This patch should be applied to an un-modified XFree86 version 4.0.3 source tree. It is the fourth of four patches that will will convert the source tree to XFree86 version 4.1.0. To apply this patch, run the following from the directory containing your 'xc' directory: patch -p0 -E < 4.0.3-4.1.0.diff1 patch -p0 -E < 4.0.3-4.1.0.diff2 patch -p0 -E < 4.0.3-4.1.0.diff3 patch -p0 -E < 4.0.3-4.1.0.diff4 rm -f xc/programs/xieperf/images/image.012 rm -fr xc/fonts/bdf/latin2 rm -fr xc/fonts/bdf/100dpi rm -fr xc/fonts/bdf/75dpi gzip -d < 4.1.0.tgz | tar vxf - ------------------------------------------------------------------------------- Index: xc/programs/Xserver/hw/xfree86/Imakefile diff -u xc/programs/Xserver/hw/xfree86/Imakefile:3.70 xc/programs/Xserver/hw/xfree86/Imakefile:3.76 --- xc/programs/Xserver/hw/xfree86/Imakefile:3.70 Sat Oct 21 21:51:36 2000 +++ xc/programs/Xserver/hw/xfree86/Imakefile Tue May 15 14:22:20 2001 @@ -3,7 +3,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.70 2000/10/22 01:51:36 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/Imakefile,v 3.76 2001/05/15 18:22:20 paulo Exp $ #include #define IHaveSubdirs @@ -67,9 +67,7 @@ INT10DIR = int10 #endif -#if !defined(OsfArchitecture) && !defined(AmoebaArchitecture) && \ - !defined(ArcArchitecture) && !defined(Arm32Architecture) && \ - !defined(PpcArchitecture) && !defined(MipsArchitecture) +#if BuildSuperProbe SUPERPROBE = SuperProbe #endif @@ -89,15 +87,15 @@ DRIVERSDK = sdk #endif -#if !BuildServersOnly -XF86CFGDIR = xf86cfg +#if !BuildServersOnly || BuildXFree86ConfigTools +XF86CFGDIRS = xf86cfg xf86config #endif SUBDIRS = os-support common $(XAADIR) $(XF1BPPDIR) $(XF4BPPDIR) \ $(XF8_32BPPDIR) $(XF8_16BPPDIR) $(XF24_32BPPDIR) $(SHADOWFBDIR) \ drivers $(LOADERDIR) $(VGAHWDIR) $(FBDEVHWDIR) $(RAMDACDIR) \ $(RACDIR) $(I2CDIR) $(DDCDIR) $(INPUTDIR) $(INT10DIR) parser \ - scanpci doc xf86config dummylib $(XF86CFGDIR) $(XF86SETUPDIR) etc \ + scanpci doc dummylib $(XF86CFGDIRS) $(XF86SETUPDIR) etc \ $(SUPERPROBE) $(DRIVERSDK) $(XF8_32WIDDIR) #if !defined(OS2Architecture) && !defined(cygwinArchitecture) @@ -196,14 +194,13 @@ InstallDriverSDKNonExecFile($(XF98CONFIG),$(DRIVERSDKDIR)) #endif -EXTRAMANCPPDEFS=-D__logdir__=$(LOGDIRECTORY) -CppManTarget(XFree86,$(EXTRAMANCPPDEFS)) -CppManTarget(XF86Config,$(EXTRAMANCPPDEFS)) +EXTRAMANDEFS=-D__logdir__=$(LOGDIRECTORY) InstallManPage(XFree86,$(MANDIR)) InstallGenManPage(XF86Config,$(FILEMANDIR),$(FILEMANSUFFIX)) InstallNamedNonExec($(XF86CONFIG),XF86Config.eg,$(LIBDIR)) InstallNamedNonExec($(XF98CONFIG),XF86Config.98,$(LIBDIR)) +InstallNamedNonExec(Options,Options,$(LIBDIR)) InstallDriverSDKNamedNonExec($(XF86CONFIG),XF86Config.eg,$(DRIVERSDKDIR)) Index: xc/programs/Xserver/hw/xfree86/Options diff -u /dev/null xc/programs/Xserver/hw/xfree86/Options:1.1.2.2 --- /dev/null Mon Jun 4 12:40:20 2001 +++ xc/programs/Xserver/hw/xfree86/Options Thu May 31 22:24:16 2001 @@ -0,0 +1,208 @@ +!! +!! Copyright (c) 2001 by The XFree86 Project, Inc. +!! +!! 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. +!! +!! $XFree86: xc/programs/Xserver/hw/xfree86/Options,v 1.1.2.2 2001/06/01 02:24:16 dawes Exp $ + +!! XAA options +xaa.XaaNoCPUToScreenColorExpandFill:\ +Disables accelerated rectangular expansion blits from source patterns \ +stored in system memory (using a memory-mapped aperture). + +xaa.XaaNoColor8x8PatternFillRect:\ +Disables accelerated fills of a rectangular region with a full-color pattern. + +xaa.XaaNoColor8x8PatternFillTrap:\ +Disables accelerated fills of a trapezoidal region with a full-color pattern. + +xaa.XaaNoDashedBresenhamLine:\ +Disables accelerated dashed Bresenham line draws. + +xaa.XaaNoDashedTwoPointLine:\ +Disables accelerated dashed line draws between two arbitrary points. + +xaa.XaaNoImageWriteRect:\ +Disables acclerated transfers of full-color rectangular patterns from \ +system memory to video memory (using a memory-mapped aperture). + +xaa.XaaNoMono8x8PatternFillRect:\ +Disables accelerated fills of a rectangular region with a monochrome pattern. + +xaa.XaaNoMono8x8PatternFillTrap:\ +Disables accelerated fills of a trapezoidal region with a monochrome pattern. + +xaa.XaaNoOffscreenPixmaps:\ +Disables accelerated draws into pixmaps stored in offscreen video memory. + +xaa.XaaNoPixmapCache:\ +Disables caching of patterns in offscreen video memory. + +xaa.XaaNoScanlineCPUToScreenColorExpandFill:\ +Disables accelerated rectangular expansion blits from source patterns \ +stored in system memory (one scan line at a time). + +xaa.XaaNoScanlineImageWriteRect:\ +Disables acclerated transfers of full-color rectangular patterns from \ +system memory to video memory (one scan line at a time). + +xaa.XaaNoScreenToScreenColorExpandFill:\ +Disables accelerated rectangular expansion blits from source patterns \ +stored in offscreen video memory. + +xaa.XaaNoScreenToScreenCopy:\ +Disables accelerated copies of rectangular regions from one part of video \ +memory to another part of video memory. + +xaa.XaaNoSolidBresenhamLine:\ +Disables accelerated solid Bresenham line draws. + +xaa.XaaNoSolidFillRect:\ +Disables accelerated solid-color fills of rectangles. + +xaa.XaaNoSolidFillTrap:\ +Disables accelerated solid-color fills of Bresenham trapezoids. + +xaa.XaaNoSolidHorVertLine:\ +Disables accelerated solid horizontal and vertical line draws. + +xaa.XaaNoSolidTwoPointLine:\ +Disables accelerated solid line draws between two arbitrary points. + + +!! FBDev options +fbdev.fbdev:\ +The framebuffer device to use. \ +Default: /dev/fb0. + +fbdev.ShadowFB:\ +Enable or disable use of the shadow framebuffer layer. \ +Default: on. + + +!! MGA options +mga.ColorKey:\ +Set the colormap index used for the transparency key for the depth 8 plane \ +when operating in 8+24 overlay mode. The value must be in the range 2-255. \ +Default: 255. + +mga.HWcursor:\ +Enable or disable the HW cursor. Default: on. + +mga.MGASDRAM:\ +Specify whether G100, G200 or G400 cards have SDRAM. The driver attempts to \ +auto-detect this based on the card's PCI subsystem ID. This option may be \ +used to override that auto-detection. The mga driver is not able to \ +auto-detect the presence of of SDRAM on secondary heads in multihead \ +configurations so this option will often need to be specified in multihead \ +configurations. Default: autodetected. + +mga.NoAccel:\ +Disable or enable acceleration. Default: acceleration is enabled. + +mga.OverclockMem:\ +Set clocks to values used by some commercial X-Servers (G100, G200 and \ +G400 only). Default: off. + +mga.Overlay:\ +Enable 8+24 overlay mode. Only appropriate for depth 24. (Note: the G100 is \ +unaccelerated in the 8+24 overlay mode due to a missing hardware feature). \ +Default: off. + +mga.PciRetry:\ +Enable or disable PCI retries. Default: off. + +mga.Rotate:\ +Rotate the display clockwise or counterclockwise. This mode is unaccelerated. \ +Default: no rotation. + +mga.ShadowFB:\ +Enable or disable use of the shadow framebuffer layer. See shadowfb(4) for \ +further information. Default: off. + +mga.SyncOnGreen:\ +Enable or disable combining the sync signals with the green signal. \ +Default: off. + +mga.UseFBDev:\ +Enable or disable use of on OS-specific fb interface (and is not supported \ +on all OSs). See fbdevhw(4) for further information. Default: off. + +mga.VideoKey:\ +This sets the default pixel value for the YUV video overlay key. \ +Default: undefined. + +mga.TexturedVideo:\ +This has XvImage support use the texture engine rather than the video \ +overlay. This option is only supported by the G200 and G400, and only in \ +16 and 32 bits per pixel. Default: off. + + +!! R128 options + +r128.SWcursor: \ +Selects software cursor. \ +Default: off. + +r128.NoAccel:\ +Enables or disables all hardware acceleration. \ +Default: on. + +r128.Dac6Bit:\ +Enables or disables the use of 6 bits per color component when in 8 bpp \ +mode (emulates VGA mode). \ +Default: off. + +r128.VideoKey:\ +This overrides the default pixel value for the YUV video overlay key. \ +Default: undefined. + +r128.Display:\ +Select display mode for devices which support flat panels. Supported\ +modes are "FP", "CRT", "Mirror", "BIOS". \ +Default: "FP". + +r128.ProgramFPRegs:\ +Enable or disable programming of the flat panel registers.\ +Beware that this may damage your panel, so use at your own risk. \ +Default: device dependant. + +r128.PanelWidth:\ +Override flat panel width in pixels. \ +Default: determined using BIOS. + +r128.PanelHeight:\ +Override flat panel height in pixels. \ +Default: determined using BIOS. + +r128.UseFBDev:\ +Enable or disable use of on OS-specific fb interface (and is not supported \ +on all OSs). See fbdevhw(4) for further information. Default: off. + + +!! Vesa options +vesa.ShadowFB:\ +Enable or disable use of the shadow framebuffer layer. See shadowfb(4)\ +for further information. Default: on. + Index: xc/programs/Xserver/hw/xfree86/Registry diff -u xc/programs/Xserver/hw/xfree86/Registry:1.16 xc/programs/Xserver/hw/xfree86/Registry:1.17 --- xc/programs/Xserver/hw/xfree86/Registry:1.16 Sat Sep 25 10:36:55 1999 +++ xc/programs/Xserver/hw/xfree86/Registry Thu Apr 5 15:29:41 2001 @@ -29,6 +29,7 @@ type1 vga vgahw +vmware xaa xf1bpp xf4bpp @@ -52,6 +53,7 @@ tseng vga vgahw +vmware xaa xf1bpp xf4bpp @@ -318,4 +320,4 @@ -$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.16 1999/09/25 14:36:55 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/Registry,v 1.17 2001/04/05 19:29:41 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/XF86Config.cpp diff -u xc/programs/Xserver/hw/xfree86/XF86Config.cpp:1.13.2.2 xc/programs/Xserver/hw/xfree86/XF86Config.cpp:removed --- xc/programs/Xserver/hw/xfree86/XF86Config.cpp:1.13.2.2 Thu Mar 15 18:35:36 2001 +++ xc/programs/Xserver/hw/xfree86/XF86Config.cpp Mon Jun 4 12:40:20 2001 @@ -1,1612 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.cpp,v 1.13.2.2 2001/03/15 23:35:36 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH XF86Config __filemansuffix__ "Version 4.0.3" "XFree86" -.SH NAME -XF86Config - Configuration File for XFree86 -.SH DESCRIPTION -.I XFree86 -uses a configuration file called -.B XF86Config -for its initial setup. This configuration file is searched for in the -following places when the server is started as a normal user: -.PP -.RS 4 -.nf -.RI /etc/X11/ -.RI __projectroot__/etc/X11/ -.RB /etc/X11/ $XF86CONFIG -.RB __projectroot__/etc/X11/ $XF86CONFIG -/etc/X11/XF86Config-4 -/etc/X11/XF86Config -/etc/XF86Config -.RI __projectroot__/etc/X11/XF86Config. -__projectroot__/etc/X11/XF86Config-4 -__projectroot__/etc/X11/XF86Config -.RI __projectroot__/lib/X11/XF86Config. -__projectroot__/lib/X11/XF86Config-4 -__projectroot__/lib/X11/XF86Config -.fi -.RE -.PP -where -.I -is a relative path (with no ".." components) specified with the -.B \-xf86config -command line option, -.B $XF86CONFIG -is the relative path (with no ".." components) specified by that -environment variable, and -.I -is the machines hostname as reported by gethostname(3). -.PP -When the X server is started by the "root" user, the config file search -locations are as follows: -.PP -.RS 4 -.nf -.I -.RI /etc/X11/ -.RI __projectroot__/etc/X11/ -.B $XF86CONFIG -.RB /etc/X11/ $XF86CONFIG -.RB __projectroot__/etc/X11/ $XF86CONFIG -.BR $HOME /XF86Config -/etc/X11/XF86Config-4 -/etc/X11/XF86Config -/etc/XF86Config -.RI __projectroot__/etc/X11/XF86Config. -__projectroot__/etc/X11/XF86Config-4 -__projectroot__/etc/X11/XF86Config -.RI __projectroot__/lib/X11/XF86Config. -__projectroot__/lib/X11/XF86Config-4 -__projectroot__/lib/X11/XF86Config -.fi -.RE -.PP -where -.I -is the path specified with the -.B \-xf86config -command line option (which may be absolute or relative), -.B $XF86CONFIG -is the path specified by that -environment variable (absolute or relative), -.B $HOME -is the path specified by that environment variable (usually the home -directory), and -.I -is the machines hostname as reported by gethostname(3). -.PP -The -.B XF86Config -file is composed of a number of sections which may be present in any -order. Each section has -the form: -.PP -.RS 4 -.nf -.\" Some man macros don't handle quotes in .BI, etc very well -.\" \fBSection "\fP\fISectionName\fP\fB"\fP -.BI "Section \*q" SectionName \*q -.RI " " SectionEntry - ... -.B EndSection -.fi -.RE -.PP -The section names are: -.PP -.RS 4 -.nf -.BR "Files " "File pathnames" -.BR "ServerFlags " "Server flags" -.BR "Module " "Dynamic module loading" -.BR "InputDevice " "Input device description" -.BR "Device " "Graphics device description" -.BR "VideoAdaptor " "Xv video adaptor description" -.BR "Monitor " "Monitor description" -.BR "Modes " "Video modes descriptions" -.BR "Screen " "Screen configuration" -.BR "ServerLayout " "Overall layout" -.BR "DRI " "DRI-specific configuration" -.BR "Vendor " "Vendor-specific configuration" -.fi -.RE -.PP -The following obsolete section names are still recognised for compatibility -purposes. In new config files, the -.B InputDevice -section should be used instead. -.PP -.RS 4 -.nf -.BR "Keyboard " "Keyboard configuration" -.BR "Pointer " "Pointer/mouse configuration" -.fi -.RE -.PP -The old -.B XInput -section is no longer recognised. -.PP -The -.B ServerLayout -sections are at the highest level. They bind together the input and -output devices that will be used in a session. The input devices -are described in the -.B InputDevice -sections. Output devices usually consist of multiple independent -components (e.g., and graphics board and a monitor). These multiple -components are bound together in the -.B Screen -sections, and it is these that are referenced by the -.B ServerLayout -section. Each -.B Screen -section binds together a graphics board and a monitor. The graphics -boards are described in the -.B Device -sections, and the monitors are described in the -.B Monitor -sections. -.PP -Config file keywords are case-insensitive, and "_" characters are -ignored. Most strings (including -.B Option -names) are also case-insensitive, and insensitive to white space and -"_" characters. -.PP -Each config file entry usually take up a single line in the file. -They consist of a keyword, which is possibly followed by one or -more arguments, with the number and types of the arguments depending -on the keyword. The argument types are: -.PP -.RS 4 -.nf -.BR "Integer " "an integer number in decimal, hex or octal" -.BR "Real " "a floating point number" -.BR "String " "a string enclosed in double quote marks (\*q)" -.fi -.RE -.PP -Note: hex integer values must be prefixed with "0x", and octal values -with "0". -.PP -A special keyword called -.B Option -may be used to provide free-form data to various components of the server. -The -.B Option -keyword takes either one or two string arguments. The first is the option -name, and the optional second argument is the option value. Some commonly -used option value types include: -.PP -.RS 4 -.nf -.BR "Integer " "an integer number in decimal, hex or octal" -.BR "Real " "a floating point number" -.BR "String " "a sequence of characters" -.BR "Boolean " "a boolean value (see below)" -.BR "Frequency " "a frequency value (see below)" -.fi -.RE -.PP -Note that -.I all -.B Option -values, not just strings, must be enclosed in quotes. -.PP -Boolean options may optionally have a value specified. When no value -is specified, the option's value is -.BR TRUE . -The following boolean option values are recognised as -.BR TRUE : -.PP -.RS 4 -.BR 1 , -.BR on , -.BR true , -.B yes -.RE -.PP -and the following boolean option values are recognised as -.BR FALSE : -.PP -.RS 4 -.BR 0 , -.BR off , -.BR false , -.B no -.RE -.PP -If an option name is prefixed with -.RB \*q No \*q, -then the option value is negated. -.PP -Example: the following option entries are equivalent: -.PP -.RS 4 -.nf -.B "Option \*qAccel\*q \*qOff\*q" -.B "Option \*qNoAccel\*q" -.B "Option \*qNoAccel\*q \*qOn\*q" -.B "Option \*qAccel\*q \*qfalse\*q" -.B "Option \*qAccel\*q \*qno\*q" -.fi -.RE -.PP -Frequency option values consist of a real number that is optionally -followed by one of the following frequency units: -.PP -.RS 4 -.BR Hz , -.BR k , -.BR kHz , -.BR M , -.B MHz -.RE -.PP -When the unit name is omitted, the correct units will be determined from -the value and the expectations of the appropriate range of the value. -It is recommended that the units always be specified when using frequency -option values to avoid any errors in determining the value. -.SH FILES SECTION -The -.B Files -section is used to specify some path names required by the server. -Some of these paths can also be set from the command line (see -.I Xserver(1) -and -.IR XFree86(1) ). -The command line settings override the values specified in the config -file. -The entries that can appear in this section are: -.TP 7 -.BI "FontPath \*q" path \*q -sets the search path for fonts. This path is a comma separated -list of font path elements which the X server searches for font databases. -Multiple -.B FontPath -entries may be specified, and they will be -concatenated to build up the fontpath used by the server. -Font path elements may be either absolute directory paths, or -a font server identifier. Font server identifiers have the form: -.PP -.RS 11 -.IR / : -.RE -.PP -.RS 7 -where -.I -is the transport type to use to connect to the font server (e.g., -.B unix -for UNIX-domain sockets or -.B tcp -for a TCP/IP connection), -.I -is the hostname of the machine running the font server, and -.I -is the port number that the font server is listening on (usually 7100). -.PP -When this entry is not specified in the config file, the server falls back -to the compiled-in default font path, which contains the following -font path elements: -.PP -.RS 4 -.nf -__projectroot__/lib/X11/fonts/misc/ -__projectroot__/lib/X11/fonts/Speedo/ -__projectroot__/lib/X11/fonts/Type1/ -__projectroot__/lib/X11/fonts/CID/ -__projectroot__/lib/X11/fonts/75dpi/ -__projectroot__/lib/X11/fonts/100dpi/ -.fi -.RE -.PP -The recommended font path contains the following font path elements: -.PP -.RS 4 -.nf -__projectroot__/lib/X11/fonts/local/ -__projectroot__/lib/X11/fonts/misc/ -__projectroot__/lib/X11/fonts/75dpi/:unscaled -__projectroot__/lib/X11/fonts/100dpi/:unscaled -__projectroot__/lib/X11/fonts/Type1/ -__projectroot__/lib/X11/fonts/CID/ -__projectroot__/lib/X11/fonts/Speedo/ -__projectroot__/lib/X11/fonts/75dpi/ -__projectroot__/lib/X11/fonts/100dpi/ -.fi -.RE -.PP -Font path elements that are found to be invalid are removed from the -font path when the server starts up. -.RE -.TP 7 -.BI "RGBPath \*q" path \*q -sets the path name for the RGB color database. -When this entry is not specified in the config file, the server falls back -to the compiled-in default RGB path, which is: -.PP -.RS 11 -__projectroot__/lib/X11/rgb -.RE -.TP 7 -.BI "ModulePath \*q" path \*q -sets the search path for loadable X server modules. This path is a -comma separated list of directories which the X server searches for -loadable modules loading in the order specified. Multiple -.B ModulePath -entries may be specified, and they will be concatenated to build the -module search path used by the server. -.\" The LogFile keyword is not currently implemented -.ig -.TP 7 -.BI "LogFile \*q" path \*q -sets the name of the X server log file. The default log file name is -.PP -.RS 11 -.RI __logdir__/XFree86. .log -.RE -.PP -.RS 7 -where -.I -is the display number for the X server. -.. -.SH SERVERFLAGS SECTION -The -.B ServerFlags -section is used to specify some global -X server options. All of the entries in this section are -.BR Options , -although for compatibility purposes some of the old style entries are -still recognised. Those old style entries are not documented here, and -using them is discouraged. -.PP -.B Options -specified in this section may be overridden by -.B Options -specified in the active -.B ServerLayout -section. Options with command line equivalents are overridden when their -command line equivalent is used. The options recognised by this section -are: -.TP 7 -.BI "Option \*qNoTrapSignals\*q \*q" boolean \*q -This prevents the X server from trapping a range of unexpected -fatal signals and exiting cleanly. Instead, the X server will die -and drop core where the fault occurred. The default behaviour is -for the X server exit cleanly, but still drop a core file. In -general you never want to use this option unless you are debugging -an X server problem and know how to deal with the consequences. -.TP 7 -.BI "Option \*qDontZap\*q \*q" boolean \*q -This disallows the use of the -.B Ctrl+Alt+Backspace -sequence. That sequence is normally used to terminate the X server. -When this option is enabled, that key sequence has no special meaning -and is passed to clients. Default: off. -.TP 7 -.BI "Option \*qDontZoom\*q \*q" boolean \*q -This disallows the use of the -.B Ctrl+Alt+Keypad-Plus -and -.B Ctrl+Alt+Keypad-Minus -sequences. These sequences allows you to switch between video modes. -When this option is enabled, those key sequences have no special meaning -and are passed to clients. Default: off. -.TP 7 -.BI "Option \*qDisableVidModeExtension\*q \*q" boolean \*q -This disables the parts of the VidMode extension used by the xvidtune client -that can be used to change the video modes. Default: the VidMode extension -is enabled. -.TP 7 -.BI "Option \*qAllowNonLocalXvidtune\*q \*q" boolean \*q -This allows the xvidtune client (and other clients that use the VidMode -extension) to connect from another host. Default: off. -.TP 7 -.BI "Option \*qDisableModInDev\*q \*q" boolean \*q -This disables the parts of the XFree86-Misc extension that can be used to -modify the input device settings dynamically. Default: that functionality -is enabled. -.TP 7 -.BI "Option \*qAllowNonLocalModInDev\*q \*q" boolean \*q -This allows a client to connect from another host and change keyboard -and mouse settings in the running server. Default: off. -.TP 7 -.BI "Option \*qAllowMouseOpenFail\*q \*q" boolean \*q -This allows the server to start up even if the mouse device can't be -opened/initialised. Default: false. -.TP 7 -.BI "Option \*qVTInit\*q \*q" command \*q -Runs -.I command -after the VT used by the server has been opened. -The command string is passed to "/bin/sh -c", and is run with the -real user's id with stdin and stdout set to the VT. The purpose -of this option is to allow system dependent VT initialisation -commands to be run. This option should rarely be needed. Default: not set. -.TP 7 -.BI "Option \*qVTSysReq\*q \*q" boolean \*q -enables the SYSV-style VT switch sequence for non-SYSV systems -which support VT switching. This sequence is -.B Alt-SysRq -followed -by a function key -.RB ( Fn ). -This prevents the X server trapping the -keys used for the default VT switch sequence, which means that clients can -access them. Default: off. -.\" The following four options are "undocumented". -.ig -.TP 7 -.BI "Option \*qPciProbe1\*q" -Use PCI probe method 1. Default: set. -.TP 7 -.BI "Option \*qPciProbe2\*q" -Use PCI probe method 2. Default: not set. -.TP 7 -.BI "Option \*qPciForceConfig1\*q" -Force the use PCI config type 1. Default: not set. -.TP 7 -.BI "Option \*qPciForceConfig2\*q" -Force the use PCI config type 2. Default: not set. -.. -.TP 7 -.BI "Option \*qBlankTime\*q \*q" time \*q -sets the inactivity timeout for the blanking phase of the screensaver. -.I time -is in minutes. This is equivalent to the Xserver's `-s' flag, and the -value can be changed at run-time with \fIxset(1)\fP. Default: 10 minutes. -.TP 7 -.BI "Option \*qStandbyTime\*q \*q" time \*q -sets the inactivity timeout for the "standby" phase of DPMS mode. -.I time -is in minutes, and the value can be changed at run-time with \fIxset(1)\fP. -Default: 20 minutes. -This is only suitable for VESA DPMS compatible monitors, and may not be -supported by all video drivers. It is only enabled for screens that -have the -.B \*qDPMS\*q -option set (see the MONITOR section below). -.TP 7 -.BI "Option \*qSuspendTime\*q \*q" time \*q -sets the inactivity timeout for the "suspend" phase of DPMS mode. -.I time -is in minutes, and the value can be changed at run-time with \fIxset(1)\fP. -Default: 30 minutes. -This is only suitable for VESA DPMS compatible monitors, and may not be -supported by all video drivers. It is only enabled for screens that -have the -.B \*qDPMS\*q -option set (see the MONITOR section below). -.TP 7 -.BI "Option \*qOffTime\*q \*q" time \*q -sets the inactivity timeout for the "off" phase of DPMS mode. -.I time -is in minutes, and the value can be changed at run-time with \fIxset(1)\fP. -Default: 40 minutes. -This is only suitable for VESA DPMS compatible monitors, and may not be -supported by all video drivers. It is only enabled for screens that -have the -.B \*qDPMS\*q -option set (see the MONITOR section below). -.TP 7 -.BI "Option \*qPixmap\*q \*q" bpp \*q -This sets the pixmap format to use for depth 24. Allowed values for -.I bpp -are 24 and 32. Default: 32 unless driver constraints don't allow this -(which is rare). Note: some clients don't behave well when -this value is set to 24. -.TP 7 -.BI "Option \*qPC98\*q \*q" boolean \*q -Specify that the machine is a Japanese PC-98 machine. This should not -be enabled for anything other than the Japanese-specific PC-98 -architecture. Default: auto-detected. -.\" Doubt this should be documented. -.ig -.TP 7 -.BI "Option \*qEstimateSizesAggressively\*q \*q" value \*q -This option affects the way that bus resource sizes are estimated. Default: 0. -.. -.TP 7 -.BI "Option \*qNoPM\*q \*q" boolean \*q -Disables something to do with power management events. Default: PM enabled -on platforms that support it. -.TP 7 -.BI "Option \*qXinerama\*q \*q" boolean \*q -enable or disable XINERAMA extension. Default is disabled. -.SH MODULE SECTION -The -.B Module -section is used to specify which X server modules should be loaded. -This section is ignored when the X server is built in static form. -The types of modules normally loaded in this section are X server -extension modules, and font rasteriser modules. Most other module types -are loaded automatically when they are needed via other mechanisms. -.PP -Entries in this section may be in two forms. The first and most commonly -used form is an entry that uses the -.B Load -keyword, as described here: -.TP 7 -.BI "Load \*q" modulename \*q -This instructs the server to load the module called -.IR modulename . -The module name given should be the module's standard name, not the -module file name. The standard name is case-sensitive, and does not -include the "lib" prefix, or the ".a", ".o", or ".so" suffixes. -.PP -.RS 7 -Example: the Type 1 font rasteriser can be loaded with the following entry: -.PP -.RS 4 -.B "Load \*qtype1\*q" -.RE -.RE -.PP -The second form of entry is a -.BR SubSection, -with the subsection name being the module name, and the contents of the -.B SubSection -being -.B Options -that are passed to the module when it is loaded. -.PP -Example: the extmod module (which contains a miscellaneous group of -server extensions) can be loaded, with the XFree86-DGA extension -disabled by using the following entry: -.PP -.RS 4 -.nf -.B "SubSection \*qextmod\*q" -.B " Option \*qomit XFree86-DGA\*q" -.B EndSubSection -.fi -.RE -.PP -Modules are searched for in each directory specified in the -.B ModulePath -search path, and in the drivers, input, extensions, fonts, and -internal subdirectories of each of those directories. -In addition to this, operating system specific subdirectories of all -the above are searched first if they exist. -.PP -To see what font and extension modules are available, check the contents -of the following directories: -.PP -.RS 4 -.nf -__projectroot__/lib/modules/fonts -__projectroot__/lib/modules/extensions -.fi -.RE -.PP -The "bitmap" font modules is loaded automatically. It is recommended -that at very least the "extmod" extension module be loaded. If it isn't -some commonly used server extensions (like the SHAPE extension) will not be -available. -.SH INPUTDEVICE SECTION -The config file may have multiple -.B InputDevice -sections. There will normally be at least two: one for the core (primary) -keyboard, and one of the core pointer. -.PP -.B InputDevice -sections have the following format: -.PP -.RS 4 -.nf -.B "Section \*qInputDevice\*q" -.BI " Identifier \*q" name \*q -.BI " Driver \*q" inputdriver \*q -.I " options" -.I " ..." -.B "EndSection" -.fi -.RE -.PP -The -.B Identifier -entry specifies the unique name for this input device. The -.B Driver -entry specifies the name of the driver to use for this input device. -When using the loadable server, the input driver module -.RI \*q inputdriver \*q -will be loaded for each active -.B InputDevice -section. An -.B InputDevice -section is considered active if it is referenced by an active -.B ServerLayout -section, or if it is referenced by the -.B \-keyboard -or -.B \-pointer -command line options. -The most commonly used input drivers are "keyboard" and "mouse". -.PP -.B InputDevice -sections recognise some driver-independent -.BR Options , -which are described here. See the individual input driver manual pages -for a description of the device-specific options. -.TP 7 -.BI "Option \*qCorePointer\*q" -When this is set, the input device is installed as the core (primary) -pointer device. There must be exactly one core pointer. If this option -is not set here, or in the -.B ServerLayout -section, or from the -.B \-pointer -command line option, then the first input device that is capable of -being used as a core pointer will be selected as the core pointer. -This option is implicitly set when the obsolete -.B Pointer -section is used. -.TP 7 -.BI "Option \*qCoreKeyboard\*q" -When this is set, the input device is to be installed as the core -(primary) keyboard device. There must be exactly one core keyboard. If -this option is not set here, in the -.B ServerLayout -section, or from the -.B \-keyboard -command line option, then the first input device that is capable of -being used as a core keyboard will be selected as the core keyboard. -This option is implicitly set when the obsolete -.B Keyboard -section is used. -.TP 7 -.BI "Option \*qAlwaysCore\*q \*q" boolean \*q -.TP 7 -.BI "Option \*qSendCoreEvents\*q \*q" boolean \*q -Both of these options are equivalent, and when enabled cause the -input device to always report core events. This can be used, for -example, to allow an additional pointer device to generate core -pointer events (like moving the cursor, etc). -.TP 4 -.BI "Option \*qHistorySize\*q \*q" number \*q -Sets the motion history size. Default: 0. -.TP 7 -.BI "Option \*qSendDragEvents\*q \*q" boolean \*q -??? -.SH DEVICE SECTION -The config file may have multiple -.B Device -sections. There must be at least one, for the video card being used. -.PP -.B Device -sections have the following format: -.PP -.RS 4 -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" name \*q -.BI " Driver \*q" driver \*q -.I " entries" -.I " ..." -.B "EndSection" -.fi -.RE -.PP -The -.B Identifier -entry specifies the unique name for this graphics device. The -.B Driver -entry specifies the name of the driver to use for this graphics device. -When using the loadable server, the driver module -.RI \*q driver \*q -will be loaded for each active -.B Device -section. A -.B Device -section is considered active if it is referenced by an active -.B Screen -section. -.PP -.B Device -sections recognise some driver-independent entries and -.BR Options , -which are described here. Not all drivers make use of these -driver-independent entries, and many of those that do don't require them -to be specified because the information is auto-detected. See the -individual graphics driver manual pages for further information about -this, and for a description of the device-specific options. -Note that most of the -.B Options -listed here (but not the other entries) may be specified in the -.B Screen -section instead of here in the -.B Device -section. -.TP 7 -.BI "BusID \*q" bus-id \*q -This specifies the bus location of the graphics card. For PCI/AGP cards, -the -.I bus-id -string has the form -.BI PCI: bus : device : function -(e.g., "PCI:1:0:0" might be appropriate for an AGP card). -This field is usually optional in single-head configurations when using -the primary graphics card. In multi-head configurations, or when using -a secondary graphics card in a single-head configuration, this entry is -mandatory. Its main purpose is to make an unambiguous connection between -the device section and the hardware it is representing. This information -can usually be found by running the X server with the -.B \-scanpci -command line option. -.TP 7 -.BI "Screen " number -This option is mandatory for cards where a single PCI entity can drive more -than one display (i.e., multiple CRTCs sharing a single graphics accelerator -and video memory). One -.B Device -section is required for each head, and this -parameter determines which head each of the -.B Device -sections applies to. The legal values of -.I number -range from 0 to one less than the total number of heads per entity. -Most drivers require that the primary screen (0) be present. -.TP 7 -.BI "Chipset \*q" chipset \*q -This usually optional entry specifies the chipset used on the graphics -board. In most cases this entry is not required because the drivers -will probe the hardware to determine the chipset type. Don't -specify it unless the driver-specific documentation recommends that you -do. -.TP 7 -.BI "Ramdac \*q" ramdac-type \*q -This optional entry specifies the type of RAMDAC used on the graphics -board. This is only used by a few of the drivers, and in most cases it -is not required because the drivers will probe the hardware to determine -the RAMDAC type where possible. Don't specify it unless the -driver-specific documentation recommends that you do. -.TP 7 -.BI "DacSpeed " speed -.TP 7 -.BI "DacSpeed " "speed-8 speed-16 speed-24 speed-32" -This optional entry specifies the RAMDAC speed rating (which is usually -printed on the RAMDAC chip). The speed is in MHz. When one value is -given, it applies to all framebuffer pixel sizes. When multiple values -are give, they apply to the framebuffer pixel sizes 8, 16, 24 and 32 -respectively. This is not used by many drivers, and only needs to be -specified when the speed rating of the RAMDAC is different from the -defaults built in to driver, or when the driver can't auto-detect the -correct defaults. Don't specify it unless the driver-specific -documentation recommends that you do. -.TP 7 -.BI "Clocks " "clock ..." -specifies the pixel that are on your graphics board. The clocks are in -MHz, and may be specified as a floating point number. The value is -stored internally to the nearest kHz. The ordering of the clocks is -important. It must match the order in which they are selected on the -graphics board. Multiple -.B Clocks -lines may be specified, and each is concatenated to form the list. Most -drivers do not use this entry, and it is only required for some older -boards with non-programmable clocks. Don't specify this entry unless -the driver-specific documentation explicitly recommends that you do. -.TP -.BI "ClockChip \*q" clockchip-type \*q -This optional entry is used to specify the clock chip type on -graphics boards which have a programmable clock generator. Only -a few X servers support programmable clock chips. For details, -see the appropriate X server manual page. -.TP 7 -.BI "VideoRam " "mem" -This optional entry specifies the amount of video ram that is installed -on the graphics board. This is measured in kBytes. In most cases this -is not required because the X server probes the graphics board to -determine this quantity. The driver-specific documentation should -indicate when it might be needed. -.TP 7 -.BI "BiosBase " "baseaddress" -This optional entry specifies the base address of the video BIOS -for the VGA board. This address is normally auto-detected, and should -only be specified if the driver-specific documentation recommends it. -.TP 7 -.BI "MemBase " "baseaddress" -This optional entry specifies the memory base address of a graphics -board's linear frame buffer. This entry is not used by many drivers, -and it should only be specified if the driver-specific documentation -recommends it. -.TP 7 -.BI "IOBase " "baseaddress" -This optional entry specifies the IO base address. This entry is not -used by many drivers, and it should only be specified if the -driver-specific documentation recommends it. -.TP 7 -.BI "ChipID " "id" -This optional entry specifies a numerical ID representing the chip type. -For PCI cards, it is usually the device ID. This can be used to override -the auto-detection, but that should only be done when the driver-specific -documentation recommends it. -.TP 7 -.BI "ChipRev " "rev" -This optional entry specifies the chip revision number. This can be -used to override the auto-detection, but that should only be done when -the driver-specific documentation recommends it. -.TP 7 -.BI "TextClockFreq " "freq" -This optional entry specifies the pixel clock frequency that is used -for the regular text mode. The frequency is specified in MHz. This is -rarely used. -.ig -.TP 7 -This optional entry allows an IRQ number to be specified. -.. -.TP 7 -.B Options -Option flags may be specified in the -.B Device -sections. These include driver-specific options and driver-independent -options. The former are described in the driver-specific documentation. -Some of the latter are described below in the section about the -.B Screen -section, and they may also be included here. - -.SH VIDEOADAPTOR SECTION -Nobody wants to say how this works. Maybe nobody knows ... - -.SH MONITOR SECTION -The config file may have multiple -.B Monitor -sections. There must be at least one, for the monitor being used. -.PP -.B Monitor -sections have the following format: -.PP -.RS 4 -.nf -.B "Section \*qMonitor\*q" -.BI " Identifier \*q" name \*q -.I " entries" -.I " ..." -.B "EndSection" -.fi -.RE -.PP -The -.B Identifier -entry specifies the unique name for this monitor. The -.B Monitor -section provides information about the specifications of the monitor, -monitor-specific -.BR Options , -and information about the video modes to use with the monitor. Specifying -video modes is optional because the server now has a built-in list of -VESA standard modes. When modes are specified explicitly in the -.B Monitor -section (with the -.BR Modes , -.BR ModeLine , -or -.B UseModes -keywords), built-in modes with the same names are not included. Built-in -modes with different names are, however, still implicitly included. -.PP -The entries that may be used in -.B Monitor -sections are described below. -.TP 7 -.BI "VendorName \*q" vendor \*q -This optional entry specifies the monitor's manufacturer. -.TP 7 -.BI "ModelName \*q" model \*q -This optional entry specifies the monitor's model. -.TP 7 -.BI "HorizSync " "horizsync-range" -gives the range(s) of horizontal sync frequencies supported by the -monitor. -.I horizsync-range -may be a comma separated list of either discrete values or ranges of -values. A range of values is two values separated by a dash. By default -the values are in units of kHz. They may be specified in MHz or Hz if -.B MHz -or -.B Hz -is added to the end of the line. The data given here is used by the X -server to determine if video modes are within the specifications of the -monitor. This information should be available in the monitor's handbook. -If this entry is omitted, a default range of 28\-33kHz is used. -.TP 7 -.BI "VertRefresh " "vertrefresh-range" -gives the range(s) of vertical refresh frequencies supported by the -monitor. -.I vertrefresh-range -may be a comma separated list of either discrete values or ranges of -values. A range of values is two values separated by a dash. By default -the values are in units of Hz. They may be specified in MHz or kHz if -.B MHz -or -.B kHz -is added to the end of the line. The data given here is used by the X -server to determine if video modes are within the specifications of the -monitor. This information should be available in the monitor's handbook. -If this entry is omitted, a default range of 43-72Hz is used. -.TP 7 -.BI "DisplaySize " "width height" -This optional entry gives the width and height, in millimetres, of the -picture area of the monitor. If given this is used to calculate the -horizontal and vertical pitch (DPI) of the screen. -.TP 7 -.BI "Gamma " "gamma-value" -.TP 7 -.BI "Gamma " "red-gamma green-gamma blue-gamma" -This is an optional entry that can be used to specify the gamma -correction for the monitor. It may be specified as either a single -value or as three separate RGB values. The values should be in the range -0.1 to 10.0, and the default is 1.0. Not all drivers are capable -of using this information. -.TP 7 -.BI "UseModes \*q" modesection-id \*q -Include the set of modes listed in the -.B Modes -section called -.IR modesection-id. -This make all of the modes defined in that section available for use -by this monitor. -.TP 7 -.B Mode \fI"name"\fP -This is an optional multi-line entry that can be used to provide -definitions for video modes for the monitor. In most cases this isn't -necessary because the built-in set of VESA standard modes will be -sufficient. The -.B Mode -keyword indicates the start of a multi-line video mode description. -The mode description is terminated with the -.B EndMode -keyword. The mode description consists of the following entries: -.RS 7 -.TP 4 -.BI "DotClock " clock -is the dot (pixel) clock rate to be used for the mode. -.TP 4 -.BI "HTimings " "hdisp hsyncstart hsyncend htotal" -specifies the horizontal timings for the mode. -.TP 4 -.BI "VTimings " "vdisp vsyncstart vsyncend vtotal" -specifies the vertical timings for the mode. -.TP 4 -.BI "Flags \*q" flag \*q " ..." -specifies an optional set of mode flags, each of which is a separate -string in double quotes. -.B \*qInterlace\*q -indicates that the mode is interlaced. -.B \*qDoubleScan\*q -indicates a mode where each scanline is doubled. -.B \*q+HSync\*q -and -.B \*q\-HSync\*q -can be used to select the polarity of the HSync signal. -.B \*q+VSync\*q -and -.B \*q\-VSync\*q -can be used to select the polarity of the VSync signal. -.B \*qComposite\*q -can be used to specify composite sync on hardware where this is supported. -Additionally, on some hardware, -.B \*q+CSync\*q -and -.B \*q\-CSync\*q -may be used to select the composite sync polarity. -.TP 4 -.BI "HSkew " hskew -specifies the number of pixels (towards the right edge of the screen) -by which the display enable signal is to be skewed. Not all drivers -use this information. This option might become necessary to override -the default value supplied by the server (if any). "Roving" horizontal -lines indicate this value needs to be increased. If the last few pixels -on a scan line appear on the left of the screen, this value should be -decreased. -.TP 4 -.BI "VScan " vscan -specifies the number of times each scanline is painted on the screen. -Not all drivers use this information. Values less than 1 are treated -as 1, which is the default. Generally, the -.B \*qDoubleScan\*q -.B Flag -mentioned above doubles this value. -.RE -.TP 7 -.BI "ModeLine \*q" name \*q " mode-description" -This entry is a more compact version of the -.B Mode -entry, and it also can be used to specify video modes for the monitor. -is a single line format for specifying video modes. In most cases this -isn't necessary because the built-in set of VESA standard modes will be -sufficient. -.PP -.RS 7 -The -.I mode-description -is in four sections, the first three of which are mandatory. The first -is the dot (pixel) clock. This is a single number specifying the pixel -clock rate for the mode in MHz. The second section is a list of four -numbers specifying the horizontal timings. These numbers are the -.IR hdisp , -.IR hsyncstart , -.IR hsyncend , -and -.I htotal -values. The third section is a list of four numbers specifying the -vertical timings. These numbers are the -.IR vdisp , -.IR vsyncstart , -.IR vsyncend , -and -.I vtotal -values. The final section is a list of flags specifying other -characteristics of the mode. -.B Interlace -indicates that the mode is interlaced. -.B DoubleScan -indicates a mode where each scanline is doubled. -.B +HSync -and -.B \-HSync -can be used to select the polarity of the HSync signal. -.B +VSync -and -.B \-VSync -can be used to select the polarity of the VSync signal. -.B Composite -can be used to specify composite sync on hardware where this is supported. -Additionally, on some hardware, -.B +CSync -and -.B \-CSync -may be used to select the composite sync polarity. The -.B HSkew -and -.B VScan -options mentioned above in the -.B Modes -entry description can also be used here. -.RE -.TP 7 -.B Options -Some -.B Option -flags that may be useful to include in -.B Monitor -sections (when needed) include -.BR \*qDPMS\*q , -and -.BR \*qSyncOnGreen\*q . - -.SH MODES SECTION -The config file may have multiple -.B Modes -sections, or none. These sections provide a way of defining sets of -video modes independently of the -.B Monitor -sections. -.B Monitor -sections may include the definitions provided in these sections by -using the -.B UseModes -keyword. In most cases the -.B Modes -sections are not necessary because the built-in set of VESA standard modes -will be sufficient. -.PP -.B Modes -sections have the following format: -.PP -.RS 4 -.nf -.B "Section \*qModes\*q" -.BI " Identifier \*q" name \*q -.I " entries" -.I " ..." -.B "EndSection" -.fi -.RE -.PP -The -.B Identifier -entry specifies the unique name for this set of mode descriptions. -The other entries permitted in -.B Modes -sections are the -.B Mode -and -.B ModeLine -entries that are described above in the -.B Monitor -section. -.SH SCREEN SECTION -The config file may have multiple -.B Screen -sections. There must be at least one, for the "screen" being used. -A "screen" represents the binding of a graphics device -.RB ( Device -section) and a monitor -.RB ( Monitor -section). A -.B Screen -section is considered "active" if it is referenced by an active -.B ServerLayout -section or by the -.B \-screen -command line option. If neither of those is present, the first -.B Screen -section found in the config file is considered the active one. -.PP -.B Screen -sections have the following format: -.PP -.RS 4 -.nf -.B "Section \*qScreen\*q" -.BI " Identifier \*q" name \*q -.BI " Device \*q" devid \*q -.BI " Monitor \*q" monid \*q -.I " entries" -.I " ..." -.BI " SubSection \*qDisplay\*q" -.I " entries" -.I " ... -.B " EndSubSection" -.I " ..." -.B "EndSection" -.fi -.RE -.PP -The -.B Identifier -entry specifies the unique name for this screen. The -.B Screen -section provides information specific to the whole screen, including -screen-specific -.BR Options . -In multi-head configurations, there will be multiple active -.B Screen -sections, one for each head. -The entries available -for this section are: -.TP 7 -.BI "Device \*q" device-id \*q -This specifies the -.B Device -section to be used for this screen. This is what ties a specific -graphics card to a screen. The -.I device-id -must match the -.B Identifier -of a -.B Device -section in the config file. -.TP 7 -.BI "Monitor \*q" monitor-id \*q -specifies which monitor description is to be used for this screen. -.TP 7 -.BI "VideoAdaptor \*q" xv-id \*q -specifies an optional Xv video adaptor description to be used with this -screen. -.TP 7 -.BI "DefaultDepth " depth -specifies which color depth the server should use by default. The -.B \-depth -command line option can be used to override this. If neither is specified, -the default depth is driver-specific, but in most cases is 8. -.TP 7 -.BI "DefaultFbBpp " bpp -specifies which framebuffer layout to use by default. The -.B \-fbbpp -command line option can be used to override this. In most cases the -driver will chose the best default value for this. The only case where -there is even a choice in this value is for depth 24, where some hardware -supports both a packed 24 bit framebuffer layout and a sparse 32 bit -framebuffer layout. -.TP 7 -.B Options -Various -.B Option -flags may be specified in the -.B Screen -section. Some are driver-specific and are described in the driver -documentation. Others are driver-independent, and will eventually be -described here. -.PP -Each -.B Screen -section must contain one or more -.B Display -subsections. Those subsections provide depth/fbbpp specific configuration -information, and the one chosen depends on the depth and/or fbbpp that -is being used for the screen. The -.B Display -subsection format is described in the section below. - -.SH DISPLAY SUBSECTION -Each -.B Screen -section may have multiple -.B Display -subsections. There must be at least one, which matches the depth -and/or fbbpp values that are being used for the screen. The "active" -.B Display -subsection is the first that matches the depth and/or fbbpp values being -used. -.PP -.B Display -subsections have the following format: -.PP -.RS 4 -.nf -.B " SubSection \*qDisplay\*q" -.BI " Depth " depth -.I " entries" -.I " ..." -.B " EndSubSection" -.fi -.RE -.PP -.TP 7 -.BI "Depth " depth -This entry specifies what colour depth the -.B Display -subsection is to be used for. This entry is usually mandatory, -but it may be omitted in some cases providing an -.B FbBpp -entry is present. The range of -.I depth -values that are allowed depends on the driver. Most driver support -8, 15, 16 and 24. Some also support 1 and/or 4, and some may support -other values (like 30). Note: -.I depth -means the number of bits in a pixel that are actually used to determine -the pixel colour. 32 is not a valid -.I depth -value. Most hardware that uses 32 bits per pixel only uses 24 of them -to hold the colour information, which means that the colour depth is -24, not 32. -.TP 7 -.BI "FbBpp " bpp -This entry specifies the framebuffer format this -.B Display -subsection is to be used for. This entry is only needed when providing -depth 24 configurations that allow a choice between a 24 bpp packed -framebuffer format and a 32bpp sparse framebuffer format. In most cases -this entry should not be used. -.TP 7 -.BI "Weight " "red-weight green-weight blue-weight" -This optional entry specifies the relative RGB weighting to be used -for a screen is being used at depth 16 for drivers that allow multiple -formats. This may also be specified from the command line with the -.B \-weight -option (see -.IR XFree86(1) ). -.TP 7 -.BI "Virtual " "xdim ydim" -This optional entry specifies the virtual screen resolution to be used. -.I xdim -must be a multiple of either 8 or 16 for most drivers, and a multiple -of 32 when running in monochrome mode. The given value will be rounded -down if this is not the case. Video modes which are too large for the -specified virtual size will be rejected. If this entry is not present, -the virtual screen resolution will be set to accommodate all the valid -video modes given in the -.B Modes -entry. Some drivers/hardware combinations do not support virtual screens. -Refer to the appropriate driver-specific documentation for details. -.TP 7 -.BI "ViewPort " "x0 y0" -This optional entry sets the upper left corner of the initial display. -This is only relevant when the virtual screen resolution is different -from the resolution of the initial video mode. If this entry is not -given, then the initial display will be centered in the virtual display -area. -.TP 7 -.BI "Modes \*q" mode-name \*q " ..." -This entry is highly desirable for most drivers, and it specifies the list -of video modes to use. Each -.I mode-name -specified must be in double quotes. They must correspond to those -specified or referenced in the appropriate -.B Monitor -section (including implicitly referenced built-in VESA standard modes). -The server will delete modes from this list which don't satisfy various -requirements. The first valid mode in this list will be the default -display mode for startup. The list of valid modes is converted internally -into a circular list. It is possible to switch to the next mode with -.B Ctrl+Alt+Keypad-Plus -and to the previous mode with -.BR Ctrl+Alt+Keypad-Minus . -When this entry is omitted, the largest valid mode referenced by the -appropriate -.B Monitor -section will be used. -.TP 7 -.BI "Visual \*q" visual-name \*q -This optional entry sets the default root visual type. This may also -be specified from the command line (see the -.I Xserver(1) -man page). The visual types available for depth 8 are (default is -.BR PseudoColor ): -.PP -.RS 11 -.nf -.B StaticGray -.B GrayScale -.B StaticColor -.B PseudoColor -.B TrueColor -.B DirectColor -.fi -.RE -.PP -.RS 7 -The visual type available for the depths 15, 16 and 24 are (default is -.BR TrueColor ): -.PP -.RS 4 -.nf -.B TrueColor -.B DirectColor -.fi -.RE -.PP -Not all drivers support -.B DirectColor -at these depths. -.PP -The visual types available for the depth 4 are (default is -.BR StaticColor ): -.PP -.RS 4 -.nf -.B StaticGray -.B GrayScale -.B StaticColor -.B PseudoColor -.fi -.RE -.PP -The visual type available for the depth 1 (monochrome) is -.BR StaticGray . -.RE -.TP 7 -.BI "Black " "red green blue" -This optional entry allows the "black" colour to be specified. This -.TP 7 -.BI "White " "red green blue" -This optional entry allows the "white" colour to be specified. This -is only supported at depth 1. The default is white. -.TP 7 -.B Options -Option flags may be specified in the -.B Display -subsections. These may include driver-specific options and -driver-independent options. The former are described in the -driver-specific documentation. Some of the latter are described above -in the section about the -.B Screen -section, and they may also be included here. -.SH SERVERLAYOUT SECTION -The config file may have multiple -.B ServerLayout -sections. -A "server layout" represents the binding of one or more screens -.RB ( Screen -sections) and one or more input devices -.RB ( InputDevice -sections) to form a complete configuration. In multi-head configurations, -it also specifies the relative layout of the heads. A -.B ServerLayout -section is considered "active" if it is referenced by the -.B \-layout -command line option. If that option is not used, the first -.B ServerLayout -section found in the config file is considered the active one. If no -.B ServerLayout -sections are present, the single active screen and two active (core) -input devices are selected as described in the relevant sections above. -.PP -.B ServerLayout -sections have the following format: -.PP -.RS 4 -.nf -.B "Section \*qServerLayout\*q" -.BI " Identifier \*q" name \*q -.BI " Screen \*q" screen-id \*q -.I " ..." -.BI " InputDevice \*q" idev-id \*q -.I " ..." -.I " options" -.I " ..." -.B "EndSection" -.fi -.RE -.PP -The -.B Identifier -entry specifies the unique name for this server layout. The -.B ServerLayout -section provides information specific to the whole session, including -session-specific -.BR Options . -The -.B ServerFlags -options (described above) may be specified here, and ones given here -override those given in the -.B ServerFlags -section. -.PP -The entries that may be used in this section are described here. -.TP 7 -.BI "Screen " "screen-num" " \*qscreen-id\*q " "position-information" -One of these entries must be given for each screen being used in -a session. The -.I screen-id -field is mandatory, and specifies the -.B Screen -section being referenced. The -.I screen-num -field is optional, and may be used to specify the screen number -in multi-head configurations. When this field is omitted, the -screens will be numbered in the order that they are listed in. -The numbering starts from 0, and must be consecutive. The -.I position-information -field describes the way multiple screens are positioned. There are -a number of different ways that this information can be provided: -.RS 7 -.TP 4 -.BI "Absolute " "x y" -This says that the upper left corner's coordinates are -.RI ( x , y ). -If the coordinates are omitted or if no positioning information -is given, (0,0) is assumed. -.TP 4 -.BI "RightOf \*q" screen-id \*q -.TP 4 -.BI "LeftOf \*q" screen-id \*q -.TP 4 -.BI "Above \*q" screen-id \*q -.TP 4 -.BI "Below \*q" screen-id \*q -.TP 4 -.BI "Relative \*q" screen-id \*q " x y" -These give the screen's location relative to another screen. -.RE -.TP 7 -.BI "InputDevice \*q" idev-id "\*q \*q" option \*q " ..." -One of these entries must be given for each input device being used in -a session. Normally at least two are required, one each for the core -pointer and keyboard devices. The -.I idev-id -field is mandatory, and specifies the name of the -.B InputDevice -section being referenced. Multiple -.I option -fields may be specified, each in double quotes. The options permitted -here are any that may also be given in the -.B InputDevice -sections. Normally only session-specific input device options would -be used here. The most commonly used options are: -.PP -.RS 11 -.nf -.B \*qCorePointer\*q -.B \*qCoreKeyboard\*q -.B \*qSendCoreEvents\*q -.fi -.RE -.PP -.RS 7 -and the first two should normally be used to indicate the core pointer -and core keyboard devices respectively. -.RE -.TP 7 -.B Options -Any option permitted in the -.B ServerFlags -section may also be specified here. When the same option appears in both -places, the value given here overrides the one given in the -.B ServerFlags -section. -.PP -Here is an example of a -.B ServerLayout -section for a dual headed configuration with two mice: -.PP -.RS 4 -.nf -.B "Section \*qServerLayout\*q" -.B " Identifier \*qLayout 1\*q" -.B " Screen \*qMGA 1\*q" -.B " Screen \*qMGA 2\*q RightOf \*qMGA 1\*q" -.B " InputDevice \*qKeyboard 1\*q \*qCoreKeyboard\*q" -.B " InputDevice \*qMouse 1\*q \*qCorePointer\*q" -.B " InputDevice \*qMouse 2\*q \*qSendCoreEvents\*q" -.B " Option \*qBlankTime\*q \*q5\*q" -.B "EndSection" -.fi -.RE -.SH DRI SECTION -This optional section is used to provide some information for the -Direct Rendering Infrastructure. Details about the format of this section -can be found in the README.DRI document, which is also available on-line -at -.IR . -.SH VENDOR SECTION -The optional -.B Vendor -section may be used to provide vendor-specific configuration information. -Multiple -.B Vendor -sections may be present, and they may contain an -.B Identifier -entry and multiple -.B Option -flags. The data therein is not used in this release. -.PP -.SH FILES -For an example of an XF86Config file, see the file installed as -__projectroot__/lib/X11/XF86Config.eg. -.fi -.SH "SEE ALSO" -X(__miscmansuffix__), Xserver(1), XFree86(1), -apm(__drivermansuffix__), -ati(__drivermansuffix__), -chips(__drivermansuffix__), -cirrus(__drivermansuffix__), -cyrix(__drivermansuffix__), -fbdev(__drivermansuffix__), -glide(__drivermansuffix__), -glint(__drivermansuffix__), -i128(__drivermansuffix__), -i740(__drivermansuffix__), -i810(__drivermansuffix__), -imstt(__drivermansuffix__), -mga(__drivermansuffix__), -neomagic(__drivermansuffix__), -nv(__drivermansuffix__), -r128(__drivermansuffix__), -rendition(__drivermansuffix__), -s3virge(__drivermansuffix__), -siliconmotion(__drivermansuffix__), -sis(__drivermansuffix__), -sunbw2(__drivermansuffix__), -suncg14(__drivermansuffix__), -suncg3(__drivermansuffix__), -suncg6(__drivermansuffix__), -sunffb(__drivermansuffix__), -sunleo(__drivermansuffix__), -suntcx(__drivermansuffix__), -tdfx(__drivermansuffix__), -tga(__drivermansuffix__), -trident(__drivermansuffix__), -tseng(__drivermansuffix__), -v4l(__drivermansuffix__), -vesa(__drivermansuffix__), -vga(__drivermansuffix__), -.br -README -.IR , -.br -RELNOTES -.IR , -.br -README.mouse -.IR , -.br -README.DRI -.IR , -.br -Status -.IR , -.br -Install -.IR . -.SH AUTHORS -This manual page was largely rewritten for XFree86 4.0 by David Dawes -.IR . Index: xc/programs/Xserver/hw/xfree86/XF86Config.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/XF86Config.man:1.5 --- /dev/null Mon Jun 4 12:40:20 2001 +++ xc/programs/Xserver/hw/xfree86/XF86Config.man Tue May 8 17:53:08 2001 @@ -0,0 +1,1689 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Config.man,v 1.5 2001/05/08 21:53:08 paulo Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH XF86Config __filemansuffix__ __vendorversion__ +.SH NAME +XF86Config - Configuration File for XFree86 +.SH DESCRIPTION +.I XFree86 +uses a configuration file called +.B XF86Config +for its initial setup. This configuration file is searched for in the +following places when the server is started as a normal user: +.PP +.RS 4 +.nf +.RI /etc/X11/ +.RI __projectroot__/etc/X11/ +.RB /etc/X11/ $XF86CONFIG +.RB __projectroot__/etc/X11/ $XF86CONFIG +/etc/X11/XF86Config-4 +/etc/X11/XF86Config +/etc/XF86Config +.RI __projectroot__/etc/X11/XF86Config. +__projectroot__/etc/X11/XF86Config-4 +__projectroot__/etc/X11/XF86Config +.RI __projectroot__/lib/X11/XF86Config. +__projectroot__/lib/X11/XF86Config-4 +__projectroot__/lib/X11/XF86Config +.fi +.RE +.PP +where +.I +is a relative path (with no ".." components) specified with the +.B \-xf86config +command line option, +.B $XF86CONFIG +is the relative path (with no ".." components) specified by that +environment variable, and +.I +is the machines hostname as reported by gethostname(3). +.PP +When the X server is started by the "root" user, the config file search +locations are as follows: +.PP +.RS 4 +.nf +.I +.RI /etc/X11/ +.RI __projectroot__/etc/X11/ +.B $XF86CONFIG +.RB /etc/X11/ $XF86CONFIG +.RB __projectroot__/etc/X11/ $XF86CONFIG +.BR $HOME /XF86Config +/etc/X11/XF86Config-4 +/etc/X11/XF86Config +/etc/XF86Config +.RI __projectroot__/etc/X11/XF86Config. +__projectroot__/etc/X11/XF86Config-4 +__projectroot__/etc/X11/XF86Config +.RI __projectroot__/lib/X11/XF86Config. +__projectroot__/lib/X11/XF86Config-4 +__projectroot__/lib/X11/XF86Config +.fi +.RE +.PP +where +.I +is the path specified with the +.B \-xf86config +command line option (which may be absolute or relative), +.B $XF86CONFIG +is the path specified by that +environment variable (absolute or relative), +.B $HOME +is the path specified by that environment variable (usually the home +directory), and +.I +is the machines hostname as reported by gethostname(3). +.PP +The +.B XF86Config +file is composed of a number of sections which may be present in any +order. Each section has +the form: +.PP +.RS 4 +.nf +.\" Some man macros don't handle quotes in .BI, etc very well +.\" \fBSection "\fP\fISectionName\fP\fB"\fP +.BI "Section \*q" SectionName \*q +.RI " " SectionEntry + ... +.B EndSection +.fi +.RE +.PP +The section names are: +.PP +.RS 4 +.nf +.BR "Files " "File pathnames" +.BR "ServerFlags " "Server flags" +.BR "Module " "Dynamic module loading" +.BR "InputDevice " "Input device description" +.BR "Device " "Graphics device description" +.BR "VideoAdaptor " "Xv video adaptor description" +.BR "Monitor " "Monitor description" +.BR "Modes " "Video modes descriptions" +.BR "Screen " "Screen configuration" +.BR "ServerLayout " "Overall layout" +.BR "DRI " "DRI-specific configuration" +.BR "Vendor " "Vendor-specific configuration" +.fi +.RE +.PP +The following obsolete section names are still recognised for compatibility +purposes. In new config files, the +.B InputDevice +section should be used instead. +.PP +.RS 4 +.nf +.BR "Keyboard " "Keyboard configuration" +.BR "Pointer " "Pointer/mouse configuration" +.fi +.RE +.PP +The old +.B XInput +section is no longer recognised. +.PP +The +.B ServerLayout +sections are at the highest level. They bind together the input and +output devices that will be used in a session. The input devices +are described in the +.B InputDevice +sections. Output devices usually consist of multiple independent +components (e.g., and graphics board and a monitor). These multiple +components are bound together in the +.B Screen +sections, and it is these that are referenced by the +.B ServerLayout +section. Each +.B Screen +section binds together a graphics board and a monitor. The graphics +boards are described in the +.B Device +sections, and the monitors are described in the +.B Monitor +sections. +.PP +Config file keywords are case-insensitive, and "_" characters are +ignored. Most strings (including +.B Option +names) are also case-insensitive, and insensitive to white space and +"_" characters. +.PP +Each config file entry usually take up a single line in the file. +They consist of a keyword, which is possibly followed by one or +more arguments, with the number and types of the arguments depending +on the keyword. The argument types are: +.PP +.RS 4 +.nf +.BR "Integer " "an integer number in decimal, hex or octal" +.BR "Real " "a floating point number" +.BR "String " "a string enclosed in double quote marks (\*q)" +.fi +.RE +.PP +Note: hex integer values must be prefixed with "0x", and octal values +with "0". +.PP +A special keyword called +.B Option +may be used to provide free-form data to various components of the server. +The +.B Option +keyword takes either one or two string arguments. The first is the option +name, and the optional second argument is the option value. Some commonly +used option value types include: +.PP +.RS 4 +.nf +.BR "Integer " "an integer number in decimal, hex or octal" +.BR "Real " "a floating point number" +.BR "String " "a sequence of characters" +.BR "Boolean " "a boolean value (see below)" +.BR "Frequency " "a frequency value (see below)" +.fi +.RE +.PP +Note that +.I all +.B Option +values, not just strings, must be enclosed in quotes. +.PP +Boolean options may optionally have a value specified. When no value +is specified, the option's value is +.BR TRUE . +The following boolean option values are recognised as +.BR TRUE : +.PP +.RS 4 +.BR 1 , +.BR on , +.BR true , +.B yes +.RE +.PP +and the following boolean option values are recognised as +.BR FALSE : +.PP +.RS 4 +.BR 0 , +.BR off , +.BR false , +.B no +.RE +.PP +If an option name is prefixed with +.RB \*q No \*q, +then the option value is negated. +.PP +Example: the following option entries are equivalent: +.PP +.RS 4 +.nf +.B "Option \*qAccel\*q \*qOff\*q" +.B "Option \*qNoAccel\*q" +.B "Option \*qNoAccel\*q \*qOn\*q" +.B "Option \*qAccel\*q \*qfalse\*q" +.B "Option \*qAccel\*q \*qno\*q" +.fi +.RE +.PP +Frequency option values consist of a real number that is optionally +followed by one of the following frequency units: +.PP +.RS 4 +.BR Hz , +.BR k , +.BR kHz , +.BR M , +.B MHz +.RE +.PP +When the unit name is omitted, the correct units will be determined from +the value and the expectations of the appropriate range of the value. +It is recommended that the units always be specified when using frequency +option values to avoid any errors in determining the value. +.SH FILES SECTION +The +.B Files +section is used to specify some path names required by the server. +Some of these paths can also be set from the command line (see +.I Xserver(1) +and +.IR XFree86(1) ). +The command line settings override the values specified in the config +file. +The entries that can appear in this section are: +.TP 7 +.BI "FontPath \*q" path \*q +sets the search path for fonts. This path is a comma separated +list of font path elements which the X server searches for font databases. +Multiple +.B FontPath +entries may be specified, and they will be +concatenated to build up the fontpath used by the server. +Font path elements may be either absolute directory paths, or +a font server identifier. Font server identifiers have the form: +.PP +.RS 11 +.IR / : +.RE +.PP +.RS 7 +where +.I +is the transport type to use to connect to the font server (e.g., +.B unix +for UNIX-domain sockets or +.B tcp +for a TCP/IP connection), +.I +is the hostname of the machine running the font server, and +.I +is the port number that the font server is listening on (usually 7100). +.PP +When this entry is not specified in the config file, the server falls back +to the compiled-in default font path, which contains the following +font path elements: +.PP +.RS 4 +.nf +__projectroot__/lib/X11/fonts/misc/ +__projectroot__/lib/X11/fonts/Speedo/ +__projectroot__/lib/X11/fonts/Type1/ +__projectroot__/lib/X11/fonts/CID/ +__projectroot__/lib/X11/fonts/75dpi/ +__projectroot__/lib/X11/fonts/100dpi/ +.fi +.RE +.PP +The recommended font path contains the following font path elements: +.PP +.RS 4 +.nf +__projectroot__/lib/X11/fonts/local/ +__projectroot__/lib/X11/fonts/misc/ +__projectroot__/lib/X11/fonts/75dpi/:unscaled +__projectroot__/lib/X11/fonts/100dpi/:unscaled +__projectroot__/lib/X11/fonts/Type1/ +__projectroot__/lib/X11/fonts/CID/ +__projectroot__/lib/X11/fonts/Speedo/ +__projectroot__/lib/X11/fonts/75dpi/ +__projectroot__/lib/X11/fonts/100dpi/ +.fi +.RE +.PP +Font path elements that are found to be invalid are removed from the +font path when the server starts up. +.RE +.TP 7 +.BI "RGBPath \*q" path \*q +sets the path name for the RGB color database. +When this entry is not specified in the config file, the server falls back +to the compiled-in default RGB path, which is: +.PP +.RS 11 +__projectroot__/lib/X11/rgb +.RE +.TP 7 +.BI "ModulePath \*q" path \*q +sets the search path for loadable X server modules. This path is a +comma separated list of directories which the X server searches for +loadable modules loading in the order specified. Multiple +.B ModulePath +entries may be specified, and they will be concatenated to build the +module search path used by the server. +.\" The LogFile keyword is not currently implemented +.ig +.TP 7 +.BI "LogFile \*q" path \*q +sets the name of the X server log file. The default log file name is +.PP +.RS 11 +.RI __logdir__/XFree86. .log +.RE +.PP +.RS 7 +where +.I +is the display number for the X server. +.. +.SH SERVERFLAGS SECTION +The +.B ServerFlags +section is used to specify some global +X server options. All of the entries in this section are +.BR Options , +although for compatibility purposes some of the old style entries are +still recognised. Those old style entries are not documented here, and +using them is discouraged. +.PP +.B Options +specified in this section may be overridden by +.B Options +specified in the active +.B ServerLayout +section. Options with command line equivalents are overridden when their +command line equivalent is used. The options recognised by this section +are: +.TP 7 +.BI "Option \*qNoTrapSignals\*q \*q" boolean \*q +This prevents the X server from trapping a range of unexpected +fatal signals and exiting cleanly. Instead, the X server will die +and drop core where the fault occurred. The default behaviour is +for the X server exit cleanly, but still drop a core file. In +general you never want to use this option unless you are debugging +an X server problem and know how to deal with the consequences. +.TP 7 +.BI "Option \*qDontZap\*q \*q" boolean \*q +This disallows the use of the +.B Ctrl+Alt+Backspace +sequence. That sequence is normally used to terminate the X server. +When this option is enabled, that key sequence has no special meaning +and is passed to clients. Default: off. +.TP 7 +.BI "Option \*qDontZoom\*q \*q" boolean \*q +This disallows the use of the +.B Ctrl+Alt+Keypad-Plus +and +.B Ctrl+Alt+Keypad-Minus +sequences. These sequences allows you to switch between video modes. +When this option is enabled, those key sequences have no special meaning +and are passed to clients. Default: off. +.TP 7 +.BI "Option \*qDisableVidModeExtension\*q \*q" boolean \*q +This disables the parts of the VidMode extension used by the xvidtune client +that can be used to change the video modes. Default: the VidMode extension +is enabled. +.TP 7 +.BI "Option \*qAllowNonLocalXvidtune\*q \*q" boolean \*q +This allows the xvidtune client (and other clients that use the VidMode +extension) to connect from another host. Default: off. +.TP 7 +.BI "Option \*qDisableModInDev\*q \*q" boolean \*q +This disables the parts of the XFree86-Misc extension that can be used to +modify the input device settings dynamically. Default: that functionality +is enabled. +.TP 7 +.BI "Option \*qAllowNonLocalModInDev\*q \*q" boolean \*q +This allows a client to connect from another host and change keyboard +and mouse settings in the running server. Default: off. +.TP 7 +.BI "Option \*qAllowMouseOpenFail\*q \*q" boolean \*q +This allows the server to start up even if the mouse device can't be +opened/initialised. Default: false. +.TP 7 +.BI "Option \*qVTInit\*q \*q" command \*q +Runs +.I command +after the VT used by the server has been opened. +The command string is passed to "/bin/sh -c", and is run with the +real user's id with stdin and stdout set to the VT. The purpose +of this option is to allow system dependent VT initialisation +commands to be run. This option should rarely be needed. Default: not set. +.TP 7 +.BI "Option \*qVTSysReq\*q \*q" boolean \*q +enables the SYSV-style VT switch sequence for non-SYSV systems +which support VT switching. This sequence is +.B Alt-SysRq +followed +by a function key +.RB ( Fn ). +This prevents the X server trapping the +keys used for the default VT switch sequence, which means that clients can +access them. Default: off. +.\" The following four options are "undocumented". +.ig +.TP 7 +.BI "Option \*qPciProbe1\*q" +Use PCI probe method 1. Default: set. +.TP 7 +.BI "Option \*qPciProbe2\*q" +Use PCI probe method 2. Default: not set. +.TP 7 +.BI "Option \*qPciForceConfig1\*q" +Force the use PCI config type 1. Default: not set. +.TP 7 +.BI "Option \*qPciForceConfig2\*q" +Force the use PCI config type 2. Default: not set. +.. +.TP 7 +.BI "Option \*qBlankTime\*q \*q" time \*q +sets the inactivity timeout for the blanking phase of the screensaver. +.I time +is in minutes. This is equivalent to the Xserver's `-s' flag, and the +value can be changed at run-time with \fIxset(1)\fP. Default: 10 minutes. +.TP 7 +.BI "Option \*qStandbyTime\*q \*q" time \*q +sets the inactivity timeout for the "standby" phase of DPMS mode. +.I time +is in minutes, and the value can be changed at run-time with \fIxset(1)\fP. +Default: 20 minutes. +This is only suitable for VESA DPMS compatible monitors, and may not be +supported by all video drivers. It is only enabled for screens that +have the +.B \*qDPMS\*q +option set (see the MONITOR section below). +.TP 7 +.BI "Option \*qSuspendTime\*q \*q" time \*q +sets the inactivity timeout for the "suspend" phase of DPMS mode. +.I time +is in minutes, and the value can be changed at run-time with \fIxset(1)\fP. +Default: 30 minutes. +This is only suitable for VESA DPMS compatible monitors, and may not be +supported by all video drivers. It is only enabled for screens that +have the +.B \*qDPMS\*q +option set (see the MONITOR section below). +.TP 7 +.BI "Option \*qOffTime\*q \*q" time \*q +sets the inactivity timeout for the "off" phase of DPMS mode. +.I time +is in minutes, and the value can be changed at run-time with \fIxset(1)\fP. +Default: 40 minutes. +This is only suitable for VESA DPMS compatible monitors, and may not be +supported by all video drivers. It is only enabled for screens that +have the +.B \*qDPMS\*q +option set (see the MONITOR section below). +.TP 7 +.BI "Option \*qPixmap\*q \*q" bpp \*q +This sets the pixmap format to use for depth 24. Allowed values for +.I bpp +are 24 and 32. Default: 32 unless driver constraints don't allow this +(which is rare). Note: some clients don't behave well when +this value is set to 24. +.TP 7 +.BI "Option \*qPC98\*q \*q" boolean \*q +Specify that the machine is a Japanese PC-98 machine. This should not +be enabled for anything other than the Japanese-specific PC-98 +architecture. Default: auto-detected. +.\" Doubt this should be documented. +.ig +.TP 7 +.BI "Option \*qEstimateSizesAggressively\*q \*q" value \*q +This option affects the way that bus resource sizes are estimated. Default: 0. +.. +.TP 7 +.BI "Option \*qNoPM\*q \*q" boolean \*q +Disables something to do with power management events. Default: PM enabled +on platforms that support it. +.TP 7 +.BI "Option \*qXinerama\*q \*q" boolean \*q +enable or disable XINERAMA extension. Default is disabled. +.SH MODULE SECTION +The +.B Module +section is used to specify which X server modules should be loaded. +This section is ignored when the X server is built in static form. +The types of modules normally loaded in this section are X server +extension modules, and font rasteriser modules. Most other module types +are loaded automatically when they are needed via other mechanisms. +.PP +Entries in this section may be in two forms. The first and most commonly +used form is an entry that uses the +.B Load +keyword, as described here: +.TP 7 +.BI "Load \*q" modulename \*q +This instructs the server to load the module called +.IR modulename . +The module name given should be the module's standard name, not the +module file name. The standard name is case-sensitive, and does not +include the "lib" prefix, or the ".a", ".o", or ".so" suffixes. +.PP +.RS 7 +Example: the Type 1 font rasteriser can be loaded with the following entry: +.PP +.RS 4 +.B "Load \*qtype1\*q" +.RE +.RE +.PP +The second form of entry is a +.BR SubSection, +with the subsection name being the module name, and the contents of the +.B SubSection +being +.B Options +that are passed to the module when it is loaded. +.PP +Example: the extmod module (which contains a miscellaneous group of +server extensions) can be loaded, with the XFree86-DGA extension +disabled by using the following entry: +.PP +.RS 4 +.nf +.B "SubSection \*qextmod\*q" +.B " Option \*qomit XFree86-DGA\*q" +.B EndSubSection +.fi +.RE +.PP +Modules are searched for in each directory specified in the +.B ModulePath +search path, and in the drivers, input, extensions, fonts, and +internal subdirectories of each of those directories. +In addition to this, operating system specific subdirectories of all +the above are searched first if they exist. +.PP +To see what font and extension modules are available, check the contents +of the following directories: +.PP +.RS 4 +.nf +__projectroot__/lib/modules/fonts +__projectroot__/lib/modules/extensions +.fi +.RE +.PP +The "bitmap" font modules is loaded automatically. It is recommended +that at very least the "extmod" extension module be loaded. If it isn't +some commonly used server extensions (like the SHAPE extension) will not be +available. +.SH INPUTDEVICE SECTION +The config file may have multiple +.B InputDevice +sections. There will normally be at least two: one for the core (primary) +keyboard, and one of the core pointer. +.PP +.B InputDevice +sections have the following format: +.PP +.RS 4 +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" name \*q +.BI " Driver \*q" inputdriver \*q +.I " options" +.I " ..." +.B "EndSection" +.fi +.RE +.PP +The +.B Identifier +entry specifies the unique name for this input device. The +.B Driver +entry specifies the name of the driver to use for this input device. +When using the loadable server, the input driver module +.RI \*q inputdriver \*q +will be loaded for each active +.B InputDevice +section. An +.B InputDevice +section is considered active if it is referenced by an active +.B ServerLayout +section, or if it is referenced by the +.B \-keyboard +or +.B \-pointer +command line options. +The most commonly used input drivers are "keyboard" and "mouse". +.PP +.B InputDevice +sections recognise some driver-independent +.BR Options , +which are described here. See the individual input driver manual pages +for a description of the device-specific options. +.TP 7 +.BI "Option \*qCorePointer\*q" +When this is set, the input device is installed as the core (primary) +pointer device. There must be exactly one core pointer. If this option +is not set here, or in the +.B ServerLayout +section, or from the +.B \-pointer +command line option, then the first input device that is capable of +being used as a core pointer will be selected as the core pointer. +This option is implicitly set when the obsolete +.B Pointer +section is used. +.TP 7 +.BI "Option \*qCoreKeyboard\*q" +When this is set, the input device is to be installed as the core +(primary) keyboard device. There must be exactly one core keyboard. If +this option is not set here, in the +.B ServerLayout +section, or from the +.B \-keyboard +command line option, then the first input device that is capable of +being used as a core keyboard will be selected as the core keyboard. +This option is implicitly set when the obsolete +.B Keyboard +section is used. +.TP 7 +.BI "Option \*qAlwaysCore\*q \*q" boolean \*q +.TP 7 +.BI "Option \*qSendCoreEvents\*q \*q" boolean \*q +Both of these options are equivalent, and when enabled cause the +input device to always report core events. This can be used, for +example, to allow an additional pointer device to generate core +pointer events (like moving the cursor, etc). +.TP 4 +.BI "Option \*qHistorySize\*q \*q" number \*q +Sets the motion history size. Default: 0. +.TP 7 +.BI "Option \*qSendDragEvents\*q \*q" boolean \*q +??? +.SH DEVICE SECTION +The config file may have multiple +.B Device +sections. There must be at least one, for the video card being used. +.PP +.B Device +sections have the following format: +.PP +.RS 4 +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" name \*q +.BI " Driver \*q" driver \*q +.I " entries" +.I " ..." +.B "EndSection" +.fi +.RE +.PP +The +.B Identifier +entry specifies the unique name for this graphics device. The +.B Driver +entry specifies the name of the driver to use for this graphics device. +When using the loadable server, the driver module +.RI \*q driver \*q +will be loaded for each active +.B Device +section. A +.B Device +section is considered active if it is referenced by an active +.B Screen +section. +.PP +.B Device +sections recognise some driver-independent entries and +.BR Options , +which are described here. Not all drivers make use of these +driver-independent entries, and many of those that do don't require them +to be specified because the information is auto-detected. See the +individual graphics driver manual pages for further information about +this, and for a description of the device-specific options. +Note that most of the +.B Options +listed here (but not the other entries) may be specified in the +.B Screen +section instead of here in the +.B Device +section. +.TP 7 +.BI "BusID \*q" bus-id \*q +This specifies the bus location of the graphics card. For PCI/AGP cards, +the +.I bus-id +string has the form +.BI PCI: bus : device : function +(e.g., "PCI:1:0:0" might be appropriate for an AGP card). +This field is usually optional in single-head configurations when using +the primary graphics card. In multi-head configurations, or when using +a secondary graphics card in a single-head configuration, this entry is +mandatory. Its main purpose is to make an unambiguous connection between +the device section and the hardware it is representing. This information +can usually be found by running the X server with the +.B \-scanpci +command line option. +.TP 7 +.BI "Screen " number +This option is mandatory for cards where a single PCI entity can drive more +than one display (i.e., multiple CRTCs sharing a single graphics accelerator +and video memory). One +.B Device +section is required for each head, and this +parameter determines which head each of the +.B Device +sections applies to. The legal values of +.I number +range from 0 to one less than the total number of heads per entity. +Most drivers require that the primary screen (0) be present. +.TP 7 +.BI "Chipset \*q" chipset \*q +This usually optional entry specifies the chipset used on the graphics +board. In most cases this entry is not required because the drivers +will probe the hardware to determine the chipset type. Don't +specify it unless the driver-specific documentation recommends that you +do. +.TP 7 +.BI "Ramdac \*q" ramdac-type \*q +This optional entry specifies the type of RAMDAC used on the graphics +board. This is only used by a few of the drivers, and in most cases it +is not required because the drivers will probe the hardware to determine +the RAMDAC type where possible. Don't specify it unless the +driver-specific documentation recommends that you do. +.TP 7 +.BI "DacSpeed " speed +.TP 7 +.BI "DacSpeed " "speed-8 speed-16 speed-24 speed-32" +This optional entry specifies the RAMDAC speed rating (which is usually +printed on the RAMDAC chip). The speed is in MHz. When one value is +given, it applies to all framebuffer pixel sizes. When multiple values +are give, they apply to the framebuffer pixel sizes 8, 16, 24 and 32 +respectively. This is not used by many drivers, and only needs to be +specified when the speed rating of the RAMDAC is different from the +defaults built in to driver, or when the driver can't auto-detect the +correct defaults. Don't specify it unless the driver-specific +documentation recommends that you do. +.TP 7 +.BI "Clocks " "clock ..." +specifies the pixel that are on your graphics board. The clocks are in +MHz, and may be specified as a floating point number. The value is +stored internally to the nearest kHz. The ordering of the clocks is +important. It must match the order in which they are selected on the +graphics board. Multiple +.B Clocks +lines may be specified, and each is concatenated to form the list. Most +drivers do not use this entry, and it is only required for some older +boards with non-programmable clocks. Don't specify this entry unless +the driver-specific documentation explicitly recommends that you do. +.TP +.BI "ClockChip \*q" clockchip-type \*q +This optional entry is used to specify the clock chip type on +graphics boards which have a programmable clock generator. Only +a few X servers support programmable clock chips. For details, +see the appropriate X server manual page. +.TP 7 +.BI "VideoRam " "mem" +This optional entry specifies the amount of video ram that is installed +on the graphics board. This is measured in kBytes. In most cases this +is not required because the X server probes the graphics board to +determine this quantity. The driver-specific documentation should +indicate when it might be needed. +.TP 7 +.BI "BiosBase " "baseaddress" +This optional entry specifies the base address of the video BIOS +for the VGA board. This address is normally auto-detected, and should +only be specified if the driver-specific documentation recommends it. +.TP 7 +.BI "MemBase " "baseaddress" +This optional entry specifies the memory base address of a graphics +board's linear frame buffer. This entry is not used by many drivers, +and it should only be specified if the driver-specific documentation +recommends it. +.TP 7 +.BI "IOBase " "baseaddress" +This optional entry specifies the IO base address. This entry is not +used by many drivers, and it should only be specified if the +driver-specific documentation recommends it. +.TP 7 +.BI "ChipID " "id" +This optional entry specifies a numerical ID representing the chip type. +For PCI cards, it is usually the device ID. This can be used to override +the auto-detection, but that should only be done when the driver-specific +documentation recommends it. +.TP 7 +.BI "ChipRev " "rev" +This optional entry specifies the chip revision number. This can be +used to override the auto-detection, but that should only be done when +the driver-specific documentation recommends it. +.TP 7 +.BI "TextClockFreq " "freq" +This optional entry specifies the pixel clock frequency that is used +for the regular text mode. The frequency is specified in MHz. This is +rarely used. +.ig +.TP 7 +This optional entry allows an IRQ number to be specified. +.. +.TP 7 +.B Options +Option flags may be specified in the +.B Device +sections. These include driver-specific options and driver-independent +options. The former are described in the driver-specific documentation. +Some of the latter are described below in the section about the +.B Screen +section, and they may also be included here. + +.SH VIDEOADAPTOR SECTION +Nobody wants to say how this works. Maybe nobody knows ... + +.SH MONITOR SECTION +The config file may have multiple +.B Monitor +sections. There must be at least one, for the monitor being used. +.PP +.B Monitor +sections have the following format: +.PP +.RS 4 +.nf +.B "Section \*qMonitor\*q" +.BI " Identifier \*q" name \*q +.I " entries" +.I " ..." +.B "EndSection" +.fi +.RE +.PP +The +.B Identifier +entry specifies the unique name for this monitor. The +.B Monitor +section provides information about the specifications of the monitor, +monitor-specific +.BR Options , +and information about the video modes to use with the monitor. Specifying +video modes is optional because the server now has a built-in list of +VESA standard modes. When modes are specified explicitly in the +.B Monitor +section (with the +.BR Modes , +.BR ModeLine , +or +.B UseModes +keywords), built-in modes with the same names are not included. Built-in +modes with different names are, however, still implicitly included. +.PP +The entries that may be used in +.B Monitor +sections are described below. +.TP 7 +.BI "VendorName \*q" vendor \*q +This optional entry specifies the monitor's manufacturer. +.TP 7 +.BI "ModelName \*q" model \*q +This optional entry specifies the monitor's model. +.TP 7 +.BI "HorizSync " "horizsync-range" +gives the range(s) of horizontal sync frequencies supported by the +monitor. +.I horizsync-range +may be a comma separated list of either discrete values or ranges of +values. A range of values is two values separated by a dash. By default +the values are in units of kHz. They may be specified in MHz or Hz if +.B MHz +or +.B Hz +is added to the end of the line. The data given here is used by the X +server to determine if video modes are within the specifications of the +monitor. This information should be available in the monitor's handbook. +If this entry is omitted, a default range of 28\-33kHz is used. +.TP 7 +.BI "VertRefresh " "vertrefresh-range" +gives the range(s) of vertical refresh frequencies supported by the +monitor. +.I vertrefresh-range +may be a comma separated list of either discrete values or ranges of +values. A range of values is two values separated by a dash. By default +the values are in units of Hz. They may be specified in MHz or kHz if +.B MHz +or +.B kHz +is added to the end of the line. The data given here is used by the X +server to determine if video modes are within the specifications of the +monitor. This information should be available in the monitor's handbook. +If this entry is omitted, a default range of 43-72Hz is used. +.TP 7 +.BI "DisplaySize " "width height" +This optional entry gives the width and height, in millimetres, of the +picture area of the monitor. If given this is used to calculate the +horizontal and vertical pitch (DPI) of the screen. +.TP 7 +.BI "Gamma " "gamma-value" +.TP 7 +.BI "Gamma " "red-gamma green-gamma blue-gamma" +This is an optional entry that can be used to specify the gamma +correction for the monitor. It may be specified as either a single +value or as three separate RGB values. The values should be in the range +0.1 to 10.0, and the default is 1.0. Not all drivers are capable +of using this information. +.TP 7 +.BI "UseModes \*q" modesection-id \*q +Include the set of modes listed in the +.B Modes +section called +.IR modesection-id. +This make all of the modes defined in that section available for use +by this monitor. +.TP 7 +.B Mode \fI"name"\fP +This is an optional multi-line entry that can be used to provide +definitions for video modes for the monitor. In most cases this isn't +necessary because the built-in set of VESA standard modes will be +sufficient. The +.B Mode +keyword indicates the start of a multi-line video mode description. +The mode description is terminated with the +.B EndMode +keyword. The mode description consists of the following entries: +.RS 7 +.TP 4 +.BI "DotClock " clock +is the dot (pixel) clock rate to be used for the mode. +.TP 4 +.BI "HTimings " "hdisp hsyncstart hsyncend htotal" +specifies the horizontal timings for the mode. +.TP 4 +.BI "VTimings " "vdisp vsyncstart vsyncend vtotal" +specifies the vertical timings for the mode. +.TP 4 +.BI "Flags \*q" flag \*q " ..." +specifies an optional set of mode flags, each of which is a separate +string in double quotes. +.B \*qInterlace\*q +indicates that the mode is interlaced. +.B \*qDoubleScan\*q +indicates a mode where each scanline is doubled. +.B \*q+HSync\*q +and +.B \*q\-HSync\*q +can be used to select the polarity of the HSync signal. +.B \*q+VSync\*q +and +.B \*q\-VSync\*q +can be used to select the polarity of the VSync signal. +.B \*qComposite\*q +can be used to specify composite sync on hardware where this is supported. +Additionally, on some hardware, +.B \*q+CSync\*q +and +.B \*q\-CSync\*q +may be used to select the composite sync polarity. +.TP 4 +.BI "HSkew " hskew +specifies the number of pixels (towards the right edge of the screen) +by which the display enable signal is to be skewed. Not all drivers +use this information. This option might become necessary to override +the default value supplied by the server (if any). "Roving" horizontal +lines indicate this value needs to be increased. If the last few pixels +on a scan line appear on the left of the screen, this value should be +decreased. +.TP 4 +.BI "VScan " vscan +specifies the number of times each scanline is painted on the screen. +Not all drivers use this information. Values less than 1 are treated +as 1, which is the default. Generally, the +.B \*qDoubleScan\*q +.B Flag +mentioned above doubles this value. +.RE +.TP 7 +.BI "ModeLine \*q" name \*q " mode-description" +This entry is a more compact version of the +.B Mode +entry, and it also can be used to specify video modes for the monitor. +is a single line format for specifying video modes. In most cases this +isn't necessary because the built-in set of VESA standard modes will be +sufficient. +.PP +.RS 7 +The +.I mode-description +is in four sections, the first three of which are mandatory. The first +is the dot (pixel) clock. This is a single number specifying the pixel +clock rate for the mode in MHz. The second section is a list of four +numbers specifying the horizontal timings. These numbers are the +.IR hdisp , +.IR hsyncstart , +.IR hsyncend , +and +.I htotal +values. The third section is a list of four numbers specifying the +vertical timings. These numbers are the +.IR vdisp , +.IR vsyncstart , +.IR vsyncend , +and +.I vtotal +values. The final section is a list of flags specifying other +characteristics of the mode. +.B Interlace +indicates that the mode is interlaced. +.B DoubleScan +indicates a mode where each scanline is doubled. +.B +HSync +and +.B \-HSync +can be used to select the polarity of the HSync signal. +.B +VSync +and +.B \-VSync +can be used to select the polarity of the VSync signal. +.B Composite +can be used to specify composite sync on hardware where this is supported. +Additionally, on some hardware, +.B +CSync +and +.B \-CSync +may be used to select the composite sync polarity. The +.B HSkew +and +.B VScan +options mentioned above in the +.B Modes +entry description can also be used here. +.RE +.TP 7 +.B Options +Some +.B Option +flags that may be useful to include in +.B Monitor +sections (when needed) include +.BR \*qDPMS\*q , +and +.BR \*qSyncOnGreen\*q . + +.SH MODES SECTION +The config file may have multiple +.B Modes +sections, or none. These sections provide a way of defining sets of +video modes independently of the +.B Monitor +sections. +.B Monitor +sections may include the definitions provided in these sections by +using the +.B UseModes +keyword. In most cases the +.B Modes +sections are not necessary because the built-in set of VESA standard modes +will be sufficient. +.PP +.B Modes +sections have the following format: +.PP +.RS 4 +.nf +.B "Section \*qModes\*q" +.BI " Identifier \*q" name \*q +.I " entries" +.I " ..." +.B "EndSection" +.fi +.RE +.PP +The +.B Identifier +entry specifies the unique name for this set of mode descriptions. +The other entries permitted in +.B Modes +sections are the +.B Mode +and +.B ModeLine +entries that are described above in the +.B Monitor +section. +.SH SCREEN SECTION +The config file may have multiple +.B Screen +sections. There must be at least one, for the "screen" being used. +A "screen" represents the binding of a graphics device +.RB ( Device +section) and a monitor +.RB ( Monitor +section). A +.B Screen +section is considered "active" if it is referenced by an active +.B ServerLayout +section or by the +.B \-screen +command line option. If neither of those is present, the first +.B Screen +section found in the config file is considered the active one. +.PP +.B Screen +sections have the following format: +.PP +.RS 4 +.nf +.B "Section \*qScreen\*q" +.BI " Identifier \*q" name \*q +.BI " Device \*q" devid \*q +.BI " Monitor \*q" monid \*q +.I " entries" +.I " ..." +.BI " SubSection \*qDisplay\*q" +.I " entries" +.I " ... +.B " EndSubSection" +.I " ..." +.B "EndSection" +.fi +.RE +.PP +The +.B Identifier +entry specifies the unique name for this screen. The +.B Screen +section provides information specific to the whole screen, including +screen-specific +.BR Options . +In multi-head configurations, there will be multiple active +.B Screen +sections, one for each head. +The entries available +for this section are: +.TP 7 +.BI "Device \*q" device-id \*q +This specifies the +.B Device +section to be used for this screen. This is what ties a specific +graphics card to a screen. The +.I device-id +must match the +.B Identifier +of a +.B Device +section in the config file. +.TP 7 +.BI "Monitor \*q" monitor-id \*q +specifies which monitor description is to be used for this screen. +.TP 7 +.BI "VideoAdaptor \*q" xv-id \*q +specifies an optional Xv video adaptor description to be used with this +screen. +.TP 7 +.BI "DefaultDepth " depth +specifies which color depth the server should use by default. The +.B \-depth +command line option can be used to override this. If neither is specified, +the default depth is driver-specific, but in most cases is 8. +.TP 7 +.BI "DefaultFbBpp " bpp +specifies which framebuffer layout to use by default. The +.B \-fbbpp +command line option can be used to override this. In most cases the +driver will chose the best default value for this. The only case where +there is even a choice in this value is for depth 24, where some hardware +supports both a packed 24 bit framebuffer layout and a sparse 32 bit +framebuffer layout. +.TP 7 +.B Options +Various +.B Option +flags may be specified in the +.B Screen +section. Some are driver-specific and are described in the driver +documentation. Others are driver-independent, and will eventually be +described here. +.TP 7 +.BI "Option \*qAccel\*q" +Enables XAA (X Acceleration Architecture), a mechanism that makes video +cards' 2D hardware acceleration available to the X server. This option is +on by default, but it may be necessary to turn it off if there are bugs in +the driver. There are many options to disable specific acclerated +operations, listed below. Note that disabling an operation will have no +effect if the operation is not accelerated (whether due to lack of support +in the hardware or in the driver). +.TP 7 +.BI "Option \*qXaaNoCPUToScreenColorExpandFill\*q" +Disables accelerated rectangular expansion blits from source patterns +stored in system memory (using a memory-mapped aperture). +.TP 7 +.BI "Option \*qXaaNoColor8x8PatternFillRect\*q" +Disables accelerated fills of a rectangular region with a full-color +pattern. +.TP 7 +.BI "Option \*qXaaNoColor8x8PatternFillTrap\*q" +Disables accelerated fills of a trapezoidal region with a full-color +pattern. +.TP 7 +.BI "Option \*qXaaNoDashedBresenhamLine\*q" +Disables accelerated dashed Bresenham line draws. +.TP 7 +.BI "Option \*qXaaNoDashedTwoPointLine\*q" +Disables accelerated dashed line draws between two arbitrary points. +.TP 7 +.BI "Option \*qXaaNoImageWriteRect\*q" +Disables acclerated transfers of full-color rectangular patterns from +system memory to video memory (using a memory-mapped aperture). +.TP 7 +.BI "Option \*qXaaNoMono8x8PatternFillRect\*q" +Disables accelerated fills of a rectangular region with a monochrome +pattern. +.TP 7 +.BI "Option \*qXaaNoMono8x8PatternFillTrap\*q" +Disables accelerated fills of a trapezoidal region with a monochrome +pattern. +.TP 7 +.BI "Option \*qXaaNoOffscreenPixmaps\*q" +Disables accelerated draws into pixmaps stored in offscreen video memory. +.TP 7 +.BI "Option \*qXaaNoPixmapCache\*q" +Disables caching of patterns in offscreen video memory. +.TP 7 +.BI "Option \*qXaaNoScanlineCPUToScreenColorExpandFill\*q" +Disables accelerated rectangular expansion blits from source patterns +stored in system memory (one scan line at a time). +.TP 7 +.BI "Option \*qXaaNoScanlineImageWriteRect\*q" +Disables acclerated transfers of full-color rectangular patterns from +system memory to video memory (one scan line at a time). +.TP 7 +.BI "Option \*qXaaNoScreenToScreenColorExpandFill\*q" +Disables accelerated rectangular expansion blits from source patterns +stored in offscreen video memory. +.TP 7 +.BI "Option \*qXaaNoScreenToScreenCopy\*q" +Disables accelerated copies of rectangular regions from one part of video +memory to another part of video memory. +.TP 7 +.BI "Option \*qXaaNoSolidBresenhamLine\*q" +Disables accelerated solid Bresenham line draws. +.TP 7 +.BI "Option \*qXaaNoSolidFillRect\*q" +Disables accelerated solid-color fills of rectangles. +.TP 7 +.BI "Option \*qXaaNoSolidFillTrap\*q" +Disables accelerated solid-color fills of Bresenham trapezoids. +.TP 7 +.BI "Option \*qXaaNoSolidHorVertLine\*q" +Disables accelerated solid horizontal and vertical line draws. +.TP 7 +.BI "Option \*qXaaNoSolidTwoPointLine\*q" +Disables accelerated solid line draws between two arbitrary points. +.PP +Each +.B Screen +section must contain one or more +.B Display +subsections. Those subsections provide depth/fbbpp specific configuration +information, and the one chosen depends on the depth and/or fbbpp that +is being used for the screen. The +.B Display +subsection format is described in the section below. + +.SH DISPLAY SUBSECTION +Each +.B Screen +section may have multiple +.B Display +subsections. There must be at least one, which matches the depth +and/or fbbpp values that are being used for the screen. The "active" +.B Display +subsection is the first that matches the depth and/or fbbpp values being +used. +.PP +.B Display +subsections have the following format: +.PP +.RS 4 +.nf +.B " SubSection \*qDisplay\*q" +.BI " Depth " depth +.I " entries" +.I " ..." +.B " EndSubSection" +.fi +.RE +.PP +.TP 7 +.BI "Depth " depth +This entry specifies what colour depth the +.B Display +subsection is to be used for. This entry is usually mandatory, +but it may be omitted in some cases providing an +.B FbBpp +entry is present. The range of +.I depth +values that are allowed depends on the driver. Most driver support +8, 15, 16 and 24. Some also support 1 and/or 4, and some may support +other values (like 30). Note: +.I depth +means the number of bits in a pixel that are actually used to determine +the pixel colour. 32 is not a valid +.I depth +value. Most hardware that uses 32 bits per pixel only uses 24 of them +to hold the colour information, which means that the colour depth is +24, not 32. +.TP 7 +.BI "FbBpp " bpp +This entry specifies the framebuffer format this +.B Display +subsection is to be used for. This entry is only needed when providing +depth 24 configurations that allow a choice between a 24 bpp packed +framebuffer format and a 32bpp sparse framebuffer format. In most cases +this entry should not be used. +.TP 7 +.BI "Weight " "red-weight green-weight blue-weight" +This optional entry specifies the relative RGB weighting to be used +for a screen is being used at depth 16 for drivers that allow multiple +formats. This may also be specified from the command line with the +.B \-weight +option (see +.IR XFree86(1) ). +.TP 7 +.BI "Virtual " "xdim ydim" +This optional entry specifies the virtual screen resolution to be used. +.I xdim +must be a multiple of either 8 or 16 for most drivers, and a multiple +of 32 when running in monochrome mode. The given value will be rounded +down if this is not the case. Video modes which are too large for the +specified virtual size will be rejected. If this entry is not present, +the virtual screen resolution will be set to accommodate all the valid +video modes given in the +.B Modes +entry. Some drivers/hardware combinations do not support virtual screens. +Refer to the appropriate driver-specific documentation for details. +.TP 7 +.BI "ViewPort " "x0 y0" +This optional entry sets the upper left corner of the initial display. +This is only relevant when the virtual screen resolution is different +from the resolution of the initial video mode. If this entry is not +given, then the initial display will be centered in the virtual display +area. +.TP 7 +.BI "Modes \*q" mode-name \*q " ..." +This entry is highly desirable for most drivers, and it specifies the list +of video modes to use. Each +.I mode-name +specified must be in double quotes. They must correspond to those +specified or referenced in the appropriate +.B Monitor +section (including implicitly referenced built-in VESA standard modes). +The server will delete modes from this list which don't satisfy various +requirements. The first valid mode in this list will be the default +display mode for startup. The list of valid modes is converted internally +into a circular list. It is possible to switch to the next mode with +.B Ctrl+Alt+Keypad-Plus +and to the previous mode with +.BR Ctrl+Alt+Keypad-Minus . +When this entry is omitted, the largest valid mode referenced by the +appropriate +.B Monitor +section will be used. +.TP 7 +.BI "Visual \*q" visual-name \*q +This optional entry sets the default root visual type. This may also +be specified from the command line (see the +.I Xserver(1) +man page). The visual types available for depth 8 are (default is +.BR PseudoColor ): +.PP +.RS 11 +.nf +.B StaticGray +.B GrayScale +.B StaticColor +.B PseudoColor +.B TrueColor +.B DirectColor +.fi +.RE +.PP +.RS 7 +The visual type available for the depths 15, 16 and 24 are (default is +.BR TrueColor ): +.PP +.RS 4 +.nf +.B TrueColor +.B DirectColor +.fi +.RE +.PP +Not all drivers support +.B DirectColor +at these depths. +.PP +The visual types available for the depth 4 are (default is +.BR StaticColor ): +.PP +.RS 4 +.nf +.B StaticGray +.B GrayScale +.B StaticColor +.B PseudoColor +.fi +.RE +.PP +The visual type available for the depth 1 (monochrome) is +.BR StaticGray . +.RE +.TP 7 +.BI "Black " "red green blue" +This optional entry allows the "black" colour to be specified. This +.TP 7 +.BI "White " "red green blue" +This optional entry allows the "white" colour to be specified. This +is only supported at depth 1. The default is white. +.TP 7 +.B Options +Option flags may be specified in the +.B Display +subsections. These may include driver-specific options and +driver-independent options. The former are described in the +driver-specific documentation. Some of the latter are described above +in the section about the +.B Screen +section, and they may also be included here. +.SH SERVERLAYOUT SECTION +The config file may have multiple +.B ServerLayout +sections. +A "server layout" represents the binding of one or more screens +.RB ( Screen +sections) and one or more input devices +.RB ( InputDevice +sections) to form a complete configuration. In multi-head configurations, +it also specifies the relative layout of the heads. A +.B ServerLayout +section is considered "active" if it is referenced by the +.B \-layout +command line option. If that option is not used, the first +.B ServerLayout +section found in the config file is considered the active one. If no +.B ServerLayout +sections are present, the single active screen and two active (core) +input devices are selected as described in the relevant sections above. +.PP +.B ServerLayout +sections have the following format: +.PP +.RS 4 +.nf +.B "Section \*qServerLayout\*q" +.BI " Identifier \*q" name \*q +.BI " Screen \*q" screen-id \*q +.I " ..." +.BI " InputDevice \*q" idev-id \*q +.I " ..." +.I " options" +.I " ..." +.B "EndSection" +.fi +.RE +.PP +The +.B Identifier +entry specifies the unique name for this server layout. The +.B ServerLayout +section provides information specific to the whole session, including +session-specific +.BR Options . +The +.B ServerFlags +options (described above) may be specified here, and ones given here +override those given in the +.B ServerFlags +section. +.PP +The entries that may be used in this section are described here. +.TP 7 +.BI "Screen " "screen-num" " \*qscreen-id\*q " "position-information" +One of these entries must be given for each screen being used in +a session. The +.I screen-id +field is mandatory, and specifies the +.B Screen +section being referenced. The +.I screen-num +field is optional, and may be used to specify the screen number +in multi-head configurations. When this field is omitted, the +screens will be numbered in the order that they are listed in. +The numbering starts from 0, and must be consecutive. The +.I position-information +field describes the way multiple screens are positioned. There are +a number of different ways that this information can be provided: +.RS 7 +.TP 4 +.BI "Absolute " "x y" +This says that the upper left corner's coordinates are +.RI ( x , y ). +If the coordinates are omitted or if no positioning information +is given, (0,0) is assumed. +.TP 4 +.BI "RightOf \*q" screen-id \*q +.TP 4 +.BI "LeftOf \*q" screen-id \*q +.TP 4 +.BI "Above \*q" screen-id \*q +.TP 4 +.BI "Below \*q" screen-id \*q +.TP 4 +.BI "Relative \*q" screen-id \*q " x y" +These give the screen's location relative to another screen. +.RE +.TP 7 +.BI "InputDevice \*q" idev-id "\*q \*q" option \*q " ..." +One of these entries must be given for each input device being used in +a session. Normally at least two are required, one each for the core +pointer and keyboard devices. The +.I idev-id +field is mandatory, and specifies the name of the +.B InputDevice +section being referenced. Multiple +.I option +fields may be specified, each in double quotes. The options permitted +here are any that may also be given in the +.B InputDevice +sections. Normally only session-specific input device options would +be used here. The most commonly used options are: +.PP +.RS 11 +.nf +.B \*qCorePointer\*q +.B \*qCoreKeyboard\*q +.B \*qSendCoreEvents\*q +.fi +.RE +.PP +.RS 7 +and the first two should normally be used to indicate the core pointer +and core keyboard devices respectively. +.RE +.TP 7 +.B Options +Any option permitted in the +.B ServerFlags +section may also be specified here. When the same option appears in both +places, the value given here overrides the one given in the +.B ServerFlags +section. +.PP +Here is an example of a +.B ServerLayout +section for a dual headed configuration with two mice: +.PP +.RS 4 +.nf +.B "Section \*qServerLayout\*q" +.B " Identifier \*qLayout 1\*q" +.B " Screen \*qMGA 1\*q" +.B " Screen \*qMGA 2\*q RightOf \*qMGA 1\*q" +.B " InputDevice \*qKeyboard 1\*q \*qCoreKeyboard\*q" +.B " InputDevice \*qMouse 1\*q \*qCorePointer\*q" +.B " InputDevice \*qMouse 2\*q \*qSendCoreEvents\*q" +.B " Option \*qBlankTime\*q \*q5\*q" +.B "EndSection" +.fi +.RE +.SH DRI SECTION +This optional section is used to provide some information for the +Direct Rendering Infrastructure. Details about the format of this section +can be found in the README.DRI document, which is also available on-line +at +.IR . +.SH VENDOR SECTION +The optional +.B Vendor +section may be used to provide vendor-specific configuration information. +Multiple +.B Vendor +sections may be present, and they may contain an +.B Identifier +entry and multiple +.B Option +flags. The data therein is not used in this release. +.PP +.SH FILES +For an example of an XF86Config file, see the file installed as +__projectroot__/lib/X11/XF86Config.eg. +.fi +.SH "SEE ALSO" +X(__miscmansuffix__), Xserver(1), XFree86(1), +apm(__drivermansuffix__), +ati(__drivermansuffix__), +chips(__drivermansuffix__), +cirrus(__drivermansuffix__), +cyrix(__drivermansuffix__), +fbdev(__drivermansuffix__), +glide(__drivermansuffix__), +glint(__drivermansuffix__), +i128(__drivermansuffix__), +i740(__drivermansuffix__), +i810(__drivermansuffix__), +imstt(__drivermansuffix__), +mga(__drivermansuffix__), +neomagic(__drivermansuffix__), +nv(__drivermansuffix__), +r128(__drivermansuffix__), +rendition(__drivermansuffix__), +s3virge(__drivermansuffix__), +siliconmotion(__drivermansuffix__), +sis(__drivermansuffix__), +sunbw2(__drivermansuffix__), +suncg14(__drivermansuffix__), +suncg3(__drivermansuffix__), +suncg6(__drivermansuffix__), +sunffb(__drivermansuffix__), +sunleo(__drivermansuffix__), +suntcx(__drivermansuffix__), +tdfx(__drivermansuffix__), +tga(__drivermansuffix__), +trident(__drivermansuffix__), +tseng(__drivermansuffix__), +v4l(__drivermansuffix__), +vesa(__drivermansuffix__), +vga(__drivermansuffix__), +vmware(__drivermansuffix__), +.br +README +.IR , +.br +RELNOTES +.IR , +.br +README.mouse +.IR , +.br +README.DRI +.IR , +.br +Status +.IR , +.br +Install +.IR . +.SH AUTHORS +This manual page was largely rewritten for XFree86 4.0 by David Dawes +.IR . Index: xc/programs/Xserver/hw/xfree86/XFree86.cpp diff -u xc/programs/Xserver/hw/xfree86/XFree86.cpp:1.4.2.1 xc/programs/Xserver/hw/xfree86/XFree86.cpp:removed --- xc/programs/Xserver/hw/xfree86/XFree86.cpp:1.4.2.1 Thu Mar 15 13:59:13 2001 +++ xc/programs/Xserver/hw/xfree86/XFree86.cpp Mon Jun 4 12:40:21 2001 @@ -1,562 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XFree86.cpp,v 1.4.2.1 2001/03/15 18:59:13 dawes Exp $ -.TH XFree86 1 "Version 4.0.3" "XFree86" -.SH NAME -XFree86 - X11R6 X server -.SH SYNOPSIS -.B XFree86 -[:display] [option ...] -.SH DESCRIPTION -XFree86 is an X server that was originally designed for UNIX and UNIX-like -operating systems running on Intel x86 hardware. It now runs on a wider -range of hardware and OS platforms. -.PP -This work is derived from -.I "X386\ 1.2" -which was contributed to X11R5 by Snitily Graphics Consulting Service. -The current XFree86 release is based on X11R6.3. The XFree86 X server -architecture was redesigned for the 4.0 release, and it includes among -other things a loadable module system donated by Metro Link, Inc. -.SH CONFIGURATIONS -.PP -.I XFree86 -operates under a wide range of operating systems and hardware platforms. -The Intel x86 (IA32) architecture is the most widely supported hardware -platform. Other hardware platforms include Compaq Alpha, Intel IA64, -SPARC and PowerPC. The most widely supported operating systems are the -free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD and -OpenBSD. Commercial UNIX operating systems such as Solaris (x86) and -UnixWare are also supported. Other supported operating systems include -LynxOS, and GNU Hurd. Darwin and Mac OS X are supported with the -Xdarwin(1) X server. Win32/Cygwin is supported with the XWin X server. -.PP -.SH "NETWORK CONNECTIONS" -\fIXFree86\fP supports connections made using the following reliable -byte-streams: -.TP 4 -.I "Local" -On most platforms, the "Local" connection type is a UNIX-domain socket. -On some System V platforms, the "local" connection types also include -STREAMS pipes, named pipes, and some other mechanisms. -.TP 4 -.I TCP\/IP -\fIXFree86\fP listens on port 6000+\fIn\fP, where \fIn\fP is the display -number. This connection type can be disabled with the \fB\-nolisten\fP -option (see the Xserver(1) man page for details). -.SH "ENVIRONMENT VARIABLES" -For operating systems that support local connections other than Unix Domain -sockets (SVR3 and SVR4), there is a compiled-in list specifying the order -in which local connections should be attempted. This list can be overridden by -the \fIXLOCAL\fP environment variable described below. If the display name -indicates a best-choice connection should be made (e.g. \fI:0.0\fP), each -connection mechanism is tried until a connection succeeds or no more -mechanisms are available. Note: for these OSs, the Unix Domain socket -connection is treated differently from the other local connection types. -To use it the connection must be made to \fIunix:0.0\fP. -.PP -The \fIXLOCAL\fP environment variable should contain a list of one more -more of the following: -.PP -.RS 8 -.nf -NAMED -PTS -SCO -ISC -.fi -.RE -.PP -which represent SVR4 Named Streams pipe, Old-style USL -Streams pipe, SCO XSight Streams pipe, and ISC Streams pipe, respectively. -You can select a single mechanism (e.g. \fIXLOCAL=NAMED\fP), or an ordered -list (e.g. \fIXLOCAL="NAMED:PTS:SCO"\fP). This variable overrides the -compiled-in defaults. For SVR4 it is recommended that \fINAMED\fP be -the first preference connection. The default setting is -\fIPTS:NAMED:ISC:SCO\fP. -.PP -To globally override the compiled-in defaults, you should define (and -export if using \fIsh\fP or \fIksh\fP) \fIXLOCAL\fP globally. If you -use \fIstartx/xinit\fP, the definition should be at the top of -your \fI.xinitrc\fP file. If you use \fIxdm\fP, the definitions should be -early on in the \fI/lib/X11/xdm/Xsession\fP script. -.SH OPTIONS -In addition to the normal server options described in the \fIXserver(1)\fP -manual page, \fIXFree86\fP accepts the following command line switches: -.TP 8 -.B vt\fIXX\fP -\fIXX\fP specifies the Virtual Terminal device number which \fIXFree86\fP -will use. Without this option, \fIXFree86\fP will pick the first -available Virtual Terminal that it can locate. This option applies only -to platforms such as Linux, BSD, SVR3 and SVR4, that have virtual terminal -support. -.TP -.B \-allowMouseOpenFail -Allow the server to start up even if the mouse device can't be opened -or initialised. This is equivalent to the -.B AllowMouseOpenFail -XF86Config(__filemansuffix__) file option. -.TP 8 -.B \-allowNonLocalModInDev -Allow changes to keyboard and mouse settings from non-local clients. -By default, connections from non-local clients are not allowed to do -this. This is equivalent to the -.B AllowNonLocalModInDev -XF86Config(__filemansuffix__) file option. -.TP 8 -.B \-allowNonLocalXvidtune -Make the VidMode extension available to remote clients. This allows -the xvidtune client to connect from another host. This is equivalent -to the -.B AllowNonLocalXvidtune -XF86Config(__filemansuffix__) file option. By default non-local -connections are not allowed. -.TP 8 -.B \-bgamma \fIvalue\fP -Set the blue gamma correction. \fIvalue\fP must be between 0.1 and 10. -The default is 1.0. Not all drivers support this. See also the -.BR \-gamma , -.BR \-rgamma , -and -.B \-ggamma -options. -.TP 8 -.B \-bpp \fIn\fP -No longer supported. Use \fB\-depth\fP to set the color depth, and use -\fB\-fbbpp\fP if you really need to force a non-default framebuffer -(hardware) pixel format. -.TP -.B \-configure -When this option is specified, the X server loads all video driver -modules, probes for available hardware, and writes out an initial -XF86Config(__filemansuffix__) file based on what was detected. This -option currently has some problems on some platforms, but in most cases -it is a good way to bootstrap the configuration process. This option -is only available when the server is run as root (i.e, with real-uid -0). -.TP 8 -.B \-crt /dev/tty\fIXX\fP -SCO only. This is the same as the \fBvt\fP option, and is provided for -compatibility with the native SCO X server. -.TP 8 -.B \-depth \fIn\fP -Sets the default color depth. Legal values are 1, 4, 8, 15, 16, and -24. Not all drivers support all values. -.TP 8 -.B \-disableModInDev -Disable dynamic modification of input device settings. This is equivalent -to the -.B DisableModInDev -XF86Config(__filemansuffix__) file option. -.TP 8 -.B \-disableVidMode -Disable the the parts of the VidMode extension (used by the xvidtune -client) that can be used to change the video modes. This is equivalent -to the -.B DisableVidModeExtension -XF86Config(__filemansuffix__) file option. -.TP 8 -.B \-fbbpp \fIn\fP -Sets the number of framebuffer bits per pixel. You should only set this -if you're sure it's necessary; normally the server can deduce the correct -value from \fB\-depth\fP above. Useful if you want to run a depth 24 -configuration with a 24 bpp framebuffer rather than the (possibly default) -32 bpp framebuffer (or vice versa). Legal values are 1, 8, 16, 24, 32. -Not all drivers support all values. -.TP 8 -.B \-flipPixels -Swap the default values for the black and white pixels. -.TP 8 -.B \-gamma \fIvalue\fP -Set the gamma correction. \fIvalue\fP must be between 0.1 and 10. The -default is 1.0. This value is applied equally to the R, G and B values. -Those values can be set independently with the -.BR \-rgamma , -.BR \-bgamma , -and -.B \-ggamma -options. Not all drivers support this. -.TP 8 -.B \-ggamma \fIvalue\fP -Set the green gamma correction. \fIvalue\fP must be between 0.1 and -10. The default is 1.0. Not all drivers support this. See also the -.BR \-gamma , -.BR \-rgamma , -and -.B \-bgamma -options. -.TP 8 -.B \-ignoreABI -The X server checks the ABI revision levels of each module that it loads. -It will normally refuse to load modules with ABI revisions that are newer -than the server's. This is because such modules might use interfaces that -the server does not have. When this option is specified, mismatches like -this are downgraded from fatal errors to warnings. This option should -be used with care. -.TP 8 -.B \-keeptty -Prevent the server from detaching its initial controlling terminal. -This option is only useful when debugging the server. Not all platforms -support (or can use) this option. -.TP 8 -.B \-keyboard \fIkeyboard-name\fP -Use the XF86Config(__filemansuffix__) file -.B InputDevice -section called -.I keyboard-name -as the core keyboard. -By default the core keyboard input device referenced by the default -.B Layout -section are used, or the first relevant -.B InputDevice -section when there are no -.B Layout -sections. -.TP 8 -.B \-layout \fIlayout-name\fP -Use the XF86Config(__filemansuffix__) file -.B Layout -section called -.IR layout-name . -By default the first -.B Layout -section is used. -.TP 8 -.B \-logfile \fIfilename\fP -Use the file called -.I filenameg -as the X server log file. The default log file is -.B __logdir__/XFree86.\fIn\fP.log -on most platforms, where -.I n -is the display number of the X server. The default may be in a different -directory on some platforms. This option is only available when the -server is run as root (i.e, with real-uid 0). -.TP 8 -.BR \-logverbose " [\fIn\fP]" -Sets the verbosity level for information printed to the X server log -file. If the -.I n -value isn't supplied, each occurrance of this option increments the log -file verbosity level. When the -.I n -value is supplied, the log file verbosity level is set to that value. -The default log file verbosity level is 3. -.TP 8 -.B \-modulepath \fIsearchpath\fP -Set the module search path to -.IR searchpath . -.I searchpath -is a comma separated list of directories to search for X server modules. -This option is only available when the server is run as root (i.e, with -real-uid 0). -.TP 8 -.B \-nosilk -Disable Silken Mouse support. -.TP 8 -.B \-pixmap24 -Set the internal pixmap format for depth 24 pixmaps to 24 bits per pixel. -The default is usually 32 bits per pixel. There is normally little -reason to use this option. Some client applications don't like this -pixmap format, even though it is a perfectly legal format. -This is equvalent to the -.B Pixmap -XF86Config(__filemansuffix__) file option. -.TP 8 -.B \-pixmap32 -Set the internal pixmap format for depth 24 pixmaps to 32 bits per pixel. -This is usually the default. -This is equvalent to the -.B Pixmap -XF86Config(__filemansuffix__) file option. -.TP 8 -.B \-pointer \fIpointer-name\fP -Use the XF86Config(__filemansuffix__) file -.B InputDevice -section called -.I pointer-name -as the core pointer. -By default the core pointer input device referenced by the default -.B Layout -section are used, or the first relevant -.B InputDevice -section when there are no -.B Layout -sections. -.TP 8 -.B \-probeonly -Causes the server to exit after the device probing stage. The XF86Config -file is still used when this option is given, so information that can -be auto-detected should be commented out. -.TP 8 -.B \-quiet -Suppress most informational messages at startup. The verbosity level -is set to zero. -.TP 8 -.B \-rgamma \fIvalue\fP -Set the red gamma correction. \fIvalue\fP must be between 0.1 and 10. -The default is 1.0. Not all drivers support this. See also the -.BR \-gamma , -.BR \-bgamma , -and -.B \-ggamma -options. -.TP 8 -.B \-scanpci -When this option is specified, the X server scans the PCI bus, and prints -out some information about each device that was detected. See also -scanpci(1) and pcitweak(1). -.TP 8 -.B \-screen \fIscreen-name\fP -Use the XF86Config(__filemansuffix__) file -.B Screen -section called -.IR screen-name . -By default the screens referenced by the default -.B Layout -section are used, or the first -.B Screen -section when there are no -.B Layout -sections. -.TP 8 -.B \-showconfig -This is the same as the -.B \-version -option, and is included for compatibilty reasons. It may be removed in -a future release, so the -.B \-version -options hould be used instead. -.TP 8 -.B \-weight \fInnn\fP -Set RGB weighting at 16 bpp. The default is 565. This applies only to -those drivers which support 16 bpp. -.TP 8 -.BR \-verbose " [\fIn\fP]" -Sets the verbosity level for information printed on stderr. If the -.I n -value isn't supplied, each occurrance of this option increments the -verbosity level. When the -.I n -value is supplied, the verbosity level is set to that value. The default -verbosity level is 1. -.TP 8 -.B \-version -Print out the server version, patchlevel, release date, the operating -system/platform it was built on, and whether it includes module loader -support. -.TP 8 -.B \-xf86config \fIfile\fP -Read the server configuration from \fIfile\fP. This option will work -for any file when the server is run as root (i.e, with real-uid 0), or -for files relative to a directory in the config search path for all -other users. -.SH "KEYBOARD" -Multiple key presses recognized directly by \fIXFree86\fP are: -.TP 8 -.B Ctrl+Alt+Backspace -Immediately kills the server -- no questions asked. This can be disabled -with the -.B DontZap -XF86Config(__filemansuffix__) file option. -.TP 8 -.B Ctrl+Alt+Keypad-Plus -Change video mode to next one specified in the configuration file. -This can be disabled with the -.B DontZoom -XF86Config(__filemansuffix__) file option. -.TP 8 -.B Ctrl+Alt+Keypad-Minus -Change video mode to previous one specified in the configuration file. -This can be disabled with the -.B DontZoom -XF86Config(__filemansuffix__) file option. -.TP 8 -.B Ctrl+Alt+F1...F12 -For BSD and Linux systems with virtual terminal support, these keystroke -combinations are used to switch to Virtual Console 1 through 12. -.SH SETUP -.I XFree86 -uses a configuration file called \fBXF86Config\fP for its initial setup. -Refer to the -.I XF86Config(__filemansuffix__) -manual page for information about the -format of this file. -.SH FILES -The X server config file can be found in a range of locations. These -are documented fully in the -.I XF86Config(__filemansuffix__) -manual page. The most commonly used locations are shown here. -.TP 30 -/etc/X11/XF86Config -Server configuration file -.TP 30 -/etc/X11/XF86Config-4 -Server configuration file -.TP 30 -/etc/XF86Config -Server configuration file -.TP 30 -__projectroot__/etc/XF86Config -Server configuration file -.TP 30 -__projectroot__/lib/X11/XF86Config -Server configuration file -.TP 30 -__logdir__/XFree86.\fIn\fP.log -Server log file for display \fIn\fP. -.TP 30 -__projectroot__/bin/\(** -Client binaries -.TP 30 -__projectroot__/include/\(** -Header files -.TP 30 -__projectroot__/lib/\(** -Libraries -.TP 30 -__projectroot__/lib/X11/fonts/\(** -Fonts -.TP 30 -__projectroot__/lib/X11/rgb.txt -Color names to RGB mapping -.TP 30 -__projectroot__/lib/X11/XErrorDB -Client error message database -.TP 30 -__projectroot__/lib/X11/app-defaults/\(** -Client resource specifications -.TP 30 -__projectroot__/man/man?/\(** -Manual pages -.TP 30 -/etc/X\fIn\fP.hosts -Initial access control list for display \fIn\fP -.SH "SEE ALSO" -X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), -XF86Config(__filemansuffix__), xf86config(1), xf86cfg(1), xvidtune(1), -apm(__drivermansuffix__), -ati(__drivermansuffix__), -chips(__drivermansuffix__), -cirrus(__drivermansuffix__), -cyrix(__drivermansuffix__), -fbdev(__drivermansuffix__), -glide(__drivermansuffix__), -glint(__drivermansuffix__), -i128(__drivermansuffix__), -i740(__drivermansuffix__), -i810(__drivermansuffix__), -imstt(__drivermansuffix__), -mga(__drivermansuffix__), -neomagic(__drivermansuffix__), -nv(__drivermansuffix__), -r128(__drivermansuffix__), -rendition(__drivermansuffix__), -s3virge(__drivermansuffix__), -siliconmotion(__drivermansuffix__), -sis(__drivermansuffix__), -sunbw2(__drivermansuffix__), -suncg14(__drivermansuffix__), -suncg3(__drivermansuffix__), -suncg6(__drivermansuffix__), -sunffb(__drivermansuffix__), -sunleo(__drivermansuffix__), -suntcx(__drivermansuffix__), -tdfx(__drivermansuffix__), -tga(__drivermansuffix__), -trident(__drivermansuffix__), -tseng(__drivermansuffix__), -v4l(__drivermansuffix__), -vesa(__drivermansuffix__), -vga(__drivermansuffix__), -.br -README -.IR , -.br -RELNOTES -.IR , -.br -README.mouse -.IR , -.br -README.DRI -.IR , -.br -Status -.IR , -.br -Install -.IR . - -.SH AUTHORS -XFree86 has many contributors world wide. The names of most of them -can be found in the documentation, CHANGELOG files in the source tree, -and in the actual source code. -.PP -XFree86 was originally based on \fIX386 1.2\fP by Thomas Roell, which -was contributed to the then X Consortium's X11R5 distribution by SGCS. -.PP -The project that became XFree86 was originally founded in 1992 by -David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat. -.PP -XFree86 was later integrated in the then X Consortium's X11R6 release -by a group of dedicated XFree86 developers, including the following: -.PP -.RS 4 -.nf -Stuart Anderson \fIanderson@metrolink.com\fP -Doug Anson \fIdanson@lgc.com\fP -Gertjan Akkerman \fIakkerman@dutiba.twi.tudelft.nl\fP -Mike Bernson \fImike@mbsun.mlb.org\fP -Robin Cutshaw \fIrobin@XFree86.org\fP -David Dawes \fIdawes@XFree86.org\fP -Marc Evans \fImarc@XFree86.org\fP -Pascal Haible \fIhaible@izfm.uni-stuttgart.de\fP -Matthieu Herrb \fIMatthieu.Herrb@laas.fr\fP -Dirk Hohndel \fIhohndel@XFree86.org\fP -David Holland \fIdavidh@use.com\fP -Alan Hourihane \fIalanh@fairlite.demon.co.uk\fP -Jeffrey Hsu \fIhsu@soda.berkeley.edu\fP -Glenn Lai \fIglenn@cs.utexas.edu\fP -Ted Lemon \fImellon@ncd.com\fP -Rich Murphey \fIrich@XFree86.org\fP -Hans Nasten \fInasten@everyware.se\fP -Mark Snitily \fImark@sgcs.com\fP -Randy Terbush \fIrandyt@cse.unl.edu\fP -Jon Tombs \fItombs@XFree86.org\fP -Kees Verstoep \fIversto@cs.vu.nl\fP -Paul Vixie \fIpaul@vix.com\fP -Mark Weaver \fIMark_Weaver@brown.edu\fP -David Wexelblat \fIdwex@XFree86.org\fP -Philip Wheatley \fIPhilip.Wheatley@ColumbiaSC.NCR.COM\fP -Thomas Wolfram \fIwolf@prz.tu-berlin.de\fP -Orest Zborowski \fIorestz@eskimo.com\fP -.fi -.RE -.PP -The current XFree86 core team consists of: -.PP -.RS 4 -.nf -Stuart Anderson \fIanderson@metrolink.com\fP -Preston Brown \fIpbrown@redhat.com\fP -Robin Cutshaw \fIrobin@xfree86.org\fP -David Dawes \fIdawes@xfree86.org\fP -Egbert Eich \fIeich@xfree86.org\fP -Marc Evans \fImarc@xfree86.org\fP -Dirk Hohndel \fIhohndel@xfree86.org\fP -Alan Hourihane \fIalanh@xfree86.org\fP -Harald Koenig \fIkoenig@xfree86.org\fP -Marc La France \fItsi@xfree86.org\fP -Kevin Martin \fImartin@xfree86.org\fP -Rich Murphey \fIrich@xfree86.org\fP -Takaaki Nomura \fIamadeus@yk.rim.or.jp\fP -Keith Packard \fIkeithp@xfree86.org\fP -Jon Tombs \fIjon@gtex02.us.es\fP -Mark Vojkovich \fImarkv@xfree86.org\fP -David Wexelblat \fIdwex@xfree86.org\fP -.fi -.RE -.PP -\fIXFree86\fP source is available from the FTP server -\fI\fP, among others. Documentation -and other information can be found from the XFree86 web site -\fI\fP. Index: xc/programs/Xserver/hw/xfree86/XFree86.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/XFree86.man:3.52 --- /dev/null Mon Jun 4 12:40:21 2001 +++ xc/programs/Xserver/hw/xfree86/XFree86.man Thu Apr 5 15:29:41 2001 @@ -0,0 +1,563 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XFree86.man,v 3.52 2001/04/05 19:29:41 dawes Exp $ +.TH XFree86 1 __vendorversion__ +.SH NAME +XFree86 - X11R6 X server +.SH SYNOPSIS +.B XFree86 +[:display] [option ...] +.SH DESCRIPTION +XFree86 is an X server that was originally designed for UNIX and UNIX-like +operating systems running on Intel x86 hardware. It now runs on a wider +range of hardware and OS platforms. +.PP +This work is derived from +.I "X386\ 1.2" +which was contributed to X11R5 by Snitily Graphics Consulting Service. +The current XFree86 release is based on X11R6.3. The XFree86 X server +architecture was redesigned for the 4.0 release, and it includes among +other things a loadable module system donated by Metro Link, Inc. +.SH CONFIGURATIONS +.PP +.I XFree86 +operates under a wide range of operating systems and hardware platforms. +The Intel x86 (IA32) architecture is the most widely supported hardware +platform. Other hardware platforms include Compaq Alpha, Intel IA64, +SPARC and PowerPC. The most widely supported operating systems are the +free/OpenSource UNIX-like systems such as Linux, FreeBSD, NetBSD and +OpenBSD. Commercial UNIX operating systems such as Solaris (x86) and +UnixWare are also supported. Other supported operating systems include +LynxOS, and GNU Hurd. Darwin and Mac OS X are supported with the +XDarwin(1) X server. Win32/Cygwin is supported with the XWin X server. +.PP +.SH "NETWORK CONNECTIONS" +\fIXFree86\fP supports connections made using the following reliable +byte-streams: +.TP 4 +.I "Local" +On most platforms, the "Local" connection type is a UNIX-domain socket. +On some System V platforms, the "local" connection types also include +STREAMS pipes, named pipes, and some other mechanisms. +.TP 4 +.I TCP\/IP +\fIXFree86\fP listens on port 6000+\fIn\fP, where \fIn\fP is the display +number. This connection type can be disabled with the \fB\-nolisten\fP +option (see the Xserver(1) man page for details). +.SH "ENVIRONMENT VARIABLES" +For operating systems that support local connections other than Unix Domain +sockets (SVR3 and SVR4), there is a compiled-in list specifying the order +in which local connections should be attempted. This list can be overridden by +the \fIXLOCAL\fP environment variable described below. If the display name +indicates a best-choice connection should be made (e.g. \fI:0.0\fP), each +connection mechanism is tried until a connection succeeds or no more +mechanisms are available. Note: for these OSs, the Unix Domain socket +connection is treated differently from the other local connection types. +To use it the connection must be made to \fIunix:0.0\fP. +.PP +The \fIXLOCAL\fP environment variable should contain a list of one more +more of the following: +.PP +.RS 8 +.nf +NAMED +PTS +SCO +ISC +.fi +.RE +.PP +which represent SVR4 Named Streams pipe, Old-style USL +Streams pipe, SCO XSight Streams pipe, and ISC Streams pipe, respectively. +You can select a single mechanism (e.g. \fIXLOCAL=NAMED\fP), or an ordered +list (e.g. \fIXLOCAL="NAMED:PTS:SCO"\fP). This variable overrides the +compiled-in defaults. For SVR4 it is recommended that \fINAMED\fP be +the first preference connection. The default setting is +\fIPTS:NAMED:ISC:SCO\fP. +.PP +To globally override the compiled-in defaults, you should define (and +export if using \fIsh\fP or \fIksh\fP) \fIXLOCAL\fP globally. If you +use \fIstartx/xinit\fP, the definition should be at the top of +your \fI.xinitrc\fP file. If you use \fIxdm\fP, the definitions should be +early on in the \fI/lib/X11/xdm/Xsession\fP script. +.SH OPTIONS +In addition to the normal server options described in the \fIXserver(1)\fP +manual page, \fIXFree86\fP accepts the following command line switches: +.TP 8 +.B vt\fIXX\fP +\fIXX\fP specifies the Virtual Terminal device number which \fIXFree86\fP +will use. Without this option, \fIXFree86\fP will pick the first +available Virtual Terminal that it can locate. This option applies only +to platforms such as Linux, BSD, SVR3 and SVR4, that have virtual terminal +support. +.TP +.B \-allowMouseOpenFail +Allow the server to start up even if the mouse device can't be opened +or initialised. This is equivalent to the +.B AllowMouseOpenFail +XF86Config(__filemansuffix__) file option. +.TP 8 +.B \-allowNonLocalModInDev +Allow changes to keyboard and mouse settings from non-local clients. +By default, connections from non-local clients are not allowed to do +this. This is equivalent to the +.B AllowNonLocalModInDev +XF86Config(__filemansuffix__) file option. +.TP 8 +.B \-allowNonLocalXvidtune +Make the VidMode extension available to remote clients. This allows +the xvidtune client to connect from another host. This is equivalent +to the +.B AllowNonLocalXvidtune +XF86Config(__filemansuffix__) file option. By default non-local +connections are not allowed. +.TP 8 +.B \-bgamma \fIvalue\fP +Set the blue gamma correction. \fIvalue\fP must be between 0.1 and 10. +The default is 1.0. Not all drivers support this. See also the +.BR \-gamma , +.BR \-rgamma , +and +.B \-ggamma +options. +.TP 8 +.B \-bpp \fIn\fP +No longer supported. Use \fB\-depth\fP to set the color depth, and use +\fB\-fbbpp\fP if you really need to force a non-default framebuffer +(hardware) pixel format. +.TP +.B \-configure +When this option is specified, the X server loads all video driver +modules, probes for available hardware, and writes out an initial +XF86Config(__filemansuffix__) file based on what was detected. This +option currently has some problems on some platforms, but in most cases +it is a good way to bootstrap the configuration process. This option +is only available when the server is run as root (i.e, with real-uid +0). +.TP 8 +.B \-crt /dev/tty\fIXX\fP +SCO only. This is the same as the \fBvt\fP option, and is provided for +compatibility with the native SCO X server. +.TP 8 +.B \-depth \fIn\fP +Sets the default color depth. Legal values are 1, 4, 8, 15, 16, and +24. Not all drivers support all values. +.TP 8 +.B \-disableModInDev +Disable dynamic modification of input device settings. This is equivalent +to the +.B DisableModInDev +XF86Config(__filemansuffix__) file option. +.TP 8 +.B \-disableVidMode +Disable the the parts of the VidMode extension (used by the xvidtune +client) that can be used to change the video modes. This is equivalent +to the +.B DisableVidModeExtension +XF86Config(__filemansuffix__) file option. +.TP 8 +.B \-fbbpp \fIn\fP +Sets the number of framebuffer bits per pixel. You should only set this +if you're sure it's necessary; normally the server can deduce the correct +value from \fB\-depth\fP above. Useful if you want to run a depth 24 +configuration with a 24 bpp framebuffer rather than the (possibly default) +32 bpp framebuffer (or vice versa). Legal values are 1, 8, 16, 24, 32. +Not all drivers support all values. +.TP 8 +.B \-flipPixels +Swap the default values for the black and white pixels. +.TP 8 +.B \-gamma \fIvalue\fP +Set the gamma correction. \fIvalue\fP must be between 0.1 and 10. The +default is 1.0. This value is applied equally to the R, G and B values. +Those values can be set independently with the +.BR \-rgamma , +.BR \-bgamma , +and +.B \-ggamma +options. Not all drivers support this. +.TP 8 +.B \-ggamma \fIvalue\fP +Set the green gamma correction. \fIvalue\fP must be between 0.1 and +10. The default is 1.0. Not all drivers support this. See also the +.BR \-gamma , +.BR \-rgamma , +and +.B \-bgamma +options. +.TP 8 +.B \-ignoreABI +The X server checks the ABI revision levels of each module that it loads. +It will normally refuse to load modules with ABI revisions that are newer +than the server's. This is because such modules might use interfaces that +the server does not have. When this option is specified, mismatches like +this are downgraded from fatal errors to warnings. This option should +be used with care. +.TP 8 +.B \-keeptty +Prevent the server from detaching its initial controlling terminal. +This option is only useful when debugging the server. Not all platforms +support (or can use) this option. +.TP 8 +.B \-keyboard \fIkeyboard-name\fP +Use the XF86Config(__filemansuffix__) file +.B InputDevice +section called +.I keyboard-name +as the core keyboard. +By default the core keyboard input device referenced by the default +.B Layout +section are used, or the first relevant +.B InputDevice +section when there are no +.B Layout +sections. +.TP 8 +.B \-layout \fIlayout-name\fP +Use the XF86Config(__filemansuffix__) file +.B Layout +section called +.IR layout-name . +By default the first +.B Layout +section is used. +.TP 8 +.B \-logfile \fIfilename\fP +Use the file called +.I filename +as the X server log file. The default log file is +.B __logdir__/XFree86.\fIn\fP.log +on most platforms, where +.I n +is the display number of the X server. The default may be in a different +directory on some platforms. This option is only available when the +server is run as root (i.e, with real-uid 0). +.TP 8 +.BR \-logverbose " [\fIn\fP]" +Sets the verbosity level for information printed to the X server log +file. If the +.I n +value isn't supplied, each occurrance of this option increments the log +file verbosity level. When the +.I n +value is supplied, the log file verbosity level is set to that value. +The default log file verbosity level is 3. +.TP 8 +.B \-modulepath \fIsearchpath\fP +Set the module search path to +.IR searchpath . +.I searchpath +is a comma separated list of directories to search for X server modules. +This option is only available when the server is run as root (i.e, with +real-uid 0). +.TP 8 +.B \-nosilk +Disable Silken Mouse support. +.TP 8 +.B \-pixmap24 +Set the internal pixmap format for depth 24 pixmaps to 24 bits per pixel. +The default is usually 32 bits per pixel. There is normally little +reason to use this option. Some client applications don't like this +pixmap format, even though it is a perfectly legal format. +This is equvalent to the +.B Pixmap +XF86Config(__filemansuffix__) file option. +.TP 8 +.B \-pixmap32 +Set the internal pixmap format for depth 24 pixmaps to 32 bits per pixel. +This is usually the default. +This is equvalent to the +.B Pixmap +XF86Config(__filemansuffix__) file option. +.TP 8 +.B \-pointer \fIpointer-name\fP +Use the XF86Config(__filemansuffix__) file +.B InputDevice +section called +.I pointer-name +as the core pointer. +By default the core pointer input device referenced by the default +.B Layout +section are used, or the first relevant +.B InputDevice +section when there are no +.B Layout +sections. +.TP 8 +.B \-probeonly +Causes the server to exit after the device probing stage. The XF86Config +file is still used when this option is given, so information that can +be auto-detected should be commented out. +.TP 8 +.B \-quiet +Suppress most informational messages at startup. The verbosity level +is set to zero. +.TP 8 +.B \-rgamma \fIvalue\fP +Set the red gamma correction. \fIvalue\fP must be between 0.1 and 10. +The default is 1.0. Not all drivers support this. See also the +.BR \-gamma , +.BR \-bgamma , +and +.B \-ggamma +options. +.TP 8 +.B \-scanpci +When this option is specified, the X server scans the PCI bus, and prints +out some information about each device that was detected. See also +scanpci(1) and pcitweak(1). +.TP 8 +.B \-screen \fIscreen-name\fP +Use the XF86Config(__filemansuffix__) file +.B Screen +section called +.IR screen-name . +By default the screens referenced by the default +.B Layout +section are used, or the first +.B Screen +section when there are no +.B Layout +sections. +.TP 8 +.B \-showconfig +This is the same as the +.B \-version +option, and is included for compatibilty reasons. It may be removed in +a future release, so the +.B \-version +options hould be used instead. +.TP 8 +.B \-weight \fInnn\fP +Set RGB weighting at 16 bpp. The default is 565. This applies only to +those drivers which support 16 bpp. +.TP 8 +.BR \-verbose " [\fIn\fP]" +Sets the verbosity level for information printed on stderr. If the +.I n +value isn't supplied, each occurrance of this option increments the +verbosity level. When the +.I n +value is supplied, the verbosity level is set to that value. The default +verbosity level is 1. +.TP 8 +.B \-version +Print out the server version, patchlevel, release date, the operating +system/platform it was built on, and whether it includes module loader +support. +.TP 8 +.B \-xf86config \fIfile\fP +Read the server configuration from \fIfile\fP. This option will work +for any file when the server is run as root (i.e, with real-uid 0), or +for files relative to a directory in the config search path for all +other users. +.SH "KEYBOARD" +Multiple key presses recognized directly by \fIXFree86\fP are: +.TP 8 +.B Ctrl+Alt+Backspace +Immediately kills the server -- no questions asked. This can be disabled +with the +.B DontZap +XF86Config(__filemansuffix__) file option. +.TP 8 +.B Ctrl+Alt+Keypad-Plus +Change video mode to next one specified in the configuration file. +This can be disabled with the +.B DontZoom +XF86Config(__filemansuffix__) file option. +.TP 8 +.B Ctrl+Alt+Keypad-Minus +Change video mode to previous one specified in the configuration file. +This can be disabled with the +.B DontZoom +XF86Config(__filemansuffix__) file option. +.TP 8 +.B Ctrl+Alt+F1...F12 +For BSD and Linux systems with virtual terminal support, these keystroke +combinations are used to switch to Virtual Console 1 through 12. +.SH SETUP +.I XFree86 +uses a configuration file called \fBXF86Config\fP for its initial setup. +Refer to the +.I XF86Config(__filemansuffix__) +manual page for information about the +format of this file. +.SH FILES +The X server config file can be found in a range of locations. These +are documented fully in the +.I XF86Config(__filemansuffix__) +manual page. The most commonly used locations are shown here. +.TP 30 +/etc/X11/XF86Config +Server configuration file +.TP 30 +/etc/X11/XF86Config-4 +Server configuration file +.TP 30 +/etc/XF86Config +Server configuration file +.TP 30 +__projectroot__/etc/XF86Config +Server configuration file +.TP 30 +__projectroot__/lib/X11/XF86Config +Server configuration file +.TP 30 +__logdir__/XFree86.\fIn\fP.log +Server log file for display \fIn\fP. +.TP 30 +__projectroot__/bin/\(** +Client binaries +.TP 30 +__projectroot__/include/\(** +Header files +.TP 30 +__projectroot__/lib/\(** +Libraries +.TP 30 +__projectroot__/lib/X11/fonts/\(** +Fonts +.TP 30 +__projectroot__/lib/X11/rgb.txt +Color names to RGB mapping +.TP 30 +__projectroot__/lib/X11/XErrorDB +Client error message database +.TP 30 +__projectroot__/lib/X11/app-defaults/\(** +Client resource specifications +.TP 30 +__projectroot__/man/man?/\(** +Manual pages +.TP 30 +/etc/X\fIn\fP.hosts +Initial access control list for display \fIn\fP +.SH "SEE ALSO" +X(__miscmansuffix__), Xserver(1), xdm(1), xinit(1), +XF86Config(__filemansuffix__), xf86config(1), xf86cfg(1), xvidtune(1), +apm(__drivermansuffix__), +ati(__drivermansuffix__), +chips(__drivermansuffix__), +cirrus(__drivermansuffix__), +cyrix(__drivermansuffix__), +fbdev(__drivermansuffix__), +glide(__drivermansuffix__), +glint(__drivermansuffix__), +i128(__drivermansuffix__), +i740(__drivermansuffix__), +i810(__drivermansuffix__), +imstt(__drivermansuffix__), +mga(__drivermansuffix__), +neomagic(__drivermansuffix__), +nv(__drivermansuffix__), +r128(__drivermansuffix__), +rendition(__drivermansuffix__), +s3virge(__drivermansuffix__), +siliconmotion(__drivermansuffix__), +sis(__drivermansuffix__), +sunbw2(__drivermansuffix__), +suncg14(__drivermansuffix__), +suncg3(__drivermansuffix__), +suncg6(__drivermansuffix__), +sunffb(__drivermansuffix__), +sunleo(__drivermansuffix__), +suntcx(__drivermansuffix__), +tdfx(__drivermansuffix__), +tga(__drivermansuffix__), +trident(__drivermansuffix__), +tseng(__drivermansuffix__), +v4l(__drivermansuffix__), +vesa(__drivermansuffix__), +vga(__drivermansuffix__), +vmware(__drivermansuffix__), +.br +README +.IR , +.br +RELNOTES +.IR , +.br +README.mouse +.IR , +.br +README.DRI +.IR , +.br +Status +.IR , +.br +Install +.IR . + +.SH AUTHORS +XFree86 has many contributors world wide. The names of most of them +can be found in the documentation, CHANGELOG files in the source tree, +and in the actual source code. +.PP +XFree86 was originally based on \fIX386 1.2\fP by Thomas Roell, which +was contributed to the then X Consortium's X11R5 distribution by SGCS. +.PP +The project that became XFree86 was originally founded in 1992 by +David Dawes, Glenn Lai, Jim Tsillas and David Wexelblat. +.PP +XFree86 was later integrated in the then X Consortium's X11R6 release +by a group of dedicated XFree86 developers, including the following: +.PP +.RS 4 +.nf +Stuart Anderson \fIanderson@metrolink.com\fP +Doug Anson \fIdanson@lgc.com\fP +Gertjan Akkerman \fIakkerman@dutiba.twi.tudelft.nl\fP +Mike Bernson \fImike@mbsun.mlb.org\fP +Robin Cutshaw \fIrobin@XFree86.org\fP +David Dawes \fIdawes@XFree86.org\fP +Marc Evans \fImarc@XFree86.org\fP +Pascal Haible \fIhaible@izfm.uni-stuttgart.de\fP +Matthieu Herrb \fIMatthieu.Herrb@laas.fr\fP +Dirk Hohndel \fIhohndel@XFree86.org\fP +David Holland \fIdavidh@use.com\fP +Alan Hourihane \fIalanh@fairlite.demon.co.uk\fP +Jeffrey Hsu \fIhsu@soda.berkeley.edu\fP +Glenn Lai \fIglenn@cs.utexas.edu\fP +Ted Lemon \fImellon@ncd.com\fP +Rich Murphey \fIrich@XFree86.org\fP +Hans Nasten \fInasten@everyware.se\fP +Mark Snitily \fImark@sgcs.com\fP +Randy Terbush \fIrandyt@cse.unl.edu\fP +Jon Tombs \fItombs@XFree86.org\fP +Kees Verstoep \fIversto@cs.vu.nl\fP +Paul Vixie \fIpaul@vix.com\fP +Mark Weaver \fIMark_Weaver@brown.edu\fP +David Wexelblat \fIdwex@XFree86.org\fP +Philip Wheatley \fIPhilip.Wheatley@ColumbiaSC.NCR.COM\fP +Thomas Wolfram \fIwolf@prz.tu-berlin.de\fP +Orest Zborowski \fIorestz@eskimo.com\fP +.fi +.RE +.PP +The current XFree86 core team consists of: +.PP +.RS 4 +.nf +Stuart Anderson \fIanderson@metrolink.com\fP +Preston Brown \fIpbrown@redhat.com\fP +Robin Cutshaw \fIrobin@xfree86.org\fP +David Dawes \fIdawes@xfree86.org\fP +Egbert Eich \fIeich@xfree86.org\fP +Marc Evans \fImarc@xfree86.org\fP +Dirk Hohndel \fIhohndel@xfree86.org\fP +Alan Hourihane \fIalanh@xfree86.org\fP +Harald Koenig \fIkoenig@xfree86.org\fP +Marc La France \fItsi@xfree86.org\fP +Kevin Martin \fImartin@xfree86.org\fP +Rich Murphey \fIrich@xfree86.org\fP +Takaaki Nomura \fIamadeus@yk.rim.or.jp\fP +Keith Packard \fIkeithp@xfree86.org\fP +Jon Tombs \fIjon@gtex02.us.es\fP +Mark Vojkovich \fImarkv@xfree86.org\fP +David Wexelblat \fIdwex@xfree86.org\fP +.fi +.RE +.PP +\fIXFree86\fP source is available from the FTP server +\fI\fP, among others. Documentation +and other information can be found from the XFree86 web site +\fI\fP. Index: xc/programs/Xserver/hw/xfree86/xf86Version.h diff -u xc/programs/Xserver/hw/xfree86/xf86Version.h:3.460.2.4 xc/programs/Xserver/hw/xfree86/xf86Version.h:3.472.2.5 --- xc/programs/Xserver/hw/xfree86/xf86Version.h:3.460.2.4 Fri Mar 16 11:42:31 2001 +++ xc/programs/Xserver/hw/xfree86/xf86Version.h Sat Jun 2 11:27:52 2001 @@ -1,23 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.460.2.4 2001/03/16 16:42:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf86Version.h,v 3.472.2.5 2001/06/02 15:27:52 dawes Exp $ */ -#define XF86_VERSION " 4.0.3 " +#ifndef XF86_VERSION_CURRENT -/* The finer points in versions... */ #define XF86_VERSION_MAJOR 4 -#define XF86_VERSION_MINOR 0 -#define XF86_VERSION_SUBMINOR 3 -#define XF86_VERSION_BETA 0 /* 0="", 1="A", 2="B", etc... */ -#define XF86_VERSION_ALPHA 0 /* 0="", 1="a", 2="b", etc... */ +#define XF86_VERSION_MINOR 1 +#define XF86_VERSION_PATCH 0 +#define XF86_VERSION_SNAP 0 -#define XF86_VERSION_NUMERIC(major,minor,subminor,beta,alpha) \ - ((((((((major << 7) | minor) << 7) | subminor) << 5) | beta) << 5) | alpha) +/* This has five arguments for compatibilty reasons */ +#define XF86_VERSION_NUMERIC(major,minor,patch,snap,dummy) \ + (((major) * 10000000) + ((minor) * 100000) + ((patch) * 1000) + snap) + +/* Define these for compatibility. They'll be removed at some point. */ +#define XF86_VERSION_SUBMINOR XF86_VERSION_PATCH +#define XF86_VERSION_BETA 0 +#define XF86_VERSION_ALPHA XF86_VERSION_SNAP + #define XF86_VERSION_CURRENT \ XF86_VERSION_NUMERIC(XF86_VERSION_MAJOR, \ XF86_VERSION_MINOR, \ - XF86_VERSION_SUBMINOR, \ - XF86_VERSION_BETA, \ - XF86_VERSION_ALPHA) + XF86_VERSION_PATCH, \ + XF86_VERSION_SNAP, \ + 0) + + +#define XF86_DATE "2 June 2001" -#define XF86_DATE "16 March 2001" +#endif /* $XConsortium: xf86Version.h /main/78 1996/10/28 05:42:10 kaleb $ */ Index: xc/programs/Xserver/hw/xfree86/SuperProbe/00README diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/00README:3.5 xc/programs/Xserver/hw/xfree86/SuperProbe/00README:3.6 --- xc/programs/Xserver/hw/xfree86/SuperProbe/00README:3.5 Mon Dec 23 01:30:54 1996 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/00README Sat Jan 6 15:58:02 2001 @@ -69,14 +69,14 @@ Kevin Martin 8514/A, ATI Mach8 and ATI Mach32 probe code. -Marc Aurele La France +Marc Aurele La France ATI Mach64 probe code. The XFree86 Beta Test Team For helping test and debug this software. -$XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/00README,v 3.5 1996/12/23 06:30:54 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/00README,v 3.6 2001/01/06 20:58:02 tsi Exp $ Index: xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h:3.17 xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h:3.18 --- xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h:3.17 Fri Sep 29 04:59:44 2000 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h Sun Apr 1 10:00:07 2001 @@ -57,10 +57,16 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h,v 3.17 2000/09/29 08:59:44 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/AsmMacros.h,v 3.18 2001/04/01 14:00:07 tsi Exp $ */ #if defined(__GNUC__) #if defined(linux) && (defined(__alpha__) || defined(__ia64__)) +#undef inb +#undef inw +#undef inl +#undef outb +#undef outw +#undef outl #define inb _inb #define inw _inw #define inl _inl Index: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c:3.17.2.2 xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c:3.19 --- xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c:3.17.2.2 Fri Mar 2 17:55:24 2001 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c Sat Mar 3 04:53:00 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c,v 3.17.2.2 2001/03/02 22:55:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/OS_386BSD.c,v 3.19 2001/03/03 09:53:00 herrb Exp $ */ /* * (c) Copyright 1993,1994 by David Dawes * Index: xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man diff -u xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man:3.9 xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man:3.10 --- xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man:3.9 Sat Sep 25 10:37:02 1999 +++ xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man Sat Jan 27 13:20:44 2001 @@ -1,5 +1,5 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man,v 3.9 1999/09/25 14:37:02 dawes Exp $ -.TH SuperProbe 1 "XFree86 3.9.17/SuperProbe 2.21" "X Version 11" +.\" $XFree86: xc/programs/Xserver/hw/xfree86/SuperProbe/SuperProbe.man,v 3.10 2001/01/27 18:20:44 dawes Exp $ +.TH SuperProbe 1 __vendorversion__ .SH NAME SuperProbe - probe for and identify installed video hardware. .SH SYNOPSIS Index: xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man diff -u xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man:3.4 xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man:3.5 --- xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man:3.4 Fri Dec 27 01:53:58 1996 +++ xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man Sat Jan 27 13:20:45 2001 @@ -1,6 +1,6 @@ .\" $XConsortium: XF86Setup.man /main/3 1996/12/09 17:37:49 kaleb $ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man,v 3.4 1996/12/27 06:53:58 dawes Exp $ -.TH XF86Setup 1 "Version 3.2" "XFree86" +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/XF86Setup.man,v 3.5 2001/01/27 18:20:45 dawes Exp $ +.TH XF86Setup 1 __vendorversion__ .SH NAME XF86Setup - Graphical configuration utility for XFree86 .SH SYNOPSIS Index: xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man diff -u xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man:3.4 xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man:3.5 --- xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man:3.4 Sun Nov 16 01:18:46 1997 +++ xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man Sat Jan 27 13:20:45 2001 @@ -4,8 +4,8 @@ .\" .\" .\" -.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man,v 3.4 1997/11/16 06:18:46 dawes Exp $ -.TH xmseconfig 1 "Release 6.4 (XFree86 3.3.1)" "X Version 11" +.\" $XFree86: xc/programs/Xserver/hw/xfree86/XF86Setup/scripts/xmseconfig.man,v 3.5 2001/01/27 18:20:45 dawes Exp $ +.TH xmseconfig 1 __vendorversion__ .SH NAME xmseconfig - Graphical mouse configuration utility .SH SYNOPSIS Index: xc/programs/Xserver/hw/xfree86/common/Imakefile diff -u xc/programs/Xserver/hw/xfree86/common/Imakefile:3.125 xc/programs/Xserver/hw/xfree86/common/Imakefile:3.134 --- xc/programs/Xserver/hw/xfree86/common/Imakefile:3.125 Wed Dec 6 10:35:06 2000 +++ xc/programs/Xserver/hw/xfree86/common/Imakefile Mon May 7 17:42:31 2001 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.125 2000/12/06 15:35:06 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/common/Imakefile,v 3.134 2001/05/07 21:42:31 tsi Exp $ @@ -17,7 +17,8 @@ KBD = xf86KbdMach #endif /* GNUMachArchitecture */ #else -# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) +# if defined(i386BsdArchitecture) || defined(AlphaBsdArchitecture) \ + || defined(OpenBSDArchitecture) && defined(PpcArchitecture) KBD = xf86KbdBSD # else # ifdef LinuxArchitecture @@ -59,10 +60,6 @@ EXT_MODULES_DEFINES = $(GLX_DEFINES) #endif -#if defined(LinuxArchitecture) && defined(PpcArchitecture) - KBDDEFINES = -DASSUME_CUSTOM_KEYCODES -#endif - #ifndef XF86ExpireServer #define XF86ExpireServer NO #endif @@ -95,7 +92,7 @@ xf86Cursor.c \ xf86DGA.c \ xf86DPMS.c \ - xf86DefModes.c \ + xf86DefModeSet.c \ xf86DoProbe.c \ xf86DoScanPci.c \ xf86Events.c \ @@ -109,6 +106,7 @@ xf86VidMode.c \ xf86fbman.c \ xf86xv.c \ + xf86xvmc.c \ xf86cmap.c\ xf86PM.c \ $(DEBUGSRC) \ @@ -130,7 +128,7 @@ xf86Cursor.o \ xf86DGA.o \ xf86DPMS.o \ - xf86DefModes.o \ + xf86DefModeSet.o \ xf86DoProbe.o \ xf86DoScanPci.o \ xf86Events.o \ @@ -143,6 +141,7 @@ xf86VidMode.o \ xf86fbman.o \ xf86xv.o \ + xf86xvmc.o \ xf86cmap.o\ xf86PM.o \ $(DEBUGOBJ) \ @@ -180,7 +179,6 @@ #endif CONSDEFINES = XFree86ConsoleDefines EXP_DEFINES = -DEXPIRY_TIME=XF86ServerExpiry $(EXP_FORCE_DEFINES) -PROJECTROOT = ProjectRoot DRIVERS = XF86CardDrivers IDRIVERS = XInputDrivers XCONFIGDEFINES = -DPROJECTROOT='"$(PROJECTROOT)"' \ @@ -189,7 +187,7 @@ XF86CONFIGFILE = XConfigFile XCONFIGUREDEFINES = -DXF86CONFIGFILE='"$(XF86CONFIGFILE)"' - DEFINES = $(CONSDEFINES) $(KBDDEFINES) $(EXT_DEFINES) $(OSDEFINES) + DEFINES = $(CONSDEFINES) $(KBDDEFINES) $(EXT_DEFINES) $(OS_DEFINES) AllTarget($(OFILES)) @@ -216,6 +214,28 @@ LinkSourceFile(xf86Sbus.h,$(XF86OSSRC)/bus) #endif +#if HasPerl +MODEDEFSRCS = ../etc/vesamodes ../etc/extramodes + +MODEDEFS = modedefs + +$(MODEDEFS): $(MODEDEFSRCS) + RemoveFile($@) + cat $(MODEDEFSRCS) > $@ + +includes:: xf86DefModeSet.c + +xf86DefModeSet.c: $(MODEDEFS) modeline2c.pl + RemoveFile($@) + RunPerlScript(modeline2c.pl, < $(MODEDEFS) > $@) + +clean:: + RemoveFile($(MODEDEFS)) + RemoveFile(xf86DefModeSet.c) +#else +LinkFile(xf86DefModeSet.c,xf86DefModes.c) +#endif + #ifndef OS2Architecture DependTarget() #endif @@ -236,3 +256,4 @@ InstallDriverSDKNonExecFile(xf86fbman.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(xf86str.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(xf86xv.h,$(DRIVERSDKINCLUDEDIR)) +InstallDriverSDKNonExecFile(xf86xvmc.h,$(DRIVERSDKINCLUDEDIR)) Index: xc/programs/Xserver/hw/xfree86/common/atKeynames.h diff -u xc/programs/Xserver/hw/xfree86/common/atKeynames.h:3.15 xc/programs/Xserver/hw/xfree86/common/atKeynames.h:3.17 --- xc/programs/Xserver/hw/xfree86/common/atKeynames.h:3.15 Fri Aug 11 19:59:48 2000 +++ xc/programs/Xserver/hw/xfree86/common/atKeynames.h Fri May 18 12:03:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.15 2000/08/11 23:59:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/atKeynames.h,v 3.17 2001/05/18 16:03:10 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -189,11 +189,16 @@ #define KEY_F13 /* F13 0x6e */ 110 #define KEY_F14 /* F14 0x6f */ 111 #define KEY_F15 /* F15 0x70 */ 112 +#define KEY_HKTG /* Hirugana/Katakana tog 0x70 */ 112 #define KEY_F16 /* F16 0x71 */ 113 #define KEY_F17 /* F17 0x72 */ 114 #define KEY_KP_DEC /* KP_DEC 0x73 */ 115 +#define KEY_BSlash2 /* \ _ 0x73 */ 115 +#define KEY_XFER /* Kanji Transfer 0x79 */ 121 +#define KEY_NFER /* No Kanji Transfer 0x7b */ 123 +#define KEY_Yen /* Yen 0x7d */ 125 -/* These are for "notused" and "uknown" entries in translation maps. */ +/* These are for "notused" and "unknown" entries in translation maps. */ #define KEY_NOTUSED 0 #define KEY_UNKNOWN 255 Index: xc/programs/Xserver/hw/xfree86/common/compiler.h diff -u xc/programs/Xserver/hw/xfree86/common/compiler.h:3.76 xc/programs/Xserver/hw/xfree86/common/compiler.h:3.81 --- xc/programs/Xserver/hw/xfree86/common/compiler.h:3.76 Thu Dec 7 10:43:40 2000 +++ xc/programs/Xserver/hw/xfree86/common/compiler.h Mon Apr 23 12:17:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/compiler.h,v 3.76 2000/12/07 15:43:40 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. * @@ -429,6 +429,19 @@ #define mem_barrier() __asm__ __volatile__ ("mf" ::: "memory") #define write_mem_barrier() __asm__ __volatile__ ("mf" ::: "memory") +/* + * This is overkill, but for different reasons depending on where it is used. + * This is thus general enough to be used everywhere cache flushes are needed. + * It doesn't handle memory access serialisation by other processors, though. + */ +#define ia64_flush_cache(Addr) \ + __asm__ __volatile__ ( \ + "fc %0;;;" \ + "sync.i;;;" \ + "mf;;;" \ + "srlz.i;;;" \ + :: "r"(Addr) : "memory") + #undef outb #undef outw #undef outl @@ -437,7 +450,7 @@ #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 @@ -446,92 +459,126 @@ #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; @@ -541,8 +588,9 @@ 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; @@ -552,8 +600,9 @@ 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; @@ -563,8 +612,9 @@ 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; @@ -574,8 +624,9 @@ 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; @@ -585,8 +636,9 @@ 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; @@ -595,8 +647,9 @@ : "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; @@ -605,8 +658,9 @@ : "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; @@ -615,8 +669,9 @@ : "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; @@ -625,8 +680,9 @@ : "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; @@ -753,19 +809,19 @@ 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); } @@ -840,7 +896,7 @@ #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__( @@ -849,11 +905,11 @@ : "=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__( @@ -862,11 +918,11 @@ : "=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__( @@ -875,11 +931,11 @@ : "=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__( @@ -888,11 +944,11 @@ : "=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__( @@ -901,12 +957,12 @@ : "=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" @@ -915,8 +971,8 @@ } 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" @@ -925,8 +981,8 @@ } 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" @@ -935,8 +991,8 @@ } 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" @@ -945,8 +1001,8 @@ } 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" @@ -955,42 +1011,42 @@ } 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(); } @@ -999,42 +1055,42 @@ 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) @@ -1388,13 +1444,13 @@ #endif /* - * This header sometimes gets included where is isn't needed, and on some - * OSs this causes problems because the following functions generate - * references to inb() and outb() which can't be resolved. Defining - * NO_COMPILER_H_EXTRAS avoids this problem. + * This header sometimes gets included where is isn't needed, and on some OSs + * this causes problems because the following functions generate references to + * inx() and outx() which can't be resolved. If you need the extra definitions + * below, #define COMPILER_H_EXTRAS. */ -#ifndef NO_COMPILER_H_EXTRAS +#ifdef COMPILER_H_EXTRAS /* *----------------------------------------------------------------------- * Port manipulation convenience functions @@ -1418,7 +1474,7 @@ if (port == 0x3C0) /* reset attribute flip-flop */ (void) inb(0x3DA); outb(port, ind); - return(inb(port+1)); + return inb(port+1); } /* @@ -1461,7 +1517,7 @@ outb(port, old | mask); new2 = inb(port) & mask; outb(port, old); - return((new1 == 0) && (new2 == mask)); + return (new1 == 0) && (new2 == mask); } /* @@ -1479,7 +1535,7 @@ wrinx(port, ind, old | mask); new2 = rdinx(port, ind) & mask; wrinx(port, ind, old); - return((new1 == 0) && (new2 == mask)); + return (new1 == 0) && (new2 == mask); } /* @@ -1489,9 +1545,9 @@ static __inline__ int testinx(unsigned short port, unsigned char ind) { - return(testinx2(port, ind, 0xFF)); + return testinx2(port, ind, 0xFF); } -#endif /* NO_COMPILER_H_EXTRAS */ +#endif /* COMPILER_H_EXTRAS */ #endif /* NO_INLINE */ @@ -1510,27 +1566,28 @@ extern void xf86JensenBusToMem(char *, char *, unsigned long, int); extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int); extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); + /* Some macros to hide the system dependencies for MMIO accesses */ /* Changed to kill noise generated by gcc's -Wcast-align */ #define MMIO_IN8(base, offset) (*xf86ReadMmio8)(base, offset) #define MMIO_IN16(base, offset) (*xf86ReadMmio16)(base, offset) -# if defined (JENSEN_SUPPORT) #define MMIO_IN32(base, offset) (*xf86ReadMmio32)(base, offset) + +# if defined (JENSEN_SUPPORT) #define MMIO_OUT32(base, offset, val) \ (*xf86WriteMmio32)((CARD32)(val), base, offset) #define MMIO_ONB32(base, offset, val) \ (*xf86WriteMmioNB32)((CARD32)(val), base, offset) # else -#define MMIO_IN32(base, offset) \ - *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) #define MMIO_OUT32(base, offset, val) \ do { \ - *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \ write_mem_barrier(); \ + *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val); \ } while (0) #define MMIO_ONB32(base, offset, val) \ *(volatile CARD32 *)(void *)(((CARD8*)(base)) + (offset)) = (val) # endif + #define MMIO_OUT8(base, offset, val) \ (*xf86WriteMmio8)((CARD8)(val), base, offset) #define MMIO_OUT16(base, offset, val) \ @@ -1539,6 +1596,7 @@ (*xf86WriteMmioNB8)((CARD8)(val), base, offset) #define MMIO_ONB16(base, offset, val) \ (*xf86WriteMmioNB16)((CARD16)(val), base, offset) + #elif defined(__powerpc__) /* * we provide byteswapping and no byteswapping functions here @@ -1550,6 +1608,7 @@ xf86WriteMmio8(base, offset, (CARD8)(val)) # define MMIO_ONB8(base, offset, val) \ xf86WriteMmioNB8(base, offset, (CARD8)(val)) + # if defined(PPC_MMIO_IS_BE) /* No byteswapping */ # define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset) # define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset) @@ -1573,6 +1632,7 @@ # define MMIO_ONB32(base, offset, val) \ xf86WriteMmioNB32Le(base, offset, (CARD32)(val)) # endif + static __inline__ void ppc_flush_icache(char *addr) { __asm__ volatile ( @@ -1597,6 +1657,7 @@ xf86WriteMmio8(base, offset, (CARD8)(val)) # define MMIO_ONB8(base, offset, val) \ xf86WriteMmio8NB(base, offset, (CARD8)(val)) + # if defined(SPARC_MMIO_IS_BE) /* No byteswapping */ # define MMIO_IN16(base, offset) xf86ReadMmio16Be(base, offset) # define MMIO_IN32(base, offset) xf86ReadMmio32Be(base, offset) @@ -1620,7 +1681,9 @@ # define MMIO_ONB32(base, offset, val) \ xf86WriteMmio32LeNB(base, offset, (CARD32)(val)) # endif + #else /* !__alpha__ && !__powerpc__ && !__sparc__ */ + #define MMIO_IN8(base, offset) \ *(volatile CARD8 *)(((CARD8*)(base)) + (offset)) #define MMIO_IN16(base, offset) \ @@ -1636,6 +1699,7 @@ #define MMIO_ONB8(base, offset, val) MMIO_OUT8(base, offset, val) #define MMIO_ONB16(base, offset, val) MMIO_OUT16(base, offset, val) #define MMIO_ONB32(base, offset, val) MMIO_OUT32(base, offset, val) + #endif /* __alpha__ */ /* Index: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl diff -u xc/programs/Xserver/hw/xfree86/common/modeline2c.pl:1.3 xc/programs/Xserver/hw/xfree86/common/modeline2c.pl:1.7 --- xc/programs/Xserver/hw/xfree86/common/modeline2c.pl:1.3 Thu Nov 18 11:52:06 1999 +++ xc/programs/Xserver/hw/xfree86/common/modeline2c.pl Fri Apr 6 20:50:15 2001 @@ -1,6 +1,6 @@ #!/usr/bin/perl -# automatically generate the xf86DefaultModes.c file from a normal +# automatically generate the xf86DefModeSet.c file from a normal # XF86Config style file of Modelines # # run as @@ -8,11 +8,11 @@ # perl /modeline2c.pl < [modesfile] > xf86DefModes.c # # hackish perl - author Dirk Hohndel -# Copyright 1999 by The XFree86 Project, Inc. +# Copyright 1999-2001 by The XFree86 Project, Inc. # -# $XFree86: xc/programs/Xserver/hw/xfree86/common/modeline2c.pl,v 1.3 1999/11/18 16:52:06 tsi 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"; @@ -24,14 +24,14 @@ $flagshash{"+hsync -vsync"} = "V_PHSYNC | V_NVSYNC"; $flagshash{"-hsync +vsync"} = "V_NHSYNC | V_PVSYNC"; $flagshash{"-hsync -vsync"} = "V_NHSYNC | V_NVSYNC"; -$flagshash{"+hsync +vsync Interlace"} = "V_PHSYNC | V_PVSYNC | V_INTERLACE"; -$flagshash{"+hsync -vsync Interlace"} = "V_PHSYNC | V_NVSYNC | V_INTERLACE"; -$flagshash{"-hsync +vsync Interlace"} = "V_NHSYNC | V_PVSYNC | V_INTERLACE"; -$flagshash{"-hsync -vsync Interlace"} = "V_NHSYNC | V_NVSYNC | V_INTERLACE"; +$flagshash{"+hsync +vsync interlace"} = "V_PHSYNC | V_PVSYNC | V_INTERLACE"; +$flagshash{"+hsync -vsync interlace"} = "V_PHSYNC | V_NVSYNC | V_INTERLACE"; +$flagshash{"-hsync +vsync interlace"} = "V_NHSYNC | V_PVSYNC | V_INTERLACE"; +$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 @@ -45,14 +45,13 @@ #include \"xf86.h\" #include \"xf86Config.h\" -#define NO_COMPILER_H_EXTRAS #include \"xf86Priv.h\" #include \"xf86_OSlib.h\" #include \"globals.h\" #define MODEPREFIX(name) NULL, NULL, name, 0,M_T_DEFAULT -#define MODESUFFIX 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0 +#define MODESUFFIX 0,0, 0,0,0,0,0,0,0, 0,0,0,0,0,0,FALSE,FALSE,0,NULL,0,0.0,0.0 DisplayModeRec xf86DefaultModes [] = { "); @@ -62,10 +61,11 @@ chop; print "/*" . $_ . " */\n"; } - if (/^ModeLine\s+(\S+)\s+([\d.\s]+)(.*)/) { - my $name = $1; - my $values = $2; - my $flags = $3; + if (/^ModeLine\s+(\S+)\s+([\d.\s]+)(.*)/i) { + $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", $name,$1*1000,$2,$3,$4,$5,$6,$7,$8,$9,$flagshash{$flags}); Index: xc/programs/Xserver/hw/xfree86/common/xf86.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86.h:3.147 xc/programs/Xserver/hw/xfree86/common/xf86.h:3.152 --- xc/programs/Xserver/hw/xfree86/common/xf86.h:3.147 Thu Dec 7 15:26:19 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86.h Wed May 16 16:08:35 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.147 2000/12/07 20:26:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86.h,v 3.152 2001/05/16 20:08:35 paulo Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -42,6 +42,8 @@ #ifdef __sparc__ extern Bool sbusSlotClaimed; #endif +extern confDRIRec xf86ConfigDRI; + #define XF86SCRNINFO(p) ((ScrnInfoPtr)((p)->devPrivates[xf86ScreenIndex].ptr)) #define XF86FLIP_PIXELS() \ @@ -134,6 +136,7 @@ char n, pciVideoPtr pvp_exclude); pciVideoPtr xf86FindPciClass(CARD8 intf, CARD8 subClass, CARD16 class, char n, pciVideoPtr pvp_exclude); +void xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable); void xf86RegisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func, pointer arg); Bool xf86DeregisterStateChangeNotificationCallback(xf86StateChangeNotificationCallbackFunc func); #ifdef async @@ -308,6 +311,11 @@ int format, unsigned long len, pointer value); Bool xf86IsUnblank(int mode); + +#ifdef XFree86LOADER +void xf86AddModuleInfo(ModuleInfoPtr info, pointer module); +void xf86DeleteModuleInfo(int idx); +#endif /* xf86Debug.c */ #ifdef BUILDDEBUG Index: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Bus.c:1.56.2.1 xc/programs/Xserver/hw/xfree86/common/xf86Bus.c:1.61.2.2 --- xc/programs/Xserver/hw/xfree86/common/xf86Bus.c:1.56.2.1 Sat Feb 10 05:23:53 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Bus.c Sat Jun 2 11:27:54 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.56.2.1 2001/02/10 10:23:53 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.c,v 1.61.2.2 2001/06/02 15:27:54 dawes Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. */ @@ -46,22 +46,23 @@ #endif /* resource lists */ -resPtr Acc = NULL; +resPtr Acc = NULL; +resPtr osRes = NULL; /* allocatable ranges */ resPtr ResRange = NULL; /* predefined special resources */ -resRange resVgaExclusive[] = {_VGA_EXCLUSIVE, _END}; -resRange resVgaShared[] = {_VGA_SHARED, _END}; -resRange resVgaMemShared[] = {_VGA_SHARED_MEM,_END}; -resRange resVgaIoShared[] = {_VGA_SHARED_IO,_END}; -resRange resVgaUnusedExclusive[] = {_VGA_EXCLUSIVE_UNUSED, _END}; -resRange resVgaUnusedShared[] = {_VGA_SHARED_UNUSED, _END}; -resRange resVgaSparseExclusive[] = {_VGA_EXCLUSIVE_SPARSE, _END}; -resRange resVgaSparseShared[] = {_VGA_SHARED_SPARSE, _END}; -resRange res8514Exclusive[] = {_8514_EXCLUSIVE, _END}; -resRange res8514Shared[] = {_8514_SHARED, _END}; +const resRange resVgaExclusive[] = {_VGA_EXCLUSIVE, _END}; +const resRange resVgaShared[] = {_VGA_SHARED, _END}; +const resRange resVgaMemShared[] = {_VGA_SHARED_MEM,_END}; +const resRange resVgaIoShared[] = {_VGA_SHARED_IO,_END}; +const resRange resVgaUnusedExclusive[] = {_VGA_EXCLUSIVE_UNUSED, _END}; +const resRange resVgaUnusedShared[] = {_VGA_SHARED_UNUSED, _END}; +const resRange resVgaSparseExclusive[] = {_VGA_EXCLUSIVE_SPARSE, _END}; +const resRange resVgaSparseShared[] = {_VGA_SHARED_SPARSE, _END}; +const resRange res8514Exclusive[] = {_8514_EXCLUSIVE, _END}; +const resRange res8514Shared[] = {_8514_SHARED, _END}; /* Flag: do we need RAC ? */ static Bool needRAC = FALSE; @@ -225,12 +226,13 @@ switch (pEnt->busType) { case BUS_PCI: - return (primaryBus.type == BUS_PCI && - pEnt->pciBusId.bus == primaryBus.id.pci.bus && + return (pEnt->pciBusId.bus == primaryBus.id.pci.bus && pEnt->pciBusId.device == primaryBus.id.pci.device && pEnt->pciBusId.func == primaryBus.id.pci.func); case BUS_ISA: - return ( primaryBus.type == BUS_ISA ); + return TRUE; + case BUS_SBUS: + return (pEnt->sbusBusId.fbNum == primaryBus.id.sbus.fbNum); default: return FALSE; } @@ -1365,7 +1367,8 @@ xf86ResourceBrokerInit(void) { resPtr resPci; - resPtr osRes = NULL; + + osRes = NULL; /* Get the addressable ranges */ ResRange = xf86BusAccWindowsFromOS(); @@ -1373,14 +1376,13 @@ xf86PrintResList(3, ResRange); /* Get the ranges used exclusively by the system */ - osRes = xf86AccResFromOS(osRes); /*these need to be in host address space*/ + osRes = xf86AccResFromOS(osRes); xf86MsgVerb(X_INFO, 3, "OS-reported resource ranges:\n"); xf86PrintResList(3, osRes); /* Bus dep initialization */ resPci = ResourceBrokerInitPci(&osRes); - Acc = xf86JoinResLists(osRes, resPci); - + Acc = xf86JoinResLists(xf86DupResList(osRes), resPci); xf86MsgVerb(X_INFO, 3, "All system resource ranges:\n"); xf86PrintResList(3, Acc); @@ -1397,7 +1399,7 @@ * only deals with exclusive resources. */ void -RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment) +RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, Bool useEstimated) { resPtr pRes; memType size, newsize, adjust; @@ -1408,24 +1410,24 @@ (target->res_type & ResPhysMask)) && pRes->block_begin <= target->block_end && pRes->block_end >= target->block_begin) { + /* Possibly ignore estimated resources */ + if (!useEstimated && (pRes->res_type & ResEstimated)) continue; /* - * target should be a larger region than pRes. If pRes fully + * Target should be a larger region than pRes. If pRes fully * contains target, don't do anything. */ if (pRes->block_begin <= target->block_begin && pRes->block_end >= target->block_end) continue; /* - * cases where the target and pRes have the same starting address - * cannot be resolved, so skip them (with a warning). + * In cases where the target and pRes have the same starting + * address, reduce the size of the target (given it's an estimate). */ if (pRes->block_begin == target->block_begin) { - xf86MsgVerb(X_WARNING, 3, "Unresolvable overlap at 0x%08x\n", - pRes->block_begin); - continue; + target->block_end = pRes->block_end; } /* Otherwise, trim target to remove the overlap */ - if (pRes->block_begin <= target->block_end) { + else if (pRes->block_begin <= target->block_end) { target->block_end = pRes->block_begin - 1; } else if (!pow2Alignment && pRes->block_end >= target->block_begin) { @@ -1710,11 +1712,13 @@ { resPtr res = NULL; resRange range; - + resList list_f = NULL; + if (!list) { list = xf86GetResourcesImplicitly(entityIndex); /* these resources have to be in host address space already */ if (!list) return NULL; + list_f = list; } while(list->type != ResEnd) { @@ -1727,13 +1731,20 @@ range.type = (range.type & ~ResAccMask) | (access & ResAccMask); } range.type &= ~ResEstimated; /* Not allowed for drivers */ +#if !(defined(__alpha__) && defined(linux)) + /* On Alpha Linux, do not check for conflicts, trust the kernel. */ if (checkConflict(&range, Acc, entityIndex, SETUP,TRUE)) res = xf86AddResToList(res,&range,entityIndex); - else { + else +#endif + { Acc = xf86AddResToList(Acc,&range,entityIndex); } list++; } + if (list_f) + xfree(list_f); + #ifdef DEBUG xf86MsgVerb(X_INFO, 3,"Resources after driver initialization\n"); xf86PrintResList(3, Acc); @@ -2073,6 +2084,8 @@ * xf86EnterServerState() -- set state the server is in. */ +typedef enum { TRI_UNSET, TRI_TRUE, TRI_FALSE } TriState; + void xf86EnterServerState(xf86State state) { @@ -2080,13 +2093,29 @@ ScrnInfoPtr pScrn; int i,j; resType rt; + static int sigio_state; + static TriState sigio_blocked = TRI_UNSET; + /* + * This is a good place to block SIGIO during SETUP state. + * SIGIO should be blocked in SETUP state otherwise (u)sleep() + * might get interrupted early. + * We take care not to call xf86BlockSIGIO() twice. + */ + if ((state == SETUP) && (sigio_blocked != TRI_TRUE)) { + sigio_state = xf86BlockSIGIO(); + sigio_blocked = TRI_TRUE; + } else if ((state == OPERATING) && (sigio_blocked != TRI_UNSET)) { + xf86UnblockSIGIO(sigio_state); + sigio_blocked = TRI_FALSE; + } #ifdef DEBUG if (state == SETUP) ErrorF("Entering SETUP state\n"); else ErrorF("Entering OPERATING state\n"); #endif + /* When servicing a dump framebuffer we don't need to do anything */ if (doFramebufferMode) return; @@ -2456,7 +2485,10 @@ } xf86FreeResList(acc); +#if !(defined(__alpha__) && defined(linux)) + /* No need to validate on Alpha Linux, trust the kernel. */ ValidatePci(); +#endif xf86MsgVerb(X_INFO, 3, "resource ranges after probing:\n"); xf86PrintResList(3, Acc); @@ -2975,13 +3007,13 @@ CheckGenericGA(); if (primaryBus.type != BUS_NONE) { char *bus; - char *loc = xnfcalloc(1,8); + char *loc = xnfcalloc(1,9); if (loc == NULL) return; switch (primaryBus.type) { case BUS_PCI: bus = "PCI"; - sprintf(loc,"%2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus, + sprintf(loc," %2.2x:%2.2x:%1.1x",primaryBus.id.pci.bus, primaryBus.id.pci.device,primaryBus.id.pci.func); break; case BUS_ISA: @@ -2990,14 +3022,14 @@ break; case BUS_SBUS: bus = "SBUS"; - sprintf(loc,"%2.2x",primaryBus.id.sbus.fbNum); + sprintf(loc," %2.2x",primaryBus.id.sbus.fbNum); break; default: bus = ""; loc[0] = '\0'; } - xf86MsgVerb(X_INFO, 2, "Primary Device is: %s %s\n",bus,loc); + xf86MsgVerb(X_INFO, 2, "Primary Device is: %s%s\n",bus,loc); xfree(loc); } Index: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Bus.h:1.16 xc/programs/Xserver/hw/xfree86/common/xf86Bus.h:1.18 --- xc/programs/Xserver/hw/xfree86/common/xf86Bus.h:1.16 Tue Jun 20 01:08:43 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Bus.h Sun Feb 11 20:25:23 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.16 2000/06/20 05:08:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Bus.h,v 1.18 2001/02/12 01:25:23 tsi Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. */ @@ -113,6 +113,7 @@ extern xf86AccessRec AccessNULL; extern BusRec primaryBus; extern resPtr Acc; +extern resPtr osRes; extern resPtr ResRange; extern BusAccPtr xf86BusAccInfo; @@ -124,7 +125,8 @@ resPtr xf86ExtractTypeFromList(resPtr list, unsigned long type); resPtr findIntersect(resRange Range, resPtr list); resPtr xf86FindIntersect(resRange Range, resPtr list); -void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment); +void RemoveOverlaps(resPtr target, resPtr list, Bool pow2Alignment, + Bool useEstimated); void xf86ConvertListToHost(int entityIndex, resPtr list); #endif /* _XF86_BUS_H */ Index: xc/programs/Xserver/hw/xfree86/common/xf86Config.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Config.c:3.236 xc/programs/Xserver/hw/xfree86/common/xf86Config.c:3.242 --- xc/programs/Xserver/hw/xfree86/common/xf86Config.c:3.236 Wed Dec 6 10:35:07 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Config.c Wed May 16 16:08:35 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.236 2000/12/06 15:35:07 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Config.c,v 3.242 2001/05/16 20:08:35 paulo Exp $ */ /* @@ -23,7 +23,6 @@ #include "xf86Parser.h" #include "xf86tokens.h" #include "xf86Config.h" -#define NO_COMPILER_H_EXTRAS #include "xf86Priv.h" #include "xf86_OSlib.h" @@ -455,6 +454,7 @@ const char *subdirs[] = {NULL, NULL}; static const char *patlist[] = {"(.*)_drv\\.so", "(.*)_drv\\.o", NULL}; char **dlist, **clist, **dcp, **ccp; + int size; subdirs[0] = dirname; @@ -469,13 +469,16 @@ /* The resulting list cannot be longer than the module list */ for (dcp = dlist, count = 0; *dcp++; count++); - driverlist = (char **)xnfalloc((count + 1) * sizeof(char *)); + driverlist = (char **)xnfalloc((size = count + 1) * sizeof(char *)); /* First, add modules not in compiled-in list */ for (count = 0, dcp = dlist; *dcp; dcp++) { for (ccp = clist; ; ccp++) { if (!*ccp) { driverlist[count++] = *dcp; + if (count >= size) + driverlist = (char**) + xnfrealloc(driverlist, ++size * sizeof(char*)); break; } if (!strcmp(*ccp, *dcp)) @@ -488,6 +491,9 @@ for (dcp = dlist; *dcp; dcp++) { if (!strcmp(*ccp, *dcp)) { driverlist[count++] = *ccp; + if (count >= size) + driverlist = (char**) + xnfrealloc(driverlist, ++size * sizeof(char*)); break; } } @@ -775,14 +781,12 @@ Bool value; MessageType from; - if(flagsconf == NULL) - return TRUE; /* * Merge the ServerLayout and ServerFlags options. The former have * precedence over the latter. */ optp = NULL; - if (flagsconf->flg_option_lst) + if (flagsconf && flagsconf->flg_option_lst) optp = xf86optionListDup(flagsconf->flg_option_lst); if (layoutopts) { tmp = xf86optionListDup(layoutopts); @@ -939,9 +943,9 @@ configInputKbd(IDevPtr inputp) { char *s; -#ifdef XKB MessageType from = X_DEFAULT; -#endif + Bool customKeycodesDefault = FALSE; + int verb = 0; /* Initialize defaults */ xf86Info.xleds = 0L; @@ -954,6 +958,7 @@ #if defined(SVR4) && defined(i386) xf86Info.panix106 = FALSE; #endif + xf86Info.kbdCustomKeycodes = FALSE; #ifdef XKB if (!xf86IsPc98()) { xf86Info.xkbrules = "xfree86"; @@ -986,28 +991,34 @@ #else xf86Info.kbdEvents = xf86KbdEvents; #endif + xfree(s); } else if (xf86NameCmp(s, "xqueue") == 0) { #ifdef XQUEUE xf86Info.kbdProc = xf86XqueKbdProc; xf86Info.kbdEvents = xf86XqueEvents; xf86Msg(X_CONFIG, "Xqueue selected for keyboard input\n"); #endif + xfree(s); #ifdef WSCONS_SUPPORT } else if (xf86NameCmp(s, "wskbd") == 0) { int xf86WSKbdProc(DeviceIntPtr, int); xf86Info.kbdProc = xf86WSKbdProc; xf86Info.kbdEvents = xf86KbdEvents; + xfree(s); s = xf86SetStrOption(inputp->commonOptions, "Device", NULL); xf86Msg(X_CONFIG, "Keyboard: Protocol: wskbd\n"); xf86Info.kbdFd = open(s, O_RDONLY | O_NONBLOCK | O_EXCL); if (xf86Info.kbdFd == -1) { xf86ConfigError("cannot open \"%s\"", s); + xfree(s); return FALSE; } + xfree(s); #endif } else { xf86ConfigError("\"%s\" is not a valid keyboard protocol name", s); + xfree(s); return FALSE; } @@ -1015,9 +1026,12 @@ if (s) { if (sscanf(s, "%d %d", &xf86Info.kbdDelay, &xf86Info.kbdRate) != 2) { xf86ConfigError("\"%s\" is not a valid AutoRepeat value", s); + xfree(s); return FALSE; } + xfree(s); } + s = xf86SetStrOption(inputp->commonOptions, "XLeds", NULL); if (s) { char *l, *end; @@ -1029,10 +1043,12 @@ xf86Info.xleds |= 1L << (i - 1); else { xf86ConfigError("\"%s\" is not a valid XLeds value", l); + xfree(s); return FALSE; } l = strtok(NULL, " \t\n"); } + xfree(s); } #ifdef XKB @@ -1047,7 +1063,7 @@ if (noXkbExtension) xf86Msg(from, "XKB: disabled\n"); -#define NULL_IF_EMPTY(s) (s[0] ? s : NULL) +#define NULL_IF_EMPTY(s) (s[0] ? s : (xfree(s), NULL)) if (!noXkbExtension && !XkbInitialMap) { if ((s = xf86SetStrOption(inputp->commonOptions, "XkbKeymap", NULL))) { @@ -1125,6 +1141,39 @@ } #endif + /* + * This was once a compile time option (ASSUME_CUSTOM_KEYCODES) + * defaulting to 1 on Linux/PPC. It is no longer necessary, but for + * backwards compatibility we provide 'Option "CustomKeycodes"' + * and try to autoprobe on Linux/PPC. + */ + from = X_DEFAULT; + verb = 2; +#if defined(__linux__) && defined(__powerpc__) + { + FILE *f; + + f = fopen("/proc/sys/dev/mac_hid/keyboard_sends_linux_keycodes","r"); + if (f) { + if (fgetc(f) == '0') { + customKeycodesDefault = TRUE; + from = X_PROBED; + verb = 1; + } + fclose(f); + } + } +#endif + if (xf86FindOption(inputp->commonOptions, "CustomKeycodes")) { + from = X_CONFIG; + verb = 1; + } + xf86Info.kbdCustomKeycodes = + xf86SetBoolOption(inputp->commonOptions, "CustomKeycodes", + customKeycodesDefault); + xf86MsgVerb(from, verb, "Keyboard: CustomKeycode %s\n", + xf86Info.kbdCustomKeycodes ? "enabled" : "disabled"); + return TRUE; } @@ -2060,6 +2109,7 @@ X_INFO_STRING " informational,\n" " " X_WARNING_STRING " warning, " X_ERROR_STRING " error, " + X_NOT_IMPLEMENTED_STRING " not implemented, " X_UNKNOWN_STRING " unknown.\n"); /* Index: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Configure.c:3.49.2.1 xc/programs/Xserver/hw/xfree86/common/xf86Configure.c:3.55 --- xc/programs/Xserver/hw/xfree86/common/xf86Configure.c:3.49.2.1 Sun Feb 11 13:03:48 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86Configure.c Mon May 7 17:38:51 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.49.2.1 2001/02/11 18:03:48 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Configure.c,v 3.55 2001/05/07 21:38:51 tsi Exp $ */ /* * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales. * @@ -161,10 +161,10 @@ i = nDevToConfig++; DevToConfig = xnfrealloc(DevToConfig, nDevToConfig * sizeof(DevToConfigRec)); -#if 0 /* Doesn't work when a driver detects more than one adapter */ - if (i > 0 && isPrimary) { +#if 1 /* Doesn't work when a driver detects more than one adapter */ + if ((i > 0) && isPrimary) { memmove(DevToConfig + 1,DevToConfig, - (nDevToConfig - 1) * sizeof(DevToConfigRec)); + (nDevToConfig - 1) * sizeof(DevToConfigRec)); i = 0; } #endif @@ -213,7 +213,7 @@ # undef CardName if (chipset < 0) - chipset = (pVideo->vendor << 16) || pVideo->chipType; + chipset = (pVideo->vendor << 16) | pVideo->chipType; } break; case BUS_ISA: @@ -246,7 +246,7 @@ /* Get driver's available options */ if (xf86DriverList[CurrentDriver]->AvailableOptions) - NewDevice.GDev.options = + NewDevice.GDev.options = (OptionInfoPtr) (*xf86DriverList[CurrentDriver]->AvailableOptions)(chipset, bus); @@ -366,6 +366,29 @@ return ptr; } +static char* +optionTypeToSting(OptionValueType type) +{ + switch (type) { + case OPTV_NONE: + return ""; + case OPTV_INTEGER: + return ""; + case OPTV_STRING: + return ""; + case OPTV_ANYSTR: + return "[]"; + case OPTV_REAL: + return ""; + case OPTV_BOOLEAN: + return "[]"; + case OPTV_FREQ: + return ""; + default: + return ""; + } +} + static XF86ConfDevicePtr configureDeviceSection (int screennum) { @@ -403,14 +426,23 @@ /* Make sure older drivers don't segv */ if (DevToConfig[screennum].GDev.options) { /* Fill in the available driver options for people to use */ - ptr->dev_comment = xnfalloc(32 + 1); + ptr->dev_comment = xnfalloc(240 + 1); strcpy(ptr->dev_comment, "Available Driver options are:-\n"); + strcat(ptr->dev_comment, " ### Values: : integer, : " + "float, : \"True\"/\"False\",\n" + " ### : \"String\", " + ": \" Hz/kHz/MHz\"\n"); + strcat(ptr->dev_comment, " ### [arg]: arg optional\n"); for (p = DevToConfig[screennum].GDev.options; p->name != NULL; p++) { + char *optname = xnfalloc(strlen(p->name) + 6); + char *p_e; ptr->dev_comment = xrealloc(ptr->dev_comment, - strlen(ptr->dev_comment) + strlen(p->name) + 24 + 1); - strcat(ptr->dev_comment, " #Option \""); - strcat(ptr->dev_comment, p->name); - strcat(ptr->dev_comment, "\"\n"); + strlen(ptr->dev_comment) + 80 + 1); + p_e = ptr->dev_comment + strlen(ptr->dev_comment); + sprintf(optname,"\"%s\"",p->name); + sprintf(p_e, " #Option %-20s \t# %s\n", + optname, optionTypeToSting(p->type)); + xfree(optname); } } @@ -554,7 +586,9 @@ 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); @@ -611,7 +645,12 @@ case DT: case DS_STD_TIMINGS: case DS_WHITE_P: + break; case DS_NAME: + xfree(ptr->mon_modelname); + ptr->mon_modelname = + strdup((char*)(ConfiguredMonitor->det_mon[i].section.name)); + break; case DS_ASCII_STR: case DS_SERIAL: break; @@ -641,6 +680,7 @@ char *filename = NULL; XF86ConfigPtr xf86config = NULL; char **vlist, **vl; + int *dev2screen; vlist = xf86DriverlistFromCompile(); @@ -747,16 +787,48 @@ xf86DoConfigurePass1 = FALSE; + dev2screen = xnfcalloc(1,xf86NumDrivers*sizeof(int)); + { Bool *driverProbed = xnfcalloc(1,xf86NumDrivers*sizeof(Bool)); for (screennum = 0; screennum < nDevToConfig; screennum++) { + int k,l,n,oldNumScreens; + i = DevToConfig[screennum].iDriver; - + if (driverProbed[i]) continue; driverProbed[i] = TRUE; + + oldNumScreens = xf86NumScreens; (*xf86DriverList[i]->Probe)(xf86DriverList[i], 0); + /* reorder */ + k = screennum > 0 ? screennum : 1; + for (l = oldNumScreens; l < xf86NumScreens; l++) { + /* is screen primary? */ + Bool primary = FALSE; + for (n = 0; nnumEntities; n++) { + if (xf86IsEntityPrimary(xf86Screens[l]->entityList[n])) { + dev2screen[0] = l; + primary = TRUE; + break; + } + } + if (primary) continue; + /* not primary: assign it to next device of same driver */ + /* + * NOTE: we assume that devices in DevToConfig + * and xf86Screens[] have the same order except + * for the primary device which always comes first. + */ + for (; k < nDevToConfig; k++) { + if (DevToConfig[k].iDriver == i) { + dev2screen[k++] = l; + break; + } + } + } xf86SetPciVideo(NULL,NONE); } xfree(driverProbed); @@ -786,8 +858,9 @@ ConfiguredMonitor = NULL; - xf86EnableAccess(xf86Screens[j]); - if ((*xf86Screens[j]->PreInit)(xf86Screens[j], PROBE_DETECT) && + xf86EnableAccess(xf86Screens[dev2screen[j]]); + if ((*xf86Screens[dev2screen[j]]->PreInit)(xf86Screens[dev2screen[j]], + PROBE_DETECT) && ConfiguredMonitor) { MonitorPtr = configureDDCMonitorSection(j); } else { Index: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c:3.28 xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c:3.29 --- xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c:3.28 Fri Jun 23 20:33:54 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c Tue May 8 23:12:01 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.28 2000/06/24 00:33:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Cursor.c,v 3.29 2001/05/09 03:12:01 tsi Exp $ */ /* $XConsortium: xf86Cursor.c /main/10 1996/10/19 17:58:23 kaleb $ */ #define NEED_EVENTS @@ -201,7 +201,7 @@ /* * adjust new frame for the displaysize */ - pScr->frameX0 = (pScr->frameX1 + pScr->frameX0 - + pScr->frameX0 = (pScr->frameX1 + pScr->frameX0 + 1 - pScr->currentMode->HDisplay) / 2; pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay - 1; @@ -213,7 +213,7 @@ pScr->frameX1 = pScr->frameX0 + pScr->currentMode->HDisplay - 1; } - pScr->frameY0 = (pScr->frameY1 + pScr->frameY0 - + pScr->frameY0 = (pScr->frameY1 + pScr->frameY0 + 1 - pScr->currentMode->VDisplay) / 2; pScr->frameY1 = pScr->frameY0 + pScr->currentMode->VDisplay - 1; Index: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86DGA.c:1.37.2.1 xc/programs/Xserver/hw/xfree86/common/xf86DGA.c:1.40 --- xc/programs/Xserver/hw/xfree86/common/xf86DGA.c:1.37.2.1 Fri Mar 9 13:03:18 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86DGA.c Sat Mar 3 20:29:03 2001 @@ -3,7 +3,7 @@ Written by Mark Vojkovich */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.37.2.1 2001/03/09 18:03:18 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DGA.c,v 1.40 2001/03/04 01:29:03 tsi Exp $ */ #include "xf86.h" #include "xf86str.h" @@ -42,7 +42,7 @@ XDGAModePtr xmode ); -#ifdef XFree86LOADER +#if defined(XFree86LOADER) || !defined(XFreeXDGA) int *XDGAEventBase = NULL; #else int *XDGAEventBase = &DGAEventBase; @@ -228,7 +228,7 @@ ScreenPtr pScreen = pmap->pScreen; DGAScreenPtr pScreenPriv = DGA_GET_SCREEN_PRIV(pScreen); - if(pScreenPriv->current) { + if(pScreenPriv->current && pScreenPriv->dgaColormap) { if (pmap != pScreenPriv->dgaColormap) { pScreenPriv->savedColormap = pmap; pmap = pScreenPriv->dgaColormap; Index: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c:1.5 xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c:1.6 --- xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c:1.5 Tue Sep 19 08:46:13 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c Thu May 10 06:17:39 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c,v 1.5 2000/09/19 12:46:13 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DPMS.c,v 1.6 2001/05/10 10:17:39 alanh Exp $ */ /* * Copyright (c) 1997-1998 by The XFree86 Project, Inc. @@ -49,9 +49,9 @@ pDPMS->Flags = flags; DPMSOpt = xf86FindOption(xf86Screens[pScreen->myNum]->options, "dpms"); if (DPMSOpt) { - if (pDPMS->Enabled + if ((pDPMS->Enabled = xf86SetBoolOption(xf86Screens[pScreen->myNum]->options, - "dpms",FALSE) + "dpms",FALSE)) && !DPMSDisabledSwitch) DPMSEnabled = TRUE; xf86MarkOptionUsed(DPMSOpt); Index: xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c:1.4 xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c:1.6 --- xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c:1.4 Thu Nov 18 11:52:06 1999 +++ xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c Thu Feb 15 13:20:33 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c,v 1.4 1999/11/18 16:52:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86DefModes.c,v 1.6 2001/02/15 18:20:33 dawes Exp $ */ /* THIS FILE IS AUTOMATICALLY GENERATED -- DO NOT EDIT -- LOOK at * modeline2c.pl */ @@ -11,7 +11,6 @@ #include "xf86.h" #include "xf86Config.h" -#define NO_COMPILER_H_EXTRAS #include "xf86Priv.h" #include "xf86_OSlib.h" @@ -89,5 +88,9 @@ {MODEPREFIX("1920x1440"),234000, 1920,2048,2256,2600,0, 1440,1441,1444,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, /* 1920x1440 @ 75Hz (VESA) hsync: 112.5kHz */ {MODEPREFIX("1920x1440"),297000, 1920,2064,2288,2640,0, 1440,1441,1444,1500,0, V_NHSYNC | V_PVSYNC, MODESUFFIX}, +/* 1400x1050 @ 60Hz (VESA GFT) hsync: 65.5kHz */ + {MODEPREFIX("1400x1050"),122000, 1400,1488,1640,1880,0, 1050,1052,1064,1082,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, +/* 1400x1050 @ 75Hz (VESA GFT) hsync: 82.2kHz */ + {MODEPREFIX("1400x1050"),155800, 1400,1464,1784,1912,0, 1050,1052,1064,1090,0, V_PHSYNC | V_PVSYNC, MODESUFFIX}, {MODEPREFIX(NULL),0,0,0,0,0,0,0,0,0,0,0,0,MODESUFFIX} }; Index: xc/programs/Xserver/hw/xfree86/common/xf86Events.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Events.c:3.104 xc/programs/Xserver/hw/xfree86/common/xf86Events.c:3.109 --- xc/programs/Xserver/hw/xfree86/common/xf86Events.c:3.104 Thu Dec 7 15:32:54 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Events.c Fri May 18 12:03:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.104 2000/12/07 20:32:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Events.c,v 3.109 2001/05/18 16:03:10 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -295,11 +295,14 @@ * ifdefs further (hv). */ -#ifdef ASSUME_CUSTOM_KEYCODES +#ifdef __linux__ extern u_char SpecialServerMap[]; -#endif /* ASSUME_CUSTOM_KEYCODES */ +#endif -#if !defined(__EMX__) && !defined(__SOL8__) && !defined(__CYGWIN__) +#if !defined(__EMX__) && \ + !defined(__SOL8__) && \ + (!defined(sun) || defined(i386)) && \ + !defined(__CYGWIN__) void xf86PostKbdEvent(unsigned key) { @@ -347,30 +350,27 @@ * PANIX returns DICOP standards based keycodes in using 106jp * keyboard. We need to remap some keys. */ -#define KEY_P_UP 0x5A -#define KEY_P_PGUP 0x5B -#define KEY_P_LEFT 0x5C -#define KEY_P_BKSL 0x73 -#define KEY_P_YEN 0x7D -#define KEY_P_NFER 0x7B -#define KEY_P_XFER 0x79 - if(xf86Info.panix106 == TRUE){ switch (scanCode) { - /* case 0x78: scanCode = KEY_P_UP; break; not needed*/ - case 0x56: scanCode = KEY_P_BKSL; break; /* Backslash */ - case 0x5A: scanCode = KEY_P_NFER; break; /* No Kanji Transfer*/ - case 0x5B: scanCode = KEY_P_XFER; break; /* Kanji Tranfer */ - case 0x5C: scanCode = KEY_P_YEN; break; /* Yen curs pgup */ - case 0x6B: scanCode = KEY_P_LEFT; break; /* Cur Left */ - case 0x6F: scanCode = KEY_P_PGUP; break; /* Cur PageUp */ + case 0x56: scanCode = KEY_BSlash2; break; /* Backslash */ + case 0x5A: scanCode = KEY_NFER; break; /* No Kanji Transfer*/ + case 0x5B: scanCode = KEY_XFER; break; /* Kanji Tranfer */ + case 0x5C: scanCode = KEY_Yen; break; /* Yen curs pgup */ + case 0x6B: scanCode = KEY_Left; break; /* Cur Left */ + case 0x6F: scanCode = KEY_PgUp; break; /* Cur PageUp */ case 0x72: scanCode = KEY_AltLang; break; /* AltLang(right) */ case 0x73: scanCode = KEY_RCtrl; break; /* not needed */ } } #endif /* i386 && SVR4 */ -#ifndef ASSUME_CUSTOM_KEYCODES +#ifdef __linux__ + if (xf86Info.kbdCustomKeycodes) { + specialkey = SpecialServerMap[scanCode]; + goto customkeycodes; + } +#endif + /* * First do some special scancode remapping ... */ @@ -457,18 +457,14 @@ if (scanCode != KEY_NumLock) return; scanCode = KEY_Pause; /* pause */ } -#endif /* !ASSUME_CUSTOM_KEYCODES */ /* * and now get some special keysequences */ -#ifdef ASSUME_CUSTOM_KEYCODES - specialkey = SpecialServerMap[scanCode]; -#else /* ASSUME_CUSTOM_KEYCODES */ specialkey = scanCode; -#endif /* ASSUME_CUSTOM_KEYCODES */ +customkeycodes: if (xf86IsPc98()) { switch (scanCode) { case 0x0e: specialkey = 0x0e; break; /* KEY_BackSpace */ @@ -859,25 +855,31 @@ updateLeds = TRUE; } -#ifndef ASSUME_CUSTOM_KEYCODES - /* - * normal, non-keypad keys - */ - if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) { -#if !defined(CSRG_BASED) && !defined(MACH386) && !defined(MINIX) && !defined(__OSF__) && !defined(__GNU__) && !defined(__CYGWIN__) + if (!xf86Info.kbdCustomKeycodes) { /* - * magic ALT_L key on AT84 keyboards for multilingual support + * normal, non-keypad keys */ - if (xf86Info.kbdType == KB_84 && - ModifierDown(AltMask) && - keysym[2] != NoSymbol) - { - UsePrefix = TRUE; - Direction = TRUE; - } + if (scanCode < KEY_KP_7 || scanCode > KEY_KP_Decimal) { +#if !defined(CSRG_BASED) && \ + !defined(MACH386) && \ + !defined(MINIX) && \ + !defined(__OSF__) && \ + !defined(__GNU__) && \ + !defined(__CYGWIN__) && \ + defined(KB_84) + /* + * magic ALT_L key on AT84 keyboards for multilingual support + */ + if (xf86Info.kbdType == KB_84 && + ModifierDown(AltMask) && + keysym[2] != NoSymbol) + { + UsePrefix = TRUE; + Direction = TRUE; + } #endif /* !CSRG_BASED && !MACH386 && !MINIX && !__OSF__ */ + } } -#endif /* !ASSUME_CUSTOM_KEYCODES */ if (updateLeds) xf86KbdLeds(); #ifdef XKB } Index: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Globals.c:1.28 xc/programs/Xserver/hw/xfree86/common/xf86Globals.c:1.32 --- xc/programs/Xserver/hw/xfree86/common/xf86Globals.c:1.28 Wed Mar 8 00:38:37 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Globals.c Fri May 18 12:03:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.28 2000/03/08 05:38:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Globals.c,v 1.32 2001/05/18 16:03:11 tsi Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -138,7 +138,8 @@ FALSE, /* pc98 */ #endif TRUE, /* pmFlag */ - 0 /* estimateSizesAggressively */ + 0, /* estimateSizesAggressively */ + FALSE /* kbdCustomKeycodes */ }; const char *xf86ConfigFile = NULL; const char *xf86ModulePath = DEFAULT_MODULE_PATH; @@ -158,6 +159,8 @@ int xf86NumDrivers = 0; InputDriverPtr *xf86InputDriverList = NULL; int xf86NumInputDrivers = 0; +ModuleInfoPtr *xf86ModuleInfoList = NULL; +int xf86NumModuleInfos = 0; #endif int xf86NumScreens = 0; Index: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Helper.c:1.108 xc/programs/Xserver/hw/xfree86/common/xf86Helper.c:1.111.2.1 --- xc/programs/Xserver/hw/xfree86/common/xf86Helper.c:1.108 Thu Dec 14 11:33:08 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Helper.c Thu May 24 15:43:39 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.108 2000/12/14 16:33:08 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Helper.c,v 1.111.2.1 2001/05/24 19:43:39 dawes Exp $ */ /* * Copyright (c) 1997-1998 by The XFree86 Project, Inc. @@ -69,6 +69,7 @@ && (!xf86DriverHasEntities(xf86DriverList[drvIndex]))) { if (xf86DriverList[drvIndex]->module) UnloadModule(xf86DriverList[drvIndex]->module); + xfree(xf86DriverList[drvIndex]); xf86DriverList[drvIndex] = NULL; } } @@ -100,8 +101,39 @@ { if (xf86InputDriverList[drvIndex] && xf86InputDriverList[drvIndex]->module) UnloadModule(xf86InputDriverList[drvIndex]->module); + xfree(xf86InputDriverList[drvIndex]); xf86InputDriverList[drvIndex] = NULL; } + +void +xf86AddModuleInfo(ModuleInfoPtr info, pointer module) +{ + /* Don't add null entries */ + if (!module) + return; + + if (xf86ModuleInfoList == NULL) + xf86NumModuleInfos = 0; + + xf86NumModuleInfos++; + xf86ModuleInfoList = xnfrealloc(xf86ModuleInfoList, + xf86NumModuleInfos * sizeof(ModuleInfoPtr)); + xf86ModuleInfoList[xf86NumModuleInfos - 1] = xnfalloc(sizeof(ModuleInfoRec)); + *xf86ModuleInfoList[xf86NumModuleInfos - 1] = *info; + xf86ModuleInfoList[xf86NumModuleInfos - 1]->module = module; + xf86ModuleInfoList[xf86NumModuleInfos - 1]->refCount = 0; +} + +void +xf86DeleteModuleInfo(int idx) +{ + if (xf86ModuleInfoList[idx]) { + if (xf86ModuleInfoList[idx]->module) + UnloadModule(xf86ModuleInfoList[idx]->module); + xfree(xf86ModuleInfoList[idx]); + xf86ModuleInfoList[idx] = NULL; + } +} #endif @@ -947,8 +979,8 @@ WindowPtr pWin = WindowTable[pScreen->myNum]; WindowPtr pChild; Bool WasViewable = (Bool)(pWin->viewable); - Bool anyMarked; - RegionPtr pOldClip, bsExposed; + Bool anyMarked = FALSE; + RegionPtr pOldClip = NULL, bsExposed; #ifdef DO_SAVE_UNDERS Bool dosave = FALSE; #endif @@ -1218,6 +1250,9 @@ case X_INFO: s = X_INFO_STRING; break; + case X_NOT_IMPLEMENTED: + s = X_NOT_IMPLEMENTED_STRING; + break; case X_NONE: s = NULL; break; @@ -1333,8 +1368,10 @@ if ((logfile = fopen(xf86LogFile, "w")) == NULL) FatalError("Cannot open log file \"%s\"\n", xf86LogFile); setvbuf(logfile, NULL, _IONBF, 0); +#ifdef DDXOSVERRORF if (!OsVendorVErrorFProc) OsVendorVErrorFProc = OsVendorVErrorF; +#endif /* Flush saved log information */ if (saveBuffer && size > 0) { @@ -1997,7 +2034,6 @@ { register int status = vertsyncreg; unsigned long i, cnt, rcnt, sync; - int saved_nice; /* First save registers that get written on */ (*ClockFunc)(pScrn, CLK_REG_SAVE); @@ -2386,21 +2422,20 @@ OPTION_BACKING_STORE } BSOpts; -static OptionInfoRec BSOptions[] = { +static const OptionInfoRec BSOptions[] = { { OPTION_BACKING_STORE, "BackingStore", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; -#define nBSOptions (sizeof(BSOptions) / sizeof(BSOptions[0])) - void xf86SetBackingStore(ScreenPtr pScreen) { Bool useBS = FALSE; MessageType from = X_DEFAULT; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - OptionInfoRec options[nBSOptions]; + OptionInfoPtr options; + options = xnfalloc(sizeof(BSOptions)); (void)memcpy(options, BSOptions, sizeof(BSOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); @@ -2415,6 +2450,7 @@ if (xf86GetOptValBool(options, OPTION_BACKING_STORE, &useBS)) from = X_CONFIG; } + xfree(options); pScreen->backingStoreSupport = useBS ? Always : NotUseful; if (serverGeneration == 1) xf86DrvMsg(pScreen->myNum, from, "Backing store %s\n", @@ -2426,21 +2462,20 @@ OPTION_SILKEN_MOUSE } SMOpts; -static OptionInfoRec SMOptions[] = { +static const OptionInfoRec SMOptions[] = { { OPTION_SILKEN_MOUSE, "SilkenMouse", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; -#define nSMOptions (sizeof(SMOptions) / sizeof(SMOptions[0])) - void xf86SetSilkenMouse (ScreenPtr pScreen) { Bool useSM = TRUE; MessageType from = X_DEFAULT; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - OptionInfoRec options[nSMOptions]; + OptionInfoPtr options; + options = xnfalloc(sizeof(SMOptions)); (void)memcpy(options, SMOptions, sizeof(SMOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); @@ -2459,6 +2494,7 @@ if (xf86GetOptValBool(options, OPTION_SILKEN_MOUSE, &useSM)) from = X_CONFIG; } + xfree(options); /* * XXX quick hack to report correctly for OSs that can't do SilkenMouse * yet. Should handle this differently so that alternate async methods Index: xc/programs/Xserver/hw/xfree86/common/xf86Init.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Init.c:3.173 xc/programs/Xserver/hw/xfree86/common/xf86Init.c:3.176.2.1 --- xc/programs/Xserver/hw/xfree86/common/xf86Init.c:3.173 Thu Nov 30 19:24:33 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Init.c Thu May 24 15:43:39 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.173 2000/12/01 00:24:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Init.c,v 3.176.2.1 2001/05/24 19:43:39 dawes Exp $ */ /* * Copyright 1991-1999 by The XFree86 Project, Inc. @@ -1146,6 +1146,7 @@ * yet. Use malloc/free instead. */ +#ifdef DDXOSVERRORF static Bool beenHere = FALSE; if (!beenHere) { @@ -1156,6 +1157,7 @@ OsVendorVErrorFProc = OsVendorVErrorF; beenHere = TRUE; } +#endif /* First the options that are only allowed for root */ if (getuid() == 0) @@ -1554,7 +1556,7 @@ #define OSVENDOR "" #endif #ifndef PRE_RELEASE -#define PRE_RELEASE (XF86_VERSION_BETA || XF86_VERSION_ALPHA) +#define PRE_RELEASE XF86_VERSION_SNAP #endif static void @@ -1567,19 +1569,29 @@ "to fixes@XFree86.Org. Before reporting bugs in pre-release versions,\n" "please check the latest version in the XFree86 CVS repository\n" "(http://www.XFree86.Org/cvs)\n"); +#endif + ErrorF("\nXFree86 Version %d.%d.%d", XF86_VERSION_MAJOR, XF86_VERSION_MINOR, + XF86_VERSION_PATCH); +#if XF86_VERSION_SNAP > 0 + ErrorF(".%d", XF86_VERSION_SNAP); #endif - ErrorF("\nXFree86 Version%s", XF86_VERSION); + +#if XF86_VERSION_SNAP >= 900 + ErrorF(" (%d.%d.0 RC %d)", XF86_VERSION_MAJOR, XF86_VERSION_MINOR + 1, + XF86_VERSION_SNAP - 900); +#endif + #ifdef XF86_CUSTOM_VERSION - ErrorF("(%s) ", XF86_CUSTOM_VERSION); + ErrorF(" (%s)", XF86_CUSTOM_VERSION); #endif - ErrorF("/ X Window System\n"); + ErrorF(" / X Window System\n"); ErrorF("(protocol Version %d, revision %d, vendor release %d)\n", X_PROTOCOL, X_PROTOCOL_REVISION, VENDOR_RELEASE ); ErrorF("Release Date: %s\n", XF86_DATE); ErrorF("\tIf the server is older than 6-12 months, or if your card is\n" "\tnewer than the above date, look for a newer version before\n" "\treporting problems. (See http://www.XFree86.Org/FAQ)\n"); - ErrorF("Operating System:%s%s\n", OSNAME, OSVENDOR); + ErrorF("Build Operating System:%s%s\n", OSNAME, OSVENDOR); #if defined(BUILDERSTRING) ErrorF("%s \n",BUILDERSTRING); #endif Index: xc/programs/Xserver/hw/xfree86/common/xf86Io.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Io.c:3.41 xc/programs/Xserver/hw/xfree86/common/xf86Io.c:3.42 --- xc/programs/Xserver/hw/xfree86/common/xf86Io.c:3.41 Mon Nov 6 14:24:06 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Io.c Fri Apr 20 12:32:30 2001 @@ -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 @@ 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 @@ gettimeofday(&tp, 0); return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); } -#endif /* !AMOEBA && !(sun || SVR4) && !MINIX */ +#endif /* DDXTIME && !QNX4 */ #ifdef WSCONS_SUPPORT Index: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c:3.14 xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c:3.15 --- xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c:3.14 Fri Aug 11 13:27:13 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c Thu Mar 8 18:23:32 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.14 2000/08/11 17:27:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdBSD.c,v 3.15 2001/03/08 23:23:32 dawes Exp $ */ /* * Derived from xf86Kbd.c by S_ren Schmidt (sos@login.dkuug.dk) * which is Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. @@ -40,7 +40,7 @@ #define KD_GET_ENTRY(i,n) \ eascii_to_x[((keymap.key[i].spcl << (n+1)) & 0x100) + keymap.key[i].map[n]] -static unsigned char remap[128] = { +static unsigned char remap[NUM_KEYCODES] = { 0, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, /* 0x00 - 0x07 */ 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, /* 0x08 - 0x0f */ 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, /* 0x10 - 0x17 */ @@ -131,8 +131,76 @@ * special marked entries (256 + x) */ +#if 1 + /* This has been checked against what syscons actually does */ NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, + XK_ISO_Left_Tab,XK_Control_L, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, XK_F1, + XK_F2, XK_F3, XK_F4, XK_F5, + XK_F6, XK_F7, XK_F8, XK_F9, + XK_F10, XK_F11, XK_F12, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + XK_Control_R, XK_Alt_R, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol +#else + /* The old table, supposedly for pcvt. */ + NoSymbol, NoSymbol, XK_Shift_L, XK_Shift_R, + XK_Caps_Lock, XK_Num_Lock, XK_Scroll_Lock, XK_Alt_L, NoSymbol, XK_Control_L, XK_Alt_L, XK_Alt_R, XK_Control_L, XK_Control_R, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, @@ -194,6 +262,8 @@ NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, NoSymbol, + NoSymbol, NoSymbol, NoSymbol, NoSymbol +#endif }; #ifdef __OpenBSD__ Index: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c:3.15 xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c:3.16 --- xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c:3.15 Thu Apr 29 01:12:58 1999 +++ xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c Mon Mar 5 15:18:20 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c,v 3.15 1999/04/29 05:12:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86KbdLnx.c,v 3.16 2001/03/05 20:18:20 dawes Exp $ */ /* * Linux version of keymapping setup. The kernel (since 0.99.14) has support * for fully remapping the keyboard, but there are some differences between @@ -205,8 +205,6 @@ XK_udiaeresis, XK_yacute, XK_thorn, XK_ydiaeresis }; -#ifndef ASSUME_CUSTOM_KEYCODES - /* * Maps the AT keycodes to Linux keycodes */ @@ -278,20 +276,17 @@ 0x00, /* 0x7f */ }; #define NUM_AT2LNX (sizeof(at2lnx) / sizeof(at2lnx[0])) - -#else /* !ASSUME_CUSTOM_KEYCODES */ - -#define NUM_AT2LNX NR_KEYS -u_char SpecialServerMap[NR_KEYS]; +#define NUM_CUSTOMKEYS NR_KEYS -#endif /* !ASSUME_CUSTOM_KEYCODES */ +u_char SpecialServerMap[NUM_CUSTOMKEYS]; static void readKernelMapping(KeySymsPtr pKeySyms, CARD8 *pModMap) { KeySym *k; int i; + int maxkey; static unsigned char tbl[GLYPHS_PER_KEY] = { 0, /* unshifted */ @@ -312,20 +307,24 @@ tbl[2] = 8; /* alt */ tbl[3] = tbl[2] | 1; -#ifndef ASSUME_CUSTOM_KEYCODES - for (i = 0, k = map+GLYPHS_PER_KEY; i < NUM_AT2LNX; ++i) -#else /* !ASSUME_CUSTOM_KEYCODES */ - for (i = 0, k = map; i < NUM_AT2LNX; ++i) -#endif /* !ASSUME_CUSTOM_KEYCODES */ + if (xf86Info.kbdCustomKeycodes) { + k = map; + maxkey = NUM_CUSTOMKEYS; + } + else { + k = map+GLYPHS_PER_KEY; + maxkey = NUM_AT2LNX; + } + + for (i = 0; i < maxkey; ++i) { struct kbentry kbe; int j; -#ifndef ASSUME_CUSTOM_KEYCODES - kbe.kb_index = at2lnx[i]; -#else /* !ASSUME_CUSTOM_KEYCODES */ - kbe.kb_index = i; -#endif /* !ASSUME_CUSTOM_KEYCODES */ + if (xf86Info.kbdCustomKeycodes) + kbe.kb_index = i; + else + kbe.kb_index = at2lnx[i]; for (j = 0; j < GLYPHS_PER_KEY; ++j, ++k) { @@ -335,9 +334,7 @@ kbe.kb_table = tbl[j]; if ( -#ifndef ASSUME_CUSTOM_KEYCODES - kbe.kb_index == 0 || -#endif /* !ASSUME_CUSTOM_KEYCODES */ + (!xf86Info.kbdCustomKeycodes && kbe.kb_index == 0) || ioctl(xf86Info.consoleFd, KDGKBENT, &kbe)) continue; @@ -549,11 +546,14 @@ if (k[-4] == k[-2] && k[-3] == k[-1]) k[-2] = k[-1] = NoSymbol; if (k[-1] == k[-4] && k[-2] == k[-3] && k[-2] == NoSymbol) k[-1] =NoSymbol; } -#ifdef ASSUME_CUSTOM_KEYCODES + + if (!xf86Info.kbdCustomKeycodes) + return; + /* * Find the Mapping for the special server functions */ - for (i = 0; i < NR_KEYS; ++i) { + for (i = 0; i < NUM_CUSTOMKEYS; ++i) { struct kbentry kbe; int special = 0; @@ -618,5 +618,4 @@ } SpecialServerMap[i] = special; } -#endif /* ASSUME_CUSTOM_KEYCODES */ } Index: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h:3.13 xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h:3.15 --- xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h:3.13 Fri Aug 11 13:27:13 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h Tue May 1 18:31:30 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.13 2000/08/11 17:27:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Keymap.h,v 3.15 2001/05/01 22:31:30 alanh Exp $ */ /* * * For Scancodes see notes in atKeynames.h !!!! @@ -22,7 +22,7 @@ /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol, /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol, /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, - /* 0x0f */ XK_Tab, NoSymbol, NoSymbol, NoSymbol, + /* 0x0f */ XK_Tab, XK_ISO_Left_Tab,NoSymbol, NoSymbol, /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol, /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol, @@ -118,26 +118,27 @@ /* 0x6b */ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, /* 0x6c */ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, /* 0x6d */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, - /* 0x6e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x6f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x6e */ XK_F13, NoSymbol, NoSymbol, NoSymbol, + /* 0x6f */ XK_F14, NoSymbol, NoSymbol, NoSymbol, + /* 0x70 */ XK_F15, NoSymbol, NoSymbol, NoSymbol, + /* 0x71 */ XK_F16, NoSymbol, NoSymbol, NoSymbol, + /* 0x72 */ XK_F17, NoSymbol, NoSymbol, NoSymbol, + /* 0x73 */ XK_backslash, XK_underscore, NoSymbol, NoSymbol, /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x77 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x79 */ XK_Henkan, XK_Mode_switch, NoSymbol, NoSymbol, /* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x7b */ XK_Muhenkan, NoSymbol, NoSymbol, NoSymbol, /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x7d */ XK_backslash, XK_bar, NoSymbol, NoSymbol, /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, + /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, }; -#if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__) && !defined(linux) && !defined(CSRG_BASED) +#if !defined(Lynx) && !defined(AMOEBA) && !defined(MINIX) && !defined(__OSF__) && !defined(__EMX__) && !defined(__mips__) && !defined(linux) && !defined(CSRG_BASED) && !defined(__CYGWIN__) static KeySym map84[NUM_KEYCODES * GLYPHS_PER_KEY] = { /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, Index: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Mode.c:1.36 xc/programs/Xserver/hw/xfree86/common/xf86Mode.c:1.40 --- xc/programs/Xserver/hw/xfree86/common/xf86Mode.c:1.36 Wed Dec 6 10:35:11 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Mode.c Thu May 10 06:17:39 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.36 2000/12/06 15:35:11 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Mode.c,v 1.40 2001/05/10 10:17:39 alanh Exp $ */ /* * Copyright (c) 1997,1998 by The XFree86 Project, Inc. @@ -1305,16 +1305,16 @@ q->status = MODE_OK; } else { if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "Built-in mode \"%s\" deleted (%s)\n", p->name, - xf86ModeStatusToString(status)); + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using built-in mode \"%s\" (%s)\n", + p->name, xf86ModeStatusToString(status)); else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "Default mode \"%s\" deleted (%s)\n", p->name, + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using default mode \"%s\" (%s)\n", p->name, xf86ModeStatusToString(status)); else - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "Mode \"%s\" deleted (%s)\n", p->name, + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using mode \"%s\" (%s)\n", p->name, xf86ModeStatusToString(status)); } } @@ -1401,16 +1401,16 @@ status = xf86LookupMode(scrp, p, clockRanges, strategy); if (status != MODE_OK) { if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "Built-in mode \"%s\" deleted (%s)\n", p->name, - xf86ModeStatusToString(status)); + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using built-in mode \"%s\" (%s)\n", + p->name, xf86ModeStatusToString(status)); else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "Default mode \"%s\" deleted (%s)\n", p->name, + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using default mode \"%s\" (%s)\n", p->name, xf86ModeStatusToString(status)); else - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "Mode \"%s\" deleted (%s)\n", p->name, + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using mode \"%s\" (%s)\n", p->name, xf86ModeStatusToString(status)); } if (status == MODE_ERROR) { @@ -1493,16 +1493,16 @@ if (p->status != MODE_OK) { if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "Built-in mode \"%s\" deleted (%s)\n", p->name, - xf86ModeStatusToString(p->status)); + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using built-in mode \"%s\" (%s)\n", + p->name, xf86ModeStatusToString(p->status)); else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "Default mode \"%s\" deleted (%s)\n", p->name, + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using default mode \"%s\" (%s)\n", p->name, xf86ModeStatusToString(p->status)); else - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "Mode \"%s\" deleted (%s)\n", p->name, + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using mode \"%s\" (%s)\n", p->name, xf86ModeStatusToString(p->status)); goto lookupNext; @@ -1607,17 +1607,17 @@ if (p->status != MODE_OK) { #if 0 if (p->type & M_T_BUILTIN) - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "Built-in mode \"%s\" deleted (%s)\n", p->name, + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using built-in mode \"%s\" (%s)\n", p->name, xf86ModeStatusToString(p->status)); else if (p->type & M_T_DEFAULT) - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "Default mode \"%s\" deleted (%s)\n", p->name, - xf86ModeStatusToString(p->status)); + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using default mode \"%s\" (%s)\n", p->name, + xf86ModeStatusToString(p->status)); else - xf86DrvMsg(scrp->scrnIndex, X_WARNING, - "Mode \"%s\" deleted (%s)\n", p->name, - xf86ModeStatusToString(p->status)); + xf86DrvMsg(scrp->scrnIndex, X_INFO, + "Not using mode \"%s\" (%s)\n", p->name, + xf86ModeStatusToString(p->status)); #endif xf86DeleteMode(&(scrp->modes), p); } @@ -1668,11 +1668,57 @@ } +static void +add(char **p, char *new) +{ + if (!*p) { + *p = xnfalloc(strlen(new) + 1); + strcpy(*p,new); + } else { + *p = xnfrealloc(*p,((*p)?strlen(*p):0) + strlen(new) + 2); + strcat(*p," "); + strcat(*p,new); + } +} + +static void +PrintModeline(int scrnIndex,DisplayModePtr mode) +{ + char tmp[256]; + char *flags = NULL; + + if (mode->HSkew) { + snprintf(tmp,256,"hskew %i",mode->HSkew); + add(&flags,tmp); + } + if (mode->VScan) { + snprintf(tmp,256,"vscan %i",mode->VScan); + add(&flags,tmp); + } + if (mode->Flags & V_INTERLACE) add(&flags,"interlace"); + if (mode->Flags & V_CSYNC) add(&flags,"composite"); + if (mode->Flags & V_DBLSCAN) add(&flags,"doublescan"); + if (mode->Flags & V_BCAST) add(&flags,"bcast"); + if (mode->Flags & V_PHSYNC) add(&flags,"+hsync"); + if (mode->Flags & V_NHSYNC) add(&flags,"-hsync"); + if (mode->Flags & V_PVSYNC) add(&flags,"+vsync"); + if (mode->Flags & V_NVSYNC) add(&flags,"-vsync"); + if (mode->Flags & V_PCSYNC) add(&flags,"+csync"); + if (mode->Flags & V_NCSYNC) add(&flags,"-csync"); + xf86DrvMsgVerb(scrnIndex,X_INFO,3, + "Modeline \"%s\" %6.2f %i %i %i %i %i %i %i %i %s\n", + mode->name,mode->Clock/1000., mode->HDisplay, + mode->HSyncStart,mode->HSyncEnd,mode->HTotal, + mode->VDisplay,mode->VSyncStart,mode->VSyncEnd, + mode->VTotal,flags); + xfree(flags); +} + void xf86PrintModes(ScrnInfoPtr scrp) { DisplayModePtr p; - float hsync, refresh; + float hsync, refresh = 0; char *desc, *desc2, *prefix; if (scrp == NULL) @@ -1690,9 +1736,12 @@ desc = desc2 = ""; if (p->HSync > 0.0) hsync = p->HSync; - else + else if (p->HTotal > 0) hsync = (float)p->Clock / (float)p->HTotal; - refresh = hsync * 1000.0 / p->VTotal; + else + hsync = 0.0; + if (p->VTotal > 0) + refresh = hsync * 1000.0 / p->VTotal; if (p->Flags & V_INTERLACE) { refresh *= 2.0; desc = " (I)"; @@ -1713,7 +1762,10 @@ prefix = "Default mode"; else prefix = "Mode"; - if (p->Clock == p->SynthClock) { + if (hsync == 0 || refresh == 0) { + xf86DrvMsg(scrp->scrnIndex, X_CONFIG, + "%s \"%s\"\n", prefix, p->name); + } else if (p->Clock == p->SynthClock) { xf86DrvMsg(scrp->scrnIndex, X_CONFIG, "%s \"%s\": %.1f MHz, %.1f kHz, %.1f Hz%s%s\n", prefix, p->name, p->Clock / 1000.0, hsync, refresh, @@ -1725,6 +1777,8 @@ prefix, p->name, p->Clock / 1000.0, p->SynthClock / 1000.0, hsync, refresh, desc, desc2); } + if (hsync != 0 && refresh != 0) + PrintModeline(scrp->scrnIndex,p); p = p->next; } while (p != NULL && p != scrp->modes); } Index: xc/programs/Xserver/hw/xfree86/common/xf86Module.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Module.h:1.27 xc/programs/Xserver/hw/xfree86/common/xf86Module.h:1.28 --- xc/programs/Xserver/hw/xfree86/common/xf86Module.h:1.27 Tue Nov 14 11:54:49 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Module.h Tue Mar 13 11:03:36 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.27 2000/11/14 16:54:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Module.h,v 1.28 2001/03/13 16:03:36 dawes Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -62,8 +62,8 @@ * mask is 0xFFFF0000. */ #define ABI_ANSIC_VERSION SET_ABI_VERSION(0, 1) -#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 3) -#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 1) +#define ABI_VIDEODRV_VERSION SET_ABI_VERSION(0, 4) +#define ABI_XINPUT_VERSION SET_ABI_VERSION(0, 2) #define ABI_EXTENSION_VERSION SET_ABI_VERSION(0, 1) #define ABI_FONT_VERSION SET_ABI_VERSION(0, 2) Index: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Opt.h:1.10 xc/programs/Xserver/hw/xfree86/common/xf86Opt.h:1.12 --- xc/programs/Xserver/hw/xfree86/common/xf86Opt.h:1.10 Fri Aug 4 12:13:25 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Opt.h Fri May 4 15:05:30 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.10 2000/08/04 16:13:25 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Opt.h,v 1.12 2001/05/04 19:05:30 dawes Exp $ */ /* Option handling things that ModuleSetup procs can use */ @@ -43,6 +43,7 @@ } OptionInfoRec, *OptionInfoPtr; int xf86SetIntOption(pointer optlist, const char *name, int deflt); +double xf86SetRealOption(pointer optlist, const char *name, double deflt); char *xf86SetStrOption(pointer optlist, const char *name, char *deflt); int xf86SetBoolOption(pointer list, const char *name, int deflt ); pointer xf86AddNewOption(pointer head, char *name, char *val ); @@ -62,17 +63,17 @@ Bool xf86CheckIfOptionUsedByName(pointer options, const char *name); void xf86ShowUnusedOptions(int scrnIndex, pointer options); void xf86ProcessOptions(int scrnIndex, pointer options, OptionInfoPtr optinfo); -OptionInfoPtr xf86TokenToOptinfo(OptionInfoPtr table, int token); -const char *xf86TokenToOptName(OptionInfoPtr table, int token); -Bool xf86IsOptionSet(OptionInfoPtr table, int token); -char *xf86GetOptValString(OptionInfoPtr table, int token); -Bool xf86GetOptValInteger(OptionInfoPtr table, int token, int *value); -Bool xf86GetOptValULong(OptionInfoPtr table, int token, unsigned long *value); -Bool xf86GetOptValReal(OptionInfoPtr table, int token, double *value); -Bool xf86GetOptValFreq(OptionInfoPtr table, int token, +OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token); +const char *xf86TokenToOptName(const OptionInfoRec *table, int token); +Bool xf86IsOptionSet(const OptionInfoRec *table, int token); +char *xf86GetOptValString(const OptionInfoRec *table, int token); +Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value); +Bool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value); +Bool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value); +Bool xf86GetOptValFreq(const OptionInfoRec *table, int token, OptFreqUnits expectedUnits, double *value); -Bool xf86GetOptValBool(OptionInfoPtr table, int token, Bool *value); -Bool xf86ReturnOptValBool(OptionInfoPtr table, int token, Bool def); +Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value); +Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def); int xf86NameCmp(const char *s1, const char *s2); char *xf86NormalizeName(const char *s); pointer xf86ReplaceIntOption(pointer optlist, char *name, int val); Index: xc/programs/Xserver/hw/xfree86/common/xf86Option.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Option.c:1.21 xc/programs/Xserver/hw/xfree86/common/xf86Option.c:1.23 --- xc/programs/Xserver/hw/xfree86/common/xf86Option.c:1.21 Fri Oct 20 10:58:59 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Option.c Fri May 4 15:05:30 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.21 2000/10/20 14:58:59 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Option.c,v 1.23 2001/05/04 19:05:30 dawes Exp $ */ /* * Copyright (c) 1998 by The XFree86 Project, Inc. @@ -155,6 +155,19 @@ } +double +xf86SetRealOption(pointer optlist, const char *name, double deflt) +{ + OptionInfoRec o; + + o.name = name; + o.type = OPTV_REAL; + if (ParseOptionValue(-1, optlist, &o)) + deflt = o.value.realnum; + return deflt; +} + + char * xf86SetStrOption(pointer optlist, const char *name, char *deflt) { @@ -560,9 +573,9 @@ OptionInfoPtr -xf86TokenToOptinfo(OptionInfoPtr table, int token) +xf86TokenToOptinfo(const OptionInfoRec *table, int token) { - OptionInfoPtr p; + const OptionInfoRec *p; for (p = table; p->token >= 0 && p->token != token; p++) ; @@ -570,14 +583,14 @@ if (p->token < 0) return NULL; else - return p; + return (OptionInfoPtr)p; } const char * -xf86TokenToOptName(OptionInfoPtr table, int token) +xf86TokenToOptName(const OptionInfoRec *table, int token) { - OptionInfoPtr p; + const OptionInfoRec *p; p = xf86TokenToOptinfo(table, token); return p->name; @@ -585,7 +598,7 @@ Bool -xf86IsOptionSet(OptionInfoPtr table, int token) +xf86IsOptionSet(const OptionInfoRec *table, int token) { OptionInfoPtr p; @@ -595,7 +608,7 @@ char * -xf86GetOptValString(OptionInfoPtr table, int token) +xf86GetOptValString(const OptionInfoRec *table, int token) { OptionInfoPtr p; @@ -608,7 +621,7 @@ Bool -xf86GetOptValInteger(OptionInfoPtr table, int token, int *value) +xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value) { OptionInfoPtr p; @@ -622,7 +635,7 @@ Bool -xf86GetOptValULong(OptionInfoPtr table, int token, unsigned long *value) +xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value) { OptionInfoPtr p; @@ -636,7 +649,7 @@ Bool -xf86GetOptValReal(OptionInfoPtr table, int token, double *value) +xf86GetOptValReal(const OptionInfoRec *table, int token, double *value) { OptionInfoPtr p; @@ -650,8 +663,8 @@ Bool -xf86GetOptValFreq(OptionInfoPtr table, int token, OptFreqUnits expectedUnits, - double *value) +xf86GetOptValFreq(const OptionInfoRec *table, int token, + OptFreqUnits expectedUnits, double *value) { OptionInfoPtr p; @@ -698,7 +711,7 @@ Bool -xf86GetOptValBool(OptionInfoPtr table, int token, Bool *value) +xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value) { OptionInfoPtr p; @@ -712,7 +725,7 @@ Bool -xf86ReturnOptValBool(OptionInfoPtr table, int token, Bool def) +xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def) { OptionInfoPtr p; Index: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h:1.83.2.2 xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h:1.98 --- xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h:1.83.2.2 Tue Mar 6 13:51:55 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h Fri May 11 03:56:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.83.2.2 2001/03/06 18:51:55 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86PciInfo.h,v 1.98 2001/05/11 07:56:10 alanh Exp $ */ /* * PCI Probe * @@ -150,6 +150,7 @@ #define PCI_VENDOR_TRITECH 0x1292 #define PCI_VENDOR_NVIDIA_SGS 0x12d2 #define PCI_VENDOR_NETGEAR 0x1385 +#define PCI_VENDOR_VMWARE 0x15AD #define PCI_VENDOR_SYMPHONY 0x1C1C #define PCI_VENDOR_TEKRAM_2 0x1DE1 #define PCI_VENDOR_3DLABS 0x3D3D @@ -238,6 +239,7 @@ #define PCI_CHIP_RADEON_QE 0x5145 #define PCI_CHIP_RADEON_QF 0x5146 #define PCI_CHIP_RADEON_QG 0x5147 +#define PCI_CHIP_RADEON_VE 0x5159 #define PCI_CHIP_RAGE128RE 0x5245 #define PCI_CHIP_RAGE128RF 0x5246 #define PCI_CHIP_RAGE128RG 0x5247 @@ -259,6 +261,7 @@ /* Avance Logic */ #define PCI_CHIP_ALG2064 0x2064 #define PCI_CHIP_ALG2301 0x2301 +#define PCI_CHIP_ALG2501 0x2501 /* NS */ #define PCI_CHIP_87415 0x0002 @@ -340,6 +343,8 @@ #define PCI_CHIP_9750 0x9750 #define PCI_CHIP_9850 0x9850 #define PCI_CHIP_9880 0x9880 +#define PCI_CHIP_9910 0x9910 +#define PCI_CHIP_9930 0x9930 /* ALI */ #define PCI_CHIP_M1435 0x1435 @@ -404,7 +409,8 @@ #define PCI_CHIP_SIS300 0x0300 #define PCI_CHIP_SIS630 0x6300 #define PCI_CHIP_SIS540 0x5300 - +/* Agregado por Carlos Duclos & Manuel Jander */ +#define PCI_CHIP_SIS82C204 0x0204 /* HP */ #define PCI_CHIP_J2585A 0x1030 #define PCI_CHIP_J2585B 0x1031 @@ -474,8 +480,8 @@ #define PCI_CHIP_UTNT2 0x0029 #define PCI_CHIP_VTNT2 0x002C #define PCI_CHIP_UVTNT2 0x002D -#define PCI_CHIP_TNT2_A 0x002E -#define PCI_CHIP_TNT2_B 0x002F +#define PCI_CHIP_TNT2_A 0x002E +#define PCI_CHIP_TNT2_B 0x002F #define PCI_CHIP_ITNT2 0x00A0 #define PCI_CHIP_GEFORCE256 0x0100 #define PCI_CHIP_GEFORCEDDR 0x0101 @@ -488,28 +494,34 @@ #define PCI_CHIP_GEFORCE2GTS_1 0x0151 #define PCI_CHIP_GEFORCE2ULTRA 0x0152 #define PCI_CHIP_QUADRO2PRO 0x0153 -#define PCI_CHIP_GEFORCE3 0x0200 -#define PCI_CHIP_GEFORCE3_1 0x0201 -#define PCI_CHIP_GEFORCE3_2 0x0202 -#define PCI_CHIP_GEFORCE3_3 0x0203 - +#define PCI_CHIP_GEFORCE3 0x0200 +#define PCI_CHIP_GEFORCE3_1 0x0201 +#define PCI_CHIP_GEFORCE3_2 0x0202 +#define PCI_CHIP_GEFORCE3_3 0x0203 /* NVIDIA & SGS */ #define PCI_CHIP_RIVA128 0x0018 +/* IMS */ +#define PCI_CHIP_IMSTT128 0x9128 +#define PCI_CHIP_IMSTT3D 0x9135 + /* Alliance Semiconductor */ #define PCI_CHIP_AP6410 0x3210 #define PCI_CHIP_AP6422 0x6422 #define PCI_CHIP_AT24 0x6424 #define PCI_CHIP_AT3D 0x643D -/* 3Dfx Interactive */ +/* 3dfx Interactive */ #define PCI_CHIP_VOODOO_GRAPHICS 0x0001 #define PCI_CHIP_VOODOO2 0x0002 #define PCI_CHIP_BANSHEE 0x0003 #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 @@ -524,6 +536,10 @@ #define PCI_CHIP_GAMMA 0x0008 #define PCI_CHIP_PERMEDIA2V 0x0009 #define PCI_CHIP_PERMEDIA3 0x000A +#define PCI_CHIP_PERMEDIA4 0x000C +#define PCI_CHIP_R4 0x000D +#define PCI_CHIP_GAMMA2 0x000E +#define PCI_CHIP_R4ALT 0x0011 /* S3 */ #define PCI_CHIP_PLATO 0x0551 @@ -598,6 +614,10 @@ #define PCI_CHIP_SMI712 0x712 #define PCI_CHIP_SMI720 0x720 +/* VMware */ +#define PCI_CHIP_VMWARE0405 0x0405 +#define PCI_CHIP_VMWARE0710 0x0710 + /* * first the VendorId - VendorName mapping */ @@ -699,7 +719,7 @@ {PCI_VENDOR_RICOH, "Ricoh"}, {PCI_VENDOR_ZEINET, "Zeinet"}, {PCI_VENDOR_LITEON, "Lite-On"}, - {PCI_VENDOR_3DFX, "3Dfx Interactive"}, + {PCI_VENDOR_3DFX, "3dfx Interactive"}, {PCI_VENDOR_SIGMADESIGNS, "Sigma Designs"}, {PCI_VENDOR_ENSONIQ, "Ensoniq"}, {PCI_VENDOR_ROCKWELL, "Rockwell"}, @@ -718,6 +738,7 @@ {PCI_VENDOR_ARK, "ARK Logic"}, {PCI_VENDOR_YAMAHA, "Yamaha"}, {PCI_VENDOR_SMI, "Silicon Motion Inc."}, + {PCI_VENDOR_VMWARE, "VMware"}, {0,NULL} }; #endif @@ -811,6 +832,7 @@ {PCI_CHIP_RADEON_QE, "Radeon QE",0}, {PCI_CHIP_RADEON_QF, "Radeon QF",0}, {PCI_CHIP_RADEON_QG, "Radeon QG",0}, + {PCI_CHIP_RADEON_VE, "Radeon VE",0}, {PCI_CHIP_RAGE128RE, "Rage 128 RE",0}, {PCI_CHIP_RAGE128RF, "Rage 128 RF",0}, {PCI_CHIP_RAGE128RK, "Rage 128 RK",0}, @@ -854,7 +876,7 @@ {PCI_VENDOR_DIGITAL, { {PCI_CHIP_DEC21030, "21030/TGA",0}, {0x0001, "DC21050 PCI-PCI Bridge" - /* print_pcibridge} */,0 }, + /* print_pcibridge */,0 }, {0x0002, "DC21040 10Mb/s Ethernet",0 }, {0x0009, "DC21140 10/100 Mb/s Ethernet",0 }, {0x000D, "TGA2",0 }, @@ -919,6 +941,8 @@ {PCI_CHIP_9750, "3DImage975",0}, {PCI_CHIP_9850, "3DImage985",0}, {PCI_CHIP_9880, "Blade3D",0}, + {PCI_CHIP_9910, "Cyber/BladeXP",0}, + {PCI_CHIP_9930, "CyberBlade/XPm",0}, {PCI_CHIP_8400, "CyberBlade/i7",0}, {PCI_CHIP_8420, "CyberBlade/DSTN/i7",0}, {PCI_CHIP_8500, "CyberBlade/i1",0}, @@ -976,6 +1000,7 @@ {PCI_CHIP_SIS300, "300",0}, {PCI_CHIP_SIS630, "630",0}, {PCI_CHIP_SIS540, "540",0}, + {PCI_CHIP_SIS82C204, "82C204",0}, {0x0000, NULL,0}}}, #ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_HP, { @@ -1215,8 +1240,8 @@ {PCI_CHIP_UTNT2, "Riva Ultra TNT2",0}, {PCI_CHIP_VTNT2, "Riva Vanta",0}, {PCI_CHIP_UVTNT2, "Riva Ultra 64",0}, - {PCI_CHIP_TNT2_A, "Riva TNT2 (A)",0}, - {PCI_CHIP_TNT2_B, "Riva TNT2 (B)",0}, + {PCI_CHIP_TNT2_A, "Riva TNT2 (A)",0}, + {PCI_CHIP_TNT2_B, "Riva TNT2 (B)",0}, {PCI_CHIP_ITNT2, "Riva Integrated",0}, {PCI_CHIP_GEFORCE256, "GeForce 256",0}, {PCI_CHIP_GEFORCEDDR, "GeForce DDR",0}, @@ -1228,15 +1253,19 @@ {PCI_CHIP_GEFORCE2GTS_1,"GeForce2 GTS (rev 1)",0}, {PCI_CHIP_GEFORCE2ULTRA,"GeForce2 Ultra",0}, {PCI_CHIP_QUADRO2PRO, "Quadro 2 Pro",0}, - {PCI_CHIP_GEFORCE3, "GeForce3",0}, - {PCI_CHIP_GEFORCE3_1, "GeForce3 (rev 1)",0}, - {PCI_CHIP_GEFORCE3_2, "GeForce3 (rev 2)",0}, - {PCI_CHIP_GEFORCE3_3, "GeForce3 (rev 3)",0}, + {PCI_CHIP_GEFORCE3, "GeForce3",0}, + {PCI_CHIP_GEFORCE3_1, "GeForce3 (rev 1)",0}, + {PCI_CHIP_GEFORCE3_2, "GeForce3 (rev 2)",0}, + {PCI_CHIP_GEFORCE3_3, "GeForce3 (rev 3)",0}, {0x0000, NULL,0}}}, -#ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_IMS, { + {PCI_CHIP_IMSTT128, "TwinTurbo 128", 0}, + {PCI_CHIP_IMSTT3D, "TwinTurbo 3D", 0}, +#ifdef VENDOR_INCLUDE_NONVIDEO {0x8849, "8849",0 }, +#endif {0x0000, NULL,0}}}, +#ifdef VENDOR_INCLUDE_NONVIDEO {PCI_VENDOR_TEKRAM, { {0x690C, "DC690C",0 }, {0x0000, NULL,0}}}, @@ -1392,9 +1421,14 @@ {PCI_CHIP_GAMMA, "GLINT Gamma",0}, {PCI_CHIP_PERMEDIA2V, "GLINT Permedia 2v",0}, {PCI_CHIP_PERMEDIA3, "GLINT Permedia 3",0}, + {PCI_CHIP_PERMEDIA4, "GLINT Permedia 4",0}, + {PCI_CHIP_R4, "GLINT R4",0}, + {PCI_CHIP_R4ALT, "GLINT R4 (Alt)",0}, + {PCI_CHIP_GAMMA2, "GLINT Gamma 2",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_AVANCE_2, { {PCI_CHIP_ALG2064, "ALG2064",0}, + {PCI_CHIP_ALG2501, "ALG2501",0}, {0x0000, NULL,0}}}, {PCI_VENDOR_S3, { {PCI_CHIP_PLATO, "PLATO/PX",0}, @@ -1524,6 +1558,10 @@ {PCI_CHIP_SMI712, "LynxEM+",0}, {PCI_CHIP_SMI720, "Lynx3DM",0}, {0x0000, NULL,0}}}, + {PCI_VENDOR_VMWARE, { + {PCI_CHIP_VMWARE0405, "PCI SVGA (FIFO)",0}, + {PCI_CHIP_VMWARE0710, "LEGACY SVGA",0}, + {0x0000, NULL,0}}}, {0x0000, { {0x0000, NULL,0}}}, }; @@ -1581,14 +1619,14 @@ { 0x0000, (char *)NULL,0, NF } } }, #endif { PCI_VENDOR_SONY, { - { 0x8051, "Vaio Video",0,NF }, + { 0x8051, "Vaio Video",0,NF }, #ifdef VENDOR_INCLUDE_NONVIDEO - { 0x8052, "Vaio Audio",0,NF }, - { 0x8054, "Vaio Firewire",0,NF }, - { 0x8056, "Vaio Modem",0,NF }, - { 0x8057, "Vaio Ethernet",0,NF }, + { 0x8052, "Vaio Audio",0,NF }, + { 0x8054, "Vaio Firewire",0,NF }, + { 0x8056, "Vaio Modem",0,NF }, + { 0x8057, "Vaio Ethernet",0,NF }, #endif - { 0x0000, (char *)NULL,0, NF } } }, + { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_DIAMOND, { { 0x0003, "Monster Fusion",0, NF }, { 0x00b8, "Fire GL1",0, NF }, @@ -1607,6 +1645,35 @@ { 0x8760, "Fireport 40 Dual",0, NF }, { 0x8a10, "Stealth 3D 4000",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, + { PCI_VENDOR_APPIAN, { + { 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 }, + { 0x0099, "PermediaLC",0, NF }, + { 0x0100, "Permedia2 PCI",0, NF }, + { 0x0101, "Permedia2 AGP",0, NF }, + { 0x0102, "Oxygen GMX2000 PCI",0, NF }, + { 0x0106, "Oxygen GMX2000 AGP",0, NF }, + { 0x0116, "Oxygen GVX1 AGP",0, NF }, + { 0x0121, "Oxygen VX1 PCI",0, NF }, + { 0x0122, "Oxygen ACX AGP",0, NF }, + { 0x0123, "Oxygen ACX PCI",0, NF }, + { 0x0125, "Oxygen VX1 AGP",0, NF }, + { 0x0127, "Permedia3 Create!",0, NF }, + { 0x0134, "Oxygen GVX1 PCI",0, NF }, + { 0x0136, "Oxygen GVX210 AGP",0, NF }, + { 0x0140, "Oxygen VX1-16 AGP",0, NF }, + { 0x0144, "Oxygen VX1-4X AGP",0, NF }, + { 0x0400, "Oxygen GVX420 AGP",0, NF }, + { 0x0800, "Oxygen VX1-1600SW PCI",0, NF }, + { 0x0000, (char *)NULL,0, NF } } }, { PCI_VENDOR_ELSA, { { 0x0914, "Winner 1000",0, NF }, { 0x0930, "Winner 1000PRO 864",0, NF }, @@ -1726,6 +1793,12 @@ { PCI_VENDOR_NETGEAR, { { 0xf004, "FA310-TX Rev. D2",0, NF }, { 0x0000, (char *)NULL,0, NF } } }, +#endif +#if 0 + { PCI_VENDOR_VMWARE, { + {PCI_CHIP_VMWARE0405, "PCI SVGA (FIFO)",0, NF }, + {PCI_CHIP_VMWARE0710, "LEGACY SVGA",0, NF }, + {0x0000, NULL,0, NF } } }, #endif {0x0000, { {0x0000, NULL,0, NF } } }, Index: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Priv.h:3.69 xc/programs/Xserver/hw/xfree86/common/xf86Priv.h:3.72 --- xc/programs/Xserver/hw/xfree86/common/xf86Priv.h:3.69 Thu Dec 7 10:43:40 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Priv.h Tue May 15 14:22:21 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.69 2000/12/07 15:43:40 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Priv.h,v 3.72 2001/05/15 18:22:21 paulo Exp $ */ /* * Copyright (c) 1997 by The XFree86 Project, Inc. @@ -63,7 +63,6 @@ extern MessageType xf86LogFileFrom; extern serverLayoutRec xf86ConfigLayout; extern Pix24Flags xf86ConfigPix24; -extern confDRIRec xf86ConfigDRI; extern unsigned short xf86MouseCflags[]; extern Bool xf86SupportedMouseTypes[]; @@ -71,6 +70,8 @@ #ifdef XFree86LOADER extern DriverPtr *xf86DriverList; +extern ModuleInfoPtr *xf86ModuleInfoList; +extern int xf86NumModuleInfos; #else extern DriverPtr xf86DriverList[]; #endif @@ -126,7 +127,7 @@ void xf86AddDevToEntity(int entityIndex, GDevPtr dev); extern void xf86PostPreInit(void); extern void xf86PostScreenInit(void); -extern memType getValidBIOSBase(PCITAG tag, int *num); +extern memType getValidBIOSBase(PCITAG tag, int num); extern int pciTestMultiDeviceCard(int bus, int dev, int func, PCITAG** pTag); /* xf86Config.c */ Index: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h:1.21 xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h:1.25 --- xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h:1.21 Mon Nov 6 14:24:07 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h Fri May 18 12:03:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.21 2000/11/06 19:24:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Privstr.h,v 1.25 2001/05/18 16:03:11 tsi Exp $ */ /* * Copyright (c) 1997,1998 by The XFree86 Project, Inc. @@ -12,10 +12,8 @@ #ifndef _XF86PRIVSTR_H #define _XF86PRIVSTR_H -#include "Xproto.h" #include "xf86Pci.h" -#ifdef XINPUT -#endif +#include "xf86str.h" /* PCI probe flags */ @@ -124,6 +122,7 @@ #endif Bool pmFlag; int estimateSizesAggressively; + Bool kbdCustomKeycodes; } xf86InfoRec, *xf86InfoPtr; #ifdef DPMSExtension @@ -200,6 +199,9 @@ #endif #ifndef X_INFO_STRING #define X_INFO_STRING "(II)" +#endif +#ifndef X_NOT_IMPLEMENTED_STRING +#define X_NOT_IMPLEMENTED_STRING "(NI)" #endif #endif /* _XF86PRIVSTR_H */ Index: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Resources.h:1.11 xc/programs/Xserver/hw/xfree86/common/xf86Resources.h:1.11.4.1 --- xc/programs/Xserver/hw/xfree86/common/xf86Resources.h:1.11 Tue Jul 11 12:14:57 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Resources.h Mon May 28 10:23:37 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.11 2000/07/11 16:14:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Resources.h,v 1.11.4.1 2001/05/28 14:23:37 eich Exp $ */ #ifndef _XF86_RESOURCES_H @@ -80,16 +80,16 @@ {ResShrIoSparse | ResBios | ResBus, 0x02E8, 0x03F8} /* predefined resources */ -extern resRange resVgaExclusive[]; -extern resRange resVgaShared[]; -extern resRange resVgaIoShared[]; -extern resRange resVgaMemShared[]; -extern resRange resVgaUnusedExclusive[]; -extern resRange resVgaUnusedShared[]; -extern resRange resVgaSparseExclusive[]; -extern resRange resVgaSparseShared[]; -extern resRange res8514Exclusive[]; -extern resRange res8514Shared[]; +extern const resRange resVgaExclusive[]; +extern const resRange resVgaShared[]; +extern const resRange resVgaIoShared[]; +extern const resRange resVgaMemShared[]; +extern const resRange resVgaUnusedExclusive[]; +extern const resRange resVgaUnusedShared[]; +extern const resRange resVgaSparseExclusive[]; +extern const resRange resVgaSparseShared[]; +extern const resRange res8514Exclusive[]; +extern const resRange res8514Shared[]; /* Less misleading aliases for xf86SetOpratingState() */ #define resVgaMem resVgaMemShared Index: xc/programs/Xserver/hw/xfree86/common/xf86Switch.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Switch.c:3.8 xc/programs/Xserver/hw/xfree86/common/xf86Switch.c:3.9 --- xc/programs/Xserver/hw/xfree86/common/xf86Switch.c:3.8 Thu May 6 22:56:14 1999 +++ xc/programs/Xserver/hw/xfree86/common/xf86Switch.c Fri Apr 20 12:32:31 2001 @@ -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 Index: xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c:1.9 xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c:1.12 --- xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c:1.9 Wed Dec 6 17:00:46 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c Sun May 6 17:59:07 2001 @@ -1,7 +1,7 @@ /* * Copyright (c) 1999 by The XFree86 Project, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c,v 1.9 2000/12/06 22:00:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86VidMode.c,v 1.12 2001/05/06 21:59:07 mvojkovi Exp $ */ /* * This file contains the VidMode functions required by the extension. @@ -91,8 +91,12 @@ pScreen->CloseScreen = pVidMode->CloseScreen; - if (--VidModeCount == 0) + if (--VidModeCount == 0) { + if (pScreen->devPrivates[VidModeIndex].ptr) + xfree(pScreen->devPrivates[VidModeIndex].ptr); + pScreen->devPrivates[VidModeIndex].ptr = NULL; VidModeIndex = -1; + } return pScreen->CloseScreen(i, pScreen); } @@ -538,6 +542,41 @@ *green = pScrn->gamma.green; *blue = pScrn->gamma.blue; return TRUE; +} + +Bool +VidModeSetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b) +{ + ScrnInfoPtr pScrn; + + if (!VidModeAvailable(scrnIndex)) + return FALSE; + + pScrn = xf86Screens[scrnIndex]; + xf86ChangeGammaRamp(pScrn->pScreen, size, r, g, b); + return TRUE; +} + +Bool +VidModeGetGammaRamp(int scrnIndex, int size, CARD16 *r, CARD16 *g, CARD16 *b) +{ + ScrnInfoPtr pScrn; + + if (!VidModeAvailable(scrnIndex)) + return FALSE; + + pScrn = xf86Screens[scrnIndex]; + xf86GetGammaRamp(pScrn->pScreen, size, r, g, b); + return TRUE; +} + +int +VidModeGetGammaRampSize(int scrnIndex) +{ + if (!VidModeAvailable(scrnIndex)) + return 0; + + return xf86GetGammaRampSize(xf86Screens[scrnIndex]->pScreen); } pointer Index: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c:3.62 xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c:3.63 --- xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c:3.62 Fri Sep 22 19:41:01 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c Sun Apr 1 10:00:08 2001 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.62 2000/09/22 23:41:01 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.c,v 3.63 2001/04/01 14:00:08 tsi Exp $ */ #include "Xfuncproto.h" #include "Xmd.h" @@ -31,7 +31,6 @@ #include "XIproto.h" #endif #include "xf86.h" -#include "Xpoll.h" #include "xf86Priv.h" #include "xf86Xinput.h" #ifdef XINPUT @@ -61,7 +60,7 @@ #include #include "osdep.h" /* EnabledDevices */ - +#include "Xpoll.h" #include "xf86_OSproc.h" /* sigio stuff */ /****************************************************************************** Index: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h:3.32 xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h:3.34 --- xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h:3.32 Wed Nov 29 10:51:20 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h Mon Apr 16 17:08:24 2001 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.32 2000/11/29 15:51:20 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86Xinput.h,v 3.34 2001/04/16 21:08:24 herrb Exp $ */ #ifndef _xf86Xinput_h #define _xf86Xinput_h @@ -30,8 +30,7 @@ #ifndef NEED_EVENTS #define NEED_EVENTS #endif -#include "X.h" -#include "Xproto.h" +#include "xf86str.h" #include "inputstr.h" #ifdef XINPUT #include "extensions/XI.h" @@ -71,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; @@ -84,7 +84,7 @@ pointer module; int refCount; } InputDriverRec, *InputDriverPtr; - +#endif /* This is to input devices what the ScrnInfoRec is to screens. */ Index: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86cmap.c:1.19 xc/programs/Xserver/hw/xfree86/common/xf86cmap.c:1.22 --- xc/programs/Xserver/hw/xfree86/common/xf86cmap.c:1.19 Fri Mar 17 15:43:34 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86cmap.c Sun May 6 17:59:07 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c,v 1.19 2000/03/17 20:43:34 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.c,v 1.22 2001/05/06 21:59:07 mvojkovi Exp $ */ #ifdef _XOPEN_SOURCE #include @@ -465,7 +465,8 @@ pScreenPriv->isDGAmode = DGAActive(index); - if(!pScreenPriv->isDGAmode && miInstalledMaps[index]) + if(!pScreenPriv->isDGAmode && miInstalledMaps[index] + && xf86Screens[pScreen->myNum]->vtSema) CMapReinstallMap(miInstalledMaps[index]); return ret; @@ -923,6 +924,148 @@ return Success; } + +static void +ComputeGammaRamp ( + CMapScreenPtr priv, + unsigned short *red, + unsigned short *green, + unsigned short *blue +){ + int elements = priv->gammaElements; + LOCO *entry = priv->gamma; + int shift = 16 - priv->sigRGBbits; + + while(elements--) { + entry->red = *(red++) >> shift; + entry->green = *(green++) >> shift; + entry->blue = *(blue++) >> shift; + entry++; + } +} + +int +xf86ChangeGammaRamp( + ScreenPtr pScreen, + int size, + unsigned short *red, + unsigned short *green, + unsigned short *blue +){ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + CMapColormapPtr pColPriv; + CMapScreenPtr pScreenPriv; + CMapLinkPtr pLink; + + if(CMapScreenIndex == -1) + return BadImplementation; + + pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; + if(!pScreenPriv) + return BadImplementation; + + if(pScreenPriv->gammaElements != size) + return BadValue; + + ComputeGammaRamp(pScreenPriv, red, green, blue); + + /* mark all colormaps on this screen */ + pLink = pScreenPriv->maps; + while(pLink) { + pColPriv = + (CMapColormapPtr) pLink->cmap->devPrivates[CMapColormapIndex].ptr; + pColPriv->recalculate = TRUE; + pLink = pLink->next; + } + + if(miInstalledMaps[pScreen->myNum] && + ((pScreenPriv->flags & CMAP_LOAD_EVEN_IF_OFFSCREEN) || + pScrn->vtSema || pScreenPriv->isDGAmode)) { + ColormapPtr pMap = miInstalledMaps[pScreen->myNum]; + + if(!(pScreenPriv->flags & CMAP_PALETTED_TRUECOLOR) && + (pMap->pVisual->class == TrueColor) && + ((1 << pMap->pVisual->nplanes) > pScreenPriv->maxColors)) { + + /* if the current map doesn't have a palette look + for another map to change the gamma on. */ + + pLink = pScreenPriv->maps; + while(pLink) { + if(pLink->cmap->pVisual->class == PseudoColor) + break; + pLink = pLink->next; + } + + if(pLink) { + /* need to trick CMapRefreshColors() into thinking + this is the currently installed map */ + miInstalledMaps[pScreen->myNum] = pLink->cmap; + CMapReinstallMap(pLink->cmap); + miInstalledMaps[pScreen->myNum] = pMap; + } + } else + CMapReinstallMap(pMap); + } + + return Success; +} + +int +xf86GetGammaRampSize(ScreenPtr pScreen) +{ + CMapScreenPtr pScreenPriv; + + if(CMapScreenIndex == -1) return 0; + + pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; + if(!pScreenPriv) return 0; + + return pScreenPriv->gammaElements; +} + +int +xf86GetGammaRamp( + ScreenPtr pScreen, + int size, + unsigned short *red, + unsigned short *green, + unsigned short *blue +){ + CMapScreenPtr pScreenPriv; + LOCO *entry; + int shift, sigbits; + + if(CMapScreenIndex == -1) + return BadImplementation; + + pScreenPriv = (CMapScreenPtr)pScreen->devPrivates[CMapScreenIndex].ptr; + if(!pScreenPriv) + return BadImplementation; + + if(size > pScreenPriv->gammaElements) + return BadValue; + + entry = pScreenPriv->gamma; + sigbits = pScreenPriv->sigRGBbits; + + while(size--) { + *red = entry->red << (16 - sigbits); + *green = entry->green << (16 - sigbits); + *blue = entry->blue << (16 - sigbits); + shift = sigbits; + while(shift < 16) { + *red |= *red >> shift; + *green |= *green >> shift; + *blue |= *blue >> shift; + shift += sigbits; + } + red++; green++; blue++; + entry++; + } + + return Success; +} int xf86ChangeGamma( Index: xc/programs/Xserver/hw/xfree86/common/xf86cmap.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86cmap.h:1.6 xc/programs/Xserver/hw/xfree86/common/xf86cmap.h:1.7 --- xc/programs/Xserver/hw/xfree86/common/xf86cmap.h:1.6 Thu May 11 14:14:28 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86cmap.h Sat May 5 20:49:12 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.h,v 1.6 2000/05/11 18:14:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86cmap.h,v 1.7 2001/05/06 00:49:12 mvojkovi Exp $ */ #ifndef _XF86CMAP_H #define _XF86CMAP_H @@ -36,6 +36,26 @@ xf86ChangeGamma( ScreenPtr pScreen, Gamma newGamma +); + +int +xf86ChangeGammaRamp( + ScreenPtr pScreen, + int size, + unsigned short *red, + unsigned short *green, + unsigned short *blue +); + +int xf86GetGammaRampSize(ScreenPtr pScreen); + +int +xf86GetGammaRamp( + ScreenPtr pScreen, + int size, + unsigned short *red, + unsigned short *green, + unsigned short *blue ); #endif /* _XF86CMAP_H */ Index: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86fbman.c:1.19 xc/programs/Xserver/hw/xfree86/common/xf86fbman.c:1.22 --- xc/programs/Xserver/hw/xfree86/common/xf86fbman.c:1.19 Fri Nov 24 18:18:29 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86fbman.c Thu May 10 06:17:39 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c,v 1.19 2000/11/24 23:18:29 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86fbman.c,v 1.22 2001/05/10 10:17:39 alanh Exp $ */ #include "misc.h" #include "xf86.h" @@ -917,7 +917,7 @@ extents = REGION_EXTENTS(pScreen, offman->InitialBoxes); pitch = extents->x2 - extents->x1; - if(length < w) { /* special case */ + if(length < pitch) { /* special case */ w = length; h = 1; } else { @@ -1011,7 +1011,10 @@ REGION_DESTROY(pScreen, offman->InitialBoxes); REGION_DESTROY(pScreen, offman->FreeBoxes); + xfree(offman->FreeBoxesUpdateCallback); + xfree(offman->devPrivates); xfree(offman); + pScreen->devPrivates[xf86FBScreenIndex].ptr = NULL; return (*pScreen->CloseScreen) (i, pScreen); } @@ -1036,6 +1039,9 @@ (FullBox->x2 < ScreenBox.x2) || (FullBox->y2 < ScreenBox.y2)) { return FALSE; } + + if (FullBox->y2 < FullBox->y1) return FALSE; + if (FullBox->x2 < FullBox->x2) return FALSE; REGION_INIT(pScreen, &ScreenRegion, &ScreenBox, 1); REGION_INIT(pScreen, &FullRegion, FullBox, 1); Index: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c:3.28.2.1 xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c:3.42 --- xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c:3.28.2.1 Sat Feb 10 05:23:55 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c Wed May 16 03:56:06 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.28.2.1 2001/02/10 10:23:55 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86pciBus.c,v 3.42 2001/05/16 07:56:06 alanh Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -175,45 +175,64 @@ if ((PCISHAREDIOCLASSES(baseclass, subclass)) && (pcrp->pci_command & PCI_CMD_IO_ENABLE) && (pcrp->pci_prog_if == 0)) { - /* assumption: primary bus is always VGA */ - primaryBus.type = BUS_PCI; - primaryBus.id.pci.bus = pcrp->busnum; - primaryBus.id.pci.device = pcrp->devnum; - primaryBus.id.pci.func = pcrp->funcnum; + + /* + * Attempt to ensure that VGA is actually routed to this + * adapter on entry. This needs to be fixed when we finally + * grok host bridges (and multiple bus trees). + */ + j = info->bus; + while (j > 0) { + PciBusPtr pBus = xf86PciBus; + while (pBus && j != pBus->secondary) + pBus = pBus->next; + if (!pBus || !(pBus->brcontrol & PCI_PCI_BRIDGE_VGA_EN)) + break; + j = pBus->brbus; + } + if (j <= 0) { + if (primaryBus.type == BUS_NONE) { + /* assumption: primary bus is always VGA */ + primaryBus.type = BUS_PCI; + primaryBus.id.pci.bus = pcrp->busnum; + primaryBus.id.pci.device = pcrp->devnum; + primaryBus.id.pci.func = pcrp->funcnum; + } else if (primaryBus.type < BUS_last) { + xf86Msg(X_NOTICE, + "More than one primary device found\n"); + primaryBus.type ^= (BusType)(-1); + } + } } for (j = 0; j < 6; j++) { info->memBase[j] = 0; info->ioBase[j] = 0; - if (PCINONSYSTEMCLASSES(info->class, info->subclass)) { - info->size[j] = pciGetBaseSize(pcrp->tag, j, TRUE, - &info->validSize); + if (PCINONSYSTEMCLASSES(baseclass, subclass)) { + info->size[j] = + pciGetBaseSize(pcrp->tag, j, TRUE, &info->validSize); + pcrp->minBasesize = info->validSize; } else { info->size[j] = pcrp->basesize[j]; info->validSize = pcrp->minBasesize; } - /* pciGetBaseSize(pcrp->tag, j, FALSE, NULL) */ info->type[j] = 0; } - if (!(pcrp->pci_base0) && info->size[0] - && PCINONSYSTEMCLASSES(info->class, info->subclass)) - pcrp->pci_base0 = pciCheckForBrokenBase(pcrp->tag,0); - if (!(pcrp->pci_base1) && info->size[1] - && PCINONSYSTEMCLASSES(info->class, info->subclass)) - pcrp->pci_base1 = pciCheckForBrokenBase(pcrp->tag,1); - if (!(pcrp->pci_base2) && info->size[2] - && PCINONSYSTEMCLASSES(info->class, info->subclass)) - pcrp->pci_base2 = pciCheckForBrokenBase(pcrp->tag,2); - if (!(pcrp->pci_base3) && info->size[3] - && PCINONSYSTEMCLASSES(info->class, info->subclass)) - pcrp->pci_base3 = pciCheckForBrokenBase(pcrp->tag,3); - if (!(pcrp->pci_base4) && info->size[4] - && PCINONSYSTEMCLASSES(info->class, info->subclass)) - pcrp->pci_base4 = pciCheckForBrokenBase(pcrp->tag,4); - if (!(pcrp->pci_base5) && info->size[5] - && PCINONSYSTEMCLASSES(info->class, info->subclass)) - pcrp->pci_base5 = pciCheckForBrokenBase(pcrp->tag,5); + if (PCINONSYSTEMCLASSES(baseclass, subclass)) { + if (!pcrp->pci_base0 && info->size[0]) + pcrp->pci_base0 = pciCheckForBrokenBase(pcrp->tag, 0); + if (!pcrp->pci_base1 && info->size[1]) + pcrp->pci_base1 = pciCheckForBrokenBase(pcrp->tag, 1); + if (!pcrp->pci_base2 && info->size[2]) + pcrp->pci_base2 = pciCheckForBrokenBase(pcrp->tag, 2); + if (!pcrp->pci_base3 && info->size[3]) + pcrp->pci_base3 = pciCheckForBrokenBase(pcrp->tag, 3); + if (!pcrp->pci_base4 && info->size[4]) + pcrp->pci_base4 = pciCheckForBrokenBase(pcrp->tag, 4); + if (!pcrp->pci_base5 && info->size[5]) + pcrp->pci_base5 = pciCheckForBrokenBase(pcrp->tag, 5); + } /* * 64-bit base addresses are checked for and avoided. @@ -387,7 +406,8 @@ xf86ErrorF("unknown chipset (0x%04x) ", info->chipType); xf86ErrorF("rev %d", info->chipRev); for (i = 0; i < 6; i++) { - if (info->memBase[i]) { + if (info->memBase[i] && + (info->memBase[i] < (memType)(-1 << info->size[i]))) { if (!memdone) { xf86ErrorF(", Mem @ "); memdone = TRUE; @@ -397,7 +417,8 @@ } } for (i = 0; i < 6; i++) { - if (info->ioBase[i]) { + if (info->ioBase[i] && + (info->ioBase[i] < (memType)(-1 << info->size[i]))) { if (!iodone) { xf86ErrorF(", I/O @ "); iodone = TRUE; @@ -406,6 +427,10 @@ xf86ErrorF("0x%04x/%d", info->ioBase[i], info->size[i]); } } + if (info->biosBase && + (info->biosBase < (memType)(-1 << info->biosSize))) + xf86ErrorF(", BIOS @ 0x%08x/%d", + info->biosBase, info->biosSize); xf86ErrorF("\n"); } } @@ -752,7 +777,7 @@ } } - RemoveOverlaps(target,bridgeRes,TRUE); + RemoveOverlaps(target, bridgeRes, TRUE, TRUE); if (range.rEnd > target->block_end) { correctPciSize(range.rBegin,range.rEnd - range.rBegin, target->block_end - target->block_begin, @@ -800,12 +825,14 @@ resMisc |= ResEstimated; for (i = 0; i < 6; i++) { - if (pvp->ioBase[i]) { + if (pvp->ioBase[i] && + (pvp->ioBase[i] < (memType)(-1 << pvp->size[i]))) { PV_I_RANGE(range,pvp,i,ResExcIoBlock | resMisc); tmp = xf86AddResToList(NULL, &range, -1); removeOverlapsWithBridges(pvp->bus,tmp); *res = xf86JoinResLists(tmp,*res); - } else if (pvp->memBase[i]) { + } else if (pvp->memBase[i] && + (pvp->memBase[i] < (memType)(-1 << pvp->size[i]))) { PV_M_RANGE(range, pvp,i, ResExcMemBlock | resMisc); tmp = xf86AddResToList(NULL, &range, -1); removeOverlapsWithBridges(pvp->bus,tmp); @@ -815,7 +842,8 @@ /* FIXME!!!: Don't use BIOS resources for overlap * checking but reserve them! */ - if (pvp->biosBase) { + if (pvp->biosBase && + (pvp->biosBase < (memType)(-1 << pvp->biosSize))) { PV_B_RANGE(range, pvp, ResExcMemBlock | resMisc); tmp = xf86AddResToList(NULL, &range, -1); removeOverlapsWithBridges(pvp->bus,tmp); @@ -826,7 +854,9 @@ for (pcrpp = xf86PciInfo, pcrp = *pcrpp; pcrp; pcrp = *++(pcrpp)) { resPtr *res; - if (PCIINFOCLASSES(pcrp->pci_base_class, pcrp->pci_sub_class)) + if (PCIINFOCLASSES((pcrp->listed_class & 0xffff) ? + ((pcrp->listed_class >> 8) & 0x0ff) : + pcrp->pci_base_class, pcrp->pci_sub_class)) continue; /* Only process devices with type 0 headers */ @@ -868,7 +898,9 @@ } } } - if (pcrp->pci_baserom) { + /* Ignore disabled non-video ROMs */ + if ((res == activeRes) && + (pcrp->pci_baserom & PCI_MAP_ROM_DECODE_ENABLE)) { P_M_RANGE(range,pcrp->tag,PCIGETROM(pcrp->pci_baserom), pcrp->basesize[6], ResExcMemBlock | resMisc); if (range.rBegin) { @@ -902,9 +934,9 @@ if (ResIsEstimated(&pRes->val)) { range = pRes->val; - RemoveOverlaps(pRes, *activeRes, TRUE); - if (xf86Info.estimateSizesAggressively > 0) - RemoveOverlaps(pRes, *inactiveRes, TRUE); + RemoveOverlaps(pRes, *activeRes, TRUE, TRUE); + RemoveOverlaps(pRes, *inactiveRes, TRUE, + (xf86Info.estimateSizesAggressively > 0)); if (range.rEnd > pRes->block_end) { correctPciSize(range.rBegin,range.rEnd - range.rBegin, @@ -923,14 +955,16 @@ xf86PrintResList(3, *activeRes); } - if (*inactiveRes && (xf86Info.estimateSizesAggressively > 1)) { + if (*inactiveRes) { /* Check for overlaps */ for (pRes = *inactiveRes; pRes; pRes = pRes->next) { if (ResIsEstimated(&pRes->val)) { range = pRes->val; - RemoveOverlaps(pRes, *activeRes, TRUE); - RemoveOverlaps(pRes, *inactiveRes, TRUE); + RemoveOverlaps(pRes, *activeRes, TRUE, + (xf86Info.estimateSizesAggressively > 1)); + RemoveOverlaps(pRes, *inactiveRes, TRUE, + (xf86Info.estimateSizesAggressively > 1)); if (range.rEnd > pRes->block_end) { correctPciSize(range.rBegin,range.rEnd - range.rBegin, @@ -946,7 +980,7 @@ } } xf86MsgVerb(X_INFO, 3, - "Ative PCI resource ranges after removing overlaps:\n"); + "Inactive PCI resource ranges after removing overlaps:\n"); xf86PrintResList(3, *inactiveRes); } } @@ -968,7 +1002,7 @@ */ for (tmp = *osRes; tmp; tmp = tmp->next) - RemoveOverlaps(tmp, activeRes, FALSE); + RemoveOverlaps(tmp, activeRes, FALSE, TRUE); xf86MsgVerb(X_INFO, 3, "OS-reported resource ranges after removing" " overlaps with PCI:\n"); @@ -976,7 +1010,7 @@ pciAvoidRes = xf86AddRangesToList(pciAvoidRes,PciAvoid,-1); for (tmp = pciAvoidRes; tmp; tmp = tmp->next) - RemoveOverlaps(tmp, activeRes, FALSE); + RemoveOverlaps(tmp, activeRes, FALSE, TRUE); tmp = xf86DupResList(*osRes); pciAvoidRes = xf86JoinResLists(pciAvoidRes,tmp); @@ -1160,13 +1194,12 @@ xf86FreeResList(w_2nd); xf86FreeResList(avoid); return TRUE; - } else { + } #ifdef DEBUG - ErrorF("removing old resource\n"); + ErrorF("removing old resource\n"); #endif - orgAcc = Acc; - Acc = AccTmp; - } + orgAcc = Acc; + Acc = AccTmp; #else orgAcc = xf86DupResList(Acc); pAcc = &Acc; @@ -1349,7 +1382,127 @@ /* * BIOS releated */ +memType +getValidBIOSBase(PCITAG tag, int num) +{ + pciVideoPtr pvp = NULL; + PciBusPtr pbp, pbp1; + resPtr m = NULL; + resPtr tmp, avoid; + resRange range; + memType ret; + int n = 0; + CARD32 biosSize, alignment; + + if (!xf86PciVideoInfo) return 0; + + while ((pvp = xf86PciVideoInfo[n++])) { + if (pciTag(pvp->bus,pvp->device,pvp->func) == tag) + break; + } + if (!pvp) return 0; + + biosSize = pvp->biosSize; + alignment = (1 << biosSize) - 1; + if (biosSize > 24) + biosSize = 24; + + switch ((romBaseSource)num) { + case ROM_BASE_PRESET: + return 0; /* This should not happen */ + case ROM_BASE_BIOS: + /* In some cases the BIOS base register contains the size mask */ + if ((memType)(-1 << biosSize) == PCIGETROM(pvp->biosBase)) + return 0; + P_M_RANGE(range, TAG(pvp),pvp->biosBase,biosSize,ResExcMemBlock); + ret = pvp->biosBase; + break; + case ROM_BASE_MEM0: + case ROM_BASE_MEM1: + case ROM_BASE_MEM2: + case ROM_BASE_MEM3: + case ROM_BASE_MEM4: + case ROM_BASE_MEM5: + if (!pvp->memBase[num] || (pvp->size[n] < biosSize)) + return 0; + P_M_RANGE(range, TAG(pvp),pvp->memBase[num],biosSize, + ResExcMemBlock); + ret = pvp->memBase[num]; + break; + case ROM_BASE_FIND: + ret = 0; + break; + default: + return 0; /* This should not happen */ + } + + /* Now find the ranges for validation */ + avoid = xf86DupResList(pciAvoidRes); + pbp = pbp1 = xf86PciBus; + while (pbp) { + if (pbp->secondary == pvp->bus) { + if (pbp->preferred_pmem) + tmp = xf86DupResList(pbp->preferred_pmem); + else + tmp = xf86DupResList(pbp->pmem); + m = xf86JoinResLists(m,tmp); + if (pbp->preferred_mem) + tmp = xf86DupResList(pbp->preferred_mem); + else + tmp = xf86DupResList(pbp->mem); + m = xf86JoinResLists(m,tmp); + tmp = m; + while (tmp) { + tmp->block_end = MIN(tmp->block_end,PCI_MEM32_LENGTH_MAX); + tmp = tmp->next; + } + } + while (pbp1) { + if (pbp1->primary == pvp->bus) { + tmp = xf86DupResList(pbp1->preferred_pmem); + avoid = xf86JoinResLists(avoid,tmp); + tmp = xf86DupResList(pbp1->pmem); + avoid = xf86JoinResLists(avoid,tmp); + tmp = xf86DupResList(pbp1->preferred_mem); + avoid = xf86JoinResLists(avoid,tmp); + tmp = xf86DupResList(pbp1->mem); + avoid = xf86JoinResLists(avoid,tmp); + } + pbp1 = pbp1->next; + } + pbp = pbp->next; + } + pciConvertListToHost(pvp->bus,pvp->device,pvp->func, avoid); + + if (!ret) { + /* + * Return a possible window. Note that this doesn't deal with + * host bridges yet. But the fix for that belongs elsewhere. + */ + while (m) { + range = xf86GetBlock(ResExcMemBlock, + PCI_SIZE(ResMem, TAG(pvp), 1 << biosSize), + m->block_begin, m->block_end, + PCI_SIZE(ResMem, TAG(pvp), alignment), + avoid); + if (range.type != ResEnd) { + ret = M2B(TAG(pvp), range.rBase); + break; + } + m = m->next; + } + } else { + if (!xf86IsSubsetOf(range, m) || + ChkConflict(&range, avoid, SETUP)) + ret = 0; + } + + xf86FreeResList(avoid); + xf86FreeResList(m); + return ret; +} +#if 0 memType getValidBIOSBase(PCITAG tag, int *num) { @@ -1411,7 +1564,9 @@ } pciConvertListToHost(pvp->bus,pvp->device,pvp->func, avoid); - if (pvp->biosBase) { /* try biosBase first */ + if (pvp->biosBase && + (pvp->biosBase < (memType)(-1 << pvp->biosSize))) { + /* try biosBase first */ P_M_RANGE(range, TAG(pvp),pvp->biosBase,biosSize,ResExcMemBlock); if (xf86IsSubsetOf(range,m) && ! ChkConflict(&range,avoid,SETUP)) { xf86FreeResList(avoid); @@ -1424,41 +1579,56 @@ if ((*num < 0) || (*num > 5) || !pvp->memBase[*num] || (pvp->size[*num] < biosSize)) { *num = -1; + } else { + P_M_RANGE(range, TAG(pvp), pvp->memBase[*num], biosSize, + ResExcMemBlock); + if (!xf86IsSubsetOf(range, m) || ChkConflict(&range, avoid, SETUP)) + *num = -1; + } + + if (*num < 0) { for (n = 0; n <= 5; n++) { if (pvp->memBase[n] && (pvp->size[n] >= biosSize)) { - *num = n; - break; + /* keep bios size ! */ + P_M_RANGE(range, TAG(pvp), pvp->memBase[*num], + biosSize, ResExcMemBlock); + if (xf86IsSubsetOf(range, m) && + !ChkConflict(&range, avoid, SETUP)) { + *num = n; + break; + } } } } - if (*num >= 0) { - /* then try suggested memBase */ - /* keep bios size ! */ - P_M_RANGE(range,TAG(pvp),pvp->memBase[*num],biosSize,ResExcMemBlock); - if (xf86IsSubsetOf(range,m) && !ChkConflict(&range,avoid,SETUP)) { - xf86FreeResList(avoid); - xf86FreeResList(m); - return pvp->memBase[*num]; - } - } + /* + * Return a possible window. Note that this doesn't deal with host bridges + * yet. But the fix for that belongs elsewhere. + */ while (m) { range = xf86GetBlock(ResExcMemBlock, - PCI_SIZE(ResMem,TAG(pvp),(1 << biosSize)), + PCI_SIZE(ResMem, TAG(pvp), 1 << biosSize), m->block_begin, m->block_end, - PCI_SIZE(ResMem,TAG(pvp),alignment), avoid); - if (range.type != ResEnd) - break; + PCI_SIZE(ResMem, TAG(pvp), alignment), avoid); + if (range.type != ResEnd) { + xf86FreeResList(avoid); + xf86FreeResList(m); + return M2B(TAG(pvp), range.rBase); + } m = m->next; } - + xf86FreeResList(avoid); xf86FreeResList(m); - xf86MsgVerb(X_INFO,5,"GetVaildBIOSBase for %x:%x:%x: BIOSbase 0x%lx\n", - pvp->bus,pvp->device,pvp->func, - (memType)M2B(TAG(pvp),range.rBase)); - return M2B(TAG(pvp),range.rBase); + + if (*num >= 0) { + /* then try suggested memBase */ + return pvp->memBase[*num]; + } + + return 0; } +#endif /* * xf86Bus.c interface @@ -1527,24 +1697,24 @@ iomap = pciReadByte(pcrp->tag, APB_IO_ADDRESS_MAP); memmap = pciReadByte(pcrp->tag, APB_MEM_ADDRESS_MAP); - /* if (pcrp->pci_command & PCI_CMD_IO_ENABLE) */ { /* ??? */ + if (pcrp->pci_command & PCI_CMD_IO_ENABLE) { for (i = 0; i < 8; i++) { if ((iomap & (1 << i)) != 0) { PCI_I_RANGE(range, pcrp->tag, (i << 21), (i << 21) + ((1 << 21) - 1), ResIo | ResBlock | ResExclusive); - PciBus->io = xf86AddResToList(PciBus->io, &range, -1); + PciBus->preferred_io = xf86AddResToList(PciBus->preferred_io, &range, -1); } } } - /* if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) */ { /* ??? */ + if (pcrp->pci_command & PCI_CMD_MEM_ENABLE) { for (i = 0; i < 8; i++) { if ((memmap & (1 << i)) != 0) { PCI_M_RANGE(range, pcrp->tag, (i << 29), (i << 29) + ((1 << 29) - 1), ResMem | ResBlock | ResExclusive); - PciBus->mem = xf86AddResToList(PciBus->mem, &range, -1); + PciBus->preferred_mem = xf86AddResToList(PciBus->preferred_mem, &range, -1); } } } @@ -1561,7 +1731,9 @@ int MaxBus = 0; int i; memType base, limit; - + + resPtr pciBusAccWindows = xf86PciBusAccWindowsFromOS(); + if (pciInfo == NULL) return NULL; /* Add each PCI-PCI bridge */ @@ -1674,6 +1846,7 @@ PciBus->brdev = pcrp->devnum; PciBus->brfunc = pcrp->funcnum; PciBus->subclass = sub_class; + PciBus->brcontrol = PCI_PCI_BRIDGE_VGA_EN; xf86MsgVerb(X_INFO,3,"PCI-to-ISA bridge:\n"); break; case PCI_SUBCLASS_BRIDGE_HOST: @@ -1682,12 +1855,13 @@ PciBus->primary = -1; PciBus->secondary = -1; /* to be set below */ PciBus->subclass = sub_class; + PciBus->brcontrol = PCI_PCI_BRIDGE_VGA_EN; PciBus->preferred_io = xf86ExtractTypeFromList( - xf86PciBusAccWindowsFromOS(),ResIo); + pciBusAccWindows,ResIo); PciBus->preferred_mem = xf86ExtractTypeFromList( - xf86PciBusAccWindowsFromOS(),ResMem); + pciBusAccWindows,ResMem); PciBus->preferred_pmem = xf86ExtractTypeFromList( - xf86PciBusAccWindowsFromOS(),ResMem); + pciBusAccWindows,ResMem); xf86MsgVerb(X_INFO,3,"Host-to-PCI bridge:\n"); break; default: @@ -1719,11 +1893,11 @@ PciBus->secondary = i; PciBus->subclass = PCI_SUBCLASS_BRIDGE_HOST; PciBus->preferred_io = xf86ExtractTypeFromList( - xf86PciBusAccWindowsFromOS(),ResIo); + pciBusAccWindows,ResIo); PciBus->preferred_mem = xf86ExtractTypeFromList( - xf86PciBusAccWindowsFromOS(),ResMem); + pciBusAccWindows,ResMem); PciBus->preferred_pmem = xf86ExtractTypeFromList( - xf86PciBusAccWindowsFromOS(),ResMem); + pciBusAccWindows,ResMem); xf86MsgVerb(X_INFO,3,"Host-to-PCI bridge:\n"); } } @@ -1754,6 +1928,7 @@ printBridgeInfo(PciBus); } + xf86FreeResList(pciBusAccWindows); return PciBusBase; } @@ -1803,7 +1978,7 @@ * Mark all pciInfoRecs that need to be validated. These are * the ones which have been assigned to a screen. */ - Sys = NULL; + Sys = xf86DupResList(osRes); for (i=0; inumEntities; m++) if ((pvp = xf86GetPciInfoForEntity(xf86Screens[i]->entityList[m]))) @@ -1879,6 +2054,10 @@ Sys = xf86AddResToList(Sys, &range, -1); } } +#ifdef DEBUG + xf86MsgVerb(X_INFO, 3,"Sys:\n"); + xf86PrintResList(3,Sys); +#endif /* * The order the video devices are listed in is @@ -1890,7 +2069,7 @@ */ while ((pvp = xf86PciVideoInfo[n++])) { resPtr res_mp = NULL, res_m_io = NULL; - resPtr NonSys = NULL; + resPtr NonSys; resPtr tmp, avoid = NULL; if (!pvp->validate) continue; @@ -1987,8 +2166,10 @@ if (xf86IsSubsetOf(range,res_m_io) && ! ChkConflict(&range,own,SETUP) && ! ChkConflict(&range,avoid,SETUP) - && ! ChkConflict(&range,NonSys,SETUP)) + && ! ChkConflict(&range,NonSys,SETUP)) { + xf86FreeResList(own); continue; + } xf86MsgVerb(X_WARNING, 0, "****INVALID IO ALLOCATION**** b: 0x%lx e: 0x%lx " "correcting\a\n", range.rBegin,range.rEnd); @@ -2002,14 +2183,18 @@ if (xf86IsSubsetOf(range,res_mp) && ! ChkConflict(&range,own,SETUP) && ! ChkConflict(&range,avoid,SETUP) - && ! ChkConflict(&range,NonSys,SETUP)) + && ! ChkConflict(&range,NonSys,SETUP)) { + xf86FreeResList(own); continue; + } } if (xf86IsSubsetOf(range,res_m_io) && ! ChkConflict(&range,own,SETUP) && ! ChkConflict(&range,avoid,SETUP) - && ! ChkConflict(&range,NonSys,SETUP)) + && ! ChkConflict(&range,NonSys,SETUP)) { + xf86FreeResList(own); continue; + } xf86MsgVerb(X_WARNING, 0, "****INVALID MEM ALLOCATION**** b: 0x%lx e: 0x%lx " "correcting\a\n", range.rBegin,range.rEnd); @@ -2756,7 +2941,7 @@ /* * xf86FindPciVendorDevice() xf86FindPciClass(): These functions - * are ment to be used by the pci bios emulation. Some bioses + * are meant to be used by the pci bios emulation. Some bioses * need to see if there are _other_ chips of the same type around * so by setting pvp_exclude one pci device can be explicitely * _excluded if required. @@ -2938,5 +3123,22 @@ if (!pvp) return; tag = TAG(pvp); pciTagConvertRange2Host(tag, pRange); +} + + +void +xf86EnablePciBusMaster(pciVideoPtr pPci, Bool enable) +{ + CARD32 temp; + PCITAG tag; + + if (!pPci) return; + + tag = pciTag(pPci->bus, pPci->device, pPci->func); + temp = pciReadLong(tag, PCI_CMD_STAT_REG); + if (enable) + pciWriteLong(tag, PCI_CMD_STAT_REG, temp | PCI_CMD_MASTER_ENABLE); + else + pciWriteLong(tag, PCI_CMD_STAT_REG, temp & ~PCI_CMD_MASTER_ENABLE); } Index: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c:3.5 xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c:3.6 --- xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c:3.5 Wed Dec 6 10:35:11 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c Sat Mar 3 17:16:35 2001 @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c,v 3.5 2000/12/06 15:35:11 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86sbusBus.c,v 3.6 2001/03/03 22:16:35 tsi Exp $ */ #include #include @@ -276,7 +276,7 @@ for (i = 0, len = 0; sbusDeviceTable[i].devId; i++) { len = strlen(sbusDeviceTable[i].promName); if (!strncmp (sbusDeviceTable[i].promName, id, len) - && isdigit(id + len)) + && isdigit(id[len])) break; } devId = sbusDeviceTable[i].devId; Index: xc/programs/Xserver/hw/xfree86/common/xf86str.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86str.h:1.74 xc/programs/Xserver/hw/xfree86/common/xf86str.h:1.79 --- xc/programs/Xserver/hw/xfree86/common/xf86str.h:1.74 Tue Dec 12 21:44:59 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86str.h Fri May 18 19:35:31 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.74 2000/12/13 02:44:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86str.h,v 1.79 2001/05/18 23:35:31 dawes Exp $ */ /* * Copyright (c) 1997-2000 by The XFree86 Project, Inc. @@ -87,9 +87,9 @@ 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; @@ -218,12 +218,28 @@ char * driverName; void (*Identify)(int flags); Bool (*Probe)(struct _DriverRec *drv, int flags); - OptionInfoPtr (*AvailableOptions)(int chipid, int bustype); + const OptionInfoRec * (*AvailableOptions)(int chipid, int bustype); pointer module; int refCount; } DriverRec, *DriverPtr; +#ifdef XFree86LOADER /* + * The optional module list struct. This allows modules exporting helping + * functions to configuration tools, the Xserver, or any other + * application/module interested in such information. + */ +typedef struct _ModuleInfoRec { + int moduleVersion; + char * moduleName; + pointer module; + int refCount; + const OptionInfoRec * (*AvailableOptions)(void *unused); + pointer unused[8]; /* leave some space for more fields */ +} ModuleInfoRec, *ModuleInfoPtr; +#endif + +/* * These are the private bus types. New types can be added here. Types * required for the public interface should be added to xf86str.h, with * function prototypes added to xf86.h. @@ -233,7 +249,8 @@ BUS_NONE, BUS_ISA, BUS_PCI, - BUS_SBUS + BUS_SBUS, + BUS_last /* Keep last */ } BusType; typedef struct { @@ -438,7 +455,8 @@ X_ERROR, /* Error message */ X_WARNING, /* Warning message */ X_INFO, /* Informational message */ - X_NONE /* No prefix */ + X_NONE, /* No prefix */ + X_NOT_IMPLEMENTED /* Not implemented */ } MessageType; /* flags for depth 24 pixmap options */ Index: xc/programs/Xserver/hw/xfree86/common/xf86xv.c diff -u xc/programs/Xserver/hw/xfree86/common/xf86xv.c:1.28 xc/programs/Xserver/hw/xfree86/common/xf86xv.c:1.29 --- xc/programs/Xserver/hw/xfree86/common/xf86xv.c:1.28 Fri Aug 4 23:32:37 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86xv.c Mon May 7 17:59:05 2001 @@ -6,7 +6,7 @@ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.28 2000/08/05 03:32:37 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.c,v 1.29 2001/05/07 21:59:05 tsi Exp $ */ #include "misc.h" #include "xf86.h" @@ -176,10 +176,14 @@ XF86VideoAdaptorPtr *adaptors, int num ){ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + ScrnInfoPtr pScrn; XF86XVScreenPtr ScreenPriv; XvScreenPtr pxvs; + if(num <= 0 || + !XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc) + return FALSE; + if(XF86XVGeneration != serverGeneration) { if((XF86XVWindowIndex = AllocateWindowPrivateIndex()) < 0) return FALSE; @@ -189,9 +193,6 @@ if(!AllocateWindowPrivate(pScreen,XF86XVWindowIndex,sizeof(XF86XVWindowRec))) return FALSE; - if(!XvGetScreenIndexProc || !XvGetRTPortProc || !XvScreenInitProc) - return FALSE; - if(Success != (*XvScreenInitProc)(pScreen)) return FALSE; XF86XvScreenIndex = (*XvGetScreenIndexProc)(); @@ -199,7 +200,6 @@ pxvs = GET_XV_SCREEN(pScreen); - /* Anyone initializing the Xv layer must provide these two. The Xv di layer calls them without even checking if they exist! */ @@ -216,6 +216,7 @@ if(!ScreenPriv) return FALSE; + pScrn = xf86Screens[pScreen->myNum]; ScreenPriv->CreateWindow = pScreen->CreateWindow; ScreenPriv->DestroyWindow = pScreen->DestroyWindow; @@ -224,7 +225,6 @@ ScreenPriv->EnterVT = pScrn->EnterVT; ScreenPriv->LeaveVT = pScrn->LeaveVT; ScreenPriv->AdjustFrame = pScrn->AdjustFrame; - pScreen->CreateWindow = xf86XVCreateWindow; pScreen->DestroyWindow = xf86XVDestroyWindow; Index: xc/programs/Xserver/hw/xfree86/common/xf86xv.h diff -u xc/programs/Xserver/hw/xfree86/common/xf86xv.h:1.19 xc/programs/Xserver/hw/xfree86/common/xf86xv.h:1.21 --- xc/programs/Xserver/hw/xfree86/common/xf86xv.h:1.19 Thu Nov 2 11:33:27 2000 +++ xc/programs/Xserver/hw/xfree86/common/xf86xv.h Mon May 7 17:59:06 2001 @@ -1,7 +1,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.19 2000/11/02 16:33:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xv.h,v 1.21 2001/05/07 21:59:06 tsi Exp $ */ -#ifndef _XVDIX_H_ -#define _XVDIX_H_ +#ifndef _XF86XV_H_ +#define _XF86XV_H_ #include "xvdix.h" #include "xf86str.h" @@ -205,6 +205,7 @@ /*** These are DDX layer privates ***/ +extern int XF86XvScreenIndex; typedef struct { CreateWindowProcPtr CreateWindow; @@ -253,5 +254,4 @@ struct _XF86XVWindowRec *next; } XF86XVWindowRec, *XF86XVWindowPtr; -#endif /* _XVDIX_H_ */ - +#endif /* _XF86XV_H_ */ Index: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c:1.3 --- /dev/null Mon Jun 4 12:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c Sun Apr 1 10:00:08 2001 @@ -0,0 +1,201 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.c,v 1.3 2001/04/01 14:00:08 tsi Exp $ */ + +#include "misc.h" +#include "xf86.h" +#include "xf86_OSproc.h" + +#include "X.h" +#include "Xproto.h" +#include "scrnintstr.h" +#include "resource.h" +#include "dixstruct.h" + +#ifdef XFree86LOADER +#include "xvmodproc.h" +#endif + +#include "xf86xvmc.h" + +#ifdef XFree86LOADER +int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = NULL; +#else +int (*XvMCScreenInitProc)(ScreenPtr, int, XvMCAdaptorPtr) = XvMCScreenInit; +#endif + + +typedef struct { + CloseScreenProcPtr CloseScreen; + int num_adaptors; + XF86MCAdaptorPtr *adaptors; + XvMCAdaptorPtr dixinfo; +} xf86XvMCScreenRec, *xf86XvMCScreenPtr; + +static unsigned long XF86XvMCGeneration = 0; +static int XF86XvMCScreenIndex = -1; + +#define XF86XVMC_GET_PRIVATE(pScreen) \ + (xf86XvMCScreenPtr)((pScreen)->devPrivates[XF86XvMCScreenIndex].ptr) + + +static int +xf86XvMCCreateContext ( + XvPortPtr pPort, + XvMCContextPtr pContext, + int *num_priv, + CARD32 **priv +) +{ + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); + ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + + pContext->port_priv = (XvPortRecPrivatePtr)(pPort->devPriv.ptr); + + return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateContext)( + pScrn, pContext, num_priv, priv); +} + +static void +xf86XvMCDestroyContext ( XvMCContextPtr pContext) +{ + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); + ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + + (*pScreenPriv->adaptors[pContext->adapt_num]->DestroyContext)( + pScrn, pContext); +} + +static int +xf86XvMCCreateSurface ( + XvMCSurfacePtr pSurface, + int *num_priv, + CARD32 **priv +) +{ + XvMCContextPtr pContext = pSurface->context; + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); + ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + + return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSurface)( + pScrn, pSurface, num_priv, priv); +} + +static void +xf86XvMCDestroySurface (XvMCSurfacePtr pSurface) +{ + XvMCContextPtr pContext = pSurface->context; + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); + ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + + (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySurface)( + pScrn, pSurface); +} + +static int +xf86XvMCCreateSubpicture ( + XvMCSubpicturePtr pSubpicture, + int *num_priv, + CARD32 **priv +) +{ + XvMCContextPtr pContext = pSubpicture->context; + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); + ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + + return (*pScreenPriv->adaptors[pContext->adapt_num]->CreateSubpicture)( + pScrn, pSubpicture, num_priv, priv); +} + +static void +xf86XvMCDestroySubpicture (XvMCSubpicturePtr pSubpicture) +{ + XvMCContextPtr pContext = pSubpicture->context; + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pContext->pScreen); + ScrnInfoPtr pScrn = xf86Screens[pContext->pScreen->myNum]; + + (*pScreenPriv->adaptors[pContext->adapt_num]->DestroySubpicture)( + pScrn, pSubpicture); +} + + +static Bool +xf86XvMCCloseScreen (int i, ScreenPtr pScreen) +{ + xf86XvMCScreenPtr pScreenPriv = XF86XVMC_GET_PRIVATE(pScreen); + + pScreen->CloseScreen = pScreenPriv->CloseScreen; + + xfree(pScreenPriv->dixinfo); + xfree(pScreenPriv); + + return (*pScreen->CloseScreen)(i, pScreen); +} + +Bool xf86XvMCScreenInit( + ScreenPtr pScreen, + int num_adaptors, + XF86MCAdaptorPtr *adaptors +) +{ + XvMCAdaptorPtr pAdapt; + xf86XvMCScreenPtr pScreenPriv; + XvScreenPtr pxvs = + (XvScreenPtr)(pScreen->devPrivates[XF86XvScreenIndex].ptr); + + int i, j; + + if(!XvMCScreenInitProc) return FALSE; + + if(XF86XvMCGeneration != serverGeneration) { + if((XF86XvMCScreenIndex = AllocateScreenPrivateIndex()) < 0) + return FALSE; + XF86XvMCGeneration = serverGeneration; + } + + if(!(pAdapt = xalloc(sizeof(XvMCAdaptorRec) * num_adaptors))) + return FALSE; + + if(!(pScreenPriv = xalloc(sizeof(xf86XvMCScreenRec)))) { + xfree(pAdapt); + return FALSE; + } + + pScreen->devPrivates[XF86XvMCScreenIndex].ptr = (pointer)pScreenPriv; + + pScreenPriv->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = xf86XvMCCloseScreen; + + pScreenPriv->num_adaptors = num_adaptors; + pScreenPriv->adaptors = adaptors; + pScreenPriv->dixinfo = pAdapt; + + for(i = 0; i < num_adaptors; i++) { + pAdapt[i].xv_adaptor = NULL; + for(j = 0; j < pxvs->nAdaptors; j++) { + if(!strcmp((*adaptors)->name, pxvs->pAdaptors[j].name)) { + pAdapt[i].xv_adaptor = &(pxvs->pAdaptors[j]); + break; + } + } + if(!pAdapt[i].xv_adaptor) { + /* no adaptor by that name */ + xfree(pAdapt); + return FALSE; + } + pAdapt[i].num_surfaces = (*adaptors)->num_surfaces; + pAdapt[i].surfaces = (XvMCSurfaceInfoPtr*)((*adaptors)->surfaces); + pAdapt[i].num_subpictures = (*adaptors)->num_subpictures; + pAdapt[i].subpictures = (XvImagePtr*)((*adaptors)->subpictures); + pAdapt[i].CreateContext = xf86XvMCCreateContext; + pAdapt[i].DestroyContext = xf86XvMCDestroyContext; + pAdapt[i].CreateSurface = xf86XvMCCreateSurface; + pAdapt[i].DestroySurface = xf86XvMCDestroySurface; + pAdapt[i].CreateSubpicture = xf86XvMCCreateSubpicture; + pAdapt[i].DestroySubpicture = xf86XvMCDestroySubpicture; + adaptors++; + } + + if(Success != (*XvMCScreenInitProc)(pScreen, num_adaptors, pAdapt)) + return FALSE; + + return TRUE; +} Index: xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h:1.4 --- /dev/null Mon Jun 4 12:40:33 2001 +++ xc/programs/Xserver/hw/xfree86/common/xf86xvmc.h Sun Apr 8 19:00:27 2001 @@ -0,0 +1,134 @@ +/* $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 "xvmcext.h" +#include "xf86xv.h" + +typedef struct { + int num_xvimages; + int *xvimage_ids; /* reference the subpictures in the XF86MCAdaptorRec */ +} XF86MCImageIDList; + +typedef struct { + int surface_type_id; /* Driver generated. Must be unique on the port */ + int chroma_format; + int color_description; + unsigned short max_width; + unsigned short max_height; + unsigned short subpicture_max_width; + unsigned short subpicture_max_height; + int mc_type; + int flags; + XF86MCImageIDList *compatible_subpictures; /* can be null, if none */ +} XF86MCSurfaceInfoRec, *XF86MCSurfaceInfoPtr; + + +/* + xf86XvMCCreateContextProc + + DIX will fill everything out in the context except the driver_priv. + The port_priv holds the private data specified for the port when + Xv was initialized by the driver. + The driver may store whatever it wants in driver_priv and edit + the width, height and flags. If the driver wants to return something + to the client it can allocate space in priv and specify the number + of 32 bit words in num_priv. This must be dynamically allocated + space because DIX will free it after it passes it to the client. +*/ + + +typedef int (*xf86XvMCCreateContextProcPtr) ( + ScrnInfoPtr pScrn, + XvMCContextPtr context, + int *num_priv, + CARD32 **priv +); + +typedef void (*xf86XvMCDestroyContextProcPtr) ( + ScrnInfoPtr pScrn, + XvMCContextPtr context +); + +/* + xf86XvMCCreateSurfaceProc + + DIX will fill everything out in the surface except the driver_priv. + The driver may store whatever it wants in driver_priv. The driver + may pass data back to the client in the same manner as the + xf86XvMCCreateContextProc. +*/ + + +typedef int (*xf86XvMCCreateSurfaceProcPtr) ( + ScrnInfoPtr pScrn, + XvMCSurfacePtr surface, + int *num_priv, + CARD32 **priv +); + +typedef void (*xf86XvMCDestroySurfaceProcPtr) ( + ScrnInfoPtr pScrn, + XvMCSurfacePtr surface +); + +/* + xf86XvMCCreateSubpictureProc + + DIX will fill everything out in the subpicture except the driver_priv, + num_palette_entries, entry_bytes and component_order. The driver may + store whatever it wants in driver_priv and edit the width and height. + If it is a paletted subpicture the driver needs to fill out the + num_palette_entries, entry_bytes and component_order. These are + not communicated to the client until the time the surface is + created. + + The driver may pass data back to the client in the same manner as the + xf86XvMCCreateContextProc. +*/ + + +typedef int (*xf86XvMCCreateSubpictureProcPtr) ( + ScrnInfoPtr pScrn, + XvMCSubpicturePtr subpicture, + int *num_priv, + CARD32 **priv +); + +typedef void (*xf86XvMCDestroySubpictureProcPtr) ( + ScrnInfoPtr pScrn, + XvMCSubpicturePtr subpicture +); + + +typedef struct { + char *name; + int num_surfaces; + XF86MCSurfaceInfoPtr *surfaces; + int num_subpictures; + XF86ImagePtr *subpictures; + xf86XvMCCreateContextProcPtr CreateContext; + xf86XvMCDestroyContextProcPtr DestroyContext; + xf86XvMCCreateSurfaceProcPtr CreateSurface; + xf86XvMCDestroySurfaceProcPtr DestroySurface; + xf86XvMCCreateSubpictureProcPtr CreateSubpicture; + xf86XvMCDestroySubpictureProcPtr DestroySubpicture; +} XF86MCAdaptorRec, *XF86MCAdaptorPtr; + +/* + xf86XvMCScreenInit + + Unlike Xv, the adaptor data is not copied from this structure. + This structure's data is used so it must stick around for the + life of the server. Note that it's an array of pointers not + an array of structures. +*/ + +Bool xf86XvMCScreenInit( + ScreenPtr pScreen, + int num_adaptors, + XF86MCAdaptorPtr *adaptors +); + +#endif /* _XF86XVMC_H */ Index: xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c diff -u xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c:1.4 xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c:1.7 --- xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c:1.4 Mon Nov 6 14:24:07 2000 +++ xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c Thu Apr 5 13:42:32 2001 @@ -3,7 +3,7 @@ * * Copyright 1999 by Andrew C Aitchison */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c,v 1.4 2000/11/06 19:24:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/ddcProperty.c,v 1.7 2001/04/05 17:42:32 dawes Exp $ */ #include "misc.h" #include "xf86.h" @@ -26,6 +26,8 @@ CARD8 *EDID2rawdata = NULL; CARD8 *VDIFrawdata = NULL; int i, ret; + Bool makeEDID1prop = FALSE; + Bool makeEDID2prop = FALSE; #ifdef DEBUG ErrorF("xf86SetDDCproperties(%p, %p)\n", pScrnInfo, DDC); @@ -44,7 +46,36 @@ pScrnInfo->monitor->DDC = DDC; if (DDC->ver.version == 1) { + makeEDID1prop = TRUE; + } else if (DDC->ver.version == 2) { + int checksum1 = 0; + int checksum2 = 0; + makeEDID2prop = TRUE; + + /* Some monitors (eg Panasonic PanaSync4) + * report version==2 because they used EDID v2 spec document, + * although they use EDID v1 data structure :-( + * + * Try using checksum to determine when we have such a monitor. + */ + for (i=0; i<256; i++) { checksum2 += DDC->rawData[i]; } + if ( (checksum2 % 256) != 0 ) { + xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "Monitor EDID v2 checksum failed\n"); + xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "XFree86_DDC_EDID2_RAWDATA property may be bad\n"); + for (i=0; i<128; i++) { checksum1 += DDC->rawData[i]; } + if ( (checksum1 % 256) == 0 ) { + xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "Monitor EDID v1 checksum passed,\n"); + xf86DrvMsg(pScrnInfo->scrnIndex,X_INFO, "XFree86_DDC_EDID2_RAWDATA property created\n"); + makeEDID1prop = TRUE; + } + } + } else { + xf86DrvMsg(pScrnInfo->scrnIndex, X_PROBED, + "unexpected EDID version %d revision %d\n", + DDC->ver.version, DDC->ver.revision ); + } + if (makeEDID1prop) { if ( (EDID1rawdata = xalloc(128*sizeof(CARD8)))==NULL ) { return FALSE; } @@ -72,9 +103,10 @@ ErrorF("xf86RegisterRootWindowProperty returns %d\n", ret ); #endif - } else if (DDC->ver.version == 2) { + } + + if (makeEDID2prop) { if ( (EDID2rawdata = xalloc(256*sizeof(CARD8)))==NULL ) { - xfree(EDID2rawdata); return FALSE; } for (i=0; i<256; i++) { @@ -92,21 +124,11 @@ #endif ret = xf86RegisterRootWindowProperty(pScrnInfo->scrnIndex, EDID2Atom, XA_INTEGER, 8, -#if 1 - 256, (unsigned char *)EDID1rawdata -#else -#define EDID2_DUMMY_STRING "Dummy EDID2 property - please insert correct values" - strlen(EDID2_DUMMY_STRING), - EDID2_DUMMY_STRING -#endif + 256, (unsigned char *)EDID2rawdata ); #ifdef DEBUG ErrorF("xf86RegisterRootWindowProperty returns %d\n", ret ); #endif - } else { - xf86DrvMsg(pScrnInfo->scrnIndex, X_PROBED, - "unexpected EDID version %d revision %d\n", - DDC->ver.version, DDC->ver.revision ); } if (DDC->vdif) { Index: xc/programs/Xserver/hw/xfree86/ddc/print_edid.c diff -u xc/programs/Xserver/hw/xfree86/ddc/print_edid.c:1.14 xc/programs/Xserver/hw/xfree86/ddc/print_edid.c:1.14.4.1 --- xc/programs/Xserver/hw/xfree86/ddc/print_edid.c:1.14 Thu Jul 13 17:31:38 2000 +++ xc/programs/Xserver/hw/xfree86/ddc/print_edid.c Tue May 22 13:02:36 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/print_edid.c,v 1.14 2000/07/13 21:31:38 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/print_edid.c,v 1.14.4.1 2001/05/22 17:02:36 tsi Exp $ */ /* print_edid.c: print out all information retrieved from display device * @@ -232,7 +232,7 @@ m[i].section.ranges.min_v, m[i].section.ranges.max_v, m[i].section.ranges.min_h, m[i].section.ranges.max_h); if (m[i].section.ranges.max_clock != 0) - xf86ErrorF(" PixClock max %i kHz\n",m[i].section.ranges.max_clock); + xf86ErrorF(" PixClock max %i MHz\n",m[i].section.ranges.max_clock); else xf86DrvMsg(scrnIndex,X_INFO,"\n"); break; Index: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c diff -u xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c:1.19 xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c:1.20.2.1 --- xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c:1.19 Thu Nov 16 14:44:55 2000 +++ xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c Fri May 25 17:45:00 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c,v 1.19 2000/11/16 19:44:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ddc/xf86DDC.c,v 1.20.2.1 2001/05/25 21:45:00 paulo Exp $ */ /* xf86DDC.c * @@ -10,6 +10,8 @@ #include "xf86_OSproc.h" #include "xf86DDC.h" +static const OptionInfoRec *DDCAvailableOptions(void *unused); + const char *i2cSymbols[] = { "xf86CreateI2CDevRec", "xf86I2CDevInit", @@ -38,6 +40,14 @@ XF86ModuleData ddcModuleData = { &ddcVersRec, ddcSetup, NULL }; +ModuleInfoRec DDC = { + 1, + "DDC", + NULL, + 0, + DDCAvailableOptions, +}; + static pointer ddcSetup(pointer module, pointer opts, int *errmaj, int *errmin) { @@ -45,6 +55,10 @@ if (!setupDone) { setupDone = TRUE; +#ifndef REMOVE_LOADER_CHECK_MODULE_INFO + if (xf86LoaderCheckSymbol("xf86AddModuleInfo")) +#endif + xf86AddModuleInfo(&DDC, module); /* * Tell the loader about symbols from other modules that this module * might refer to. @@ -112,14 +126,19 @@ DDCOPT_NODDC } DDCOpts; -static OptionInfoRec DDCOptions[] = { +static const OptionInfoRec DDCOptions[] = { { DDCOPT_NODDC1, "NoDDC1", OPTV_BOOLEAN, {0}, FALSE }, { DDCOPT_NODDC2, "NoDDC2", OPTV_BOOLEAN, {0}, FALSE }, { DDCOPT_NODDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; -#define nDDCOptions (sizeof(DDCOptions) / sizeof(DDCOptions[0])) +/*ARGSUSED*/ +static const OptionInfoRec * +DDCAvailableOptions(void *unused) +{ + return (DDCOptions); +} xf86MonPtr xf86DoEDID_DDC1( @@ -133,13 +152,15 @@ int sigio; /* Default DDC and DDC1 to enabled. */ Bool noddc = FALSE, noddc1 = FALSE; - OptionInfoRec options[nDDCOptions]; + OptionInfoPtr options; + options = xnfalloc(sizeof(DDCOptions)); (void)memcpy(options, DDCOptions, sizeof(DDCOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); xf86GetOptValBool(options, DDCOPT_NODDC, &noddc); xf86GetOptValBool(options, DDCOPT_NODDC1, &noddc1); + xfree(options); if (noddc || noddc1) return NULL; @@ -168,13 +189,15 @@ xf86MonPtr tmp = NULL; /* Default DDC and DDC2 to enabled. */ Bool noddc = FALSE, noddc2 = FALSE; - OptionInfoRec options[nDDCOptions]; + OptionInfoPtr options; + options = xnfalloc(sizeof(DDCOptions)); (void)memcpy(options, DDCOptions, sizeof(DDCOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); xf86GetOptValBool(options, DDCOPT_NODDC, &noddc); xf86GetOptValBool(options, DDCOPT_NODDC2, &noddc2); + xfree(options); if (noddc || noddc2) return NULL; Index: xc/programs/Xserver/hw/xfree86/doc/BugReport diff -u xc/programs/Xserver/hw/xfree86/doc/BugReport:1.3.2.2 xc/programs/Xserver/hw/xfree86/doc/BugReport:removed --- xc/programs/Xserver/hw/xfree86/doc/BugReport:1.3.2.2 Fri Mar 16 11:10:42 2001 +++ xc/programs/Xserver/hw/xfree86/doc/BugReport Mon Jun 4 12:40:34 2001 @@ -1,57 +0,0 @@ - XFree86 Bug/Test Report Form - -Please fill in as many of the fields a possible, and return this form to -XFree86@XFree86.org. Replace the comments in [] with your own text. - -VERSION: - -4.0.3 - -VIDEO DRIVER: - -[e.g. mga] - -OPERATING SYSTEM: - -[e.g. Linux] - -VIDEO CARD: - - [Fill out each relevant entry. If you don't know some of the details, - just leave them blank.] - - MODEL: - - [Include a precise description of the model. There are often subtle - differences in card model names.] - - GRAPHICS CHIPSET: - - [e.g. Matrox G200] - - RAMDAC: - - [Usually only relevant for old cards] - - CLOCKCHIP: - - [Usually only relevant for old cards] - - VIDEO MEMORY: - - [e.g. 2MB DRAM Include both the amount, and type (if known)] - - BUS TYPE: - - [e.g. PCI] - -REPORT: - - [Include details of any problems you encountered. If you didn't have - any problems, just say "no problems". Indicate what modes and colour - depths you tested. If you found a bug, give a description of how to - reproduce it.] - - - -$XFree86: xc/programs/Xserver/hw/xfree86/doc/BugReport,v 1.3.2.2 2001/03/16 16:10:42 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/BugReport.cpp diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/BugReport.cpp:1.1 --- /dev/null Mon Jun 4 12:40:34 2001 +++ xc/programs/Xserver/hw/xfree86/doc/BugReport.cpp Mon Jan 15 18:00:01 2001 @@ -0,0 +1,57 @@ + XFree86 Bug/Test Report Form + +Please fill in as many of the fields a possible, and return this form to +XFree86@XFree86.org. Replace the comments in [] with your own text. + +VERSION: + +XF86_VERSION + +VIDEO DRIVER: + +[e.g. mga] + +OPERATING SYSTEM: + +[e.g. Linux] + +VIDEO CARD: + + [Fill out each relevant entry. If you don't know some of the details, + just leave them blank.] + + MODEL: + + [Include a precise description of the model. There are often subtle + differences in card model names.] + + GRAPHICS CHIPSET: + + [e.g. Matrox G200] + + RAMDAC: + + [Usually only relevant for old cards] + + CLOCKCHIP: + + [Usually only relevant for old cards] + + VIDEO MEMORY: + + [e.g. 2MB DRAM Include both the amount, and type (if known)] + + BUS TYPE: + + [e.g. PCI] + +REPORT: + + [Include details of any problems you encountered. If you didn't have + any problems, just say "no problems". Indicate what modes and colour + depths you tested. If you found a bug, give a description of how to + reproduce it.] + + + +$XFree86: xc/programs/Xserver/hw/xfree86/doc/BugReport.cpp,v 1.1 2001/01/15 23:00:01 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/DESIGN diff -u xc/programs/Xserver/hw/xfree86/doc/DESIGN:1.33.2.2 xc/programs/Xserver/hw/xfree86/doc/DESIGN:1.36.2.1 --- xc/programs/Xserver/hw/xfree86/doc/DESIGN:1.33.2.2 Tue Mar 13 12:19:26 2001 +++ xc/programs/Xserver/hw/xfree86/doc/DESIGN Fri Jun 1 14:26:42 2001 @@ -2,7 +2,7 @@ The XFree86 Project, Inc - Last modified 2 December 2000 + Last modified 1 May 2001 NOTE: This is a DRAFT document, and the interfaces described here are subject to change without notice. @@ -2100,13 +2100,14 @@ ScreenInit() function, but only when serverGeneration == 1. - OptionInfoPtr xf86TokenToOptinfo(OptionInfoPtr table, int token) + OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int + token) Returns a pointer to the OptionInfoRec in table with a token field matching token. Returns NULL if no match is found. - Bool xf86IsOptionSet(OptionInfoPtr table, int token) + Bool xf86IsOptionSet(const OptionInfoRec *table, int token) Returns the found field of the OptionInfoRec in table with a token field matching token. This can be used for @@ -2115,13 +2116,13 @@ mine the value of the option. Returns FALSE if no match is found. - char *xf86GetOptValString(OptionInfoPtr table, int token) + char *xf86GetOptValString(const OptionInfoRec *table, int token) Returns the value.str field of the OptionInfoRec in table with a token field matching token. Returns NULL if no match is found. - Bool xf86GetOptValInteger(OptionInfoPtr table, int token, + Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, int *value) @@ -2132,21 +2133,21 @@ tion. The function return value is as for xf86IsOption- Set(). - Bool xf86GetOptValULong(OptionInfoPtr table, int token, + Bool xf86GetOptValULong(const OptionInfoRec *table, int token, unsigned long *value) Like xf86GetOptValInteger(), except the value is treated as an unsigned long. - Bool xf86GetOptValReal(OptionInfoPtr table, int token, + Bool xf86GetOptValReal(const OptionInfoRec *table, int token, double *value) Like xf86GetOptValInteger(), except that value.realnum is used. - Bool xf86GetOptValFreq(OptionInfoPtr table, int token, + Bool xf86GetOptValFreq(const OptionInfoRec *table, int token, OptFreqUnits expectedUnits, double *value) @@ -2161,7 +2162,8 @@ "10000" and expectedUnits is OPTUNITS_MHZ, the value returned is 10. - Bool xf86GetOptValBool(OptionInfoPtr table, int token, Bool *value) + Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool + *value) This function is used to check boolean options (OPTV_BOOLEAN). If the function return value is FALSE, @@ -2176,7 +2178,8 @@ present. It should normally be set to a default value before calling this function. - Bool xf86ReturnOptValBool(OptionInfoPtr table, int token, Bool def) + Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, + Bool def) This function is used to check boolean options (OPTV_BOOLEAN). If the option is set, its value is @@ -4905,7 +4908,15 @@ fields of hwp with the standard VGA set of functions. This is called by vgaHWGetHWRec(), so there is usually no need to call this explicitly. The register access func- - tions are described below. + tions are described below. If the registers are shadowed + in some other port I/O space (for example a PCI I/O + region), these functions can be used to access the shad- + owed registers if hwp->PIOOffset is initialised with off- + set, calculated in such a way that when the standard VGA + I/O port value is added to it the correct offset into the + PIO area results. This value is initialised to zero in + vgaHWGetHWRec(). (Note: the PIOOffset functionality is + present in XFree86 4.1.0 and later.) void vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset) @@ -4977,6 +4988,16 @@ vgahw module is not loaded (for example, in the Chip- Probe() function). + void vgaHWEnable(vgaHWPtr hwp) + + This function enables the VGA subsystem. (Note, this + function is present in XFree86 4.1.0 and later.). + + void vgaHWDisable(vgaHWPtr hwp) + + This function disables the VGA subsystem. (Note, this + function is present in XFree86 4.1.0 and later.). + void vgaHWSave(ScrnInfoPtr pScrn, vgaRegPtr save, int flags) This function saves the VGA state. The state is written @@ -5236,6 +5257,17 @@ Return the value read from the DAC Data register. + CARD8 readEnable(vgaHWptr hwp) + + Return the value read from the VGA Enable register. + (Note: This function is present in XFree86 4.1.0 and + later.) + + void writeEnable(vgaHWPtr hwp, CARD8 value) + + Write value to the VGA Enable register. (Note: This + function is present in XFree86 4.1.0 and later.) + 20. Some notes about writing a driver NOTE: some parts of this are not up to date @@ -5433,6 +5465,7 @@ Bool noAccel; Bool hwCursor; CloseScreenProcPtr CloseScreen; + OptionInfoPtr Options; ... } ZZZRec, *ZZZPtr; @@ -5447,7 +5480,7 @@ OPTION_NOACCEL } ZZZOpts; - static OptionInfoRec ZZZOptions[] = { + static const OptionInfoRec ZZZOptions[] = { { OPTION_FOO_HACK, "FooHack", OPTV_INTEGER, {0}, FALSE }, { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, @@ -5455,8 +5488,6 @@ { -1, NULL, OPTV_NONE, {0}, FALSE } }; - #define nZZZOptions (sizeof(ZZZOptions) / sizeof(ZZZOptions[0])) - 20.3 Functions 20.3.1 SetupProc @@ -5704,8 +5735,6 @@ static Bool ZZZPreInit(ScrnInfoPtr pScrn, int flags) { - OptionInfoRec options[nZZZOptions]; - /* Fill in the monitor field */ pScrn->monitor = pScrn->confScreen->monitor; @@ -5784,10 +5813,14 @@ /* * Process the options based on the information in ZZZOptions. - * The results are written to options. + * The results are written to pZzz->Options. If all of the options + * processing is done within this function a local variable "options" + * can be used instead of pZzz->Options. */ - (void)memcpy(options, ZZZOptions, sizeof(ZZZOptions)); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); + if (!(pZzz->Options = xalloc(sizeof(ZZZOptions)))) + return FALSE; + (void)memcpy(pZzz->Options, ZZZOptions, sizeof(ZZZOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pZzz->Options); /* * Set various fields of ScrnInfoRec and/or ZZZRec based on @@ -5795,25 +5828,25 @@ */ from = X_DEFAULT; pZzz->hwCursor = FALSE; - if (xf86IsOptionSet(options, OPTION_HW_CURSOR)) { + if (xf86IsOptionSet(pZzz->Options, OPTION_HW_CURSOR)) { from = X_CONFIG; pZzz->hwCursor = TRUE; } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pZzz->hwCursor ? "HW" : "SW"); - if (xf86IsOptionSet(options, OPTION_NOACCEL)) { + if (xf86IsOptionSet(pZzz->Options, OPTION_NOACCEL)) { pZzz->noAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } else { pZzz->noAccel = FALSE; } - if (xf86IsOptionSet(options, OPTION_PCI_RETRY)) { + if (xf86IsOptionSet(pZzz->Options, OPTION_PCI_RETRY)) { pZzz->UsePCIRetry = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry enabled\n"); } pZzz->fooHack = 0; - if (xf86GetOptValInteger(options, OPTION_FOO_HACK, + if (xf86GetOptValInteger(pZzz->Options, OPTION_FOO_HACK, &pZzz->fooHack)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Foo Hack set to %d\n", pZzz->fooHack); @@ -6302,7 +6335,7 @@ ZZZFreeRec(xf86Screens[scrnIndex]); } - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.39.2.1 2001/02/08 19:31:03 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.44 2001/05/19 00:40:30 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/DESIGN,v 1.33.2.2 2001/03/13 17:19:26 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/DESIGN,v 1.36.2.1 2001/06/01 18:26:42 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/Imakefile diff -u xc/programs/Xserver/hw/xfree86/doc/Imakefile:3.72.2.1 xc/programs/Xserver/hw/xfree86/doc/Imakefile:3.76.2.1 --- xc/programs/Xserver/hw/xfree86/doc/Imakefile:3.72.2.1 Fri Mar 16 09:55:40 2001 +++ xc/programs/Xserver/hw/xfree86/doc/Imakefile Fri Jun 1 14:09:46 2001 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.72.2.1 2001/03/16 14:55:40 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/Imakefile,v 3.76.2.1 2001/06/01 18:09:46 dawes Exp $ #include #include @@ -76,20 +76,24 @@ /*ReadmeFile(WstDig)*/ \ $(_NULLENTRY_) -MAINDOCS = LICENSE README /*ReadmeFile(Config)*/ /*BUILD*/ RELNOTES \ +MAINDOCS = LICENSE README /*ReadmeFile(Config)*/ /*BUILD*/ /*RELNOTES*/ \ Install Status DESIGN Versions OTHERDOCS = /*VideoModes.doc*/ /*QuickStart.doc*/ /*xinput*/ \ ReadmeFile(fonts) ReadmeFile(mouse) ReadmeFile(DRI) \ - ReadmeFile(DRIcomp) + ReadmeFile(DRIcomp) ReadmeFile(dps) #endif MISCDOCS = ServersOnly /*LbxproxyOnly*/ $(REPORTFORM) ReadmeFile(DGA) \ - VideoBoard98 + VideoBoard98 ReadmeFile(rapidaccess) DATABASE = /* modeDB.txt */ /* AccelCards Monitors Devices */ FILES = $(MAINDOCS) $(OSREADME) $(HWREADME) $(OTHERDOCS) $(MISCDOCS) $(DATABASE) + +VERS = XFree86VersionString + +CppFileTarget(BugReport, BugReport.cpp, -DXF86_VERSION=$(VERS), $(ICONFIGFILES)) InstallMultipleDest(install,$(FILES),$(XFREE86DOCDIR)) Index: xc/programs/Xserver/hw/xfree86/doc/Install diff -u xc/programs/Xserver/hw/xfree86/doc/Install:1.10.2.3 xc/programs/Xserver/hw/xfree86/doc/Install:1.11.2.1 --- xc/programs/Xserver/hw/xfree86/doc/Install:1.10.2.3 Fri Mar 16 09:57:21 2001 +++ xc/programs/Xserver/hw/xfree86/doc/Install Fri Jun 1 14:26:43 2001 @@ -1,8 +1,8 @@ - Installation Details for XFree86[tm] 4.0.3 + Installation Details for XFree86[tm] 4.1.0 The XFree86 Project, Inc - 2 March 2001 + 1 June 2001 Abstract @@ -20,20 +20,14 @@ installation script. We recommend that these be used to install the bina- ries. -2. Downloading the XFree86 4.0.3 binaries +2. Downloading the XFree86 4.1.0 binaries -XFree86 4.0.3 is an update release. The most recent full release (4.0.2) -needs to be installed before installing this update. Information about down- -loading and installing 4.0.2 can be found in the installation document for -that version, which can be found on the XFree86 web site -. - -We provide XFree86 4.0.3 update binaries for a range of operating systems at -our ftp site . Often -during releases our ftp site is heavily loaded. Instead of downloading -directly from us we recommend that instead you use one of our mirror sites. -Another advantage of using our mirror sites is that some of them support http -access (ours does not). +We provide XFree86 4.1.0 binaries for a range of operating systems at our ftp +site . Often during +releases our ftp site is heavily loaded. Instead of downloading directly +from us we recommend that instead you use one of our mirror sites. Another +advantage of using our mirror sites is that some of them support http access +(ours does not). Our binaries are organized by sub-directories which correspond to each of the OS/platforms for which we provide binaries. First go to the sub-directory @@ -49,24 +43,46 @@ you to download. If you are careful with this step you will save yourself a lot time and trouble from NOT downloading an incompatible distribution. -NOTE: the Xinstall.sh script must be downloaded in binary mode, otherwise it -won't run correctly. If you get lots of "command not found" messages when -you try to run it, then it is most likely because the script wasn't down- -loaded in binary mode. Some web browsers won't do this for files of that -name, so we also have a copy of it called "Xinstall.bin", and most browsers -should download that correctly. When downloading it under this name, select -"save as" on your browser, and save the file under the name "Xinstall.sh". - -Once you're run the Xinstall.sh script and found which binary update distri- -bution is suitable for your system, download the necessary files. The five -(5) mandatory files for all installations are listed below. If you have not +NOTES: + + o The Xinstall.sh script must be downloaded in binary mode, otherwise it + won't run correctly. If you get lots of "command not found" messages + when you try to run it, then it is most likely because the script wasn't + downloaded in binary mode. Some web browsers won't do this for files of + that name, so we also have a copy of it called "Xinstall.bin", and most + browsers should download that correctly. When downloading it under this + name, select "save as" on your browser, and save the file under the name + "Xinstall.sh". + + o The Xinstall.sh script requires some system commands and utilities to + function correctly. While most systems will have these, some Linux + installations may not. If you find that the script is failing because + of some missing system command, you will need to install it before you + can continue. If you don't know how to do this, then we recommend that + you obtain this version of XFree86 from your Operating System distribu- + tor. + + o Always use the version of the Xinstall.sh script that's provided with + the release you're installing. Older versions of the script may not + install newer releases correctly. + +Once you're run the Xinstall.sh script and found which binary distribution is +suitable for your system, download the necessary files. The twelve (12) +mandatory files for all installations are listed below. If you have not downloaded all of the files, the installer script will complain. - 1. Xinstall.sh The installer script - 2. extract The utility for extracting tarballs - 3. Xupdate.tgz Updated files except X server drivers/modules - 4. Xdocupd.tgz Updated documentation - 5. Xdrivers.tgz Updated X server drivers + 1. Xinstall.sh The installer script + 2. extract The utility for extracting tarballs + 3. Xbin.tgz X clients/utilities and run-time libraries + 4. Xlib.tgz Some data files required at run-time + 5. Xman.tgz Manual pages + 6. Xdoc.tgz XFree86 documentation + 7. Xfnts.tgz Base set of fonts + 8. Xfenc.tgz Base set of font encoding data + 9. Xetc.tgz Run-time configuration files + 10. Xvar.tgz Run-time data + 11. Xxserv.tgz XFree86 X server + 12. Xmod.tgz XFree86 X server modules NOTES: @@ -75,22 +91,46 @@ extract.exe instead. This should fix the problem. (This is not a DOS/Windows executable.) - o The Darwin/Mac OS X distribution doesn't have or require the - Xdrivers.tgz tarball. + o A few distributions don't have or require the Xvar.tgz tarball. If it + is present in the binaries sub-directory for your platform, then it is + required. + o The Darwin/Mac OS X distribution doesn't have or require the Xmod.tgz + tarball. + o Some distributions may have additional mandatory tarballs. While rare, the installer script will tell you if any are missing. + +The following eleven (11) tarballs are optional. You should download the +ones you want to install. + + 1. Xfsrv.tgz Font server + 2. Xnest.tgz Nested X server + 3. Xprog.tgz X header files, config files and compile-time libs + 4. Xprt.tgz X Print server + 5. Xvfb.tgz Virtual framebuffer X server + 6. Xf100.tgz 100dpi fonts + 7. Xfcyr.tgz Cyrillic fonts + 8. Xfscl.tgz Scalable fonts (Speedo and Type1) + 9. Xhtml.tgz HTML version of the documentation + 10. Xps.tgz PostScript version of the documentation + 11. Xjdoc.tgz Documentation in Japanese + +NOTES: -3. Installing XFree86 4.0.3 using the Xinstall.sh script + o Some distributions may have some additional optional tarballs. -We strongly recommend that our XFree86 4.0.3 binaries be installed using the -Xinstall.sh script that we provide. It is also important that the previous -full release (4.0.2) is installed before installing this update release. -Make sure that you use the 4.0.3 version of the Xinstall.sh script to install -this update. Older versions may not be able to do it correctly. There are a -lot of steps in the manual installation process, and those steps can vary -according to the platform and hardware setup. +If you miss some and want to install them later, go to the Manual Installa- +tion (section 4., page 1) section. +3. Installing XFree86 4.1.0 using the Xinstall.sh script + +We strongly recommend that our XFree86 4.1.0 binaries be installed using the +Xinstall.sh script that we provide. There are a lot of steps in the manual +installation process, and those steps can vary according to the platform and +hardware setup. There is a description of the manual installation process +for the most common cases below (section 4., page 1). + You must login as the super user (root) to run the installer script. Place all of the downloaded files into a single directory (choose a temporary loca- tion with enough space). Use the cd command to change to that directory and @@ -117,29 +157,92 @@ running, before continuing. If you ignore this warning and run into prob- lems, well, you were warned! -You will be warned that proceeding with this installation will overwrite it. -Only those things that are part of our standard distribution will be over- -written. Other X applications that you may have installed will not be -removed. Some configuration files may be overwritten though, but the -installer should prompt you before doing so. As the opening greeting says, -it is strongly recommended that you backup any existing installation before -proceeding. If you want your old applications to still be there after you've -installed, don't do the "backup" by simply renaming your old /usr/X11R6 -directory. It is better to make a copy of it, and then install over the top -of the original one. If you run into problems and want to revert to the old -installation, you can then delete the overwritten one and copy the saved ver- -sion back. +If you have an existing X installation, you will be warned that proceeding +with this installation will overwrite it. Only those things that are part of +our standard distribution will be overwritten. Other X applications that you +may have installed will not be removed. Some configuration files may be +overwritten though, but the installer should prompt you before doing so. As +the opening greeting says, it is strongly recommended that you backup any +existing installation before proceeding. If you want your old applications +to still be there after you've installed, don't do the "backup" by simply +renaming your old /usr/X11R6 directory. It is better to make a copy of it, +and then install over the top of the original one. If you run into problems +and want to revert to the old installation, you can then delete the overwrit- +ten one and copy the saved version back. During the first part of the installation over an existing version, the script may remove some old files or directories that would get in the way of the new installation. It will list which files/directories have been removed. If none are listed, then none were removed. +The next step when installing over an existing version is to check for exist- +ing configuration files. As of XFree86 version 3.9.18, the run-time configu- +ration files are installed by default under /etc/X11 instead of under +/usr/X11R6/lib/X11. The installer will move the existing ones for you and +create the necessary symbolic links. If you don't want to have these config- +uration files under /etc/X11, then you should answer "no" when asked about +it. Answering "no" here also means that the new configuration files will be +installed in the old /usr/X11R6/lib/X11 location. + +Note: for the rare systems that don't have symbolic links, this question will +not be asked. The default answer is "yes" because that is best for most sit- +uations. It is our new default. It makes it easier to share the /usr/X11R6 +directory between multiple hosts, and allows it to be mounted read-only. If +you don't need these features, then you can safely answer "no" if you don't +want them moved. + +When installing over an existing version, you will be prompted before each +set of configuration files is installed. If you haven't made any Customisa- +tions to your existing configuration files, then you can safely answer "yes" +for each of these. If you have made customisations, you can try answering +"no". If you run into problems later, you may need to manually merge your +customisations into the the new version of the configuration files. The con- +figuration files can all be found in the Xetc.tgz tarball. See the section +below (section 4., page 1) about manual installation for information about +extracting them separately. + +After the configuration files have been dealt with, the other mandatory com- +ponents of the binary distribution will be installed. This should proceed +without any user intervention. + +If you downloaded any of the optional components, the installer will ask you +about each one before it is installed. The default answer is "yes". If +there are any that you've since decided that you don't want to install, +answer "no" when prompted. + +After that is done, the main part of the installation is complete. The next +steps are to tidy up some aspects of the installation. The first of these is +to run "ldconfig" on systems that require it, so that the newly installed +shared libraries are accessible. Then the fonts.dir files in some directo- +ries are updated so that the fonts can be accessed correctly. Next, the +installer checks to see if your system has a termcap file or terminfo files. +If it finds the former, it tells you how you may update the entries in that +file. If it finds the latter, it asks you if you want it to update them for +you. + +You may be asked if you want to create links for the GL libraries and header +files. The OpenGL standard on some platforms (Linux in particular) says that +these should be installed in the standard system locations (/usr/lib and +/usr/include), so the installer offers to create the appropriate links. If +you're running Linux, you should probably answer yes. For other platforms it +is your choice. If you already have another version of libGL in /usr/lib, +answering "yes" will remove it and replace it with a link to the version we +supply. The installer will show you a listing of any existing versions +before asking if they should be replaced. + +Finally, the installer asks you if you want a link created for the rstart +utility. On most modern systems the link isn't essential, so the default +answer is "no". Answer "yes" if you know that you need it. If you find +later that you need it, you can create it easily by running: + + rm -f /usr/bin/rstartd + ln -s /usr/X11R6/bin/rstartd /usr/bin/rstartd + 3.2 After the installation is complete The next step is to configure the X server. That is covered in detail in an as-yet unwritten document :-(. In the meantime, there are three ways to cre- -ate a basic X server configuration file for XFree86 4.0.3. One is to run the +ate a basic X server configuration file for XFree86 4.1.0. One is to run the xf86config utility. Another is to run the xf86cfg utility. The third option is to use the new -configure X server option: @@ -157,8 +260,113 @@ After the X server configuration is done, it may be advisable to reboot, especially if you run xdm (or equivalent) or the font server (xfs). + +4. Installing XFree86 4.1.0 manually + +This section describes how to manually install the XFree86 4.1.0 binary dis- +tributions. You should only use this method if you know what you're doing. +The information here covers some common cases, but not every possible case. + +Put all of the downloaded files into a single directory (choose some tempo- +rary location with enough space). Become the super user (root). All of the +following commands should be run as root, and they should be run from the +directory that has all of the downloaded files. The "extract" utility should +be used to unpack the tarballs. This is a customised version of GNU tar that +has the gzip code built-in, and which has a different usage when run under +the name "extract". One important thing that extract does that most versions +of tar do not do by default is that it unlinks existing files before writing +new ones. This is important when installing over an existing version of X. +If you choose to use some other utility to extract the tarballs, you're on +your own. + +4.1 A new installation + +The simplest case is when there is no existing X installation. The installa- +tion procedure for this case is as follows: + + chmod +x extract + mkdir /usr/X11R6 + mkdir /etc/X11 + ./extract -C /usr/X11R6 X[a-df-uw-z]*.tgz + ./extract -C /usr/X11R6 Xvfb.tgz # If you are installing Xvfb + ./extract -C /etc/X11 Xetc.tgz + ./extract -C /var Xvar.tgz + ln -s /etc/X11/app-defaults /usr/X11R6/lib/X11 + ln -s /etc/X11/fs /usr/X11R6/lib/X11 + ln -s /etc/X11/lbxproxy /usr/X11R6/lib/X11 + ln -s /etc/X11/proxymngr /usr/X11R6/lib/X11 + ln -s /etc/X11/rstart /usr/X11R6/lib/X11 + ln -s /etc/X11/twm /usr/X11R6/lib/X11 + ln -s /etc/X11/xdm /usr/X11R6/lib/X11 + ln -s /etc/X11/xinit /usr/X11R6/lib/X11 + ln -s /etc/X11/xsm /usr/X11R6/lib/X11 + ln -s /etc/X11/xserver /usr/X11R6/lib/X11 + chmod ug-w /usr/X11R6/lib # Make sure the permissions are OK + /sbin/ldconfig /usr/X11R6/lib # For Linux + /sbin/ldconfig -m /usr/X11R6/lib # For FreeBSD, NetBSD, OpenBSD + /usr/X11R6/bin/mkfontdir /usr/X11R6/lib/X11/fonts/misc + +4.2 Installing over an old installation + +If you have an existing installation of X, you should make a backup copy of +it before installing the new version over the top of it. + +Before doing anything else, make sure the extract command is executable, and +also link it to the name "gnu-tar" so that it can be used as a regular tar +command: + + chmod +x extract + rm -f gnu-tar + ln extract gnu-tar + +The first part of the procedure is to move the old run-time config files from +/usr/X11R6/lib/X11 to /etc/X11. Create /etc/X11 if it doesn't already exist. +For each of the following sub-directories (app-defaults, fs, lbxproxy, prox- +ymngr, rstart, twm, xdm, xinit, xsm, xserver) that you want to move, check +that there is a sub-directory of this name in /usr/X11R6/lib/X11. Create a +sub-directory of the same name under /etc/X11, then copy the files over by +running: + + ./gnu-tar -C /usr/X11R6/lib/X11/subdir -c -f - . | \ + ./gnu-tar -C /etc/X11/subdir -v -x -p -U -f - + +For each subdirectory that is moved, remove the one under /usr/X11R6/lib/X11 +and create a symbolic link to the new location: + + rm -fr /usr/X11R6/lib/X11/subdir + ln -s /etc/X11/subdir /usr/X11R6/lib/X11 + +For those subdirectories that didn't already exist under /usr/X11R6/lib/X11, +create one under /etc/X11 and create the symbolic link to it: + + mkdir /etc/X11/subdir + ln -s /etc/X11/subdir /usr/X11R6/lib/X11 + +Once that is done, extract the config files from the Xetc.tgz tarball into a +temporary directory: + + mkdir tmpdir + ./extract -C tmpdir Xetc.tgz + +and then copy each sub-directory over to the installed location: + + ./gnu-tar -C tmpdir/subdir -c -f - . | \ + ./gnu-tar -C /usr/X11R6/lib/X11/subdir -v -x -p -U -f - + +If you have customised any config files in your old installation, you may +want to omit those sub-directories, or copy selected files over by hand. + +Once that's done, the main part of the installation can be done: + + ./extract -C /usr/X11R6 `pwd`/X[a-df-uw-z]*.tgz + ./extract -C /usr/X11R6 Xvfb.tgz # If you are installing Xvfb + ./extract -C /var Xvar.tgz + chmod ug-w /usr/X11R6/lib # Make sure the permissions are OK + /sbin/ldconfig /usr/X11R6/lib # For Linux + /sbin/ldconfig -m /usr/X11R6/lib # For FreeBSD, NetBSD, OpenBSD + /usr/X11R6/bin/mkfontdir /usr/X11R6/lib/X11/fonts/misc - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.10.2.2 2001/03/14 18:23:45 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.11.2.2 2001/06/01 18:09:48 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.10.2.3 2001/03/16 14:57:21 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Install,v 1.11.2.1 2001/06/01 18:26:43 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/LICENSE diff -u xc/programs/Xserver/hw/xfree86/doc/LICENSE:1.11.2.2 xc/programs/Xserver/hw/xfree86/doc/LICENSE:1.12.2.1 --- xc/programs/Xserver/hw/xfree86/doc/LICENSE:1.11.2.2 Fri Mar 16 11:13:05 2001 +++ xc/programs/Xserver/hw/xfree86/doc/LICENSE Fri Jun 1 14:26:43 2001 @@ -592,7 +592,7 @@ or - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.7.2.1 2001/03/16 16:12:06 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.8 2001/03/16 22:13:19 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.11.2.2 2001/03/16 16:13:05 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/LICENSE,v 1.12.2.1 2001/06/01 18:26:43 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/OS2.Notes diff -u xc/programs/Xserver/hw/xfree86/doc/OS2.Notes:3.17.2.1 xc/programs/Xserver/hw/xfree86/doc/OS2.Notes:3.17.4.1 --- xc/programs/Xserver/hw/xfree86/doc/OS2.Notes:3.17.2.1 Tue Mar 13 12:19:27 2001 +++ xc/programs/Xserver/hw/xfree86/doc/OS2.Notes Fri Jun 1 14:26:43 2001 @@ -226,4 +226,4 @@ $XConsortium: OS2note.sgml /main/1 1996/02/24 10:08:59 kaleb $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/OS2.Notes,v 3.17.2.1 2001/03/13 17:19:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/OS2.Notes,v 3.17.4.1 2001/06/01 18:26:43 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README diff -u xc/programs/Xserver/hw/xfree86/doc/README:3.109.2.4 xc/programs/Xserver/hw/xfree86/doc/README:3.111.2.3 --- xc/programs/Xserver/hw/xfree86/doc/README:3.109.2.4 Fri Mar 16 11:01:13 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README Sat Jun 2 12:21:49 2001 @@ -1,8 +1,8 @@ - README for XFree86[tm] 4.0.3 + README for XFree86[tm] 4.1.0 The XFree86 Project, Inc - 2 March 2001 + 2 June 2001 Abstract @@ -10,16 +10,10 @@ supports several UNIX(R) and UNIX-like (such as Linux, the BSDs and Solaris x86) operating systems on Intel and other platforms. -1. What is XFree86 4.0.3? +1. What is XFree86 4.1.0? -XFree86 4.0.3 is the first update to 4.0.2, the third full release in the new -XFree86 4 series. +XFree86 4.1.0 is the fourth full release in the XFree86 4 series. -Update releases are taken from a stable/maintenance branch. They are -designed to be installed on top of the full release that they are updating. -They contain fixes for serious problems, most commonly fixes for security -issues, fixes for driver bugs, and fixes that improve stability. - XFree86 release 4 is a major re-design of the basic architectural underpin- nings of XFree86's implementation of the original X Consortium's X Server. This re-design allows for a modular interaction between the hardware drivers @@ -31,7 +25,8 @@ The road to XFree86 release 4 began as an architectural concept in mid 1997, with the serious framework being implemented in code the beginning of 1998. There were several snapshots on the road to 4.0 which are now part of the 4.0 -base release. +base release. The 4.1.0 version is an upgrade to 4.0.3, which include more +hardware ports, code enhancements and bug fixes. Release 4 also included the long-awaited integration of the DRI (Direct Ren- dering Infrastructure). This upgrade into the code base gives XFree86 the @@ -43,8 +38,6 @@ ware are available. Please check the Driver Status document first to see whether your hardware is supported before upgrading to the 4.x series. -Specific release enhancements can be viewed in the Release Notes. - The XFree86 version numbering system has had some changes as of the 4.0.2 release. Information about this can be found in the Versions Document. @@ -121,26 +114,50 @@ fix to . This will ensure that they are included in future releases. And thanks! You make this truly an Open group. -4. How to get XFree86 4.0.3 +4. How to get XFree86 4.1.0 -XFree86 4.0.3 can be found at the XFree86 ftp server -, and at mirrors of this +XFree86 4.1.0 can be found at the XFree86 ftp server +, and at mirrors of this server. Information about obtaining and installing binary distributions of this release can be found in the Installation Document. Information about obtaining the release in source form is given below. + +The source for version 4.1.0 is split into three tarballs: X410src-1.tgz, +X410src-2.tgz, X410src-3.tgz. The first contains everything except the fonts +and general X11 documentation. It is sufficient for building XFree86 if you +already have a set of fonts. The second contains the fonts and the source +for the general X11 documentation. The third contains the general X11 docu- +mentation in hardcopy format. + +A source patch relative to version 4.0.2 is also available. Because of its +size, it is split into four parts. The patch files are 4.0.2-4.1.0.diff1.gz, +4.0.2-4.1.0.diff2.gz, 4.0.2-4.1.0.diff3.gz and 4.0.2-4.1.0.diff4.gz. There +is also a tarball that contains some files that have components that can't be +included in a diff. It is 4.1.0.tgz. These patches should be applied to a +clean 4.0.2 source tree, working from the directory containing the xc/ direc- +tory. The patches should be applied by running: + + gzip -d < 4.0.2-4.1.0.diff1.gz | patch -p0 -E + gzip -d < 4.0.2-4.1.0.diff2.gz | patch -p0 -E + gzip -d < 4.0.2-4.1.0.diff3.gz | patch -p0 -E + gzip -d < 4.0.2-4.1.0.diff4.gz | patch -p0 -E + + rm -f xc/programs/xieperf/images/image.012 + rm -fr xc/fonts/bdf/latin2 + rm -fr xc/fonts/bdf/100dpi + rm -fr xc/fonts/bdf/75dpi + + gzip -d < 4.1.0.tgz | tar vxf - + +Patches might also be available relative to 4.0.3. If so, the instructions +for applying them are the same, except that you should start with a clean +4.0.3 source tree. -The source for version 4.0.3 is available as a patch relative to 4.0.2. The -patch file is 4.0.2-4.0.3.diff.gz. +The contrib part of the distribution was folded into the main source tree a +while ago, so a separate contrib tarball is not required. -The patch should be applied to a clean 4.0.2 source tree, working from the -directory containing the xc/ directory. The patch should be applied by run- -ning: - - gzip -d < 4.0.2-4.0.3.diff.gz | patch -p0 -E - -Information about getting the source for 4.0.2 can be found in the README -file for that version, which can be found on the XFree86 web site -. +To format the XFree86 documentation use the latest version of our doctools +package available as doctools-1.2.tgz. 5. Reporting Bugs @@ -151,7 +168,7 @@ system core dump. Do not edit the log file as our developers use it to reproduce and debug your problem. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.110.2.4 2001/03/16 15:57:44 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.113.2.3 2001/06/02 16:17:40 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.109.2.4 2001/03/16 16:01:13 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README,v 3.111.2.3 2001/06/02 16:21:49 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.DECtga diff -u xc/programs/Xserver/hw/xfree86/doc/README.DECtga:3.17.2.1 xc/programs/Xserver/hw/xfree86/doc/README.DECtga:3.17.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.DECtga:3.17.2.1 Tue Mar 13 12:19:27 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.DECtga Fri Jun 1 14:26:43 2001 @@ -6,7 +6,7 @@ 1. DEC 21030 - o The DEC 21030 is supported by XFree86 4.0.3. The driver is now par- + o The DEC 21030 is supported by XFree86 4.1.0. The driver is now par- tially accelerated. The built-in graphics on the Multia is supported in 8-plane mode, and PCI cards with 8 or 16 MB framebuffers are supported in 24-plane mode. TGA2 (aka PowerStorm 3D30/4D20) cards are not cur- @@ -65,4 +65,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DECtga.sgml,v 3.9 2000/03/06 22:59:23 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DECtga,v 3.17.2.1 2001/03/13 17:19:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DECtga,v 3.17.4.1 2001/06/01 18:26:43 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.DRI diff -u xc/programs/Xserver/hw/xfree86/doc/README.DRI:1.12.2.1 xc/programs/Xserver/hw/xfree86/doc/README.DRI:1.16.2.1 --- xc/programs/Xserver/hw/xfree86/doc/README.DRI:1.12.2.1 Tue Mar 13 12:19:27 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.DRI Fri Jun 1 14:26:43 2001 @@ -2,13 +2,13 @@ VA Linux Systems, Inc. Professional Services - Graphics. - 20 November 2000 + 3 May 2001 1. Preamble 1.1 Copyright -Copyright © 2000 by VA Linux Systems, Inc. All Rights Reserved. +Copyright © 2000-2001 by VA Linux Systems, Inc. All Rights Reserved. Permission is granted to make and distribute verbatim copies of this document provided the copyright notice and this permission notice are preserved on all @@ -24,8 +24,9 @@ Oxygen are either registered trademarks or trademarks of 3Dlabs Inc. Ltd. 3dfx, Voodoo3, Voodoo4, and Voodoo5 are registered trademarks of 3dfx Inter- active, Incorporated. Matrox is a registered trademark of Matrox Electronic -Systems Ltd. ATI Rage is a registered trademark of ATI Technologies, Inc. -All other trademarks mentioned are the property of their respective owners. +Systems Ltd. ATI Rage and Radeon are registered trademarks of ATI Technolo- +gies, Inc. All other trademarks mentioned are the property of their respec- +tive owners. 2. Introduction @@ -49,59 +50,37 @@ 3. Supported Architectures & Hardware - " +3.1 CPU Architectures -3.1 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. + +Intel's SSE (a.k.a. Katmai) instructions are used in optimized vertex trans- +formation functions in Mesa-based drivers. This requires a recent Linux ker- +nel both at compile and runtime. See the DRI Compile Guide for compile-time +requirements. At runtime a check is made to determine if the CPU can execute +SSE instructions. They're disabled otherwise. + +AMD's 3DNow! instructions are also used in optimized vertex transformation +functions in the Mesa-based DRI drivers. 3DNow! is supported in most ver- +sions of Linux. Like the SSE optimizations, a runtime check is made to +determine if the CPU can execute 3DNow! instructions. - " +Alpha-based systems can use Compaq's optimized math library for improved 3D +performance. See the DRI Compilation Guide for details. -The Architectures currently supported by the DRI have grown from the initial -Intel i386 based machines to now include, the Alpha Processor and the Sun -SPARC machines. - -The build environment for both of these new architectures have a pre-build -environment that will correctly build the DRI drivers and Mesa meaning no -extra configuration is necessary to build the DRI for these architectures. - -3.1.1 Alpha Features - - " - -On newer Alpha processors, it should be noted that a significant performance -increase can be seen with the addition of the -mcpu= command that should be -passed to GCC upon compilation. Dependent of the architecture of the proces- -sor, for example -mcpu=ev6 will build specifically for the EV6 based AXP's, -giving both byte and word alignment access to the DRI/Mesa drivers. - -Use this as an example of compiling with this extra speed. In your host.def -file that should reside in the xc/config directory, add the line. - -#define DefaultGcc2AxpOpt -O2 -mcpu=ev6 - -Additional speed improvements to 3D rendering can be achieved by installing -Compaq's Math Libraries (CPML) which can be obtained from the following URL. - -http://www.support.compaq.com/alpha-tools/software/index.html - -Once installed, you can set this option in your host.def to build against the -CPML libraries. - -#define UseCompaqMathLibrary YES - 3.2 Graphics Hardware - " - XFree86 4.0 (or later versions) includes 3D acceleration for the following graphics hardware: -NOTE: This is a complete list of graphics hardware supported. It may not be -supported on your platform. + o 3dfx, supported on Intel x86, AMD and Alpha: - o 3dfx: - o Voodoo5 5500 + o Voodoo4 4500 + o Voodoo3 3500 TV o Voodoo3 3000 AGP @@ -119,42 +98,53 @@ There are many configurations of 3dfx cards on the market. Not all have been tested. - o Matrox: + o Matrox, supported on Intel x86 and AMD: o Matrox G200 o Matrox G400 - o Intel i810 + o Intel i810 (motherboard chipset) o i810 o i810-dc100 o i810e + + o ATI Rage 128, supported on Intel x86 and AMD: - o ATI Rage 128 + o Rage Fury - o Rage Fury AGP + o Rage Magnum - o Rage Magnum AGP + o XPERT 2000 - o XPERT 2000 AGP + o XPERT 128 - o XPERT 128 AGP + o XPERT 99 - o XPERT 99 AGP + o All-in-Wonder 128 - o All-in-Wonder 128 AGP + Note that both PCI and AGP versions of Rage 128 based cards are sup- + ported at this time. - The PCI versions of these cards also have minimal support. Note that - there are also Rage 128 Pro based boards on the market, and these are - not yet supported. + o ATI Radeon, supported on Intel x86 and AMD: - o 3Dlabs Oxygen GMX 2000 (MX/Gamma based) + o Radeon SDR AGP -Support for other hardware is underway. + o Radeon DDR AGP + o 3Dlabs, supported on Intel x86 and AMD: + + o Oxygen GMX 2000 (MX/Gamma based). Note: this driver is no longer + being actively developed. + +Support for other hardware is underway. Most of the DRI development work is +funded by contracts with IHVs. These contracts often prevent us from +announcing drivers before they're released. Queries about upcoming drivers +may not be answerable. + 4. Prerequisite Software o The DRI is available in XFree86 4.0 and later. @@ -167,8 +157,6 @@ 5. Kernel Modules - " - 3D hardware acceleration requires a DRI kernel module that's specific to your graphics hardware. @@ -195,8 +183,6 @@ 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. @@ -210,10 +196,13 @@ Load "dri" EndSection -Next, the DRI section can be used to restrict access to direct rendering. +Next, the DRI section can be used to restrict access to direct rendering. A +client can only use direct rendering if it has permission to open the +/dev/dri/card? file(s). The permissions on these DRI device files is con- +trolled by the "DRI" section in the XF86Config file. If you want all of the users on your system to be able to use direct-render- -ing, then use a simple DRI section: +ing, then use a simple DRI section like this: Section "DRI" Mode 0666 @@ -342,15 +331,15 @@ OpenGL vendor, renderer, and version lines. Among the output you should see something like this: - OpenGL vendor string: Precision Insight, Inc. + OpenGL vendor string: VA Linux Systems, Inc. OpenGL renderer string: Mesa DRI Voodoo3 20000224 - OpenGL version string: 1.2 Mesa 3.3 beta + OpenGL version string: 1.2 Mesa 3.4 or this: - OpenGL vendor string: Precision Insight, Inc. + OpenGL vendor string: VA Linux Systems, Inc. OpenGL renderer string: Mesa GLX Indirect - OpenGL version string: 1.2 Mesa 3.3 beta + OpenGL version string: 1.2 Mesa 3.4 The first example indicates that the 3dfx driver is using Voodoo3 hardware. The second example indicates that no hardware driver was found and indirect, @@ -398,9 +387,59 @@ This section contains information to help you diagnose general problems. See below for additional information for specific hardware. + +9.1 Bus Mastering + +DMA-based DRI drivers (that's most DRI drivers) cannot function unless bus +mastering is enabled for your graphics card. By default, some systems don't +having bus mastering on. You should enable it in your BIOS. + +Alternately, you can check the status of bus mastering and change the setting +from within Linux. There may be similar procedures for other operating sys- +tems. + +Run lspci (as root) and find the information describing your graphics +adapter. For example: + + 00:00.0 Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 03) + 00:01.0 PCI bridge: Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 03) + 00:07.0 ISA bridge: Intel Corporation 82371AB PIIX4 ISA (rev 02) + 00:07.1 IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01) + 00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01) + 00:07.3 Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 02) + 00:11.0 Ethernet controller: Intel Corporation 82557 [Ethernet Pro 100] (rev 08) + 00:12.0 SCSI storage controller: Symbios Logic Inc. (formerly NCR) 53c895 (rev 02) + 00:14.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 08) + 01:00.0 VGA compatible controller: 3Dfx Interactive, Inc.: Unknown device 0009 (rev 01) + +The bus, device, and function number comprise the device id, which is conven- +tionally written in the form bus:dev.func, or in this case 01:00.0. + +Use the setpci command to examine bit two of register 4 for your graphics +card. This will indicate whether or not bus mastering is enabled. + + setpci -s 01:00.0 4.w + +A 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. + +The following shell script will enabled bus mastering for your graphics card +and host bridge. Run it as root. + + #!/bin/bash + dev=01:00.0 # change as appropriate + echo Enabling bus mastering on device $dev + setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4))) + dev=00:00.0 + echo Enabling bus mastering on host bridge $dev + setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4))) -9.1 The X Server +You can check if this worked by running the first setpci command again. +9.2 The X Server + 1. Before you start the X server, verify the appropriate 3D kernel module is installed. Type lsmod and look for the appropriate kernel module. For 3dfx hardware you should see tdfx, for example. @@ -453,7 +492,7 @@ SGI-GLX XFree86-DRI -9.2 Linking, running and verifying 3D acceleration +9.3 Linking, running and verifying 3D acceleration After you've verified that the X server and DRI have started correctly it's time to verify that the GL library and hardware drivers are working cor- @@ -521,25 +560,35 @@ This section presents hardware-specific information for normal use and trou- bleshooting. -10.1 3dfx Voodoo3 Series +10.1 3dfx Banshee, Voodoo3, Voodoo4 and Voodoo5 Series -10.1.1 Dependencies +10.1.1 Requirements -The Voodoo3 DRI driver requires a special versions of the 3dfx Glide library. -It can be downloaded from the DRI website. +The 3dfx DRI driver requires special versions of the 3dfx Glide library. +Different versions of Glide are needed for Banshee/Voodoo3 than for +Voodoo4/5. The Glide libraries can be downloaded from the DRI website. 10.1.2 Configuration -Your XF86Config file's device section must specify the tdfx device: +Your XF86Config file's device section must specify the tdfx device. For +example: Section "Device" Identifier "Voodoo3" VendorName "3dfx" Driver "tdfx" EndSection + +Or, -The Screen section should then reference the Voodoo3 device: + Section "Device" + Identifier "Voodoo5" + VendorName "3dfx" + Driver "tdfx" + EndSection +The Screen section should then reference the Voodoo device: + Section "Screen" Identifier "Screen 1" Device "Voodoo3" @@ -552,13 +601,39 @@ EndSubsection EndSection -The kernel module for the Voodoo3 is named tdfx.o and should be installed in -/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded -by the Xserver if needed. +Or, + + Section "Screen" + Identifier "Screen 1" + Device "Voodoo5" + Monitor "High Res Monitor" + DefaultDepth 24 + Subsection "Display" + Depth 16 + Modes "1280x1024" "1024x768" "800x600" "640x480" + ViewPort 0 0 + EndSubsection + Subsection "Display" + Depth 24 + Modes "1280x1024" "1024x768" "800x600" "640x480" + ViewPort 0 0 + EndSubsection + EndSection + +The kernel module for 3dfx hardware is named tdfx.o and should be installed +in /lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically +loaded by the Xserver if needed. -The DRI 3D driver for the Voodoo3 should be in /usr/X11R6/lib/mod- +The DRI 3D driver for 3dfx hardware should be in /usr/X11R6/lib/mod- ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so. +The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. When running in +32bpp mode an 8-bit stencil buffer and 24-bit Z (depth) buffer are offered. +When running in 16bpp mode only a 16-bit Z (depth) buffer is offered and +stencil is implemented in software. + +A software-based accumulation buffer is available in both 16 and 32bpp modes. + 10.1.3 Troubleshooting o If you try to run an OpenGL application and see an error message similar @@ -569,21 +644,33 @@ it means that you have the wrong version of the Glide library for your hardware. - o 3D acceleration for Voodoo3 is only supported in the 16 bit/pixel screen - mode. Use xdpyinfo to verify that all your visuals are depth 16. Edit - your XF86Config file if needed. + o 3D acceleration for Banshee and Voodoo3 is only supported in the 16 + bit/pixel screen mode. Use xdpyinfo to verify that all your visuals are + depth 16. Edit your XF86Config file if needed. o The /dev/3dfx device is not used for DRI; it's only for Glide on older 3dfx hardware. -10.1.4 Performance + o Different versions of Glide are needed for Voodoo3 and Voodoo5. See the + DRI website's resources page to download the right version of Glide. + + o Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default) but 3D + acceleration is not supported in that mode. 32bpp mode is fully 3D + accelerated. + +10.1.4 Performance and Features o Normally, buffer swapping in double-buffered applications is synchro- nized to your monitor's refresh rate. This may be overridden by setting - the FX_GLIDE_SWAPINTERNVAL environment variable. The value of this - variable indicates the maximum number of swap buffer commands can be + the FX_GLIDE_SWAPINTERVAL environment variable. The value of this vari- + able indicates the maximum number of swap buffer commands can be buffered. Zero allows maximum frame rate. + o On Voodoo4/5, rendering with 16-bits/texel textures is faster than using + 32-bit per texel textures. The internalFormat parameter to glTexImage2D + can be used to control texel size. Quake3 and other games let you con- + trol this as well. + o The glTexEnv mode GL_BLEND is not directly supported by the Voodoo3 hardware. It can be accomplished with a multipass algorithm but it's not implemented at this time. Applications which use that mode, such as @@ -622,125 +709,50 @@ o Using glColorMask(r, g, b, a) when r!=g or g!=b. -10.1.5 Known Problems - - o The Glide library cannot be used directly; it's only meant to be used - via the tdfx DRI driver. - - o SSystem has problems because of poorly set near and far clipping planes. - The office.unc Performer model also suffers from this problem. - - o The lowest mipmap level is sometimes miscolored in trilinear- sampled - polygons. - -10.2 3dfx Voodoo5 Series - -10.2.1 Dependencies - -The Voodoo5 DRI driver requires a special versions of the 3dfx Glide library, -different than that used for Voodoo3 hardware. It can be downloaded from the -DRI website. - -10.2.2 Configuration - -Your XF86Config file's device section must specify the tdfx device: - - Section "Device" - Identifier "Voodoo5" - VendorName "3dfx" - Driver "tdfx" - EndSection - -The Screen section should then reference the Voodoo3 device: - - Section "Screen" - Identifier "Screen 1" - Device "Voodoo5" - Monitor "High Res Monitor" - DefaultDepth 24 - Subsection "Display" - Depth 16 - Modes "1280x1024" "1024x768" "800x600" "640x480" - ViewPort 0 0 - EndSubsection - Subsection "Display" - Depth 24 - Modes "1280x1024" "1024x768" "800x600" "640x480" - ViewPort 0 0 - EndSubsection - EndSection - -The kernel module for the Voodoo5 is named tdfx.o and should be installed in -/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded -by the Xserver if needed. - -The DRI 3D driver for the Voodoo5 should be in /usr/X11R6/lib/mod- -ules/dri/tdfx_dri.so. This will be automatically loaded by libGL.so. - -The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. When running in -32bpp mode an 8-bit stencil buffer and 24-bit Z (depth) buffer are offered. -When running in 16bpp mode only a 16-bit Z (depth) buffer is offered and -stencil is implemented in software. - -A software-based accumulation buffer is available in both 16 and 32bpp modes. - -10.2.3 Troubleshooting - - o The /dev/3dfx device is not used for DRI; it's only for Glide on older - 3dfx hardware. - - o Different versions of Glide are needed for Voodoo3 and Voodoo5. See the - DRI website's resources page to download the right version of Glide. - -10.2.4 Performance - - o Normally, buffer swapping in double-buffered applications is synchro- - nized to your monitor's refresh rate. This may be overridden by setting - the FX_GLIDE_SWAPINTERNVAL environment variable. The value of this - variable indicates the maximum number of swap buffer commands can be - buffered. Zero allows maximum frame rate. - - o Rendering with 16-bit per texel textures is faster than using 32-bit per - texel textures. The internalFormat parameter to glTexImage2D can be - used to control texel size. - o The Voodoo5 driver reverts to software rendering under the same condi- tions Voodoo3 with three exceptions. First, stencil operations are implemented in hardware when the screen is configured for 32 bits/pixel. Second, the GL_BLEND texture env mode is fully supported in hardware. Third, glColorMask is fully supported in hardware when the screen is configured for 32 bits/pixel. - -10.2.5 Known Problems - o The Glide library cannot be used directly; it's only meant to be used - via the tdfx DRI driver. - - o 24bpp screen modes are supported by the hardware but not by the current - driver. 32bpp is fully supported. - - o As of October, 2000 the second VSA-100 chip on the Voodoo5 is not yet + o As of January, 2001 the second VSA-100 chip on the Voodoo5 is not yet operational. Therefore, the board isn't being used to its full capac- ity. The second VSA-100 chip will allow Scan-Line Interleave (SLI) mode for full-screen applications and games, potentially doubling the sys- - tem's fill rate. + tem's fill rate. When the second VSA-100 chip is activated glGet- + String(GL_RENDERER) will report Voodoo5 instead of Voodoo4. -10.3 Intel i810 + o The lowest mipmap level is sometimes miscolored in trilinear- sampled + polygons. - " + o The GL_EXT_texture_env_combine extension is supported on the Voodoo4 and + Voodoo5. -10.3.1 Dependencies +10.1.5 Known Problems - " + o The lowest mipmap level is sometimes miscolored in trilinear- sampled + polygons (Voodoo3/Banshee). -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. + o Fog doesn't work with orthographic projections. -10.3.2 Configuration + o The accuracy of blending operations on Voodoo4/5 isn't always very good. + If you run Glean, you'll find some test failures. - " + o The Glide library cannot be used directly; it's only meant to be used + via the tdfx DRI driver. + o SSystem has problems because of poorly set near and far clipping planes. + The office.unc Performer model also suffers from this problem. + +10.2 Intel i810 + +10.2.1 Requirements + +A kernel with AGP GART support (such as Linux 2.4.x) is needed. + +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. @@ -748,6 +760,7 @@ Identifier "i810" VendorName "Intel" Driver "i810" + Option "AGPMode" "1" VideoRam 10000 EndSection @@ -772,7 +785,7 @@ The DRI 3D driver for the i810 should be in /usr/X11R6/lib/mod- ules/dri/i810_dri.so. This will be automatically loaded by libGL.so. -10.3.3 Troubleshooting +10.2.3 Troubleshooting o 3D acceleration for the i810 is only available in the 16 bit/pixel screen mode at this time. 32bpp acceleration is not supported by this @@ -787,27 +800,41 @@ too little memory is available for DMA buffers, back and depth buffers and textures, direct rendering will be disabled. -10.4 Matrox G200 and G400 +10.2.4 Performance and Features - " +Basically all of the i810 features which can be exposed through OpenGL 1.2 +are implemented. However, the following OpenGL features are implemented in +software and will be slow: -10.4.1 Dependencies + o Stencil buffer and accumulation buffer operations - " + o Blend subtract, min/max and logic op blend modes -A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is -needed. + o glColorMask when any mask is set to false -10.4.2 Configuration + o GL_SEPARATE_SPECULAR_COLOR lighting mode + + o glDrawBuffer(GL_FRONT_AND_BACK) + + o Using 1D or 3D textures + + o Using texture borders + +10.3 Matrox G200 and G400 + +10.3.1 Requirements - " +A kernel with AGP GART support (such as Linux 2.4.x) is needed. +10.3.2 Configuration + Your XF86Config file's device section must specify the mga device: Section "Device" Identifier "MGA" VendorName "Matrox" Driver "mga" + Option "AGPMode" "1" VideoRam 32768 EndSection @@ -847,7 +874,7 @@ The DRI 3D driver for the G200/G400 should be in /usr/X11R6/lib/mod- ules/dri/mga_dri.so. This will be automatically loaded by libGL.so. -10.4.3 Performance +10.3.3 Performance and Features Software rendering will be used under any of the following conditions: @@ -861,10 +888,34 @@ o Using 1D or 3D textures. + o Using texture borders. + + o Using glDepthFunc(GL_NEVER). + o Using the accumulation buffer. -10.4.4 IRQ Assignment +The AGP mode may be set to 1, 2, or 4. One is used by default. Higher AGP +speeds may result in unreliable performance depending on your motherboard. +Compaq has funded the implementation of AGP accelerated 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 when the DRI is enabled (to the point of being unusable.) This is caused by the graphics card not having an interrupt assigned to it. The current DRI @@ -875,7 +926,7 @@ Please consult your system BIOS manual for instructions on how to enable an interrupt for your graphics card. -10.4.5 MGA HAL lib +10.3.5 MGA HAL lib MGAHALlib.a is a binary library Matrox has provided for use under Linux to expose functionality for which they can not provide documentation. (For @@ -900,31 +951,26 @@ configure XFree86 4.x Multihead. It should be noted that currently the sec- ond head does not support direct rendering. -10.4.6 Known Problems +10.3.6 Known Problems None. - -10.5 ATI Rage 128 - " +10.4 ATI Rage 128 -10.5.1 Dependencies +10.4.1 Requirements - " +A kernel with AGP GART support (such as Linux 2.4.x) is needed. -A Linux kernel with AGP GART support (such as the 2.4.x test kernels) is -needed. - -10.5.2 Configuration - - " +10.4.2 Configuration -Your XF86Config file's device section must specify the r128 device: +Your XF86Config file's device section must specify the ati device: Section "Device" Identifier "Rage128" VendorName "ATI" - Driver "r128" + Driver "ati" + Option "AGPMode" "1" + Option "UseCCEFor2D" "false" EndSection The Screen section should then reference the Rage 128 device: @@ -955,15 +1001,123 @@ You may also set your screen depth to 32 for 32bpp mode. -10.5.3 Performance +10.4.3 Performance and Features While PCI Rage 128 based cards are supported, they do not yet support PCI GART, so they will not perform as well as their AGP counterparts. +For AGP cards, the AGP mode may be set to 1, 2, or 4. One is used by +default. Higher AGP speeds may result in unreliable performance depending on +your motherboard. + +Note that even at 32bpp there is no alpha channel. + +The following OpenGL features are implemented in software and will be slow: + + o Stencil buffer and accumulation buffer operations + + o Blend subtract, min/max and logic op blend modes + + o GL_SEPARATE_SPECULAR_COLOR lighting mode + + o glDrawBuffer(GL_FRONT_AND_BACK) + + o Using 1D or 3D textures + + o Using texture borders + +10.4.4 Known Problems + +If you experience stability problems you may try setting the UseCCEFor2D +option to true. This will effectively disable 2D hardware acceleration. +Performance will be degraded, of course. + +10.5 ATI Radeon + +10.5.1 Requirements + +A kernel with AGP GART support (such as Linux 2.4.x) is needed. + +10.5.2 Configuration + +Your XF86Config file's device section must specify the ati device: + + Section "Device" + Identifier "Radeon" + VendorName "ATI" + Driver "ati" + Option "AGPMode" "1" + EndSection + +The Screen section should then reference the Radeon device: + + Section "Screen" + Identifier "Screen 1" + Device "Radeon" + Monitor "High Res Monitor" + DefaultDepth 16 + Subsection "Display" + Depth 16 + Modes "1280x1024" "1024x768" "800x600" "640x480" + ViewPort 0 0 + EndSubsection + Subsection "Display" + Depth 32 + Modes "1280x1024" "1024x768" "800x600" "640x480" + ViewPort 0 0 + EndSubsection + EndSection + +The kernel module for the Radeon is named radeon.o and should be installed in +/lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded +by the Xserver if needed. + +The DRI 3D driver for the Radeon should be in /usr/X11R6/lib/mod- +ules/dri/radeon_dri.so. This will be automatically loaded by libGL.so. + +You may also set your screen depth to 32 for 32bpp mode. + +10.5.3 Performance and Features + +While this driver supports many of the features of ATI Radeon cards, we do +not yet fully support the card's TCL features. This work is progressing, but +is not yet ready. + +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. + +The following OpenGL features are implemented in software and will be slow: + + o Blend subtract, blend min/max and blend logicops + + o Stencil and accumulation operations + + o 1D and 3D textures + + o Texture borders + +The GL_EXT_texture_env_combine, GL_EXT_texture_env_add and GL_EXT_tex- +ture_env_dot3 extensions are supported (or will be soon supported in the new +driver based on Mesa 3.5). + +We hope to implement support for the following features in the future: + + o Vertex transformation, clipping and lighting (TCL) + + o Hardware stencil buffer + + o Cube map textures + + o 3D textures + + o Three texture units + 10.5.4 Known Problems -DGA is not yet supported in the ATI Rage 128 X server. This feature will be -added in a future release. +Certain (early?) revisions of the AMD Irongate chipset have AGPGART problems +which effect Radeon, and other graphics cards. The card may work unreliably, +or not work at all. If the DRM kernel module is not loaded, the 2D Xserver +may work. There's hope that this can be fixed in the future. 10.6 3DLabs Oxygen GMX 2000 @@ -977,8 +1131,8 @@ The following OpenGL features are not supported at this time: overlays, stereo, hardware-accelerated indirect rendering. -OpenGL-like functionality is provided with the Mesa library. XFree86 4.0.1 -uses Mesa 3.3. Subsequent releases of XFree86 will use newer versions of +OpenGL-like functionality is provided with the Mesa library. XFree86 4.1.0 +uses Mesa 3.4.2. Subsequent releases of XFree86 will use newer versions of Mesa. When newer versions of Mesa are available, the 3D drivers can be updated without reinstalling XFree86 or libGL.so. @@ -1052,8 +1206,7 @@ 12.1 Software A collection of useful configuration files, libraries, headers, utilities and -demo programs is available from http://dri.source- -forge.net/resources/resources.html +demo programs is available from http://dri.sourceforge.net/res.phtml 12.2 Documentation @@ -1078,7 +1231,7 @@ 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.15 2000/12/12 18:54:29 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.24 2001/05/19 00:42:22 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.12.2.1 2001/03/13 17:19:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRI,v 1.16.2.1 2001/06/01 18:26:43 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp diff -u xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp:3.6.2.1 xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp:3.10.2.1 --- xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp:3.6.2.1 Tue Mar 13 12:19:27 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp Fri Jun 1 14:26:43 2001 @@ -2,13 +2,13 @@ VA Linux Systems, Inc. Professional Services - Graphics. - 29 October 2000 + 21 April 2001 1. Preamble 1.1 Copyright -Copyright © 2000 by VA Linux Systems, Inc. All Rights Reserved. +Copyright © 2000-2001 by VA Linux Systems, Inc. All Rights Reserved. Permission is granted to make and distribute verbatim copies of this document provided the copyright notice and this permission notice are preserved on all @@ -24,12 +24,14 @@ Oxygen are either registered trademarks or trademarks of 3Dlabs Inc. Ltd. 3dfx, Voodoo3, Voodoo4, and Voodoo5 are registered trademarks of 3dfx Inter- active, Incorporated. Matrox is a registered trademark of Matrox Electronic -Systems Ltd. ATI Rage is a registered trademark of ATI Technologies, Inc. -All other trademarks mentioned are the property of their respective owners. +Systems Ltd. ATI Rage and Radeon is a registered trademark of ATI Technolo- +gies, Inc. All other trademarks mentioned are the property of their respec- +tive owners. 2. Introduction This document describes how to download, compile and install the DRI project. +The DRI provides 3D graphics hardware acceleration for the XFree86 project. This information is intended for experienced Linux developers. Beginners are probably better off installing precompiled packages. @@ -40,12 +42,9 @@ You'll need the following: - o At least 400MB of free disk space. More is needed if you want to build - with debugging information or keep several build trees. + o At least 200MB of free disk space. If you compile for debugging (the -g + option) then you'll need about 600MB. - o A fast system. Using a PIII-550 it takes about 1/2 hour to build every- - thing. - o GCC compiler and related tools. o ssh (secure shell) for registered developer downloading of the DRI @@ -55,9 +54,12 @@ o FreeBSD support is not currently being maintained and may not work. +The DRI 3D drivers generally work on systems with Intel or AMD CPUs. How- +ever, there is limited support for Alpha and PowerPC support is underway. + For 3dfx Voodoo3 hardware, you'll also need: - o Glide3x headers and runtime library if you want to use the 3dfx driver. + o Glide3 headers and runtime library if you want to use the 3dfx driver. These can be obtained from linux.3dfx.com. o A recent Linux 2.4.x kernel. AGP support is not required. @@ -70,20 +72,24 @@ o A recent Linux 2.4.x kernel with AGP support. -For ATI Rage hardware, you'll also need: +For ATI Rage 128 and Radeon hardware, you'll also need: o A recent Linux 2.4.x kernel with AGP support. 4. Linux Kernel Preparation The DRI project closely tracks Linux kernel development. Since the internal -Linux data structures change frequently in the 2.4 development branch it's -important to have use the most recent Linux kernel. As of this writing (Nov -2000), 2.4.0-test11-pre5 is the most recent version of Linux which the DRI is -synchronized to. +Linux data structures might change in the 2.4 Linux kernel, it's important to +use the most recent Linux kernel and not an old, intermediate development +release. As of this writing (Jan 2001), 2.4.0 is the most recent version of +Linux which the DRI is synchronized to. Most of the DRI drivers require AGP support and using Intel Pentium III SSE -optimizations also requires an up-to-date Linux kernel. +optimizations also requires an up-to-date Linux kernel. Configuring your +kernel correctly is very important, as features such as SSE optimizations +will be disabled if your kernel does not support them. Thus, if you have a +Pentium III processor, you must configure your kernel for the Pentium III +processor family. Building a new Linux kernel can be difficult for beginners but there are resources on the Internet to help. This document assumes experience with @@ -102,6 +108,17 @@ ln -s linux-2.4.x linux bzcat linux-2.4.x.tar.bz2 | tar xf - + It is critical that /usr/src/linux point to your new kernel sources, + otherwise the kernel headers will not be used when building the DRI. + This will almost certainly cause compilation problems. + + o Read /usr/src/linux/Documentation/Changes. This file lists the minimum + requirements for all software packages required to build the kernel. + You must upgrade at least gcc, make, binutils and modutils to at least + the versions specified in this file. The other packages may not be + needed. If you are upgrading from Linux 2.2.x you must upgrade your + modutils package for Linux 2.4.x. + o Configure your kernel. You might, for example, use make menuconfig and do the following: @@ -111,10 +128,17 @@ o hit ESC to return to the top-level menu + o Go to Processor type and features + + o Select your processor type from Processor Family + + o hit ESC to return to the top-level menu + o Go to Character devices o Disable Direct Rendering Manager (XFree86 DRI support) since we'll - use the DRI module from the XFree86/DRI tree. + use the DRI code from the XFree86/DRI tree and will compile it + there. o Go to /dev/agpgart (AGP Support) (EXPERIMENTAL) (NEW) @@ -153,13 +177,54 @@ Note that last make command will automatically run lilo for you. - o Upgrade your modutils package for Linux 2.4.x if you're upgrading from - Linux 2.2.x. - o Now reboot to use the new kernel. + +5. CPU Architectures + +In general, nothing special has to be done to use the DRI on different CPU +architectures. There are, however, a few optimizations that are CPU-depen- +dent. Mesa will determine at runtime which CPU-dependent optimizations +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- +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. Downloading the XFree86/DRI CVS Sources +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- +cally for the EV6 based AXP's, giving both byte and word alignment access to +the DRI/Mesa drivers. + +To enable this optimization edit your xc/config/host.def file and add the +line: + +#define DefaultGcc2AxpOpt -O2 -mcpu=ev6 + +Additional speed improvements to 3D rendering can be achieved by installing +Compaq's Math Libraries (CPML) which can be obtained from http://www.sup- +port.compaq.com/alpha-tools/software/index.html + +Once installed, you can add this line to your host.def to build with the CPML +libraries: + +#define UseCompaqMathLibrary YES + +The host.def file is explained below. + +6. Downloading the XFree86/DRI CVS Sources + The DRI project is hosted by VA Linux Systems' SourceForge. The DRI source code, which is a subset of the XFree86 source tree, is kept in a CVS reposi- tory there. @@ -169,7 +234,7 @@ user so that you may submit non-anonymous bug reports and can participate in the mailing lists. -5.1 Anonymous CVS download: +6.1 Anonymous CVS download: 1. Create a directory to store the CVS files: @@ -189,7 +254,7 @@ The -z3 flag causes compression to be used in order to reduce the down- load time. -5.2 Registered CVS download: +6.2 Registered CVS download: 1. Create a directory to store the CVS files: @@ -215,7 +280,7 @@ The -z3 flag causes compression to be used in order to reduce the down- load time. -5.3 Updating your CVS sources +6.3 Updating your CVS sources In the future you'll want to occasionally update your local copy of the DRI source code to get the latest changes. This can be done with: @@ -226,7 +291,7 @@ The -d flag causes any new subdirectories to be created and -A causes most recent trunk sources to be fetched, not branch sources. -6. Mesa +7. Mesa Most of the DRI 3D drivers are based on Mesa (the free implementation of the OpenGL API). The relevant files from Mesa are already included in the @@ -239,9 +304,9 @@ not generally recommended. The DRI developers will upgrade Mesa when appro- priate. -7. Compiling the XFree86/DRI tree +8. Compiling the XFree86/DRI tree -7.1 Make a build tree +8.1 Make a build tree Rather than placing object files and library files right in the source tree, they're instead put into a parallel build tree. The build tree is made with @@ -259,7 +324,7 @@ Advanced users may have several build trees for compiling and testing with different options. -7.2 Edit the host.def file +8.2 Edit the host.def file The ~/DRI-CVS/build/xc/config/cf/host.def file is used to configure the XFree86 build process. You can change it to customize your build options or @@ -272,7 +337,7 @@ (Alpha) #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 (or similar) #define LibraryCDebugFlags -O2 #define BuildServersOnly YES - #define XF86CardDrivers vga tdfx mga r128 i810 + #define XF86CardDrivers vga tdfx mga ati i810 #define LinuxDistribution LinuxRedHat #define DefaultCCOptions -ansi GccWarningOptions -pipe #define BuildXF86DRI YES @@ -281,6 +346,7 @@ /* #define GlxBuiltInTdfx YES */ /* #define GlxBuiltInMga YES */ /* #define GlxBuiltInR128 YES */ + /* #define GlxBuiltInRadeon YES */ /* #define DoLoadableServer NO */ #define SharedLibFont NO @@ -294,12 +360,27 @@ If you have 3dfx hardware be sure that the Glide 3x headers are installed in /usr/include/glide3/ and that the Glide 3x library is installed at -/usr/lib/libglide3x.so. +/usr/lib/libglide3.so. If you do not have 3dfx hardware comment out the HasGlide3 line in host.def. + +If you want to enable 3DNow! optimizations in Mesa and the DRI drivers, you +should add the following: + + #define MesaUse3DNow YES -7.3 Compilation +If you want to enable SSE optimizations in Mesa and the DRI drivers, you must +upgrade to a Linux 2.4.x kernel. Mesa will verify that SSE is supported by +both your processor and your operating system, but to build Mesa inside the +DRI you need to have the Linux 2.4.x kernel headers in /usr/src/linux. If +you enable SSE optimizations with an earlier version of the Linux kernel in +/usr/src/linux, Mesa will not compile. You have been warned. If you do have +a 2.4.x kernel, you should add the following: + #define MesaUseKatmai YES + +8.3 Compilation + To compile the complete DRI tree: cd ~/DRI-CVS/build/xc/ @@ -320,7 +401,7 @@ WARNING: do not use the -j option with make. It's reported that it does not work with XFree86/DRI. -7.4 Check for compilation errors +8.4 Check for compilation errors Using your text editor, examine World.LOG for errors by searching for the pattern ***. @@ -331,8 +412,8 @@ ls For the 3dfx Voodoo, you should see tdfx.o. For the Matrox G200/G400, you -should see mga.o. For the ATI Rage 128, you should see r128.o. For the -Intel i810, you should see i810.o. +should see mga.o. For the ATI Rage 128, you should see r128.o. For the ATI +Radeon, you should see radeon.o. For the Intel i810, you should see i810.o. If the DRI kernel module(s) failed to build you should verify that you're using the right version of the Linux kernel. The most recent kernels are not @@ -344,7 +425,7 @@ path to your kernel source is /usr/src/linux-2.4.x, cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel - make TREE=/usr/src/linux-2.4 + make TREE=/usr/src/linux-2.4.x/include or alternatively, edit Makefile to include this change. @@ -352,19 +433,22 @@ parts of the source tree but it's important that the whole tree will build first. -7.5 DRI kernel module installation +8.5 DRI kernel module installation The DRI kernel modules are in ~/DRI-CVS/build/xc/pro- grams/Xserver/hw/xfree86/os-support/linux/drm/kernel/. -To load the appropriate DRI module in your running kernel you can either use +To load the appropriate DRM module in your running kernel you can either use ismod and restart your X server or copy the kernel module to /lib/mod- -ules/2.4.x/kernel/driver/char/drm/ then run depmod and restart your X server. +ules/2.4.x/kernel/drivers/char/drm/ then run depmod and restart your X +server. Make sure you first unload any older DRI kernel modules that might be already loaded. + +Note that some DRM modules require that the agpgart module be loaded first. -8. Normal Installation and Configuration +9. Normal Installation and Configuration Most users will want to install the new X server and use it instead of the original X server. This section explains how to do that. We assume that the @@ -374,7 +458,7 @@ actually installing it as their default server. If you want to do that, skip to the next section. -8.1 X Installation +9.1 X Installation You'll need to run as root to do the following commands: @@ -388,7 +472,7 @@ cd ~/DRI-CVS/build/xc make install -8.2 Linker configuration +9.2 Linker configuration Edit your /etc/ld.so.conf file and put /usr/X11R6-DRI/lib as the first line. Then run: @@ -397,7 +481,7 @@ This will ensure that you use the new X libraries when you run X programs. -8.3 Update Locale Information +9.3 Update Locale Information To update your X locale information do the following: @@ -409,7 +493,7 @@ This will prevent a locale error message from being printed when you run Xlib programs. -8.4 Setup Miscellaneous Files +9.4 Setup Miscellaneous Files Issue the following commands: @@ -421,7 +505,7 @@ This will allow applications to use the fonts and resources that they used in the past. -8.5 Disable the Old X Server and Enable the New One +9.5 Disable the Old X Server and Enable the New One Assuming that an installation of XFree86 3.3.x is present, we need to disable the old 3.3.x X server and enable the new 4.0.x X server. @@ -435,7 +519,7 @@ This will cause the new X server to be used instead of the original one. -8.6 Create the XF86Config File +9.6 Create the XF86Config File Configuration files for XFree86 3.3.x will not work with XFree86 4.0.x. @@ -460,20 +544,20 @@ not by 3.3.x servers. You can instead name it /etc/X11/XF86Config but that'll overwrite your old config file, which you may want to preserve. -8.7 Start the New X Server +9.7 Start the New X Server The new X server should be ready to use now. Start your X server in your usual manner. Typically, the startx command is used: startx -9. Testing the Server Without Installing It +10. Testing the Server Without Installing It As mentioned at the start of section 8, developers may want to simply run the X server without installing it. This can save some time and allow you to keep a number of X servers available for testing. -9.1 Configuration +10.1 Configuration As described in the preceding section, you'll need to create a configuration file for the new server. Put the XF86Config file in your ~/DRI- @@ -481,7 +565,7 @@ Be sure the ModulePath option is set correctly. -9.2 A Startup Script +10.2 A Startup Script A simple shell script can be used to start the X server. Here's an example. @@ -508,13 +592,13 @@ ./start-dri >& log -10. Where To Go From Here +11. Where To Go From Here 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.9 2000/12/12 17:48:10 alanh Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.14 2001/05/02 15:06:08 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.6.2.1 2001/03/13 17:19:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.DRIcomp,v 3.10.2.1 2001/06/01 18:26:43 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.Darwin diff -u xc/programs/Xserver/hw/xfree86/doc/README.Darwin:1.3.2.1 xc/programs/Xserver/hw/xfree86/doc/README.Darwin:1.3.4.4 --- xc/programs/Xserver/hw/xfree86/doc/README.Darwin:1.3.2.1 Tue Mar 13 12:19:27 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.Darwin Sat Jun 2 12:02:08 2001 @@ -2,7 +2,7 @@ Torrey T. Lyons - 11 December 2000 + 25 May 2001 1. Introduction @@ -14,19 +14,31 @@ 2. Hardware Support and Configuration -The Darwin port of XFree86 uses the IOKit for device driver loading and dis- -covery, rather than the XFree86 module loader. Because of this, the XFree86 -configuration file is not used on Darwin systems. The descriptions found -elsewhere of devices supported by XFree86 for other operating systems also do -not apply. - -XFree86 for Darwin will work with any video card that you have an IOKit -driver for. If you are running Mac OS X, this typically means any card that -has been shipped by Apple. If a card works for you with the Mac OS X GUI, it -will work on the same machine with XFree86. If you have a pure Darwin instal- -lation, your hardware support may be somewhat limited because Apple does not -include all its hardware drivers with Darwin. IOKit drivers are typically -found in /System/Library/Extensions/ or /Library/Extensions/. +XFree86 can be run either from the console or side by side with Mac OS X's +Aqua desktop in a full screen mode. In full screen mode with Aqua, when the X +window system is active, it takes over the entire screen. You can switch back +to the Mac OS X desktop by holding down Command-Option-A. This key combina- +tion can be changed in the user preferences. From the Mac OS X desktop, just +click on the XDarwin icon in the floating switch window to switch back to the +X window system. You can change this behavior in the user preferences so +that clicking on the XDarwin icon in the Dock switches as well. The full +screen cooperative mode with Aqua is known as Quartz mode, named after the +Quartz 2D compositing engine used by Aqua. + +From the console, the Darwin port of XFree86 uses the IOKit for device driver +loading and discovery, rather than the XFree86 module loader. Because of +this, the XFree86 configuration file is not used on Darwin or Mac OS X sys- +tems. The descriptions found elsewhere of devices supported by XFree86 for +other operating systems also do not apply. Running XFree86 from the text +console is known as IOKit mode. + +XFree86 for Darwin or Mac OS X will work with any video card that you have an +IOKit driver for. If you are running Mac OS X, this typically means any card +that has been shipped by Apple. If a card works for you with the Mac OS X +GUI, it will work on the same machine with XFree86. If you have a pure Darwin +installation, you may need to download additional third-party drivers from +Apple's Darwin site. IOKit drivers are typically installed in /Sys- +tem/Library/Extensions/ or /Library/Extensions/. Multi-button and scroll wheel mouse support works well with all USB mice that I have tested. I have done no testing with serial mice. @@ -35,31 +47,21 @@ Following are instructions for building and running your own copy of XFree86. The procedure for getting your X server up and running on Darwin and Mac OS X -are very similar, but it is actually somewhat more difficult on Mac OS X. -Where there are differences I have noted them below. Both Mac OS X Develop- -ers' Preview 4 and Mac OS X Public Beta are covered. Note that to build -XFree86 for yourself on Mac OS X Beta, you will need to have the Developers' -Tools. If you did not receive these as a member of ADC, they are available -for download from the Apple Developer Connection. - -If you want to save some time, you can use the precompiled binaries provided -by the XFree86 server at . Follow the instructions in the Install document to install -it. - -This will create two new directory trees, /usr/X11R6 and /private/etc/X11. If -you have the developers' tools, you may have to run ranlib on all the -libraries in /usr/X11R6/lib/* before trying to build other X applications. +are very similar. Where there are differences I have noted them below. Note +that to build XFree86 for yourself on Mac OS X, you will need to install the +Developers' Tools. + +If you don't feel the need to live on the cutting edge, you can save some +time and effort by using the precompiled binaries available on the XFree86 +FTP server at . +Follow the instructions in the Install document to install it. This will cre- +ate two new directory trees, /usr/X11R6 and /etc/X11 For Mac OS X Quartz sup- +port, download the optional Xquartz.tgz tarball. If you get the precompiled binaries you can skip ahead to the section on run- -ning X windows (section 4., page 1) +ning the X window system (section 4., page 1) On the other hand, if you want +to build things yourself from scratch, follow the directions below. -On the other hand, if you want to build things yourself from scratch, follow -the directions below. - -If you want to recompile the X server on Mac OS X, you will have to make the -header files as described below (section 3.2, page 1). - 3.1 Get the Code The first thing you need to do is to get the source code from the XFree86 @@ -68,8 +70,8 @@ o Setup CVS: Both Darwin and Mac OS X include CVS (Concurrent Versions System), which is an easy way to download and keep up to date with open source code released by XFree86 and others. You do have to setup CVS - properly, however, to tell it where to look. Follow the instructions - here on how to do this either via ssh or via the cvs pserver. + properly, however, to tell it where to look. Follow the XFree86 instruc- + tions on how to do this either via ssh or via the cvs pserver. o Now make a directory in some convenient place which will serve as your top level directory for you open source development efforts. I am going @@ -82,23 +84,8 @@ cvs checkout xc Wait for all the files to complete downloading. - -3.2 Make Header Files for Mac OS X - -These next steps are not necessary if you are building XFree86 on Darwin. Mac -OS X Beta or DP4 does not include many of the 'in-progress' header files that -are needed to successfully build XFree86. The general philosophy is that at -any given time, Mac OS X will include only headers files that are 'ready for -prime time' while Darwin will include a snapshot of Apple's current efforts. -So if you have access to a Darwin system, I would suggest using this instead -of Mac OS X to build XFree86. If you don't, read the appropriate page below -for an outline of what you need to do: - - o Mac OS X Public Beta (section 6.1, page 1) - - o Mac OS X Developers' Preview 4 (section 6.2, page 1) -3.3 Build XFree86 +3.2 Build XFree86 Once you have everything ready it is easy to build and install XFree86. From the command line: @@ -108,61 +95,69 @@ (wait for several hours) - su root - make install >& install.log - make install.man >& man.log + sudo make install >& install.log + sudo make install.man >& man.log -4. Run X Windows +4. Run the X Window System -You will want to add the X windows executables to your path. Your path is the +You will want to add the X window executables to your path. Your path is the list of directories to be searched when you type a command. You will also want to add the man pages from XFree86 to the list of pages to be searched when you are looking for documentation. The way to do this depends on the shell you are using. With tcsh or csh add the following two lines to a file -in your home directory called .cshrc (create this file if you don't have one -yet): +named ~/Library/init/tcsh/path: (You may need to create this file and direc- +tory path if it does not exist already.) - setenv MANPATH "${MANPATH}:/usr/X11R6/man:/usr/local/man" setenv PATH "${PATH}:/usr/X11R6/bin" + setenv MANPATH "${MANPATH}:/usr/X11R6/man" -Now type ``source ~/.cshrc;rehash'' to get these changes to take effect. On -future logins, this file will be executed automatically. +The next time you login or open a Terminal window, this file will be executed +automatically. -You are now ready to go. On Mac OS X, you have to do a few extra steps each -time you want to run X windows. You can't run XFree86 with CoreGraphics run- -ning since they both want to control the screen. So for Mac OS X you first -need to logout. Then for Mac OS X DP4, from the login window type ``console'' -as the user name and push login. For Mac OS X Beta, type ``>console'' as the -user name. This should shutdown CoreGraphics and bring you up with a text -console. Login again. - -Now from the text console you can start X Windows in either Darwin or Mac OS -X by typing ``startx''. After a brief wait at least one terminal window -should pop up for you. So far it probably isn't very impressive as you might -not even have a window manager running to allow you to move windows around. - -When you are ready to quit X windows type ``exit'' in the main terminal win- -dow or quit with the window manager if you have one running. Unfortunately -the X server won't shutdown correctly and you will get an apparently frozen -screen with only a spinning beachball cursor on it. Nothing you type shows up -on the screen, but in fact your keystrokes are being received by the console. -Type ``logout'' to return to normalcy after a brief delay. With Darwin this -should put you back at the text console login prompt. With Mac OS X, Core- -Graphics will restart and you should be given a login window. +You are now ready to go. On Mac OS X, you can run XFree86 from the text con- +sole or in full screen mode with Aqua. To get to the text console in Mac OS X +you need to logout and type ``>console'' as the user name. This will shutdown +Core Graphics and bring up the console login prompt. Login again as your +user. + +From the text console you can start the X Window System by typing ``startx''. +After a brief wait at least one terminal window should pop up for you. So +far it probably isn't very impressive as you might not even have a window +manager running to allow you to move windows around. + +When you are ready to quit XFree86 type ``exit'' in the main terminal window +or quit with the window manager if you have one running. Unfortunately the X +server won't shutdown correctly and you will get an apparently frozen screen +with only a spinning beachball cursor on it. Nothing you type shows up on the +screen, but in fact your keystrokes are being received by the console. Type +``logout'' to return to normalcy after a brief delay. With Darwin this should +put you back at the text console login prompt. With Mac OS X, Core Graphics +will restart and you should be given a login window. + +To start XFree86 in Quartz mode you can launch the XDarwin application in the +/Applications folder, or from the command line type ``startx -- -quartz''. +When the X window system is active, it takes over the entire screen. You can +switch back to the Mac OS X desktop by holding down Command-Option-A. This +key combination can be changed in the user preferences. From the Mac OS X +desktop, just click on the XDarwin icon in the floating switch window to +switch back to the X window system. You can change this behavior in the user +preferences so that clicking on the XDarwin icon in the Dock switches as +well. Customize X Windows -X windows is very customizable and you will certainly want to change some -things. There is a lot you can do to control how your windows look, how the -windows are moved, resized, etc. You will likely want to get a better window -manager than twm, which is included with XFree86. The .xinitrc file in your -home directory controls what programs are run when you start X windows. You -can find a sample .xinitrc file in /private/etc/X11/xinit/xinitrc. - -There are several window managers that have been ported to Darwin. The best -collection of window managers and other X windows applications is at Dar- -winfo's ports page. Another good place to look for Darwin ports in general is -at Stepwise's Softrak site. +The X window system is very customizable and you will certainly want to +change some things. There is a lot you can do to control how your windows +look, how the windows are moved, resized, etc. You will likely want to get a +better window manager than twm, which is included with XFree86. The .xinitrc +file in your home directory controls what programs are run when you start the +X window system. You can find a sample .xinitrc file in /etc/X11/xinit/xini- +trc. + +There are several window managers that have been ported to Darwin. The best +collection of window managers and other X window clients is at Darwinfo's +ports page. Another good place to look for Darwin ports in general is at +Stepwise's Softrak site. Good luck! @@ -173,176 +168,20 @@ Things that are broken: - o The bell is broken. + o The bell does not work in IOKit mode. - o Server shutdown problem: After quitting the X server the colored beach- - ball cursor reappears, but the screen never returns to the console dis- - play. The console is accepting input however, so typing ``logout'' will - return you to the login prompt. + o Server shutdown problem: After quitting the X server in IOKit mode, the + colored beachball cursor reappears, but the screen never returns to the + console display. The console is accepting input however, so typing + ``logout'' will return you to the login prompt. o Only one display is currently supported. - - o Screen saver not supported. - - o Key repeat rate can not be adjusted. - -Things I am working on: - - o Allowing rootless use on Mac OS X - - o Correct wake from sleep behavior - -6. Appendix - -6.1 Installing IOKit Header files on Mac OS X Beta - -Here is what you need to do to be able to build XFree86 (or other clients of -IOGraphics services) on Mac OS X Public Beta. - - 1. You need to install some more build tools that aren't included in Mac - OS X Beta, but are included in Darwin. These are needed for the next - step. Go to your development directory and type: - - cvs checkout bootstrap_cmds - cd bootstrap_cmds - make - - Now su to root and do a ``make install'' from the bootstrap_cmds direc- - tory. - - 2. The IOKit framework included with Mac OS X Beta is a little on the - wimpy side, even after installing the Developer Tools. You'll need to - rebuild it, but to do so safely we'll take advantage of the cool direc- - tory structure of Mac OS X and put the new version in /Library/Frame- - works/. This will override the version in /System/Library/Frameworks/. - Or at least, that's where you should put it using the new Mac OS X Beta - file structure, but in fact the compiler doesn't know this and still - looks in /Local/Library/Frameworks. (I have already filed a developer's - bug report on this.) To start we make a copy of the original. Login as - root and do the following: - - cd /Library - mkdir -p Frameworks - cp -R /System/Library/Frameworks/IOKit.framework Frameworks/IOKit.framework - cd / - mkdir -p Local - ln -s /Library /Local/Library - - 3. Now you need to get a full version of the IOKit framework from the Dar- - win repository. This comes as part of the kernel. So, in your develop- - ment directory again: - - cvs checkout xnu - cd xnu - source SETUP/setup.csh - make exporthdrs - make install - - The "make install" will start by assembling all the headers you need, - but then will proceed to build a new kernel. You can Control-C out of - the build once it starts compiling things if you want. Otherwise, just - be patient. - - 4. You also need to get the IOKitUser project, which contains the user - interface to the IOKit, and merge it into the IOKit framework. From - your development directory type: - - cvs checkout IOKitUser - - Then you need to change the Makefile so it builds on top of the new - IOKit framework you are building. Change to the IOKitUser project - directory and edit the Makefile. Change the following line: - - NEXTSTEP_BUILD_OUTPUT_DIR = /$(USER)/build/$(NAME) - - to: - - NEXTSTEP_BUILD_OUTPUT_DIR = /BUILD/dst/System/Library/Frameworks - - Now, run ``make'' while in the IOKitUser directory. It will likely not - finish building since the IOKitUser project relies on some stuff that - Apple hasn't really made public yet, but it should finish populating - the new IOKit framework with headers and start compiling. (Strangely - enough, the headers installed in your new IOKit framework don't contain - the real header files. They are just single line files with an #import - of the file in your IOKitUser project. This works fine as long as you - don't ever delete or move your IOKitUser project. I imagine that using - ``make install'' would fix this up, but you can't do this as long as - the project doesn't build correctly. So for now you can either move the - header files by hand, or make sure you leave your IOKitUser project in - place.) - - 5. Now put the new IOKit headers into our local copy. Change to the xnu - project directory and do the following as root: - - cd BUILD/dst/System/Library/Frameworks/ - cp -R IOKit.framework/Versions/A/Headers/* \ - /Library/Frameworks/IOKit.framework/Versions/A/Headers - - 6. The System framework needs touching up a bit too. You need to copy the - libkern header files from the new System.framework. As root, go to the - xnu project directory and type: (Of course you could make a local copy - of the System framework in /Library/Frameworks/, but the additions to - the System framework are small.) - - cd BUILD/dst/System/Library/Frameworks/System.framework/Versions/B/Headers - cp -R libkern /System/Library/Frameworks/System.framework/Headers/libkern - -6.2 Installing IOKit Header files on Mac OS X DP4 - -Here is an outline of what you need to do to be able to build XFree86 (or -other clients of IOGraphics services) on Mac OS X Developers' Preview 4. - - 1. Checkout, build, and install bootstrap_cmds from the CVS repository. - - 2. Checkout xnu from the CVS repository. Go to sandbox/xnu and do the fol- - lowing: - - source SETUP/setup.csh - make exporthdrs - - 3. su to root and do the following: - - mkdir -p /Local/Library/Frameworks - cp -R /System/Library/Frameworks/IOKit.framework /Local/Library/Frameworks - - This will create a new local version of the IOKit framework that will - override the System version without changing the original. - - 4. You now want to merge the IOKit headers from the xnu project into your - local IOKit framework. I did this fairly tediously by hand, but I would - suggest something like: - - cp -R sandbox/xnu/BUILD/dst/System/Library/Frameworks/IOKit.framework/Versions/A/Headers \ - /Local/Library/Frameworks/IOKit.framework/Versions/A - - The only problem with this is that there are a few stub header files - included that are just a single line with an #import to the appropriate - place in the xnu source on your disk. This is fine as long as you don't - move your xnu project. If you do, you can copy the original file to - replace the stub. There is probably an easier way to automatically - build a clean version of the IOKit framework, but I didn't find it. - (Let me know if you do.) - - 5. There are just a few more files you need in the IOKit framework. Check- - out the IO project from CVS. Get the necessary header files from there - and put them in your new local IOKit framework. You'll get errors when - you try to build XFree86 from which you can tell which files are - needed. I also needed to make the following patch to IOLLEvent.h. Your - mileage may vary. - 47c47 - < #include - --- - > #include + o The display mode can not be changed once the X server has started. - 6. You'll also need a few extra CoreFoundation header files. Checkout - CoreFoundation. You can make a new local version of the CoreFoundation - framework as above, or just add to the existing one. The files you need - are CFMachPort.h and CFMessagePort.h in the RunLoop.subproj and CFStor- - age.h in Collections.subproj. + o A screen saver is not supported. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml,v 1.4 2000/12/12 18:54:29 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml,v 1.4.4.2 2001/06/02 04:44:37 torrey Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Darwin,v 1.3.2.1 2001/03/13 17:19:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.Darwin,v 1.3.4.4 2001/06/02 16:02:08 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.I128 diff -u xc/programs/Xserver/hw/xfree86/doc/README.I128:1.10.2.1 xc/programs/Xserver/hw/xfree86/doc/README.I128:1.10.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.I128:1.10.2.1 Tue Mar 13 12:19:27 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.I128 Fri Jun 1 14:26:44 2001 @@ -100,4 +100,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/I128.sgml,v 1.6 2000/12/13 01:55:47 robin Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.I128,v 1.10.2.1 2001/03/13 17:19:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.I128,v 1.10.4.1 2001/06/01 18:26:44 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.LynxOS diff -u xc/programs/Xserver/hw/xfree86/doc/README.LynxOS:3.28.2.1 xc/programs/Xserver/hw/xfree86/doc/README.LynxOS:3.28.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.LynxOS:3.28.2.1 Tue Mar 13 12:19:27 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.LynxOS Fri Jun 1 14:26:44 2001 @@ -1,4 +1,4 @@ - README for XFree86 4.0.3 on LynxOS + README for XFree86 4.1.0 on LynxOS Thomas Mueller @@ -13,19 +13,19 @@ See the Copyright Notice. -The sources for XFree86 4.0.3 are available by anonymous ftp from: +The sources for XFree86 4.1.0 are available by anonymous ftp from: -ftp://ftp.XFree86.org/pub/XFree86/4.0.3 +ftp://ftp.XFree86.org/pub/XFree86/4.1.0 Binaries of XFree86 for LynxOS x86 are available from: -ftp://ftp.XFree86.org/pub/XFree86/4.0.3/binaries/LynxOS +ftp://ftp.XFree86.org/pub/XFree86/4.1.0/binaries/LynxOS A list of mirror sites is provided by ftp://ftp.XFree86.org/pub/XFree86/MIR- RORS The binaries on the FTP site were built on the latest released LynxOS version -at the time XFree86 4.0.3 was released. In this case it is `LynxOS x86 +at the time XFree86 4.1.0 was released. In this case it is `LynxOS x86 3.0.1'. Because of changes made to the object format they don't run on LynxOS versions earlier than 3.0.0. @@ -37,7 +37,7 @@ 3.1.0' support has to be considered to be in `alpha state'. Initial tests were performed on LynxOS x86 only! -XFree86 4.0.3 supports LynxOS on the x86 and on the PowerPC platform. X +XFree86 4.1.0 supports LynxOS on the x86 and on the PowerPC platform. X servers are currently available only on the x86 platform. The X server may work with some PowerPC platforms supported by LynxOS though this has not (yet) been thoroughly tested. @@ -163,7 +163,7 @@ 3.5 X Server debug diagnostics output and other VT peculiarities Output made by the XFree86 X on its stdout or stderr will be lost after the -server switches to graphics mode. The XFree86 4.0.3 server stores its output +server switches to graphics mode. The XFree86 4.1.0 server stores its output in /usr/adm/XFree86.n.log (where n is the screen number). When the X server is running output made to other consoles will be lost. @@ -266,4 +266,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LynxOS.sgml,v 3.20 2000/06/17 00:27:32 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.LynxOS,v 3.28.2.1 2001/03/13 17:19:27 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.LynxOS,v 3.28.4.1 2001/06/01 18:26:44 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD diff -u xc/programs/Xserver/hw/xfree86/doc/README.NetBSD:3.75.2.2 xc/programs/Xserver/hw/xfree86/doc/README.NetBSD:3.76.2.1 --- xc/programs/Xserver/hw/xfree86/doc/README.NetBSD:3.75.2.2 Tue Mar 13 12:19:28 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.NetBSD Fri Jun 1 14:26:44 2001 @@ -1,4 +1,4 @@ - README for XFree86 4.0.3 on NetBSD + README for XFree86 4.1.0 on NetBSD Rich Murphey, David Dawes, Marc Wandschneider, Mark Weaver, Matthieu Herrb @@ -14,10 +14,10 @@ The sources for XFree86 are available by anonymous ftp from: -ftp://ftp.XFree86.org/pub/XFree86/4.0.3 +ftp://ftp.XFree86.org/pub/XFree86/4.1.0 Binaries for NetBSD 1.4 and later are available from: -ftp://ftp.XFree86.org/pub/XFree86/4.0.3/binaries/NetBSD +ftp://ftp.XFree86.org/pub/XFree86/4.1.0/binaries/NetBSD A list of mirror sites is provided by http://www.xfree86.org/MIRRORS.shtml @@ -33,8 +33,6 @@ 3. New OS dependent features -See the Release Notes for non-OS dependent new features in XFree86 4.0.3. - 3.1 New OS dependent features in 4.0.2 o A fix for libXmu OS detection which was broken since unix isn't defined @@ -101,7 +99,7 @@ 5.1 About mouse configuration -XFree86 4.0.3 has support for the mouse driver included in the wscons console +XFree86 4.1.0 has support for the mouse driver included in the wscons console driver introduced by NetBSD 1.4. Specify ``wsmouse'' as the protocol and ``/dev/wsmouse0'' as the device in /etc/X11/XF86Config if you're using NetBSD 1.4 or later with a PS/2 mouse. @@ -219,14 +217,14 @@ access to the /dev/mem device when in multi-users mode. But XFree86 servers can take advantage (or require) linear access to the display memory. -Most XFree86 4.0.3 card drivers require linear memory access. There are two +Most XFree86 4.1.0 card drivers require linear memory access. There are two ways to allow XFree86 to access linear memory: The first way is to disable the kernel security feature by adding ``option INSECURE'' in the kernel configuration file and build a new kernel. The second way is to install the aperture driver, included in source form in -xc/programs/Xserver/hw/xfree86/etc/apNetBSD.shar in the XFree86 4.0.3 source +xc/programs/Xserver/hw/xfree86/etc/apNetBSD.shar in the XFree86 4.1.0 source distribution. Unpack it in a new directory of your choice by running: sh apNetBSD.shar @@ -370,7 +368,7 @@ particular, David Dawes, Pace Willison, Amancio Hasty, Christoph Robitschko, Nate Williams, Rod Grimes, Jack Velte and Michael Smith. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.59.2.1 2001/03/04 09:41:30 herrb Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.60.2.1 2001/06/01 18:09:48 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.75.2.2 2001/03/13 17:19:28 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.NetBSD,v 3.76.2.1 2001/06/01 18:26:44 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD diff -u xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD:1.20.2.3 xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD:1.22.2.1 --- xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD:1.20.2.3 Fri Mar 16 11:01:14 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD Fri Jun 1 14:26:44 2001 @@ -1,4 +1,4 @@ - README for XFree86 4.0.3 on OpenBSD + README for XFree86 4.1.0 on OpenBSD Matthieu Herrb @@ -12,13 +12,13 @@ See the Copyright Notice. -The sources for XFree86 4.0.3 are available by anonymous ftp from: +The sources for XFree86 4.1.0 are available by anonymous ftp from: -ftp://ftp.XFree86.org/pub/XFree86/4.0.3 +ftp://ftp.XFree86.org/pub/XFree86/4.1.0 Binaries for OpenBSD/i386 2.8 and later are available from: -ftp://ftp.XFree86.org/pub/XFree86/4.0.3/binaries/OpenBSD +ftp://ftp.XFree86.org/pub/XFree86/4.1.0/binaries/OpenBSD A list of mirror sites is provided by http://www.xfree86.org/MIRRORS.shtml @@ -32,7 +32,7 @@ 3. New OS dependent features -See the Release Notes for non-OS dependent new features in XFree86 4.0.3. +See the Release Notes for non-OS dependent new features in XFree86 4.1.0. 3.1 New OS dependent features in 4.0.3 @@ -122,7 +122,7 @@ 5.1 About mouse configuration -XFree86 4.0.3 has support for the mouse driver included in the new wscons +XFree86 4.1.0 has support for the mouse driver included in the new wscons console driver introduced by OpenBSD-current after 2.8. Specify ``wsmouse'' as the protocol and ``/dev/wsmouse0'' as the device in /etc/X11/XF86Config if you're using OpenBSD-current with a PS/2 mouse. @@ -332,7 +332,7 @@ particular, David Dawes, Pace Willison, Amancio Hasty, Christoph Robitschko, Nate Williams, Rod Grimes, Jack Velte and Michael Smith. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.15.2.2 2001/03/16 15:57:43 dawes 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.20.2.3 2001/03/16 16:01:14 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.OpenBSD,v 1.22.2.1 2001/06/01 18:26:44 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.SiS diff -u xc/programs/Xserver/hw/xfree86/doc/README.SiS:3.16.2.1 xc/programs/Xserver/hw/xfree86/doc/README.SiS:3.16.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.SiS:3.16.2.1 Tue Mar 13 12:19:28 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.SiS Fri Jun 1 14:26:44 2001 @@ -113,4 +113,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/SiS.sgml,v 3.7 2000/03/06 22:59:24 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SiS,v 3.16.2.1 2001/03/13 17:19:28 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.SiS,v 3.16.4.1 2001/06/01 18:26:44 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.apm diff -u xc/programs/Xserver/hw/xfree86/doc/README.apm:1.8.2.1 xc/programs/Xserver/hw/xfree86/doc/README.apm:1.8.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.apm:1.8.2.1 Tue Mar 13 12:19:28 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.apm Fri Jun 1 14:26:44 2001 @@ -111,4 +111,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/apm.sgml,v 1.3 2000/03/08 05:38:43 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.apm,v 1.8.2.1 2001/03/13 17:19:28 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.apm,v 1.8.4.1 2001/06/01 18:26:44 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.ati diff -u xc/programs/Xserver/hw/xfree86/doc/README.ati:3.53.2.1 xc/programs/Xserver/hw/xfree86/doc/README.ati:3.56.2.1 --- xc/programs/Xserver/hw/xfree86/doc/README.ati:3.53.2.1 Tue Mar 13 12:19:28 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.ati Fri Jun 1 14:26:44 2001 @@ -2,7 +2,7 @@ Marc Aurele La France - 2000 December 6 + 2001 April 10 Abstract @@ -216,7 +216,7 @@ A ChipSet name of ``vgawonder'' is equivalent to ``ativga'', except that only VGAWonder-capable adapters can be assigned to the ``Device'' section. This -specifically excludes newer Mach64's with integrated controllers. +specifically excludes the newer integrated Mach64 controllers. In some PCI or AGP systems, the driver will not, by default, probe for non- PCI Mach32's or Mach64's. This is because, before doing any such probe, the @@ -426,10 +426,28 @@ aperture. On non-Intel platforms, the driver requires a linear aperture and, so, this -option should not be specified. +option is ignored. -5.10 Option ``shadowfb'' +5.10 Option ``HWCursor'' and Option ``SWCursor'' +Option ``HWCursor'', which is the default, specifies that hardware facilities +are to be used to paint the mouse pointer on the screen. Option ``SWCursor'' +specifies that the mouse pointer is to by drawn by software, which is much +slower. If both options are specified, option ``SWCursor'' prevails. Cur- +rently, these options are only acted upon for 256-colour or higher depth +modes, if a Mach64 accelerator CRTC, or a Mach64 integrated controller is +being used. In all other situations, a software cursor will be used. + +5.11 Option ``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 copy the result into video memory. If this option is not active, the CPU @@ -444,19 +462,19 @@ a linear video memory aperture is not enabled, when the frame buffer depth is less than 8, or when acceleration is used. -5.11 Option ``dpms'' +5.13 Option ``dpms'' This option enables the driver's support for VESA's Display Power Management Specification. -5.12 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.13 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. @@ -470,14 +488,14 @@ requirements of most devices in the system. This means the driver can not easily change the linear aperture address. -5.14 Option ``ReferenceClock'' ``frequency'' +5.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.15 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 @@ -619,7 +637,7 @@ resolving problems. If you are still experiencing problems, you can send me non-HTMLised e-mail -at . Please be as specific as possible when describing the +at . Please be as specific as possible when describing the problem(s), and include an unedited copy of the server's log and the XF86Con- fig file used. @@ -673,7 +691,7 @@ 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.34 2000/12/07 15:43:41 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.53.2.1 2001/03/13 17:19:28 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.ati,v 3.56.2.1 2001/06/01 18:26:44 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.chips diff -u xc/programs/Xserver/hw/xfree86/doc/README.chips:3.35.2.1 xc/programs/Xserver/hw/xfree86/doc/README.chips:3.36.2.1 --- xc/programs/Xserver/hw/xfree86/doc/README.chips:3.35.2.1 Tue Mar 13 12:19:28 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.chips Fri Jun 1 14:26:44 2001 @@ -3,11 +3,11 @@ David Bateman (), Egbert Eich () - 14th June 2000 + 1st January 2001 1. Introduction -With the release of XFree86 version 4.0.3, the Chips and Technologies driver +With the release of XFree86 version 4.1.0, the Chips and Technologies driver has been extensively rewritten and contains many new features. This driver must be considered work in progress, and those users wanting stability are encouraged to use the older XFree86 3.3.x versions. However this version of @@ -260,14 +260,6 @@ grammable clock makes this option obsolete and so it's use isn't recommended. It is completely ignored for HiQV chipsets. - Option "UseVclk1" - The HiQV series of chips have three programmable clocks. The - first two are usually loaded with 25.175 and 28.322MHz for VGA - backward compatibility, and the third is used as a fully pro- - grammable clock. On at least one system (the Inside 686 LCD/S - single board computer) the third clock is unusable. This option - forces the use of VClk1 as the programmable clock. - TextClockFreq 25.175 Except for the HiQV chipsets, it is impossible for the server to read the value of the currently used frequency for the text con- @@ -291,18 +283,29 @@ or 32bpp LCD panel clocks, where the options above set the clocks to 65MHz. + Option "CRTClkIndx" "2" + Option "FPClkIndx" "1"" The HiQV series of chips have three pro- + grammable clocks. The first two are usually loaded with 25.175 + and 28.322MHz for VGA backward compatibility, and the third is + used as a fully programmable clock. On at least one system (the + Inside 686 LCD/S single board computer) the third clock is unus- + able. These options can be used to force a particular clock index + to be used + Option "MMIO" This has a different effect depending on the hardware on which it is used. For the 6554x machines MMIO is only used to talk to the BitBLT engine and is only usable with PCI buses. It is enabled by default for 65545 machines since the blitter can not be used otherwise. The HiQV series of chipsets must use MMIO with - their BitBLT engines, and so this is enabled by default. However - the 690xx chipsets can use MMIO for all communications with the + their BitBLT engines, and so this is enabled by default. + + Option "FullMMIO" + The 690xx chipsets can use MMIO for all communications with the video processor. So using this option on a 690xx chipset forces them to use MMIO for all communications. This only makes sense when the 690xx is on a PCI bus so that normal PIO can be dis- - abled. (WARNING!! 690xx MMIO is untested) + abled. Option "SuspendHack" This option sets the centering and stretching to the BIOS default @@ -409,6 +412,20 @@ 255 for 8bit depth, 0 to 32,767 for 15bit depth, etc. This option might be used if the default video overlay key causes problems. + Option "DualRefresh" + The 69030 chipset has independent display channels, that can be + configured to support independent refresh rates on the flat panel + and on the CRT. The default behaviour is to have both the flat + panel and the CRT use the same display channel and thus the same + refresh rate. This option forces the two display channels to be + used, giving independent refresh rates. + + Option "Crt2Memory" "2048" + The ct69030 supports dual-head display. By default the two dis- + play share equally the available memory. This option forces the + second display to take a particular amount of memory. Please read + the section below about dual-head display. + Option "XaaNoScreenToScreenCopy", Option "XaaNoSolidFillRect", Option "XaaNoSolidHorVertLine", Option "XaaNoMono8x8PatternFillRect", Option "XaaNoColor8x8Pat- @@ -499,6 +516,13 @@ after a suspend/resume or LCD/CRT switch. For a complete discus- sion on the dot clock limitations, see the next section. + * Dual-head display + Dual-head display has two effects on the modelines. Firstly, the + memory requirements of both heads must fit in the available mem- + ory. Secondly, the memory bandwidth of the video processor is + shared between the two heads. Hence the maximum dot-clock might + need to be limited. + The driver is capable of driving both a CRT and a flat panel display. In fact the timing for the flat panel are dependent on the specification of the panel itself and are independent of the particular mode chosen. For this reason it @@ -530,8 +554,98 @@ knowledge no machine with a HiQV needs the "UseModeline" or "FixPanelSize" options. -5. The Full Story on Clock Limitations +5. Dual Display Channel +XFree86 releases later than 4.1.0 support dual-channel display on the +ct69030. This support can be used to give a single display image on two +screen with different refresh rates, or entirely different images on the two +displays. + +Dual refresh rate display can be selected with the "DualRefresh" option +described above. However to use the dual-head support is slightly more com- +plex. Firstly, the ct69030 chipset must be installed on a PCI bus. This is a +driver limitation that might be relaxed in the future. In addition the +device, screen and layout sections of the "XF86Config" must be correctly con- +figured. A sample of an incomplete "XF86Config" is given below + + Section "Device" + Identifier "Chips and Technologies - Pipe A" + Driver "chips" + BusID "PCI:0:20:0" + Screen 0 + EndSection + + Section "Device" + Identifier "Chips and Technologies - Pipe B" + Driver "chips" + BusID "PCI:0:20:0" + Screen 1 + EndSection + + Section "Screen" + Identifier "Screen 0" + Device "Chips and Technologies - Pipe A" + Monitor "generic LCD" + + SubSection "Display" + Depth 16 + Modes "1024x768" + EndSubsection + EndSection + + Section "Screen" + Identifier "Screen 1" + Device "Chips and Technologies - Pipe B" + Monitor "generic CRT" + + SubSection "Display" + Depth 16 + Modes "1024x768" + EndSubsection + EndSection + + Section "ServerLayout" + Identifier "Main Layout" + Screen "Screen 0" + Screen "Screen 1" RightOf "Screen 0" + InputDevice "Mouse1" "CorePointer" + InputDevice "Keyboard1" "CoreKeyboard" + EndSection + +The device section must include the PCI BusID. This can be found from the log +file of a working single-head installation. For instance, the line + + (--) PCI:*(0:20:0) C&T 69030 rev 97, Mem @ 0xed000000/24 + +appears for the case above. Additionally, the "Screen" option must appear in +the device section. It should be noted that if a flat panel is used, this it +must be allocated to "Screen 0". + +The server can then be started with the "+xinerama" option as follows + + startx -- +xinerama + +For more information, read the Xinerama documentation. + +It should be noted that the dual channel display options of the 69030 require +the use of additional memory bandwidth, as each display channel independently +accesses the video memory. For this reason, the maximum colour depth and res- +olution that can be supported in a dual channel mode will be reduced compared +to a single display channel mode. However, as the driver does not prevent you +from using a mode that will exceed the memory bandwidth of the 69030, but a +warning like + + (WW) Memory bandwidth requirements exceeded by dual-channel + (WW) mode. Display might be corrupted!!! + +If you see such display corruption, and you have this warning, your choices +are to reduce the refresh rate, colour depth or resolution, or increase the +speed of the memory clock with the the "SetMClk" option described above. Note +that increasing the memory clock also has its own problems as described +above. + +6. The Full Story on Clock Limitations + There has been much confusion about exactly what the clock limitations of the Chips and Technologies chipsets are. Hence I hope that this section will clear up the misunderstandings. @@ -575,17 +689,24 @@ the screen. The formula to determine the maximum usable dotclock on the HiQV series of chips is + Max dotclock = min(MaxDClk, 0.70 * 8 * MemoryClk / (BytesPerPixel + + (isDSTN == TRUE ? 1 : 0))) + +if you chips is a 69030 or 69000 or + Max dotclock = min(MaxDClk, 0.70 * 4 * MemoryClk / (BytesPerPixel + (isDSTN == TRUE ? 1 : 0))) -which says that there are two limits on the dotclock. One the overall maxi- -mum, and another due to the available memory bandwidth of the chip. For the -memory bandwidth 4 bytes are transfered every clock cycle (Hence the 4), but -after accounting for the RAS/CAS signaling only about 70% of the bandwidth is -available. The whole thing is divided by the bytes per pixel, plus an extra -byte if you are using a DSTN. The extra byte with DSTN screens is used for -the frame buffering/acceleration in these screens. So for the various Chips -and Technologies chips the maximum specifications are +otherwise. This effectively means that there are two limits on the dotclock. +One the overall maximum, and another due to the available memory bandwidth of +the chip. The 69030 and 69000 have a 64bit memory bus and thus transfer 8 +bytes every clock thus (hence the 8), while the other HiQV chipsets are 32bit +and transfer 4 bytes per clock cycle (hence the 4). However, after accounting +for the RAS/CAS signaling only about 70% of the bandwidth is available. The +whole thing is divided by the bytes per pixel, plus an extra byte if you are +using a DSTN. The extra byte with DSTN screens is used for the frame buffer- +ing/acceleration in these screens. So for the various Chips and Technologies +chips the maximum specifications are Max DClk MHz Max Mem Clk MHz 65550 rev A 3.3v 80 38 @@ -613,8 +734,8 @@ 65554 94.5 77 51.33 77 51.33 38.5 65555 110 77 51.33 77 51.33 38.5 68554 110 77 51.33 77 51.33 38.5 - 69000 135 116.2 77.47 116.2 77.47 58.1 - 69030 170 140 93.33 140 93.33 70 + 69000 135 135 135 135 135 116.2 + 69030 170 170 170 170 170 140 If you exceed the maximum set by the memory clock, you'll get corruption on the screen during graphics operations, as you will be starving the HW BitBlt @@ -632,7 +753,7 @@ is no guarantee that driving the video processor beyond it capabilities won't cause damage. -6. Troubleshooting +7. Troubleshooting The cursor appears as a white box, after switching modes There is a known bug in the H/W cursor, that sometimes causes the @@ -805,13 +926,13 @@ My ct69030 machine locks up when starting XFree The ct69030 chipset introduced a new dual channel architecture. - In its current form, XFree can not take advantage of this second - display channel. In fact if the video BIOS on the machine sets - the ct69030 to a dual channel mode by default, XFree will lockup - hard at this point. The solution is to use the BIOS setup to - change to a single display channel mode, ensuring that both the - IOSS and MSS registers are set to a single channel mode. Work is - underway to fix this. + In its current form, XFree86 can not take advantage of this sec- + ond display channel. In fact if the video BIOS on the machine + sets the ct69030 to a dual channel mode by default, XFree86 will + lockup hard at this point. The solution is to use the BIOS setup + to change to a single display channel mode, ensuring that both + the IOSS and MSS registers are set to a single channel mode. Work + is underway to fix this. I can't start X-windows with 16, 24 or 32bpp Firstly, is your machine capable of 16/24/32bpp with the mode @@ -829,7 +950,7 @@ startx -- -depth 24 -fbbpp 32 8-8-8 RGB truecolor - however as XFree86 version 4.0.3 allows 32bpp pixmaps to be used + however as XFree86 version 4.1.0 allows 32bpp pixmaps to be used with framebuffers operating in 24bpp, this mode of operating will cost performance for no gain in functionality. @@ -847,7 +968,8 @@ example 65.00MHz might be unstable while 65.10MHz is not. So for unexplained problems not addressed above, please try to alter the clock you are using slightly, say in steps of 0.05MHz and see if the problem goes away. Alterna- -tively, using the "UseVClk1" option with HiQV chips might also help. +tively, using the "CRTClkIndx" or "FPClkIndx" option with HiQV chips might +also help. For other screen drawing related problems, try the "NoAccel" or one of the XAA acceleration options discussed above. A useful trick for all laptop com- @@ -860,19 +982,19 @@ or ), or post in the Usenet newsgroup "comp.windows.x.i386unix". -7. Disclaimer +8. Disclaimer XFree86, allows the user to do damage to their hardware with software. Although the authors of this software have tried to prevent this, they dis- claim all responsibility for any damage caused by the software. Use caution, if you think the Xserver is frying your screen, TURN THE COMPUTER OFF!! -8. Acknowledgement +9. Acknowledgement The authors of this software wish to acknowledge the support supplied by Chips and Technologies during the development of this software. -9. Authors +10. Authors Major Contributors (In no particular order) @@ -899,7 +1021,7 @@ We also thank the many people on the net who have contributed by reporting bugs and extensively testing this server. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml,v 3.33 2000/12/02 21:52:22 dbateman Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml,v 3.36 2001/05/19 00:35:42 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.chips,v 3.35.2.1 2001/03/13 17:19:28 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.chips,v 3.36.2.1 2001/06/01 18:26:44 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.cyrix diff -u xc/programs/Xserver/hw/xfree86/doc/README.cyrix:1.8.2.1 xc/programs/Xserver/hw/xfree86/doc/README.cyrix:1.8.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.cyrix:1.8.2.1 Tue Mar 13 12:19:28 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.cyrix Fri Jun 1 14:26:45 2001 @@ -50,4 +50,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/cyrix.sgml,v 1.3 2000/03/08 05:38:43 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.cyrix,v 1.8.2.1 2001/03/13 17:19:28 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.cyrix,v 1.8.4.1 2001/06/01 18:26:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.dps diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/README.dps:1.2.2.1 --- /dev/null Mon Jun 4 12:40:35 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.dps Fri Jun 1 14:26:45 2001 @@ -0,0 +1,170 @@ + XFree86 and DPS + + Juliusz Chroboczek, + + 27 February 2001 + +1. Introduction + +Display Postscript (or DPS for short) is a rendering extension for X11. DPS +is slightly atypical in that it is based on code mobility, the ability to +send executable code from client to server. Thus, a DPS client does not +request that a line should be rendered; instead, it uploads code to the +server which, when executed, causes a line to be drawn. + +This document does not aim at teaching programming with DPS; it is only a +summary description of the DPS support code included with XFree86. More +information about DPS, including a DPS bibliography, is available from the +DPS extension site . + + Note: Adobe, PostScript and Display PostScript are trademarks of + Adobe Systems Incorporated which may be registered in certain + jurisdictions. + +As all X11 extensions, DPS consists of client-side and server-side compo- +nents. The DPS client side consists of a number of libraries and a number of +tools for programming and configuration. The DPS server side may consist +either of an X server extension, or of a client-side process known as the +``DPS agent.'' In this latter case, the term ``server-side'' is somewhat +misleading. + +At the time of writing, only the client side is included with XFree86; the +server side must be obtained separately. Please see server side (section 3., +page 1) later in this document for more information. + +2. The DPS client side + +The DPS client side consists of four libraries and a number of basic tools +for programming and configuration; these are all included with XFree86. + +2.1 Libraries + +The libpsres library is a library for management of PostScript resources, on- +disk files representing PostScript data structures such as fonts, font encod- +ings, procsets, etc. It is closely related to the makepsres tool (see client- +side tools (section 2.2, page 1) later in this document). + +The basic DPS client library is libdps. This library contains a number of +functions for connection establishment, resource management, as well as stubs +for all standard PostScript operators. Normally, all DPS clients should link +with libdps; in addition, libdps may be used for printing by non-DPS clients +(this is done, for example, by Sun's JDK). This library is documented in +[CLRM] and [CLSX]. + +The libdpstk library contains a number of additional utilities for managing +DPS contexts, user paths and user objects, and for previewing EPS files. It +is documented in [DPTX]. + +The libdpstkXm library contains four Motif widgets. The DPS Scrolling Widget +is a DPS drawing area that automatically manages issues such as scrolling, +scaling, client-side backing store, incremental redisplay, etc. The Font +Selection Box, and its associated Font Preview, present a convenient and pow- +erful interface for choosing scalable fonts. Finally, the Color Picker pre- +sents an interface for choosing colours using either of the RGB or HSV +spaces. The latter three widgets are documented in [DPTX]; some summary +Scrolling Widget documentation is available in the doc subdirectory of the +DPS.tar.gz file, available from . + +The source code for libdpstkXm is included with XFree86; however, as it +depends on Motif, this library is not built by default. A GTK-based library +providing some of the functionality of libdpstkXm is available from the +gtkDPS site . + +2.1.1 Libdps and Xt + +In X11R5, libdps did not depend on libXt. In X11R6, however, code was added +to make the Xt main loop dispatch to sundry code on DPS events; with this +addition, all programs that link with libdps need to link with libXt, whether +they use Xt or not. + +This state of affairs is unfortunately true of the version of libdps included +with XFree86. We are currently considering various solutions to this problem +(including the use of weak linker symbols or splitting off the guilty func- +tions into a separate library). + +2.2 Client-side tools + +In addition to the libraries, the client side of DPS consists of two utili- +ties. + +The makepsres utility is used for managing PostScript resources. Its basic +operation consists in walking recursively a filesystem tree, noting all +resources, and then writing out a ``Unix PostScript Resources,'' file, basi- +cally a directory of all the resources found. This utility is documented in +the makepsres(1) manual page. + +The pswrap utility is a stub generator for PostScript clients. Roughly +speaking, it takes as its input textual PostScript code, and generates a col- +lection of C functions that transmit that code in pre-tokenised form to the +DPS extension. Pswrap is documented in [PSWRAP]. + +2.3 Sample clients + +XFree86 contains three sample DPS clients, dpsinfo, dpsexec and texteroids. +They are documented in their respective manual pages. + +A number of sample clients that depend on Motif are available in +. Additional sample +clients can be found as part of GtkDPS (see above). + +The GNUstep environment can be compiled to use DPS for all rendering; for +more information, please see the GNUstep site . + +3. The DPS server side + +In order to use DPS clients, you need to install a DPS server side, which can +be either a server extension (a ``DPS/X extension''), or a separate process +(referred to, variously, either as a ``DPS/NX agent'' or, rather confusingly, +as ``Client-Side DPS'' (CSDPS). + +3.1 Display Ghostscript + +Display Ghostscript (note the capitalisation), or DGS, is a client-side +implementation of DPS based on the Ghostscript PostScript interpreter. DGS +is still in beta at the time of writing; it does, however, provide a very +usable implementation of DPS, although it still has some problems with the +semantics of multiple DPS contexts. + +DGS is available from the GNUstep download area +. + +3.2 The DPS extension + +The DPS extension is a much younger project aiming at producing an efficient +server-side implementation of DPS. The extension is currently in a state +best described as alpha; current versions are known to crash the X server +under some circumstances. + +The DPS extension is available from the DPS extension site +. + +4. References + +Links to electronic versions of all of these, and more, are available from +the DPS extension site . + +[PLRM2] PostScript language reference manual. Adobe Systems, 2nd ed. Addison- +Wesley, 1990. ISBN 0-201-18127-4. + +[PLRM] PostScript language reference. Adobe Systems Incorporated, 3rd ed. +Addison-Wesley, 1999. ISBN 0-201-37922-8. + +[INTRO] Display PostScript System. Introduction: Perspective for Software +Developers. 15 April 1993. + +[CLRM] Display PostScript System. Client Library Reference Manual. 15 April +1993. + +[CLSX] Display PostScript System. Client Library Supplement for X. 15 April +1993. + +[DPTX] Display PostScript System. Display PostScript Toolkit for X. 15 April +1993. + +[PSWRAP] Display PostScript System. pswrap Reference Manual. 15 April 1993. + + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml,v 1.1 2001/03/02 02:45:37 dawes Exp $ + + +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.dps,v 1.2.2.1 2001/06/01 18:26:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.fonts diff -u xc/programs/Xserver/hw/xfree86/doc/README.fonts:1.15.2.2 xc/programs/Xserver/hw/xfree86/doc/README.fonts:1.16.2.1 --- xc/programs/Xserver/hw/xfree86/doc/README.fonts:1.15.2.2 Tue Mar 13 12:19:29 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.fonts Fri Jun 1 14:26:45 2001 @@ -1010,7 +1010,7 @@ world, often provide interesting information about character set issues; my favourite is RFC 373. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.11.2.1 2001/02/28 20:06:21 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.13 2001/03/01 00:37:09 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.15.2.2 2001/03/13 17:19:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.fonts,v 1.16.2.1 2001/06/01 18:26:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.i740 diff -u xc/programs/Xserver/hw/xfree86/doc/README.i740:1.8.2.1 xc/programs/Xserver/hw/xfree86/doc/README.i740:1.8.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.i740:1.8.2.1 Tue Mar 13 12:19:29 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.i740 Fri Jun 1 14:26:45 2001 @@ -178,4 +178,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i740.sgml,v 1.3 2000/03/04 00:26:30 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i740,v 1.8.2.1 2001/03/13 17:19:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i740,v 1.8.4.1 2001/06/01 18:26:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.i810 diff -u xc/programs/Xserver/hw/xfree86/doc/README.i810:1.5.2.1 xc/programs/Xserver/hw/xfree86/doc/README.i810:1.6.2.1 --- xc/programs/Xserver/hw/xfree86/doc/README.i810:1.5.2.1 Tue Mar 13 12:19:29 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.i810 Fri Jun 1 14:26:45 2001 @@ -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 @@ 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.2.1 2001/03/13 17:19:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.i810,v 1.6.2.1 2001/06/01 18:26:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.isc diff -u xc/programs/Xserver/hw/xfree86/doc/README.isc:3.39.2.1 xc/programs/Xserver/hw/xfree86/doc/README.isc:3.39.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.isc:3.39.2.1 Tue Mar 13 12:19:29 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.isc Fri Jun 1 14:26:45 2001 @@ -489,4 +489,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/isc.sgml,v 3.24 2000/03/06 22:59:25 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.isc,v 3.39.2.1 2001/03/13 17:19:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.isc,v 3.39.4.1 2001/06/01 18:26:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.mouse diff -u xc/programs/Xserver/hw/xfree86/doc/README.mouse:1.11.2.1 xc/programs/Xserver/hw/xfree86/doc/README.mouse:1.11.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.mouse:1.11.2.1 Tue Mar 13 12:19:29 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.mouse Fri Jun 1 14:26:45 2001 @@ -6,7 +6,7 @@ 1. Introduction -This document describes mouse support in XFree86 4.0.3. +This document describes mouse support in XFree86 4.1.0. Mouse configuration has often been mysterious task for novice users. How- ever, once you learn several basics, it is straightforward to write the mouse @@ -928,4 +928,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/mouse.sgml,v 1.11 2000/03/01 00:25:23 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.mouse,v 1.11.2.1 2001/03/13 17:19:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.mouse,v 1.11.4.1 2001/06/01 18:26:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.newport diff -u xc/programs/Xserver/hw/xfree86/doc/README.newport:1.2.2.1 xc/programs/Xserver/hw/xfree86/doc/README.newport:1.2.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.newport:1.2.2.1 Tue Mar 13 12:19:29 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.newport Fri Jun 1 14:26:45 2001 @@ -41,4 +41,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/newport.sgml,v 1.2 2000/12/12 18:54:29 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.newport,v 1.2.2.1 2001/03/13 17:19:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.newport,v 1.2.4.1 2001/06/01 18:26:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.r128 diff -u xc/programs/Xserver/hw/xfree86/doc/README.r128:1.13.2.1 xc/programs/Xserver/hw/xfree86/doc/README.r128:1.13.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.r128:1.13.2.1 Tue Mar 13 12:19:29 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.r128 Fri Jun 1 14:26:45 2001 @@ -119,4 +119,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/r128.sgml,v 1.8 2000/06/14 00:16:09 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.r128,v 1.13.2.1 2001/03/13 17:19:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.r128,v 1.13.4.1 2001/06/01 18:26:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.rapidaccess diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/README.rapidaccess:1.1 --- /dev/null Mon Jun 4 12:40:36 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.rapidaccess Fri May 18 19:35:32 2001 @@ -0,0 +1,48 @@ +The IBM Rapid Access keyboard have some extra buttons +on it to launch programs, control a cd-player and so on. + +These buttons is not functional when the computer is turned +on but have to be activated by sending the codes 0xea 0x71 +to it. + +I've written the following hack to send codes to the keyboard: + +-------------------------------------------------------------- +/* gcc -O2 -s -Wall -osend_to_keyboard send_to_keyboard.c */ +#include +#include +#include + +int main( int argc, char *argv[] ) +{ + int i; + + ioperm( 0x60, 3, 1 ); + + for( i = 1; i < argc; i++ ) { + int x = strtol( argv[i], 0, 16 ); + + usleep( 300 ); + outb( x, 0x60 ); + } + + return 0; +} +-------------------------------------------------------------- + +As root you can then call this program (in your boot scripts) +as "send_to_keyboard ea 71" to turn on the extra buttons. + +It's not a good idea to run several instances of this program +at the same time. It is a hack but it works. If you try to +send other codes to the keyboard it probably will lock up. +For other codes see: + +http://www.win.tue.nl/~aeb/linux/kbd/scancodes-2.html#ss2.22 + +-- +Dennis Björklund + + + +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.rapidaccess,v 1.1 2001/05/18 23:35:32 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.rendition diff -u xc/programs/Xserver/hw/xfree86/doc/README.rendition:1.12.2.1 xc/programs/Xserver/hw/xfree86/doc/README.rendition:1.12.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.rendition:1.12.2.1 Tue Mar 13 12:19:29 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.rendition Fri Jun 1 14:26:45 2001 @@ -145,4 +145,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/rendition.sgml,v 1.12 2000/06/17 02:30:33 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.rendition,v 1.12.2.1 2001/03/13 17:19:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.rendition,v 1.12.4.1 2001/06/01 18:26:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.s3virge diff -u xc/programs/Xserver/hw/xfree86/doc/README.s3virge:1.6.2.1 xc/programs/Xserver/hw/xfree86/doc/README.s3virge:1.6.4.1 --- xc/programs/Xserver/hw/xfree86/doc/README.s3virge:1.6.2.1 Tue Mar 13 12:19:29 2001 +++ xc/programs/Xserver/hw/xfree86/doc/README.s3virge Fri Jun 1 14:26:45 2001 @@ -6,7 +6,7 @@ 1. Supported hardware -The s3virge driver in XFree86 4.0.3 supports the S3 ViRGE, ViRGE DX, GX, MX, +The s3virge driver in XFree86 4.1.0 supports the S3 ViRGE, ViRGE DX, GX, MX, MX+, and VX chipsets. A majority of testing is done on ViRGE DX chips, mak- ing them the most stable to date. This release has improved support for ViRGE GX2 stability, XVideo support for ViRGE DX (tested) and ViRGE @@ -63,4 +63,4 @@ Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/s3virge.sgml,v 1.3 2000/11/28 20:59:17 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.s3virge,v 1.6.2.1 2001/03/13 17:19:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.s3virge,v 1.6.4.1 2001/06/01 18:26:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/README.trident diff -u xc/programs/Xserver/hw/xfree86/doc/README.trident:3.38 xc/programs/Xserver/hw/xfree86/doc/README.trident:removed --- xc/programs/Xserver/hw/xfree86/doc/README.trident:3.38 Tue Feb 29 20:48:28 2000 +++ xc/programs/Xserver/hw/xfree86/doc/README.trident Mon Jun 4 12:40:36 2001 @@ -1,180 +0,0 @@ - Information for Trident Chipset Users - - The XFree86 Project, Inc. - - June 25 1999 - -1. Supported chipsets - -The Trident driver has undergone some slight work for XFree86 3.3.3. Because -of this work, all of the Trident SVGA chipsets, except the very first one, -are supported by both the color and monochrome servers. - - 8800CS 8200LX 8900B 8900C 8900CL/D 9000 9000i 9100B 9200CXr 9320LCD - 9400CXi 9420 9420DGi 9430DGi 9440AGi 9660XGi 9680 ProVidia9682 Pro- - Vidia9685 Cyber9382 Cyber9385 Cyber9385-1 Cyber9388 Cyber9397 - Cyber9520 Cyber9525 3DImage975(PCI) 3DImage975(AGP) 3DImage985(AGP) - Blade3D CyberBlade - -It must be noted that the 9000i chipset is treated as a 9000 by the server. -Additionally the 9100B is treated as a Trident 8900CL. Therefore it is equiv- -alent to putting `Chipset "tvga8900cl"' or `Chipset "tvga9000"' in the -XF86Config file. Also, note that the 9000i, 9100B have not been tested with -the server, but should work in this way according to the chipset documenta- -tion. - - NOTES: - - o The chipset keyword changed in XFree86 v3.3.2 and now you no longer - specify 'tgui96xx' as the generic keyword, but you actually specify your - chip. i.e. Chipset 'tgui9685' will set a ProVidia9685 chip. - - o The Cyber9388/9397, 3DImage975 and 3DImage985 cards are fixed in - XFree86 v3.3.3, these chipsets have some acceleration now too. This - acceleration has been disabled by default for the Cyber9388/9397 because - there have been problems, but it can be re-enabled with the "accel" - option (see below). - - o 24bpp is all drivers remains unaccelerated, this will change in a - future version, although 32bpp acceleration is supported for all TGUI - based chipset except the 9440 which doesn't have the capability. - - o 16bpp is now supported for the Cyber9320 chipset. - - Option "nolinear" - Turn off linear mapping - - Option "linear" - Force linear mapping. Use this if you have a non-PCI card - and require 16bpp support. Note: ISA cards can only access - up to 16MB of memory, so be sure you have less than this or - it could cause a system hang. - - MemBase 0x??????? - This option may be used to specify the start address of the - linear frame buffer. By default for VLBus/EISA cards it is - at 60MB. For the 8900CL/D, it is at 15MB. - - Option "no_mmio" - This option turns off Memory Mapped IO support. MMIO is - enabled by default when acceleration is enabled. Accelera- - tion doesn't work well when MMIO is disabled. - - Option "tgui_pci_read_on" - Turn on PCI burst read mode. - - Option "tgui_pci_write_on" - Turn on PCI burst write mode. - - Option "pci_burst_on" - Turn on PCI burst (read and write) - - Option "pci_burst_off" - Turn off PCI burst (read and write) - - NOTE: PCI burst modes are now OFF by default for TGUI9440 - cards because it often upsets its Graphics Accelerator. It - can be turned it back on as may improve performance. PCI - burst modes are ON by default for all other PCI/AGP cards. - - ClockChip "tgui" - Turn on programmable clocks. This is the default for TGUIs. - - Option "no_program_clocks" - Turn off programmable clock. Use fixed VGA clocks only. - Useful for fixed frequency monitors - usually used for VGA - monitors - not SVGA. - - Option "noaccel" - Turn off XAA acceleration. - - Option "accel" - Enable acceleration for the Cyber9388/9397. - - Option "xaa_no_color_exp" - Disable color expansion. - - Option "no_stretch" - Disable LCD stretching on Cyber 938x based chips. - - Option "lcd_center" - Enable LCD centering on Cyber 938x based chips. - - Option "cyber_shadow" - Enable Shadow registers, might be needed for some Cyber - chipsets. (laptop machines) - - Option "tgui_mclk_66" - Pushes the Memory Clock from its default value to 66MHz. - Increases graphics speed dramatically, but use entirely at - your own risk, as it may damage the video card. If snow - appears, disable. Only tested on the 9440. - -The original Trident chipset, 8800BR, cannot be supported as an SVGA chipset -by either the color or monochrome servers. The chip is supported, however, -by the ``generic'' driver for the monochrome server. - -2. Special considerations for 512k boards - -There are no longer any special considerations for 512k Trident boards. The -driver is now configured so that they can use modes with normal timings. The -available pixel clocks are halved compared with those specified on the Clocks -line - -Be aware that older Trident chipsets support a maximum clock of 65Mhz. Hence -the best actual clock available to the color server is 32.5Mhz. This means, -in broad terms, that the color server will require an interlaced mode to be -defined for resolutions above 640x480. Newer chipsets (8900CL, 9000, 9000i, -9100B, 9200CX and 9420) support up to 16 clocks, and can support much higher -clocks, which will allow 800x600 modes, non-interlaced. - -3. Additional Notes - -We have had reports of the server failing to detect the amount of installed -memory and the correct dot-clocks on older TVGA8900 boards. If the server -fails to detect the correct amount of memory, use the "Videoram" keyword in -your XF86Config file to specify it. (e.g. Videoram 512 or Videoram 1024). -If the server has problems detecting the dot-clocks, try adding the following -line to your XF86Config file: - - Clocks 25 28 45 36 57 65 50 40 - -This line gives the clock values provided by older Trident clock synthesizer -chipsets. This also appears to be the standard first 8 clocks for the newer -clock synthesizers, but you should have no problems on newer boards. - -Some newer Trident 8900B/C boards are apparently being built with the clock -synthesizers used on the 9000 and 8900CL boards. If your board has a chip -labeled "Trident TCK900x" ("x" has been seen as 2 or 4; there may be others), -your board may actually have a 4th clock select bit. The 9002 has twelve -distinct clocks (the other 4 are duplicates); the 9004 has 16 clocks (the -same 12 as the 9002 + 4 others). If you see such a chip on a board with an -8900B or 8900C, put the following line in the Device section of your XF86Con- -fig file: - - Option "16clocks" - -This will cause the same clock selection code as is used for the 8900CL to be -used for the board. - -While developing the Trident driver, an interesting and perturbing hardware -phenomenon was discovered. When using the default board jumper configura- -tion, dot-clocks above 57Mhz would frequently lock up the machine. There -appear to be jumpers on all of the Trident boards that determine whether the -board will operate in zero-wait-state mode on the ISA bus. Disabling the -zero-wait-state mode via jumpers cured the lockups, but at the expense of -performance. Whether or not a given system will experience this problem is -likely a combination of (a) bus speed, (b) video memory speed, and (c) dot -clock speed. So be prepared for this phenomenon to occur, and have the board -documentation handy. - -NOTE: VLBus cards are also subject to the above. By specifying the Clocks in -the XF86Config file, these lockups are overcome. But it may be worth checking -wait states etc. on the card and in the BIOS setup. - - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/trident.sgml,v 3.24 1999/08/23 06:38:54 dawes Exp $ - - $XConsortium: trident.sgml /main/11 1996/10/28 04:24:08 kaleb $ - - -$XFree86: xc/programs/Xserver/hw/xfree86/doc/README.trident,v 3.38 2000/03/01 01:48:28 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/RELNOTES diff -u xc/programs/Xserver/hw/xfree86/doc/RELNOTES:3.96.2.3 xc/programs/Xserver/hw/xfree86/doc/RELNOTES:3.97.2.2 --- xc/programs/Xserver/hw/xfree86/doc/RELNOTES:3.96.2.3 Fri Mar 16 11:01:14 2001 +++ xc/programs/Xserver/hw/xfree86/doc/RELNOTES Sat Jun 2 00:44:36 2001 @@ -1,23 +1,23 @@ - Release Notes for XFree86[tm] 4.0.3 + Release Notes for XFree86[tm] 4.1.0 The XFree86 Project, Inc - 16 March 2001 + 17 December 2000 Abstract This document contains some information about the features present - in XFree86 4.0.3 and their status. + in XFree86 4.1.0 and their status. 1. Introduction to the 4.x Release Series -XFree86 4.0 was the first official release of the new XFree86 4 series. -XFree86 4.0.3 is the first update to 4.0.2, which is the latest full release -in that series. XFree86 4 represents a significant redesign of the XFree86 X -server. Not all of the hardware drivers from 3.3.x have been ported to 4.x -yet, but conversely, 4.x has some hardware support not present in 3.3.x. Our -Driver Status document summarizes how the hardware driver support compares -between 3.3.6 and 4.0.3. Please check there first before downloading 4.0.3. +XFree86 4.0 was the first official release of the new XFree86 4 series. The +current release (4.1.0) is the latest in that series. XFree86 4 represents a +significant redesign of the XFree86 X server. Not all of the hardware +drivers from 3.3.x have been ported to 4.x yet, but conversely, 4.x has some +hardware support not present in 3.3.x. Our Driver Status document summarizes +how the hardware driver support compares between 3.3.6 and 4.1.0. Please +check there first before downloading 4.1.0. The 4.0.1 release introduced a new graphical configuration tool, "xf86cfg", and a text mode interface was added to it for the 4.0.2 release. It is work @@ -28,7 +28,7 @@ for some hardware. To try it out, just run (as root) "XFree86 -configure". Each of these configuration options will give you a reasonable starting point for a suitable configuration file. We've put some effort into documenting -the 4.0.3 config file format, and you can find that information in the +the 4.1.0 config file format, and you can find that information in the XF86Config manual page. Check that, the driver manual pages and the related documentation for further information. @@ -37,83 +37,18 @@ save you some time and help you figure out which of the binary releases you need. -The next sections describe what has changed in the update release(s) as well -as what is new in the latest full release (4.0.2). The other sections below -describe some of the new features and changes between 3.3.x and 4.0. There -are lot's of new features, and we definitely don't have enough space to cover -them all here. - -2. Summary of updates in 4.0.3. - - o Some temporary file-related security vulnerabilities are fixed. - - o Screen corruption problems and palette saving problems with some Neo- - magic chips are fixed. - - o 'XFree86 -configure' problems are fixed in some drivers (including sis - and i810). - - o A problem with some plain S3 ViRGE cards is fixed. - - o Some Xaw incompatibilities with Xaw6 are fixed. - - o Some XKB files are updated. - - o Some trident driver updates, including fixing acceleration for the - Cyber9388. - - o A palette saving problem in the vgahw module is fixed. - - o Support for the wsmouse protocol is added for OpenBSD/i386. - - o A load problem with the sis driver module, and some depth 24 problems - are fixed. - - o Support for the "PD" variant of the ATI Rage 128 is added. - - o Support for GNU Hurd is updated. - - o Some TrueType font problems are fixed. - - o The mga driver doesn't attempt to drive the G450 if the "mga_hal" module - isn't available. - - o A problem with bold font simulation in xterm is fixed. - - o The (DPS) stub files created by pswrap are now compatible with the Adobe - version. - - o Some glint driver problems are fixed. - - o Support for building on OpenBSD-current, and multi-thread support for - OpenBSD are provided. - - o A problem with the ThinkingMousePS/2 protocol is fixed in the mouse - driver. - - o Support for the Render extension with Xinerama is added. - - o A DGA-related server crash is fixed. - - o Some Chips & Technologies driver bugs are fixed. - - o Some tseng driver bugs are fixed. - - o Some Alpha platform updates are included. - - o Support for the GeForce3 is added to the nv driver. - - o Misc build-related issues are fixed. - - o Various documentation updates, including a reworked XFree86(1) manual - page. - -3. Summary of new features in 4.0.2. - -3.1 X server - - o Darwin/Mac OS X is now supported and the X server runs on PowerPC. The - X server for this platform is called "Xdarwin", and its installation and +The next section describes what is new in the latest version (4.1.0). The +other sections below describe some of the new features and changes between +3.3.x and 4.0. There are lot's of new features, and we definitely don't have +enough space to cover them all here. + +2. Summary of new features in 4.1.0. + +2.1 X server + + o Darwin/Mac OS X is now supported on PowerPC and Intel/x86. The X server + runs from the console or in cooperation with the Mac OS X Aqua GUI. The + X server for this platform is called "XDarwin", and its installation and configuration is different from the "XFree86" server used on other plat- forms. Please read the XFree86 on Darwin and Mac OS X document for fur- ther information. @@ -181,7 +116,7 @@ o Big endian problems in Xinerama have been fixed. - o The new "render" extension has been added (see below (section 5.11, page + o The new "render" extension has been added (see below (section 4.11, page 1)). The design has been extended in the following ways: o A new FillRectangles request was added. @@ -300,10 +235,10 @@ some of the bugs in the current options. A protocol for plugging in external modules is also planned. -3.2 X libraries and clients. +2.2 X libraries and clients. o Significant updates to the internationalisation support in Xlib (see - below (section 3.3, page 1)). + below (section 2.3, page 1)). o Some xfs updates, including font path verification, and new options. @@ -311,7 +246,7 @@ o New "xvinfo" client for querying the XVideo extension. -3.3 Fonts and Internationalisation +2.3 Fonts and Internationalisation o Many of the "misc" bdf fonts have been updated and extended, and a wider range of ISO-8859 subsets have been added. These are now auto-generated @@ -340,7 +275,7 @@ o XKB keyboard definitions have been added and updated for some countries. -3.4 Platforms +2.4 Platforms o Darwin/Mac OS X. @@ -351,11 +286,11 @@ o Support has been added for more Alpha platforms under Linux. This now includes all platforms that require sparse memory mapping. -4. Drivers +3. Drivers -4.1 Video Drivers +3.1 Video Drivers -XFree86 4.0.3 includes the following video drivers: +XFree86 4.1.0 includes the following video drivers: +--------------+--------------------------+----------------------------------+ |Driver Name | Description | Further Information | @@ -407,9 +342,9 @@ Darwin/Mac OS X uses IOKit drivers and does not use the module loader drivers listed above. Further information can be found in README.Darwin. -XFree86 4.0.3 includes the following input drivers: +XFree86 4.1.0 includes the following input drivers: -4.2 Input Drivers +3.2 Input Drivers +------------+--------------------+---------------------+ |Driver Name | Description | Further Information | @@ -430,21 +365,21 @@ |wacom | Wacom tablets | wacom(4) | +------------+--------------------+---------------------+ -5. Summary of XFree86 4. +4. Summary of XFree86 4. Unlike XFree86 3.3.x where there are multiple X server binaries, each of -which drive different hardware, XFree86 4.0.3 has a single X server binary +which drive different hardware, XFree86 4.1.0 has a single X server binary called XFree86. This binary can either have one or more video drivers linked in statically, or, more usually, dynamically load the video drivers and other modules that are needed. -XFree86 4.0.3 has X server support for most UNIX(R) and UNIX-like operating +XFree86 4.1.0 has X server support for most UNIX(R) and UNIX-like operating systems on Intel/x86 platforms, plus support for Linux on Alpha, PowerPC, IA-64, Sparc, and Mips platforms, and for Darwin on PowerPC. Work on support for additional architectures and operating systems is in progress, and is planned for future releases. -5.1 Loader and Modules +4.1 Loader and Modules The XFree86 X server has a built-in run-time loader, donated by Metro Link . This loader can load normal object files and @@ -460,7 +395,7 @@ the future we plan to take advantage of this to provide more frequent driver module updates in between major releases. -The loader in version 4.0.3 has support for Intel (x86), Alpha and PowerPC +The loader in version 4.1.0 has support for Intel (x86), Alpha and PowerPC platforms. It also has preliminary support for Sparc platforms. The X server makes use of modules for video drivers, X server extensions, @@ -482,7 +417,7 @@ hope to have a mechanism for signing/verifying the modules that we provide available in a future release. -5.2 Configuration File +4.2 Configuration File The X server configuration file format has been extended to handle some of the new functionality. The xf86config utility can be used to generate a @@ -642,7 +577,7 @@ and /usr/X11R6/etc/X11 being added. The full search path details are docu- mented in the XF86Config manual page. -5.3 Command Line Options +4.3 Command Line Options The following new X server command line options have been added: @@ -753,13 +688,13 @@ This makes it possible for users to choose from multiple config files that the the sysadmin has provided. -5.4 XAA +4.4 XAA The XFree86 Acceleration Architecture (XAA) has been completely rewritten from scratch for XFree86 4.x. Most drivers implement acceleration by making use of the XAA module. -5.5 Multi-head +4.5 Multi-head Some multi-head configurations are supported in XFree86 4.x, primarily with multiple PCI/AGP cards. However, this is an area that is still being worked @@ -775,7 +710,7 @@ which card is the primary card (either by using a different PCI slot, or by changing the system BIOS's preference for the primary card). -5.6 Xinerama +4.6 Xinerama Xinerama is an X server extension that allows multiple physical screens to behave as a single screen. With traditional multi-head in X11, windows can- @@ -797,14 +732,14 @@ an issue that needs to be dealt with in the individual window managers, and isn't specifically an XFree86 problem. -5.7 DGA version 2 +4.7 DGA version 2 -DGA 2.0 is included in 4.0.3, but is not implemented by all drivers. Prelim- +DGA 2.0 is included in 4.1.0, but is not implemented by all drivers. Prelim- inary documentation for the client libraries can be found in the README.DGA document. A good degree of backwards compatibility with version 1.0 is pro- vided. -5.8 DDC +4.8 DDC The VESA(R) Display Data Channel (DDC[tm]) standard allows the monitor to tell the video card (or on some cases the computer directly) about itself; @@ -826,7 +761,7 @@ the X server, or by specifying appropriate screen dimensions with the "Dis- playSize" keyword in the "Monitor" section of the config file. -5.9 GLX and the Direct Rendering Infrastructure (DRI) +4.9 GLX and the Direct Rendering Infrastructure (DRI) Precision Insight (now part of the Pro- fessional Services group at VA Linux Systems ) @@ -847,7 +782,7 @@ drivers can be found at the DRI Project on SourceForge . -5.10 XVideo Extension (Xv) +4.10 XVideo Extension (Xv) The XVideo extension is supported in XFree86 4.x. An XvQueryPortAttributes function has been added as well as support for XvImages. XvImages are XIm- @@ -855,7 +790,7 @@ through shared memory segments. This allows clients to display YUV data with high quality hardware scaling and filtering. -5.11 X Rendering Extension (Render) +4.11 X Rendering Extension (Render) The X Rendering extension provides a 2D rendering model that more closely matches application demands and hardware capabilities. It provides a render- @@ -867,7 +802,7 @@ overlays and other image operations not possible with the core X rendering system. -XFree86 4.0.3 provides a partial implementation of Render sufficient for +XFree86 4.1.0 provides a partial implementation of Render sufficient for drawing anti-aliased text and image composition. Still to be implemented are geometric primitives and affine transformation of images. @@ -877,7 +812,7 @@ access to the available font information while still providing hardware acceleration. The Xft library provides font access for Render applications. -5.11.1 The Xft Library +4.11.1 The Xft Library On the client side, the Xft library provides access to fonts for applications using the FreeType library, version 2. FreeType currently supports Type1 and @@ -890,38 +825,39 @@ To allow a graceful transition for applications moving from core text render- ing to the Render extension, Xft can use either core fonts or FreeType and -the Render extension for text. By default, Xft is configured to support only -core fonts, see the section on building FreeType support for the changes -needed to add FreeType/Render fonts. +the Render extension for text. By default, Xft is configured to support both +core fonts and FreeType fonts using the supplied version of FreeType 2. See +the section on FreeType support in Xft for instructions on configuring +XFree86 to use an existing FreeType installation. The Xft library uses a configuration file, XftConfig, which contains informa- tion about which directories contain font files and also provides a sophisti- cated font aliasing mechanism. Documentation for that file is included in the Xft man page. -5.11.2 Building FreeType support for Xft +4.11.2 FreeType support in Xft -XFree86 4.0.3 includes sources for FreeType version 2.0.1, but they are not -built and installed automatically. As a result, Xft is configured to provide -only core fonts by default. +XFree86 4.1.0 includes sources for FreeType version 2.0.1, and, by default, +they are built and installed automatically. -To build FreeType support for Xft, first FreeType must be built and -installed, either from the sources included in XFree86 in extras/freetype2 or -from another FreeType (version 2.0.1 or later) release. Early FreeType ver- -sion 2 releases used a different header file installation and aren't compati- -ble with XFree86. Instructions for building and installing FreeType can be -found in the INSTALL file included with the FreeType release. +If you prefer, you can configure XFree86 4.1.0 to use an existing Freetype2 +installation by telling XFree86 not to build the internal copy and indicating +where that external version has been installed. Edit (or create) con- +fig/cf/host.def to include: -Second, XFree86 needs to know the installed location for FreeType, usually -/usr/local. Edit (or create) config/cf/host.def to include: + o #define BuildFreetype2Library NO - #define Freetype2Dir /usr/local + o #define Freetype2Dir /usr/local -Finally, build XFree86 with "make World" from the top. +Note that XFree86 assumes you'll be using a release FreeType no older than +version 2.0.1. Early FreeType version 2 releases used a different header +file installation and aren't compatible with XFree86. Instructions for build- +ing and installing FreeType can be found in the INSTALL file included with +the FreeType release. -5.11.3 Application Support For Anti-Aliased Text +4.11.3 Application Support For Anti-Aliased Text -Only three applications have been modified in XFree86 4.0.3 to work with the +Only three applications have been modified in XFree86 4.1.0 to work with the Render extension and the Xft and FreeType libraries to provide anti-aliased text. Xterm, xditview and x11perf. Migration of other applications may occur in future releases. @@ -937,10 +873,10 @@ Xditview will use Xft instead of the core API by default. X11perf includes tests to measure the performance of text rendered in three ways, anti- aliased, anti-aliased with sub-pixel sampling and regular chunky text, but -through the Render extension, a path which has not been optimized within the -X server yet. +through the Render extension, a path which is currently somewhat slower than +core text. -5.12 Other extensions +4.12 Other extensions The XFree86-Misc extension has not been fully ported to the new server archi- tecture yet. This should be completed in a future release. @@ -953,7 +889,7 @@ 3.3.x version of the extension is provided. The missing parts of this exten- sion and some new features should be completed in a future release. -5.13 Xaw +4.13 Xaw Two versions of the Xaw library are provided with XFree86 4.x. A version with bug fixes and a few binary compatible improvements and a new version with @@ -1012,11 +948,11 @@ o Several bugs were fixed in the text code, while some code was rewritten from scratch. -5.14 Xpm +4.14 Xpm Version 3.4k of the Xpm (X pixmap) library is now integrated into XFree86. -5.15 xedit +4.15 xedit Xedit have been changed to use most of the new features added to the new ver- sion of the Xaw library, and some xedit only features were added. Emacs users @@ -1055,18 +991,18 @@ o C-mode: this mode is expected to be stable, and fully usable. -5.16 Font support +4.16 Font support Details about the font support in XFree86 4.x can be found in the README.fonts document. -5.17 TrueType support +4.17 TrueType support XFree86 4.x comes with two TrueType backends, known as `xfsft' (the "freetype" module) and `X-TrueType' (the "xtt" module). Both of these back- ends are based on the FreeType library. -5.18 CID font support +4.18 CID font support Support for CID-keyed fonts is included in XFree86 4.x. The CID-keyed font format was designed by Adobe Systems for fonts @@ -1074,7 +1010,7 @@ by SGI . See the LICENSE document for a copy of the CID Font Code Public License. -5.19 Internationalisation of the scalable font backends +4.19 Internationalisation of the scalable font backends XFree86 4.x has a ``fontenc'' layer to allow the scalable font backends to use a common method of font re-encoding. This re-encoding makes it possible @@ -1083,14 +1019,14 @@ TrueType backend. The `X-TrueType' version of the TrueType backend uses a different re-encoding method based on loadable encoding modules. -5.20 Large font optimisation +4.20 Large font optimisation The glyph metrics array, which all the X clients using a particular font have access to, is now placed in shared memory, so as to reduce redundant memory consumption. For non-local clients, the glyph metrics array is transmitted in a compressed format. -5.21 Unicode/ISO 10646 support +4.21 Unicode/ISO 10646 support What is included in 4.x: @@ -1123,7 +1059,7 @@ o Both the xfsft (the "freetype" module) and the X-TrueType (the "xtt" module) TrueType font backends support Unicode-encoded fonts. -5.22 Lucidux fonts from Bigelow and Holmes +4.22 Lucidux fonts from Bigelow and Holmes XFree86 now includes the ``Lucidux'' family of professionally hinted Type 1 fonts. This family consists of the fonts ``Lucidux Serif'', ``Lucidux Sans'' @@ -1136,7 +1072,7 @@ or , or consult Y&Y's web site . -5.23 Directory rearrangements +4.23 Directory rearrangements Some changes to the installed XFree86 directory structure have been imple- mented for 4.x. One important change is a modified search path for the X @@ -1147,7 +1083,7 @@ located under the appropriate subdirectories of /var, again with the relevant symbolic links in the old location. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.58.2.2 2001/03/16 15:57:44 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.60 2001/03/02 17:40:48 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.96.2.3 2001/03/16 16:01:14 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/RELNOTES,v 3.97.2.2 2001/06/02 04:44:36 torrey Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/Status diff -u xc/programs/Xserver/hw/xfree86/doc/Status:1.21.2.3 xc/programs/Xserver/hw/xfree86/doc/Status:1.23.2.2 --- xc/programs/Xserver/hw/xfree86/doc/Status:1.21.2.3 Fri Mar 16 11:01:14 2001 +++ xc/programs/Xserver/hw/xfree86/doc/Status Fri Jun 1 14:26:45 2001 @@ -1,34 +1,35 @@ - Driver Status for XFree86[tm] 4.0.3 + Driver Status for XFree86[tm] 4.1.0 The XFree86 Project, Inc - 4 December 2000 + 1 June 2001 Abstract This document provides information about the status of the driver - and hardware support in XFree86 4.0.3 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 + and hardware support in XFree86 4.1.0 compared with that in XFree86 + 3.3.6. Please send updates for this document to + . Please do not send requests for information + or support to that address (they will not be answered). 1. Introduction 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.3. It +each chipset family that is supported in XFree86 3.3.6 or XFree86 4.1.0. 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.3. +3.3.6 and 4.1.0. 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 compile time. In other cases, X servers for specific chips (or families of chips) are provided (such as XF86_AGX, XF86_Mach64, etc.). -In XFree86 4.0.3, there is only one X server, called "XFree86", which can +In XFree86 4.1.0, there is only one X server, called "XFree86", which can load driver modules at runtime. Thus there is no specific mention of a -server binary when 4.0.3 is discussed; only the XFree86 server is used. +server binary when 4.1.0 is discussed; only the XFree86 server is used. Third-party vendors (often the manufacturers of various video chipsets) may provide their own drivers for the XFree86 server, but these third-party mod- ules are beyond the scope of this document. @@ -44,7 +45,7 @@ Support (including acceleration) for Voodoo Banshee and Voodoo3 cards is provided by the XF86_SVGA server with the tdfx driver. - 4.0.3: + 4.1.0: Support for Voodoo Graphics and Voodoo 2 chips is available on platforms where Glide is available (Linux and FreeBSD(?)) and is provided by the "glide" driver (requires version 2.x of the Glide @@ -54,7 +55,7 @@ Voodoo4, and Voodoo5 is provided by the "tdfx" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.0.3. + All hardware supported in 3.3.6 is also supported in 4.1.0. 3. 3Dlabs @@ -64,14 +65,14 @@ ramdacs), Permedia with IBM RGB526 RAMDAC, and Permedia 2, 2a, 2v is provided by the XF86_3DLabs server. - 4.0.3: + 4.1.0: Support (including acceleration) for Permedia, Permedia 2, 2v, (and 2a?), Permedia 3, GLINT 500TX, GLINT MX, GLINT Gamma, and GLINT Delta coproc is provided by the "glint" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.0.3. The - Permedia 3 is only supported in 4.0.3. + All hardware supported in 3.3.6 is also supported in 4.1.0. The + Permedia 3 is only supported in 4.1.0. 4. Alliance @@ -79,14 +80,14 @@ Support (including acceleration) for the AT24, AP6422, AT3D. Support is provided by the XF86_SVGA server with the apm driver. - 4.0.3: + 4.1.0: Support (including acceleration?) for the AT24, AT25 and AT3D. This support is provided by the "apm" driver. This driver cur- rently has only incomplete support for the AP6422. Summary: - The AP6422 is supported in 3.3.6 but not fully in 4.0.3. The - AT25 is supported in 4.0.3 but not in 3.3.6. + The AP6422 is supported in 3.3.6 but not fully in 4.1.0. The + AT25 is supported in 4.1.0 but not in 3.3.6. 5. ARK Logic @@ -95,12 +96,12 @@ and ARK2000MT. Support is provided by the XF86_SVGA server with the ark driver. - 4.0.3: + 4.1.0: Support (including acceleration) for the ARK1000PV, ARK2000PV, and ARK2000MT. Support is provided by the "ark" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.0.3. + All hardware supported in 3.3.6 is also supported in 4.1.0. 6. ATI @@ -118,17 +119,17 @@ driver. Accelerated support is provided for the Rage 128 chips by the XF86_SVGA server with the r128 driver. - 4.0.3: + 4.1.0: Accelerated support is provided for Mach64, Rage, Rage 128 and Radeon chips. Unaccelerated support is provided for all of the others except the Mach8 and some early Mach32 chips by the "ati" driver. Summary: - All chips supported in 3.3.6 are supported in 4.0.3 except for - Mach8 and some old Mach32 chips. The support in 4.0.3 is, how- - ever, unaccelerated for all chips except the Mach64, Rage and - Rage 128 variants. + All chips supported in 3.3.6 are supported in 4.1.0 except for + Mach8 and some old Mach32 chips. The support in 4.1.0 is, how- + ever, unaccelerated for all chips except the Mach64, Rage, Rage + 128 and Radeon variants. 7. Avance Logic @@ -139,12 +140,12 @@ the others. These drivers reportedly work, but they have no maintainer. - 4.0.3: + 4.1.0: No native support for these chipsets, because the old drivers have not been ported. Summary: - No Avance Logic chips are supported in 4.0.3. + No Avance Logic chips are supported in 4.1.0. 8. Chips and Technologies @@ -154,13 +155,13 @@ 64300. This support is provided by the XF86_SVGA server with the chips driver. - 4.0.3: + 4.1.0: Support (accelerated) for the 65520, 65525, 65530, 65535, 65540, 65545, 65546, 65548, 65550, 65554, 65555, 68554, 69000, 64200 and 64300. This support is provided by the "chips" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.0.3. + All hardware supported in 3.3.6 is also supported in 4.1.0. 9. Cirrus Logic @@ -172,13 +173,13 @@ 7541, 7542, 7543, 7548, 7555 and 7556 is provided by the XF86_SVGA server with the cirrus driver. - 4.0.3: + 4.1.0: Support (accelerated) for the Alpine (5430, 5434, 5436, 5446, 5480, 7548), and Laguna (5462, 5464, 5465) chips is provided by the "cirrus" driver. Summary: - The following chips are supported in 3.3.6 but not in 4.0.3: + The following chips are supported in 3.3.6 but not in 4.1.0: 6410, 6412, 6420, 6440, 5420, 5422, 5424, 5426, 5428, 5429, 6205, 6215, 6225, 6235, 7541, 7542, 7543, 7555 and 7556. @@ -194,7 +195,7 @@ 24 plane 3D chips (on Alpha platforms) is provided by the XF86_TGA server. - 4.0.3: + 4.1.0: No support for the Compaq AVGA (driver hasn't been ported). Support (accelerated) for the DEC 21030 TGA 8 plane, 24 plane and @@ -202,8 +203,8 @@ the "tga" driver. Summary: - No Compaq AVGA support in 4.0.3. DEC TGA support is equivalent - in both 3.3.6 and 4.0.3. + No Compaq AVGA support in 4.1.0. DEC TGA support is equivalent + in both 3.3.6 and 4.1.0. 11. Cyrix @@ -211,12 +212,12 @@ Support (accelerated) for the Cyrix MediaGX is provided by the XF86_SVGA server with the cyrix driver. - 4.0.3: - The 3.3.6 driver has been ported to 4.0.3, including accelera- + 4.1.0: + The 3.3.6 driver has been ported to 4.1.0, including accelera- tion, but feedback is needed. Summary: - Cyrix MediaGX users are encouraged to test its support in 4.0.3. + Cyrix MediaGX users are encouraged to test its support in 4.1.0. 12. Epson @@ -224,12 +225,12 @@ Support (accelerated) for the Epson SPC8110 is provided by the XF86_SVGA server with the spc8100 driver. - 4.0.3: + 4.1.0: No native support for this chipset, because the old driver has not been ported. Summary: - No Epson chips are supported in 4.0.3. + No Epson chips are supported in 4.1.0. 13. Genoa @@ -239,12 +240,12 @@ because we don't have any recent test reports, and this driver has no maintainer. - 4.0.3: + 4.1.0: No native support for this chipset, because the old driver has not been ported. Summary: - No Genoa chips are supported in 4.0.3. + No Genoa chips are supported in 4.1.0. 14. IBM @@ -259,7 +260,7 @@ Support for the IBM XGA-2 chip is provided by the XF86_AGX server. - 4.0.3: + 4.1.0: Support for the standard IBM VGA chip (and compatibles) is pro- vided by the "vga" driver. @@ -268,7 +269,7 @@ Summary: The standard VGA core is supported in both versions, but there is - no support for the 8514/A or XGA-2 in 4.0.3. + no support for the 8514/A or XGA-2 in 4.1.0. 15. IIT @@ -276,12 +277,12 @@ Support (accelerated) for the AGX-016, AGX-015 and AGX-014 is provided by the XF86_AGX server. - 4.0.3: + 4.1.0: No native support for these chipsets, because the old driver has not been ported. Summary: - No IIT chips are supported in 4.0.3. + No IIT chips are supported in 4.1.0. 16. Integrated Micro Solutions (IMS) @@ -289,12 +290,12 @@ Support (accelerated) for the IMS Twin Turbo 128 is provided by the XF86_SVGA server with the imstt driver. - 4.0.3: + 4.1.0: Support (accelerated) for the IMS Twin Turbo 128 is provided by the "imstt" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.0.3. + All hardware supported in 3.3.6 is also supported in 4.1.0. 17. Intel @@ -305,15 +306,17 @@ Linux, and requires the agpgart.o kernel module in order to use modes that require more than 1MB of video memory. - 4.0.3: + 4.1.0: 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 @@ -322,13 +325,13 @@ (Mystique), MGA2164W (Millennium II) (PCI and AGP), G100, G200 and G400 is provided by the XF86_SVGA server with the mga driver. - 4.0.3: + 4.1.0: Support (accelerated) for the MGA2064W (Millennium I), MGA1064SG (Mystique), MGA2164W (Millennium II) (PCI and AGP), G100, G200 and G400 is provided by the "mga" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.0.3. + All hardware supported in 3.3.6 is also supported in 4.1.0. 19. MX (???) @@ -338,12 +341,12 @@ is unknown because we don't have any recent test reports, and this driver has no maintainer. - 4.0.3: + 4.1.0: No native support for this chipset, because the old driver has not been ported. Summary: - No MX (???) chips are supported in 4.0.3. + No MX (???) chips are supported in 4.1.0. 20. NCR @@ -352,12 +355,12 @@ XF86_SVGA server and the ncr77c22 driver. The status of this support is unknown because we don't have any recent test reports. - 4.0.3: + 4.1.0: No native support for this chipset, because the old driver has not been ported. Summary: - No NCR chips are supported in 4.0.3. + No NCR chips are supported in 4.1.0. 21. NeoMagic @@ -366,14 +369,14 @@ NM2097, NM2160 and NM2200 chipsets is provided by the XF86_SVGA server with the neo driver. - 4.0.3: + 4.1.0: Support (accelerated) for the NeoMagic NM2070, NM2090, NM2093, NM2097, NM2160, NM2200, NM2230, NM2360 and NM2380 chipsets is provided by the "neomagic" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.0.3. The - NM2230 and later chips are only supported in 4.0.3. + All hardware supported in 3.3.6 is also supported in 4.1.0. The + NM2230 and later chips are only supported in 4.1.0. 22. NVIDIA @@ -382,15 +385,15 @@ (Ultra, Vanta, M64), GeForce (DDR, 256) and Quadro is provided by the XF86_SVGA server and the nv driver. - 4.0.3: + 4.1.0: Support (accelerated) for the Riva 128, 128ZX, TNT, TNT2 (Ultra, Vanta, M64), GeForce (DDR, 256), GeForce2 (GTS, Ultra, MX), - Quadro, Quadro2, and GeForce3 is provided by the "nv" driver. + Quadro, and Quadro2 is provided by the "nv" driver. Summary: All chipsets supported in 3.3.6 except the NV1 are also supported - in 4.0.3. Support for the newer chips (GeForce2 and later) is - only available in 4.0.3. + in 4.1.0. Support for the newer chips (GeForce2 and later) is + only available in 4.1.0. 23. Number Nine @@ -398,12 +401,12 @@ Support (accelerated) for the Imagine 128, Ticket 2 Ride, Revolu- tion 3D and Revolution IV is provided by the XF86_I128 server. - 4.0.3: + 4.1.0: Support (accelerated) for the Imagine 128, Ticket 2 Ride, Revolu- tion 3D and Revolution IV is provided by the "i128" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.0.3. + All hardware supported in 3.3.6 is also supported in 4.1.0. 24. Oak Technologies, Inc. @@ -412,12 +415,12 @@ acceleration) is provided by the XF86_SVGA server and the oak driver. - 4.0.3: + 4.1.0: No native support for these chipsets, because the old driver has not been ported. Summary: - No Oak chips are supported in 4.0.3. + No Oak chips are supported in 4.1.0. 25. Paradise/Western Digital @@ -428,12 +431,12 @@ port for some of these chipsets is uncertain because we don't have any recent test reports, and this driver has no maintainer. - 4.0.3: + 4.1.0: No native support for these chipsets, because the old driver has not been ported. Summary: - No Paradise/Western Digital chips are supported in 4.0.3. + No Paradise/Western Digital chips are supported in 4.1.0. 26. RealTek @@ -443,12 +446,12 @@ unknown because we don't have any recent test reports, and this driver has no maintainer. - 4.0.3: + 4.1.0: No native support for these chipsets, because the old driver has not been ported. Summary: - No RealTek chips are supported in 4.0.3. + No RealTek chips are supported in 4.1.0. 27. Rendition/Micron @@ -456,12 +459,12 @@ Support for the Verite 1000, 2100 and 2200 is provided by the XF86_SVGA server with the rendition driver. - 4.0.3: + 4.1.0: Support for the Verite 1000, 2100 and 2200 is provided by the "rendition" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.0.3. + All hardware supported in 3.3.6 is also supported in 4.1.0. 28. S3 @@ -478,7 +481,7 @@ age2000, is provided by the XF86_SVGA server with the s3_savage driver on some OSes (Linux, *BSD). - 4.0.3: + 4.1.0: Support (accelerated) for the ViRGE, ViRGE/VX, ViRGE/DX, ViRGE/GX, ViRGE/GX2, ViRGE/MX, ViRGE/MX+, Trio3D and Trio3D/2X is provided by the "s3virge" driver. Support (accelerated) for the @@ -488,19 +491,19 @@ Summary: Only the ViRGE, Trio3D and Savage chipsets are supported in - 4.0.3. All of the other chipsets are only supported in 3.3.6. + 4.1.0. All of the other chipsets are only supported in 3.3.6. 29. Silicon Graphics, Inc. (SGI) 3.3.6: No SGI hardware is supported in 3.3.6. - 4.0.3: + 4.1.0: Unaccelerated support for the SGI Indy's Newport cards is pro- vided by the "newport" driver. Summary: - SGI hardware is supported only in 4.0.3. + SGI hardware is supported only in 4.1.0. 30. Silicon Integrated Systems (SiS) @@ -509,7 +512,7 @@ 86C225, 5597, 5598, 6326, 530, 620, 300, 630 and 540 is provided by the XF86_SVGA server with the sis driver. - 4.0.3: + 4.1.0: Support (accelerated) for the SiS 530, 620, 6326 is provided by the "sis" driver. The 630, 300, and 540 are also supported, but this code is new and there are @@ -526,20 +529,20 @@ LynxEM+ and Lynx3DM chips is provided by the XF86_SVGA server with the smi driver. - 4.0.3: + 4.1.0: Support (accelerated) for the Lynx, LynxE, Lynx3D, LynxEM, LynxEM+ and Lynx3DM chips is provided by the "siliconmotion" driver. Summary: - All hardware supported in 3.3.6 is also supported in 4.0.3. + All hardware supported in 3.3.6 is also supported in 4.1.0. 32. Sun Microsystems 3.3.6: No Sun hardware is supported in 3.3.6. - 4.0.3: + 4.1.0: Sun BW2 framebuffers are supported by the "sunbw2" driver. Sun CG3 framebuffers are supported by the "suncg3" driver. Sun CG6 framebuffers are supported by the "suncg6" driver. Sun CG14 @@ -549,7 +552,7 @@ framebuffers are supported by the "suntcx" driver. Summary: - Sun hardware is supported only in 4.0.3. + Sun hardware is supported only in 4.1.0. 33. Trident Microsystems @@ -564,7 +567,7 @@ CyberBlade/DSTN/i7 and CyberBlade/i1 is provided by the XF86_SVGA server with the tvga8900 driver. - 4.0.3: + 4.1.0: Support (accelerated where the chip supports it) for the TVGA8900D, TGUI9440AGi, TGUI9660, TGUI9680, ProVidia 9682, Pro- Vidia 9685, Cyber9320, Cyber9382, Cyber9385, Cyber9388, @@ -576,10 +579,10 @@ Summary: The following (older) chipsets that are supported in 3.3.6 are - not supported in 4.0.3: TVGA8200LX, TVGA8800CS, TVGA8900B, + not supported in 4.1.0: TVGA8200LX, TVGA8800CS, TVGA8900B, TVGA8900C, TVGA8900CL, TVGA9000, TVGA9000i, TVGA9100B, TVGA9200CXr, TGUI9400CXi, TGUI9420, TGUI9430DGi. The remaining - listed chipsets are supported in 4.0.3. + listed chipsets are supported in 4.1.0. 34. Tseng Labs @@ -591,13 +594,13 @@ driver. Support (accelerated) for the ET4000/W32 series and the ET6000 is also provided by the deprecated XF86_W32 server. - 4.0.3: + 4.1.0: Support for the ET4000AX, and accelerated support for the ET4000/W32, ET4000/W32i, ET4000/W32p, ET6000 and ET6100 is pro- vided by the "tseng" driver. Summary: - All cards supported by 3.3.6 are also supported by 4.0.3 except + All cards supported by 3.3.6 are also supported by 4.1.0 except for the old ET3000. 35. Video 7 @@ -608,12 +611,12 @@ unknown because we don't have any recent test reports, and this driver has no maintainer. - 4.0.3: + 4.1.0: No native support for these chipsets, because the old driver has not been ported. Summary: - No Video 7 chips are supported in 4.0.3. + No Video 7 chips are supported in 4.1.0. 36. Weitek @@ -622,14 +625,14 @@ server and accelerated support for the P9100 is provided by the XF86_SVGA server with the p9x00 driver. - 4.0.3: + 4.1.0: No native support for these chipsets, because the old drivers have not been ported. Summary: - No Weitek chips are supported in 4.0.3. + No Weitek chips are supported in 4.1.0. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.26.2.3 2001/03/16 15:57:44 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.29.2.2 2001/06/01 18:09:49 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.21.2.3 2001/03/16 16:01:14 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Status,v 1.23.2.2 2001/06/01 18:26:45 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/Versions diff -u xc/programs/Xserver/hw/xfree86/doc/Versions:1.1.2.2 xc/programs/Xserver/hw/xfree86/doc/Versions:1.1.4.1 --- xc/programs/Xserver/hw/xfree86/doc/Versions:1.1.2.2 Fri Mar 16 09:57:21 2001 +++ xc/programs/Xserver/hw/xfree86/doc/Versions Fri Jun 1 14:26:46 2001 @@ -295,7 +295,7 @@ VendorRelease set to M * 10000000 + m * 100000 + P * 1000 + s. Note: 4.0.3 and any other 4.0.x releases will continue with the Mmnn scheme. - Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml,v 1.1.2.1 2001/03/16 14:55:41 dawes Exp $ + Generated from XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml,v 1.1 2001/02/07 18:49:31 dawes Exp $ -$XFree86: xc/programs/Xserver/hw/xfree86/doc/Versions,v 1.1.2.2 2001/03/16 14:57:21 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/Versions,v 1.1.4.1 2001/06/01 18:26:46 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/doc/modeDB.txt diff -u xc/programs/Xserver/hw/xfree86/doc/modeDB.txt:3.8 xc/programs/Xserver/hw/xfree86/doc/modeDB.txt:3.9 --- xc/programs/Xserver/hw/xfree86/doc/modeDB.txt:3.8 Sat Dec 20 09:20:57 1997 +++ xc/programs/Xserver/hw/xfree86/doc/modeDB.txt Sat Jan 6 15:58:02 2001 @@ -1,4 +1,4 @@ -# $XFree86: xc/programs/Xserver/hw/xfree86/doc/modeDB.txt,v 3.8 1997/12/20 14:20:57 hohndel Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/doc/modeDB.txt,v 3.9 2001/01/06 20:58:02 tsi Exp $ # # # @@ -157,7 +157,7 @@ ############################################################################### # Card: ATI VGAWonder series -# Contributor: Marc Aurele La France [tsi@ualberta.ca] +# Contributor: Marc Aurele La France [tsi@xfree86.org] # Last Edit Date: 1994.06.07 # # See file README.ati for clock information for these cards. Index: xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man diff -u xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man:3.6 xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man:3.8 --- xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man:3.6 Sun Nov 16 01:42:12 1997 +++ xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man Wed Feb 7 17:35:22 2001 @@ -1,18 +1,18 @@ .\" Copyright (c) 1996 The XFree86 Project -.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man,v 3.6 1997/11/16 06:42:12 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86DGA.man,v 3.8 2001/02/07 22:35:22 tsi Exp $ .\" $TOG: XF86DGA.man /main/9 1997/11/11 12:08:52 kaleb $ .\" .de ZN .ie t \fB\^\\$1\^\fR\\$2 .el \fI\^\\$1\^\fP\\$2 .. -.TH XF86DGA 3X11 "3.3.1+ (X11R6.4)" "XFree86" "X FUNCTIONS" +.TH XF86DGA 3X11 __vendorversion__ "X FUNCTIONS" .SH NAME XF86DGAQueryExtension, XF86DGAQueryVersion, XF86DGAQueryDirectVideo, XF86DGAGetVideo, XF86DGADirectVideo, XF86DGASetVidPage, XF86DGASetViewPort, XF86DGAViewPortChanged, XF86DGAGetViewPortSize, XF86DGAInstallColormap, XF86DGAForkApp \- XFree86-DGA extension interface functions .SH SYNTAX .nf .LP -#include +\&#include .LP Bool XF86DGAQueryExtension( Display *\fIdisplay\fP\^, Index: xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man diff -u xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man:3.9 xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man:3.11 --- xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man:3.9 Sat Apr 4 21:28:41 1998 +++ xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man Wed Feb 7 17:35:22 2001 @@ -4,18 +4,18 @@ .\" .\" Copyright (c) 1996 Joe Moss, The XFree86 Project .\" -.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man,v 3.9 1998/04/05 02:28:41 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86Misc.man,v 3.11 2001/02/07 22:35:22 tsi Exp $ .de ZN .ie t \fB\^\\$1\^\fR\\$2 .el \fI\^\\$1\^\fP\\$2 .. -.TH XF86MISC 3X11 "3.3.1+ (X11R6.4)" "XFree86" "X FUNCTIONS" +.TH XF86MISC 3X11 __vendorversion__ "X FUNCTIONS" .SH NAME XF86MiscQueryExtension, XF86MiscQueryVersion, XF86MiscGetMouseSettings, XF86MiscSetMouseSettings, XF86MiscGetKbdSettings, XF86MiscSetKbdSettings \- XFree86-Misc extension interface functions .SH SYNTAX .nf .LP -#include +\&#include .LP Bool XF86MiscQueryExtension( Display *\fIdisplay\fP\^, Index: xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man diff -u xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man:3.8 xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man:3.10 --- xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man:3.8 Sat Apr 4 21:28:41 1998 +++ xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man Wed Feb 7 17:35:22 2001 @@ -4,19 +4,19 @@ .\" .\" .\" Copyright (c) 1996 Joe Moss, The XFree86 Project -.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man,v 3.8 1998/04/05 02:28:41 dawes Exp $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/doc/man/XF86VM.man,v 3.10 2001/02/07 22:35:22 tsi Exp $ .\" .de ZN .ie t \fB\^\\$1\^\fR\\$2 .el \fI\^\\$1\^\fP\\$2 .. -.TH XF86VIDMODE 3X11 "3.3.1+ (X11R6.4)" "XFree86" "X FUNCTIONS" +.TH XF86VIDMODE 3X11 __vendorversion__ "X FUNCTIONS" .SH NAME XF86VidModeQueryExtension, XF86VidModeQueryVersion, XF86VidModeGetModeLine, XF86VidModeGetAllModeLines, XF86VidModeDeleteModeLine, XF86VidModeModModeLine, XF86VidModeValidateModeLine, XF86VidModeSwitchMode, XF86VidModeSwitchToMode, XF86VidModeLockModeSwitch, XF86VidModeGetMonitor, XF86VidModeGetViewPort, XF86VidModeSetViewPort \- XFree86-VidMode extension interface functions .SH SYNTAX .nf .LP -#include +\&#include .LP Bool XF86VidModeQueryExtension( Display *\fIdisplay\fP\^, Index: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml:1.39.2.1 xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml:1.44 --- xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml:1.39.2.1 Thu Feb 8 14:31:03 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml Fri May 18 20:40:30 2001 @@ -27,7 +27,7 @@ XFree86 X server ``New Design'' (DRAFT) <author>The XFree86 Project, Inc -<date>Last modified 2 December 2000 +<date>Last modified 1 May 2001 @@ -36,7 +36,7 @@ <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.39.2.1 2001/02/08 19:31:03 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DESIGN.sgml,v 1.44 2001/05/19 00:40:30 dawes Exp $ </ident> @@ -2561,7 +2561,7 @@ </quote> - &s.code;OptionInfoPtr xf86TokenToOptinfo(OptionInfoPtr table, int token)&e.code; + &s.code;OptionInfoPtr xf86TokenToOptinfo(const OptionInfoRec *table, int token)&e.code; <quote><p> Returns a pointer to the &s.code;OptionInfoRec&e.code; in &s.code;table&e.code; with a token field matching @@ -2570,7 +2570,7 @@ </quote> - &s.code;Bool xf86IsOptionSet(OptionInfoPtr table, int token)&e.code; + &s.code;Bool xf86IsOptionSet(const OptionInfoRec *table, int token)&e.code; <quote><p> Returns the &s.code;found&e.code; field of the &s.code;OptionInfoRec&e.code; in &s.code;table&e.code; with a @@ -2582,7 +2582,7 @@ </quote> - &s.code;char *xf86GetOptValString(OptionInfoPtr table, int token)&e.code; + &s.code;char *xf86GetOptValString(const OptionInfoRec *table, int token)&e.code; <quote><p> Returns the &s.code;value.str&e.code; field of the &s.code;OptionInfoRec&e.code; in &s.code;table&e.code; with a @@ -2591,7 +2591,7 @@ </quote> - &s.code;Bool xf86GetOptValInteger(OptionInfoPtr table, int token, + &s.code;Bool xf86GetOptValInteger(const OptionInfoRec *table, int token, &f.indent;int *value)&e.code; <quote><p> Returns via &s.code;*value&e.code; the &s.code;value.num&e.code; @@ -2604,7 +2604,7 @@ </quote> - &s.code;Bool xf86GetOptValULong(OptionInfoPtr table, int token, + &s.code;Bool xf86GetOptValULong(const OptionInfoRec *table, int token, &f.indent;unsigned long *value)&e.code; <quote><p> Like &s.code;xf86GetOptValInteger()&e.code;, except the value is @@ -2612,7 +2612,7 @@ </quote> - &s.code;Bool xf86GetOptValReal(OptionInfoPtr table, int token, + &s.code;Bool xf86GetOptValReal(const OptionInfoRec *table, int token, &f.indent;double *value)&e.code; <quote><p> Like &s.code;xf86GetOptValInteger()&e.code;, except that @@ -2620,7 +2620,7 @@ </quote> - &s.code;Bool xf86GetOptValFreq(OptionInfoPtr table, int token, + &s.code;Bool xf86GetOptValFreq(const OptionInfoRec *table, int token, &f.indent;OptFreqUnits expectedUnits, double *value)&e.code; <quote><p> Like &s.code;xf86GetOptValInteger()&e.code;, except that the @@ -2636,7 +2636,7 @@ </quote> - &s.code;Bool xf86GetOptValBool(OptionInfoPtr table, int token, Bool *value)&e.code; + &s.code;Bool xf86GetOptValBool(const OptionInfoRec *table, int token, Bool *value)&e.code; <quote><p> This function is used to check boolean options (&s.code;OPTV_BOOLEAN&e.code;). If the function return value is @@ -2654,7 +2654,7 @@ </quote> - &s.code;Bool xf86ReturnOptValBool(OptionInfoPtr table, int token, Bool def)&e.code; + &s.code;Bool xf86ReturnOptValBool(const OptionInfoRec *table, int token, Bool def)&e.code; <quote><p> This function is used to check boolean options (&s.code;OPTV_BOOLEAN&e.code;). If the option is set, its value @@ -5774,7 +5774,15 @@ &s.code;hwp&e.code; with the standard VGA set of functions. This is called by &s.code;vgaHWGetHWRec()&e.code;, so there is usually no need to call this explicitly. The register access functions - are described below. + are described below. If the registers are shadowed in some other + port I/O space (for example a PCI I/O region), these functions + can be used to access the shadowed registers if + &s.code;hwp->PIOOffset&e.code; is initialised with + &s.code;offset&e.code;, calculated in such a way that when the + standard VGA I/O port value is added to it the correct offset into + the PIO area results. This value is initialised to zero in + &s.code;vgaHWGetHWRec()&e.code;. (Note: the PIOOffset functionality + is present in XFree86 4.1.0 and later.) </quote> @@ -5861,6 +5869,20 @@ </quote> + &s.code;void vgaHWEnable(vgaHWPtr hwp)&e.code; + <quote><p> + This function enables the VGA subsystem. (Note, this function is + present in XFree86 4.1.0 and later.). + + </quote> + + &s.code;void vgaHWDisable(vgaHWPtr hwp)&e.code; + <quote><p> + This function disables the VGA subsystem. (Note, this function is + present in XFree86 4.1.0 and later.). + + </quote> + &s.code;void vgaHWSave(ScrnInfoPtr pScrn, vgaRegPtr save, int flags)&e.code; <quote><p> This function saves the VGA state. The state is written to the @@ -6188,6 +6210,20 @@ Return the value read from the DAC Data register. </quote> + + &s.code;CARD8 readEnable(vgaHWptr hwp)&e.code; + <quote><p> + Return the value read from the VGA Enable register. (Note: This + function is present in XFree86 4.1.0 and later.) + + </quote> + + &s.code;void writeEnable(vgaHWPtr hwp, CARD8 value)&e.code; + <quote><p> + Write &s.code;value&e.code; to the VGA Enable register. (Note: This + function is present in XFree86 4.1.0 and later.) + + </quote> </quote> <sect>Some notes about writing a driver<label id="sample"> @@ -6409,6 +6445,7 @@ Bool noAccel; Bool hwCursor; CloseScreenProcPtr CloseScreen; + OptionInfoPtr Options; ... } ZZZRec, *ZZZPtr; </code> @@ -6425,15 +6462,13 @@ OPTION_NOACCEL } ZZZOpts; -static OptionInfoRec ZZZOptions[] = { +static const OptionInfoRec ZZZOptions[] = { { OPTION_FOO_HACK, "FooHack", OPTV_INTEGER, {0}, FALSE }, { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; - -#define nZZZOptions (sizeof(ZZZOptions) / sizeof(ZZZOptions[0])) </code> <p> </itemize> @@ -6721,8 +6756,6 @@ static Bool ZZZPreInit(ScrnInfoPtr pScrn, int flags) { - OptionInfoRec options[nZZZOptions]; - /* Fill in the monitor field */ pScrn->monitor = pScrn->confScreen->monitor; @@ -6801,10 +6834,14 @@ /* * Process the options based on the information in ZZZOptions. - * The results are written to options. + * The results are written to pZzz->Options. If all of the options + * processing is done within this function a local variable "options" + * can be used instead of pZzz->Options. */ - (void)memcpy(options, ZZZOptions, sizeof(ZZZOptions)); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); + if (!(pZzz->Options = xalloc(sizeof(ZZZOptions)))) + return FALSE; + (void)memcpy(pZzz->Options, ZZZOptions, sizeof(ZZZOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pZzz->Options); /* * Set various fields of ScrnInfoRec and/or ZZZRec based on @@ -6812,25 +6849,25 @@ */ from = X_DEFAULT; pZzz->hwCursor = FALSE; - if (xf86IsOptionSet(options, OPTION_HW_CURSOR)) { + if (xf86IsOptionSet(pZzz->Options, OPTION_HW_CURSOR)) { from = X_CONFIG; pZzz->hwCursor = TRUE; } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pZzz->hwCursor ? "HW" : "SW"); - if (xf86IsOptionSet(options, OPTION_NOACCEL)) { + if (xf86IsOptionSet(pZzz->Options, OPTION_NOACCEL)) { pZzz->noAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } else { pZzz->noAccel = FALSE; } - if (xf86IsOptionSet(options, OPTION_PCI_RETRY)) { + if (xf86IsOptionSet(pZzz->Options, OPTION_PCI_RETRY)) { pZzz->UsePCIRetry = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry enabled\n"); } pZzz->fooHack = 0; - if (xf86GetOptValInteger(options, OPTION_FOO_HACK, + if (xf86GetOptValInteger(pZzz->Options, OPTION_FOO_HACK, &pZzz->fooHack)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Foo Hack set to %d\n", pZzz->fooHack); Index: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml:1.15 xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml:1.24 --- xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml:1.15 Tue Dec 12 13:54:29 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml Fri May 18 20:42:22 2001 @@ -3,19 +3,17 @@ ]> <!-- Created: Mon Feb 28 13:00:00 2000 by brianp@valinux.com --> -<!-- Revised: Fri May 19 09:41:48 2000 by martin@valinux.com --> -<!-- Revised: Tue Aug 22 14:00:00 2000 by brianp@valinux.com --> +<!-- Revised: Sat Jan 6 09:44:18 2001 by martin@valinux.com --> <article> + <title>DRI User Guide + <author> + <htmlurl url="http://www.valinux.com/" + name="VA Linux Systems, Inc."> Professional Services - Graphics. + <date>3 May 2001 - <title>DRI User Guide - <author> - <htmlurl url="http://www.valinux.com/" - name="VA Linux Systems, Inc."> Professional Services - Graphics. - <date>20 November 2000 - <ident> - $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.15 2000/12/12 18:54:29 dawes Exp $ + $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRI.sgml,v 1.24 2001/05/19 00:42:22 dawes Exp $ </ident> <toc> @@ -24,7 +22,7 @@ <p> <sect1>Copyright <p> - <bf>Copyright © 2000 by VA Linux Systems, Inc. + <bf>Copyright © 2000-2001 by VA Linux Systems, Inc. All Rights Reserved.</bf> <p> <bf>Permission is granted to make and distribute verbatim copies @@ -45,7 +43,8 @@ 3dfx, Voodoo3, Voodoo4, and Voodoo5 are registered trademarks of 3dfx Interactive, Incorporated. Matrox is a registered trademark of Matrox Electronic Systems Ltd. - ATI Rage is a registered trademark of ATI Technologies, Inc. + ATI Rage and Radeon are registered trademarks of ATI Technologies, + Inc. All other trademarks mentioned are the property of their respective owners. @@ -75,57 +74,40 @@ to brianp@valinux.com. <sect>Supported Architectures & Hardware - <p> - <sect1>Architectures - <p> - The Architectures currently supported by the DRI have grown - from the initial Intel i386 based machines to now include, - the Alpha Processor and the Sun SPARC machines. - - The build environment for both of these new architectures - have a pre-build environment that will correctly build the - DRI drivers and Mesa meaning no extra configuration is necessary - to build the DRI for these architectures. - - <sect2>Alpha Features - <p> - On newer Alpha processors, it should be noted that a - significant performance increase can be seen with the - addition of the -mcpu= command that should be passed to - GCC upon compilation. Dependent of the architecture of the - processor, for example -mcpu=ev6 will build specifically - for the EV6 based AXP's, giving both byte and word alignment - access to the DRI/Mesa drivers. - - Use this as an example of compiling with this extra speed. - In your host.def file that should reside in the xc/config - directory, add the line. - - #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 - - Additional speed improvements to 3D rendering can be achieved - by installing Compaq's Math Libraries (CPML) which can be - obtained from the following URL. - - http://www.support.compaq.com/alpha-tools/software/index.html - - Once installed, you can set this option in your host.def - to build against the CPML libraries. - - #define UseCompaqMathLibrary YES +<p> + <sect1>CPU Architectures +<p> + The architectures currently supported by the DRI have grown + from the initial Intel i386 systems to now include the Alpha + Processor and the Sun SPARC machines. + + Intel's SSE (a.k.a. Katmai) instructions are used in optimized + vertex transformation functions in Mesa-based drivers. + This requires a recent Linux kernel both at compile and runtime. + See the DRI Compile Guide for compile-time requirements. + At runtime a check is made to determine if the CPU can execute + SSE instructions. They're disabled otherwise. + + AMD's 3DNow! instructions are also used in optimized vertex + transformation functions in the Mesa-based DRI drivers. + 3DNow! is supported in most versions of Linux. + Like the SSE optimizations, a runtime check is made to determine + if the CPU can execute 3DNow! instructions. + + Alpha-based systems can use Compaq's optimized math library for + improved 3D performance. See the DRI Compilation Guide for + details. <sect1> Graphics Hardware - <p> +<p> XFree86 4.0 (or later versions) includes 3D acceleration for the following graphics hardware: - NOTE: This is a complete list of graphics hardware supported. It - may not be supported on your platform. - <itemize> - <item>3dfx: + <item>3dfx, supported on Intel x86, AMD and Alpha: <itemize> <item>Voodoo5 5500 + <item>Voodoo4 4500 <item>Voodoo3 3500 TV <item>Voodoo3 3000 AGP <item>Voodoo3 3000 PCI @@ -136,34 +118,46 @@ </itemize> There are many configurations of 3dfx cards on the market. Not all have been tested. - <item>Matrox: + <item>Matrox, supported on Intel x86 and AMD: <itemize> <item>Matrox G200 <item>Matrox G400 </itemize> - <item>Intel i810 + <item>Intel i810 (motherboard chipset) <itemize> <item>i810 <item>i810-dc100 <item>i810e + </itemize> + <item>ATI Rage 128, supported on Intel x86 and AMD: + <itemize> + <item>Rage Fury + <item>Rage Magnum + <item>XPERT 2000 + <item>XPERT 128 + <item>XPERT 99 + <item>All-in-Wonder 128 + </itemize> + Note that both PCI and AGP versions of Rage 128 based cards + are supported at this time. + <item>ATI Radeon, supported on Intel x86 and AMD: + <itemize> + <item>Radeon SDR AGP + <item>Radeon DDR AGP </itemize> - <item>ATI Rage 128 + <item>3Dlabs, supported on Intel x86 and AMD: <itemize> - <item>Rage Fury AGP - <item>Rage Magnum AGP - <item>XPERT 2000 AGP - <item>XPERT 128 AGP - <item>XPERT 99 AGP - <item>All-in-Wonder 128 AGP + <item>Oxygen GMX 2000 (MX/Gamma based). + Note: this driver is no longer being actively developed. </itemize> - The PCI versions of these cards also have minimal support. - Note that there are also Rage 128 Pro based boards on the - market, and these are not yet supported. - <item>3Dlabs Oxygen GMX 2000 (MX/Gamma based) </itemize> <p> Support for other hardware is underway. + Most of the DRI development work is funded by contracts with IHVs. + These contracts often prevent us from announcing drivers before + they're released. + Queries about upcoming drivers may not be answerable. <p> @@ -181,7 +175,7 @@ <sect>Kernel Modules - <p> +<p> 3D hardware acceleration requires a DRI kernel module that's specific to your graphics hardware. <P> @@ -210,7 +204,7 @@ exists. <sect>XF86Config file - <p> +<p> The XFree86 configuration file is usually found in <tt>/etc/X11/XF86Config</tt>. This section describes the parts which must be specially set for @@ -230,9 +224,13 @@ Next, the DRI section can be used to restrict access to direct rendering. + A client can only use direct rendering if it has permission to + open the <tt>/dev/dri/card?</tt> file(s). + The permissions on these DRI device files is controlled by the "DRI" + section in the XF86Config file. <p> If you want all of the users on your system to be able to use - direct-rendering, then use a simple DRI section: + direct-rendering, then use a simple DRI section like this: <verb> Section "DRI" Mode 0666 @@ -385,17 +383,17 @@ Among the output you should see something like this: <p> <verb> - OpenGL vendor string: Precision Insight, Inc. + OpenGL vendor string: VA Linux Systems, Inc. OpenGL renderer string: Mesa DRI Voodoo3 20000224 - OpenGL version string: 1.2 Mesa 3.3 beta + OpenGL version string: 1.2 Mesa 3.4 </verb> <p> or this: <p> <verb> - OpenGL vendor string: Precision Insight, Inc. + OpenGL vendor string: VA Linux Systems, Inc. OpenGL renderer string: Mesa GLX Indirect - OpenGL version string: 1.2 Mesa 3.3 beta + OpenGL version string: 1.2 Mesa 3.4 </verb> <p> The first example indicates that the 3dfx driver is using @@ -455,9 +453,71 @@ <sect>General Trouble Shooting <p> This section contains information to help you diagnose general - problems. - See below for additional information for specific hardware. + problems. + See below for additional information for specific hardware. + + <sect1>Bus Mastering +<p> + DMA-based DRI drivers (that's most DRI drivers) cannot function + unless bus mastering is enabled for your graphics card. + By default, some systems don't having bus mastering on. + You should enable it in your BIOS. + <p> + Alternately, you can check the status of bus mastering and change + the setting from within Linux. There may be similar procedures for + other operating systems. + <p> + Run <tt>lspci</tt> (as root) and find the information + describing your graphics adapter. For example: + <P> + <verb> + 00:00.0 Host bridge: Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge (rev 03) + 00:01.0 PCI bridge: Intel Corporation 440BX/ZX - 82443BX/ZX AGP bridge (rev 03) + 00:07.0 ISA bridge: Intel Corporation 82371AB PIIX4 ISA (rev 02) + 00:07.1 IDE interface: Intel Corporation 82371AB PIIX4 IDE (rev 01) + 00:07.2 USB Controller: Intel Corporation 82371AB PIIX4 USB (rev 01) + 00:07.3 Bridge: Intel Corporation 82371AB PIIX4 ACPI (rev 02) + 00:11.0 Ethernet controller: Intel Corporation 82557 [Ethernet Pro 100] (rev 08) + 00:12.0 SCSI storage controller: Symbios Logic Inc. (formerly NCR) 53c895 (rev 02) + 00:14.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 08) + 01:00.0 VGA compatible controller: 3Dfx Interactive, Inc.: Unknown device 0009 (rev 01) + </verb> + <p> + The bus, device, and function number comprise the device id, + which is conventionally written in the form bus:dev.func, or + in this case 01:00.0. + <p> + Use the <tt>setpci</tt> command to examine bit two of register 4 for + your graphics card. This will indicate whether or not bus mastering + is enabled. + <p> + <verb> + setpci -s 01:00.0 4.w + </verb> + <p> + A hexadecimal value will be printed. Convert the least significant + digit to binary. For example, if you see 3, that's 0011 in binary + (bit two is 0). If you see 7, that's 0111 in binary (bit two is 1). + In the first example, bus mastering is disabled. It's enabled in + the second example. + <p> + The following shell script will enabled bus mastering for your + graphics card and host bridge. Run it as root. + <verb> + #!/bin/bash + dev=01:00.0 # change as appropriate + echo Enabling bus mastering on device $dev + setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4))) + dev=00:00.0 + echo Enabling bus mastering on host bridge $dev + setpci -s $dev 4.w=$(printf %x $((0x$(setpci -s $dev 4.w)|4))) + </verb> + <p> + You can check if this worked by running the first setpci command again. + <p> + + <sect1>The X Server <p> <enum> @@ -615,26 +675,39 @@ This section presents hardware-specific information for normal use and troubleshooting. - <sect1>3dfx Voodoo3 Series + <sect1>3dfx Banshee, Voodoo3, Voodoo4 and Voodoo5 Series <p> - <sect2>Dependencies + <sect2>Requirements <p> - The Voodoo3 DRI driver requires a special versions of - the 3dfx Glide library. - It can be downloaded from the DRI website. + The 3dfx DRI driver requires special versions of the 3dfx Glide + library. + Different versions of Glide are needed for Banshee/Voodoo3 than + for Voodoo4/5. + The Glide libraries can be downloaded from the DRI website. <p> <sect2>Configuration <p> Your XF86Config file's device section must specify the - <tt>tdfx</tt> device: + <tt>tdfx</tt> device. For example: <verb> Section "Device" Identifier "Voodoo3" VendorName "3dfx" Driver "tdfx" EndSection + </verb> +<p> + Or, +<p> + <verb> + Section "Device" + Identifier "Voodoo5" + VendorName "3dfx" + Driver "tdfx" + EndSection </verb> - The Screen section should then reference the Voodoo3 device: + + The Screen section should then reference the Voodoo device: <verb> Section "Screen" Identifier "Screen 1" @@ -648,15 +721,46 @@ EndSubsection EndSection </verb> + + Or, +<p> + + <verb> + Section "Screen" + Identifier "Screen 1" + Device "Voodoo5" + Monitor "High Res Monitor" + DefaultDepth 24 + Subsection "Display" + Depth 16 + Modes "1280x1024" "1024x768" "800x600" "640x480" + ViewPort 0 0 + EndSubsection + Subsection "Display" + Depth 24 + Modes "1280x1024" "1024x768" "800x600" "640x480" + ViewPort 0 0 + EndSubsection + EndSection + </verb> + <p> - The kernel module for the Voodoo3 is named <tt>tdfx.o</tt> and + The kernel module for 3dfx hardware is named <tt>tdfx.o</tt> and should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. It will be automatically loaded by the Xserver if needed. <p> - The DRI 3D driver for the Voodoo3 should be in + The DRI 3D driver for 3dfx hardware should be in <tt>/usr/X11R6/lib/modules/dri/tdfx_dri.so</tt>. This will be automatically loaded by libGL.so. <p> + The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. + When running in 32bpp mode an 8-bit stencil buffer and 24-bit + Z (depth) buffer are offered. + When running in 16bpp mode only a 16-bit Z (depth) buffer is + offered and stencil is implemented in software. + <p> + A software-based accumulation buffer is available in both + 16 and 32bpp modes. <sect2>Troubleshooting <p> @@ -670,27 +774,41 @@ it means that you have the wrong version of the Glide library for your hardware. <item> - 3D acceleration for Voodoo3 is only supported in the 16 - bit/pixel screen mode. + 3D acceleration for Banshee and Voodoo3 is only supported in + the 16 bit/pixel screen mode. Use <tt/xdpyinfo/ to verify that all your visuals are depth 16. Edit your XF86Config file if needed. - <item> + <item> The <tt>/dev/3dfx</tt> device is not used for DRI; it's only for Glide on older 3dfx hardware. + <item> + Different versions of Glide are needed for Voodoo3 and Voodoo5. + See the DRI website's resources page to download the right + version of Glide. + <item> + Voodoo4/5 may be run at 24bpp (instead of 32bpp, the default) + but 3D acceleration is not supported in that mode. + 32bpp mode is fully 3D accelerated. </itemize> - <sect2>Performance + <sect2>Performance and Features <p> <itemize> <item> Normally, buffer swapping in double-buffered applications is synchronized to your monitor's refresh rate. - This may be overridden by setting the <tt/FX_GLIDE_SWAPINTERNVAL/ + This may be overridden by setting the <tt/FX_GLIDE_SWAPINTERVAL/ environment variable. The value of this variable indicates the maximum number of swap buffer commands can be buffered. Zero allows maximum frame rate. <item> + On Voodoo4/5, rendering with 16-bits/texel textures is faster + than using 32-bit per texel textures. + The <tt/internalFormat/ parameter to <tt/glTexImage2D/ can be + used to control texel size. + Quake3 and other games let you control this as well. + <item> The <tt/glTexEnv/ mode <tt/GL_BLEND/ is not directly supported by the Voodoo3 hardware. It can be accomplished with a multipass algorithm but it's not @@ -734,110 +852,7 @@ <item> Using <tt/glColorMask(r, g, b, a)/ when r!=g or g!=b. </itemize> - </itemize> - - <sect2>Known Problems -<p> - <itemize> - <item> - The Glide library cannot be used directly; it's only meant to - be used via the tdfx DRI driver. - <item> - SSystem has problems because of poorly set near and far - clipping planes. - The office.unc Performer model also suffers from this problem. - <item> - The lowest mipmap level is sometimes miscolored in trilinear- - sampled polygons. - </itemize> - - - <sect1>3dfx Voodoo5 Series -<p> - <sect2>Dependencies -<p> - The Voodoo5 DRI driver requires a special versions of - the 3dfx Glide library, different than that used for Voodoo3 - hardware. - It can be downloaded from the DRI website. -<p> - <sect2>Configuration -<p> - Your XF86Config file's device section must specify the - <tt>tdfx</tt> device: - <verb> - Section "Device" - Identifier "Voodoo5" - VendorName "3dfx" - Driver "tdfx" - EndSection - </verb> - The Screen section should then reference the Voodoo3 device: - <verb> - Section "Screen" - Identifier "Screen 1" - Device "Voodoo5" - Monitor "High Res Monitor" - DefaultDepth 24 - Subsection "Display" - Depth 16 - Modes "1280x1024" "1024x768" "800x600" "640x480" - ViewPort 0 0 - EndSubsection - Subsection "Display" - Depth 24 - Modes "1280x1024" "1024x768" "800x600" "640x480" - ViewPort 0 0 - EndSubsection - EndSection - </verb> - <p> - The kernel module for the Voodoo5 is named <tt>tdfx.o</tt> and - should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. - It will be automatically loaded by the Xserver if needed. - <p> - The DRI 3D driver for the Voodoo5 should be in - <tt>/usr/X11R6/lib/modules/dri/tdfx_dri.so</tt>. - This will be automatically loaded by libGL.so. - <p> - The Voodoo5 supports 3D rendering in 16 and 32 bpp modes. - When running in 32bpp mode an 8-bit stencil buffer and 24-bit - Z (depth) buffer are offered. - When running in 16bpp mode only a 16-bit Z (depth) buffer is - offered and stencil is implemented in software. - <p> - A software-based accumulation buffer is available in both - 16 and 32bpp modes. - <p> - - <sect2>Troubleshooting -<p> - <itemize> - <item> - The <tt>/dev/3dfx</tt> device is not used for DRI; it's only for - Glide on older 3dfx hardware. - <item> - Different versions of Glide are needed for Voodoo3 and Voodoo5. - See the DRI website's resources page to download the right - version of Glide. - </itemize> - - <sect2>Performance -<p> - <itemize> <item> - Normally, buffer swapping in double-buffered applications is - synchronized to your monitor's refresh rate. - This may be overridden by setting the <tt/FX_GLIDE_SWAPINTERNVAL/ - environment variable. - The value of this variable indicates the maximum number of - swap buffer commands can be buffered. - Zero allows maximum frame rate. - <item> - Rendering with 16-bit per texel textures is faster than using - 32-bit per texel textures. The <tt/internalFormat/ parameter - to <tt/glTexImage2D/ can be used to control texel size. - <item> The Voodoo5 driver reverts to software rendering under the same conditions Voodoo3 with three exceptions. First, stencil operations are implemented in hardware when the @@ -846,38 +861,54 @@ hardware. Third, <tt/glColorMask/ is fully supported in hardware when the screen is configured for 32 bits/pixel. + <item> + As of January, 2001 the second VSA-100 chip on the Voodoo5 is + not yet operational. + Therefore, the board isn't being used to its full capacity. + The second VSA-100 chip will allow Scan-Line Interleave (SLI) + mode for full-screen applications and games, potentially doubling + the system's fill rate. + When the second VSA-100 chip is activated + glGetString(GL_RENDERER) will report Voodoo5 instead of Voodoo4. + <item> + The lowest mipmap level is sometimes miscolored in trilinear- + sampled polygons. + <item> + The GL_EXT_texture_env_combine extension is supported on the + Voodoo4 and Voodoo5. </itemize> + <sect2>Known Problems <p> <itemize> <item> + The lowest mipmap level is sometimes miscolored in trilinear- + sampled polygons (Voodoo3/Banshee). + <item> + Fog doesn't work with orthographic projections. + <item> + The accuracy of blending operations on Voodoo4/5 isn't always + very good. + If you run Glean, you'll find some test failures. + <item> The Glide library cannot be used directly; it's only meant to be used via the tdfx DRI driver. - <item> - 24bpp screen modes are supported by the hardware but not by - the current driver. 32bpp is fully supported. <item> - As of October, 2000 the second VSA-100 chip on the Voodoo5 is - not yet operational. - Therefore, the board isn't being used to its full capacity. - The second VSA-100 chip will allow Scan-Line Interleave (SLI) - mode for full-screen applications and games, potentially doubling - the system's fill rate. + SSystem has problems because of poorly set near and far + clipping planes. + The office.unc Performer model also suffers from this problem. </itemize> <sect1>Intel i810 - <p> - <sect2>Dependencies - <p> - A Linux kernel with AGP GART support is required. - The 2.2.x kernel series does not have AGP GART support. - The 2.4.x test kernels have AGP GART and have been tested - with the i810. - <p> +<p> + <sect2>Requirements +<p> + A kernel with AGP GART support (such as Linux 2.4.x) is needed. +<p> <sect2>Configuration - <p> +<p> Your XF86Config file's device section must specify the <tt>i810</tt> device, and specify a usable amount of video ram to reserve. @@ -886,6 +917,7 @@ Identifier "i810" VendorName "Intel" Driver "i810" + Option "AGPMode" "1" VideoRam 10000 EndSection </verb> @@ -933,17 +965,31 @@ rendering will be disabled. </itemize> + <sect2>Performance and Features <p> + Basically all of the i810 features which can be exposed through + OpenGL 1.2 are implemented. + However, the following OpenGL features are implemented in software + and will be slow: + <itemize> + <item>Stencil buffer and accumulation buffer operations + <item>Blend subtract, min/max and logic op blend modes + <item>glColorMask when any mask is set to false + <item>GL_SEPARATE_SPECULAR_COLOR lighting mode + <item>glDrawBuffer(GL_FRONT_AND_BACK) + <item>Using 1D or 3D textures + <item>Using texture borders + </itemize> +<p> <sect1>Matrox G200 and G400 - <p> - <sect2>Dependencies - <p> - A Linux kernel with AGP GART support (such as the 2.4.x test - kernels) is needed. - <p> +<p> + <sect2>Requirements +<p> + A kernel with AGP GART support (such as Linux 2.4.x) is needed. +<p> <sect2>Configuration - <p> +<p> Your XF86Config file's device section must specify the <tt>mga</tt> device: <verb> @@ -951,6 +997,7 @@ Identifier "MGA" VendorName "Matrox" Driver "mga" + Option "AGPMode" "1" VideoRam 32768 EndSection </verb> @@ -994,7 +1041,7 @@ <tt>/usr/X11R6/lib/modules/dri/mga_dri.so</tt>. This will be automatically loaded by libGL.so. - <sect2>Performance + <sect2>Performance and Features <p> Software rendering will be used under any of the following conditions: @@ -1004,8 +1051,38 @@ <item>Using glLogicOp. <item>Using glPolygonStipple or glLineStipple. <item>Using 1D or 3D textures. + <item>Using texture borders. + <item>Using glDepthFunc(GL_NEVER). <item>Using the accumulation buffer. </itemize> +<p> + The AGP mode may be set to 1, 2, or 4. One is used by default. + Higher AGP speeds may result in unreliable performance depending + on your motherboard. + +<p> + Compaq has funded the implementation of AGP accelerated + 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 @@ -1061,21 +1138,22 @@ <sect1>ATI Rage 128 - <p> - <sect2>Dependencies - <p> - A Linux kernel with AGP GART support (such as the 2.4.x test - kernels) is needed. - <p> +<p> + <sect2>Requirements +<p> + A kernel with AGP GART support (such as Linux 2.4.x) is needed. +<p> <sect2>Configuration - <p> +<p> Your XF86Config file's device section must specify the - <tt>r128</tt> device: + <tt>ati</tt> device: <verb> Section "Device" Identifier "Rage128" VendorName "ATI" - Driver "r128" + Driver "ati" + Option "AGPMode" "1" + Option "UseCCEFor2D" "false" EndSection </verb> The Screen section should then reference the Rage 128 device: @@ -1109,17 +1187,129 @@ You may also set your screen depth to 32 for 32bpp mode. <p> - <sect2>Performance + <sect2>Performance and Features <p> While PCI Rage 128 based cards are supported, they do not yet support PCI GART, so they will not perform as well as their AGP counterparts. - +<p> + For AGP cards, the AGP mode may be set to 1, 2, or 4. One is + used by default. + Higher AGP speeds may result in unreliable performance depending + on your motherboard. +<p> + Note that even at 32bpp there is no alpha channel. +<p> + The following OpenGL features are implemented in software and + will be slow: + <itemize> + <item>Stencil buffer and accumulation buffer operations + <item>Blend subtract, min/max and logic op blend modes + <item>GL_SEPARATE_SPECULAR_COLOR lighting mode + <item>glDrawBuffer(GL_FRONT_AND_BACK) + <item>Using 1D or 3D textures + <item>Using texture borders + </itemize> +<p> <sect2>Known Problems <p> - DGA is not yet supported in the ATI Rage 128 X server. This - feature will be added in a future release. + If you experience stability problems you may try setting the + <tt>UseCCEFor2D</tt> option to <tt>true</tt>. This will + effectively disable 2D hardware acceleration. Performance will + be degraded, of course. +<p> + + <sect1>ATI Radeon +<p> + <sect2>Requirements +<p> + A kernel with AGP GART support (such as Linux 2.4.x) is needed. +<p> + <sect2>Configuration +<p> + Your XF86Config file's device section must specify the + <tt>ati</tt> device: + <verb> + Section "Device" + Identifier "Radeon" + VendorName "ATI" + Driver "ati" + Option "AGPMode" "1" + EndSection + </verb> + The Screen section should then reference the Radeon device: + <verb> + Section "Screen" + Identifier "Screen 1" + Device "Radeon" + Monitor "High Res Monitor" + DefaultDepth 16 + Subsection "Display" + Depth 16 + Modes "1280x1024" "1024x768" "800x600" "640x480" + ViewPort 0 0 + EndSubsection + Subsection "Display" + Depth 32 + Modes "1280x1024" "1024x768" "800x600" "640x480" + ViewPort 0 0 + EndSubsection + EndSection + </verb> + <p> + The kernel module for the Radeon is named <tt>radeon.o</tt> and + should be installed in /lib/modules/2.4.x/kernel/driver/char/drm/. + It will be automatically loaded by the Xserver if needed. + <p> + The DRI 3D driver for the Radeon should be in + <tt>/usr/X11R6/lib/modules/dri/radeon_dri.so</tt>. + This will be automatically loaded by libGL.so. + <p> + You may also set your screen depth to 32 for 32bpp mode. + <p> + + <sect2>Performance and Features +<p> + While this driver supports many of the features of ATI Radeon + cards, we do not <em/yet/ fully support the card's TCL + features. This work is progressing, but is not yet ready. +<p> + The AGP mode may be set to 1, 2, or 4. One is used by default. + Higher AGP speeds may result in unreliable performance depending + on your motherboard. +<p> + The following OpenGL features are implemented in software and will + be slow: + <itemize> + <item>Blend subtract, blend min/max and blend logicops + <item>Stencil and accumulation operations + <item>1D and 3D textures + <item>Texture borders + </itemize> +<p> + The GL_EXT_texture_env_combine, GL_EXT_texture_env_add and + GL_EXT_texture_env_dot3 extensions are supported (or will be + soon supported in the new driver based on Mesa 3.5). +<p> + We hope to implement support for the following features in the + future: + <itemize> + <item>Vertex transformation, clipping and lighting (TCL) + <item>Hardware stencil buffer + <item>Cube map textures + <item>3D textures + <item>Three texture units + </itemize> +<p> + <sect2>Known Problems +<p> + Certain (early?) revisions of the AMD Irongate chipset have + AGPGART problems which effect Radeon, and other graphics cards. + The card may work unreliably, or not work at all. If the DRM + kernel module is not loaded, the 2D Xserver may work. There's + hope that this can be fixed in the future. +<p> <sect1>3DLabs Oxygen GMX 2000 <p> @@ -1135,7 +1325,7 @@ overlays, stereo, hardware-accelerated indirect rendering. <p> OpenGL-like functionality is provided with the Mesa library. - XFree86 4.0.1 uses Mesa 3.3. + XFree86 4.1.0 uses Mesa 3.4.2. Subsequent releases of XFree86 will use newer versions of Mesa. When newer versions of Mesa are available, the 3D drivers can be updated without reinstalling XFree86 or libGL.so. @@ -1230,8 +1420,8 @@ <p> A collection of useful configuration files, libraries, headers, utilities and demo programs is available from - <htmlurl url="http://dri.sourceforge.net/resources/resources.html" - name="http://dri.sourceforge.net/resources/resources.html"> + <htmlurl url="http://dri.sourceforge.net/res.phtml" + name="http://dri.sourceforge.net/res.phtml"> <sect1>Documentation <p> @@ -1246,7 +1436,8 @@ <item>Visit the <htmlurl url="http://dri.sourceforge.net" name="DRI project on SourceForge.net"> for the latest development news about the DRI and 3D drivers. - <item>The <htmlurl url="http://dri.sourceforge.net/DRIcompile.html" + <item>The <htmlurl + url="http://dri.sourceforge.net/doc/DRIcompile.html" name="DRI Compilation Guide"> explains how to download, compile and install the DRI for yourself. </itemize> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml:1.9 xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml:1.14 --- xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml:1.9 Tue Dec 12 12:48:10 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml Wed May 2 11:06:08 2001 @@ -3,19 +3,17 @@ ]> <!-- Created: Sun Mar 12 13:00:00 2000 by brianp@valinux.com --> -<!-- Revised: Fri May 19 09:36:02 2000 by martin@valinux.com --> -<!-- Revised: Sat Aug 19 14:00:00 2000 by brianp@valinux.com --> +<!-- Revised: Sat Jan 6 10:15:22 2001 by martin@valinux.com --> <article> + <title>DRI Compilation Guide + <author> + <htmlurl url="http://www.valinux.com/" + name="VA Linux Systems, Inc."> Professional Services - Graphics. + <date>21 April 2001 - <title>DRI Compilation Guide - <author> - <htmlurl url="http://www.valinux.com/" - name="VA Linux Systems, Inc."> Professional Services - Graphics. - <date>29 October 2000 - <ident> - $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.9 2000/12/12 17:48:10 alanh Exp $ + $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/DRIcomp.sgml,v 1.14 2001/05/02 15:06:08 dawes Exp $ </ident> <toc> @@ -24,7 +22,7 @@ <sect1>Copyright <p> - <bf>Copyright © 2000 by VA Linux Systems, Inc. + <bf>Copyright © 2000-2001 by VA Linux Systems, Inc. All Rights Reserved.</bf> <p> <bf>Permission is granted to make and distribute verbatim copies @@ -45,7 +43,8 @@ 3dfx, Voodoo3, Voodoo4, and Voodoo5 are registered trademarks of 3dfx Interactive, Incorporated. Matrox is a registered trademark of Matrox Electronic Systems Ltd. - ATI Rage is a registered trademark of ATI Technologies, Inc. + ATI Rage and Radeon is a registered trademark of ATI Technologies, + Inc. All other trademarks mentioned are the property of their respective owners. @@ -54,6 +53,8 @@ This document describes how to download, compile and install the DRI project. + The DRI provides 3D graphics hardware acceleration for the XFree86 + project. This information is intended for experienced Linux developers. Beginners are probably better off installing precompiled packages. <p> @@ -65,10 +66,9 @@ You'll need the following: <itemize> - <item>At least 400MB of free disk space. More is needed if you want - to build with debugging information or keep several build trees. - <item>A fast system. Using a PIII-550 it takes about 1/2 hour to - build everything. + <item>At least 200MB of free disk space. + If you compile for debugging (the -g option) then you'll need + about 600MB. <item>GCC compiler and related tools. <item>ssh (secure shell) for registered developer downloading of the DRI source tree @@ -78,9 +78,14 @@ </itemize> <p> + The DRI 3D drivers generally work on systems with Intel or AMD CPUs. + However, there is limited support for Alpha and PowerPC support is + underway. + + <p> For 3dfx Voodoo3 hardware, you'll also need: <itemize> - <item>Glide3x headers and runtime library if you want to use the + <item>Glide3 headers and runtime library if you want to use the 3dfx driver. These can be obtained from <htmlurl url="http://linux.3dfx.com/open_source/glide_kit.htm" @@ -101,7 +106,7 @@ </itemize> <p> - For ATI Rage hardware, you'll also need: + For ATI Rage 128 and Radeon hardware, you'll also need: <itemize> <item>A recent Linux 2.4.x kernel with AGP support. </itemize> @@ -109,15 +114,20 @@ <sect>Linux Kernel Preparation <p> - The DRI project closely tracks Linux kernel development. - Since the internal Linux data structures change frequently in - the 2.4 development branch it's important to have use the most - recent Linux kernel. - As of this writing (Nov 2000), 2.4.0-test11-pre5 is the most - recent version of Linux which the DRI is synchronized to. + The DRI project closely tracks Linux kernel development. Since + the internal Linux data structures might change in the 2.4 Linux + kernel, it's important to use the most recent Linux kernel and + not an old, intermediate development release. + As of this writing (Jan 2001), 2.4.0 is the most recent version + of Linux which the DRI is synchronized to. <p> Most of the DRI drivers require AGP support and using Intel - Pentium III SSE optimizations also requires an up-to-date Linux kernel. + Pentium III SSE optimizations also requires an up-to-date Linux + kernel. Configuring your kernel correctly is very important, as + features such as SSE optimizations will be disabled if your + kernel does not support them. Thus, if you have a Pentium III + processor, you must configure your kernel for the Pentium III + processor family. <p> Building a new Linux kernel can be difficult for beginners but there are resources on the Internet to help. @@ -140,7 +150,18 @@ ln -s linux-2.4.x linux bzcat linux-2.4.x.tar.bz2 | tar xf - </verb> - <item>Configure your kernel. + It is critical that /usr/src/linux point to your new kernel + sources, otherwise the kernel headers <bf>will not</bf> be + used when building the DRI. This will almost certainly cause + compilation problems. + <item>Read /usr/src/linux/Documentation/Changes. + This file lists the minimum requirements for all software + packages required to build the kernel. You must 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. + <item>Configure your kernel. You might, for example, use <tt>make menuconfig</tt> and do the following: @@ -149,9 +170,13 @@ <item>Enable <em>Prompt for development and/or incomplete code/drivers</em> <item>hit ESC to return to the top-level menu + <item>Go to <em>Processor type and features</em> + <item>Select your processor type from <em>Processor Family</em> + <item>hit ESC to return to the top-level menu <item>Go to <em>Character devices</em> <item>Disable <em>Direct Rendering Manager (XFree86 DRI support)</em> - since we'll use the DRI module from the XFree86/DRI tree. + since we'll use the DRI code from the XFree86/DRI tree and will + compile it there. <item>Go to <em>/dev/agpgart (AGP Support) (EXPERIMENTAL) (NEW)</em> <item>Hit SPACE twice to build AGP support into the kernel <item>Enable all chipsets' support for AGP @@ -183,12 +208,61 @@ make install </verb> Note that last make command will automatically run lilo for you. - <item>Upgrade your modutils package for Linux 2.4.x if you're - upgrading from Linux 2.2.x. <item>Now reboot to use the new kernel. </itemize> + <sect>CPU Architectures <p> + + In general, nothing special has to be done to use the DRI on + different CPU architectures. There are, however, a few + optimizations that are CPU-dependent. Mesa will determine at + runtime which CPU-dependent optimizations should be used and + enable them where appropriate. + + <sect1>Intel Pentium III Features <p> + + The Pentium III SSE (Katmai) instructions are used in + optimized vertex transformation functions in the Mesa-based + DRI drivers. + On Linux, SSE requires a recent kernel (such as 2.4.0-test11 + or later) both at compile time and runtime. + + <sect1>AMD 3DNow! Features <p> + + AMD's 3DNow! instructions are used in optimized vertex + transformation functions in the Mesa-based DRI drivers. + 3DNow! is supported in most versions of Linux. + + <sect1>Alpha Features <p> + + 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 specifically for the EV6 based + AXP's, giving both byte and word alignment access to the + DRI/Mesa drivers. + + To enable this optimization edit your xc/config/host.def file + and add the line: + + #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 + + Additional speed improvements to 3D rendering can be achieved + by installing Compaq's Math Libraries (CPML) which can be + obtained from + <htmlurl url="http://www.support.compaq.com/alpha-tools/software/index.html" + name="http://www.support.compaq.com/alpha-tools/software/index.html"> + + Once installed, you can add this line to your host.def to build + with the CPML libraries: + + #define UseCompaqMathLibrary YES + + The host.def file is explained below. + + + <sect>Downloading the XFree86/DRI CVS Sources <p> The DRI project is hosted by VA Linux Systems' @@ -291,6 +365,7 @@ The DRI developers will upgrade Mesa when appropriate. <p> + <sect>Compiling the XFree86/DRI tree <p> <sect1>Make a build tree <p> @@ -325,7 +400,7 @@ (Alpha) #define DefaultGcc2AxpOpt -O2 -mcpu=ev6 (or similar) #define LibraryCDebugFlags -O2 #define BuildServersOnly YES - #define XF86CardDrivers vga tdfx mga r128 i810 + #define XF86CardDrivers vga tdfx mga ati i810 #define LinuxDistribution LinuxRedHat #define DefaultCCOptions -ansi GccWarningOptions -pipe #define BuildXF86DRI YES @@ -334,6 +409,7 @@ /* #define GlxBuiltInTdfx YES */ /* #define GlxBuiltInMga YES */ /* #define GlxBuiltInR128 YES */ + /* #define GlxBuiltInRadeon YES */ /* #define DoLoadableServer NO */ #define SharedLibFont NO </verb> @@ -351,11 +427,30 @@ <p> If you have 3dfx hardware be sure that the Glide 3x headers are installed in <tt>/usr/include/glide3/</tt> and that the Glide 3x - library is installed at <tt>/usr/lib/libglide3x.so</tt>. + library is installed at <tt>/usr/lib/libglide3.so</tt>. <p> If you do not have 3dfx hardware comment out the <tt>HasGlide3</tt> line in <tt>host.def</tt>. <p> + If you want to enable 3DNow! optimizations in Mesa and the DRI + drivers, you should add the following: + <verb> + #define MesaUse3DNow YES + </verb> + <p> + If you want to enable SSE optimizations in Mesa and the DRI + drivers, you <bf>must</bf> upgrade to a Linux 2.4.x kernel. + Mesa will verify that SSE is supported by both your processor + <em>and</em> your operating system, but to build Mesa inside + the DRI you need to have the Linux 2.4.x kernel headers in + /usr/src/linux. If you enable SSE optimizations with an + earlier version of the Linux kernel in /usr/src/linux, Mesa + <bf>will not compile</bf>. You have been warned. If you do + have a 2.4.x kernel, you should add the following: + <verb> + #define MesaUseKatmai YES + </verb> + <p> <sect1>Compilation <p> @@ -394,6 +489,7 @@ For the 3dfx Voodoo, you should see <em>tdfx.o</em>. For the Matrox G200/G400, you should see <em>mga.o</em>. For the ATI Rage 128, you should see <em>r128.o</em>. + For the ATI Radeon, you should see <em>radeon.o</em>. For the Intel i810, you should see <em>i810.o</em>. <p> If the DRI kernel module(s) failed to build you should verify @@ -408,7 +504,7 @@ <tt>/usr/src/linux-2.4.x</tt>, <verb> cd ~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel - make TREE=/usr/src/linux-2.4 + make TREE=/usr/src/linux-2.4.x/include </verb> or alternatively, edit Makefile to include this change. <p> @@ -421,13 +517,16 @@ The DRI kernel modules are in <tt>~/DRI-CVS/build/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/</tt>. <p> - To load the appropriate DRI module in your running kernel you can + To load the appropriate DRM module in your running kernel you can either use ismod and restart your X server or copy the kernel module - to <tt>/lib/modules/2.4.x/kernel/driver/char/drm/</tt> then run + to <tt>/lib/modules/2.4.x/kernel/drivers/char/drm/</tt> then run depmod and restart your X server. <p> Make sure you first unload any older DRI kernel modules that might be already loaded. + <p> + Note that some DRM modules require that the <tt>agpgart</tt> module + be loaded first. <p> <sect>Normal Installation and Configuration <p> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml:1.4 xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml:1.4.4.2 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml:1.4 Tue Dec 12 13:54:29 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml Sat Jun 2 00:44:37 2001 @@ -5,10 +5,10 @@ <article> <title>XFree86 on Darwin and Mac OS X <author>Torrey T. Lyons -<date>11 December 2000 +<date>25 May 2001 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml,v 1.4 2000/12/12 18:54:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Darwin.sgml,v 1.4.4.2 2001/06/02 04:44:37 torrey Exp $ </ident> <toc> @@ -19,8 +19,7 @@ implementation of X Windows, has been ported to <htmlurl url="http://www.publicsource.apple.com/projects/darwin/" name="Darwin"> and <htmlurl url="http://www.apple.com/macosx/" name="Mac OS X">. This -document is -a collection of information for anyone +document is a collection of information for anyone experimenting with running X Windows on Apple's next generation operating system. Please send any comments on this page to <email/torrey@mrcla.com/. If you are also @@ -28,23 +27,38 @@ <sect>Hardware Support and Configuration <p> -The Darwin port of XFree86 uses the IOKit for device driver loading -and discovery, rather than the XFree86 module loader. Because of this, -the XFree86 configuration file is not used on Darwin systems. The -descriptions found elsewhere of devices supported by XFree86 for other -operating systems also do not apply. +XFree86 can be run either from the console or side by side with +Mac OS X's Aqua desktop in a full screen mode. In full screen mode +with Aqua, when the X window system is active, it takes over the entire +screen. You can switch back to the Mac OS X desktop by holding down +Command-Option-A. This key combination can be changed in the user +preferences. From the Mac OS X desktop, just click on the XDarwin +icon in the floating switch window to switch back to the X window system. +You can change this behavior in the user preferences so that clicking on +the XDarwin icon in the Dock switches as well. The full screen cooperative +mode with Aqua is known as Quartz mode, named after the Quartz 2D +compositing engine used by Aqua. + +<p> +From the console, the Darwin port of XFree86 uses the IOKit for device +driver loading and discovery, rather than the XFree86 module loader. +Because of this, the XFree86 configuration file is not used on Darwin +or Mac OS X systems. The descriptions found elsewhere of devices +supported by XFree86 for other operating systems also do not apply. +Running XFree86 from the text console is known as IOKit mode. + +<p> +XFree86 for Darwin or Mac OS X will work with any video card that +you have an IOKit driver for. If you are running Mac OS X, this +typically means any card that has been shipped by Apple. If a card works +for you with the Mac OS X GUI, it will work on the same machine with +XFree86. If you have a pure Darwin installation, you may need to download +additional third-party drivers from +<htmlurl url="http://www.publicsource.apple.com/projects/darwin/" +name="Apple's Darwin site">. IOKit drivers are typically installed in +<tt>/System/Library/Extensions/</tt> or <tt>/Library/Extensions/</tt>. <p> -XFree86 for Darwin will work with any video card that you have an -IOKit driver for. If you are running Mac OS X, this typically means -any card that has been shipped by Apple. If a card works for you with -the Mac OS X GUI, it will work on the same machine with XFree86. If -you have a pure Darwin installation, your hardware support may be -somewhat limited because Apple does not include all its hardware -drivers with Darwin. IOKit drivers are typically found in -/System/Library/Extensions/ or /Library/Extensions/. - -<p> Multi-button and scroll wheel mouse support works well with all USB mice that I have tested. I have done no testing with serial mice. @@ -53,42 +67,27 @@ <p> Following are instructions for building and running your own copy of XFree86. The procedure for getting your X server up and running on -Darwin and Mac OS X are very similar, but it is actually somewhat more -difficult on Mac OS X. Where there are differences I have noted them -below. Both Mac OS X Developers' Preview 4 and Mac OS X -Public Beta are covered. Note that to build XFree86 for yourself on -Mac OS X Beta, you will need to have the Developers' Tools. If -you did not receive these as a member of ADC, they are available for -download from the <htmlurl url="http://www.apple.com/developer/" -name="Apple Developer Connection">. +Darwin and Mac OS X are very similar. Where there are differences +I have noted them below. Note that to build XFree86 for yourself on +Mac OS X, you will need to install the Developers' Tools. <p> -If you want to save some time, you can use the precompiled binaries -provided by the XFree86 server at <url +If you don't feel the need to live on the cutting edge, you can save +some time and effort by using the precompiled binaries available on +the XFree86 FTP server at <url url="ftp://ftp.xfree86.org/pub/XFree86/&relvers;/binaries/Darwin/">. Follow the instructions in the <htmlurl url="http://www.xfree86.org/&relvers;/Install.html" name="Install"> -document to install it. - -<p> -This will create two new directory trees, <tt>/usr/X11R6</tt> and -<tt>/private/etc/X11</tt>. If you have the developers' tools, you may -have to run ranlib on all the libraries in <tt>/usr/X11R6/lib/*</tt> -before trying to build other X applications. +document to install it. This will create two new directory trees, +<tt>/usr/X11R6</tt> and <tt>/etc/X11</tt> For Mac OS X Quartz +support, download the optional Xquartz.tgz tarball. <p> If you get the precompiled binaries you can skip ahead to the section -on <ref id="running" name="running X windows"> - -<p> -On the other hand, if you want to build things yourself from scratch, +on <ref id="running" name="running the X window system"> On the other hand, +if you want to build things yourself from scratch, follow the directions below. -<p> -If you want to recompile the X server on Mac OS X, you will have to -make the header files as described <ref id="makeHeaders" -name="below">. - <sect1> Get the Code <p> @@ -96,11 +95,11 @@ XFree86 project. <itemize> -<item> Setup CVS: Both Darwin and Mac OS X include CVS (Concurrent +<item> Setup CVS: Both Darwin and Mac OS X include CVS (Concurrent Versions System), which is an easy way to download and keep up to date with open source code released by XFree86 and others. You do have to setup CVS properly, however, to tell it where to look. Follow the -instructions <htmlurl url="http://www.xfree86.org/cvs/" name="here"> on +<htmlurl url="http://www.xfree86.org/cvs/" name="XFree86 instructions"> on how to do this either via ssh or via the cvs pserver. <item> Now make a directory in some convenient place which will serve @@ -117,24 +116,6 @@ </itemize> -<sect1>Make Header Files for Mac OS X<label id="makeHeaders"> -<p> - -These next steps are not necessary if you are building XFree86 on -Darwin. Mac OS X Beta or DP4 does not include many of the -"in-progress" header files that are needed to successfully -build XFree86. The general philosophy is that at any given time, Mac -OS X will include only headers files that are "ready for prime -time" while Darwin will include a snapshot of Apple's current -efforts. So if you have access to a Darwin system, I would suggest -using this instead of Mac OS X to build XFree86. If you don't, read -the appropriate page below for an outline of what you need to do: - -<itemize> -<item><ref id="headersXBeta" name="Mac OS X Public Beta"> -<item><ref id="headersXDP4" name="Mac OS X Developers' Preview 4"> -</itemize> - <sect1> Build XFree86 <p> Once you have everything ready it is easy to build and install @@ -146,47 +127,43 @@ (wait for several hours) -su root -make install >& install.log -make install.man >& man.log +sudo make install >& install.log +sudo make install.man >& man.log </verb></tscreen> -<sect>Run X Windows<label id="running"> +<sect>Run the X Window System<label id="running"> <p> -You will want to add the X windows executables to your path. Your path +You will want to add the X window executables to your path. Your path is the list of directories to be searched when you type a command. You will also want to add the man pages from XFree86 to the list of pages to be searched when you are looking for documentation. The way to do this depends on the shell you are using. With tcsh or csh add the -following two lines to a file in your home directory called <tt/.cshrc/ -(create this file if you don't have one yet): +following two lines to a file named +<tt>~/Library/init/tcsh/path</tt>: (You may need to create this file and +directory path if it does not exist already.) + <tscreen><verb> -setenv MANPATH "${MANPATH}:/usr/X11R6/man:/usr/local/man" setenv PATH "${PATH}:/usr/X11R6/bin" +setenv MANPATH "${MANPATH}:/usr/X11R6/man" </verb></tscreen> -Now type ``<tt>source ~/.cshrc;rehash</tt>'' to -get these changes to take effect. On future logins, this file will be +The next time you login or open a Terminal window, this file will be executed automatically. <p> -You are now ready to go. On Mac OS X, you have to do a few extra steps -each time you want to run X windows. You can't run XFree86 with -CoreGraphics running since they both want to control the screen. So -for Mac OS X you first need to logout. Then for Mac OS X DP4, from the -login window type ``console'' as the user name and push -login. For Mac OS X Beta, type ``>console'' as the user -name. This should shutdown CoreGraphics and bring you up with a text -console. Login again. - -<p> -Now from the text console you can start X Windows in either Darwin or -Mac OS X by typing ``startx''. After a brief wait at least one terminal -window should pop up for you. So far it probably isn't very impressive -as you might not even have a window manager running to allow you to -move windows around. +You are now ready to go. On Mac OS X, you can run XFree86 from the +text console or in full screen mode with Aqua. To get to the text +console in Mac OS X you need to logout and type ``>console'' as +the user name. This will shutdown Core Graphics and +bring up the console login prompt. Login again as your user. <p> -When you are ready to quit X windows type ``exit'' in the main +From the text console you can start the X Window System by typing ``startx''. +After a brief wait at least one terminal window should pop up for you. +So far it probably isn't very impressive as you might not even have a +window manager running to allow you to move windows around. + +<p> +When you are ready to quit XFree86 type ``exit'' in the main terminal window or quit with the window manager if you have one running. Unfortunately the X server won't shutdown correctly and you will get an apparently frozen screen with only a spinning beachball @@ -194,25 +171,36 @@ your keystrokes are being received by the console. Type ``logout'' to return to normalcy after a brief delay. With Darwin this should put you back at the text console login prompt. With -Mac OS X, CoreGraphics will restart and you should be given a login +Mac OS X, Core Graphics will restart and you should be given a login window. <p> +To start XFree86 in Quartz mode you can launch the XDarwin application +in the <tt>/Applications</tt> folder, or from the command line type +``startx -- -quartz''. When the X window system is active, it takes over +the entire screen. You can switch back to the Mac OS X desktop by +holding down Command-Option-A. This key combination can be changed in +the user preferences. From the Mac OS X desktop, just click on the +XDarwin icon in the floating switch window to switch back to the X window +system. You can change this behavior in the user preferences so that +clicking on the XDarwin icon in the Dock switches as well. + +<p> <bf/Customize X Windows/ <p> -X windows is very customizable and you will certainly want to change -some things. There is a lot you can do to control how your windows +The X window system is very customizable and you will certainly want to +change some things. There is a lot you can do to control how your windows look, how the windows are moved, resized, etc. You will likely want to get a better window manager than twm, which is included with XFree86. The <tt>.xinitrc</tt> file in your home directory controls what -programs are run when you start X windows. You can find a sample -<tt>.xinitrc</tt> file in <tt>/private/etc/X11/xinit/xinitrc</tt>. +programs are run when you start the X window system. You can find a sample +<tt>.xinitrc</tt> file in <tt>/etc/X11/xinit/xinitrc</tt>. <p> -There are several -window managers that have been ported to Darwin. The best collection -of window managers and other X windows applications is at <htmlurl +There are several window managers that have been ported to Darwin. +The best collection of window managers and other X window clients +is at <htmlurl url="http://www.darwinfo.org/ports.shtml#X Windows" name="Darwinfo's ports page">. Another good place to look for Darwin ports in general is at <htmlurl @@ -230,195 +218,21 @@ <bf/Things that are broken:/ <itemize> -<item>The bell is broken. +<item>The bell does not work in IOKit mode. -<item>Server shutdown problem: After quitting the X server the colored -beachball cursor reappears, but the screen never returns to the +<item>Server shutdown problem: After quitting the X server in IOKit mode, +the colored beachball cursor reappears, but the screen never returns to the console display. The console is accepting input however, so typing ``logout'' will return you to the login prompt. <item>Only one display is currently supported. -<item>Screen saver not supported. +<item>The display mode can not be changed once the X server +has started. -<item>Key repeat rate can not be adjusted. -</itemize> +<item>A screen saver is not supported. -<bf/Things I am working on:/ -<itemize> -<item> Allowing rootless use on Mac OS X -<item> Correct wake from sleep behavior </itemize> - -<sect>Appendix - -<sect1>Installing IOKit Header files on Mac OS X Beta<label - id="headersXBeta"> -<p> -Here is what you need to do to be able to build XFree86 (or other -clients of IOGraphics services) on Mac OS X Public Beta. -<enum> - -<item>You need to install some more build tools that aren't included -in Mac OS X Beta, but are included in Darwin. These are needed for the -next step. Go to your development directory and type: -<tscreen><verb> -cvs checkout bootstrap_cmds -cd bootstrap_cmds -make -</verb></tscreen> -Now su to root and do a ``make install'' from the bootstrap_cmds -directory. - -<item> -The IOKit framework included with Mac OS X Beta is a little on the -wimpy side, even after installing the Developer Tools. You'll need to -rebuild it, but to do so safely we'll take advantage of the cool -directory structure of Mac OS X and put the new version in -/Library/Frameworks/. This will override the version in -/System/Library/Frameworks/. Or at least, that's where you should put -it using the new Mac OS X Beta file structure, but in fact the -compiler doesn't know this and still looks in -/Local/Library/Frameworks. (I have already filed a developer's bug -report on this.) To start we make a copy of the original. Login as -root and do the following: -<tscreen><verb> -cd /Library -mkdir -p Frameworks -cp -R /System/Library/Frameworks/IOKit.framework Frameworks/IOKit.framework -cd / -mkdir -p Local -ln -s /Library /Local/Library -</verb></tscreen> - -<item>Now you need to get a full version of the IOKit framework from -the Darwin repository. This comes as part of the kernel. So, in your -development directory again: - -<tscreen><verb> -cvs checkout xnu -cd xnu -source SETUP/setup.csh -make exporthdrs -make install -</verb></tscreen> - -The "make install" will start by assembling all the headers you need, -but then will proceed to build a new kernel. You can Control-C out of -the build once it starts compiling things if you want. Otherwise, just -be patient. - -<item> -You also need to get the IOKitUser project, which contains the user -interface to the IOKit, and merge it into the IOKit framework. From -your development directory type: -<tscreen><verb> -cvs checkout IOKitUser -</verb></tscreen> -Then you need to change the Makefile so it builds on top of the new -IOKit framework you are building. Change to the IOKitUser project -directory and edit the Makefile. Change the following line: -<tscreen><verb> -NEXTSTEP_BUILD_OUTPUT_DIR = /$(USER)/build/$(NAME) -</verb></tscreen> -to: -<tscreen><verb> -NEXTSTEP_BUILD_OUTPUT_DIR = <your xnudir>/BUILD/dst/System/Library/Frameworks -</verb></tscreen> - -Now, run ``make'' while in the IOKitUser directory. It will likely not -finish building since the IOKitUser project relies on some stuff that -Apple hasn't really made public yet, but it should finish populating -the new IOKit framework with headers and start compiling. (Strangely -enough, the headers installed in your new IOKit framework don't contain -the real header files. They are just single line files with an #import -of the file in your IOKitUser project. This works fine as long as you -don't ever delete or move your IOKitUser project. I imagine that using -``make install'' would fix this up, but you can't do this as long as the -project doesn't build correctly. So for now you can either move the -header files by hand, or make sure you leave your IOKitUser project in -place.) - -<item> -Now put the new IOKit headers into our local copy. Change to the xnu -project directory and do the following as root: -<tscreen><verb> -cd BUILD/dst/System/Library/Frameworks/ -cp -R IOKit.framework/Versions/A/Headers/* \ - /Library/Frameworks/IOKit.framework/Versions/A/Headers -</verb></tscreen> - -<item> -The System framework needs touching up a bit too. You need to copy the -libkern header files from the new System.framework. As root, go to the -xnu project directory and type: (Of course you could make a local copy -of the System framework in /Library/Frameworks/, but the additions to -the System framework are small.) -<tscreen><verb> -cd BUILD/dst/System/Library/Frameworks/System.framework/Versions/B/Headers -cp -R libkern /System/Library/Frameworks/System.framework/Headers/libkern -</verb></tscreen> -</enum> - -<sect1>Installing IOKit Header files on Mac OS X DP4<label -id="headersXDP4"> -<p> -Here is an outline of what you need to do to be able to build XFree86 -(or other clients of IOGraphics services) on Mac OS X Developers' -Preview 4. - -<enum> - -<item>Checkout, build, and install bootstrap_cmds from the CVS -repository. -<item>Checkout xnu from the CVS repository. Go to sandbox/xnu and do -the following: -<tscreen><verb> -source SETUP/setup.csh -make exporthdrs -</verb></tscreen> -<item>su to root and do the following: -<tscreen><verb> -mkdir -p /Local/Library/Frameworks -cp -R /System/Library/Frameworks/IOKit.framework /Local/Library/Frameworks -</verb></tscreen> -This will create a new local version of the IOKit framework that will -override the System version without changing the original. - -<item>You now want to merge the IOKit headers from the xnu project -into your local IOKit framework. I did this fairly tediously by hand, -but I would suggest something like: -<tscreen><verb> -cp -R sandbox/xnu/BUILD/dst/System/Library/Frameworks/IOKit.framework/Versions/A/Headers \ -/Local/Library/Frameworks/IOKit.framework/Versions/A -</verb></tscreen> -The only problem with this is that there are a few stub header files -included that are just a single line with an #import to the -appropriate place in the xnu source on your disk. This is fine as long -as you don't move your xnu project. If you do, you can copy the -original file to replace the stub. There is probably an easier way to -automatically build a clean version of the IOKit framework, but I -didn't find it. (Let me know if you do.) - -<item>There are just a few more files you need in the IOKit -framework. Checkout the IO project from CVS. Get the necessary header -files from there and put them in your new local IOKit -framework. You'll get errors when you try to build XFree86 from which -you can tell which files are needed. I also needed to make the -following patch to IOLLEvent.h. Your mileage may vary. -<tscreen><verb> -47c47 -< #include <Kernel/libkern/OSTypes.h> ---- -> #include <libkern/OSTypes.h> -</verb></tscreen> - -<item>You'll also need a few extra CoreFoundation header -files. Checkout CoreFoundation. You can make a new local version of -the CoreFoundation framework as above, or just add to the existing -one. The files you need are CFMachPort.h and CFMessagePort.h in the -RunLoop.subproj and CFStorage.h in Collections.subproj. -</enum> </article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile:3.69.2.1 xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile:3.71.2.1 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile:3.69.2.1 Fri Mar 16 09:55:41 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile Fri Jun 1 14:09:48 2001 @@ -3,16 +3,25 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile,v 3.69.2.1 2001/03/16 14:55:41 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Imakefile,v 3.71.2.1 2001/06/01 18:09:48 dawes Exp $ #include <Server.tmpl> #include <lnxdoc.rules> +/* Set this to YES if the RELNOTES file is up to date */ +#ifndef BuildRelnotes +#define BuildRelnotes NO +#endif + +#if BuildRelnotes +RELNOTES=RELNOTES.sgml +#endif + SGMLDEPENDS = defs.ent MANSGMLDEPENDS = mdefs.ent - INDEXLIST = README.sgml RELNOTES.sgml Status.sgml LICENSE.sgml Install.sgml \ + INDEXLIST = README.sgml $(RELNOTES) Status.sgml LICENSE.sgml Install.sgml \ DESIGN.sgml Versions.sgml \ - mouse.sgml fonts.sgml DRI.sgml DRIcomp.sgml \ + mouse.sgml fonts.sgml DRI.sgml DRIcomp.sgml dps.sgml \ Darwin.sgml isc.sgml LynxOS.sgml NetBSD.sgml OpenBSD.sgml \ OS2note.sgml \ apm.sgml ati.sgml chips.sgml cyrix.sgml DECtga.sgml \ @@ -105,7 +114,9 @@ LinuxDocTargetLong(QStart.sgml,QuickStart.doc,QuickStart) #endif LinuxDocTarget(README) +#if BuildRelnotes LinuxDocTarget(RELNOTES) +#endif LinuxDocTarget(Status) /* Other docs */ @@ -118,6 +129,7 @@ #endif LinuxDocReadmeTarget(DRI) LinuxDocReadmeTarget(DRIcomp) +LinuxDocReadmeTarget(dps) SGMLMANDEFS=-D__drivermansuffix__='"$(DRIVERMANSUFFIX)"' \ -D__filemansuffix__='"$(FILEMANSUFFIX)"' \ @@ -148,6 +160,8 @@ FORMATTEDDIR = .. +#if BuildRelnotes /* Update RELNOTES at top level */ UpdateFormattedDoc(RELNOTES,$(TOP)) +#endif Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml:1.10.2.2 xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml:1.11.2.2 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml:1.10.2.2 Wed Mar 14 13:23:45 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml Fri Jun 1 14:09:48 2001 @@ -6,10 +6,10 @@ <title>Installation Details for XFree86™ &relvers; <author>The XFree86 Project, Inc -<date>2 March 2001 +<date>1 June 2001 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.10.2.2 2001/03/14 18:23:45 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Install.sgml,v 1.11.2.2 2001/06/01 18:09:48 dawes Exp $ </ident> <abstract> @@ -80,46 +80,62 @@ yourself a lot time and trouble from NOT downloading an incompatible distribution. -<bf>NOTE</bf>: the Xinstall.sh script must be downloaded in binary mode, -otherwise it won't run correctly. If you get lots of "command not found" -messages when you try to run it, then it is most likely because the -script wasn't downloaded in binary mode. Some web browsers won't do -this for files of that name, so we also have a copy of it called -"<tt>Xinstall.bin</tt>", and most browsers should download that correctly. -When downloading it under this name, select "save as" on your browser, -and save the file under the name "<tt>Xinstall.sh</tt>". +<bf>NOTES</bf>: +<itemize> + <item>The Xinstall.sh script must be downloaded in binary mode, + otherwise it won't run correctly. If you get lots of "command + not found" messages when you try to run it, then it is most + likely because the script wasn't downloaded in binary mode. + Some web browsers won't do this for files of that name, so we + also have a copy of it called "<tt>Xinstall.bin</tt>", and most + browsers should download that correctly. When downloading it + under this name, select "save as" on your browser, and save the + file under the name "<tt>Xinstall.sh</tt>". + + <item>The Xinstall.sh script requires some system commands and + utilities to function correctly. While most systems will have + these, some Linux installations may not. If you find that the + script is failing because of some missing system command, you + will need to install it before you can continue. If you don't + know how to do this, then we recommend that you obtain this + version of XFree86 from your Operating System distributor. + + <item>Always use the version of the Xinstall.sh script that's provided + with the release you're installing. Older versions of the script + may not install newer releases correctly. +</itemize> + Once you're run the <tt>Xinstall.sh</tt> script and found which binary <![ %updaterel; [update ]]>distribution is suitable for your system, download the necessary files. The <![ %fullrel [twelve (12)]]><![ -%updaterel [five (5)]]> mandatory files for all installations are listed +%updaterel [four (4)]]> mandatory files for all installations are listed below. If you have not downloaded all of the files, the installer script will complain. <![ %fullrel [ <quote><verb> -1. Xinstall.sh The installer script -2. extract The utility for extracting tarballs -3. Xbin.tgz X clients/utilities and run-time libraries -4. Xlib.tgz Some data files required at run-time -5. Xman.tgz Manual pages -6. Xdoc.tgz XFree86 documentation -7. Xfnts.tgz Base set of fonts -8. Xfenc.tgz Base set of font encoding data -9. Xetc.tgz Run-time configuration files -10. Xvar.tgz Run-time data -11. Xxserv.tgz XFree86 X server -12. Xmod.tgz XFree86 X server modules +1. Xinstall.sh The installer script +2. extract The utility for extracting tarballs +3. Xbin.tgz X clients/utilities and run-time libraries +4. Xlib.tgz Some data files required at run-time +5. Xman.tgz Manual pages +6. Xdoc.tgz XFree86 documentation +7. Xfnts.tgz Base set of fonts +8. Xfenc.tgz Base set of font encoding data +9. Xetc.tgz Run-time configuration files +10. Xvar.tgz Run-time data +11. Xxserv.tgz XFree86 X server +12. Xmod.tgz XFree86 X server modules </verb></quote> ]]> <![ %updaterel [ <quote><verb> -1. Xinstall.sh The installer script -2. extract The utility for extracting tarballs -3. Xupdate.tgz Updated files except X server drivers/modules -4. Xdocupd.tgz Updated documentation -5. Xdrivers.tgz Updated X server drivers +1. Xinstall.sh The installer script +2. extract The utility for extracting tarballs +3. Xupdate.tgz Updated files except X server drivers +4. Xdrivers.tgz Updated X server drivers </verb></quote> ]]> @@ -146,23 +162,21 @@ </itemize> <![ %fullrel [ -The following thirteen (13) tarballs are optional. You should download +The following eleven (11) tarballs are optional. You should download the ones you want to install. <quote><verb> -1. Xfsrv.tgz Font server -2. Xnest.tgz Nested X server -3. Xprog.tgz X header files, config files and compile-time libs -4. Xprt.tgz X Print server -5. Xvfb.tgz Virtual framebuffer X server -6. Xf100.tgz 100dpi fonts -7. Xfcyr.tgz Cyrillic fonts -8. Xflat2.tgz Latin-2 fonts -9. Xfnon.tgz Some large bitmap fonts -10. Xfscl.tgz Scalable fonts (Speedo and Type1) -11. Xhtml.tgz HTML version of the documentation -12. Xps.tgz PostScript version of the documentation -13. Xjdoc.tgz Documentation in Japanese +1. Xfsrv.tgz Font server +2. Xnest.tgz Nested X server +3. Xprog.tgz X header files, config files and compile-time libs +4. Xprt.tgz X Print server +5. Xvfb.tgz Virtual framebuffer X server +6. Xf100.tgz 100dpi fonts +7. Xfcyr.tgz Cyrillic fonts +8. Xfscl.tgz Scalable fonts (Speedo and Type1) +9. Xhtml.tgz HTML version of the documentation +10. Xps.tgz PostScript version of the documentation +11. Xjdoc.tgz Documentation in Japanese </verb></quote> NOTES: @@ -384,6 +398,7 @@ ln -s /etc/X11/xinit /usr/X11R6/lib/X11 ln -s /etc/X11/xsm /usr/X11R6/lib/X11 ln -s /etc/X11/xserver /usr/X11R6/lib/X11 +chmod ug-w /usr/X11R6/lib # Make sure the permissions are OK /sbin/ldconfig /usr/X11R6/lib # For Linux /sbin/ldconfig -m /usr/X11R6/lib # For FreeBSD, NetBSD, OpenBSD /usr/X11R6/bin/mkfontdir /usr/X11R6/lib/X11/fonts/misc @@ -462,6 +477,7 @@ ./extract -C /usr/X11R6 `pwd`/X[a-df-uw-z]*.tgz ./extract -C /usr/X11R6 Xvfb.tgz # If you are installing Xvfb ./extract -C /var Xvar.tgz +chmod ug-w /usr/X11R6/lib # Make sure the permissions are OK /sbin/ldconfig /usr/X11R6/lib # For Linux /sbin/ldconfig -m /usr/X11R6/lib # For FreeBSD, NetBSD, OpenBSD /usr/X11R6/bin/mkfontdir /usr/X11R6/lib/X11/fonts/misc Index: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml:1.7.2.1 xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml:1.8 --- xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml:1.7.2.1 Fri Mar 16 11:12:06 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml Fri Mar 16 17:13:19 2001 @@ -8,7 +8,7 @@ <date>March 2001</date> <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.7.2.1 2001/03/16 16:12:06 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/LICENSE.sgml,v 1.8 2001/03/16 22:13:19 dawes Exp $ </ident> <sect>XFree86 License Index: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml:3.59.2.1 xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml:3.60.2.1 --- xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml:3.59.2.1 Sun Mar 4 04:41:30 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml Fri Jun 1 14:09:48 2001 @@ -12,7 +12,7 @@ <Date>Last modified on: 3 March 2001 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.59.2.1 2001/03/04 09:41:30 herrb Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/NetBSD.sgml,v 3.60.2.1 2001/06/01 18:09:48 dawes Exp $ </ident> <toc> @@ -56,8 +56,10 @@ <sect>New OS dependent features <p> +<![ %haverelnotes [ See the <htmlurl url="RELNOTES.html" name="Release Notes"> for non-OS dependent new features in XFree86 &relvers;. +]]> <sect1>New OS dependent features in 4.0.2 <p> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml:1.15.2.2 xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml:1.17 --- xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml:1.15.2.2 Fri Mar 16 10:57:43 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml Thu Apr 5 15:29:43 2001 @@ -9,7 +9,7 @@ <Date>Last modified on: 3 March 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.15.2.2 2001/03/16 15:57:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/OpenBSD.sgml,v 1.17 2001/04/05 19:29:43 dawes Exp $ </ident> <toc> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml:3.110.2.4 xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml:3.113.2.3 --- xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml:3.110.2.4 Fri Mar 16 10:57:44 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml Sat Jun 2 12:17:40 2001 @@ -5,6 +5,7 @@ <!ENTITY % threediffs 'IGNORE'> <!-- patch is split into three diff files --> <!ENTITY % fourdiffs 'INCLUDE'> <!-- patch is split into four diff files --> <!ENTITY % difftar 'INCLUDE'> <!-- patch also contains a tarball --> +<!ENTITY % removefiles 'INCLUDE'> <!-- patching requires removing some files --> ]> @@ -12,10 +13,10 @@ <title>README for XFree86&tm; &relvers; <author>The XFree86 Project, Inc -<date>2 March 2001 +<date>2 June 2001 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.110.2.4 2001/03/16 15:57:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/README.sgml,v 3.113.2.3 2001/06/02 16:17:40 dawes Exp $ </ident> <abstract> @@ -33,8 +34,9 @@ <![ %updaterel [ XFree86 &relvers; is the &whichupdaterel; update to &fullrelvers;, -the &whichfullrel; full release in the <![ %earlyrel; [new]]> XFree86 -4 series. +the &whichfullrel; full release in the +<![ %earlyrel; [new]]> +XFree86 4 series. Update releases are taken from a stable/maintenance branch. They are designed to be installed on top of the full release that they are @@ -44,8 +46,9 @@ ]]> <![ %fullrel [ -XFree86 &relvers; is the &whichfullrel; full release in the <![ %earlyrel; -[new]]> XFree86 4 series. +XFree86 &relvers; is the &whichfullrel; full release in the +<![ %earlyrel; [new]]> +XFree86 4 series. ]]> <p> @@ -77,8 +80,10 @@ Status document" url="Status.html"> first to see whether your hardware is supported before upgrading to the 4.x series. +<![ %haverelnotes [ Specific release enhancements can be viewed in the <htmlurl name="Release Notes" url="RELNOTES.html">. +]]> The XFree86 version numbering system has had some changes as of the 4.0.2 release. Information about this can be found in the @@ -238,7 +243,7 @@ <tt>X&fullsrcvers;src-1.tgz</tt>, <tt>X&fullsrcvers;src-2.tgz</tt>, <tt>X&fullsrcvers;src-3.tgz</tt>. The first contains everything except the fonts and general X11 documentation. It is sufficient for building -XFree86 is you already have a set of fonts. The second contains the +XFree86 if you already have a set of fonts. The second contains the fonts and the source for the general X11 documentation. The third contains the general X11 documentation in hardcopy format. @@ -339,14 +344,28 @@ gzip -d < &prevfullrelvers;-&fullrelvers;.diff4.gz | patch -p0 -E </verb></tscreen> <![ %difftar; [ +<![ %removefiles; [ +<tscreen><verb> +rm -f xc/programs/xieperf/images/image.012 +rm -fr xc/fonts/bdf/latin2 +rm -fr xc/fonts/bdf/100dpi +rm -fr xc/fonts/bdf/75dpi +</verb></tscreen> +]]> <tscreen><verb> gzip -d < &fullrelvers;.tgz | tar vxf - </verb></tscreen> ]]> ]]> + +<![ %prevrelwasupdate; [ +Patches might also be available relative to &prevrelvers;. If so, the +instructions for applying them are the same, except that you should start +with a clean &prevrelvers; source tree. +]]> -The contrib part of the distribution has been folded into the main -source tree, so a separate contrib tarball is no longer required. +The contrib part of the distribution was folded into the main source +tree a while ago, so a separate contrib tarball is not required. To format the XFree86 documentation use the latest version of our doctools package available as <tt>doctools-&doctoolsvers;.tgz</tt>. Index: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml:1.58.2.2 xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml:1.60.2.1 --- xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml:1.58.2.2 Fri Mar 16 10:57:44 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml Sat Jun 2 12:28:25 2001 @@ -6,10 +6,10 @@ <title>Release Notes for XFree86™ &relvers; <author>The XFree86 Project, Inc -<date>16 March 2001 +<date>17 December 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.58.2.2 2001/03/16 15:57:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/RELNOTES.sgml,v 1.60.2.1 2001/06/02 16:28:25 torrey Exp $ </ident> <abstract> @@ -83,44 +83,6 @@ <![ %updaterel [ <sect>Summary of updates in &relvers;. <p> -<itemize> - <item>Some temporary file-related security vulnerabilities are fixed. - <item>Screen corruption problems and palette saving problems with some - Neomagic chips are fixed. - <item>'XFree86 -configure' problems are fixed in some drivers (including - sis and i810). - <item>A problem with some plain S3 ViRGE cards is fixed. - <item>Some Xaw incompatibilities with Xaw6 are fixed. - <item>Some XKB files are updated. - <item>Some trident driver updates, including fixing acceleration for the - Cyber9388. - <item>A palette saving problem in the vgahw module is fixed. - <item>Support for the wsmouse protocol is added for OpenBSD/i386. - <item>A load problem with the sis driver module, and some depth 24 - problems are fixed. - <item>Support for the "PD" variant of the ATI Rage 128 is added. - <item>Support for GNU Hurd is updated. - <item>Some TrueType font problems are fixed. - <item>The mga driver doesn't attempt to drive the G450 if the "mga_hal" - module isn't available. - <item>A problem with bold font simulation in xterm is fixed. - <item>The (DPS) stub files created by pswrap are now compatible with the - Adobe version. - <item>Some glint driver problems are fixed. - <item>Support for building on OpenBSD-current, and multi-thread support - for OpenBSD are provided. - <item>A problem with the ThinkingMousePS/2 protocol is fixed in the mouse - driver. - <item>Support for the Render extension with Xinerama is added. - <item>A DGA-related server crash is fixed. - <item>Some Chips & Technologies driver bugs are fixed. - <item>Some tseng driver bugs are fixed. - <item>Some Alpha platform updates are included. - <item>Support for the GeForce3 is added to the nv driver. - <item>Misc build-related issues are fixed. - <item>Various documentation updates, including a reworked <htmlurl - name="XFree86(1)" url="XFree86.1.html"> manual page. -</itemize> </sect> ]]> @@ -130,9 +92,10 @@ <sect1>X server <p> <itemize> - <item>Darwin/Mac OS X is now supported and the X server runs on PowerPC. - The X server for this platform is called "Xdarwin", and its - installation and configuration is different from the "XFree86" + <item>Darwin/Mac OS X is now supported on PowerPC and Intel/x86. The X + server runs from the console or in cooperation with the Mac OS X + Aqua GUI. The X server for this platform is called "XDarwin", and + its installation and configuration is different from the "XFree86" server used on other platforms. Please read the <htmlurl url="Darwin.html" name="XFree86 on Darwin and Mac OS X"> document for further information. @@ -1097,12 +1060,14 @@ information to <tt>XF86Config</tt>. <p> -To allow a graceful transition for applications moving from core text -rendering to the Render extension, Xft can use either core fonts or -FreeType and the Render extension for text. By default, Xft is configured -to support only core fonts, see the section on building FreeType support -for the changes needed to add FreeType/Render fonts. +To allow a graceful transition for applications moving from core text +rendering to the Render extension, Xft can use either core fonts or FreeType +and the Render extension for text. By default, Xft is configured to support +both core fonts and FreeType fonts using the supplied version of FreeType +2. See the section on FreeType support in Xft for instructions on +configuring XFree86 to use an existing FreeType installation. + <p> The Xft library uses a configuration file, <tt>XftConfig</tt>, which contains information about which directories contain font files and also @@ -1110,32 +1075,30 @@ file is included in the Xft man page. </sect2> -<sect2>Building FreeType support for Xft +<sect2>FreeType support in Xft <p> -XFree86 &relvers; includes sources for FreeType version 2.0.1, but they are -not built and installed automatically. As a result, Xft is configured to -provide only core fonts by default. +XFree86 &relvers; includes sources for FreeType version 2.0.1, and, by +default, they are built and installed automatically. <p> -To build FreeType support for Xft, first FreeType must be built and -installed, either from the sources included in XFree86 in -<tt>extras/freetype2</tt> or from another FreeType (version 2.0.1 or later) -release. Early FreeType version 2 releases used a different header file + +If you prefer, you can configure XFree86 &relvers; to use an existing +Freetype2 installation by telling XFree86 not to build the internal copy and +indicating where that external version has been installed. Edit (or create) +<tt>config/cf/host.def</tt> to include: + +<itemize> + <item><tt>#define BuildFreetype2Library NO</tt> + <item><tt>#define Freetype2Dir /usr/local</tt> +</itemize> + +Note that XFree86 assumes you'll be using a release FreeType no older than +version 2.0.1. Early FreeType version 2 releases used a different header file installation and aren't compatible with XFree86. Instructions for building and installing FreeType can be found in the <tt>INSTALL</tt> file included with the FreeType release. -<p> -Second, XFree86 needs to know the installed location for FreeType, usually -<tt>/usr/local</tt>. Edit (or create) <tt>config/cf/host.def</tt> to -include: -<quote><p> - #define Freetype2Dir /usr/local -</quote> - -<p> -Finally, build XFree86 with "make World" from the top. </sect2> <sect2>Application Support For Anti-Aliased Text @@ -1161,8 +1124,8 @@ Xditview will use Xft instead of the core API by default. X11perf includes tests to measure the performance of text rendered in three ways, anti-aliased, anti-aliased with sub-pixel sampling and regular chunky -text, but through the Render extension, a path which has not been -optimized within the X server yet. +text, but through the Render extension, a path which is currently somewhat +slower than core text. </sect2> <sect1>Other extensions Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml:1.26.2.3 xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml:1.29.2.2 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml:1.26.2.3 Fri Mar 16 10:57:44 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml Fri Jun 1 14:09:49 2001 @@ -6,20 +6,19 @@ <title>Driver Status for XFree86™ &relvers; <author>The XFree86 Project, Inc -<date>4 December 2000 +<date>1 June 2001 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.26.2.3 2001/03/16 15:57:44 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Status.sgml,v 1.29.2.2 2001/06/01 18:09:49 dawes Exp $ </ident> <abstract> This document provides information about the status of the driver and hardware support in XFree86 &relvers; compared with that in XFree86 -&legacyvers;. Unless otherwise stated, hardware is classified as "supported" -if its driver provides basic 2D support. Support for additional features -may or may not be present. Please send updates for this document to -<email>fixes@xfree86.org</email> +&legacyvers;. Please send updates for this document to +<email>fixes@xfree86.org</email>. Please do not send requests for +information or support to that address (they will not be answered). </abstract> @@ -31,7 +30,10 @@ for each chipset family that is supported in XFree86 &legacyvers; or XFree86 &relvers;. It includes information about the status of the drivers and the hardware they support, including a comparison of the -level of support between versions &legacyvers; and &relvers;. +level of support between versions &legacyvers; and &relvers;. Unless +otherwise stated, hardware is classified as "supported" if its driver +provides basic 2D support. Support for additional features may or may +not be present. In XFree86 &legacyvers;, several X servers are available; much hardware uses the XF86_SVGA server, which has a set of driver modules that are built @@ -155,7 +157,7 @@ All chips supported in &legacyvers; are supported in &relvers; except for Mach8 and some old Mach32 chips. The support in &relvers; is, however, unaccelerated for all chips except the - Mach64, Rage and Rage 128 variants. + Mach64, Rage, Rage 128 and Radeon variants. </descrip> @@ -365,15 +367,17 @@ Linux, and requires the agpgart.o kernel module in order to use modes that require more than 1MB of video memory. -<tag>&relvers;:</tag> - Support (accelerated) for the Intel i740 is provided by the - "i740" driver, and support for the Intel i810 is provided by - the "i810" driver. The "i810" driver is currently Linux-only, - and requires the agpgart.o kernel module. +<tag>&relvers;:</tag> Support (accelerated) for the Intel i740 is + provided by the "i740" driver, and support for the Intel i810 + (including i810-dc100 and i810e) and i815 is provided by the + "i810" driver. The "i810" driver is currently supported only on + Linux and FreeBSD (4.1 and later), and requires the agpgart + kernel support. <tag>Summary:</tag> - The i740 and i810 are supported in both versions, but the i810 is - only supported on Linux/x86 platforms at present. + The i740 and i810 are supported in both versions, but the i810 + is only supported on Linux/x86 and recent FreeBSD/i386 platforms + at present. </descrip> @@ -461,7 +465,7 @@ <tag>&relvers;:</tag> Support (accelerated) for the Riva 128, 128ZX, TNT, TNT2 (Ultra, Vanta, M64), GeForce (DDR, 256), GeForce2 (GTS, Ultra, MX), Quadro, - Quadro2, and GeForce3 is provided by the "nv" driver. + and Quadro2 is provided by the "nv" driver. <tag>Summary:</tag> All chipsets supported in &legacyvers; except the NV1 are also Index: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml:1.1.2.1 xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml:1.1 --- xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml:1.1.2.1 Fri Mar 16 09:55:41 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml Wed Feb 7 13:49:31 2001 @@ -10,7 +10,7 @@ <date>28 January 2001 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml,v 1.1.2.1 2001/03/16 14:55:41 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/Versions.sgml,v 1.1 2001/02/07 18:49:31 dawes Exp $ </ident> <abstract> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml:3.34 xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml:3.37 --- xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml:3.34 Thu Dec 7 10:43:41 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml Mon Apr 16 11:02:08 2001 @@ -8,14 +8,14 @@ <title>ATI Adapters README file <author>Marc Aurele La France -<date>2000 December 6 +<date>2001 April 10 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/ati.sgml,v 3.34 2000/12/07 15:43:41 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> @@ -208,7 +208,7 @@ A ChipSet name of ``<it>vgawonder</it>'' is equivalent to ``<it>ativga</it>'', except that only VGAWonder-capable adapters can be assigned to the ``Device'' section. -This specifically excludes newer Mach64's with integrated controllers.<p> +This specifically excludes the newer integrated Mach64 controllers.<p> In some PCI or AGP systems, the driver will not, by default, probe for non-PCI Mach32's or Mach64's. This is because, before doing any such probe, the driver attempts to determine @@ -394,7 +394,24 @@ or an integrated Mach64 graphics chip. This option disables this linear aperture.<p> On non-Intel platforms, the driver requires a linear aperture and, so, this -option should not be specified.<p> +option is ignored.<p> +<sect1>Option <it>``HWCursor''</it> and Option <it>``SWCursor''</it><p> +Option <it>``HWCursor''</it>, which is the default, specifies that hardware +facilities are to be used to paint the mouse pointer on the screen. +Option <it>``SWCursor''</it> specifies that the mouse pointer is to by drawn by +software, which is much slower. +If both options are specified, option <it>``SWCursor''</it> prevails. +Currently, these options are only acted upon for 256-colour or higher depth +modes, if a Mach64 accelerator CRTC, or a Mach64 integrated controller is being +used. +In all other situations, a software cursor will be used.<p> +<sect1>Option <it>``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 @@ -562,7 +579,7 @@ newsgroups using your favourite archiving service can also prove useful in resolving problems.<p> If you are still experiencing problems, you can send me <it>non-HTMLised</it> -e-mail at <email>tsi@ualberta.ca</email>. +e-mail at <email>tsi@xfree86.org</email>. Please be as specific as possible when describing the problem(s), and include an <it>unedited</it> copy of the server's log and the XF86Config file used.<p> <sect>Driver history<p> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml:3.33 xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml:3.36 --- xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml:3.33 Sat Dec 2 16:52:22 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml Fri May 18 20:35:42 2001 @@ -8,10 +8,10 @@ <title> Information for Chips and Technologies Users <author> David Bateman (<email>dbateman@club-internet.fr</email>), Egbert Eich (<email>eich@xfree86.org</email>) -<date> 14th June 2000 +<date> 1st January 2001 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml,v 3.33 2000/12/02 21:52:22 dbateman Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/chips.sgml,v 3.36 2001/05/19 00:35:42 dawes Exp $ </ident> <!-- Table of contents --> @@ -276,15 +276,6 @@ programmable clock makes this option obsolete and so it's use isn't recommended. It is completely ignored for HiQV chipsets. <tag> -Option "UseVclk1" -</tag> - The HiQV series of chips have three programmable clocks. The - first two are usually loaded with 25.175 and 28.322MHz for - VGA backward compatibility, and the third is used as a fully - programmable clock. On at least one system (the Inside 686 LCD/S - single board computer) the third clock is unusable. This option - forces the use of VClk1 as the programmable clock. -<tag> TextClockFreq 25.175 </tag> Except for the HiQV chipsets, it is impossible for the server to read @@ -311,6 +302,16 @@ less, 16, 24 or 32bpp LCD panel clocks, where the options above set the clocks to 65MHz. <tag> +Option "CRTClkIndx" "2" +Option "FPClkIndx" "1" +</tag> + The HiQV series of chips have three programmable clocks. The + first two are usually loaded with 25.175 and 28.322MHz for + VGA backward compatibility, and the third is used as a fully + programmable clock. On at least one system (the Inside 686 LCD/S + single board computer) the third clock is unusable. These options + can be used to force a particular clock index to be used +<tag> Option "MMIO" </tag> This has a different effect depending on the hardware on which it @@ -318,12 +319,14 @@ BitBLT engine and is only usable with PCI buses. It is enabled by default for 65545 machines since the blitter can not be used otherwise. The HiQV series of chipsets must use MMIO with their - BitBLT engines, and so this is enabled by default. However the - 690xx chipsets can use MMIO for all communications with the video - processor. So using this option on a 690xx chipset forces them - to use MMIO for all communications. This only makes sense when - the 690xx is on a PCI bus so that normal PIO can be disabled. - (WARNING!! 690xx MMIO is untested) + BitBLT engines, and so this is enabled by default. +<tag> +Option "FullMMIO" +</tag> + The 690xx chipsets can use MMIO for all communications with the + video processor. So using this option on a 690xx chipset forces + them to use MMIO for all communications. This only makes sense + when the 690xx is on a PCI bus so that normal PIO can be disabled. <tag> Option "SuspendHack" </tag> @@ -442,6 +445,22 @@ 8bit depth, 0 to 32,767 for 15bit depth, etc. This option might be used if the default video overlay key causes problems. <tag> +Option "DualRefresh" +</tag> + The 69030 chipset has independent display channels, that can be + configured to support independent refresh rates on the flat panel + and on the CRT. The default behaviour is to have both the flat panel + and the CRT use the same display channel and thus the same refresh + rate. This option forces the two display channels to be used, giving + independent refresh rates. +<tag> +Option "Crt2Memory" "2048" +</tag> + The ct69030 supports dual-head display. By default the two display + share equally the available memory. This option forces the second + display to take a particular amount of memory. Please read the + section below about dual-head display. +<tag> Option "XaaNoScreenToScreenCopy", Option "XaaNoSolidFillRect", Option "XaaNoSolidHorVertLine", @@ -532,6 +551,12 @@ they specified after a suspend/resume or LCD/CRT switch. For a complete discussion on the dot clock limitations, see the next section. +<tag> * Dual-head display </tag> + Dual-head display has two effects on the modelines. Firstly, + the memory requirements of both heads must fit in the available + memory. Secondly, the memory bandwidth of the video processor is + shared between the two heads. Hence the maximum dot-clock might + need to be limited. </descrip> The driver is capable of driving both a CRT and a flat panel @@ -572,6 +597,105 @@ knowledge no machine with a HiQV needs the "UseModeline" or "FixPanelSize" options. +<sect> Dual Display Channel<p> + +XFree86 releases later than 4.1.0 support dual-channel display on the ct69030. +This support can be used to give a single display image on two screen with +different refresh rates, or entirely different images on the two displays. + +Dual refresh rate display can be selected with the "<tt>DualRefresh</tt>" +option described above. However to use the dual-head support is slightly +more complex. Firstly, the ct69030 chipset must be installed on a PCI bus. This +is a driver limitation that might be relaxed in the future. In addition the +device, screen and layout sections of the "<tt>XF86Config</tt>" must be +correctly configured. A sample of an incomplete "<tt>XF86Config</tt>" is +given below + +<quote><verb> +Section "Device" + Identifier "Chips and Technologies - Pipe A" + Driver "chips" + BusID "PCI:0:20:0" + Screen 0 +EndSection + +Section "Device" + Identifier "Chips and Technologies - Pipe B" + Driver "chips" + BusID "PCI:0:20:0" + Screen 1 +EndSection + +Section "Screen" + Identifier "Screen 0" + Device "Chips and Technologies - Pipe A" + Monitor "generic LCD" + + SubSection "Display" + Depth 16 + Modes "1024x768" + EndSubsection +EndSection + +Section "Screen" + Identifier "Screen 1" + Device "Chips and Technologies - Pipe B" + Monitor "generic CRT" + + SubSection "Display" + Depth 16 + Modes "1024x768" + EndSubsection +EndSection + +Section "ServerLayout" + Identifier "Main Layout" + Screen "Screen 0" + Screen "Screen 1" RightOf "Screen 0" + InputDevice "Mouse1" "CorePointer" + InputDevice "Keyboard1" "CoreKeyboard" +EndSection +</verb></quote> + +The device section must include the PCI BusID. This can be found from the +log file of a working single-head installation. For instance, the line + +<quote><verb> +(--) PCI:*(0:20:0) C&T 69030 rev 97, Mem @ 0xed000000/24 +</verb></quote> + +appears for the case above. Additionally, the "<tt>Screen</tt>" option +must appear in the device section. It should be noted that if a flat +panel is used, this it must be allocated to "<tt>Screen 0</tt>". + +The server can then be started with the "<tt>+xinerama</tt>" option +as follows + +<quote><verb> +startx -- +xinerama +</verb></quote> + +For more information, read the Xinerama documentation. + +It should be noted that the dual channel display options of the 69030 +require the use of additional memory bandwidth, as each display channel +independently accesses the video memory. For this reason, the maximum +colour depth and resolution that can be supported in a dual channel mode +will be reduced compared to a single display channel mode. However, as +the driver does not prevent you from using a mode that will exceed the +memory bandwidth of the 69030, but a warning like + +<quote><verb> +(WW) Memory bandwidth requirements exceeded by dual-channel +(WW) mode. Display might be corrupted!!! +</verb></quote> + +If you see such display corruption, and you have this warning, your choices +are to reduce the refresh rate, colour depth or resolution, or increase the +speed of the memory clock with the the "<tt>SetMClk</tt>" option described +above. Note that increasing the memory clock also has its own problems as +described above. + <sect> The Full Story on Clock Limitations <p> There has been much confusion about exactly what the clock limitations @@ -623,19 +747,29 @@ maximum usable dotclock on the HiQV series of chips is <verb> +Max dotclock = min(MaxDClk, 0.70 * 8 * MemoryClk / (BytesPerPixel + + (isDSTN == TRUE ? 1 : 0))) +</verb> + +if you chips is a 69030 or 69000 or + +<verb> Max dotclock = min(MaxDClk, 0.70 * 4 * MemoryClk / (BytesPerPixel + (isDSTN == TRUE ? 1 : 0))) </verb> + -which says that there are two limits on the dotclock. One the overall -maximum, and another due to the available memory bandwidth of the chip. -For the memory bandwidth 4 bytes are transfered every clock cycle (Hence -the 4), but after accounting for the RAS/CAS signaling only about 70% -of the bandwidth is available. The whole thing is divided by the bytes -per pixel, plus an extra byte if you are using a DSTN. The extra byte -with DSTN screens is used for the frame buffering/acceleration in these -screens. So for the various Chips and Technologies chips the maximum -specifications are +otherwise. This effectively means that there are two limits on the +dotclock. One the overall maximum, and another due to the available +memory bandwidth of the chip. The 69030 and 69000 have a 64bit memory +bus and thus transfer 8 bytes every clock thus (hence the 8), while +the other HiQV chipsets are 32bit and transfer 4 bytes per clock cycle +(hence the 4). However, after accounting for the RAS/CAS signaling +only about 70% of the bandwidth is available. The whole thing is +divided by the bytes per pixel, plus an extra byte if you are using a +DSTN. The extra byte with DSTN screens is used for the frame +buffering/acceleration in these screens. So for the various Chips and +Technologies chips the maximum specifications are <verb> Max DClk MHz Max Mem Clk MHz @@ -666,8 +800,8 @@ 65554 94.5 77 51.33 77 51.33 38.5 65555 110 77 51.33 77 51.33 38.5 68554 110 77 51.33 77 51.33 38.5 -69000 135 116.2 77.47 116.2 77.47 58.1 -69030 170 140 93.33 140 93.33 70 +69000 135 135 135 135 135 116.2 +69030 170 170 170 170 170 140 </verb> If you exceed the maximum set by the memory clock, you'll get corruption @@ -841,9 +975,9 @@ However, 8 and 24 bit colour depths seem to work fine. <tag> My ct69030 machine locks up when starting XFree</tag> The ct69030 chipset introduced a new dual channel architecture. In its - current form, XFree can not take advantage of this second display + current form, XFree86 can not take advantage of this second display channel. In fact if the video BIOS on the machine sets the ct69030 - to a dual channel mode by default, XFree will lockup hard at this + to a dual channel mode by default, XFree86 will lockup hard at this point. The solution is to use the BIOS setup to change to a single display channel mode, ensuring that both the IOSS and MSS registers are set to a single channel mode. Work is underway to fix this. @@ -885,7 +1019,8 @@ 65.10MHz is not. So for unexplained problems not addressed above, please try to alter the clock you are using slightly, say in steps of 0.05MHz and see if the problem goes away. Alternatively, using the - "<tt>UseVClk1</tt>" option with HiQV chips might also help. + "<tt>CRTClkIndx</tt>" or "<tt>FPClkIndx</tt>" option with HiQV chips might + also help. For other screen drawing related problems, try the "<tt>NoAccel</tt>" or Index: xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent:1.15.2.1 xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent:1.16.2.3 --- xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent:1.15.2.1 Thu Feb 8 23:25:04 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent Sat Jun 2 12:17:40 2001 @@ -1,18 +1,18 @@ -<!-- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent,v 1.15.2.1 2001/02/09 04:25:04 dawes Exp $ --> +<!-- $XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/defs.ent,v 1.16.2.3 2001/06/02 16:17:40 dawes Exp $ --> <!-- shared entity definitions for the XFree86 documentation --> <!-- XFree86 version string --> -<!ENTITY relvers CDATA "4.0.3"> -<!ENTITY prevrelvers CDATA "4.0.2"> -<!ENTITY fullrelvers CDATA "4.0.2"> -<!ENTITY prevfullrelvers CDATA "4.0.1"> -<!ENTITY srcvers CDATA "403"> -<!ENTITY prevsrcvers CDATA "402"> -<!ENTITY fullsrcvers CDATA "402"> -<!ENTITY prevfullsrcvers CDATA "401"> -<!ENTITY whichfullrel CDATA "third"> -<!ENTITY whichupdaterel CDATA "first"> +<!ENTITY relvers CDATA "4.1.0"> +<!ENTITY prevrelvers CDATA "4.0.3"> +<!ENTITY fullrelvers CDATA "4.1.0"> +<!ENTITY prevfullrelvers CDATA "4.0.2"> +<!ENTITY srcvers CDATA "410"> +<!ENTITY prevsrcvers CDATA "403"> +<!ENTITY fullsrcvers CDATA "410"> +<!ENTITY prevfullsrcvers CDATA "402"> +<!ENTITY whichfullrel CDATA "fourth"> +<!ENTITY whichupdaterel CDATA "none"> <!-- Version of the most recent 3.3.x release --> <!ENTITY legacyvers CDATA "3.3.6"> @@ -30,8 +30,12 @@ <!ENTITY % snapshot 'IGNORE'> <!ENTITY % release 'INCLUDE'> <!ENTITY % firstrel 'IGNORE'> -<!ENTITY % earlyrel 'INCLUDE'> +<!ENTITY % earlyrel 'IGNORE'> <!ENTITY % laterrel 'INCLUDE'> -<!ENTITY % fullrel 'IGNORE'> -<!ENTITY % updaterel 'INCLUDE'> +<!ENTITY % fullrel 'INCLUDE'> +<!ENTITY % updaterel 'IGNORE'> +<!ENTITY % prevrelwasupdate 'INCLUDE'> + +<!-- Set this to INCLUDE when references to the RELNOTES are to be included --> +<!ENTITY % haverelnotes 'IGNORE'> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml diff -u /dev/null xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml:1.1 --- /dev/null Mon Jun 4 12:40:39 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml Thu Mar 1 21:45:37 2001 @@ -0,0 +1,192 @@ +<!doctype LINUXDOC PUBLIC "-//XFree86//DTD linuxdoc//EN" [ +<!ENTITY % defs SYSTEM "defs.ent"> %defs; +]> + +<article> + +<title>XFree86 and DPS +<author>Juliusz Chroboczek, <email/jch@xfree86.org/ +<date>27 February 2001</date> + +<ident>$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/dps.sgml,v 1.1 2001/03/02 02:45:37 dawes Exp $</ident> + +<toc> + +<sect>Introduction + +<p>Display Postscript (or DPS for short) is a rendering extension for +X11. DPS is slightly atypical in that it is based on <it/code +mobility/, the ability to send executable code from client to server. +Thus, a DPS client does not request that a line should be rendered; +instead, it uploads code to the server which, when executed, causes a +line to be drawn. + +<p>This document does not aim at teaching programming with DPS; it is +only a summary description of the DPS support code included with +XFree86. More information about DPS, including a DPS bibliography, is +available from +<url url="http://dps.sourceforge.net" name="the DPS extension site">. + +<tscreen> +<it>Note: Adobe, PostScript and Display PostScript are trademarks of +Adobe Systems Incorporated which may be registered in certain +jurisdictions.</it> +</tscreen> + +As all X11 extensions, DPS consists of client-side and server-side +components. The DPS client side consists of a number of libraries and +a number of tools for programming and configuration. The DPS server +side may consist either of an X server extension, or of a client-side +process known as the ``DPS agent.'' In this latter case, the term +``server-side'' is somewhat misleading. + +At the time of writing, only the client side is included with XFree86; +the server side must be obtained separately. Please see <ref +id="sec:server-side" name="server side"> later in this document for +more information. + +<sect>The DPS client side + +<p>The DPS client side consists of four libraries and a number of +basic tools for programming and configuration; these are all included +with XFree86. + +<sect1>Libraries + +<p>The <tt/libpsres/ library is a library for management of +<it/PostScript resources/, on-disk files representing PostScript data +structures such as fonts, font encodings, procsets, <it/etc./ It is +closely related to the <tt/makepsres/ tool (see <ref id="sec:tools" +name="client-side tools"> later in this document). + +The basic DPS client library is <tt/libdps/. This library contains a +number of functions for connection establishment, resource management, +as well as stubs for all standard PostScript operators. Normally, all +DPS clients should link with <tt/libdps/; in addition, <tt/libdps/ may +be used for printing by non-DPS clients (this is done, for example, by +Sun's JDK). This library is documented in [CLRM] and [CLSX]. + +The <tt/libdpstk/ library contains a number of additional utilities +for managing DPS contexts, user paths and user objects, and for +previewing EPS files. It is documented in [DPTX]. + +The <tt/libdpstkXm/ library contains four Motif widgets. The <it/DPS +Scrolling Widget/ is a DPS drawing area that automatically manages +issues such as scrolling, scaling, client-side backing store, +incremental redisplay, <it/etc./ The <it/Font Selection Box/, and its +associated <it/Font Preview/, present a convenient and powerful +interface for choosing scalable fonts. Finally, the <it/Color Picker/ +presents an interface for choosing colours using either of the RGB or +HSV spaces. The latter three widgets are documented in [DPTX]; some +summary Scrolling Widget documentation is available in the <tt/doc/ +subdirectory of the <tt/DPS.tar.gz/ file, available from <url +url="ftp://dps.sourceforge.net/pub/dps/DPS.tar.gz">. + +The source code for <tt/libdpstkXm/ is included with XFree86; however, +as it depends on Motif, this library is not built by default. +A GTK-based library providing some of the functionality of +<tt/libdpstkXm/ is available from +<url url="http://www.gyve.org/gtkDPS/" + name="the gtkDPS site">. + +<sect2>Libdps and Xt + +<p>In X11R5, <tt/libdps/ did not depend on <tt/libXt/. In X11R6, +however, code was added to make the Xt main loop dispatch to sundry +code on DPS events; with this addition, all programs that link with +<tt/libdps/ need to link with <tt/libXt/, whether they use Xt or not. + +This state of affairs is unfortunately true of the version of +<tt/libdps/ included with XFree86. We are currently considering +various solutions to this problem (including the use of weak linker +symbols or splitting off the guilty functions into a separate +library). + +<sect1>Client-side tools <label id="sec:tools"> + +<p>In addition to the libraries, the client side of DPS consists of two +utilities. + +The <tt/makepsres/ utility is used for managing PostScript resources. +Its basic operation consists in walking recursively a filesystem tree, +noting all resources, and then writing out a ``Unix PostScript +Resources,'' file, basically a directory of all the resources found. +This utility is documented in the makepsres(1) manual page. + +The <tt/pswrap/ utility is a stub generator for PostScript clients. +Roughly speaking, it takes as its input textual PostScript code, and +generates a collection of C functions that transmit that code in +pre-tokenised form to the DPS extension. <tt/Pswrap/ is documented in +[PSWRAP]. + +<sect1>Sample clients + +<p>XFree86 contains three sample DPS clients, <tt/dpsinfo/, +<tt/dpsexec/ and <tt/texteroids/. They are documented in their +respective manual pages. + +A number of sample clients that depend on Motif are available in <url +url="ftp://dps.sourceforge.net/pub/ftp/DPS.tar.gz">. Additional +sample clients can be found as part of GtkDPS (see above). + +The GNUstep environment can be compiled to use DPS for +all rendering; for more information, please see +<url url="http://www.gnustep.org" name="the GNUstep site">. + +<sect>The DPS server side <label id="sec:server-side"> + +<p>In order to use DPS clients, you need to install a DPS server side, +which can be either a server extension (a ``DPS/X extension''), or a +separate process (referred to, variously, either as a ``DPS/NX agent'' +or, rather confusingly, as ``Client-Side DPS'' (CSDPS). + +<sect1>Display Ghostscript + +<p>Display Ghostscript (note the capitalisation), or DGS, is a +client-side implementation of DPS based on the Ghostscript +PostScript interpreter. DGS is still in beta at the time of writing; +it does, however, provide a very usable implementation of DPS, +although it still has some problems with the semantics of multiple DPS +contexts. + +DGS is available from +<url url="http://www.gnustep.org/resources/sources.html" + name="the GNUstep download area">. + +<sect1>The DPS extension + +<p>The DPS extension is a much younger project aiming at producing an +efficient server-side implementation of DPS. The extension is +currently in a state best described as alpha; current versions are +known to crash the X server under some circumstances. + +The DPS extension is available from +<url url="http://dps.sourceforge.net" name="the DPS extension site">. + +<sect>References + +<p>Links to electronic versions of all of these, and more, are +available from <url url="http://dps.sourceforge.net" name="the DPS +extension site">. + +[PLRM2] PostScript language reference manual. Adobe Systems, 2nd ed. Addison-Wesley, 1990. ISBN 0-201-18127-4. + +[PLRM] PostScript language reference. Adobe Systems Incorporated, 3rd +ed. Addison-Wesley, 1999. ISBN 0-201-37922-8. + +[INTRO] Display PostScript System. Introduction: Perspective for +Software Developers. 15 April 1993. + +[CLRM] Display PostScript System. Client Library Reference Manual. 15 +April 1993. + +[CLSX] Display PostScript System. Client Library Supplement for X. 15 +April 1993. + +[DPTX] Display PostScript System. Display PostScript Toolkit for X. 15 +April 1993. + +[PSWRAP] Display PostScript System. pswrap Reference Manual. 15 April +1993. + +</article> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml:1.11.2.1 xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml:1.13 --- xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml:1.11.2.1 Wed Feb 28 15:06:21 2001 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml Wed Feb 28 19:37:09 2001 @@ -9,7 +9,7 @@ <date>21 January 2001</date> <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.11.2.1 2001/02/28 20:06:21 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/fonts.sgml,v 1.13 2001/03/01 00:37:09 dawes Exp $ </ident> <toc> Index: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml diff -u xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml:1.2 xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml:1.3 --- xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml:1.2 Fri Mar 3 19:00:30 2000 +++ xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml Tue Apr 3 21:34:18 2001 @@ -7,7 +7,7 @@ <author>Precision Insight, Inc. <date>3 March 2000 <ident> -$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.2 2000/03/04 00:00:30 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/doc/sgml/i810.sgml,v 1.3 2001/04/04 01:34:18 dawes Exp $ </ident> <toc> @@ -19,6 +19,7 @@ <item>i810, <item>i810-dc100, <item>i810e + <item>i815 </itemize> </itemize> @@ -43,16 +44,17 @@ in 32 bit per pixel format, and this mode is not supported by this driver. <item>Interlace modes cannot be supported. - <item>This driver currently only works for Linux/ix86, and normal use - requires the agpgart.o kernel module, included in Linux kernels - 2.3.42 and higher. + <item>This driver currently only works for Linux/ix86 and recent versions + of FreeBSD. It requires the agpgart kernel support, which is + included in Linux kernels 2.3.42 and higher, and FreeBSD 4.1 + and higher. </itemize> <sect>Reported Working Video Cards <p> <itemize> - <item>Intel evaluation hardware - i810, i810-dc100 and i810e. + <item>Intel evaluation hardware - i810, i810-dc100, i810e and i815. <item>Tyan Tomcat Motherboard. <item>HappyPC set-top box. </itemize> Index: xc/programs/Xserver/hw/xfree86/drivers/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/Imakefile:1.20 xc/programs/Xserver/hw/xfree86/drivers/Imakefile:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/Imakefile:1.20 Tue Nov 28 15:59:17 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/Imakefile Thu Apr 5 15:29:43 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/Imakefile,v 1.20 2000/11/28 20:59:17 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/Imakefile,v 1.21 2001/04/05 19:29:43 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -15,7 +15,7 @@ i810/?*_drv.o imstt/?*_drv.o mga/?*_drv.o neomagic/?*_drv.o \ nv/?*_drv.o rendition/?*_drv.o s3virge/?*_drv.o sis/?*_drv.o \ tdfx/?*_drv.o tga/?*_drv.o trident/?*_drv.o tseng/?*_drv.o \ - vesa/?*_drv.o vga/?*_drv.o siliconmotion/?*.drv.o + vesa/?*_drv.o vga/?*_drv.o siliconmotion/?*.drv.o vmware/?*_drv.o #endif Index: xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile:1.20 xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile:1.20 Tue Sep 19 20:09:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile Wed Apr 25 13:46:42 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/Imakefile,v 1.20 2000/09/20 00:09:18 keithp 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 @@ #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 \ @@ -41,7 +41,6 @@ InstallObjectModule(apm,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(apm,) InstallModuleManPage(apm) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm.cpp:1.5 xc/programs/Xserver/hw/xfree86/drivers/apm/apm.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm.cpp:1.5 Mon Dec 11 15:18:05 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm.cpp Mon Jun 4 12:40:39 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.cpp,v 1.5 2000/12/11 20:18:05 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH APM __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -apm \- Alliance ProMotion video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qapm\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B apm -is an XFree86 driver for Alliance ProMotion video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B apm -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h:1.15 xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h:1.15 Fri Jun 30 14:27:02 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm.h Fri May 4 15:05:31 2001 @@ -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.17 2001/05/04 19:05:31 dawes Exp $ */ /* All drivers should typically include these */ @@ -33,19 +33,8 @@ #include "xf1bpp.h" #include "xf4bpp.h" -/* Drivers using cfb need this */ +#include "fb.h" -#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" - /* Drivers using the XAA interface ... */ #include "xaa.h" #include "xaalocal.h" @@ -186,6 +175,7 @@ XF86VideoAdaptorPtr adaptor; int timerIsOn; Time offTime; + OptionInfoPtr Options; } ApmRec, *ApmPtr; #define curr ((unsigned char *)pApm->regcurr) @@ -233,6 +223,8 @@ extern Bool ApmSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); extern void ApmAdjustFrame(int scrnIndex, int x, int y, int flags); +extern void ApmHWCursorReserveSpace(ApmPtr pApm); +extern void ApmAccelReserveSpace(ApmPtr pApm); extern int ApmPixmapIndex; #define APM_GET_PIXMAP_PRIVATE(pix)\ Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man:1.2 --- /dev/null Mon Jun 4 12:40:39 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man Sat Jan 27 13:20:46 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm.man,v 1.2 2001/01/27 18:20:46 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH APM __drivermansuffix__ __vendorversion__ +.SH NAME +apm \- Alliance ProMotion video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qapm\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B apm +is an XFree86 driver for Alliance ProMotion video cards. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B apm +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c:1.16.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c:1.14 Fri Jun 30 14:27:02 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c Wed May 23 16:21:52 2001 @@ -1,6 +1,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c,v 1.14 2000/06/30 18:27:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_accel.c,v 1.16.2.1 2001/05/23 20:21:52 dawes Exp $ */ +#define COMPILER_H_EXTRAS #include "apm.h" #include "miline.h" @@ -158,7 +159,7 @@ 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) { @@ -301,10 +302,12 @@ SETROP(ROP_S_xor_D); SETROP(ROP_S); +#if 0 if (XAAPixmapOps.CopyArea != ApmCopyAreaPixmap) { SaveCopyAreaPixmap = XAAPixmapOps.CopyArea; XAAPixmapOps.CopyArea = ApmCopyAreaPixmap; } +#endif ApmSetupXAAInfo(pApm, pXAAinfo); Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c:1.8 Mon Feb 14 14:20:46 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c Sat Jan 6 16:29:11 2001 @@ -1,11 +1,11 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c,v 1.8 2000/02/14 19:20:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_dga.c,v 1.9 2001/01/06 21:29:11 tsi Exp $ */ /* * file: apm_dga.c * ported from s3virge, ported from mga * */ - +#define COMPILER_H_EXTRAS #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c:1.46 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c:1.50 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c:1.46 Sat Dec 2 10:30:31 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c Fri May 4 15:05:31 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.46 2000/12/02 15:30:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_driver.c,v 1.50 2001/05/04 19:05:31 dawes Exp $ */ - +#define COMPILER_H_EXTRAS #include "apm.h" #include "xf86cmap.h" #include "shadowfb.h" @@ -9,10 +9,9 @@ #include "xf86RAC.h" #include "vbe.h" -#ifdef DPMSExtension #include "opaque.h" +#define DPMS_SERVER #include "extensions/dpms.h" -#endif #define VERSION 4000 #define APM_NAME "APM" @@ -28,7 +27,7 @@ #define TEXT_AMOUNT 32768 /* Mandatory functions */ -static OptionInfoPtr ApmAvailableOptions(int chipid, int busid); +static const OptionInfoRec * ApmAvailableOptions(int chipid, int busid); static void ApmIdentify(int flags); static Bool ApmProbe(DriverPtr drv, int flags); static Bool ApmPreInit(ScrnInfoPtr pScrn, int flags); @@ -47,17 +46,14 @@ ApmRegPtr ApmReg); static void ApmLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual); -#ifdef DPMSExtension static void ApmDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif static void ApmProbeDDC(ScrnInfoPtr pScrn, int index); int ApmPixmapIndex = -1; static int ApmGeneration = -1; -static int pix24bpp = 0; DriverRec APM = { VERSION, @@ -99,7 +95,7 @@ OPTION_PCI_RETRY } ApmOpts; -static OptionInfoRec ApmOptions[] = +static const OptionInfoRec ApmOptions[] = { {OPTION_SET_MCLK, "SetMclk", OPTV_FREQ, {0}, FALSE}, @@ -199,14 +195,11 @@ #ifdef XFree86LOADER -static const char *cfbSymbols[] = { +static const char *fbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", - "cfbScreenInit", - "cfb16ScreenInit", - "cfb24ScreenInit", - "cfb32ScreenInit", - "cfb24_32ScreenInit", + "fbScreenInit", + "fbPictureInit", NULL }; @@ -240,7 +233,7 @@ setupDone = TRUE; xf86AddDriver(&APM, module, 0); - LoaderRefSymLists(vgahwSymbols, cfbSymbols, xaaSymbols, + LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, /*xf8_32bppSymbols,*/ ramdacSymbols, vbeSymbols, ddcSymbols, i2cSymbols, shadowSymbols, NULL); @@ -301,8 +294,7 @@ ApmChipsets); } -static -OptionInfoPtr +static const OptionInfoRec * ApmAvailableOptions(int chipid, int busid) { return ApmOptions; @@ -482,8 +474,6 @@ return (STATUS_IOP() & STATUS_SDA) != 0; } -extern xf86MonPtr ConfiguredMonitor; - static void ApmProbeDDC(ScrnInfoPtr pScrn, int index) { @@ -621,7 +611,10 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ApmOptions); + if (!(pApm->Options = xalloc(sizeof(ApmOptions)))) + return FALSE; + memcpy(pApm->Options, ApmOptions, sizeof(ApmOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pApm->Options); pApm->scrnIndex = pScrn->scrnIndex; /* Set the bits per RGB for 8bpp mode */ @@ -629,16 +622,16 @@ /* Default to 8 */ pScrn->rgbBits = 8; } - if (xf86ReturnOptValBool(ApmOptions, OPTION_NOLINEAR, FALSE)) { + if (xf86ReturnOptValBool(pApm->Options, OPTION_NOLINEAR, FALSE)) { pApm->noLinear = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "No linear framebuffer\n"); } from = X_DEFAULT; pApm->hwCursor = FALSE; - if (xf86GetOptValBool(ApmOptions, OPTION_HW_CURSOR, &pApm->hwCursor)) + if (xf86GetOptValBool(pApm->Options, OPTION_HW_CURSOR, &pApm->hwCursor)) from = X_CONFIG; if (pApm->noLinear || - xf86ReturnOptValBool(ApmOptions, OPTION_SW_CURSOR, FALSE)) { + xf86ReturnOptValBool(pApm->Options, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pApm->hwCursor = FALSE; } @@ -647,24 +640,24 @@ from = X_DEFAULT; if (pScrn->bitsPerPixel < 8) pApm->NoAccel = TRUE; - if (xf86ReturnOptValBool(ApmOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pApm->Options, OPTION_NOACCEL, FALSE)) { from = X_CONFIG; pApm->NoAccel = TRUE; } if (pApm->NoAccel) xf86DrvMsg(pScrn->scrnIndex, from, "Acceleration disabled\n"); - if (xf86GetOptValFreq(ApmOptions, OPTION_SET_MCLK, OPTUNITS_MHZ, &real)) { + if (xf86GetOptValFreq(pApm->Options, OPTION_SET_MCLK, OPTUNITS_MHZ, &real)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "MCLK used is %.1f MHz\n", real); pApm->MemClk = (int)(real * 1000.0); } - if (xf86ReturnOptValBool(ApmOptions, OPTION_SHADOW_FB, FALSE)) { + if (xf86ReturnOptValBool(pApm->Options, OPTION_SHADOW_FB, FALSE)) { pApm->ShadowFB = TRUE; pApm->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using \"Shadow Framebuffer\" - acceleration disabled\n"); } - if (xf86ReturnOptValBool(ApmOptions, OPTION_PCI_RETRY, FALSE)) { - if (xf86ReturnOptValBool(ApmOptions, OPTION_PCI_BURST, FALSE)) { + if (xf86ReturnOptValBool(pApm->Options, OPTION_PCI_RETRY, FALSE)) { + if (xf86ReturnOptValBool(pApm->Options, OPTION_PCI_BURST, FALSE)) { pApm->UsePCIRetry = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry enabled\n"); } @@ -1050,25 +1043,11 @@ 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; } @@ -1804,26 +1783,8 @@ ApmSaveScreen(pScreen, SCREEN_SAVER_ON); 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(); @@ -1865,6 +1826,8 @@ ApmHWCursorReserveSpace(pApm); ApmAccelReserveSpace(pApm); + miSetPixmapDepths(); + switch (pScrn->bitsPerPixel) { case 1: ret = xf1bppScreenInit(pScreen, FbBase, @@ -1879,31 +1842,14 @@ 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, @@ -1978,9 +1924,7 @@ if (pApm->ShadowFB) ShadowFBInit(pScreen, ApmRefreshArea); -#ifdef DPMSExtension xf86DPMSInit(pScreen, ApmDisplayPowerManagementSet, 0); -#endif if (pApm->noLinear) ApmInitVideo_IOP(pScreen); @@ -2233,7 +2177,6 @@ * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -#ifdef DPMSExtension static void ApmDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -2270,7 +2213,6 @@ WRXB(0xD0, (tmp & 0xFC) | dpmsreg); } } -#endif static Bool ApmSaveScreen(ScreenPtr pScreen, int mode) Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c:1.5 Tue Apr 4 15:25:04 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c Sat Jan 6 16:29:12 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c,v 1.5 2000/04/04 19:25:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_i2c.c,v 1.6 2001/01/06 21:29:12 tsi Exp $ */ - +#define COMPILER_H_EXTRAS #include "apm.h" #include "apm_regs.h" Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c:1.9.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c:1.8 Tue Feb 29 12:32:54 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c Wed May 23 16:21:52 2001 @@ -1,8 +1,9 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c,v 1.8 2000/02/29 17:32:54 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_rush.c,v 1.9.2.1 2001/05/23 20:21:52 dawes Exp $ */ /* * Copyright Loïc Grenié 1999 */ +#define COMPILER_H_EXTRAS #include "apm.h" #include "xaalocal.h" @@ -492,8 +493,10 @@ return ProcXF86RushUnlockAllPixmaps(client); case X_XF86RushSetCopyMode: return ProcXF86RushSetCopyMode(client); +#if 0 case X_XF86RushSetPixelStride: return ProcXF86RushSetPixelStride(client); +#endif case X_XF86RushOverlayPixmap: return ProcXF86RushOverlayPixmap(client); case X_XF86RushStatusRegOffset: Index: xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c:1.7 Fri Jun 30 14:27:02 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/apm/apm_video.c Wed Apr 25 13:46:42 2001 @@ -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 @@ 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 @@ 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; Index: xc/programs/Xserver/hw/xfree86/drivers/ark/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/ark/Imakefile:1.5 xc/programs/Xserver/hw/xfree86/drivers/ark/Imakefile:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ark/Imakefile:1.5 Wed Nov 15 18:13:08 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ark/Imakefile Mon Jan 29 10:15:44 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/Imakefile,v 1.5 2000/11/15 23:13:08 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/Imakefile,v 1.6 2001/01/29 15:15:44 keithp Exp $ /* * * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -16,8 +16,8 @@ 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$(SERVERSRC)/mi \ + -I$(XF86SRC)/xaa \ -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ -I$(XF86SRC)/xf24_32bpp -I$(SERVERSRC)/Xext \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ Index: xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h:1.1 Tue Nov 14 12:28:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h Mon Jan 29 10:15:44 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h,v 1.1 2000/11/14 17:28:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark.h,v 1.2 2001/01/29 15:15:44 keithp Exp $ */ /* * ark */ @@ -67,5 +67,6 @@ #define ZOOMDAC 0x404 #define ATT490 0x101 +Bool ARKAccelInit(ScreenPtr pScreen); #endif /* _ARK_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c:1.4 Wed Nov 15 18:13:09 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c Mon Jan 29 10:15:44 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c,v 1.4 2000/11/15 23:13:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_accel.c,v 1.5 2001/01/29 15:15:44 keithp Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> * @@ -187,7 +187,6 @@ { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ARKPtr pARK = ARKPTR(pScrn); - vgaHWPtr hwp = VGAHWPTR(pScrn); XAAInfoRecPtr pXAA; if (!(pXAA = XAACreateInfoRec())) Index: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c:1.9 Sat Dec 2 10:30:31 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c Thu May 10 12:48:12 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.9 2000/12/02 15:30:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ark/ark_driver.c,v 1.14 2001/05/10 16:48:12 dawes Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> * @@ -28,7 +28,7 @@ * */ - +#define COMPILER_H_EXTRAS #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -43,14 +43,14 @@ #include "mipointer.h" #include "micmap.h" #include "mibstore.h" - +#include "fb.h" #include "ark.h" /* * prototypes */ -static OptionInfoPtr ARKAvailableOptions(int chipid, int busid); +static const OptionInfoRec * ARKAvailableOptions(int chipid, int busid); static void ARKIdentify(int flags); static Bool ARKProbe(DriverPtr drv, int flags); static Bool ARKPreInit(ScrnInfoPtr pScrn, int flags); @@ -73,7 +73,7 @@ static void ARKWriteMode(ScrnInfoPtr pScrn, vgaRegPtr pVga, ARKRegPtr new); /* helpers */ -static unsigned char get_daccomm(); +static unsigned char get_daccomm(void); static unsigned char set_daccom(unsigned char comm); @@ -107,8 +107,9 @@ OPTION_NOACCEL } ARKOpts; -static OptionInfoRec ARKOptions[] = { - { OPTION_NOACCEL, "noaccel", OPTV_BOOLEAN, {0}, FALSE } +static const OptionInfoRec ARKOptions[] = { + { OPTION_NOACCEL, "noaccel", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } }; static const char *fbSymbols[] = { @@ -195,7 +196,7 @@ pScrn->driverPrivate = NULL; } -static OptionInfoPtr ARKAvailableOptions(int chipid, int busid) +static const OptionInfoRec * ARKAvailableOptions(int chipid, int busid) { return ARKOptions; } @@ -262,11 +263,8 @@ EntityInfoPtr pEnt; ARKPtr pARK; vgaHWPtr hwp; - MessageType from = X_DEFAULT; int i; ClockRangePtr clockRanges; - char *mod = NULL; - const char *reqSym = NULL; rgb zeros = {0, 0, 0}; Gamma gzeros = {0.0, 0.0, 0.0}; unsigned char tmp; @@ -326,9 +324,12 @@ pARK = ARKPTR(pScrn); xf86CollectOptions(pScrn, NULL); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ARKOptions); + if (!(pARK->Options = xalloc(sizeof(ARKOptions)))) + return FALSE; + memcpy(pARK->Options, ARKOptions, sizeof(ARKOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pARK->Options); - if (xf86ReturnOptValBool(ARKOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pARK->Options, OPTION_NOACCEL, FALSE)) { pARK->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: NoAccel - acceleration disabled\n"); } else @@ -414,10 +415,11 @@ pScrn->videoRam = 2048; else pScrn->videoRam = 4096; - } + } - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected %d bytes video ram\n", - pScrn->videoRam); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected %d bytes video ram\n", + pScrn->videoRam); + } /* try to detect the RAMDAC */ { @@ -459,7 +461,7 @@ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, NULL, 256, 2048, pScrn->bitsPerPixel, - 128, 2048, pScrn->virtualX, + 128, 2048, pScrn->display->virtualX, pScrn->display->virtualY, pARK->videoRam * 1024, LOOKUP_BEST_REFRESH); if (i == -1) { @@ -491,15 +493,12 @@ return TRUE; } -} static Bool ARKScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; ARKPtr pARK = ARKPTR(pScrn); - BoxRec MemBox; - int i; pScrn->fbOffset = 0; @@ -530,11 +529,15 @@ return FALSE; } + miSetPixmapDepths (); + if (!fbScreenInit(pScreen, pARK->FBBase, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); if (pScrn->bitsPerPixel > 8) { @@ -1131,7 +1134,7 @@ } -static unsigned char get_daccomm() +static unsigned char get_daccomm(void) { unsigned char tmp; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile:1.25 xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile:1.32 --- xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile:1.25 Thu Nov 2 11:55:26 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile Fri May 18 16:22:28 2001 @@ -1,6 +1,6 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.25 2000/11/02 16:55:26 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/Imakefile,v 1.32 2001/05/18 20:22:28 tsi Exp $ XCOMM -XCOMM Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca +XCOMM Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org XCOMM XCOMM Permission to use, copy, modify, distribute, and sell this software and XCOMM its documentation for any purpose is hereby granted without fee, provided @@ -45,8 +45,10 @@ #if BuildXF86DRI DRISRCS3 = r128_dri.c +DRISRCS4 = radeon_dri.c DRIOBJS3 = r128_dri.o +DRIOBJS4 = radeon_dri.o DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri -I$(TOP)/include DRIDEFINES = $(GLX_DEFINES) @@ -74,6 +76,10 @@ * For testing purposes, #define'ing ATIAvoidCPIO as YES is also supported on * platforms that do, in fact, provide or emulate a PIO address space as * described above, but this should not be the default driver configuration. + * + * Currently, ATIAvoidNonPCI needs to be set to YES for those platforms that + * "drop down" to firmware on accesses to allocated, but disabled, PCI space. + * ATIAvoidNonPCI necessarily implies ATIAvoidCPIO. */ #if defined(i386Architecture) || \ defined(ia64Architecture) || \ @@ -86,43 +92,60 @@ # define ATIAvoidCPIO YES #endif -#if !ATIAvoidCPIO +#if defined(PpcArchitecture) +# undef ATIAvoidNonPCI +# define ATIAvoidNonPCI YES +#elif !defined(ATIAvoidNonPCI) +# define ATIAvoidNonPCI NO +#endif -CPIOSRCS1 = atibios.c ativgaio.c -CPIOSRCS2 = atibank.c ativga.c atiwonder.c atiwonderio.c +#if ATIAvoidNonPCI +# undef ATIAvoidCPIO +# define ATIAvoidCPIO YES -CPIOOBJS1 = atibios.o ativgaio.o -CPIOOBJS2 = atibank.o ativga.o atiwonder.o atiwonderio.o +NONPCIDEFINES = -DAVOID_NON_PCI -#else +#endif +#if ATIAvoidCPIO + CPIODEFINES = -DAVOID_CPIO +#else + +CPIOSRCS1 = ativgaio.c +CPIOSRCS2 = atibank.c ativga.c atiwonder.c atiwonderio.c + +CPIOOBJS1 = ativgaio.o +CPIOOBJS2 = atibank.o ativga.o atiwonder.o atiwonderio.o + #endif -DEFINES = $(CPIODEFINES) $(DRIDEFINES) +DEFINES = $(CPIODEFINES) $(NONPCIDEFINES) $(DRIDEFINES) SRCS1 = ati.c atiadapter.c atibus.c atichip.c atiident.c atioption.c \ atiprobe.c atividmem.c $(MODSRCS1) $(CPIOSRCS1) \ radeon_probe.c r128_probe.c -SRCS2 = atiadjust.c aticlock.c aticonfig.c aticonsole.c atidac.c atidga.c \ - atidsp.c atilock.c atimach64.c atimach64io.c atimode.c atipreinit.c \ - atiprint.c atiscreen.c atiutil.c ativalid.c $(MODSRCS2) $(CPIOSRCS2) +SRCS2 = atiaccel.c atiadjust.c aticlock.c aticonfig.c aticonsole.c \ + aticursor.c atidac.c atidga.c atidsp.c atilock.c atimach64.c \ + atimach64io.c atimode.c atipreinit.c atiprint.c atiscreen.c atiutil.c \ + ativalid.c atixv.c $(MODSRCS2) $(CPIOSRCS2) SRCS3 = r128_accel.c r128_cursor.c r128_dga.c r128_driver.c r128_video.c \ $(MODSRCS3) $(DRISRCS3) SRCS4 = radeon_accel.c radeon_cursor.c radeon_dga.c radeon_driver.c \ - radeon_video.c $(MODSRCS4) + radeon_video.c $(MODSRCS4) $(DRISRCS4) OBJS1 = ati.o atiadapter.o atibus.o atichip.o atiident.o atioption.o \ atiprobe.o atividmem.o $(MODOBJS1) $(CPIOOBJS1) \ radeon_probe.o r128_probe.o -OBJS2 = atiadjust.o aticlock.o aticonfig.o aticonsole.o atidac.o atidga.o \ - atidsp.o atilock.o atimach64.o atimach64io.o atimode.o atipreinit.o \ - atiprint.o atiscreen.o atiutil.o ativalid.o $(MODOBJS2) $(CPIOOBJS2) +OBJS2 = atiaccel.o atiadjust.o aticlock.o aticonfig.o aticonsole.o \ + aticursor.o atidac.o atidga.o atidsp.o atilock.o atimach64.o \ + atimach64io.o atimode.o atipreinit.o atiprint.o atiscreen.o atiutil.o \ + ativalid.o atixv.o $(MODOBJS2) $(CPIOOBJS2) OBJS3 = r128_accel.o r128_cursor.o r128_dga.o r128_driver.o r128_video.o \ $(MODOBJS3) $(DRIOBJS3) OBJS4 = radeon_accel.o radeon_cursor.o radeon_dga.o radeon_driver.o \ - radeon_video.o $(MODOBJS4) + radeon_video.o $(MODOBJS4) $(DRIOBJS4) SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(SRCS4) OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(OBJS4) @@ -160,11 +183,9 @@ InstallObjectModule(radeon,$(MODULEDIR),drivers) #if 0 -CppManTarget(ati,) InstallModuleManPage(ati) #endif -CppManTarget(r128,) InstallModuleManPage(r128) DependTarget() @@ -173,14 +194,14 @@ InstallDriverSDKNonExecFile(ati.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(ati.cpp,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(ati.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(atiaccel.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(atiaccel.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiadapter.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiadapter.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiadjust.c,$(DRIVERSDKDIR)/drivers/ati) 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) @@ -192,6 +213,8 @@ InstallDriverSDKNonExecFile(aticonsole.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(aticonsole.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(aticrtc.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(aticursor.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(aticursor.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atidac.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atidac.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atidga.c,$(DRIVERSDKDIR)/drivers/ati) @@ -244,6 +267,8 @@ InstallDriverSDKNonExecFile(atiwonder.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiwonderio.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(atiwonderio.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(atixv.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(atixv.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(r128.cpp,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(r128.h,$(DRIVERSDKDIR)/drivers/ati) @@ -266,11 +291,15 @@ InstallDriverSDKNonExecFile(radeon_accel.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_cursor.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_dga.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(radeon_dri.c,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(radeon_dri.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(radeon_dripriv.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_driver.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_misc.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_probe.c,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_probe.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_reg.h,$(DRIVERSDKDIR)/drivers/ati) +InstallDriverSDKNonExecFile(radeon_sarea.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_version.h,$(DRIVERSDKDIR)/drivers/ati) InstallDriverSDKNonExecFile(radeon_video.c,$(DRIVERSDKDIR)/drivers/ati) Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c:1.14 Sat Dec 2 10:53:52 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c Tue May 8 23:12:02 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.14 2000/12/02 15:53:52 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.c,v 1.17 2001/05/09 03:12:02 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -24,7 +24,7 @@ /*************************************************************************/ /* - * Author: Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Author: Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * This is the ATI driver for XFree86. * @@ -57,7 +57,7 @@ * Henrik Harmsen, ervhch@erv.ericsson.se * Christian Lupien, lupien@physics.utoronto.ca * Precision Insight Incorporated - * Mark Vojkovich, mvojkovich@valinux.com + * Mark Vojkovich, mvojkovich@nvidia.com * Huw D M Davies, h.davies1@physics.ox.ac.uk * Andrew C Aitchison, A.C.Aitchison@dpmms.cam.ac.uk * Ani Joshi, ajoshi@shell.unixbox.com @@ -66,6 +66,8 @@ * David S. Miller, davem@redhat.com * A E Lawrence, adrian.lawrence@computing-services.oxford.ac.uk * Linus Torvalds, torvalds@transmeta.com + * William Blew, wblew@home.com + * Ignacio Garcia Etxebarria, garetxe@euskalnet.net * * ... and, many, many others from around the world. * Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ati.cpp:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/ati.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/ati/ati.cpp:1.6 Mon Dec 11 15:18:06 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ati.cpp Mon Jun 4 12:40:40 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.cpp,v 1.6 2000/12/11 20:18:06 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH ATI __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -ati \- ATI video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qati\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B ati -is an XFree86 driver for ATI video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B ati -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h:1.6 Fri Aug 4 17:07:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h Sat Jan 6 15:58:03 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h,v 1.6 2000/08/04 21:07:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.h,v 1.7 2001/01/06 20:58:03 tsi Exp $ */ /* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/ati.man:1.2 --- /dev/null Mon Jun 4 12:40:40 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ati.man Sat Jan 27 13:20:46 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ati.man,v 1.2 2001/01/27 18:20:46 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH ATI __drivermansuffix__ __vendorversion__ +.SH NAME +ati \- ATI video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qati\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B ati +is an XFree86 driver for ATI video cards. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B ati +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c:1.6 --- /dev/null Mon Jun 4 12:40:40 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c Mon May 7 17:59:06 2001 @@ -0,0 +1,79 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.c,v 1.6 2001/05/07 21:59:06 tsi Exp $ */ +/* + * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "atiaccel.h" +#include "atiadapter.h" +#include "atimach64.h" +#include "atistruct.h" + +/* + * ATIInitializeAcceleration -- + * + * This function is called to initialise XAA on a screen. + */ +Bool +ATIInitializeAcceleration +( + ScreenPtr pScreen, + ScrnInfoPtr pScreenInfo, + ATIPtr pATI +) +{ + BoxRec ScreenArea; + unsigned int nScanlines, maxScanlines; + + if (!pATI->OptionAccel) + return TRUE; + + if (!(pATI->pXAAInfo = XAACreateInfoRec())) + return FALSE; + + switch (pATI->Adapter) + { + case ATI_ADAPTER_MACH64: + maxScanlines = ATIMach64AccelInit(pATI, pATI->pXAAInfo); + break; + + default: + maxScanlines = 0; + } + + 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; + } + + XAADestroyInfoRec(pATI->pXAAInfo); + pATI->pXAAInfo = NULL; + return FALSE; +} Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h:1.2 --- /dev/null Mon Jun 4 12:40:40 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h Mon May 7 17:59:06 2001 @@ -0,0 +1,36 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiaccel.h,v 1.2 2001/05/07 21:59:06 tsi Exp $ */ +/* + * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef ___ATIACCEL_H___ +#define ___ATIACCEL_H___ 1 + +#include "atipriv.h" +#include "atiproto.h" + +#include "xf86str.h" + +extern Bool ATIInitializeAcceleration FunctionPrototype((ScreenPtr, + ScrnInfoPtr, + ATIPtr)); + +#endif /* ___ATIACCEL_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c:1.14 Wed Oct 11 18:52:53 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c Sat Jan 6 15:58:04 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c,v 1.14 2000/10/11 22:52:53 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.c,v 1.15 2001/01/06 20:58:04 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h:1.7 Wed Oct 11 18:52:53 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h Sat Jan 6 15:58:04 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h,v 1.7 2000/10/11 22:52:53 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadapter.h,v 1.8 2001/01/06 20:58:04 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c:1.9 Wed Oct 11 18:52:54 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c Tue May 8 23:12:02 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c,v 1.9 2000/10/11 22:52:54 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.c,v 1.12 2001/05/09 03:12:02 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -133,7 +133,7 @@ { ScrnInfoPtr pScreenInfo = xf86Screens[scrnIndex]; ATIPtr pATI = ATIPTR(pScreenInfo); - int Base; + int Base, xy; /* * Assume the caller has already done its homework in ensuring the physical @@ -149,6 +149,21 @@ Base = ((((y * pATI->displayWidth) + x) & pATI->AdjustMask) * pATI->AdjustDepth) >> 3; + if (!pATI->currentMode) + { + /* + * Not in DGA. This reverse-calculates pScreenInfo->frame[XY][01] so + * that the cursor does not move on mode switches. + */ + xy = (Base << 3) / pATI->AdjustDepth; + pScreenInfo->frameX0 = xy % pATI->displayWidth; + pScreenInfo->frameY0 = xy / pATI->displayWidth; + pScreenInfo->frameX1 = + pScreenInfo->frameX0 + pScreenInfo->currentMode->HDisplay - 1; + pScreenInfo->frameY1 = + pScreenInfo->frameY0 + pScreenInfo->currentMode->VDisplay - 1; + } + /* Unlock registers */ ATIUnlock(pATI); @@ -178,40 +193,32 @@ } } else - -#endif /* AVOID_CPIO */ - + /* + * On integrated controllers, there is only one set of CRTC control bits, + * many of which are simultaneously accessible through both VGA and + * accelerator I/O ports. Given VGA's architectural limitations, setting + * the CRTC's offset register to more than 256k needs to be done through + * the accelerator port. + */ + if (pATI->depth <= 4) { - /* - * On integrated controllers, there is only one set of CRTC control - * bits, many of which are simultaneously accessible through both VGA - * and accelerator I/O ports. Given VGA's architectural limitations, - * setting the CRTC's offset register to more than 256k needs to be - * done through the accelerator port. - */ - -#ifndef AVOID_CPIO - - if (pATI->depth <= 4) - { - outr(CRTC_OFF_PITCH, SetBits(pATI->displayWidth >> 4, CRTC_PITCH) | - SetBits(Base, CRTC_OFFSET)); - } - else + outr(CRTC_OFF_PITCH, SetBits(pATI->displayWidth >> 4, CRTC_PITCH) | + SetBits(Base, CRTC_OFFSET)); + } + else #endif /* AVOID_CPIO */ - { + { #ifndef AVOID_CPIO - if (pATI->NewHW.crtc == ATI_CRTC_VGA) - Base <<= 1; /* LSBit must be zero */ + if (pATI->NewHW.crtc == ATI_CRTC_VGA) + Base <<= 1; /* LSBit must be zero */ #endif /* AVOID_CPIO */ - outr(CRTC_OFF_PITCH, SetBits(pATI->displayWidth >> 3, CRTC_PITCH) | - SetBits(Base, CRTC_OFFSET)); - } + outr(CRTC_OFF_PITCH, SetBits(pATI->displayWidth >> 3, CRTC_PITCH) | + SetBits(Base, CRTC_OFFSET)); } } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h:1.5 Mon Jun 19 11:00:55 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h Sat Jan 6 15:58:04 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h,v 1.5 2000/06/19 15:00:55 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiadjust.h,v 1.6 2001/01/06 20:58:04 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c:1.9 Wed Oct 11 18:52:54 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c Sat Jan 6 15:58:04 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c,v 1.9 2000/10/11 22:52:54 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.c,v 1.10 2001/01/06 20:58:04 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h:1.5 Fri Aug 4 17:07:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h Sat Jan 6 15:58:04 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h,v 1.5 2000/08/04 21:07:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibank.h,v 1.6 2001/01/06 20:58:04 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.c:1.7 Tue Aug 22 17:54:29 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.c Mon Jun 4 12:40:40 2001 @@ -1,66 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.c,v 1.7 2000/08/22 21:54:29 tsi Exp $ */ -/* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of Marc Aurele La France not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Marc Aurele La France makes no representations - * about the suitability of this software for any purpose. It is provided - * "as-is" without express or implied warranty. - * - * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO - * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#include "ati.h" -#include "atibios.h" -#include "atistruct.h" - -#ifndef AVOID_CPIO - -/* - * ATIReadBIOS -- - * - * This function is called to read in an adapter's BIOS, or parts thereof. - */ -int -ATIReadBIOS -( - ATIPtr pATI, - pointer Buffer, - unsigned long Offset, - int Length -) -{ - pciVideoPtr pVideo; - pciConfigPtr pPCI; - - /* - * Read PCI adapter expansion ROM, but only for adapters found to have been - * disabled on server entry. - */ - if ((pVideo = pATI->PCIInfo) && - (((pPCI = pVideo->thisCard)->pci_command & - (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE)) != - (PCI_CMD_IO_ENABLE | PCI_CMD_MEM_ENABLE))) - { - pATI->BIOSBase = PCIGETROM(pciReadLong(pPCI->tag, PCI_MAP_ROM_REG)); - return xf86ReadPciBIOS(Offset, pPCI->tag, 0, Buffer, Length); - } - - /* Read legacy ROM */ - if (!pATI->BIOSBase) - pATI->BIOSBase = 0x000C0000U; - return xf86ReadBIOS(pATI->BIOSBase, Offset, Buffer, Length); -} - -#endif /* AVOID_CPIO */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.h:1.3 Fri Aug 4 17:07:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.h Mon Jun 4 12:40:40 2001 @@ -1,39 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibios.h,v 1.3 2000/08/04 21:07:12 tsi Exp $ */ -/* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that copyright - * notice and this permission notice appear in supporting documentation, and - * that the name of Marc Aurele La France not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Marc Aurele La France makes no representations - * about the suitability of this software for any purpose. It is provided - * "as-is" without express or implied warranty. - * - * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO - * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - */ - -#ifndef ___ATIBIOS_H___ -#define ___ATIBIOS_H___ 1 - -#include "atipriv.h" -#include "atiproto.h" - -#include "Xmd.h" - -#ifndef AVOID_CPIO - -extern int ATIReadBIOS FunctionPrototype((ATIPtr, pointer, unsigned long, - int)); - -#endif /* AVOID_CPIO */ - -#endif /* ___ATIBIOS_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c:1.12 Thu Oct 26 07:47:45 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c Sun Feb 11 22:27:03 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c,v 1.12 2000/10/26 11:47:45 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.c,v 1.14 2001/02/12 03:27:03 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -102,13 +102,9 @@ } } -#endif /* AVOID_CPIO */ - if (!Active && pATI->SharedAccelerator) return; -#ifndef AVOID_CPIO - /* Claim 8514/A resources */ if (pATI->ChipHasSUBSYS_CNTL) xf86ClaimFixedResources( @@ -129,12 +125,17 @@ xf86ClaimFixedResources(Resources, pATI->iEntity); } -#endif /* AVOID_CPIO */ - - /* Register relocatable resources for inactive adapters */ if (Active) return; +#else /* AVOID_CPIO */ + + if (pATI->SharedAccelerator) + return; + +#endif /* AVOID_CPIO */ + + /* Register unshared relocatable resources for inactive adapters */ pResources = xf86RegisterResources(pATI->iEntity, NULL, ResExclusive); pResources = xf86ReallocatePciResources(pATI->iEntity, pResources); if (!pResources) Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h:1.7 Thu Oct 26 07:47:45 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h Sat Jan 6 15:58:04 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h,v 1.7 2000/10/26 11:47:45 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atibus.h,v 1.8 2001/01/06 20:58:04 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c:1.15 xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c:1.15 Tue Oct 10 11:16:34 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c Wed Apr 25 14:21:10 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.c,v 1.15 2000/10/10 15:16:34 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 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -82,8 +82,11 @@ "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" }; @@ -327,9 +330,11 @@ case OldChipID('L', 'I'): case OldChipID('L', 'P'): + case OldChipID('L', 'Q'): pATI->ChipType = OldToNewChipID(pATI->ChipType); case NewChipID('L', 'I'): case NewChipID('L', 'P'): + case NewChipID('L', 'Q'): pATI->ChipRevision = GetBits(pATI->config_chip_id, CFG_CHIP_REVISION); pATI->Chip = ATI_CHIP_264LTPRO; @@ -507,6 +512,7 @@ case OldChipID('L', 'D'): case NewChipID('L', 'D'): case OldChipID('L', 'I'): case NewChipID('L', 'I'): case OldChipID('L', 'P'): case NewChipID('L', 'P'): + case OldChipID('L', 'Q'): case NewChipID('L', 'Q'): return ATI_CHIP_264LTPRO; case OldChipID('G', 'L'): case NewChipID('G', 'L'): @@ -528,6 +534,7 @@ 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'): @@ -575,11 +582,27 @@ 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'): 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; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h:1.13 Tue Oct 10 11:16:34 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h Wed Apr 25 14:21:10 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atichip.h,v 1.13 2000/10/10 15:16:34 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 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -84,8 +84,11 @@ 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; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c:1.14 Wed Oct 11 18:52:54 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c Sun Feb 11 22:27:03 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c,v 1.14 2000/10/11 22:52:54 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.c,v 1.16 2001/02/12 03:27:03 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -1015,6 +1015,7 @@ else #endif /* AVOID_CPIO */ + { /* All others don't have crystals */ if (pATI->Clock == ATI_CLOCK_CRYSTALS) Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h:1.5 Fri Aug 4 17:07:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h,v 1.5 2000/08/04 21:07:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticlock.h,v 1.6 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c:1.1 Wed Oct 11 18:52:55 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c Sun Mar 25 00:32:07 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c,v 1.1 2000/10/11 22:52:55 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.c,v 1.5 2001/03/25 05:32:07 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -24,11 +24,12 @@ #include "ati.h" #include "atiadapter.h" #include "aticonfig.h" +#include "aticursor.h" #include "atioption.h" #include "atistruct.h" /* - * Recognised XF86Config options. + * Non-publicised XF86Config options. */ typedef enum { @@ -81,10 +82,18 @@ # define CRTScreen PublicOption[ATI_OPTION_CRT].value.bool # define CSync PublicOption[ATI_OPTION_CSYNC].value.bool # define Devel PrivateOption[ATI_OPTION_DEVEL].value.bool +# define HWCursor PublicOption[ATI_OPTION_HWCURSOR].value.bool + +#ifndef AVOID_CPIO + # define Linear PublicOption[ATI_OPTION_LINEAR].value.bool + +#endif /* AVOID_CPIO */ + # define CacheMMIO PublicOption[ATI_OPTION_MMIO_CACHE].value.bool # define ProbeClocks PublicOption[ATI_OPTION_PROBE_CLOCKS].value.bool # define ShadowFB PublicOption[ATI_OPTION_SHADOW_FB].value.bool +# define SWCursor PublicOption[ATI_OPTION_SWCURSOR].value.bool # define Sync PrivateOption[ATI_OPTION_SYNC].value.bool # define ReferenceClock \ @@ -102,7 +111,14 @@ #endif /* AVOID_CPIO */ { - Accel = Linear = CacheMMIO = TRUE; + Accel = CacheMMIO = HWCursor = TRUE; + +#ifndef AVOID_CPIO + + Linear = TRUE; + +#endif /* AVOID_CPIO */ + } ReferenceClock = ((double)157500000.0) / ((double)11.0); @@ -124,6 +140,8 @@ xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options, PrivateOption); +#ifndef AVOID_CPIO + /* Disable linear apertures if the OS doesn't support them */ if (!xf86LinearVidMem() && Linear) { @@ -133,37 +151,60 @@ Linear = FALSE; } +#endif /* AVOID_CPIO */ + /* Move option values into driver private structure */ pATI->OptionAccel = Accel; pATI->OptionCRT = CRTScreen; pATI->OptionCSync = CSync; pATI->OptionDevel = Devel; + +#ifndef AVOID_CPIO + pATI->OptionLinear = Linear; + +#endif /* AVOID_CPIO */ + pATI->OptionMMIOCache = CacheMMIO; pATI->OptionProbeClocks = ProbeClocks; pATI->OptionShadowFB = ShadowFB; pATI->OptionSync = Sync; - /* Only set the reference clock if it hasn't already been determined */ - if (pATI->ReferenceNumerator && pATI->ReferenceDenominator) - return; + /* Validate and set cursor options */ + if (SWCursor || !HWCursor) + { + pATI->Cursor = ATI_CURSOR_SOFTWARE; + if (HWCursor && PublicOption[ATI_OPTION_HWCURSOR].found) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Option \"sw_cursor\" overrides Option \"hw_cursor\".\n"); + } + else + { + pATI->Cursor = ATI_CURSOR_HARDWARE; + } - switch ((int)(ReferenceClock / ((double)100000.0))) + /* Only set the reference clock if it hasn't already been determined */ + if (!pATI->ReferenceNumerator || !pATI->ReferenceDenominator) { - case 143: - pATI->ReferenceNumerator = 157500; - pATI->ReferenceDenominator = 11; - break; - - case 286: - pATI->ReferenceNumerator = 315000; - pATI->ReferenceDenominator = 11; - break; - - default: - pATI->ReferenceNumerator = - (int)(ReferenceClock / ((double)1000.0)); - pATI->ReferenceDenominator = 1; - break; + switch ((int)(ReferenceClock / ((double)100000.0))) + { + case 143: + pATI->ReferenceNumerator = 157500; + pATI->ReferenceDenominator = 11; + break; + + case 286: + pATI->ReferenceNumerator = 315000; + pATI->ReferenceDenominator = 11; + break; + + default: + pATI->ReferenceNumerator = + (int)(ReferenceClock / ((double)1000.0)); + pATI->ReferenceDenominator = 1; + break; + } } + + xfree(PublicOption); } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h:1.1 Wed Oct 11 18:52:55 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h,v 1.1 2000/10/11 22:52:55 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonfig.h,v 1.2 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c:1.14 Wed Oct 11 18:52:55 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c Sun Feb 11 22:27:04 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c,v 1.14 2000/10/11 22:52:55 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.c,v 1.16 2001/02/12 03:27:04 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -108,20 +108,17 @@ ATIMach64SetDPMSMode(pATI, DPMSMode); break; + default: + #ifndef AVOID_CPIO + /* Assume EGA/VGA */ + ATIVGASetDPMSMode(pATI, DPMSMode); + break; + case ATI_ADAPTER_NONE: case ATI_ADAPTER_8514A: case ATI_ADAPTER_MACH8: - break; - -#endif /* AVOID_CPIO */ - - default: /* Assume EGA/VGA */ - -#ifndef AVOID_CPIO - - ATIVGASetDPMSMode(pATI, DPMSMode); #endif /* AVOID_CPIO */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h:1.6 Fri Aug 4 17:07:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h,v 1.6 2000/08/04 21:07:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticonsole.h,v 1.7 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h:1.5 Fri Aug 4 17:07:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h,v 1.5 2000/08/04 21:07:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticrtc.h,v 1.6 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c:1.1 --- /dev/null Mon Jun 4 12:40:40 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c Sun Mar 25 00:33:06 2001 @@ -0,0 +1,75 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.c,v 1.1 2001/03/25 05:33:06 tsi Exp $ */ +/* + * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "atiadapter.h" +#include "aticursor.h" +#include "atimach64.h" +#include "atistruct.h" + +#include "xf86.h" + +/* + * ATIInitializeCursor -- + * + * This function initialises the screen cursor. + */ +Bool +ATIInitializeCursor +( + ScreenPtr pScreen, + ATIPtr pATI +) +{ + /* Initialise software cursor */ + if (!miDCInitialize(pScreen, xf86GetPointerScreenFuncs())) + return FALSE; + + if (pATI->Cursor == ATI_CURSOR_SOFTWARE) + return TRUE; + + if (!(pATI->pCursorInfo = xf86CreateCursorInfoRec())) + return FALSE; + + switch (pATI->Adapter) + { + case ATI_ADAPTER_MACH64: + if (ATIMach64CursorInit(pATI->pCursorInfo)) + break; + /* Fall through */ + + default: + xf86DestroyCursorInfoRec(pATI->pCursorInfo); + pATI->pCursorInfo = NULL; + return FALSE; + } + + if (xf86InitCursor(pScreen, pATI->pCursorInfo)) + { + xf86SetSilkenMouse(pScreen); + return TRUE; + } + + xf86DestroyCursorInfoRec(pATI->pCursorInfo); + pATI->pCursorInfo = NULL; + return FALSE; +} Index: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h:1.1 --- /dev/null Mon Jun 4 12:40:40 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h Sun Mar 25 00:33:06 2001 @@ -0,0 +1,44 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/aticursor.h,v 1.1 2001/03/25 05:33:06 tsi Exp $ */ +/* + * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef ___ATICURSOR_H___ +#define ___ATICURSOR_H___ 1 + +#include "atipriv.h" +#include "atiproto.h" + +#include "screenint.h" + +/* + * Cursor related definitions. + */ +typedef enum +{ + ATI_CURSOR_SOFTWARE, /* Software cursor */ + ATI_CURSOR_HARDWARE, /* Hardware cursor provided by CRTC */ + ATI_CURSOR_DAC /* Hardware cursor provided by RAMDAC */ +} ATICursorType; + +extern Bool ATIInitializeCursor FunctionPrototype((ScreenPtr, ATIPtr)); + +#endif /* ___ATICURSOR_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c:1.10 Tue Dec 12 19:45:19 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c Wed Jan 10 22:36:57 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c,v 1.10 2000/12/13 00:45:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.c,v 1.12 2001/01/11 03:36:57 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -203,9 +203,9 @@ (blackColour.green == whiteColour.green) && (blackColour.blue == whiteColour.blue)) { - blackColour.red = whiteColour.red ^ maxColour; - blackColour.green = whiteColour.green ^ maxColour; - blackColour.blue = whiteColour.blue ^ maxColour; + blackColour.red ^= maxColour; + blackColour.green ^= maxColour; + blackColour.blue ^= maxColour; } pATIHW->lut[(MONO_BLACK * 3) + 0] = blackColour.red; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h:1.9 Wed Oct 11 18:52:55 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h,v 1.9 2000/10/11 22:52:55 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidac.h,v 1.10 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c:1.4 Wed Oct 11 18:52:55 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.4 2000/10/11 22:52:55 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.c,v 1.5 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h:1.2 Fri Aug 4 17:07:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h,v 1.2 2000/08/04 21:07:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidga.h,v 1.3 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c:1.12 Fri Aug 4 17:07:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c,v 1.12 2000/08/04 21:07:13 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.c,v 1.13 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h:1.7 Fri Aug 4 17:07:14 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h,v 1.7 2000/08/04 21:07:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atidsp.h,v 1.8 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c:1.7 Thu Nov 2 11:55:27 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c,v 1.7 2000/11/02 16:55:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.c,v 1.8 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h:1.7 Fri Aug 4 17:07:14 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h,v 1.7 2000/08/04 21:07:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiident.h,v 1.8 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h:1.10 xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h:1.10 Wed Oct 11 18:52:56 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h Sat Jan 6 16:29:15 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h,v 1.10 2000/10/11 22:52:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiio.h,v 1.12 2001/01/06 21:29:15 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -32,9 +32,6 @@ #include "atiregs.h" -#ifndef NO_COMPILER_H_EXTRAS -# define NO_COMPILER_H_EXTRAS -#endif #include "compiler.h" /* I/O decoding definitions */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c:1.1 Fri Oct 13 09:27:00 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c Sun Mar 25 00:32:07 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c,v 1.1 2000/10/13 13:27:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.c,v 1.6 2001/03/25 05:32:07 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -24,6 +24,7 @@ #ifdef XFree86LOADER #include "ati.h" +#include "aticursor.h" #include "atiload.h" #include "atistruct.h" @@ -73,14 +74,15 @@ #endif /* AVOID_CPIO */ - "cfbScreenInit", - "cfb16ScreenInit", - "cfb24ScreenInit", - "cfb32ScreenInit", + "fbScreenInit", + "fbPictureInit", "ShadowFBInit", "XAACreateInfoRec", "XAADestroyInfoRec", "XAAInit", + "xf86InitCursor", + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", NULL); /* Load shadow frame buffer code if needed */ @@ -98,6 +100,19 @@ xf86LoaderReqSymbols("XAACreateInfoRec", "XAADestroyInfoRec", NULL); } + /* Load ramdac module if needed */ + if (pATI->Cursor > ATI_CURSOR_SOFTWARE) + { + if (!ATILoadModule(pScreenInfo, "ramdac", "xf86InitCursor")) + return FALSE; + + /* Require more ramdac symbols */ + xf86LoaderReqSymbols( + "xf86CreateCursorInfoRec", + "xf86DestroyCursorInfoRec", + NULL); + } + /* Load depth-specific entry points */ switch (pATI->bitsPerPixel) { @@ -113,16 +128,15 @@ #endif /* AVOID_CPIO */ case 8: - return ATILoadModule(pScreenInfo, "cfb", "cfbScreenInit"); - case 16: - return ATILoadModule(pScreenInfo, "cfb16", "cfb16ScreenInit"); - case 24: - return ATILoadModule(pScreenInfo, "cfb24", "cfb24ScreenInit"); - case 32: - return ATILoadModule(pScreenInfo, "cfb32", "cfb32ScreenInit"); + if (!ATILoadModule(pScreenInfo, "fb", "fbScreenInit")) + return FALSE; + + /* Require more fb symbols */ + xf86LoaderReqSymbols("fbPictureInit", FALSE); + return TRUE; default: return FALSE; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h:1.1 Fri Oct 13 09:27:00 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h,v 1.1 2000/10/13 13:27:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiload.h,v 1.2 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c:1.8 Wed Oct 11 18:52:56 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c Sun Mar 25 00:32:07 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c,v 1.8 2000/10/11 22:52:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.c,v 1.10 2001/03/25 05:32:07 tsi Exp $ */ /* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -133,6 +133,11 @@ ~(LCD_MONDET_INT_EN | LCD_MONDET_INT)); } + pATI->LockData.mem_cntl = inr(MEM_CNTL); + if (pATI->Chip < ATI_CHIP_264CT) + outr(MEM_CNTL, pATI->LockData.mem_cntl & + ~(CTL_MEM_BNDRY | CTL_MEM_BNDRY_EN)); + #ifndef AVOID_CPIO /* Ensure VGA aperture is enabled */ @@ -140,22 +145,8 @@ pATI->LockData.dac_cntl = inr(DAC_CNTL); outr(DAC_CNTL, pATI->LockData.dac_cntl | DAC_VGA_ADR_EN); outr(CONFIG_CNTL, pATI->LockData.config_cntl & ~CFG_VGA_DIS); - -#endif /* AVOID_CPIO */ - - pATI->LockData.mem_cntl = inr(MEM_CNTL); - if (pATI->Chip < ATI_CHIP_264CT) - outr(MEM_CNTL, pATI->LockData.mem_cntl & - ~(CTL_MEM_BNDRY | CTL_MEM_BNDRY_EN)); - else if (pATI->Chip >= ATI_CHIP_264VTB) - outr(MEM_CNTL, (pATI->LockData.mem_cntl & - ~(CTL_MEM_LOWER_APER_ENDIAN | CTL_MEM_UPPER_APER_ENDIAN)) | - (SetBits(CTL_MEM_APER_BYTE_ENDIAN, CTL_MEM_LOWER_APER_ENDIAN) | - SetBits(CTL_MEM_APER_LONG_ENDIAN, CTL_MEM_UPPER_APER_ENDIAN))); } -#ifndef AVOID_CPIO - if (pATI->VGAAdapter != ATI_ADAPTER_NONE) { if (pATI->CPIO_VGAWonder) @@ -346,10 +337,10 @@ out8(LCD_INDEX, GetByte(pATI->LockData.lcd_index, 0)); } } - } #endif /* AVOID_CPIO */ + } } /* @@ -508,7 +499,8 @@ #endif /* AVOID_CPIO */ - outr(MEM_CNTL, pATI->LockData.mem_cntl); + if (pATI->Chip < ATI_CHIP_264CT) + outr(MEM_CNTL, pATI->LockData.mem_cntl); if ((pATI->LCDPanelID >= 0) && (pATI->Chip != ATI_CHIP_264LT)) outr(LCD_INDEX, pATI->LockData.lcd_index); } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h:1.2 Fri Feb 18 07:19:24 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h Sat Jan 6 15:58:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h,v 1.2 2000/02/18 12:19:24 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atilock.h,v 1.3 2001/01/06 20:58:05 tsi Exp $ */ /* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c:1.27 xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c:1.36 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c:1.27 Tue Dec 12 19:25:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c Tue May 8 23:12:02 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.27 2000/12/13 00:25:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.c,v 1.36 2001/05/09 03:12:02 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -47,6 +47,7 @@ #include "ati.h" #include "atibus.h" #include "atichip.h" +#include "aticrtc.h" #include "atimach64.h" #include "atimach64io.h" @@ -116,8 +117,14 @@ pATIHW->bus_cntl &= ~(BUS_FIFO_ERR_INT_EN | BUS_ROM_DIS); pATIHW->bus_cntl |= SetBits(15, BUS_FIFO_WS) | BUS_FIFO_ERR_INT; } + else if (pATI->MMIOInLinear) + { + pATIHW->bus_cntl &= ~BUS_APER_REG_DIS; + } else + { pATIHW->bus_cntl |= BUS_APER_REG_DIS; + } if (pATI->Chip >= ATI_CHIP_264VT) pATIHW->bus_cntl |= BUS_EXT_REG_EN; /* Enable Block 1 */ @@ -142,6 +149,8 @@ if ((pATI->depth > 8) || (pScreenInfo->rgbBits == 8)) pATIHW->dac_cntl |= DAC_8BIT_EN; + pATIHW->gen_test_cntl = pATI->LockData.gen_test_cntl & ~GEN_CUR_EN; + pATIHW->config_cntl = config_cntl = inr(CONFIG_CNTL); #ifndef AVOID_CPIO @@ -167,6 +176,31 @@ pATIHW->config_cntl |= SetBits(2, CFG_MEM_AP_SIZE); } + if (pATI->Chip >= ATI_CHIP_264VTB) + { + pATIHW->mem_cntl = (pATI->LockData.mem_cntl & + ~(CTL_MEM_LOWER_APER_ENDIAN | CTL_MEM_UPPER_APER_ENDIAN)) | + SetBits(CTL_MEM_APER_BYTE_ENDIAN, CTL_MEM_LOWER_APER_ENDIAN); + + switch (pATI->bitsPerPixel) + { + default: + pATIHW->mem_cntl |= SetBits(CTL_MEM_APER_BYTE_ENDIAN, + CTL_MEM_UPPER_APER_ENDIAN); + break; + + case 16: + pATIHW->mem_cntl |= SetBits(CTL_MEM_APER_WORD_ENDIAN, + CTL_MEM_UPPER_APER_ENDIAN); + break; + + case 32: + pATIHW->mem_cntl |= SetBits(CTL_MEM_APER_LONG_ENDIAN, + CTL_MEM_UPPER_APER_ENDIAN); + break; + } + } + /* Draw engine setup */ if (pATI->OptionAccel) { @@ -296,6 +330,12 @@ pATIHW->ovr_wid_left_right = inr(OVR_WID_LEFT_RIGHT); pATIHW->ovr_wid_top_bottom = inr(OVR_WID_TOP_BOTTOM); + pATIHW->cur_clr0 = inr(CUR_CLR0); + pATIHW->cur_clr1 = inr(CUR_CLR1); + pATIHW->cur_offset = inr(CUR_OFFSET); + pATIHW->cur_horz_vert_posn = inr(CUR_HORZ_VERT_POSN); + pATIHW->cur_horz_vert_off = inr(CUR_HORZ_VERT_OFF); + pATIHW->clock_cntl = inr(CLOCK_CNTL); pATIHW->bus_cntl = inr(BUS_CNTL); @@ -307,6 +347,11 @@ pATIHW->config_cntl = inr(CONFIG_CNTL); + pATIHW->gen_test_cntl = inr(GEN_TEST_CNTL); + + if (pATI->Chip >= ATI_CHIP_264VTB) + pATIHW->mem_cntl = inr(MEM_CNTL); + /* Save draw engine state */ if (pATI->OptionAccel && (pATIHW == &pATI->OldHW)) { @@ -587,14 +632,25 @@ outr(CRTC_OFF_PITCH, pATIHW->crtc_off_pitch); - /* Set pixel clock */ - outr(CLOCK_CNTL, pATIHW->clock_cntl | CLOCK_STROBE); - /* Load overscan registers */ outr(OVR_CLR, pATIHW->ovr_clr); outr(OVR_WID_LEFT_RIGHT, pATIHW->ovr_wid_left_right); outr(OVR_WID_TOP_BOTTOM, pATIHW->ovr_wid_top_bottom); + /* Load hardware cursor registers */ + outr(CUR_CLR0, pATIHW->cur_clr0); + outr(CUR_CLR1, pATIHW->cur_clr1); + outr(CUR_OFFSET, pATIHW->cur_offset); + outr(CUR_HORZ_VERT_POSN, pATIHW->cur_horz_vert_posn); + outr(CUR_HORZ_VERT_OFF, pATIHW->cur_horz_vert_off); + + /* Set pixel clock */ + outr(CLOCK_CNTL, pATIHW->clock_cntl | CLOCK_STROBE); + + outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl | GEN_GUI_EN); + outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl); + outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl | GEN_GUI_EN); + /* Finalise CRTC setup and turn on the screen */ outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl); @@ -733,6 +789,9 @@ outr(CONFIG_CNTL, pATIHW->config_cntl); outr(BUS_CNTL, pATIHW->bus_cntl); + + if (pATI->Chip >= ATI_CHIP_264VTB) + outr(MEM_CNTL, pATIHW->mem_cntl); } /* @@ -1091,23 +1150,11 @@ { ATIPtr pATI = ATIPTR(pScreenInfo); - pATI->dst_cntl = 0; - - if (ydir > 0) - pATI->dst_cntl |= DST_Y_DIR; - if (xdir > 0) - pATI->dst_cntl |= DST_X_DIR; - - if (pATI->XModifier == 1) - outf(DST_CNTL, pATI->dst_cntl); - else - pATI->dst_cntl |= DST_24_ROT_EN; - ATIMach64WaitForFIFO(pATI, 3); - outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); outf(DP_WRITE_MASK, planemask); outf(DP_SRC, DP_MONO_SRC_ALLONES | SetBits(SRC_BLIT, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); if (TransparencyColour == -1) outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); @@ -1117,6 +1164,18 @@ outf(CLR_CMP_CLR, TransparencyColour); outf(CLR_CMP_CNTL, CLR_CMP_FN_EQUAL | CLR_CMP_SRC_2D); } + + pATI->dst_cntl = 0; + + if (ydir > 0) + pATI->dst_cntl |= DST_Y_DIR; + if (xdir > 0) + pATI->dst_cntl |= DST_X_DIR; + + if (pATI->XModifier == 1) + outf(DST_CNTL, pATI->dst_cntl); + else + pATI->dst_cntl |= DST_24_ROT_EN; } /* @@ -1183,17 +1242,17 @@ { ATIPtr pATI = ATIPTR(pScreenInfo); - if (pATI->XModifier == 1) - outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); - ATIMach64WaitForFIFO(pATI, 5); - outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); outf(DP_WRITE_MASK, planemask); outf(DP_SRC, DP_MONO_SRC_ALLONES | SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); outf(DP_FRGD_CLR, colour); + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); + + if (pATI->XModifier == 1) + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); } /* @@ -1248,11 +1307,11 @@ ATIPtr pATI = ATIPTR(pScreenInfo); ATIMach64WaitForFIFO(pATI, 5); - outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); outf(DP_WRITE_MASK, planemask); outf(DP_SRC, DP_MONO_SRC_ALLONES | SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); outf(DP_FRGD_CLR, colour); + outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX)); outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); @@ -1347,8 +1406,11 @@ { ATIPtr pATI = ATIPTR(pScreenInfo); - if (pATI->XModifier == 1) - outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); + ATIMach64WaitForFIFO(pATI, 3); + outf(DP_WRITE_MASK, planemask); + outf(DP_SRC, DP_MONO_SRC_PATTERN | + SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); + outf(DP_FRGD_CLR, fg); if (bg == -1) outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | @@ -1356,22 +1418,20 @@ else { ATIMach64WaitForFIFO(pATI, 2); + outf(DP_BKGD_CLR, bg); outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | SetBits(ATIMach64ALU[rop], DP_BKGD_MIX)); - outf(DP_BKGD_CLR, bg); } - ATIMach64WaitForFIFO(pATI, 7); - outf(DP_WRITE_MASK, planemask); - outf(DP_SRC, DP_MONO_SRC_PATTERN | - SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); - outf(DP_FRGD_CLR, fg); - + ATIMach64WaitForFIFO(pATI, 4); outf(PAT_REG0, patx); outf(PAT_REG1, paty); outf(PAT_CNTL, PAT_MONO_EN); outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); + + if (pATI->XModifier == 1) + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); } /* @@ -1427,8 +1487,11 @@ { ATIPtr pATI = ATIPTR(pScreenInfo); - if (pATI->XModifier == 1) - outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); + ATIMach64WaitForFIFO(pATI, 3); + outf(DP_WRITE_MASK, planemask); + outf(DP_SRC, DP_MONO_SRC_HOST | + SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); + outf(DP_FRGD_CLR, fg); if (bg == -1) outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | @@ -1436,18 +1499,15 @@ else { ATIMach64WaitForFIFO(pATI, 2); + outf(DP_BKGD_CLR, bg); outf(DP_MIX, SetBits(ATIMach64ALU[rop], DP_FRGD_MIX) | SetBits(ATIMach64ALU[rop], DP_BKGD_MIX)); - outf(DP_BKGD_CLR, bg); } - ATIMach64WaitForFIFO(pATI, 4); - outf(DP_WRITE_MASK, planemask); - outf(DP_SRC, DP_MONO_SRC_HOST | - SetBits(SRC_FRGD, DP_FRGD_SRC) | SetBits(SRC_BKGD, DP_BKGD_SRC)); - outf(DP_FRGD_CLR, fg); - outf(CLR_CMP_CNTL, CLR_CMP_FN_FALSE); + + if (pATI->XModifier == 1) + outf(DST_CNTL, DST_X_DIR | DST_Y_DIR); } /* @@ -1504,12 +1564,13 @@ int iBuffer ) { - ATIPtr pATI = ATIPTR(pScreenInfo); - CARD32 *pBitmapData = pATI->ExpansionBitmapScanlinePtr[iBuffer]; - CARD32 *pDst, *pSrc; - int w = pATI->ExpansionBitmapWidth; - int nDWord; - unsigned int iDWord; + ATIPtr pATI = ATIPTR(pScreenInfo); + CARD32 *pBitmapData = pATI->ExpansionBitmapScanlinePtr[iBuffer]; + volatile CARD32 *pDst; + CARD32 *pSrc; + int w = pATI->ExpansionBitmapWidth; + int nDWord; + unsigned int iDWord; while (w > 0) { @@ -1530,7 +1591,7 @@ * only be guaranteed to be on a chunk-sized boundary. */ iDWord = 16 - nDWord; - pDst = (CARD32 *)pATI->pHOST_DATA - iDWord; + pDst = (volatile CARD32 *)pATI->pHOST_DATA - iDWord; pSrc = pBitmapData - iDWord; /* @@ -1575,7 +1636,7 @@ * This function fills in structure fields needed for acceleration on Mach64 * variants. */ -Bool +unsigned int ATIMach64AccelInit ( ATIPtr pATI, @@ -1623,6 +1684,9 @@ */ 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; @@ -1647,13 +1711,376 @@ /* The engine does not support the following primitives for 24bpp */ if (pATI->XModifier != 1) - return TRUE; + return ATIMach64MaxY; /* Solid lines */ pXAAInfo->SetupForSolidLine = ATIMach64SetupForSolidLine; pXAAInfo->SubsequentSolidHorVertLine = ATIMach64SubsequentSolidHorVertLine; pXAAInfo->SubsequentSolidBresenhamLine = ATIMach64SubsequentSolidBresenhamLine; + + return ATIMach64MaxY; +} + +/* + * ATIMach64SetCursorColours -- + * + * Set hardware cursor foreground and background colours. + */ +static void +ATIMach64SetCursorColours +( + ScrnInfoPtr pScreenInfo, + int fg, + int bg +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + + outr(CUR_CLR0, SetBits(fg, CUR_CLR)); + outr(CUR_CLR1, SetBits(bg, CUR_CLR)); +} + +/* + * ATIMach64SetCursorPosition -- + * + * Set position of hardware cursor. + */ +static void +ATIMach64SetCursorPosition +( + ScrnInfoPtr pScreenInfo, + int x, + int y +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + CARD16 CursorXOffset, CursorYOffset; + + /* Adjust x & y when the cursor is partially obscured */ + if (x < 0) + { + if ((CursorXOffset = -x) > 63) + CursorXOffset = 63; + x = 0; + } + else + { + CursorXOffset = pScreenInfo->frameX1 - pScreenInfo->frameX0; + if (x > CursorXOffset) + x = CursorXOffset; + CursorXOffset = 0; + } + + if (y < 0) + { + if ((CursorYOffset = -y) > 63) + CursorYOffset = 63; + y = 0; + } + else + { + CursorYOffset = pScreenInfo->frameY1 - pScreenInfo->frameY0; + if (y > CursorYOffset) + y = CursorYOffset; + CursorYOffset = 0; + } + + /* Adjust for multiscanned modes */ + if (pScreenInfo->currentMode->Flags & V_DBLSCAN) + y *= 2; + if (pScreenInfo->currentMode->VScan > 1) + y *= pScreenInfo->currentMode->VScan; + + do + { + if (CursorYOffset != pATI->CursorYOffset) + { + pATI->CursorYOffset = CursorYOffset; + outr(CUR_OFFSET, ((CursorYOffset << 4) + pATI->CursorOffset) >> 3); + } + else if (CursorXOffset == pATI->CursorXOffset) + break; + + pATI->CursorXOffset = CursorXOffset; + outr(CUR_HORZ_VERT_OFF, SetBits(CursorXOffset, CUR_HORZ_OFF) | + SetBits(CursorYOffset, CUR_VERT_OFF)); + } while (0); + + outr(CUR_HORZ_VERT_POSN, + SetBits(x, CUR_HORZ_POSN) | SetBits(y, CUR_VERT_POSN)); +} + +/* + * ATIMach64LoadCursorImage -- + * + * Copy hardware cursor image into offscreen video memory. + */ +static void +ATIMach64LoadCursorImage +( + ScrnInfoPtr pScreenInfo, + CARD8 *pImage +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + CARD32 *pSrc = (pointer)pImage; + volatile CARD32 *pDst = pATI->pCursorImage; + + /* 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]; + pDst[ 4] = pSrc[ 4]; pDst[ 5] = pSrc[ 5]; + pDst[ 6] = pSrc[ 6]; pDst[ 7] = pSrc[ 7]; + pDst[ 8] = pSrc[ 8]; pDst[ 9] = pSrc[ 9]; + pDst[ 10] = pSrc[ 10]; pDst[ 11] = pSrc[ 11]; + pDst[ 12] = pSrc[ 12]; pDst[ 13] = pSrc[ 13]; + pDst[ 14] = pSrc[ 14]; pDst[ 15] = pSrc[ 15]; + pDst[ 16] = pSrc[ 16]; pDst[ 17] = pSrc[ 17]; + pDst[ 18] = pSrc[ 18]; pDst[ 19] = pSrc[ 19]; + pDst[ 20] = pSrc[ 20]; pDst[ 21] = pSrc[ 21]; + pDst[ 22] = pSrc[ 22]; pDst[ 23] = pSrc[ 23]; + pDst[ 24] = pSrc[ 24]; pDst[ 25] = pSrc[ 25]; + pDst[ 26] = pSrc[ 26]; pDst[ 27] = pSrc[ 27]; + pDst[ 28] = pSrc[ 28]; pDst[ 29] = pSrc[ 29]; + pDst[ 30] = pSrc[ 30]; pDst[ 31] = pSrc[ 31]; + pDst[ 32] = pSrc[ 32]; pDst[ 33] = pSrc[ 33]; + pDst[ 34] = pSrc[ 34]; pDst[ 35] = pSrc[ 35]; + pDst[ 36] = pSrc[ 36]; pDst[ 37] = pSrc[ 37]; + pDst[ 38] = pSrc[ 38]; pDst[ 39] = pSrc[ 39]; + pDst[ 40] = pSrc[ 40]; pDst[ 41] = pSrc[ 41]; + pDst[ 42] = pSrc[ 42]; pDst[ 43] = pSrc[ 43]; + pDst[ 44] = pSrc[ 44]; pDst[ 45] = pSrc[ 45]; + pDst[ 46] = pSrc[ 46]; pDst[ 47] = pSrc[ 47]; + pDst[ 48] = pSrc[ 48]; pDst[ 49] = pSrc[ 49]; + pDst[ 50] = pSrc[ 50]; pDst[ 51] = pSrc[ 51]; + pDst[ 52] = pSrc[ 52]; pDst[ 53] = pSrc[ 53]; + pDst[ 54] = pSrc[ 54]; pDst[ 55] = pSrc[ 55]; + pDst[ 56] = pSrc[ 56]; pDst[ 57] = pSrc[ 57]; + pDst[ 58] = pSrc[ 58]; pDst[ 59] = pSrc[ 59]; + pDst[ 60] = pSrc[ 60]; pDst[ 61] = pSrc[ 61]; + pDst[ 62] = pSrc[ 62]; pDst[ 63] = pSrc[ 63]; + pDst[ 64] = pSrc[ 64]; pDst[ 65] = pSrc[ 65]; + pDst[ 66] = pSrc[ 66]; pDst[ 67] = pSrc[ 67]; + pDst[ 68] = pSrc[ 68]; pDst[ 69] = pSrc[ 69]; + pDst[ 70] = pSrc[ 70]; pDst[ 71] = pSrc[ 71]; + pDst[ 72] = pSrc[ 72]; pDst[ 73] = pSrc[ 73]; + pDst[ 74] = pSrc[ 74]; pDst[ 75] = pSrc[ 75]; + pDst[ 76] = pSrc[ 76]; pDst[ 77] = pSrc[ 77]; + pDst[ 78] = pSrc[ 78]; pDst[ 79] = pSrc[ 79]; + pDst[ 80] = pSrc[ 80]; pDst[ 81] = pSrc[ 81]; + pDst[ 82] = pSrc[ 82]; pDst[ 83] = pSrc[ 83]; + pDst[ 84] = pSrc[ 84]; pDst[ 85] = pSrc[ 85]; + pDst[ 86] = pSrc[ 86]; pDst[ 87] = pSrc[ 87]; + pDst[ 88] = pSrc[ 88]; pDst[ 89] = pSrc[ 89]; + pDst[ 90] = pSrc[ 90]; pDst[ 91] = pSrc[ 91]; + pDst[ 92] = pSrc[ 92]; pDst[ 93] = pSrc[ 93]; + pDst[ 94] = pSrc[ 94]; pDst[ 95] = pSrc[ 95]; + pDst[ 96] = pSrc[ 96]; pDst[ 97] = pSrc[ 97]; + pDst[ 98] = pSrc[ 98]; pDst[ 99] = pSrc[ 99]; + pDst[100] = pSrc[100]; pDst[101] = pSrc[101]; + pDst[102] = pSrc[102]; pDst[103] = pSrc[103]; + pDst[104] = pSrc[104]; pDst[105] = pSrc[105]; + pDst[106] = pSrc[106]; pDst[107] = pSrc[107]; + pDst[108] = pSrc[108]; pDst[109] = pSrc[109]; + pDst[110] = pSrc[110]; pDst[111] = pSrc[111]; + pDst[112] = pSrc[112]; pDst[113] = pSrc[113]; + pDst[114] = pSrc[114]; pDst[115] = pSrc[115]; + pDst[116] = pSrc[116]; pDst[117] = pSrc[117]; + pDst[118] = pSrc[118]; pDst[119] = pSrc[119]; + pDst[120] = pSrc[120]; pDst[121] = pSrc[121]; + pDst[122] = pSrc[122]; pDst[123] = pSrc[123]; + pDst[124] = pSrc[124]; pDst[125] = pSrc[125]; + pDst[126] = pSrc[126]; pDst[127] = pSrc[127]; + pDst[128] = pSrc[128]; pDst[129] = pSrc[129]; + pDst[130] = pSrc[130]; pDst[131] = pSrc[131]; + pDst[132] = pSrc[132]; pDst[133] = pSrc[133]; + pDst[134] = pSrc[134]; pDst[135] = pSrc[135]; + pDst[136] = pSrc[136]; pDst[137] = pSrc[137]; + pDst[138] = pSrc[138]; pDst[139] = pSrc[139]; + pDst[140] = pSrc[140]; pDst[141] = pSrc[141]; + pDst[142] = pSrc[142]; pDst[143] = pSrc[143]; + pDst[144] = pSrc[144]; pDst[145] = pSrc[145]; + pDst[146] = pSrc[146]; pDst[147] = pSrc[147]; + pDst[148] = pSrc[148]; pDst[149] = pSrc[149]; + pDst[150] = pSrc[150]; pDst[151] = pSrc[151]; + pDst[152] = pSrc[152]; pDst[153] = pSrc[153]; + pDst[154] = pSrc[154]; pDst[155] = pSrc[155]; + pDst[156] = pSrc[156]; pDst[157] = pSrc[157]; + pDst[158] = pSrc[158]; pDst[159] = pSrc[159]; + pDst[160] = pSrc[160]; pDst[161] = pSrc[161]; + pDst[162] = pSrc[162]; pDst[163] = pSrc[163]; + pDst[164] = pSrc[164]; pDst[165] = pSrc[165]; + pDst[166] = pSrc[166]; pDst[167] = pSrc[167]; + pDst[168] = pSrc[168]; pDst[169] = pSrc[169]; + pDst[170] = pSrc[170]; pDst[171] = pSrc[171]; + pDst[172] = pSrc[172]; pDst[173] = pSrc[173]; + pDst[174] = pSrc[174]; pDst[175] = pSrc[175]; + pDst[176] = pSrc[176]; pDst[177] = pSrc[177]; + pDst[178] = pSrc[178]; pDst[179] = pSrc[179]; + pDst[180] = pSrc[180]; pDst[181] = pSrc[181]; + pDst[182] = pSrc[182]; pDst[183] = pSrc[183]; + pDst[184] = pSrc[184]; pDst[185] = pSrc[185]; + pDst[186] = pSrc[186]; pDst[187] = pSrc[187]; + pDst[188] = pSrc[188]; pDst[189] = pSrc[189]; + pDst[190] = pSrc[190]; pDst[191] = pSrc[191]; + pDst[192] = pSrc[192]; pDst[193] = pSrc[193]; + pDst[194] = pSrc[194]; pDst[195] = pSrc[195]; + pDst[196] = pSrc[196]; pDst[197] = pSrc[197]; + pDst[198] = pSrc[198]; pDst[199] = pSrc[199]; + pDst[200] = pSrc[200]; pDst[201] = pSrc[201]; + pDst[202] = pSrc[202]; pDst[203] = pSrc[203]; + pDst[204] = pSrc[204]; pDst[205] = pSrc[205]; + pDst[206] = pSrc[206]; pDst[207] = pSrc[207]; + pDst[208] = pSrc[208]; pDst[209] = pSrc[209]; + pDst[210] = pSrc[210]; pDst[211] = pSrc[211]; + pDst[212] = pSrc[212]; pDst[213] = pSrc[213]; + pDst[214] = pSrc[214]; pDst[215] = pSrc[215]; + pDst[216] = pSrc[216]; pDst[217] = pSrc[217]; + pDst[218] = pSrc[218]; pDst[219] = pSrc[219]; + pDst[220] = pSrc[220]; pDst[221] = pSrc[221]; + pDst[222] = pSrc[222]; pDst[223] = pSrc[223]; + pDst[224] = pSrc[224]; pDst[225] = pSrc[225]; + pDst[226] = pSrc[226]; pDst[227] = pSrc[227]; + pDst[228] = pSrc[228]; pDst[229] = pSrc[229]; + pDst[230] = pSrc[230]; pDst[231] = pSrc[231]; + pDst[232] = pSrc[232]; pDst[233] = pSrc[233]; + pDst[234] = pSrc[234]; pDst[235] = pSrc[235]; + pDst[236] = pSrc[236]; pDst[237] = pSrc[237]; + pDst[238] = pSrc[238]; pDst[239] = pSrc[239]; + pDst[240] = pSrc[240]; pDst[241] = pSrc[241]; + pDst[242] = pSrc[242]; pDst[243] = pSrc[243]; + pDst[244] = pSrc[244]; pDst[245] = pSrc[245]; + pDst[246] = pSrc[246]; pDst[247] = pSrc[247]; + pDst[248] = pSrc[248]; pDst[249] = pSrc[249]; + pDst[250] = pSrc[250]; pDst[251] = pSrc[251]; + pDst[252] = pSrc[252]; pDst[253] = pSrc[253]; + pDst[254] = pSrc[254]; pDst[255] = pSrc[255]; +} + +/* + * ATIMach64HideCursor -- + * + * Turn off hardware cursor. + */ +static void +ATIMach64HideCursor +( + ScrnInfoPtr pScreenInfo +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + + if (!(pATI->NewHW.gen_test_cntl & GEN_CUR_EN)) + return; + + pATI->NewHW.gen_test_cntl &= ~GEN_CUR_EN; + out8(GEN_TEST_CNTL, GetByte(pATI->NewHW.gen_test_cntl, 0)); +} + +/* + * ATIMach64ShowCursor -- + * + * Turn on hardware cursor. + */ +static void +ATIMach64ShowCursor +( + ScrnInfoPtr pScreenInfo +) +{ + ATIPtr pATI = ATIPTR(pScreenInfo); + + if (pATI->NewHW.gen_test_cntl & GEN_CUR_EN) + return; + + pATI->NewHW.gen_test_cntl |= GEN_CUR_EN; + out8(GEN_TEST_CNTL, GetByte(pATI->NewHW.gen_test_cntl, 0)); +} + +/* + * ATIMach64UseHWCursor -- + * + * Notify cursor layer whether a hardware cursor is configured. + */ +static Bool +ATIMach64UseHWCursor +( + ScreenPtr pScreen, + CursorPtr pCursor +) +{ + ScrnInfoPtr pScreenInfo = xf86Screens[pScreen->myNum]; + ATIPtr pATI = ATIPTR(pScreenInfo); + + if (!pATI->CursorBase) + return FALSE; + +#ifndef AVOID_CPIO + + /* + * For some reason, the hardware cursor isn't vertically scaled when a VGA + * doublescanned or multiscanned mode is in effect. + */ + if (pATI->NewHW.crtc == ATI_CRTC_MACH64) + return TRUE; + if ((pScreenInfo->currentMode->Flags & V_DBLSCAN) || + (pScreenInfo->currentMode->VScan > 1)) + return FALSE; + +#endif /* AVOID_CPIO */ + + return TRUE; +} + +/* + * ATIMach64CursorInit -- + * + * Initialise xf86CursorInfoRec fields with information specific to Mach64 + * variants. + */ +Bool +ATIMach64CursorInit +( + xf86CursorInfoPtr pCursorInfo +) +{ + /* + * 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 | + HARDWARE_CURSOR_AND_SOURCE_WITH_MASK | + +#if X_BYTE_ORDER != X_LITTLE_ENDIAN + + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + +#endif /* X_BYTE_ORDER */ + + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1; + pCursorInfo->MaxWidth = pCursorInfo->MaxHeight = 64; + + pCursorInfo->SetCursorColors = ATIMach64SetCursorColours; + pCursorInfo->SetCursorPosition = ATIMach64SetCursorPosition; + pCursorInfo->LoadCursorImage = ATIMach64LoadCursorImage; + pCursorInfo->HideCursor = ATIMach64HideCursor; + pCursorInfo->ShowCursor = ATIMach64ShowCursor; + pCursorInfo->UseHWCursor = ATIMach64UseHWCursor; return TRUE; } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h:1.9 Fri Aug 4 17:07:14 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h Mon Apr 16 11:47:56 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64.h,v 1.9 2000/08/04 21:07:14 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 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -28,20 +28,24 @@ #include "atiproto.h" #include "xaa.h" +#include "xf86Cursor.h" #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)); #endif /* ___ATIMACH64_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c:1.2 Fri Aug 4 17:07:14 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c Sat Jan 6 15:58:06 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c,v 1.2 2000/08/04 21:07:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.c,v 1.3 2001/01/06 20:58:06 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h:1.4 Wed Oct 11 18:52:56 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h Mon Apr 16 11:02:09 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.4 2000/10/11 22:52:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimach64io.h,v 1.9 2001/04/16 15:02:09 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -46,10 +46,12 @@ * inm/outm 32-bit R/W through MMIO space. The register is specified as * the actual MMIO offset (with Block 1 following Block 0), which, * in this case, is equivalent to the register's IOPortTag from - * atiregs.h. Can only be used for those few non-FIFO'ed - * registers outside of Block 0's first 256 bytes. pATI->pBlock - * array elements must have been previously set up by - * ATIMapApertures(). + * atiregs.h. Can be used for those few non-FIFO'ed registers + * outside of Block 0's first 256 bytes. inm() can also be used + * for FIFO'ed registers if, and only if, it can be guaranteed to + * not have been previously FIFO'ed (e.g. when the engine is + * idle). pATI->pBlock array elements must have been previously + * set up by ATIMapApertures(). * * outf 32-bit write through MMIO cache. Identical to outm() but * intended for FIFO'ed registers. There is no inf() provided. @@ -130,7 +132,7 @@ /* * 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) \ @@ -162,15 +164,15 @@ /* * 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)) \ - ATIMach64PollEngineStatus(pATI); + ATIMach64PollEngineStatus(pATI) #define ATIMach64WaitForIdle(_pATI) \ while (pATI->EngineIsBusy) \ - ATIMach64PollEngineStatus(pATI); + ATIMach64PollEngineStatus(pATI) extern void ATIAccessMach64PLLReg FunctionPrototype((ATIPtr, const CARD8, const Bool)); @@ -185,7 +187,7 @@ { \ ATIAccessMach64PLLReg(pATI, _Index, TRUE); \ out8(CLOCK_CNTL + 2, _Value); \ - } while(0) + } while (0) #define ATIGetMach64LCDReg(_Index) \ ( \ @@ -197,7 +199,7 @@ { \ out8(LCD_INDEX, SetBits(_Index, LCD_REG_INDEX)); \ outr(LCD_DATA, _Value); \ - } while(0) + } while (0) #define ATIGetMach64TVReg(_Index) \ ( \ @@ -209,6 +211,6 @@ { \ out8(TV_OUT_INDEX, SetBits(_Index, TV_REG_INDEX)); \ outr(TV_OUT_DATA, _Value); \ - } while(0) + } while (0) #endif /* ___ATIMACH64IO_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c:1.1 Mon Oct 30 18:02:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c Sat Mar 3 17:27:41 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c,v 1.1 2000/10/30 23:02:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimisc.c,v 1.3 2001/03/03 22:27:41 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -30,7 +30,7 @@ static XF86ModuleVersionInfo ATIVersionRec = { - ATI_DRIVER_NAME, + "atimisc", MODULEVENDORSTRING, MODINFOSTRING1, MODINFOSTRING2, Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c:1.1 Wed Oct 11 18:52:56 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c Mon Apr 16 11:02:09 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.c,v 1.1 2000/10/11 22:52:56 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 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -243,7 +243,6 @@ ) { CARD32 lcd_index; - int HDisplay, VDisplay; #ifndef AVOID_CPIO @@ -264,177 +263,71 @@ { ATIMach64PreInit(pScreenInfo, pATI, pATIHW); - } - - if (pATI->Chip >= ATI_CHIP_264CT) - { - /* Ensure proper VCLK source */ - pATIHW->pll_vclk_cntl = ATIGetMach64PLLReg(PLL_VCLK_CNTL) | - (PLL_VCLK_SRC_SEL | PLL_VCLK_RESET); - /* Set provisional values for other PLL registers */ - pATIHW->pll_vclk_post_div = ATIGetMach64PLLReg(PLL_VCLK_POST_DIV); - pATIHW->pll_vclk0_fb_div = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV); - pATIHW->pll_vclk1_fb_div = ATIGetMach64PLLReg(PLL_VCLK1_FB_DIV); - pATIHW->pll_vclk2_fb_div = ATIGetMach64PLLReg(PLL_VCLK2_FB_DIV); - pATIHW->pll_vclk3_fb_div = ATIGetMach64PLLReg(PLL_VCLK3_FB_DIV); - pATIHW->pll_xclk_cntl = ATIGetMach64PLLReg(PLL_XCLK_CNTL); - - /* For now disable extended reference and feedback dividers */ - if (pATI->Chip >= ATI_CHIP_264LT) - pATIHW->pll_ext_vpll_cntl = ATIGetMach64PLLReg(PLL_EXT_VPLL_CNTL) & - ~(PLL_EXT_VPLL_EN | PLL_EXT_VPLL_VGA_EN | PLL_EXT_VPLL_INSYNC); - } - - /* Initialise CRTC data for LCD panels */ - if (pATI->LCDPanelID >= 0) - { - if (pATI->Chip == ATI_CHIP_264LT) + if (pATI->Chip >= ATI_CHIP_264CT) { - pATIHW->horz_stretching = inr(HORZ_STRETCHING); - pATIHW->vert_stretching = inr(VERT_STRETCHING); - pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL); - } - else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || - (pATI->Chip == ATI_CHIP_264XL) || - (pATI->Chip == ATI_CHIP_MOBILITY)) */ - { - lcd_index = inr(LCD_INDEX); - pATIHW->lcd_index = (lcd_index & - ~(LCD_REG_INDEX | LCD_DISPLAY_DIS | LCD_SRC_SEL)) | - (LCD_SRC_SEL_CRTC1 | LCD_CRTC2_DISPLAY_DIS); - pATIHW->config_panel = - ATIGetMach64LCDReg(LCD_CONFIG_PANEL) | DONT_SHADOW_HEND; - pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); - pATIHW->horz_stretching = ATIGetMach64LCDReg(LCD_HORZ_STRETCHING); - pATIHW->vert_stretching = ATIGetMach64LCDReg(LCD_VERT_STRETCHING); - outr(LCD_INDEX, lcd_index); - } - - pATIHW->lcd_gen_ctrl &= - ~(HORZ_DIVBY2_EN | DISABLE_PCLK_RESET | DIS_HOR_CRT_DIVBY2 | - VCLK_DAC_PM_EN | XTALIN_PM_EN | CRTC_RW_SELECT | - USE_SHADOWED_VEND | USE_SHADOWED_ROWCUR | - SHADOW_EN | SHADOW_RW_EN); - pATIHW->lcd_gen_ctrl |= DONT_SHADOW_VPAR | LOCK_8DOT; - - if (pATI->OptionCRT) - { - /* - * Use primary CRTC to drive the CRT. Turn off panel interface. - */ - pATIHW->lcd_gen_ctrl &= ~LCD_ON; - pATIHW->lcd_gen_ctrl |= CRT_ON; - } - else - { - /* Use primary CRTC to drive the panel */ - pATIHW->lcd_gen_ctrl |= LCD_ON; - - /* - * Determine porch data. The following is inaccurate (but still - * good enough) when BIOS initialisation has set things up so that - * the registers read here are not the ones actually in use by the - * panel. - */ - -#ifndef AVOID_CPIO + /* Ensure proper VCLK source */ + pATIHW->pll_vclk_cntl = ATIGetMach64PLLReg(PLL_VCLK_CNTL) | + (PLL_VCLK_SRC_SEL | PLL_VCLK_RESET); + + /* Set provisional values for other PLL registers */ + pATIHW->pll_vclk_post_div = ATIGetMach64PLLReg(PLL_VCLK_POST_DIV); + pATIHW->pll_vclk0_fb_div = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV); + pATIHW->pll_vclk1_fb_div = ATIGetMach64PLLReg(PLL_VCLK1_FB_DIV); + pATIHW->pll_vclk2_fb_div = ATIGetMach64PLLReg(PLL_VCLK2_FB_DIV); + pATIHW->pll_vclk3_fb_div = ATIGetMach64PLLReg(PLL_VCLK3_FB_DIV); + pATIHW->pll_xclk_cntl = ATIGetMach64PLLReg(PLL_XCLK_CNTL); + + /* For now disable extended reference and feedback dividers */ + if (pATI->Chip >= ATI_CHIP_264LT) + pATIHW->pll_ext_vpll_cntl = + ATIGetMach64PLLReg(PLL_EXT_VPLL_CNTL) & + ~(PLL_EXT_VPLL_EN | PLL_EXT_VPLL_VGA_EN | + PLL_EXT_VPLL_INSYNC); - if (pATI->LockData.crtc_gen_cntl & CRTC_EXT_DISP_EN) - -#endif /* AVOID_CPIO */ - + /* Initialise CRTC data for LCD panels */ + if (pATI->LCDPanelID >= 0) { - pATIHW->crtc_h_total_disp = inr(CRTC_H_TOTAL_DISP); - pATIHW->crtc_h_sync_strt_wid = inr(CRTC_H_SYNC_STRT_WID); - pATIHW->crtc_v_total_disp = inr(CRTC_V_TOTAL_DISP); - pATIHW->crtc_v_sync_strt_wid = inr(CRTC_V_SYNC_STRT_WID); - - HDisplay = GetBits(pATIHW->crtc_h_total_disp, CRTC_H_DISP); - VDisplay = GetBits(pATIHW->crtc_v_total_disp, CRTC_V_DISP); - - pATI->LCDHSyncStart = - (GetBits(pATIHW->crtc_h_sync_strt_wid, - CRTC_H_SYNC_STRT_HI) * - (MaxBits(CRTC_H_SYNC_STRT) + 1)) + - GetBits(pATIHW->crtc_h_sync_strt_wid, CRTC_H_SYNC_STRT) - - HDisplay; - pATI->LCDHSyncWidth = - GetBits(pATIHW->crtc_h_sync_strt_wid, CRTC_H_SYNC_WID); - pATI->LCDHBlankWidth = - GetBits(pATIHW->crtc_h_total_disp, CRTC_H_TOTAL) - - HDisplay; - pATI->LCDVSyncStart = - GetBits(pATIHW->crtc_v_sync_strt_wid, CRTC_V_SYNC_STRT) - - VDisplay; - pATI->LCDVSyncWidth = - GetBits(pATIHW->crtc_v_sync_strt_wid, CRTC_V_SYNC_WID); - pATI->LCDVBlankWidth = - GetBits(pATIHW->crtc_v_total_disp, CRTC_V_TOTAL) - - VDisplay; - } - -#ifndef AVOID_CPIO - - else - { - pATIHW->crt[0] = GetReg(CRTX(pATI->CPIO_VGABase), 0x00U); - pATIHW->crt[1] = GetReg(CRTX(pATI->CPIO_VGABase), 0x01U); - pATIHW->crt[4] = GetReg(CRTX(pATI->CPIO_VGABase), 0x04U); - pATIHW->crt[5] = GetReg(CRTX(pATI->CPIO_VGABase), 0x05U); - pATIHW->crt[6] = GetReg(CRTX(pATI->CPIO_VGABase), 0x06U); - pATIHW->crt[7] = GetReg(CRTX(pATI->CPIO_VGABase), 0x07U); - pATIHW->crt[16] = GetReg(CRTX(pATI->CPIO_VGABase), 0x10U); - pATIHW->crt[17] = GetReg(CRTX(pATI->CPIO_VGABase), 0x11U); - pATIHW->crt[18] = GetReg(CRTX(pATI->CPIO_VGABase), 0x12U); - - HDisplay = pATIHW->crt[1] + 1; - VDisplay = (((pATIHW->crt[7] << 3) & 0x0200U) | - ((pATIHW->crt[7] << 7) & 0x0100U) | - pATIHW->crt[18]) + 1; - - pATI->LCDHSyncStart = pATIHW->crt[4] - HDisplay; - pATI->LCDHSyncWidth = - (pATIHW->crt[5] - pATIHW->crt[4]) & 0x1FU; - pATI->LCDHBlankWidth = pATIHW->crt[0] + 5 - HDisplay; - pATI->LCDVSyncStart = (((pATIHW->crt[7] << 2) & 0x0200U) | - ((pATIHW->crt[7] << 6) & 0x0100U) | - pATIHW->crt[16]) - VDisplay; - pATI->LCDVSyncWidth = - (pATIHW->crt[17] - pATIHW->crt[16]) & 0x0FU; - pATI->LCDVBlankWidth = (((pATIHW->crt[7] << 4) & 0x0200U) | - ((pATIHW->crt[7] << 8) & 0x0100U) | - pATIHW->crt[6]) + 2 - VDisplay; - } - -#endif /* AVOID_CPIO */ + if (pATI->Chip == ATI_CHIP_264LT) + { + pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL); + } + else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || + (pATI->Chip == ATI_CHIP_264XL) || + (pATI->Chip == ATI_CHIP_MOBILITY)) */ + { + lcd_index = inr(LCD_INDEX); + pATIHW->lcd_index = (lcd_index & + ~(LCD_REG_INDEX | LCD_DISPLAY_DIS | LCD_SRC_SEL)) | + (LCD_SRC_SEL_CRTC1 | LCD_CRTC2_DISPLAY_DIS); + pATIHW->config_panel = + ATIGetMach64LCDReg(LCD_CONFIG_PANEL) | + DONT_SHADOW_HEND; + pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); + outr(LCD_INDEX, lcd_index); + } - HDisplay <<= 3; - pATI->LCDHSyncStart <<= 3; - pATI->LCDHSyncWidth <<= 3; - pATI->LCDHBlankWidth <<= 3; - - /* If the mode on entry wasn't stretched, adjust timings */ - if (!(pATIHW->horz_stretching & HORZ_STRETCH_EN) && - ((HDisplay = pATI->LCDHorizontal - HDisplay) > 0)) - { - if ((pATI->LCDHSyncStart -= HDisplay) < 0) - pATI->LCDHSyncStart = 0; - pATI->LCDHBlankWidth -= HDisplay; - HDisplay = pATI->LCDHSyncStart + pATI->LCDHSyncWidth; - if (pATI->LCDHBlankWidth < HDisplay) - pATI->LCDHBlankWidth = HDisplay; - } + pATIHW->lcd_gen_ctrl &= + ~(HORZ_DIVBY2_EN | DISABLE_PCLK_RESET | + DIS_HOR_CRT_DIVBY2 | VCLK_DAC_PM_EN | XTALIN_PM_EN | + CRTC_RW_SELECT | USE_SHADOWED_VEND | + USE_SHADOWED_ROWCUR | SHADOW_EN | SHADOW_RW_EN); + pATIHW->lcd_gen_ctrl |= DONT_SHADOW_VPAR | LOCK_8DOT; - if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) && - ((VDisplay = pATI->LCDVertical - VDisplay) > 0)) - { - if ((pATI->LCDVSyncStart -= VDisplay) < 0) - pATI->LCDVSyncStart = 0; - pATI->LCDVBlankWidth -= VDisplay; - VDisplay = pATI->LCDVSyncStart + pATI->LCDVSyncWidth; - if (pATI->LCDVBlankWidth < VDisplay) - pATI->LCDVBlankWidth = VDisplay; + if (pATI->OptionCRT) + { + /* + * Use primary CRTC to drive the CRT. Turn off panel + * interface. + */ + pATIHW->lcd_gen_ctrl &= ~LCD_ON; + pATIHW->lcd_gen_ctrl |= CRT_ON; + } + else + { + /* Use primary CRTC to drive the panel */ + pATIHW->lcd_gen_ctrl |= LCD_ON; + } } } } @@ -481,36 +374,38 @@ pATIHW->pll_xclk_cntl = ATIGetMach64PLLReg(PLL_XCLK_CNTL); if (pATI->Chip >= ATI_CHIP_264LT) pATIHW->pll_ext_vpll_cntl = ATIGetMach64PLLReg(PLL_EXT_VPLL_CNTL); - } - - /* Save LCD registers */ - if (pATI->LCDPanelID >= 0) - { - if (pATI->Chip == ATI_CHIP_264LT) - { - pATIHW->horz_stretching = inr(HORZ_STRETCHING); - pATIHW->vert_stretching = inr(VERT_STRETCHING); - pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL); - /* Set up to save non-shadow registers */ - outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl & - ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); - } - else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || - (pATI->Chip == ATI_CHIP_264XL) || - (pATI->Chip == ATI_CHIP_MOBILITY)) */ + /* Save LCD registers */ + if (pATI->LCDPanelID >= 0) { - pATIHW->lcd_index = inr(LCD_INDEX); - pATIHW->config_panel = ATIGetMach64LCDReg(LCD_CONFIG_PANEL); - pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); - pATIHW->horz_stretching = ATIGetMach64LCDReg(LCD_HORZ_STRETCHING); - pATIHW->vert_stretching = ATIGetMach64LCDReg(LCD_VERT_STRETCHING); - pATIHW->ext_vert_stretch = - ATIGetMach64LCDReg(LCD_EXT_VERT_STRETCH); - - /* Set up to save non-shadow registers */ - ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl & - ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); + if (pATI->Chip == ATI_CHIP_264LT) + { + pATIHW->horz_stretching = inr(HORZ_STRETCHING); + pATIHW->vert_stretching = inr(VERT_STRETCHING); + pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL); + + /* Set up to save non-shadow registers */ + outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl & + ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); + } + else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || + (pATI->Chip == ATI_CHIP_264XL) || + (pATI->Chip == ATI_CHIP_MOBILITY)) */ + { + pATIHW->lcd_index = inr(LCD_INDEX); + pATIHW->config_panel = ATIGetMach64LCDReg(LCD_CONFIG_PANEL); + pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); + pATIHW->horz_stretching = + ATIGetMach64LCDReg(LCD_HORZ_STRETCHING); + pATIHW->vert_stretching = + ATIGetMach64LCDReg(LCD_VERT_STRETCHING); + pATIHW->ext_vert_stretch = + ATIGetMach64LCDReg(LCD_EXT_VERT_STRETCH); + + /* Set up to save non-shadow registers */ + ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl & + ~(CRTC_RW_SELECT | SHADOW_EN | SHADOW_RW_EN)); + } } } @@ -533,52 +428,57 @@ { ATIMach64Save(pATI, pATIHW); - } - - /* Save DSP data */ - if (pATI->Chip >= ATI_CHIP_264VTB) - ATIDSPSave(pATI, pATIHW); - if (pATI->LCDPanelID >= 0) - { - if (!pATI->OptionCRT) + if (pATI->Chip >= ATI_CHIP_264VTB) { - /* Switch to shadow registers */ - if (pATI->Chip == ATI_CHIP_264LT) - outr(LCD_GEN_CTRL, (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) | - (SHADOW_EN | SHADOW_RW_EN)); - else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || - (pATI->Chip == ATI_CHIP_264XL) || - (pATI->Chip == ATI_CHIP_MOBILITY)) */ - ATIPutMach64LCDReg(LCD_GEN_CNTL, - (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) | - (SHADOW_EN | SHADOW_RW_EN)); + /* Save DSP data */ + ATIDSPSave(pATI, pATIHW); + if (pATI->LCDPanelID >= 0) + { + if (!pATI->OptionCRT) + { + /* Switch to shadow registers */ + if (pATI->Chip == ATI_CHIP_264LT) + outr(LCD_GEN_CTRL, + (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) | + (SHADOW_EN | SHADOW_RW_EN)); + else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || + (pATI->Chip == ATI_CHIP_264XL) || + (pATI->Chip == ATI_CHIP_MOBILITY)) */ + ATIPutMach64LCDReg(LCD_GEN_CNTL, + (pATIHW->lcd_gen_ctrl & ~CRTC_RW_SELECT) | + (SHADOW_EN | SHADOW_RW_EN)); + #ifndef AVOID_CPIO - /* Save shadow VGA CRTC registers */ - for (Index = 0; Index < NumberOf(pATIHW->shadow_vga); Index++) - pATIHW->shadow_vga[Index] = - GetReg(CRTX(pATI->CPIO_VGABase), Index); + /* Save shadow VGA CRTC registers */ + for (Index = 0; + Index < NumberOf(pATIHW->shadow_vga); + Index++) + pATIHW->shadow_vga[Index] = + GetReg(CRTX(pATI->CPIO_VGABase), Index); #endif /* AVOID_CPIO */ - /* Save shadow Mach64 CRTC registers */ - pATIHW->shadow_h_total_disp = inr(CRTC_H_TOTAL_DISP); - pATIHW->shadow_h_sync_strt_wid = inr(CRTC_H_SYNC_STRT_WID); - pATIHW->shadow_v_total_disp = inr(CRTC_V_TOTAL_DISP); - pATIHW->shadow_v_sync_strt_wid = inr(CRTC_V_SYNC_STRT_WID); - } + /* Save shadow Mach64 CRTC registers */ + pATIHW->shadow_h_total_disp = inr(CRTC_H_TOTAL_DISP); + pATIHW->shadow_h_sync_strt_wid = inr(CRTC_H_SYNC_STRT_WID); + pATIHW->shadow_v_total_disp = inr(CRTC_V_TOTAL_DISP); + pATIHW->shadow_v_sync_strt_wid = inr(CRTC_V_SYNC_STRT_WID); + } - /* Restore CRTC selection and shadow state */ - if (pATI->Chip == ATI_CHIP_264LT) - outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl); - else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || - (pATI->Chip == ATI_CHIP_264XL) || - (pATI->Chip == ATI_CHIP_MOBILITY)) */ - { - ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl); - outr(LCD_INDEX, pATIHW->lcd_index); + /* Restore CRTC selection and shadow state */ + if (pATI->Chip == ATI_CHIP_264LT) + outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl); + else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || + (pATI->Chip == ATI_CHIP_264XL) || + (pATI->Chip == ATI_CHIP_MOBILITY)) */ + { + ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl); + outr(LCD_INDEX, pATIHW->lcd_index); + } + } } } @@ -646,7 +546,7 @@ ) { CARD32 lcd_index; - int Index, ECPClock; + int Index, ECPClock, MaxScalerClock; /* Clobber mode timings */ if ((pATI->LCDPanelID >= 0) && !pATI->OptionCRT && @@ -859,10 +759,20 @@ /* Setup ECP clock divider */ if (pATI->Chip >= ATI_CHIP_264VT) { + if (pATI->Chip <= ATI_CHIP_264VT3) + MaxScalerClock = 80000; + else if (pATI->Chip <= ATI_CHIP_264GT2C) + MaxScalerClock = 100000; + else if (pATI->Chip == ATI_CHIP_264GTPRO) + MaxScalerClock = 125000; + else if (pATI->Chip <= ATI_CHIP_MOBILITY) + MaxScalerClock = 135000; + else + MaxScalerClock = 80000; /* Conservative */ pATIHW->pll_vclk_cntl &= ~PLL_ECP_DIV; /* XXX Don't do this for TVOut! */ ECPClock = pMode->SynthClock; - for (Index = 0; (ECPClock > 125000) && (Index < 2); Index++) + for (Index = 0; (ECPClock > MaxScalerClock) && (Index < 2); Index++) ECPClock >>= 1; pATIHW->pll_vclk_cntl |= SetBits(Index, PLL_ECP_DIV); } @@ -907,45 +817,47 @@ ATIPutMach64PLLReg(PLL_EXT_VPLL_CNTL, pATIHW->pll_ext_vpll_cntl); ATIPutMach64PLLReg(PLL_VCLK_CNTL, pATIHW->pll_vclk_cntl & ~PLL_VCLK_RESET); - } - - /* Load LCD registers */ - if (pATI->LCDPanelID >= 0) - { - /* Stop CRTC */ - outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl & - ~(CRTC_EXT_DISP_EN | CRTC_EN)); - if (pATI->Chip == ATI_CHIP_264LT) + /* Load LCD registers */ + if (pATI->LCDPanelID >= 0) { - /* Update non-shadow registers first */ - outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl & - ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT | - SHADOW_EN | SHADOW_RW_EN)); - - /* Temporarily disable stretching */ - outr(HORZ_STRETCHING, pATIHW->horz_stretching & - ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN)); - outr(VERT_STRETCHING, pATIHW->vert_stretching & - ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 | - VERT_STRETCH_USE0 | VERT_STRETCH_EN)); - } - else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || - (pATI->Chip == ATI_CHIP_264XL) || - (pATI->Chip == ATI_CHIP_MOBILITY)) */ - { - /* Update non-shadow registers first */ - ATIPutMach64LCDReg(LCD_CONFIG_PANEL, pATIHW->config_panel); - ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl & - ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT | - SHADOW_EN | SHADOW_RW_EN)); - - /* Temporarily disable stretching */ - ATIPutMach64LCDReg(LCD_HORZ_STRETCHING, pATIHW->horz_stretching & - ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN)); - ATIPutMach64LCDReg(LCD_VERT_STRETCHING, pATIHW->vert_stretching & - ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 | - VERT_STRETCH_USE0 | VERT_STRETCH_EN)); + /* Stop CRTC */ + outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl & + ~(CRTC_EXT_DISP_EN | CRTC_EN)); + + if (pATI->Chip == ATI_CHIP_264LT) + { + /* Update non-shadow registers first */ + outr(LCD_GEN_CTRL, pATIHW->lcd_gen_ctrl & + ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT | + SHADOW_EN | SHADOW_RW_EN)); + + /* Temporarily disable stretching */ + outr(HORZ_STRETCHING, pATIHW->horz_stretching & + ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN)); + outr(VERT_STRETCHING, pATIHW->vert_stretching & + ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 | + VERT_STRETCH_USE0 | VERT_STRETCH_EN)); + } + else /* if ((pATI->Chip == ATI_CHIP_264LTPRO) || + (pATI->Chip == ATI_CHIP_264XL) || + (pATI->Chip == ATI_CHIP_MOBILITY)) */ + { + /* Update non-shadow registers first */ + ATIPutMach64LCDReg(LCD_CONFIG_PANEL, pATIHW->config_panel); + ATIPutMach64LCDReg(LCD_GEN_CNTL, pATIHW->lcd_gen_ctrl & + ~(DISABLE_PCLK_RESET | CRTC_RW_SELECT | + SHADOW_EN | SHADOW_RW_EN)); + + /* Temporarily disable stretching */ + ATIPutMach64LCDReg(LCD_HORZ_STRETCHING, + pATIHW->horz_stretching & + ~(HORZ_STRETCH_MODE | HORZ_STRETCH_EN)); + ATIPutMach64LCDReg(LCD_VERT_STRETCHING, + pATIHW->vert_stretching & + ~(VERT_STRETCH_RATIO1 | VERT_STRETCH_RATIO2 | + VERT_STRETCH_USE0 | VERT_STRETCH_EN)); + } } } @@ -978,8 +890,16 @@ if (pATI->Chip >= ATI_CHIP_88800GXC) { outr(CRTC_GEN_CNTL, pATIHW->crtc_gen_cntl); + outr(CUR_CLR0, pATIHW->cur_clr0); + outr(CUR_CLR1, pATIHW->cur_clr1); + outr(CUR_OFFSET, pATIHW->cur_offset); + outr(CUR_HORZ_VERT_POSN, pATIHW->cur_horz_vert_posn); + outr(CUR_HORZ_VERT_OFF, pATIHW->cur_horz_vert_off); outr(MEM_VGA_WP_SEL, pATIHW->mem_vga_wp_sel); outr(MEM_VGA_RP_SEL, pATIHW->mem_vga_rp_sel); + outr(GEN_TEST_CNTL, pATIHW->gen_test_cntl | 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) { @@ -990,6 +910,8 @@ outr(CRTC_OFF_PITCH, pATIHW->crtc_off_pitch); outr(BUS_CNTL, pATIHW->bus_cntl); outr(DAC_CNTL, pATIHW->dac_cntl); + if (pATI->Chip >= ATI_CHIP_264VTB) + outr(MEM_CNTL, pATIHW->mem_cntl); } } @@ -1096,6 +1018,9 @@ /* Load RAMDAC */ ATIDACSet(pATI, pATIHW); + /* Reset hardware cursor caching */ + pATI->CursorXOffset = pATI->CursorYOffset = (CARD16)(-1); + #ifndef AVOID_CPIO /* Restore video memory */ @@ -1113,53 +1038,4 @@ ATIPrintMode(pScreenInfo->currentMode); ATIPrintRegisters(pATI); } -} - -/* - * ATIModeAccelInit -- - * - * This function is called to initialise XAA on a screen. - */ -Bool -ATIModeAccelInit -( - ScrnInfoPtr pScreenInfo, - ScreenPtr pScreen, - ATIPtr pATI -) -{ - BoxRec ScreenArea; - - if (!pATI->OptionAccel) - return TRUE; - - if (!(pATI->pXAAInfo = XAACreateInfoRec())) - return FALSE; - - switch (pATI->Adapter) - { - case ATI_ADAPTER_MACH64: - if (ATIMach64AccelInit(pATI, pATI->pXAAInfo)) - break; - - default: - XAADestroyInfoRec(pATI->pXAAInfo); - pATI->pXAAInfo = NULL; - return FALSE; - } - - ScreenArea.x1 = ScreenArea.y1 = 0; - ScreenArea.x2 = pATI->displayWidth; - ScreenArea.y2 = pScreenInfo->videoRam * 1024 * 8 / pATI->displayWidth / - pATI->bitsPerPixel; - if ((unsigned)ScreenArea.y2 > ATIMach64MaxY) - ScreenArea.y2 = ATIMach64MaxY; - xf86InitFBManager(pScreen, &ScreenArea); - - if (XAAInit(pScreen, pATI->pXAAInfo)) - return TRUE; - - XAADestroyInfoRec(pATI->pXAAInfo); - pATI->pXAAInfo = NULL; - return FALSE; } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h:1.1 Wed Oct 11 18:52:56 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h Sun Mar 25 00:32:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h,v 1.1 2000/10/11 22:52:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimode.h,v 1.3 2001/03/25 05:32:08 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -37,8 +37,5 @@ DisplayModePtr)); extern void ATIModeSet FunctionPrototype((ScrnInfoPtr, ATIPtr, ATIHWPtr)); - -extern Bool ATIModeAccelInit FunctionPrototype((ScrnInfoPtr, ScreenPtr, - ATIPtr)); #endif /* ___ATIMODE_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c:1.11 xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c:1.11 Thu Nov 2 11:55:28 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c Sat Jan 6 15:58:06 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c,v 1.11 2000/11/02 16:55:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.c,v 1.12 2001/01/06 20:58:06 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h:1.6 Thu Nov 2 11:55:28 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h Sat Jan 6 15:58:06 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h,v 1.6 2000/11/02 16:55:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimodule.h,v 1.7 2001/01/06 20:58:06 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h:1.4 Fri Feb 18 07:19:27 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h Sat Jan 6 15:58:06 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h,v 1.4 2000/02/18 12:19:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atimono.h,v 1.5 2001/01/06 20:58:06 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c:1.13 Thu Nov 2 11:55:28 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c Mon May 7 17:59:06 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.13 2000/11/02 16:55:28 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.c,v 1.18 2001/05/07 21:59:06 tsi Exp $ */ /* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -30,7 +30,7 @@ /* * Recognised XF86Config options. */ -OptionInfoRec ATIPublicOptions[] = +const OptionInfoRec ATIPublicOptions[] = { { ATI_OPTION_ACCEL, @@ -54,12 +54,25 @@ FALSE }, { + ATI_OPTION_HWCURSOR, + "hw_cursor", + OPTV_BOOLEAN, + {0, }, + FALSE, + }, + +#ifndef AVOID_CPIO + + { ATI_OPTION_LINEAR, "linear", OPTV_BOOLEAN, {0, }, FALSE }, + +#endif /* AVOID_CPIO */ + { ATI_OPTION_MMIO_CACHE, "mmio_cache", @@ -89,6 +102,13 @@ FALSE }, { + ATI_OPTION_SWCURSOR, + "sw_cursor", + OPTV_BOOLEAN, + {0, }, + FALSE, + }, + { -1, NULL, OPTV_NONE, @@ -104,14 +124,14 @@ * * Return recognised options that are intended for public consumption. */ -OptionInfoPtr +const OptionInfoRec * ATIAvailableOptions ( - int ChipId, /* Ignored */ - int BusId /* Ignored */ + int ChipId, + int BusId ) { - OptionInfoPtr pOptions; + const OptionInfoRec *pOptions; if ((pOptions = R128AvailableOptions(ChipId, BusId))) return pOptions; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h:1.4 Wed Oct 11 18:52:57 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h Fri May 18 16:22:28 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h,v 1.4 2000/10/11 22:52:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atioption.h,v 1.8 2001/05/18 20:22:28 tsi Exp $ */ /* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -36,16 +36,24 @@ ATI_OPTION_ACCEL, ATI_OPTION_CRT, ATI_OPTION_CSYNC, + ATI_OPTION_HWCURSOR, + +#ifndef AVOID_CPIO + ATI_OPTION_LINEAR, + +#endif /* AVOID_CPIO */ + ATI_OPTION_MMIO_CACHE, ATI_OPTION_PROBE_CLOCKS, ATI_OPTION_REFERENCE_CLOCK, - ATI_OPTION_SHADOW_FB + ATI_OPTION_SHADOW_FB, + ATI_OPTION_SWCURSOR } ATIPublicOptionType; -extern OptionInfoRec ATIPublicOptions[]; -extern const unsigned long ATIPublicOptionSize; +extern const OptionInfoRec ATIPublicOptions[]; +extern const unsigned long ATIPublicOptionSize; -extern OptionInfoPtr ATIAvailableOptions FunctionPrototype((int, int)); +extern const OptionInfoRec * ATIAvailableOptions FunctionPrototype((int, int)); #endif /* ___ATIOPTION_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c:1.39 xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c:1.47.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c:1.39 Tue Dec 12 19:45:20 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c Tue May 22 11:57:03 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.39 2000/12/13 00:45:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.c,v 1.47.2.1 2001/05/22 15:57:03 tsi Exp $ */ /* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -27,6 +27,7 @@ #include "atibus.h" #include "atichip.h" #include "aticonfig.h" +#include "aticursor.h" #include "atidac.h" #include "atidsp.h" #include "atiident.h" @@ -403,8 +404,8 @@ pciVideoPtr pVideo; DisplayModePtr pMode; unsigned long Block0Base; - CARD32 IOValue1, IOValue2 = 0, IOValue3 = 0, IOValue4 = 0; - int i, j, AcceleratorVideoRAM = 0; + CARD32 IOValue; + int i, j, AcceleratorVideoRAM = 0, ServerVideoRAM; int Numerator, Denominator; int MinX, MinY; ClockRange ATIClockRange = {NULL, 0, 80000, 0, TRUE, TRUE, 1, 1, 0}; @@ -412,6 +413,8 @@ int ApertureSize = 0x00010000U; LookupModeFlags Strategy = LOOKUP_CLOSEST_CLOCK; +# define pATIHW (&pATI->OldHW) + #ifndef AVOID_CPIO xf86Int10InfoPtr pInt10Info = NULL; @@ -456,6 +459,7 @@ } ConfiguredMonitor = NULL; + (void)memset(BIOS, 0, SizeOf(BIOS)); if (!(flags & PROBE_DETECT)) { @@ -514,11 +518,15 @@ { static const CARD8 AllowedDepthBpp[][2] = { + #ifndef AVOID_CPIO + { 1, 1}, { 4, 4}, { 4, 8}, + #endif /* AVOID_CPIO */ + { 8, 8}, {15, 16}, {16, 16}, @@ -563,7 +571,7 @@ #ifdef AVOID_CPIO - else + else /* if (flags & PROBE_DETECT) */ return TRUE; #else /* AVOID_CPIO */ @@ -572,7 +580,6 @@ * If there is an ix86-style BIOS, ensure its initialisation entry point * has been executed, and retrieve DDC and VBE information from it. */ - (void)memset(BIOS, 0, SizeOf(BIOS)); if (!(pInt10Module = xf86LoadSubModule(pScreenInfo, "int10"))) xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, "Unable to load int10 module.\n"); @@ -625,8 +632,11 @@ return TRUE; } - xf86PrintEDID(ConfiguredMonitor); - xf86SetDDCproperties(pScreenInfo, ConfiguredMonitor); + if (ConfiguredMonitor) + { + xf86PrintEDID(ConfiguredMonitor); + xf86SetDDCproperties(pScreenInfo, ConfiguredMonitor); + } /* DDC module is no longer needed at this point */ xf86UnloadSubModule(pDDCModule); @@ -641,10 +651,16 @@ /* Set MMIO address from PCI configuration space, if available */ if ((pATI->Block0Base = pVideo->memBase[2])) - pATI->Block0Base += 0x0400U; + { + if (pATI->Block0Base >= (CARD32)(-1 << pVideo->size[2])) + pATI->Block0Base = 0; + else + pATI->Block0Base += 0x0400U; + } } - pScreenInfo->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_VIEWPORT; + pScreenInfo->racIoFlags = + RAC_FB | RAC_COLORMAP | RAC_VIEWPORT | RAC_CURSOR; pScreenInfo->racMemFlags = RAC_FB; /* Deal with ChipID & ChipRev overrides */ @@ -744,13 +760,13 @@ break; case ATI_ADAPTER_MACH32: - IOValue1 = inw(CONFIG_STATUS_1); - pATI->DAC = ATI_DAC(GetBits(IOValue1, DACTYPE), 0); - pATI->MemoryType = GetBits(IOValue1, MEM_TYPE); + IOValue = inw(CONFIG_STATUS_1); + pATI->DAC = ATI_DAC(GetBits(IOValue, DACTYPE), 0); + pATI->MemoryType = GetBits(IOValue, MEM_TYPE); - IOValue1 = inw(MISC_OPTIONS); + IOValue = inw(MISC_OPTIONS); pATI->VideoRAM = - videoRamSizes[GetBits(IOValue1, MEM_SIZE_ALIAS) + 2]; + videoRamSizes[GetBits(IOValue, MEM_SIZE_ALIAS) + 2]; /* * The 68800-6 doesn't necessarily report the correct video memory @@ -793,7 +809,7 @@ } ATIMapMach64(pScreenInfo->scrnIndex, pATI); - } while(0); + } while (0); pATI->Block0Base = Block0Base; #ifdef AVOID_CPIO @@ -807,8 +823,9 @@ #endif /* AVOID_CPIO */ - IOValue1 = inr(CRTC_GEN_CNTL); - if (!(IOValue1 & CRTC_EN) && (pATI->Chip >= ATI_CHIP_264CT)) + pATIHW->crtc_gen_cntl = inr(CRTC_GEN_CNTL); + if (!(pATIHW->crtc_gen_cntl & CRTC_EN) && + (pATI->Chip >= ATI_CHIP_264CT)) { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, "Adapter has not been initialised.\n"); @@ -819,7 +836,7 @@ #ifdef AVOID_CPIO - if (!(IOValue1 & CRTC_EXT_DISP_EN)) + if (!(pATIHW->crtc_gen_cntl & CRTC_EXT_DISP_EN)) { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, "Adapters found to be in VGA mode on server entry are not" @@ -831,49 +848,51 @@ #endif /* AVOID_CPIO */ - IOValue1 = inr(MEM_CNTL); + pATIHW->mem_cntl = inr(MEM_CNTL); if (pATI->Chip < ATI_CHIP_264VTB) pATI->VideoRAM = - videoRamSizes[GetBits(IOValue1, CTL_MEM_SIZE) + 2]; + videoRamSizes[GetBits(pATIHW->mem_cntl, CTL_MEM_SIZE) + 2]; else { pATI->nFIFOEntries = /* Don't care */ (unsigned int)(-1) >> 1; - IOValue1 = GetBits(IOValue1, CTL_MEM_SIZEB); - if (IOValue1 < 8) - pATI->VideoRAM = (IOValue1 + 1) * 512; - else if (IOValue1 < 12) - pATI->VideoRAM = (IOValue1 - 3) * 1024; + IOValue = GetBits(pATIHW->mem_cntl, CTL_MEM_SIZEB); + if (IOValue < 8) + pATI->VideoRAM = (IOValue + 1) * 512; + else if (IOValue < 12) + pATI->VideoRAM = (IOValue - 3) * 1024; else - pATI->VideoRAM = (IOValue1 - 7) * 2048; + pATI->VideoRAM = (IOValue - 7) * 2048; } pATI->DAC = GetBits(inr(DAC_CNTL), DAC_TYPE); - IOValue1 = inr(CONFIG_STATUS64_0); + IOValue = inr(CONFIG_STATUS64_0); if (pATI->Chip >= ATI_CHIP_264CT) { - pATI->MemoryType = GetBits(IOValue1, CFG_MEM_TYPE_T); + pATI->MemoryType = GetBits(IOValue, CFG_MEM_TYPE_T); /* Get LCD panel id and set LCD & TV I/O port numbers */ if (pATI->Chip == ATI_CHIP_264LT) { - pATI->LCDPanelID = GetBits(IOValue1, CFG_PANEL_ID); + pATI->LCDPanelID = GetBits(IOValue, CFG_PANEL_ID); - IOValue2 = inr(HORZ_STRETCHING); - IOValue3 = inr(VERT_STRETCHING); - IOValue4 = inr(LCD_GEN_CTRL); + pATIHW->horz_stretching = inr(HORZ_STRETCHING); + pATIHW->vert_stretching = inr(VERT_STRETCHING); + pATIHW->lcd_gen_ctrl = inr(LCD_GEN_CTRL); } else if ((pATI->Chip == ATI_CHIP_264LTPRO) || (pATI->Chip == ATI_CHIP_264XL) || (pATI->Chip == ATI_CHIP_MOBILITY)) { - pATI->LCDPanelID = GetBits(IOValue1, CFG_PANEL_ID); + pATI->LCDPanelID = GetBits(IOValue, CFG_PANEL_ID); - IOValue1 = inr(LCD_INDEX); - IOValue2 = ATIGetMach64LCDReg(LCD_HORZ_STRETCHING); - pATI->LCDHorizontal = GetBits(IOValue2, HORZ_PANEL_SIZE); + pATIHW->lcd_index = inr(LCD_INDEX); + pATIHW->horz_stretching = + ATIGetMach64LCDReg(LCD_HORZ_STRETCHING); + pATI->LCDHorizontal = + GetBits(pATIHW->horz_stretching, HORZ_PANEL_SIZE); if (pATI->LCDHorizontal) { if (pATI->LCDHorizontal == MaxBits(HORZ_PANEL_SIZE)) @@ -882,8 +901,10 @@ pATI->LCDHorizontal = (pATI->LCDHorizontal + 1) << 3; } - IOValue3 = ATIGetMach64LCDReg(LCD_EXT_VERT_STRETCH); - pATI->LCDVertical = GetBits(IOValue3, VERT_PANEL_SIZE); + pATIHW->ext_vert_stretch = + ATIGetMach64LCDReg(LCD_EXT_VERT_STRETCH); + pATI->LCDVertical = + GetBits(pATIHW->ext_vert_stretch, VERT_PANEL_SIZE); if (pATI->LCDVertical) { if (pATI->LCDVertical == MaxBits(VERT_PANEL_SIZE)) @@ -891,9 +912,10 @@ else pATI->LCDVertical++; } - IOValue3 = ATIGetMach64LCDReg(LCD_VERT_STRETCHING); - IOValue4 = ATIGetMach64LCDReg(LCD_GEN_CNTL); - outr(LCD_INDEX, IOValue1); + pATIHW->vert_stretching = + ATIGetMach64LCDReg(LCD_VERT_STRETCHING); + pATIHW->lcd_gen_ctrl = ATIGetMach64LCDReg(LCD_GEN_CNTL); + outr(LCD_INDEX, pATIHW->lcd_index); } /* @@ -901,16 +923,26 @@ * enabled. */ if ((pATI->LCDPanelID >= 0) && - !pATI->LCDHorizontal && - !pATI->LCDVertical && - !(IOValue2 & HORZ_STRETCH_EN) && - !(IOValue3 & VERT_STRETCH_EN) && - !(IOValue4 & LCD_ON)) + !(pATIHW->horz_stretching & HORZ_STRETCH_EN) && + !(pATIHW->vert_stretching & VERT_STRETCH_EN) && + !(pATIHW->lcd_gen_ctrl & LCD_ON)) + { + /* + * At this point, if an XL or Mobility BIOS hasn't set + * panel dimensions, then there is no panel. Otherwise, + * keep any panel disabled to allow for modes greater than + * the panel's dimensions. + */ + if ((pATI->Chip >= ATI_CHIP_264XL) && + (!pATI->LCDHorizontal || !pATI->LCDVertical)) pATI->LCDPanelID = -1; + else + pATI->OptionCRT = TRUE; + } } else { - pATI->MemoryType = GetBits(IOValue1, CFG_MEM_TYPE); + pATI->MemoryType = GetBits(IOValue, CFG_MEM_TYPE); /* Factor in what the BIOS says the DAC is */ pATI->DAC = ATI_DAC(pATI->DAC, @@ -1124,7 +1156,7 @@ pATI->DAC = ClockDac; /* For now */ } - /* Determine panel dimensions and driving clock */ + /* Determine panel dimensions */ if (pATI->LCDPanelID >= 0) { LCDTable = BIOSWord(0x78U); @@ -1214,10 +1246,10 @@ /* Sometimes, the BIOS lies about the chip */ if ((pATI->Chip >= ATI_CHIP_28800_4) && (pATI->Chip <= ATI_CHIP_28800_6)) { - IOValue1 = GetBits(ATIGetExtReg(0xAAU), 0x0FU) + + IOValue = GetBits(ATIGetExtReg(0xAAU), 0x0FU) + (ATI_CHIP_28800_4 - 4); - if ((IOValue1 <= ATI_CHIP_28800_6) && (IOValue1 > pATI->Chip)) - pATI->Chip = IOValue1; + if ((IOValue <= ATI_CHIP_28800_6) && (IOValue > pATI->Chip)) + pATI->Chip = IOValue; } #endif /* AVOID_CPIO */ @@ -1324,10 +1356,10 @@ #ifdef AVOID_CPIO - if (!pATI->OptionLinear) + if (!xf86LinearVidMem()) { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "A linear aperture is not available in this configuration.\n"); + "A linear aperture is not available.\n"); ATILock(pATI); ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); @@ -1516,90 +1548,347 @@ */ if (pATI->LCDPanelID >= 0) { - CARD8 ClockMask, PostMask; - - if (!pATI->LCDHorizontal || !pATI->LCDVertical) + if (pATI->OptionCRT) { - if (pATI->LCDPanelID || (pATI->Chip <= ATI_CHIP_264LTPRO)) - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Unable to determine dimensions of panel (ID %d).\n", - pATI->LCDPanelID); + xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, + "Using CRT interface and disabling digital flat panel.\n"); + } + else + { + int HDisplay, VDisplay; + CARD8 ClockMask, PostMask; + + /* + * Determine porch data. The following is inaccurate (but still + * good enough) when BIOS initialisation has set things up so that + * the registers read here are not the ones actually in use by the + * panel. Thus, a further refinement here would be to flip back + * and forth between shadow and non-shadow registers as dictated by + * the various LCD_GEN_CNTL and CONFIG_PANEL bits involved. + * + * This groks the mode on entry to extract the width and position + * of its sync and blanking pulses, and considers any overscan as + * part of the displayed area, given that the overscan is also + * stretched. + * + * This also attempts to determine panel dimensions but cannot do + * so for one that is "auto-stretched". + */ + +#ifndef AVOID_CPIO + + if (!(pATIHW->crtc_gen_cntl & CRTC_EXT_DISP_EN)) + { + pATIHW->clock = (inb(R_GENMO) & 0x0CU) >> 2; + + pATIHW->crt[0] = GetReg(CRTX(pATI->CPIO_VGABase), 0x00U); + pATIHW->crt[2] = GetReg(CRTX(pATI->CPIO_VGABase), 0x02U); + pATIHW->crt[3] = GetReg(CRTX(pATI->CPIO_VGABase), 0x03U); + pATIHW->crt[4] = GetReg(CRTX(pATI->CPIO_VGABase), 0x04U); + pATIHW->crt[5] = GetReg(CRTX(pATI->CPIO_VGABase), 0x05U); + pATIHW->crt[6] = GetReg(CRTX(pATI->CPIO_VGABase), 0x06U); + pATIHW->crt[7] = GetReg(CRTX(pATI->CPIO_VGABase), 0x07U); + pATIHW->crt[9] = GetReg(CRTX(pATI->CPIO_VGABase), 0x09U); + pATIHW->crt[16] = GetReg(CRTX(pATI->CPIO_VGABase), 0x10U); + pATIHW->crt[17] = GetReg(CRTX(pATI->CPIO_VGABase), 0x11U); + pATIHW->crt[21] = GetReg(CRTX(pATI->CPIO_VGABase), 0x15U); + pATIHW->crt[22] = GetReg(CRTX(pATI->CPIO_VGABase), 0x16U); + + pATI->LCDHSyncWidth = + (pATIHW->crt[5] - pATIHW->crt[4]) & 0x1FU; + pATI->LCDHBlankWidth = (((pATIHW->crt[3] & 0x1FU) | + ((pATIHW->crt[5] >> 2) & 0x20U)) - + pATIHW->crt[2]) & 0x3FU; + pATI->LCDVSyncWidth = + (pATIHW->crt[17] - pATIHW->crt[16]) & 0x0FU; + pATI->LCDVBlankWidth = + (pATIHW->crt[22] - pATIHW->crt[21]) & 0xFFU; + + HDisplay = pATIHW->crt[0] + 5 - pATI->LCDHBlankWidth; + VDisplay = (((pATIHW->crt[7] << 4) & 0x0200U) | + ((pATIHW->crt[7] << 8) & 0x0100U) | + pATIHW->crt[6]) + 2 - pATI->LCDVBlankWidth; + + pATI->LCDHSyncStart = + ((pATIHW->crt[4] - pATIHW->crt[2]) & 0xFFU) + 1; + pATI->LCDVSyncStart = (((((pATIHW->crt[7] << 2) & 0x0200U) | + ((pATIHW->crt[7] << 6) & 0x0100U) | + pATIHW->crt[16]) - + (((pATIHW->crt[9] << 4) & 0x0200U) | + ((pATIHW->crt[7] << 5) & 0x0100U) | + pATIHW->crt[21])) & 0xFFU) + 1; + } else - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Unable to determine dimensions of panel.\n"); - ATILock(pATI); - ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); - ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); - return FALSE; - } +#endif /* AVOID_CPIO */ - if (pATI->LCDPanelID || (pATI->Chip <= ATI_CHIP_264LTPRO)) - xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, - "%dx%d panel (ID %d) detected.\n", - pATI->LCDHorizontal, pATI->LCDVertical, pATI->LCDPanelID); - else - xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, - "%dx%d panel detected.\n", - pATI->LCDHorizontal, pATI->LCDVertical); + { + pATIHW->clock = inr(CLOCK_CNTL) & 0x03U; - if (LCDPanelInfo) - { - for (i = 0; i < 24; i++) - Buffer[i] = BIOSByte(LCDPanelInfo + 1 + i); - for (; --i >= 0; ) - if (Buffer[i] && Buffer[i] != ' ') + pATIHW->crtc_h_total_disp = inr(CRTC_H_TOTAL_DISP); + pATIHW->crtc_h_sync_strt_wid = inr(CRTC_H_SYNC_STRT_WID); + pATIHW->crtc_v_total_disp = inr(CRTC_V_TOTAL_DISP); + pATIHW->crtc_v_sync_strt_wid = inr(CRTC_V_SYNC_STRT_WID); + pATIHW->ovr_wid_left_right = inr(OVR_WID_LEFT_RIGHT); + pATIHW->ovr_wid_top_bottom = inr(OVR_WID_TOP_BOTTOM); + + HDisplay = GetBits(pATIHW->crtc_h_total_disp, CRTC_H_DISP) + + GetBits(pATIHW->ovr_wid_left_right, OVR_WID_LEFT) + + GetBits(pATIHW->ovr_wid_left_right, OVR_WID_RIGHT); + VDisplay = GetBits(pATIHW->crtc_v_total_disp, CRTC_V_DISP) + + GetBits(pATIHW->ovr_wid_top_bottom, OVR_WID_TOP) + + GetBits(pATIHW->ovr_wid_top_bottom, OVR_WID_BOTTOM); + + pATI->LCDHSyncStart = + (GetBits(pATIHW->crtc_h_sync_strt_wid, + CRTC_H_SYNC_STRT_HI) * + (MaxBits(CRTC_H_SYNC_STRT) + 1)) + + GetBits(pATIHW->crtc_h_sync_strt_wid, CRTC_H_SYNC_STRT) - + HDisplay; + pATI->LCDHSyncWidth = + GetBits(pATIHW->crtc_h_sync_strt_wid, CRTC_H_SYNC_WID); + pATI->LCDHBlankWidth = + GetBits(pATIHW->crtc_h_total_disp, CRTC_H_TOTAL) - + HDisplay; + pATI->LCDVSyncStart = + GetBits(pATIHW->crtc_v_sync_strt_wid, CRTC_V_SYNC_STRT) - + VDisplay; + pATI->LCDVSyncWidth = + GetBits(pATIHW->crtc_v_sync_strt_wid, CRTC_V_SYNC_WID); + pATI->LCDVBlankWidth = + GetBits(pATIHW->crtc_v_total_disp, CRTC_V_TOTAL) - + VDisplay; + + HDisplay++; + VDisplay++; + } + + HDisplay <<= 3; + pATI->LCDHSyncStart <<= 3; + pATI->LCDHSyncWidth <<= 3; + pATI->LCDHBlankWidth <<= 3; + + /* Calculate panel dimensions implied by the input timing */ + if ((pATIHW->horz_stretching & + (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) == + HORZ_STRETCH_EN) + { + if (pATIHW->horz_stretching & HORZ_STRETCH_MODE) { - Buffer[i + 1] = '\0'; - xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, - "Panel model %s.\n", Buffer); - break; + if (pATIHW->horz_stretching & HORZ_STRETCH_BLEND) + { + HDisplay = + (HDisplay * (MaxBits(HORZ_STRETCH_BLEND) + 1)) / + GetBits(pATIHW->horz_stretching, + HORZ_STRETCH_BLEND); + } } - } + else if (((pATIHW->horz_stretching & HORZ_STRETCH_LOOP) > + HORZ_STRETCH_LOOP15) || + (pATIHW->horz_stretching & + SetBits(1, HORZ_STRETCH_RATIO))) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Ignoring invalid horizontal stretch ratio in mode on" + " server entry.\n"); + } + else + { + IOValue = + GetBits(pATIHW->horz_stretching, HORZ_STRETCH_RATIO); - /* - * Determine panel clock. This must be done after option processing so - * that the adapter's reference frequency is always available. - */ + switch (GetBits(pATIHW->horz_stretching, + HORZ_STRETCH_LOOP)) + { + case GetBits(HORZ_STRETCH_LOOP09, HORZ_STRETCH_LOOP): + i = 9; + IOValue &= (1 << 9) - 1; + break; + + case GetBits(HORZ_STRETCH_LOOP11, HORZ_STRETCH_LOOP): + i = 11; + IOValue &= (1 << 11) - 1; + break; + + case GetBits(HORZ_STRETCH_LOOP12, HORZ_STRETCH_LOOP): + i = 12; + IOValue &= (1 << 12) - 1; + break; + + case GetBits(HORZ_STRETCH_LOOP14, HORZ_STRETCH_LOOP): + i = 14; + IOValue &= (1 << 14) - 1; + break; + + case GetBits(HORZ_STRETCH_LOOP15, HORZ_STRETCH_LOOP): + default: /* Muffle compiler */ + i = 15; + IOValue &= (1 << 15) - 1; + break; + } -#ifndef AVOID_CPIO + if (IOValue) + { + /* Count the number of bits in IOValue */ + j = (IOValue >> 1) & 0x36DBU; + j = IOValue - j - ((j >> 1) & 0x36DBU); + j = ((j + (j >> 3)) & 0x71C7U) % 0x3FU; - if (!(pATI->LockData.crtc_gen_cntl & CRTC_EXT_DISP_EN)) - i = (inb(R_GENMO) & 0x0CU) >> 2; - else + HDisplay = (HDisplay * i) / j; + } + } + } -#endif /* AVOID_CPIO */ + if ((pATIHW->vert_stretching & VERT_STRETCH_EN) && + !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO)) + { + if ((pATIHW->vert_stretching & VERT_STRETCH_USE0) || + (VDisplay <= 350)) + IOValue = + GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO0); + else if (VDisplay <= 400) + IOValue = + GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO1); + else if ((VDisplay <= 480) || + !(pATIHW->ext_vert_stretch & VERT_STRETCH_RATIO3)) + IOValue = + GetBits(pATIHW->vert_stretching, VERT_STRETCH_RATIO2); + else + IOValue = + GetBits(pATIHW->ext_vert_stretch, VERT_STRETCH_RATIO3); - { - i = inr(CLOCK_CNTL) & 0x03U; - } + if (IOValue) + VDisplay = + (VDisplay * (MaxBits(VERT_STRETCH_RATIO0) + 1)) / + IOValue; + } - /* - * Get post divider. A GCC bug has caused the following expression to - * be broken down into its individual components. - */ - ClockMask = PLL_VCLK0_XDIV << i; - PostMask = PLL_VCLK0_POST_DIV << (i * 2); - j = GetBits(ATIGetMach64PLLReg(PLL_XCLK_CNTL), ClockMask); - j *= MaxBits(PLL_VCLK0_POST_DIV) + 1; - j |= GetBits(ATIGetMach64PLLReg(PLL_VCLK_POST_DIV), PostMask); - - /* Calculate clock of mode on entry */ - Numerator = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV + i) * - pATI->ReferenceNumerator; - Denominator = pATI->ClockDescriptor.MinM * pATI->ReferenceDenominator * - pATI->ClockDescriptor.PostDividers[j]; - pATI->LCDClock = ATIDivide(Numerator, Denominator, 1, 0); + /* Match calculated dimensions to probed dimensions */ + if (!pATI->LCDHorizontal) + { + if ((pATIHW->horz_stretching & + (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) != + (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) + pATI->LCDHorizontal = HDisplay; + } + else if (pATI->LCDHorizontal != HDisplay) + { + if ((pATIHW->horz_stretching & + (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) != + (HORZ_STRETCH_EN | AUTO_HORZ_RATIO)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Inconsistent panel horizontal dimension:" + " %d and %d.\n", pATI->LCDHorizontal, HDisplay); + HDisplay = pATI->LCDHorizontal; + } - xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, - "Panel clock is %.3f MHz.\n", (double)(pATI->LCDClock) / 1000.0); + if (!pATI->LCDVertical) + { + if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) || + !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO)) + pATI->LCDVertical = VDisplay; + } + else if (pATI->LCDVertical != VDisplay) + { + if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) || + !(pATIHW->ext_vert_stretch & AUTO_VERT_RATIO)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Inconsistent panel vertical dimension: %d and %d.\n", + pATI->LCDVertical, VDisplay); + VDisplay = pATI->LCDVertical; + } - if (pATI->OptionCRT) - xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, - "Using CRT interface and disabling digital flat panel.\n"); - else + if (!pATI->LCDHorizontal || !pATI->LCDVertical) + { + if (pATI->LCDPanelID || (pATI->Chip <= ATI_CHIP_264LTPRO)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Unable to determine dimensions of panel (ID %d).\n", + pATI->LCDPanelID); + else + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Unable to determine dimensions of panel.\n"); + + ATILock(pATI); + ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + return FALSE; + } + + /* If the mode on entry wasn't stretched, adjust timings */ + if (!(pATIHW->horz_stretching & HORZ_STRETCH_EN) && + ((HDisplay = pATI->LCDHorizontal - HDisplay) > 0)) + { + if ((pATI->LCDHSyncStart -= HDisplay) < 0) + pATI->LCDHSyncStart = 0; + pATI->LCDHBlankWidth -= HDisplay; + HDisplay = pATI->LCDHSyncStart + pATI->LCDHSyncWidth; + if (pATI->LCDHBlankWidth < HDisplay) + pATI->LCDHBlankWidth = HDisplay; + } + + if (!(pATIHW->vert_stretching & VERT_STRETCH_EN) && + ((VDisplay = pATI->LCDVertical - VDisplay) > 0)) + { + if ((pATI->LCDVSyncStart -= VDisplay) < 0) + pATI->LCDVSyncStart = 0; + pATI->LCDVBlankWidth -= VDisplay; + VDisplay = pATI->LCDVSyncStart + pATI->LCDVSyncWidth; + if (pATI->LCDVBlankWidth < VDisplay) + pATI->LCDVBlankWidth = VDisplay; + } + + if (pATI->LCDPanelID || (pATI->Chip <= ATI_CHIP_264LTPRO)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, + "%dx%d panel (ID %d) detected.\n", + pATI->LCDHorizontal, pATI->LCDVertical, pATI->LCDPanelID); + else + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, + "%dx%d panel detected.\n", + pATI->LCDHorizontal, pATI->LCDVertical); + + if (LCDPanelInfo) + { + for (i = 0; i < 24; i++) + Buffer[i] = BIOSByte(LCDPanelInfo + 1 + i); + for (; --i >= 0; ) + if (Buffer[i] && Buffer[i] != ' ') + { + Buffer[i + 1] = '\0'; + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, + "Panel model %s.\n", Buffer); + break; + } + } + + /* + * Determine panel clock. This must be done after option + * processing so that the adapter's reference frequency is always + * available. + * + * Get post divider. A GCC bug has caused the following expression + * to be broken down into its individual components. + */ + ClockMask = PLL_VCLK0_XDIV << pATIHW->clock; + PostMask = PLL_VCLK0_POST_DIV << (pATIHW->clock * 2); + i = GetBits(ATIGetMach64PLLReg(PLL_XCLK_CNTL), ClockMask); + i *= MaxBits(PLL_VCLK0_POST_DIV) + 1; + i |= GetBits(ATIGetMach64PLLReg(PLL_VCLK_POST_DIV), PostMask); + + /* Calculate clock of mode on entry */ + Numerator = ATIGetMach64PLLReg(PLL_VCLK0_FB_DIV + pATIHW->clock) * + pATI->ReferenceNumerator; + Denominator = pATI->ClockDescriptor.MinM * + pATI->ReferenceDenominator * + pATI->ClockDescriptor.PostDividers[i]; + pATI->LCDClock = ATIDivide(Numerator, Denominator, 1, 0); + + xf86DrvMsg(pScreenInfo->scrnIndex, X_PROBED, + "Panel clock is %.3f MHz.\n", + (double)(pATI->LCDClock) / 1000.0); + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Using digital flat panel interface.\n"); + } } /* @@ -1636,10 +1925,10 @@ } else { - IOValue1 = ATIGetExtReg(0xB0U); - if (IOValue1 & 0x08U) + IOValue = ATIGetExtReg(0xB0U); + if (IOValue & 0x08U) VGAVideoRAM = 1024; - else if (IOValue1 & 0x10U) + else if (IOValue & 0x10U) VGAVideoRAM = 512; else VGAVideoRAM = 256; @@ -1691,157 +1980,190 @@ #endif /* AVOID_CPIO */ { - /* Possibly set up for linear aperture */ - -#ifndef AVOID_CPIO - - if (pATI->OptionLinear) - -#endif /* AVOID_CPIO */ - + /* Get adapter's linear aperture configuration */ + pATIHW->config_cntl = inr(CONFIG_CNTL); + pATI->LinearBase = + GetBits(pATIHW->config_cntl, CFG_MEM_AP_LOC) << 22; + if ((pATIHW->config_cntl & CFG_MEM_AP_SIZE) != CFG_MEM_AP_SIZE) { - /* Get adapter's linear aperture configuration */ - IOValue1 = inr(CONFIG_CNTL); - pATI->LinearBase = GetBits(IOValue1, CFG_MEM_AP_LOC) << 22; - if ((IOValue1 & CFG_MEM_AP_SIZE) != CFG_MEM_AP_SIZE) - { - pATI->LinearSize = - GetBits(IOValue1, CFG_MEM_AP_SIZE) << 22; + pATI->LinearSize = + GetBits(pATIHW->config_cntl, CFG_MEM_AP_SIZE) << 22; - /* - * Linear aperture could have been disabled (but still - * assigned) by BIOS initialisation. - */ - if (pATI->LinearBase && !pATI->LinearSize) - { - if (pATI->VideoRAM < 4096) - pATI->LinearSize = 4 * 1024 * 1024; - else - pATI->LinearSize = 8 * 1024 * 1024; - } + /* + * Linear aperture could have been disabled (but still + * assigned) by BIOS initialisation. + */ + if (pATI->LinearBase && !pATI->LinearSize) + { + if (pATI->VideoRAM < 4096) + pATI->LinearSize = 4 * 1024 * 1024; + else + pATI->LinearSize = 8 * 1024 * 1024; } + } #ifndef AVOID_CPIO - /* Except for PCI & AGP, allow for user override */ - if (!pATI->PCIInfo) - { - if (pATI->Chip == ATI_CHIP_88800CX) - IOValue2 = ~((CARD32)((1 << 23) - 1)); - else if (pATI->Chip >= ATI_CHIP_88800GXE) - IOValue2 = ~((CARD32)((1 << 24) - 1)); - else if (pATI->VideoRAM >= 4096) - IOValue2 = ~((CARD32)((1 << 23) - 1)); - else - IOValue2 = ~((CARD32)((1 << 22) - 1)); + /* Except for PCI & AGP, allow for user override */ + if (!pATI->PCIInfo) + { + if (pATI->Chip == ATI_CHIP_88800CX) + IOValue = ~((CARD32)((1 << 23) - 1)); + else if (pATI->Chip >= ATI_CHIP_88800GXE) + IOValue = ~((CARD32)((1 << 24) - 1)); + else if (pATI->VideoRAM >= 4096) + IOValue = ~((CARD32)((1 << 23) - 1)); + else + IOValue = ~((CARD32)((1 << 22) - 1)); - if ((IOValue2 &= pGDev->MemBase) && - (IOValue2 <= (MaxBits(CFG_MEM_AP_LOC) << 22))) - pATI->LinearBase = IOValue2; + if ((IOValue &= pGDev->MemBase) && + (IOValue <= (MaxBits(CFG_MEM_AP_LOC) << 22))) + pATI->LinearBase = IOValue; - if (!pATI->LinearBase) - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "Linear aperture not configured. Specify" - " \"MemBase\" override in XF86Config \"Device\"" - " section.\n"); - else + if (!pATI->LinearBase) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Linear aperture not configured. Specify \"MemBase\"" + " override in XF86Config \"Device\" section.\n"); + else + { + if (!pATI->LinearSize) { if (pATI->VideoRAM < 4096) pATI->LinearSize = 4 * 1024 * 1024; else pATI->LinearSize = 8 * 1024 * 1024; + } - Resources[0].type = ResExcMemBlock; - Resources[0].rBegin = pATI->LinearBase; - Resources[0].rEnd = pATI->LinearBase + - pATI->LinearSize - 1; - if (xf86RegisterResources(pATI->iEntity, Resources, - ResNone)) - { - xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, - "Unable to register %d MB linear aperture at" - " 0x%08X.\n", pATI->LinearSize >> 10, - pATI->LinearBase); + Resources[0].type = ResExcMemBlock; + Resources[0].rBegin = pATI->LinearBase; + Resources[0].rEnd = + pATI->LinearBase + pATI->LinearSize - 1; + if (xf86RegisterResources(pATI->iEntity, Resources, + ResNone)) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Unable to register %d MB linear aperture at" + " 0x%08X.\n", pATI->LinearSize >> 10, + pATI->LinearBase); - pATI->LinearSize = 0; - } + pATI->LinearSize = 0; } } + } #endif /* AVOID_CPIO */ - if (!pATI->LinearBase || !pATI->LinearSize) + if (pATI->LinearBase && pATI->LinearSize) + { + /* + * Unless specified in PCI configuration space, set MMIO + * address to tail end of linear aperture. + */ + if (!pATI->Block0Base) { + pATI->Block0Base = + pATI->LinearBase + pATI->LinearSize - 0x00000400U; + pATI->MMIOInLinear = pATI->OptionAccel; + } -#ifndef AVOID_CPIO + AcceleratorVideoRAM = pATI->LinearSize >> 10; - if (pATI->VGAAdapter == ATI_ADAPTER_NONE) + /* + * Account for MMIO area at the tail end of the linear + * aperture, if it is needed or if it cannot be disabled. + */ + if (pATI->MMIOInLinear || (pATI->Chip < ATI_CHIP_264VTB)) + AcceleratorVideoRAM -= 2; -#endif /* AVOID_CPIO */ + ServerVideoRAM = pATI->VideoRAM; - { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "A linear aperture is not available through this" - " adapter.\n"); - ATILock(pATI); - ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); - ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); - return FALSE; - } + if (pATI->Cursor > ATI_CURSOR_SOFTWARE) + { + /* + * Allocate a 1 kB cursor image area at the top of the + * little-endian aperture, just before any MMIO area that + * might also be there. + */ + if (ServerVideoRAM > AcceleratorVideoRAM) + ServerVideoRAM = AcceleratorVideoRAM; + ServerVideoRAM--; + pATI->CursorOffset = ServerVideoRAM << 10; + pATI->CursorBase = pATI->LinearBase + pATI->CursorOffset; + + xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, + "Storing hardware cursor image at 0x%08X.\n", + pATI->CursorBase); + } + #ifndef AVOID_CPIO - /* Insurance */ - pATI->LinearBase = pATI->LinearSize = 0; + if (pATI->OptionLinear) #endif /* AVOID_CPIO */ - } - else { - /* - * Unless specified in PCI configuration space, set MMIO - * address to tail end of linear aperture. - */ - if (!pATI->Block0Base) - pATI->Block0Base = - pATI->LinearBase + pATI->LinearSize - 0x00000400U; + CARD32 PageSize = getpagesize() >> 10; - AcceleratorVideoRAM = pATI->LinearSize >> 10; - #if X_BYTE_ORDER == X_LITTLE_ENDIAN /* - * Account for MMIO area, if it cannot be disabled. This - * relinquishes the entire last page of the linear aperture - * to prevent the server from write-combining it. + * MMIO areas must be mmap()'ed separately to avoid write + * combining them. Thus, they might not end up still + * adjacent with the little-endian linear aperture after + * mmap()'ing. So, round down the linear aperture size to + * avoid an overlap. Any hardware cursor image area might + * not end up being write combined, but this seems + * preferable to further reducing the video memory size + * advertised to the server. + * + * XXX Ideally this should be dealt with in the os-support + * layer, i.e., it should be possible to reset a + * subarea's write combining after it has been + * mmap()'ed, but doing so currently causes the removal + * of write combining for the entire aperture. */ - if (pATI->Chip < ATI_CHIP_264VTB) - AcceleratorVideoRAM -= getpagesize() >> 10; + if (pATI->MMIOInLinear) + AcceleratorVideoRAM -= AcceleratorVideoRAM % PageSize; -#else /* if X_BYTE_ORDER == X_BIG_ENDIAN */ +#else /* if X_BYTE_ORDER != X_LITTLE_ENDIAN */ - /* Big-endian aperture is 8 MB higher */ + /* + * Big-endian apertures are 8 MB higher and don't contain + * an MMIO area. + */ pATI->LinearBase += 0x00800000U; + AcceleratorVideoRAM = pATI->LinearSize >> 10; #endif /* X_BYTE_ORDER */ - if (AcceleratorVideoRAM < pATI->VideoRAM) - { - pScreenInfo->videoRam = AcceleratorVideoRAM; - xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, - "Virtual resolutions will be limited to %d kB due" - " to linear aperture size.\n", - AcceleratorVideoRAM); - } + if (ServerVideoRAM > AcceleratorVideoRAM) + ServerVideoRAM = AcceleratorVideoRAM; + else if (AcceleratorVideoRAM > pATI->VideoRAM) + AcceleratorVideoRAM = pATI->VideoRAM; + + PageSize--; + AcceleratorVideoRAM = + (AcceleratorVideoRAM + PageSize) & ~PageSize; xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, "Using %d MB linear aperture at 0x%08X.\n", pATI->LinearSize >> 20, pATI->LinearBase); /* Only mmap what is needed */ - ApertureSize = pATI->LinearSize = pATI->VideoRAM * 1024; + ApertureSize = pATI->LinearSize = + AcceleratorVideoRAM << 10; } + + if (ServerVideoRAM < pATI->VideoRAM) + { + pScreenInfo->videoRam = ServerVideoRAM; + xf86DrvMsg(pScreenInfo->scrnIndex, X_NOTICE, + "Virtual resolutions will be limited to %d kB\n due to" + " linear aperture size and/or placement of hardware" + " cursor image area.\n", + ServerVideoRAM); + } } } @@ -1872,8 +2194,9 @@ /* * Unless specified in PCI configuration space, or at the top of - * of a linear aperture, set MMIO address to the one just above the - * VGA aperture. This does not work on the CT (maybe others). + * of a little-endian linear aperture, set MMIO address to the one + * just above the VGA aperture. This does not work on the CT + * (maybe others). */ if (!pATI->Block0Base && ((pATI->Chip < ATI_CHIP_264CT) || @@ -1882,8 +2205,49 @@ pATI->Block0Base = 0x000BFC00U; } + if (!pATI->OptionLinear) + pATI->LinearBase = 0; /* Not needed */ + +#endif /* AVOID_CPIO */ + + if (!pATI->LinearBase || !pATI->LinearSize) + { + +#ifndef AVOID_CPIO + + if (pATI->VGAAdapter == ATI_ADAPTER_NONE) + +#endif /* AVOID_CPIO */ + + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + "Linear aperture not available.\n"); + ATILock(pATI); + ATIPrintNoiseIfRequested(pATI, BIOS, BIOSSize); + ATIUnmapApertures(pScreenInfo->scrnIndex, pATI); + return FALSE; + } + +#ifndef AVOID_CPIO + + /* Insurance */ + pATI->LinearBase = pATI->LinearSize = 0; + #endif /* AVOID_CPIO */ + } + +#ifndef AVOID_CPIO + + if (!pATI->OptionAccel) + { + pATI->Block0Base = 0; /* Not needed */ + pATI->MMIOInLinear = FALSE; + } + else + +#endif + if (pATI->Block0Base) { xf86DrvMsg(pScreenInfo->scrnIndex, X_INFO, @@ -1966,6 +2330,14 @@ #endif /* AVOID_CPIO */ + if ((pATI->Cursor > ATI_CURSOR_SOFTWARE) && !pATI->CursorBase) + { + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "Unable to store hardware cursor image. Reverting to software" + " cursor.\n"); + pATI->Cursor = ATI_CURSOR_SOFTWARE; + } + /* * Remap apertures. Must lock and re-unlock around this in case the * remapping fails. @@ -2115,7 +2487,7 @@ if (pATI->OptionShadowFB) { - /* Until ShadowFB becomes a true screen wrapper... */ + /* Until ShadowFB becomes a true screen wrapper, if it ever does... */ #ifndef AVOID_CPIO Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h:1.3 Fri Aug 4 17:07:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h Sat Jan 6 15:58:06 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h,v 1.3 2000/08/04 21:07:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipreinit.h,v 1.4 2001/01/06 20:58:06 tsi Exp $ */ /* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c:1.18 xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c:1.18 Tue Oct 17 12:53:17 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c Thu Apr 19 10:14:05 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.c,v 1.18 2000/10/17 16:53:17 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 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -646,6 +646,12 @@ } 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"); } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h:1.7 Tue Aug 22 17:54:31 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h Sat Jan 6 15:58:07 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h,v 1.7 2000/08/22 21:54:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprint.h,v 1.8 2001/01/06 20:58:07 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h:1.2 Fri Feb 18 07:19:31 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h Sat Jan 6 15:58:07 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h,v 1.2 2000/02/18 12:19:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atipriv.h,v 1.3 2001/01/06 20:58:07 tsi Exp $ */ /* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c:1.36 xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c:1.45 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c:1.36 Tue Dec 12 21:44:59 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c Fri May 18 16:22:28 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.36 2000/12/13 02:44:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.c,v 1.45 2001/05/18 20:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -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" @@ -58,6 +57,32 @@ * largely ignored. */ +#ifdef XFree86LOADER + +/* + * The following exists to prevent the compiler from considering entry points + * defined in a separate module from being constants. + */ +static xf86PreInitProc * const volatile PreInitProc = ATIPreInit; +static xf86ScreenInitProc * const volatile ScreenInitProc = ATIScreenInit; +static xf86SwitchModeProc * const volatile SwitchModeProc = ATISwitchMode; +static xf86AdjustFrameProc * const volatile AdjustFrameProc = ATIAdjustFrame; +static xf86EnterVTProc * const volatile EnterVTProc = ATIEnterVT; +static xf86LeaveVTProc * const volatile LeaveVTProc = ATILeaveVT; +static xf86FreeScreenProc * const volatile FreeScreenProc = ATIFreeScreen; +static xf86ValidModeProc * const volatile ValidModeProc = ATIValidMode; + +#define ATIPreInit PreInitProc +#define ATIScreenInit ScreenInitProc +#define ATISwitchMode SwitchModeProc +#define ATIAdjustFrame AdjustFrameProc +#define ATIEnterVT EnterVTProc +#define ATILeaveVT LeaveVTProc +#define ATIFreeScreen FreeScreenProc +#define ATIValidMode ValidModeProc + +#endif + /* Used as a temporary buffer */ #define Identifier ((char *)(pATI->MMIOCache)) @@ -478,7 +503,8 @@ 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)) @@ -620,7 +646,9 @@ * apertures can be enabled/disabled only through PCI, this probes no * further. */ - if ((pVideo->size[2] >= 12) && (pATI->Block0Base = pVideo->memBase[2])) + if ((pVideo->size[2] >= 12) && + (pATI->Block0Base = pVideo->memBase[2]) && + (pATI->Block0Base < (CARD32)(-1 << pVideo->size[2]))) { pATI->Block0Base += 0x00000400U; goto LastProbe; @@ -679,9 +707,14 @@ CARD32 IOValue; CARD16 ChipType = 0; + if (!IOBase) + return NULL; + if (pVideo) { - if ((IODecoding == BLOCK_IO) && (pVideo->size[1] < 8)) + if ((IODecoding == BLOCK_IO) && + ((pVideo->size[1] < 8) || + (IOBase >= (CARD32)(-1 << pVideo->size[1])))) return NULL; ChipType = pVideo->chipType; @@ -1122,15 +1155,15 @@ { 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); } } @@ -1139,16 +1172,16 @@ { 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); } } @@ -1301,6 +1334,8 @@ if (nATIGDev) { +#ifndef AVOID_NON_PCI + #ifdef AVOID_CPIO /* PCI sparse I/O adapters can still be used through MMIO */ @@ -1308,7 +1343,7 @@ { if ((pVideo->vendor != PCI_VENDOR_ATI) || (pVideo->chipType == PCI_CHIP_MACH32) || - IsATIBlockIOBase(pVideo->ioBase[1])) + pVideo->size[1]) continue; pPCI = pVideo->thisCard; @@ -1344,10 +1379,10 @@ { if ((pVideo->vendor != PCI_VENDOR_ATI) || (pVideo->chipType == PCI_CHIP_MACH32) || - !IsATIBlockIOBase(pVideo->ioBase[1])) + !pVideo->size[1]) continue; - /* For now, ignore Rage128's */ + /* For now, ignore Rage128's and Radeon's */ Chip = ATIChipID(pVideo->chipType, pVideo->chipRev); if (Chip > ATI_CHIP_Mach64) continue; @@ -1384,6 +1419,8 @@ } +#endif /* AVOID_NON_PCI */ + #ifndef AVOID_CPIO /* @@ -1521,7 +1558,7 @@ { if ((pVideo->vendor != PCI_VENDOR_ATI) || (pVideo->chipType == PCI_CHIP_MACH32) || - IsATIBlockIOBase(pVideo->ioBase[1])) + pVideo->size[1]) continue; pPCI = pVideo->thisCard; @@ -1617,7 +1654,7 @@ { if ((pVideo->vendor != PCI_VENDOR_ATI) || (pVideo->chipType == PCI_CHIP_MACH32) || - IsATIBlockIOBase(pVideo->ioBase[1])) + pVideo->size[1]) continue; /* Check if this one has already been detected */ @@ -1672,7 +1709,7 @@ { if ((pVideo->vendor != PCI_VENDOR_ATI) || (pVideo->chipType == PCI_CHIP_MACH32) || - !IsATIBlockIOBase(pVideo->ioBase[1])) + !pVideo->size[1]) continue; /* Check for Rage128's, Radeon's and later adapters */ @@ -1687,10 +1724,13 @@ case ATI_CHIP_RAGE128PROVR: case ATI_CHIP_RAGE128MOBILITY3: case ATI_CHIP_RAGE128MOBILITY4: + case ATI_CHIP_RAGE128ULTRA: DoRage128 = TRUE; continue; case ATI_CHIP_RADEON: + case ATI_CHIP_RADEONVE: + case ATI_CHIP_RADEONMOBILITY: DoRadeon = TRUE; continue; @@ -2240,24 +2280,6 @@ } xf86LoaderReqSymLists(ATISymbols, NULL); - - /* Workaround for possible loader bug */ -# define ATIPreInit \ - (xf86PreInitProc*) LoaderSymbol("ATIPreInit") -# define ATIScreenInit \ - (xf86ScreenInitProc*) LoaderSymbol("ATIScreenInit") -# define ATISwitchMode \ - (xf86SwitchModeProc*) LoaderSymbol("ATISwitchMode") -# define ATIAdjustFrame \ - (xf86AdjustFrameProc*)LoaderSymbol("ATIAdjustFrame") -# define ATIEnterVT \ - (xf86EnterVTProc*) LoaderSymbol("ATIEnterVT") -# define ATILeaveVT \ - (xf86LeaveVTProc*) LoaderSymbol("ATILeaveVT") -# define ATIFreeScreen \ - (xf86FreeScreenProc*) LoaderSymbol("ATIFreeScreen") -# define ATIValidMode \ - (xf86ValidModeProc*) LoaderSymbol("ATIValidMode") #endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h:1.5 Fri Aug 4 17:07:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h Sat Jan 6 15:58:07 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h,v 1.5 2000/08/04 21:07:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiprobe.h,v 1.6 2001/01/06 20:58:07 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h:1.4 Fri Feb 18 07:19:34 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h Sat Jan 6 15:58:07 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h,v 1.4 2000/02/18 12:19:34 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiproto.h,v 1.5 2001/01/06 20:58:07 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h:1.12 xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h:1.12 Tue Aug 22 17:54:31 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h Mon Apr 16 11:02:10 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiregs.h,v 1.12 2000/08/22 21:54:31 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 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1994 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -53,16 +53,13 @@ #define SPARSE_IO_PORT (SPARSE_IO_BASE | IO_BYTE_SELECT) #define BLOCK_IO_PORT (BLOCK_IO_BASE | IO_BYTE_SELECT) -#define IsATIBlockIOBase(_Base) \ - (((_Base) & BLOCK_IO_BASE) && !((_Base) & BLOCK_IO_SELECT)) - #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) -/* MDA/CGA/EGA/VGA I/O ports */ +/* MDA/[M]CGA/EGA/VGA I/O ports */ #define GENVS 0x0102u /* Write (and Read on uC only) */ #define R_GENLPS 0x03b9u /* Read */ @@ -99,24 +96,24 @@ #define MonochromeIOBase 0x03b0u #define ColourIOBase 0x03d0u -/* Other EGA/CGA/VGA I/O ports */ -/* ?(_IOBase) (_IOBase + 0x00u) */ -/* ?(_IOBase) (_IOBase + 0x01u) */ -/* ?(_IOBase) (_IOBase + 0x02u) */ -/* ?(_IOBase) (_IOBase + 0x03u) */ -#define CRTX(_IOBase) (_IOBase + 0x04u) -#define CRTD(_IOBase) (_IOBase + 0x05u) -/* ?(_IOBase) (_IOBase + 0x06u) */ -/* ?(_IOBase) (_IOBase + 0x07u) */ -#define GENMC(_IOBase) (_IOBase + 0x08u) -/* ?(_IOBase) (_IOBase + 0x09u) */ /* R_GENLPS/GENB */ -#define GENS1(_IOBase) (_IOBase + 0x0au) /* Read */ -#define GENFC(_IOBase) (_IOBase + 0x0au) /* Write */ -#define GENLPC(_IOBase) (_IOBase + 0x0bu) -/* ?(_IOBase) (_IOBase + 0x0cu) */ /* /GENLPS */ -/* ?(_IOBase) (_IOBase + 0x0du) */ /* /KCX */ -/* ?(_IOBase) (_IOBase + 0x0eu) */ /* /KCD */ -/* ?(_IOBase) (_IOBase + 0x0fu) */ /* GENHP/ */ +/* Other MDA/[M]CGA/EGA/VGA I/O ports */ +/* ?(_IOBase) ((_IOBase) + 0x00u) */ /* CRTX synonym */ +/* ?(_IOBase) ((_IOBase) + 0x01u) */ /* CRTD synonym */ +/* ?(_IOBase) ((_IOBase) + 0x02u) */ /* CRTX synonym */ +/* ?(_IOBase) ((_IOBase) + 0x03u) */ /* CRTD synonym */ +#define CRTX(_IOBase) ((_IOBase) + 0x04u) +#define CRTD(_IOBase) ((_IOBase) + 0x05u) +/* ?(_IOBase) ((_IOBase) + 0x06u) */ +/* ?(_IOBase) ((_IOBase) + 0x07u) */ +#define GENMC(_IOBase) ((_IOBase) + 0x08u) +/* ?(_IOBase) ((_IOBase) + 0x09u) */ /* R_GENLPS/GENB */ +#define GENS1(_IOBase) ((_IOBase) + 0x0au) /* Read */ +#define GENFC(_IOBase) ((_IOBase) + 0x0au) /* Write */ +#define GENLPC(_IOBase) ((_IOBase) + 0x0bu) +/* ?(_IOBase) ((_IOBase) + 0x0cu) */ /* /GENLPS */ +/* ?(_IOBase) ((_IOBase) + 0x0du) */ /* /KCX */ +/* ?(_IOBase) ((_IOBase) + 0x0eu) */ /* /KCD */ +/* ?(_IOBase) ((_IOBase) + 0x0fu) */ /* GENHP/ */ /* 8514/A VESA approved register definitions */ #define DISP_STAT 0x02e8u /* Read */ @@ -738,9 +735,23 @@ #define CRTC2_OFF_PITCH BlockIOTag(0x17u) /* LTPro */ #define CUR_CLR0 IOPortTag(0x0bu, 0x18u) #define CUR_CLR1 IOPortTag(0x0cu, 0x19u) +/* These are for both CUR_CLR0 and CUR_CLR1 */ +#define CUR_CLR_I 0x000000fful +#define CUR_CLR_B 0x0000ff00ul +#define CUR_CLR_G 0x00ff0000ul +#define CUR_CLR_R 0xff000000ul +#define CUR_CLR (CUR_CLR_R | CUR_CLR_G | CUR_CLR_B) #define CUR_OFFSET IOPortTag(0x0du, 0x1au) #define CUR_HORZ_VERT_POSN IOPortTag(0x0eu, 0x1bu) +#define CUR_HORZ_POSN 0x000007fful +/* ? 0x0000f800ul */ +#define CUR_VERT_POSN 0x07ff0000ul +/* ? 0xf8000000ul */ #define CUR_HORZ_VERT_OFF IOPortTag(0x0fu, 0x1cu) +#define CUR_HORZ_OFF 0x0000007ful +/* ? 0x0000ff80ul */ +#define CUR_VERT_OFF 0x007f0000ul +/* ? 0xff800000ul */ #define CONFIG_PANEL BlockIOTag(0x1du) /* LT */ #define PANEL_FORMAT 0x00000007ul /* ? 0x00000008ul */ @@ -1087,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 */ @@ -1284,7 +1295,7 @@ /* DST_Y_X BlockIOTag(0x4du) */ /* Duplicate */ #define TRAIL_BRES_ERR BlockIOTag(0x4eu) /* GT */ #define TRAIL_BRES_INC BlockIOTag(0x4fu) /* GT */ -#define TRAIL_BRES_DEC BlockIOTag(0x50u) /* GT */ +#define TRAIL_BRES_DEC BlockIOTag(0x50u) /* GT */ #define LEAD_BRES_LNTH BlockIOTag(0x51u) /* GT */ #define Z_OFF_PITCH BlockIOTag(0x52u) /* GT */ #define Z_CNTL BlockIOTag(0x53u) /* GT */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c:1.12 xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c:1.12 Wed Oct 11 18:52:57 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c Tue May 8 23:12:03 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c,v 1.12 2000/10/11 22:52:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.c,v 1.21 2001/05/09 03:12:03 tsi Exp $ */ /* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -22,26 +22,23 @@ */ #include "ati.h" +#include "atiaccel.h" #include "aticonsole.h" +#include "aticursor.h" #include "atidac.h" #include "atidga.h" -#include "atimode.h" #include "atiscreen.h" #include "atistruct.h" +#include "atixv.h" #include "shadowfb.h" #include "xf86cmap.h" #include "xf1bpp.h" #include "xf4bpp.h" -#undef PSZ -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb16.h" -#include "cfb24.h" -#include "cfb32.h" +#include "fb.h" + #include "mibank.h" #include "micmap.h" #include "mipointer.h" @@ -119,6 +116,9 @@ pScreenInfo->defaultVisual)) return FALSE; + if (!miSetPixmapDepths()) + return FALSE; + pFB = pATI->pMemory; if (pATI->OptionShadowFB) { @@ -155,27 +155,35 @@ #endif /* AVOID_CPIO */ case 8: - pATI->Closeable = cfbScreenInit(pScreen, pFB, - pScreenInfo->virtualX, pScreenInfo->virtualY, - pScreenInfo->xDpi, pScreenInfo->yDpi, pATI->displayWidth); - break; - case 16: - pATI->Closeable = cfb16ScreenInit(pScreen, pFB, - pScreenInfo->virtualX, pScreenInfo->virtualY, - pScreenInfo->xDpi, pScreenInfo->yDpi, pATI->displayWidth); - break; - case 24: - pATI->Closeable = cfb24ScreenInit(pScreen, pFB, - pScreenInfo->virtualX, pScreenInfo->virtualY, - pScreenInfo->xDpi, pScreenInfo->yDpi, pATI->displayWidth); - break; - case 32: - pATI->Closeable = cfb32ScreenInit(pScreen, pFB, + pATI->Closeable = fbScreenInit(pScreen, pFB, pScreenInfo->virtualX, pScreenInfo->virtualY, - pScreenInfo->xDpi, pScreenInfo->yDpi, pATI->displayWidth); + pScreenInfo->xDpi, pScreenInfo->yDpi, pATI->displayWidth, + pATI->bitsPerPixel); + + if (!pATI->Closeable) + return FALSE; + + if (pATI->OptionShadowFB) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "RENDER extension not supported with a shadowed" + " framebuffer.\n"); + +#ifndef AVOID_CPIO + + else if (pATI->BankInfo.BankSize) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "RENDER extension not supported with a banked" + " framebuffer.\n"); + +#endif /* AVOID_CPIO */ + + else if (!fbPictureInit(pScreen, NULL, 0)) + xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, + "RENDER extension initialisation failed.\n"); + break; default: @@ -221,15 +229,16 @@ (void)ATIDGAInit(pScreenInfo, pScreen, pATI); /* Setup acceleration */ - if (!ATIModeAccelInit(pScreenInfo, pScreen, pATI)) + if (!ATIInitializeAcceleration(pScreen, pScreenInfo, pATI)) return FALSE; /* Initialise backing store */ miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); - /* Initialise software cursor */ - miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); + /* Initialise cursor */ + if (!ATIInitializeCursor(pScreen, pATI)) + return FALSE; /* Create default colourmap */ if (!miCreateDefColormap(pScreen)) @@ -262,6 +271,9 @@ /* Initialise DPMS support */ (void)xf86DPMSInit(pScreen, ATISetDPMSMode, 0); + /* Initialise XVideo support */ + (void)ATIInitializeXVideo(pScreen, pScreenInfo, pATI); + /* Set pScreen->SaveScreen and wrap CloseScreen vector */ pScreen->SaveScreen = ATISaveScreen; pATI->CloseScreen = pScreen->CloseScreen; @@ -303,6 +315,12 @@ pATI->Closeable = FALSE; + if (pATI->pCursorInfo) + { + xf86DestroyCursorInfoRec(pATI->pCursorInfo); + pATI->pCursorInfo = NULL; + } + ATILeaveGraphics(pScreenInfo, pATI); xfree(pATI->ExpansionBitmapScanlinePtr[1]); @@ -311,6 +329,7 @@ xfree(pATI->pShadow); pATI->pShadow = NULL; + pScreenInfo->pScreen = NULL; return Closed; } Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h:1.3 Fri Aug 4 17:07:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h Sat Jan 6 15:58:07 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h,v 1.3 2000/08/04 21:07:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiscreen.h,v 1.4 2001/01/06 20:58:07 tsi Exp $ */ /* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h:1.21 xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h:1.21 Tue Aug 22 17:54:31 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h Sun Mar 25 00:32:09 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h,v 1.21 2000/08/22 21:54:31 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atistruct.h,v 1.25 2001/03/25 05:32:09 tsi Exp $ */ /* - * Copyright 1999 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1999 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -28,6 +28,7 @@ #include "aticlock.h" #include "atiregs.h" +#include "xf86Cursor.h" #include "xf86Resources.h" #include "xaa.h" @@ -83,8 +84,10 @@ crtc_v_total_disp, crtc_v_sync_strt_wid, crtc_off_pitch, crtc_gen_cntl, dsp_config, dsp_on_off, ovr_clr, ovr_wid_left_right, ovr_wid_top_bottom, - clock_cntl, bus_cntl, mem_vga_wp_sel, mem_vga_rp_sel, - dac_cntl, config_cntl; + cur_clr0, cur_clr1, cur_offset, + cur_horz_vert_posn, cur_horz_vert_off, + clock_cntl, bus_cntl, mem_cntl, mem_vga_wp_sel, mem_vga_rp_sel, + dac_cntl, gen_test_cntl, config_cntl; /* LCD registers */ CARD32 lcd_index, config_panel, lcd_gen_ctrl, @@ -234,6 +237,10 @@ #ifndef AVOID_CPIO + /* + * Banking interface. + */ + miBankInfoRec BankInfo; pointer pBank; CARD8 UseSmallApertures; @@ -245,15 +252,6 @@ pointer pMMIO, pBlock[2]; unsigned long Block0Base, Block1Base; -#ifndef AVOID_CPIO - - /* - * Banking interface. - */ - miBankInfoRec BankInfo; - -#endif /* AVOID_CPIO */ - /* * XAA interface. */ @@ -268,6 +266,16 @@ int ExpansionBitmapWidth; /* + * Cursor-related definitions. + */ + xf86CursorInfoPtr pCursorInfo; + pointer pCursorPage, pCursorImage; + unsigned long CursorBase; + CARD32 CursorOffset; + CARD16 CursorXOffset, CursorYOffset; + CARD8 Cursor; + + /* * MMIO cache. */ CARD32 MMIOCache[CacheSlotOf(DWORD_SELECT) + 1]; @@ -364,7 +372,13 @@ CARD8 OptionCRT; /* Prefer CRT over digital panel */ CARD8 OptionCSync; /* Use composite sync */ CARD8 OptionDevel; /* Intentionally undocumented */ + +#ifndef AVOID_CPIO + CARD8 OptionLinear; /* Use linear fb aperture when available */ + +#endif /* AVOID_CPIO */ + CARD8 OptionMMIOCache; /* Cache MMIO writes */ CARD8 OptionProbeClocks; /* Force probe for fixed clocks */ CARD8 OptionShadowFB; /* Use shadow frame buffer */ @@ -374,6 +388,7 @@ * State flags. */ CARD8 Unlocked, Mapped, Closeable; + CARD8 MMIOInLinear; /* * Wrapped functions. Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c:1.4 Fri Feb 18 07:19:41 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c Sat Jan 6 15:58:07 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c,v 1.4 2000/02/18 12:19:41 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.c,v 1.5 2001/01/06 20:58:07 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h:1.4 Fri Feb 18 07:19:41 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h Sat Jan 6 15:58:07 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h,v 1.4 2000/02/18 12:19:41 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiutil.h,v 1.5 2001/01/06 20:58:07 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c:1.11 xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c:1.11 Fri Aug 4 17:07:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c,v 1.11 2000/08/04 21:07:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.c,v 1.12 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h:1.5 Fri Aug 4 17:07:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h,v 1.5 2000/08/04 21:07:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativalid.h,v 1.6 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h:1.28 xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h:1.38 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h:1.28 Tue Dec 12 19:45:21 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h Fri May 18 16:22:28 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.28 2000/12/13 00:45:21 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativersion.h,v 1.38 2001/05/18 20:22:28 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -27,11 +27,11 @@ #define ATI_NAME "ATI" #define ATI_DRIVER_NAME "ati" -#define ATI_VERSION_NAME "6.2.3" +#define ATI_VERSION_NAME "6.3.6" #define ATI_VERSION_MAJOR 6 -#define ATI_VERSION_MINOR 2 -#define ATI_VERSION_PATCH 3 +#define ATI_VERSION_MINOR 3 +#define ATI_VERSION_PATCH 6 #define ATI_VERSION_CURRENT \ ((ATI_VERSION_MAJOR << 20) | (ATI_VERSION_MINOR << 10) | ATI_VERSION_PATCH) Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c:1.13 Wed Oct 11 18:52:58 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c,v 1.13 2000/10/11 22:52:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.c,v 1.14 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h:1.7 Fri Aug 4 17:07:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h,v 1.7 2000/08/04 21:07:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativga.h,v 1.8 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c:1.1 Wed Oct 11 18:52:58 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c,v 1.1 2000/10/11 22:52:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.c,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h:1.1 Wed Oct 11 18:52:58 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h Sun Mar 25 00:32:09 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h,v 1.1 2000/10/11 22:52:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/ativgaio.h,v 1.3 2001/03/25 05:32:09 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -49,7 +49,7 @@ { \ outb(_Register, _Index); \ outb((_Register) + 1, _Value); \ - } while(0) + } while (0) #endif /* AVOID_CPIO */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c:1.10 Tue Aug 22 17:54:32 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c Sun Mar 25 00:32:09 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c,v 1.10 2000/08/22 21:54:32 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.c,v 1.12 2001/03/25 05:32:09 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -101,8 +101,6 @@ ATIPtr pATI ) { - unsigned long PageSize; - int LinearSize; #ifdef AVOID_CPIO @@ -116,13 +114,7 @@ #endif /* AVOID_CPIO */ { - PageSize = getpagesize(); - LinearSize = pATI->LinearSize; - if (((pATI->Block0Base | (PageSize - 1)) + 1) == - (pATI->LinearBase + LinearSize)) - LinearSize -= PageSize; - - xf86UnMapVidMem(iScreen, pATI->pMemory, LinearSize); + xf86UnMapVidMem(iScreen, pATI->pMemory, pATI->LinearSize); } pATI->pMemory = NULL; @@ -147,6 +139,24 @@ } /* + * ATIUnmapCursor -- + * + * Unmap hardware cursor image area. + */ +static void +ATIUnmapCursor +( + int iScreen, + ATIPtr pATI +) +{ + if (pATI->pCursorPage) + xf86UnMapVidMem(iScreen, pATI->pCursorPage, getpagesize()); + + pATI->pCursorPage = pATI->pCursorImage = NULL; +} + +/* * ATIMapApertures -- * * This function maps all apertures used by the driver. @@ -160,8 +170,7 @@ { pciVideoPtr pVideo; PCITAG Tag; - unsigned long PageSize, MMIOBase; - int LinearSize; + unsigned long PageSize; if (pATI->Mapped) return TRUE; @@ -178,10 +187,6 @@ } PageSize = getpagesize(); - MMIOBase = pATI->Block0Base & ~(PageSize - 1); - LinearSize = pATI->LinearSize; - if ((MMIOBase + PageSize) == (pATI->LinearBase + LinearSize)) - LinearSize -= PageSize; if ((pVideo = pATI->PCIInfo)) Tag = ((pciConfigPtr)(pVideo->thisCard))->tag; @@ -221,10 +226,10 @@ { if (pVideo) pATI->pMemory = xf86MapPciMem(iScreen, VIDMEM_FRAMEBUFFER, - Tag, pATI->LinearBase, LinearSize); + Tag, pATI->LinearBase, pATI->LinearSize); else pATI->pMemory = xf86MapVidMem(iScreen, VIDMEM_FRAMEBUFFER, - pATI->LinearBase, LinearSize); + pATI->LinearBase, pATI->LinearSize); if (!pATI->pMemory) { @@ -240,11 +245,22 @@ } pATI->Mapped = TRUE; + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + + if ((pATI->CursorBase >= pATI->LinearBase) && + ((pATI->CursorOffset + 0x00000400UL) <= (CARD32)pATI->LinearSize)) + pATI->pCursorImage = (char *)pATI->pMemory + pATI->CursorOffset; + +#endif /* X_BYTE_ORDER */ + } /* Map MMIO aperture */ if (pATI->Block0Base) { + unsigned long MMIOBase = pATI->Block0Base & ~(PageSize - 1); + if (pVideo) pATI->pMMIO = xf86MapPciMem(iScreen, VIDMEM_MMIO, Tag, MMIOBase, PageSize); @@ -254,6 +270,13 @@ if (!pATI->pMMIO) { + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + + ATIUnmapCursor(iScreen, pATI); + +#endif /* X_BYTE_ORDER */ + ATIUnmapLinear(iScreen, pATI); #ifndef AVOID_CPIO @@ -273,8 +296,53 @@ if (pATI->Block1Base) pATI->pBlock[1] = (char *)pATI->pBlock[0] - 0x00000400U; + +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + + if (!pATI->pCursorImage) + +#endif /* X_BYTE_ORDER */ + + { + if ((pATI->CursorBase >= MMIOBase) && + ((pATI->CursorBase + 0x00000400UL) <= (MMIOBase + PageSize))) + pATI->pCursorImage = (char *)pATI->pMMIO + + (pATI->CursorBase - MMIOBase); + } } + /* Map hardware cursor image area */ + if (pATI->CursorBase && !pATI->pCursorImage) + { + unsigned long CursorBase = pATI->CursorBase & ~(PageSize - 1); + + if (pVideo) + pATI->pCursorPage = xf86MapPciMem(iScreen, VIDMEM_FRAMEBUFFER, + Tag, CursorBase, PageSize); + else + pATI->pCursorPage = xf86MapVidMem(iScreen, VIDMEM_FRAMEBUFFER, + CursorBase, PageSize); + + if (!pATI->pCursorPage) + { + ATIUnmapCursor(iScreen, pATI); + ATIUnmapMMIO(iScreen, pATI); + ATIUnmapLinear(iScreen, pATI); + +#ifndef AVOID_CPIO + + ATIUnmapVGA(iScreen, pATI); + +#endif /* AVOID_CPIO */ + + pATI->Mapped = FALSE; + return FALSE; + } + + pATI->pCursorImage = (char *)pATI->pCursorPage + + (pATI->CursorBase - CursorBase); + } + return TRUE; } @@ -293,6 +361,9 @@ if (!pATI->Mapped) return; pATI->Mapped = FALSE; + + /* Unmap hardware cursor image area */ + ATIUnmapCursor(iScreen, pATI); /* Unmap MMIO area */ ATIUnmapMMIO(iScreen, pATI); Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h:1.6 Fri Aug 4 17:07:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h,v 1.6 2000/08/04 21:07:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atividmem.h,v 1.7 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c:1.11 xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c:1.11 Wed Oct 11 18:52:58 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c,v 1.11 2000/10/11 22:52:58 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.c,v 1.12 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h:1.6 Fri Aug 4 17:07:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h,v 1.6 2000/08/04 21:07:16 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonder.h,v 1.7 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c:1.1 Wed Oct 11 18:52:59 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c,v 1.1 2000/10/11 22:52:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.c,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h:1.1 Wed Oct 11 18:52:59 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h,v 1.1 2000/10/11 22:52:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atiwonderio.h,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c:1.1 --- /dev/null Mon Jun 4 12:40:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c Tue May 8 23:12:04 2001 @@ -0,0 +1,52 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.c,v 1.1 2001/05/09 03:12:04 tsi Exp $ */ +/* + * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include "atistruct.h" +#include "atixv.h" + +#include "xf86xv.h" + +/* + * ATIInitializeXVideo -- + * + * This function is called to initialise XVideo extension support on a screen. + */ +Bool +ATIInitializeXVideo +( + ScreenPtr pScreen, + ScrnInfoPtr pScreenInfo, + ATIPtr pATI +) +{ + XF86VideoAdaptorPtr *ppAdaptor; + int nAdaptor; + + if (!(pScreenInfo->memPhysBase = pATI->LinearBase)) + return FALSE; + + pScreenInfo->fbOffset = 0; + + nAdaptor = xf86XVListGenericAdaptors(pScreenInfo, &ppAdaptor); + return xf86XVScreenInit(pScreen, ppAdaptor, nAdaptor); +} Index: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h:1.1 --- /dev/null Mon Jun 4 12:40:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h Tue May 8 23:12:04 2001 @@ -0,0 +1,35 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/atixv.h,v 1.1 2001/05/09 03:12:04 tsi Exp $ */ +/* + * Copyright 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that copyright + * notice and this permission notice appear in supporting documentation, and + * that the name of Marc Aurele La France not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Marc Aurele La France makes no representations + * about the suitability of this software for any purpose. It is provided + * "as-is" without express or implied warranty. + * + * MARC AURELE LA FRANCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO + * EVENT SHALL MARC AURELE LA FRANCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#ifndef ___ATIXV_H___ +#define ___ATIXV_H___ 1 + +#include "atipriv.h" +#include "atiproto.h" + +#include "xf86str.h" + +extern Bool ATIInitializeXVideo FunctionPrototype((ScreenPtr, ScrnInfoPtr, + ATIPtr)); + +#endif /* ___ATIXV_H___ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128.cpp:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/r128.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128.cpp:1.3 Mon Dec 11 15:18:07 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128.cpp Mon Jun 4 12:40:44 2001 @@ -1,75 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.cpp,v 1.3 2000/12/11 20:18:07 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH R128 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -r128 \- ATI Rage 128 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qr128\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B r128 -is an XFree86 driver for ATI Rage 128 based video cards. It contains -full support for 8, 15, 16 and 24 bit pixel depths, hardware -acceleration of drawing primitives, hardware cursor, video modes up to -1800x1440 @ 70Hz, doublescan modes (e.g., 320x200 and 320x240), gamma -correction at all pixel depths, a fully programming dot clock and robust -text mode restoration for VT switching. -.SH SUPPORTED HARDWARE -The -.B r128 -driver supports all ATI Rage 128 based video cards including the Rage -Fury AGP 32MB, the XPERT 128 AGP 16MB and the XPERT 99 AGP 8MB. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects all device information necessary to initialize -the card. However, if you have problems with auto-detection, you can -specify: -.PP -.RS 4 -VideoRam - in kilobytes -.br -MemBase - physical address of the linear framebuffer -.br -IOBase - physical address of the MMIO registers -.br -ChipID - PCI DEVICE ID -.RE -.PP -In addition, the following driver -.B Options -are supported: -.TP -.BI "Option \*qSWcursor\*q \*q" boolean \*q -Selects software cursor. The default is -.B off. -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Enables or disables all hardware acceleration. The default is to -.B enable -hardware acceleration. -.TP -.BI "Option \*qDac6Bit\*q \*q" boolean \*q -Enables or disables the use of 6 bits per color component when in 8 bpp -mode (emulates VGA mode). By default, all 8 bits per color component -are used. The default is -.B off. -.TP -.BI "Option \*qVideoKey\*q \*q" integer \*q -This overrides the default pixel value for the YUV video overlay key. -The default value is -.B undefined. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -.nf -Rickard E. (Rik) Faith \fIfaith@precisioninsight.com\fP -Kevin E. Martin \fIkevin@precisioninsight.com\fP Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h:1.8 Fri Dec 8 14:15:33 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h Tue May 15 06:19:36 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.8 2000/12/08 19:15:33 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.h,v 1.13 2001/05/15 10:19:36 eich Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -193,7 +193,6 @@ unsigned long LinearAddr; /* Frame buffer physical address */ unsigned long MMIOAddr; /* MMIO region physical address */ unsigned long BIOSAddr; /* BIOS physical address */ - Bool BIOSFromPCI; /* BIOS is read from PCI space */ unsigned char *MMIO; /* Map of MMIO region */ unsigned char *FB; /* Map of frame buffer */ @@ -203,8 +202,9 @@ unsigned long FbMapSize; /* Size of frame buffer, in bytes */ int Flags; /* Saved copy of mode flags */ + CARD8 BIOSDisplay; /* Device the BIOS is set to display to */ + Bool HasPanelRegs; /* Current chip can connect to a FP */ - Bool CRTOnly; /* Only use External CRT instead of FP */ CARD8 *VBIOS; /* Video BIOS for mode validation on FPs */ int FPBIOSstart; /* Start of the flat panel info */ @@ -273,6 +273,9 @@ 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 */ @@ -348,6 +351,7 @@ void (*VideoTimerCallback)(ScrnInfoPtr, Time); int videoKey; Bool showCache; + OptionInfoPtr Options; } R128InfoRec, *R128InfoPtr; #define R128WaitForFifo(pScrn, entries) \ @@ -400,7 +404,8 @@ #define R128CCE_RESET(pScrn, info) \ do { \ - if (R128CCE_USE_RING_BUFFER(info->CCEMode)) { \ + if (info->directRenderingEnabled \ + && R128CCE_USE_RING_BUFFER(info->CCEMode)) { \ int _ret = drmR128ResetCCE(info->drmFD); \ if (_ret) { \ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man:1.2.2.1 --- /dev/null Mon Jun 4 12:40:44 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man Thu May 31 22:24:17 2001 @@ -0,0 +1,127 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128.man,v 1.2.2.1 2001/06/01 02:24:17 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH R128 __drivermansuffix__ __vendorversion__ +.SH NAME +r128 \- ATI Rage 128 video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qr128\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B r128 +is an XFree86 driver for ATI Rage 128 based video cards. It contains +full support for 8, 15, 16 and 24 bit pixel depths, hardware +acceleration of drawing primitives, hardware cursor, video modes up to +1800x1440 @ 70Hz, doublescan modes (e.g., 320x200 and 320x240), gamma +correction at all pixel depths, a fully programming dot clock and robust +text mode restoration for VT switching. +.SH SUPPORTED HARDWARE +The +.B r128 +driver supports all ATI Rage 128 based video cards including the Rage +Fury AGP 32MB, the XPERT 128 AGP 16MB and the XPERT 99 AGP 8MB. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto-detects all device information necessary to initialize +the card. However, if you have problems with auto-detection, you can +specify: +.PP +.RS 4 +VideoRam - in kilobytes +.br +MemBase - physical address of the linear framebuffer +.br +IOBase - physical address of the MMIO registers +.br +ChipID - PCI DEVICE ID +.RE +.PP +In addition, the following driver +.B Options +are supported: +.TP +.BI "Option \*qSWcursor\*q \*q" boolean \*q +Selects software cursor. The default is +.B off. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Enables or disables all hardware acceleration. The default is to +.B enable +hardware acceleration. +.TP +.BI "Option \*qDac6Bit\*q \*q" boolean \*q +Enables or disables the use of 6 bits per color component when in 8 bpp +mode (emulates VGA mode). By default, all 8 bits per color component +are used. The default is +.B off. +.TP +.BI "Option \*qVideoKey\*q \*q" integer \*q +This overrides the default pixel value for the YUV video overlay key. +The default value is +.B undefined. +.TP +.BI "Option \*qDisplay\*q \*q" string \*q +Select display mode for devices which support flat panels. Supported modes are: + +.B \*qFP\*q +- use flat panel; + +.B \*qCRT\*q +- use cathode ray tube; + +.B \*qMirror\*q +- use both FP and CRT; + +.B \*qBIOS\*q +- use mode as configured in the BIOS. + +The default is +.B FP. + +.PP +The following +.B Options +are mostly important for non-x86 architectures: +.TP +.BI "Option \*qProgramFPRegs\*q \*q" boolean \*q +Enable or disable programming of the flat panel registers. +Beware that this may damage your panel, so use this +.B at your own risk. +The default depends on the device. +.TP +.BI "Option \*qPanelWidth\*q \*q" integer \*q +.TP +.BI "Option \*qPanelHeight\*q \*q" integer \*q +Override the flat panel dimensions in pixels. They are used to program the flat panel +registers and normally determined using the video card BIOS. If the wrong dimensions +are used, the system may hang. +.TP +.BI "Option \*qUseFBDev\*q \*q" boolean \*q +Enable or disable use of an OS-specific framebuffer device interface +(which is not supported on all OSs). See fbdevhw(__drivermansuffix__) +for further information. +Default: off. + +.PP +The following additional +.B Options +are supported: +.TP +.BI "Option \*qShowCache\*q \*q" boolean \*q +Enable or disable viewing offscreen cache memory. A +development debug option. Default: off. + +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +.nf +Rickard E. (Rik) Faith \fIfaith@precisioninsight.com\fP +Kevin E. Martin \fIkevin@precisioninsight.com\fP Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c:1.4 Mon Dec 4 14:21:52 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c Tue Apr 10 12:07:58 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.4 2000/12/04 19:21:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_accel.c,v 1.9 2001/04/10 16:07:58 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -77,7 +77,6 @@ * */ -#define R128_IMAGEWRITE 0 /* Disable ImageWrites - faster in software */ #define R128_TRAPEZOIDS 0 /* Trapezoids don't work */ /* Driver data structures */ @@ -149,7 +148,8 @@ OUTREG(R128_GEN_RESET_CNTL, gen_reset_cntl | R128_SOFT_RESET_GUI); INREG(R128_GEN_RESET_CNTL); - OUTREG(R128_GEN_RESET_CNTL, gen_reset_cntl & ~R128_SOFT_RESET_GUI); + OUTREG(R128_GEN_RESET_CNTL, + gen_reset_cntl & (CARD32)(~R128_SOFT_RESET_GUI)); INREG(R128_GEN_RESET_CNTL); OUTPLL(R128_MCLK_CNTL, mclk_cntl); @@ -402,7 +402,7 @@ { R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; - CARD32 pat = *(CARD32 *)pattern; + CARD32 pat = *(CARD32 *)(pointer)pattern; #ifdef XF86DRI R128CCE_TO_MMIO(pScrn, info); @@ -820,13 +820,13 @@ OUTREG(R128_DST_HEIGHT_WIDTH, (h << 16) | ((w + 31) & ~31)); } -/* Subsequent XAA indirect CPU-to-screen color expandion. This is called +/* Subsequent XAA indirect CPU-to-screen color expansion. This is called once for each scanline. */ static void R128SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) { R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; - CARD32 *p = (CARD32 *)info->scratch_buffer[bufno]; + CARD32 *p = (pointer)info->scratch_buffer[bufno]; int i; int left = info->scanline_words; volatile CARD32 *d; @@ -838,6 +838,7 @@ if (info->scanline_direct) return; --info->scanline_h; while (left) { + write_mem_barrier(); if (left <= 8) { /* Last scanline - finish write to DATA_LAST */ if (info->scanline_h == 0) { @@ -870,7 +871,6 @@ x11perf -putimage100 2150.0/sec 1170.0/sec x11perf -putimage500 108.0/sec 49.8/sec */ -#if R128_IMAGEWRITE static void R128SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, @@ -968,7 +968,7 @@ { R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; - CARD32 *p = (CARD32 *)info->scratch_buffer[bufno]; + CARD32 *p = (pointer)info->scratch_buffer[bufno]; int i; int left = info->scanline_words; volatile CARD32 *d; @@ -980,6 +980,7 @@ if (info->scanline_direct) return; --info->scanline_h; while (left) { + write_mem_barrier(); if (left <= 8) { /* Last scanline - finish write to DATA_LAST */ if (info->scanline_h == 0) { @@ -1003,7 +1004,6 @@ } } } -#endif /* Initialize the acceleration hardware. */ void R128EngineInit(ScrnInfoPtr pScrn) @@ -1155,7 +1155,6 @@ | LINE_PATTERN_POWER_OF_2_ONLY); /* ImageWrite */ -#if R128_IMAGEWRITE a->NumScanlineImageWriteBuffers = 1; a->ScanlineImageWriteBuffers = info->scratch_buffer; info->scratch_buffer[0] = info->scratch_save; @@ -1169,7 +1168,6 @@ | LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X | SCANLINE_PAD_DWORD; -#endif } /* Initialize XAA for supported acceleration and also initialize the Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c:1.3 Sat Nov 18 14:37:10 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c Sat Mar 3 17:26:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c,v 1.3 2000/11/18 19:37:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_cursor.c,v 1.5 2001/03/03 22:26:09 tsi Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -107,13 +107,13 @@ { R128InfoPtr info = R128PTR(pScrn); unsigned char *R128MMIO = info->MMIO; - CARD32 *s = (CARD32 *)image; - CARD32 *d = (CARD32 *)(info->FB + info->cursor_start); + CARD32 *s = (pointer)image; + CARD32 *d = (pointer)(info->FB + info->cursor_start); int y; CARD32 save; save = INREG(R128_CRTC_GEN_CNTL); - OUTREG(R128_CRTC_GEN_CNTL, save & ~R128_CRTC_CUR_EN); + OUTREG(R128_CRTC_GEN_CNTL, save & (CARD32)~R128_CRTC_CUR_EN); #if X_BYTE_ORDER == X_BIG_ENDIAN switch(info->CurrentLayout.pixel_bytes) { Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c:1.7 Tue Dec 12 12:17:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c Wed May 2 11:06:08 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.7 2000/12/12 17:17:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.c,v 1.14 2001/05/02 15:06:08 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 @@ case 8: /* 8bpp mode is not support */ case 15: /* FIXME */ case 24: /* FIXME */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] R128DRIScreenInit failed (depth %d not supported). " + "Disabling DRI.\n", info->CurrentLayout.pixel_code); return FALSE; #define R128_USE_ACCUM 1 @@ -83,18 +94,18 @@ 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 @@ 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); @@ -189,16 +200,16 @@ pConfigs[i].redSize = 8; pConfigs[i].greenSize = 8; pConfigs[i].blueSize = 8; - pConfigs[i].alphaSize = 8; + pConfigs[i].alphaSize = 0; pConfigs[i].redMask = 0x00FF0000; pConfigs[i].greenMask = 0x0000FF00; pConfigs[i].blueMask = 0x000000FF; - pConfigs[i].alphaMask = 0xFF000000; + pConfigs[i].alphaMask = 0x00000000; if (accum) { /* Simulated in software */ pConfigs[i].accumRedSize = 16; pConfigs[i].accumGreenSize = 16; pConfigs[i].accumBlueSize = 16; - pConfigs[i].accumAlphaSize = 16; + pConfigs[i].accumAlphaSize = 0; } else { pConfigs[i].accumRedSize = 0; pConfigs[i].accumGreenSize = 0; @@ -399,12 +410,12 @@ 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 @@ /* 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,19 +587,147 @@ 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. */ @@ -653,11 +792,20 @@ 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; @@ -666,12 +814,6 @@ "[drm] Added %d %d byte vertex/indirect buffers\n", info->bufNumBufs, R128_BUFFER_SIZE); - if (drmMarkBufs(info->drmFD, 0.133333, 0.266666)) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Failed to mark vertex/indirect buffers list\n"); - return FALSE; - } - if (!(info->buffers = drmMapBufs(info->drmFD))) { xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] Failed to map vertex/indirect buffers list\n"); @@ -735,18 +877,18 @@ if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE; if (!xf86LoaderCheckSymbol("DRIQueryVersion")) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "R128DRIScreenInit failed (libdri.a too old)\n"); + "[dri] R128DRIScreenInit failed (libdri.a too old)\n"); return FALSE; } /* Check the DRI version */ DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 0 || patch < 0) { + if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "R128DRIScreenInit failed " - "(DRI version = %d.%d.%d, expected 3.0.x). " - "Disabling DRI.\n", - major, minor, patch); + "[dri] R128DRIScreenInit failed because of a version mismatch.\n" + "[dri] libDRI version is %d.%d.%d but version 4.0.x is needed.\n" + "[dri] Disabling the DRI.\n", + major, minor, patch); return FALSE; } @@ -755,6 +897,9 @@ /* These modes are not supported (yet). */ case 15: case 24: + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] R128DRIScreenInit failed (depth %d not supported). " + "[dri] Disabling DRI.\n", info->CurrentLayout.pixel_code); return FALSE; /* Only 16 and 32 color depths are supports currently. */ @@ -801,13 +946,14 @@ * in the SAREA header */ if (sizeof(XF86DRISAREARec)+sizeof(R128SAREAPriv)>SAREA_MAX) { - ErrorF("Data does not fit in SAREA\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] Data does not fit in SAREA. Disabling DRI.\n"); return FALSE; } 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; @@ -823,8 +969,12 @@ pDRIInfo->MoveBuffers = R128DRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; + if (!DRIScreenInit(pScreen, pDRIInfo, &info->drmFD)) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed!\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] DRIScreenInit failed. Disabling DRI.\n"); xfree(pDRIInfo->devPrivate); pDRIInfo->devPrivate = NULL; DRIDestroyInfoRec(pDRIInfo); @@ -836,16 +986,15 @@ version = drmGetVersion(info->drmFD); if (version) { if (version->version_major != 2 || - version->version_minor != 1 || - version->version_patchlevel < 0) { + version->version_minor < 1) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, - "R128DRIScreenInit failed " - "(DRM version = %d.%d.%d, expected 2.1.x). " - "Disabling DRI.\n", - version->version_major, - version->version_minor, - version->version_patchlevel); + "[dri] R128DRIScreenInit failed because of a version mismatch.\n" + "[dri] r128.o kernel module version is %d.%d.%d but version 2.1.x is needed.\n" + "[dri] Disabling the DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); drmFreeVersion(version); R128DRICloseScreen(pScreen); return FALSE; @@ -855,22 +1004,18 @@ /* Initialize AGP */ if (!info->IsPCI && !R128DRIAgpInit(info, pScreen)) { - R128DRICloseScreen(pScreen); - return FALSE; + info->IsPCI = TRUE; + xf86DrvMsg(pScreen->myNum, X_WARNING, + "[agp] AGP failed to initialize -- falling back to PCI mode.\n"); + xf86DrvMsg(pScreen->myNum, X_WARNING, + "[agp] 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 @@ -886,7 +1031,7 @@ R128DRICloseScreen(pScreen); return FALSE; } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Visual configs initialized\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Visual configs initialized\n"); return TRUE; } @@ -920,7 +1065,7 @@ } /* Initialize the vertex buffers list */ - if (!info->IsPCI && !R128DRIBufInit(info, pScreen)) { + if (!R128DRIBufInit(info, pScreen)) { R128DRICloseScreen(pScreen); return FALSE; } @@ -930,49 +1075,37 @@ pSAREAPriv = (R128SAREAPrivPtr)DRIGetSAREAPrivate(pScreen); memset(pSAREAPriv, 0, sizeof(*pSAREAPriv)); - - pR128DRI = (R128DRIPtr)info->pDRIInfo->devPrivate; - pR128DRI->registerHandle = info->registerHandle; - pR128DRI->registerSize = info->registerSize; - - pR128DRI->ringHandle = info->ringHandle; - pR128DRI->ringMapSize = info->ringMapSize; - pR128DRI->ringSize = info->ringSize*1024*1024; - - pR128DRI->ringReadPtrHandle = info->ringReadPtrHandle; - pR128DRI->ringReadMapSize = info->ringReadMapSize; - - pR128DRI->bufHandle = info->bufHandle; - pR128DRI->bufMapSize = info->bufMapSize; - pR128DRI->bufOffset = info->bufStart; - - pR128DRI->agpTexHandle = info->agpTexHandle; - pR128DRI->agpTexMapSize = info->agpTexMapSize; - pR128DRI->log2AGPTexGran = info->log2AGPTexGran; - pR128DRI->agpTexOffset = info->agpTexStart; - - pR128DRI->deviceID = info->Chipset; - pR128DRI->width = pScrn->virtualX; - pR128DRI->height = pScrn->virtualY; - pR128DRI->depth = pScrn->depth; - pR128DRI->bpp = pScrn->bitsPerPixel; - - 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->IsPCI = info->IsPCI; - pR128DRI->AGPMode = info->agpMode; + pR128DRI = (R128DRIPtr)info->pDRIInfo->devPrivate; - pR128DRI->CCEMode = info->CCEMode; - pR128DRI->CCEFifoSize = info->CCEFifoSize; + 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; } @@ -1020,6 +1153,10 @@ drmAgpFree(info->drmFD, info->agpMemHandle); info->agpMemHandle = 0; drmAgpRelease(info->drmFD); + } + if (info->pciMemHandle) { + drmScatterGatherFree(info->drmFD, info->pciMemHandle); + info->pciMemHandle = 0; } /* De-allocate all DRI resources */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h:1.4 Mon Dec 4 14:21:52 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h Wed Mar 21 12:02:21 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.4 2000/12/04 19:21:52 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_dri.h,v 1.6 2001/03/21 17:02:21 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -45,7 +45,7 @@ /* DRI Driver defaults */ #define R128_DEFAULT_CCE_PIO_MODE R128_PM4_64PIO_64VCBM_64INDBM #define R128_DEFAULT_CCE_BM_MODE R128_PM4_64BM_64VCBM_64INDBM -#define R128_DEFAULT_AGP_MODE 2 +#define R128_DEFAULT_AGP_MODE 1 #define R128_DEFAULT_AGP_SIZE 8 /* MB (must be a power of 2 and > 4MB) */ #define R128_DEFAULT_RING_SIZE 1 /* MB (must be page aligned) */ #define R128_DEFAULT_BUFFER_SIZE 2 /* MB (must be page aligned) */ @@ -66,30 +66,6 @@ ((m) == R128_PM4_64BM_64VCBM_64INDBM)) typedef struct { - /* MMIO register data */ - drmHandle registerHandle; - drmSize registerSize; - - /* CCE ring buffer data */ - drmHandle ringHandle; - drmSize ringMapSize; - int ringSize; - - /* CCE ring read pointer data */ - drmHandle ringReadPtrHandle; - drmSize ringReadMapSize; - - /* CCE vertex/indirect buffer data */ - drmHandle bufHandle; - drmSize bufMapSize; - int bufOffset; - - /* CCE AGP Texture data */ - drmHandle agpTexHandle; - drmSize agpTexMapSize; - int log2AGPTexGran; - int agpTexOffset; - /* DRI screen private data */ int deviceID; /* PCI device ID */ int width; /* Width in pixels of display */ @@ -97,6 +73,9 @@ int depth; /* Depth of display (8, 15, 16, 24) */ int bpp; /* Bit depth of display (8, 16, 24, 32) */ + int IsPCI; /* Current card is a PCI card */ + int AGPMode; + int frontOffset; /* Start of front buffer */ int frontPitch; int backOffset; /* Start of shared back buffer */ @@ -108,11 +87,16 @@ int textureSize; int log2TexGran; - int IsPCI; /* Current card is a PCI card */ - int AGPMode; + /* MMIO register data */ + drmHandle registerHandle; + drmSize registerSize; - int CCEMode; /* CCE mode that server/clients use */ - int CCEFifoSize; /* Size of the CCE command FIFO */ + /* CCE AGP Texture data */ + drmHandle agpTexHandle; + drmSize agpTexMapSize; + int log2AGPTexGran; + int agpTexOffset; + unsigned int sarea_priv_offset; } R128DRIRec, *R128DRIPtr; #endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c:1.13.2.1 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c:1.29.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c:1.13.2.1 Thu Feb 15 11:01:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c Thu May 24 15:43:39 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.13.2.1 2001/02/15 16:01:41 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_driver.c,v 1.29.2.1 2001/05/24 19:43:39 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -107,6 +107,8 @@ #define MAX(a,b) ((a)>(b)?(a):(b)) #endif +#define USE_CRT_ONLY 0 + /* Forward definitions for driver functions */ static Bool R128CloseScreen(int scrnIndex, ScreenPtr pScreen); static Bool R128SaveScreen(ScreenPtr pScreen, int mode); @@ -134,10 +136,11 @@ OPTION_BUFFER_SIZE, OPTION_USE_CCE_2D, #endif -#if 0 +#if USE_CRT_ONLY /* FIXME: Disable CRTOnly until it is tested */ OPTION_CRT, #endif + OPTION_DISPLAY, OPTION_PANEL_WIDTH, OPTION_PANEL_HEIGHT, OPTION_PROG_FP_REGS, @@ -146,7 +149,7 @@ OPTION_SHOW_CACHE } R128Opts; -OptionInfoRec R128Options[] = { +const OptionInfoRec R128Options[] = { { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE }, @@ -162,10 +165,7 @@ { OPTION_BUFFER_SIZE, "BufferSize", OPTV_INTEGER, {0}, FALSE }, { OPTION_USE_CCE_2D, "UseCCEfor2D", OPTV_BOOLEAN, {0}, FALSE }, #endif -#if 0 - /* FIXME: Disable CRTOnly until it is tested */ - { OPTION_CRT, "CRTOnly", OPTV_BOOLEAN, {0}, FALSE }, -#endif + { OPTION_DISPLAY, "Display", OPTV_STRING, {0}, FALSE }, { OPTION_PANEL_WIDTH, "PanelWidth", OPTV_INTEGER, {0}, FALSE }, { OPTION_PANEL_HEIGHT, "PanelHeight", OPTV_INTEGER, {0}, FALSE }, { OPTION_PROG_FP_REGS, "ProgramFPRegs", OPTV_BOOLEAN, {0}, FALSE }, @@ -295,6 +295,10 @@ "drmMarkBufs", "drmR128CleanupCCE", "drmR128InitCCE", + "drmR128ResetCCE", + "drmR128StartCCE", + "drmR128StopCCE", + "drmR128WaitForIdleCCE", "drmUnmap", "drmUnmapBufs", NULL @@ -499,17 +503,12 @@ } /* Read the Video BIOS block and the FP registers (if applicable). */ -static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn) +static Bool R128GetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { R128InfoPtr info = R128PTR(pScrn); int i; int FPHeader = 0; -#define R128ReadBIOS(offset, buffer, length) \ - (info->BIOSFromPCI ? \ - xf86ReadPciBIOS(offset, info->PciTag, 0, buffer, length) : \ - xf86ReadBIOS(info->BIOSAddr, offset, buffer, length)) - #define R128_BIOS8(v) (info->VBIOS[v]) #define R128_BIOS16(v) (info->VBIOS[v] | \ (info->VBIOS[(v) + 1] << 8)) @@ -524,16 +523,20 @@ return FALSE; } - info->BIOSFromPCI = TRUE; - R128ReadBIOS(0x0000, info->VBIOS, R128_VBIOS_SIZE); - if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Video BIOS not detected in PCI space!\n"); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Attempting to read Video BIOS from legacy ISA space!\n"); - info->BIOSFromPCI = FALSE; - info->BIOSAddr = 0x000c0000; - R128ReadBIOS(0x0000, info->VBIOS, R128_VBIOS_SIZE); + if (pInt10) { + info->BIOSAddr = pInt10->BIOSseg << 4; + (void)memcpy(info->VBIOS, xf86int10Addr(pInt10, info->BIOSAddr), + R128_VBIOS_SIZE); + } else { + xf86ReadPciBIOS(0, info->PciTag, 0, info->VBIOS, R128_VBIOS_SIZE); + if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Video BIOS not detected in PCI space!\n"); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Attempting to read Video BIOS from legacy ISA space!\n"); + info->BIOSAddr = 0x000c0000; + xf86ReadBIOS(info->BIOSAddr, 0, info->VBIOS, R128_VBIOS_SIZE); + } } if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { info->BIOSAddr = 0x00000000; @@ -623,7 +626,7 @@ 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 */ @@ -648,10 +651,10 @@ INPLL(pScrn,R128_PPLL_REF_DIV) & R128_PPLL_REF_DIV_MASK; /* unmap it again */ R128UnmapMMIO(pScrn); - + Nx = (x_mpll_ref_fb_div & 0x00FF00) >> 8; M = (x_mpll_ref_fb_div & 0x0000FF); - + pll->xclk = R128Div((2 * Nx * pll->reference_freq), (M * PostDivSet[xclk_cntl])); @@ -765,7 +768,7 @@ if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE; } else { pScrn->rgbBits = 8; - if (xf86ReturnOptValBool(R128Options, OPTION_DAC_6BIT, FALSE)) { + if (xf86ReturnOptValBool(info->Options, OPTION_DAC_6BIT, FALSE)) { pScrn->rgbBits = 6; info->dac6bits = TRUE; } @@ -873,7 +876,7 @@ } /* Flat panel (part 1) */ - if (xf86GetOptValBool(R128Options, OPTION_PROG_FP_REGS, + if (xf86GetOptValBool(info->Options, OPTION_PROG_FP_REGS, &info->HasPanelRegs)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Turned flat panel register programming %s\n", @@ -898,17 +901,50 @@ } /* Read registers used to determine options */ - from = X_PROBED; + from = X_PROBED; R128MapMMIO(pScrn); - R128MMIO = info->MMIO; + R128MMIO = info->MMIO; + if (info->FBDev) - pScrn->videoRam = fbdevHWGetVidmem(pScrn) / 1024; + pScrn->videoRam = fbdevHWGetVidmem(pScrn) / 1024; else - pScrn->videoRam = INREG(R128_CONFIG_MEMSIZE) / 1024; - info->MemCntl = INREG(R128_MEM_CNTL); + pScrn->videoRam = INREG(R128_CONFIG_MEMSIZE) / 1024; + + info->MemCntl = INREG(R128_MEM_CNTL); + info->BusCntl = INREG(R128_BUS_CNTL); + + /* On non-flat panel systems, the default is to display to the CRT, + and on flat panel systems, the default is to display to the flat + panel unless the user explicity chooses otherwise using the "Display" + config file setting. BIOS_5_SCRATCH holds the display device on flat + panel systems only. */ + if (info->HasPanelRegs) { + char *display = xf86GetOptValString(info->Options, OPTION_DISPLAY); + + if (info->FBDev) + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Option \"Display\" ignored " + "(framebuffer device determines display type)\n"); + else if (!display || !xf86NameCmp(display, "FP")) + info->BIOSDisplay = R128_BIOS_DISPLAY_FP; + else if (!xf86NameCmp(display, "BIOS")) + info->BIOSDisplay = INREG8(R128_BIOS_5_SCRATCH); + else if (!xf86NameCmp(display, "Mirror")) + info->BIOSDisplay = R128_BIOS_DISPLAY_FP_CRT; + else if (!xf86NameCmp(display, "CRT")) + info->BIOSDisplay = R128_BIOS_DISPLAY_CRT; + else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Unsupported type \"%s\" specified for Option \"Display\".\n" + "\tSupported types are: " + "\"BIOS\", \"Mirror\", \"CRT\" and \"FP\"\n", display); + return FALSE; + } + } else { + info->BIOSDisplay = R128_BIOS_DISPLAY_CRT; + } - info->BusCntl = INREG(R128_BUS_CNTL); - R128MMIO = NULL; + R128MMIO = NULL; R128UnmapMMIO(pScrn); /* RAM */ @@ -948,51 +984,48 @@ /* Flat panel (part 2) */ if (info->HasPanelRegs) { -#if 1 - info->CRTOnly = FALSE; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using flat panel for display\n"); -#else - /* Panel CRT mode override */ - if ((info->CRTOnly = xf86ReturnOptValBool(R128Options, - OPTION_CRT, FALSE))) { + switch (info->BIOSDisplay) { + case R128_BIOS_DISPLAY_FP: xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Using external CRT instead of " - "flat panel for display\n"); - } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using flat panel for display\n"); + break; + case R128_BIOS_DISPLAY_CRT: + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using external CRT for display\n"); + break; + case R128_BIOS_DISPLAY_FP_CRT: + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using both flat panel and external CRT " + "for display\n"); + break; } -#endif /* Panel width/height overrides */ info->PanelXRes = 0; info->PanelYRes = 0; - if (xf86GetOptValInteger(R128Options, + if (xf86GetOptValInteger(info->Options, OPTION_PANEL_WIDTH, &(info->PanelXRes))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Flat panel width: %d\n", info->PanelXRes); } - if (xf86GetOptValInteger(R128Options, + if (xf86GetOptValInteger(info->Options, OPTION_PANEL_HEIGHT, &(info->PanelYRes))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Flat panel height: %d\n", info->PanelYRes); } - } else { - info->CRTOnly = FALSE; } #ifdef XF86DRI /* AGP/PCI */ - if (xf86ReturnOptValBool(R128Options, OPTION_IS_PCI, FALSE)) { + if (xf86ReturnOptValBool(info->Options, OPTION_IS_PCI, FALSE)) { info->IsPCI = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forced into PCI-only mode\n"); } else { switch (info->Chipset) { case PCI_CHIP_RAGE128LE: - case PCI_CHIP_RAGE128PD: case PCI_CHIP_RAGE128RE: - case PCI_CHIP_RAGE128RK: info->IsPCI = TRUE; break; + case PCI_CHIP_RAGE128RK: + case PCI_CHIP_RAGE128PD: info->IsPCI = TRUE; break; case PCI_CHIP_RAGE128LF: case PCI_CHIP_RAGE128MF: case PCI_CHIP_RAGE128ML: @@ -1008,7 +1041,7 @@ return TRUE; } -static Bool R128PreInitDDC(ScrnInfoPtr pScrn) +static Bool R128PreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { R128InfoPtr info = R128PTR(pScrn); vbeInfoPtr pVbe; @@ -1016,15 +1049,15 @@ if (!xf86LoadSubModule(pScrn, "ddc")) return FALSE; xf86LoaderReqSymLists(ddcSymbols, NULL); -#if defined(__powerpc__) - /* Int10 is broken on PPC */ +#if defined(__powerpc__) || defined(__alpha__) + /* Int10 is broken on PPC and some Alphas */ return TRUE; #else if (xf86LoadSubModule(pScrn, "vbe")) { #ifdef XFree86LOADER xf86LoaderReqSymLists(vbeSymbols,NULL); #endif - pVbe = VBEInit(NULL,info->pEnt->index); + pVbe = VBEInit(pInt10,info->pEnt->index); if (!pVbe) return FALSE; xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL))); @@ -1079,8 +1112,8 @@ 64 * pScrn->bitsPerPixel, /* pitchInc */ 128, /* minHeight */ 2048, /* maxHeight */ - pScrn->virtualX, - pScrn->virtualY, + pScrn->display->virtualX, + pScrn->display->virtualY, info->FbMapSize, LOOKUP_BEST_REFRESH); @@ -1124,10 +1157,8 @@ if (mod && !xf86LoadSubModule(pScrn, mod)) return FALSE; xf86LoaderReqSymbols(Sym, NULL); #ifdef USE_FB -#ifdef RENDER xf86LoaderReqSymbols("fbPictureInit", NULL); #endif -#endif info->CurrentLayout.displayWidth = pScrn->displayWidth; info->CurrentLayout.mode = pScrn->currentMode; @@ -1138,7 +1169,9 @@ /* This is called by R128PreInit to initialize the hardware cursor. */ static Bool R128PreInitCursor(ScrnInfoPtr pScrn) { - if (!xf86ReturnOptValBool(R128Options, OPTION_SW_CURSOR, FALSE)) { + R128InfoPtr info = R128PTR(pScrn); + + if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; } return TRUE; @@ -1147,21 +1180,22 @@ /* This is called by R128PreInit to initialize hardware acceleration. */ static Bool R128PreInitAccel(ScrnInfoPtr pScrn) { - if (!xf86ReturnOptValBool(R128Options, OPTION_NOACCEL, FALSE)) { + R128InfoPtr info = R128PTR(pScrn); + + if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE; } return TRUE; } -static Bool R128PreInitInt10(ScrnInfoPtr pScrn) +static Bool R128PreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10) { R128InfoPtr info = R128PTR(pScrn); -#if 1 +#if 1 && !defined(__alpha__) + /* int10 is broken on some Alphas */ if (xf86LoadSubModule(pScrn, "int10")) { - xf86Int10InfoPtr pInt; xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); - pInt = xf86InitInt10(info->pEnt->index); - xf86FreeInt10(pInt); + *ppInt10 = xf86InitInt10(info->pEnt->index); } #endif return TRUE; @@ -1172,23 +1206,21 @@ { R128InfoPtr info = R128PTR(pScrn); - if (info->IsPCI) { - info->CCEMode = R128_DEFAULT_CCE_PIO_MODE; - } else if (xf86ReturnOptValBool(R128Options, OPTION_CCE_PIO, FALSE)) { + if (xf86ReturnOptValBool(info->Options, OPTION_CCE_PIO, FALSE)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing CCE into PIO mode\n"); info->CCEMode = R128_DEFAULT_CCE_PIO_MODE; } else { info->CCEMode = R128_DEFAULT_CCE_BM_MODE; } - if (xf86ReturnOptValBool(R128Options, OPTION_USE_CCE_2D, FALSE)) { + if (xf86ReturnOptValBool(info->Options, OPTION_USE_CCE_2D, FALSE)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using CCE for 2D\n"); info->CCE2D = TRUE; } else { info->CCE2D = FALSE; } - if (xf86ReturnOptValBool(R128Options, OPTION_NO_SECURITY, FALSE)) { + if (xf86ReturnOptValBool(info->Options, OPTION_NO_SECURITY, FALSE)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "WARNING!!! CCE Security checks disabled!!! **********\n"); info->CCESecure = FALSE; @@ -1205,7 +1237,7 @@ info->CCEusecTimeout = R128_DEFAULT_CCE_TIMEOUT; if (!info->IsPCI) { - if (xf86GetOptValInteger(R128Options, + if (xf86GetOptValInteger(info->Options, OPTION_AGP_MODE, &(info->agpMode))) { if (info->agpMode < 1 || info->agpMode > R128_AGP_MAX_MODE) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -1216,7 +1248,7 @@ "Using AGP %dx mode\n", info->agpMode); } - if (xf86GetOptValInteger(R128Options, + if (xf86GetOptValInteger(info->Options, OPTION_AGP_SIZE, (int *)&(info->agpSize))) { switch (info->agpSize) { case 4: @@ -1234,7 +1266,7 @@ } } - if (xf86GetOptValInteger(R128Options, + if (xf86GetOptValInteger(info->Options, OPTION_RING_SIZE, &(info->ringSize))) { if (info->ringSize < 1 || info->ringSize >= (int)info->agpSize) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -1244,7 +1276,7 @@ } } - if (xf86GetOptValInteger(R128Options, + if (xf86GetOptValInteger(info->Options, OPTION_BUFFER_SIZE, &(info->bufSize))) { if (info->bufSize < 1 || info->bufSize >= (int)info->agpSize) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -1272,7 +1304,7 @@ info->agpTexSize = info->agpSize - (info->ringSize + info->bufSize); } - if (xf86GetOptValInteger(R128Options, OPTION_USEC_TIMEOUT, + if (xf86GetOptValInteger(info->Options, OPTION_USEC_TIMEOUT, &(info->CCEusecTimeout))) { /* This option checked by the R128 DRM kernel module */ } @@ -1294,7 +1326,8 @@ /* R128PreInit is called once at server startup. */ Bool R128PreInit(ScrnInfoPtr pScrn, int flags) { - R128InfoPtr info; + R128InfoPtr info; + xf86Int10InfoPtr pInt10 = NULL; R128TRACE(("R128PreInit\n")); @@ -1358,7 +1391,7 @@ if (xf86RegisterResources(info->pEnt->index, 0, ResNone)) goto fail; - pScrn->racMemFlags = RAC_FB | RAC_COLORMAP; + pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR; pScrn->monitor = pScrn->confScreen->monitor; if (!R128PreInitVisual(pScrn)) goto fail; @@ -1366,23 +1399,25 @@ /* We can't do this until we have a pScrn->display. */ xf86CollectOptions(pScrn, NULL); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, R128Options); + if (!(info->Options = xalloc(sizeof(R128Options)))) goto fail; + memcpy(info->Options, R128Options, sizeof(R128Options)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, info->Options); if (!R128PreInitWeight(pScrn)) goto fail; - if(xf86GetOptValInteger(R128Options, OPTION_VIDEO_KEY, &(info->videoKey))) { + if(xf86GetOptValInteger(info->Options, OPTION_VIDEO_KEY, &(info->videoKey))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", info->videoKey); } else { info->videoKey = 0x1E; } - if (xf86ReturnOptValBool(R128Options, OPTION_SHOW_CACHE, FALSE)) { + if (xf86ReturnOptValBool(info->Options, OPTION_SHOW_CACHE, FALSE)) { info->showCache = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache enabled\n"); } - if (xf86ReturnOptValBool(R128Options, OPTION_FBDEV, FALSE)) { + if (xf86ReturnOptValBool(info->Options, OPTION_FBDEV, FALSE)) { info->FBDev = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using framebuffer device\n"); @@ -1401,26 +1436,27 @@ } if (!info->FBDev) - if (!R128PreInitInt10(pScrn)) goto fail; + if (!R128PreInitInt10(pScrn, &pInt10)) goto fail; - if (!R128PreInitConfig(pScrn)) goto fail; + if (!R128PreInitConfig(pScrn)) goto fail; - if (!R128GetBIOSParameters(pScrn)) goto fail; + if (!R128GetBIOSParameters(pScrn, pInt10)) goto fail; - if (!R128GetPLLParameters(pScrn)) goto fail; + if (!R128GetPLLParameters(pScrn)) goto fail; - if (!R128PreInitDDC(pScrn)) goto fail; + /* Don't fail on this one */ + R128PreInitDDC(pScrn, pInt10); - if (!R128PreInitGamma(pScrn)) goto fail; + if (!R128PreInitGamma(pScrn)) goto fail; - if (!R128PreInitModes(pScrn)) goto fail; + if (!R128PreInitModes(pScrn)) goto fail; - if (!R128PreInitCursor(pScrn)) goto fail; + if (!R128PreInitCursor(pScrn)) goto fail; - if (!R128PreInitAccel(pScrn)) goto fail; + if (!R128PreInitAccel(pScrn)) goto fail; #ifdef XF86DRI - if (!R128PreInitDRI(pScrn)) goto fail; + if (!R128PreInitDRI(pScrn)) goto fail; #endif /* Free the video bios (if applicable) */ @@ -1429,6 +1465,10 @@ info->VBIOS = NULL; } + /* Free int10 info */ + if (pInt10) + xf86FreeInt10(pInt10); + return TRUE; fail: @@ -1440,6 +1480,10 @@ info->VBIOS = NULL; } + /* Free int10 info */ + if (pInt10) + xf86FreeInt10(pInt10); + vgaHWFreeHWRec(pScrn); R128FreeRec(pScrn); return FALSE; @@ -1517,6 +1561,7 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; R128InfoPtr info = R128PTR(pScrn); BoxRec MemBox; + int y2; R128TRACE(("R128ScreenInit %x %d\n", pScrn->memPhysBase, pScrn->fbOffset)); @@ -1568,7 +1613,7 @@ info->CurrentLayout.pixel_bytes); int maxy = info->FbMapSize / width_bytes; - if (xf86ReturnOptValBool(R128Options, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { xf86DrvMsg(scrnIndex, X_WARNING, "Acceleration disabled, not initializing the DRI\n"); info->directRenderingEnabled = FALSE; @@ -1591,9 +1636,7 @@ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; -#ifdef RENDER fbPictureInit (pScreen, 0, 0); -#endif #else switch (pScrn->bitsPerPixel) { case 8: @@ -1658,170 +1701,170 @@ /* Memory manager setup */ #ifdef XF86DRI if (info->directRenderingEnabled) { - FBAreaPtr fbarea; - int width_bytes = (pScrn->displayWidth * - info->CurrentLayout.pixel_bytes); - int cpp = info->CurrentLayout.pixel_bytes; - int bufferSize = pScrn->virtualY * width_bytes; - int l, total; - int scanlines; - - switch (info->CCEMode) { - case R128_DEFAULT_CCE_PIO_MODE: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CCE in PIO mode\n"); - break; - case R128_DEFAULT_CCE_BM_MODE: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CCE in BM mode\n"); - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CCE in UNKNOWN mode\n"); - break; - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d MB AGP aperture\n", info->agpSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d MB for the ring buffer\n", info->ringSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d MB for vertex/indirect buffers\n", info->bufSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d MB for AGP textures\n", info->agpTexSize); - - /* Try for front, back, depth, and two framebuffers worth of - * pixmap cache. Should be enough for a fullscreen background - * image plus some leftovers. - */ - info->textureSize = info->FbMapSize - 5 * bufferSize; - - /* If that gives us less than half the available memory, let's - * be greedy and grab some more. Sorry, I care more about 3D - * performance than playing nicely, and you'll get around a full - * framebuffer's worth of pixmap cache anyway. - */ - if ( info->textureSize < (int)info->FbMapSize / 2 ) { - info->textureSize = info->FbMapSize - 4 * bufferSize; - } - if ( info->textureSize > 0 ) { - l = R128MinBits((info->textureSize-1) / R128_NR_TEX_REGIONS); - if (l < R128_LOG_TEX_GRANULARITY) l = R128_LOG_TEX_GRANULARITY; - - /* Round the texture size up to the nearest whole number of - * texture regions. Again, be greedy about this, don't - * round down. - */ - info->log2TexGran = l; - info->textureSize = ((info->textureSize >> l) + 1) << l; - } else { - info->textureSize = 0; - } - - total = info->FbMapSize - info->textureSize; - scanlines = total / width_bytes; - if (scanlines > 8191) scanlines = 8191; - - /* Recalculate the texture offset and size to accomodate any - * rounding to a whole number of scanlines. - * FIXME: Is this actually needed? - */ - info->textureOffset = scanlines * width_bytes; - info->textureSize = info->FbMapSize - info->textureOffset; - - /* Set a minimum usable local texture heap size. This will fit - * two 256x256x32bpp textures. - */ - if ( info->textureSize < 512 * 1024 ) { - info->textureOffset = 0; - info->textureSize = 0; - } - - MemBox.x1 = 0; - MemBox.y1 = 0; - MemBox.x2 = pScrn->displayWidth; - MemBox.y2 = scanlines; - - if (!xf86InitFBManager(pScreen, &MemBox)) { - xf86DrvMsg(scrnIndex, X_ERROR, - "Memory manager initialization to (%d,%d) (%d,%d) failed\n", - MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); - return FALSE; - } else { - int width, height; - - xf86DrvMsg(scrnIndex, X_INFO, - "Memory manager initialized to (%d,%d) (%d,%d)\n", - MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); - if ((fbarea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, - 2, 0, NULL, NULL, NULL))) { - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved area from (%d,%d) to (%d,%d)\n", - fbarea->box.x1, fbarea->box.y1, - fbarea->box.x2, fbarea->box.y2); - } else { - xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve area\n"); - } - if (xf86QueryLargestOffscreenArea(pScreen, &width, - &height, 0, 0, 0)) { - xf86DrvMsg(scrnIndex, X_INFO, - "Largest offscreen area available: %d x %d\n", - width, height); - } - } + FBAreaPtr fbarea; + int width_bytes = (pScrn->displayWidth * + info->CurrentLayout.pixel_bytes); + int cpp = info->CurrentLayout.pixel_bytes; + int bufferSize = pScrn->virtualY * width_bytes; + int l, total; + int scanlines; + + switch (info->CCEMode) { + case R128_DEFAULT_CCE_PIO_MODE: + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CCE in PIO mode\n"); + break; + case R128_DEFAULT_CCE_BM_MODE: + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CCE in BM mode\n"); + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "CCE in UNKNOWN mode\n"); + break; + } + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %d MB AGP aperture\n", info->agpSize); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %d MB for the ring buffer\n", info->ringSize); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %d MB for vertex/indirect buffers\n", info->bufSize); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %d MB for AGP textures\n", info->agpTexSize); + + /* Try for front, back, depth, and two framebuffers worth of + * pixmap cache. Should be enough for a fullscreen background + * image plus some leftovers. + */ + info->textureSize = info->FbMapSize - 5 * bufferSize; + + /* If that gives us less than half the available memory, let's + * be greedy and grab some more. Sorry, I care more about 3D + * performance than playing nicely, and you'll get around a full + * framebuffer's worth of pixmap cache anyway. + */ + if (info->textureSize < (int)info->FbMapSize / 2) { + info->textureSize = info->FbMapSize - 4 * bufferSize; + } + + if (info->textureSize > 0) { + l = R128MinBits((info->textureSize-1) / R128_NR_TEX_REGIONS); + if (l < R128_LOG_TEX_GRANULARITY) l = R128_LOG_TEX_GRANULARITY; + + /* Round the texture size up to the nearest whole number of + * texture regions. Again, be greedy about this, don't + * round down. + */ + info->log2TexGran = l; + info->textureSize = (info->textureSize >> l) << l; + } else { + info->textureSize = 0; + } + + /* Set a minimum usable local texture heap size. This will fit + * two 256x256x32bpp textures. + */ + if (info->textureSize < 512 * 1024) { + info->textureOffset = 0; + info->textureSize = 0; + } + + total = info->FbMapSize - info->textureSize; + scanlines = total / width_bytes; + if (scanlines > 8191) scanlines = 8191; + + /* Recalculate the texture offset and size to accomodate any + * rounding to a whole number of scanlines. + */ + info->textureOffset = scanlines * width_bytes; + + MemBox.x1 = 0; + MemBox.y1 = 0; + MemBox.x2 = pScrn->displayWidth; + MemBox.y2 = scanlines; + + if (!xf86InitFBManager(pScreen, &MemBox)) { + xf86DrvMsg(scrnIndex, X_ERROR, + "Memory manager initialization to (%d,%d) (%d,%d) failed\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); + return FALSE; + } else { + int width, height; + + xf86DrvMsg(scrnIndex, X_INFO, + "Memory manager initialized to (%d,%d) (%d,%d)\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); + if ((fbarea = xf86AllocateOffscreenArea(pScreen, + pScrn->displayWidth, + 2, 0, NULL, NULL, NULL))) { + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved area from (%d,%d) to (%d,%d)\n", + fbarea->box.x1, fbarea->box.y1, + fbarea->box.x2, fbarea->box.y2); + } else { + xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve area\n"); + } + if (xf86QueryLargestOffscreenArea(pScreen, &width, + &height, 0, 0, 0)) { + xf86DrvMsg(scrnIndex, X_INFO, + "Largest offscreen area available: %d x %d\n", + width, height); + } + } /* Allocate the shared back buffer */ - if ((fbarea = xf86AllocateOffscreenArea(pScreen, - pScrn->virtualX, - pScrn->virtualY, - 32, NULL, NULL, NULL))) { - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved back buffer from (%d,%d) to (%d,%d)\n", - fbarea->box.x1, fbarea->box.y1, - fbarea->box.x2, fbarea->box.y2); - - info->backX = fbarea->box.x1; - info->backY = fbarea->box.y1; - info->backOffset = (fbarea->box.y1 * width_bytes + - fbarea->box.x1 * cpp); - info->backPitch = pScrn->displayWidth; - } else { - xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve back buffer\n"); - info->backX = -1; - info->backY = -1; - info->backOffset = -1; - info->backPitch = -1; - } + if ((fbarea = xf86AllocateOffscreenArea(pScreen, + pScrn->virtualX, + pScrn->virtualY, + 32, NULL, NULL, NULL))) { + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved back buffer from (%d,%d) to (%d,%d)\n", + fbarea->box.x1, fbarea->box.y1, + fbarea->box.x2, fbarea->box.y2); + + info->backX = fbarea->box.x1; + info->backY = fbarea->box.y1; + info->backOffset = (fbarea->box.y1 * width_bytes + + fbarea->box.x1 * cpp); + info->backPitch = pScrn->displayWidth; + } else { + xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve back buffer\n"); + info->backX = -1; + info->backY = -1; + info->backOffset = -1; + info->backPitch = -1; + } /* Allocate the shared depth buffer */ - if ((fbarea = xf86AllocateOffscreenArea(pScreen, - pScrn->virtualX, - pScrn->virtualY + 1, - 32, NULL, NULL, NULL))) { - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved depth buffer from (%d,%d) to (%d,%d)\n", - fbarea->box.x1, fbarea->box.y1, - fbarea->box.x2, fbarea->box.y2); - - info->depthX = fbarea->box.x1; - info->depthY = fbarea->box.y1; - info->depthOffset = (fbarea->box.y1 * width_bytes + - fbarea->box.x1 * cpp); - info->depthPitch = pScrn->displayWidth; - info->spanOffset = ((fbarea->box.y2 - 1) * width_bytes + - fbarea->box.x1 * cpp); - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved depth span from (%d,%d) offset 0x%x\n", - fbarea->box.x1, fbarea->box.y2 - 1, info->spanOffset); - } else { - xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve depth buffer\n"); - info->depthX = -1; - info->depthY = -1; - info->depthOffset = -1; - info->depthPitch = -1; - info->spanOffset = -1; - } - - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved %d kb for textures at offset 0x%x\n", - info->textureSize/1024, total); + if ((fbarea = xf86AllocateOffscreenArea(pScreen, + pScrn->virtualX, + pScrn->virtualY + 1, + 32, NULL, NULL, NULL))) { + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved depth buffer from (%d,%d) to (%d,%d)\n", + fbarea->box.x1, fbarea->box.y1, + fbarea->box.x2, fbarea->box.y2); + + info->depthX = fbarea->box.x1; + info->depthY = fbarea->box.y1; + info->depthOffset = (fbarea->box.y1 * width_bytes + + fbarea->box.x1 * cpp); + info->depthPitch = pScrn->displayWidth; + info->spanOffset = ((fbarea->box.y2 - 1) * width_bytes + + fbarea->box.x1 * cpp); + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved depth span from (%d,%d) offset 0x%x\n", + fbarea->box.x1, fbarea->box.y2 - 1, info->spanOffset); + } else { + xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve depth buffer\n"); + info->depthX = -1; + info->depthY = -1; + info->depthOffset = -1; + info->depthPitch = -1; + info->spanOffset = -1; + } + + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved %d kb for textures at offset 0x%x\n", + info->textureSize/1024, info->textureOffset); } else #endif @@ -1829,13 +1872,14 @@ MemBox.x1 = 0; MemBox.y1 = 0; MemBox.x2 = pScrn->displayWidth; - MemBox.y2 = (info->FbMapSize + y2 = (info->FbMapSize / (pScrn->displayWidth * info->CurrentLayout.pixel_bytes)); /* The acceleration engine uses 14 bit signed coordinates, so we can't have any drawable caches beyond this region. */ - if (MemBox.y2 > 8191) MemBox.y2 = 8191; + if (y2 > 8191) y2 = 8191; + MemBox.y2 = y2; if (!xf86InitFBManager(pScreen, &MemBox)) { xf86DrvMsg(scrnIndex, X_ERROR, @@ -1874,7 +1918,7 @@ xf86SetSilkenMouse(pScreen); /* Acceleration setup */ - if (!xf86ReturnOptValBool(R128Options, OPTION_NOACCEL, FALSE)) { + if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { if (R128AccelInit(pScreen)) { xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n"); info->accelOn = TRUE; @@ -1893,7 +1937,7 @@ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); /* Hardware cursor setup */ - if (!xf86ReturnOptValBool(R128Options, OPTION_SW_CURSOR, FALSE)) { + if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { if (R128CursorInit(pScreen)) { int width, height; @@ -1927,11 +1971,9 @@ #endif )) return FALSE; - /* DPMS setup */ -#ifdef DPMSExtension - if (!info->HasPanelRegs || info->CRTOnly) + /* DPMS setup - FIXME: also for mirror mode? - Michel */ + if (!info->HasPanelRegs || info->BIOSDisplay == R128_BIOS_DISPLAY_CRT) xf86DPMSInit(pScreen, R128DisplayPowerManagementSet, 0); -#endif R128InitVideo(pScreen); @@ -2036,7 +2078,8 @@ OUTREG(R128_LVDS_GEN_CNTL, restore->lvds_gen_cntl); } else { if (restore->lvds_gen_cntl & (R128_LVDS_ON | R128_LVDS_BLON)) { - OUTREG(R128_LVDS_GEN_CNTL, restore->lvds_gen_cntl & ~R128_LVDS_BLON); + OUTREG(R128_LVDS_GEN_CNTL, + restore->lvds_gen_cntl & (CARD32)~R128_LVDS_BLON); usleep(R128PTR(pScrn)->PanelPwrDly * 1000); OUTREG(R128_LVDS_GEN_CNTL, restore->lvds_gen_cntl); } else { @@ -2141,7 +2184,7 @@ R128RestoreCrtcRegisters(pScrn, restore); if (info->HasPanelRegs) R128RestoreFPRegisters(pScrn, restore); - if (!info->HasPanelRegs || info->CRTOnly) + if (!info->HasPanelRegs || info->BIOSDisplay == R128_BIOS_DISPLAY_CRT) R128RestorePLLRegisters(pScrn, restore); R128RestoreDDARegisters(pScrn, restore); R128RestorePalette(pScrn, restore); @@ -2366,15 +2409,24 @@ case 32: format = 6; bytpp = 4; break; /* xRGB */ default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unsupported pixel depth (%d)\n", info->CurrentLayout.bitsPerPixel); + "Unsupported pixel depth (%d)\n", + info->CurrentLayout.bitsPerPixel); return FALSE; } R128TRACE(("Format = %d (%d bytes per pixel)\n", format, bytpp)); - if (info->HasPanelRegs) - if (info->CRTOnly) hsync_fudge = hsync_fudge_fp_crt[format-1]; - else hsync_fudge = hsync_fudge_fp[format-1]; - else hsync_fudge = hsync_fudge_default[format-1]; + switch (info->BIOSDisplay) { + case R128_BIOS_DISPLAY_FP: + hsync_fudge = hsync_fudge_fp[format-1]; + break; + case R128_BIOS_DISPLAY_FP_CRT: + hsync_fudge = hsync_fudge_fp_crt[format-1]; + break; + case R128_BIOS_DISPLAY_CRT: + default: + hsync_fudge = hsync_fudge_default[format-1]; + break; + } save->crtc_gen_cntl = (R128_CRTC_EXT_DISP_EN | R128_CRTC_EN @@ -2384,6 +2436,9 @@ : 0) | ((mode->Flags & V_INTERLACE) ? R128_CRTC_INTERLACE_EN + : 0) + | ((mode->Flags & V_CSYNC) + ? R128_CRTC_CSYNC_EN : 0)); save->crtc_ext_cntl = R128_VGA_ATI_LINEAR | R128_XCRT_CNT_EN; @@ -2456,7 +2511,7 @@ int yres = mode->CrtcVDisplay; float Hratio, Vratio; - if (info->CRTOnly) { + if (info->BIOSDisplay == R128_BIOS_DISPLAY_CRT) { save->crtc_ext_cntl |= R128_CRTC_CRT_ON; save->crtc2_gen_cntl = 0; save->fp_gen_cntl = orig->fp_gen_cntl; @@ -2467,9 +2522,9 @@ R128_FP_USE_SHADOW_EN); save->fp_gen_cntl |= (R128_FP_SEL_CRTC2 | R128_FP_CRTC_DONT_SHADOW_VPAR); - save->fp_panel_cntl = orig->fp_panel_cntl & ~R128_FP_DIGON; - save->lvds_gen_cntl = orig->lvds_gen_cntl & ~(R128_LVDS_ON | - R128_LVDS_BLON); + save->fp_panel_cntl = orig->fp_panel_cntl & (CARD32)~R128_FP_DIGON; + save->lvds_gen_cntl = orig->lvds_gen_cntl & + (CARD32)~(R128_LVDS_ON | R128_LVDS_BLON); return; } @@ -2502,11 +2557,12 @@ else save->fp_vert_stretch |= (R128_VERT_STRETCH_ENABLE | R128_VERT_STRETCH_BLEND); - save->fp_gen_cntl = (orig->fp_gen_cntl & ~(R128_FP_SEL_CRTC2 | - R128_FP_CRTC_USE_SHADOW_VEND | - R128_FP_CRTC_HORZ_DIV2_EN | - R128_FP_CRTC_HOR_CRT_DIV2_DIS | - R128_FP_USE_SHADOW_EN)); + save->fp_gen_cntl = (orig->fp_gen_cntl & + (CARD32)~(R128_FP_SEL_CRTC2 | + R128_FP_CRTC_USE_SHADOW_VEND | + R128_FP_CRTC_HORZ_DIV2_EN | + R128_FP_CRTC_HOR_CRT_DIV2_DIS | + R128_FP_USE_SHADOW_EN)); if (orig->fp_gen_cntl & R128_FP_DETECT_SENSE) { save->fp_gen_cntl |= (R128_FP_CRTC_DONT_SHADOW_VPAR | R128_FP_TDMS_EN); @@ -2522,9 +2578,13 @@ want to use the dual CRTC capabilities of the R128 to allow both the flat panel and external CRT to either simultaneously display the same image or display two different images. */ - save->crtc_ext_cntl &= ~R128_CRTC_CRT_ON; - save->dac_cntl |= R128_DAC_CRT_SEL_CRTC2; - save->crtc2_gen_cntl = 0; + if (info->BIOSDisplay == R128_BIOS_DISPLAY_FP_CRT) { + save->crtc_ext_cntl |= R128_CRTC_CRT_ON; + } else { + save->crtc_ext_cntl &= ~R128_CRTC_CRT_ON; + save->dac_cntl |= R128_DAC_CRT_SEL_CRTC2; + save->crtc2_gen_cntl = 0; + } /* WARNING: Be careful about turning on the flat panel */ #if 1 @@ -2541,8 +2601,8 @@ } /* Define PLL registers for requested video mode. */ -static void R128InitPLLRegisters(R128SavePtr save, R128PLLPtr pll, - double dot_clock) +static void R128InitPLLRegisters(ScrnInfoPtr pScrn, R128SavePtr save, + R128PLLPtr pll, double dot_clock) { unsigned long freq = dot_clock * 100; struct { @@ -2721,7 +2781,7 @@ if (!R128InitCrtcRegisters(pScrn, save, mode, info)) return FALSE; if (info->HasPanelRegs) R128InitFPRegisters(&info->SavedReg, save, mode, info); - R128InitPLLRegisters(save, &info->pll, dot_clock); + R128InitPLLRegisters(pScrn, save, &info->pll, dot_clock); if (!R128InitDDARegisters(pScrn, save, &info->pll, info)) return FALSE; if (!info->PaletteSavedOnVT) R128InitPalette(save); @@ -2782,7 +2842,9 @@ if (mode->Flags & V_DBLSCAN) return MODE_NO_DBLESCAN; } - if (info->HasPanelRegs && !info->CRTOnly && info->VBIOS) { + if (info->HasPanelRegs && + info->BIOSDisplay != R128_BIOS_DISPLAY_CRT && + info->VBIOS) { int i; for (i = info->FPBIOSstart+64; R128_BIOS16(i) != 0; i += 2) { int j = R128_BIOS16(i); @@ -2974,7 +3036,6 @@ R128FreeRec(pScrn); } -#ifdef DPMSExtension /* Sets VESA Display Power Management Signaling (DPMS) Mode. */ static void R128DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -3006,4 +3067,3 @@ break; } } -#endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c:1.1 Thu Nov 2 11:55:36 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c,v 1.1 2000/11/02 16:55:36 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_misc.c,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c:1.6.2.1 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c:1.6.2.1 Thu Feb 15 11:01:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c Fri May 4 15:05:33 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.6.2.1 2001/02/15 16:01:41 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.c,v 1.10 2001/05/04 19:05:33 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -48,13 +48,39 @@ #include "xf86_ansic.h" #include "xf86Resources.h" +#ifdef XFree86LOADER + +/* + * The following exists to prevent the compiler from considering entry points + * defined in a separate module from being constants. + */ +static xf86PreInitProc * const volatile PreInitProc = R128PreInit; +static xf86ScreenInitProc * const volatile ScreenInitProc = R128ScreenInit; +static xf86SwitchModeProc * const volatile SwitchModeProc = R128SwitchMode; +static xf86AdjustFrameProc * const volatile AdjustFrameProc = R128AdjustFrame; +static xf86EnterVTProc * const volatile EnterVTProc = R128EnterVT; +static xf86LeaveVTProc * const volatile LeaveVTProc = R128LeaveVT; +static xf86FreeScreenProc * const volatile FreeScreenProc = R128FreeScreen; +static xf86ValidModeProc * const volatile ValidModeProc = R128ValidMode; + +#define R128PreInit PreInitProc +#define R128ScreenInit ScreenInitProc +#define R128SwitchMode SwitchModeProc +#define R128AdjustFrame AdjustFrameProc +#define R128EnterVT EnterVTProc +#define R128LeaveVT LeaveVTProc +#define R128FreeScreen FreeScreenProc +#define R128ValidMode ValidModeProc + +#endif + SymTabRec R128Chipsets[] = { { PCI_CHIP_RAGE128RE, "ATI Rage 128 RE (PCI)" }, { PCI_CHIP_RAGE128RF, "ATI Rage 128 RF (AGP)" }, { PCI_CHIP_RAGE128RG, "ATI Rage 128 RG (AGP)" }, { PCI_CHIP_RAGE128RK, "ATI Rage 128 RK (PCI)" }, { PCI_CHIP_RAGE128RL, "ATI Rage 128 RL (AGP)" }, - { PCI_CHIP_RAGE128PD, "ATI Rage 128 Pro PD (AGP)" }, + { PCI_CHIP_RAGE128PD, "ATI Rage 128 Pro PD (PCI)" }, { PCI_CHIP_RAGE128PF, "ATI Rage 128 Pro PF (AGP)" }, { PCI_CHIP_RAGE128LE, "ATI Rage 128 Mobility LE (PCI)" }, { PCI_CHIP_RAGE128LF, "ATI Rage 128 Mobility LF (AGP)" }, @@ -79,7 +105,7 @@ }; /* Return the options for supported chipset 'n'; NULL otherwise */ -OptionInfoPtr +const OptionInfoRec * R128AvailableOptions(int chipid, int busid) { int i; @@ -88,6 +114,8 @@ * Return options defined in the r128 submodule which will have been * loaded by this point. */ + if ((chipid >> 16) == PCI_VENDOR_ATI) + chipid -= PCI_VENDOR_ATI << 16; for (i = 0; R128PciChipsets[i].PCIid > 0; i++) { if (chipid == R128PciChipsets[i].PCIid) return R128Options; @@ -161,9 +189,10 @@ pEnt = xf86GetEntityInfo(usedChips[i]); if (pEnt->active) { - ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); + ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); #ifdef XFree86LOADER + if (!xf86LoadSubModule(pScrn, "r128")) { xf86Msg(X_ERROR, R128_NAME ": Failed to load \"r128\" module.\n"); @@ -172,24 +201,6 @@ } xf86LoaderReqSymLists(R128Symbols, NULL); - - /* Workaround for possible loader bug */ -# define R128PreInit \ - (xf86PreInitProc*) LoaderSymbol("R128PreInit") -# define R128ScreenInit \ - (xf86ScreenInitProc*) LoaderSymbol("R128ScreenInit") -# define R128SwitchMode \ - (xf86SwitchModeProc*) LoaderSymbol("R128SwitchMode") -# define R128AdjustFrame \ - (xf86AdjustFrameProc*)LoaderSymbol("R128AdjustFrame") -# define R128EnterVT \ - (xf86EnterVTProc*) LoaderSymbol("R128EnterVT") -# define R128LeaveVT \ - (xf86LeaveVTProc*) LoaderSymbol("R128LeaveVT") -# define R128FreeScreen \ - (xf86FreeScreenProc*) LoaderSymbol("R128FreeScreen") -# define R128ValidMode \ - (xf86ValidModeProc*) LoaderSymbol("R128ValidMode") #endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h:1.3 Sat Nov 18 14:37:11 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h Mon May 7 17:59:06 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h,v 1.3 2000/11/18 19:37:11 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_probe.h,v 1.5 2001/05/07 21:59:06 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -42,34 +42,35 @@ #include "xf86str.h" /* r128_probe.c */ -extern OptionInfoPtr R128AvailableOptions - FunctionPrototype((int, int)); -extern void R128Identify - FunctionPrototype((int)); -extern Bool R128Probe - FunctionPrototype((DriverPtr, int)); +extern const OptionInfoRec * R128AvailableOptions + FunctionPrototype((int, int)); +extern void R128Identify + FunctionPrototype((int)); +extern Bool R128Probe + FunctionPrototype((DriverPtr, int)); -extern SymTabRec R128Chipsets[]; -extern PciChipsets R128PciChipsets[]; +extern SymTabRec R128Chipsets[]; +extern PciChipsets R128PciChipsets[]; /* r128_driver.c */ -extern Bool R128PreInit - FunctionPrototype((ScrnInfoPtr, int)); -extern Bool R128ScreenInit - FunctionPrototype((int, ScreenPtr, int, char **)); -extern Bool R128SwitchMode - FunctionPrototype((int, DisplayModePtr, int)); -extern void R128AdjustFrame - FunctionPrototype((int, int, int, int)); -extern Bool R128EnterVT - FunctionPrototype((int, int)); -extern void R128LeaveVT - FunctionPrototype((int, int)); -extern void R128FreeScreen - FunctionPrototype((int, int)); -extern int R128ValidMode - FunctionPrototype((int, DisplayModePtr, Bool, int)); +extern Bool R128PreInit + FunctionPrototype((ScrnInfoPtr, int)); +extern Bool R128ScreenInit + FunctionPrototype((int, ScreenPtr, int, char **)); +extern Bool R128SwitchMode + FunctionPrototype((int, DisplayModePtr, int)); +extern void R128AdjustFrame + FunctionPrototype((int, int, int, int)); +extern Bool R128EnterVT + FunctionPrototype((int, int)); +extern void R128LeaveVT + FunctionPrototype((int, int)); +extern void R128FreeScreen + FunctionPrototype((int, int)); +extern int R128ValidMode + FunctionPrototype((int, DisplayModePtr, Bool, + int)); -extern OptionInfoRec R128Options[]; +extern const OptionInfoRec R128Options[]; #endif /* _R128_PROBE_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h:1.6 Tue Dec 12 12:17:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h Tue Apr 10 12:07:59 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.6 2000/12/12 17:17:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_reg.h,v 1.11 2001/04/10 16:07:59 dawes Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -59,7 +59,7 @@ #define OUTREG16(addr, val) MMIO_OUT16(R128MMIO, addr, val) #define OUTREG(addr, val) MMIO_OUT32(R128MMIO, addr, val) -#define ADDRREG(addr) ((volatile CARD32 *)(R128MMIO + (addr))) +#define ADDRREG(addr) ((volatile CARD32 *)(pointer)(R128MMIO + (addr))) #define OUTREGP(addr, val, mask) \ @@ -116,12 +116,12 @@ #define PAL_SELECT(idx) \ do { \ + CARD32 tmp = INREG(R128_DAC_CNTL); \ if (idx) { \ - OUTREG(R128_DAC_CNTL, INREG(R128_DAC_CNTL) | \ - R128_DAC_PALETTE_ACC_CTL); \ + OUTREG(R128_DAC_CNTL, tmp | R128_DAC_PALETTE_ACC_CTL); \ } else { \ - OUTREG(R128_DAC_CNTL, INREG(R128_DAC_CNTL) & \ - ~R128_DAC_PALETTE_ACC_CTL); \ + OUTREG(R128_DAC_CNTL, tmp & \ + (CARD32)~R128_DAC_PALETTE_ACC_CTL); \ } \ } while (0) @@ -182,8 +182,19 @@ #define R128_BIOS_1_SCRATCH 0x0014 #define R128_BIOS_2_SCRATCH 0x0018 #define R128_BIOS_3_SCRATCH 0x001c +#define R128_BIOS_4_SCRATCH 0x0020 +#define R128_BIOS_5_SCRATCH 0x0024 +# define R128_BIOS_DISPLAY_FP (1 << 0) +# define R128_BIOS_DISPLAY_CRT (2 << 0) +# define R128_BIOS_DISPLAY_FP_CRT (3 << 0) +#define R128_BIOS_6_SCRATCH 0x0028 +#define R128_BIOS_7_SCRATCH 0x002c #define R128_BIOS_ROM 0x0f30 /* PCI */ #define R128_BIST 0x0f0f /* PCI */ +#define R128_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 @@ -1272,49 +1283,53 @@ # define R128_PSEUDOCOLOR_DT_ARGB1555 (1 << 24) # define R128_PSEUDOCOLOR_DT_ARGB4444 (2 << 24) #define R128_PRIM_TEXTURE_COMBINE_CNTL_C 0x1cb4 -# define R128_COMB_DIS (0 << 0) -# define R128_COMB_COPY (1 << 0) -# define R128_COMB_COPY_INP (2 << 0) -# define R128_COMB_MODULATE (3 << 0) -# define R128_COMB_MODULATE2X (4 << 0) -# define R128_COMB_MODULATE4X (5 << 0) -# define R128_COMB_ADD (6 << 0) -# define R128_COMB_ADD_SIGNED (7 << 0) -# define R128_COMB_BLEND_VERTEX (8 << 0) -# define R128_COMB_BLEND_TEXTURE (9 << 0) -# define R128_COMB_BLEND_CONST (10 << 0) -# define R128_COMB_BLEND_PREMULT (11 << 0) -# define R128_COMB_BLEND_PREV (12 << 0) -# define R128_COMB_BLEND_PREMULT_INV (13 << 0) -# define R128_COMB_ADD_SIGNED2X (14 << 0) -# define R128_COMB_BLEND_CONST_COLOR (15 << 0) -# define R128_COMB_MASK (15 << 0) -# define R128_COLOR_FACTOR_TEX (4 << 4) -# define R128_COLOR_FACTOR_NTEX (5 << 4) -# define R128_COLOR_FACTOR_ALPHA (6 << 4) -# define R128_COLOR_FACTOR_NALPHA (7 << 4) -# define R128_COLOR_FACTOR_MASK (15 << 4) -# define R128_INPUT_FACTOR_CONST_COLOR (2 << 10) -# define R128_INPUT_FACTOR_CONST_ALPHA (3 << 10) -# define R128_INPUT_FACTOR_INT_COLOR (4 << 10) -# define R128_INPUT_FACTOR_INT_ALPHA (5 << 10) -# define R128_INPUT_FACTOR_MASK (15 << 10) -# define R128_COMB_ALPHA_DIS (0 << 14) -# define R128_COMB_ALPHA_COPY (1 << 14) -# define R128_COMB_ALPHA_COPY_INP (2 << 14) -# define R128_COMB_ALPHA_MODULATE (3 << 14) -# define R128_COMB_ALPHA_MODULATE2X (4 << 14) -# define R128_COMB_ALPHA_MODULATE4X (5 << 14) -# define R128_COMB_ALPHA_ADD (6 << 14) -# define R128_COMB_ALPHA_ADD_SIGNED (7 << 14) -# define R128_COMB_ALPHA_ADD_SIGNED2X (14 << 14) -# define R128_COMB_ALPHA_MASK (15 << 14) -# define R128_ALPHA_FACTOR_TEX_ALPHA (6 << 18) -# define R128_ALPHA_FACTOR_NTEX_ALPHA (7 << 18) -# define R128_ALPHA_FACTOR_MASK (15 << 18) -# define R128_INP_FACTOR_A_CONST_ALPHA (1 << 25) -# define R128_INP_FACTOR_A_INT_ALPHA (2 << 25) -# define R128_INP_FACTOR_A_MASK (7 << 25) +# define R128_COMB_DIS (0 << 0) +# define R128_COMB_COPY (1 << 0) +# define R128_COMB_COPY_INP (2 << 0) +# define R128_COMB_MODULATE (3 << 0) +# define R128_COMB_MODULATE2X (4 << 0) +# define R128_COMB_MODULATE4X (5 << 0) +# define R128_COMB_ADD (6 << 0) +# define R128_COMB_ADD_SIGNED (7 << 0) +# define R128_COMB_BLEND_VERTEX (8 << 0) +# define R128_COMB_BLEND_TEXTURE (9 << 0) +# define R128_COMB_BLEND_CONST (10 << 0) +# define R128_COMB_BLEND_PREMULT (11 << 0) +# define R128_COMB_BLEND_PREV (12 << 0) +# define R128_COMB_BLEND_PREMULT_INV (13 << 0) +# define R128_COMB_ADD_SIGNED2X (14 << 0) +# define R128_COMB_BLEND_CONST_COLOR (15 << 0) +# define R128_COMB_MASK (15 << 0) +# define R128_COLOR_FACTOR_CONST_COLOR (0 << 4) +# define R128_COLOR_FACTOR_NCONST_COLOR (1 << 4) +# define R128_COLOR_FACTOR_TEX (4 << 4) +# define R128_COLOR_FACTOR_NTEX (5 << 4) +# define R128_COLOR_FACTOR_ALPHA (6 << 4) +# define R128_COLOR_FACTOR_NALPHA (7 << 4) +# define R128_COLOR_FACTOR_PREV_COLOR (8 << 4) +# define R128_COLOR_FACTOR_MASK (15 << 4) +# define R128_COMB_FCN_MSB (1 << 8) +# define R128_INPUT_FACTOR_CONST_COLOR (2 << 10) +# define R128_INPUT_FACTOR_CONST_ALPHA (3 << 10) +# define R128_INPUT_FACTOR_INT_COLOR (4 << 10) +# define R128_INPUT_FACTOR_INT_ALPHA (5 << 10) +# define R128_INPUT_FACTOR_MASK (15 << 10) +# define R128_COMB_ALPHA_DIS (0 << 14) +# define R128_COMB_ALPHA_COPY (1 << 14) +# define R128_COMB_ALPHA_COPY_INP (2 << 14) +# define R128_COMB_ALPHA_MODULATE (3 << 14) +# define R128_COMB_ALPHA_MODULATE2X (4 << 14) +# define R128_COMB_ALPHA_MODULATE4X (5 << 14) +# define R128_COMB_ALPHA_ADD (6 << 14) +# define R128_COMB_ALPHA_ADD_SIGNED (7 << 14) +# define R128_COMB_ALPHA_ADD_SIGNED2X (14 << 14) +# define R128_COMB_ALPHA_MASK (15 << 14) +# define R128_ALPHA_FACTOR_TEX_ALPHA (6 << 18) +# define R128_ALPHA_FACTOR_NTEX_ALPHA (7 << 18) +# define R128_ALPHA_FACTOR_MASK (15 << 18) +# define R128_INP_FACTOR_A_CONST_ALPHA (1 << 25) +# define R128_INP_FACTOR_A_INT_ALPHA (2 << 25) +# define R128_INP_FACTOR_A_MASK (7 << 25) #define R128_TEX_SIZE_PITCH_C 0x1cb8 # define R128_TEX_PITCH_SHIFT 0 # define R128_TEX_SIZE_SHIFT 4 Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h:1.5 Fri Dec 15 17:48:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h Sun Jan 7 20:07:35 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.5 2000/12/15 22:48:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_sarea.h,v 1.6 2001/01/08 01:07:35 martin Exp $ */ /* * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario, * Precision Insight, Inc., Cedar Park, Texas, and @@ -76,11 +76,7 @@ /* Vertex/indirect buffer size */ -#if 1 #define R128_BUFFER_SIZE 16384 -#else -#define R128_BUFFER_SIZE (128 * 1024) -#endif /* Byte offsets for indirect buffer data */ @@ -94,15 +90,17 @@ /* There are 2 heaps (local/AGP). Each region within a heap is a * minimum of 64k, and there are at most 64 of them per heap. */ -#define R128_LOCAL_TEX_HEAP 0 -#define R128_AGP_TEX_HEAP 1 +#define R128_CARD_HEAP 0 +#define R128_AGP_HEAP 1 #define R128_NR_TEX_HEAPS 2 #define R128_NR_TEX_REGIONS 64 #define R128_LOG_TEX_GRANULARITY 16 #define R128_NR_CONTEXT_REGS 12 -#define R128_TEX_MAXLEVELS 11 +#define R128_MAX_TEXTURE_LEVELS 11 +#define R128_MAX_TEXTURE_UNITS 2 + #endif /* __R128_SAREA_DEFINES__ */ typedef struct { @@ -146,14 +144,14 @@ unsigned int tex_cntl; unsigned int tex_combine_cntl; unsigned int tex_size_pitch; - unsigned int tex_offset[R128_TEX_MAXLEVELS]; + unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS]; unsigned int tex_border_color; } r128_texture_regs_t; typedef struct { unsigned char next, prev; /* indices to form a circular LRU */ unsigned char in_use; /* owned by a client, or free? */ - int age; /* tracked by clients to update local LRU's */ + int age; /* tracked by clients to update local LRU's */ } r128_tex_region_t; typedef struct { @@ -161,20 +159,20 @@ * on firing a vertex buffer. */ r128_context_regs_t ContextState; - r128_texture_regs_t TexState[R128_NR_TEX_HEAPS]; - unsigned int dirty; - unsigned int vertsize; - unsigned int vc_format; + r128_texture_regs_t TexState[R128_MAX_TEXTURE_UNITS]; + unsigned int dirty; + unsigned int vertsize; + unsigned int vc_format; /* The current cliprects, or a subset thereof. */ - XF86DRIClipRectRec boxes[R128_NR_SAREA_CLIPRECTS]; - unsigned int nbox; + XF86DRIClipRectRec boxes[R128_NR_SAREA_CLIPRECTS]; + unsigned int nbox; /* Counters for throttling of rendering clients. */ - unsigned int last_frame; - unsigned int last_dispatch; + unsigned int last_frame; + unsigned int last_dispatch; /* Maintain an LRU of contiguous regions of texture space. If you * think you own a region of texture memory, and it has an age @@ -191,11 +189,11 @@ * else's - simply eject them all in LRU order. */ /* Last elt is sentinal */ - r128_tex_region_t texList[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1]; + r128_tex_region_t texList[R128_NR_TEX_HEAPS][R128_NR_TEX_REGIONS+1]; /* last time texture was uploaded */ - int texAge[R128_NR_TEX_HEAPS]; + int texAge[R128_NR_TEX_HEAPS]; - int ctxOwner; /* last context to upload state */ + int ctxOwner; /* last context to upload state */ } R128SAREAPriv, *R128SAREAPrivPtr; #endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h:1.1 Thu Nov 2 11:55:39 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h,v 1.1 2000/11/02 16:55:39 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_version.h,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c:1.14 Thu Dec 7 15:42:52 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c Sat Mar 3 17:26:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.14 2000/12/07 20:42:52 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/r128_video.c,v 1.18 2001/03/03 22:26:10 tsi Exp $ */ #include "r128.h" #include "r128_reg.h" @@ -37,7 +37,7 @@ static void R128ResetVideo(ScrnInfoPtr); -static void R128VideoTimerCallback(ScrnInfoPtr pScrn, Time time); +static void R128VideoTimerCallback(ScrnInfoPtr pScrn, Time now); #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) @@ -253,8 +253,8 @@ (A->extents.y2 != B->extents.y2)) return FALSE; - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); + dataA = (pointer)REGION_RECTS(A); + dataB = (pointer)REGION_RECTS(B); while(num--) { if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) @@ -398,6 +398,7 @@ if((value < -64) || (value > 63)) return BadValue; pPriv->brightness = value; + OUTREG(R128_OV0_COLOUR_CNTL, (pPriv->brightness & 0x7f) | (pPriv->saturation << 8) | (pPriv->saturation << 16)); @@ -406,6 +407,7 @@ if((value < 0) || (value > 31)) return BadValue; pPriv->saturation = value; + OUTREG(R128_OV0_COLOUR_CNTL, (pPriv->brightness & 0x7f) | (pPriv->saturation << 8) | (pPriv->saturation << 16)); @@ -460,13 +462,18 @@ unsigned int *p_w, unsigned int *p_h, pointer data ){ + if(vid_w > (drw_w << 4)) + drw_w = vid_w >> 4; + if(vid_h > (drw_h << 4)) + drw_h = vid_h >> 4; + *p_w = drw_w; *p_h = drw_h; } static void -R128CopyData( +R128CopyData422( unsigned char *src, unsigned char *dst, int srcPitch, @@ -483,47 +490,44 @@ } static void -R128CopyMungedData( +R128CopyData420( unsigned char *src1, unsigned char *src2, unsigned char *src3, unsigned char *dst1, + unsigned char *dst2, + unsigned char *dst3, int srcPitch, int srcPitch2, int dstPitch, int h, int w ){ - CARD32 *dst; - CARD8 *s1, *s2, *s3; - int i, j; + int count; + count = h; + while(count--) { + memcpy(dst1, src1, w); + src1 += srcPitch; + dst1 += dstPitch; + } + w >>= 1; + h >>= 1; + dstPitch >>= 1; - for(j = 0; j < h; j++) { - dst = (CARD32*)dst1; - s1 = src1; s2 = src2; s3 = src3; - i = w; - while(i > 4) { - dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); - dst[1] = s1[2] | (s1[3] << 16) | (s3[1] << 8) | (s2[1] << 24); - dst[2] = s1[4] | (s1[5] << 16) | (s3[2] << 8) | (s2[2] << 24); - dst[3] = s1[6] | (s1[7] << 16) | (s3[3] << 8) | (s2[3] << 24); - dst += 4; s2 += 4; s3 += 4; s1 += 8; - i -= 4; - } - while(i--) { - dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); - dst++; s2++; s3++; - s1 += 2; - } + count = h; + while(count--) { + memcpy(dst2, src2, w); + src2 += srcPitch2; + dst2 += dstPitch; + } - dst1 += dstPitch; - src1 += srcPitch; - if(j & 1) { - src2 += srcPitch2; - src3 += srcPitch2; - } + count = h; + while(count--) { + memcpy(dst3, src3, w); + src3 += srcPitch2; + dst3 += dstPitch; } } @@ -570,7 +574,7 @@ } static void -R128DisplayVideo( +R128DisplayVideo422( ScrnInfoPtr pScrn, int id, int offset, @@ -613,7 +617,6 @@ left = (left >> 16) & 7; - OUTREG(R128_OV0_REG_LOAD_CNTL, 1); while(!(INREG(R128_OV0_REG_LOAD_CNTL) & (1 << 3))); @@ -624,24 +627,104 @@ OUTREG(R128_OV0_V_INC, v_inc); OUTREG(R128_OV0_P1_BLANK_LINES_AT_TOP, 0x00000fff | ((src_h - 1) << 16)); OUTREG(R128_OV0_VID_BUF_PITCH0_VALUE, pitch); - OUTREG(R128_OV0_P1_X_START_END, (src_w + left - 1) | (left << 16)); - left >>= 1; src_w >>= 1; - OUTREG(R128_OV0_P2_X_START_END, (src_w + left - 1) | (left << 16)); - OUTREG(R128_OV0_P3_X_START_END, (src_w + left - 1) | (left << 16)); + OUTREG(R128_OV0_P1_X_START_END, (width - 1) | (left << 16)); + left >>= 1; width >>= 1; + OUTREG(R128_OV0_P2_X_START_END, (width - 1) | (left << 16)); + OUTREG(R128_OV0_P3_X_START_END, (width - 1) | (left << 16)); OUTREG(R128_OV0_VID_BUF0_BASE_ADRS, offset & 0xfffffff0); OUTREG(R128_OV0_P1_V_ACCUM_INIT, p1_v_accum_init); + OUTREG(R128_OV0_P23_V_ACCUM_INIT, 0); OUTREG(R128_OV0_P1_H_ACCUM_INIT, p1_h_accum_init); OUTREG(R128_OV0_P23_H_ACCUM_INIT, p23_h_accum_init); if(id == FOURCC_UYVY) - OUTREG(R128_OV0_SCALE_CNTL, 0x41008C03); + OUTREG(R128_OV0_SCALE_CNTL, 0x41FF8C03); else - OUTREG(R128_OV0_SCALE_CNTL, 0x41008B03); + OUTREG(R128_OV0_SCALE_CNTL, 0x41FF8B03); + + OUTREG(R128_OV0_REG_LOAD_CNTL, 0); +} + +static void +R128DisplayVideo420( + ScrnInfoPtr pScrn, + short width, short height, + int pitch, + int offset1, int offset2, int offset3, + int left, int right, int top, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +){ + R128InfoPtr info = R128PTR(pScrn); + unsigned char *R128MMIO = info->MMIO; + int v_inc, h_inc, step_by, tmp, leftUV; + int p1_h_accum_init, p23_h_accum_init; + int p1_v_accum_init, p23_v_accum_init; + + v_inc = (src_h << 20) / drw_h; + h_inc = (src_w << 12) / drw_w; + step_by = 1; + + while(h_inc >= (2 << 12)) { + step_by++; + h_inc >>= 1; + } + + /* keep everything in 16.16 */ + + offset1 += (left >> 16) & ~15; + offset2 += (left >> 17) & ~15; + offset3 += (left >> 17) & ~15; + + tmp = (left & 0x0003ffff) + 0x00028000 + (h_inc << 3); + p1_h_accum_init = ((tmp << 4) & 0x000f8000) | + ((tmp << 12) & 0xf0000000); + + tmp = ((left >> 1) & 0x0001ffff) + 0x00028000 + (h_inc << 2); + p23_h_accum_init = ((tmp << 4) & 0x000f8000) | + ((tmp << 12) & 0x70000000); + + tmp = (top & 0x0000ffff) + 0x00018000; + p1_v_accum_init = ((tmp << 4) & 0x03ff8000) | 0x00000001; + + tmp = ((top >> 1) & 0x0000ffff) + 0x00018000; + p23_v_accum_init = ((tmp << 4) & 0x01ff8000) | 0x00000001; + leftUV = (left >> 17) & 15; + left = (left >> 16) & 15; + + OUTREG(R128_OV0_REG_LOAD_CNTL, 1); + while(!(INREG(R128_OV0_REG_LOAD_CNTL) & (1 << 3))); + + OUTREG(R128_OV0_H_INC, h_inc | ((h_inc >> 1) << 16)); + OUTREG(R128_OV0_STEP_BY, step_by | (step_by << 8)); + OUTREG(R128_OV0_Y_X_START, dstBox->x1 | (dstBox->y1 << 16)); + OUTREG(R128_OV0_Y_X_END, dstBox->x2 | (dstBox->y2 << 16)); + OUTREG(R128_OV0_V_INC, v_inc); + OUTREG(R128_OV0_P1_BLANK_LINES_AT_TOP, 0x00000fff | ((src_h - 1) << 16)); + src_h = (src_h + 1) >> 1; + OUTREG(R128_OV0_P23_BLANK_LINES_AT_TOP, 0x000007ff | ((src_h - 1) << 16)); + OUTREG(R128_OV0_VID_BUF_PITCH0_VALUE, pitch); + OUTREG(R128_OV0_VID_BUF_PITCH1_VALUE, pitch >> 1); + OUTREG(R128_OV0_P1_X_START_END, (width - 1) | (left << 16)); + width >>= 1; + OUTREG(R128_OV0_P2_X_START_END, (width - 1) | (leftUV << 16)); + OUTREG(R128_OV0_P3_X_START_END, (width - 1) | (leftUV << 16)); + OUTREG(R128_OV0_VID_BUF0_BASE_ADRS, offset1 & 0xfffffff0); + OUTREG(R128_OV0_VID_BUF1_BASE_ADRS, (offset2 & 0xfffffff0) | 0x00000001); + OUTREG(R128_OV0_VID_BUF2_BASE_ADRS, (offset3 & 0xfffffff0) | 0x00000001); + OUTREG(R128_OV0_P1_V_ACCUM_INIT, p1_v_accum_init); + OUTREG(R128_OV0_P23_V_ACCUM_INIT, p23_v_accum_init); + OUTREG(R128_OV0_P1_H_ACCUM_INIT, p1_h_accum_init); + OUTREG(R128_OV0_P23_H_ACCUM_INIT, p23_h_accum_init); + OUTREG(R128_OV0_SCALE_CNTL, 0x41FF8A03); + OUTREG(R128_OV0_REG_LOAD_CNTL, 0); } + static int R128PutImage( ScrnInfoPtr pScrn, @@ -657,27 +740,28 @@ R128InfoPtr info = R128PTR(pScrn); R128PortPrivPtr pPriv = (R128PortPrivPtr)data; INT32 xa, xb, ya, yb; - unsigned char *dst_start; - int pitch, new_size, offset, s2offset, s3offset; + int pitch, new_size, offset, s1offset, s2offset, s3offset; int srcPitch, srcPitch2, dstPitch; + int d1line, d2line, d3line, d1offset, d2offset, d3offset; int top, left, npixels, nlines, bpp; BoxRec dstBox; CARD32 tmp; /* - * s2offset, s3offset - byte offsets into U and V plane of the - * source where copying starts. Y plane is - * done by editing "buf". + * s1offset, s2offset, s3offset - byte offsets to the Y, U and V planes + * of the source. + * + * d1offset, d2offset, d3offset - byte offsets to the Y, U and V planes + * of the destination. * - * offset - byte offset to the first line of the destination. + * offset - byte offset within the framebuffer to where the destination + * is stored. * - * dst_start - byte address to the first displayed pel. + * d1line, d2line, d3line - byte offsets within the destination to the + * first displayed scanline in each plane. * */ - /* make the compiler happy */ - s2offset = s3offset = srcPitch2 = 0; - if(src_w > (drw_w << 4)) drw_w = src_w >> 4; if(src_h > (drw_h << 4)) @@ -708,19 +792,24 @@ switch(id) { case FOURCC_YV12: case FOURCC_I420: - dstPitch = ((width << 1) + 15) & ~15; - new_size = ((dstPitch * height) + bpp - 1) / bpp; srcPitch = (width + 3) & ~3; - s2offset = srcPitch * height; srcPitch2 = ((width >> 1) + 3) & ~3; + dstPitch = (width + 31) & ~31; /* of luma */ + new_size = ((dstPitch * (height + (height >> 1))) + bpp - 1) / bpp; + s1offset = 0; + s2offset = srcPitch * height; s3offset = (srcPitch2 * (height >> 1)) + s2offset; break; case FOURCC_UYVY: case FOURCC_YUY2: default: + srcPitch = width << 1; + srcPitch2 = 0; dstPitch = ((width << 1) + 15) & ~15; new_size = ((dstPitch * height) + bpp - 1) / bpp; - srcPitch = (width << 1); + s1offset = 0; + s2offset = 0; + s3offset = 0; break; } @@ -737,37 +826,52 @@ left = (xa >> 16) & ~1; npixels = ((((xb + 0xffff) >> 16) + 1) & ~1) - left; - offset = (pPriv->linear->offset * bpp) + (top * dstPitch); + offset = pPriv->linear->offset * bpp; if(pPriv->doubleBuffer) offset += pPriv->currentBuffer * new_size * bpp; - dst_start = info->FB + offset; switch(id) { case FOURCC_YV12: case FOURCC_I420: + d1line = top * dstPitch; + d2line = (height * dstPitch) + ((top >> 1) * (dstPitch >> 1)); + d3line = d2line + ((height >> 1) * (dstPitch >> 1)); + top &= ~1; - dst_start += left << 1; + + d1offset = (top * dstPitch) + left + offset; + d2offset = d2line + (left >> 1) + offset; + d3offset = d3line + (left >> 1) + offset; + + s1offset += (top * srcPitch) + left; tmp = ((top >> 1) * srcPitch2) + (left >> 1); s2offset += tmp; s3offset += tmp; - if(id == FOURCC_I420) { + if(id == FOURCC_YV12) { tmp = s2offset; s2offset = s3offset; s3offset = tmp; } + nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; - R128CopyMungedData(buf + (top * srcPitch) + left, buf + s2offset, - buf + s3offset, dst_start, srcPitch, srcPitch2, - dstPitch, nlines, npixels); + R128CopyData420(buf + s1offset, buf + s2offset, buf + s3offset, + info->FB+d1offset, info->FB+d2offset, info->FB+d3offset, + srcPitch, srcPitch2, dstPitch, nlines, npixels); break; case FOURCC_UYVY: case FOURCC_YUY2: default: left <<= 1; - buf += (top * srcPitch) + left; + d1line = top * dstPitch; + d2line = 0; + d3line = 0; + d1offset = d1line + left + offset; + d2offset = 0; + d3offset = 0; + s1offset += (top * srcPitch) + left; nlines = ((yb + 0xffff) >> 16) - top; - dst_start += left; - R128CopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + R128CopyData422(buf + s1offset, info->FB + d1offset, + srcPitch, dstPitch, nlines, npixels); break; } @@ -776,13 +880,27 @@ if(!RegionsEqual(&pPriv->clip, clipBoxes)) { REGION_COPY(pScreen, &pPriv->clip, clipBoxes); /* draw these */ - (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0, + (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, + (CARD32)~0, REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); } + - R128DisplayVideo(pScrn, id, offset, width, height, dstPitch, + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + R128DisplayVideo420(pScrn, width, height, dstPitch, + offset + d1line, offset + d2line, offset + d3line, + xa, xb, ya, &dstBox, src_w, src_h, drw_w, drw_h); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + R128DisplayVideo422(pScrn, id, offset + d1line, width, height, dstPitch, xa, xb, ya, &dstBox, src_w, src_h, drw_w, drw_h); + break; + } pPriv->videoStatus = CLIENT_VIDEO_ON; @@ -835,21 +953,21 @@ } static void -R128VideoTimerCallback(ScrnInfoPtr pScrn, Time time) +R128VideoTimerCallback(ScrnInfoPtr pScrn, Time now) { R128InfoPtr info = R128PTR(pScrn); R128PortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr; if(pPriv->videoStatus & TIMER_MASK) { if(pPriv->videoStatus & OFF_TIMER) { - if(pPriv->offTime < time) { + if(pPriv->offTime < now) { unsigned char *R128MMIO = info->MMIO; OUTREG(R128_OV0_SCALE_CNTL, 0); pPriv->videoStatus = FREE_TIMER; - pPriv->freeTime = time + FREE_DELAY; + pPriv->freeTime = now + FREE_DELAY; } } else { /* FREE_TIMER */ - if(pPriv->freeTime < time) { + if(pPriv->freeTime < now) { if(pPriv->linear) { xf86FreeOffscreenLinear(pPriv->linear); pPriv->linear = NULL; Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h:1.8 Fri Dec 8 09:41:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h Fri May 4 15:05:33 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.8 2000/12/08 14:41:16 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon.h,v 1.19 2001/05/04 19:05:33 dawes Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -51,21 +51,21 @@ #include "xf86xv.h" /* DRI support */ -#undef XF86DRI /* Not yet */ #ifdef XF86DRI #define _XF86DRI_SERVER_ -#include "r128_dripriv.h" +#include "radeon_dripriv.h" #include "dri.h" #include "GL/glxint.h" #endif + /* Render support */ +#ifdef RENDER +#include "picturestr.h" +#endif + #define RADEON_DEBUG 0 /* Turn off debugging output */ #define RADEON_TIMEOUT 2000000 /* Fall out of wait loops after this count */ #define RADEON_MMIOSIZE 0x80000 -/* Atomic updates of PLL clock don't seem to always work and stick, thus - * the bit never resets. Here - we use our own check by reading back the - * register we've just wrote to make sure it's got the Right! value */ -#define RADEON_ATOMIC_UPDATE 0 /* Use PLL Atomic updates (seems broken) */ #define RADEON_VBIOS_SIZE 0x00010000 @@ -197,7 +197,6 @@ unsigned long LinearAddr; /* Frame buffer physical address */ unsigned long MMIOAddr; /* MMIO region physical address */ unsigned long BIOSAddr; /* BIOS physical address */ - Bool BIOSFromPCI; /* BIOS is read from PCI space */ unsigned char *MMIO; /* Map of MMIO region */ unsigned char *FB; /* Map of frame buffer */ @@ -280,19 +279,24 @@ drmHandle registerHandle; Bool IsPCI; /* Current card is a PCI card */ + drmSize pciSize; + drmHandle pciMemHandle; + unsigned char *PCI; /* Map */ + Bool depthMoves; /* Enable depth moves -- slow! */ + drmSize agpSize; drmHandle agpMemHandle; /* Handle from drmAgpAlloc */ unsigned long agpOffset; unsigned char *AGP; /* Map */ int agpMode; + + CARD32 pciCommand; - Bool CPInUse; /* CP is currently active */ + Bool CPInUse; /* CP has been used by X server */ int CPMode; /* CP mode that server/clients use */ int CPFifoSize; /* Size of the CP command FIFO */ - Bool CPSecure; /* CP security enabled */ int CPusecTimeout; /* CP timeout in usecs */ - Bool CP2D; /* CP is used for X server 2D prims */ /* CP ring buffer data */ unsigned long ringStart; /* Offset into AGP space */ @@ -307,22 +311,14 @@ drmSize ringReadMapSize; /* Size of map */ unsigned char *ringReadPtr; /* Map */ - /* CP vertex buffer data */ - unsigned long vbStart; /* Offset into AGP space */ - drmHandle vbHandle; /* Handle from drmAddMap */ - drmSize vbMapSize; /* Size of map */ - int vbSize; /* Size of vert bufs (in MB) */ - unsigned char *vb; /* Map */ - int vbBufSize; /* Size of individual vert buf */ - int vbNumBufs; /* Number of vert bufs */ - drmBufMapPtr vbBufs; /* Buffer map */ - - /* CP indirect buffer data */ - unsigned long indStart; /* Offset into AGP space */ - drmHandle indHandle; /* Handle from drmAddMap */ - drmSize indMapSize; /* Size of map */ - int indSize; /* Size of indirect bufs (in MB) */ - unsigned char *ind; /* Map */ + /* CP vertex/indirect buffer data */ + unsigned long bufStart; /* Offset into AGP space */ + drmHandle bufHandle; /* Handle from drmAddMap */ + drmSize bufMapSize; /* Size of map */ + int bufSize; /* Size of buffers (in MB) */ + unsigned char *buf; /* Map */ + int bufNumBufs; /* Number of buffers */ + drmBufMapPtr buffers; /* Buffer map */ /* CP AGP Texture data */ unsigned long agpTexStart; /* Offset into AGP space */ @@ -332,6 +328,10 @@ unsigned char *agpTex; /* Map */ int log2AGPTexGran; + /* CP accleration */ + drmBufPtr indirectBuffer; + int indirectStart; + /* DRI screen private data */ int fbX; int fbY; @@ -339,15 +339,44 @@ int backY; int depthX; int depthY; - int textureX; - int textureY; + + int frontOffset; + int frontPitch; + int backOffset; + int backPitch; + int depthOffset; + int depthPitch; + int textureOffset; int textureSize; int log2TexGran; + + CARD32 frontPitchOffset; + CARD32 backPitchOffset; + CARD32 depthPitchOffset; + + CARD32 dst_pitch_offset; + + /* Saved scissor values */ + CARD32 sc_left; + CARD32 sc_right; + CARD32 sc_top; + CARD32 sc_bottom; + + CARD32 re_top_left; + CARD32 re_width_height; + + CARD32 aux_sc_cntl; + +#ifdef PER_CONTEXT_SAREA + int perctx_sarea_size; +#endif #endif + XF86VideoAdaptorPtr adaptor; void (*VideoTimerCallback)(ScrnInfoPtr, Time); int videoKey; Bool showCache; + OptionInfoPtr Options; } RADEONInfoRec, *RADEONInfoPtr; #define RADEONWaitForFifo(pScrn, entries) \ @@ -359,14 +388,17 @@ extern void RADEONWaitForFifoFunction(ScrnInfoPtr pScrn, int entries); extern void RADEONWaitForIdle(ScrnInfoPtr pScrn); + extern void RADEONEngineReset(ScrnInfoPtr pScrn); extern void RADEONEngineFlush(ScrnInfoPtr pScrn); +extern void RADEONEngineRestore(ScrnInfoPtr pScrn); extern unsigned RADEONINPLL(ScrnInfoPtr pScrn, int addr); extern void RADEONWaitForVerticalSync(ScrnInfoPtr pScrn); +extern void RADEONSelectBuffer(ScrnInfoPtr pScrn, int buffer); + extern Bool RADEONAccelInit(ScreenPtr pScreen); -extern void RADEONEngineInit(ScrnInfoPtr pScrn); extern Bool RADEONCursorInit(ScreenPtr pScreen); extern Bool RADEONDGAInit(ScreenPtr pScreen); @@ -378,10 +410,174 @@ extern Bool RADEONDRIScreenInit(ScreenPtr pScreen); extern void RADEONDRICloseScreen(ScreenPtr pScreen); extern Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen); -extern void RADEONCPStart(ScrnInfoPtr pScrn); -extern void RADEONCPStop(ScrnInfoPtr pScrn); -extern void RADEONCPResetRing(ScrnInfoPtr pScrn); -extern void RADEONCPWaitForIdle(ScrnInfoPtr pScrn); -#endif -#endif +extern drmBufPtr RADEONCPGetBuffer(ScrnInfoPtr pScrn); +extern void RADEONCPFlushIndirect(ScrnInfoPtr pScrn); +extern void RADEONCPReleaseIndirect(ScrnInfoPtr pScrn); + + +#define RADEONCP_START(pScrn, info) \ +do { \ + int _ret = drmRadeonStartCP(info->drmFD); \ + if (_ret) { \ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ + "%s: CP start %d\n", __FUNCTION__, _ret); \ + } \ +} while (0) + +#define RADEONCP_STOP(pScrn, info) \ +do { \ + int _ret = drmRadeonStopCP(info->drmFD); \ + if (_ret) { \ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ + "%s: CP stop %d\n", __FUNCTION__, _ret); \ + } \ + RADEONEngineRestore(pScrn); \ +} while (0) + +#define RADEONCP_RESET(pScrn, info) \ +do { \ + if (RADEONCP_USE_RING_BUFFER(info->CPMode)) { \ + int _ret = drmRadeonResetCP(info->drmFD); \ + if (_ret) { \ + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, \ + "%s: CP reset %d\n", __FUNCTION__, _ret); \ + } \ + } \ +} while (0) + +#define RADEONCP_REFRESH(pScrn, info) \ +do { \ + if ( !info->CPInUse ) { \ + RADEON_WAIT_UNTIL_IDLE(); \ + BEGIN_RING( 6 ); \ + OUT_RING_REG( RADEON_RE_TOP_LEFT, info->re_top_left ); \ + OUT_RING_REG( RADEON_RE_WIDTH_HEIGHT, info->re_width_height ); \ + OUT_RING_REG( RADEON_AUX_SC_CNTL, info->aux_sc_cntl ); \ + ADVANCE_RING(); \ + info->CPInUse = TRUE; \ + } \ +} while (0) + + +#define CP_PACKET0( reg, n ) \ + (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) +#define CP_PACKET1( reg0, reg1 ) \ + (RADEON_CP_PACKET1 | (((reg1) >> 2) << 11) | ((reg0) >> 2)) +#define CP_PACKET2() \ + (RADEON_CP_PACKET2) +#define CP_PACKET3( pkt, n ) \ + (RADEON_CP_PACKET3 | (pkt) | ((n) << 16)) + + +#define RADEON_VERBOSE 0 + +#define RING_LOCALS CARD32 *__head; int __count; +#define RING_THRESHOLD 256 + +#define BEGIN_RING( n ) do { \ + if ( RADEON_VERBOSE ) { \ + xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ + "BEGIN_RING( %d ) in %s\n", n, __FUNCTION__ ); \ + } \ + if ( !info->indirectBuffer ) { \ + info->indirectBuffer = RADEONCPGetBuffer( pScrn ); \ + info->indirectStart = 0; \ + } else if ( info->indirectBuffer->used - info->indirectStart + \ + (n) * (int)sizeof(CARD32) > RING_THRESHOLD ) { \ + RADEONCPFlushIndirect( pScrn ); \ + } \ + __head = (pointer)((char *)info->indirectBuffer->address + \ + info->indirectBuffer->used); \ + __count = 0; \ +} while (0) + +#define ADVANCE_RING() do { \ + if ( RADEON_VERBOSE ) { \ + xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ + "ADVANCE_RING() used: %d+%d=%d/%d\n", \ + info->indirectBuffer->used - info->indirectStart, \ + __count * sizeof(CARD32), \ + info->indirectBuffer->used - info->indirectStart + \ + __count * sizeof(CARD32), \ + RING_THRESHOLD ); \ + } \ + info->indirectBuffer->used += __count * (int)sizeof(CARD32); \ +} while (0) + +#define OUT_RING( x ) do { \ + if ( RADEON_VERBOSE ) { \ + xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ + " OUT_RING( 0x%08x )\n", (unsigned int)(x) ); \ + } \ + __head[__count++] = (x); \ +} while (0) + +#define OUT_RING_REG( reg, val ) \ +do { \ + OUT_RING( CP_PACKET0( reg, 0 ) ); \ + OUT_RING( val ); \ +} while (0) + +#define FLUSH_RING() \ +do { \ + if ( RADEON_VERBOSE ) \ + xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ + "FLUSH_RING in %s\n", __FUNCTION__ ); \ + if ( info->indirectBuffer ) { \ + RADEONCPFlushIndirect( pScrn ); \ + } \ +} while (0) + + +#define RADEON_WAIT_UNTIL_2D_IDLE() \ +do { \ + BEGIN_RING( 2 ); \ + OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ + OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ + RADEON_WAIT_HOST_IDLECLEAN) ); \ + ADVANCE_RING(); \ +} while (0) + +#define RADEON_WAIT_UNTIL_3D_IDLE() \ +do { \ + BEGIN_RING( 2 ); \ + OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ + OUT_RING( (RADEON_WAIT_3D_IDLECLEAN | \ + RADEON_WAIT_HOST_IDLECLEAN) ); \ + ADVANCE_RING(); \ +} while (0) + +#define RADEON_WAIT_UNTIL_IDLE() \ +do { \ + if ( RADEON_VERBOSE ) { \ + xf86DrvMsg( pScrn->scrnIndex, X_INFO, \ + "WAIT_UNTIL_IDLE() in %s\n", __FUNCTION__ ); \ + } \ + BEGIN_RING( 2 ); \ + OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ + OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ + RADEON_WAIT_3D_IDLECLEAN | \ + RADEON_WAIT_HOST_IDLECLEAN) ); \ + ADVANCE_RING(); \ +} while (0) + +#define RADEON_FLUSH_CACHE() \ +do { \ + BEGIN_RING( 2 ); \ + OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ + OUT_RING( RADEON_RB2D_DC_FLUSH ); \ + ADVANCE_RING(); \ +} while (0) + +#define RADEON_PURGE_CACHE() \ +do { \ + BEGIN_RING( 2 ); \ + OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ + OUT_RING( RADEON_RB2D_DC_FLUSH_ALL ); \ + ADVANCE_RING(); \ +} while (0) + +#endif /* XF86DRI */ + +#endif /* _RADEON_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c:1.4 Sat Nov 18 14:37:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c Wed May 2 11:06:08 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.4 2000/11/18 19:37:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_accel.c,v 1.14 2001/05/02 15:06:08 dawes Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -70,14 +70,13 @@ * */ -#define RADEON_IMAGEWRITE 0 /* Turned off by default - slower in accel */ - /* Driver data structures */ #include "radeon.h" #include "radeon_reg.h" #ifdef XF86DRI #define _XF86DRI_SERVER_ -#include "r128_dri.h" +#include "radeon_dri.h" +#include "radeon_sarea.h" #endif /* Line support */ @@ -108,6 +107,109 @@ { RADEON_ROP3_ONE, RADEON_ROP3_ONE } /* GXset */ }; +/* The FIFO has 64 slots. This routines waits until at least `entries' of + these slots are empty. */ +void RADEONWaitForFifoFunction(ScrnInfoPtr pScrn, int entries) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + int i; + + for (;;) { + for (i = 0; i < RADEON_TIMEOUT; i++) { + info->fifo_slots = + INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK; + if (info->fifo_slots >= entries) return; + } + RADEONTRACE(("FIFO timed out: %d entries, stat=0x%08x\n", + INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, + INREG(RADEON_RBBM_STATUS))); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "FIFO timed out, resetting engine...\n"); + RADEONEngineReset(pScrn); + RADEONEngineRestore(pScrn); +#ifdef XF86DRI + RADEONCP_RESET(pScrn, info); + if (info->directRenderingEnabled) { + RADEONCP_START(pScrn, info); + } +#endif + } +} + +/* Wait for the graphics engine to be completely idle: the FIFO has + drained, the Pixel Cache is flushed, and the engine is idle. This is a + standard "sync" function that will make the hardware "quiescent". */ +void RADEONWaitForIdle(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO = info->MMIO; + int i; + + RADEONTRACE(("WaitForIdle (entering): %d entries, stat=0x%08x\n", + INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, + INREG(RADEON_RBBM_STATUS))); + + RADEONWaitForFifoFunction(pScrn, 64); + + for (;;) { + for (i = 0; i < RADEON_TIMEOUT; i++) { + if (!(INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_ACTIVE)) { + RADEONEngineFlush(pScrn); + return; + } + } + RADEONTRACE(("Idle timed out: %d entries, stat=0x%08x\n", + INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, + INREG(RADEON_RBBM_STATUS))); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Idle timed out, resetting engine...\n"); + RADEONEngineReset(pScrn); + RADEONEngineRestore(pScrn); +#ifdef XF86DRI + RADEONCP_RESET(pScrn, info); + if (info->directRenderingEnabled) { + RADEONCP_START(pScrn, info); + } +#endif + } +} + +#ifdef XF86DRI +/* Wait until the CP is completely idle: the FIFO has drained and the + * CP is idle. + */ +static void RADEONCPWaitForIdle(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + int ret; + int i = 0; + + FLUSH_RING(); + + for (;;) { + do { + ret = drmRadeonWaitForIdleCP(info->drmFD); + if (ret && ret != -EBUSY) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "%s: CP idle %d\n", __FUNCTION__, ret); + } + } while ((ret == -EBUSY) && (i++ < RADEON_TIMEOUT)); + + if (ret == 0) return; + + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Idle timed out, resetting engine...\n"); + RADEONEngineReset(pScrn); + RADEONEngineRestore(pScrn); + + /* Always restart the engine when doing CP 2D acceleration */ + RADEONCP_RESET(pScrn, info); + RADEONCP_START(pScrn, info); + } +} +#endif + /* Flush all dirty data in the Pixel Cache to memory. */ void RADEONEngineFlush(ScrnInfoPtr pScrn) { @@ -136,7 +238,13 @@ clock_cntl_index = INREG(RADEON_CLOCK_CNTL_INDEX); mclk_cntl = INPLL(pScrn, RADEON_MCLK_CNTL); - OUTPLL(RADEON_MCLK_CNTL, (mclk_cntl | 0x003f0000)); + OUTPLL(RADEON_MCLK_CNTL, (mclk_cntl | + RADEON_FORCEON_MCLKA | + RADEON_FORCEON_MCLKB | + RADEON_FORCEON_YCLKA | + RADEON_FORCEON_YCLKB | + RADEON_FORCEON_MC | + RADEON_FORCEON_AIC)); rbbm_soft_reset = INREG(RADEON_RBBM_SOFT_RESET); @@ -150,7 +258,7 @@ RADEON_SOFT_RESET_RB | RADEON_SOFT_RESET_HDP); INREG(RADEON_RBBM_SOFT_RESET); - OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset & + OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset & (CARD32) ~(RADEON_SOFT_RESET_CP | RADEON_SOFT_RESET_HI | RADEON_SOFT_RESET_SE | @@ -164,70 +272,105 @@ OUTPLL(RADEON_MCLK_CNTL, mclk_cntl); OUTREG(RADEON_CLOCK_CNTL_INDEX, clock_cntl_index); OUTREG(RADEON_RBBM_SOFT_RESET, rbbm_soft_reset); - -#ifdef XF86DRI - if (RADEONCP_USE_RING_BUFFER(info->CPMode)) RADEONCPResetRing(pScrn); -#endif } -/* The FIFO has 64 slots. This routines waits until at least `entries' of - these slots are empty. */ -void RADEONWaitForFifoFunction(ScrnInfoPtr pScrn, int entries) +/* Restore the acceleration hardware to its previous state. */ +void RADEONEngineRestore(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int i; + int pitch64; - for (;;) { - for (i = 0; i < RADEON_TIMEOUT; i++) { - info->fifo_slots = - INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK; - if (info->fifo_slots >= entries) return; - } - RADEONTRACE(("FIFO timed out: %d entries, stat=0x%08x\n", - INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, - INREG(RADEON_RBBM_STATUS))); - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "FIFO timed out, resetting engine...\n"); - RADEONEngineInit(pScrn); -#ifdef XF86DRI - if (info->CP2D) RADEONCPStart(pScrn); + RADEONTRACE(("EngineRestore (%d/%d)\n", + info->CurrentLayout.pixel_code, + info->CurrentLayout.bitsPerPixel)); + + RADEONWaitForFifo(pScrn, 1); + /* turn of all automatic flushing - we'll do it all */ + OUTREG(RADEON_RB2D_DSTCACHE_MODE, 0); + + pitch64 = ((pScrn->displayWidth * (pScrn->bitsPerPixel / 8) + 0x3f)) >> 6; + + RADEONWaitForFifo(pScrn, 1); + OUTREG(RADEON_DEFAULT_OFFSET, (INREG(RADEON_DEFAULT_OFFSET) & 0xC0000000) | + (pitch64 << 22)); + + RADEONWaitForFifo(pScrn, 1); +#if X_BYTE_ORDER == X_BIG_ENDIAN + OUTREGP(RADEON_DP_DATATYPE, + RADEON_HOST_BIG_ENDIAN_EN, ~RADEON_HOST_BIG_ENDIAN_EN); +#else + OUTREGP(RADEON_DP_DATATYPE, 0, ~RADEON_HOST_BIG_ENDIAN_EN); #endif - } + + RADEONWaitForFifo(pScrn, 1); + OUTREG(RADEON_DEFAULT_SC_BOTTOM_RIGHT, (RADEON_DEFAULT_SC_RIGHT_MAX + | RADEON_DEFAULT_SC_BOTTOM_MAX)); + RADEONWaitForFifo(pScrn, 1); + OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl + | RADEON_GMC_BRUSH_SOLID_COLOR + | RADEON_GMC_SRC_DATATYPE_COLOR)); + + RADEONWaitForFifo(pScrn, 7); + OUTREG(RADEON_DST_LINE_START, 0); + OUTREG(RADEON_DST_LINE_END, 0); + OUTREG(RADEON_DP_BRUSH_FRGD_CLR, 0xffffffff); + OUTREG(RADEON_DP_BRUSH_BKGD_CLR, 0x00000000); + OUTREG(RADEON_DP_SRC_FRGD_CLR, 0xffffffff); + OUTREG(RADEON_DP_SRC_BKGD_CLR, 0x00000000); + OUTREG(RADEON_DP_WRITE_MASK, 0xffffffff); + + RADEONWaitForIdle(pScrn); } -/* Wait for the graphics engine to be completely idle: the FIFO has - drained, the Pixel Cache is flushed, and the engine is idle. This is a - standard "sync" function that will make the hardware "quiescent". */ -void RADEONWaitForIdle(ScrnInfoPtr pScrn) +/* Initialize the acceleration hardware. */ +static void RADEONEngineInit(ScrnInfoPtr pScrn) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int i; - RADEONTRACE(("WaitForIdle (entering): %d entries, stat=0x%08x\n", - INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, - INREG(RADEON_RBBM_STATUS))); + RADEONTRACE(("EngineInit (%d/%d)\n", + info->CurrentLayout.pixel_code, + info->CurrentLayout.bitsPerPixel)); - RADEONWaitForFifoFunction(pScrn, 64); + OUTREG(RADEON_RB3D_CNTL, 0); + RADEONEngineReset(pScrn); - for (;;) { - for (i = 0; i < RADEON_TIMEOUT; i++) { - if (!(INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_ACTIVE)) { - RADEONEngineFlush(pScrn); - return; - } - } - RADEONTRACE(("Idle timed out: %d entries, stat=0x%08x\n", - INREG(RADEON_RBBM_STATUS) & RADEON_RBBM_FIFOCNT_MASK, - INREG(RADEON_RBBM_STATUS))); - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Idle timed out, resetting engine...\n"); - RADEONEngineInit(pScrn); + switch (info->CurrentLayout.pixel_code) { + case 8: info->datatype = 2; break; + case 15: info->datatype = 3; break; + case 16: info->datatype = 4; break; + case 24: info->datatype = 5; break; + case 32: info->datatype = 6; break; + default: + RADEONTRACE(("Unknown depth/bpp = %d/%d (code = %d)\n", + info->CurrentLayout.depth, + info->CurrentLayout.bitsPerPixel, + info->CurrentLayout.pixel_code)); + } + info->pitch = ((info->CurrentLayout.displayWidth / 8) * + (info->CurrentLayout.pixel_bytes == 3 ? 3 : 1)); + + RADEONTRACE(("Pitch for acceleration = %d\n", info->pitch)); + + info->dp_gui_master_cntl = + ((info->datatype << RADEON_GMC_DST_DATATYPE_SHIFT) + | RADEON_GMC_CLR_CMP_CNTL_DIS); + #ifdef XF86DRI - if (info->CP2D) RADEONCPStart(pScrn); + info->sc_left = 0x00000000; + info->sc_right = RADEON_DEFAULT_SC_RIGHT_MAX; + info->sc_top = 0x00000000; + info->sc_bottom = RADEON_DEFAULT_SC_BOTTOM_MAX; + + info->re_top_left = 0x00000000; + info->re_width_height = ((0x7ff << RADEON_RE_WIDTH_SHIFT) | + (0x7ff << RADEON_RE_HEIGHT_SHIFT)); + + info->aux_sc_cntl = 0x00000000; #endif - } + + RADEONEngineRestore(pScrn); } /* Setup for XAA SolidFill. */ @@ -338,7 +481,7 @@ { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 pat = *(CARD32 *)pattern; + CARD32 pat = *(CARD32 *)(pointer)pattern; switch (length) { case 2: pat |= pat << 2; /* fall through */ @@ -362,10 +505,10 @@ /* Subsequent XAA dashed line. */ static void RADEONSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, - int xa, int ya, - int xb, int yb, - int flags, - int phase) + int xa, int ya, + int xb, int yb, + int flags, + int phase) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; @@ -585,7 +728,13 @@ info->scanline_h = h; info->scanline_words = (w + 31) >> 5; - if ((info->scanline_words * h) <= 9) { +#ifdef __alpha__ + /* always use indirect for Alpha */ + if (0) +#else + if ((info->scanline_words * h) <= 9) +#endif + { /* Turn on direct for less than 9 dword colour expansion */ info->scratch_buffer[0] = (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST) @@ -607,13 +756,13 @@ OUTREG(RADEON_DST_HEIGHT_WIDTH, (h << 16) | ((w + 31) & ~31)); } -/* Subsequent XAA indirect CPU-to-screen color expandion. This is called +/* Subsequent XAA indirect CPU-to-screen color expansion. This is called once for each scanline. */ static void RADEONSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 *p = (CARD32 *)info->scratch_buffer[bufno]; + CARD32 *p = (pointer)info->scratch_buffer[bufno]; int i; int left = info->scanline_words; volatile CARD32 *d; @@ -621,6 +770,7 @@ if (info->scanline_direct) return; --info->scanline_h; while (left) { + write_mem_barrier(); if (left <= 8) { /* Last scanline - finish write to DATA_LAST */ if (info->scanline_h == 0) { @@ -645,7 +795,6 @@ } } -#if RADEON_IMAGEWRITE /* Setup for XAA indirect image write. */ static void RADEONSetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, @@ -691,7 +840,7 @@ { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - int shift = 0; /* 32bpp */ + int shift = 0; /* 32bpp */ if (pScrn->bitsPerPixel == 8) shift = 3; else if (pScrn->bitsPerPixel == 16) shift = 1; @@ -699,7 +848,13 @@ info->scanline_h = h; info->scanline_words = (w * info->scanline_bpp + 31) >> 5; - if ((info->scanline_words * h) <= 9) { +#ifdef __alpha__ + /* always use indirect for Alpha */ + if (0) +#else + if ((info->scanline_words * h) <= 9) +#endif + { /* Turn on direct for less than 9 dword colour expansion */ info->scratch_buffer[0] = (unsigned char *)(ADDRREG(RADEON_HOST_DATA_LAST) @@ -727,7 +882,7 @@ { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 *p = (CARD32 *)info->scratch_buffer[bufno]; + CARD32 *p = (pointer)info->scratch_buffer[bufno]; int i; int left = info->scanline_words; volatile CARD32 *d; @@ -735,6 +890,7 @@ if (info->scanline_direct) return; --info->scanline_h; while (left) { + write_mem_barrier(); if (left <= 8) { /* Last scanline - finish write to DATA_LAST */ if (info->scanline_h == 0) { @@ -758,94 +914,292 @@ } } } -#endif -/* Initialize the acceleration hardware. */ -void RADEONEngineInit(ScrnInfoPtr pScrn) + +/* ================================================================ + * CP-based 2D acceleration + */ +#ifdef XF86DRI + +/* Setup for XAA SolidFill. */ +static void RADEONCPSetupForSolidFill(ScrnInfoPtr pScrn, + int color, int rop, + unsigned int planemask) { - RADEONInfoPtr info = RADEONPTR(pScrn); - unsigned char *RADEONMMIO = info->MMIO; - int pitch64; + RADEONInfoPtr info = RADEONPTR(pScrn); + RING_LOCALS; - RADEONTRACE(("EngineInit (%d/%d)\n", - info->CurrentLayout.pixel_code, - info->CurrentLayout.bitsPerPixel)); + RADEONCP_REFRESH( pScrn, info ); - OUTREG(RADEON_SCALE_3D_CNTL, 0); - RADEONEngineReset(pScrn); + BEGIN_RING( 8 ); - RADEONWaitForFifo(pScrn, 1); - /* turn of all automatic flushing - we'll do it all */ - OUTREG(RADEON_RB2D_DSTCACHE_MODE, 0); + OUT_RING_REG( RADEON_DP_GUI_MASTER_CNTL, + (info->dp_gui_master_cntl + | RADEON_GMC_BRUSH_SOLID_COLOR + | RADEON_GMC_SRC_DATATYPE_COLOR + | RADEON_ROP[rop].pattern) ); + + OUT_RING_REG( RADEON_DP_BRUSH_FRGD_CLR, color ); + OUT_RING_REG( RADEON_DP_WRITE_MASK, planemask ); + OUT_RING_REG( RADEON_DP_CNTL, (RADEON_DST_X_LEFT_TO_RIGHT | + RADEON_DST_Y_TOP_TO_BOTTOM) ); + ADVANCE_RING(); +} - switch (info->CurrentLayout.pixel_code) { - case 8: info->datatype = 2; break; - case 15: info->datatype = 3; break; - case 16: info->datatype = 4; break; - case 24: info->datatype = 5; break; - case 32: info->datatype = 6; break; +/* Subsequent XAA SolidFillRect. + + Tests: xtest CH06/fllrctngl, xterm +*/ +static void RADEONCPSubsequentSolidFillRect(ScrnInfoPtr pScrn, + int x, int y, int w, int h) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + RING_LOCALS; + + RADEONCP_REFRESH( pScrn, info ); + + BEGIN_RING( 4 ); + + OUT_RING_REG( RADEON_DST_Y_X, (y << 16) | x ); + OUT_RING_REG( RADEON_DST_WIDTH_HEIGHT, (w << 16) | h ); + + ADVANCE_RING(); +} + +/* Setup for XAA screen-to-screen copy. + + Tests: xtest CH06/fllrctngl (also tests transparency). +*/ +static void RADEONCPSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, + int xdir, int ydir, int rop, + unsigned int planemask, + int trans_color) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + RING_LOCALS; + + RADEONCP_REFRESH( pScrn, info ); + + info->xdir = xdir; + info->ydir = ydir; + + BEGIN_RING( 6 ); + + OUT_RING_REG( RADEON_DP_GUI_MASTER_CNTL, + (info->dp_gui_master_cntl + | RADEON_GMC_BRUSH_NONE + | RADEON_GMC_SRC_DATATYPE_COLOR + | RADEON_ROP[rop].rop + | RADEON_DP_SRC_SOURCE_MEMORY) ); + + OUT_RING_REG( RADEON_DP_WRITE_MASK, planemask ); + OUT_RING_REG( RADEON_DP_CNTL, + ((xdir >= 0 ? RADEON_DST_X_LEFT_TO_RIGHT : 0) | + (ydir >= 0 ? RADEON_DST_Y_TOP_TO_BOTTOM : 0)) ); + + ADVANCE_RING(); + + if ( trans_color != -1 ) { + BEGIN_RING( 6 ); + + OUT_RING_REG( RADEON_CLR_CMP_CLR_SRC, trans_color ); + OUT_RING_REG( RADEON_CLR_CMP_MASK, RADEON_CLR_CMP_MSK ); + /* Mmmm, Seems as though the transparency compare is opposite to r128 + * It should only draw when source != trans_color, + * this is the opposite of that. */ + OUT_RING_REG( RADEON_CLR_CMP_CNTL, (RADEON_SRC_CMP_EQ_COLOR | + RADEON_CLR_CMP_SRC_SOURCE) ); + + ADVANCE_RING(); + } +} + +/* Subsequent XAA screen-to-screen copy. */ +static void RADEONCPSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, + int xa, int ya, + int xb, int yb, + int w, int h) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + RING_LOCALS; + + RADEONCP_REFRESH( pScrn, info ); + + if (info->xdir < 0) xa += w - 1, xb += w - 1; + if (info->ydir < 0) ya += h - 1, yb += h - 1; + + BEGIN_RING( 6 ); + + OUT_RING_REG( RADEON_SRC_Y_X, (ya << 16) | xa ); + OUT_RING_REG( RADEON_DST_Y_X, (yb << 16) | xb ); + OUT_RING_REG( RADEON_DST_HEIGHT_WIDTH, (h << 16) | w ); + + ADVANCE_RING(); +} + +/* Point the DST_PITCH_OFFSET register at the current buffer. This + * allows us to interact with the back and depth buffers. All CP 2D + * acceleration commands use the DST_PITCH_OFFSET register. + */ +void RADEONSelectBuffer(ScrnInfoPtr pScrn, int buffer) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + RING_LOCALS; + + switch (buffer) { + case RADEON_BACK: + info->dst_pitch_offset = info->backPitchOffset; + break; + case RADEON_DEPTH: + info->dst_pitch_offset = info->depthPitchOffset; + break; default: - RADEONTRACE(("Unknown depth/bpp = %d/%d (code = %d)\n", - info->CurrentLayout.depth, - info->CurrentLayout.bitsPerPixel, - info->CurrentLayout.pixel_code)); + case RADEON_FRONT: + info->dst_pitch_offset = info->frontPitchOffset; + break; } - info->pitch = ((info->CurrentLayout.displayWidth / 8) * - (info->CurrentLayout.pixel_bytes == 3 ? 3 : 1)); - RADEONTRACE(("Pitch for acceleration = %d\n", info->pitch)); + BEGIN_RING( 2 ); - pitch64 = ((pScrn->displayWidth * (pScrn->bitsPerPixel / 8) + 0x3f)) >> 6; + OUT_RING_REG( RADEON_DEFAULT_OFFSET, info->dst_pitch_offset ); - RADEONWaitForFifo(pScrn, 1); - OUTREG(RADEON_DEFAULT_OFFSET, (INREG(RADEON_DEFAULT_OFFSET) & 0xC0000000) | - (pitch64 << 22)); + ADVANCE_RING(); +} - RADEONWaitForFifo(pScrn, 1); -#if X_BYTE_ORDER == X_BIG_ENDIAN - OUTREGP(RADEON_DP_DATATYPE, - RADEON_HOST_BIG_ENDIAN_EN, ~RADEON_HOST_BIG_ENDIAN_EN); +/* Get an indirect buffer for the CP 2D acceleration commands. + */ +drmBufPtr RADEONCPGetBuffer( ScrnInfoPtr pScrn ) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + drmDMAReq dma; + drmBufPtr buf = NULL; + int indx = 0; + int size = 0; + int ret, i = 0; + +#if 0 + /* FIXME: pScrn->pScreen has not been initialized when this is first + called from RADEONSelectBuffer via RADEONDRICPInit. We could use + the screen index from pScrn, which is initialized, and then get + the screen from screenInfo.screens[index], but that is a hack. */ + dma.context = DRIGetContext(pScrn->pScreen); #else - OUTREGP(RADEON_DP_DATATYPE, 0, ~RADEON_HOST_BIG_ENDIAN_EN); + dma.context = 0x00000001; /* This is the X server's context */ #endif + dma.send_count = 0; + dma.send_list = NULL; + dma.send_sizes = NULL; + dma.flags = 0; + dma.request_count = 1; + dma.request_size = RADEON_BUFFER_SIZE; + dma.request_list = &indx; + dma.request_sizes = &size; + dma.granted_count = 0; + + while ( 1 ) { + do { + ret = drmDMA( info->drmFD, &dma ); + if ( ret && ret != -EBUSY ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "%s: CP GetBuffer %d\n", __FUNCTION__, ret ); + } + } while ( ( ret == -EBUSY ) && ( i++ < RADEON_TIMEOUT ) ); - RADEONWaitForFifo(pScrn, 1); - OUTREG(RADEON_DEFAULT_SC_BOTTOM_RIGHT, (RADEON_DEFAULT_SC_RIGHT_MAX - | RADEON_DEFAULT_SC_BOTTOM_MAX)); - info->dp_gui_master_cntl = - ((info->datatype << RADEON_GMC_DST_DATATYPE_SHIFT) - | RADEON_GMC_CLR_CMP_CNTL_DIS); - RADEONWaitForFifo(pScrn, 1); - OUTREG(RADEON_DP_GUI_MASTER_CNTL, (info->dp_gui_master_cntl - | RADEON_GMC_BRUSH_SOLID_COLOR - | RADEON_GMC_SRC_DATATYPE_COLOR)); + if ( ret == 0 ) { + buf = &info->buffers->list[indx]; + buf->used = 0; + if ( RADEON_VERBOSE ) { + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + " GetBuffer returning %d\n", buf->idx ); + } + return buf; + } - RADEONWaitForFifo(pScrn, 7); - OUTREG(RADEON_DST_LINE_START, 0); - OUTREG(RADEON_DST_LINE_END, 0); - OUTREG(RADEON_DP_BRUSH_FRGD_CLR, 0xffffffff); - OUTREG(RADEON_DP_BRUSH_BKGD_CLR, 0x00000000); - OUTREG(RADEON_DP_SRC_FRGD_CLR, 0xffffffff); - OUTREG(RADEON_DP_SRC_BKGD_CLR, 0x00000000); - OUTREG(RADEON_DP_WRITE_MASK, 0xffffffff); + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "GetBuffer timed out, resetting engine...\n"); + RADEONEngineReset( pScrn ); + RADEONEngineRestore( pScrn ); + + /* Always restart the engine when doing CP 2D acceleration */ + RADEONCP_RESET( pScrn, info ); + RADEONCP_START( pScrn, info ); + } +} - RADEONWaitForIdle(pScrn); +/* Flush the indirect buffer to the kernel for submission to the card. + */ +void RADEONCPFlushIndirect( ScrnInfoPtr pScrn ) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + drmBufPtr buffer = info->indirectBuffer; + int start = info->indirectStart; + int discard; + + if ( !buffer ) + return; + + if ( start == buffer->used ) + return; + + discard = ( buffer->used + RING_THRESHOLD > buffer->total ); + + drmRadeonFlushIndirectBuffer( info->drmFD, buffer->idx, + start, buffer->used, discard ); + + if ( discard ) { + info->indirectBuffer = RADEONCPGetBuffer( pScrn ); + info->indirectStart = 0; + } else { + info->indirectStart = buffer->used; + } } -#ifdef XF86DRI -/* FIXME: When direct rendering is enabled, we should use the CP to - draw 2D commands */ +/* Flush and release the indirect buffer. + */ +void RADEONCPReleaseIndirect( ScrnInfoPtr pScrn ) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + drmBufPtr buffer = info->indirectBuffer; + int start = info->indirectStart; + + info->indirectBuffer = NULL; + info->indirectStart = 0; + + if ( !buffer ) + return; + + drmRadeonFlushIndirectBuffer( info->drmFD, buffer->idx, + start, buffer->used, 1 ); +} + static void RADEONCPAccelInit(ScrnInfoPtr pScrn, XAAInfoRecPtr a) { - a->Flags = 0; + RADEONInfoPtr info = RADEONPTR(pScrn); - /* Sync */ #if 1 - a->Sync = RADEONWaitForIdle; + a->Flags = (PIXMAP_CACHE + | OFFSCREEN_PIXMAPS + | LINEAR_FRAMEBUFFER); #else - a->Sync = RADEONCCEWaitForIdle; + a->Flags = 0; /* GH: Do we really need this? */ #endif + /* Sync */ + a->Sync = RADEONCPWaitForIdle; + + /* If direct rendering is disabled, then do not enable any CP + acceleration routines */ + if (!info->directRenderingEnabled) return; + + /* Solid Filled Rectangle */ + a->PolyFillRectSolidFlags = 0; + a->SetupForSolidFill = RADEONCPSetupForSolidFill; + a->SubsequentSolidFillRect = RADEONCPSubsequentSolidFillRect; + + /* Screen-to-screen Copy */ + a->ScreenToScreenCopyFlags = 0; + a->SetupForScreenToScreenCopy = RADEONCPSetupForScreenToScreenCopy; + a->SubsequentScreenToScreenCopy = RADEONCPSubsequentScreenToScreenCopy; } #endif @@ -917,7 +1271,6 @@ a->DashedLineFlags = (LINE_PATTERN_LSBFIRST_LSBJUSTIFIED | LINE_PATTERN_POWER_OF_2_ONLY); -#if RADEON_IMAGEWRITE /* ImageWrite */ a->NumScanlineImageWriteBuffers = 1; a->ScanlineImageWriteBuffers = info->scratch_buffer; @@ -936,7 +1289,6 @@ | SCANLINE_PAD_DWORD | LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X; -#endif #if 0 /* Color 8x8 Pattern Fill */ @@ -962,9 +1314,8 @@ if (!(a = info->accel = XAACreateInfoRec())) return FALSE; #ifdef XF86DRI - /* FIXME: When direct rendering is enabled, we should use the CP to - draw 2D commands */ - if (info->CP2D) RADEONCPAccelInit(pScrn, a); + if (info->directRenderingEnabled) + RADEONCPAccelInit(pScrn, a); else #endif RADEONMMIOAccelInit(pScrn, a); Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c:1.3 Sat Nov 18 14:37:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c Sat Mar 3 17:26:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.3 2000/11/18 19:37:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_cursor.c,v 1.5 2001/03/03 22:26:10 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -109,13 +109,13 @@ { RADEONInfoPtr info = RADEONPTR(pScrn); unsigned char *RADEONMMIO = info->MMIO; - CARD32 *s = (CARD32 *)image; - CARD32 *d = (CARD32 *)(info->FB + info->cursor_start); + CARD32 *s = (pointer)image; + CARD32 *d = (pointer)(info->FB + info->cursor_start); int y; CARD32 save; save = INREG(RADEON_CRTC_GEN_CNTL); - OUTREG(RADEON_CRTC_GEN_CNTL, save & ~RADEON_CRTC_CUR_EN); + OUTREG(RADEON_CRTC_GEN_CNTL, save & (CARD32)~RADEON_CRTC_CUR_EN); #if X_BYTE_ORDER == X_BIG_ENDIAN switch(info->CurrentLayout.pixel_bytes) { Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c:1.13 --- /dev/null Mon Jun 4 12:40:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c Wed May 2 11:06:08 2001 @@ -0,0 +1,1635 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.c,v 1.13 2001/05/02 15:06:08 dawes Exp $ */ +/* + * Copyright 2000 ATI Technologies Inc., Markham, Ontario, + * VA Linux Systems Inc., Fremont, California. + * + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation on the rights to use, copy, modify, merge, + * publish, distribute, 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR + * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin <martin@valinux.com> + * Rickard E. Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * + */ + + + /* Driver data structures */ +#include "radeon.h" +#include "radeon_dri.h" +#include "radeon_reg.h" +#include "radeon_sarea.h" +#include "radeon_version.h" + + /* X and server generic header files */ +#include "xf86.h" +#include "windowstr.h" + + /* GLX/DRI/DRM definitions */ +#define _XF86DRI_SERVER_ +#include "GL/glxtokens.h" +#include "sarea.h" + +#if defined(__alpha__) +# define PCIGART_ENABLED +#else +# undef PCIGART_ENABLED +#endif + +/* ?? 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 + rendering core supports, and the intersection is exported to the + client. */ +static Bool RADEONInitVisualConfigs(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + int numConfigs = 0; + __GLXvisualConfig *pConfigs = 0; + RADEONConfigPrivPtr pRADEONConfigs = 0; + RADEONConfigPrivPtr *pRADEONConfigPtrs = 0; + int i, accum, stencil; + + switch (info->CurrentLayout.pixel_code) { + case 8: /* 8bpp mode is not support */ + case 15: /* FIXME */ + case 24: /* FIXME */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] RADEONInitVisualConfigs failed (depth %d not supported). " + "Disabling DRI.\n", info->CurrentLayout.pixel_code); + return FALSE; + +#define RADEON_USE_ACCUM 1 +#define RADEON_USE_STENCIL 1 + + case 16: + numConfigs = 1; + if (RADEON_USE_ACCUM) numConfigs *= 2; + if (RADEON_USE_STENCIL) numConfigs *= 2; + + if (!(pConfigs + = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), + numConfigs))) { + return FALSE; + } + if (!(pRADEONConfigs + = (RADEONConfigPrivPtr)xcalloc(sizeof(RADEONConfigPrivRec), + numConfigs))) { + xfree(pConfigs); + return FALSE; + } + if (!(pRADEONConfigPtrs + = (RADEONConfigPrivPtr*)xcalloc(sizeof(RADEONConfigPrivPtr), + numConfigs))) { + xfree(pConfigs); + xfree(pRADEONConfigs); + return FALSE; + } + + i = 0; + for (accum = 0; accum <= RADEON_USE_ACCUM; accum++) { + for (stencil = 0; stencil <= RADEON_USE_STENCIL; stencil++) { + pRADEONConfigPtrs[i] = &pRADEONConfigs[i]; + + pConfigs[i].vid = (VisualID)(-1); + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 5; + pConfigs[i].greenSize = 6; + pConfigs[i].blueSize = 5; + pConfigs[i].alphaSize = 0; + pConfigs[i].redMask = 0x0000F800; + pConfigs[i].greenMask = 0x000007E0; + pConfigs[i].blueMask = 0x0000001F; + pConfigs[i].alphaMask = 0x00000000; + if (accum) { /* Simulated in software */ + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 0; + } else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + pConfigs[i].doubleBuffer = TRUE; + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 16; + pConfigs[i].depthSize = 16; + if (stencil) + pConfigs[i].stencilSize = 8; /* Simulated in software */ + else + pConfigs[i].stencilSize = 0; + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if (accum || stencil) { + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + } else { + pConfigs[i].visualRating = GLX_NONE_EXT; + } + pConfigs[i].transparentPixel = GLX_NONE; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; + i++; + } + } + break; + case 32: + numConfigs = 1; + if (RADEON_USE_ACCUM) numConfigs *= 2; + if (RADEON_USE_STENCIL) numConfigs *= 2; + + if (!(pConfigs + = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), + numConfigs))) { + return FALSE; + } + if (!(pRADEONConfigs + = (RADEONConfigPrivPtr)xcalloc(sizeof(RADEONConfigPrivRec), + numConfigs))) { + xfree(pConfigs); + return FALSE; + } + if (!(pRADEONConfigPtrs + = (RADEONConfigPrivPtr*)xcalloc(sizeof(RADEONConfigPrivPtr), + numConfigs))) { + xfree(pConfigs); + xfree(pRADEONConfigs); + return FALSE; + } + + i = 0; + for (accum = 0; accum <= RADEON_USE_ACCUM; accum++) { + for (stencil = 0; stencil <= RADEON_USE_STENCIL; stencil++) { + pRADEONConfigPtrs[i] = &pRADEONConfigs[i]; + + pConfigs[i].vid = (VisualID)(-1); + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 8; + pConfigs[i].greenSize = 8; + pConfigs[i].blueSize = 8; + pConfigs[i].alphaSize = 8; + pConfigs[i].redMask = 0x00FF0000; + pConfigs[i].greenMask = 0x0000FF00; + pConfigs[i].blueMask = 0x000000FF; + pConfigs[i].alphaMask = 0xFF000000; + if (accum) { /* Simulated in software */ + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 16; + } else { + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; + } + pConfigs[i].doubleBuffer = TRUE; + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 24; + if (stencil) { + pConfigs[i].depthSize = 24; + pConfigs[i].stencilSize = 8; + } else { + pConfigs[i].depthSize = 24; + pConfigs[i].stencilSize = 0; + } + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if (accum || stencil) { + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + } else { + pConfigs[i].visualRating = GLX_NONE_EXT; + } + pConfigs[i].transparentPixel = GLX_NONE; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; + i++; + } + } + break; + } + + info->numVisualConfigs = numConfigs; + info->pVisualConfigs = pConfigs; + info->pVisualConfigsPriv = pRADEONConfigs; + GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pRADEONConfigPtrs); + return TRUE; +} + +/* Create the Radeon-specific context information */ +static Bool RADEONCreateContext(ScreenPtr pScreen, VisualPtr visual, + drmContext hwContext, void *pVisualConfigPriv, + DRIContextType contextStore) +{ +#ifdef PER_CONTEXT_SAREA + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONDRIContextPtr ctx_info; + + ctx_info = (RADEONDRIContextPtr)contextStore; + if (!ctx_info) return FALSE; + + if (drmAddMap(info->drmFD, 0, + info->perctx_sarea_size, + DRM_SHM, + DRM_REMOVABLE, + &ctx_info->sarea_handle) < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] could not create private sarea for ctx id (%d)\n", + (int)hwContext); + return FALSE; + } + + if (drmAddContextPrivateMapping(info->drmFD, hwContext, + ctx_info->sarea_handle) < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] could not associate private sarea to ctx id (%d)\n", + (int)hwContext); + drmRmMap(info->drmFD, ctx_info->sarea_handle); + return FALSE; + } + + ctx_info->ctx_id = hwContext; +#endif + return TRUE; +} + +/* Destroy the Radeon-specific context information */ +static void RADEONDestroyContext(ScreenPtr pScreen, drmContext hwContext, + DRIContextType contextStore) +{ +#ifdef PER_CONTEXT_SAREA + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONDRIContextPtr ctx_info; + + ctx_info = (RADEONDRIContextPtr) contextStore; + if (!ctx_info) return; + + if (drmRmMap(info->drmFD, ctx_info->sarea_handle) < 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] could not remove private sarea for ctx id (%d)\n", + (int)hwContext); + } +#endif +} + +/* Called when the X server is woken up to allow the last client's + context to be saved and the X server's context to be loaded. This is + not necessary for the Radeon since the client detects when it's + context is not currently loaded and then load's it itself. Since the + registers to start and stop the CP are privileged, only the X server + can start/stop the engine. */ +static void RADEONEnterServer(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + + if (info->accel) info->accel->NeedToSync = TRUE; +} + +/* Called when the X server goes to sleep to allow the X server's + context to be saved and the last client's context to be loaded. This + is not necessary for the Radeon since the client detects when it's + context is not currently loaded and then load's it itself. Since the + registers to start and stop the CP are privileged, only the X server + can start/stop the engine. */ +static void RADEONLeaveServer(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RING_LOCALS; + + /* The CP is always running, but if we've generated any CP commands + * we must flush them to the kernel module now. + */ + if (info->CPInUse) { + RADEON_FLUSH_CACHE(); + RADEON_WAIT_UNTIL_IDLE(); + RADEONCPReleaseIndirect(pScrn); + + info->CPInUse = FALSE; + } +} + +/* Contexts can be swapped by the X server if necessary. This callback + is currently only used to perform any functions necessary when + entering or leaving the X server, and in the future might not be + necessary. */ +static void RADEONDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, + DRIContextType oldContextType, + void *oldContext, + DRIContextType newContextType, + void *newContext) +{ + if ((syncType==DRI_3D_SYNC) && (oldContextType==DRI_2D_CONTEXT) && + (newContextType==DRI_2D_CONTEXT)) { /* Entering from Wakeup */ + RADEONEnterServer(pScreen); + } + if ((syncType==DRI_2D_SYNC) && (oldContextType==DRI_NO_CONTEXT) && + (newContextType==DRI_2D_CONTEXT)) { /* Exiting from Block Handler */ + RADEONLeaveServer(pScreen); + } +} + +/* The Radeon has depth tiling on all the time, so we have to convert + * the x,y coordinates into the memory bus address (mba) in the same + * manner as the engine. In each case, the linear block address (ba) + * is calculated, and then wired with x and y to produce the final + * memory address. + */ +static CARD32 radeon_mba_z16(RADEONInfoPtr info, + int x, int y) +{ + CARD32 pitch = info->frontPitch; + CARD32 ba, address = 0; /* a[0] = 0 */ + + ba = (y / 16) * (pitch / 32) + (x / 32); + + address |= (x & 0x7) << 1; /* a[1..3] = x[0..2] */ + address |= (y & 0x7) << 4; /* a[4..6] = y[0..2] */ + address |= (x & 0x8) << 4; /* a[7] = x[3] */ + address |= (ba & 0x3) << 8; /* a[8..9] = ba[0..1] */ + address |= (y & 0x8) << 7; /* a[10] = y[3] */ + address |= ((x & 0x10) ^ (y & 0x10)) << 7; /* a[11] = x[4] ^ y[4] */ + address |= (ba & ~0x3u) << 10; /* a[12..] = ba[2..] */ + + return address; +} + +static CARD32 radeon_mba_z32(RADEONInfoPtr info, + int x, int y) +{ + CARD32 pitch = info->frontPitch; + CARD32 ba, address = 0; /* a[0..1] = 0 */ + + ba = (y / 16) * (pitch / 16) + (x / 16); + + address |= (x & 0x7) << 2; /* a[2..4] = x[0..2] */ + address |= (y & 0x3) << 5; /* a[5..6] = y[0..1] */ + address |= + (((x & 0x10) >> 2) ^ (y & 0x4)) << 5; /* a[7] = x[4] ^ y[2] */ + address |= (ba & 0x3) << 8; /* a[8..9] = ba[0..1] */ + + address |= (y & 0x8) << 7; /* a[10] = y[3] */ + address |= + (((x & 0x8) << 1) ^ (y & 0x10)) << 7; /* a[11] = x[3] ^ y[4] */ + address |= (ba & ~0x3u) << 10; /* a[12..] = ba[2..] */ + + return address; +} + +/* 16-bit depth buffer functions */ +#define WRITE_DEPTH16(_x, _y, d) \ + *(CARD16 *)(pointer)(buf + radeon_mba_z16(info, (_x), (_y))) = (d) + +#define READ_DEPTH16(d, _x, _y) \ + (d) = *(CARD16 *)(pointer)(buf + radeon_mba_z16(info, (_x), (_y))) + +/* 24 bit depth, 8 bit stencil depthbuffer functions */ +#define WRITE_DEPTH32(_x, _y, d) \ +do { \ + CARD32 tmp = \ + *(CARD32 *)(pointer)(buf + radeon_mba_z32(info, (_x), (_y))); \ + tmp &= 0xff000000; \ + tmp |= ((d) & 0x00ffffff); \ + *(CARD32 *)(pointer)(buf + radeon_mba_z32(info, (_x), (_y))) = tmp; \ +} while (0) + +#define READ_DEPTH32(d, _x, _y) \ + d = *(CARD32 *)(pointer)(buf + radeon_mba_z32(info, (_x), (_y))) & 0x00ffffff + +/* Screen to screen copy of data in the depth buffer */ +static void RADEONScreenToScreenCopyDepth(ScrnInfoPtr pScrn, + int xa, int ya, + int xb, int yb, + int w, int h) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + int xstart, xend, xdir; + int ystart, yend, ydir; + int x, y, d; + unsigned char *buf = info->FB + info->depthOffset; + + if (xa < xb) xdir = -1, xstart = w-1, xend = 0; + else xdir = 1, xstart = 0, xend = w-1; + + if (ya < yb) ydir = -1, ystart = h-1, yend = 0; + else ydir = 1, ystart = 0, yend = h-1; + + switch (pScrn->bitsPerPixel) { + case 16: + for (x = xstart; x != xend; x += xdir) { + for (y = ystart; y != yend; y += ydir) { + READ_DEPTH16(d, xa+x, ya+y); + WRITE_DEPTH16(xb+x, yb+y, d); + } + } + break; + case 32: + for (x = xstart; x != xend; x += xdir) { + for (y = ystart; y != yend; y += ydir) { + READ_DEPTH32(d, xa+x, ya+y); + WRITE_DEPTH32(xb+x, yb+y, d); + } + } + break; + default: break; + } +} + +/* Initialize the state of the back and depth buffers. */ +static void RADEONDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 indx) +{ + /* FIXME: This routine needs to have acceleration turned on */ + ScreenPtr pScreen = pWin->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONSAREAPrivPtr pSAREAPriv; + BoxPtr pbox; + int nbox; + unsigned int color, depth; + unsigned int color_mask, depth_mask; + + /* FIXME: This should be based on the __GLXvisualConfig info */ + color = 0; + switch (pScrn->bitsPerPixel) { + case 16: + depth = 0x0000ffff; + color_mask = 0x0000ffff; + depth_mask = 0xffffffff; + break; + case 32: + depth = 0x00ffffff; + color_mask = 0xffffffff; + depth_mask = 0xffffffff; + break; + default: + depth = 0x00000000; + color_mask = 0x00000000; + depth_mask = 0x00000000; + break; + } + + /* FIXME: Copy XAAPaintWindow() and use REGION_TRANSLATE() */ + /* FIXME: Only initialize the back and depth buffers for contexts + that request them */ + + FLUSH_RING(); + + pSAREAPriv = (RADEONSAREAPrivPtr)DRIGetSAREAPrivate(pScreen); + + pbox = REGION_RECTS(prgn); + nbox = REGION_NUM_RECTS(prgn); + + for (; nbox; nbox--, pbox++) { + int ret; + + /* drmRadeonClear uses the clip rects to draw instead of the + rect passed to it; however, it uses the rect for the depth + clears */ + pSAREAPriv->boxes[0].x1 = pbox->x1; + pSAREAPriv->boxes[0].x2 = pbox->x2; + pSAREAPriv->boxes[0].y1 = pbox->y1; + pSAREAPriv->boxes[0].y2 = pbox->y2; + pSAREAPriv->nbox = 1; + + ret = drmRadeonClear(info->drmFD, + DRM_RADEON_BACK | DRM_RADEON_DEPTH, + color, depth, color_mask, depth_mask, + pSAREAPriv->boxes, pSAREAPriv->nbox); + if (ret) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[dri] DRIInitBuffers timed out, resetting engine...\n"); + RADEONEngineReset(pScrn); + RADEONEngineRestore(pScrn); + RADEONCP_RESET(pScrn, info); + RADEONCP_START(pScrn, info); + return; + } + } + + /* Mark the X server as the last context owner */ + pSAREAPriv->ctxOwner = DRIGetContext(pScreen); + + RADEONSelectBuffer(pScrn, RADEON_FRONT); + info->accel->NeedToSync = TRUE; +} + +/* Copy the back and depth buffers when the X server moves a window. + * + * This routine is a modified form of XAADoBitBlt with the calls to + * ScreenToScreenBitBlt built in. My routine has the prgnSrc as source + * instead of destination. My origin is upside down so the ydir cases + * are reversed. + */ +static void RADEONDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 indx) +{ + ScreenPtr pScreen = pParent->drawable.pScreen; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + + BoxPtr pboxTmp, pboxNext, pboxBase; + DDXPointPtr pptTmp; + int xdir, ydir; + + int screenwidth = pScrn->virtualX; + int screenheight = pScrn->virtualY; + + BoxPtr pbox = REGION_RECTS(prgnSrc); + int nbox = REGION_NUM_RECTS(prgnSrc); + + BoxPtr pboxNew1 = NULL; + BoxPtr pboxNew2 = NULL; + DDXPointPtr pptNew1 = NULL; + DDXPointPtr pptNew2 = NULL; + DDXPointPtr pptSrc = &ptOldOrg; + + int dx = pParent->drawable.x - ptOldOrg.x; + int dy = pParent->drawable.y - ptOldOrg.y; + + /* If the copy will overlap in Y, reverse the order */ + if (dy > 0) { + ydir = -1; + + if (nbox > 1) { + /* Keep ordering in each band, reverse order of bands */ + pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); + if (!pboxNew1) return; + pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); + if (!pptNew1) { + DEALLOCATE_LOCAL(pboxNew1); + return; + } + pboxBase = pboxNext = pbox+nbox-1; + while (pboxBase >= pbox) { + while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) + pboxNext--; + pboxTmp = pboxNext+1; + pptTmp = pptSrc + (pboxTmp - pbox); + while (pboxTmp <= pboxBase) { + *pboxNew1++ = *pboxTmp++; + *pptNew1++ = *pptTmp++; + } + pboxBase = pboxNext; + } + pboxNew1 -= nbox; + pbox = pboxNew1; + pptNew1 -= nbox; + pptSrc = pptNew1; + } + } else { + /* No changes required */ + ydir = 1; + } + + /* If the regions will overlap in X, reverse the order */ + if (dx > 0) { + xdir = -1; + + if (nbox > 1) { + /* reverse order of rects in each band */ + pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); + pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); + if (!pboxNew2 || !pptNew2) { + DEALLOCATE_LOCAL(pptNew2); + DEALLOCATE_LOCAL(pboxNew2); + DEALLOCATE_LOCAL(pptNew1); + DEALLOCATE_LOCAL(pboxNew1); + return; + } + pboxBase = pboxNext = pbox; + while (pboxBase < pbox+nbox) { + while ((pboxNext < pbox+nbox) + && (pboxNext->y1 == pboxBase->y1)) + pboxNext++; + pboxTmp = pboxNext; + pptTmp = pptSrc + (pboxTmp - pbox); + while (pboxTmp != pboxBase) { + *pboxNew2++ = *--pboxTmp; + *pptNew2++ = *--pptTmp; + } + pboxBase = pboxNext; + } + pboxNew2 -= nbox; + pbox = pboxNew2; + pptNew2 -= nbox; + pptSrc = pptNew2; + } + } else { + /* No changes are needed */ + xdir = 1; + } + + (*info->accel->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, + (CARD32)(-1), -1); + + for (; nbox-- ; pbox++) { + int xa = pbox->x1; + int ya = pbox->y1; + int destx = xa + dx; + int desty = ya + dy; + int w = pbox->x2 - xa + 1; + int h = pbox->y2 - ya + 1; + + if (destx < 0) xa -= destx, w += destx, destx = 0; + if (desty < 0) ya -= desty, h += desty, desty = 0; + if (destx + w > screenwidth) w = screenwidth - destx; + if (desty + h > screenheight) h = screenheight - desty; + + if (w <= 0) continue; + if (h <= 0) continue; + + RADEONSelectBuffer(pScrn, RADEON_BACK); + (*info->accel->SubsequentScreenToScreenCopy)(pScrn, + xa, ya, + destx, desty, + w, h); + RADEONSelectBuffer(pScrn, RADEON_DEPTH); + + if (info->depthMoves) + RADEONScreenToScreenCopyDepth(pScrn, + xa, ya, + destx, desty, + w, h); + } + + RADEONSelectBuffer(pScrn, RADEON_FRONT); + + DEALLOCATE_LOCAL(pptNew2); + DEALLOCATE_LOCAL(pboxNew2); + DEALLOCATE_LOCAL(pptNew1); + DEALLOCATE_LOCAL(pboxNew1); + + info->accel->NeedToSync = TRUE; +} + +/* Initialize the AGP state. Request memory for use in AGP space, and + initialize the Radeon registers to point to that memory. */ +static Bool RADEONDRIAgpInit(RADEONInfoPtr info, ScreenPtr pScreen) +{ + unsigned char *RADEONMMIO = info->MMIO; + unsigned long mode; + unsigned int vendor, device; + int ret; + int s, l; + + if (drmAgpAcquire(info->drmFD) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] AGP not available\n"); + return FALSE; + } + + /* Modify the mode if the default mode is + not appropriate for this particular + combination of graphics card and AGP + chipset. */ + + mode = drmAgpGetMode(info->drmFD); /* Default mode */ + vendor = drmAgpVendorId(info->drmFD); + device = drmAgpDeviceId(info->drmFD); + + mode &= ~RADEON_AGP_MODE_MASK; + switch (info->agpMode) { + case 4: mode |= RADEON_AGP_4X_MODE; + case 2: mode |= RADEON_AGP_2X_MODE; + case 1: default: mode |= RADEON_AGP_1X_MODE; + } + + xf86DrvMsg(pScreen->myNum, X_INFO, + "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n", + mode, vendor, device, + info->PciInfo->vendor, + info->PciInfo->chipType); + + if (drmAgpEnable(info->drmFD, mode) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] AGP not enabled\n"); + drmAgpRelease(info->drmFD); + return FALSE; + } + + info->agpOffset = 0; + + if ((ret = drmAgpAlloc(info->drmFD, info->agpSize*1024*1024, 0, NULL, + &info->agpMemHandle)) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Out of memory (%d)\n", ret); + drmAgpRelease(info->drmFD); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[agp] %d kB allocated with handle 0x%08x\n", + info->agpSize*1024, info->agpMemHandle); + + if (drmAgpBind(info->drmFD, + info->agpMemHandle, info->agpOffset) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Could not bind\n"); + drmAgpFree(info->drmFD, info->agpMemHandle); + drmAgpRelease(info->drmFD); + return FALSE; + } + + /* Initialize the CP 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; + + /* Reserve the rest for AGP textures */ + info->agpTexStart = info->bufStart + info->bufMapSize; + s = (info->agpSize*1024*1024 - info->agpTexStart); + l = RADEONMinBits((s-1) / RADEON_NR_TEX_REGIONS); + if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY; + info->agpTexMapSize = (s >> l) << l; + info->log2AGPTexGran = l; + + if (drmAddMap(info->drmFD, info->ringStart, info->ringMapSize, + DRM_AGP, DRM_READ_ONLY, &info->ringHandle) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[agp] Could not add ring mapping\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[agp] ring handle = 0x%08lx\n", info->ringHandle); + + if (drmMap(info->drmFD, info->ringHandle, info->ringMapSize, + (drmAddressPtr)&info->ring) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] Could not map ring\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[agp] Ring mapped at 0x%08lx\n", + (unsigned long)info->ring); + + if (drmAddMap(info->drmFD, info->ringReadOffset, info->ringReadMapSize, + DRM_AGP, DRM_READ_ONLY, &info->ringReadPtrHandle) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[agp] Could not add ring read ptr mapping\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[agp] 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, + "[agp] Could not map ring read ptr\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[agp] Ring read ptr mapped at 0x%08lx\n", + (unsigned long)info->ringReadPtr); + + if (drmAddMap(info->drmFD, info->bufStart, info->bufMapSize, + DRM_AGP, 0, &info->bufHandle) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[agp] Could not add vertex/indirect buffers mapping\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[agp] 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, + "[agp] Could not map vertex/indirect buffers\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[agp] Vertex/indirect buffers mapped at 0x%08lx\n", + (unsigned long)info->buf); + + if (drmAddMap(info->drmFD, info->agpTexStart, info->agpTexMapSize, + DRM_AGP, 0, &info->agpTexHandle) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[agp] Could not add AGP texture map mapping\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[agp] AGP texture map handle = 0x%08lx\n", + info->agpTexHandle); + + if (drmMap(info->drmFD, info->agpTexHandle, info->agpTexMapSize, + (drmAddressPtr)&info->agpTex) < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[agp] Could not map AGP texture map\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[agp] AGP Texture map mapped at 0x%08lx\n", + (unsigned long)info->agpTex); + + /* Initialize Radeon's AGP registers */ + /* Ring buffer is at AGP offset 0 */ + OUTREG(RADEON_AGP_BASE, info->ringHandle); + + /* Enable bus mastering in PCI config + space */ + xf86EnablePciBusMaster(info->PciInfo, TRUE); + + return TRUE; +} + +#if defined(PCIGART_ENABLED) +/* 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) +{ + 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; +} +#endif + +/* Add a map for the MMIO registers that will be accessed by any + DRI-based clients. */ +static Bool RADEONDRIMapInit(RADEONInfoPtr info, ScreenPtr pScreen) +{ + /* Map registers */ + info->registerSize = RADEON_MMIOSIZE; + if (drmAddMap(info->drmFD, info->MMIOAddr, info->registerSize, + DRM_REGISTERS, DRM_READ_ONLY, &info->registerHandle) < 0) { + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[drm] register handle = 0x%08lx\n", info->registerHandle); + + return TRUE; +} + +/* Initialize the kernel data structures. */ +static int RADEONDRIKernelInit(RADEONInfoPtr info, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + int cpp = info->CurrentLayout.pixel_bytes; + drmRadeonInit drmInfo; + + drmInfo.sarea_priv_offset = sizeof(XF86DRISAREARec); + drmInfo.is_pci = info->IsPCI; + drmInfo.cp_mode = info->CPMode; + drmInfo.agp_size = info->agpSize*1024*1024; + drmInfo.ring_size = info->ringSize*1024*1024; + drmInfo.usec_timeout = info->CPusecTimeout; + + drmInfo.fb_bpp = info->CurrentLayout.pixel_code; + drmInfo.depth_bpp = info->CurrentLayout.pixel_code; + + drmInfo.front_offset = info->frontOffset; + drmInfo.front_pitch = info->frontPitch * cpp; + drmInfo.back_offset = info->backOffset; + drmInfo.back_pitch = info->backPitch * cpp; + drmInfo.depth_offset = info->depthOffset; + drmInfo.depth_pitch = info->depthPitch * cpp; + + drmInfo.fb_offset = info->LinearAddr; + drmInfo.mmio_offset = info->registerHandle; + drmInfo.ring_offset = info->ringHandle; + drmInfo.ring_rptr_offset = info->ringReadPtrHandle; + drmInfo.buffers_offset = info->bufHandle; + drmInfo.agp_textures_offset = info->agpTexHandle; + + if (drmRadeonInitCP(info->drmFD, &drmInfo) < 0) return FALSE; + + /* drmRadeonInitCP does an engine reset, which resets some engine + registers back to their default values, so we need to restore + those engine register here. */ + RADEONEngineRestore(pScrn); + + return TRUE; +} + +/* Add a map for the vertex buffers that will be accessed by any + DRI-based clients. */ +static Bool RADEONDRIBufInit(RADEONInfoPtr info, ScreenPtr pScreen) +{ + /* Initialize vertex buffers */ + if (info->IsPCI) { +#if !defined(PCIGART_ENABLED) + 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; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[drm] Added %d %d byte vertex/indirect buffers\n", + info->bufNumBufs, RADEON_BUFFER_SIZE); + + if (!(info->buffers = drmMapBufs(info->drmFD))) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] Failed to map vertex/indirect buffers list\n"); + return FALSE; + } + xf86DrvMsg(pScreen->myNum, X_INFO, + "[drm] Mapped %d vertex/indirect buffers\n", + info->buffers->count); + + return TRUE; +} + +/* Initialize the CP state, and start the CP (if used by the X server) */ +static void RADEONDRICPInit(ScrnInfoPtr pScrn) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + + /* Turn on bus mastering */ + info->BusCntl &= ~RADEON_BUS_MASTER_DIS; + + /* Make sure the CP is on for the X server */ + RADEONCP_START(pScrn, info); + RADEONSelectBuffer(pScrn, RADEON_FRONT); +} + +/* Initialize the DRI specific hardware state stored in the SAREA. + Currently, this involves setting up the 3D hardware state. */ +static void RADEONDRISAREAInit(ScreenPtr pScreen, + RADEONSAREAPrivPtr pSAREAPriv) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + radeon_context_regs_t *ctx; + radeon_texture_regs_t *tex; + CARD32 color_fmt, depth_fmt; + int i; + + switch (info->CurrentLayout.pixel_code) { + case 16: + color_fmt = RADEON_COLOR_FORMAT_RGB565; + depth_fmt = RADEON_DEPTH_FORMAT_16BIT_INT_Z; + break; + case 32: + color_fmt = RADEON_COLOR_FORMAT_ARGB8888; + depth_fmt = RADEON_DEPTH_FORMAT_24BIT_INT_Z; + break; + default: + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] RADEONDRISAREAInit failed: Unsupported depth (%d bpp). Disabling DRI.\n", + info->CurrentLayout.pixel_code); + return; + } + + /* Initialize the context state */ + ctx = &pSAREAPriv->ContextState; + + ctx->pp_misc = (RADEON_ALPHA_TEST_PASS | + RADEON_CHROMA_FUNC_FAIL | + RADEON_CHROMA_KEY_NEAREST | + RADEON_SHADOW_FUNC_EQUAL | + RADEON_SHADOW_PASS_1 | + RADEON_RIGHT_HAND_CUBE_OGL); + + ctx->pp_fog_color = ((0x00000000 & RADEON_FOG_COLOR_MASK) | + RADEON_FOG_VERTEX | + RADEON_FOG_USE_DEPTH); + + ctx->re_solid_color = 0x00000000; + + ctx->rb3d_blendcntl = (RADEON_SRC_BLEND_GL_ONE | + RADEON_DST_BLEND_GL_ZERO ); + + ctx->rb3d_depthoffset = info->depthOffset; + + ctx->rb3d_depthpitch = ((info->depthPitch & RADEON_DEPTHPITCH_MASK) | + RADEON_DEPTH_ENDIAN_NO_SWAP); + + ctx->rb3d_zstencilcntl = (depth_fmt | + RADEON_Z_TEST_LESS | + RADEON_STENCIL_TEST_ALWAYS | + RADEON_STENCIL_S_FAIL_KEEP | + RADEON_STENCIL_ZPASS_KEEP | + RADEON_STENCIL_ZFAIL_KEEP | + RADEON_Z_WRITE_ENABLE); + + ctx->pp_cntl = (RADEON_SCISSOR_ENABLE | + RADEON_ANTI_ALIAS_NONE); + + ctx->rb3d_cntl = (RADEON_PLANE_MASK_ENABLE | + color_fmt | + RADEON_ZBLOCK16); + + ctx->rb3d_coloroffset = (info->backOffset & RADEON_COLOROFFSET_MASK); + + ctx->re_width_height = ((0x7ff << RADEON_RE_WIDTH_SHIFT) | + (0x7ff << RADEON_RE_HEIGHT_SHIFT)); + + ctx->rb3d_colorpitch = ((info->backPitch & RADEON_COLORPITCH_MASK) | + RADEON_COLOR_ENDIAN_NO_SWAP); + + ctx->se_cntl = (RADEON_FFACE_CULL_CW | + RADEON_BFACE_SOLID | + RADEON_FFACE_SOLID | + RADEON_FLAT_SHADE_VTX_LAST | + RADEON_DIFFUSE_SHADE_GOURAUD | + RADEON_ALPHA_SHADE_GOURAUD | + RADEON_SPECULAR_SHADE_GOURAUD | + RADEON_FOG_SHADE_GOURAUD | + RADEON_VPORT_XY_XFORM_ENABLE | + RADEON_VTX_PIX_CENTER_OGL | + RADEON_ROUND_MODE_TRUNC | + RADEON_ROUND_PREC_8TH_PIX); + + ctx->se_coord_fmt = (RADEON_VTX_XY_PRE_MULT_1_OVER_W0 | + RADEON_VTX_Z_PRE_MULT_1_OVER_W0 | + RADEON_TEX1_W_ROUTING_USE_Q1); + + ctx->re_line_pattern = ((0x0000 & RADEON_LINE_PATTERN_MASK) | + (0 << RADEON_LINE_REPEAT_COUNT_SHIFT) | + (0 << RADEON_LINE_PATTERN_START_SHIFT) | + RADEON_LINE_PATTERN_LITTLE_BIT_ORDER); + + ctx->re_line_state = ((0 << RADEON_LINE_CURRENT_PTR_SHIFT) | + (0 << RADEON_LINE_CURRENT_COUNT_SHIFT)); + + ctx->se_line_width = 0x0000000; + + ctx->pp_lum_matrix = 0x00000000; + + ctx->pp_rot_matrix_0 = 0x00000000; + ctx->pp_rot_matrix_1 = 0x00000000; + + ctx->rb3d_stencilrefmask = + (CARD32)((0x000 << RADEON_STENCIL_REF_SHIFT) | + (0x0ff << RADEON_STENCIL_MASK_SHIFT) | + (0x0ff << RADEON_STENCIL_WRITEMASK_SHIFT)); + + ctx->rb3d_ropcntl = 0x00000000; + ctx->rb3d_planemask = 0xffffffff; + + ctx->se_vport_xscale = 0x00000000; + ctx->se_vport_xoffset = 0x00000000; + ctx->se_vport_yscale = 0x00000000; + ctx->se_vport_yoffset = 0x00000000; + ctx->se_vport_zscale = 0x00000000; + ctx->se_vport_zoffset = 0x00000000; + + ctx->se_cntl_status = (RADEON_VC_NO_SWAP | + RADEON_TCL_BYPASS); + +#ifdef TCL_ENABLE + /* FIXME: Obviously these need to be properly initialized */ + ctx->se_tcl_material_emmissive.red = 0x00000000; + ctx->se_tcl_material_emmissive.green = 0x00000000; + ctx->se_tcl_material_emmissive.blue = 0x00000000; + ctx->se_tcl_material_emmissive.alpha = 0x00000000; + + ctx->se_tcl_material_ambient.red = 0x00000000; + ctx->se_tcl_material_ambient.green = 0x00000000; + ctx->se_tcl_material_ambient.blue = 0x00000000; + ctx->se_tcl_material_ambient.alpha = 0x00000000; + + ctx->se_tcl_material_diffuse.red = 0x00000000; + ctx->se_tcl_material_diffuse.green = 0x00000000; + ctx->se_tcl_material_diffuse.blue = 0x00000000; + ctx->se_tcl_material_diffuse.alpha = 0x00000000; + + ctx->se_tcl_material_specular.red = 0x00000000; + ctx->se_tcl_material_specular.green = 0x00000000; + ctx->se_tcl_material_specular.blue = 0x00000000; + ctx->se_tcl_material_specular.alpha = 0x00000000; + + ctx->se_tcl_shininess = 0x00000000; + ctx->se_tcl_output_vtx_fmt = 0x00000000; + ctx->se_tcl_output_vtx_sel = 0x00000000; + ctx->se_tcl_matrix_select_0 = 0x00000000; + ctx->se_tcl_matrix_select_1 = 0x00000000; + ctx->se_tcl_ucp_vert_blend_ctl = 0x00000000; + ctx->se_tcl_texture_proc_ctl = 0x00000000; + ctx->se_tcl_light_model_ctl = 0x00000000; + for ( i = 0 ; i < 4 ; i++ ) { + ctx->se_tcl_per_light_ctl[i] = 0x00000000; + } +#endif + + ctx->re_top_left = ((0 << RADEON_RE_LEFT_SHIFT) | + (0 << RADEON_RE_TOP_SHIFT) ); + + ctx->re_misc = ((0 << RADEON_STIPPLE_X_OFFSET_SHIFT) | + (0 << RADEON_STIPPLE_Y_OFFSET_SHIFT) | + RADEON_STIPPLE_LITTLE_BIT_ORDER); + + /* Initialize the texture state */ + for (i = 0; i < RADEON_MAX_TEXTURE_UNITS; i++) { + tex = &pSAREAPriv->TexState[i]; + + tex->pp_txfilter = 0x00000000; + tex->pp_txformat = 0x00000000; + tex->pp_txoffset = 0x00000000; + tex->pp_txcblend = 0x00000000; + tex->pp_txablend = 0x00000000; + tex->pp_tfactor = 0x00000000; + tex->pp_border_color = 0x00000000; + } + + /* Mark the context as dirty */ + pSAREAPriv->dirty = RADEON_UPLOAD_ALL; + + /* Mark the X server as the last context owner */ + pSAREAPriv->ctxOwner = DRIGetContext(pScreen); +} + +/* Initialize the screen-specific data structures for the DRI and the + Radeon. This is the main entry point to the device-specific + initialization code. It calls device-independent DRI functions to + create the DRI data structures and initialize the DRI state. */ +Bool RADEONDRIScreenInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + DRIInfoPtr pDRIInfo; + RADEONDRIPtr pRADEONDRI; + int major, minor, patch; + drmVersionPtr version; + + /* Check that the GLX, DRI, and DRM modules have been loaded by testing + * for known symbols in each module. */ + if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE; + if (!xf86LoaderCheckSymbol("DRIScreenInit")) return FALSE; + if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE; + if (!xf86LoaderCheckSymbol("DRIQueryVersion")) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] RADEONDRIScreenInit failed (libdri.a too old)\n"); + return FALSE; + } + + /* Check the DRI version */ + DRIQueryVersion(&major, &minor, &patch); + if (major != 4 || minor < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] RADEONDRIScreenInit failed because of a version mismatch.\n" + "[dri] libDRI version is %d.%d.%d but version 4.0.x is needed.\n" + "[dri] Disabling DRI.\n", + major, minor, patch); + return FALSE; + } + + switch (info->CurrentLayout.pixel_code) { + case 8: + case 15: + case 24: + /* These modes are not supported (yet). */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] RADEONInitVisualConfigs failed (depth %d not supported). " + "Disabling DRI.\n", info->CurrentLayout.pixel_code); + return FALSE; + + /* Only 16 and 32 color depths are supports currently. */ + case 16: + case 32: + break; + } + + /* Create the DRI data structure, and fill it in before calling the + DRIScreenInit(). */ + if (!(pDRIInfo = DRICreateInfoRec())) return FALSE; + + info->pDRIInfo = pDRIInfo; + pDRIInfo->drmDriverName = RADEON_DRIVER_NAME; + pDRIInfo->clientDriverName = RADEON_DRIVER_NAME; + pDRIInfo->busIdString = xalloc(64); + sprintf(pDRIInfo->busIdString, + "PCI:%d:%d:%d", + info->PciInfo->bus, + info->PciInfo->device, + info->PciInfo->func); + pDRIInfo->ddxDriverMajorVersion = RADEON_VERSION_MAJOR; + pDRIInfo->ddxDriverMinorVersion = RADEON_VERSION_MINOR; + pDRIInfo->ddxDriverPatchVersion = RADEON_VERSION_PATCH; + pDRIInfo->frameBufferPhysicalAddress = info->LinearAddr; + pDRIInfo->frameBufferSize = info->FbMapSize; + pDRIInfo->frameBufferStride = (pScrn->displayWidth * + info->CurrentLayout.pixel_bytes); + pDRIInfo->ddxDrawableTableEntry = RADEON_MAX_DRAWABLES; + pDRIInfo->maxDrawableTableEntry = (SAREA_MAX_DRAWABLES + < RADEON_MAX_DRAWABLES + ? SAREA_MAX_DRAWABLES + : RADEON_MAX_DRAWABLES); +#ifdef PER_CONTEXT_SAREA + /* This is only here for testing per-context SAREAs. When used, the + magic number below would be properly defined in a header file. */ + info->perctx_sarea_size = 64 * 1024; +#endif + +#ifdef NOT_DONE + /* FIXME: Need to extend DRI protocol to pass this size back to + * client for SAREA mapping that includes a device private record + */ + pDRIInfo->SAREASize = + ((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); /* round to page */ + /* + shared memory device private rec */ +#else + /* For now the mapping works by using a fixed size defined + * in the SAREA header + */ + if (sizeof(XF86DRISAREARec)+sizeof(RADEONSAREAPriv)>SAREA_MAX) { + ErrorF("Data does not fit in SAREA\n"); + return FALSE; + } + pDRIInfo->SAREASize = SAREA_MAX; +#endif + + if (!(pRADEONDRI = (RADEONDRIPtr)xcalloc(sizeof(RADEONDRIRec),1))) { + DRIDestroyInfoRec(info->pDRIInfo); + info->pDRIInfo = NULL; + return FALSE; + } + pDRIInfo->devPrivate = pRADEONDRI; + pDRIInfo->devPrivateSize = sizeof(RADEONDRIRec); + pDRIInfo->contextSize = sizeof(RADEONDRIContextRec); + + pDRIInfo->CreateContext = RADEONCreateContext; + pDRIInfo->DestroyContext = RADEONDestroyContext; + pDRIInfo->SwapContext = RADEONDRISwapContext; + pDRIInfo->InitBuffers = RADEONDRIInitBuffers; + pDRIInfo->MoveBuffers = RADEONDRIMoveBuffers; + pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; + + if (!DRIScreenInit(pScreen, pDRIInfo, &info->drmFD)) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] DRIScreenInit failed. Disabling DRI.\n"); + xfree(pDRIInfo->devPrivate); + pDRIInfo->devPrivate = NULL; + DRIDestroyInfoRec(pDRIInfo); + pDRIInfo = NULL; + return FALSE; + } + + /* Check the radeon DRM version */ + version = drmGetVersion(info->drmFD); + if (version) { + if (version->version_major != 1 || + version->version_minor < 1) { + /* incompatible drm version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] RADEONDRIScreenInit failed because of a version mismatch.\n" + "[dri] radeon.o kernel module version is %d.%d.%d but version 1.1.x is needed.\n" + "[dri] Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + drmFreeVersion(version); + RADEONDRICloseScreen(pScreen); + return FALSE; + } + drmFreeVersion(version); + } + +#if !defined(PCIGART_ENABLED) + /* Initialize AGP */ + if (!info->IsPCI && !RADEONDRIAgpInit(info, pScreen)) { + RADEONDRICloseScreen(pScreen); + return FALSE; + } + + /* Initialize PCI */ + if (info->IsPCI) { + xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] PCI cards not yet supported. Disabling DRI.\n"); + RADEONDRICloseScreen(pScreen); + return FALSE; + } +#else + /* Initialize AGP */ + if (!info->IsPCI && !RADEONDRIAgpInit(info, pScreen)) { + info->IsPCI = TRUE; + xf86DrvMsg(pScreen->myNum, X_WARNING, + "[agp] AGP failed to initialize -- falling back to PCI mode.\n"); + xf86DrvMsg(pScreen->myNum, X_WARNING, + "[agp] Make sure you have the agpgart kernel module loaded.\n"); + } + + /* Initialize PCI */ + if (info->IsPCI && !RADEONDRIPciInit(info, pScreen)) { + RADEONDRICloseScreen(pScreen); + return FALSE; + } +#endif + + /* DRIScreenInit doesn't add all the + common mappings. Add additional + mappings here. */ + if (!RADEONDRIMapInit(info, pScreen)) { + RADEONDRICloseScreen(pScreen); + return FALSE; + } + + /* FIXME: When are these mappings unmapped? */ + + if (!RADEONInitVisualConfigs(pScreen)) { + RADEONDRICloseScreen(pScreen); + return FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] Visual configs initialized\n"); + + return TRUE; +} + +/* Finish initializing the device-dependent DRI state, and call + DRIFinishScreenInit() to complete the device-independent DRI + initialization. */ +Bool RADEONDRIFinishScreenInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + RADEONSAREAPrivPtr pSAREAPriv; + RADEONDRIPtr pRADEONDRI; + + info->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; + /* info->pDRIInfo->driverSwapMethod = DRI_SERVER_SWAP; */ + + /* NOTE: DRIFinishScreenInit must be called before *DRIKernelInit + because *DRIKernelInit requires that the hardware lock is held by + the X server, and the first time the hardware lock is grabbed is + in DRIFinishScreenInit. */ + if (!DRIFinishScreenInit(pScreen)) { + RADEONDRICloseScreen(pScreen); + return FALSE; + } + + /* Initialize the kernel data structures */ + if (!RADEONDRIKernelInit(info, pScreen)) { + RADEONDRICloseScreen(pScreen); + return FALSE; + } + + /* Initialize the vertex buffers list */ + if (!RADEONDRIBufInit(info, pScreen)) { + RADEONDRICloseScreen(pScreen); + return FALSE; + } + + /* Initialize and start the CP if required */ + RADEONDRICPInit(pScrn); + + /* Initialize the SAREA private data structure */ + pSAREAPriv = (RADEONSAREAPrivPtr)DRIGetSAREAPrivate(pScreen); + memset(pSAREAPriv, 0, sizeof(*pSAREAPriv)); + + RADEONDRISAREAInit(pScreen, pSAREAPriv); + + 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->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->registerHandle = info->registerHandle; + pRADEONDRI->registerSize = info->registerSize; + + 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->sarea_priv_offset = sizeof(XF86DRISAREARec); + +#ifdef PER_CONTEXT_SAREA + /* Set per-context SAREA size */ + pRADEONDRI->perctx_sarea_size = info->perctx_sarea_size; +#endif + + return TRUE; +} + +/* The screen is being closed, so clean up any state and free any + resources used by the DRI. */ +void RADEONDRICloseScreen(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + RADEONInfoPtr info = RADEONPTR(pScrn); + + /* Stop the CP */ + if (info->directRenderingEnabled) { + RADEONCP_STOP(pScrn, info); + } + + /* De-allocate vertex buffers */ + if (info->buffers) { + drmUnmapBufs(info->buffers); + info->buffers = NULL; + } + + /* De-allocate all kernel resources */ + drmRadeonCleanupCP(info->drmFD); + + /* De-allocate all AGP resources */ + if (info->agpTex) { + drmUnmap(info->agpTex, info->agpTexMapSize); + info->agpTex = NULL; + } + if (info->buf) { + drmUnmap(info->buf, info->bufMapSize); + info->buf = NULL; + } + if (info->ringReadPtr) { + drmUnmap(info->ringReadPtr, info->ringReadMapSize); + info->ringReadPtr = NULL; + } + if (info->ring) { + drmUnmap(info->ring, info->ringMapSize); + info->ring = NULL; + } + if (info->agpMemHandle) { + drmAgpUnbind(info->drmFD, info->agpMemHandle); + drmAgpFree(info->drmFD, info->agpMemHandle); + info->agpMemHandle = 0; + drmAgpRelease(info->drmFD); + } + if (info->pciMemHandle) { + drmScatterGatherFree(info->drmFD, info->pciMemHandle); + info->pciMemHandle = 0; + } + + /* De-allocate all DRI resources */ + DRICloseScreen(pScreen); + + /* De-allocate all DRI data structures */ + if (info->pDRIInfo) { + if (info->pDRIInfo->devPrivate) { + xfree(info->pDRIInfo->devPrivate); + info->pDRIInfo->devPrivate = NULL; + } + DRIDestroyInfoRec(info->pDRIInfo); + info->pDRIInfo = NULL; + } + if (info->pVisualConfigs) { + xfree(info->pVisualConfigs); + info->pVisualConfigs = NULL; + } + if (info->pVisualConfigsPriv) { + xfree(info->pVisualConfigsPriv); + info->pVisualConfigsPriv = NULL; + } +} Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h:1.2 --- /dev/null Mon Jun 4 12:40:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h Wed Mar 21 12:02:22 2001 @@ -0,0 +1,106 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dri.h,v 1.2 2001/03/21 17:02:22 dawes Exp $ */ +/* + * Copyright 2000 ATI Technologies Inc., Markham, Ontario, + * VA Linux Systems Inc., Fremont, California. + * + * 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, 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR + * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin <martin@valinux.com> + * Rickard E. Faith <faith@valinux.com> + * + */ + +#ifndef _RADEON_DRI_ +#define _RADEON_DRI_ + +#include "xf86drm.h" +#include "xf86drmRadeon.h" + +/* DRI Driver defaults */ +#define RADEON_DEFAULT_CP_PIO_MODE RADEON_CSQ_PRIPIO_INDPIO +#define RADEON_DEFAULT_CP_BM_MODE RADEON_CSQ_PRIBM_INDBM +#define RADEON_DEFAULT_AGP_MODE 1 +#define RADEON_DEFAULT_AGP_SIZE 8 /* MB (must be a power of 2 and > 4MB) */ +#define RADEON_DEFAULT_RING_SIZE 1 /* MB (must be page aligned) */ +#define RADEON_DEFAULT_BUFFER_SIZE 2 /* MB (must be page aligned) */ +#define RADEON_DEFAULT_AGP_TEX_SIZE 1 /* MB (must be page aligned) */ + +#define RADEON_DEFAULT_CP_TIMEOUT 10000 /* usecs */ + +#define RADEON_AGP_MAX_MODE 4 + +#define RADEON_CARD_TYPE_RADEON 1 + +/* Buffer are aligned on 4096 byte boundaries */ +#define RADEON_BUFFER_ALIGN 0x00000fff + +#define RADEONCP_USE_RING_BUFFER(m) \ +(((m) == RADEON_CSQ_PRIBM_INDDIS) || \ + ((m) == RADEON_CSQ_PRIBM_INDBM)) + +typedef struct { + /* DRI screen private data */ + int deviceID; /* PCI device ID */ + int width; /* Width in pixels of display */ + int height; /* Height in scanlines of display */ + int depth; /* Depth of display (8, 15, 16, 24) */ + int bpp; /* Bit depth of display (8, 16, 24, 32) */ + + int IsPCI; /* Current card is a PCI card */ + int AGPMode; + + int frontOffset; /* Start of front buffer */ + int frontPitch; + int backOffset; /* Start of shared back buffer */ + int backPitch; + int depthOffset; /* Start of shared depth buffer */ + int depthPitch; + int textureOffset;/* Start of texture data in frame buffer */ + int textureSize; + int log2TexGran; + + /* MMIO register data */ + drmHandle registerHandle; + drmSize registerSize; + + /* CP in-memory status information */ + drmHandle statusHandle; + drmSize statusSize; + + /* CP AGP Texture data */ + drmHandle agpTexHandle; + drmSize agpTexMapSize; + int log2AGPTexGran; + int agpTexOffset; + unsigned int sarea_priv_offset; + +#ifdef PER_CONTEXT_SAREA + drmSize perctx_sarea_size; +#endif +} RADEONDRIRec, *RADEONDRIPtr; + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h:1.2 --- /dev/null Mon Jun 4 12:40:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h Wed Mar 21 12:02:22 2001 @@ -0,0 +1,64 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_dripriv.h,v 1.2 2001/03/21 17:02:22 dawes Exp $ */ +/* + * Copyright 2000 ATI Technologies Inc., Markham, Ontario, + * VA Linux Systems Inc., Fremont, California. + * + * 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, 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR + * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin <martin@valinux.com> + * Rickard E. Faith <faith@valinux.com> + * + */ + +#ifndef _RADEON_DRIPRIV_H_ +#define _RADEON_DRIPRIV_H_ + +#include "GL/glxint.h" +#include "xf86drm.h" +#include "xf86drmRadeon.h" + +#define RADEON_MAX_DRAWABLES 256 + +extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, + void **configprivs); + +typedef struct { + /* Nothing here yet */ + int dummy; +} RADEONConfigPrivRec, *RADEONConfigPrivPtr; + +typedef struct { +#ifdef PER_CONTEXT_SAREA + drmContext ctx_id; + drmHandle sarea_handle; +#else + /* Nothing here yet */ + int dummy; +#endif +} RADEONDRIContextRec, *RADEONDRIContextPtr; + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c:1.25.2.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c:1.8 Fri Dec 8 09:40:01 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c Thu May 31 04:36:15 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.8 2000/12/08 14:40:01 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_driver.c,v 1.25.2.2 2001/05/31 08:36:15 alanh Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -66,8 +66,8 @@ #ifdef XF86DRI #define _XF86DRI_SERVER_ -#include "r128_dri.h" -#include "r128_sarea.h" +#include "radeon_dri.h" +#include "radeon_sarea.h" #endif #define USE_FB /* not until overlays */ @@ -130,9 +130,8 @@ OPTION_AGP_MODE, OPTION_AGP_SIZE, OPTION_RING_SIZE, - OPTION_VERT_SIZE, - OPTION_VBUF_SIZE, - OPTION_USE_CP_2D, + OPTION_BUFFER_SIZE, + OPTION_DEPTH_MOVE, #endif #ifdef ENABLE_FLAT_PANEL /* Note: Radeon flat panel support has been disabled for now */ @@ -146,7 +145,7 @@ OPTION_FBDEV } RADEONOpts; -OptionInfoRec RADEONOptions[] = { +const OptionInfoRec RADEONOptions[] = { { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE }, @@ -154,14 +153,12 @@ #ifdef XF86DRI { OPTION_IS_PCI, "ForcePCIMode", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_CP_PIO, "CPPIOMode", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_NO_SECURITY, "CPNoSecurity", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_USEC_TIMEOUT, "CPusecTimeout", OPTV_INTEGER, {0}, FALSE }, { OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE }, { OPTION_AGP_SIZE, "AGPSize", OPTV_INTEGER, {0}, FALSE }, { OPTION_RING_SIZE, "RingSize", OPTV_INTEGER, {0}, FALSE }, - { OPTION_VERT_SIZE, "VBListSize", OPTV_INTEGER, {0}, FALSE }, - { OPTION_VBUF_SIZE, "VBSize", OPTV_INTEGER, {0}, FALSE }, - { OPTION_USE_CP_2D, "UseCPfor2D", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_BUFFER_SIZE, "BufferSize", OPTV_INTEGER, {0}, FALSE }, + { OPTION_DEPTH_MOVE, "EnableDepthMoves", OPTV_BOOLEAN, {0}, FALSE }, #endif #ifdef ENABLE_FLAT_PANEL /* Note: Radeon flat panel support has been disabled for now */ @@ -309,6 +306,106 @@ }; #endif +#if !defined(__alpha__) +# define RADEONPreInt10Save(s, r1, r2) +# define RADEONPostInt10Check(s, r1, r2) +#else /* __alpha__ */ +static void +RADEONSaveRegsZapMemCntl(ScrnInfoPtr pScrn, CARD32 *MEM_CNTL, CARD32 *MEMSIZE) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO; + int mapped = 0; + + /* + * First make sure we have the pci and mmio info and that mmio is mapped + */ + if (!info->PciInfo) + info->PciInfo = xf86GetPciInfoForEntity(info->pEnt->index); + if (!info->PciTag) + info->PciTag = pciTag(info->PciInfo->bus, info->PciInfo->device, + info->PciInfo->func); + if (!info->MMIOAddr) + info->MMIOAddr = info->PciInfo->memBase[2] & 0xffffff00; + if (!info->MMIO) { + RADEONMapMMIO(pScrn); + mapped = 1; + } + RADEONMMIO = info->MMIO; + + /* + * Save the values and zap MEM_CNTL + */ + *MEM_CNTL = INREG(RADEON_MEM_CNTL); + *MEMSIZE = INREG(RADEON_CONFIG_MEMSIZE); + OUTREG(RADEON_MEM_CNTL, 0); + + /* + * Unmap mmio space if we mapped it + */ + if (mapped) + RADEONUnmapMMIO(pScrn); +} + +static void +RADEONCheckRegs(ScrnInfoPtr pScrn, CARD32 Saved_MEM_CNTL, CARD32 Saved_MEMSIZE) +{ + RADEONInfoPtr info = RADEONPTR(pScrn); + unsigned char *RADEONMMIO; + CARD32 MEM_CNTL; + int mapped = 0; + + /* + * If we don't have a valid (non-zero) saved MEM_CNTL, get out now + */ + if (!Saved_MEM_CNTL) + return; + + /* + * First make sure that mmio is mapped + */ + if (!info->MMIO) { + RADEONMapMMIO(pScrn); + mapped = 1; + } + RADEONMMIO = info->MMIO; + + /* + * If either MEM_CNTL is currently zero or inconistent (configured for + * two channels with the two channels configured differently), restore + * the saved registers. + */ + MEM_CNTL = INREG(RADEON_MEM_CNTL); + if (!MEM_CNTL || + ((MEM_CNTL & 1) && + (((MEM_CNTL >> 8) & 0xff) != ((MEM_CNTL >> 24) & 0xff)))) { + /* + * Restore the saved registers + */ + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Restoring MEM_CNTL (%08x), setting to %08x\n", + MEM_CNTL, Saved_MEM_CNTL); + OUTREG(RADEON_MEM_CNTL, Saved_MEM_CNTL); + + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Restoring CONFIG_MEMSIZE (%08x), setting to %08x\n", + INREG(RADEON_CONFIG_MEMSIZE), Saved_MEMSIZE); + OUTREG(RADEON_CONFIG_MEMSIZE, Saved_MEMSIZE); + } + + /* + * Unmap mmio space if we mapped it + */ + if (mapped) + RADEONUnmapMMIO(pScrn); +} + +# define RADEONPreInt10Save(s, r1, r2) \ + RADEONSaveRegsZapMemCntl((s), (r1), (r2)) +# define RADEONPostInt10Check(s, r1, r2) \ + RADEONCheckRegs((s), (r1), (r2)) +#endif /* __alpha__ */ + /* Allocate our private RADEONInfoRec. */ static Bool RADEONGetRec(ScrnInfoPtr pScrn) { @@ -496,7 +593,7 @@ } /* Read the Video BIOS block and the FP registers (if applicable). */ -static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn) +static Bool RADEONGetBIOSParameters(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { RADEONInfoPtr info = RADEONPTR(pScrn); #ifdef ENABLE_FLAT_PANEL @@ -504,11 +601,6 @@ 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)) @@ -523,16 +615,20 @@ return FALSE; } - info->BIOSFromPCI = TRUE; - RADEONReadBIOS(0x0000, info->VBIOS, RADEON_VBIOS_SIZE); - if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Video BIOS not detected in PCI space!\n"); - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Attempting to read Video BIOS from legacy ISA space!\n"); - info->BIOSFromPCI = FALSE; - info->BIOSAddr = 0x000c0000; - RADEONReadBIOS(0x0000, info->VBIOS, RADEON_VBIOS_SIZE); + if (pInt10) { + info->BIOSAddr = pInt10->BIOSseg << 4; + (void)memcpy(info->VBIOS, xf86int10Addr(pInt10, info->BIOSAddr), + RADEON_VBIOS_SIZE); + } else { + xf86ReadPciBIOS(0, info->PciTag, 0, info->VBIOS, RADEON_VBIOS_SIZE); + if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Video BIOS not detected in PCI space!\n"); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Attempting to read Video BIOS from legacy ISA space!\n"); + info->BIOSAddr = 0x000c0000; + xf86ReadBIOS(info->BIOSAddr, 0, info->VBIOS, RADEON_VBIOS_SIZE); + } } if (info->VBIOS[0] != 0x55 || info->VBIOS[1] != 0xaa) { info->BIOSAddr = 0x00000000; @@ -735,7 +831,7 @@ if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE; } else { pScrn->rgbBits = 8; - if (xf86ReturnOptValBool(RADEONOptions, OPTION_DAC_6BIT, FALSE)) { + if (xf86ReturnOptValBool(info->Options, OPTION_DAC_6BIT, FALSE)) { pScrn->rgbBits = 6; info->dac6bits = TRUE; } @@ -854,6 +950,7 @@ case PCI_CHIP_RADEON_QE: case PCI_CHIP_RADEON_QF: case PCI_CHIP_RADEON_QG: + case PCI_CHIP_RADEON_VE: default: info->HasPanelRegs = FALSE; break; } #endif @@ -902,7 +999,7 @@ "Using flat panel for display\n"); #else /* Panel CRT mode override */ - if ((info->CRTOnly = xf86ReturnOptValBool(RADEONOptions, + if ((info->CRTOnly = xf86ReturnOptValBool(info->Options, OPTION_CRT, FALSE))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using external CRT instead of " @@ -916,12 +1013,12 @@ /* Panel width/height overrides */ info->PanelXRes = 0; info->PanelYRes = 0; - if (xf86GetOptValInteger(RADEONOptions, + if (xf86GetOptValInteger(info->Options, OPTION_PANEL_WIDTH, &(info->PanelXRes))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Flat panel width: %d\n", info->PanelXRes); } - if (xf86GetOptValInteger(RADEONOptions, + if (xf86GetOptValInteger(info->Options, OPTION_PANEL_HEIGHT, &(info->PanelYRes))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Flat panel height: %d\n", info->PanelYRes); @@ -933,7 +1030,7 @@ #ifdef XF86DRI /* AGP/PCI */ - if (xf86ReturnOptValBool(RADEONOptions, OPTION_IS_PCI, FALSE)) { + if (xf86ReturnOptValBool(info->Options, OPTION_IS_PCI, FALSE)) { info->IsPCI = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forced into PCI-only mode\n"); } else { @@ -945,6 +1042,7 @@ case PCI_CHIP_RADEON_QE: case PCI_CHIP_RADEON_QF: case PCI_CHIP_RADEON_QG: + case PCI_CHIP_RADEON_VE: default: info->IsPCI = FALSE; break; } } @@ -953,7 +1051,7 @@ return TRUE; } -static Bool RADEONPreInitDDC(ScrnInfoPtr pScrn) +static Bool RADEONPreInitDDC(ScrnInfoPtr pScrn, xf86Int10InfoPtr pInt10) { RADEONInfoPtr info = RADEONPTR(pScrn); vbeInfoPtr pVbe; @@ -961,7 +1059,7 @@ if (!xf86LoadSubModule(pScrn, "ddc")) return FALSE; xf86LoaderReqSymLists(ddcSymbols, NULL); if (xf86LoadSubModule(pScrn, "vbe")) { - pVbe = VBEInit(NULL,info->pEnt->index); + pVbe = VBEInit(pInt10, info->pEnt->index); if (!pVbe) return FALSE; xf86SetDDCproperties(pScrn,xf86PrintEDID(vbeDoEDID(pVbe,NULL))); @@ -1020,8 +1118,8 @@ 64 * pScrn->bitsPerPixel, /* pitchInc */ 128, /* minHeight */ 2048, /* maxHeight */ - pScrn->virtualX, - pScrn->virtualY, + pScrn->display->virtualX, + pScrn->display->virtualY, info->FbMapSize, LOOKUP_BEST_REFRESH); @@ -1059,10 +1157,8 @@ xf86LoaderReqSymbols(Sym, NULL); #ifdef USE_FB -#ifdef RENDER xf86LoaderReqSymbols("fbPictureInit", NULL); #endif -#endif info->CurrentLayout.displayWidth = pScrn->displayWidth; info->CurrentLayout.mode = pScrn->currentMode; @@ -1073,7 +1169,9 @@ /* This is called by RADEONPreInit to initialize the hardware cursor. */ static Bool RADEONPreInitCursor(ScrnInfoPtr pScrn) { - if (!xf86ReturnOptValBool(RADEONOptions, OPTION_SW_CURSOR, FALSE)) { + RADEONInfoPtr info = RADEONPTR(pScrn); + + if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) return FALSE; } return TRUE; @@ -1082,23 +1180,22 @@ /* This is called by RADEONPreInit to initialize hardware acceleration. */ static Bool RADEONPreInitAccel(ScrnInfoPtr pScrn) { - if (!xf86ReturnOptValBool(RADEONOptions, OPTION_NOACCEL, FALSE)) { + RADEONInfoPtr info = RADEONPTR(pScrn); + + if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE; } return TRUE; } -static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn) +static Bool RADEONPreInitInt10(ScrnInfoPtr pScrn, xf86Int10InfoPtr *ppInt10) { RADEONInfoPtr info = RADEONPTR(pScrn); -#if 1 + if (xf86LoadSubModule(pScrn, "int10")) { - xf86Int10InfoPtr pInt; xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); - pInt = xf86InitInt10(info->pEnt->index); - xf86FreeInt10(pInt); + *ppInt10 = xf86InitInt10(info->pEnt->index); } -#endif return TRUE; } @@ -1107,43 +1204,23 @@ { RADEONInfoPtr info = RADEONPTR(pScrn); - if (info->IsPCI) { - info->CPMode = RADEON_DEFAULT_CP_PIO_MODE; - } else if (xf86ReturnOptValBool(RADEONOptions, OPTION_CP_PIO, FALSE)) { + if (xf86ReturnOptValBool(info->Options, OPTION_CP_PIO, FALSE)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing CP into PIO mode\n"); info->CPMode = RADEON_DEFAULT_CP_PIO_MODE; } else { info->CPMode = RADEON_DEFAULT_CP_BM_MODE; } - if (xf86ReturnOptValBool(RADEONOptions, OPTION_USE_CP_2D, FALSE)) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using CP for 2D\n"); - info->CP2D = TRUE; - } else { - info->CP2D = FALSE; - } - - if (xf86ReturnOptValBool(RADEONOptions, OPTION_NO_SECURITY, FALSE)) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "WARNING!!! CP Security checks disabled!!! **********\n"); - info->CPSecure = FALSE; - } else { - info->CPSecure = TRUE; - } - info->agpMode = RADEON_DEFAULT_AGP_MODE; info->agpSize = RADEON_DEFAULT_AGP_SIZE; info->ringSize = RADEON_DEFAULT_RING_SIZE; - info->vbSize = RADEON_DEFAULT_VB_SIZE; - info->indSize = RADEON_DEFAULT_IND_SIZE; + info->bufSize = RADEON_DEFAULT_BUFFER_SIZE; info->agpTexSize = RADEON_DEFAULT_AGP_TEX_SIZE; - info->vbBufSize = RADEON_DEFAULT_VB_BUF_SIZE; - info->CPusecTimeout = RADEON_DEFAULT_CP_TIMEOUT; if (!info->IsPCI) { - if (xf86GetOptValInteger(RADEONOptions, + if (xf86GetOptValInteger(info->Options, OPTION_AGP_MODE, &(info->agpMode))) { if (info->agpMode < 1 || info->agpMode > RADEON_AGP_MAX_MODE) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -1154,7 +1231,7 @@ "Using AGP %dx mode\n", info->agpMode); } - if (xf86GetOptValInteger(RADEONOptions, + if (xf86GetOptValInteger(info->Options, OPTION_AGP_SIZE, (int *)&(info->agpSize))) { switch (info->agpSize) { case 4: @@ -1172,9 +1249,9 @@ } } - if (xf86GetOptValInteger(RADEONOptions, + if (xf86GetOptValInteger(info->Options, OPTION_RING_SIZE, &(info->ringSize))) { - if (info->ringSize < 1 || info->ringSize >= info->agpSize) { + if (info->ringSize < 1 || info->ringSize >= (int)info->agpSize) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Illegal ring buffer size: %d MB\n", info->ringSize); @@ -1182,44 +1259,48 @@ } } - if (xf86GetOptValInteger(RADEONOptions, - OPTION_VERT_SIZE, &(info->vbSize))) { - if (info->vbSize < 1 || info->vbSize >= info->agpSize) { + if (xf86GetOptValInteger(info->Options, + OPTION_BUFFER_SIZE, &(info->bufSize))) { + if (info->bufSize < 1 || info->bufSize >= (int)info->agpSize) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Illegal vertex buffers list size: %d MB\n", - info->vbSize); + "Illegal vertex/indirect buffers size: %d MB\n", + info->bufSize); return FALSE; } - } - - if (xf86GetOptValInteger(RADEONOptions, - OPTION_VBUF_SIZE, &(info->vbBufSize))) { - int numBufs = info->vbSize*1024*1024/info->vbBufSize; - if (numBufs < 2 || numBufs > 512) { /* FIXME: 512 is arbitrary */ + if (info->bufSize > 2) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Illegal individual vertex buffer size: %d bytes\n", - info->vbBufSize); - return FALSE; + "Illegal vertex/indirect buffers size: %d MB\n", + info->bufSize); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Clamping vertex/indirect buffers size to 2 MB\n"); + info->bufSize = 2; } } - if (info->ringSize + info->vbSize + info->indSize + info->agpTexSize > - info->agpSize) { + if (info->ringSize + info->bufSize + info->agpTexSize > + (int)info->agpSize) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Buffers are too big for requested AGP space\n"); return FALSE; } - info->agpTexSize = info->agpSize - (info->ringSize + - info->vbSize + - info->indSize); + info->agpTexSize = info->agpSize - (info->ringSize + info->bufSize); } - if (xf86GetOptValInteger(RADEONOptions, OPTION_USEC_TIMEOUT, + if (xf86GetOptValInteger(info->Options, OPTION_USEC_TIMEOUT, &(info->CPusecTimeout))) { /* This option checked by the RADEON DRM kernel module */ } + /* Depth moves are disabled by default since they are extremely slow */ + if ((info->depthMoves = xf86ReturnOptValBool(info->Options, + OPTION_DEPTH_MOVE, FALSE))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Enabling depth moves\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Depth moves disabled by default\n"); + } + return TRUE; } #endif @@ -1237,7 +1318,9 @@ /* RADEONPreInit is called once at server startup. */ Bool RADEONPreInit(ScrnInfoPtr pScrn, int flags) { - RADEONInfoPtr info; + RADEONInfoPtr info; + xf86Int10InfoPtr pInt10 = NULL; + CARD32 save1, save2; #ifdef XFree86LOADER /* @@ -1275,8 +1358,11 @@ info->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if (info->pEnt->location.type != BUS_PCI) goto fail; + RADEONPreInt10Save(pScrn, &save1, &save2); + if (flags & PROBE_DETECT) { RADEONProbeDDC(pScrn, info->pEnt->index); + RADEONPostInt10Check(pScrn, save1, save2); return TRUE; } @@ -1308,11 +1394,13 @@ /* We can't do this until we have a pScrn->display. */ xf86CollectOptions(pScrn, NULL); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, RADEONOptions); + if (!(info->Options = xalloc(sizeof(RADEONOptions)))) goto fail; + memcpy(info->Options, RADEONOptions, sizeof(RADEONOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, info->Options); if (!RADEONPreInitWeight(pScrn)) goto fail; - if (xf86ReturnOptValBool(RADEONOptions, OPTION_FBDEV, FALSE)) { + if (xf86ReturnOptValBool(info->Options, OPTION_FBDEV, FALSE)) { info->FBDev = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using framebuffer device\n"); @@ -1331,26 +1419,31 @@ } if (!info->FBDev) - if (!RADEONPreInitInt10(pScrn)) goto fail; + if (!RADEONPreInitInt10(pScrn, &pInt10)) goto fail; + + RADEONPostInt10Check(pScrn, save1, save2); + + if (!RADEONPreInitConfig(pScrn)) goto fail; - if (!RADEONPreInitConfig(pScrn)) goto fail; + if (!RADEONGetBIOSParameters(pScrn, pInt10)) goto fail; - if (!RADEONGetBIOSParameters(pScrn)) goto fail; + if (!RADEONGetPLLParameters(pScrn)) goto fail; - if (!RADEONGetPLLParameters(pScrn)) goto fail; + /* shouldn't fail just because we can't get DDC */ + RADEONPreInitDDC(pScrn, pInt10); - if (!RADEONPreInitDDC(pScrn)) goto fail; + RADEONPostInt10Check(pScrn, save1, save2); - if (!RADEONPreInitGamma(pScrn)) goto fail; + if (!RADEONPreInitGamma(pScrn)) goto fail; - if (!RADEONPreInitModes(pScrn)) goto fail; + if (!RADEONPreInitModes(pScrn)) goto fail; - if (!RADEONPreInitCursor(pScrn)) goto fail; + if (!RADEONPreInitCursor(pScrn)) goto fail; - if (!RADEONPreInitAccel(pScrn)) goto fail; + if (!RADEONPreInitAccel(pScrn)) goto fail; #ifdef XF86DRI - if (!RADEONPreInitDRI(pScrn)) goto fail; + if (!RADEONPreInitDRI(pScrn)) goto fail; #endif /* Free the video bios (if applicable) */ @@ -1359,6 +1452,10 @@ info->VBIOS = NULL; } + /* Free int10 info */ + if (pInt10) + xf86FreeInt10(pInt10); + return TRUE; fail: @@ -1370,6 +1467,10 @@ info->VBIOS = NULL; } + /* Free int10 info */ + if (pInt10) + xf86FreeInt10(pInt10); + vgaHWFreeHWRec(pScrn); RADEONFreeRec(pScrn); return FALSE; @@ -1445,14 +1546,14 @@ static void RADEONBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) { - ScreenPtr pScreen = screenInfo.screens[i]; - ScrnInfoPtr pScrn = xf86Screens[i]; + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; RADEONInfoPtr info = RADEONPTR(pScrn); - + pScreen->BlockHandler = info->BlockHandler; (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); pScreen->BlockHandler = RADEONBlockHandler; - + if(info->VideoTimerCallback) { (*info->VideoTimerCallback)(pScrn, currentTime.milliseconds); } @@ -1515,21 +1616,19 @@ info->CurrentLayout.pixel_bytes); int maxy = info->FbMapSize / width_bytes; - if (!xf86ReturnOptValBool(RADEONOptions, OPTION_NOACCEL, FALSE) && - (maxy > pScrn->virtualY * 3) -#ifdef ENABLE_FLAT_PANEL - /* FIXME: Disable 3D support for FPs until it is tested */ - && !info->HasPanelRegs -#endif - ) { - info->directRenderingEnabled = RADEONDRIScreenInit(pScreen); - } else { + if (xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { + xf86DrvMsg(scrnIndex, X_WARNING, + "Acceleration disabled, not initializing the DRI\n"); + info->directRenderingEnabled = FALSE; + } else if (maxy <= pScrn->virtualY * 3) { xf86DrvMsg(scrnIndex, X_WARNING, "Static buffer allocation failed -- " "need at least %d kB video memory\n", (pScrn->displayWidth * pScrn->virtualY * info->CurrentLayout.pixel_bytes * 3 + 1023) / 1024); info->directRenderingEnabled = FALSE; + } else { + info->directRenderingEnabled = RADEONDRIScreenInit(pScreen); } } #endif @@ -1540,9 +1639,7 @@ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; -#ifdef RENDER fbPictureInit (pScreen, 0, 0); -#endif #else switch (pScrn->bitsPerPixel) { case 8: @@ -1590,57 +1687,19 @@ RADEONDGAInit(pScreen); /* Memory manager setup */ - MemBox.x1 = 0; - MemBox.y1 = 0; - MemBox.x2 = pScrn->displayWidth; - y2 = (info->FbMapSize - / (pScrn->displayWidth * info->CurrentLayout.pixel_bytes)); - if (y2 >= 32768) y2 = 32767; /* because MemBox.y2 is signed short */ - MemBox.y2 = y2; - - /* The acceleration engine uses 14 bit - signed coordinates, so we can't have any - drawable caches beyond this region. */ - if (MemBox.y2 > 8191) MemBox.y2 = 8191; - - if (!xf86InitFBManager(pScreen, &MemBox)) { - xf86DrvMsg(scrnIndex, X_ERROR, - "Memory manager initialization to (%d,%d) (%d,%d) failed\n", - MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); - return FALSE; - } else { - int width, height; - FBAreaPtr fbarea; - - xf86DrvMsg(scrnIndex, X_INFO, - "Memory manager initialized to (%d,%d) (%d,%d)\n", - MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); - if ((fbarea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, - 2, 0, NULL, NULL, NULL))) { - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved area from (%d,%d) to (%d,%d)\n", - fbarea->box.x1, fbarea->box.y1, - fbarea->box.x2, fbarea->box.y2); - } else { - xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve area\n"); - } - if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, 0, 0, 0)) { - xf86DrvMsg(scrnIndex, X_INFO, - "Largest offscreen area available: %d x %d\n", - width, height); - } - } - #ifdef XF86DRI - /* Allocate frame buffer space for the - shared back and depth buffers as well - as for local textures. */ if (info->directRenderingEnabled) { FBAreaPtr fbarea; - int width_bytes = (pScrn->displayWidth * - info->CurrentLayout.pixel_bytes); - int maxy = info->FbMapSize / width_bytes; - int l; + int width_bytes = (pScrn->displayWidth * + info->CurrentLayout.pixel_bytes); + int cpp = info->CurrentLayout.pixel_bytes; + int bufferSize = ((pScrn->virtualY * width_bytes + RADEON_BUFFER_ALIGN) + & ~RADEON_BUFFER_ALIGN); + int l; + int scanlines; + + info->frontOffset = 0; + info->frontPitch = pScrn->displayWidth; switch (info->CPMode) { case RADEON_DEFAULT_CP_PIO_MODE: @@ -1658,100 +1717,176 @@ "Using %d MB AGP aperture\n", info->agpSize); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %d MB for the ring buffer\n", info->ringSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d MB for vertex buffers\n", info->vbSize); xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d MB for indirect buffers\n", info->indSize); + "Using %d MB for vertex/indirect buffers\n", info->bufSize); xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %d MB for AGP textures\n", info->agpTexSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d byte vertex buffers\n", info->vbBufSize); - /* Allocate the shared back buffer */ - if ((fbarea = xf86AllocateOffscreenArea(pScreen, - pScrn->virtualX, - pScrn->virtualY, - 32, NULL, NULL, NULL))) { - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved back buffer from (%d,%d) to (%d,%d)\n", - fbarea->box.x1, fbarea->box.y1, - fbarea->box.x2, fbarea->box.y2); + /* Try for front, back, depth, and three framebuffers worth of + * pixmap cache. Should be enough for a fullscreen background + * image plus some leftovers. + */ + info->textureSize = info->FbMapSize - 6 * bufferSize; + + /* If that gives us less than half the available memory, let's + * be greedy and grab some more. Sorry, I care more about 3D + * performance than playing nicely, and you'll get around a full + * framebuffer's worth of pixmap cache anyway. + */ + if (info->textureSize < (int)info->FbMapSize / 2) { + info->textureSize = info->FbMapSize - 5 * bufferSize; + } + if (info->textureSize < (int)info->FbMapSize / 2) { + info->textureSize = info->FbMapSize - 4 * bufferSize; + } + + /* Check to see if there is more room available after the 8192nd + scanline for textures */ + if ((int)info->FbMapSize - 8192*width_bytes - bufferSize*2 + > info->textureSize) { + info->textureSize = + info->FbMapSize - 8192*width_bytes - bufferSize*2; + } - info->backX = fbarea->box.x1; - info->backY = fbarea->box.y1; + if (info->textureSize > 0) { + l = RADEONMinBits((info->textureSize-1) / RADEON_NR_TEX_REGIONS); + if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY; + + /* Round the texture size up to the nearest whole number of + * texture regions. Again, be greedy about this, don't + * round down. + */ + info->log2TexGran = l; + info->textureSize = (info->textureSize >> l) << l; } else { - xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve back buffer\n"); - info->backX = -1; - info->backY = -1; + info->textureSize = 0; } - /* Allocate the shared depth buffer */ - if ((fbarea = xf86AllocateOffscreenArea(pScreen, - pScrn->virtualX, - pScrn->virtualY, - 32, NULL, NULL, NULL))) { - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved depth buffer from (%d,%d) to (%d,%d)\n", - fbarea->box.x1, fbarea->box.y1, - fbarea->box.x2, fbarea->box.y2); + /* Set a minimum usable local texture heap size. This will fit + * two 256x256x32bpp textures. + */ + if (info->textureSize < 512 * 1024) { + info->textureOffset = 0; + info->textureSize = 0; + } + + /* Reserve space for textures */ + info->textureOffset = (info->FbMapSize - info->textureSize + + RADEON_BUFFER_ALIGN) & + ~(CARD32)RADEON_BUFFER_ALIGN; + + /* Reserve space for the shared depth buffer */ + info->depthOffset = (info->textureOffset - bufferSize + + RADEON_BUFFER_ALIGN) & + ~(CARD32)RADEON_BUFFER_ALIGN; + info->depthPitch = pScrn->displayWidth; + + /* Reserve space for the shared back buffer */ + info->backOffset = (info->depthOffset - bufferSize + + RADEON_BUFFER_ALIGN) & + ~(CARD32)RADEON_BUFFER_ALIGN; + info->backPitch = pScrn->displayWidth; + + scanlines = info->backOffset / width_bytes - 1; + if (scanlines > 8191) scanlines = 8191; + + MemBox.x1 = 0; + MemBox.y1 = 0; + MemBox.x2 = pScrn->displayWidth; + MemBox.y2 = scanlines; - info->depthX = fbarea->box.x1; - info->depthY = fbarea->box.y1; + if (!xf86InitFBManager(pScreen, &MemBox)) { + xf86DrvMsg(scrnIndex, X_ERROR, + "Memory manager initialization to (%d,%d) (%d,%d) failed\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); + return FALSE; } else { - xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve depth buffer\n"); - info->depthX = -1; - info->depthY = -1; - } + int width, height; - /* Allocate local texture space */ - if (((maxy - MemBox.y2 - 1) * width_bytes) > - (pScrn->virtualX * pScrn->virtualY * 2 * - info->CurrentLayout.pixel_bytes)) { - info->textureX = 0; - info->textureY = MemBox.y2 + 1; - info->textureSize = (maxy - MemBox.y2 - 1) * width_bytes; + xf86DrvMsg(scrnIndex, X_INFO, + "Memory manager initialized to (%d,%d) (%d,%d)\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); + if ((fbarea = xf86AllocateOffscreenArea(pScreen, + pScrn->displayWidth, + 2, 0, NULL, NULL, NULL))) { + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved area from (%d,%d) to (%d,%d)\n", + fbarea->box.x1, fbarea->box.y1, + fbarea->box.x2, fbarea->box.y2); + } else { + xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve area\n"); + } + if (xf86QueryLargestOffscreenArea(pScreen, &width, + &height, 0, 0, 0)) { + xf86DrvMsg(scrnIndex, X_INFO, + "Largest offscreen area available: %d x %d\n", + width, height); + } + } - l = RADEONMinBits((info->textureSize-1) / RADEON_NR_TEX_REGIONS); - if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY; + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved back buffer at offset 0x%x\n", + info->backOffset); + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved depth buffer at offset 0x%x\n", + info->depthOffset); + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved %d kb for textures at offset 0x%x\n", + info->textureSize/1024, info->textureOffset); - info->log2TexGran = l; - info->textureSize = (info->textureSize >> l) << l; + info->frontPitchOffset = (((info->frontPitch * cpp / 64) << 22) | + (info->frontOffset >> 10)); - xf86DrvMsg(scrnIndex, X_INFO, - "Reserved %d kb for textures: (%d,%d)-(%d,%d)\n", - info->textureSize/1024, - info->textureX, info->textureY, - pScrn->displayWidth, maxy); - } else if ((fbarea = xf86AllocateOffscreenArea(pScreen, - pScrn->virtualX, - pScrn->virtualY * 2, - 32, - NULL, NULL, NULL))) { - info->textureX = fbarea->box.x1; - info->textureY = fbarea->box.y1; - info->textureSize = ((fbarea->box.y2 - fbarea->box.y1) * - (fbarea->box.x2 - fbarea->box.x1) * - info->CurrentLayout.pixel_bytes); + info->backPitchOffset = (((info->backPitch * cpp / 64) << 22) | + (info->backOffset >> 10)); - l = RADEONMinBits((info->textureSize-1) / RADEON_NR_TEX_REGIONS); - if (l < RADEON_LOG_TEX_GRANULARITY) l = RADEON_LOG_TEX_GRANULARITY; + info->depthPitchOffset = (((info->depthPitch * cpp / 64) << 22) | + (info->depthOffset >> 10)); + } + else +#endif + { + MemBox.x1 = 0; + MemBox.y1 = 0; + MemBox.x2 = pScrn->displayWidth; + y2 = (info->FbMapSize + / (pScrn->displayWidth * + info->CurrentLayout.pixel_bytes)); + /* The acceleration engine uses 14 bit + signed coordinates, so we can't have any + drawable caches beyond this region. */ + if (y2 > 8191) y2 = 8191; + MemBox.y2 = y2; - info->log2TexGran = l; - info->textureSize = (info->textureSize >> l) << l; + if (!xf86InitFBManager(pScreen, &MemBox)) { + xf86DrvMsg(scrnIndex, X_ERROR, + "Memory manager initialization to (%d,%d) (%d,%d) failed\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); + return FALSE; + } else { + int width, height; + FBAreaPtr fbarea; xf86DrvMsg(scrnIndex, X_INFO, - "Reserved %d kb for textures: (%d,%d)-(%d,%d)\n", - info->textureSize/1024, - fbarea->box.x1, fbarea->box.y1, - fbarea->box.x2, fbarea->box.y2); - } else { - xf86DrvMsg(scrnIndex, X_ERROR, - "Unable to reserve texture space in frame buffer\n"); - info->textureX = -1; - info->textureY = -1; + "Memory manager initialized to (%d,%d) (%d,%d)\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2); + if ((fbarea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + 2, 0, NULL, NULL, NULL))) { + xf86DrvMsg(scrnIndex, X_INFO, + "Reserved area from (%d,%d) to (%d,%d)\n", + fbarea->box.x1, fbarea->box.y1, + fbarea->box.x2, fbarea->box.y2); + } else { + xf86DrvMsg(scrnIndex, X_ERROR, "Unable to reserve area\n"); + } + if (xf86QueryLargestOffscreenArea(pScreen, &width, &height, + 0, 0, 0)) { + xf86DrvMsg(scrnIndex, X_INFO, + "Largest offscreen area available: %d x %d\n", + width, height); + } } } -#endif /* Backing store setup */ miInitializeBackingStore(pScreen); @@ -1761,7 +1896,7 @@ xf86SetSilkenMouse(pScreen); /* Acceleration setup */ - if (!xf86ReturnOptValBool(RADEONOptions, OPTION_NOACCEL, FALSE)) { + if (!xf86ReturnOptValBool(info->Options, OPTION_NOACCEL, FALSE)) { if (RADEONAccelInit(pScreen)) { xf86DrvMsg(scrnIndex, X_INFO, "Acceleration enabled\n"); info->accelOn = TRUE; @@ -1780,7 +1915,7 @@ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); /* Hardware cursor setup */ - if (!xf86ReturnOptValBool(RADEONOptions, OPTION_SW_CURSOR, FALSE)) { + if (!xf86ReturnOptValBool(info->Options, OPTION_SW_CURSOR, FALSE)) { if (RADEONCursorInit(pScreen)) { int width, height; @@ -1815,14 +1950,10 @@ )) return FALSE; /* DPMS setup */ -#ifdef DPMSExtension #ifdef ENABLE_FLAT_PANEL if (!info->HasPanelRegs || info->CRTOnly) - xf86DPMSInit(pScreen, RADEONDisplayPowerManagementSet, 0); -#else - xf86DPMSInit(pScreen, RADEONDisplayPowerManagementSet, 0); -#endif #endif + xf86DPMSInit(pScreen, RADEONDisplayPowerManagementSet, 0); RADEONInitVideo(pScreen); @@ -2362,6 +2493,11 @@ ? RADEON_CRTC_INTERLACE_EN : 0)); + if (info->Chipset == PCI_CHIP_RADEON_VE) { + save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | RADEON_CRTC_CRT_ON; + } else { + save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | RADEON_XCRT_CNT_EN; + } save->crtc_ext_cntl = RADEON_VGA_ATI_LINEAR | RADEON_XCRT_CNT_EN; save->dac_cntl = (RADEON_DAC_MASK_ALL | RADEON_DAC_VGA_ADR_EN @@ -2840,13 +2976,13 @@ RADEONTRACE(("RADEONEnterVT\n")); #ifdef XF86DRI if (RADEONPTR(pScrn)->directRenderingEnabled) { - RADEONCPStart(pScrn); + RADEONCP_START(pScrn, info); DRIUnlock(pScrn->pScreen); } #endif if (!RADEONModeInit(pScrn, pScrn->currentMode)) return FALSE; if (info->accelOn) - RADEONEngineInit(pScrn); + RADEONEngineRestore(pScrn); info->PaletteSavedOnVT = FALSE; RADEONAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); @@ -2866,7 +3002,7 @@ #ifdef XF86DRI if (RADEONPTR(pScrn)->directRenderingEnabled) { DRILock(pScrn->pScreen, 0); - RADEONCPStop(pScrn); + RADEONCP_STOP(pScrn, info); } #endif RADEONSavePalette(pScrn, save); @@ -2882,7 +3018,8 @@ RADEONSavePtr restore = &info->SavedReg; fbdevHWEnterVT(scrnIndex,flags); RADEONRestorePalette(pScrn,restore); - RADEONEngineInit(pScrn); + if (info->accelOn) + RADEONEngineRestore(pScrn); return TRUE; } @@ -2947,7 +3084,6 @@ RADEONFreeRec(pScrn); } -#ifdef DPMSExtension /* Sets VESA Display Power Management Signaling (DPMS) Mode. */ static void RADEONDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -2979,4 +3115,3 @@ break; } } -#endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c:1.2 Sat Nov 18 14:37:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.2 2000/11/18 19:37:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_misc.c,v 1.3 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c:1.5 Tue Dec 12 21:45:00 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c Fri May 4 15:05:33 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.5 2000/12/13 02:45:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.c,v 1.9 2001/05/04 19:05:33 dawes Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -47,11 +47,38 @@ #include "xf86_ansic.h" #include "xf86Resources.h" +#ifdef XFree86LOADER + +/* + * The following exists to prevent the compiler from considering entry points + * defined in a separate module from being constants. + */ +static xf86PreInitProc * const volatile PreInitProc = RADEONPreInit; +static xf86ScreenInitProc * const volatile ScreenInitProc = RADEONScreenInit; +static xf86SwitchModeProc * const volatile SwitchModeProc = RADEONSwitchMode; +static xf86AdjustFrameProc * const volatile AdjustFrameProc = RADEONAdjustFrame; +static xf86EnterVTProc * const volatile EnterVTProc = RADEONEnterVT; +static xf86LeaveVTProc * const volatile LeaveVTProc = RADEONLeaveVT; +static xf86FreeScreenProc * const volatile FreeScreenProc = RADEONFreeScreen; +static xf86ValidModeProc * const volatile ValidModeProc = RADEONValidMode; + +#define RADEONPreInit PreInitProc +#define RADEONScreenInit ScreenInitProc +#define RADEONSwitchMode SwitchModeProc +#define RADEONAdjustFrame AdjustFrameProc +#define RADEONEnterVT EnterVTProc +#define RADEONLeaveVT LeaveVTProc +#define RADEONFreeScreen FreeScreenProc +#define RADEONValidMode ValidModeProc + +#endif + SymTabRec RADEONChipsets[] = { { PCI_CHIP_RADEON_QD, "ATI Radeon QD (AGP)" }, { PCI_CHIP_RADEON_QE, "ATI Radeon QE (AGP)" }, { PCI_CHIP_RADEON_QF, "ATI Radeon QF (AGP)" }, { PCI_CHIP_RADEON_QG, "ATI Radeon QG (AGP)" }, + { PCI_CHIP_RADEON_VE, "ATI Radeon VE (AGP)" }, { -1, NULL } }; @@ -60,11 +87,12 @@ { PCI_CHIP_RADEON_QE, PCI_CHIP_RADEON_QE, RES_SHARED_VGA }, { PCI_CHIP_RADEON_QF, PCI_CHIP_RADEON_QF, RES_SHARED_VGA }, { PCI_CHIP_RADEON_QG, PCI_CHIP_RADEON_QG, RES_SHARED_VGA }, + { PCI_CHIP_RADEON_VE, PCI_CHIP_RADEON_VE, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; /* Return the options for supported chipset 'n'; NULL otherwise */ -OptionInfoPtr +const OptionInfoRec * RADEONAvailableOptions(int chipid, int busid) { int i; @@ -73,6 +101,8 @@ * Return options defined in the radeon submodule which will have been * loaded by this point. */ + if ((chipid >> 16) == PCI_VENDOR_ATI) + chipid -= PCI_VENDOR_ATI << 16; for (i = 0; RADEONPciChipsets[i].PCIid > 0; i++) { if (chipid == RADEONPciChipsets[i].PCIid) return RADEONOptions; @@ -146,9 +176,10 @@ pEnt = xf86GetEntityInfo(usedChips[i]); if (pEnt->active) { - ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); + ScrnInfoPtr pScrn = xf86AllocateScreen(drv, 0); #ifdef XFree86LOADER + if (!xf86LoadSubModule(pScrn, "radeon")) { xf86Msg(X_ERROR, RADEON_NAME ": Failed to load \"radeon\" module.\n"); @@ -157,24 +188,6 @@ } xf86LoaderReqSymLists(RADEONSymbols, NULL); - - /* Workaround for possible loader bug */ -# define RADEONPreInit \ - (xf86PreInitProc*) LoaderSymbol("RADEONPreInit") -# define RADEONScreenInit \ - (xf86ScreenInitProc*) LoaderSymbol("RADEONScreenInit") -# define RADEONSwitchMode \ - (xf86SwitchModeProc*) LoaderSymbol("RADEONSwitchMode") -# define RADEONAdjustFrame \ - (xf86AdjustFrameProc*)LoaderSymbol("RADEONAdjustFrame") -# define RADEONEnterVT \ - (xf86EnterVTProc*) LoaderSymbol("RADEONEnterVT") -# define RADEONLeaveVT \ - (xf86LeaveVTProc*) LoaderSymbol("RADEONLeaveVT") -# define RADEONFreeScreen \ - (xf86FreeScreenProc*) LoaderSymbol("RADEONFreeScreen") -# define RADEONValidMode \ - (xf86ValidModeProc*) LoaderSymbol("RADEONValidMode") #endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h:1.3 Sat Nov 18 14:37:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h Mon May 7 17:59:06 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h,v 1.3 2000/11/18 19:37:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_probe.h,v 1.5 2001/05/07 21:59:06 tsi Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -42,34 +42,35 @@ #include "xf86str.h" /* radeon_probe.c */ -extern OptionInfoPtr RADEONAvailableOptions - FunctionPrototype((int, int)); -extern void RADEONIdentify - FunctionPrototype((int)); -extern Bool RADEONProbe - FunctionPrototype((DriverPtr, int)); +extern const OptionInfoRec * RADEONAvailableOptions + FunctionPrototype((int, int)); +extern void RADEONIdentify + FunctionPrototype((int)); +extern Bool RADEONProbe + FunctionPrototype((DriverPtr, int)); -extern SymTabRec RADEONChipsets[]; -extern PciChipsets RADEONPciChipsets[]; +extern SymTabRec RADEONChipsets[]; +extern PciChipsets RADEONPciChipsets[]; /* radeon_driver.c */ -extern Bool RADEONPreInit - FunctionPrototype((ScrnInfoPtr, int)); -extern Bool RADEONScreenInit - FunctionPrototype((int, ScreenPtr, int, char **)); -extern Bool RADEONSwitchMode - FunctionPrototype((int, DisplayModePtr, int)); -extern void RADEONAdjustFrame - FunctionPrototype((int, int, int, int)); -extern Bool RADEONEnterVT - FunctionPrototype((int, int)); -extern void RADEONLeaveVT - FunctionPrototype((int, int)); -extern void RADEONFreeScreen - FunctionPrototype((int, int)); -extern int RADEONValidMode - FunctionPrototype((int, DisplayModePtr, Bool, int)); +extern Bool RADEONPreInit + FunctionPrototype((ScrnInfoPtr, int)); +extern Bool RADEONScreenInit + FunctionPrototype((int, ScreenPtr, int, char **)); +extern Bool RADEONSwitchMode + FunctionPrototype((int, DisplayModePtr, int)); +extern void RADEONAdjustFrame + FunctionPrototype((int, int, int, int)); +extern Bool RADEONEnterVT + FunctionPrototype((int, int)); +extern void RADEONLeaveVT + FunctionPrototype((int, int)); +extern void RADEONFreeScreen + FunctionPrototype((int, int)); +extern int RADEONValidMode + FunctionPrototype((int, DisplayModePtr, Bool, + int)); -extern OptionInfoRec RADEONOptions[]; +extern const OptionInfoRec RADEONOptions[]; #endif /* _RADEON_PROBE_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h:1.4 Sat Nov 18 14:37:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h Wed May 2 11:06:08 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.4 2000/11/18 19:37:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_reg.h,v 1.9 2001/05/02 15:06:08 dawes Exp $ */ /* * Copyright 2000 ATI Technologies Inc., Markham, Ontario, and * VA Linux Systems Inc., Fremont, California. @@ -56,6 +56,11 @@ #include "xf86_ansic.h" #include "compiler.h" +/* Atomic updates of PLL clock don't seem to always work and stick, thus + * the bit never resets. Here - we use our own check by reading back the + * register we've just wrote to make sure it's got the Right! value */ +#define RADEON_ATOMIC_UPDATE 0 /* Use PLL Atomic updates (seems broken) */ + /* Memory mapped register access macros */ #define INREG8(addr) MMIO_IN8(RADEONMMIO, addr) #define INREG16(addr) MMIO_IN16(RADEONMMIO, addr) @@ -64,7 +69,7 @@ #define OUTREG16(addr, val) MMIO_OUT16(RADEONMMIO, addr, val) #define OUTREG(addr, val) MMIO_OUT32(RADEONMMIO, addr, val) -#define ADDRREG(addr) ((volatile CARD32 *)(RADEONMMIO + (addr))) +#define ADDRREG(addr) ((volatile CARD32 *)(pointer)(RADEONMMIO + (addr))) #define OUTREGP(addr, val, mask) \ @@ -139,7 +144,7 @@ RADEON_DAC_PALETTE_ACC_CTL); \ } else { \ OUTREG(RADEON_DAC_CNTL, INREG(RADEON_DAC_CNTL) & \ - ~RADEON_DAC_PALETTE_ACC_CTL); \ + (CARD32)~RADEON_DAC_PALETTE_ACC_CTL); \ } \ } while (0) @@ -168,6 +173,7 @@ #define RADEON_ATTRDR 0x03c1 /* VGA */ #define RADEON_ATTRDW 0x03c0 /* VGA */ #define RADEON_ATTRX 0x03c0 /* VGA */ +#define RADEON_AUX_SC_CNTL 0x1660 # define RADEON_AUX1_SC_EN (1 << 0) # define RADEON_AUX1_SC_MODE_OR (0 << 1) # define RADEON_AUX1_SC_MODE_NAND (1 << 1) @@ -177,7 +183,6 @@ # define RADEON_AUX3_SC_EN (1 << 4) # define RADEON_AUX3_SC_MODE_OR (0 << 5) # define RADEON_AUX3_SC_MODE_NAND (1 << 5) -#define RADEON_AUX_SC_CNTL 0x1660 #define RADEON_AUX1_SC_BOTTOM 0x1670 #define RADEON_AUX1_SC_LEFT 0x1664 #define RADEON_AUX1_SC_RIGHT 0x1668 @@ -354,6 +359,7 @@ # define RADEON_CRTC_H_DISP_SHIFT 16 #define RADEON_CRTC_OFFSET 0x0224 #define RADEON_CRTC_OFFSET_CNTL 0x0228 +# define RADEON_CRTC_TILE_EN (1 << 15) #define RADEON_CRTC_PITCH 0x022c #define RADEON_CRTC_STATUS 0x005c # define RADEON_CRTC_VBLANK_SAVE (1 << 1) @@ -440,6 +446,8 @@ # define RADEON_GMC_BRUSH_1X8_MONO_FG_LA (5 << 4) # define RADEON_GMC_BRUSH_32x1_MONO_FG_BG (6 << 4) # define RADEON_GMC_BRUSH_32x1_MONO_FG_LA (7 << 4) +# define RADEON_GMC_BRUSH_32x32_MONO_FG_BG (8 << 4) +# define RADEON_GMC_BRUSH_32x32_MONO_FG_LA (9 << 4) # define RADEON_GMC_BRUSH_8x8_COLOR (10 << 4) # define RADEON_GMC_BRUSH_1X8_COLOR (12 << 4) # define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4) @@ -530,6 +538,10 @@ #define RADEON_DST_PITCH_OFFSET 0x142c #define RADEON_DST_PITCH_OFFSET_C 0x1c80 # define RADEON_PITCH_SHIFT 21 +# define RADEON_DST_TILE_LINEAR (0 << 30) +# define RADEON_DST_TILE_MACRO (1 << 30) +# define RADEON_DST_TILE_MICRO (2 << 30) +# define RADEON_DST_TILE_BOTH (3 << 30) #define RADEON_DST_WIDTH 0x140c #define RADEON_DST_WIDTH_HEIGHT 0x1598 #define RADEON_DST_WIDTH_X 0x1588 @@ -600,15 +612,6 @@ #define RADEON_GEN_INT_STATUS 0x0044 # define RADEON_VSYNC_INT_AK (1 << 2) # define RADEON_VSYNC_INT (1 << 2) -#define RADEON_RBBM_SOFT_RESET 0x00f0 -# define RADEON_SOFT_RESET_CP (1 << 0) -# define RADEON_SOFT_RESET_HI (1 << 1) -# define RADEON_SOFT_RESET_SE (1 << 2) -# define RADEON_SOFT_RESET_RE (1 << 3) -# define RADEON_SOFT_RESET_PP (1 << 4) -# define RADEON_SOFT_RESET_E2 (1 << 5) -# define RADEON_SOFT_RESET_RB (1 << 6) -# define RADEON_SOFT_RESET_HDP (1 << 7) #define RADEON_GENENB 0x03c3 /* VGA */ #define RADEON_GENFC_RD 0x03ca /* VGA */ #define RADEON_GENFC_WT 0x03da /* VGA, 0x03ba */ @@ -684,9 +687,12 @@ #define RADEON_MC_AGP_LOCATION 0x014c #define RADEON_MC_FB_LOCATION 0x0148 #define RADEON_MCLK_CNTL 0x0012 /* PLL */ -# define RADEON_FORCE_GCP (1 << 16) -# define RADEON_FORCE_PIPE3D_CP (1 << 17) -# define RADEON_FORCE_RCP (1 << 18) +# define RADEON_FORCEON_MCLKA (1 << 16) +# define RADEON_FORCEON_MCLKB (1 << 17) +# define RADEON_FORCEON_YCLKA (1 << 18) +# define RADEON_FORCEON_YCLKB (1 << 19) +# define RADEON_FORCEON_MC (1 << 20) +# define RADEON_FORCEON_AIC (1 << 21) #define RADEON_MDGPIO_A_REG 0x01ac #define RADEON_MDGPIO_EN_REG 0x01b0 #define RADEON_MDGPIO_MASK 0x0198 @@ -856,10 +862,20 @@ # define RADEON_PPLL_ATOMIC_UPDATE_W (1 << 15) /* same as _R */ #define RADEON_PWR_MNGMT_CNTL_STATUS 0x0f60 /* PCI */ #define RADEON_RBBM_SOFT_RESET 0x00f0 +# define RADEON_SOFT_RESET_CP (1 << 0) +# define RADEON_SOFT_RESET_HI (1 << 1) +# define RADEON_SOFT_RESET_SE (1 << 2) +# define RADEON_SOFT_RESET_RE (1 << 3) +# define RADEON_SOFT_RESET_PP (1 << 4) +# define RADEON_SOFT_RESET_E2 (1 << 5) +# define RADEON_SOFT_RESET_RB (1 << 6) +# define RADEON_SOFT_RESET_HDP (1 << 7) #define RADEON_RBBM_STATUS 0x0e40 # define RADEON_RBBM_FIFOCNT_MASK 0x007f # define RADEON_RBBM_ACTIVE (1 << 31) #define RADEON_RB2D_DSTCACHE_CTLSTAT 0x342c +# define RADEON_RB2D_DC_FLUSH (3 << 0) +# define RADEON_RB2D_DC_FREE (3 << 2) # define RADEON_RB2D_DC_FLUSH_ALL 0xf # define RADEON_RB2D_DC_BUSY (1 << 31) #define RADEON_RB2D_DSTCACHE_MODE 0x3428 @@ -894,7 +910,7 @@ #define RADEON_STATUS 0x0f06 /* PCI */ #define RADEON_SUBPIC_CNTL 0x0540 /* ? */ #define RADEON_SUB_CLASS 0x0f0a /* PCI */ -#define RADEON_SURFACE_DELAY 0x0b00 +#define RADEON_SURFACE_CNTL 0x0b00 #define RADEON_SURFACE0_INFO 0x0b0c #define RADEON_SURFACE0_LOWER_BOUND 0x0b04 #define RADEON_SURFACE0_UPPER_BOUND 0x0b08 @@ -907,6 +923,18 @@ #define RADEON_SURFACE3_INFO 0x0b3c #define RADEON_SURFACE3_LOWER_BOUND 0x0b34 #define RADEON_SURFACE3_UPPER_BOUND 0x0b38 +#define RADEON_SURFACE4_INFO 0x0b4c +#define RADEON_SURFACE4_LOWER_BOUND 0x0b44 +#define RADEON_SURFACE4_UPPER_BOUND 0x0b48 +#define RADEON_SURFACE5_INFO 0x0b5c +#define RADEON_SURFACE5_LOWER_BOUND 0x0b54 +#define RADEON_SURFACE5_UPPER_BOUND 0x0b58 +#define RADEON_SURFACE6_INFO 0x0b6c +#define RADEON_SURFACE6_LOWER_BOUND 0x0b64 +#define RADEON_SURFACE6_UPPER_BOUND 0x0b68 +#define RADEON_SURFACE7_INFO 0x0b7c +#define RADEON_SURFACE7_LOWER_BOUND 0x0b74 +#define RADEON_SURFACE7_UPPER_BOUND 0x0b78 #define RADEON_SW_SEMAPHORE 0x013c #define RADEON_TEST_DEBUG_CNTL 0x0120 @@ -928,13 +956,550 @@ #define RADEON_VIPH_CONTROL 0x0c40 /* ? */ #define RADEON_WAIT_UNTIL 0x1720 +# define RADEON_WAIT_CRTC_PFLIP (1 << 0) +# define RADEON_WAIT_2D_IDLECLEAN (1 << 16) +# define RADEON_WAIT_3D_IDLECLEAN (1 << 17) +# define RADEON_WAIT_HOST_IDLECLEAN (1 << 18) #define RADEON_X_MPLL_REF_FB_DIV 0x000a /* PLL */ #define RADEON_XCLK_CNTL 0x000d /* PLL */ #define RADEON_XDLL_CNTL 0x000c /* PLL */ #define RADEON_XPLL_CNTL 0x000b /* PLL */ - /* Registers for CCE and Microcode Engine */ + /* Registers for 3D/TCL */ +#define RADEON_PP_BORDER_COLOR_0 0x1d40 +#define RADEON_PP_BORDER_COLOR_1 0x1d44 +#define RADEON_PP_BORDER_COLOR_2 0x1d48 +#define RADEON_PP_CNTL 0x1c38 +# define RADEON_STIPPLE_ENABLE (1 << 0) +# define RADEON_SCISSOR_ENABLE (1 << 1) +# define RADEON_PATTERN_ENABLE (1 << 2) +# define RADEON_SHADOW_ENABLE (1 << 3) +# define RADEON_TEX_ENABLE_MASK (0xf << 4) +# define RADEON_TEX_0_ENABLE (1 << 4) +# define RADEON_TEX_1_ENABLE (1 << 5) +# define RADEON_TEX_2_ENABLE (1 << 6) +# define RADEON_TEX_3_ENABLE (1 << 7) +# define RADEON_TEX_BLEND_ENABLE_MASK (0xf << 12) +# define RADEON_TEX_BLEND_0_ENABLE (1 << 12) +# define RADEON_TEX_BLEND_1_ENABLE (1 << 13) +# define RADEON_TEX_BLEND_2_ENABLE (1 << 14) +# define RADEON_TEX_BLEND_3_ENABLE (1 << 15) +# define RADEON_PLANAR_YUV_ENABLE (1 << 20) +# define RADEON_SPECULAR_ENABLE (1 << 21) +# define RADEON_FOG_ENABLE (1 << 22) +# define RADEON_ALPHA_TEST_ENABLE (1 << 23) +# define RADEON_ANTI_ALIAS_NONE (0 << 24) +# define RADEON_ANTI_ALIAS_LINE (1 << 24) +# define RADEON_ANTI_ALIAS_POLY (2 << 24) +# define RADEON_ANTI_ALIAS_LINE_POLY (3 << 24) +# define RADEON_BUMP_MAP_ENABLE (1 << 26) +# define RADEON_BUMPED_MAP_T0 (0 << 27) +# define RADEON_BUMPED_MAP_T1 (1 << 27) +# define RADEON_BUMPED_MAP_T2 (2 << 27) +# define RADEON_TEX_3D_ENABLE_0 (1 << 29) +# define RADEON_TEX_3D_ENABLE_1 (1 << 30) +# define RADEON_MC_ENABLE (1 << 31) +#define RADEON_PP_FOG_COLOR 0x1c18 +# define RADEON_FOG_COLOR_MASK 0x00ffffff +# define RADEON_FOG_VERTEX (0 << 24) +# define RADEON_FOG_TABLE (1 << 24) +# define RADEON_FOG_USE_DEPTH (0 << 25) +# define RADEON_FOG_USE_DIFFUSE_ALPHA (2 << 25) +# define RADEON_FOG_USE_SPEC_ALPHA (3 << 25) +#define RADEON_PP_LUM_MATRIX 0x1d00 +#define RADEON_PP_MISC 0x1c14 +# define RADEON_REF_ALPHA_MASK 0x000000ff +# define RADEON_ALPHA_TEST_FAIL (0 << 8) +# define RADEON_ALPHA_TEST_LESS (1 << 8) +# define RADEON_ALPHA_TEST_LEQUAL (2 << 8) +# define RADEON_ALPHA_TEST_EQUAL (3 << 8) +# define RADEON_ALPHA_TEST_GEQUAL (4 << 8) +# define RADEON_ALPHA_TEST_GREATER (5 << 8) +# define RADEON_ALPHA_TEST_NEQUAL (6 << 8) +# define RADEON_ALPHA_TEST_PASS (7 << 8) +# define RADEON_ALPHA_TEST_OP_MASK (7 << 8) +# define RADEON_CHROMA_FUNC_FAIL (0 << 16) +# define RADEON_CHROMA_FUNC_PASS (1 << 16) +# define RADEON_CHROMA_FUNC_NEQUAL (2 << 16) +# define RADEON_CHROMA_FUNC_EQUAL (3 << 16) +# define RADEON_CHROMA_KEY_NEAREST (0 << 18) +# define RADEON_CHROMA_KEY_ZERO (1 << 18) +# define RADEON_SHADOW_ID_AUTO_INC (1 << 20) +# define RADEON_SHADOW_FUNC_EQUAL (0 << 21) +# define RADEON_SHADOW_FUNC_NEQUAL (1 << 21) +# define RADEON_SHADOW_PASS_1 (0 << 22) +# define RADEON_SHADOW_PASS_2 (1 << 22) +# define RADEON_RIGHT_HAND_CUBE_D3D (0 << 24) +# define RADEON_RIGHT_HAND_CUBE_OGL (1 << 24) +#define RADEON_PP_ROT_MATRIX_0 0x1d58 +#define RADEON_PP_ROT_MATRIX_1 0x1d5c +#define RADEON_PP_TXFILTER_0 0x1c54 +#define RADEON_PP_TXFILTER_1 0x1c6c +#define RADEON_PP_TXFILTER_2 0x1c84 +# define RADEON_MAG_FILTER_NEAREST (0 << 0) +# define RADEON_MAG_FILTER_LINEAR (1 << 0) +# define RADEON_MAG_FILTER_MASK (1 << 0) +# define RADEON_MIN_FILTER_NEAREST (0 << 1) +# define RADEON_MIN_FILTER_LINEAR (1 << 1) +# define RADEON_MIN_FILTER_NEAREST_MIP_NEAREST (2 << 1) +# define RADEON_MIN_FILTER_NEAREST_MIP_LINEAR (3 << 1) +# define RADEON_MIN_FILTER_LINEAR_MIP_NEAREST (6 << 1) +# define RADEON_MIN_FILTER_LINEAR_MIP_LINEAR (7 << 1) +# define RADEON_MIN_FILTER_ANISO_NEAREST (8 << 1) +# define RADEON_MIN_FILTER_ANISO_LINEAR (9 << 1) +# define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_NEAREST (10 << 1) +# define RADEON_MIN_FILTER_ANISO_NEAREST_MIP_LINEAR (11 << 1) +# define RADEON_MIN_FILTER_MASK (15 << 1) +# define RADEON_LOD_BIAS_MASK (0xffff << 8) +# define RADEON_LOD_BIAS_SHIFT 8 +# define RADEON_MAX_MIP_LEVEL_MASK (0x0f << 16) +# define RADEON_MAX_MIP_LEVEL_SHIFT 16 +# define RADEON_WRAPEN_S (1 << 22) +# define RADEON_CLAMP_S_WRAP (0 << 23) +# define RADEON_CLAMP_S_MIRROR (1 << 23) +# define RADEON_CLAMP_S_CLAMP_LAST (2 << 23) +# define RADEON_CLAMP_S_MIRROR_CLAMP_LAST (3 << 23) +# define RADEON_CLAMP_S_CLAMP_BORDER (4 << 23) +# define RADEON_CLAMP_S_MIRROR_CLAMP_BORDER (5 << 23) +# define RADEON_CLAMP_S_MASK (7 << 23) +# define RADEON_WRAPEN_T (1 << 26) +# define RADEON_CLAMP_T_WRAP (0 << 27) +# define RADEON_CLAMP_T_MIRROR (1 << 27) +# define RADEON_CLAMP_T_CLAMP_LAST (2 << 27) +# define RADEON_CLAMP_T_MIRROR_CLAMP_LAST (3 << 27) +# define RADEON_CLAMP_T_CLAMP_BORDER (4 << 27) +# define RADEON_CLAMP_T_MIRROR_CLAMP_BORDER (5 << 27) +# define RADEON_CLAMP_T_MASK (7 << 27) +# define RADEON_BORDER_MODE_OGL (0 << 31) +# define RADEON_BORDER_MODE_D3D (1 << 31) +#define RADEON_PP_TXFORMAT_0 0x1c58 +#define RADEON_PP_TXFORMAT_1 0x1c70 +#define RADEON_PP_TXFORMAT_2 0x1c88 +# define RADEON_TXFORMAT_I8 (0 << 0) +# define RADEON_TXFORMAT_AI88 (1 << 0) +# define RADEON_TXFORMAT_RGB332 (2 << 0) +# define RADEON_TXFORMAT_ARGB1555 (3 << 0) +# define RADEON_TXFORMAT_RGB565 (4 << 0) +# define RADEON_TXFORMAT_ARGB4444 (5 << 0) +# define RADEON_TXFORMAT_ARGB8888 (6 << 0) +# define RADEON_TXFORMAT_RGBA8888 (7 << 0) +# define RADEON_TXFORMAT_Y8 (8 << 0) +# define RADEON_TXFORMAT_FORMAT_MASK (31 << 0) +# define RADEON_TXFORMAT_FORMAT_SHIFT 0 +# define RADEON_TXFORMAT_APPLE_YUV_MODE (1 << 5) +# define RADEON_TXFORMAT_ALPHA_IN_MAP (1 << 6) +# define RADEON_TXFORMAT_NON_POWER2 (1 << 7) +# define RADEON_TXFORMAT_WIDTH_MASK (15 << 8) +# define RADEON_TXFORMAT_WIDTH_SHIFT 8 +# define RADEON_TXFORMAT_HEIGHT_MASK (15 << 12) +# define RADEON_TXFORMAT_HEIGHT_SHIFT 12 +# define RADEON_TXFORMAT_ST_ROUTE_STQ0 (0 << 24) +# define RADEON_TXFORMAT_ST_ROUTE_MASK (3 << 24) +# define RADEON_TXFORMAT_ST_ROUTE_STQ1 (1 << 24) +# define RADEON_TXFORMAT_ST_ROUTE_STQ2 (2 << 24) +# define RADEON_TXFORMAT_ENDIAN_NO_SWAP (0 << 26) +# define RADEON_TXFORMAT_ENDIAN_16BPP_SWAP (1 << 26) +# define RADEON_TXFORMAT_ENDIAN_32BPP_SWAP (2 << 26) +# define RADEON_TXFORMAT_ENDIAN_HALFDW_SWAP (3 << 26) +# define RADEON_TXFORMAT_ALPHA_MASK_ENABLE (1 << 28) +# define RADEON_TXFORMAT_CHROMA_KEY_ENABLE (1 << 29) +# define RADEON_TXFORMAT_CUBIC_MAP_ENABLE (1 << 30) +# define RADEON_TXFORMAT_PERSPECTIVE_ENABLE (1 << 31) +#define RADEON_PP_TXOFFSET_0 0x1c5c +#define RADEON_PP_TXOFFSET_1 0x1c74 +#define RADEON_PP_TXOFFSET_2 0x1c8c +# define RADEON_TXO_ENDIAN_NO_SWAP (0 << 0) +# define RADEON_TXO_ENDIAN_BYTE_SWAP (1 << 0) +# define RADEON_TXO_ENDIAN_WORD_SWAP (2 << 0) +# define RADEON_TXO_ENDIAN_HALFDW_SWAP (3 << 0) +# define RADEON_TXO_MACRO_LINEAR (0 << 2) +# define RADEON_TXO_MACRO_TILE (1 << 2) +# define RADEON_TXO_MICRO_LINEAR (0 << 3) +# define RADEON_TXO_MICRO_TILE_X2 (1 << 3) +# define RADEON_TXO_MICRO_TILE_OPT (2 << 3) +# define RADEON_TXO_OFFSET_MASK 0xffffffe0 +# define RADEON_TXO_OFFSET_SHIFT 5 +#define RADEON_PP_TXCBLEND_0 0x1c60 +#define RADEON_PP_TXCBLEND_1 0x1c78 +#define RADEON_PP_TXCBLEND_2 0x1c90 +# define RADEON_COLOR_ARG_A_SHIFT 0 +# define RADEON_COLOR_ARG_A_MASK (0x1f << 0) +# define RADEON_COLOR_ARG_A_ZERO (0 << 0) +# define RADEON_COLOR_ARG_A_CURRENT_COLOR (2 << 0) +# define RADEON_COLOR_ARG_A_CURRENT_ALPHA (3 << 0) +# define RADEON_COLOR_ARG_A_DIFFUSE_COLOR (4 << 0) +# define RADEON_COLOR_ARG_A_DIFFUSE_ALPHA (5 << 0) +# define RADEON_COLOR_ARG_A_SPECULAR_COLOR (6 << 0) +# define RADEON_COLOR_ARG_A_SPECULAR_ALPHA (7 << 0) +# define RADEON_COLOR_ARG_A_TFACTOR_COLOR (8 << 0) +# define RADEON_COLOR_ARG_A_TFACTOR_ALPHA (9 << 0) +# define RADEON_COLOR_ARG_A_T0_COLOR (10 << 0) +# define RADEON_COLOR_ARG_A_T0_ALPHA (11 << 0) +# define RADEON_COLOR_ARG_A_T1_COLOR (12 << 0) +# define RADEON_COLOR_ARG_A_T1_ALPHA (13 << 0) +# define RADEON_COLOR_ARG_A_T2_COLOR (14 << 0) +# define RADEON_COLOR_ARG_A_T2_ALPHA (15 << 0) +# define RADEON_COLOR_ARG_A_T3_COLOR (16 << 0) +# define RADEON_COLOR_ARG_A_T3_ALPHA (17 << 0) +# define RADEON_COLOR_ARG_B_SHIFT 5 +# define RADEON_COLOR_ARG_B_MASK (0x1f << 5) +# define RADEON_COLOR_ARG_B_ZERO (0 << 5) +# define RADEON_COLOR_ARG_B_CURRENT_COLOR (2 << 5) +# define RADEON_COLOR_ARG_B_CURRENT_ALPHA (3 << 5) +# define RADEON_COLOR_ARG_B_DIFFUSE_COLOR (4 << 5) +# define RADEON_COLOR_ARG_B_DIFFUSE_ALPHA (5 << 5) +# define RADEON_COLOR_ARG_B_SPECULAR_COLOR (6 << 5) +# define RADEON_COLOR_ARG_B_SPECULAR_ALPHA (7 << 5) +# define RADEON_COLOR_ARG_B_TFACTOR_COLOR (8 << 5) +# define RADEON_COLOR_ARG_B_TFACTOR_ALPHA (9 << 5) +# define RADEON_COLOR_ARG_B_T0_COLOR (10 << 5) +# define RADEON_COLOR_ARG_B_T0_ALPHA (11 << 5) +# define RADEON_COLOR_ARG_B_T1_COLOR (12 << 5) +# define RADEON_COLOR_ARG_B_T1_ALPHA (13 << 5) +# define RADEON_COLOR_ARG_B_T2_COLOR (14 << 5) +# define RADEON_COLOR_ARG_B_T2_ALPHA (15 << 5) +# define RADEON_COLOR_ARG_B_T3_COLOR (16 << 5) +# define RADEON_COLOR_ARG_B_T3_ALPHA (17 << 5) +# define RADEON_COLOR_ARG_C_SHIFT 10 +# define RADEON_COLOR_ARG_C_MASK (0x1f << 10) +# define RADEON_COLOR_ARG_C_ZERO (0 << 10) +# define RADEON_COLOR_ARG_C_CURRENT_COLOR (2 << 10) +# define RADEON_COLOR_ARG_C_CURRENT_ALPHA (3 << 10) +# define RADEON_COLOR_ARG_C_DIFFUSE_COLOR (4 << 10) +# define RADEON_COLOR_ARG_C_DIFFUSE_ALPHA (5 << 10) +# define RADEON_COLOR_ARG_C_SPECULAR_COLOR (6 << 10) +# define RADEON_COLOR_ARG_C_SPECULAR_ALPHA (7 << 10) +# define RADEON_COLOR_ARG_C_TFACTOR_COLOR (8 << 10) +# define RADEON_COLOR_ARG_C_TFACTOR_ALPHA (9 << 10) +# define RADEON_COLOR_ARG_C_T0_COLOR (10 << 10) +# define RADEON_COLOR_ARG_C_T0_ALPHA (11 << 10) +# define RADEON_COLOR_ARG_C_T1_COLOR (12 << 10) +# define RADEON_COLOR_ARG_C_T1_ALPHA (13 << 10) +# define RADEON_COLOR_ARG_C_T2_COLOR (14 << 10) +# define RADEON_COLOR_ARG_C_T2_ALPHA (15 << 10) +# define RADEON_COLOR_ARG_C_T3_COLOR (16 << 10) +# define RADEON_COLOR_ARG_C_T3_ALPHA (17 << 10) +# define RADEON_COMP_ARG_A (1 << 15) +# define RADEON_COMP_ARG_A_SHIFT 15 +# define RADEON_COMP_ARG_B (1 << 16) +# define RADEON_COMP_ARG_B_SHIFT 16 +# define RADEON_COMP_ARG_C (1 << 17) +# define RADEON_COMP_ARG_C_SHIFT 17 +# define RADEON_BLEND_CTL_MASK (7 << 18) +# define RADEON_BLEND_CTL_ADD (0 << 18) +# define RADEON_BLEND_CTL_SUBTRACT (1 << 18) +# define RADEON_BLEND_CTL_ADDSIGNED (2 << 18) +# define RADEON_BLEND_CTL_BLEND (3 << 18) +# define RADEON_BLEND_CTL_DOT3 (4 << 18) +# define RADEON_SCALE_SHIFT 21 +# define RADEON_SCALE_MASK (3 << 21) +# define RADEON_SCALE_1X (0 << 21) +# define RADEON_SCALE_2X (1 << 21) +# define RADEON_SCALE_4X (2 << 21) +# define RADEON_CLAMP_TX (1 << 23) +# define RADEON_T0_EQ_TCUR (1 << 24) +# define RADEON_T1_EQ_TCUR (1 << 25) +# define RADEON_T2_EQ_TCUR (1 << 26) +# define RADEON_T3_EQ_TCUR (1 << 27) +# define RADEON_COLOR_ARG_MASK 0x1f +# define RADEON_COMP_ARG_SHIFT 15 +#define RADEON_PP_TXABLEND_0 0x1c64 +#define RADEON_PP_TXABLEND_1 0x1c7c +#define RADEON_PP_TXABLEND_2 0x1c94 +# define RADEON_ALPHA_ARG_A_SHIFT 0 +# define RADEON_ALPHA_ARG_A_MASK (0xf << 0) +# define RADEON_ALPHA_ARG_A_ZERO (0 << 0) +# define RADEON_ALPHA_ARG_A_CURRENT_ALPHA (1 << 0) +# define RADEON_ALPHA_ARG_A_DIFFUSE_ALPHA (2 << 0) +# define RADEON_ALPHA_ARG_A_SPECULAR_ALPHA (3 << 0) +# define RADEON_ALPHA_ARG_A_TFACTOR_ALPHA (4 << 0) +# define RADEON_ALPHA_ARG_A_T0_ALPHA (5 << 0) +# define RADEON_ALPHA_ARG_A_T1_ALPHA (6 << 0) +# define RADEON_ALPHA_ARG_A_T2_ALPHA (7 << 0) +# define RADEON_ALPHA_ARG_A_T3_ALPHA (8 << 0) +# define RADEON_ALPHA_ARG_B_SHIFT 4 +# define RADEON_ALPHA_ARG_B_MASK (0xf << 4) +# define RADEON_ALPHA_ARG_B_ZERO (0 << 4) +# define RADEON_ALPHA_ARG_B_CURRENT_ALPHA (1 << 4) +# define RADEON_ALPHA_ARG_B_DIFFUSE_ALPHA (2 << 4) +# define RADEON_ALPHA_ARG_B_SPECULAR_ALPHA (3 << 4) +# define RADEON_ALPHA_ARG_B_TFACTOR_ALPHA (4 << 4) +# define RADEON_ALPHA_ARG_B_T0_ALPHA (5 << 4) +# define RADEON_ALPHA_ARG_B_T1_ALPHA (6 << 4) +# define RADEON_ALPHA_ARG_B_T2_ALPHA (7 << 4) +# define RADEON_ALPHA_ARG_B_T3_ALPHA (8 << 4) +# define RADEON_ALPHA_ARG_C_SHIFT 8 +# define RADEON_ALPHA_ARG_C_MASK (0xf << 8) +# define RADEON_ALPHA_ARG_C_ZERO (0 << 8) +# define RADEON_ALPHA_ARG_C_CURRENT_ALPHA (1 << 8) +# define RADEON_ALPHA_ARG_C_DIFFUSE_ALPHA (2 << 8) +# define RADEON_ALPHA_ARG_C_SPECULAR_ALPHA (3 << 8) +# define RADEON_ALPHA_ARG_C_TFACTOR_ALPHA (4 << 8) +# define RADEON_ALPHA_ARG_C_T0_ALPHA (5 << 8) +# define RADEON_ALPHA_ARG_C_T1_ALPHA (6 << 8) +# define RADEON_ALPHA_ARG_C_T2_ALPHA (7 << 8) +# define RADEON_ALPHA_ARG_C_T3_ALPHA (8 << 8) +# define RADEON_DOT_ALPHA_DONT_REPLICATE (1 << 9) +# define RADEON_ALPHA_ARG_MASK 0xf + +#define RADEON_PP_TFACTOR_0 0x1c68 +#define RADEON_PP_TFACTOR_1 0x1c80 +#define RADEON_PP_TFACTOR_2 0x1c98 + +#define RADEON_RB3D_BLENDCNTL 0x1c20 +# define RADEON_COMB_FCN_ADD_CLAMP (0 << 12) +# define RADEON_COMB_FCN_ADD_NOCLAMP (1 << 12) +# define RADEON_COMB_FCN_SUB_CLAMP (2 << 12) +# define RADEON_COMB_FCN_SUB_NOCLAMP (3 << 12) +# define RADEON_SRC_BLEND_GL_ZERO (32 << 16) +# define RADEON_SRC_BLEND_GL_ONE (33 << 16) +# define RADEON_SRC_BLEND_GL_SRC_COLOR (34 << 16) +# define RADEON_SRC_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 16) +# define RADEON_SRC_BLEND_GL_DST_COLOR (36 << 16) +# define RADEON_SRC_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 16) +# define RADEON_SRC_BLEND_GL_SRC_ALPHA (38 << 16) +# define RADEON_SRC_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 16) +# define RADEON_SRC_BLEND_GL_DST_ALPHA (40 << 16) +# define RADEON_SRC_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 16) +# define RADEON_SRC_BLEND_GL_SRC_ALPHA_SATURATE (42 << 16) +# define RADEON_SRC_BLEND_MASK (63 << 16) +# define RADEON_DST_BLEND_GL_ZERO (32 << 24) +# define RADEON_DST_BLEND_GL_ONE (33 << 24) +# define RADEON_DST_BLEND_GL_SRC_COLOR (34 << 24) +# define RADEON_DST_BLEND_GL_ONE_MINUS_SRC_COLOR (35 << 24) +# define RADEON_DST_BLEND_GL_DST_COLOR (36 << 24) +# define RADEON_DST_BLEND_GL_ONE_MINUS_DST_COLOR (37 << 24) +# define RADEON_DST_BLEND_GL_SRC_ALPHA (38 << 24) +# define RADEON_DST_BLEND_GL_ONE_MINUS_SRC_ALPHA (39 << 24) +# define RADEON_DST_BLEND_GL_DST_ALPHA (40 << 24) +# define RADEON_DST_BLEND_GL_ONE_MINUS_DST_ALPHA (41 << 24) +# define RADEON_DST_BLEND_MASK (63 << 24) +#define RADEON_RB3D_CNTL 0x1c3c +# define RADEON_ALPHA_BLEND_ENABLE (1 << 0) +# define RADEON_PLANE_MASK_ENABLE (1 << 1) +# define RADEON_DITHER_ENABLE (1 << 2) +# define RADEON_ROUND_ENABLE (1 << 3) +# define RADEON_SCALE_DITHER_ENABLE (1 << 4) +# define RADEON_DITHER_INIT (1 << 5) +# define RADEON_ROP_ENABLE (1 << 6) +# define RADEON_STENCIL_ENABLE (1 << 7) +# define RADEON_Z_ENABLE (1 << 8) +# define RADEON_DEPTH_XZ_OFFEST_ENABLE (1 << 9) +# define RADEON_COLOR_FORMAT_ARGB1555 (3 << 10) +# define RADEON_COLOR_FORMAT_RGB565 (4 << 10) +# define RADEON_COLOR_FORMAT_ARGB8888 (6 << 10) +# define RADEON_COLOR_FORMAT_RGB332 (7 << 10) +# define RADEON_COLOR_FORMAT_Y8 (8 << 10) +# define RADEON_COLOR_FORMAT_RGB8 (9 << 10) +# define RADEON_COLOR_FORMAT_YUV422_VYUY (11 << 10) +# define RADEON_COLOR_FORMAT_YUV422_YVYU (12 << 10) +# define RADEON_COLOR_FORMAT_aYUV444 (14 << 10) +# define RADEON_COLOR_FORMAT_ARGB4444 (15 << 10) +# define RADEON_CLRCMP_FLIP_ENABLE (1 << 14) +# define RADEON_ZBLOCK8 (0 << 15) +# define RADEON_ZBLOCK16 (1 << 15) +#define RADEON_RB3D_COLOROFFSET 0x1c40 +# define RADEON_COLOROFFSET_MASK 0xfffffff0 +#define RADEON_RB3D_COLORPITCH 0x1c48 +# define RADEON_COLORPITCH_MASK 0x000001ff8 +# define RADEON_COLOR_TILE_ENABLE (1 << 16) +# define RADEON_COLOR_MICROTILE_ENABLE (1 << 17) +# define RADEON_COLOR_ENDIAN_NO_SWAP (0 << 18) +# define RADEON_COLOR_ENDIAN_WORD_SWAP (1 << 18) +# define RADEON_COLOR_ENDIAN_DWORD_SWAP (2 << 18) +#define RADEON_RB3D_DEPTHOFFSET 0x1c24 +#define RADEON_RB3D_DEPTHPITCH 0x1c28 +# define RADEON_DEPTHPITCH_MASK 0x00001ff8 +# define RADEON_DEPTH_ENDIAN_NO_SWAP (0 << 18) +# define RADEON_DEPTH_ENDIAN_WORD_SWAP (1 << 18) +# define RADEON_DEPTH_ENDIAN_DWORD_SWAP (2 << 18) +#define RADEON_RB3D_PLANEMASK 0x1d84 +#define RADEON_RB3D_ROPCNTL 0x1d80 +#define RADEON_RB3D_STENCILREFMASK 0x1d7c +# define RADEON_STENCIL_REF_SHIFT 0 +# define RADEON_STENCIL_MASK_SHIFT 16 +# define RADEON_STENCIL_WRITEMASK_SHIFT 24 +#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c +# define RADEON_DEPTH_FORMAT_MASK (0xf << 0) +# define RADEON_DEPTH_FORMAT_16BIT_INT_Z (0 << 0) +# define RADEON_DEPTH_FORMAT_24BIT_INT_Z (2 << 0) +# define RADEON_DEPTH_FORMAT_24BIT_FLOAT_Z (3 << 0) +# define RADEON_DEPTH_FORMAT_32BIT_INT_Z (4 << 0) +# define RADEON_DEPTH_FORMAT_32BIT_FLOAT_Z (5 << 0) +# define RADEON_DEPTH_FORMAT_16BIT_FLOAT_W (7 << 0) +# define RADEON_DEPTH_FORMAT_24BIT_FLOAT_W (9 << 0) +# define RADEON_DEPTH_FORMAT_32BIT_FLOAT_W (11 << 0) +# define RADEON_Z_TEST_NEVER (0 << 4) +# define RADEON_Z_TEST_LESS (1 << 4) +# define RADEON_Z_TEST_LEQUAL (2 << 4) +# define RADEON_Z_TEST_EQUAL (3 << 4) +# define RADEON_Z_TEST_GEQUAL (4 << 4) +# define RADEON_Z_TEST_GREATER (5 << 4) +# define RADEON_Z_TEST_NEQUAL (6 << 4) +# define RADEON_Z_TEST_ALWAYS (7 << 4) +# define RADEON_Z_TEST_MASK (7 << 4) +# define RADEON_HIERARCHICAL_Z_ENABLE (1 << 8) +# define RADEON_STENCIL_TEST_NEVER (0 << 12) +# define RADEON_STENCIL_TEST_LESS (1 << 12) +# define RADEON_STENCIL_TEST_LEQUAL (2 << 12) +# define RADEON_STENCIL_TEST_EQUAL (3 << 12) +# define RADEON_STENCIL_TEST_GEQUAL (4 << 12) +# define RADEON_STENCIL_TEST_GREATER (5 << 12) +# define RADEON_STENCIL_TEST_NEQUAL (6 << 12) +# define RADEON_STENCIL_TEST_ALWAYS (7 << 12) +# define RADEON_STENCIL_S_FAIL_KEEP (0 << 16) +# define RADEON_STENCIL_S_FAIL_ZERO (1 << 16) +# define RADEON_STENCIL_S_FAIL_REPLACE (2 << 16) +# define RADEON_STENCIL_S_FAIL_INC (3 << 16) +# define RADEON_STENCIL_S_FAIL_DEC (4 << 16) +# define RADEON_STENCIL_S_FAIL_INVERT (5 << 16) +# define RADEON_STENCIL_ZPASS_KEEP (0 << 20) +# define RADEON_STENCIL_ZPASS_ZERO (1 << 20) +# define RADEON_STENCIL_ZPASS_REPLACE (2 << 20) +# define RADEON_STENCIL_ZPASS_INC (3 << 20) +# define RADEON_STENCIL_ZPASS_DEC (4 << 20) +# define RADEON_STENCIL_ZPASS_INVERT (5 << 20) +# define RADEON_STENCIL_ZFAIL_KEEP (0 << 20) +# define RADEON_STENCIL_ZFAIL_ZERO (1 << 20) +# define RADEON_STENCIL_ZFAIL_REPLACE (2 << 20) +# define RADEON_STENCIL_ZFAIL_INC (3 << 20) +# define RADEON_STENCIL_ZFAIL_DEC (4 << 20) +# define RADEON_STENCIL_ZFAIL_INVERT (5 << 20) +# define RADEON_Z_COMPRESSION_ENABLE (1 << 28) +# define RADEON_FORCE_Z_DIRTY (1 << 29) +# define RADEON_Z_WRITE_ENABLE (1 << 30) +# define RADEON_Z_DECOMPRESSION_ENABLE (1 << 31) +#define RADEON_RE_LINE_PATTERN 0x1cd0 +# define RADEON_LINE_PATTERN_MASK 0x0000ffff +# define RADEON_LINE_REPEAT_COUNT_SHIFT 16 +# define RADEON_LINE_PATTERN_START_SHIFT 24 +# define RADEON_LINE_PATTERN_LITTLE_BIT_ORDER (0 << 28) +# define RADEON_LINE_PATTERN_BIG_BIT_ORDER (1 << 28) +# define RADEON_LINE_PATTERN_AUTO_RESET (1 << 29) +#define RADEON_RE_LINE_STATE 0x1cd4 +# define RADEON_LINE_CURRENT_PTR_SHIFT 0 +# define RADEON_LINE_CURRENT_COUNT_SHIFT 8 +#define RADEON_RE_MISC 0x26c4 +# define RADEON_STIPPLE_COORD_MASK 0x1f +# define RADEON_STIPPLE_X_OFFSET_SHIFT 0 +# define RADEON_STIPPLE_X_OFFSET_MASK (0x1f << 0) +# define RADEON_STIPPLE_Y_OFFSET_SHIFT 8 +# define RADEON_STIPPLE_Y_OFFSET_MASK (0x1f << 8) +# define RADEON_STIPPLE_LITTLE_BIT_ORDER (0 << 16) +# define RADEON_STIPPLE_BIG_BIT_ORDER (1 << 16) +#define RADEON_RE_SOLID_COLOR 0x1c1c +#define RADEON_RE_TOP_LEFT 0x26c0 +# define RADEON_RE_LEFT_SHIFT 0 +# define RADEON_RE_TOP_SHIFT 16 +#define RADEON_RE_WIDTH_HEIGHT 0x1c44 +# define RADEON_RE_WIDTH_SHIFT 0 +# define RADEON_RE_HEIGHT_SHIFT 16 + +#define RADEON_SE_CNTL 0x1c4c +# define RADEON_FFACE_CULL_CW (0 << 0) +# define RADEON_FFACE_CULL_CCW (1 << 0) +# define RADEON_FFACE_CULL_DIR_MASK (1 << 0) +# define RADEON_BFACE_CULL (0 << 1) +# define RADEON_BFACE_SOLID (3 << 1) +# define RADEON_FFACE_CULL (0 << 3) +# define RADEON_FFACE_SOLID (3 << 3) +# define RADEON_FFACE_CULL_MASK (3 << 3) +# define RADEON_BADVTX_CULL_DISABLE (1 << 5) +# define RADEON_FLAT_SHADE_VTX_0 (0 << 6) +# define RADEON_FLAT_SHADE_VTX_1 (1 << 6) +# define RADEON_FLAT_SHADE_VTX_2 (2 << 6) +# define RADEON_FLAT_SHADE_VTX_LAST (3 << 6) +# define RADEON_DIFFUSE_SHADE_SOLID (0 << 8) +# define RADEON_DIFFUSE_SHADE_FLAT (1 << 8) +# define RADEON_DIFFUSE_SHADE_GOURAUD (2 << 8) +# define RADEON_DIFFUSE_SHADE_MASK (3 << 8) +# define RADEON_ALPHA_SHADE_SOLID (0 << 10) +# define RADEON_ALPHA_SHADE_FLAT (1 << 10) +# define RADEON_ALPHA_SHADE_GOURAUD (2 << 10) +# define RADEON_ALPHA_SHADE_MASK (3 << 10) +# define RADEON_SPECULAR_SHADE_SOLID (0 << 12) +# define RADEON_SPECULAR_SHADE_FLAT (1 << 12) +# define RADEON_SPECULAR_SHADE_GOURAUD (2 << 12) +# define RADEON_SPECULAR_SHADE_MASK (3 << 12) +# define RADEON_FOG_SHADE_SOLID (0 << 14) +# define RADEON_FOG_SHADE_FLAT (1 << 14) +# define RADEON_FOG_SHADE_GOURAUD (2 << 14) +# define RADEON_FOG_SHADE_MASK (3 << 14) +# define RADEON_ZBIAS_ENABLE_POINT (1 << 16) +# define RADEON_ZBIAS_ENABLE_LINE (1 << 17) +# define RADEON_ZBIAS_ENABLE_TRI (1 << 18) +# define RADEON_WIDELINE_ENABLE (1 << 20) +# define RADEON_VPORT_XY_XFORM_ENABLE (1 << 24) +# define RADEON_VPORT_Z_XFORM_ENABLE (1 << 25) +# define RADEON_VTX_PIX_CENTER_D3D (0 << 27) +# define RADEON_VTX_PIX_CENTER_OGL (1 << 27) +# define RADEON_ROUND_MODE_TRUNC (0 << 28) +# define RADEON_ROUND_MODE_ROUND (1 << 28) +# define RADEON_ROUND_MODE_ROUND_EVEN (2 << 28) +# define RADEON_ROUND_MODE_ROUND_ODD (3 << 28) +# define RADEON_ROUND_PREC_16TH_PIX (0 << 30) +# define RADEON_ROUND_PREC_8TH_PIX (1 << 30) +# define RADEON_ROUND_PREC_4TH_PIX (2 << 30) +# define RADEON_ROUND_PREC_HALF_PIX (3 << 30) +#define RADEON_SE_CNTL_STATUS 0x2140 +# define RADEON_VC_NO_SWAP (0 << 0) +# define RADEON_VC_16BIT_SWAP (1 << 0) +# define RADEON_VC_32BIT_SWAP (2 << 0) +# define RADEON_VC_HALF_DWORD_SWAP (3 << 0) +# define RADEON_TCL_BYPASS (1 << 8) +#define RADEON_SE_COORD_FMT 0x15c0 +# define RADEON_VTX_XY_PRE_MULT_1_OVER_W0 (1 << 0) +# define RADEON_VTX_Z_PRE_MULT_1_OVER_W0 (1 << 1) +# define RADEON_VTX_ST0_NONPARAMETRIC (1 << 8) +# define RADEON_VTX_ST1_NONPARAMETRIC (1 << 9) +# define RADEON_VTX_ST2_NONPARAMETRIC (1 << 10) +# define RADEON_VTX_ST3_NONPARAMETRIC (1 << 11) +# define RADEON_VTX_W0_NORMALIZE (1 << 12) +# define RADEON_VTX_W0_IS_NOT_1_OVER_W0 (1 << 16) +# define RADEON_VTX_ST0_PRE_MULT_1_OVER_W0 (1 << 17) +# define RADEON_VTX_ST1_PRE_MULT_1_OVER_W0 (1 << 19) +# define RADEON_VTX_ST2_PRE_MULT_1_OVER_W0 (1 << 21) +# define RADEON_VTX_ST3_PRE_MULT_1_OVER_W0 (1 << 23) +# define RADEON_TEX1_W_ROUTING_USE_W0 (0 << 26) +# define RADEON_TEX1_W_ROUTING_USE_Q1 (1 << 26) +#define RADEON_SE_LINE_WIDTH 0x1db8 +#define RADEON_SE_TCL_LIGHT_MODEL_CTL 0x226c +#define RADEON_SE_TCL_MATERIAL_AMBIENT_RED 0x2220 +#define RADEON_SE_TCL_MATERIAL_AMBIENT_GREEN 0x2224 +#define RADEON_SE_TCL_MATERIAL_AMBIENT_BLUE 0x2228 +#define RADEON_SE_TCL_MATERIAL_AMBIENT_ALPHA 0x222c +#define RADEON_SE_TCL_MATERIAL_DIFFUSE_RED 0x2230 +#define RADEON_SE_TCL_MATERIAL_DIFFUSE_GREEN 0x2234 +#define RADEON_SE_TCL_MATERIAL_DIFFUSE_BLUE 0x2238 +#define RADEON_SE_TCL_MATERIAL_DIFFUSE_ALPHA 0x223c +#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED 0x2210 +#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_GREEN 0x2214 +#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_BLUE 0x2218 +#define RADEON_SE_TCL_MATERIAL_EMMISSIVE_ALPHA 0x221c +#define RADEON_SE_TCL_MATERIAL_SPECULAR_RED 0x2240 +#define RADEON_SE_TCL_MATERIAL_SPECULAR_GREEN 0x2244 +#define RADEON_SE_TCL_MATERIAL_SPECULAR_BLUE 0x2248 +#define RADEON_SE_TCL_MATERIAL_SPECULAR_ALPHA 0x224c +#define RADEON_SE_TCL_MATRIX_SELECT_0 0x225c +#define RADEON_SE_TCL_MATRIX_SELECT_1 0x2260 +#define RADEON_SE_TCL_OUTPUT_VTX_FMT 0x2254 +#define RADEON_SE_TCL_OUTPUT_VTX_SEL 0x2258 +#define RADEON_SE_TCL_PER_LIGHT_CTL_0 0x2270 +#define RADEON_SE_TCL_PER_LIGHT_CTL_1 0x2274 +#define RADEON_SE_TCL_PER_LIGHT_CTL_2 0x2278 +#define RADEON_SE_TCL_PER_LIGHT_CTL_3 0x227c +#define RADEON_SE_TCL_SHININESS 0x2250 +#define RADEON_SE_TCL_TEXTURE_PROC_CTL 0x2268 +#define RADEON_SE_TCL_UCP_VERT_BLEND_CTL 0x2264 +#define RADEON_SE_VPORT_XSCALE 0x1d98 +#define RADEON_SE_VPORT_XOFFSET 0x1d9c +#define RADEON_SE_VPORT_YSCALE 0x1da0 +#define RADEON_SE_VPORT_YOFFSET 0x1da4 +#define RADEON_SE_VPORT_ZSCALE 0x1da8 +#define RADEON_SE_VPORT_ZOFFSET 0x1dac + + /* Registers for CP and Microcode Engine */ #define RADEON_CP_ME_RAM_ADDR 0x07d4 #define RADEON_CP_ME_RAM_RADDR 0x07d8 #define RADEON_CP_ME_RAM_DATAH 0x07dc @@ -945,18 +1510,28 @@ #define RADEON_CP_RB_RPTR_ADDR 0x070c #define RADEON_CP_RB_RPTR 0x0710 #define RADEON_CP_RB_WPTR 0x0714 -# define RADEON_PM4_BUFFER_DL_DONE (1 << 31) #define RADEON_CP_IB_BASE 0x0738 #define RADEON_CP_IB_BUFSZ 0x073c #define RADEON_CP_CSQ_CNTL 0x0740 -# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28) -# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28) -# define RADEON_CSQ_PRIBM_INDDIS (2 << 28) -# define RADEON_CSQ_PRIPIO_INDBM (3 << 28) -# define RADEON_CSQ_PRIBM_INDBM (4 << 28) -# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28) +# define RADEON_CSQ_CNT_PRIMARY_MASK (0xff << 0) +# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28) +# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28) +# define RADEON_CSQ_PRIBM_INDDIS (2 << 28) +# define RADEON_CSQ_PRIPIO_INDBM (3 << 28) +# define RADEON_CSQ_PRIBM_INDBM (4 << 28) +# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28) +#define RADEON_CP_CSQ_STAT 0x07f8 +# define RADEON_CSQ_RPTR_PRIMARY_MASK (0xff << 0) +# define RADEON_CSQ_WPTR_PRIMARY_MASK (0xff << 8) +# define RADEON_CSQ_RPTR_INDIRECT_MASK (0xff << 16) +# define RADEON_CSQ_WPTR_INDIRECT_MASK (0xff << 24) +#define RADEON_CP_CSQ_ADDR 0x07f0 +#define RADEON_CP_CSQ_DATA 0x07f4 +#define RADEON_CP_CSQ_APER_PRIMARY 0x1000 +#define RADEON_CP_CSQ_APER_INDIRECT 0x1300 + #define RADEON_CP_RB_WPTR_DELAY 0x0718 # define RADEON_PRE_WRITE_TIMER_SHIFT 0 # define RADEON_PRE_WRITE_LIMIT_SHIFT 23 @@ -964,518 +1539,94 @@ #define RADEON_AIC_CNTL 0x01d0 # define RADEON_PCIGART_TRANSLATE_EN (1 << 0) -#define RADEON_PM4_VC_FPU_SETUP 0x071c -# define RADEON_FRONT_DIR_CW (0 << 0) -# define RADEON_FRONT_DIR_CCW (1 << 0) -# define RADEON_FRONT_DIR_MASK (1 << 0) -# define RADEON_BACKFACE_CULL (0 << 1) -# define RADEON_BACKFACE_POINTS (1 << 1) -# define RADEON_BACKFACE_LINES (2 << 1) -# define RADEON_BACKFACE_SOLID (3 << 1) -# define RADEON_BACKFACE_MASK (3 << 1) -# define RADEON_FRONTFACE_CULL (0 << 3) -# define RADEON_FRONTFACE_POINTS (1 << 3) -# define RADEON_FRONTFACE_LINES (2 << 3) -# define RADEON_FRONTFACE_SOLID (3 << 3) -# define RADEON_FRONTFACE_MASK (3 << 3) -# define RADEON_FPU_COLOR_SOLID (0 << 5) -# define RADEON_FPU_COLOR_FLAT (1 << 5) -# define RADEON_FPU_COLOR_GOURAUD (2 << 5) -# define RADEON_FPU_COLOR_GOURAUD2 (3 << 5) -# define RADEON_FPU_COLOR_MASK (3 << 5) -# define RADEON_FPU_SUB_PIX_2BITS (0 << 7) -# define RADEON_FPU_SUB_PIX_4BITS (1 << 7) -# define RADEON_FPU_MODE_2D (0 << 8) -# define RADEON_FPU_MODE_3D (1 << 8) -# define RADEON_TRAP_BITS_DISABLE (1 << 9) -# define RADEON_EDGE_ANTIALIAS (1 << 10) -# define RADEON_SUPERSAMPLE (1 << 11) -# define RADEON_XFACTOR_2 (0 << 12) -# define RADEON_XFACTOR_4 (1 << 12) -# define RADEON_YFACTOR_2 (0 << 13) -# define RADEON_YFACTOR_4 (1 << 13) -# define RADEON_FLAT_SHADE_VERTEX_D3D (0 << 14) -# define RADEON_FLAT_SHADE_VERTEX_OGL (1 << 14) -# define RADEON_FPU_ROUND_TRUNCATE (0 << 15) -# define RADEON_FPU_ROUND_NEAREST (1 << 15) -# define RADEON_WM_SEL_8DW (0 << 16) -# define RADEON_WM_SEL_16DW (1 << 16) -# define RADEON_WM_SEL_32DW (2 << 16) -#define RADEON_PM4_VC_DEBUG_CONFIG 0x07a4 -#define RADEON_PM4_VC_STAT 0x07a8 -#define RADEON_PM4_VC_TIMESTAMP0 0x07b0 -#define RADEON_PM4_VC_TIMESTAMP1 0x07b4 -#define RADEON_PM4_STAT 0x07b8 -# define RADEON_PM4_FIFOCNT_MASK 0x0fff -# define RADEON_PM4_BUSY (1 << 16) -# define RADEON_PM4_GUI_ACTIVE (1 << 31) -#define RADEON_PM4_BUFFER_ADDR 0x07f0 -#define RADEON_CP_ME_CNTL 0x07d0 -# define RADEON_CP_ME_FREERUN (1 << 30) -#define RADEON_PM4_FIFO_DATA_EVEN 0x1000 -#define RADEON_PM4_FIFO_DATA_ODD 0x1004 - -#define RADEON_SCALE_3D_CNTL 0x1a00 -# define RADEON_SCALE_DITHER_ERR_DIFF (0 << 1) -# define RADEON_SCALE_DITHER_TABLE (1 << 1) -# define RADEON_TEX_CACHE_SIZE_FULL (0 << 2) -# define RADEON_TEX_CACHE_SIZE_HALF (1 << 2) -# define RADEON_DITHER_INIT_CURR (0 << 3) -# define RADEON_DITHER_INIT_RESET (1 << 3) -# define RADEON_ROUND_24BIT (1 << 4) -# define RADEON_TEX_CACHE_DISABLE (1 << 5) -# define RADEON_SCALE_3D_NOOP (0 << 6) -# define RADEON_SCALE_3D_SCALE (1 << 6) -# define RADEON_SCALE_3D_TEXMAP_SHADE (2 << 6) -# define RADEON_SCALE_PIX_BLEND (0 << 8) -# define RADEON_SCALE_PIX_REPLICATE (1 << 8) -# define RADEON_TEX_CACHE_SPLIT (1 << 9) -# define RADEON_APPLE_YUV_MODE (1 << 10) -# define RADEON_TEX_CACHE_PALLETE_MODE (1 << 11) -# define RADEON_ALPHA_COMB_ADD_CLAMP (0 << 12) -# define RADEON_ALPHA_COMB_ADD_NCLAMP (1 << 12) -# define RADEON_ALPHA_COMB_SUB_DST_SRC_CLAMP (2 << 12) -# define RADEON_ALPHA_COMB_SUB_DST_SRC_NCLAMP (3 << 12) -# define RADEON_FOG_TABLE (1 << 14) -# define RADEON_SIGNED_DST_CLAMP (1 << 15) -# define RADEON_ALPHA_BLEND_SRC_ZERO (0 << 16) -# define RADEON_ALPHA_BLEND_SRC_ONE (1 << 16) -# define RADEON_ALPHA_BLEND_SRC_SRCCOLOR (2 << 16) -# define RADEON_ALPHA_BLEND_SRC_INVSRCCOLOR (3 << 16) -# define RADEON_ALPHA_BLEND_SRC_SRCALPHA (4 << 16) -# define RADEON_ALPHA_BLEND_SRC_INVSRCALPHA (5 << 16) -# define RADEON_ALPHA_BLEND_SRC_DSTALPHA (6 << 16) -# define RADEON_ALPHA_BLEND_SRC_INVDSTALPHA (7 << 16) -# define RADEON_ALPHA_BLEND_SRC_DSTCOLOR (8 << 16) -# define RADEON_ALPHA_BLEND_SRC_INVDSTCOLOR (9 << 16) -# define RADEON_ALPHA_BLEND_SRC_SAT (10 << 16) -# define RADEON_ALPHA_BLEND_SRC_BLEND (11 << 16) -# define RADEON_ALPHA_BLEND_SRC_INVBLEND (12 << 16) -# define RADEON_ALPHA_BLEND_DST_ZERO (0 << 20) -# define RADEON_ALPHA_BLEND_DST_ONE (1 << 20) -# define RADEON_ALPHA_BLEND_DST_SRCCOLOR (2 << 20) -# define RADEON_ALPHA_BLEND_DST_INVSRCCOLOR (3 << 20) -# define RADEON_ALPHA_BLEND_DST_SRCALPHA (4 << 20) -# define RADEON_ALPHA_BLEND_DST_INVSRCALPHA (5 << 20) -# define RADEON_ALPHA_BLEND_DST_DSTALPHA (6 << 20) -# define RADEON_ALPHA_BLEND_DST_INVDSTALPHA (7 << 20) -# define RADEON_ALPHA_BLEND_DST_DSTCOLOR (8 << 20) -# define RADEON_ALPHA_BLEND_DST_INVDSTCOLOR (9 << 20) -# define RADEON_ALPHA_TEST_NEVER (0 << 24) -# define RADEON_ALPHA_TEST_LESS (1 << 24) -# define RADEON_ALPHA_TEST_LESSEQUAL (2 << 24) -# define RADEON_ALPHA_TEST_EQUAL (3 << 24) -# define RADEON_ALPHA_TEST_GREATEREQUAL (4 << 24) -# define RADEON_ALPHA_TEST_GREATER (5 << 24) -# define RADEON_ALPHA_TEST_NEQUAL (6 << 24) -# define RADEON_ALPHA_TEST_ALWAYS (7 << 24) -# define RADEON_COMPOSITE_SHADOW_CMP_EQUAL (0 << 28) -# define RADEON_COMPOSITE_SHADOW_CMP_NEQUAL (1 << 28) -# define RADEON_COMPOSITE_SHADOW (1 << 29) -# define RADEON_TEX_MAP_ALPHA_IN_TEXTURE (1 << 30) -# define RADEON_TEX_CACHE_LINE_SIZE_8QW (0 << 31) -# define RADEON_TEX_CACHE_LINE_SIZE_4QW (1 << 31) -#define RADEON_SCALE_3D_DATATYPE 0x1a20 - -#define RADEON_SETUP_CNTL 0x1bc4 -# define RADEON_DONT_START_TRIANGLE (1 << 0) -# define RADEON_Z_BIAS (0 << 1) -# define RADEON_DONT_START_ANY_ON (1 << 2) -# define RADEON_COLOR_SOLID_COLOR (0 << 3) -# define RADEON_COLOR_FLAT_VERT_1 (1 << 3) -# define RADEON_COLOR_FLAT_VERT_2 (2 << 3) -# define RADEON_COLOR_FLAT_VERT_3 (3 << 3) -# define RADEON_COLOR_GOURAUD (4 << 3) -# define RADEON_PRIM_TYPE_TRI (0 << 7) -# define RADEON_PRIM_TYPE_LINE (1 << 7) -# define RADEON_PRIM_TYPE_POINT (2 << 7) -# define RADEON_PRIM_TYPE_POLY_EDGE (3 << 7) -# define RADEON_TEXTURE_ST_MULT_W (0 << 9) -# define RADEON_TEXTURE_ST_DIRECT (1 << 9) -# define RADEON_STARTING_VERTEX_1 (1 << 14) -# define RADEON_STARTING_VERTEX_2 (2 << 14) -# define RADEON_STARTING_VERTEX_3 (3 << 14) -# define RADEON_ENDING_VERTEX_1 (1 << 16) -# define RADEON_ENDING_VERTEX_2 (2 << 16) -# define RADEON_ENDING_VERTEX_3 (3 << 16) -# define RADEON_SU_POLY_LINE_LAST (0 << 18) -# define RADEON_SU_POLY_LINE_NOT_LAST (1 << 18) -# define RADEON_SUB_PIX_2BITS (0 << 19) -# define RADEON_SUB_PIX_4BITS (1 << 19) -# define RADEON_SET_UP_CONTINUE (1 << 31) - -#define RADEON_WINDOW_XY_OFFSET 0x1bcc -# define RADEON_WINDOW_Y_SHIFT 4 -# define RADEON_WINDOW_X_SHIFT 20 - -#define RADEON_Z_OFFSET_C 0x1c90 -#define RADEON_Z_PITCH_C 0x1c94 -#define RADEON_Z_STEN_CNTL_C 0x1c98 -# define RADEON_Z_PIX_WIDTH_16 (0 << 1) -# define RADEON_Z_PIX_WIDTH_24 (1 << 1) -# define RADEON_Z_PIX_WIDTH_32 (2 << 1) -# define RADEON_Z_PIX_WIDTH_MASK (3 << 1) -# define RADEON_Z_TEST_NEVER (0 << 4) -# define RADEON_Z_TEST_LESS (1 << 4) -# define RADEON_Z_TEST_LESSEQUAL (2 << 4) -# define RADEON_Z_TEST_EQUAL (3 << 4) -# define RADEON_Z_TEST_GREATEREQUAL (4 << 4) -# define RADEON_Z_TEST_GREATER (5 << 4) -# define RADEON_Z_TEST_NEQUAL (6 << 4) -# define RADEON_Z_TEST_ALWAYS (7 << 4) -# define RADEON_Z_TEST_MASK (7 << 4) -# define RADEON_STENCIL_TEST_NEVER (0 << 12) -# define RADEON_STENCIL_TEST_LESS (1 << 12) -# define RADEON_STENCIL_TEST_LESSEQUAL (2 << 12) -# define RADEON_STENCIL_TEST_EQUAL (3 << 12) -# define RADEON_STENCIL_TEST_GREATEREQUAL (4 << 12) -# define RADEON_STENCIL_TEST_GREATER (5 << 12) -# define RADEON_STENCIL_TEST_NEQUAL (6 << 12) -# define RADEON_STENCIL_TEST_ALWAYS (7 << 12) -# define RADEON_STENCIL_S_FAIL_KEEP (0 << 16) -# define RADEON_STENCIL_S_FAIL_ZERO (1 << 16) -# define RADEON_STENCIL_S_FAIL_REPLACE (2 << 16) -# define RADEON_STENCIL_S_FAIL_INC (3 << 16) -# define RADEON_STENCIL_S_FAIL_DEC (4 << 16) -# define RADEON_STENCIL_S_FAIL_INV (5 << 16) -# define RADEON_STENCIL_ZPASS_KEEP (0 << 20) -# define RADEON_STENCIL_ZPASS_ZERO (1 << 20) -# define RADEON_STENCIL_ZPASS_REPLACE (2 << 20) -# define RADEON_STENCIL_ZPASS_INC (3 << 20) -# define RADEON_STENCIL_ZPASS_DEC (4 << 20) -# define RADEON_STENCIL_ZPASS_INV (5 << 20) -# define RADEON_STENCIL_ZFAIL_KEEP (0 << 24) -# define RADEON_STENCIL_ZFAIL_ZERO (1 << 24) -# define RADEON_STENCIL_ZFAIL_REPLACE (2 << 24) -# define RADEON_STENCIL_ZFAIL_INC (3 << 24) -# define RADEON_STENCIL_ZFAIL_DEC (4 << 24) -# define RADEON_STENCIL_ZFAIL_INV (5 << 24) -#define RADEON_TEX_CNTL_C 0x1c9c -# define RADEON_Z_ENABLE (1 << 0) -# define RADEON_Z_WRITE_ENABLE (1 << 1) -# define RADEON_STENCIL_ENABLE (1 << 3) -# define RADEON_SHADE_ENABLE (0 << 4) -# define RADEON_TEXMAP_ENABLE (1 << 4) -# define RADEON_SEC_TEXMAP_ENABLE (1 << 5) -# define RADEON_FOG_ENABLE (1 << 7) -# define RADEON_DITHER_ENABLE (1 << 8) -# define RADEON_ALPHA_ENABLE (1 << 9) -# define RADEON_ALPHA_TEST_ENABLE (1 << 10) -# define RADEON_SPEC_LIGHT_ENABLE (1 << 11) -# define RADEON_TEX_CHROMA_KEY_ENABLE (1 << 12) -# define RADEON_ALPHA_IN_TEX_COMPLETE_A (0 << 13) -# define RADEON_ALPHA_IN_TEX_LSB_A (1 << 13) -# define RADEON_LIGHT_DIS (0 << 14) -# define RADEON_LIGHT_COPY (1 << 14) -# define RADEON_LIGHT_MODULATE (2 << 14) -# define RADEON_LIGHT_ADD (3 << 14) -# define RADEON_LIGHT_BLEND_CONSTANT (4 << 14) -# define RADEON_LIGHT_BLEND_TEXTURE (5 << 14) -# define RADEON_LIGHT_BLEND_VERTEX (6 << 14) -# define RADEON_LIGHT_BLEND_CONST_COLOR (7 << 14) -# define RADEON_ALPHA_LIGHT_DIS (0 << 18) -# define RADEON_ALPHA_LIGHT_COPY (1 << 18) -# define RADEON_ALPHA_LIGHT_MODULATE (2 << 18) -# define RADEON_ALPHA_LIGHT_ADD (3 << 18) -# define RADEON_ANTI_ALIAS (1 << 21) -# define RADEON_TEX_CACHE_FLUSH (1 << 23) -# define RADEON_LOD_BIAS_SHIFT 24 -#define RADEON_MISC_3D_STATE_CNTL_REG 0x1ca0 -# define RADEON_REF_ALPHA_MASK 0xff -# define RADEON_MISC_SCALE_3D_NOOP (0 << 8) -# define RADEON_MISC_SCALE_3D_SCALE (1 << 8) -# define RADEON_MISC_SCALE_3D_TEXMAP_SHADE (2 << 8) -# define RADEON_MISC_SCALE_PIX_BLEND (0 << 10) -# define RADEON_MISC_SCALE_PIX_REPLICATE (1 << 10) -# define RADEON_ALPHA_COMB_ADD_CLAMP (0 << 12) -# define RADEON_ALPHA_COMB_ADD_NO_CLAMP (1 << 12) -# define RADEON_ALPHA_COMB_SUB_SRC_DST_CLAMP (2 << 12) -# define RADEON_ALPHA_COMB_SUB_SRC_DST_NO_CLAMP (3 << 12) -# define RADEON_FOG_VERTEX (0 << 14) -# define RADEON_FOG_TABLE (1 << 14) -# define RADEON_ALPHA_BLEND_SRC_ZERO (0 << 16) -# define RADEON_ALPHA_BLEND_SRC_ONE (1 << 16) -# define RADEON_ALPHA_BLEND_SRC_SRCCOLOR (2 << 16) -# define RADEON_ALPHA_BLEND_SRC_INVSRCCOLOR (3 << 16) -# define RADEON_ALPHA_BLEND_SRC_SRCALPHA (4 << 16) -# define RADEON_ALPHA_BLEND_SRC_INVSRCALPHA (5 << 16) -# define RADEON_ALPHA_BLEND_SRC_DESTALPHA (6 << 16) -# define RADEON_ALPHA_BLEND_SRC_INVDESTALPHA (7 << 16) -# define RADEON_ALPHA_BLEND_SRC_DESTCOLOR (8 << 16) -# define RADEON_ALPHA_BLEND_SRC_INVDESTCOLOR (9 << 16) -# define RADEON_ALPHA_BLEND_SRC_SRCALPHASAT (10 << 16) -# define RADEON_ALPHA_BLEND_SRC_BOTHSRCALPHA (11 << 16) -# define RADEON_ALPHA_BLEND_SRC_BOTHINVSRCALPHA (12 << 16) -# define RADEON_ALPHA_BLEND_SRC_MASK (15 << 16) -# define RADEON_ALPHA_BLEND_DST_ZERO (0 << 20) -# define RADEON_ALPHA_BLEND_DST_ONE (1 << 20) -# define RADEON_ALPHA_BLEND_DST_SRCCOLOR (2 << 20) -# define RADEON_ALPHA_BLEND_DST_INVSRCCOLOR (3 << 20) -# define RADEON_ALPHA_BLEND_DST_SRCALPHA (4 << 20) -# define RADEON_ALPHA_BLEND_DST_INVSRCALPHA (5 << 20) -# define RADEON_ALPHA_BLEND_DST_DESTALPHA (6 << 20) -# define RADEON_ALPHA_BLEND_DST_INVDESTALPHA (7 << 20) -# define RADEON_ALPHA_BLEND_DST_DESTCOLOR (8 << 20) -# define RADEON_ALPHA_BLEND_DST_INVDESTCOLOR (9 << 20) -# define RADEON_ALPHA_BLEND_DST_SRCALPHASAT (10 << 20) -# define RADEON_ALPHA_BLEND_DST_MASK (15 << 20) -# define RADEON_ALPHA_TEST_NEVER (0 << 24) -# define RADEON_ALPHA_TEST_LESS (1 << 24) -# define RADEON_ALPHA_TEST_LESSEQUAL (2 << 24) -# define RADEON_ALPHA_TEST_EQUAL (3 << 24) -# define RADEON_ALPHA_TEST_GREATEREQUAL (4 << 24) -# define RADEON_ALPHA_TEST_GREATER (5 << 24) -# define RADEON_ALPHA_TEST_NEQUAL (6 << 24) -# define RADEON_ALPHA_TEST_ALWAYS (7 << 24) -# define RADEON_ALPHA_TEST_MASK (7 << 24) -#define RADEON_TEXTURE_CLR_CMP_CLR_C 0x1ca4 -#define RADEON_TEXTURE_CLR_CMP_MSK_C 0x1ca8 -#define RADEON_FOG_COLOR_C 0x1cac -# define RADEON_FOG_BLUE_SHIFT 0 -# define RADEON_FOG_GREEN_SHIFT 8 -# define RADEON_FOG_RED_SHIFT 16 -#define RADEON_PRIM_TEX_CNTL_C 0x1cb0 -# define RADEON_MIN_BLEND_NEAREST (0 << 1) -# define RADEON_MIN_BLEND_LINEAR (1 << 1) -# define RADEON_MIN_BLEND_MIPNEAREST (2 << 1) -# define RADEON_MIN_BLEND_MIPLINEAR (3 << 1) -# define RADEON_MIN_BLEND_LINEARMIPNEAREST (4 << 1) -# define RADEON_MIN_BLEND_LINEARMIPLINEAR (5 << 1) -# define RADEON_MIN_BLEND_MASK (7 << 1) -# define RADEON_MAG_BLEND_NEAREST (0 << 4) -# define RADEON_MAG_BLEND_LINEAR (1 << 4) -# define RADEON_MAG_BLEND_MASK (7 << 4) -# define RADEON_MIP_MAP_DISABLE (1 << 7) -# define RADEON_TEX_CLAMP_S_WRAP (0 << 8) -# define RADEON_TEX_CLAMP_S_MIRROR (1 << 8) -# define RADEON_TEX_CLAMP_S_CLAMP (2 << 8) -# define RADEON_TEX_CLAMP_S_BORDER_COLOR (3 << 8) -# define RADEON_TEX_CLAMP_S_MASK (3 << 8) -# define RADEON_TEX_WRAP_S (1 << 10) -# define RADEON_TEX_CLAMP_T_WRAP (0 << 11) -# define RADEON_TEX_CLAMP_T_MIRROR (1 << 11) -# define RADEON_TEX_CLAMP_T_CLAMP (2 << 11) -# define RADEON_TEX_CLAMP_T_BORDER_COLOR (3 << 11) -# define RADEON_TEX_CLAMP_T_MASK (3 << 11) -# define RADEON_TEX_WRAP_T (1 << 13) -# define RADEON_TEX_PERSPECTIVE_DISABLE (1 << 14) -# define RADEON_DATATYPE_VQ (0 << 16) -# define RADEON_DATATYPE_CI4 (1 << 16) -# define RADEON_DATATYPE_CI8 (2 << 16) -# define RADEON_DATATYPE_ARGB1555 (3 << 16) -# define RADEON_DATATYPE_RGB565 (4 << 16) -# define RADEON_DATATYPE_RGB888 (5 << 16) -# define RADEON_DATATYPE_ARGB8888 (6 << 16) -# define RADEON_DATATYPE_RGB332 (7 << 16) -# define RADEON_DATATYPE_Y8 (8 << 16) -# define RADEON_DATATYPE_RGB8 (9 << 16) -# define RADEON_DATATYPE_CI16 (10 << 16) -# define RADEON_DATATYPE_YUV422 (11 << 16) -# define RADEON_DATATYPE_YUV422_2 (12 << 16) -# define RADEON_DATATYPE_AYUV444 (14 << 16) -# define RADEON_DATATYPE_ARGB4444 (15 << 16) -# define RADEON_PALLETE_EITHER (0 << 20) -# define RADEON_PALLETE_1 (1 << 20) -# define RADEON_PALLETE_2 (2 << 20) -# define RADEON_PSEUDOCOLOR_DT_RGB565 (0 << 24) -# define RADEON_PSEUDOCOLOR_DT_ARGB1555 (1 << 24) -# define RADEON_PSEUDOCOLOR_DT_ARGB4444 (2 << 24) -#define RADEON_PRIM_TEXTURE_COMBINE_CNTL_C 0x1cb4 -# define RADEON_COMB_DIS (0 << 0) -# define RADEON_COMB_COPY (1 << 0) -# define RADEON_COMB_COPY_INP (2 << 0) -# define RADEON_COMB_MODULATE (3 << 0) -# define RADEON_COMB_MODULATE2X (4 << 0) -# define RADEON_COMB_MODULATE4X (5 << 0) -# define RADEON_COMB_ADD (6 << 0) -# define RADEON_COMB_ADD_SIGNED (7 << 0) -# define RADEON_COMB_BLEND_VERTEX (8 << 0) -# define RADEON_COMB_BLEND_TEXTURE (9 << 0) -# define RADEON_COMB_BLEND_CONST (10 << 0) -# define RADEON_COMB_BLEND_PREMULT (11 << 0) -# define RADEON_COMB_BLEND_PREV (12 << 0) -# define RADEON_COMB_BLEND_PREMULT_INV (13 << 0) -# define RADEON_COMB_ADD_SIGNED2X (14 << 0) -# define RADEON_COMB_BLEND_CONST_COLOR (15 << 0) -# define RADEON_COMB_MASK (15 << 0) -# define RADEON_COLOR_FACTOR_TEX (4 << 4) -# define RADEON_COLOR_FACTOR_NTEX (5 << 4) -# define RADEON_COLOR_FACTOR_ALPHA (6 << 4) -# define RADEON_COLOR_FACTOR_NALPHA (7 << 4) -# define RADEON_COLOR_FACTOR_MASK (15 << 4) -# define RADEON_INPUT_FACTOR_CONST_COLOR (2 << 10) -# define RADEON_INPUT_FACTOR_CONST_ALPHA (3 << 10) -# define RADEON_INPUT_FACTOR_INT_COLOR (4 << 10) -# define RADEON_INPUT_FACTOR_INT_ALPHA (5 << 10) -# define RADEON_INPUT_FACTOR_MASK (15 << 10) -# define RADEON_COMB_ALPHA_DIS (0 << 14) -# define RADEON_COMB_ALPHA_COPY (1 << 14) -# define RADEON_COMB_ALPHA_COPY_INP (2 << 14) -# define RADEON_COMB_ALPHA_MODULATE (3 << 14) -# define RADEON_COMB_ALPHA_MODULATE2X (4 << 14) -# define RADEON_COMB_ALPHA_MODULATE4X (5 << 14) -# define RADEON_COMB_ALPHA_ADD (6 << 14) -# define RADEON_COMB_ALPHA_ADD_SIGNED (7 << 14) -# define RADEON_COMB_ALPHA_ADD_SIGNED2X (14 << 14) -# define RADEON_COMB_ALPHA_MASK (15 << 14) -# define RADEON_ALPHA_FACTOR_TEX_ALPHA (6 << 18) -# define RADEON_ALPHA_FACTOR_NTEX_ALPHA (7 << 18) -# define RADEON_ALPHA_FACTOR_MASK (15 << 18) -# define RADEON_INP_FACTOR_A_CONST_ALPHA (1 << 25) -# define RADEON_INP_FACTOR_A_INT_ALPHA (2 << 25) -# define RADEON_INP_FACTOR_A_MASK (7 << 25) -#define RADEON_TEX_SIZE_PITCH_C 0x1cb8 -# define RADEON_TEX_PITCH_SHIFT 0 -# define RADEON_TEX_SIZE_SHIFT 4 -# define RADEON_TEX_HEIGHT_SHIFT 8 -# define RADEON_TEX_MIN_SIZE_SHIFT 12 -# define RADEON_SEC_TEX_PITCH_SHIFT 16 -# define RADEON_SEC_TEX_SIZE_SHIFT 20 -# define RADEON_SEC_TEX_HEIGHT_SHIFT 24 -# define RADEON_SEC_TEX_MIN_SIZE_SHIFT 28 -# define RADEON_TEX_PITCH_MASK (0x0f << 0) -# define RADEON_TEX_SIZE_MASK (0x0f << 4) -# define RADEON_TEX_HEIGHT_MASK (0x0f << 8) -# define RADEON_TEX_MIN_SIZE_MASK (0x0f << 12) -# define RADEON_SEC_TEX_PITCH_MASK (0x0f << 16) -# define RADEON_SEC_TEX_SIZE_MASK (0x0f << 20) -# define RADEON_SEC_TEX_HEIGHT_MASK (0x0f << 24) -# define RADEON_SEC_TEX_MIN_SIZE_MASK (0x0f << 28) -# define RADEON_TEX_SIZE_PITCH_SHIFT 0 -# define RADEON_SEC_TEX_SIZE_PITCH_SHIFT 16 -# define RADEON_TEX_SIZE_PITCH_MASK (0xffff << 0) -# define RADEON_SEC_TEX_SIZE_PITCH_MASK (0xffff << 16) -#define RADEON_PRIM_TEX_0_OFFSET_C 0x1cbc -#define RADEON_PRIM_TEX_1_OFFSET_C 0x1cc0 -#define RADEON_PRIM_TEX_2_OFFSET_C 0x1cc4 -#define RADEON_PRIM_TEX_3_OFFSET_C 0x1cc8 -#define RADEON_PRIM_TEX_4_OFFSET_C 0x1ccc -#define RADEON_PRIM_TEX_5_OFFSET_C 0x1cd0 -#define RADEON_PRIM_TEX_6_OFFSET_C 0x1cd4 -#define RADEON_PRIM_TEX_7_OFFSET_C 0x1cd8 -#define RADEON_PRIM_TEX_8_OFFSET_C 0x1cdc -#define RADEON_PRIM_TEX_9_OFFSET_C 0x1ce0 -#define RADEON_PRIM_TEX_10_OFFSET_C 0x1ce4 -# define RADEON_TEX_NO_TILE (0 << 30) -# define RADEON_TEX_TILED_BY_HOST (1 << 30) -# define RADEON_TEX_TILED_BY_STORAGE (2 << 30) -# define RADEON_TEX_TILED_BY_STORAGE2 (3 << 30) - -#define RADEON_SEC_TEX_CNTL_C 0x1d00 -# define RADEON_SEC_SELECT_PRIM_ST (0 << 0) -# define RADEON_SEC_SELECT_SEC_ST (1 << 0) -#define RADEON_SEC_TEX_COMBINE_CNTL_C 0x1d04 -# define RADEON_INPUT_FACTOR_PREV_COLOR (8 << 10) -# define RADEON_INPUT_FACTOR_PREV_ALPHA (9 << 10) -# define RADEON_INP_FACTOR_A_PREV_ALPHA (4 << 25) -#define RADEON_SEC_TEX_0_OFFSET_C 0x1d08 -#define RADEON_SEC_TEX_1_OFFSET_C 0x1d0c -#define RADEON_SEC_TEX_2_OFFSET_C 0x1d10 -#define RADEON_SEC_TEX_3_OFFSET_C 0x1d14 -#define RADEON_SEC_TEX_4_OFFSET_C 0x1d18 -#define RADEON_SEC_TEX_5_OFFSET_C 0x1d1c -#define RADEON_SEC_TEX_6_OFFSET_C 0x1d20 -#define RADEON_SEC_TEX_7_OFFSET_C 0x1d24 -#define RADEON_SEC_TEX_8_OFFSET_C 0x1d28 -#define RADEON_SEC_TEX_9_OFFSET_C 0x1d2c -#define RADEON_SEC_TEX_10_OFFSET_C 0x1d30 -#define RADEON_CONSTANT_COLOR_C 0x1d34 -# define RADEON_CONSTANT_BLUE_SHIFT 0 -# define RADEON_CONSTANT_GREEN_SHIFT 8 -# define RADEON_CONSTANT_RED_SHIFT 16 -# define RADEON_CONSTANT_ALPHA_SHIFT 24 -#define RADEON_PRIM_TEXTURE_BORDER_COLOR_C 0x1d38 -# define RADEON_PRIM_TEX_BORDER_BLUE_SHIFT 0 -# define RADEON_PRIM_TEX_BORDER_GREEN_SHIFT 8 -# define RADEON_PRIM_TEX_BORDER_RED_SHIFT 16 -# define RADEON_PRIM_TEX_BORDER_ALPHA_SHIFT 24 -#define RADEON_SEC_TEXTURE_BORDER_COLOR_C 0x1d3c -# define RADEON_SEC_TEX_BORDER_BLUE_SHIFT 0 -# define RADEON_SEC_TEX_BORDER_GREEN_SHIFT 8 -# define RADEON_SEC_TEX_BORDER_RED_SHIFT 16 -# define RADEON_SEC_TEX_BORDER_ALPHA_SHIFT 24 -#define RADEON_STEN_REF_MASK_C 0x1d40 -# define RADEON_STEN_REFERENCE_SHIFT 0 -# define RADEON_STEN_MASK_SHIFT 16 -# define RADEON_STEN_WRITE_MASK_SHIFT 24 -#define RADEON_PLANE_3D_MASK_C 0x1d44 -#define RADEON_TEX_CACHE_STAT_COUNT 0x1974 - - /* Constants */ #define RADEON_AGP_TEX_OFFSET 0x02000000 -#define RADEON_VB_AGE_REG RADEON_GUI_SCRATCH_REG0 -#define RADEON_SWAP_AGE_REG RADEON_GUI_SCRATCH_REG1 +#define RADEON_LAST_FRAME_REG RADEON_GUI_SCRATCH_REG0 +#define RADEON_LAST_CLEAR_REG RADEON_GUI_SCRATCH_REG2 - /* CCE packet types */ -#define RADEON_CCE_PACKET0 0x00000000 -#define RADEON_CCE_PACKET0_ONE_REG_WR 0x00008000 -#define RADEON_CCE_PACKET1 0x40000000 -#define RADEON_CCE_PACKET2 0x80000000 -#define RADEON_CCE_PACKET3_NOP 0xC0001000 -#define RADEON_CCE_PACKET3_PAINT 0xC0001100 -#define RADEON_CCE_PACKET3_BITBLT 0xC0001200 -#define RADEON_CCE_PACKET3_SMALLTEXT 0xC0001300 -#define RADEON_CCE_PACKET3_HOSTDATA_BLT 0xC0001400 -#define RADEON_CCE_PACKET3_POLYLINE 0xC0001500 -#define RADEON_CCE_PACKET3_SCALING 0xC0001600 -#define RADEON_CCE_PACKET3_TRANS_SCALING 0xC0001700 -#define RADEON_CCE_PACKET3_POLYSCANLINES 0xC0001800 -#define RADEON_CCE_PACKET3_NEXT_CHAR 0xC0001900 -#define RADEON_CCE_PACKET3_PAINT_MULTI 0xC0001A00 -#define RADEON_CCE_PACKET3_BITBLT_MULTI 0xC0001B00 -#define RADEON_CCE_PACKET3_PLY_NEXTSCAN 0xC0001D00 -#define RADEON_CCE_PACKET3_SET_SCISSORS 0xC0001E00 -#define RADEON_CCE_PACKET3_SET_MODE24BPP 0xC0001F00 -#define RADEON_CCE_PACKET3_CNTL_PAINT 0xC0009100 -#define RADEON_CCE_PACKET3_CNTL_BITBLT 0xC0009200 -#define RADEON_CCE_PACKET3_CNTL_SMALLTEXT 0xC0009300 -#define RADEON_CCE_PACKET3_CNTL_HOSTDATA_BLT 0xC0009400 -#define RADEON_CCE_PACKET3_CNTL_POLYLINE 0xC0009500 -#define RADEON_CCE_PACKET3_CNTL_SCALING 0xC0009600 -#define RADEON_CCE_PACKET3_CNTL_TRANS_SCALING 0xC0009700 -#define RADEON_CCE_PACKET3_CNTL_POLYSCANLINES 0xC0009800 -#define RADEON_CCE_PACKET3_CNTL_NEXT_CHAR 0xC0009900 -#define RADEON_CCE_PACKET3_CNTL_PAINT_MULTI 0xC0009A00 -#define RADEON_CCE_PACKET3_CNTL_BITBLT_MULTI 0xC0009B00 -#define RADEON_CCE_PACKET3_CNTL_TRANS_BITBLT 0xC0009C00 -#define RADEON_CCE_PACKET3_3D_SAVE_CONTEXT 0xC0002000 -#define RADEON_CCE_PACKET3_3D_PLAY_CONTEXT 0xC0002100 -#define RADEON_CCE_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xC0002300 -#define RADEON_CCE_PACKET3_3D_RNDR_GEN_PRIM 0xC0002500 -#define RADEON_CCE_PACKET3_LOAD_PALETTE 0xC0002C00 -#define RADEON_CCE_PACKET3_PURGE 0xC0002D00 -#define RADEON_CCE_PACKET3_NEXT_VERTEX_BUNDLE 0xC0002E00 -# define RADEON_CCE_PACKET_MASK 0xC0000000 -# define RADEON_CCE_PACKET_COUNT_MASK 0x3fff0000 -# define RADEON_CCE_PACKET_MAX_DWORDS (1 << 14) -# define RADEON_CCE_PACKET0_REG_MASK 0x000007ff -# define RADEON_CCE_PACKET1_REG0_MASK 0x000007ff -# define RADEON_CCE_PACKET1_REG1_MASK 0x003ff800 - -#define RADEON_CCE_VC_FRMT_RHW 0x00000001 -#define RADEON_CCE_VC_FRMT_DIFFUSE_BGR 0x00000002 -#define RADEON_CCE_VC_FRMT_DIFFUSE_A 0x00000004 -#define RADEON_CCE_VC_FRMT_DIFFUSE_ARGB 0x00000008 -#define RADEON_CCE_VC_FRMT_SPEC_BGR 0x00000010 -#define RADEON_CCE_VC_FRMT_SPEC_F 0x00000020 -#define RADEON_CCE_VC_FRMT_SPEC_FRGB 0x00000040 -#define RADEON_CCE_VC_FRMT_S_T 0x00000080 -#define RADEON_CCE_VC_FRMT_S2_T2 0x00000100 -#define RADEON_CCE_VC_FRMT_RHW2 0x00000200 - -#define RADEON_CCE_VC_CNTL_PRIM_TYPE_NONE 0x00000000 -#define RADEON_CCE_VC_CNTL_PRIM_TYPE_POINT 0x00000001 -#define RADEON_CCE_VC_CNTL_PRIM_TYPE_LINE 0x00000002 -#define RADEON_CCE_VC_CNTL_PRIM_TYPE_POLY_LINE 0x00000003 -#define RADEON_CCE_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004 -#define RADEON_CCE_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005 -#define RADEON_CCE_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006 -#define RADEON_CCE_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007 -#define RADEON_CCE_VC_CNTL_PRIM_WALK_IND 0x00000010 -#define RADEON_CCE_VC_CNTL_PRIM_WALK_LIST 0x00000020 -#define RADEON_CCE_VC_CNTL_PRIM_WALK_RING 0x00000030 -#define RADEON_CCE_VC_CNTL_NUM_SHIFT 16 + /* CP packet types */ +#define RADEON_CP_PACKET0 0x00000000 +#define RADEON_CP_PACKET1 0x40000000 +#define RADEON_CP_PACKET2 0x80000000 +#define RADEON_CP_PACKET3 0xC0000000 +# define RADEON_CP_PACKET_MASK 0xC0000000 +# define RADEON_CP_PACKET_COUNT_MASK 0x3fff0000 +# define RADEON_CP_PACKET_MAX_DWORDS (1 << 12) +# define RADEON_CP_PACKET0_REG_MASK 0x000007ff +# define RADEON_CP_PACKET1_REG0_MASK 0x000007ff +# define RADEON_CP_PACKET1_REG1_MASK 0x003ff800 + +#define RADEON_CP_PACKET0_ONE_REG_WR 0x00008000 + +#define RADEON_CP_PACKET3_NOP 0xC0001000 +#define RADEON_CP_PACKET3_NEXT_CHAR 0xC0001900 +#define RADEON_CP_PACKET3_PLY_NEXTSCAN 0xC0001D00 +#define RADEON_CP_PACKET3_SET_SCISSORS 0xC0001E00 +#define RADEON_CP_PACKET3_3D_RNDR_GEN_INDX_PRIM 0xC0002300 +#define RADEON_CP_PACKET3_LOAD_MICROCODE 0xC0002400 +#define RADEON_CP_PACKET3_3D_RNDR_GEN_PRIM 0xC0002500 +#define RADEON_CP_PACKET3_WAIT_FOR_IDLE 0xC0002600 +#define RADEON_CP_PACKET3_3D_DRAW_VBUF 0xC0002800 +#define RADEON_CP_PACKET3_3D_DRAW_IMMD 0xC0002900 +#define RADEON_CP_PACKET3_3D_DRAW_INDX 0xC0002A00 +#define RADEON_CP_PACKET3_LOAD_PALETTE 0xC0002C00 +#define RADEON_CP_PACKET3_3D_LOAD_VBPNTR 0xC0002F00 +#define RADEON_CP_PACKET3_3D_CLEAR_ZMASK 0xC0003200 +#define RADEON_CP_PACKET3_CNTL_PAINT 0xC0009100 +#define RADEON_CP_PACKET3_CNTL_BITBLT 0xC0009200 +#define RADEON_CP_PACKET3_CNTL_SMALLTEXT 0xC0009300 +#define RADEON_CP_PACKET3_CNTL_HOSTDATA_BLT 0xC0009400 +#define RADEON_CP_PACKET3_CNTL_POLYLINE 0xC0009500 +#define RADEON_CP_PACKET3_CNTL_POLYSCANLINES 0xC0009800 +#define RADEON_CP_PACKET3_CNTL_PAINT_MULTI 0xC0009A00 +#define RADEON_CP_PACKET3_CNTL_BITBLT_MULTI 0xC0009B00 +#define RADEON_CP_PACKET3_CNTL_TRANS_BITBLT 0xC0009C00 + + +#define RADEON_CP_VC_FRMT_XY 0x00000000 +#define RADEON_CP_VC_FRMT_W0 0x00000001 +#define RADEON_CP_VC_FRMT_FPCOLOR 0x00000002 +#define RADEON_CP_VC_FRMT_FPALPHA 0x00000004 +#define RADEON_CP_VC_FRMT_PKCOLOR 0x00000008 +#define RADEON_CP_VC_FRMT_FPSPEC 0x00000010 +#define RADEON_CP_VC_FRMT_FPFOG 0x00000020 +#define RADEON_CP_VC_FRMT_PKSPEC 0x00000040 +#define RADEON_CP_VC_FRMT_ST0 0x00000080 +#define RADEON_CP_VC_FRMT_ST1 0x00000100 +#define RADEON_CP_VC_FRMT_Q1 0x00000200 +#define RADEON_CP_VC_FRMT_ST2 0x00000400 +#define RADEON_CP_VC_FRMT_Q2 0x00000800 +#define RADEON_CP_VC_FRMT_ST3 0x00001000 +#define RADEON_CP_VC_FRMT_Q3 0x00002000 +#define RADEON_CP_VC_FRMT_Q0 0x00004000 +#define RADEON_CP_VC_FRMT_BLND_WEIGHT_CNT_MASK 0x00038000 +#define RADEON_CP_VC_FRMT_N0 0x00040000 +#define RADEON_CP_VC_FRMT_XY1 0x08000000 +#define RADEON_CP_VC_FRMT_Z1 0x10000000 +#define RADEON_CP_VC_FRMT_W1 0x20000000 +#define RADEON_CP_VC_FRMT_N1 0x40000000 +#define RADEON_CP_VC_FRMT_Z 0x80000000 + +#define RADEON_CP_VC_CNTL_PRIM_TYPE_NONE 0x00000000 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_POINT 0x00000001 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE 0x00000002 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_LINE_STRIP 0x00000003 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_LIST 0x00000004 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_FAN 0x00000005 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_STRIP 0x00000006 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_TRI_TYPE2 0x00000007 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_RECT_LIST 0x00000008 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_POINT_LIST 0x00000009 +#define RADEON_CP_VC_CNTL_PRIM_TYPE_3VRT_LINE_LIST 0x0000000a +#define RADEON_CP_VC_CNTL_PRIM_WALK_IND 0x00000010 +#define RADEON_CP_VC_CNTL_PRIM_WALK_LIST 0x00000020 +#define RADEON_CP_VC_CNTL_PRIM_WALK_RING 0x00000030 +#define RADEON_CP_VC_CNTL_COLOR_ORDER_BGRA 0x00000000 +#define RADEON_CP_VC_CNTL_COLOR_ORDER_RGBA 0x00000040 +#define RADEON_CP_VC_CNTL_MAOS_ENABLE 0x00000080 +#define RADEON_CP_VC_CNTL_VTX_FMT_NON_RADEON_MODE 0x00000000 +#define RADEON_CP_VC_CNTL_VTX_FMT_RADEON_MODE 0x00000100 +#define RADEON_CP_VC_CNTL_NUM_SHIFT 16 #endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h:1.2 --- /dev/null Mon Jun 4 12:40:46 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h Wed Mar 21 12:02:22 2001 @@ -0,0 +1,261 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_sarea.h,v 1.2 2001/03/21 17:02:22 dawes Exp $ */ +/* + * Copyright 2000 ATI Technologies Inc., Markham, Ontario, + * VA Linux Systems Inc., Fremont, California. + * + * 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, 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 + * NON-INFRINGEMENT. IN NO EVENT SHALL ATI, VA LINUX SYSTEMS AND/OR + * THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* + * Authors: + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * + */ + +#ifndef _RADEON_SAREA_H_ +#define _RADEON_SAREA_H_ + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the kernel file (radeon_drm.h) + */ +#ifndef __RADEON_SAREA_DEFINES__ +#define __RADEON_SAREA_DEFINES__ + +/* What needs to be changed for the current vertex buffer? + */ +#define RADEON_UPLOAD_CONTEXT 0x00000001 +#define RADEON_UPLOAD_VERTFMT 0x00000002 +#define RADEON_UPLOAD_LINE 0x00000004 +#define RADEON_UPLOAD_BUMPMAP 0x00000008 +#define RADEON_UPLOAD_MASKS 0x00000010 +#define RADEON_UPLOAD_VIEWPORT 0x00000020 +#define RADEON_UPLOAD_SETUP 0x00000040 +#define RADEON_UPLOAD_TCL 0x00000080 +#define RADEON_UPLOAD_MISC 0x00000100 +#define RADEON_UPLOAD_TEX0 0x00000200 +#define RADEON_UPLOAD_TEX1 0x00000400 +#define RADEON_UPLOAD_TEX2 0x00000800 +#define RADEON_UPLOAD_TEX0IMAGES 0x00001000 +#define RADEON_UPLOAD_TEX1IMAGES 0x00002000 +#define RADEON_UPLOAD_TEX2IMAGES 0x00004000 +#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ +#define RADEON_REQUIRE_QUIESCENCE 0x00010000 +#define RADEON_UPLOAD_ALL 0x0001ffff + +#define RADEON_FRONT 0x1 +#define RADEON_BACK 0x2 +#define RADEON_DEPTH 0x4 + +/* Primitive types + */ +#define RADEON_POINTS 0x1 +#define RADEON_LINES 0x2 +#define RADEON_LINE_STRIP 0x3 +#define RADEON_TRIANGLES 0x4 +#define RADEON_TRIANGLE_FAN 0x5 +#define RADEON_TRIANGLE_STRIP 0x6 +#define RADEON_3VTX_POINTS 0x9 +#define RADEON_3VTX_LINES 0xa + +/* Vertex/indirect buffer size + */ +#define RADEON_BUFFER_SIZE 65536 + +/* Byte offsets for indirect buffer data + */ +#define RADEON_INDEX_PRIM_OFFSET 20 +#define RADEON_HOSTDATA_BLIT_OFFSET 32 + +#define RADEON_SCRATCH_REG_OFFSET 32 + +/* Keep these small for testing + */ +#define RADEON_NR_SAREA_CLIPRECTS 12 + +/* There are 2 heaps (local/AGP). Each region within a heap is a + * minimum of 64k, and there are at most 64 of them per heap. + */ +#define RADEON_CARD_HEAP 0 +#define RADEON_AGP_HEAP 1 +#define RADEON_NR_TEX_HEAPS 2 +#define RADEON_NR_TEX_REGIONS 64 +#define RADEON_LOG_TEX_GRANULARITY 16 + +#define RADEON_MAX_TEXTURE_LEVELS 11 +#define RADEON_MAX_TEXTURE_UNITS 3 + +/* Blits have strict offset rules. All blit offset must be aligned on + * a 1K-byte boundary. + */ +#define RADEON_OFFSET_SHIFT 10 +#define RADEON_OFFSET_ALIGN (1 << RADEON_OFFSET_SHIFT) +#define RADEON_OFFSET_MASK (RADEON_OFFSET_ALIGN - 1) + +#endif /* __RADEON_SAREA_DEFINES__ */ + +typedef struct { + unsigned int red; + unsigned int green; + unsigned int blue; + unsigned int alpha; +} radeon_color_regs_t; + +typedef struct { + /* Context state */ + unsigned int pp_misc; + unsigned int pp_fog_color; + unsigned int re_solid_color; + unsigned int rb3d_blendcntl; + unsigned int rb3d_depthoffset; + unsigned int rb3d_depthpitch; + unsigned int rb3d_zstencilcntl; + + unsigned int pp_cntl; + unsigned int rb3d_cntl; + unsigned int rb3d_coloroffset; + unsigned int re_width_height; + unsigned int rb3d_colorpitch; + unsigned int se_cntl; + + /* Vertex format state */ + unsigned int se_coord_fmt; + + /* Line state */ + unsigned int re_line_pattern; + unsigned int re_line_state; + + unsigned int se_line_width; + + /* Bumpmap state */ + unsigned int pp_lum_matrix; + + unsigned int pp_rot_matrix_0; + unsigned int pp_rot_matrix_1; + + /* Mask state */ + unsigned int rb3d_stencilrefmask; + unsigned int rb3d_ropcntl; + unsigned int rb3d_planemask; + + /* Viewport state */ + unsigned int se_vport_xscale; + unsigned int se_vport_xoffset; + unsigned int se_vport_yscale; + unsigned int se_vport_yoffset; + unsigned int se_vport_zscale; + unsigned int se_vport_zoffset; + + /* Setup state */ + unsigned int se_cntl_status; + +#ifdef TCL_ENABLE + /* TCL state */ + radeon_color_regs_t se_tcl_material_emmissive; + radeon_color_regs_t se_tcl_material_ambient; + radeon_color_regs_t se_tcl_material_diffuse; + radeon_color_regs_t se_tcl_material_specular; + unsigned int se_tcl_shininess; + unsigned int se_tcl_output_vtx_fmt; + unsigned int se_tcl_output_vtx_sel; + unsigned int se_tcl_matrix_select_0; + unsigned int se_tcl_matrix_select_1; + unsigned int se_tcl_ucp_vert_blend_ctl; + unsigned int se_tcl_texture_proc_ctl; + unsigned int se_tcl_light_model_ctl; + unsigned int se_tcl_per_light_ctl[4]; +#endif + + /* Misc state */ + unsigned int re_top_left; + unsigned int re_misc; +} radeon_context_regs_t; + +/* Setup registers for each texture unit */ +typedef struct { + unsigned int pp_txfilter; + unsigned int pp_txformat; + unsigned int pp_txoffset; + unsigned int pp_txcblend; + unsigned int pp_txablend; + unsigned int pp_tfactor; + + unsigned int pp_border_color; + +#ifdef CUBIC_ENABLE + unsigned int pp_cubic_faces; + unsigned int pp_cubic_offset[5]; +#endif +} radeon_texture_regs_t; + +typedef struct { + unsigned char next, prev; /* indices to form a circular LRU */ + unsigned char in_use; /* owned by a client, or free? */ + int age; /* tracked by clients to update local LRU's */ +} radeon_tex_region_t; + +typedef struct { + /* The channel for communication of state information to the kernel + * on firing a vertex buffer. + */ + radeon_context_regs_t ContextState; + radeon_texture_regs_t TexState[RADEON_MAX_TEXTURE_UNITS]; + unsigned int dirty; + unsigned int vertsize; + unsigned int vc_format; + + /* The current cliprects, or a subset thereof + */ + XF86DRIClipRectRec boxes[RADEON_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Counters for throttling of rendering clients + */ + unsigned int last_frame; + unsigned int last_dispatch; + unsigned int last_clear; + + /* Maintain an LRU of contiguous regions of texture space. If you + * think you own a region of texture memory, and it has an age + * different to the one you set, then you are mistaken and it has + * been stolen by another client. If global texAge hasn't changed, + * there is no need to walk the list. + * + * These regions can be used as a proxy for the fine-grained texture + * information of other clients - by maintaining them in the same + * lru which is used to age their own textures, clients have an + * approximate lru for the whole of global texture space, and can + * make informed decisions as to which areas to kick out. There is + * no need to choose whether to kick out your own texture or someone + * else's - simply eject them all in LRU order. + */ + /* Last elt is sentinal */ + radeon_tex_region_t texList[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS+1]; + /* last time texture was uploaded */ + int texAge[RADEON_NR_TEX_HEAPS]; + + int ctxOwner; /* last context to upload state */ +} RADEONSAREAPriv, *RADEONSAREAPrivPtr; + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h:1.1 Thu Nov 2 11:55:46 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h Sat Jan 6 15:58:08 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h,v 1.1 2000/11/02 16:55:46 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_version.h,v 1.2 2001/01/06 20:58:08 tsi Exp $ */ /* - * Copyright 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 2000 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that Index: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c:1.8 Wed Dec 13 07:58:19 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c Sat Mar 3 17:26:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.8 2000/12/13 12:58:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/ati/radeon_video.c,v 1.11 2001/03/03 22:26:11 tsi Exp $ */ #include "radeon.h" #include "radeon_reg.h" @@ -37,7 +37,7 @@ static void RADEONResetVideo(ScrnInfoPtr); -static void RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time time); +static void RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time now); #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) @@ -253,8 +253,8 @@ (A->extents.y2 != B->extents.y2)) return FALSE; - dataA = (int*)REGION_RECTS(A); - dataB = (int*)REGION_RECTS(B); + dataA = (pointer)REGION_RECTS(A); + dataB = (pointer)REGION_RECTS(B); while(num--) { if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) @@ -460,6 +460,11 @@ unsigned int *p_w, unsigned int *p_h, pointer data ){ + if(vid_w > (drw_w << 4)) + drw_w = vid_w >> 4; + if(vid_h > (drw_h << 4)) + drw_h = vid_h >> 4; + *p_w = drw_w; *p_h = drw_h; } @@ -501,7 +506,7 @@ w >>= 1; for(j = 0; j < h; j++) { - dst = (CARD32*)dst1; + dst = (pointer)dst1; s1 = src1; s2 = src2; s3 = src3; i = w; while(i > 4) { @@ -776,7 +781,8 @@ if(!RegionsEqual(&pPriv->clip, clipBoxes)) { REGION_COPY(pScreen, &pPriv->clip, clipBoxes); /* draw these */ - (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, ~0, + (*info->accel->FillSolidRects)(pScrn, pPriv->colorKey, GXcopy, + (CARD32)~0, REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); } @@ -835,21 +841,21 @@ } static void -RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time time) +RADEONVideoTimerCallback(ScrnInfoPtr pScrn, Time now) { RADEONInfoPtr info = RADEONPTR(pScrn); RADEONPortPrivPtr pPriv = info->adaptor->pPortPrivates[0].ptr; if(pPriv->videoStatus & TIMER_MASK) { if(pPriv->videoStatus & OFF_TIMER) { - if(pPriv->offTime < time) { + if(pPriv->offTime < now) { unsigned char *RADEONMMIO = info->MMIO; OUTREG(RADEON_OV0_SCALE_CNTL, 0); pPriv->videoStatus = FREE_TIMER; - pPriv->freeTime = time + FREE_DELAY; + pPriv->freeTime = now + FREE_DELAY; } } else { /* FREE_TIMER */ - if(pPriv->freeTime < time) { + if(pPriv->freeTime < now) { if(pPriv->linear) { xf86FreeOffscreenLinear(pPriv->linear); pPriv->linear = NULL; Index: xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile:1.27 xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile:1.28 --- xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile:1.27 Fri Nov 3 13:46:08 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile Tue Jan 23 19:06:16 2001 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile,v 1.27 2000/11/03 18:46:08 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/Imakefile,v 1.28 2001/01/24 00:06:16 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -45,7 +45,6 @@ InstallObjectModule(chips,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(chips,) InstallModuleManPage(chips) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/chips/chips.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/chips.cpp:1.9 xc/programs/Xserver/hw/xfree86/drivers/chips/chips.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/chips/chips.cpp:1.9 Tue Dec 12 13:54:30 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/chips.cpp Mon Jun 4 12:40:46 2001 @@ -1,203 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/chips.cpp,v 1.9 2000/12/12 18:54:30 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH CHIPS __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -chips \- Chips and Technologies video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qchips\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B chips -is an XFree86 driver for Chips and Technologies video processors. The majority -of the Chips and Technologies chipsets are supported by this driver. In general -the limitation on the capabilities of this driver are determined by the -chipset on which it is run. Where possible, this driver provides full -acceleration and supports the following depths: 1, 4, 8, 15, 16, 24 and on -the latest chipsets an 8+16 overlay mode. All visual types are supported for -depth 1, 4 and 8 and both TrueColor and DirectColor visuals are supported -where possible. Multi-head configurations are supported on PCI or AGP buses. -.SH SUPPORTED HARDWARE -The -.B chips -driver supports video processors on most of the bus types currently available. -The chipsets supported fall into one of three architectural classes. A -.B basic -architecture, the -.B WinGine -architecture and the newer -.B HiQV -architecture. -.PP -.B Basic Architecture -.PP -The supported chipsets are -.B ct65520, ct65525, ct65530, ct65535, ct65540, ct65545, ct65546 -and -.B ct65548 -.PP -Color depths 1, 4 and 8 are supported on all chipsets, while depths 15, 16 -and 24 are supported only on the -.B 65540, 65545, 65546 -and -.B 65548 -chipsets. The driver is accelerated when used with the -.B 65545, 65546 -or -.B 65548 -chipsets, however the DirectColor visual is not available. -.PP -.B Wingine Architecture -.PP -The supported chipsets are -.B ct64200 -and -.B ct64300 -.PP -Color depths 1, 4 and 8 are supported on both chipsets, while depths 15, 16 -and 24 are supported only on the -.B 64300 -chipsets. The driver is accelerated when used with the -.B 64300 -chipsets, however the DirectColor visual is not available. -.PP -.B HiQV Architecture -.PP -The supported chipsets are -.B ct65550, ct65554, ct65555, ct68554, ct69000 -and -.B ct69030 -.PP -Color depths 1, 4, 8, 15, 16, 24 and 8+16 are supported on all chipsets. -The DirectColor visual is supported on all color depths except the 8+16 -overlay mode. Full acceleration is supplied for all chipsets. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type, but the following -.B ChipSet -names may optionally be specified in the config file -.B \*qDevice\*q -section, and will override the auto-detection: -.PP -.RS 4 -"ct65520", "ct65525", "ct65530", "ct65535", "ct65540", "ct65545", "ct65546", -"ct65548", "ct65550", "ct65554", "ct65555", "ct68554", "ct69000", "ct69030", -"ct64200", "ct64300". -.RE -.PP -The driver will auto-detect the amount of video memory present for all -chipsets. But maybe overridden with the -.B VideoRam -entry in the config file -.B \*qDevice\*q -section. -.PP -The following driver -.B Options -are supported, on one or more of the supported chipsets: -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qNoLinear\*q \*q" boolean \*q -Disables linear addressing in cases where it is enabled by default. -Default: off -.TP -.BI "Option \*qLinear\*q \*q" boolean \*q -Enables linear addressing in cases where it is disabled by default. -Default: off -.TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: off. -.TP -.BI "Option \*qSTN\*q \*q" boolean \*q -Force detection of STN screen type. Default: off. -.TP -.BI "Option \*qUseModeline\*q \*q" boolean \*q -Reprogram flat panel timings with values from the modeline. Default: off -.TP -.BI "Option \*qFixPanelSize\*q \*q" boolean \*q -Reprogram flat panel size with values from the modeline. Default: off -.TP -.BI "Option \*qNoStretch\*q \*q" boolean \*q -This option disables the stretching on a mode on a flat panel to fill the -screen. Default: off -.TP -.BI "Option \*qLcdCenter\*q \*q" boolean \*q -Center the mode displayed on the flat panel on the screen. Default: off -.TP -.BI "Option \*qHWclocks\*q \*q" boolean \*q -Force the use of fixed hardware clocks on chips that support both fixed -and programmable clocks. Default: off -.TP -.BI "Option \*qUseVclk1\*q \*q" boolean \*q -Use the Vclk1 programable clock on -.B HiQV -chipsets instead of Vclk2. Default: off -.TP -.BI "Option \*qFPClock8\*q \*q" float \*q -.TP -.BI "Option \*qFPClock16\*q \*q" float \*q -.TP -.BI "Option \*qFPClock24\*q \*q" float \*q -.TP -.BI "Option \*qFPClock32\*q \*q" float \*q -Force the use of a particular video clock speed for use with the -flat panel at a specified depth -.TP -.BI "Option \*qMMIO\*q \*q" boolean \*q -Force the use of memory mapped IO where it can be used. Default: off -.TP -.BI "Option \*qSuspendHack\*q \*q" boolean \*q -Force driver to leave centering and stretching registers alone. This -can fix some laptop suspend/resume problems. Default: off -.TP -.BI "Option \*qOverlay\*q" -Enable 8+24 overlay mode. Only appropriate for depth 24. Default: off. -.TP -.BI "Option \*qColorKey\*q \*q" integer \*q -Set the colormap index used for the transparency key for the depth 8 plane -when operating in 8+16 overlay mode. The value must be in the range -2\-255. Default: 255. -.TP -.BI "Option \*qVideoKey\*q \*q" integer \*q -This sets the default pixel value for the YUV video overlay key. -Default: undefined. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: off. -.TP -.BI "Option \*qSyncOnGreen\*q \*q" boolean \*q -Enable or disable combining the sync signals with the green signal. -Default: off. -.TP -.BI "Option \*qShowCache\*q \*q" boolean \*q -Enable or disable viewing offscreen memory. Used for debugging only -Default: off. -.TP -.BI "Option \*q18bitBus\*q \*q" boolean \*q -Force the driver to assume that the flat panel has an 18bit data bus. -Default: off. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.PP -You are also recommended to read the README.chips file that comes with all -XFree86 distributions, which discusses the -.B chips -driver in more detail. -.SH AUTHORS -Authors include: Jon Block, Mike Hollick, Regis Cridlig, Nozomi Ytow, -Egbert Eich, David Bateman and Xavier Ducoin - Index: xc/programs/Xserver/hw/xfree86/drivers/chips/chips.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/chips/chips.man:1.3 --- /dev/null Mon Jun 4 12:40:46 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/chips.man Wed May 9 15:57:04 2001 @@ -0,0 +1,219 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/chips.man,v 1.3 2001/05/09 19:57:04 dbateman Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH CHIPS __drivermansuffix__ __vendorversion__ +.SH NAME +chips \- Chips and Technologies video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qchips\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B chips +is an XFree86 driver for Chips and Technologies video processors. The majority +of the Chips and Technologies chipsets are supported by this driver. In general +the limitation on the capabilities of this driver are determined by the +chipset on which it is run. Where possible, this driver provides full +acceleration and supports the following depths: 1, 4, 8, 15, 16, 24 and on +the latest chipsets an 8+16 overlay mode. All visual types are supported for +depth 1, 4 and 8 and both TrueColor and DirectColor visuals are supported +where possible. Multi-head configurations are supported on PCI or AGP buses. +.SH SUPPORTED HARDWARE +The +.B chips +driver supports video processors on most of the bus types currently available. +The chipsets supported fall into one of three architectural classes. A +.B basic +architecture, the +.B WinGine +architecture and the newer +.B HiQV +architecture. +.PP +.B Basic Architecture +.PP +The supported chipsets are +.B ct65520, ct65525, ct65530, ct65535, ct65540, ct65545, ct65546 +and +.B ct65548 +.PP +Color depths 1, 4 and 8 are supported on all chipsets, while depths 15, 16 +and 24 are supported only on the +.B 65540, 65545, 65546 +and +.B 65548 +chipsets. The driver is accelerated when used with the +.B 65545, 65546 +or +.B 65548 +chipsets, however the DirectColor visual is not available. +.PP +.B Wingine Architecture +.PP +The supported chipsets are +.B ct64200 +and +.B ct64300 +.PP +Color depths 1, 4 and 8 are supported on both chipsets, while depths 15, 16 +and 24 are supported only on the +.B 64300 +chipsets. The driver is accelerated when used with the +.B 64300 +chipsets, however the DirectColor visual is not available. +.PP +.B HiQV Architecture +.PP +The supported chipsets are +.B ct65550, ct65554, ct65555, ct68554, ct69000 +and +.B ct69030 +.PP +Color depths 1, 4, 8, 15, 16, 24 and 8+16 are supported on all chipsets. +The DirectColor visual is supported on all color depths except the 8+16 +overlay mode. Full acceleration is supplied for all chipsets. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto-detects the chipset type, but the following +.B ChipSet +names may optionally be specified in the config file +.B \*qDevice\*q +section, and will override the auto-detection: +.PP +.RS 4 +"ct65520", "ct65525", "ct65530", "ct65535", "ct65540", "ct65545", "ct65546", +"ct65548", "ct65550", "ct65554", "ct65555", "ct68554", "ct69000", "ct69030", +"ct64200", "ct64300". +.RE +.PP +The driver will auto-detect the amount of video memory present for all +chipsets. But maybe overridden with the +.B VideoRam +entry in the config file +.B \*qDevice\*q +section. +.PP +The following driver +.B Options +are supported, on one or more of the supported chipsets: +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.TP +.BI "Option \*qNoLinear\*q \*q" boolean \*q +Disables linear addressing in cases where it is enabled by default. +Default: off +.TP +.BI "Option \*qLinear\*q \*q" boolean \*q +Enables linear addressing in cases where it is disabled by default. +Default: off +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +Enable or disable the HW cursor. Default: on. +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +Enable or disable the HW cursor. Default: off. +.TP +.BI "Option \*qSTN\*q \*q" boolean \*q +Force detection of STN screen type. Default: off. +.TP +.BI "Option \*qUseModeline\*q \*q" boolean \*q +Reprogram flat panel timings with values from the modeline. Default: off +.TP +.BI "Option \*qFixPanelSize\*q \*q" boolean \*q +Reprogram flat panel size with values from the modeline. Default: off +.TP +.BI "Option \*qNoStretch\*q \*q" boolean \*q +This option disables the stretching on a mode on a flat panel to fill the +screen. Default: off +.TP +.BI "Option \*qLcdCenter\*q \*q" boolean \*q +Center the mode displayed on the flat panel on the screen. Default: off +.TP +.BI "Option \*qHWclocks\*q \*q" boolean \*q +Force the use of fixed hardware clocks on chips that support both fixed +and programmable clocks. Default: off +.TP +.BI "Option \*qUseVclk1\*q \*q" boolean \*q +Use the Vclk1 programable clock on +.B HiQV +chipsets instead of Vclk2. Default: off +.TP +.BI "Option \*qFPClock8\*q \*q" float \*q +.TP +.BI "Option \*qFPClock16\*q \*q" float \*q +.TP +.BI "Option \*qFPClock24\*q \*q" float \*q +.TP +.BI "Option \*qFPClock32\*q \*q" float \*q +Force the use of a particular video clock speed for use with the +flat panel at a specified depth +.TP +.BI "Option \*qMMIO\*q \*q" boolean \*q +Force the use of memory mapped IO for acceleration registers. Default: off +.TP +.BI "Option \*qFullMMIO\*q \*q" boolean \*q +Force the use of memory mapped IO where it can be used. Default: off +.TP +.BI "Option \*qSuspendHack\*q \*q" boolean \*q +Force driver to leave centering and stretching registers alone. This +can fix some laptop suspend/resume problems. Default: off +.TP +.BI "Option \*qOverlay\*q" +Enable 8+24 overlay mode. Only appropriate for depth 24. Default: off. +.TP +.BI "Option \*qColorKey\*q \*q" integer \*q +Set the colormap index used for the transparency key for the depth 8 plane +when operating in 8+16 overlay mode. The value must be in the range +2\-255. Default: 255. +.TP +.BI "Option \*qVideoKey\*q \*q" integer \*q +This sets the default pixel value for the YUV video overlay key. +Default: undefined. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. See +shadowfb(__drivermansuffix__) for further information. Default: off. +.TP +.BI "Option \*qSyncOnGreen\*q \*q" boolean \*q +Enable or disable combining the sync signals with the green signal. +Default: off. +.TP +.BI "Option \*qShowCache\*q \*q" boolean \*q +Enable or disable viewing offscreen memory. Used for debugging only +Default: off. +.TP +.BI "Option \*q18bitBus\*q \*q" boolean \*q +Force the driver to assume that the flat panel has an 18bit data bus. +Default: off. +.TP +.BI "Option \*qCrt2Memory\*q \*q" integer \*q +In a dual-head mode (69030 only) this option selects the amount of memory +to set aside for the second head. If not specified, half the memory is used. +Default: off. +.TP +.BI "Option \*qDualRefresh\*q \*q" integer \*q +The 69030 supports independent refresh rates on its two display channels. +This mode of operations uses additional memory bandwidth and thus limits +the maximum colour depth and refresh rate that can be achieved, and so is +off by default. Using this option forces the use of an independent refresh +rate on the two screens. +Default: off. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.PP +You are also recommended to read the README.chips file that comes with all +XFree86 distributions, which discusses the +.B chips +driver in more detail. +.SH AUTHORS +Authors include: Jon Block, Mike Hollick, Regis Cridlig, Nozomi Ytow, +Egbert Eich, David Bateman and Xavier Ducoin + Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c:1.35 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c:1.36 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c:1.35 Tue Sep 26 11:57:10 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c Wed May 9 15:57:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c,v 1.35 2000/09/26 15:57:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_accel.c,v 1.36 2001/05/09 19:57:04 dbateman Exp $ */ /* * Copyright 1996, 1997, 1998 by David Bateman <dbateman@ee.uts.edu.au> * Modified 1997, 1998 by Nozomi Ytow @@ -49,9 +49,6 @@ /* Drivers that use XAA need this */ #include "xf86fbman.h" - -/* The vga HW register stuff. Do we need this? */ -#include "vgaHW.h" /* Our driver specific include file */ #include "ct_driver.h" Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c:1.20 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c:1.23 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c:1.20 Tue Apr 4 15:25:06 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c Tue May 15 06:19:36 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c,v 1.20 2000/04/04 19:25:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_cursor.c,v 1.23 2001/05/15 10:19:36 eich Exp $ */ /* * Copyright 1994 The XFree86 Project @@ -40,10 +40,6 @@ /* Drivers that need to access the PCI config space directly need this */ #include "xf86Pci.h" -/* All drivers using the vgahw module need this */ -/* This driver needs to be modified to not use vgaHW for multihead operation */ -#include "vgaHW.h" - #include "xf86Cursor.h" /* Driver specific headers */ @@ -74,6 +70,20 @@ if (IS_HiQV(cPtr)) { tmp = cPtr->readXR(cPtr, 0xA0); cPtr->writeXR(cPtr, 0xA0, (tmp & 0xF8) | 5); + if (cPtr->UseDualChannel && + (! xf86IsEntityShared(pScrn->entityList[0]))) { + unsigned int IOSS, MSS; + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | + MSS_PIPE_B)); + tmp = cPtr->readXR(cPtr, 0xA0); + cPtr->writeXR(cPtr, 0xA0, (tmp & 0xF8) | 5); + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } } else { if(!cPtr->UseMMIO) { HW_DEBUG(0x8); @@ -99,6 +109,20 @@ if (IS_HiQV(cPtr)) { tmp = cPtr->readXR(cPtr, 0xA0); cPtr->writeXR(cPtr, 0xA0, tmp & 0xF8); + if (cPtr->UseDualChannel && + (! xf86IsEntityShared(pScrn->entityList[0]))) { + unsigned int IOSS, MSS; + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | + MSS_PIPE_B)); + tmp = cPtr->readXR(cPtr, 0xA0); + cPtr->writeXR(cPtr, 0xA0, tmp & 0xF8); + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } } else { if(!cPtr->UseMMIO) { HW_DEBUG(0x8); @@ -133,6 +157,22 @@ cPtr->writeXR(cPtr, 0xA5, (x >> 8) & 0x87); cPtr->writeXR(cPtr, 0xA6, y & 0xFF); cPtr->writeXR(cPtr, 0xA7, (y >> 8) & 0x87); + if (cPtr->UseDualChannel && + (! xf86IsEntityShared(pScrn->entityList[0]))) { + unsigned int IOSS, MSS; + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | + MSS_PIPE_B)); + cPtr->writeXR(cPtr, 0xA4, x & 0xFF); + cPtr->writeXR(cPtr, 0xA5, (x >> 8) & 0x87); + cPtr->writeXR(cPtr, 0xA6, y & 0xFF); + cPtr->writeXR(cPtr, 0xA7, (y >> 8) & 0x87); + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } } else { CARD32 xy; @@ -188,6 +228,47 @@ } /* Enable normal palette addressing */ cPtr->writeXR(cPtr, 0x80, xr80); + + if (cPtr->UseDualChannel && + (! xf86IsEntityShared(pScrn->entityList[0]))) { + unsigned int IOSS, MSS; + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | + MSS_PIPE_B)); + /* Enable extended palette addressing */ + xr80 = cPtr->readXR(cPtr, 0x80); + cPtr->writeXR(cPtr, 0x80, xr80 | 0x1); + + /* Write the new colours to the extended VGA palette. Palette + * index is incremented after each write, so only write index + * once + */ + hwp->writeDacWriteAddr(hwp, 0x04); + if (xr80 & 0x80) { + /* 8bit DAC */ + hwp->writeDacData(hwp, (bg >> 16) & 0xFF); + hwp->writeDacData(hwp, (bg >> 8) & 0xFF); + hwp->writeDacData(hwp, bg & 0xFF); + hwp->writeDacData(hwp, (fg >> 16) & 0xFF); + hwp->writeDacData(hwp, (fg >> 8) & 0xFF); + hwp->writeDacData(hwp, fg & 0xFF); + } else { + /* 6bit DAC */ + hwp->writeDacData(hwp, (bg >> 18) & 0xFF); + hwp->writeDacData(hwp, (bg >> 10) & 0xFF); + hwp->writeDacData(hwp, (bg >> 2) & 0xFF); + hwp->writeDacData(hwp, (fg >> 18) & 0xFF); + hwp->writeDacData(hwp, (fg >> 10) & 0xFF); + hwp->writeDacData(hwp, (fg >> 2) & 0xFF); + } + /* Enable normal palette addressing */ + cPtr->writeXR(cPtr, 0x80, xr80); + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } } else if (IS_Wingine(cPtr)) { outl(DR(0xA), (bg & 0xFFFFFF)); outl(DR(0x9), (fg & 0xFFFFFF)); @@ -215,6 +296,11 @@ CURSOR_SYNC(pScrn); + if (cPtr->cursorDelay) { + usleep(200000); + cPtr->cursorDelay = FALSE; + } + if (IS_Wingine(cPtr)) { int i; CARD32 *tmp = (CARD32 *)src; @@ -258,6 +344,20 @@ if (IS_HiQV(cPtr)) { cPtr->writeXR(cPtr, 0xA2, (cAcl->CursorAddress >> 8) & 0xFF); cPtr->writeXR(cPtr, 0xA3, (cAcl->CursorAddress >> 16) & 0x3F); + if (cPtr->UseDualChannel && + (! xf86IsEntityShared(pScrn->entityList[0]))) { + unsigned int IOSS, MSS; + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | + MSS_PIPE_B)); + cPtr->writeXR(cPtr, 0xA2, (cAcl->CursorAddress >> 8) & 0xFF); + cPtr->writeXR(cPtr, 0xA3, (cAcl->CursorAddress >> 16) & 0x3F); + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } } else if (!IS_Wingine(cPtr)) { if (!cPtr->UseMMIO) { HW_DEBUG(0xC); Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_ddc.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_ddc.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_ddc.c:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_ddc.c:1.7 Tue Apr 4 15:25:06 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_ddc.c Wed May 9 15:57:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_ddc.c,v 1.7 2000/04/04 19:25:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_ddc.c,v 1.8 2001/05/09 19:57:04 dbateman Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -13,9 +13,6 @@ /* Drivers that need to access the PCI config space directly need this */ #include "xf86Pci.h" - -/* All drivers using the vgahw module need this */ -#include "vgaHW.h" #include "ct_driver.h" Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c:1.103.2.1 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c:1.110.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c:1.103.2.1 Fri Mar 9 13:03:20 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c Fri May 25 14:15:44 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.103.2.1 2001/03/09 18:03:20 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.c,v 1.110.2.1 2001/05/25 18:15:44 eich Exp $ */ /* * Copyright 1993 by Jon Block <block@frc.com> @@ -126,15 +126,13 @@ /* Needed for replacement LoadPalette function for Gamma Correction */ #include "xf86cmap.h" -#ifdef RENDER -#include "picturestr.h" -#endif +#include "dixstruct.h" /* Driver specific headers */ #include "ct_driver.h" /* Mandatory functions */ -static OptionInfoPtr CHIPSAvailableOptions(int chipid, int busid); +static const OptionInfoRec * CHIPSAvailableOptions(int chipid, int busid); static void CHIPSIdentify(int flags); static Bool CHIPSProbe(DriverPtr drv, int flags); static Bool CHIPSPreInit(ScrnInfoPtr pScrn, int flags); @@ -152,7 +150,8 @@ static int chipsFindIsaDevice(GDevPtr dev); static Bool chipsClockSelect(ScrnInfoPtr pScrn, int no); Bool chipsModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); -static void chipsSave(ScrnInfoPtr pScrn); +static void chipsSave(ScrnInfoPtr pScrn, vgaRegPtr VgaSave, + CHIPSRegPtr ChipsSave); static void chipsRestore(ScrnInfoPtr pScrn, vgaRegPtr VgaReg, CHIPSRegPtr ChipsReg, Bool restoreFonts); static void chipsLock(ScrnInfoPtr pScrn); @@ -182,21 +181,31 @@ int displayVSize); static void chipsDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -static void chipsHWCursorOn(CHIPSPtr cPtr); -static void chipsHWCursorOff(CHIPSPtr cPtr); +static void chipsHWCursorOn(CHIPSPtr cPtr, ScrnInfoPtr pScrn); +static void chipsHWCursorOff(CHIPSPtr cPtr, ScrnInfoPtr pScrn); static void chipsFixResume(ScrnInfoPtr pScrn); static void chipsLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual); static void chipsLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual); static void chipsSetPanelType(CHIPSPtr cPtr); +static void chipsBlockHandler(int, pointer, pointer, pointer); /* * This is intentionally screen-independent. It indicates the binding * choice made in the first PreInit. */ static int pix24bpp = 0; - + +/* + * Index of Entity + */ +static int CHIPSEntityIndex = -1; + + +/* Set the non-documented SAR04 register for overlay/video */ +#define SAR04 + /* * Initialise some arrays that are used in multiple instances of the * acceleration code. Set them up here as its a convenient place to do it. @@ -467,9 +476,6 @@ DriverRec CHIPS = { VERSION, CHIPS_DRIVER_NAME, -#if 0 - "Driver for the Chips and Technologies chipsets", -#endif CHIPSIdentify, CHIPSProbe, CHIPSAvailableOptions, @@ -559,10 +565,14 @@ OPTION_FP_CLOCK_32, OPTION_SET_MCLK, OPTION_ROTATE, - OPTION_NO_TMED + OPTION_NO_TMED, + OPTION_CRT2_MEM, + OPTION_DUAL_REFRESH, + OPTION_CRT_CLK_INDX, + OPTION_FP_CLK_INDX } CHIPSOpts; -static OptionInfoRec Chips655xxOptions[] = { +static const OptionInfoRec Chips655xxOptions[] = { { OPTION_LINEAR, "Linear", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CLKS, "HWclocks", OPTV_BOOLEAN, {0}, FALSE }, @@ -589,7 +599,7 @@ { -1, NULL, OPTV_NONE, {0}, FALSE } }; -static OptionInfoRec ChipsWingineOptions[] = { +static const OptionInfoRec ChipsWingineOptions[] = { { OPTION_LINEAR, "Linear", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CLKS, "HWclocks", OPTV_BOOLEAN, {0}, FALSE }, @@ -604,7 +614,7 @@ { -1, NULL, OPTV_NONE, {0}, FALSE } }; -static OptionInfoRec ChipsHiQVOptions[] = { +static const OptionInfoRec ChipsHiQVOptions[] = { { OPTION_LINEAR, "Linear", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, @@ -631,6 +641,10 @@ { OPTION_FP_CLOCK_32, "FPClock32", OPTV_FREQ, {0}, FALSE }, { OPTION_SET_MCLK, "SetMclk", OPTV_FREQ, {0}, FALSE }, { OPTION_NO_TMED, "NoTMED", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CRT2_MEM, "Crt2Memory", OPTV_INTEGER, {0}, FALSE }, + { OPTION_DUAL_REFRESH, "DualRefresh", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CRT_CLK_INDX, "CrtClkIndx", OPTV_INTEGER, {0}, FALSE }, + { OPTION_FP_CLK_INDX, "FPClkIndx", OPTV_INTEGER, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -660,7 +674,8 @@ "xf1bppScreenInit", "xf4bppScreenInit", "cfb8_16ScreenInit", - "fb_ScreenInit", + "fbScreenInit", + "fbPictureInit", NULL }; @@ -668,6 +683,8 @@ "XAADestroyInfoRec", "XAACreateInfoRec", "XAAInit", + "XAAFillSolidRects" , + "XAAInitDualFramebufferOverlay", "XAAStippleScanlineFuncMSBFirst", NULL }; @@ -799,8 +816,7 @@ CHIPSChipsets); } -static -OptionInfoPtr +static const OptionInfoRec * CHIPSAvailableOptions(int chipid, int busid) { int chip = chipid & 0x0000ffff; @@ -844,6 +860,7 @@ if (flags & PROBE_DETECT) foundScreen = TRUE; else for (i = 0; i < numUsed; i++) { + EntityInfoPtr pEnt; /* Allocate a ScrnInfoRec */ ScrnInfoPtr pScrn = NULL; if ((pScrn = xf86ConfigPciEntity(pScrn,0,usedChips[i], @@ -863,6 +880,40 @@ pScrn->ValidMode = CHIPSValidMode; foundScreen = TRUE; } + + /* + * For cards that can do dual head per entity, mark the entity + * as sharable. + */ + pEnt = xf86GetEntityInfo(usedChips[i]); + if (pEnt->chipset == CHIPS_CT69030) { + CHIPSEntPtr cPtrEnt = NULL; + DevUnion *pPriv; + + xf86SetEntitySharable(usedChips[i]); + /* Allocate an entity private if necessary */ + if (CHIPSEntityIndex < 0) + CHIPSEntityIndex = xf86AllocateEntityPrivateIndex(); + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex); + if (!pPriv->ptr) { + pPriv->ptr = xnfcalloc(sizeof(CHIPSEntRec), 1); + cPtrEnt = pPriv->ptr; + cPtrEnt->lastInstance = -1; + } else { + cPtrEnt = pPriv->ptr; + } + /* + * Set the entity instance for this instance of the + * driver. For dual head per card, instance 0 is the + * "master" instance, driving the primary head, and + * instance 1 is the "slave". + */ + cPtrEnt->lastInstance++; + xf86SetEntityInstanceForScreen(pScrn, pScrn->entityList[0], + cPtrEnt->lastInstance); + } + } xfree(usedChips); } @@ -993,11 +1044,10 @@ { pciVideoPtr pciPtr; ClockRangePtr clockRanges; - char *mod = NULL; int i; CHIPSPtr cPtr; - const char *reqSym = NULL; Bool res = FALSE; + CHIPSEntPtr cPtrEnt = NULL; if (flags & PROBE_DETECT) return FALSE; @@ -1012,12 +1062,14 @@ } cPtr = CHIPSPTR(pScrn); + /* XXX Check the number of entities, and fail if it isn't one. */ + if (pScrn->numEntities != 1) + return FALSE; + /* Since the capabilities are determined by the chipset the very * first thing to do is, figure out the chipset and its capabilities */ - /* This driver doesn't expect more than one entity per screen */ - if (pScrn->numEntities > 1) - return FALSE; + /* This is the general case */ for (i = 0; i<pScrn->numEntities; i++) { cPtr->pEnt = xf86GetEntityInfo(pScrn->entityList[i]); @@ -1094,6 +1146,30 @@ case CHIPS_CT65520: break; } + + /* Check for shared entities */ + if (xf86IsEntityShared(pScrn->entityList[0])) { + if (!(cPtr->Flags & ChipsDualChannelSupport)) + return FALSE; + + /* Make sure entity is PCI for now, though this might not be needed. */ + if (cPtr->pEnt->location.type != BUS_PCI) + return FALSE; + + /* Allocate an entity private if necessary */ + if (xf86IsEntityShared(pScrn->entityList[0])) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; + cPtr->entityPrivate = cPtrEnt; + } +#if 0 + /* Set cPtr->device to the relevant Device section */ + cPtr->device = xf86GetDevFromEntity(pScrn->entityList[0], + pScrn->entityInstanceList[0]); +#endif + } + + /* Set the driver to use the PIO register functions by default */ CHIPSSetStdExtFuncs(cPtr); /* Call the device specific PreInit */ @@ -1107,9 +1183,12 @@ if (cPtr->UseFullMMIO) chipsUnmapMem(pScrn); - if (!res) + if (!res) { + vbeFree(cPtr->pVbe); + cPtr->pVbe = NULL; return FALSE; - + } + /*********/ /* * Setup the ClockRanges, which describe what clock ranges are available, @@ -1144,6 +1223,8 @@ LOOKUP_BEST_REFRESH); if (i == -1) { + vbeFree(cPtr->pVbe); + cPtr->pVbe = NULL; CHIPSFreeRec(pScrn); return FALSE; } @@ -1158,6 +1239,8 @@ if (i == 0 || pScrn->modes == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + vbeFree(cPtr->pVbe); + cPtr->pVbe = NULL; CHIPSFreeRec(pScrn); return FALSE; } @@ -1185,6 +1268,8 @@ switch (pScrn->bitsPerPixel) { case 1: if (xf86LoadSubModule(pScrn, "xf1bpp") == NULL) { + vbeFree(cPtr->pVbe); + cPtr->pVbe = NULL; CHIPSFreeRec(pScrn); return FALSE; } @@ -1192,6 +1277,8 @@ break; case 4: if (xf86LoadSubModule(pScrn, "xf4bpp") == NULL) { + vbeFree(cPtr->pVbe); + cPtr->pVbe = NULL; CHIPSFreeRec(pScrn); return FALSE; } @@ -1200,6 +1287,8 @@ case 16: if (cPtr->Flags & ChipsOverlay8plus16) { if (xf86LoadSubModule(pScrn, "xf8_16bpp") == NULL) { + vbeFree(cPtr->pVbe); + cPtr->pVbe = NULL; CHIPSFreeRec(pScrn); return FALSE; } @@ -1208,18 +1297,19 @@ } default: if (xf86LoadSubModule(pScrn, "fb") == NULL) { + vbeFree(cPtr->pVbe); + cPtr->pVbe = NULL; CHIPSFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", NULL); -#ifdef RENDER - xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif + xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); break; } if (cPtr->Flags & ChipsAccelSupport) { if (!xf86LoadSubModule(pScrn, "xaa")) { + vbeFree(cPtr->pVbe); + cPtr->pVbe = NULL; CHIPSFreeRec(pScrn); return FALSE; } @@ -1228,6 +1318,8 @@ if (cPtr->Flags & ChipsShadowFB) { if (!xf86LoadSubModule(pScrn, "shadowfb")) { + vbeFree(cPtr->pVbe); + cPtr->pVbe = NULL; CHIPSFreeRec(pScrn); return FALSE; } @@ -1236,6 +1328,8 @@ if (cPtr->Accel.UseHWCursor) { if (!xf86LoadSubModule(pScrn, "ramdac")) { + vbeFree(cPtr->pVbe); + cPtr->pVbe = NULL; CHIPSFreeRec(pScrn); return FALSE; } @@ -1248,7 +1342,6 @@ if (cPtr->MMIOBaseVGA) xf86SetOperatingState(RES_SHARED_VGA, cPtr->pEnt->index, ResDisableOpr); - return TRUE; } @@ -1261,11 +1354,12 @@ int i; unsigned int Probed[3], FPclkI, CRTclkI; double real; - int val; + int val, indx; const char *s; vgaHWPtr hwp; CHIPSPtr cPtr = CHIPSPTR(pScrn); + CHIPSEntPtr cPtrEnt = NULL; CHIPSPanelSizePtr Size = &cPtr->PanelSize; CHIPSMemClockPtr MemClk = &cPtr->MemClock; CHIPSClockPtr SaveClk = &(cPtr->SavedReg.Clock); @@ -1313,6 +1407,14 @@ vgaHWGetIOBase(hwp); /* + * Must allow ensure that storage for the 2nd set of vga registers is + * allocated for dual channel cards + */ + if ((cPtr->Flags & ChipsDualChannelSupport) && + (! xf86IsEntityShared(pScrn->entityList[0]))) + vgaHWAllocDefaultRegs(&(cPtr->VgaSavedReg2)); + + /* * This must happen after pScrn->display has been set because * xf86SetWeight references it. */ @@ -1344,7 +1446,9 @@ /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); /* Process the options */ - cPtr->Options = (OptionInfoPtr)ChipsHiQVOptions; + if (!(cPtr->Options = xalloc(sizeof(ChipsHiQVOptions)))) + return FALSE; + memcpy(cPtr->Options, ChipsHiQVOptions, sizeof(ChipsHiQVOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, cPtr->Options); /* Set the bits per RGB */ @@ -1548,33 +1652,95 @@ if ((cPtr->Flags & ChipsLinearSupport) && (cPtr->Flags & ChipsFullMMIOSupport) && (cPtr->pEnt->location.type == BUS_PCI)) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Enabling Full MMIO\n"); - cPtr->UseFullMMIO = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Using Full MMIO\n"); - - /* Map the linear framebuffer */ - if (!chipsMapMem(pScrn)) - return FALSE; + + if (cPtr->Flags & ChipsDualChannelSupport) + /* !!!! Full MMIO doesn't work on the 69030 for now */ + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "FULL_MMIO option ignored for Dual Channel\n"); + else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Enabling Full MMIO\n"); + cPtr->UseFullMMIO = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Using Full MMIO\n"); + + /* + * We need to map the framebuffer to read/write regs. + * but can't do that without the FbMapSize. So need to + * fake value for PreInit. This isn't a problem as + * framebuffer isn't actually used in PreInit + */ + cPtr->FbMapSize = 1024 * 1024; + + /* Map the linear framebuffer */ + if (!chipsMapMem(pScrn)) + return FALSE; - /* Setup the MMIO register functions */ - if (cPtr->MMIOBaseVGA) { - CHIPSSetMmioExtFuncs(cPtr); - CHIPSHWSetMmioFuncs(pScrn, cPtr->MMIOBaseVGA, 0x0); + /* Setup the MMIO register functions */ + if (cPtr->MMIOBaseVGA) { + CHIPSSetMmioExtFuncs(cPtr); + CHIPSHWSetMmioFuncs(pScrn, cPtr->MMIOBaseVGA, 0x0); + } } } else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "FULL_MMIO option ignored\n"); + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "FULL_MMIO option ignored\n"); } } } else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,"Disabling MMIO: " + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG,"Disabling MMIO: " "no acceleration, no hw_cursor\n"); cPtr->UseMMIO = FALSE; cPtr->Accel.UseHWCursor = FALSE; cPtr->Flags &= ~ChipsAccelSupport; } + + if (cPtr->Flags & ChipsDualChannelSupport) { + + if (xf86IsEntityShared(pScrn->entityList[0])) { + cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; +#if 1 + /* + * XXX This assumes that the lower number screen is always the + * "master" head, and that the "master" is the first CRTC. This + * can result in unexpected behaviour when the config file marks + * the primary CRTC as the second screen. + */ + if (xf86IsPrimInitDone(pScrn->entityList[0])) { +#else + /* + * This is an alternative version that determines which is the + * secondary CRTC from the screen field in cPtr->pEnt->device. + * It doesn't currently work because there are things that assume + * the primary CRTC is initialised first. + */ + if (cPtr->pEnt->device->screen == 1) { + +#endif + /* This is the second crtc */ + cPtr->SecondCrtc = TRUE; + cPtr->UseDualChannel = TRUE; + } else + cPtr->SecondCrtc = FALSE; + + } else { + if (xf86ReturnOptValBool(cPtr->Options, + OPTION_DUAL_REFRESH, FALSE)) { + cPtr->Flags |= ChipsDualRefresh; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Dual Refresh mode enabled\n"); + cPtr->UseDualChannel = TRUE; + } + } + + /* Store IOSS/MSS so that we can restore them */ + cPtr->storeIOSS = cPtr->readIOSS(cPtr); + cPtr->storeMSS = cPtr->readMSS(cPtr); + DUALOPEN; + } + /* memory size */ if (cPtr->pEnt->device->videoRam != 0) { pScrn->videoRam = cPtr->pEnt->device->videoRam; @@ -1638,17 +1804,61 @@ break; } } - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VideoRAM: %d kByte\n", - pScrn->videoRam); } - cPtr->FbMapSize = pScrn->videoRam * 1024; + + if ((cPtr->Flags & ChipsDualChannelSupport) && + (xf86IsEntityShared(pScrn->entityList[0]))) { + /* + * This takes gives either half or the amount of memory specified + * with the Crt2Memory option + */ + if(cPtr->SecondCrtc == FALSE) { + MessageType from; + + int crt2mem = -1, adjust; + + xf86GetOptValInteger(cPtr->Options, OPTION_CRT2_MEM, &crt2mem); + if (crt2mem > 0) { + adjust = crt2mem; + from = X_CONFIG; + } else { + adjust = pScrn->videoRam / 2; + from = X_DEFAULT; + } + xf86DrvMsg(pScrn->scrnIndex, from, + "CRT2 will use %dK of VideoRam\n", + adjust); + + cPtrEnt->mastervideoRam = pScrn->videoRam - adjust; + pScrn->videoRam = cPtrEnt->mastervideoRam; + cPtrEnt->slavevideoRam = adjust; + cPtrEnt->masterFbAddress = cPtr->FbAddress; + cPtr->FbMapSize = + cPtrEnt->masterFbMapSize = pScrn->videoRam * 1024; + cPtrEnt->slaveFbMapSize = cPtrEnt->slavevideoRam * 1024; + } else { + cPtrEnt->slaveFbAddress = cPtr->FbAddress + + cPtrEnt->masterFbAddress; + cPtr->FbMapSize = cPtrEnt->slaveFbMapSize; + pScrn->videoRam = cPtrEnt->slavevideoRam; + } + cPtrEnt->refCount++; + } else { + /* Normal Handling of video ram etc */ + cPtr->FbMapSize = pScrn->videoRam * 1024; + } + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "VideoRAM: %d kByte\n", + pScrn->videoRam); + /* Store register values that might be messed up by a suspend resume */ /* Do this early as some of the other code in PreInit relies on it */ cPtr->SuspendHack.vgaIOBaseFlag = ((hwp->readMiscOut(hwp)) & 0x01); cPtr->IOBase = (unsigned int)(cPtr->SuspendHack.vgaIOBaseFlag ? 0x3D0 : 0x3B0); + /*test STN / TFT */ tmp = cPtr->readFR(cPtr, 0x10); @@ -1852,16 +2062,9 @@ } CRTclkI = (hwp->readMiscOut(hwp) >> 2) & 0x03; if (CRTclkI == 3) CRTclkI = 2; - if (cPtr->Flags & ChipsDualChannelSupport) { - unsigned char IOSS, MSS; - IOSS = cPtr->readIOSS(cPtr); - MSS = cPtr->readMSS(cPtr); - cPtr->writeIOSS(cPtr,((IOSS&0xE0) | 0x11)); /* Select Pipeline A */ - cPtr->writeMSS(cPtr,((MSS&0xF0) | 0x8)); + if (cPtr->Chipset == CHIPS_CT69030) FPclkI = (cPtr->readFR(cPtr, 0x01) >> 2) & 0x3; - cPtr->writeIOSS(cPtr,IOSS); - cPtr->writeMSS(cPtr,MSS); - } else + else FPclkI = (cPtr->readFR(cPtr, 0x03) >> 2) & 0x3; if (FPclkI == 3) FPclkI = 2; for (i = 0; i < 3; i++) { @@ -1882,6 +2085,46 @@ } cPtr->CRTclkInx = CRTclkI; + + /* + * Some chips seem to dislike some clocks in one of the PLL's. Give + * the user the oppurtunity to change it + */ + if (xf86GetOptValInteger(cPtr->Options, OPTION_CRT_CLK_INDX, &indx)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Force CRT Clock index to %d\n", + indx); + cPtr->CRTclkInx = indx; + + if (xf86GetOptValInteger(cPtr->Options, OPTION_FP_CLK_INDX, &indx)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Force FP Clock index to %d\n", indx); + cPtr->FPclkInx = indx; + } else { + if (indx == cPtr->FPclkInx) { + if (indx == 2) + cPtr->FPclkInx = 1; + else + cPtr->FPclkInx = indx + 1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "FP Clock index forced to %d\n", cPtr->FPclkInx); + } + } + } else if (xf86GetOptValInteger(cPtr->Options, OPTION_FP_CLK_INDX, + &indx)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Force FP Clock index to %d\n", indx); + cPtr->FPclkInx = indx; + if (indx == cPtr->CRTclkInx) { + if (indx == 2) + cPtr->CRTclkInx = 1; + else + cPtr->CRTclkInx = indx + 1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "CRT Clock index forced to %d\n", cPtr->CRTclkInx); + } + } + + /* Probe the memory clock currently in use */ MemClk->xrCC = cPtr->readXR(cPtr, 0xCC); MemClk->M = (MemClk->xrCC & 0x7F) + 2; @@ -1968,18 +2211,37 @@ /* Check if maxClock is limited by the MemClk. Only 70% to allow for */ /* RAS/CAS. Extra byte per memory clock needed if framebuffer used */ /* Extra byte if the overlay plane is avtivated */ - if (cPtr->FrameBufferSize && (cPtr->PanelType & ChipsLCD)) - if (cPtr->Flags & ChipsOverlay8plus16 ) - cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 4 * 0.7 / 4); + /* We have a 64bit wide memory bus on the 69030 and 69000, and 32bits */ + /* on the others. Thus multiply by a suitable factor */ + if ((cPtr->Chipset == CHIPS_CT69030) || (cPtr->Chipset == CHIPS_CT69000)) { + if (cPtr->FrameBufferSize && (cPtr->PanelType & ChipsLCD)) + if (cPtr->Flags & ChipsOverlay8plus16 ) + cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 8 * 0.7 / 4); + else + cPtr->MaxClock = min(cPtr->MaxClock, + MemClk->Clk * 8 * 0.7 / (bytesPerPixel + 1)); else - cPtr->MaxClock = min(cPtr->MaxClock, + if (cPtr->Flags & ChipsOverlay8plus16) + cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 8 * 0.7 / 3); + else + cPtr->MaxClock = min(cPtr->MaxClock, + MemClk->Clk * 8 * 0.7 / bytesPerPixel); + } else { + if (cPtr->FrameBufferSize && (cPtr->PanelType & ChipsLCD)) + if (cPtr->Flags & ChipsOverlay8plus16 ) + cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 4 * 0.7 / 4); + else + cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 4 * 0.7 / (bytesPerPixel + 1)); - else - if (cPtr->Flags & ChipsOverlay8plus16) - cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 4 * 0.7 / 3); else - cPtr->MaxClock = min(cPtr->MaxClock, + if (cPtr->Flags & ChipsOverlay8plus16) + cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 4 * 0.7 / 3); + else + cPtr->MaxClock = min(cPtr->MaxClock, MemClk->Clk * 4 * 0.7 / bytesPerPixel); + } + + if (cPtr->pEnt->device->dacSpeeds[0]) { int speed = 0; @@ -2090,6 +2352,21 @@ chips_ddc1(pScrn); } + if (cPtr->Flags & ChipsDualChannelSupport) { + if (xf86IsEntityShared(pScrn->entityList[0])) { + if (cPtr->SecondCrtc == TRUE) { + cPtrEnt->slaveActive = FALSE; + } else { + cPtrEnt->masterActive = FALSE; + } + } + /* Put IOSS/MSS back to normal */ + cPtr->writeIOSS(cPtr, cPtr->storeIOSS); + cPtr->writeMSS(cPtr, cPtr->storeMSS); + + xf86SetPrimInitDone(pScrn->entityList[0]); + } + return TRUE; } @@ -2198,7 +2475,9 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - cPtr->Options = (OptionInfoPtr)ChipsWingineOptions; + if (!(cPtr->Options = xalloc(sizeof(ChipsWingineOptions)))) + return FALSE; + memcpy(cPtr->Options, ChipsWingineOptions, sizeof(ChipsWingineOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, cPtr->Options); /* Set the bits per RGB */ @@ -2662,7 +2941,9 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - cPtr->Options = (OptionInfoPtr)Chips655xxOptions; + if (!(cPtr->Options = xalloc(sizeof(Chips655xxOptions)))) + return FALSE; + memcpy(cPtr->Options, Chips655xxOptions, sizeof(Chips655xxOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, cPtr->Options); /* Set the bits per RGB */ @@ -3328,15 +3609,22 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; CHIPSPtr cPtr = CHIPSPTR(pScrn); + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; + + if (cPtr->Flags & ChipsDualChannelSupport) + DUALOPEN; /* Should we re-save the text mode on each VT enter? */ if(!chipsModeInit(pScrn, pScrn->currentMode)) return FALSE; if ((!(cPtr->Flags & ChipsOverlay8plus16)) && - (cPtr->Flags & ChipsVideoSupport)) - CHIPSResetVideo(pScrn); - xf86UDelay(50000); - chipsHWCursorOn(cPtr); + (cPtr->Flags & ChipsVideoSupport) + && (cPtr->Flags & ChipsAccelSupport)) + CHIPSResetVideo(pScrn); + + /*xf86UDelay(50000);*/ + chipsHWCursorOn(cPtr, pScrn); /* cursor settle delay */ xf86UDelay(50000); CHIPSAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); @@ -3351,14 +3639,24 @@ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; CHIPSPtr cPtr = CHIPSPTR(pScrn); CHIPSACLPtr cAcl = CHIPSACLPTR(pScrn); + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; /* Invalidate the cached acceleration registers */ cAcl->planemask = -1; cAcl->fgColor = -1; cAcl->bgColor = -1; - chipsHWCursorOff(cPtr); - chipsRestore(pScrn, &(VGAHWPTR(pScrn))->SavedReg, &cPtr->SavedReg, TRUE); - chipsLock(pScrn); + + if (cPtr->Flags & ChipsDualChannelSupport) { + if (cPtr->UseDualChannel) + DUALREOPEN; + DUALCLOSE; + } else { + chipsHWCursorOff(cPtr, pScrn); + chipsRestore(pScrn, &(VGAHWPTR(pScrn))->SavedReg, &cPtr->SavedReg, + TRUE); + chipsLock(pScrn); + } } @@ -3368,11 +3666,16 @@ { vgaHWPtr hwp = VGAHWPTR(pScrn); CHIPSPtr cPtr = CHIPSPTR(pScrn); + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; int i, index, shift ; shift = ((pScrn->depth == 15) && (!(cPtr->Flags & ChipsOverlay8plus16))) ? 3 : 0; + if (cPtr->UseDualChannel) + DUALREOPEN; + for (i = 0; i < numColors; i++) { index = indices[i]; hwp->writeDacWriteAddr(hwp,index << shift); @@ -3385,6 +3688,30 @@ DACDelay(hwp); } + if (cPtr->UseDualChannel && + (! xf86IsEntityShared(pScrn->entityList[0]))) { + unsigned int IOSS, MSS; + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_B)); + + for (i = 0; i < numColors; i++) { + index = indices[i]; + hwp->writeDacWriteAddr(hwp,index << shift); + DACDelay(hwp); + hwp->writeDacData(hwp, colors[index].red); + DACDelay(hwp); + hwp->writeDacData(hwp, colors[index].green); + DACDelay(hwp); + hwp->writeDacData(hwp, colors[index].blue); + DACDelay(hwp); + } + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } + /* This shouldn't be necessary, but we'll play safe. */ hwp->disablePalette(hwp); } @@ -3394,8 +3721,14 @@ LOCO *colors, VisualPtr pVisual) { vgaHWPtr hwp = VGAHWPTR(pScrn); + CHIPSPtr cPtr = CHIPSPTR(pScrn); + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; int i, index; + if (cPtr->UseDualChannel) + DUALREOPEN; + for (i = 0; i < numColors; i++) { index = indices[i]; hwp->writeDacWriteAddr(hwp, index << 2); @@ -3408,6 +3741,32 @@ DACDelay(hwp); } + + if (cPtr->UseDualChannel && + (! xf86IsEntityShared(pScrn->entityList[0]))) { + unsigned int IOSS, MSS; + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_B)); + + for (i = 0; i < numColors; i++) { + index = indices[i]; + hwp->writeDacWriteAddr(hwp, index << 2); + DACDelay(hwp); + hwp->writeDacData(hwp, colors[index >> 1].red); + DACDelay(hwp); + hwp->writeDacData(hwp, colors[index].green); + DACDelay(hwp); + hwp->writeDacData(hwp, colors[index >> 1].blue); + DACDelay(hwp); + } + + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } + /* This shouldn't be necessary, but we'll play safe. */ hwp->disablePalette(hwp); } @@ -3416,7 +3775,7 @@ static Bool CHIPSScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { - ScrnInfoPtr pScrn; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; vgaHWPtr hwp; CHIPSPtr cPtr; CHIPSACLPtr cAcl; @@ -3426,6 +3785,8 @@ unsigned int racflag = 0; unsigned char *FBStart; int height, width, displayWidth; + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; #ifdef DEBUG ErrorF("CHIPSScreenInit\n"); #endif @@ -3433,7 +3794,6 @@ * we need to get the ScrnInfoRec for this screen, so let's allocate * one first thing */ - pScrn = xf86Screens[pScreen->myNum]; cPtr = CHIPSPTR(pScrn); cAcl = CHIPSACLPTR(pScrn); hwp = VGAHWPTR(pScrn); @@ -3464,11 +3824,14 @@ } /* Setup the MMIO register access functions if need */ - if (cPtr->MMIOBaseVGA) { + if (cPtr->UseFullMMIO && cPtr->MMIOBaseVGA) { CHIPSSetMmioExtFuncs(cPtr); CHIPSHWSetMmioFuncs(pScrn, cPtr->MMIOBaseVGA, 0x0); } + if (cPtr->Flags & ChipsDualChannelSupport) + DUALOPEN; + #if defined(__arm32__) && defined(__NetBSD__) if (strcmp(pScrn->currentMode->name,"PAL") == 0) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using built-in PAL TV mode\n"); @@ -3488,11 +3851,28 @@ /* * next we save the current state and setup the first mode */ - chipsSave(pScrn); + if ((cPtr->Flags & ChipsDualChannelSupport) && + (! xf86IsEntityShared(pScrn->entityList[0]))) { + unsigned int IOSS, MSS; + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_A)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_A)); + chipsSave(pScrn, &hwp->SavedReg, &cPtr->SavedReg); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_B)); + chipsSave(pScrn, &cPtr->VgaSavedReg2, &cPtr->SavedReg2); + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } else + chipsSave(pScrn, &hwp->SavedReg, &cPtr->SavedReg); + if (!chipsModeInit(pScrn,pScrn->currentMode)) return FALSE; CHIPSSaveScreen(pScreen,SCREEN_SAVER_ON); - CHIPSAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + CHIPSAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); /* * The next step is to setup the screen's visuals, and initialise the @@ -3516,6 +3896,8 @@ if (!miSetVisualTypes(8, PseudoColorMask | GrayScaleMask, pScrn->rgbBits, PseudoColor)) return FALSE; + if (!miSetVisualTypes(16, TrueColorMask, pScrn->rgbBits, TrueColor)) + return FALSE; } else { if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), @@ -3573,10 +3955,8 @@ width,height, pScrn->xDpi, pScrn->yDpi, displayWidth,pScrn->bitsPerPixel); -#ifdef RENDER if (ret) fbPictureInit (pScreen, 0, 0); -#endif break; } @@ -3600,6 +3980,9 @@ xf86SetBlackWhitePixels(pScreen); + cPtr->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = chipsBlockHandler; + if ( (pScrn->depth >= 8)) CHIPSDGAInit(pScreen); @@ -3700,7 +4083,11 @@ freespace = allocatebase - pScrn->displayWidth * pScrn->virtualY * (pScrn->bitsPerPixel >> 3); - currentaddr = allocatebase; + if ((cPtr->Flags & ChipsDualChannelSupport) && + (cPtr->SecondCrtc == TRUE)) + currentaddr = allocatebase + cPtrEnt->masterFbMapSize; + else + currentaddr = allocatebase; if (serverGeneration == 1) xf86DrvMsg(scrnIndex, X_PROBED, "%d bytes off-screen memory available\n", freespace); @@ -3852,14 +4239,11 @@ if(!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, chipsLoadPalette, NULL, CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; - } else if ((cPtr->Flags & ChipsGammaSupport) && (pScrn->depth > 8)) { + } else { if(!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, (pScrn->depth == 16 ? chipsLoadPalette16 : chipsLoadPalette), NULL, CMAP_RELOAD_ON_MODE_SWITCH | CMAP_PALETTED_TRUECOLOR)) return FALSE; - } else { - if (!vgaHWHandleColormaps(pScreen)) - return FALSE; } if (pScrn->bitsPerPixel <= 8) @@ -3874,17 +4258,23 @@ #endif if ((!(cPtr->Flags & ChipsOverlay8plus16)) && - (cPtr->Flags & ChipsVideoSupport)) { + (cPtr->Flags & ChipsVideoSupport) + && (cPtr->Flags & ChipsAccelSupport)) { CHIPSInitVideo(pScreen); } pScreen->SaveScreen = CHIPSSaveScreen; -#ifdef DPMSExtension /* Setup DPMS mode */ if (cPtr->Flags & ChipsDPMSSupport) xf86DPMSInit(pScreen, (DPMSSetProcPtr)chipsDisplayPowerManagementSet, 0); + +#if 0 /* #### Shouldn't be needed */ + /* Dual head, needs to fix framebuffer memory address */ + if ((cPtr->Flags & ChipsDualChannelSupport) && + (cPtr->SecondCrtc == TRUE)) + pScrn->memPhysBase = cPtr->FbAddress + cPtrEnt->masterFbMapSize; #endif /* Wrap the current CloseScreen function */ @@ -3903,7 +4293,16 @@ Bool CHIPSSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + CHIPSPtr cPtr = CHIPSPTR(pScrn); + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; + ErrorF("CHIPSSwitchMode\n"); + + if (cPtr->UseDualChannel) + DUALREOPEN; + return chipsModeInit(xf86Screens[scrnIndex], mode); } @@ -3911,16 +4310,14 @@ void CHIPSAdjustFrame(int scrnIndex, int x, int y, int flags) { - ScrnInfoPtr pScrn; + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + CHIPSPtr cPtr = CHIPSPTR(pScrn); + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; int Base; - CHIPSPtr cPtr; - vgaHWPtr hwp; + vgaHWPtr hwp = VGAHWPTR(pScrn); unsigned char tmp; - pScrn = xf86Screens[scrnIndex]; - hwp = VGAHWPTR(pScrn); - cPtr = CHIPSPTR(pScrn); - if (xf86ReturnOptValBool(cPtr->Options, OPTION_SHOWCACHE, FALSE) && y) { int lastline = cPtr->FbMapSize / ((pScrn->displayWidth * pScrn->bitsPerPixel) / 8); @@ -3930,7 +4327,7 @@ } Base = y * pScrn->displayWidth + x; - + /* calculate base bpp dep. */ switch (pScrn->bitsPerPixel) { case 1: @@ -3956,6 +4353,9 @@ break; } + if (cPtr->UseDualChannel) + DUALREOPEN; + /* write base to chip */ /* * These are the generic starting address registers. @@ -3972,6 +4372,25 @@ 0x030000)) >> 16) | (tmp & 0xF8)); } + if (cPtr->UseDualChannel && + (! xf86IsEntityShared(pScrn->entityList[0]))) { + unsigned int IOSS, MSS; + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_B)); + + chipsFixResume(pScrn); + hwp->writeCrtc(hwp, 0x0C, (Base & 0xFF00) >> 8); + hwp->writeCrtc(hwp, 0x0D, Base & 0xFF); + if (((cPtr->readXR(cPtr, 0x09)) & 0x1) == 0x1) + hwp->writeCrtc(hwp, 0x40, ((Base & 0x0F0000) >> 16) | 0x80); + + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } + if (cPtr->Flags & ChipsOverlay8plus16) { Base = (Base << 3) & ~(unsigned long)0xF; @@ -3979,7 +4398,7 @@ cPtr->writeMR(cPtr, 0x23, ((cPtr->FbOffset16 + Base) >> 8) & 0xFF); cPtr->writeMR(cPtr, 0x24, ((cPtr->FbOffset16 + Base) >> 16) & 0xFF); } - + } /* Mandatory */ @@ -3988,13 +4407,32 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; CHIPSPtr cPtr = CHIPSPTR(pScrn); + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; if(pScrn->vtSema){ /*§§§*/ - chipsHWCursorOff(cPtr); - chipsRestore(pScrn, &(VGAHWPTR(pScrn))->SavedReg, &cPtr->SavedReg, TRUE); - chipsLock(pScrn); - chipsUnmapMem(pScrn); + if (cPtr->Flags & ChipsDualChannelSupport) { + if (cPtr->UseDualChannel) + DUALREOPEN; + DUALCLOSE; + } else { + chipsHWCursorOff(cPtr, pScrn); + chipsRestore(pScrn, &(VGAHWPTR(pScrn))->SavedReg, &cPtr->SavedReg, + TRUE); + chipsLock(pScrn); + } + chipsUnmapMem(pScrn); } + + if (xf86IsEntityShared(pScrn->entityList[0])) { + DevUnion *pPriv; + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], CHIPSEntityIndex); + cPtrEnt = pPriv->ptr; + cPtrEnt->refCount--; + } + if (cPtr->pVbe) + vbeFree(cPtr->pVbe); + cPtr->pVbe = NULL; if (cPtr->AccelInfoRec) XAADestroyInfoRec(cPtr->AccelInfoRec); if (cPtr->CursorInfoRec) @@ -4004,7 +4442,11 @@ if (cPtr->DGAModes) xfree(cPtr->DGAModes); pScrn->vtSema = FALSE; + if(cPtr->BlockHandler) + pScreen->BlockHandler = cPtr->BlockHandler; + pScreen->CloseScreen = cPtr->CloseScreen; /*§§§*/ + xf86ClearPrimInitDone(pScrn->entityList[0]); return (*pScreen->CloseScreen)(scrnIndex, pScreen);/*§§§*/ } @@ -4031,7 +4473,6 @@ return MODE_OK; } -#ifdef DPMSExtension /* * DPMS Control registers * @@ -4049,6 +4490,8 @@ { vgaHWPtr hwp = VGAHWPTR(pScrn); CHIPSPtr cPtr = CHIPSPTR(pScrn); + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; unsigned char dpmsreg, seqreg, lcdoff, tmp; if (!pScrn->vtSema) @@ -4084,6 +4527,9 @@ return; } + if (cPtr->UseDualChannel) + DUALREOPEN; + seqreg |= hwp->readSeq(hwp, 0x01) & ~0x20; hwp->writeSeq(hwp, 0x01, seqreg); if (IS_HiQV(cPtr)) { @@ -4122,7 +4568,6 @@ } } } -#endif static Bool CHIPSSaveScreen(ScreenPtr pScreen, int mode) @@ -4191,6 +4636,8 @@ unsigned char tmp; vgaHWPtr hwp = VGAHWPTR(pScrn); CHIPSPtr cPtr = CHIPSPTR(pScrn); + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; unsigned char Type = cPtr->ClockType; Clock->msr = hwp->readMiscOut(hwp)&0xFE; /* save standard VGA clock reg */ @@ -4198,16 +4645,12 @@ case HiQV_STYLE: /* save alternate clock select reg.*/ /* The 69030 FP clock select is at FR01 instead */ - if (cPtr->Flags & ChipsDualChannelSupport) { - unsigned char IOSS, MSS; - IOSS = cPtr->readIOSS(cPtr); - MSS = cPtr->readMSS(cPtr); - cPtr->writeIOSS(cPtr,((IOSS&0xE0) | 0x11)); /* Select Pipeline A */ - cPtr->writeMSS(cPtr,((MSS&0xF0) | 0x8)); + if (cPtr->UseDualChannel) + DUALREOPEN; + + if (cPtr->Flags & ChipsDualChannelSupport) Clock->fr03 = cPtr->readFR(cPtr, 0x01); - cPtr->writeIOSS(cPtr,IOSS); - cPtr->writeMSS(cPtr,MSS); - } else + else Clock->fr03 = cPtr->readFR(cPtr, 0x03); if (!Clock->Clock) { /* save HiQV console clock */ tmp = cPtr->CRTclkInx << 2; @@ -4245,11 +4688,16 @@ { vgaHWPtr hwp = VGAHWPTR(pScrn); CHIPSPtr cPtr = CHIPSPTR(pScrn); + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; unsigned char Type = cPtr->ClockType; if (no > (pScrn->numClocks - 1)) return (FALSE); + if (cPtr->UseDualChannel) + DUALREOPEN; + switch (Type & GET_STYLE) { case HiQV_STYLE: Clock->msr = cPtr->CRTclkInx << 2; @@ -4320,6 +4768,7 @@ #endif return (TRUE); } + static int chipsGetHWClock(ScrnInfoPtr pScrn) @@ -4378,7 +4827,6 @@ volatile unsigned char tmp, tmpmsr, tmpfcr, tmp02; volatile unsigned char tmp33, tmp54, tmpf03; unsigned char vclk[3]; - volatile unsigned char IOSS, MSS; tmpmsr = hwp->readMiscOut(hwp); /* read msr, needed for all styles */ @@ -4387,13 +4835,7 @@ /* save alternate clock select reg. */ /* The 69030 FP clock select is at FR01 instead */ if (cPtr->Flags & ChipsDualChannelSupport) { - IOSS = cPtr->readIOSS(cPtr); - MSS = cPtr->readMSS(cPtr); - cPtr->writeIOSS(cPtr,((IOSS&0xE0) | 0x11)); /* Select Pipeline A */ - cPtr->writeMSS(cPtr,((MSS&0xF0) | 0x8)); tmpf03 = cPtr->readFR(cPtr, 0x01); - cPtr->writeIOSS(cPtr,IOSS); - cPtr->writeMSS(cPtr,MSS); } else tmpf03 = cPtr->readFR(cPtr, 0x03); /* select fixed clock 0 before tampering with VCLK select */ @@ -4401,11 +4843,7 @@ cPtr->SuspendHack.vgaIOBaseFlag); /* The 69030 FP clock select is at FR01 instead */ if (cPtr->Flags & ChipsDualChannelSupport) { - cPtr->writeIOSS(cPtr,((IOSS&0xE0) | 0x11)); /* Select Pipeline A */ - cPtr->writeMSS(cPtr,((MSS&0xF0) | 0x8)); cPtr->writeFR(cPtr, 0x01, (tmpf03 & ~0x0C) | 0x04); - cPtr->writeIOSS(cPtr,IOSS); - cPtr->writeMSS(cPtr,MSS); } else cPtr->writeFR(cPtr, 0x03, (tmpf03 & ~0x0C) | 0x04); if (!Clock->Clock) { /* Hack to load saved console clock */ @@ -4448,12 +4886,8 @@ usleep(10000); /* Let VCO stabilise */ /* The 69030 FP clock select is at FR01 instead */ if (cPtr->Flags & ChipsDualChannelSupport) { - cPtr->writeIOSS(cPtr,((IOSS&0xE0) | 0x11)); /* Select Pipeline A */ - cPtr->writeMSS(cPtr,((MSS&0xF0) | 0x8)); cPtr->writeFR(cPtr, 0x01, ((tmpf03 & ~0x0C) | (Clock->fr03 & 0x0C))); - cPtr->writeIOSS(cPtr,IOSS); - cPtr->writeMSS(cPtr,MSS); } else cPtr->writeFR(cPtr, 0x03, ((tmpf03 & ~0x0C) | (Clock->fr03 & 0x0C))); @@ -4545,6 +4979,7 @@ /* Hack to deal with problem of Toshiba 720CDT clock */ int M_max = (IS_HiQV(cPtr) && cPtr->Chipset != CHIPS_CT69000 && cPtr->Chipset != CHIPS_CT69030) ? 63 : 127; + /* @@@ < CHIPS_CT690x0 ?? */ /* Other parameters available on the 65548 but not the 65545, and @@ -4584,8 +5019,8 @@ target = Clock * 1000; /* @@@ >= CHIPS_CT690x0 ?? */ - for (PSNx = (cPtr->Chipset == CHIPS_CT69000 || - cPtr->Chipset == CHIPS_CT69030) ? 1 : 0; PSNx <= 1; PSNx++) { + for (PSNx = ((cPtr->Chipset == CHIPS_CT69000) || + (cPtr->Chipset == CHIPS_CT69030)) ? 1 : 0; PSNx <= 1; PSNx++) { int low_N, high_N; double Fref4PSN; @@ -4594,7 +5029,8 @@ low_N = 3; high_N = 127; - while (Fref / (PSN * low_N) > 2.0e6) + while (Fref / (PSN * low_N) > (((cPtr->Chipset == CHIPS_CT69000) || + (cPtr->Chipset == CHIPS_CT69030)) ? 5.0e6 : 2.0e6)) low_N++; while (Fref / (PSN * high_N) < 150.0e3) high_N--; @@ -4604,8 +5040,8 @@ double tmp = Fref4PSN / N; /* @@@ < CHIPS_CT690x0 ?? */ - for (P = (IS_HiQV(cPtr) && cPtr->Chipset != CHIPS_CT69000 && - cPtr->Chipset != CHIPS_CT69030) ? 1 : 0; + for (P = (IS_HiQV(cPtr) && (cPtr->Chipset != CHIPS_CT69000) && + (cPtr->Chipset != CHIPS_CT69030)) ? 1 : 0; P <= 5; P++) { /* to force post divisor on Toshiba 720CDT */ double Fvco_desired = target * (1 << P); @@ -4653,7 +5089,7 @@ } /* @@@ >= CHIPS_CT690x0 ?? */ vclk[0] = (bestP << (IS_HiQV(cPtr) ? 4 : 1)) + - ((cPtr->Chipset == CHIPS_CT69000 || cPtr->Chipset == CHIPS_CT69030) + (((cPtr->Chipset == CHIPS_CT69000) || (cPtr->Chipset == CHIPS_CT69030)) ? 0 : (bestPSN == 1)); vclk[1] = bestM - 2; vclk[2] = bestN - 2; @@ -4665,20 +5101,16 @@ } static void -chipsSave(ScrnInfoPtr pScrn) +chipsSave(ScrnInfoPtr pScrn, vgaRegPtr VgaSave, CHIPSRegPtr ChipsSave) { - vgaRegPtr VgaSave = &VGAHWPTR(pScrn)->SavedReg; vgaHWPtr hwp = VGAHWPTR(pScrn); CHIPSPtr cPtr = CHIPSPTR(pScrn); - CHIPSRegPtr ChipsSave; int i; unsigned char tmp; #ifdef DEBUG ErrorF("chipsSave\n"); #endif - ChipsSave = &cPtr->SavedReg; - /* set registers that we can program the controller */ /* bank 0 */ if (IS_HiQV(cPtr)) { @@ -4698,16 +5130,15 @@ /* save clock */ chipsClockSave(pScrn, &ChipsSave->Clock); - /* Save the IOSS/MSS dual display channel registers */ - if (cPtr->Flags & ChipsDualChannelSupport) { - ChipsSave->MSS = cPtr->readMSS(cPtr); - ChipsSave->IOSS = cPtr->readIOSS(cPtr); - } - /* save extended registers */ if (IS_HiQV(cPtr)) { for (i = 0; i < 0xFF; i++) { - ChipsSave->XR[i] = cPtr->readXR(cPtr, i); +#ifdef SAR04 + /* Save SAR04 multimedia register correctly */ + if (i == 0x4F) + cPtr->writeXR(cPtr, 0x4E, 0x04); +#endif + ChipsSave->XR[i] = cPtr->readXR(cPtr,i); #ifdef DEBUG ErrorF("XS%X - %X\n", i, ChipsSave->XR[i]); #endif @@ -4719,12 +5150,7 @@ #endif } for (i = 0; i < 0x80; i++) { - /* Save SAR04 multimedia register correctly */ - if (i == 0x4F) { - cPtr->writeXR(cPtr, 0x4E, 0x04); ChipsSave->MR[i] = cPtr->readMR(cPtr, i); - } else - ChipsSave->MR[i] = cPtr->readMR(cPtr, i); #ifdef DEBUG ErrorF("MS%X - %X\n", i, ChipsSave->FR[i]); #endif @@ -4761,6 +5187,12 @@ chipsUnlock(pScrn); chipsFixResume(pScrn); + /* + * We need to delay cursor loading after resetting the video mode + * to give the engine a chance to recover. + */ + cPtr->cursorDelay = TRUE; + if (IS_HiQV(cPtr)) return chipsModeInitHiQV(pScrn, mode); else if (IS_Wingine(cPtr)) @@ -4815,6 +5247,7 @@ ChipsNew = &cPtr->ModeReg; ChipsStd = &hwp->ModeReg; + /* * Possibly fix up the panel size, if the manufacture is stupid * enough to set it incorrectly in text modes @@ -4836,15 +5269,30 @@ ErrorF("bomb 2\n"); return (FALSE); } - + + /* Give Warning if the dual display mode will cause problems */ + /* Note 64bit wide memory bus assumed (as in 69000 and 69030 */ + if (cPtr->UseDualChannel && ((cPtr->SecondCrtc == TRUE) || + (cPtr->Flags & ChipsDualRefresh))) { + if (((ChipsNew->Clock.FPClock + ChipsNew->Clock.Clock) * + (max(1, pScrn->bitsPerPixel >> 3) + + ((cPtr->FrameBufferSize && (cPtr->PanelType & ChipsLCD)) ? + 1 : 0)) / (8 * 0.7)) > cPtr->MemClock.Max) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Memory bandwidth requirements exceeded by dual-channel\n"); + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + " mode. Display might be corrupted!!!\n"); + } + } + /* get C&T Specific Registers */ for (i = 0; i < 0xFF; i++) { +#ifdef SAR04 /* Save SAR04 multimedia register correctly */ - if (i == 0x4F) { + if (i == 0x4F) cPtr->writeXR(cPtr, 0x4E, 0x04); - ChipsNew->XR[i] = cPtr->readXR(cPtr, i); - } else - ChipsNew->XR[i] = cPtr->readXR(cPtr, i); +#endif + ChipsNew->XR[i] = cPtr->readXR(cPtr, i); } for (i = 0; i < 0x80; i++) { ChipsNew->FR[i] = cPtr->readFR(cPtr, i); @@ -4856,14 +5304,6 @@ ChipsNew->CR[i] = hwp->readCrtc(hwp, i); } - /* Read the display panel registers and force them to desired mode */ - if (cPtr->Flags & ChipsDualChannelSupport) { - ChipsNew->MSS = cPtr->readMSS(cPtr); - ChipsNew->IOSS = cPtr->readIOSS(cPtr); - ChipsNew->MSS &= 0xF0 | 0x0B ; - ChipsNew->IOSS &= 0xE0 |0x13 ; - } - /* * Here all of the other fields of 'ChipsNew' get filled in, to * handle the SVGA extended registers. It is also allowable @@ -4929,6 +5369,25 @@ ChipsNew->XR[0xCE] = cPtr->MemClock.xrCE; } + /* Set the 69030 dual channel settings */ + if (cPtr->Flags & ChipsDualChannelSupport) { + ChipsNew->FR[0x01] &= 0xFC; + if ((cPtr->SecondCrtc == FALSE) && (cPtr->PanelType & ChipsLCD)) + ChipsNew->FR[0x01] |= 0x02; + else + ChipsNew->FR[0x01] |= 0x01; + ChipsNew->FR[0x02] &= 0xCC; + if ((cPtr->SecondCrtc == TRUE) || (cPtr->Flags & ChipsDualRefresh)) + ChipsNew->FR[0x02] |= 0x01; /* Set DAC to pipe B */ + else + ChipsNew->FR[0x02] &= 0xFE; /* Set DAC to pipe A */ + + if (cPtr->PanelType & ChipsLCD) + ChipsNew->FR[0x02] |= 0x20; /* Enable the LCD output */ + if (cPtr->PanelType & ChipsCRT) + ChipsNew->FR[0x02] |= 0x10; /* Enable the CRT output */ + } + /* linear specific */ if (cPtr->Flags & ChipsLinearSupport) { ChipsNew->XR[0x0A] |= 0x02; /* Linear Addressing Mode */ @@ -4985,6 +5444,7 @@ if ((cPtr->Chipset == CHIPS_CT69000) || (cPtr->Chipset == CHIPS_CT69030)) { /* The 690xx has overflow bits for the horizontal values as well */ ChipsNew->CR[0x38] = (((mode->CrtcHTotal >> 3) - 5) & 0x100) >> 8; +#if 0 /* We need to redo the overscan voodoo from vgaHW.c */ ChipsStd->CRTC[3] = (ChipsStd->CRTC[3] & ~0x1F) | (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F); @@ -5001,9 +5461,15 @@ ChipsStd->CRTC[3] = (ChipsStd->CRTC[3] & ~0x1F) | (i & 0x1F); ChipsStd->CRTC[5] = (ChipsStd->CRTC[5] & ~0x80) | ((i << 2) &0x80); ChipsNew->CR[0x3C] = (i & 0xC0); - } + } +#else + ChipsNew->CR[0x3C] = vgaHWHBlankKGA(mode, ChipsStd, 8, + KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO) << 6; +#endif + } else + vgaHWHBlankKGA(mode, ChipsStd, 6, KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO); + vgaHWVBlankKGA(mode, ChipsStd, 8, KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO); - } ChipsNew->CR[0x40] |= 0x80; /* centering/stretching */ @@ -5169,21 +5635,24 @@ if (cPtr->PanelType & ChipsLCD) { cPtr->OverlaySkewX = (((ChipsNew->FR[0x23] & 0xFF) - (ChipsNew->FR[0x20] & 0xFF) + 3) << 3) - - 1; + - 1; cPtr->OverlaySkewY = (ChipsNew->FR[0x33] + ((ChipsNew->FR[0x36] & 0xF) << 8) - (ChipsNew->FR[0x31] & 0xF0) - (ChipsNew->FR[0x32] & 0x0F) - ((ChipsNew->FR[0x35] & 0xF0) << 4)); + if (!xf86ReturnOptValBool(cPtr->Options, OPTION_LCD_STRETCH, + FALSE)) { if (cPtr->PanelSize.HDisplay > mode->CrtcHDisplay) cPtr->OverlaySkewX += (cPtr->PanelSize.HDisplay - mode->CrtcHDisplay) / 2; if (cPtr->PanelSize.VDisplay > mode->CrtcVDisplay) cPtr->OverlaySkewY += (cPtr->PanelSize.VDisplay - - mode->CrtcVDisplay) / 2; + mode->CrtcVDisplay) / 2; + } } else { - cPtr->OverlaySkewX = mode->CrtcHTotal - mode->CrtcHBlankStart - 1; - cPtr->OverlaySkewY = mode->CrtcVTotal - mode->CrtcVSyncEnd; + cPtr->OverlaySkewX = mode->CrtcHTotal - mode->CrtcHBlankStart - 9; + cPtr->OverlaySkewY = mode->CrtcVTotal - mode->CrtcVSyncEnd - 2; if (mode->Flags & V_INTERLACE) { /* @@ -5197,6 +5666,25 @@ } } + + /* mask for viewport granularity */ + + switch (pScrn->bitsPerPixel) { + case 8: + cPtr->viewportMask = ~7U; + break; + case 16: + cPtr->viewportMask = ~3U; + break; + case 24: + cPtr->viewportMask = ~7U; + break; + case 32: + cPtr->viewportMask = ~0U; + break; + default: + cPtr->viewportMask = ~7U; + } /* Turn off multimedia by default as it degrades performance */ ChipsNew->XR[0xD0] &= 0x0f; @@ -5204,7 +5692,9 @@ /* Setup the video/overlay */ if (cPtr->Flags & ChipsOverlay8plus16) { ChipsNew->XR[0xD0] |= 0x10; /* Force the Multimedia engine on */ +#ifdef SAR04 ChipsNew->XR[0x4F] = 0x2A; /* SAR04 >352 pixel overlay width */ +#endif ChipsNew->MR[0x1E] &= 0xE0; /* Set Zoom and Direction */ if ((!(cPtr->PanelType & ChipsLCD)) && (mode->Flags & V_INTERLACE)) ChipsNew->MR[0x1E] |= 0x10; /* Interlace */ @@ -5253,10 +5743,12 @@ ChipsNew->MR[0x41] = 0xFF; ChipsNew->MR[0x42] = 0x00; } else if (cPtr->Flags & ChipsVideoSupport) { -#if 0 +#if 0 /* if we do this even though video isn't playing we kill performance */ ChipsNew->XR[0xD0] |= 0x10; /* Force the Multimedia engine on */ #endif +#ifdef SAR04 ChipsNew->XR[0x4F] = 0x2A; /* SAR04 >352 pixel overlay width */ +#endif ChipsNew->MR[0x3C] &= 0x18; /* Ensure that the overlay is off */ cPtr->VideoZoomMax = 0x100; @@ -5269,7 +5761,39 @@ /* Program the registers */ /*vgaHWProtect(pScrn, TRUE);*/ - chipsRestore(pScrn, ChipsStd, ChipsNew, FALSE); + + + if ((cPtr->Flags & ChipsDualChannelSupport) && + (!xf86IsEntityShared(pScrn->entityList[0]))) { + unsigned char IOSS, MSS, tmpfr01; + + + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_A)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | + MSS_PIPE_A)); + chipsRestore(pScrn, ChipsStd, ChipsNew, FALSE); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | + MSS_PIPE_B)); + /* + * Hack:: Force Pipe-B on for dual refresh, and off elsewise + */ + tmpfr01 = ChipsNew->FR[0x01]; + ChipsNew->FR[0x01] &= 0xFC; + if (cPtr->UseDualChannel) + ChipsNew->FR[0x01] |= 0x01; + chipsRestore(pScrn, ChipsStd, ChipsNew, FALSE); + ChipsNew->FR[0x01] = tmpfr01; + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } else { + chipsRestore(pScrn, ChipsStd, ChipsNew, FALSE); + } + /*vgaHWProtect(pScrn, FALSE);*/ usleep(100000); /* prevents cursor corruption seen on a TECRA 510 */ @@ -5995,17 +6519,16 @@ CHIPSPtr cPtr = CHIPSPTR(pScrn); unsigned char tmp = 0; - /* Before we do anything, if using dual channel set the IOSS/MSS regs */ - if (cPtr->Flags & ChipsDualChannelSupport) { - cPtr->writeIOSS(cPtr,ChipsReg->IOSS); - cPtr->writeMSS(cPtr,ChipsReg->MSS); - } - /*vgaHWProtect(pScrn, TRUE);*/ /* set registers so that we can program the controller */ if (IS_HiQV(cPtr)) { cPtr->writeXR(cPtr, 0x0E, 0x00); + if (cPtr->Flags & ChipsDualChannelSupport) { + tmp = cPtr->readFR(cPtr, 0x01); /* Disable pipeline */ + cPtr->writeFR(cPtr, 0x01, (tmp & 0xFC)); + cPtr->writeFR(cPtr, 0x02, 0x00); /* CRT/FP off */ + } } else { cPtr->writeXR(cPtr, 0x10, 0x00); cPtr->writeXR(cPtr, 0x11, 0x00); @@ -6018,8 +6541,12 @@ chipsFixResume(pScrn); - /* wait for vsync if sequencer is running - stop sequencer */ - if (cPtr->SyncResetIgn) { /* only do if sync reset is ignored */ + /* + * Wait for vsync if sequencer is running - stop sequencer. + * Only do if sync reset is ignored. Dual pipeline capable + * chips have pipeline forced off here, so we don't care. + */ + if ((cPtr->SyncResetIgn) && (!(cPtr->Flags & ChipsDualChannelSupport))) { while (((hwp->readST01(hwp)) & 0x08) == 0x08); /* VSync off */ while (((hwp->readST01(hwp)) & 0x08) == 0x00); /* VSync on */ hwp->writeSeq(hwp, 0x07, 0x00); /* reset hsync - just in case... */ @@ -6034,33 +6561,23 @@ chipsRestoreExtendedRegs(pScrn, ChipsReg); #if 0 - /* - * If we are using the multimedia engine with the 69030, make sure only - * pipeline A's multimedia engine is on - */ - if (cPtr->Flags & ChipsDualChannelSupport) { - unsigned char IOSS, MSS, tmpXRD0; - IOSS = cPtr->readIOSS(cPtr); - MSS = cPtr->readMSS(cPtr); - cPtr->writeIOSS(cPtr,((IOSS&0xE0) | 0x11)); /* Select Pipeline B */ - cPtr->writeMSS(cPtr,((MSS&0xF0) | 0x8)); - - tmpXRD0 = cPtr->readXR(cPtr, 0xD0); - cPtr->writeXR(cPtr, 0xD0, (tmpXRD0 & 0xEF)); - cPtr->writeIOSS(cPtr,IOSS); - cPtr->writeMSS(cPtr,MSS); - } -#endif - -#if 0 /* if people complain about lock ups or blank screens -- reenable */ /* set CRTC registers - do it before sequencer restarts */ for (i=0; i<25; i++) hwp->writeCrtc(hwp, i, VgaReg->CRTC[i]); #endif /* set generic registers */ - vgaHWRestore(pScrn, VgaReg, - VGA_SR_MODE | VGA_SR_CMAP | (restoreFonts ? VGA_SR_FONTS : 0)); + /* + * Enabling writing to the colourmap causes 69030's to lock. + * Anyone care to explain to me why ???? + */ + if (cPtr->Flags & ChipsDualChannelSupport) { + vgaHWRestore(pScrn, VgaReg, VGA_SR_MODE | + (restoreFonts ? VGA_SR_FONTS : 0)); + } else { + vgaHWRestore(pScrn, VgaReg, VGA_SR_MODE | VGA_SR_CMAP | + (restoreFonts ? VGA_SR_FONTS : 0)); + } /* set stretching registers */ if (IS_HiQV(cPtr)) { @@ -6101,6 +6618,13 @@ /* Fix resume again here, as Nozomi seems to need it */ chipsFixResume(pScrn); /*vgaHWProtect(pScrn, FALSE);*/ + + /* Enable pipeline if needed */ + if (cPtr->Flags & ChipsDualChannelSupport) { + cPtr->writeFR(cPtr, 0x01, ChipsReg->FR[0x01]); + cPtr->writeFR(cPtr, 0x02, ChipsReg->FR[0x02]); + } + } static void @@ -6119,10 +6643,13 @@ } /* Set SAR04 multimedia register correctly */ - if (cPtr->Flags & ChipsOverlay8plus16) { + if ((cPtr->Flags & ChipsOverlay8plus16) + || (cPtr->Flags & ChipsVideoSupport)) { +#ifdef SAR04 cPtr->writeXR(cPtr, 0x4E, 0x04); if (cPtr->readXR(cPtr, 0x4F) != Regs->XR[0x4F]) cPtr->writeXR(cPtr, 0x4F, Regs->XR[0x4F]); +#endif } /* Don't touch reserved memory control registers */ @@ -6150,8 +6677,18 @@ for (i = 0; i < 0x80; i++) { /* Don't touch alternate clock select reg. */ - if ((i == 0x01) && (cPtr->Chipset == CHIPS_CT69030)) + if ((i == 0x01) && (cPtr->Chipset == CHIPS_CT69030)) { + /* restore the non clock bits */ + tmp = cPtr->readFR(cPtr, 0x01); + cPtr->writeFR(cPtr, 0x01, ((Regs->FR[0x01] & 0xF0) | + (tmp & ~0xF0))); continue; + } + + if ((i == 0x02) && (cPtr->Chipset == CHIPS_CT69030)) + /* keep pipeline disabled till we are ready */ + continue; + if ((i == 0x03) && (cPtr->Chipset != CHIPS_CT69030)) { /* restore the non clock bits */ tmp = cPtr->readFR(cPtr, 0x03); @@ -6159,6 +6696,11 @@ (tmp & ~0xC3))); continue; } + + if ((i > 0x03) && (cPtr->Chipset != CHIPS_CT69030) && + (cPtr->SecondCrtc == TRUE)) + continue; + if ( (i == 0x40) || (i==0x48)) { /* !! set stretching but disable compensation */ cPtr->writeFR(cPtr, i, Regs->FR[i] & 0xFE); @@ -6314,6 +6856,8 @@ { CHIPSPtr cPtr = CHIPSPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; if (cPtr->Flags & ChipsLinearSupport) { if (cPtr->UseMMIO) { @@ -6339,14 +6883,27 @@ return FALSE; } if (cPtr->FbMapSize) { + unsigned long Addr = (unsigned long)cPtr->FbAddress; + unsigned int Map = cPtr->FbMapSize; + + if ((cPtr->Flags & ChipsDualChannelSupport) && + (xf86IsEntityShared(pScrn->entityList[0]))) { + if(cPtr->SecondCrtc == FALSE) { + Addr = cPtrEnt->masterFbAddress; + Map = cPtrEnt->masterFbMapSize; + } else { + Addr = cPtrEnt->slaveFbAddress; + Map = cPtrEnt->slaveFbMapSize; + } + } + if (cPtr->Bus == ChipsPCI) cPtr->FbBase = xf86MapPciMem(pScrn->scrnIndex,VIDMEM_FRAMEBUFFER, - cPtr->PciTag, (unsigned long)cPtr->FbAddress, - cPtr->FbMapSize); + cPtr->PciTag, Addr, Map); + else cPtr->FbBase = xf86MapVidMem(pScrn->scrnIndex,VIDMEM_FRAMEBUFFER, - (unsigned long)cPtr->FbAddress, - cPtr->FbMapSize); + Addr, Map); if (cPtr->FbBase == NULL) return FALSE; @@ -6403,8 +6960,13 @@ { CHIPSPtr cPtr = CHIPSPTR(pScrn); vgaHWPtr hwp = VGAHWPTR(pScrn); + CHIPSEntPtr cPtrEnt = xf86GetEntityPrivate(pScrn->entityList[0], + CHIPSEntityIndex)->ptr; unsigned char scrn; + if (cPtr->UseDualChannel) + DUALREOPEN; + /* fix things that could be messed up by suspend/resume */ if (!IS_HiQV(cPtr)) cPtr->writeXR(cPtr, 0x15, 0x00); @@ -6428,6 +6990,44 @@ if (!cPtr->SyncResetIgn) { hwp->writeSeq(hwp, 0x00, 0x03); } + + if ((cPtr->UseDualChannel) && + (! xf86IsEntityShared(pScrn->entityList[0]))) { + unsigned int IOSS, MSS; + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_B)); + + /* fix things that could be messed up by suspend/resume */ + if (!IS_HiQV(cPtr)) + cPtr->writeXR(cPtr, 0x15, 0x00); + + scrn = hwp->readSeq(hwp, 0x01); + + if (unblank) { + scrn &= 0xDF; /* enable screen */ + } else { + scrn |= 0x20; /* blank screen */ + } + + /* synchronous reset - stop counters */ + if (!cPtr->SyncResetIgn) { + hwp->writeSeq(hwp, 0x00, 0x01); + } + + hwp->writeSeq(hwp, 0x01, scrn); /* change mode */ + + /* end reset - start counters */ + if (!cPtr->SyncResetIgn) { + hwp->writeSeq(hwp, 0x00, 0x03); + } + + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } + } static void @@ -6478,12 +7078,25 @@ } static void -chipsHWCursorOn(CHIPSPtr cPtr) +chipsHWCursorOn(CHIPSPtr cPtr, ScrnInfoPtr pScrn) { /* enable HW cursor */ if (cPtr->HWCursorShown) { if (IS_HiQV(cPtr)) { cPtr->writeXR(cPtr, 0xA0, cPtr->HWCursorContents & 0xFF); + if (cPtr->UseDualChannel && + (! xf86IsEntityShared(pScrn->entityList[0]))) { + unsigned int IOSS, MSS; + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | + IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | + MSS_PIPE_B)); + cPtr->writeXR(cPtr, 0xA0, cPtr->HWCursorContents & 0xFF); + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } } else { HW_DEBUG(0x8); if (cPtr->UseMMIO) { @@ -6496,7 +7109,7 @@ } static void -chipsHWCursorOff(CHIPSPtr cPtr) +chipsHWCursorOff(CHIPSPtr cPtr, ScrnInfoPtr pScrn) { /* disable HW cursor */ if (cPtr->HWCursorShown) { @@ -6562,7 +7175,29 @@ unsigned char dacdata[3]; unsigned char xr1, xr2; int type = 2; /* no monitor */ + unsigned char IOSS=0, MSS=0, tmpfr02=0, tmpfr01a=0, tmpfr01b=0; + /* Dual channel display, enable both pipelines */ + if (cPtr->Flags & ChipsDualChannelSupport) { + IOSS = cPtr->readIOSS(cPtr); + MSS = cPtr->readMSS(cPtr); + tmpfr02 = cPtr->readFR(cPtr,0x02); + cPtr->writeFR(cPtr, 0x02, tmpfr02 & 0xCF); /* CRT/FP off */ + usleep(1000); + cPtr->writeIOSS(cPtr, ((IOSS & IOSS_MASK) | IOSS_PIPE_A)); + cPtr->writeMSS(cPtr, ((MSS & MSS_MASK) | MSS_PIPE_A)); + tmpfr01a = cPtr->readFR(cPtr,0x01); + if ((tmpfr01a & 0x3) == 0) + cPtr->writeFR(cPtr, 0x01, ((tmpfr01a & 0xFC) | 0x1)); + cPtr->writeIOSS(cPtr, ((IOSS & IOSS_MASK) | IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((MSS & MSS_MASK) | MSS_PIPE_B)); + tmpfr01b = cPtr->readFR(cPtr,0x01); + if ((tmpfr01b & 0x3) == 0) + cPtr->writeFR(cPtr, 0x01, ((tmpfr01b & 0xFC) | 0x1)); + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + } + dacmask = hwp->readDacMask(hwp); /* save registers */ hwp->writeDacMask(hwp, 0x00); hwp->writeDacReadAddr(hwp, 0x00); @@ -6610,6 +7245,20 @@ cPtr->writeXR(cPtr,0x81,xr1); cPtr->writeXR(cPtr,0xD0,xr2); } + + if (cPtr->Flags & ChipsDualChannelSupport) { + cPtr->writeIOSS(cPtr, ((IOSS & IOSS_MASK) | IOSS_PIPE_A)); + cPtr->writeMSS(cPtr, ((MSS & MSS_MASK) | MSS_PIPE_A)); + cPtr->writeFR(cPtr, 0x01, tmpfr01a); + cPtr->writeIOSS(cPtr, ((IOSS & IOSS_MASK) | IOSS_PIPE_B)); + cPtr->writeMSS(cPtr, ((MSS & MSS_MASK) | MSS_PIPE_B)); + cPtr->writeFR(cPtr, 0x01, tmpfr01b); + usleep(1000); + cPtr->writeIOSS(cPtr, IOSS); + cPtr->writeMSS(cPtr, MSS); + cPtr->writeFR(cPtr, 0x02, tmpfr02); + } + return type; } @@ -6637,17 +7286,32 @@ CARD8 tmp; if (IS_HiQV(cPtr)) { - /* test LCD */ - /* FR01: DISPLAY TYPE REGISTER */ - /* FR01[1:0]: Display Type, 01 = CRT, 10 = FlatPanel */ - /* LCD */ - tmp = cPtr->readFR(cPtr, 0x01); - if ((tmp & 0x03) == 0x02) { - cPtr->PanelType |= ChipsLCD; - } - tmp = cPtr->readXR(cPtr,0xD0); - if (tmp & 0x01) { - cPtr->PanelType |= ChipsCRT; + if (cPtr->Chipset == CHIPS_CT69030) { + tmp = cPtr->readFR(cPtr, 0x00); + if (tmp & 0x20) { + /* FR02: DISPLAY TYPE REGISTER */ + /* FR02[4] = CRT, FR02[5] = FlatPanel */ + tmp = cPtr->readFR(cPtr, 0x02); + if (tmp & 0x10) + cPtr->PanelType |= ChipsCRT; + if (tmp & 0x20) + cPtr->PanelType |= ChipsLCD; + } else { + cPtr->PanelType |= ChipsCRT; + } + } else { + /* test LCD */ + /* FR01: DISPLAY TYPE REGISTER */ + /* FR01[1:0]: Display Type, 01 = CRT, 10 = FlatPanel */ + /* LCD */ + tmp = cPtr->readFR(cPtr, 0x01); + if ((tmp & 0x03) == 0x02) { + cPtr->PanelType |= ChipsLCD; + } + tmp = cPtr->readXR(cPtr,0xD0); + if (tmp & 0x01) { + cPtr->PanelType |= ChipsCRT; + } } } else { tmp = cPtr->readXR(cPtr, 0x51); @@ -6662,5 +7326,24 @@ } } } - +static void +chipsBlockHandler ( + int i, + pointer blockData, + pointer pTimeout, + pointer pReadmask +){ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + CHIPSPtr cPtr = CHIPSPTR(pScrn); + + pScreen->BlockHandler = cPtr->BlockHandler; + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler = chipsBlockHandler; + + if(cPtr->VideoTimerCallback) { + UpdateCurrentTime(); + (*cPtr->VideoTimerCallback)(pScrn, currentTime.milliseconds); + } +} Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h:1.30 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h:1.32 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h:1.30 Mon Oct 23 08:10:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h Tue May 15 06:19:36 2001 @@ -22,7 +22,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h,v 1.30 2000/10/23 12:10:13 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_driver.h,v 1.32 2001/05/15 10:19:36 eich Exp $ */ #ifndef _CT_DRIVER_H_ @@ -35,6 +35,7 @@ #include "xf86i2c.h" #include "xf86DDC.h" #include "xf86xv.h" +#include "vgaHW.h" /* Supported chipsets */ typedef enum { @@ -106,6 +107,7 @@ #define ChipsGammaSupport 0x00000080 #define ChipsVideoSupport 0x00000100 #define ChipsDualChannelSupport 0x00000200 +#define ChipsDualRefresh 0x00000400 /* Options flags for the C&T chipsets */ #define ChipsHWCursor 0x00001000 @@ -152,14 +154,22 @@ #define ChipsSS 0x0800 #define IS_STN(x) ((x) & 0xE00) +/* Dual channel register enable masks */ +#define IOSS_MASK 0xE0 +#define IOSS_BOTH 0x13 +#define IOSS_PIPE_A 0x11 +#define IOSS_PIPE_B 0x1E +#define MSS_MASK 0xF0 +#define MSS_BOTH 0x0B +#define MSS_PIPE_A 0x02 +#define MSS_PIPE_B 0x05 + /* Storage for the registers of the C&T chipsets */ typedef struct { unsigned char XR[0xFF]; unsigned char CR[0x80]; unsigned char FR[0x80]; unsigned char MR[0x80]; - unsigned char MSS; - unsigned char IOSS; CHIPSClockReg Clock; } CHIPSRegRec, *CHIPSRegPtr; @@ -238,6 +248,23 @@ /* The privates of the C&T driver */ #define CHIPSPTR(p) ((CHIPSPtr)((p)->driverPrivate)) + +typedef struct { + int lastInstance; + int refCount; + CARD32 masterFbAddress; + long masterFbMapSize; + CARD32 slaveFbAddress; + long slaveFbMapSize; + int mastervideoRam; + int slavevideoRam; + Bool masterOpen; + Bool slaveOpen; + Bool masterActive; + Bool slaveActive; +} CHIPSEntRec, *CHIPSEntPtr; + + typedef struct _CHIPSRec { pciVideoPtr PciInfo; PCITAG PciTag; @@ -281,6 +308,8 @@ CARD32 PanelType; CHIPSRegRec ModeReg; CHIPSRegRec SavedReg; + CHIPSRegRec SavedReg2; + vgaRegRec VgaSavedReg2; unsigned int * Regs32; unsigned int Flags; CARD32 Bus; @@ -295,12 +324,16 @@ int DGAViewportStatus; CloseScreenProcPtr CloseScreen; ScreenBlockHandlerProcPtr BlockHandler; + void (*VideoTimerCallback)(ScrnInfoPtr, Time); int videoKey; XF86VideoAdaptorPtr adaptor; int OverlaySkewX; int OverlaySkewY; int VideoZoomMax; - + Bool SecondCrtc; + CHIPSEntPtr entityPrivate; + unsigned char storeMSS; + unsigned char storeIOSS; #ifdef __arm32__ #ifdef __NetBSD__ int TVMode; @@ -320,6 +353,8 @@ chipsWriteMSSPtr writeMSS; chipsReadIOSSPtr readIOSS; chipsWriteIOSSPtr writeIOSS; + Bool cursorDelay; + unsigned int viewportMask; } CHIPSRec; typedef struct _CHIPSi2c { @@ -388,6 +423,112 @@ void chipsRefreshArea24(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void chipsRefreshArea32(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void chipsPointerMoved(int index, int x, int y); + + +/* + * Some macros for switching display channels. NOTE... It appears that we + * can't write to both display channels at the same time, and so the options + * MSS_BOTH and IOSS_BOTH should not be used. Need to get around this by set + * dual channel mode to pipe A by default and handling multiple channel writes + * in ModeInit.. + */ + +#define DUALOPEN \ + { \ + /* Set the IOSS/MSS registers to point to the right register set */ \ + if (xf86IsEntityShared(pScrn->entityList[0])) { \ + if (cPtr->SecondCrtc == TRUE) { \ + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | \ + IOSS_PIPE_B)); \ + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | \ + MSS_PIPE_B)); \ + cPtrEnt->slaveOpen = TRUE; \ + cPtrEnt->slaveActive = TRUE; \ + cPtrEnt->masterActive = FALSE; \ + } else { \ + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | \ + IOSS_PIPE_A)); \ + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | \ + MSS_PIPE_A)); \ + cPtrEnt->masterOpen = TRUE; \ + cPtrEnt->masterActive = TRUE; \ + cPtrEnt->slaveActive = FALSE; \ + } \ + } else { \ + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | \ + IOSS_PIPE_A)); \ + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_A)); \ + } \ + } + +#define DUALREOPEN \ + { \ + if (xf86IsEntityShared(pScrn->entityList[0])) { \ + if (cPtr->SecondCrtc == TRUE) { \ + if (! cPtrEnt->slaveActive) { \ + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | \ + IOSS_PIPE_B)); \ + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | \ + MSS_PIPE_B)); \ + cPtrEnt->slaveOpen = TRUE; \ + cPtrEnt->slaveActive = TRUE; \ + cPtrEnt->masterActive = FALSE; \ + } \ + } else { \ + if (! cPtrEnt->masterActive) { \ + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | \ + IOSS_PIPE_A)); \ + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | \ + MSS_PIPE_A)); \ + cPtrEnt->masterOpen = TRUE; \ + cPtrEnt->masterActive = TRUE; \ + cPtrEnt->slaveActive = FALSE; \ + } \ + } \ + } \ + } + +#define DUALCLOSE \ + { \ + if (! xf86IsEntityShared(pScrn->entityList[0])) { \ + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | \ + IOSS_PIPE_A)); \ + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_A)); \ + chipsHWCursorOff(cPtr, pScrn); \ + chipsRestore(pScrn, &(VGAHWPTR(pScrn))->SavedReg, \ + &cPtr->SavedReg, TRUE); \ + chipsLock(pScrn); \ + cPtr->writeIOSS(cPtr, ((cPtr->storeIOSS & IOSS_MASK) | \ + IOSS_PIPE_B)); \ + cPtr->writeMSS(cPtr, ((cPtr->storeMSS & MSS_MASK) | MSS_PIPE_B)); \ + chipsHWCursorOff(cPtr, pScrn); \ + chipsRestore(pScrn, &cPtr->VgaSavedReg2, &cPtr->SavedReg2, TRUE); \ + cPtr->writeIOSS(cPtr, cPtr->storeIOSS); \ + cPtr->writeMSS(cPtr, cPtr->storeMSS); \ + chipsLock(pScrn); \ + } else { \ + chipsHWCursorOff(cPtr, pScrn); \ + chipsRestore(pScrn, &(VGAHWPTR(pScrn))->SavedReg, &cPtr->SavedReg,\ + TRUE); \ + if (cPtr->SecondCrtc == TRUE) { \ + cPtrEnt->slaveActive = FALSE; \ + cPtrEnt->slaveOpen = FALSE; \ + if (! cPtrEnt->masterActive) { \ + cPtr->writeIOSS(cPtr, cPtr->storeIOSS); \ + cPtr->writeMSS(cPtr, cPtr->storeMSS); \ + chipsLock(pScrn); \ + } \ + } else { \ + cPtrEnt->masterActive = FALSE; \ + cPtrEnt->masterOpen = FALSE; \ + if (! cPtrEnt->slaveActive) { \ + cPtr->writeIOSS(cPtr, cPtr->storeIOSS); \ + cPtr->writeMSS(cPtr, cPtr->storeMSS); \ + chipsLock(pScrn); \ + } \ + } \ + } \ + } /* To aid debugging of 32 bit register access we make the following defines */ Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c:1.5 Fri Sep 22 07:35:48 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c Wed May 9 15:57:05 2001 @@ -19,7 +19,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c,v 1.5 2000/09/22 11:35:48 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_regs.c,v 1.6 2001/05/09 19:57:05 dbateman Exp $ */ /* * The functions in this file are used to read/write the C&T extension register @@ -65,9 +65,6 @@ /* This is used for module versioning */ #include "xf86Version.h" -/* All drivers using the vgahw module need this */ -#include "vgaHW.h" - /* Driver specific headers */ #include "ct_driver.h" @@ -201,8 +198,8 @@ * MMIO Access to the C&T extension registers */ -#define chipsminb(p) MMIO_IN8(cPtr->MMIOBase, (p)) -#define chipsmoutb(p,v) MMIO_OUT8(cPtr->MMIOBase, (p),(v)) +#define chipsminb(p) MMIO_IN8(cPtr->MMIOBaseVGA, (p)) +#define chipsmoutb(p,v) MMIO_OUT8(cPtr->MMIOBaseVGA, (p),(v)) static void chipsMmioWriteXR(CHIPSPtr cPtr, CARD8 index, CARD8 value) Index: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c:1.5.2.1 xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c:1.5.2.1 Fri Mar 9 13:03:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c Tue May 15 06:19:36 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.5.2.1 2001/03/09 18:03:22 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/ct_video.c,v 1.7 2001/05/15 10:19:36 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -43,14 +43,15 @@ int, unsigned char*, short, short, Bool, RegionPtr, pointer); static int CHIPSQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); +static void CHIPSVideoTimerCallback(ScrnInfoPtr pScrn, Time time); -static void CHIPSBlockHandler(int, pointer, pointer, pointer); #define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) static Atom xvColorKey; -void CHIPSInitVideo(ScreenPtr pScreen) +void +CHIPSInitVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; @@ -58,8 +59,9 @@ CHIPSPtr cPtr = CHIPSPTR(pScrn); int num_adaptors; - if(!(cPtr->Flags & ChipsOverlay8plus16) && - (cPtr->Flags & ChipsVideoSupport)) { + if (!(cPtr->Flags & ChipsOverlay8plus16) && + (cPtr->Flags & ChipsVideoSupport) + && (cPtr->Flags & ChipsAccelSupport)) { newAdaptor = CHIPSSetupImageVideo(pScreen); CHIPSInitOffscreenImages(pScreen); } @@ -91,7 +93,8 @@ } /* client libraries expect an encoding */ -static XF86VideoEncodingRec DummyEncoding[1] = +static +XF86VideoEncodingRec DummyEncoding[1] = { { 0, @@ -158,7 +161,7 @@ }; typedef struct { - FBAreaPtr area; + FBLinearPtr linear; RegionRec clip; CARD32 colorKey; CARD32 videoStatus; @@ -170,7 +173,8 @@ #define GET_PORT_PRIVATE(pScrn) \ (CHIPSPortPrivPtr)((CHIPSPTR(pScrn))->adaptor->pPortPrivates[0].ptr) -void CHIPSResetVideo(ScrnInfoPtr pScrn) +void +CHIPSResetVideo(ScrnInfoPtr pScrn) { CHIPSPtr cPtr = CHIPSPTR(pScrn); CHIPSPortPrivPtr pPriv = cPtr->adaptor->pPortPrivates[0].ptr; @@ -318,18 +322,19 @@ boundaries in 16.16 fixed point. */ -static void +static Bool CHIPSClipVideo( BoxPtr dst, INT32 *x1, INT32 *x2, INT32 *y1, INT32 *y2, - BoxPtr extents, /* extents of the clip region */ + RegionPtr reg, INT32 width, INT32 height ){ INT32 vscale, hscale, delta; + BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); int diff; hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); @@ -370,6 +375,8 @@ dst->x2 -= diff; *x2 -= diff * hscale; } + if(*x1 >= *x2) return FALSE; + if(*y1 < 0) { diff = (- *y1 + vscale - 1)/ vscale; dst->y1 += diff; @@ -381,6 +388,17 @@ dst->y2 -= diff; *y2 -= diff * vscale; } + if(*y1 >= *y2) return FALSE; + + if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || + (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) + { + RegionRec clipReg; + REGION_INIT(DummyScreen, &clipReg, dst, 1); + REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); + REGION_UNINIT(DummyScreen, &clipReg); + } + return TRUE; } static void @@ -399,18 +417,16 @@ tmp = cPtr->readXR(cPtr, 0xD0); cPtr->writeXR(cPtr, 0xD0, (tmp & 0xf)); } - if(pPriv->area) { - xf86FreeOffscreenArea(pPriv->area); - pPriv->area = NULL; + if(pPriv->linear) { + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; } pPriv->videoStatus = 0; - pScrn->pScreen->BlockHandler = cPtr->BlockHandler; } else { if(pPriv->videoStatus & CLIENT_VIDEO_ON) { pPriv->videoStatus |= OFF_TIMER; pPriv->offTime = currentTime.milliseconds + OFF_DELAY; - cPtr->BlockHandler = pScrn->pScreen->BlockHandler; - pScrn->pScreen->BlockHandler = CHIPSBlockHandler; + cPtr->VideoTimerCallback = CHIPSVideoTimerCallback; } } } @@ -532,13 +548,8 @@ for(j = 0; j < h; j++) { for(i = 0; i < w; i++) { -#if 1 dst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) | (src3[i] << 8) | (src2[i] << 24); -#else - dst[i] = (src1[i << 1] << 24) | (src1[(i << 1) + 1] << 8) | - (src3[i] << 0) | (src2[i] << 16); -#endif } dst += dstPitch; src1 += srcPitch; @@ -549,45 +560,45 @@ } } -static FBAreaPtr +static FBLinearPtr CHIPSAllocateMemory( ScrnInfoPtr pScrn, - FBAreaPtr area, - int numlines + FBLinearPtr linear, + int size ){ ScreenPtr pScreen; - FBAreaPtr new_area; + FBLinearPtr new_linear; - if(area) { - if((area->box.y2 - area->box.y1) >= numlines) - return area; + if(linear) { + if(linear->size >= size) + return linear; - if(xf86ResizeOffscreenArea(area, pScrn->displayWidth, numlines)) - return area; + if(xf86ResizeOffscreenLinear(linear, size)) + return linear; - xf86FreeOffscreenArea(area); + xf86FreeOffscreenLinear(linear); } pScreen = screenInfo.screens[pScrn->scrnIndex]; - new_area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, - numlines, 0, NULL, NULL, NULL); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 16, + NULL, NULL, NULL); - if(!new_area) { - int max_w, max_h; + if(!new_linear) { + int max_size; - xf86QueryLargestOffscreenArea(pScreen, &max_w, &max_h, 0, - FAVOR_WIDTH_THEN_AREA, PRIORITY_EXTREME); + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 16, + PRIORITY_EXTREME); - if((max_w < pScrn->displayWidth) || (max_h < numlines)) + if(max_size < size) return NULL; xf86PurgeUnlockedOffscreenAreas(pScreen); - new_area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, - numlines, 0, NULL, NULL, NULL); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 16, + NULL, NULL, NULL); } - return new_area; + return new_linear; } static void @@ -640,6 +651,8 @@ tmp &= 0xC3; cPtr->writeMR(cPtr, 0x20, tmp); + offset += (x1 >> 15) & ~0x01; + /* Setup Pointer 1 */ cPtr->writeMR(cPtr, 0x22, (offset & 0xF8)); cPtr->writeMR(cPtr, 0x23, ((offset >> 8) & 0xFF)); @@ -685,11 +698,13 @@ /* Vertical Zoom */ if (drw_h > src_h) { +#if 1 tmp = cPtr->readMR(cPtr, 0x1F); - cPtr->writeMR(cPtr, 0x1F, (tmp | 0x80)); /* set V-interpolation */ + cPtr->writeMR(cPtr, 0x1F, (tmp | 0xc0)); /* set V-interpolation */ +#endif tmp = cPtr->readMR(cPtr, 0x1E); cPtr->writeMR(cPtr, 0x1E, (tmp | 0x08)); - tmp = cPtr->VideoZoomMax * src_h / drw_h; + tmp = cPtr->VideoZoomMax * src_h / drw_h ; cPtr->writeMR(cPtr, 0x33, tmp); } @@ -714,15 +729,12 @@ CHIPSPtr cPtr = CHIPSPTR(pScrn); INT32 x1, x2, y1, y2; unsigned char *dst_start; - int pitch, new_h, offset, offset2, offset3; - int srcPitch, srcPitch2, dstPitch; - int top, left, npixels, nlines; + int pitch, new_size, offset, offset2 = 0, offset3 = 0; + int srcPitch, srcPitch2 = 0, dstPitch; + int top, left, npixels, nlines, bpp; BoxRec dstBox; CARD32 tmp; - - if (pScrn->pScreen->BlockHandler == CHIPSBlockHandler) - pScrn->pScreen->BlockHandler = cPtr->BlockHandler; - + if(drw_w > 16384) drw_w = 16384; /* Clip */ @@ -735,22 +747,20 @@ dstBox.x2 = drw_x + drw_w; dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - - CHIPSClipVideo(&dstBox, &x1, &x2, &y1, &y2, - REGION_EXTENTS(pScreen, clipBoxes), width, height); - - if((x1 >= x2) || (y1 >= y2)) - return Success; + + if (!CHIPSClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, width, height)) + return Success; - dstBox.x1 -= pScrn->frameX0; - dstBox.x2 -= pScrn->frameX0; + dstBox.x1 -= pScrn->frameX0 & cPtr->viewportMask; + dstBox.x2 -= pScrn->frameX0 & cPtr->viewportMask; dstBox.y1 -= pScrn->frameY0; dstBox.y2 -= pScrn->frameY0; - pitch = pScrn->bitsPerPixel * pScrn->displayWidth >> 3; + bpp = pScrn->bitsPerPixel >> 3; + pitch = bpp * pScrn->displayWidth; dstPitch = ((width << 1) + 15) & ~15; - new_h = ((dstPitch * height) + pitch - 1) / pitch; + new_size = ((dstPitch * height) + bpp - 1) / bpp; switch(id) { case FOURCC_YV12: /* YV12 */ @@ -764,16 +774,17 @@ break; } - if(!(pPriv->area = CHIPSAllocateMemory(pScrn, pPriv->area, new_h))) + if(!(pPriv->linear = CHIPSAllocateMemory(pScrn, pPriv->linear, new_size))) return BadAlloc; + /* copy data */ top = y1 >> 16; left = (x1 >> 16) & ~1; npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; left <<= 1; - offset = (pPriv->area->box.y1 * pitch) + (top * dstPitch); - dst_start = cPtr->FbBase + offset + left; + offset = pPriv->linear->offset * bpp; + dst_start = cPtr->FbBase + offset + left + (top * dstPitch); switch(id) { case FOURCC_YV12: /* YV12 */ @@ -801,12 +812,13 @@ REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); } - + +offset += top * dstPitch; CHIPSDisplayVideo(pScrn, id, offset, width, height, dstPitch, x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); pPriv->videoStatus = CLIENT_VIDEO_ON; - + return Success; } @@ -849,29 +861,17 @@ return size; } + static void -CHIPSBlockHandler ( - int i, - pointer blockData, - pointer pTimeout, - pointer pReadmask -){ - ScreenPtr pScreen = screenInfo.screens[i]; - ScrnInfoPtr pScrn = xf86Screens[i]; +CHIPSVideoTimerCallback(ScrnInfoPtr pScrn, Time time) +{ CHIPSPtr cPtr = CHIPSPTR(pScrn); CHIPSPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); unsigned char mr3c; - - pScreen->BlockHandler = cPtr->BlockHandler; - - (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); - - pScreen->BlockHandler = CHIPSBlockHandler; if(pPriv->videoStatus & TIMER_MASK) { - UpdateCurrentTime(); if(pPriv->videoStatus & OFF_TIMER) { - if(pPriv->offTime < currentTime.milliseconds) { + if(pPriv->offTime < time) { CHIPSHiQVSync(pScrn); mr3c = cPtr->readMR(cPtr, 0x3C); cPtr->writeMR(cPtr, 0x3C, (mr3c & 0xFE)); @@ -879,23 +879,24 @@ pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; } } else { /* FREE_TIMER */ - if(pPriv->freeTime < currentTime.milliseconds) { - if(pPriv->area) { - xf86FreeOffscreenArea(pPriv->area); - pPriv->area = NULL; + if(pPriv->freeTime < time) { + if(pPriv->linear) { + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; } pPriv->videoStatus = 0; - pScreen->BlockHandler = cPtr->BlockHandler; + cPtr->VideoTimerCallback = NULL; } } - } + } else /* shouldn't get here */ + cPtr->VideoTimerCallback = NULL; } /****************** Offscreen stuff ***************/ typedef struct { - FBAreaPtr area; + FBLinearPtr linear; Bool isOn; } OffscreenPrivRec, * OffscreenPrivPtr; @@ -907,8 +908,8 @@ unsigned short h, XF86SurfacePtr surface ){ - FBAreaPtr area; - int pitch, fbpitch, numlines; + FBLinearPtr linear; + int pitch, fbpitch, size, bpp; OffscreenPrivPtr pPriv; if((w > 1024) || (h > 1024)) @@ -916,34 +917,39 @@ w = (w + 1) & ~1; pitch = ((w << 1) + 15) & ~15; - fbpitch = pScrn->bitsPerPixel * pScrn->displayWidth >> 3; - numlines = ((pitch * h) + fbpitch - 1) / fbpitch; + bpp = pScrn->bitsPerPixel >> 3; + fbpitch = bpp * pScrn->displayWidth; + size = ((pitch * h) + bpp - 1) / bpp; - if(!(area = CHIPSAllocateMemory(pScrn, NULL, numlines))) + if(!(linear = CHIPSAllocateMemory(pScrn, NULL, size))) return BadAlloc; surface->width = w; surface->height = h; - if(!(surface->pitches = xalloc(sizeof(int)))) + 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->area = area; + pPriv->linear = linear; pPriv->isOn = FALSE; surface->pScrn = pScrn; surface->id = id; surface->pitches[0] = pitch; - surface->offsets[0] = area->box.y1 * fbpitch; + surface->offsets[0] = linear->offset * bpp; surface->devPrivate.ptr = (pointer)pPriv; return Success; @@ -977,7 +983,7 @@ if(pPriv->isOn) CHIPSStopSurface(surface); - xf86FreeOffscreenArea(pPriv->area); + xf86FreeOffscreenLinear(pPriv->linear); xfree(surface->pitches); xfree(surface->offsets); xfree(surface->devPrivate.ptr); @@ -1017,6 +1023,7 @@ ){ OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; ScrnInfoPtr pScrn = surface->pScrn; + CHIPSPtr cPtr = CHIPSPTR(pScrn); CHIPSPortPrivPtr portPriv = GET_PORT_PRIVATE(pScrn); INT32 x1, y1, x2, y2; BoxRec dstBox; @@ -1030,12 +1037,9 @@ dstBox.x2 = drw_x + drw_w; dstBox.y1 = drw_y; dstBox.y2 = drw_y + drw_h; - - CHIPSClipVideo(&dstBox, &x1, &x2, &y1, &y2, - REGION_EXTENTS(pScreen, clipBoxes), - surface->width, surface->height); - if((x1 >= x2) || (y1 >= y2)) + if(!CHIPSClipVideo(&dstBox, &x1, &x2, &y1, &y2, clipBoxes, + surface->width, surface->height)) return Success; dstBox.x1 -= pScrn->frameX0; @@ -1043,20 +1047,22 @@ dstBox.y1 -= pScrn->frameY0; dstBox.y2 -= pScrn->frameY0; - XAAFillSolidRects(pScrn, portPriv->colorKey, GXcopy, ~0, - REGION_NUM_RECTS(clipBoxes), - REGION_RECTS(clipBoxes)); CHIPSDisplayVideo(pScrn, surface->id, surface->offsets[0], surface->width, surface->height, surface->pitches[0], x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + XAAFillSolidRects(pScrn, portPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + pPriv->isOn = TRUE; if(portPriv->videoStatus & CLIENT_VIDEO_ON) { REGION_EMPTY(pScrn->pScreen, &portPriv->clip); UpdateCurrentTime(); portPriv->videoStatus = FREE_TIMER; portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + cPtr->VideoTimerCallback = CHIPSVideoTimerCallback; } return Success; Index: xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c:1.6.4.1 --- xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c:1.6 Fri Sep 22 07:35:49 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c Fri May 25 14:15:45 2001 @@ -4,7 +4,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c,v 1.6 2000/09/22 11:35:49 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/dRegs.c,v 1.6.4.1 2001/05/25 18:15:45 eich Exp $ */ #ifdef __NetBSD__ # include <sys/types.h> @@ -188,7 +188,7 @@ storeReg = inb(0x3CE); for(i = 0;i < 0x10;i++){ outb(0x3CE,i); - printf("GC 0x%2.2X\t0x%X2.2\n",i,inb(0x3CF)&0xFF); + printf("GC 0x%2.2X\t0x%2.2X\n",i,inb(0x3CF)&0xFF); } outb(0x3CE,storeReg); printf("port 0x3C4 (Sequencer)\n"); Index: xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c diff -u xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c:1.4 Fri Sep 22 07:35:49 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c Wed May 9 15:57:06 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c,v 1.4 2000/09/22 11:35:49 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/chips/util/modClock.c,v 1.5 2001/05/09 19:57:06 dbateman Exp $ */ #ifdef __NetBSD__ # include <sys/types.h> @@ -60,12 +60,39 @@ #define tolerance 0.01 /* +/- 1% */ + +#define CT65520 0x1 +#define CT65525 0x2 +#define CT65530 0x3 +#define CT64200 0x4 + +#define CT65535 0x11 +#define CT65540 0x12 +#define CT65545 0x13 +#define CT65546 0x14 +#define CT65548 0x15 +#define CT64300 0x16 + +#define CT65550 0x31 +#define CT65554 0x32 +#define CT65555 0x33 +#define CT68554 0x34 +#define CT69000 0x35 +#define CT69030 0x36 + +#define IS_Programmable(X) X&0x10 +#define IS_HiQV(X) X&0x20 + +#define DotClk 0 +#define MemClk 1 +#define IS_MemClk(X) X&0x1 + int compute_clock ( + unsigned int ChipType, double target, double Fref, unsigned int ClkMaxN, unsigned int ClkMaxM, - unsigned int PStart, unsigned int *bestM, unsigned int *bestN, unsigned int *bestP, @@ -104,7 +131,8 @@ they should be set to 0 on the 65548, and left untouched on earlier chips. */ - for (PSNx = 0; PSNx <= 1; PSNx++) { + for (PSNx = ((ChipType == CT69000) || (ChipType == CT69030)) ? 1 : 0; + PSNx <= 1; PSNx++) { unsigned int low_N, high_N; double Fref4PSN; @@ -113,7 +141,8 @@ low_N = 3; high_N = ClkMaxN; - while (Fref / (PSN * low_N) > 2.0e6) + while (Fref / (PSN * low_N) > (((ChipType == CT69000) || + (ChipType == CT69030)) ? 5.0e6 : 2.0e6)) low_N++; while (Fref / (PSN * high_N) < 150.0e3) high_N--; @@ -121,7 +150,9 @@ Fref4PSN = Fref * 4 / PSN; for (N = low_N; N <= high_N; N++) { double tmp = Fref4PSN / N; - for (P = PStart; P <= 5; P++) { + + for (P = (IS_HiQV(ChipType) && (ChipType != CT69000) && + (ChipType != CT69030)) ? 1 : 0; P <= 5; P++) { double Fvco_desired = target * (1 << P); double M_desired = Fvco_desired / tmp; /* Which way will M_desired be rounded? Do all three just to @@ -139,7 +170,8 @@ for (M = M_low; M <= M_hi; M++) { Fvco = tmp * M; - if (Fvco <= 48.0e6) + if (Fvco <= ((ChipType == CT69000) || (ChipType == CT69030) ? + 100e6 : 48.0e6)) continue; if (Fvco > 220.0e6) break; @@ -180,35 +212,10 @@ return 1; } -#define CT65520 0x1 -#define CT65525 0x2 -#define CT65530 0x3 -#define CT64200 0x4 - -#define CT65535 0x11 -#define CT65540 0x12 -#define CT65545 0x13 -#define CT65546 0x14 -#define CT65548 0x15 -#define CT64300 0x16 - -#define CT65550 0x31 -#define CT65554 0x32 -#define CT65555 0x33 -#define CT68554 0x34 -#define CT69000 0x35 -#define CT69030 0x36 - -#define IS_Programmable(X) X&0x10 -#define IS_HiQV(X) X&0x20 - -#define DotClk 0 -#define MemClk 1 -#define IS_MemClk(X) X&0x1 - int set_clock( unsigned int ChipType, unsigned int ClockType, + unsigned int ProgClock, unsigned int M, unsigned int N, unsigned int P, @@ -235,18 +242,18 @@ outb(0x3D6, 0xCE); outb(0x3D7, (0x80 | (P * 16 + (PSN == 1)))); } else { - printf ("XRC8 = 0x%02X\n", M - 2); - printf ("XRC9 = 0x%02X\n", N - 2); - printf ("XRCA = 0x%02X\n", 0); - printf ("XRCB = 0x%02X\n", P * 16 + (PSN == 1)); + printf ("XR%X = 0x%02X\n", 0xC0 + 4 * ProgClock, M - 2); + printf ("XR%X = 0x%02X\n", 0xC1 + 4 * ProgClock, N - 2); + printf ("XR%X = 0x%02X\n", 0xC2 + 4 * ProgClock, 0); + printf ("XR%X = 0x%02X\n", 0xC3 + 4 * ProgClock, P * 16 + (PSN == 1)); - outb(0x3D6, 0xC8); + outb(0x3D6, 0xC0 + 4 * ProgClock); outb(0x3D7, (M - 2)); - outb(0x3D6, 0xC9); + outb(0x3D6, 0xC1 + 4 * ProgClock); outb(0x3D7, (N - 2)); - outb(0x3D6, 0xCA); + outb(0x3D6, 0xC2 + 4 * ProgClock); outb(0x3D7, 0x0); - outb(0x3D6, 0xCB); + outb(0x3D6, 0xC3 + 4 * ProgClock); outb(0x3D7, (P * 16 + (PSN == 1))); } } else { @@ -355,10 +362,19 @@ int main (int argc, char *argv[]) { double target; double Fref = 14318180; - unsigned int M, N, P, PSN, ChipType, ClockType; + unsigned int M, N, P, PSN, ChipType, ClockType, progclock; - if (argc != 2) { - fprintf (stderr, "usage: %s freq\n", argv[0]); + switch (argc) { + case 2: + progclock = 2; + target = atof (argv[1]); + break; + case 3: + progclock = abs(atof (argv[1])); + target = atof (argv[2]); + break; + default: + fprintf (stderr, "usage: %s [-0|-1|-2] freq\n", argv[0]); return 1; } @@ -371,8 +387,6 @@ ClockType = MemClk; } - target = atof (argv[1]); - ChipType = probe_chip(); if (!ChipType) { return 1; @@ -384,14 +398,14 @@ } if (IS_HiQV(ChipType)) { - if (! compute_clock(target, Fref, 63, 127, 1, &M, &N, &P, &PSN)) { - return set_clock(ChipType, ClockType, M, N, P, PSN); + if (! compute_clock(ChipType, target, Fref, 63, 127, &M, &N, &P, &PSN)) { + return set_clock(ChipType, ClockType, progclock, M, N, P, PSN); } else { return 1; } } else { - if (! compute_clock(target, Fref, 127, 127, 0, &M, &N, &P, &PSN)) { - return set_clock(ChipType, ClockType, M, N, P, PSN); + if (! compute_clock(ChipType, target, Fref, 127, 127, &M, &N, &P, &PSN)) { + return set_clock(ChipType, ClockType, progclock, M, N, P, PSN); } else { return 1; } Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile:1.30.2.2 xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile:1.32 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile:1.30.2.2 Thu Mar 15 17:39:27 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile Thu Feb 15 12:39:28 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile,v 1.30.2.2 2001/03/15 22:39:27 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/Imakefile,v 1.32 2001/02/15 17:39:28 eich Exp $ XCOMM XCOMM This is an Imakefile for the Cirrus Logic driver. XCOMM @@ -6,8 +6,8 @@ #define IHaveModules #include <Server.tmpl> -CSRCS = cir_driver.c CirrusClk.c cir_shadow.c -COBJS = cir_driver.o CirrusClk.o cir_shadow.o +CSRCS = cir_driver.c CirrusClk.c cir_shadow.c cir_dga.c +COBJS = cir_driver.o CirrusClk.o cir_shadow.o cir_dga.o ASRCS = alp_driver.c alp_xaa.c alp_hwcurs.c alp_i2c.c alp_xaam.c AOBJS = alp_driver.o alp_xaa.o alp_hwcurs.o alp_i2c.o alp_xaam.o LSRCS = lg_driver.c lg_i2c.c lg_xaa.c lg_hwcurs.c @@ -88,7 +88,6 @@ InstallSubDriverObjectModule(cirrus_laguna,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(cirrus,) InstallModuleManPage(cirrus) #endif @@ -98,6 +97,7 @@ InstallDriverSDKNonExecFile(CirrusClk.c,$(DRIVERSDKDIR)/drivers/cirrus) InstallDriverSDKNonExecFile(cir_driver.c,$(DRIVERSDKDIR)/drivers/cirrus) InstallDriverSDKNonExecFile(cir_shadow.c,$(DRIVERSDKDIR)/drivers/cirrus) +InstallDriverSDKNonExecFile(cir_dga.c,$(DRIVERSDKDIR)/drivers/cirrus) InstallDriverSDKNonExecFile(cir.h,$(DRIVERSDKDIR)/drivers/cirrus) InstallDriverSDKNonExecFile(alp.h,$(DRIVERSDKDIR)/drivers/cirrus) InstallDriverSDKNonExecFile(alp_driver.c,$(DRIVERSDKDIR)/drivers/cirrus) Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h:1.4.2.2 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h:1.4.2.2 Thu Mar 15 17:39:27 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h Fri May 4 15:05:35 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h,v 1.4.2.2 2001/03/15 22:39:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp.h,v 1.7 2001/05/04 19:05:35 dawes Exp $ */ /* (c) Itai Nahshon */ @@ -6,7 +6,7 @@ #define ALP_H extern ScrnInfoPtr AlpProbe(int entity); -extern OptionInfoPtr AlpAvailableOptions(int chipid); +extern const OptionInfoRec * AlpAvailableOptions(int chipid); # ifdef _ALP_PRIVATE_ /* Saved registers that are not part of the core VGA */ @@ -35,6 +35,8 @@ CIR_NSAVED }; +typedef enum {LCD_NONE, LCD_DUAL_MONO, LCD_UNKNOWN, LCD_DSTN, LCD_TFT} LCDType; + typedef struct { unsigned char ExtVga[CIR_NSAVED]; } AlpRegRec, *AlpRegPtr; @@ -54,6 +56,8 @@ AlpRegRec SavedReg; AlpRegRec ModeReg; + LCDType lcdType; + int lcdWidth, lcdHeight; int CursorWidth; int CursorHeight; int waitMsk; @@ -69,6 +73,10 @@ CARD32 monoPattern8x8; Bool autoStart; + + /* MMIO Base for BitBLT operation. This is + IOBase for 5446 and 7548, IOBase+0x100 for 5480 */ + unsigned char * BLTBase; /* XXX For XF86Config based mem configuration */ CARD32 sr0f, sr17; } AlpRec, *AlpPtr; Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c:1.2 Tue Feb 8 08:13:14 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c Mon Jun 4 12:40:47 2001 @@ -1,81 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_dga.c,v 1.2 2000/02/08 13:13:14 eich Exp $ */ - -/* (c) Itai Nahshon */ - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" -#include "compiler.h" - -#include "xf86Pci.h" -#include "xf86PciInfo.h" - -#include "vgaHW.h" - -#include "cir.h" - -static Bool -CirDGAGetParams(int scrnIndex, unsigned long *offset, int *banksize, - int *memsize) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - CIRPtr pCir = &CIRPTR(pScrn)->CirRec; - - *offset = pCir->FbAddress; - *banksize = pScrn->videoRam * 1024; - *memsize = pScrn->videoRam * 1024; - -#ifdef CIR_DEBUG - ErrorF("CirDGAGetParams %d = 0x%08x, %d, %d\n", - scrnIndex, *banksize, *memsize); -#endif - return TRUE; -} - -static Bool -CirDGASetDirect(int scrnIndex, Bool enable) -{ - return TRUE; -} - -static Bool -CirDGASetBank(int scrnIndex, int bank, int flags) -{ - return TRUE; -} - -static Bool -CirDGASetViewport(int scrnIndex, int x, int y, int flags) -{ - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - (*pScrn->AdjustFrame)(scrnIndex, x, y, 0); - return TRUE; -} - -static Bool -CirDGAViewportChanged(int scrnIndex, int n, int flags) -{ - return TRUE; -} - -Bool -CirDGAInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - CIRPtr pCir = &CIRPTR(pScrn)->CirRec; - DGAInfoPtr pDGAInfo; - - pDGAInfo = DGACreateInfoRec(); - if(pDGAInfo == NULL) - return FALSE; - - pCir->DGAInfo = pDGAInfo; - - pDGAInfo->GetParams = CirDGAGetParams; - pDGAInfo->SetDirectMode = CirDGASetDirect; - pDGAInfo->SetBank = CirDGASetBank; - pDGAInfo->SetViewport = CirDGASetViewport; - pDGAInfo->ViewportChanged = CirDGAViewportChanged;; - - return DGAInit(pScreen, pDGAInfo, 0); -} Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c:1.17.2.2 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c:1.17.2.2 Thu Mar 15 17:39:27 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c Fri May 4 15:05:35 2001 @@ -11,7 +11,7 @@ * Guy DESBIEF */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.17.2.2 2001/03/15 22:39:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_driver.c,v 1.20 2001/05/04 19:05:35 dawes Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -57,13 +57,6 @@ #include "xf1bpp.h" #include "fb.h" -/* These need to be checked */ -#if 0 -#ifdef XFreeXDGA -#define _XF86DGA_SERVER_ -#include "extensions/xf86dgastr.h" -#endif -#endif #include "xf86DDC.h" #include "xf86int10.h" @@ -112,10 +105,10 @@ static void AlpSetClock(CirPtr pCir, vgaHWPtr hwp, int freq); -#ifdef DPMSExtension +static void AlpOffscreenAccelInit(ScrnInfoPtr pScrn); + static void AlpDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif /* * This is intentionally screen-independent. It indicates the binding @@ -134,7 +127,7 @@ OPTION_MEMCFG2 } CirOpts; -static OptionInfoRec CirOptions[] = { +static const OptionInfoRec CirOptions[] = { { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_MMIO, "MMIO", OPTV_BOOLEAN, {0}, FALSE }, @@ -176,13 +169,18 @@ NULL }; +#ifdef XFree86LOADER + static const char *fbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", "fbScreenInit", + "fbPictureInit", NULL }; +#endif + static const char *xaaSymbols[] = { "XAADestroyInfoRec", "XAACreateInfoRec", @@ -272,7 +270,7 @@ #endif /* XFree86LOADER */ -OptionInfoPtr +const OptionInfoRec * AlpAvailableOptions(int chipid) { return CirOptions; @@ -510,10 +508,11 @@ { CirPtr pCir; vgaHWPtr hwp; - MessageType from; + MessageType from, from1; int i; ClockRangePtr clockRanges; char *s; + xf86Int10InfoPtr pInt = NULL; if (flags & PROBE_DETECT) { cirProbeDDC( pScrn, xf86GetEntityInfo(pScrn->entityList[0])->index ); @@ -560,11 +559,8 @@ pCir->PciInfo->device, pCir->PciInfo->func); -#if 1 if (xf86LoadSubModule(pScrn, "int10")) { - xf86Int10InfoPtr pInt; xf86LoaderReqSymLists(int10Symbols,NULL); -#if 1 xf86DrvMsg(pScrn->scrnIndex,X_INFO,"initializing int10\n"); pInt = xf86InitInt10(pCir->pEnt->index); xf86FreeInt10(pInt); @@ -575,9 +571,7 @@ pciWriteLong(pCir->PciTag,0x10,pCir->PciInfo->memBase[0]); pciWriteLong(pCir->PciTag,0x14,pCir->PciInfo->memBase[1]); -#endif } -#endif /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -637,19 +631,27 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, CirOptions); + if (!(pCir->Options = xalloc(sizeof(CirOptions)))) + return FALSE; + memcpy(pCir->Options, CirOptions, sizeof(CirOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pCir->Options); + if (!xf86IsPrimaryPci(pCir->PciInfo) + && !(pInt || (xf86IsOptionSet(pCir->Options,OPTION_MEMCFG1) + && xf86IsOptionSet(pCir->Options,OPTION_MEMCFG2)))) + return FALSE; + if (pScrn->depth == 8) pScrn->rgbBits = 6; from = X_DEFAULT; pCir->HWCursor = FALSE; - if (xf86GetOptValBool(CirOptions, OPTION_HW_CURSOR, &pCir->HWCursor)) + if (xf86GetOptValBool(pCir->Options, OPTION_HW_CURSOR, &pCir->HWCursor)) from = X_CONFIG; xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pCir->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(CirOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pCir->Options, OPTION_NOACCEL, FALSE)) { pCir->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } @@ -718,29 +720,39 @@ /* We do not really need that YET. */ } } - if(pCir->IOAddress != 0) { - xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", - (unsigned long)pCir->IOAddress); - /* Default to MMIO if we have a separate IOAddress and - not in monochrome mode (IO 0x3Bx is not relocated!) */ - if (pScrn->bitsPerPixel != 1) - pCir->UseMMIO = TRUE; - } /* User options can override the MMIO default */ #if 0 /* Will we ever support MMIO on 5446A or older? */ - if (xf86ReturnOptValBool(CirOptions, OPTION_MMIO, FALSE)) { + if (xf86ReturnOptValBool(pCir->Options, OPTION_MMIO, FALSE)) { pCir->UseMMIO = TRUE; from = X_CONFIG; } #endif - if (!xf86ReturnOptValBool(CirOptions, OPTION_MMIO, TRUE)) { + if (!xf86ReturnOptValBool(pCir->Options, OPTION_MMIO, TRUE)) { pCir->UseMMIO = FALSE; - from = X_CONFIG; - } - if (pCir->UseMMIO) - xf86DrvMsg(pScrn->scrnIndex, from, "Using MMIO\n"); + from1 = X_CONFIG; + } else if (pCir->IOAddress) { + /* Default to MMIO if we have a separate IOAddress and + not in monochrome mode (IO 0x3Bx is not relocated!) */ + if (pScrn->bitsPerPixel != 1) { + pCir->UseMMIO = TRUE; + from1 = X_PROBED; + } else { + pCir->UseMMIO = FALSE; + from1 = X_PROBED; + } + } else { + pCir->UseMMIO = FALSE; + from1 = X_PROBED; + } + + if (pCir->UseMMIO) { + xf86DrvMsg(pScrn->scrnIndex, from1, "Using MMIO\n"); + xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", + (unsigned long)pCir->IOAddress); + } else + xf86DrvMsg(pScrn->scrnIndex, from1, "Not Using MMIO\n"); /* * XXX Check if this is correct @@ -797,12 +809,12 @@ /* XXX If UseMMIO == TRUE and for any reason we cannot do MMIO, abort here */ - if (xf86GetOptValBool(CirOptions, + if (xf86GetOptValBool(pCir->Options, OPTION_SHADOW_FB,&pCir->shadowFB)) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShadowFB %s.\n", pCir->shadowFB ? "enabled" : "disabled"); - if ((s = xf86GetOptValString(CirOptions, OPTION_ROTATE))) { + if ((s = xf86GetOptValString(pCir->Options, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) { /* accel is disabled below for shadowFB */ pCir->shadowFB = TRUE; @@ -847,8 +859,8 @@ pCir->chip.alp->sr0f = (CARD32)-1; pCir->chip.alp->sr17 = (CARD32)-1; - (void) xf86GetOptValULong(CirOptions, OPTION_MEMCFG1, (unsigned long *)&pCir->chip.alp->sr0f); - (void) xf86GetOptValULong(CirOptions, OPTION_MEMCFG2, (unsigned long *)&pCir->chip.alp->sr17); + (void) xf86GetOptValULong(pCir->Options, OPTION_MEMCFG1, (unsigned long *)&pCir->chip.alp->sr0f); + (void) xf86GetOptValULong(pCir->Options, OPTION_MEMCFG2, (unsigned long *)&pCir->chip.alp->sr17); /* * If the user has specified the amount of memory in the XF86Config * file, we respect that setting. @@ -1078,10 +1090,7 @@ AlpFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit",NULL); -#ifdef RENDER - xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif + xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); break; } @@ -1458,6 +1467,7 @@ VisualPtr visual; int displayWidth,width,height; unsigned char * FbBase = NULL; + int cursor_size = 0; #ifdef ALP_DEBUG ErrorF("AlpScreenInit\n"); @@ -1582,9 +1592,7 @@ } if (!ret) return FALSE; -#ifdef RENDER fbPictureInit (pScreen, 0, 0); -#endif #ifdef ALP_DEBUG ErrorF("AlpScreenInit after depth dependent init\n"); @@ -1611,84 +1619,65 @@ * Set initial black & white colourmap indices. */ xf86SetBlackWhitePixels(pScreen); - - xf86SetSilkenMouse(pScreen); - - /* Initialise cursor functions */ - miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - /* Allocation of off-screen memory to various stuff + /* + Allocation of off-screen memory to various stuff (hardware cursor, 8x8 mono pattern...) Allocation goes top-down in memory, since the cursor - *must* be in the last videoram locations */ - { - int offscreen_offset = pScrn->videoRam*1024, - offscreen_size = pScrn->videoRam * 1024 - pScrn->virtualY * - (BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel)); - int cursor_size = 0; + *must* be in the last videoram locations + */ + pCir->offscreen_offset = pScrn->videoRam*1024; + pCir->offscreen_size = pScrn->videoRam * 1024 - pScrn->virtualY * + (BitmapBytePad(pScrn->displayWidth * pScrn->bitsPerPixel)); #ifdef ALP_DEBUG - ErrorF("offscreen_offset=%d, offscreen_size=%d\n", - offscreen_offset, offscreen_size); + ErrorF("offscreen_offset=%d, offscreen_size=%d\n", + pCir->offscreen_offset, pCir->offscreen_size); #endif /* Initialise cursor functions */ - if (pCir->HWCursor) { /* Initialize HW cursor layer */ - if ((pCir->properties & HWCUR64) - && (offscreen_size >= 64*8*2)) - { - cursor_size = 64; - offscreen_size -= 64*8*2; - offscreen_offset -= 64*8*2; - } - else if (offscreen_size >= 32*4*2) - { - cursor_size = 32; - offscreen_size -= 32*8*2; - offscreen_offset -= 32*8*2; - } - if (!AlpHWCursorInit(pScreen, cursor_size)) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Hardware cursor initialization failed\n"); + if (pCir->HWCursor) { /* Initialize HW cursor layer */ + + if ((pCir->properties & HWCUR64) + && (pCir->offscreen_size >= 64*8*2)) { + cursor_size = 64; + pCir->offscreen_size -= 64*8*2; + pCir->offscreen_offset -= 64*8*2; + } else if (pCir->offscreen_size >= 32*4*2) { + cursor_size = 32; + pCir->offscreen_size -= 32*8*2; + pCir->offscreen_offset -= 32*8*2; } -#ifdef ALP_DEBUG - ErrorF("AlpHWCursorInit complete.\n"); -#endif - if (offscreen_size >= 8 && !pCir->NoAccel && - pCir->Chipset == PCI_CHIP_GD7548) - { - offscreen_offset -= 8; - offscreen_size -= 8; - pAlp->monoPattern8x8 = offscreen_offset; -#ifdef ALP_DEBUG - ErrorF("monoPattern8x8=%d\n", pAlp->monoPattern8x8); -#endif - } - else pAlp->monoPattern8x8 = 0; - { - /* TODO: probably not correct if rotated */ - BoxRec box; - box.x1=0; - box.y1=0; - box.x2=pScrn->virtualX; - box.y2=offscreen_offset / pCir->pitch; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Using %d lines for offscreen memory\n", - box.y2 - pScrn->virtualY); - } - } if (!pCir->NoAccel) { /* Initialize XAA functions */ - if (!(pCir->UseMMIO ? AlpXAAInitMMIO(pScreen) : - AlpXAAInit(pScreen))) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not initialize XAA\n"); + AlpOffscreenAccelInit(pScrn); + if (!(pCir->UseMMIO ? AlpXAAInitMMIO(pScreen) : + AlpXAAInit(pScreen))) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Could not initialize XAA\n"); } -#if 0 - if (!AlpDGAInit(pScreen)) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DGA initialization failed\n"); +#if 1 + pCir->DGAModeInit = AlpModeInit; + if (!CirDGAInit(pScreen)) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "DGA initialization failed\n"); +#endif + xf86SetSilkenMouse(pScreen); + + /* Initialise cursor functions */ + miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); + + if (pCir->HWCursor) { + if (!AlpHWCursorInit(pScreen, cursor_size)) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Hardware cursor initialization failed\n"); +#ifdef ALP_DEBUG + ErrorF("AlpHWCursorInit() complete\n"); #endif + } + if (pCir->shadowFB) { RefreshAreaFuncPtr refreshArea = cirRefreshArea; @@ -1716,9 +1705,7 @@ if (pScrn->bitsPerPixel > 1 && pScrn->bitsPerPixel <= 8) vgaHWHandleColormaps(pScreen); -#ifdef DPMSExtension xf86DPMSInit(pScreen, AlpDisplayPowerManagementSet, 0); -#endif pScrn->memPhysBase = pCir->FbAddress; pScrn->fbOffset = 0; @@ -1811,12 +1798,20 @@ AlpEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + CirPtr pCir = CIRPTR(pScrn); + Bool ret; + #ifdef ALP_DEBUG ErrorF("AlpEnterVT\n"); #endif /* Should we re-save the text mode on each VT enter? */ - return AlpModeInit(pScrn, pScrn->currentMode); + if (!(ret = AlpModeInit(pScrn, pScrn->currentMode))) + return FALSE; + + pCir->InitAccel(pScrn); + + return ret; } @@ -1869,11 +1864,10 @@ if (pCir->CursorInfoRec) xf86DestroyCursorInfoRec(pCir->CursorInfoRec); pCir->CursorInfoRec = NULL; -#if 0 - if (pCir->DGAInfo) - DGADestroyInfoRec(pCir->DGAInfo); - pCir->DGAInfo = NULL; -#endif + if (pCir->DGAModes) + xfree(pCir->DGAModes); + pCir->DGAnumModes = 0; + pCir->DGAModes = NULL; pScrn->vtSema = FALSE; @@ -1983,7 +1977,6 @@ * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -#ifdef DPMSExtension static void AlpDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -2031,7 +2024,6 @@ gr0e |= hwp->readGr(hwp, 0x0E) & ~0x06; hwp->writeGr(hwp, 0x0E, gr0e); } -#endif #ifdef ALPPROBEI2C static void AlpProbeI2C(int scrnIndex) @@ -2061,69 +2053,96 @@ static void AlpProbeLCD(ScrnInfoPtr pScrn) { - CirPtr pCir = CIRPTR(pScrn); - vgaHWPtr hwp = VGAHWPTR(pScrn); - static const char* lcd_type_names[] = - { - "none", - "dual-scan monochrome", - "unknown", - "DSTN (dual scan color)", - "TFT (active matrix)" - }; + CirPtr pCir = CIRPTR(pScrn); + AlpPtr pAlp = ALPPTR(pCir); + vgaHWPtr hwp = VGAHWPTR(pScrn); + CARD8 lcdCrtl; - pCir -> lcdType = LCD_NONE; + static const char* lcd_type_names[] = + { + "none", + "dual-scan monochrome", + "unknown", + "DSTN (dual scan color)", + "TFT (active matrix)" + }; - switch (pCir -> Chipset) - { - case PCI_CHIP_GD7548: - switch (hwp->readCrtc(hwp, 0x2C) >> 6) - { - case 0: pCir->lcdType = LCD_DUAL_MONO; break; - case 1: pCir->lcdType = LCD_UNKNOWN; break; - case 2: pCir->lcdType = LCD_DSTN; break; - case 3: pCir->lcdType = LCD_TFT; break; - } - /* Enable LCD control registers instead of normal CRTC registers */ - hwp->writeCrtc(hwp, 0x2D, hwp->readCrtc(hwp, 0x2D) | 0x80); + pAlp->lcdType = LCD_NONE; - switch ((hwp->readCrtc(hwp, 0x9) >> 2) & 3) - { + switch (pCir->Chipset) { + case PCI_CHIP_GD7548: + switch (hwp->readCrtc(hwp, 0x2C) >> 6) { + case 0: pAlp->lcdType = LCD_DUAL_MONO; break; + case 1: pAlp->lcdType = LCD_UNKNOWN; break; + case 2: pAlp->lcdType = LCD_DSTN; break; + case 3: pAlp->lcdType = LCD_TFT; break; + } + + /* Enable LCD control registers instead of normal CRTC registers */ + lcdCrtl = hwp->readCrtc(hwp, 0x2D); + hwp->writeCrtc(hwp, 0x2D, lcdCrtl | 0x80); + + switch ((hwp->readCrtc(hwp, 0x9) >> 2) & 3) { case 0: - pCir->lcdWidth = 640; - pCir->lcdHeight = 480; - break; + pAlp->lcdWidth = 640; + pAlp->lcdHeight = 480; + break; - case 1: - pCir->lcdWidth = 800; - pCir->lcdHeight = 600; - break; + case 1: + pAlp->lcdWidth = 800; + pAlp->lcdHeight = 600; + break; case 2: - pCir->lcdWidth = 1024; - pCir->lcdHeight = 768; - break; + pAlp->lcdWidth = 1024; + pAlp->lcdHeight = 768; + break; case 3: - pCir->lcdWidth = 0; - pCir->lcdHeight = 0; - break; - } + pAlp->lcdWidth = 0; + pAlp->lcdHeight = 0; + break; + } - /* Disable LCD control registers */ - hwp->writeCrtc(hwp, 0x2D, hwp->readCrtc(hwp, 0x2D) & ~0x80); - break; - } + /* Disable LCD control registers */ + hwp->writeCrtc(hwp, 0x2D, lcdCrtl); + break; + } - if (pCir -> lcdType != LCD_NONE) - { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "LCD display: %dx%d %s\n", - pCir->lcdWidth, pCir->lcdHeight, - lcd_type_names[pCir->lcdType]); - } + if (pAlp->lcdType != LCD_NONE) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "LCD display: %dx%d %s\n", + pAlp->lcdWidth, pAlp->lcdHeight, + lcd_type_names[pAlp->lcdType]); + } } +static void +AlpOffscreenAccelInit(ScrnInfoPtr pScrn) +{ + CirPtr pCir = CIRPTR(pScrn); + AlpPtr pAlp = ALPPTR(pCir); + if (pCir->offscreen_size >= 8 && pCir->Chipset == PCI_CHIP_GD7548) { + pCir->offscreen_offset -= 8; + pCir->offscreen_size -= 8; + pAlp->monoPattern8x8 = pCir->offscreen_offset; +#ifdef ALP_DEBUG + ErrorF("monoPattern8x8=%d\n", pAlp->monoPattern8x8); +#endif + } else pAlp->monoPattern8x8 = 0; + + { + /* TODO: probably not correct if rotated */ + BoxRec box; + box.x1=0; + box.y1=0; + box.x2=pScrn->virtualX; + box.y2= pCir->offscreen_offset / pCir->pitch; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Using %d lines for offscreen memory\n", + box.y2 - pScrn->virtualY); + } +} Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c:1.4 Wed Dec 6 10:35:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c Mon May 7 17:59:06 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c,v 1.4 2000/12/06 15:35:15 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_hwcurs.c,v 1.5 2001/05/07 21:59:06 tsi Exp $ */ /* (c) Itai Nahshon */ @@ -246,7 +246,6 @@ infoPtr->HideCursor = AlpHideCursor; infoPtr->ShowCursor = AlpShowCursor; infoPtr->UseHWCursor = AlpUseHWCursor; - infoPtr->RealizeCursor = NULL; #ifdef ALP_DEBUG ErrorF("AlpHWCursorInit before xf86InitCursor\n"); Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c:1.5.2.2 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c:1.5.2.2 Thu Mar 15 17:39:27 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c Thu Feb 15 12:39:27 2001 @@ -1,6 +1,6 @@ /* (c) Itai Nahshon */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.5.2.2 2001/03/15 22:39:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaa.c,v 1.6 2001/02/15 17:39:27 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -565,120 +565,120 @@ } #endif -Bool -AlpXAAInit(ScreenPtr pScreen) +static void +AlpAccelEngineInit(ScrnInfoPtr pScrn) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - CirPtr pCir = CIRPTR(pScrn); - AlpPtr pAlp = ALPPTR(pCir); - XAAInfoRecPtr XAAPtr; - -#ifdef ALP_DEBUG - ErrorF("AlpXAAInit\n"); -#endif + CirPtr pCir = CIRPTR(pScrn); - XAAPtr = XAACreateInfoRec(); - if (!XAAPtr) return FALSE; - - XAAPtr->SetupForScreenToScreenCopy = AlpSetupForScreenToScreenCopy; - XAAPtr->SubsequentScreenToScreenCopy = AlpSubsequentScreenToScreenCopy; - XAAPtr->ScreenToScreenCopyFlags = - NO_TRANSPARENCY | NO_PLANEMASK; - - switch (pCir->Chipset) - { - case PCI_CHIP_GD7548: - if (!pAlp->monoPattern8x8) break; - XAAPtr->SetupForSolidFill = AlpSetupForSolidFill; - XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect; - XAAPtr->SubsequentSolidFillTrap = NULL; - XAAPtr->SolidFillFlags = NO_PLANEMASK; - - XAAPtr->SetupForMono8x8PatternFill = AlpSetupForMono8x8PatternFill; - XAAPtr->SubsequentMono8x8PatternFillRect = - AlpSubsequentMono8x8PatternFillRect; - XAAPtr->SubsequentMono8x8PatternFillTrap = NULL; - XAAPtr->Mono8x8PatternFillFlags = - NO_PLANEMASK | - HARDWARE_PATTERN_PROGRAMMED_BITS | BIT_ORDER_IN_BYTE_MSBFIRST; + outw(0x3CE, 0x200E); /* enable writes to gr33 */ + /* Setup things for autostart */ + if (pCir->properties & ACCEL_AUTOSTART) { + outw(0x3CE, 0x8031); /* enable autostart */ + pCir->chip.alp->waitMsk = 0x10; + pCir->chip.alp->autoStart = TRUE; + } else { + pCir->chip.alp->waitMsk = 0x1; + pCir->chip.alp->autoStart = FALSE; + } +} -#if 0 - /* Currently disabled: XF86 sends DWORD-padded data, - not byte-padded */ - XAAPtr->SetupForCPUToScreenColorExpandFill = - AlpSetupForCPUToScreenColorExpandFill; - XAAPtr->SubsequentCPUToScreenColorExpandFill = - AlpSubsequentCPUToScreenColorExpandFill; - XAAPtr->ColorExpandBase = pCir->FbBase + 4; - XAAPtr->CPUToScreenColorExpandFillFlags = - NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST | - SCANLINE_PAD_DWORD | ROP_NEEDS_SOURCE | - CPU_TRANSFER_PAD_DWORD | CPU_TRANSFER_BASE_FIXED; -#endif +Bool +AlpXAAInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + CirPtr pCir = CIRPTR(pScrn); + AlpPtr pAlp = ALPPTR(pCir); + XAAInfoRecPtr XAAPtr; + + pCir->InitAccel = AlpAccelEngineInit; +#ifdef ALP_DEBUG + ErrorF("AlpXAAInit\n"); +#endif + + XAAPtr = XAACreateInfoRec(); + if (!XAAPtr) return FALSE; + + /* Pixmap cache */ + XAAPtr->Flags |= LINEAR_FRAMEBUFFER; + XAAPtr->Sync = AlpSync; + + XAAPtr->SetupForScreenToScreenCopy = AlpSetupForScreenToScreenCopy; + XAAPtr->SubsequentScreenToScreenCopy = AlpSubsequentScreenToScreenCopy; + XAAPtr->ScreenToScreenCopyFlags = + NO_TRANSPARENCY | NO_PLANEMASK; + + XAAPtr->SetupForSolidFill = AlpSetupForSolidFill; + XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect; + XAAPtr->SubsequentSolidFillTrap = NULL; + XAAPtr->SolidFillFlags = NO_PLANEMASK; + + if (pCir->Chipset == PCI_CHIP_GD7548) { + if (pAlp->monoPattern8x8) { + XAAPtr->SetupForMono8x8PatternFill + = AlpSetupForMono8x8PatternFill; + XAAPtr->SubsequentMono8x8PatternFillRect + = AlpSubsequentMono8x8PatternFillRect; + XAAPtr->SubsequentMono8x8PatternFillTrap = NULL; + XAAPtr->Mono8x8PatternFillFlags = + NO_PLANEMASK | + HARDWARE_PATTERN_PROGRAMMED_BITS | BIT_ORDER_IN_BYTE_MSBFIRST; + } #if 1 - /* kludge: since XF86 does not support byte-padded - mono bitmaps (only dword-padded), use the - scanline version */ - XAAPtr->SetupForScanlineCPUToScreenColorExpandFill = + /* kludge: since XF86 does not support byte-padded + mono bitmaps (only dword-padded), use the + scanline version */ + XAAPtr->SetupForScanlineCPUToScreenColorExpandFill = AlpSetupForScanlineCPUToScreenColorExpandFill; - XAAPtr->SubsequentScanlineCPUToScreenColorExpandFill = + XAAPtr->SubsequentScanlineCPUToScreenColorExpandFill = AlpSubsequentScanlineCPUToScreenColorExpandFill; - XAAPtr->SubsequentColorExpandScanline = + XAAPtr->SubsequentColorExpandScanline = AlpSubsequentColorExpandScanline; - { - const int NumScanlineColorExpandBuffers = 2; - int i; - int buffer_size = (pCir->pScrn->virtualX + 31) & ~31; + { + const int NumScanlineColorExpandBuffers = 2; + int i; + int buffer_size = (pCir->pScrn->virtualX + 31) & ~31; #ifdef ALP_DEBUG - ErrorF("Computing buffers for %d pixel lines\n", - pCir->pScrn->virtualX); + ErrorF("Computing buffers for %d pixel lines\n", + pCir->pScrn->virtualX); #endif - XAAPtr->NumScanlineColorExpandBuffers = + XAAPtr->NumScanlineColorExpandBuffers = NumScanlineColorExpandBuffers; - XAAPtr->ScanlineColorExpandBuffers = + XAAPtr->ScanlineColorExpandBuffers = pCir->ScanlineColorExpandBuffers = (unsigned char **) (malloc(sizeof(unsigned char *) * NumScanlineColorExpandBuffers)); /* TODO: are those mallocs to be freed ? */ - for(i=0; i<NumScanlineColorExpandBuffers; i++) + for(i=0; i<NumScanlineColorExpandBuffers; i++) pCir->ScanlineColorExpandBuffers[i] = (unsigned char *) malloc(buffer_size); - } - XAAPtr->ScanlineCPUToScreenColorExpandFillFlags = + } + XAAPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST | SCANLINE_PAD_DWORD | ROP_NEEDS_SOURCE; #endif - break; - - case PCI_CHIP_GD5446: - case PCI_CHIP_GD5480: - XAAPtr->SetupForSolidFill = AlpSetupForSolidFill; - XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect; - XAAPtr->SubsequentSolidFillTrap = NULL; - XAAPtr->SolidFillFlags = NO_TRANSPARENCY|NO_PLANEMASK; - outw(0x3CE, 0x200E); /* enable writes to gr33 */ - break; - } - - /* TODO: probably too limited */ - - XAAPtr->Sync = AlpSync; - - /* Pixmap cache */ - XAAPtr -> Flags |= LINEAR_FRAMEBUFFER; - - /* Setup things for autostart */ - if (pCir->properties & ACCEL_AUTOSTART) { - outw(0x3CE, 0x8031); /* enable autostart */ - pCir->chip.alp->waitMsk = 0x10; - pCir->chip.alp->autoStart = TRUE; - } else { - pCir->chip.alp->waitMsk = 0x1; - pCir->chip.alp->autoStart = FALSE; - } - if (!XAAInit(pScreen, XAAPtr)) - return FALSE; +#if 0 + /* Currently disabled: XF86 sends DWORD-padded data, + not byte-padded */ + XAAPtr->SetupForCPUToScreenColorExpandFill = + AlpSetupForCPUToScreenColorExpandFill; + XAAPtr->SubsequentCPUToScreenColorExpandFill = + AlpSubsequentCPUToScreenColorExpandFill; + XAAPtr->ColorExpandBase = pCir->FbBase + 4; + XAAPtr->CPUToScreenColorExpandFillFlags = + NO_PLANEMASK | BIT_ORDER_IN_BYTE_MSBFIRST | + SCANLINE_PAD_DWORD | ROP_NEEDS_SOURCE | + CPU_TRANSFER_PAD_DWORD | CPU_TRANSFER_BASE_FIXED; +#endif + } + + AlpAccelEngineInit(pScrn); - return TRUE; + pCir->AccelInfoRec = XAAPtr; + + if (!XAAInit(pScreen, XAAPtr)) + return FALSE; + + return TRUE; } + Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c:1.4.2.2 xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c:1.4.2.2 Thu Mar 15 17:39:27 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c Thu Feb 15 12:39:27 2001 @@ -1,6 +1,6 @@ /* (c) Itai Nahshon */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c,v 1.4.2.2 2001/03/15 22:39:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/alp_xaam.c,v 1.6 2001/02/15 17:39:27 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -19,25 +19,55 @@ #ifdef DEBUG #define minb(p) \ ErrorF("minb(%X)\n", p),\ - MMIO_IN8(pCir->IOBase, (p)) + MMIO_IN8(pCir->chip.alp->BLTBase, (p)) #define moutb(p,v) \ ErrorF("moutb(%X)\n", p),\ - MMIO_OUT8(pCir->IOBase, (p),(v)) + MMIO_OUT8(pCir->chip.alp->BLTBase, (p),(v)) +#define vga_minb(p) \ + ErrorF("minb(%X)\n", p),\ + MMIO_IN8(hwp->MMIOBase, (hwp->MMIOOffset + (p))) +#define vga_moutb(p,v) \ + ErrorF("moutb(%X)\n", p),\ + MMIO_OUT8(pCir->MMIOBase, (hwp->MMIOOffset + (p)),(v)) #define minl(p) \ ErrorF("minl(%X)\n", p),\ - MMIO_IN32(pCir->IOBase, (p)) + MMIO_IN32(pCir->chip.alp->BLTBase, (p)) #define moutl(p,v) \ ErrorF("moutl(%X)\n", p),\ - MMIO_OUT32(pCir->IOBase, (p),(v)) + MMIO_OUT32(pCir->chip.alp->BLTBase, (p),(v)) #else -#define minb(p) MMIO_IN8(pCir->IOBase, (p)) -#define moutb(p,v) MMIO_OUT8(pCir->IOBase, (p),(v)) -#define minl(p) MMIO_IN32(pCir->IOBase, (p)) -#define moutl(p,v) MMIO_OUT32(pCir->IOBase, (p),(v)) +#define minb(p) MMIO_IN8(pCir->chip.alp->BLTBase, (p)) +#define moutb(p,v) MMIO_OUT8(pCir->chip.alp->BLTBase, (p),(v)) +#define vga_minb(p) MMIO_IN8(hwp->MMIIOBase, (hwp->MMIOOffset + (p))) +#define vga_moutb(p,v) MMIO_OUT8(hwp->MMIOBase, (hwp->MMIOOffset + (p)),(v)) +#define minl(p) MMIO_IN32(pCir->chip.alp->BLTBase, (p)) +#define moutl(p,v) MMIO_OUT32(pCir->chip.alp->BLTBase, (p),(v)) #endif + +static const CARD8 translated_rop[] = +{ + /* GXclear */ 0x00U, + /* GXand */ 0x05U, + /* GXandreverse */ 0x09U, + /* GXcopy */ 0x0DU, + /* GXandinversted */ 0x50U, + /* GXnoop */ 0x06U, + /* GXxor */ 0x59U, + /* GXor */ 0x6DU, + /* GXnor */ 0x90U, + /* GXequiv */ 0x95U, + /* GXinvert */ 0x0BU, + /* GXorReverse */ 0xADU, + /* GXcopyInverted */ 0xD0U, + /* GXorInverted */ 0xD6U, + /* GXnand */ 0xDAU, + /* GXset */ 0x0EU +}; + +#define WAIT while(minl(0x40) & pCir->chip.alp->waitMsk){}; +#define WAIT_1 while(minl(0x40) & 0x1){}; -#define WAIT while(minb(0x40) & pCir->chip.alp->waitMsk){}; -#define WAIT_1 while(minb(0x40) & 0x1){}; +#define SetupForRop(rop) moutb(0x1A, translated_rop[rop]) static void AlpSync(ScrnInfoPtr pScrn) { @@ -58,6 +88,8 @@ WAIT; + SetupForRop(rop); + #ifdef ALP_DEBUG ErrorF("AlpSetupForScreenToScreenCopy xdir=%d ydir=%d rop=%x planemask=%x trans_color=%x\n", xdir, ydir, rop, planemask, trans_color); @@ -70,43 +102,45 @@ AlpSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int w, int h) { - CirPtr pCir = CIRPTR(pScrn); - int source, dest; - int hh, ww; - int decrement = 0; - int pitch = pCir->pitch; - - ww = ((w * pScrn->bitsPerPixel / 8) - 1) & 0x1fff; - hh = (h - 1) & 0x1fff; - dest = y2 * pitch + x2 * pScrn->bitsPerPixel / 8; - source = y1 * pitch + x1 * pScrn->bitsPerPixel / 8; - if (dest > source) { - decrement = 1; - dest += hh * pitch + ww; - source += hh * pitch + ww; - } - - WAIT; - - /* Width / Height */ - moutl(0x08, (hh << 16) | ww); - /* source */ - moutl(0x14, source & 0x3fffff); - moutl(0x18, 0x0d0000 | decrement); - - /* dest */ - write_mem_barrier(); - moutl(0x10, dest & 0x3fffff); - -#ifdef ALP_DEBUG - ErrorF("AlpSubsequentScreenToScreenCopy x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", - x1, y1, x2, y2, w, h); - ErrorF("AlpSubsequentScreenToScreenCopy s=%d d=%d ww=%d hh=%d\n", - source, dest, ww, hh); -#endif - if (!pCir->chip.alp->autoStart) - moutb(0x40,0x02); - write_mem_barrier(); + CirPtr pCir = CIRPTR(pScrn); + int source, dest; + int hh, ww; + int decrement = 0; + int pitch = pCir->pitch; + + ww = ((w * pScrn->bitsPerPixel / 8) - 1) & 0x1fff; + hh = (h - 1) & 0x1fff; + dest = y2 * pitch + x2 * pScrn->bitsPerPixel / 8; + source = y1 * pitch + x1 * pScrn->bitsPerPixel / 8; + if (dest > source) { + decrement = 1; + dest += hh * pitch + ww; + source += hh * pitch + ww; + } + + WAIT; + + /* Width / Height */ + moutl(0x08, (hh << 16) | ww); + /* source */ + moutl(0x14, source & 0x3fffff); + moutl(0x18, 0x0d0000 | decrement); + + /* dest */ + write_mem_barrier(); + moutl(0x10, dest & 0x3fffff); + +#ifdef ALP_DEBUG + ErrorF("AlpSubsequentScreenToScreenCopy x1=%d y1=%d x2=%d y2=%d w=%d h=%d\n", + x1, y1, x2, y2, w, h); + ErrorF("AlpSubsequentScreenToScreenCopy s=%d d=%d ww=%d hh=%d\n", + source, dest, ww, hh); +#endif + if (!pCir->chip.alp->autoStart) { + CARD32 val = minl(0x40); + moutl(0x40,val | 0x02); + } + write_mem_barrier(); } @@ -114,51 +148,75 @@ AlpSetupForSolidFill(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask) { - CirPtr pCir = CIRPTR(pScrn); - int pitch = pCir->pitch; + CirPtr pCir = CIRPTR(pScrn); + int pitch = pCir->pitch; - WAIT; + WAIT; + + SetupForRop(rop); #ifdef ALP_DEBUG - ErrorF("AlpSetupForSolidFill color=%x rop=%x planemask=%x\n", - color, rop, planemask); + ErrorF("AlpSetupForSolidFill color=%x rop=%x planemask=%x\n", + color, rop, planemask); #endif - moutl(0x04, color & 0xffffff); + moutl(0x04, color & 0xffffff); - /* Set dest pitch */ - moutl(0x0C, pitch & 0x1fff); - moutl(0x18, (0xC0|((pScrn->bitsPerPixel - 8) << 1)) | 0x040d0000); + /* Set dest pitch */ + moutl(0x0C, pitch & 0x1fff); + moutl(0x18, (0xC0|((pScrn->bitsPerPixel - 8) << 1)) | 0x040d0000); } static void AlpSubsequentSolidFillRect(ScrnInfoPtr pScrn, int x, int y, int w, int h) { - int dest; - int hh, ww; - CirPtr pCir = CIRPTR(pScrn); - int pitch = pCir->pitch; - - ww = ((w * pScrn->bitsPerPixel / 8) - 1) & 0x1fff; - hh = (h - 1) & 0x7ff; - dest = y * pitch + x * pScrn->bitsPerPixel / 8; - - WAIT; + int dest; + int hh, ww; + CirPtr pCir = CIRPTR(pScrn); + int pitch = pCir->pitch; - /* Width / Height */ - write_mem_barrier(); - moutl(0x08, (hh << 16) | ww); + ww = ((w * pScrn->bitsPerPixel / 8) - 1) & 0x1fff; + hh = (h - 1) & 0x7ff; + dest = y * pitch + x * pScrn->bitsPerPixel / 8; + + WAIT; + + /* Width / Height */ + write_mem_barrier(); + moutl(0x08, (hh << 16) | ww); #ifdef ALP_DEBUG - ErrorF("AlpSubsequentSolidFillRect x=%d y=%d w=%d h=%d\n", - x, y, w, h); + ErrorF("AlpSubsequentSolidFillRect x=%d y=%d w=%d h=%d\n", + x, y, w, h); #endif - /* dest */ - moutl(0x10, (dest & 0x3fffff)); + /* dest */ + moutl(0x10, (dest & 0x3fffff)); + + if (!pCir->chip.alp->autoStart) { + CARD32 val = minl(0x40); + moutl(0x40, val | 0x02); + } + write_mem_barrier(); +} + +static void +AlpAccelEngineInit(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + CirPtr pCir = CIRPTR(pScrn); - if (!pCir->chip.alp->autoStart) - moutb(0x40,0x02); - write_mem_barrier(); + if (pCir->Chipset != PCI_CHIP_GD7548) { + vga_moutb(0x3CE, 0x0E); /* enable writes to gr33 */ + vga_moutb(0x3CF, 0x20); /* enable writes to gr33 */ + } + if (pCir->properties & ACCEL_AUTOSTART) { + moutl(0x40, 0x80); /* enable autostart */ + pCir->chip.alp->waitMsk = 0x10; + pCir->chip.alp->autoStart = TRUE; + } else { + pCir->chip.alp->waitMsk = 0x1; + pCir->chip.alp->autoStart = FALSE; + } } Bool @@ -167,43 +225,48 @@ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; CirPtr pCir = CIRPTR(pScrn); XAAInfoRecPtr XAAPtr; - + + pCir->InitAccel = AlpAccelEngineInit; #ifdef ALP_DEBUG - ErrorF("AlpXAAInit mm\n"); + ErrorF("AlpXAAInitMM\n"); #endif XAAPtr = XAACreateInfoRec(); if (!XAAPtr) return FALSE; + + XAAPtr->Flags |= LINEAR_FRAMEBUFFER; + XAAPtr->Sync = AlpSync; XAAPtr->SetupForScreenToScreenCopy = AlpSetupForScreenToScreenCopy; XAAPtr->SubsequentScreenToScreenCopy = AlpSubsequentScreenToScreenCopy; - XAAPtr->ScreenToScreenCopyFlags = GXCOPY_ONLY|NO_TRANSPARENCY|NO_PLANEMASK; + XAAPtr->ScreenToScreenCopyFlags = + (NO_TRANSPARENCY | NO_PLANEMASK); XAAPtr->SetupForSolidFill = AlpSetupForSolidFill; XAAPtr->SubsequentSolidFillRect = AlpSubsequentSolidFillRect; XAAPtr->SubsequentSolidFillTrap = NULL; - XAAPtr->SolidFillFlags = GXCOPY_ONLY|NO_TRANSPARENCY|NO_PLANEMASK; - - XAAPtr->Sync = AlpSync; + XAAPtr->SolidFillFlags = NO_PLANEMASK; - if (pCir->Chipset != PCI_CHIP_GD7548) - { - moutb(0x3CE, 0x0E); /* enable writes to gr33 */ - moutb(0x3CF, 0x20); /* enable writes to gr33 */ - } - - if (pCir->properties & ACCEL_AUTOSTART) { - moutb(0x40, 0x80); /* enable autostart */ - pCir->chip.alp->waitMsk = 0x10; - pCir->chip.alp->autoStart = TRUE; - } else { - pCir->chip.alp->waitMsk = 0x1; - pCir->chip.alp->autoStart = FALSE; + switch (pCir->Chipset) { + case PCI_CHIP_GD5480: + pCir->chip.alp->BLTBase = pCir->IOBase + 0x100; + break; + default: + pCir->chip.alp->BLTBase = pCir->IOBase; + break; } + AlpAccelEngineInit(pScrn); + + pCir->AccelInfoRec = XAAPtr; + if (!XAAInit(pScreen, XAAPtr)) - return FALSE; + return FALSE; return TRUE; } + + + + Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h:1.17.2.2 xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h:1.17.2.2 Thu Mar 15 17:39:27 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h Fri May 4 15:05:35 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h,v 1.17.2.2 2001/03/15 22:39:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir.h,v 1.19 2001/05/04 19:05:35 dawes Exp $ */ /* (c) Itai Nahshon */ @@ -14,9 +14,6 @@ struct lgRec; struct alpRec; -typedef enum { - LCD_NONE, LCD_DUAL_MONO, LCD_UNKNOWN, LCD_DSTN, LCD_TFT } LCDType; - typedef struct { ScrnInfoPtr pScrn; CARD32 properties; @@ -45,9 +42,11 @@ Bool UseMMIO; XAAInfoRecPtr AccelInfoRec; xf86CursorInfoPtr CursorInfoRec; -#if 0 - DGAInfoPtr DGAInfo; -#endif + int DGAnumModes; + DGAModePtr DGAModes; + Bool DGAactive; + Bool (*DGAModeInit)(ScrnInfoPtr, DisplayModePtr); + int DGAViewportStatus; I2CBusPtr I2CPtr1; I2CBusPtr I2CPtr2; CloseScreenProcPtr CloseScreen; @@ -61,9 +60,10 @@ int pitch; unsigned char ** ScanlineColorExpandBuffers; - - LCDType lcdType; - int lcdWidth, lcdHeight; + void (* InitAccel)(ScrnInfoPtr); + int offscreen_size; + int offscreen_offset; + OptionInfoPtr Options; } CirRec, *CirPtr; /* CirrusClk.c */ @@ -77,6 +77,9 @@ extern Bool CirMapMem(CirPtr pCir, int scrnIndex); extern Bool CirUnmapMem(CirPtr pCir, int scrnIndex); extern void cirProbeDDC(ScrnInfoPtr pScrn, int index); + +/* cir_dga.c */ +extern Bool CirDGAInit(ScreenPtr pScreen); /* in cir_shadow.c */ void cirPointerMoved(int index, int x, int y); Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c:1.5.2.1 xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c:1.5.2.1 Fri Mar 9 13:03:29 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c Sun Apr 1 10:00:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c,v 1.5.2.1 2001/03/09 18:03:29 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_dga.c,v 1.6 2001/04/01 14:00:10 tsi Exp $ */ /* * Copyright 2000 by Egbert Eich * @@ -143,7 +143,7 @@ CirPtr pCir = CIRPTR(pScrn); *name = NULL; /* no special device */ - *mem = (unsigned char*)pCir->FbAddress; + *mem = (unsigned char*)(long)pCir->FbAddress; *size = pCir->FbMapSize; *offset = 0; /* Always */ *flags = 0; /* Root permissions OS-dependent */ Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c:1.62 xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c:1.67 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c:1.62 Wed Dec 6 10:35:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c Tue May 15 06:19:37 2001 @@ -11,7 +11,7 @@ * Guy DESBIEF */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c,v 1.62 2000/12/06 15:35:15 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cir_driver.c,v 1.67 2001/05/15 10:19:37 eich Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -40,7 +40,7 @@ /* Mandatory functions */ -static OptionInfoPtr CIRAvailableOptions(int chipid, int busid); +static const OptionInfoRec * CIRAvailableOptions(int chipid, int busid); static void CIRIdentify(int flags); static Bool CIRProbe(DriverPtr drv, int flags); @@ -65,9 +65,6 @@ DriverRec CIRRUS = { VERSION, CIR_DRIVER_NAME, -#if 0 - "Driver for Cirrus Logic GD5446, GD5480, and GD5462/4/5 cards", -#endif CIRIdentify, CIRProbe, CIRAvailableOptions, @@ -129,6 +126,12 @@ NULL }; +static const char *vbeSymbols[] = { + "VBEInit", + "vbeDoEDID", + "vbeFree", + NULL +}; #ifdef XFree86LOADER @@ -165,7 +168,7 @@ setupDone = TRUE; xf86AddDriver(&CIRRUS, module, 0); - LoaderRefSymLists(alpSymbols, lgSymbols, NULL); + LoaderRefSymLists(alpSymbols, lgSymbols, vbeSymbols, NULL); return (pointer)1; } if (errmaj) *errmaj = LDR_ONCEONLY; @@ -181,8 +184,7 @@ xf86PrintChipsets(CIR_NAME, "driver for Cirrus chipsets", CIRChipsets); } -static -OptionInfoPtr +static const OptionInfoRec * CIRAvailableOptions(int chipid, int busid) { int chip = chipid & 0xffff; @@ -399,7 +401,11 @@ vbeInfoPtr pVbe; if (xf86LoadSubModule(pScrn, "vbe")) { +#ifdef XFree86LOADER + xf86LoaderReqSymLists(vbeSymbols,NULL); +#endif pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.cpp:1.5 xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.cpp:1.5 Mon Dec 11 15:18:09 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.cpp Mon Jun 4 12:40:47 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.cpp,v 1.5 2000/12/11 20:18:09 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH CIRRUS __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -cirrus \- Cirrus Logic video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qcirrus\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B cirrus -is an XFree86 driver for Cirrus Logic video chips. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B cirrus -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.man:1.2 --- /dev/null Mon Jun 4 12:40:47 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.man Sat Jan 27 13:20:47 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/cirrus.man,v 1.2 2001/01/27 18:20:47 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH CIRRUS __drivermansuffix__ __vendorversion__ +.SH NAME +cirrus \- Cirrus Logic video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qcirrus\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B cirrus +is an XFree86 driver for Cirrus Logic video chips. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B cirrus +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg.h:1.11 xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg.h:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg.h:1.11 Wed Dec 6 10:35:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg.h Fri May 4 15:05:36 2001 @@ -10,14 +10,14 @@ * Inspired by cir.h */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg.h,v 1.11 2000/12/06 15:35:16 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg.h,v 1.12 2001/05/04 19:05:36 dawes Exp $ */ #ifndef LG_H #define LG_H #define LG_DEBUG extern ScrnInfoPtr LgProbe(int entity); -extern OptionInfoPtr LgAvailableOptions(int chipid); +extern const OptionInfoRec * LgAvailableOptions(int chipid); # ifdef _LG_PRIVATE_ Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c:1.33.2.2 xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c:1.37 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c:1.33.2.2 Thu Mar 15 17:39:27 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c Fri May 4 15:05:36 2001 @@ -13,7 +13,7 @@ * David Dawes, Andrew E. Mileski, Leonard N. Zubkoff, * Guy DESBIEF, Itai Nahshon. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c,v 1.33.2.2 2001/03/15 22:39:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_driver.c,v 1.37 2001/05/04 19:05:36 dawes Exp $ */ #define EXPERIMENTAL @@ -94,10 +94,8 @@ static CARD16 LgSetClock(CirPtr pCir, vgaHWPtr hwp, int freq); static void lg_vgaHWSetMmioFunc(vgaHWPtr hwp, CARD8 *base); -#ifdef DPMSExtension -static void LgDisplayPowerManagementSet(ScrnInfoPtr pScrn, - int PowerManagementMode, int flags); -#endif +static void LgDisplayPowerManagementSet(ScrnInfoPtr pScrn, + int PowerManagementMode, int flags); /* * This is intentionally screen-independent. It indicates the binding @@ -121,7 +119,7 @@ OPTION_NOACCEL } LgOpts; -static OptionInfoRec LgOptions[] = { +static const OptionInfoRec LgOptions[] = { { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, @@ -280,7 +278,7 @@ #endif /* XFree86LOADER */ -OptionInfoPtr +const OptionInfoRec * LgAvailableOptions(int chipid) { return LgOptions; @@ -529,17 +527,20 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, LgOptions); + if (!(pCir->Options = xalloc(sizeof(LgOptions)))) + return FALSE; + memcpy(pCir->Options, LgOptions, sizeof(LgOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pCir->Options); pScrn->rgbBits = 6; from = X_DEFAULT; pCir->HWCursor = FALSE; - if (xf86GetOptValBool(LgOptions, OPTION_HW_CURSOR, &pCir->HWCursor)) + if (xf86GetOptValBool(pCir->Options, OPTION_HW_CURSOR, &pCir->HWCursor)) from = X_CONFIG; xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pCir->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(LgOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pCir->Options, OPTION_NOACCEL, FALSE)) { pCir->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } @@ -683,12 +684,12 @@ if (!xf86SetGamma(pScrn, zeros)) return FALSE; } - if (xf86GetOptValBool(LgOptions, + if (xf86GetOptValBool(pCir->Options, OPTION_SHADOW_FB,&pCir->shadowFB)) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShadowFB %s.\n", pCir->shadowFB ? "enabled" : "disabled"); - if ((s = xf86GetOptValString(LgOptions, OPTION_ROTATE))) { + if ((s = xf86GetOptValString(pCir->Options, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) { /* accel is disabled below for shadowFB */ pCir->shadowFB = TRUE; @@ -863,10 +864,7 @@ LgFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit",NULL); -#ifdef RENDER - xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif + xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); break; } @@ -1426,6 +1424,8 @@ if (!ret) return FALSE; + fbPictureInit(pScreen, 0, 0); + #ifdef LG_DEBUG ErrorF("LgScreenInit after depth dependent init\n"); #endif @@ -1456,7 +1456,12 @@ if (!LgXAAInit(pScreen)) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Could not initialize XAA\n"); } - +#if 1 + pCir->DGAModeInit = LgModeInit; + if (!CirDGAInit(pScreen)) + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "DGA initialization failed\n"); +#endif xf86SetSilkenMouse(pScreen); /* Initialise cursor functions */ @@ -1475,9 +1480,7 @@ if (pScrn->bitsPerPixel > 1 && pScrn->bitsPerPixel <= 8) vgaHWHandleColormaps(pScreen); -#ifdef DPMSExtension xf86DPMSInit(pScreen, LgDisplayPowerManagementSet, 0); -#endif pScrn->memPhysBase = pCir->FbAddress; pScrn->fbOffset = 0; @@ -1691,6 +1694,10 @@ if (pCir->CursorInfoRec) xf86DestroyCursorInfoRec(pCir->CursorInfoRec); pCir->CursorInfoRec = NULL; + if (pCir->DGAModes) + xfree(pCir->DGAModes); + pCir->DGAnumModes = 0; + pCir->DGAModes = NULL; pScrn->vtSema = FALSE; @@ -1799,7 +1806,6 @@ * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -#ifdef DPMSExtension static void LgDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -1843,7 +1849,6 @@ cr1a |= hwp->readCrtc(hwp, 0x1A) & ~0x0C; hwp->writeCrtc(hwp, 0x1A, cr1a); } -#endif #define minb(p) MMIO_IN8(hwp->MMIOBase, (p)) #define moutb(p,v) MMIO_OUT8(hwp->MMIOBase, (p),(v)) Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_hwcurs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_hwcurs.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_hwcurs.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_hwcurs.c:1.4 Wed Dec 6 10:35:17 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_hwcurs.c Mon May 7 17:59:06 2001 @@ -10,7 +10,7 @@ * Much of this code is inspired by the HW cursor code from XFree86 * 3.3.3. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_hwcurs.c,v 1.4 2000/12/06 15:35:17 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_hwcurs.c,v 1.5 2001/05/07 21:59:06 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -375,10 +375,6 @@ infoPtr->HideCursor = LgHideCursor; infoPtr->ShowCursor = LgShowCursor; infoPtr->UseHWCursor = LgUseHWCursor; - /* RealizeCursor is how the cursor bits are converted from an infoPtr - to the bits to slam out to the card. Can we use one of the - pre-defined realize'rs? Look in ramdac/xf86HWCurs.c. */ - infoPtr->RealizeCursor = NULL; #ifdef LG_CURSOR_DEBUG ErrorF("LgHWCursorInit before xf86InitCursor\n"); Index: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.c:1.4.2.2 xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.c:1.4.2.2 Thu Mar 15 17:39:27 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.c Thu Feb 15 12:39:28 2001 @@ -10,7 +10,7 @@ * Much of this code is inspired by the XAA acceleration from XFree86 * 3.3.3, laguna_acl.c */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.c,v 1.4.2.2 2001/03/15 22:39:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cirrus/lg_xaa.c,v 1.5 2001/02/15 17:39:28 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -96,7 +96,9 @@ Bool LgXAAInit(ScreenPtr pScreen) { - XAAInfoRecPtr XAAPtr; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + CirPtr pCir = CIRPTR(pScrn); + XAAInfoRecPtr XAAPtr; XAAPtr = XAACreateInfoRec(); if (!XAAPtr) @@ -122,6 +124,8 @@ * Miscellany. */ XAAPtr->Sync = LgSync; + + pCir->AccelInfoRec = XAAPtr; if (!XAAInit(pScreen, XAAPtr)) return FALSE; Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile:1.4 xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile:1.4 Tue Sep 19 20:09:20 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile Tue Jan 23 19:06:17 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile,v 1.4 2000/09/20 00:09:20 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/Imakefile,v 1.5 2001/01/24 00:06:17 dawes Exp $ XCOMM XCOMM This is an Imakefile for the CYRIX driver. XCOMM @@ -31,7 +31,6 @@ InstallObjectModule(cyrix,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(cyrix,) InstallModuleManPage(cyrix) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.cpp:1.5 xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.cpp:1.5 Mon Dec 11 15:18:10 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.cpp Mon Jun 4 12:40:49 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.cpp,v 1.5 2000/12/11 20:18:10 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH CYRIX __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -cyrix \- Cyrix video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qcyrix\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B cyrix -is an XFree86 driver for Cyrix video chips. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B cyrix -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h:1.2 Wed Apr 19 12:57:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h Fri May 4 15:05:36 2001 @@ -26,7 +26,7 @@ * Dirk H. Hohndel (hohndel@suse.de), * Portions: the GGI project & confidential CYRIX databooks. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h,v 1.2 2000/04/19 16:57:43 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.h,v 1.3 2001/05/04 19:05:36 dawes Exp $ */ #ifndef _CYRIX_H_ #define _CYRIX_H_ @@ -116,6 +116,7 @@ Bool IsCyber; Bool NewClockCode; Bool NoAccel; + OptionInfoPtr Options; /* accel stuff */ int bltBufWidth; int blitMode; Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.man:1.2 --- /dev/null Mon Jun 4 12:40:49 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.man Sat Jan 27 13:20:47 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix.man,v 1.2 2001/01/27 18:20:47 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH CYRIX __drivermansuffix__ __vendorversion__ +.SH NAME +cyrix \- Cyrix video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qcyrix\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B cyrix +is an XFree86 driver for Cyrix video chips. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B cyrix +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c:1.14.2.1 xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c:1.14.2.1 Thu Feb 8 14:31:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c Fri May 4 15:05:36 2001 @@ -26,7 +26,7 @@ * Dirk H. Hohndel (hohndel@suse.de), * Portions: the GGI project & confidential CYRIX databooks. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c,v 1.14.2.1 2001/02/08 19:31:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/cyrix/cyrix_driver.c,v 1.19 2001/05/04 19:05:36 dawes Exp $ */ #include "fb.h" #include "mibank.h" @@ -45,17 +45,14 @@ #include "cyrix.h" -#ifdef XFreeXDGA #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" -#endif -#ifdef DPMSExtension #include "opaque.h" +#define DPMS_SERVER #include "extensions/dpms.h" -#endif -static OptionInfoPtr CYRIXAvailableOptions(int chip, int busid); +static const OptionInfoRec * CYRIXAvailableOptions(int chip, int busid); static void CYRIXIdentify(int flags); static Bool CYRIXProbe(DriverPtr drv, int flags); static Bool CYRIXPreInit(ScrnInfoPtr pScrn, int flags); @@ -104,7 +101,7 @@ /* * This contains the functions needed by the server after loading the driver - * module. It must be supplied, and gets passed back by the ModuleInit + * module. It must be supplied, and gets passed back by the moduleSetup * function in the dynamic case. In the static case, a reference to this * is compiled in, and this requires that the name of this DriverRec be * an upper-case version of the driver name. @@ -136,7 +133,7 @@ OPTION_NOACCEL } CYRIXOpts; -static OptionInfoRec CYRIXOptions[] = { +static const OptionInfoRec CYRIXOptions[] = { { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, @@ -238,7 +235,6 @@ pScrn->driverPrivate = NULL; } -#ifdef DPMSExtension static void CYRIXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { @@ -278,7 +274,6 @@ outb(0x83C6, PMCont); outw(0x3C4, (temp<<8) | 0x0E); } -#endif /* Mandatory */ static void @@ -287,8 +282,7 @@ xf86PrintChipsets(CYRIX_NAME, "driver for Cyrix MediaGX Processors", CYRIXChipsets); } -static -OptionInfoPtr +static const OptionInfoRec * CYRIXAvailableOptions(int chip, int busid) { return CYRIXOptions; @@ -617,7 +611,10 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, CYRIXOptions); + if (!(pCyrix->Options = xalloc(sizeof(CYRIXOptions)))) + return FALSE; + memcpy(pCyrix->Options, CYRIXOptions, sizeof(CYRIXOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pCyrix->Options); /* Set the bits per RGB for 8bpp mode */ if (pScrn->depth == 8) { @@ -625,7 +622,7 @@ /* Default to 8 */ pScrn->rgbBits = 8; #if 0 - if (xf86GetOptValInteger(CYRIXOptions, OPTION_RGB_BITS, + if (xf86GetOptValInteger(pCyrix->Options, OPTION_RGB_BITS, &pScrn->rgbBits)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Bits per RGB set to %d\n", pScrn->rgbBits); @@ -634,17 +631,17 @@ } from = X_DEFAULT; pCyrix->HWCursor = TRUE; - if (xf86IsOptionSet(CYRIXOptions, OPTION_HW_CURSOR)) { + if (xf86IsOptionSet(pCyrix->Options, OPTION_HW_CURSOR)) { from = X_CONFIG; pCyrix->HWCursor = TRUE; } - if (xf86IsOptionSet(CYRIXOptions, OPTION_SW_CURSOR)) { + if (xf86IsOptionSet(pCyrix->Options, OPTION_SW_CURSOR)) { from = X_CONFIG; pCyrix->HWCursor = FALSE; } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pCyrix->HWCursor ? "HW" : "SW"); - if (xf86IsOptionSet(CYRIXOptions, OPTION_NOACCEL)) { + if (xf86IsOptionSet(pCyrix->Options, OPTION_NOACCEL)) { pCyrix->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } @@ -994,6 +991,8 @@ return FALSE; } + miSetPixmapDepths (); + /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. @@ -1018,6 +1017,8 @@ if (!ret) return FALSE; + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); if (pScrn->bitsPerPixel > 8) { @@ -1084,9 +1085,7 @@ if (!vgaHWHandleColormaps(pScreen)) return FALSE; -#ifdef DPMSExtension xf86DPMSInit(pScreen, (DPMSSetProcPtr)CYRIXDisplayPowerManagementSet, 0); -#endif pScrn->memPhysBase = pCyrix->FbAddress; pScrn->fbOffset = 0; Index: xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile:1.8 xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile:1.8 Tue Sep 19 20:09:20 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile Fri Apr 6 14:16:30 2001 @@ -1,7 +1,7 @@ XCOMM XCOMM This is an Imakefile for the fbdev driver. XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile,v 1.8 2000/09/20 00:09:20 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/Imakefile,v 1.10 2001/04/06 18:16:30 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -21,7 +21,7 @@ -I$(XF86SRC)/rac \ -I$(SERVERSRC)/Xext -I$(XF86SRC)/xf24_32bpp\ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ - -I$(XF86SRC)/shadowfb -I$(EXTINCSRC) -I$(SERVERSRC)/render + -I$(SERVERSRC)/miext/shadow -I$(EXTINCSRC) -I$(SERVERSRC)/render #endif DEFINES = FbdevDefines @@ -37,7 +37,6 @@ InstallObjectModule(fbdev,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(fbdev,) InstallModuleManPage(fbdev) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c diff -u xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c:1.27 xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c:1.30 --- xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c:1.27 Wed Dec 6 10:35:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c Fri May 4 15:05:37 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.27 2000/12/06 15:35:18 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.c,v 1.30 2001/05/04 19:05:37 dawes Exp $ */ /* * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> @@ -15,11 +15,11 @@ #include "micmap.h" #include "colormapst.h" #include "xf86cmap.h" -#include "shadowfb.h" +#include "shadow.h" +#include "dgaproc.h" /* for visuals */ #include "fb.h" -#include "cfb24_32.h" #ifdef USE_AFB #include "afb.h" #endif @@ -48,16 +48,26 @@ /* -------------------------------------------------------------------- */ /* prototypes */ -static OptionInfoPtr FBDevAvailableOptions(int chipid, int busid); +static const OptionInfoRec * FBDevAvailableOptions(int chipid, int busid); static void FBDevIdentify(int flags); static Bool FBDevProbe(DriverPtr drv, int flags); static Bool FBDevPreInit(ScrnInfoPtr pScrn, int flags); static Bool FBDevScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv); static Bool FBDevCloseScreen(int scrnIndex, ScreenPtr pScreen); -static Bool FBDevSaveScreen(ScreenPtr pScreen, int mode); -static void FBDevDPMSSet(ScrnInfoPtr pScrn, int mode, int flags); +static void * FBDevWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, + CARD32 *size); +static Bool FBDevDGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen); + +#if 0 +static ShadowUpdateProc updateFuncs[] = + { shadowUpdatePacked, shadowUpdateRotate8, shadowUpdateRotUD8, shadowUpdateRotCCW8, + shadowUpdatePacked, shadowUpdateRotate16, shadowUpdateRotUD16, shadowUpdateRotCCW16, + shadowUpdatePacked, shadowUpdateRotate32, shadowUpdateRotUD32, shadowUpdateRotCCW32 }; +#endif + + /* -------------------------------------------------------------------- */ /* @@ -91,23 +101,23 @@ #ifdef USE_AFB { 0, "afb" }, #endif -#if 0 - { 0, "cfb8" }, - { 0, "cfb16" }, - { 0, "cfb24" }, - { 0, "cfb32" }, -#endif {-1, NULL } }; /* Supported options */ typedef enum { OPTION_SHADOW_FB, +#if 0 + OPTION_ROTATE, +#endif OPTION_FBDEV } FBDevOpts; -static OptionInfoRec FBDevOptions[] = { +static const OptionInfoRec FBDevOptions[] = { { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, +#if 0 + { OPTION_ROTATE, "Rotate", OPTV_STRING, {0}, FALSE }, +#endif { OPTION_FBDEV, "fbdev", OPTV_STRING, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -127,7 +137,9 @@ }; static const char *shadowSymbols[] = { - "ShadowFBInit", + "shadowAlloc", + "shadowInit", + "shadowUpdatePacked", NULL }; @@ -199,11 +211,18 @@ unsigned char* fbstart; unsigned char* fbmem; int fboff; + int lineLength; unsigned char* shadowmem; - int shadowPitch; +#if 0 + int rotate; +#endif Bool shadowFB; CloseScreenProcPtr CloseScreen; EntityInfoPtr pEnt; + /* DGA info */ + DGAModePtr pDGAMode; + int nDGAMode; + OptionInfoPtr Options; } FBDevRec, *FBDevPtr; #define FBDEVPTR(p) ((FBDevPtr)((p)->driverPrivate)) @@ -229,7 +248,7 @@ /* -------------------------------------------------------------------- */ -static OptionInfoPtr +static const OptionInfoRec * FBDevAvailableOptions(int chipid, int busid) { return FBDevOptions; @@ -346,7 +365,7 @@ { FBDevPtr fPtr; int default_depth; - char *mod = NULL; + char *mod = NULL, *s; const char *reqSym = NULL; Gamma zeros = {0.0, 0.0, 0.0}; @@ -420,12 +439,50 @@ /* handle options */ xf86CollectOptions(pScrn, NULL); - xf86ProcessOptions(pScrn->scrnIndex, fPtr->pEnt->device->options, FBDevOptions); - fPtr->shadowFB = xf86ReturnOptValBool(FBDevOptions, OPTION_SHADOW_FB, TRUE); - xf86DrvMsg(pScrn->scrnIndex, - xf86IsOptionSet(FBDevOptions, OPTION_SHADOW_FB) ? X_CONFIG : X_DEFAULT, - "Option ShadowFB is %s\n",fPtr->shadowFB ? "on" : "off"); + if (!(fPtr->Options = xalloc(sizeof(FBDevOptions)))) + return FALSE; + memcpy(fPtr->Options, FBDevOptions, sizeof(FBDevOptions)); + xf86ProcessOptions(pScrn->scrnIndex, fPtr->pEnt->device->options, fPtr->Options); + + /* use shadow framebuffer by default */ + fPtr->shadowFB = xf86ReturnOptValBool(fPtr->Options, OPTION_SHADOW_FB, TRUE); +#if 0 + /* rotation (doesn't work yet) */ + fPtr->rotate = 0; + if ((s = xf86GetOptValString(fPtr->Options, OPTION_ROTATE))) + { + if(!xf86NameCmp(s, "CW")) + { + fPtr->shadowFB = TRUE; + fPtr->rotate = 1; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen clockwise\n"); + } + else if(!xf86NameCmp(s, "CCW")) + { + fPtr->shadowFB = TRUE; + fPtr->rotate = 3; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen counter clockwise\n"); + } + else if(!xf86NameCmp(s, "UD")) + { + fPtr->shadowFB = TRUE; + fPtr->rotate = 2; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Rotating screen counter clockwise\n"); + } + else + { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "\"%s\" is not a valid value for Option \"Rotate\"\n", s); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Valid options are \"CW\", \"CCW\" or \"UD\"\n"); + } + } +#endif + /* select video modes */ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Checking Modes against framebuffer device...\n"); @@ -469,6 +526,7 @@ case FBDEVHW_PACKED_PIXELS: mod = "fb"; reqSym = "fbScreenInit"; + xf86LoaderReqSymbols("fbPictureInit", NULL); switch (pScrn->bitsPerPixel) { @@ -517,83 +575,31 @@ } xf86LoaderReqSymbols(reqSym, NULL); - /* Load shadowFB if needed */ + /* Load shadow if needed */ if (fPtr->shadowFB) { - if (!xf86LoadSubModule(pScrn, "shadowfb")) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using \"Shadow Framebuffer\"\n"); + if (!xf86LoadSubModule(pScrn, "shadow")) { FBDevFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("ShadowFBInit", NULL); + xf86LoaderReqSymLists(shadowSymbols, NULL); } TRACE_EXIT("PreInit"); return TRUE; } -/* for ShadowFB */ -static void -FBDevRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox) -{ - FBDevPtr fPtr = FBDEVPTR(pScrn); - int width, height, Bpp, FBPitch; - unsigned char *src, *dst; - - Bpp = pScrn->bitsPerPixel >> 3; - FBPitch = fbdevHWGetLineLength(pScrn); - - while(num--) { - width = (pbox->x2 - pbox->x1) * Bpp; - height = pbox->y2 - pbox->y1; - src = fPtr->shadowmem + (pbox->y1 * fPtr->shadowPitch) + - (pbox->x1 * Bpp); - dst = fPtr->fbmem + fPtr->fboff + (pbox->y1 * FBPitch) + (pbox->x1 * Bpp); - - while(height--) { - memcpy(dst, src, width); - dst += FBPitch; - src += fPtr->shadowPitch; - } - pbox++; - } -} - static Bool -FBDevSaveScreen(ScreenPtr pScreen, int mode) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - FBDevPtr fPtr = FBDEVPTR(pScrn); - BoxRec box; - Bool unblank; - - TRACE_ENTER("FBDevSaveScreen"); - if (!(fPtr->shadowFB)) - /* Not implemented yet - alloc huge memory block and copy ? */ - return TRUE; - - unblank = xf86IsUnblank(mode); - - if (unblank) { - box.x1 = 0; - box.x2 = pScrn->virtualX; - box.y1 = 0; - box.y2 = pScrn->virtualY; - FBDevRefreshArea(pScrn, 1, &box); - } else { - memset(fPtr->fbmem + fPtr->fboff, 0, - pScrn->virtualX * pScrn->virtualY * ((pScrn->bitsPerPixel+7)/8)); - } - return TRUE; -} - -static Bool FBDevScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; FBDevPtr fPtr = FBDEVPTR(pScrn); VisualPtr visual; - int ret,flags; + int ret,flags,width,height; + ShadowUpdateProc fun; TRACE_ENTER("FBDevScreenInit"); + #if DEBUG ErrorF("\tbitsPerPixel=%d, depth=%d, defaultVisual=%s\n" "\tmask: %x,%x,%x, offset: %d,%d,%d\n", @@ -612,6 +618,8 @@ if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; + + fbdevHWSaveScreen(pScreen, SCREEN_SAVER_ON); fbdevHWAdjustFrame(scrnIndex,0,0,0); /* mi layer */ @@ -625,12 +633,28 @@ pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; } + if (!miSetPixmapDepths()) + return FALSE; +#if 0 + if(fPtr->rotate==3 || fPtr->rotate==1) + { + height = pScrn->virtualX; + width = pScrn->virtualY; + } else { +#endif + height = pScrn->virtualY; + width = pScrn->virtualX; +#if 0 + } +#endif + /* shadowfb */ if (fPtr->shadowFB) { - fPtr->shadowPitch = - ((pScrn->virtualX * pScrn->bitsPerPixel >> 3) + 3) & ~3L; - fPtr->shadowmem = xalloc(fPtr->shadowPitch * pScrn->virtualY); + if ((fPtr->shadowmem = shadowAlloc(width, height, + pScrn->bitsPerPixel)) == NULL) + return FALSE; + fPtr->fbstart = fPtr->shadowmem; } else { fPtr->shadowmem = NULL; @@ -641,6 +665,22 @@ { #ifdef USE_AFB case FBDEVHW_PLANES: +#if 0 + if (fPtr->rotate) + { + xf86DrvMsg(scrnIndex, X_ERROR, + "Internal error: Rotate not supported for afb\n"); + ret = FALSE; + break; + } +#endif + if (fPtr->shadowFB) + { + xf86DrvMsg(scrnIndex, X_ERROR, + "Internal error: Shadwo framebuffer not supported for afb\n"); + ret = FALSE; + break; + } ret = afbScreenInit (pScreen, fPtr->fbstart, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth); @@ -652,16 +692,18 @@ if (pix24bpp == 32) { ret = cfb24_32ScreenInit - (pScreen, fPtr->fbstart, pScrn->virtualX, pScrn->virtualY, + (pScreen, fPtr->fbstart, width, height, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth); break; } case 8: case 16: case 32: - ret = fbScreenInit - (pScreen, fPtr->fbstart, pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel); + ret = fbScreenInit(pScreen, fPtr->fbstart, width, height, + pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel); + if (ret && !fbPictureInit(pScreen, NULL, 0)) + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "RENDER extension initialisation failed.\n"); break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -719,6 +761,36 @@ } } +#if 0 + switch (pScrn->bitsPerPixel) + { + case 8: + case 16: + case 32: +#endif + if (fPtr->shadowFB && + !shadowInit(pScreen, shadowUpdatePacked, /*updateFuncs[fPtr->rotate + (pScrn->bitsPerPixel/4 & 0xc)],*/ + FBDevWindowLinear)) + return FALSE; +#if 0 + break; + default: + if (fPtr->rotate) + xf86DrvMsg(scrnIndex, X_ERROR, + "Internal error: rotate not supported for %dbpp.\n", + pScrn->bitsPerPixel); + return FALSE; + } + + if (!fPtr->rotate) +#endif + FBDevDGAInit(pScrn, pScreen); +#if 0 + else + xf86DrvMsg(scrnIndex, X_WARNING, + "Rotated display, disabling DGA\n"); +#endif + xf86SetBlackWhitePixels(pScreen); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -726,9 +798,6 @@ /* software cursor */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - if(fPtr->shadowFB) - ShadowFBInit(pScreen, FBDevRefreshArea); - /* colormap */ switch (fbdevHWGetType(pScrn)) { @@ -767,11 +836,9 @@ if(!xf86HandleColormaps(pScreen, 256, 8, fbdevHWLoadPalette, NULL, flags)) return FALSE; -#ifdef DPMSExtension - xf86DPMSInit(pScreen, FBDevDPMSSet, 0); -#endif + xf86DPMSInit(pScreen, fbdevHWDPMSSet, 0); - pScreen->SaveScreen = FBDevSaveScreen; + pScreen->SaveScreen = fbdevHWSaveScreen; /* Wrap the current CloseScreen function */ fPtr->CloseScreen = pScreen->CloseScreen; @@ -788,9 +855,8 @@ } #endif -#if DEBUG - ErrorF("FBDevScreenInit done\n",pScrn->scrnIndex); -#endif + TRACE_EXIT("FBDevScreenInit"); + return TRUE; } @@ -804,17 +870,169 @@ fbdevHWUnmapVidmem(pScrn); if (fPtr->shadowmem) xfree(fPtr->shadowmem); + if (fPtr->pDGAMode) + xfree(fPtr->pDGAMode); pScrn->vtSema = FALSE; pScreen->CloseScreen = fPtr->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } +static void * +FBDevWindowLinear(ScreenPtr pScreen, CARD32 row, CARD32 offset, int mode, + CARD32 *size) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + FBDevPtr fPtr = FBDEVPTR(pScrn); + + if (fPtr->lineLength) + *size = fPtr->lineLength; + else + *size = fPtr->lineLength = fbdevHWGetLineLength(pScrn); + + return ((CARD8 *)fPtr->fbmem + fPtr->fboff + row * fPtr->lineLength + offset); +} + + +/*********************************************************************** + * DGA stuff + ***********************************************************************/ +static Bool FBDevDGAOpenFramebuffer(ScrnInfoPtr pScrn, char **DeviceName, + unsigned char **ApertureBase, + int *ApertureSize, int *ApertureOffset, + int *flags); +static Bool FBDevDGASetMode(ScrnInfoPtr pScrn, DGAModePtr pDGAMode); +static void FBDevDGASetViewport(ScrnInfoPtr pScrn, int x, int y, int flags); + +static Bool +FBDevDGAOpenFramebuffer(ScrnInfoPtr pScrn, char **DeviceName, + unsigned char **ApertureBase, int *ApertureSize, + int *ApertureOffset, int *flags) +{ + *DeviceName = NULL; /* No special device */ + *ApertureBase = (unsigned char *)(pScrn->memPhysBase); + *ApertureSize = pScrn->videoRam; + *ApertureOffset = pScrn->fbOffset; + *flags = 0; + + return TRUE; +} + +static Bool +FBDevDGASetMode(ScrnInfoPtr pScrn, DGAModePtr pDGAMode) +{ + DisplayModePtr pMode; + int scrnIdx = pScrn->pScreen->myNum; + int frameX0, frameY0; + + if (pDGAMode) { + pMode = pDGAMode->mode; + frameX0 = frameY0 = 0; + } + else { + if (!(pMode = pScrn->currentMode)) + return TRUE; + + frameX0 = pScrn->frameX0; + frameY0 = pScrn->frameY0; + } + + if (!(*pScrn->SwitchMode)(scrnIdx, pMode, 0)) + return FALSE; + (*pScrn->AdjustFrame)(scrnIdx, frameX0, frameY0, 0); + + return TRUE; +} -#ifdef DPMSExtension static void -FBDevDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) +FBDevDGASetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) { - fbdevHWDPMSSet(pScrn, mode, flags); + (*pScrn->AdjustFrame)(pScrn->pScreen->myNum, x, y, flags); } -#endif + +static int +FBDevDGAGetViewport(ScrnInfoPtr pScrn) +{ + return (0); +} + +static DGAFunctionRec FBDevDGAFunctions = +{ + FBDevDGAOpenFramebuffer, + NULL, /* CloseFramebuffer */ + FBDevDGASetMode, + FBDevDGASetViewport, + FBDevDGAGetViewport, + NULL, /* Sync */ + NULL, /* FillRect */ + NULL, /* BlitRect */ + NULL, /* BlitTransRect */ +}; + +static void +FBDevDGAAddModes(ScrnInfoPtr pScrn) +{ + FBDevPtr fPtr = FBDEVPTR(pScrn); + DisplayModePtr pMode = pScrn->modes; + DGAModePtr pDGAMode; + + do { + pDGAMode = xrealloc(fPtr->pDGAMode, + (fPtr->nDGAMode + 1) * sizeof(DGAModeRec)); + if (!pDGAMode) + break; + + fPtr->pDGAMode = pDGAMode; + pDGAMode += fPtr->nDGAMode; + (void)memset(pDGAMode, 0, sizeof(DGAModeRec)); + + ++fPtr->nDGAMode; + pDGAMode->mode = pMode; + pDGAMode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; + pDGAMode->byteOrder = pScrn->imageByteOrder; + pDGAMode->depth = pScrn->depth; + pDGAMode->bitsPerPixel = pScrn->bitsPerPixel; + pDGAMode->red_mask = pScrn->mask.red; + pDGAMode->green_mask = pScrn->mask.green; + pDGAMode->blue_mask = pScrn->mask.blue; + pDGAMode->visualClass = pScrn->bitsPerPixel > 8 ? + TrueColor : PseudoColor; + pDGAMode->xViewportStep = 1; + pDGAMode->yViewportStep = 1; + pDGAMode->viewportWidth = pMode->HDisplay; + pDGAMode->viewportHeight = pMode->VDisplay; + + if (fPtr->lineLength) + pDGAMode->bytesPerScanline = fPtr->lineLength; + else + pDGAMode->bytesPerScanline = fPtr->lineLength = fbdevHWGetLineLength(pScrn); + + pDGAMode->imageWidth = pMode->HDisplay; + pDGAMode->imageHeight = pMode->VDisplay; + pDGAMode->pixmapWidth = pDGAMode->imageWidth; + pDGAMode->pixmapHeight = pDGAMode->imageHeight; + pDGAMode->maxViewportX = pScrn->virtualX - + pDGAMode->viewportWidth; + pDGAMode->maxViewportY = pScrn->virtualY - + pDGAMode->viewportHeight; + + pDGAMode->address = fPtr->fbstart; + + pMode = pMode->next; + } while (pMode != pScrn->modes); +} + +static Bool +FBDevDGAInit(ScrnInfoPtr pScrn, ScreenPtr pScreen) +{ + FBDevPtr fPtr = FBDEVPTR(pScrn); + + if (pScrn->depth < 8) + return FALSE; + + if (!fPtr->nDGAMode) + FBDevDGAAddModes(pScrn); + + return (DGAInit(pScreen, &FBDevDGAFunctions, + fPtr->pDGAMode, fPtr->nDGAMode)); +} Index: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.cpp:1.10 xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.cpp:1.10 Mon Dec 11 17:40:25 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.cpp Mon Jun 4 12:40:50 2001 @@ -1,58 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.cpp,v 1.10 2000/12/11 22:40:25 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH FBDEV __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -fbdev \- video driver for framebuffer device -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qfbdev\*q" -.BI " BusID \*qpci:" bus : dev : func \*q -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B fbdev -is an XFree86 driver for framebuffer devices. This is a non-accelerated -driver, the following framebuffer depths are supported: 8, 15, 16, 24. -All visual types are supported for depth 8, and TrueColor visual is -supported for the other depths. Multi-head configurations are supported. -.SH SUPPORTED HARDWARE -The -.B fbdev -driver supports all hardware where a framebuffer driver is available. -fbdev uses the os-specific submodule fbdevhw(__drivermansuffix__) to talk -to the kernel -device driver. Currently a fbdevhw module is available for linux. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to -this driver. -.PP -For this driver it is not required to specify modes in the screen -section of the config file. The -.B fbdev -driver can pick up the currently used video mode from the framebuffer -driver and will use it if there are no video modes configured. -.PP -For PCI boards you might have to add a BusID line to the Device -section. See above for a sample line. You can use "XFree86 -scanpci" -to figure out the correct values. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qfbdev\*q \*q" string \*q -The framebuffer device to use. Default: /dev/fb0. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: on. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), -X(__miscmansuffix__), fbdevhw(__drivermansuffix__) -.SH AUTHORS -Authors include: Gerd Knorr, Michel Dänzer, Geert Uytterhoeven Index: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.man:1.2 --- /dev/null Mon Jun 4 12:40:50 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.man Sat Jan 27 13:20:47 2001 @@ -0,0 +1,58 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/fbdev/fbdev.man,v 1.2 2001/01/27 18:20:47 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH FBDEV __drivermansuffix__ __vendorversion__ +.SH NAME +fbdev \- video driver for framebuffer device +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qfbdev\*q" +.BI " BusID \*qpci:" bus : dev : func \*q +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B fbdev +is an XFree86 driver for framebuffer devices. This is a non-accelerated +driver, the following framebuffer depths are supported: 8, 15, 16, 24. +All visual types are supported for depth 8, and TrueColor visual is +supported for the other depths. Multi-head configurations are supported. +.SH SUPPORTED HARDWARE +The +.B fbdev +driver supports all hardware where a framebuffer driver is available. +fbdev uses the os-specific submodule fbdevhw(__drivermansuffix__) to talk +to the kernel +device driver. Currently a fbdevhw module is available for linux. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to +this driver. +.PP +For this driver it is not required to specify modes in the screen +section of the config file. The +.B fbdev +driver can pick up the currently used video mode from the framebuffer +driver and will use it if there are no video modes configured. +.PP +For PCI boards you might have to add a BusID line to the Device +section. See above for a sample line. You can use "XFree86 -scanpci" +to figure out the correct values. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qfbdev\*q \*q" string \*q +The framebuffer device to use. Default: /dev/fb0. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. See +shadowfb(__drivermansuffix__) for further information. Default: on. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), +X(__miscmansuffix__), fbdevhw(__drivermansuffix__) +.SH AUTHORS +Authors include: Gerd Knorr, Michel Dänzer, Geert Uytterhoeven Index: xc/programs/Xserver/hw/xfree86/drivers/glide/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/glide/Imakefile:1.5 xc/programs/Xserver/hw/xfree86/drivers/glide/Imakefile:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/glide/Imakefile:1.5 Sat Oct 21 21:41:58 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glide/Imakefile Wed May 16 02:48:08 2001 @@ -1,7 +1,7 @@ XCOMM XCOMM This is an Imakefile for the glide driver. XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/Imakefile,v 1.5 2000/10/22 01:41:58 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/Imakefile,v 1.7 2001/05/16 06:48:08 keithp Exp $ #define IHaveModules #include <Server.tmpl> @@ -22,8 +22,8 @@ INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(GLIDE2INCDIR) -I$(XF86COMSRC) -I$(XF86OSSRC) \ - -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ - -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa \ + -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ + -I$(XF86SRC)/xaa \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ -I$(SERVERSRC)/Xext -I$(XF86SRC)/xf8_32bpp\ @@ -42,7 +42,6 @@ InstallObjectModule(glide,$(MODULEDIR),drivers) -CppManTarget(glide,) InstallModuleManPage(glide) DependTarget() Index: xc/programs/Xserver/hw/xfree86/drivers/glide/glide.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/glide/glide.cpp:1.11 xc/programs/Xserver/hw/xfree86/drivers/glide/glide.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/glide/glide.cpp:1.11 Mon Dec 11 15:18:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glide/glide.cpp Mon Jun 4 12:40:50 2001 @@ -1,298 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/glide.cpp,v 1.11 2000/12/11 20:18:12 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH GLIDE __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -glide \- Glide video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qglide\*q" -\ \ ... -.B EndSection -.fi -.SH READ THIS IF NOTHING ELSE -This driver has a special requirement that needs to be fulfilled -before it will work: You need Glide installed and you need to make a link for the libglide2x.so -file. Read the second paragraph in the description below to find out how. -.SH DESCRIPTION -.B glide -is an XFree86 driver for Glide capable video boards (such as 3Dfx -Voodoo boards). This driver is mainly for Voodoo 1 and Voodoo 2 boards, later -boards from 3Dfx have 2D built-in and you should preferably use a driver separate for -those boards or the fbdev(__drivermansuffix__) driver. -This driver is a bit special because Voodoo 1 and 2 boards are -very much NOT made for running 2D graphics. Therefore, this driver -uses no hardware acceleration (since there is no acceleration for 2D, -only 3D). Instead it is implemented with the help of a "shadow" -framebuffer that resides entirely in RAM. Selected portions of this -shadow framebuffer are then copied out to the Voodoo board at the right -time. Because of this, the speed of the driver is very dependent on -the CPU. But since the CPU is nowadays actually rather fast at moving -data, we get very good speed anyway, especially since the whole shadow -framebuffer is in cached RAM. -.PP -This driver requires that you have installed Glide. (Which can, at the -time of this writing, be found at -http://glide.xxedgexx.com/3DfxRPMS.html). Also, you need to tell -XFree86 where the libglide2x.so file is placed by making a soft link -in the /usr/X11R6/lib/modules directory that points to the libglide2x.so -file. For example (if your libglide2x.so file is in /usr/lib): -.PP - # ln -s /usr/lib/libglide2x.so /usr/X11R6/lib/modules -.PP -If you have installed /dev/3dfx, the driver will be able to turn on -the MTRR registers (through the glide library) if you have a CPU with -such registers (see http://glide.xxedgexx.com/MTRR.html). This will -speed up copying data to the Voodoo board by as much as 2.7 times and -is very noticeable since this driver copies a lot of -data... Highly recommended. -.PP -This driver supports 16 and 24 bit color modes. The 24 bit color mode -uses a 32 bit framebuffer (it has no support for 24 bit packed-pixel -framebuffers). Notice that the Voodoo boards can only display 16 bit -color, but the shadow framebuffer can be run in 24 bit color. The -point of supporting 24 bit mode is that this enables you to run in a -multihead configuration with Xinerama together with another board that -runs in real 24 bit color mode. (All boards must run the same color -depth when you use Xinerama). -.PP -Resolutions supported are: 640x480, 800x600, 960x720, 1024x768, -1280x1024 and 1600x1200. Note that not all modes will work on all -Voodoo boards. It seems that Voodoo 2 boards support no higher than -1024x768 and Voodoo 1 boards can go to 800x600. If you see a message like this in the output from the server: -.PP - (EE) GLIDE(0): grSstWinOpen returned ... -.PP -Then you are probably trying to use a resolution that is supported by -the driver but not supported by the hardware. -.PP -Refresh rates supported are: 60Hz, 75Hz and 85Hz. The refresh rate -used is derived from the normal mode line according -to the following table: -.TP 28 -Mode-line refresh rate -Used refresh rate -.TP 28 - 0-74 Hz - 60 Hz -.TP 28 - 74-84 Hz - 75 Hz -.TP 28 - 84- Hz - 85 Hz -.PP -Thus, if you use a modeline that for example has a 70Hz refresh rate -you will only get a 60Hz refresh rate in actuality. -.PP -Selecting which Voodoo board to use with the driver is done by using -an option called "GlideDevice" in the "Device" section. (If you don't -have this option present then the first board found will be selected for that Device section). For -example: To use the first Voodoo board, use a "Device" section like -this, for example: -.PP -Section "Device" -.br - Identifier "Voodoo" -.br - Driver "glide" -.br - Option "dpms" "on" -.br - Option "GlideDevice" "0" -.br -EndSection -.PP -And if you have more than one Voodoo board, add another "Device" -section with a GlideDevice option with value 1, and so on. (You can use more than one -Voodoo board, but SLI configured boards will be treated as a single board.) -.PP -Multihead and Xinerama configurations are supported. -.PP -Limited support for DPMS screen saving is available. The "standby" and -"suspend" modes are just painting the screen black. The "off" mode turns -the Voodoo board off and thus works correctly. -.PP -This driver does not support a virtual screen size different from the display size. -.SH SUPPORTED HARDWARE -The -.B glide -driver supports any board that can be used with Glide (such as 3Dfx Voodoo boards) -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qOnAtExit\*q \*q" boolean \*q -If true, will leave the Voodoo board on when the server exits. Useful in a multihead setup when -only the Voodoo board is connected to a second monitor and you don't want that monitor to lose -signal when you quit the server. Put this option in the Device section. -Default: off. -.TP -.BI "Option \*qGlideDevice\*q \*q" integer \*q -Selects which Voodoo board to use. (Or boards, in an SLI configuration). -The value should be 0 for the first board, 1 for the second and so on. -If it is not present, the first Voodoo board found will be selected. -Put this option in the Device section. -.SH "EXAMPLE" -Here is an example of a part of an XF86Config file that uses a multihead -configuration with two monitors. The first monitor is driven by the -fbdev video driver and the second monitor is driven by the glide -driver. -.PP -.br -Section "Monitor" -.br - Identifier "Monitor 1" -.br - VendorName "Unknown" -.br - ModelName "Unknown" -.br - HorizSync 30-70 -.br - VertRefresh 50-80 -.br - -.br - # 1024x768 @ 76 Hz, 62.5 kHz hsync -.br - Modeline "1024x768" 85 1024 1032 1152 1360 768 784 787 823 -.br -EndSection -.br - -.br -Section "Monitor" -.br - Identifier "Monitor 2" -.br - VendorName "Unknown" -.br - ModelName "Unknown" -.br - HorizSync 30-70 -.br - VertRefresh 50-80 -.br - -.br - # 1024x768 @ 76 Hz, 62.5 kHz hsync -.br - Modeline "1024x768" 85 1024 1032 1152 1360 768 784 787 823 -.br -EndSection -.br - -.br -Section "Device" -.br - Identifier "fb" -.br - Driver "fbdev" -.br - Option "shadowfb" -.br - Option "dpms" "on" -.br - # My video card is on the AGP bus which is usually -.br - # located as PCI bus 1, device 0, function 0. -.br - BusID "PCI:1:0:0" -.br -EndSection -.br - -.br -Section "Device" -.br - # I have a Voodoo 2 board -.br - Identifier "Voodoo" -.br - Driver "glide" -.br - Option "dpms" "on" -.br - # The next line says I want to use the first board. -.br - Option "GlideDevice" "0" -.br -EndSection -.br - -.br -Section "Screen" -.br - Identifier "Screen 1" -.br - Device "fb" -.br - Monitor "Monitor 1" -.br - DefaultDepth 16 -.br - Subsection "Display" -.br - Depth 16 -.br - Modes "1024x768" -.br - EndSubSection -.br -EndSection -.br - -.br -Section "Screen" -.br - Identifier "Screen 2" -.br - Device "Voodoo" -.br - Monitor "Monitor 2" -.br - DefaultDepth 16 -.br - Subsection "Display" -.br - Depth 16 -.br - Modes "1024x768" -.br - EndSubSection -.br -EndSection -.br - -.br -Section "ServerLayout" -.br - Identifier "Main Layout" -.br - # Screen 1 is to the right and screen 2 is to the left -.br - Screen "Screen 2" -.br - Screen "Screen 1" "" "" "Screen 2" "" -.br -EndSection -.PP -If you use this configuration file and start the server with the -+xinerama command line option, the two monitors will be showing a -single large area where windows can be moved between monitors and -overlap from one monitor to the other. Starting the X server with the -Xinerama extension can be done for example like this: -.PP -$ xinit -- +xinerama -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Author: Henrik Harmsen. Index: xc/programs/Xserver/hw/xfree86/drivers/glide/glide.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/glide/glide.man:1.3 --- /dev/null Mon Jun 4 12:40:50 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glide/glide.man Wed Feb 7 17:51:56 2001 @@ -0,0 +1,298 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/glide.man,v 1.3 2001/02/07 22:51:56 tsi Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH GLIDE __drivermansuffix__ __vendorversion__ +.SH NAME +glide \- Glide video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qglide\*q" +\ \ ... +.B EndSection +.fi +.SH READ THIS IF NOTHING ELSE +This driver has a special requirement that needs to be fulfilled +before it will work: You need Glide installed and you need to make a link for the libglide2x.so +file. Read the second paragraph in the description below to find out how. +.SH DESCRIPTION +.B glide +is an XFree86 driver for Glide capable video boards (such as 3Dfx +Voodoo boards). This driver is mainly for Voodoo 1 and Voodoo 2 boards, later +boards from 3Dfx have 2D built-in and you should preferably use a driver separate for +those boards or the fbdev(__drivermansuffix__) driver. +This driver is a bit special because Voodoo 1 and 2 boards are +very much NOT made for running 2D graphics. Therefore, this driver +uses no hardware acceleration (since there is no acceleration for 2D, +only 3D). Instead it is implemented with the help of a "shadow" +framebuffer that resides entirely in RAM. Selected portions of this +shadow framebuffer are then copied out to the Voodoo board at the right +time. Because of this, the speed of the driver is very dependent on +the CPU. But since the CPU is nowadays actually rather fast at moving +data, we get very good speed anyway, especially since the whole shadow +framebuffer is in cached RAM. +.PP +This driver requires that you have installed Glide. (Which can, at the +time of this writing, be found at +http://glide.xxedgexx.com/3DfxRPMS.html). Also, you need to tell +XFree86 where the libglide2x.so file is placed by making a soft link +in the /usr/X11R6/lib/modules directory that points to the libglide2x.so +file. For example (if your libglide2x.so file is in /usr/lib): +.PP +\& # ln -s /usr/lib/libglide2x.so /usr/X11R6/lib/modules +.PP +If you have installed /dev/3dfx, the driver will be able to turn on +the MTRR registers (through the glide library) if you have a CPU with +such registers (see http://glide.xxedgexx.com/MTRR.html). This will +speed up copying data to the Voodoo board by as much as 2.7 times and +is very noticeable since this driver copies a lot of +data... Highly recommended. +.PP +This driver supports 16 and 24 bit color modes. The 24 bit color mode +uses a 32 bit framebuffer (it has no support for 24 bit packed-pixel +framebuffers). Notice that the Voodoo boards can only display 16 bit +color, but the shadow framebuffer can be run in 24 bit color. The +point of supporting 24 bit mode is that this enables you to run in a +multihead configuration with Xinerama together with another board that +runs in real 24 bit color mode. (All boards must run the same color +depth when you use Xinerama). +.PP +Resolutions supported are: 640x480, 800x600, 960x720, 1024x768, +1280x1024 and 1600x1200. Note that not all modes will work on all +Voodoo boards. It seems that Voodoo 2 boards support no higher than +1024x768 and Voodoo 1 boards can go to 800x600. If you see a message like this in the output from the server: +.PP + (EE) GLIDE(0): grSstWinOpen returned ... +.PP +Then you are probably trying to use a resolution that is supported by +the driver but not supported by the hardware. +.PP +Refresh rates supported are: 60Hz, 75Hz and 85Hz. The refresh rate +used is derived from the normal mode line according +to the following table: +.TP 28 +Mode-line refresh rate +Used refresh rate +.TP 28 + 0-74 Hz + 60 Hz +.TP 28 + 74-84 Hz + 75 Hz +.TP 28 + 84- Hz + 85 Hz +.PP +Thus, if you use a modeline that for example has a 70Hz refresh rate +you will only get a 60Hz refresh rate in actuality. +.PP +Selecting which Voodoo board to use with the driver is done by using +an option called "GlideDevice" in the "Device" section. (If you don't +have this option present then the first board found will be selected for that Device section). For +example: To use the first Voodoo board, use a "Device" section like +this, for example: +.PP +Section "Device" +.br + Identifier "Voodoo" +.br + Driver "glide" +.br + Option "dpms" "on" +.br + Option "GlideDevice" "0" +.br +EndSection +.PP +And if you have more than one Voodoo board, add another "Device" +section with a GlideDevice option with value 1, and so on. (You can use more than one +Voodoo board, but SLI configured boards will be treated as a single board.) +.PP +Multihead and Xinerama configurations are supported. +.PP +Limited support for DPMS screen saving is available. The "standby" and +"suspend" modes are just painting the screen black. The "off" mode turns +the Voodoo board off and thus works correctly. +.PP +This driver does not support a virtual screen size different from the display size. +.SH SUPPORTED HARDWARE +The +.B glide +driver supports any board that can be used with Glide (such as 3Dfx Voodoo boards) +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qOnAtExit\*q \*q" boolean \*q +If true, will leave the Voodoo board on when the server exits. Useful in a multihead setup when +only the Voodoo board is connected to a second monitor and you don't want that monitor to lose +signal when you quit the server. Put this option in the Device section. +Default: off. +.TP +.BI "Option \*qGlideDevice\*q \*q" integer \*q +Selects which Voodoo board to use. (Or boards, in an SLI configuration). +The value should be 0 for the first board, 1 for the second and so on. +If it is not present, the first Voodoo board found will be selected. +Put this option in the Device section. +.SH "EXAMPLE" +Here is an example of a part of an XF86Config file that uses a multihead +configuration with two monitors. The first monitor is driven by the +fbdev video driver and the second monitor is driven by the glide +driver. +.PP +.br +Section "Monitor" +.br + Identifier "Monitor 1" +.br + VendorName "Unknown" +.br + ModelName "Unknown" +.br + HorizSync 30-70 +.br + VertRefresh 50-80 +.br + +.br +\& # 1024x768 @ 76 Hz, 62.5 kHz hsync +.br + Modeline "1024x768" 85 1024 1032 1152 1360 768 784 787 823 +.br +EndSection +.br + +.br +Section "Monitor" +.br + Identifier "Monitor 2" +.br + VendorName "Unknown" +.br + ModelName "Unknown" +.br + HorizSync 30-70 +.br + VertRefresh 50-80 +.br + +.br +\& # 1024x768 @ 76 Hz, 62.5 kHz hsync +.br + Modeline "1024x768" 85 1024 1032 1152 1360 768 784 787 823 +.br +EndSection +.br + +.br +Section "Device" +.br + Identifier "fb" +.br + Driver "fbdev" +.br + Option "shadowfb" +.br + Option "dpms" "on" +.br +\& # My video card is on the AGP bus which is usually +.br +\& # located as PCI bus 1, device 0, function 0. +.br + BusID "PCI:1:0:0" +.br +EndSection +.br + +.br +Section "Device" +.br +\& # I have a Voodoo 2 board +.br + Identifier "Voodoo" +.br + Driver "glide" +.br + Option "dpms" "on" +.br +\& # The next line says I want to use the first board. +.br + Option "GlideDevice" "0" +.br +EndSection +.br + +.br +Section "Screen" +.br + Identifier "Screen 1" +.br + Device "fb" +.br + Monitor "Monitor 1" +.br + DefaultDepth 16 +.br + Subsection "Display" +.br + Depth 16 +.br + Modes "1024x768" +.br + EndSubSection +.br +EndSection +.br + +.br +Section "Screen" +.br + Identifier "Screen 2" +.br + Device "Voodoo" +.br + Monitor "Monitor 2" +.br + DefaultDepth 16 +.br + Subsection "Display" +.br + Depth 16 +.br + Modes "1024x768" +.br + EndSubSection +.br +EndSection +.br + +.br +Section "ServerLayout" +.br + Identifier "Main Layout" +.br +\& # Screen 1 is to the right and screen 2 is to the left +.br + Screen "Screen 2" +.br + Screen "Screen 1" "" "" "Screen 2" "" +.br +EndSection +.PP +If you use this configuration file and start the server with the ++xinerama command line option, the two monitors will be showing a +single large area where windows can be moved between monitors and +overlap from one monitor to the other. Starting the X server with the +Xinerama extension can be done for example like this: +.PP +$ xinit -- +xinerama +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Author: Henrik Harmsen. Index: xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c:1.19 Sat Dec 2 10:30:38 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c Wed May 16 02:48:08 2001 @@ -45,7 +45,7 @@ * Support static loading. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c,v 1.19 2000/12/02 15:30:38 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glide/glide_driver.c,v 1.24 2001/05/16 06:48:08 keithp Exp $ */ #include "xaa.h" #include "xf86Cursor.h" @@ -57,16 +57,10 @@ #include "mibstore.h" #include "micmap.h" #include "xf86DDC.h" -#ifdef DPMSExtension #include "globals.h" #define DPMS_SERVER #include "extensions/dpms.h" -#endif -#define PSZ 8 /* needed for cfb.h */ -#include "cfb.h" -#undef PSZ -#include "cfb16.h" -#include "cfb32.h" +#include "fb.h" #include "xf86cmap.h" #include "shadowfb.h" @@ -128,6 +122,7 @@ Bool OnAtExit; Bool GlideInitiated; EntityInfoPtr pEnt; + OptionInfoPtr Options; } GLIDERec, *GLIDEPtr; static pgrSstQueryBoards_t pgrSstQueryBoards; @@ -142,7 +137,7 @@ static pgrGlideShutdown_t pgrGlideShutdown; static pgrLfbWriteRegion_t pgrLfbWriteRegion; -static OptionInfoPtr GLIDEAvailableOptions(int chipid, int busid); +static const OptionInfoRec * GLIDEAvailableOptions(int chipid, int busid); static void GLIDEIdentify(int flags); static Bool GLIDEProbe(DriverPtr drv, int flags); static Bool GLIDEPreInit(ScrnInfoPtr pScrn, int flags); @@ -157,11 +152,9 @@ static void GLIDERestore(ScrnInfoPtr pScrn, Bool Closing); static void GLIDERefreshAll(ScrnInfoPtr pScrn); -#ifdef DPMSExtension static void GLIDEDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif static int LoadGlide(void); @@ -184,9 +177,6 @@ DriverRec GLIDE = { VERSION, GLIDE_DRIVER_NAME, -#if 0 - "driver for Glide devices (Voodoo cards)", -#endif GLIDEIdentify, GLIDEProbe, GLIDEAvailableOptions, @@ -199,7 +189,7 @@ OPTION_GLIDEDEVICE } GLIDEOpts; -static OptionInfoRec GLIDEOptions[] = { +static const OptionInfoRec GLIDEOptions[] = { { OPTION_ON_AT_EXIT, "OnAtExit", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_GLIDEDEVICE, "GlideDevice", OPTV_INTEGER, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } @@ -221,10 +211,11 @@ * unresolved symbols that are not required. */ -static const char *cfbSymbols[] = { - "cfbScreenInit", - "cfb16ScreenInit", - "cfb32ScreenInit", +static const char *fbSymbols[] = { + "fbScreenInit", +#ifdef RENDER + "fbPictureInit", +#endif NULL }; @@ -262,6 +253,12 @@ /* This module should be loaded only once, but check to be sure. */ + if (xf86ServerIsOnlyDetecting()) + { + xf86AddDriver(&GLIDE, module, 0); + return (pointer)1; + } + if (!setupDone) { /* @@ -308,7 +305,7 @@ * Tell the loader about symbols from other modules that this module * might refer to. */ - LoaderRefSymLists(cfbSymbols, shadowSymbols, NULL); + LoaderRefSymLists(fbSymbols, shadowSymbols, NULL); /* * The return value must be non-NULL on success even though there @@ -353,8 +350,7 @@ } -static -OptionInfoPtr +static const OptionInfoRec * GLIDEAvailableOptions(int chipid, int busid) { return GLIDEOptions; @@ -457,8 +453,6 @@ MessageType from; int i; ClockRangePtr clockRanges; - char *mod = NULL; - const char *reqSym = NULL; int sst; if (flags & PROBE_DETECT) return FALSE; @@ -545,11 +539,14 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, GLIDEOptions); + if (!(pGlide->Options = xalloc(sizeof(GLIDEOptions)))) + return FALSE; + memcpy(pGlide->Options, GLIDEOptions, sizeof(GLIDEOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pGlide->Options); pGlide->OnAtExit = FALSE; from = X_DEFAULT; - if (xf86GetOptValBool(GLIDEOptions, OPTION_ON_AT_EXIT, &(pGlide->OnAtExit))) + if (xf86GetOptValBool(pGlide->Options, OPTION_ON_AT_EXIT, &(pGlide->OnAtExit))) from = X_CONFIG; xf86DrvMsg(pScrn->scrnIndex, from, @@ -637,24 +634,14 @@ /* Set display resolution */ xf86SetDpi(pScrn, 0, 0); - - /* Load bpp-specific modules */ - switch (pScrn->bitsPerPixel) { - case 16: - mod = "cfb16"; - reqSym = "cfb16ScreenInit"; - break; - case 32: - mod = "cfb32"; - reqSym = "cfb32ScreenInit"; - break; - } - if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { + + /* Load fb */ + if (xf86LoadSubModule(pScrn, "fb") == NULL) { GLIDEFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols(reqSym, NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); /* Load the shadow framebuffer */ if (!xf86LoadSubModule(pScrn, "shadowfb")) { @@ -695,7 +682,7 @@ * function. If not, the visuals will need to be setup before calling * a fb ScreenInit() function and fixed up after. * - * For most PC hardware at depths >= 8, the defaults that cfb uses + * For most PC hardware at depths >= 8, the defaults that fb uses * are not appropriate. In this driver, we fixup the visuals after. */ @@ -708,36 +695,29 @@ if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; + miSetPixmapDepths (); + pGlide->ShadowPitch = ((pScrn->virtualX * pScrn->bitsPerPixel >> 3) + 3) & ~3L; pGlide->ShadowPtr = xnfalloc(pGlide->ShadowPitch * pScrn->virtualY); + /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. */ - switch (pScrn->bitsPerPixel) { - case 16: - ret = cfb16ScreenInit(pScreen, pGlide->ShadowPtr, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; - case 32: - ret = cfb32ScreenInit(pScreen, pGlide->ShadowPtr, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Internal error: invalid bpp (%d) in GLIDEScreenInit\n", - pScrn->bitsPerPixel); - ret = FALSE; - break; - } + ret = fbScreenInit(pScreen, pGlide->ShadowPtr, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, + pScrn->bitsPerPixel); + if (!ret) return FALSE; +#ifdef RENDER + fbPictureInit (pScreen, 0, 0); +#endif + /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; while (--visual >= pScreen->visuals) { @@ -765,9 +745,7 @@ ShadowFBInit(pScreen, GLIDERefreshArea); -#ifdef DPMSExtension xf86DPMSInit(pScreen, GLIDEDisplayPowerManagementSet, 0); -#endif pScreen->SaveScreen = GLIDESaveScreen; @@ -1098,7 +1076,6 @@ * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -#ifdef DPMSExtension static void GLIDEDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -1133,7 +1110,6 @@ } oldmode = PowerManagementMode; } -#endif static void Index: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile:1.29 xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile:1.34.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile:1.29 Tue Sep 19 20:09:21 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile Fri May 25 07:19:31 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.29 2000/09/20 00:09:21 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/Imakefile,v 1.34.2.1 2001/05/25 11:19:31 alanh Exp $ XCOMM XCOMM This is an Imakefile for the GLINT driver. XCOMM @@ -14,12 +14,12 @@ SRCS = glint_driver.c pm2_dac.c pm2ramdac.c pm2_accel.c pm_dac.c IBMramdac.c \ pm_accel.c tx_dac.c tx_accel.c pm2v_dac.c pm2vramdac.c pm2_video.c \ - pm3_dac.c pm3_accel.c TIramdac.c dualmx_dac.c dualmx_accel.c \ - glint_shadow.c $(DRISRC) sx_accel.c TIdualramdac.c glint_dga.c + pm3_dac.c pm3_accel.c pm3_video.c TIramdac.c \ + glint_shadow.c $(DRISRC) sx_accel.c glint_dga.c OBJS = glint_driver.o pm2_dac.o pm2ramdac.o pm2_accel.o pm_dac.o IBMramdac.o \ pm_accel.o tx_dac.o tx_accel.o pm2v_dac.o pm2vramdac.o pm2_video.o \ - pm3_dac.o pm3_accel.o TIramdac.o dualmx_dac.o dualmx_accel.o \ - glint_shadow.o $(DRIOBJ) sx_accel.o TIdualramdac.o glint_dga.o + pm3_dac.o pm3_accel.o pm3_video.o TIramdac.o \ + glint_shadow.o $(DRIOBJ) sx_accel.o glint_dga.o #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -39,7 +39,7 @@ -I$(SERVERSRC)/render #endif -DEFINES = $(GLX_DEFINES) -DPPC_MMIO_IS_BE +DEFINES = $(GLX_DEFINES) -DPPC_MMIO_IS_BE -DSPARC_MMIO_IS_BE #if MakeHasPosixVariableSubstitutions SubdirLibraryRule($(OBJS)) @@ -52,7 +52,6 @@ InstallObjectModule(glint,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(glint,) InstallModuleManPage(glint) #endif @@ -61,9 +60,6 @@ InstallDriverSDKNonExecFile(IBMramdac.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(TIramdac.c,$(DRIVERSDKDIR)/drivers/glint) -InstallDriverSDKNonExecFile(TIdualramdac.c,$(DRIVERSDKDIR)/drivers/glint) -InstallDriverSDKNonExecFile(dualmx_accel.c,$(DRIVERSDKDIR)/drivers/glint) -InstallDriverSDKNonExecFile(dualmx_dac.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(glint.h,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(glint_dri.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(glint_dri.h,$(DRIVERSDKDIR)/drivers/glint) @@ -80,6 +76,8 @@ InstallDriverSDKNonExecFile(pm2vramdac.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(pm3_dac.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(pm3_accel.c,$(DRIVERSDKDIR)/drivers/glint) +InstallDriverSDKNonExecFile(pm3_video.c,$(DRIVERSDKDIR)/drivers/glint) +InstallDriverSDKNonExecFile(pm3_regs.h,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(pm_accel.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(pm_dac.c,$(DRIVERSDKDIR)/drivers/glint) InstallDriverSDKNonExecFile(tx_accel.c,$(DRIVERSDKDIR)/drivers/glint) Index: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3:1.6 xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3:1.6 Tue Dec 12 12:02:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3 Tue May 8 15:31:22 2001 @@ -1,16 +1,14 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.6 2000/12/12 17:02:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/README.pm3,v 1.11 2001/05/08 19:31:22 alanh Exp $ */ -STATUS as of Mon, 16 Oct 2000 21:24:51 +0200 +STATUS as of Tue, 8 May 2001 19:01: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. - * Untested on big endian systems, i had some reports of endianess problems - with a Permedia4 though, so i suppose things are broken for Permedia3 - also. If you encounter problems, please contact me or try with - acceleration disabled. + * Endianess clean, thanks to Romain Dolbeau <dolbeaur@club-internet.fr> for + helping me debug this. * HW cursor. - * ShadowFb works. + * ShadowFb. * Full 2D Accels. - Sync. - Pixmap cache. @@ -26,23 +24,48 @@ - Pixmap Writes using direct FIFO writes with or without FIFO Disconnect. * Appian J2000 second head initialization. * Dual head : The console fonts will get trashed, but dual head works. - * DRI : - - Gamma, if available, get's claimed with the UseGamma option. + * Xv : Hardware video scaler : + - Needs checking on a big endian machine. + - Needs acceleration to work. + - Clipping supported trough the alpha channel in depth 15 and 24 + and with an overlay key color in depth 8 and 16. + - Support both dual head and single head, trough gamma or permedia3. + - Attributes are : + - FILTER : None, Partial (X only) or Full filtering. + - MIRROR : X and/or Y Axis mirroring. + - ALPHA : + - 0 -> FB Only + - 1 -> 25% Video, 75% FB + - 2 -> 75% Video, 25% FB + - 3 -> Video Only + - [TODO] VIDEOKEY : Overlay Key Color for clipping in depth 8 and 16. + * DRI : Work is underway. + Not Working : - * 2D Accel : + + * [NOT POSSIBLE] 2D Accel : - Solid & Dashed Lines are not possible on glint hardware. - 8x8 Color Pattern Fill is almost never used. - Clipping needs cleaning up. - - Seems broken on big endian systems, cannot test it though. - * 2D Accel hooks for the Rendering extension ? + * [TODO] 2D Accel hooks for the Rendering extension : - Render extension initialization. - CPUToScreenTexture. - CPUToScreenAlphaTexture. - * Video Overlay. - * DRI. - -Known Problem : + * [NEED FIX] Xv has still some minor problems : + - depth 8 does not work, but then it may be the app i am using. + - when using 2D accels there is some unstability in the video display. I + guess this is because there is then not enough bandwith to do the + copying of the data in time. After a time of the above, the images + becomes black. It will come back once stopvideo is called. + [FIX] i will disable VideoOverlay each 25 frames, this causes a flicker, + but at least it will bing the image back. + * [WORK IS UNDERWAY] DRI/OpenGL (only together with a gamma chip) : + - DRI support should be ok, but accelerated openGL is not yet supported. + - The accelerated OpenGL library supposes we are using a gamma together + with a MX rasterizer, not a Permedia3 one. +Known problems : + * Console gets broken when using dual headed mode. The culprit seems to be the vga graphics index & port (GraphicsIndexReg : 0x63ce, GraphicsPort : 0x3cf). I had to use IO acces for both these two, because if not, console @@ -51,55 +74,16 @@ vesafb, it will be a bit slower, but the fonts will no more become corrupt. Maybe i will even try writting a specific fbdev for the pm3, which will be much faster and have more functionality. - * R-B inversion. Sometimes, all of a sudden, it seems as the RGB order - gets changed. going to console and back solves this. - * [TRIGGERED IN ENLIGTHENMENT ONLY] When moving a window around a lot - quicly, the video outputs dies. I have to switch to a console and back - to have it restored. Is it possible that the accel engine gets - overloaded or something such ? Don't think so, it happens even when - PCIRetry is used too ... + [FIX2] try : consolechars -d, it should reload the console fonts. + * [FIXED] R-B inversion. Sometimes, all of a sudden, it seems as the + RGB order gets changed. going to console and back solves this. + Well, this is partly fixed, but still appears under very heavy load. + * [FIXED] When moving a window around a lot quickly, the video outputs dies. + Well, this is partly fixed, but still appears under very heavy load. + => [NOTE] If this two still happens, try disabling the Hardware cursor, with + the "SWCursor" option to your device XF86Config section. * Sometimes there are blue transparent garbage in the form of small horizontal bands, few pixels high, and more pixels width, maybe 64pixels ? - -Video Overlay [NOTHING DONE YET] : - - * I have not done anything yet here. - -DRI/3D Accels [NOTHING DONE YET] : - - * First approach would be to use the gamma for one head only (most probably - the first head, it could be configurable though). - * Sharing the gamma between both driver instances would need a setup similar - of what was done for the Matrox dualheaded G400 (mga driver). - * Alternatively it could be possible to use DRI with the gamma on one head, - and DRI with the pm3 alone on the second head. This would need writing a - pm3 drm kernel driver as well as a pm3 OpenGL driver. Could be useful for - boards without gamma chips though. - - * Claiming the Gamma (in the one head only approach) : - - The first possibility is the use of the UseGamma Option in the driver - section. The UseGamma option then tries to claim a gamma chip, if - available, on the same device. This enable the use of the gamma on - either head, in a two head setup. - - The second possibility is the automatic claiming of a gamma chip if - available. This works ok in single headed mode, but in dual head setup, - only the first head will be accelerated. - * Using the Gamma : - - A first try of using the Gamma (for 2D only) gave me a system freeze. - This is probably due to bad initialization since i only set the IOBase - to the Gamma registers, and did nothing more to initialize the Gamma. - I need more info on initialization of the Gamma chip, especially on how - to tell it which Permedia3 to use. - - A Second try, after initializing MultiGLINTAperture and MultiGLINT1 did - end in the same way. - - Once that is done, i need to write a pm3_dri.c file, inspired on the - glint_dri.c file, which does the dri setup, and the 2d/3d state saving. - * Changes to the 2D driver when using the Gamma : - - Well, there could be some changes, but in particular, the Gamma has only - a 32 entries deep Input FIFO, and not a 120 entries deep one like - permedia3. - - Another idea, is to use Gamma bypass when doing 2D accels. This way, we - don't have to worry about the Gamma smaller input Fifo. But we need to - sync the gamma also when doing syncs. Not sure where the right place for - this is though. Maybe when switching between 2D and 3D ? + This may be a hardware bug. +Sven Luther <luther@dpt-info.u-strasbg.fr> Index: xc/programs/Xserver/hw/xfree86/drivers/glint/TIdualramdac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/TIdualramdac.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/glint/TIdualramdac.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/glint/TIdualramdac.c:1.1 Tue Mar 21 16:46:27 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/TIdualramdac.c Mon Jun 4 12:40:50 2001 @@ -1,133 +0,0 @@ -/* - * Copyright 1998 by Alan Hourihane, Wigan, England. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * - * Modified from IBMramdac.c to support TI RAMDAC routines - * by Jens Owen, <jens@precisioninsight.com>. - * - * glintOutTIIndReg() and glintInTIIndReg() are used to access - * the indirect TI RAMDAC registers only. - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/TIdualramdac.c,v 1.1 2000/03/21 21:46:27 alanh Exp $ */ - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" - -#include "xf86PciInfo.h" -#include "xf86Pci.h" - -#include "TI.h" -#include "glint_regs.h" -#include "glint.h" - -#define TI_WRITE_ADDR 0x4000 -#define TI_RAMDAC_DATA 0x4008 -#define TI_PIXEL_MASK 0x4010 -#define TI_READ_ADDR 0x4018 -#define TI_CURS_COLOR_WRITE_ADDR 0x4020 -#define TI_CURS_COLOR_DATA 0x4028 -#define TI_CURS_COLOR_READ_ADDR 0x4038 -#define TI_DIRECT_CURS_CTRL 0x4048 -#define TI_INDEX_DATA 0x4050 -#define TI_CURS_RAM_DATA 0x4058 -#define TI_CURS_X_LOW 0x4060 -#define TI_CURS_X_HIGH 0x4068 -#define TI_CURS_Y_LOW 0x4070 -#define TI_CURS_Y_HIGH 0x4078 - -void -DUALglintOutTIIndReg(ScrnInfoPtr pScrn, - CARD32 reg, unsigned char mask, unsigned char data) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned char tmp = 0x00; - int offset; - - if ((reg & 0xf0) == 0xa0) { /* this is really a direct register write */ - offset = TI_WRITE_ADDR + ((reg & 0xf) << 3); - if (mask != 0x00) - tmp = GLINT_SECONDARY_READ_REG(offset) & mask; - - GLINT_SECONDARY_SLOW_WRITE_REG(tmp | data, offset); - } - else { /* normal indirect access */ - GLINT_SECONDARY_SLOW_WRITE_REG(reg & 0xFF, TI_WRITE_ADDR); - - if (mask != 0x00) - tmp = GLINT_SECONDARY_READ_REG(TI_INDEX_DATA) & mask; - - GLINT_SECONDARY_SLOW_WRITE_REG(tmp | data, TI_INDEX_DATA); - } -} - -unsigned char -DUALglintInTIIndReg (ScrnInfoPtr pScrn, CARD32 reg) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned char ret; - int offset; - - if ((reg & 0xf0) == 0xa0) { /* this is really a direct register write */ - offset = TI_WRITE_ADDR + ((reg & 0xf) << 3); - ret = GLINT_SECONDARY_READ_REG(offset); - } - else { /* normal indirect access */ - GLINT_SECONDARY_SLOW_WRITE_REG(reg & 0xFF, TI_WRITE_ADDR); - ret = GLINT_SECONDARY_READ_REG(TI_INDEX_DATA); - } - - return (ret); -} - -void -DUALglintTIWriteAddress (ScrnInfoPtr pScrn, CARD32 index) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_SECONDARY_SLOW_WRITE_REG(index, TI_WRITE_ADDR); -} - -void -DUALglintTIWriteData (ScrnInfoPtr pScrn, unsigned char data) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_SECONDARY_SLOW_WRITE_REG(data, TI_RAMDAC_DATA); -} - -void -DUALglintTIReadAddress (ScrnInfoPtr pScrn, CARD32 index) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_SECONDARY_SLOW_WRITE_REG(0xFF, TI_PIXEL_MASK); - GLINT_SECONDARY_SLOW_WRITE_REG(index, TI_READ_ADDR); -} - -unsigned char -DUALglintTIReadData (ScrnInfoPtr pScrn) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - return(GLINT_SECONDARY_READ_REG(TI_RAMDAC_DATA)); -} Index: xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c:1.3 Tue Mar 21 16:46:27 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c Wed Jan 31 11:14:52 2001 @@ -1,5 +1,5 @@ /* - * Copyright 1998 by Alan Hourihane, Wigan, England. + * Copyright 1998-2001 by Alan Hourihane, Wigan, England. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -27,7 +27,7 @@ * glintOutTIIndReg() and glintInTIIndReg() are used to access * the indirect TI RAMDAC registers only. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c,v 1.3 2000/03/21 21:46:27 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/TIramdac.c,v 1.4 2001/01/31 16:14:52 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -147,4 +147,86 @@ (*pGlint->RamDac->HWCursorInit)(infoPtr); return(xf86InitCursor(pScreen, infoPtr)); +} + +/* Special cases */ + +/* GMX2000 */ +void +GMX2000OutIndReg(ScrnInfoPtr pScrn, + CARD32 reg, unsigned char mask, unsigned char data) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + + ACCESSCHIP2(); + + glintOutTIIndReg(pScrn, reg, mask, data); + + ACCESSCHIP1(); +} + +unsigned char +GMX2000InIndReg (ScrnInfoPtr pScrn, CARD32 reg) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + unsigned char ret; + + ACCESSCHIP2(); + + ret = glintInTIIndReg(pScrn, reg); + + ACCESSCHIP1(); + + return (ret); +} + +void +GMX2000WriteAddress (ScrnInfoPtr pScrn, CARD32 index) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + + ACCESSCHIP2(); + + glintTIWriteAddress(pScrn, index); + + ACCESSCHIP1(); +} + +void +GMX2000WriteData (ScrnInfoPtr pScrn, unsigned char data) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + + ACCESSCHIP2(); + + glintTIWriteData(pScrn, data); + + ACCESSCHIP1(); +} + +void +GMX2000ReadAddress (ScrnInfoPtr pScrn, CARD32 index) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + + ACCESSCHIP2(); + + glintTIReadAddress(pScrn, index); + + ACCESSCHIP1(); +} + +unsigned char +GMX2000ReadData (ScrnInfoPtr pScrn) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + unsigned char ret; + + ACCESSCHIP2(); + + ret = glintTIReadData(pScrn); + + ACCESSCHIP1(); + + return (ret); } Index: xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c:1.9 Wed Jun 21 09:35:51 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c Mon Jun 4 12:40:51 2001 @@ -1,1003 +0,0 @@ -/* - * Copyright 1997,1998 by Alan Hourihane, Wigan, England. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * Dirk Hohndel, <hohndel@suse.de> - * Stefan Dirsch, <sndirsch@suse.de> - * - * Dual MX accelerated options. - * - * Modified version of tx_accel.c to support dual MX chips by - * Jens Owen, <jens@precisioninsight.com> - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_accel.c,v 1.9 2000/06/21 13:35:51 alanh Exp $ */ - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" - -#include "xf86PciInfo.h" -#include "xf86Pci.h" - -#include "fb.h" - -#include "miline.h" - -#include "glint_regs.h" -#include "glint.h" - -#include "xaalocal.h" /* For replacements */ - -static void DualMXSync(ScrnInfoPtr pScrn); -static void DualMXSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask); -static void DualMXSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, - int w, int h); -static void DualMXSetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, - int patterny, - int fg, int bg, int rop, - unsigned int planemask); -static void DualMXSubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int patternx, - int patterny, int x, int y, - int w, int h); -static void DualMXSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, - int rop, unsigned int planemask, - int transparency_color); -static void DualMXSubsequentScreenToScreenCopy(ScrnInfoPtr pScrn, int x1, int y1, - int x2, int y2, int w, int h); -static void DualMXWriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, - int skipleft, int fg, int bg, int rop, - unsigned int planemask); -static void DualMXSetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, - int x2,int y2); -static void DualMXDisableClipping(ScrnInfoPtr pScrn); -static void DualMXWritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int rop, - unsigned int planemask, int trans, - int bpp, int depth); -static void DualMXSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, - int bg, int rop, unsigned int planemask); -static void DualMXSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, - int y, int w, int h, int skipleft); -static void DualMXSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, - int bg, int rop, unsigned int planemask); -static void DualMXSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, - int y, int w, int h, int skipleft); -static void DualMXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); -static void DualMXLoadCoord(ScrnInfoPtr pScrn, int x, int y, int w, int h, - int a, int d); -static void DualMXSetupForSolidLine(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask); -static void DualMXSubsequentHorVertLine(ScrnInfoPtr pScrn, int x1, int y1, - int len, int dir); -static void DualMXSubsequentSolidBresenhamLine(ScrnInfoPtr pScrn, - int x, int y, int dmaj, int dmin, int e, - int len, int octant); -static void DualMXPolylinesThinSolidWrapper(DrawablePtr pDraw, GCPtr pGC, - int mode, int npt, DDXPointPtr pPts); -static void DualMXPolySegmentThinSolidWrapper(DrawablePtr pDraw, GCPtr pGC, - int nseg, xSegment *pSeg); - -#define MAX_FIFO_ENTRIES 15 - -void -DualMXInitializeEngine(ScrnInfoPtr pScrn) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - pGlint->rasterizerMode = RMMultiGLINT; - - /* Initialize the Accelerator Engine to defaults */ - - /* Only write the following registerto the first MX */ - GLINT_SLOW_WRITE_REG(1, BroadcastMask); - GLINT_SLOW_WRITE_REG(0x00000001, ScanLineOwnership); - - /* Only write the following register to the second MX */ - GLINT_SLOW_WRITE_REG(2, BroadcastMask); - GLINT_SLOW_WRITE_REG(0x00000005, ScanLineOwnership); - - /* Make sure the rest of the register writes go to both MX's */ - GLINT_SLOW_WRITE_REG(3, BroadcastMask); - - GLINT_SLOW_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ScissorMode); - GLINT_SLOW_WRITE_REG(pGlint->pprod | LBRM_ScanlineInt2, LBReadMode); - pGlint->pprod |= FBRM_ScanlineInt2; - GLINT_SLOW_WRITE_REG(pGlint->pprod, FBReadMode); - GLINT_SLOW_WRITE_REG(0, dXSub); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBWriteMode); - GLINT_SLOW_WRITE_REG(UNIT_ENABLE, FBWriteMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DitherMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaBlendMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ColorDDAMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureColorMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureAddressMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureReadMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, GLINTWindow); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaBlendMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RouterMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FogMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AntialiasMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AlphaTestMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StencilMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, AreaStippleMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LineStippleMode); - GLINT_SLOW_WRITE_REG(0, UpdateLineStippleCounters); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LogicalOpMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StatisticMode); - GLINT_SLOW_WRITE_REG(0x400, FilterMode); - GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask); - GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, GLINTDepth); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBSourceOffset); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBPixelOffset); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBSourceOffset); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, WindowOrigin); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBWindowBase); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBWindowBase); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, TextureAddressMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RouterMode); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PatternRamMode); - - switch (pScrn->bitsPerPixel) { - case 8: - GLINT_SLOW_WRITE_REG(0x2, PixelSize); - break; - case 16: - GLINT_SLOW_WRITE_REG(0x1, PixelSize); - break; - case 32: - GLINT_SLOW_WRITE_REG(0x0, PixelSize); - break; - } - - pGlint->ROP = 0xFF; - pGlint->ClippingOn = FALSE; - pGlint->startxsub = 0; - pGlint->startxdom = 0; - pGlint->starty = 0; - pGlint->count = 0; - pGlint->dxdom = 0; - pGlint->dy = 1; - pGlint->planemask = 0; - GLINT_SLOW_WRITE_REG(0, StartXSub); - GLINT_SLOW_WRITE_REG(0, StartXDom); - GLINT_SLOW_WRITE_REG(0, StartY); - GLINT_SLOW_WRITE_REG(0, GLINTCount); - GLINT_SLOW_WRITE_REG(0, dXDom); - GLINT_SLOW_WRITE_REG(1<<16, dY); -} - -Bool -DualMXAccelInit(ScreenPtr pScreen) -{ - XAAInfoRecPtr infoPtr; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - GLINTPtr pGlint = GLINTPTR(pScrn); - long memory = pGlint->FbMapSize; - BoxRec AvailFBArea; - - pGlint->AccelInfoRec = infoPtr = XAACreateInfoRec(); - if (!infoPtr) return FALSE; - - DualMXInitializeEngine(pScrn); - - infoPtr->Flags = PIXMAP_CACHE | - LINEAR_FRAMEBUFFER | - OFFSCREEN_PIXMAPS; - - infoPtr->Sync = DualMXSync; - - infoPtr->SetClippingRectangle = DualMXSetClippingRectangle; - infoPtr->DisableClipping = DualMXDisableClipping; - infoPtr->ClippingFlags = HARDWARE_CLIP_MONO_8x8_FILL | -#if 0 - HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY | -#endif - HARDWARE_CLIP_SOLID_FILL; - - infoPtr->SolidFillFlags = 0; - infoPtr->SetupForSolidFill = DualMXSetupForFillRectSolid; - infoPtr->SubsequentSolidFillRect = DualMXSubsequentFillRectSolid; - - infoPtr->SolidLineFlags = 0; - infoPtr->PolySegmentThinSolidFlags = 0; - infoPtr->PolylinesThinSolidFlags = 0; - infoPtr->SetupForSolidLine = DualMXSetupForSolidLine; - infoPtr->SubsequentSolidHorVertLine = DualMXSubsequentHorVertLine; - if (!(pScrn->overlayFlags & OVERLAY_8_32_PLANAR)) - { - infoPtr->SubsequentSolidBresenhamLine = - DualMXSubsequentSolidBresenhamLine; - } - infoPtr->PolySegmentThinSolid = DualMXPolySegmentThinSolidWrapper; - infoPtr->PolylinesThinSolid = DualMXPolylinesThinSolidWrapper; - -#if 0 - infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | - ONLY_LEFT_TO_RIGHT_BITBLT; - infoPtr->SetupForScreenToScreenCopy = DualMXSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = DualMXSubsequentScreenToScreenCopy; -#endif - - infoPtr->Mono8x8PatternFillFlags = HARDWARE_PATTERN_PROGRAMMED_ORIGIN | - HARDWARE_PATTERN_SCREEN_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS; - infoPtr->SetupForMono8x8PatternFill = DualMXSetupForMono8x8PatternFill; - infoPtr->SubsequentMono8x8PatternFillRect = - DualMXSubsequentMono8x8PatternFillRect; - -#if 0 - if (!pGlint->UsePCIRetry) { - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = - TRANSPARENCY_ONLY | -#if 0 - LEFT_EDGE_CLIPPING | - LEFT_EDGE_CLIPPING_NEGATIVE_X | -#endif - BIT_ORDER_IN_BYTE_LSBFIRST; - - pGlint->XAAScanlineColorExpandBuffers[0] = - xnfalloc(((pScrn->virtualX + 63)/32) *4* (pScrn->bitsPerPixel / 8)); - pGlint->XAAScanlineColorExpandBuffers[1] = - xnfalloc(((pScrn->virtualX + 63)/32) *4* (pScrn->bitsPerPixel / 8)); - - infoPtr->NumScanlineColorExpandBuffers = 2; - infoPtr->ScanlineColorExpandBuffers = - pGlint->XAAScanlineColorExpandBuffers; - - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = - DualMXSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = - DualMXSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = - DualMXSubsequentColorExpandScanline; - } else { - infoPtr->CPUToScreenColorExpandFillFlags = TRANSPARENCY_ONLY | - SYNC_AFTER_COLOR_EXPAND | - CPU_TRANSFER_PAD_DWORD | -#if 0 - LEFT_EDGE_CLIPPING | - LEFT_EDGE_CLIPPING_NEGATIVE_X | -#endif - BIT_ORDER_IN_BYTE_LSBFIRST; - infoPtr->ColorExpandBase = pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForCPUToScreenColorExpandFill = - DualMXSetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - DualMXSubsequentCPUToScreenColorExpandFill; - } -#endif - - infoPtr->ColorExpandRange = MAX_FIFO_ENTRIES; - - infoPtr->WriteBitmap = DualMXWriteBitmap; - infoPtr->WritePixmap = DualMXWritePixmap; - - AvailFBArea.x1 = 0; - AvailFBArea.y1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - if (memory > (16383*1024)) memory = 16383*1024; - AvailFBArea.y2 = memory / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); - - xf86InitFBManager(pScreen, &AvailFBArea); - - return (XAAInit(pScreen, infoPtr)); -} - -static void DualMXLoadCoord( - ScrnInfoPtr pScrn, - int x, int y, - int w, int h, - int a, int d -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_WRITE_REG(w<<16, StartXSub); - GLINT_WRITE_REG(x<<16,StartXDom); - GLINT_WRITE_REG(y<<16,StartY); - GLINT_WRITE_REG(h,GLINTCount); - GLINT_WRITE_REG(a<<16,dXDom); - GLINT_WRITE_REG(d<<16,dY); -} - -static void MoveDWORDS( - register CARD32* dest, - register CARD32* src, - register int dwords ) -{ - while(dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - *(dest + 3) = *(src + 3); - src += 4; - dest += 4; - dwords -= 4; - } - if (!dwords) return; - *dest = *src; - if (dwords == 1) return; - *(dest + 1) = *(src + 1); - if (dwords == 2) return; - *(dest + 2) = *(src + 2); -} - -#define Sync_tag 0x188 - -static void -DualMXSync( - ScrnInfoPtr pScrn -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned long readValue; - - CHECKCLIPPING; - - while (GLINT_READ_REG(DMACount) != 0); - GLINT_WAIT(3); - GLINT_WRITE_REG(3, BroadcastMask); /* hack! this shouldn't need to be reloaded */ - GLINT_WRITE_REG(1<<10, FilterMode); - GLINT_WRITE_REG(0, GlintSync); - - /* Read 1st MX until Sync Tag shows */ - do { - while(GLINT_READ_REG(OutFIFOWords) == 0); - readValue = GLINT_READ_REG(OutputFIFO); -#ifdef DEBUG - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "1st MX: OutputFIFO %x\n",readValue); -#endif - } while (readValue != Sync_tag); - - /* Read 2nd MX until Sync Tag shows */ - do { - while(GLINT_SECONDARY_READ_REG(OutFIFOWords) == 0); - readValue = GLINT_SECONDARY_READ_REG(OutputFIFO); -#ifdef DEBUG - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "2nd MX: OutputFIFO %x\n",readValue); -#endif - } while (readValue != Sync_tag); - -#ifdef DEBUG - if (GLINT_READ_REG(OutFIFOWords)||GLINT_SECONDARY_READ_REG(OutFIFOWords)) { - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "Unread data in output FIFO after sync\n"); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "1st MX: OutFifoWords %d\n",GLINT_READ_REG(OutFIFOWords)); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "2nd MX: OutFifoWords %d\n",GLINT_SECONDARY_READ_REG(OutFIFOWords)); - } -#endif -} - -static void -DualMXSetupForFillRectSolid( - ScrnInfoPtr pScrn, - int color, int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - pGlint->ForeGroundColor = color; - - GLINT_WAIT(5); - REPLICATE(color); - DO_PLANEMASK(planemask); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - GLINT_WRITE_REG(color, FBBlockColor); - pGlint->FrameBufferReadMode = FastFillEnable; - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - GLINT_WRITE_REG(color, PatternRamData0); - pGlint->FrameBufferReadMode = FastFillEnable | SpanOperation; - } - LOADROP(rop); -} - -static void -DualMXSubsequentFillRectSolid( - ScrnInfoPtr pScrn, - int x, int y, - int w, int h -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_WAIT(8); - DualMXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode,Render); -} - -static void -DualMXSetClippingRectangle( - ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2 -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_WAIT(3); - GLINT_WRITE_REG((y1&0xFFFF)<<16|(x1&0xFFFF), ScissorMinXY); - GLINT_WRITE_REG((y2&0xFFFF)<<16|(x2&0xFFFF), ScissorMaxXY); - GLINT_WRITE_REG(1, ScissorMode); /* Enable Scissor Mode */ - pGlint->ClippingOn = TRUE; -} - -static void -DualMXDisableClipping( - ScrnInfoPtr pScrn -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - CHECKCLIPPING; -} - -static void -DualMXSetupForScreenToScreenCopy( - ScrnInfoPtr pScrn, - int xdir, int ydir, - int rop, - unsigned int planemask, - int transparency_color -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - - pGlint->BltScanDirection = ydir; - - GLINT_WAIT(5); - DO_PLANEMASK(planemask); - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod | FBRM_SrcEnable, FBReadMode); - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_SrcEnable | FBRM_DstEnable, FBReadMode); - } - LOADROP(rop); -} - -static void -DualMXSubsequentScreenToScreenCopy( - ScrnInfoPtr pScrn, - int x1, int y1, - int x2, int y2, - int w, int h -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - int srcaddr, dstaddr; - - GLINT_WAIT(10); - if (pGlint->BltScanDirection != 1) { - y1 += h - 1; - y2 += h - 1; - DualMXLoadCoord(pScrn, x2, y2, x2+w, h, 0, -1); - } else { - DualMXLoadCoord(pScrn, x2, y2, x2+w, h, 0, 1); - } - - srcaddr = y1 * pScrn->displayWidth + x1; - dstaddr = y2 * pScrn->displayWidth + x2; - - GLINT_WRITE_REG(srcaddr - dstaddr, FBSourceOffset); - GLINT_WRITE_REG(PrimitiveTrapezoid| FastFillEnable | SpanOperation, Render); -} - -static void -DualMXSetupForScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - REPLICATE(fg); - REPLICATE(bg); - GLINT_WAIT(6); - DO_PLANEMASK(planemask); - GLINT_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - pGlint->FrameBufferReadMode = FastFillEnable; - GLINT_WRITE_REG(fg, FBBlockColor); - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - pGlint->FrameBufferReadMode = FastFillEnable | SpanOperation; - GLINT_WRITE_REG(fg, PatternRamData0); - } - LOADROP(rop); -} - -static void -DualMXSubsequentScanlineCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - - pGlint->dwords = ((w + 31) >> 5); /* dwords per scanline */ - -#if 0 - DualMXSetClippingRectangle(pScrn,x+skipleft, y, x+w, y+h); -#endif - - pGlint->cpucount = y; - pGlint->cpuheight = h; - GLINT_WAIT(6); - DualMXLoadCoord(pScrn, x, pGlint->cpucount, x+w, 1, 0, 1); -} - -static void -DualMXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - GLINTPtr pGlint = GLINTPTR(pScrn); - CARD32 *src; - int dwords = pGlint->dwords; - - GLINT_WAIT(7); - DualMXLoadCoord(pScrn, pGlint->startxdom, pGlint->cpucount, pGlint->startxsub, 1, 0, 1); - - GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode | SyncOnBitMask, - Render); - - src = (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno]; - while (dwords >= infoRec->ColorExpandRange) { - GLINT_WAIT(infoRec->ColorExpandRange); - GLINT_WRITE_REG((infoRec->ColorExpandRange - 2)<<16 | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src, - infoRec->ColorExpandRange - 1); - dwords -= (infoRec->ColorExpandRange - 1); - src += (infoRec->ColorExpandRange - 1); - } - if (dwords) { - GLINT_WAIT(dwords); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords); - } - pGlint->cpucount += 1; -#if 0 - if (pGlint->cpucount == (pGlint->cpuheight + 1)) - CHECKCLIPPING; -#endif -} - -static void -DualMXSetupForCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - REPLICATE(fg); - - DO_PLANEMASK(planemask); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - GLINT_WRITE_REG(fg, FBBlockColor); - pGlint->FrameBufferReadMode = FastFillEnable; - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - GLINT_WRITE_REG(fg, PatternRamData0); - pGlint->FrameBufferReadMode = FastFillEnable | SpanOperation; - } - LOADROP(rop); -} - -static void -DualMXSubsequentCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - int dwords = ((w + 31) >> 5) * h; - -#if 0 - DualMXSetClippingRectangle(pScrn,x+skipleft, y, x+w, y+h); -#endif - - DualMXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode | - SyncOnBitMask, Render); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); -} - -void DualMXSetupForMono8x8PatternFill( - ScrnInfoPtr pScrn, - int patternx, int patterny, - int fg, int bg, int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - - if (bg == -1) pGlint->FrameBufferReadMode = -1; - else pGlint->FrameBufferReadMode = 0; - pGlint->ForeGroundColor = fg; - pGlint->BackGroundColor = bg; - REPLICATE(pGlint->ForeGroundColor); - REPLICATE(pGlint->BackGroundColor); - - GLINT_WAIT(13); - DO_PLANEMASK(planemask); - GLINT_WRITE_REG((patternx & 0x000000FF), AreaStipplePattern0); - GLINT_WRITE_REG((patternx & 0x0000FF00) >> 8, AreaStipplePattern1); - GLINT_WRITE_REG((patternx & 0x00FF0000) >> 16, AreaStipplePattern2); - GLINT_WRITE_REG((patternx & 0xFF000000) >> 24, AreaStipplePattern3); - GLINT_WRITE_REG((patterny & 0x000000FF), AreaStipplePattern4); - GLINT_WRITE_REG((patterny & 0x0000FF00) >> 8, AreaStipplePattern5); - GLINT_WRITE_REG((patterny & 0x00FF0000) >> 16, AreaStipplePattern6); - GLINT_WRITE_REG((patterny & 0xFF000000) >> 24, AreaStipplePattern7); - - if (rop == GXcopy) { - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - } else { - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - } - LOADROP(rop); -} - -static void -DualMXSubsequentMono8x8PatternFillRect( - ScrnInfoPtr pScrn, - int patternx, int patterny, - int x, int y, - int w, int h -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - int span = 0; - - GLINT_WAIT(12); - DualMXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - - if (pGlint->FrameBufferReadMode != -1) { - if (pGlint->ROP == GXcopy) { - GLINT_WRITE_REG(pGlint->BackGroundColor, FBBlockColor); - span = 0; - } else { - GLINT_WRITE_REG(pGlint->BackGroundColor, PatternRamData0); - span = SpanOperation; - } - GLINT_WRITE_REG(2<<1|2<<4|patternx<<7|patterny<<12|ASM_InvertPattern | - UNIT_ENABLE, AreaStippleMode); - GLINT_WRITE_REG(AreaStippleEnable | span | FastFillEnable | - PrimitiveTrapezoid, Render); - } - - if (pGlint->ROP == GXcopy) { - GLINT_WRITE_REG(pGlint->ForeGroundColor, FBBlockColor); - span = 0; - } else { - GLINT_WRITE_REG(pGlint->ForeGroundColor, PatternRamData0); - span = SpanOperation; - } - GLINT_WRITE_REG(2<<1|2<<4|patternx<<7|patterny<<12| - UNIT_ENABLE, AreaStippleMode); - GLINT_WRITE_REG(AreaStippleEnable | span | FastFillEnable | - PrimitiveTrapezoid, Render); -} - -static void -DualMXWriteBitmap(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int skipleft, - int fg, int bg, - int rop, - unsigned int planemask -){ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned char *srcpntr; - int dwords, height, mode; - Bool SecondPass = FALSE; - register int count; - register CARD32* pattern; - - w += skipleft; - x -= skipleft; - dwords = (w + 31) >> 5; - - DualMXSetClippingRectangle(pScrn,x+skipleft, y, x+w, y+h); - - GLINT_WAIT(11); - DO_PLANEMASK(planemask); - GLINT_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); - LOADROP(rop); - if (rop == GXcopy) { - mode = 0; - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - } else { - mode = SpanOperation; - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - } - DualMXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - - if(bg == -1) { - /* >>>>> set fg <<<<<<<< */ - REPLICATE(fg); - GLINT_WAIT(3); - if (rop == GXcopy) { - GLINT_WRITE_REG(fg, FBBlockColor); - } else { - GLINT_WRITE_REG(fg, PatternRamData0); - } - } else if(rop == GXcopy) { - REPLICATE(bg); - GLINT_WAIT(5); - if (rop == GXcopy) { - GLINT_WRITE_REG(bg, FBBlockColor); - } else { - GLINT_WRITE_REG(bg, PatternRamData0); - } - GLINT_WRITE_REG(PrimitiveTrapezoid |mode|FastFillEnable,Render); - REPLICATE(fg); - if (rop == GXcopy) { - GLINT_WRITE_REG(fg, FBBlockColor); - } else { - GLINT_WRITE_REG(fg, PatternRamData0); - } - } else { - SecondPass = TRUE; - REPLICATE(fg); - GLINT_WAIT(3); - if (rop == GXcopy) { - GLINT_WRITE_REG(fg, FBBlockColor); - } else { - GLINT_WRITE_REG(fg, PatternRamData0); - } - } - -SECOND_PASS: - GLINT_WRITE_REG(PrimitiveTrapezoid | FastFillEnable | mode | SyncOnBitMask, Render); - - height = h; - srcpntr = src; - while(height--) { - count = dwords >> 3; - pattern = (CARD32*)srcpntr; - while(count--) { - GLINT_WAIT(8); - GLINT_WRITE_REG(*(pattern), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+1), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+2), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+3), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+4), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+5), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+6), BitMaskPattern); - GLINT_WRITE_REG(*(pattern+7), BitMaskPattern); - pattern+=8; - } - count = dwords & 0x07; - GLINT_WAIT(count); - while (count--) - GLINT_WRITE_REG(*(pattern++), BitMaskPattern); - srcpntr += srcwidth; - } - - if(SecondPass) { - SecondPass = FALSE; - REPLICATE(bg); - GLINT_WAIT(4); - GLINT_WRITE_REG((pGlint->rasterizerMode|InvertBitMask), RasterizerMode); - if (rop == GXcopy) { - GLINT_WRITE_REG(bg, FBBlockColor); - } else { - GLINT_WRITE_REG(bg, PatternRamData0); - } - goto SECOND_PASS; - } - - GLINT_WAIT(2); - GLINT_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); - CHECKCLIPPING; - SET_SYNC_FLAG(infoRec); -} - -static void -DualMXWritePixmap( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, /* bytes */ - int rop, - unsigned int planemask, - int trans, - int bpp, int depth -){ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - GLINTPtr pGlint = GLINTPTR(pScrn); - CARD32 *srcp; - int count,dwords, skipleft, Bpp = bpp >> 3; - - if((skipleft = (long)src & 0x03L)) { - skipleft /= Bpp; - - x -= skipleft; - w += skipleft; - - src = (unsigned char*)((long)src & ~0x03L); - } - - switch(Bpp) { - case 1: dwords = (w + 3) >> 2; - break; - case 2: dwords = (w + 1) >> 1; - break; - case 4: dwords = w; - break; - default: return; - } - - DualMXSetClippingRectangle(pScrn,x+skipleft, y, x+w, y+h); - - GLINT_WAIT(12); - DO_PLANEMASK(planemask); - GLINT_WRITE_REG(0, PatternRamMode); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - } - LOADROP(rop); - DualMXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - GLINT_WRITE_REG(PrimitiveTrapezoid | FastFillEnable | SpanOperation | - SyncOnHostData, Render); - - while(h--) { - count = dwords; - srcp = (CARD32*)src; - while(count >= infoRec->ColorExpandRange) { - GLINT_WAIT(infoRec->ColorExpandRange); - /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, infoRec->ColorExpandRange - 1); - count -= infoRec->ColorExpandRange - 1; - srcp += infoRec->ColorExpandRange - 1; - } - if(count) { - GLINT_WAIT(count); - /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, count); - } - src += srcwidth; - } - CHECKCLIPPING; - SET_SYNC_FLAG(infoRec); -} - -static void -DualMXPolylinesThinSolidWrapper( - DrawablePtr pDraw, - GCPtr pGC, - int mode, - int npt, - DDXPointPtr pPts -){ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - GLINTPtr pGlint = GLINTPTR(infoRec->pScrn); - pGlint->CurrentGC = pGC; - pGlint->CurrentDrawable = pDraw; - if(infoRec->NeedToSync) (*infoRec->Sync)(infoRec->pScrn); - XAAPolyLines(pDraw, pGC, mode, npt, pPts); -} - -static void -DualMXPolySegmentThinSolidWrapper( - DrawablePtr pDraw, - GCPtr pGC, - int nseg, - xSegment *pSeg -){ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - GLINTPtr pGlint = GLINTPTR(infoRec->pScrn); - pGlint->CurrentGC = pGC; - pGlint->CurrentDrawable = pDraw; - if(infoRec->NeedToSync) (*infoRec->Sync)(infoRec->pScrn); - XAAPolySegment(pDraw, pGC, nseg, pSeg); -} - -static void -DualMXSetupForSolidLine(ScrnInfoPtr pScrn, int color, - int rop, unsigned int planemask) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_WAIT(5); - DO_PLANEMASK(planemask); - GLINT_WRITE_REG(color, GLINTColor); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - } - LOADROP(rop); -} - -static void -DualMXSubsequentHorVertLine(ScrnInfoPtr pScrn,int x,int y,int len,int dir) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - GLINT_WAIT(7); - if (dir == DEGREES_0) { - DualMXLoadCoord(pScrn, x, y, 0, len, 1, 0); - } else { - DualMXLoadCoord(pScrn, x, y, 0, len, 0, 1); - } - - GLINT_WRITE_REG(PrimitiveLine, Render); -} - -static void -DualMXSubsequentSolidBresenhamLine( ScrnInfoPtr pScrn, - int x, int y, int dmaj, int dmin, int e, int len, int octant) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - int dxdom, dy; - - if(dmaj == dmin) { - GLINT_WAIT(7); - if(octant & YDECREASING) { - dy = -1; - } else { - dy = 1; - } - - if(octant & XDECREASING) { - dxdom = -1; - } else { - dxdom = 1; - } - - DualMXLoadCoord(pScrn, x, y, 0, len, dxdom, dy); - GLINT_WRITE_REG(PrimitiveLine, Render); - return; - } - - fbBres(pGlint->CurrentDrawable, pGlint->CurrentGC, 0, - (octant & XDECREASING) ? -1 : 1, - (octant & YDECREASING) ? -1 : 1, - (octant & YMAJOR) ? Y_AXIS : X_AXIS, - x, y, dmin + e, dmin, -dmaj, len); -} Index: xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_dac.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_dac.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_dac.c:1.4 Wed May 10 14:55:28 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_dac.c Mon Jun 4 12:40:51 2001 @@ -1,807 +0,0 @@ -/* - * Copyright 1997,1998 by Alan Hourihane <alanh@fairlite.demon.co.uk> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Alan Hourihane not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Alan Hourihane makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * ALAN HOURIHANE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL ALAN HOURIHANE BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Original Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> - * Dirk Hohndel, <hohndel@suse.de> - * Stefan Dirsch, <sndirsch@suse.de> - * Helmut Fahrion, <hf@suse.de> - * - * Modified version of tx_dac.c to support Dual MX rasterizers by - * Jens Owen <jens@precisioninsight.com> - */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/dualmx_dac.c,v 1.4 2000/05/10 18:55:28 alanh Exp $ */ - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" - -#include "xf86PciInfo.h" -#include "xf86Pci.h" - -#include "IBM.h" -#include "TI.h" -#include "glint_regs.h" -#include "glint.h" - -#define DEBUG -#ifdef DEBUG -#define DUMP(name,field) do { \ - value = GLINT_READ_REG(field); \ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\t%s(primary): 0x%lX\n", name, value); \ - value = GLINT_SECONDARY_READ_REG(field); \ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\t%s(secondary): 0x%lX\n", name, value); \ -} while (0) - -#define TIDUMP(name,field) do { \ - value = glintInTIIndReg(pScrn,field); \ - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\t\t%s: 0x%lX\n", name, value); \ -} while (0) - -void -GLINTDumpRegs(ScrnInfoPtr pScrn) { - GLINTPtr pGlint = GLINTPTR(pScrn); - unsigned long value; - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tGAMMA/MX regs:\n"); - DUMP("ResetStatus",ResetStatus); - DUMP("IntEnable",IntEnable); - DUMP("IntFlags",IntFlags); - DUMP("InFIFOSpace",InFIFOSpace); - DUMP("OutFIFOWords",OutFIFOWords); - DUMP("DMAAddress",DMAAddress); - DUMP("DMACount",DMACount); - DUMP("ErrorFlags",ErrorFlags); - DUMP("VClkCtl",VClkCtl); - DUMP("TestRegister",TestRegister); - DUMP("Aperture0",Aperture0); - DUMP("Aperture1",Aperture1); - DUMP("DMAControl",DMAControl); - DUMP("FIFODis",FIFODis); - DUMP("LBMemoryCtl",LBMemoryCtl); - DUMP("LBMemoryEDO",LBMemoryEDO); - DUMP("FBMemoryCtl",FBMemoryCtl); - DUMP("FBModeSel",FBModeSel); - DUMP("FBGCWrMask",FBGCWrMask); - DUMP("FBGCColorLower",FBGCColorLower); - DUMP("FBTXMemCtl",FBTXMemCtl); - DUMP("FBWrMaskk",FBWrMaskk); - DUMP("FBGCColorUpper",FBGCColorUpper); - DUMP("OutputFIFO",OutputFIFO); - DUMP("VTGHLimit",VTGHLimit); - DUMP("VTGHSyncStart",VTGHSyncStart); - DUMP("VTGHSyncEnd",VTGHSyncEnd); - DUMP("VTGHBlankEnd",VTGHBlankEnd); - DUMP("VTGVLimit",VTGVLimit); - DUMP("VTGVSyncStart",VTGVSyncStart); - DUMP("VTGVSyncEnd",VTGVSyncEnd); - DUMP("VTGVBlankEnd",VTGVBlankEnd); - DUMP("VTGHGateStart",VTGHGateStart); - DUMP("VTGHGateEnd",VTGHGateEnd); - DUMP("VTGVGateStart",VTGVGateStart); - DUMP("VTGVGateEnd",VTGVGateEnd); - DUMP("VTGPolarity",VTGPolarity); - DUMP("VTGFrameRowAddr",VTGFrameRowAddr); - DUMP("VTGVLineNumber",VTGVLineNumber); - DUMP("VTGSerialClk",VTGSerialClk); - DUMP("VTGModeCtl",VTGModeCtl); - DUMP("GInFIFOSpace",GInFIFOSpace); - DUMP("GDMAAddress",GDMAAddress); - DUMP("GDMAControl",GDMAControl); - DUMP("GOutDMA",GOutDMA); - DUMP("GOutDMACount",GOutDMACount); - DUMP("GResetStatus",GResetStatus); - DUMP("GIntEnable",GIntEnable); - DUMP("GIntFlags",GIntFlags); - DUMP("GErrorFlags",GErrorFlags); - DUMP("GTestRegister",GTestRegister); - DUMP("GFIFODis",GFIFODis); - DUMP("GChipConfig",GChipConfig); - DUMP("GCSRAperture",GCSRAperture); - DUMP("GPageTableAddr",GPageTableAddr); - DUMP("GPageTableLength",GPageTableLength); - DUMP("GDelayTimer",GDelayTimer); - DUMP("GCommandMode",GCommandMode); - DUMP("GCommandIntEnable",GCommandIntEnable); - DUMP("GCommandIntFlags",GCommandIntFlags); - DUMP("GCommandErrorFlags",GCommandErrorFlags); - DUMP("GCommandStatus",GCommandStatus); - DUMP("GCommandFaultingAddr",GCommandFaultingAddr); - DUMP("GVertexFaultingAddr",GVertexFaultingAddr); - DUMP("GWriteFaultingAddr",GWriteFaultingAddr); - DUMP("GFeedbackSelectCount",GFeedbackSelectCount); - DUMP("GGammaProcessorMode",GGammaProcessorMode); - DUMP("GVGAShadow",GVGAShadow); - DUMP("GMultGLINTAperture",GMultGLINTAperture); - DUMP("GMultGLINT1",GMultGLINT1); - DUMP("GMultGLINT2",GMultGLINT2); - DUMP("StartXDom",StartXDom); - DUMP("dXDom",dXDom); - DUMP("StartXSub",StartXSub); - DUMP("dXSub",dXSub); - DUMP("StartY",StartY); - DUMP("dY",dY); - DUMP("GLINTCount",GLINTCount); - DUMP("Render",Render); - DUMP("ContinueNewLine",ContinueNewLine); - DUMP("ContinueNewDom",ContinueNewDom); - DUMP("ContinueNewSub",ContinueNewSub); - DUMP("Continue",Continue); - DUMP("FlushSpan",FlushSpan); - DUMP("BitMaskPattern",BitMaskPattern); - DUMP("PointTable0",PointTable0); - DUMP("PointTable1",PointTable1); - DUMP("PointTable2",PointTable2); - DUMP("PointTable3",PointTable3); - DUMP("RasterizerMode",RasterizerMode); - DUMP("YLimits",YLimits); - DUMP("ScanLineOwnership",ScanLineOwnership); - DUMP("WaitForCompletion",WaitForCompletion); - DUMP("PixelSize",PixelSize); - DUMP("XLimits",XLimits); - DUMP("RectangleOrigin",RectangleOrigin); - DUMP("RectangleSize",RectangleSize); - DUMP("PackedDataLimits",PackedDataLimits); - DUMP("ScissorMode",ScissorMode); - DUMP("ScissorMinXY",ScissorMinXY); - DUMP("ScissorMaxXY",ScissorMaxXY); - DUMP("ScreenSize",ScreenSize); - DUMP("AreaStippleMode",AreaStippleMode); - DUMP("LineStippleMode",LineStippleMode); - DUMP("LoadLineStippleCounters",LoadLineStippleCounters); - DUMP("UpdateLineStippleCounters",UpdateLineStippleCounters); - DUMP("SaveLineStippleState",SaveLineStippleState); - DUMP("WindowOrigin",WindowOrigin); - DUMP("AreaStipplePattern0",AreaStipplePattern0); - DUMP("AreaStipplePattern1",AreaStipplePattern1); - DUMP("AreaStipplePattern2",AreaStipplePattern2); - DUMP("AreaStipplePattern3",AreaStipplePattern3); - DUMP("AreaStipplePattern4",AreaStipplePattern4); - DUMP("AreaStipplePattern5",AreaStipplePattern5); - DUMP("AreaStipplePattern6",AreaStipplePattern6); - DUMP("AreaStipplePattern7",AreaStipplePattern7); - DUMP("TextureAddressMode",TextureAddressMode); - DUMP("TextureReadMode",TextureReadMode); - DUMP("TextureFormat",TextureFormat); - DUMP("TextureCacheControl",TextureCacheControl); - DUMP("GLINTBorderColor",GLINTBorderColor); - DUMP("TexelLUTIndex",TexelLUTIndex); - DUMP("TexelLUTData",TexelLUTData); - DUMP("Texel0",Texel0); - DUMP("Texel1",Texel1); - DUMP("Texel2",Texel2); - DUMP("Texel3",Texel3); - DUMP("Texel4",Texel4); - DUMP("Texel5",Texel5); - DUMP("Texel6",Texel6); - DUMP("Texel7",Texel7); - DUMP("Interp0",Interp0); - DUMP("Interp1",Interp1); - DUMP("Interp2",Interp2); - DUMP("Interp3",Interp3); - DUMP("Interp4",Interp4); - DUMP("TextureFilter",TextureFilter); - DUMP("TexelLUTMode",TexelLUTMode); - DUMP("TextureColorMode",TextureColorMode); - DUMP("TextureEnvColor",TextureEnvColor); - DUMP("FogMode",FogMode); - DUMP("FogColor",FogColor); - DUMP("FStart",FStart); - DUMP("dFdx",dFdx); - DUMP("dFdyDom",dFdyDom); - DUMP("KsStart",KsStart); - DUMP("dKsdx",dKsdx); - DUMP("dKsdyDom",dKsdyDom); - DUMP("KdStart", KdStart ); - DUMP("dKdStart", dKdStart); - DUMP("dKddyDom", dKddyDom); - DUMP("RStart", RStart ); - DUMP("dRdx", dRdx); - DUMP("dRdyDom", dRdyDom ); - DUMP("GStart", GStart ); - DUMP("dGdx", dGdx ); - DUMP("dGdyDom", dGdyDom ); - DUMP("BStart", BStart ); - DUMP("dBdx", dBdx ); - DUMP("dBdyDom", dBdyDom ); - DUMP("AStart", AStart ); - DUMP("dAdx", dAdx ); - DUMP("dAdyDom", dAdyDom ); - DUMP("ColorDDAMode", ColorDDAMode ); - DUMP("ConstantColor", ConstantColor ); - DUMP("GLINTColor", GLINTColor); - DUMP("AlphaTestMode", AlphaTestMode ); - DUMP("AntialiasMode", AntialiasMode); - DUMP("AlphaBlendMode", AlphaBlendMode); - DUMP("DitherMode", DitherMode ); - DUMP("FBSoftwareWriteMask", FBSoftwareWriteMask); - DUMP("LogicalOpMode", LogicalOpMode ); - DUMP("FBWriteData", FBWriteData); - DUMP("RouterMode", RouterMode); - DUMP("LBReadMode", LBReadMode); - DUMP("LBReadFormat", LBReadFormat); - DUMP("LBSourceOffset", LBSourceOffset); - DUMP("LBStencil", LBStencil); - DUMP("LBDepth", LBDepth ); - DUMP("LBWindowBase", LBWindowBase); - DUMP("LBWriteMode", LBWriteMode); - DUMP("LBWriteFormat", LBWriteFormat); - DUMP("TextureData", TextureData ); - DUMP("TextureDownloadOffset", TextureDownloadOffset); - DUMP("GLINTWindow", GLINTWindow ); - DUMP("StencilMode", StencilMode); - DUMP("StencilData", StencilData); - DUMP("GLINTStencil", GLINTStencil ); - DUMP("DepthMode", DepthMode); - DUMP("GLINTDepth", GLINTDepth ); - DUMP("ZStartU", ZStartU ); - DUMP("ZStartL", ZStartL ); - DUMP("dZdxU", dZdxU); - DUMP("dZdxL", dZdxL); - DUMP("dZdyDomU",dZdyDomU ); - DUMP("dZdyDomL", dZdyDomL); - DUMP("FastClearDepth", FastClearDepth); - DUMP("FBReadMode", FBReadMode); - DUMP("FBSourceOffset", FBSourceOffset ); - DUMP("FBPixelOffset", FBPixelOffset); - DUMP("FBColor", FBColor ); - DUMP("FBData", FBData); - DUMP("FBSourceData", FBSourceData ); - DUMP("FBWindowBase", FBWindowBase ); - DUMP("FBWriteMode", FBWriteMode ); - DUMP("FBHardwareWriteMask", FBHardwareWriteMask ); - DUMP("FBBlockColor", FBBlockColor ); - DUMP("FBReadPixel", FBReadPixel); - DUMP("PatternRamMode", PatternRamMode ); - DUMP("PatternRamData0", PatternRamData0 ); - DUMP("PatternRamData1", PatternRamData1); - DUMP("PatternRamData2", PatternRamData2 ); - DUMP("PatternRamData3", PatternRamData3 ); - DUMP("PatternRamData4", PatternRamData4); - DUMP("PatternRamData5", PatternRamData5 ); - DUMP("PatternRamData6", PatternRamData6 ); - DUMP("PatternRamData7", PatternRamData7 ); - DUMP("FilterMode", FilterMode ); - DUMP("StatisticMode", StatisticMode); - DUMP("MinRegion", MinRegion ); - DUMP("MaxRegion", MaxRegion ); - DUMP("ResetPickResult", ResetPickResult ); - DUMP("MitHitRegion", MitHitRegion ); - DUMP("MaxHitRegion", MaxHitRegion ); - DUMP("PickResult", PickResult ); - DUMP("GlintSync", GlintSync); - DUMP("FBBlockColorU", FBBlockColorU ); - DUMP("FBBlockColorL", FBBlockColorL ); - DUMP("SuspendUntilFrameBlank", SuspendUntilFrameBlank ); - DUMP("FBSourceBase", FBSourceBase ); - DUMP("FBSourceDelta", FBSourceDelta); - DUMP("Config", Config ); - DUMP("YUVMode", YUVMode ); - DUMP("DrawTriangle", DrawTriangle); - DUMP("RepeatTriangle", RepeatTriangle); - DUMP("DrawLine01", DrawLine01); - DUMP("DrawLine10", DrawLine10 ); - DUMP("RepeatLine", RepeatLine ); - DUMP("BroadcastMask", BroadcastMask ); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tTI3030 direct regs:\n"); -#define TI_WRITE_ADDR 0x4000 -#define TI_RAMDAC_DATA 0x4008 -#define TI_PIXEL_MASK 0x4010 -#define TI_READ_ADDR 0x4018 -#define TI_CURS_COLOR_WRITE_ADDR 0x4020 -#define TI_CURS_COLOR_DATA 0x4028 -#define TI_CURS_COLOR_READ_ADDR 0x4038 -#define TI_DIRECT_CURS_CTRL 0x4048 -#define TI_INDEX_DATA 0x4050 -#define TI_CURS_RAM_DATA 0x4058 -#define TI_CURS_X_LOW 0x4060 -#define TI_CURS_X_HIGH 0x4068 -#define TI_CURS_Y_LOW 0x4070 -#define TI_CURS_Y_HIGH 0x4078 - DUMP("TI_WRITE_ADDR", TI_WRITE_ADDR); - DUMP("TI_RAMDAC_DATA", TI_RAMDAC_DATA); - DUMP("TI_PIXEL_MASK", TI_PIXEL_MASK); - DUMP("TI_READ_ADDR", TI_READ_ADDR); - DUMP("TI_CURS_COLOR_WRITE_ADDR", TI_CURS_COLOR_WRITE_ADDR); - DUMP("TI_CURS_COLOR_DATA", TI_CURS_COLOR_DATA); - DUMP("TI_CURS_COLOR_READ_ADDR", TI_CURS_COLOR_READ_ADDR); - DUMP("TI_DIRECT_CURS_CTRL", TI_DIRECT_CURS_CTRL); - DUMP("TI_INDEX_DATA", TI_INDEX_DATA); - DUMP("TI_CURS_RAM_DATA", TI_CURS_RAM_DATA); - DUMP("TI_CURS_X_LOW", TI_CURS_X_LOW); - DUMP("TI_CURS_X_HIGH", TI_CURS_X_HIGH); - DUMP("TI_CURS_Y_LOW", TI_CURS_Y_LOW); - DUMP("TI_CURS_Y_HIGH", TI_CURS_Y_HIGH); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tTI3030 indirect regs:\n"); - TIDUMP("TIDAC_rev",TIDAC_rev); - TIDUMP("TIDAC_ind_curs_ctrl",TIDAC_ind_curs_ctrl); - TIDUMP("TIDAC_byte_router_ctrl",TIDAC_byte_router_ctrl); - TIDUMP("TIDAC_latch_ctrl",TIDAC_latch_ctrl); - TIDUMP("TIDAC_true_color_ctrl",TIDAC_true_color_ctrl); - TIDUMP("TIDAC_multiplex_ctrl",TIDAC_multiplex_ctrl); - TIDUMP("TIDAC_clock_select",TIDAC_clock_select); - TIDUMP("TIDAC_palette_page",TIDAC_palette_page); - TIDUMP("TIDAC_general_ctrl",TIDAC_general_ctrl); - TIDUMP("TIDAC_misc_ctrl",TIDAC_misc_ctrl); - TIDUMP("TIDAC_pll_addr",TIDAC_pll_addr); - TIDUMP("TIDAC_pll_pixel_data",TIDAC_pll_pixel_data); - TIDUMP("TIDAC_pll_memory_data",TIDAC_pll_memory_data); - TIDUMP("TIDAC_pll_loop_data",TIDAC_pll_loop_data); - TIDUMP("TIDAC_key_over_low",TIDAC_key_over_low); - TIDUMP("TIDAC_key_over_high",TIDAC_key_over_high); - TIDUMP("TIDAC_key_red_low",TIDAC_key_red_low); - TIDUMP("TIDAC_key_red_high",TIDAC_key_red_high); - TIDUMP("TIDAC_key_green_low",TIDAC_key_green_low); - TIDUMP("TIDAC_key_green_high",TIDAC_key_green_high); - TIDUMP("TIDAC_key_blue_low",TIDAC_key_blue_low); - TIDUMP("TIDAC_key_blue_high",TIDAC_key_blue_high); - TIDUMP("TIDAC_key_ctrl",TIDAC_key_ctrl); - TIDUMP("TIDAC_clock_ctrl",TIDAC_clock_ctrl); - TIDUMP("TIDAC_sense_test",TIDAC_sense_test); - TIDUMP("TIDAC_test_mode_data",TIDAC_test_mode_data); - TIDUMP("TIDAC_crc_remain_lsb",TIDAC_crc_remain_lsb); - TIDUMP("TIDAC_crc_remain_msb",TIDAC_crc_remain_msb); - TIDUMP("TIDAC_crc_bit_select",TIDAC_crc_bit_select); - TIDUMP("TIDAC_id",TIDAC_id); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "\tTI3030 PLL regs:\n"); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x00); - TIDUMP("Pixel N",TIDAC_pll_pixel_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x01); - TIDUMP("Pixel M",TIDAC_pll_pixel_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x02); - TIDUMP("Pixel P",TIDAC_pll_pixel_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x00); - TIDUMP("Memory N",TIDAC_pll_memory_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x04); - TIDUMP("Memory M",TIDAC_pll_memory_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x08); - TIDUMP("Memory P",TIDAC_pll_memory_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x00); - TIDUMP("Loop N",TIDAC_pll_loop_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x10); - TIDUMP("Loop M",TIDAC_pll_loop_data); - glintOutTIIndReg(pScrn, TIDAC_pll_addr, 0, 0x20); - TIDUMP("Loop P",TIDAC_pll_loop_data); -} -#endif - -static int -Shiftbpp(ScrnInfoPtr pScrn, int value) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - int logbytesperaccess; - - if ( (pGlint->RamDac->RamDacType == (IBM640_RAMDAC)) || - (pGlint->RamDac->RamDacType == (TI3030_RAMDAC)) ) - logbytesperaccess = 4; - else - logbytesperaccess = 3; - - switch (pScrn->bitsPerPixel) { - case 8: - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 16: - if (pGlint->DoubleBuffer) { - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - } else { - value >>= (logbytesperaccess-1); - pGlint->BppShift = logbytesperaccess-1; - } - break; - case 24: - value *= 3; - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 32: - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - break; - } - return (value); -} - -Bool -DualMXInit(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - GLINTRegPtr pReg = &pGlint->ModeReg; - RamDacHWRecPtr pTI = RAMDACHWPTR(pScrn); - RamDacRegRecPtr ramdacReg = &pTI->ModeReg; - CARD32 temp1, temp2, temp3, temp4; - - pReg->glintRegs[Aperture0 >> 3] = 0; - pReg->glintRegs[Aperture1 >> 3] = 0; - - if (pGlint->UsePCIRetry) { - pReg->glintRegs[DFIFODis >> 3] = GLINT_READ_REG(DFIFODis) | 0x01; - if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) - pReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis) | 0x01; - else - pReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis) | 0x03; - } else { - pReg->glintRegs[DFIFODis >> 3] = GLINT_READ_REG(DFIFODis) & 0xFFFFFFFE; - pReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis) | 0x01; - } - - temp1 = mode->CrtcHSyncStart - mode->CrtcHDisplay; - temp2 = mode->CrtcVSyncStart - mode->CrtcVDisplay; - temp3 = mode->CrtcHSyncEnd - mode->CrtcHSyncStart; - temp4 = mode->CrtcVSyncEnd - mode->CrtcVSyncStart; - - pReg->glintRegs[VTGHLimit >> 3] = Shiftbpp(pScrn,mode->CrtcHTotal); - pReg->glintRegs[VTGHSyncEnd >> 3] = Shiftbpp(pScrn, temp1 + temp3); - pReg->glintRegs[VTGHSyncStart >> 3] = Shiftbpp(pScrn, temp1); - pReg->glintRegs[VTGHBlankEnd >> 3] = Shiftbpp(pScrn, mode->CrtcHTotal - - mode->CrtcHDisplay); - - pReg->glintRegs[VTGVLimit >> 3] = mode->CrtcVTotal; - pReg->glintRegs[VTGVSyncEnd >> 3] = temp2 + temp4; - pReg->glintRegs[VTGVSyncStart >> 3] = temp2; - pReg->glintRegs[VTGVBlankEnd >> 3] = mode->CrtcVTotal - mode->CrtcVDisplay; - -#if 1 /* We force them high */ - pReg->glintRegs[VTGPolarity >> 3] = 0xBA; -#else - pReg->glintRegs[VTGPolarity >> 3] = (((mode->Flags & V_PHSYNC) ? 0:2)<<2) | - ((mode->Flags & V_PVSYNC) ? 0 : 2) | (0xb0); -#endif - - pReg->glintRegs[VClkCtl >> 3] = 0; - pReg->glintRegs[VTGVGateStart >> 3] = pReg->glintRegs[VTGVBlankEnd>>3] - 1; - pReg->glintRegs[VTGVGateEnd >> 3] = pReg->glintRegs[VTGVBlankEnd>>3]; - /* - * tell DAC to use the ICD chip clock 0 as ref clock - * and set up some more video timing generator registers - */ - pReg->glintRegs[VTGHGateStart >> 3] = pReg->glintRegs[VTGHBlankEnd>>3] - 1; - pReg->glintRegs[VTGHGateEnd >> 3] = pReg->glintRegs[VTGHLimit>>3] - 1; - pReg->glintRegs[VTGSerialClk >> 3] = 0x0002; - pReg->glintRegs[FBModeSel >> 3] = 0x907; - pReg->glintRegs[VTGModeCtl >> 3] = 0x04; - - /* - * Setup memory control registers for FB and LB - */ - pReg->glintRegs[FBMemoryCtl >> 3] = 0x00000800; - pReg->glintRegs[LBMemoryEDO >> 3] = GLINT_READ_REG(LBMemoryEDO); - pReg->glintRegs[LBMemoryEDO >> 3] &= ~(LBEDOMask | - LBEDOBankSizeMask | - LBTwoPageDetectorMask); - pReg->glintRegs[LBMemoryEDO >> 3] |= (LBEDOEnabled | - LBEDOBankSize4M | - LBTwoPageDetector); - pReg->glintRegs[LBMemoryCtl >> 3] = GLINT_READ_REG(LBMemoryCtl); - pReg->glintRegs[LBMemoryCtl >> 3] &= ~(LBNumBanksMask | - LBPageSizeMask | - LBRASCASLowMask | - LBRASPrechargeMask | - LBCASLowMask | - LBPageModeMask | - LBRefreshCountMask); - pReg->glintRegs[LBMemoryCtl >> 3] |= (LBNumBanks2 | - LBPageSize1024 | - LBRASCASLow2 | - LBRASPrecharge2 | - LBCASLow1 | - LBPageModeEnabled | - (0x20 << LBRefreshCountShift)); - pReg->glintRegs[GCSRAperture >> 3] = GCSRSecondaryGLINTMapEn; - - /* - * Setup HW - * - * Note: The order of discovery for the MX devices is dependent - * on which way the resource allocation code decides to scan the - * bus. This setup assumes the first MX found owns the even - * scanlines. Should the implementation change an scan the bus - * in the opposite direction, then simple invert the indices for - * MXPciInfo below. If this is setup wrong, the bug will appear - * as incorrect scanline interleaving when software rendering. - */ - pReg->glintRegs[GMultGLINTAperture >> 3] = pGlint->realMXWidth; - pReg->glintRegs[GMultGLINT1 >> 3] = - pGlint->MXPciInfo[0]->memBase[2] & 0xFF800000; - pReg->glintRegs[GMultGLINT2 >> 3] = - pGlint->MXPciInfo[1]->memBase[2] & 0xFF800000; - - /* Copy info to secondary regs */ - pReg->glintSecondRegs[Aperture0>>3] = pReg->glintRegs[Aperture0>>3]; - pReg->glintSecondRegs[Aperture1>>3] = pReg->glintRegs[Aperture1>>3]; - - pReg->glintSecondRegs[DFIFODis>>3] = pReg->glintRegs[DFIFODis>>3]; - pReg->glintSecondRegs[FIFODis>>3] = pReg->glintRegs[FIFODis>>3]; - pReg->glintSecondRegs[VTGHLimit>>3] = pReg->glintRegs[VTGHLimit>>3]; - pReg->glintSecondRegs[VTGHSyncEnd>>3] = pReg->glintRegs[VTGHSyncEnd>>3]; - pReg->glintSecondRegs[VTGHSyncStart>>3] = pReg->glintRegs[VTGHSyncStart>>3]; - pReg->glintSecondRegs[VTGHBlankEnd>>3] = pReg->glintRegs[VTGHBlankEnd>>3]; - pReg->glintSecondRegs[VTGVLimit>>3] = pReg->glintRegs[VTGVLimit>>3]; - pReg->glintSecondRegs[VTGVSyncEnd>>3] = pReg->glintRegs[VTGVSyncEnd>>3]; - pReg->glintSecondRegs[VTGVSyncStart>>3] = pReg->glintRegs[VTGVSyncStart>>3]; - pReg->glintSecondRegs[VTGVBlankEnd>>3] = pReg->glintRegs[VTGVBlankEnd>>3]; - pReg->glintSecondRegs[VTGPolarity>>3] = pReg->glintRegs[VTGPolarity>>3]; - pReg->glintSecondRegs[VClkCtl>>3] = pReg->glintRegs[VClkCtl>>3]; - pReg->glintSecondRegs[VTGVGateStart>>3] = pReg->glintRegs[VTGVGateStart>>3]; - pReg->glintSecondRegs[VTGVGateEnd>>3] = pReg->glintRegs[VTGVGateEnd>>3]; - pReg->glintSecondRegs[VTGSerialClk>>3] = pReg->glintRegs[VTGSerialClk>>3]; - pReg->glintSecondRegs[VTGHGateStart>>3] = pReg->glintRegs[VTGHGateStart>>3]; - pReg->glintSecondRegs[VTGHGateEnd>>3] = pReg->glintRegs[VTGHGateEnd>>3]; - pReg->glintSecondRegs[FBModeSel>>3] = pReg->glintRegs[FBModeSel>>3]; - pReg->glintSecondRegs[VTGModeCtl>>3] = pReg->glintRegs[VTGModeCtl>>3]; - pReg->glintSecondRegs[FBMemoryCtl>>3] = pReg->glintRegs[FBMemoryCtl>>3]; - pReg->glintSecondRegs[LBMemoryEDO>>3] = pReg->glintRegs[LBMemoryEDO>>3]; - pReg->glintSecondRegs[LBMemoryCtl>>3] = pReg->glintRegs[LBMemoryCtl>>3]; - pReg->glintSecondRegs[GCSRAperture>>3] = pReg->glintRegs[GCSRAperture>>3]; - pReg->glintSecondRegs[GMultGLINTAperture>>3] = - pReg->glintRegs[GMultGLINTAperture>>3]; - pReg->glintSecondRegs[GMultGLINT1>>3] = pReg->glintRegs[GMultGLINT1>>3]; - pReg->glintSecondRegs[GMultGLINT2>>3] = pReg->glintRegs[GMultGLINT2>>3]; - - switch (pGlint->RamDac->RamDacType) { - case TI3030_RAMDAC: - case TI3026_RAMDAC: - { - /* Get the programmable clock values */ - unsigned long m=0,n=0,p=0; - unsigned long clock; - int count; - unsigned long q, status, VCO; - - clock = TIramdacCalculateMNPForClock(pGlint->RefClock, - mode->Clock, 1, pGlint->MinClock, pGlint->MaxClock, &m, &n, &p); - - ramdacReg->DacRegs[TIDAC_PIXEL_N] = ((n & 0x3f) | 0xc0); - ramdacReg->DacRegs[TIDAC_PIXEL_M] = (m & 0x3f) ; - ramdacReg->DacRegs[TIDAC_PIXEL_P] = ((p & 0x03) | 0xb0); - ramdacReg->DacRegs[TIDAC_PIXEL_VALID] = TRUE; - - if (pGlint->RamDac->RamDacType == (TI3026_RAMDAC)) - n = 65 - ((64 << 2) / pScrn->bitsPerPixel); - else - n = 65 - ((128 << 2) / pScrn->bitsPerPixel); - m = 61; - p = 0; - for (q = 0; q < 8; q++) { - if (q > 0) p = 3; - for ( ; p < 4; p++) { - VCO = ((clock * (q + 1) * (65 - m)) / (65 - n)) << (p + 1); - if (VCO >= 110000) { break; } - } - if (VCO >= 110000) { break; } - } - ramdacReg->DacRegs[TIDAC_clock_ctrl] = (q | 0x38); - - ramdacReg->DacRegs[TIDAC_LOOP_N] = ((n & 0x3f) | 0xc0); - ramdacReg->DacRegs[TIDAC_LOOP_M] = (m & 0x3f) ; - ramdacReg->DacRegs[TIDAC_LOOP_P] = ((p & 0x03) | 0xf0); - ramdacReg->DacRegs[TIDAC_LOOP_VALID] = TRUE; - } - break; - } - - /* Now use helper routines to setup bpp for this driver */ - (*pGlint->RamDac->SetBpp)(pScrn, ramdacReg); - - return(TRUE); -} - -void -DualMXSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - - glintReg->glintRegs[Aperture0 >> 3] = GLINT_READ_REG(Aperture0); - glintReg->glintRegs[Aperture1 >> 3] = GLINT_READ_REG(Aperture1); - - glintReg->glintRegs[DFIFODis >> 3] = GLINT_READ_REG(DFIFODis); - glintReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis); - - glintReg->glintRegs[VClkCtl >> 3] = GLINT_READ_REG(VClkCtl); - glintReg->glintRegs[VTGPolarity >> 3] = GLINT_READ_REG(VTGPolarity); - glintReg->glintRegs[VTGHLimit >> 3] = GLINT_READ_REG(VTGHLimit); - glintReg->glintRegs[VTGHBlankEnd >> 3] = GLINT_READ_REG(VTGHBlankEnd); - glintReg->glintRegs[VTGHSyncStart >> 3] = GLINT_READ_REG(VTGHSyncStart); - glintReg->glintRegs[VTGHSyncEnd >> 3] = GLINT_READ_REG(VTGHSyncEnd); - glintReg->glintRegs[VTGVLimit >> 3] = GLINT_READ_REG(VTGVLimit); - glintReg->glintRegs[VTGVBlankEnd >> 3] = GLINT_READ_REG(VTGVBlankEnd); - glintReg->glintRegs[VTGVSyncStart >> 3] = GLINT_READ_REG(VTGVSyncStart); - glintReg->glintRegs[VTGVSyncEnd >> 3] = GLINT_READ_REG(VTGVSyncEnd); - glintReg->glintRegs[VTGVGateStart >> 3] = GLINT_READ_REG(VTGVGateStart); - glintReg->glintRegs[VTGVGateEnd >> 3] = GLINT_READ_REG(VTGVGateEnd); - glintReg->glintRegs[VTGSerialClk >> 3] = GLINT_READ_REG(VTGSerialClk); - glintReg->glintRegs[FBModeSel >> 3] = GLINT_READ_REG(FBModeSel); - glintReg->glintRegs[VTGModeCtl >> 3] = GLINT_READ_REG(VTGModeCtl); - glintReg->glintRegs[VTGHGateStart >> 3] = GLINT_READ_REG(VTGHGateStart); - glintReg->glintRegs[VTGHGateEnd >> 3] = GLINT_READ_REG(VTGHGateEnd); - glintReg->glintRegs[FBMemoryCtl >> 3] = GLINT_READ_REG(FBMemoryCtl); - glintReg->glintRegs[LBMemoryEDO >> 3] = GLINT_READ_REG(LBMemoryEDO); - glintReg->glintRegs[LBMemoryCtl >> 3] = GLINT_READ_REG(LBMemoryCtl); - glintReg->glintRegs[GCSRAperture >> 3] = GLINT_READ_REG(GCSRAperture); - glintReg->glintRegs[GMultGLINTAperture>>3] = - GLINT_READ_REG(GMultGLINTAperture); - glintReg->glintRegs[GMultGLINT1>>3] = GLINT_READ_REG(GMultGLINT1); - glintReg->glintRegs[GMultGLINT2>>3] = GLINT_READ_REG(GMultGLINT2); - - glintReg->glintSecondRegs[Aperture0 >> 3] = - GLINT_SECONDARY_READ_REG(Aperture0); - glintReg->glintSecondRegs[Aperture1 >> 3] = - GLINT_SECONDARY_READ_REG(Aperture1); - - glintReg->glintSecondRegs[DFIFODis >> 3] = - GLINT_SECONDARY_READ_REG(DFIFODis); - glintReg->glintSecondRegs[FIFODis >> 3] = - GLINT_SECONDARY_READ_REG(FIFODis); - - glintReg->glintSecondRegs[VClkCtl >> 3] = - GLINT_SECONDARY_READ_REG(VClkCtl); - glintReg->glintSecondRegs[VTGPolarity >> 3] = - GLINT_SECONDARY_READ_REG(VTGPolarity); - glintReg->glintSecondRegs[VTGHLimit >> 3] = - GLINT_SECONDARY_READ_REG(VTGHLimit); - glintReg->glintSecondRegs[VTGHBlankEnd >> 3] = - GLINT_SECONDARY_READ_REG(VTGHBlankEnd); - glintReg->glintSecondRegs[VTGHSyncStart >> 3] = - GLINT_SECONDARY_READ_REG(VTGHSyncStart); - glintReg->glintSecondRegs[VTGHSyncEnd >> 3] = - GLINT_SECONDARY_READ_REG(VTGHSyncEnd); - glintReg->glintSecondRegs[VTGVLimit >> 3] = - GLINT_SECONDARY_READ_REG(VTGVLimit); - glintReg->glintSecondRegs[VTGVBlankEnd >> 3] = - GLINT_SECONDARY_READ_REG(VTGVBlankEnd); - glintReg->glintSecondRegs[VTGVSyncStart >> 3] = - GLINT_SECONDARY_READ_REG(VTGVSyncStart); - glintReg->glintSecondRegs[VTGVSyncEnd >> 3] = - GLINT_SECONDARY_READ_REG(VTGVSyncEnd); - glintReg->glintSecondRegs[VTGVGateStart >> 3] = - GLINT_SECONDARY_READ_REG(VTGVGateStart); - glintReg->glintSecondRegs[VTGVGateEnd >> 3] = - GLINT_SECONDARY_READ_REG(VTGVGateEnd); - glintReg->glintSecondRegs[VTGSerialClk >> 3] = - GLINT_SECONDARY_READ_REG(VTGSerialClk); - glintReg->glintSecondRegs[FBModeSel >> 3] = - GLINT_SECONDARY_READ_REG(FBModeSel); - glintReg->glintSecondRegs[VTGModeCtl >> 3] = - GLINT_SECONDARY_READ_REG(VTGModeCtl); - glintReg->glintSecondRegs[VTGHGateStart >> 3] = - GLINT_SECONDARY_READ_REG(VTGHGateStart); - glintReg->glintSecondRegs[VTGHGateEnd >> 3] = - GLINT_SECONDARY_READ_REG(VTGHGateEnd); - glintReg->glintSecondRegs[FBMemoryCtl >> 3] = - GLINT_SECONDARY_READ_REG(FBMemoryCtl); - glintReg->glintSecondRegs[LBMemoryEDO >> 3] = - GLINT_SECONDARY_READ_REG(LBMemoryEDO); - glintReg->glintSecondRegs[LBMemoryCtl >> 3] = - GLINT_SECONDARY_READ_REG(LBMemoryCtl); - glintReg->glintSecondRegs[GCSRAperture >> 3] = - GLINT_SECONDARY_READ_REG(GCSRAperture); - glintReg->glintSecondRegs[GMultGLINTAperture>>3] = - GLINT_SECONDARY_READ_REG(GMultGLINTAperture); - glintReg->glintSecondRegs[GMultGLINT1>>3] = - GLINT_SECONDARY_READ_REG(GMultGLINT1); - glintReg->glintSecondRegs[GMultGLINT2>>3] = - GLINT_SECONDARY_READ_REG(GMultGLINT2); -} - -void -DualMXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - -#if 0 - GLINT_SLOW_WRITE_REG(0, ResetStatus); - while(GLINT_READ_REG(ResetStatus) != 0) { - xf86MsgVerb(X_INFO, 2, "Resetting Engine - Please Wait.\n"); - }; -#endif - - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture0 >> 3], Aperture0); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture1 >> 3], Aperture1); - - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[DFIFODis >> 3], DFIFODis); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[FIFODis >> 3], FIFODis); - - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGPolarity >> 3], VTGPolarity); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGSerialClk >> 3], VTGSerialClk); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGModeCtl >> 3], VTGModeCtl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHLimit >> 3], VTGHLimit); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHSyncStart >> 3],VTGHSyncStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHSyncEnd >> 3], VTGHSyncEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHBlankEnd >> 3], VTGHBlankEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVLimit >> 3], VTGVLimit); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVSyncStart >> 3],VTGVSyncStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVSyncEnd >> 3], VTGVSyncEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVBlankEnd >> 3], VTGVBlankEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVGateStart >> 3],VTGVGateStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVGateEnd >> 3], VTGVGateEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[FBModeSel >> 3], FBModeSel); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHGateStart >> 3],VTGHGateStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHGateEnd >> 3], VTGHGateEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[FBMemoryCtl >> 3], FBMemoryCtl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[LBMemoryEDO >> 3], LBMemoryEDO); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[LBMemoryCtl >> 3], LBMemoryCtl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[GCSRAperture >> 3], GCSRAperture); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[GMultGLINTAperture >> 3], - GMultGLINTAperture); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[GMultGLINT1 >> 3], GMultGLINT1); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[GMultGLINT2 >> 3], GMultGLINT2); - - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[Aperture0 >> 3], Aperture0); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[Aperture1 >> 3], Aperture1); - - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[DFIFODis >> 3], DFIFODis); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[FIFODis >> 3], FIFODis); - - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGPolarity >> 3], VTGPolarity); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGSerialClk >> 3], VTGSerialClk); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGModeCtl >> 3], VTGModeCtl); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGHLimit >> 3], VTGHLimit); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGHSyncStart >> 3],VTGHSyncStart); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGHSyncEnd >> 3], VTGHSyncEnd); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGHBlankEnd >> 3], VTGHBlankEnd); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGVLimit >> 3], VTGVLimit); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGVSyncStart >> 3],VTGVSyncStart); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGVSyncEnd >> 3], VTGVSyncEnd); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGVBlankEnd >> 3], VTGVBlankEnd); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGVGateStart >> 3],VTGVGateStart); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGVGateEnd >> 3], VTGVGateEnd); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[FBModeSel >> 3], FBModeSel); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGHGateStart >> 3],VTGHGateStart); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[VTGHGateEnd >> 3], VTGHGateEnd); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[FBMemoryCtl >> 3], FBMemoryCtl); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[LBMemoryEDO >> 3], LBMemoryEDO); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[LBMemoryCtl >> 3], LBMemoryCtl); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[GCSRAperture >> 3], GCSRAperture); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[GMultGLINTAperture >>3], GMultGLINTAperture); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[GMultGLINT1 >> 3], GMultGLINT1); - GLINT_SECONDARY_SLOW_WRITE_REG( - glintReg->glintSecondRegs[GMultGLINT2 >> 3], GMultGLINT2); -} Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp:1.10 xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp:1.10 Mon Dec 11 15:18:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp Mon Jun 4 12:40:51 2001 @@ -1,114 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.cpp,v 1.10 2000/12/11 20:18:13 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH GLINT __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -glint \- GLINT/Permedia video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qglint\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B glint -is an XFree86 driver for 3Dlabs & Texas Instruments GLINT/Permedia based video -cards. The driver is rather fully accelerated, and provides support for the -following framebuffer depths: 8, 15 (may give bad results with FBDev support), -16, 24 (32 bpp recommended, 24 bpp has problems), 30, and an 8+24 overlay mode. -.SH SUPPORTED HARDWARE -The -.B glint -driver supports 3Dlabs (GLINT MX, GLINT 500TX, GLINT GAMMA, Permedia, -Permedia 2, Permedia 2v, Permedia 3) and Texas Instruments (Permedia, -Permedia 2) chips. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type, but the following -.B ChipSet -names may optionally be specified in the config file -.B \*qDevice\*q -section, and will override the auto-detection: -.PP -.RS 4 -"ti_pm2", "ti_pm", "pm3", "pm2v", "pm2", "pm", "500tx", "mx", "gamma". -.RE -.PP -The driver will try to auto-detect the amount of video memory present for all -chips. If it's not detected correctly, the actual amount of video memory should -be specified with a -.B VideoRam -entry in the config file -.B \*qDevice\*q -section. -.PP -Additionally, you may need to specify the bus ID of your card with a -.B BusID -entry in the config file -.B \*qDevice\*q -section, especially with FBDev support. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Enable or disable the SW cursor. Default: off. -This option disables the -.B HWCursor -option and vice versa. -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qOverlay\*q" -Enable 8+24 overlay mode. Only appropriate for depth 24, 32 bpp. -.RB ( Note: -This hasn't been tested with FBDev support and probably won't work.) -Recognized values are: "8,24", "24,8". Default: off. -.TP -.BI "Option \*qPciRetry\*q \*q" boolean \*q -Enable or disable PCI retries. -.RB ( Note: -This doesn't work with Permedia2 based cards for Amigas.) Default: off. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. -.RB ( Note: -This disables hardware acceleration.) Default: off. -.TP -.BI "Option \*qUseFBDev\*q \*q" boolean \*q -Enable or disable use of an OS-specific fb interface (which is not supported -on all OSs). See fbdevhw(__drivermansuffix__) for further information. -Default: off. -.ig -.TP -.BI "Option \*qRGBbits\*q \*q" integer \*q -Each gun of the RGB triple can have either 8 or 10 bits. Default: 8 -.. -.TP -.BI "Option \*qBlockWrite\*q \*q" boolean \*q -Enable or disable block writes for the various Permedia 2 chips. This improves -acceleration in general, but disables it for some special cases. Default: off. -.TP -.BI "Option \*qFireGL3000\*q \*q" boolean \*q -If you have a card of the same name, turn this on. Default: off. -.TP -.BI "Option \*qSetMClk\*q \*q" freq \*q -The driver will try to auto-detect the memory clock for all chips. If it's not -detected correctly, the actual value (in MHz) should be specified with this -option. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Alan Hourihane, Dirk Hohndel, Stefan Dirsch, Michel Dänzer, -Sven Luther Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h:1.37 xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h:1.48.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h:1.37 Tue Nov 14 12:32:59 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h Thu May 24 16:12:47 2001 @@ -1,6 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.37 2000/11/14 17:32:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.h,v 1.48.2.1 2001/05/24 20:12:47 alanh Exp $ */ /* - * Copyright 1997,1998 by Alan Hourihane <alanh@fairlite.demon.co.uk> + * Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -45,8 +45,7 @@ #include "glint_dripriv.h" #endif -#define GLINT_MAX_MX_DEVICES 2 -#define GLINT_VGA_MMIO_OFF 0x6000 +#define GLINT_MAX_MULTI_DEVICES 2 #define VERSION 4000 #define GLINT_NAME "GLINT" @@ -57,51 +56,57 @@ typedef struct { CARD32 glintRegs[0x2000]; - CARD32 glintSecondRegs[0x2000]; - CARD32 DacRegs[0x100]; /* used by internal DACs */ + CARD32 DacRegs[0x100]; CARD8 cmap[0x300]; } GLINTRegRec, *GLINTRegPtr; #define GLINTPTR(p) ((GLINTPtr)((p)->driverPrivate)) typedef struct { + int lastInstance; + int refCount; +} GLINTEntRec, *GLINTEntPtr; + +typedef struct { pciVideoPtr PciInfo; - pciVideoPtr MXPciInfo[GLINT_MAX_MX_DEVICES]; - int numMXDevices; + pciVideoPtr MultiPciInfo[GLINT_MAX_MULTI_DEVICES]; + int numMultiDevices; + int MultiChip; + Bool MultiAperture; PCITAG PciTag; EntityInfoPtr pEnt; + GLINTEntPtr entityPrivate; RamDacHelperRecPtr RamDac; - int MemClock; int Chipset; int ChipRev; int HwBpp; int BppShift; int pprod; - int ForeGroundColor; - int BackGroundColor; + CARD32 ForeGroundColor; + CARD32 BackGroundColor; int bppalign; - int startxdom; - int startxsub; - int starty; - int count; - int dy; - int x; - int y; - int w; - int h; - int dxdom; + CARD32 startxdom; + CARD32 startxsub; + CARD32 starty; + CARD32 count; + CARD32 dy; + CARD32 x; + CARD32 y; + CARD32 w; + CARD32 h; + CARD32 dxdom; int dwords; int cpuheight; int cpucount; - int planemask; - int realMXWidth; + CARD32 planemask; + int realWidth; CARD32 IOAddress; unsigned long FbAddress; int irq; unsigned char * IOBase; - unsigned char * IOBaseVGA; unsigned char * FbBase; long FbMapSize; + long IOOffset; DGAModePtr DGAModes; int numDGAModes; Bool DGAactive; @@ -110,47 +115,53 @@ Bool NoAccel; Bool FBDev; Bool ShadowFB; - Bool WriteBitmap; unsigned char * ShadowPtr; int ShadowPitch; Bool Dac6Bit; Bool HWCursor; Bool ClippingOn; - Bool UsePCIRetry; Bool UseBlockWrite; + Bool UseFlatPanel; Bool UseFireGL3000; - Bool VGAcore; + CARD8 VGAdata[65536]; + Bool STATE; + Bool ScanlineDirect; int MXFbSize; CARD32 rasterizerMode; int MinClock; int MaxClock; int RefClock; - GLINTRegRec SavedReg; - GLINTRegRec ModeReg; + GLINTRegRec SavedReg[GLINT_MAX_MULTI_DEVICES]; + GLINTRegRec ModeReg[GLINT_MAX_MULTI_DEVICES]; CARD32 AccelFlags; CARD32 ROP; CARD32 FrameBufferReadMode; CARD32 BltScanDirection; CARD32 TexMapFormat; CARD32 PixelWidth; + CARD32 FIFOSize; RamDacRecPtr RamDacRec; xf86CursorInfoPtr CursorInfoRec; XAAInfoRecPtr AccelInfoRec; CloseScreenProcPtr CloseScreen; + ScreenBlockHandlerProcPtr BlockHandler; GCPtr CurrentGC; DrawablePtr CurrentDrawable; I2CBusPtr DDCBus, VSBus; + CARD32 FGCursor; + CARD32 BGCursor; + CARD8 HardwareCursorPattern[1024]; CARD8* XAAScanlineColorExpandBuffers[2]; + CARD8* ScratchBuffer; CARD32 RasterizerSwap; - int PM3_Config2D; - int PM3_Render2D; - int PM3_AreaStippleMode; - int PM3_VideoControl; - Bool PM3_UseGamma; - pciVideoPtr PM3_GammaPciInfo; - PCITAG PM3_GammaPciTag; - CARD32 PM3_GammaIOAddress; - unsigned char * PM3_GammaIOBase; + void (*LoadCursorCallback)(ScrnInfoPtr); + void (*CursorColorCallback)(ScrnInfoPtr); + CARD32 PM3_PixelSize; + CARD32 PM3_Config2D; + CARD32 PM3_Render2D; + CARD32 PM3_AreaStippleMode; + CARD32 PM3_VideoControl; + int InFifoSpace; #ifdef XF86DRI Bool directRenderingEnabled; DRIInfoPtr pDRIInfo; @@ -161,6 +172,7 @@ GLINTConfigPrivPtr pVisualConfigsPriv; GLINTRegRec DRContextRegs; #endif + OptionInfoPtr Options; } GLINTRec, *GLINTPtr; /* Defines for PCI data */ @@ -212,28 +224,27 @@ void Permedia2VRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void Permedia2VSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); Bool Permedia2VInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +void Permedia2VPreInit(ScrnInfoPtr pScrn); Bool Permedia2vHWCursorInit(ScreenPtr pScreen); -/* pm3_dac.c */ void Permedia3PreInit(ScrnInfoPtr pScrn); int Permedia3MemorySizeDetect(ScrnInfoPtr pScrn); void Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); -Bool Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode); -/* pm3_accel.c */ -/* Not needed, ... is it ever called outside of pm3_accel.c ? -void Permedia3Sync(ScrnInfoPtr pScrn); -*/ +Bool Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg); Bool Permedia3AccelInit(ScreenPtr pScreen); void Permedia3InitializeEngine(ScrnInfoPtr pScrn); -/* End of pm3 stuff */ +void Permedia3EnableOffscreen(ScreenPtr pScreen); +void Permedia3Sync(ScrnInfoPtr pScrn); +void DualPermedia3Sync(ScrnInfoPtr pScrn); void TXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); void TXSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); -Bool TXInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +Bool TXInit(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr glintReg); Bool TXAccelInit(ScreenPtr pScreen); void TXInitializeEngine(ScrnInfoPtr pScrn); +void SXInitializeEngine(ScrnInfoPtr pScrn); Bool SXAccelInit(ScreenPtr pScreen); void DualMXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg); @@ -256,17 +267,17 @@ void glintOutTIIndReg(ScrnInfoPtr pScrn, CARD32 reg, unsigned char mask, unsigned char data); unsigned char glintInTIIndReg(ScrnInfoPtr pScrn, CARD32 reg); -void DUALglintOutTIIndReg(ScrnInfoPtr pScrn, +void GMX2000OutIndReg(ScrnInfoPtr pScrn, CARD32 reg, unsigned char mask, unsigned char data); -unsigned char DUALglintInTIIndReg(ScrnInfoPtr pScrn, CARD32 reg); +unsigned char GMX2000InIndReg(ScrnInfoPtr pScrn, CARD32 reg); void glintTIWriteAddress(ScrnInfoPtr pScrn, CARD32 index); void glintTIReadAddress(ScrnInfoPtr pScrn, CARD32 index); void glintTIWriteData(ScrnInfoPtr pScrn, unsigned char data); unsigned char glintTIReadData(ScrnInfoPtr pScrn); -void DUALglintTIWriteAddress(ScrnInfoPtr pScrn, CARD32 index); -void DUALglintTIReadAddress(ScrnInfoPtr pScrn, CARD32 index); -void DUALglintTIWriteData(ScrnInfoPtr pScrn, unsigned char data); -unsigned char DUALglintTIReadData(ScrnInfoPtr pScrn); +void GMX2000WriteAddress(ScrnInfoPtr pScrn, CARD32 index); +void GMX2000ReadAddress(ScrnInfoPtr pScrn, CARD32 index); +void GMX2000WriteData(ScrnInfoPtr pScrn, unsigned char data); +unsigned char GMX2000ReadData(ScrnInfoPtr pScrn); Bool glintTIHWCursorInit(ScreenPtr pScreen); void Permedia2OutIndReg(ScrnInfoPtr pScrn, @@ -282,6 +293,10 @@ LOCO *colors, VisualPtr pVisual); void Permedia2LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual); +void Permedia3LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO *colors, VisualPtr pVisual); +void Permedia3LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, + LOCO *colors, VisualPtr pVisual); void Permedia2I2CUDelay(I2CBusPtr b, int usec); void Permedia2I2CPutBits(I2CBusPtr b, int scl, int sda); void Permedia2I2CGetBits(I2CBusPtr b, int *scl, int *sda); @@ -291,6 +306,11 @@ void Permedia2VideoEnterVT(ScrnInfoPtr pScrn); void Permedia2VideoLeaveVT(ScrnInfoPtr pScrn); +void Permedia3VideoInit(ScreenPtr pScreen); +void Permedia3VideoUninit(ScrnInfoPtr pScrn); +void Permedia3VideoEnterVT(ScrnInfoPtr pScrn); +void Permedia3VideoLeaveVT(ScrnInfoPtr pScrn); + void Permedia2vOutIndReg(ScrnInfoPtr pScrn, CARD32, unsigned char mask, unsigned char data); unsigned char Permedia2vInIndReg(ScrnInfoPtr pScrn, CARD32); @@ -300,6 +320,8 @@ extern int partprodPermedia[]; +Bool GLINTDGAInit(ScreenPtr pScreen); + Bool GLINTDRIScreenInit(ScreenPtr pScreen); Bool GLINTDRIFinishScreenInit(ScreenPtr pScreen); void GLINTDRICloseScreen(ScreenPtr pScreen); @@ -314,4 +336,10 @@ CARD32 GLINT_VERB_READ_REG(GLINTPtr, CARD32 r, char *file, int line); void GLINTRefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); + +void GLINT_MoveBYTE(CARD32* dest, unsigned char* src, int dwords); +void GLINT_MoveWORDS(CARD32* dest, unsigned short* src, int dwords); +void GLINT_MoveDWORDS(CARD32* dest, CARD32* src, int dwords); + +int Shiftbpp(ScrnInfoPtr pScrn, int value); #endif /* _GLINT_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man:1.3 --- /dev/null Mon Jun 4 12:40:51 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man Mon Mar 19 17:50:28 2001 @@ -0,0 +1,114 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint.man,v 1.3 2001/03/19 22:50:28 alanh Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH GLINT __drivermansuffix__ __vendorversion__ +.SH NAME +glint \- GLINT/Permedia video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qglint\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B glint +is an XFree86 driver for 3Dlabs & Texas Instruments GLINT/Permedia based video +cards. The driver is rather fully accelerated, and provides support for the +following framebuffer depths: 8, 15 (may give bad results with FBDev support), +16, 24 (32 bpp recommended, 24 bpp has problems), 30, and an 8+24 overlay mode. +.SH SUPPORTED HARDWARE +The +.B glint +driver supports 3Dlabs (GLINT MX, GLINT 500TX, GLINT GAMMA, Permedia, +Permedia 2, Permedia 2v, Permedia 3) and Texas Instruments (Permedia, +Permedia 2) chips. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto-detects the chipset type, but the following +.B ChipSet +names may optionally be specified in the config file +.B \*qDevice\*q +section, and will override the auto-detection: +.PP +.RS 4 +"ti_pm2", "ti_pm", "pm3", "pm2v", "pm2", "pm", "500tx", "mx", "gamma". +.RE +.PP +The driver will try to auto-detect the amount of video memory present for all +chips. If it's not detected correctly, the actual amount of video memory should +be specified with a +.B VideoRam +entry in the config file +.B \*qDevice\*q +section. +.PP +Additionally, you may need to specify the bus ID of your card with a +.B BusID +entry in the config file +.B \*qDevice\*q +section, especially with FBDev support. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qUseFlatPanel\*q \*q" boolean \*q +Enable the FlatPanel feature on the Permedia3. Default: off. +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +Enable or disable the SW cursor. Default: off. +This option disables the +.B HWCursor +option and vice versa. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.TP +.BI "Option \*qOverlay\*q" +Enable 8+24 overlay mode. Only appropriate for depth 24, 32 bpp. +.RB ( Note: +This hasn't been tested with FBDev support and probably won't work.) +Recognized values are: "8,24", "24,8". Default: off. +.TP +.BI "Option \*qPciRetry\*q \*q" boolean \*q +Enable or disable PCI retries. +.RB ( Note: +This doesn't work with Permedia2 based cards for Amigas.) Default: off. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. See +shadowfb(__drivermansuffix__) for further information. +.RB ( Note: +This disables hardware acceleration.) Default: off. +.TP +.BI "Option \*qUseFBDev\*q \*q" boolean \*q +Enable or disable use of an OS-specific fb interface (which is not supported +on all OSs). See fbdevhw(__drivermansuffix__) for further information. +Default: off. +.ig +.TP +.BI "Option \*qRGBbits\*q \*q" integer \*q +Each gun of the RGB triple can have either 8 or 10 bits. Default: 8 +.. +.TP +.BI "Option \*qBlockWrite\*q \*q" boolean \*q +Enable or disable block writes for the various Permedia 2 chips. This improves +acceleration in general, but disables it for some special cases. Default: off. +.TP +.BI "Option \*qFireGL3000\*q \*q" boolean \*q +If you have a card of the same name, turn this on. Default: off. +.TP +.BI "Option \*qSetMClk\*q \*q" freq \*q +The driver will try to auto-detect the memory clock for all chips. If it's not +detected correctly, the actual value (in MHz) should be specified with this +option. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Alan Hourihane, Dirk Hohndel, Stefan Dirsch, Michel Dänzer, +Sven Luther Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c:1.1 Wed May 10 14:55:29 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c Tue Apr 10 16:33:30 2001 @@ -1,5 +1,5 @@ /* - * Copyright 2000 by Alan Hourihane, Sychdyn, North Wales, UK. + * Copyright 2000-2001 by Alan Hourihane, Sychdyn, North Wales, UK. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c,v 1.1 2000/05/10 18:55:29 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dga.c,v 1.3 2001/04/10 20:33:30 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -42,8 +42,10 @@ 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 = { @@ -54,9 +56,8 @@ GLINT_GetViewport, GLINT_Sync, GLINT_FillRect, - NULL, -#if 0 GLINT_BlitRect, +#if 0 GLINT_BlitTransRect #else NULL @@ -260,6 +261,7 @@ } +#if 0 static void GLINT_BlitTransRect( ScrnInfoPtr pScrn, @@ -271,6 +273,7 @@ /* this one should be separate since the XAA function would prohibit usage of ~0 as the key */ } +#endif static Bool Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c:1.18 xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c:1.27 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c:1.18 Fri Jun 23 19:43:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c Wed May 2 11:06:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c,v 1.18 2000/06/23 23:43:43 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.c,v 1.27 2001/05/02 15:06:09 dawes Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -92,20 +92,20 @@ 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); @@ -305,8 +305,9 @@ LBRF_FrameCountPos24 | LBRF_GIDWidth4 | LBRF_GIDPos32 ), LBWriteFormat); - if (pGlint->numMXDevices == 2) { - GLINT_SECONDARY_SLOW_WRITE_REG( + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + GLINT_SLOW_WRITE_REG( (LBRF_DepthWidth16 | LBRF_StencilWidth8 | LBRF_StencilPos16 | @@ -314,7 +315,7 @@ LBRF_FrameCountPos24 | LBRF_GIDWidth4 | LBRF_GIDPos32 ), LBReadFormat); - GLINT_SECONDARY_SLOW_WRITE_REG( + GLINT_SLOW_WRITE_REG( (LBRF_DepthWidth16 | LBRF_StencilWidth8 | LBRF_StencilPos16 | @@ -322,6 +323,7 @@ LBRF_FrameCountPos24 | LBRF_GIDWidth4 | LBRF_GIDPos32 ), LBWriteFormat); + ACCESSCHIP1(); } return TRUE; @@ -343,7 +345,7 @@ if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE; if (!xf86LoaderCheckSymbol("DRIQueryVersion")) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "GLINTDRIScreenInit failed (libdri.a too old)\n"); + "[dri] GLINTDRIScreenInit failed (libdri.a too old)\n"); return FALSE; } @@ -351,9 +353,11 @@ { int major, minor, patch; DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 0 || patch < 0) { + if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "GLINTDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.0.x). Disabling DRI.\n", + "[dri] GLINTDRIScreenInit failed because of a version mismatch.\n" + "[dri] libDRI version is %d.%d.%d but version 4.0.x is needed.\n" + "[dri] Disabling DRI.\n", major, minor, patch); return FALSE; } @@ -361,8 +365,10 @@ if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_GAMMA) return FALSE; - if (pGlint->numMXDevices > 2) return FALSE; + if (pGlint->numMultiDevices > 2) return FALSE; + if (pGlint->MultiChip != PCI_CHIP_MX) return FALSE; + pDRIInfo = DRICreateInfoRec(); if(pDRIInfo == NULL) return FALSE; @@ -408,7 +414,7 @@ pDRIInfo->SAREASize = SAREA_MAX; #endif - if (!(pGlintDRI = (GLINTDRIPtr)xnfcalloc(sizeof(GLINTDRIRec),1))) { + if (!(pGlintDRI = (GLINTDRIPtr)xcalloc(sizeof(GLINTDRIRec),1))) { DRIDestroyInfoRec(pGlint->pDRIInfo); return FALSE; } @@ -425,6 +431,9 @@ pDRIInfo->MoveBuffers = GLINTDRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; + if (!DRIScreenInit(pScreen, pDRIInfo, &(pGlint->drmSubFD))) { DRIDestroyInfoRec(pGlint->pDRIInfo); xfree(pGlintDRI); @@ -436,14 +445,15 @@ drmVersionPtr version = drmGetVersion(pGlint->drmSubFD); if (version) { if (version->version_major != 1 || - version->version_minor != 0 || - version->version_patchlevel < 0) { + version->version_minor < 0) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, - "GLINTDRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n", - version->version_major, - version->version_minor, - version->version_patchlevel); + "[dri] GLINTDRIScreenInit failed because of a version mismatch.\n" + "[dri] gamma.o kernel module version is %d.%d.%d but version 1.0.x is needed.\n" + "[dri] Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); GLINTDRICloseScreen(pScreen); drmFreeVersion(version); return FALSE; @@ -453,7 +463,7 @@ } /* Tell the client driver how many MX's we have */ - pGlintDRI->numMXDevices = pGlint->numMXDevices; + pGlintDRI->numMultiDevices = pGlint->numMultiDevices; /* Tell the client about our screen size setup */ pGlintDRI->pprod = pGlint->pprod; @@ -585,6 +595,8 @@ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] %d DMA buffers mapped\n", pGlint->drmBufs->count); + xf86EnablePciBusMaster(pGlint->PciInfo, TRUE); + /* tell the generic kernel driver how to handle Gamma DMA */ if (pGlint->irq <= 0) { pGlint->irq = drmGetInterruptFromBusID(pGlint->drmSubFD, @@ -614,7 +626,7 @@ DRICloseScreen(pScreen); return FALSE; } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "visual configs initialized\n" ); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized.\n" ); return TRUE; } @@ -827,68 +839,70 @@ pRC->MX1.CFilterMode = GLINT_READ_REG(FilterMode); pRC->MX1.CStatisticMode = GLINT_READ_REG(StatisticMode); - if (pGlint->numMXDevices == 2) { + if (pGlint->numMultiDevices == 2) { pRC->MX1.CBroadcastMask = GLINT_READ_REG(BroadcastMask); - pRC->MX2.CStartXDom = GLINT_SECONDARY_READ_REG(StartXDom); - pRC->MX2.CdXDom = GLINT_SECONDARY_READ_REG(dXDom); - pRC->MX2.CStartXSub = GLINT_SECONDARY_READ_REG(StartXSub); - pRC->MX2.CdXSub = GLINT_SECONDARY_READ_REG(dXSub); - pRC->MX2.CStartY = GLINT_SECONDARY_READ_REG(StartY); - pRC->MX2.CdY = GLINT_SECONDARY_READ_REG(dY); - pRC->MX2.CGLINTCount = GLINT_SECONDARY_READ_REG(GLINTCount); - pRC->MX2.CPointTable0 = GLINT_SECONDARY_READ_REG(PointTable0); - pRC->MX2.CPointTable1 = GLINT_SECONDARY_READ_REG(PointTable1); - pRC->MX2.CPointTable2 = GLINT_SECONDARY_READ_REG(PointTable2); - pRC->MX2.CPointTable3 = GLINT_SECONDARY_READ_REG(PointTable3); - pRC->MX2.CRasterizerMode = GLINT_SECONDARY_READ_REG(RasterizerMode); - pRC->MX2.CYLimits = GLINT_SECONDARY_READ_REG(YLimits); - pRC->MX2.CScanLineOwnership = GLINT_SECONDARY_READ_REG(ScanLineOwnership); - pRC->MX2.CPixelSize = GLINT_SECONDARY_READ_REG(PixelSize); - pRC->MX2.CScissorMode = GLINT_SECONDARY_READ_REG(ScissorMode); - pRC->MX2.CScissorMinXY = GLINT_SECONDARY_READ_REG(ScissorMinXY); - pRC->MX2.CScissorMaxXY = GLINT_SECONDARY_READ_REG(ScissorMaxXY); - pRC->MX2.CScreenSize = GLINT_SECONDARY_READ_REG(ScreenSize); - pRC->MX2.CAreaStippleMode = GLINT_SECONDARY_READ_REG(AreaStippleMode); - pRC->MX2.CLineStippleMode = GLINT_SECONDARY_READ_REG(LineStippleMode); - pRC->MX2.CLoadLineStippleCounters = GLINT_SECONDARY_READ_REG(LoadLineStippleCounters); - pRC->MX2.CWindowOrigin = GLINT_SECONDARY_READ_REG(WindowOrigin); - pRC->MX2.CRouterMode = GLINT_SECONDARY_READ_REG(RouterMode); - pRC->MX2.CTextureAddressMode = GLINT_SECONDARY_READ_REG(TextureAddressMode); - pRC->MX2.CTextureReadMode = GLINT_SECONDARY_READ_REG(TextureReadMode); - pRC->MX2.CTextureColorMode = GLINT_SECONDARY_READ_REG(TextureColorMode); - pRC->MX2.CFogMode = GLINT_SECONDARY_READ_REG(FogMode); - pRC->MX2.CColorDDAMode = GLINT_SECONDARY_READ_REG(ColorDDAMode); - pRC->MX2.CGLINTColor = GLINT_SECONDARY_READ_REG(GLINTColor); - pRC->MX2.CAlphaTestMode = GLINT_SECONDARY_READ_REG(AlphaTestMode); - pRC->MX2.CAntialiasMode = GLINT_SECONDARY_READ_REG(AntialiasMode); - pRC->MX2.CAlphaBlendMode = GLINT_SECONDARY_READ_REG(AlphaBlendMode); - pRC->MX2.CDitherMode = GLINT_SECONDARY_READ_REG(DitherMode); - pRC->MX2.CFBSoftwareWriteMask = GLINT_SECONDARY_READ_REG(FBSoftwareWriteMask); - pRC->MX2.CLogicalOpMode = GLINT_SECONDARY_READ_REG(LogicalOpMode); - pRC->MX2.CFBWriteData = GLINT_SECONDARY_READ_REG(FBWriteData); - pRC->MX2.CLBReadMode = GLINT_SECONDARY_READ_REG(LBReadMode); - pRC->MX2.CLBSourceOffset = GLINT_SECONDARY_READ_REG(LBSourceOffset); - pRC->MX2.CLBWindowBase = GLINT_SECONDARY_READ_REG(LBWindowBase); - pRC->MX2.CLBWriteMode = GLINT_SECONDARY_READ_REG(LBWriteMode); - pRC->MX2.CTextureDownloadOffset = GLINT_SECONDARY_READ_REG(TextureDownloadOffset); - pRC->MX2.CLBWindowOffset = GLINT_SECONDARY_READ_REG(LBWindowOffset); - pRC->MX2.CGLINTWindow = GLINT_SECONDARY_READ_REG(GLINTWindow); - pRC->MX2.CStencilMode = GLINT_SECONDARY_READ_REG(StencilMode); - pRC->MX2.CDepthMode = GLINT_SECONDARY_READ_REG(DepthMode); - pRC->MX2.CGLINTDepth = GLINT_SECONDARY_READ_REG(GLINTDepth); - pRC->MX2.CFBReadMode = GLINT_SECONDARY_READ_REG(FBReadMode); - pRC->MX2.CFBSourceOffset = GLINT_SECONDARY_READ_REG(FBSourceOffset); - pRC->MX2.CFBPixelOffset = GLINT_SECONDARY_READ_REG(FBPixelOffset); - pRC->MX2.CFBWindowBase = GLINT_SECONDARY_READ_REG(FBWindowBase); - pRC->MX2.CFBWriteMode = GLINT_SECONDARY_READ_REG(FBWriteMode); - pRC->MX2.CFBHardwareWriteMask = GLINT_SECONDARY_READ_REG(FBHardwareWriteMask); - pRC->MX2.CFBBlockColor = GLINT_SECONDARY_READ_REG(FBBlockColor); - pRC->MX2.CPatternRamMode = GLINT_SECONDARY_READ_REG(PatternRamMode); - pRC->MX2.CFBBlockColorU = GLINT_SECONDARY_READ_REG(FBBlockColorU); - pRC->MX2.CFBBlockColorL = GLINT_SECONDARY_READ_REG(FBBlockColorL); - pRC->MX2.CFilterMode = GLINT_SECONDARY_READ_REG(FilterMode); - pRC->MX2.CStatisticMode = GLINT_SECONDARY_READ_REG(StatisticMode); + ACCESSCHIP2(); + pRC->MX2.CStartXDom = GLINT_READ_REG(StartXDom); + pRC->MX2.CdXDom = GLINT_READ_REG(dXDom); + pRC->MX2.CStartXSub = GLINT_READ_REG(StartXSub); + pRC->MX2.CdXSub = GLINT_READ_REG(dXSub); + pRC->MX2.CStartY = GLINT_READ_REG(StartY); + pRC->MX2.CdY = GLINT_READ_REG(dY); + pRC->MX2.CGLINTCount = GLINT_READ_REG(GLINTCount); + pRC->MX2.CPointTable0 = GLINT_READ_REG(PointTable0); + pRC->MX2.CPointTable1 = GLINT_READ_REG(PointTable1); + pRC->MX2.CPointTable2 = GLINT_READ_REG(PointTable2); + pRC->MX2.CPointTable3 = GLINT_READ_REG(PointTable3); + pRC->MX2.CRasterizerMode = GLINT_READ_REG(RasterizerMode); + pRC->MX2.CYLimits = GLINT_READ_REG(YLimits); + pRC->MX2.CScanLineOwnership = GLINT_READ_REG(ScanLineOwnership); + pRC->MX2.CPixelSize = GLINT_READ_REG(PixelSize); + pRC->MX2.CScissorMode = GLINT_READ_REG(ScissorMode); + pRC->MX2.CScissorMinXY = GLINT_READ_REG(ScissorMinXY); + pRC->MX2.CScissorMaxXY = GLINT_READ_REG(ScissorMaxXY); + pRC->MX2.CScreenSize = GLINT_READ_REG(ScreenSize); + pRC->MX2.CAreaStippleMode = GLINT_READ_REG(AreaStippleMode); + pRC->MX2.CLineStippleMode = GLINT_READ_REG(LineStippleMode); + pRC->MX2.CLoadLineStippleCounters = GLINT_READ_REG(LoadLineStippleCounters); + pRC->MX2.CWindowOrigin = GLINT_READ_REG(WindowOrigin); + pRC->MX2.CRouterMode = GLINT_READ_REG(RouterMode); + pRC->MX2.CTextureAddressMode = GLINT_READ_REG(TextureAddressMode); + pRC->MX2.CTextureReadMode = GLINT_READ_REG(TextureReadMode); + pRC->MX2.CTextureColorMode = GLINT_READ_REG(TextureColorMode); + pRC->MX2.CFogMode = GLINT_READ_REG(FogMode); + pRC->MX2.CColorDDAMode = GLINT_READ_REG(ColorDDAMode); + pRC->MX2.CGLINTColor = GLINT_READ_REG(GLINTColor); + pRC->MX2.CAlphaTestMode = GLINT_READ_REG(AlphaTestMode); + pRC->MX2.CAntialiasMode = GLINT_READ_REG(AntialiasMode); + pRC->MX2.CAlphaBlendMode = GLINT_READ_REG(AlphaBlendMode); + pRC->MX2.CDitherMode = GLINT_READ_REG(DitherMode); + pRC->MX2.CFBSoftwareWriteMask = GLINT_READ_REG(FBSoftwareWriteMask); + pRC->MX2.CLogicalOpMode = GLINT_READ_REG(LogicalOpMode); + pRC->MX2.CFBWriteData = GLINT_READ_REG(FBWriteData); + pRC->MX2.CLBReadMode = GLINT_READ_REG(LBReadMode); + pRC->MX2.CLBSourceOffset = GLINT_READ_REG(LBSourceOffset); + pRC->MX2.CLBWindowBase = GLINT_READ_REG(LBWindowBase); + pRC->MX2.CLBWriteMode = GLINT_READ_REG(LBWriteMode); + pRC->MX2.CTextureDownloadOffset = GLINT_READ_REG(TextureDownloadOffset); + pRC->MX2.CLBWindowOffset = GLINT_READ_REG(LBWindowOffset); + pRC->MX2.CGLINTWindow = GLINT_READ_REG(GLINTWindow); + pRC->MX2.CStencilMode = GLINT_READ_REG(StencilMode); + pRC->MX2.CDepthMode = GLINT_READ_REG(DepthMode); + pRC->MX2.CGLINTDepth = GLINT_READ_REG(GLINTDepth); + pRC->MX2.CFBReadMode = GLINT_READ_REG(FBReadMode); + pRC->MX2.CFBSourceOffset = GLINT_READ_REG(FBSourceOffset); + pRC->MX2.CFBPixelOffset = GLINT_READ_REG(FBPixelOffset); + pRC->MX2.CFBWindowBase = GLINT_READ_REG(FBWindowBase); + pRC->MX2.CFBWriteMode = GLINT_READ_REG(FBWriteMode); + pRC->MX2.CFBHardwareWriteMask = GLINT_READ_REG(FBHardwareWriteMask); + pRC->MX2.CFBBlockColor = GLINT_READ_REG(FBBlockColor); + pRC->MX2.CPatternRamMode = GLINT_READ_REG(PatternRamMode); + pRC->MX2.CFBBlockColorU = GLINT_READ_REG(FBBlockColorU); + pRC->MX2.CFBBlockColorL = GLINT_READ_REG(FBBlockColorL); + pRC->MX2.CFilterMode = GLINT_READ_REG(FilterMode); + pRC->MX2.CStatisticMode = GLINT_READ_REG(StatisticMode); + ACCESSCHIP1(); } if (readContextType == DRI_3D_CONTEXT) { @@ -1016,133 +1030,135 @@ pRC->MX1.CKdBStart = GLINT_READ_REG(KdBStart); pRC->MX1.CdKdBdx = GLINT_READ_REG(dKdBdx); pRC->MX1.CdKdBdyDom = GLINT_READ_REG(dKdBdyDom); - if (pGlint->numMXDevices == 2) { - pRC->MX2.CSStart = GLINT_SECONDARY_READ_REG(SStart); - pRC->MX2.CdSdx = GLINT_SECONDARY_READ_REG(dSdx); - pRC->MX2.CdSdyDom = GLINT_SECONDARY_READ_REG(dSdyDom); - pRC->MX2.CTStart = GLINT_SECONDARY_READ_REG(TStart); - pRC->MX2.CdTdx = GLINT_SECONDARY_READ_REG(dTdx); - pRC->MX2.CdTdyDom = GLINT_SECONDARY_READ_REG(dTdyDom); - pRC->MX2.CQStart = GLINT_SECONDARY_READ_REG(QStart); - pRC->MX2.CdQdx = GLINT_SECONDARY_READ_REG(dQdx); - pRC->MX2.CdQdyDom = GLINT_SECONDARY_READ_REG(dQdyDom); - pRC->MX2.CLOD = GLINT_SECONDARY_READ_REG(LOD); - pRC->MX2.CdSdy = GLINT_SECONDARY_READ_REG(dSdy); - pRC->MX2.CdTdy = GLINT_SECONDARY_READ_REG(dTdy); - pRC->MX2.CdQdy = GLINT_SECONDARY_READ_REG(dQdy); - pRC->MX2.CTextureFormat = GLINT_SECONDARY_READ_REG(TextureFormat); - pRC->MX2.CTextureCacheControl = GLINT_SECONDARY_READ_REG(TextureCacheControl); - pRC->MX2.CGLINTBorderColor = GLINT_SECONDARY_READ_REG(GLINTBorderColor); - pRC->MX2.CTexelLUTIndex = GLINT_SECONDARY_READ_REG(TexelLUTIndex); - pRC->MX2.CTexelLUTData = GLINT_SECONDARY_READ_REG(TexelLUTData); - pRC->MX2.CTexelLUTAddress = GLINT_SECONDARY_READ_REG(TexelLUTAddress); - pRC->MX2.CTexelLUTTransfer = GLINT_SECONDARY_READ_REG(TexelLUTTransfer); - pRC->MX2.CTextureFilterMode = GLINT_SECONDARY_READ_REG(TextureFilterMode); - pRC->MX2.CTextureChromaUpper = GLINT_SECONDARY_READ_REG(TextureChromaUpper); - pRC->MX2.CTextureChromaLower = GLINT_SECONDARY_READ_REG(TextureChromaLower); - pRC->MX2.CTxBaseAddr0 = GLINT_SECONDARY_READ_REG(TxBaseAddr0); - pRC->MX2.CTxBaseAddr1 = GLINT_SECONDARY_READ_REG(TxBaseAddr1); - pRC->MX2.CTxBaseAddr2 = GLINT_SECONDARY_READ_REG(TxBaseAddr2); - pRC->MX2.CTxBaseAddr3 = GLINT_SECONDARY_READ_REG(TxBaseAddr3); - pRC->MX2.CTxBaseAddr4 = GLINT_SECONDARY_READ_REG(TxBaseAddr4); - pRC->MX2.CTxBaseAddr5 = GLINT_SECONDARY_READ_REG(TxBaseAddr5); - pRC->MX2.CTxBaseAddr6 = GLINT_SECONDARY_READ_REG(TxBaseAddr6); - pRC->MX2.CTxBaseAddr7 = GLINT_SECONDARY_READ_REG(TxBaseAddr7); - pRC->MX2.CTxBaseAddr8 = GLINT_SECONDARY_READ_REG(TxBaseAddr8); - pRC->MX2.CTxBaseAddr9 = GLINT_SECONDARY_READ_REG(TxBaseAddr9); - pRC->MX2.CTxBaseAddr10 = GLINT_SECONDARY_READ_REG(TxBaseAddr10); - pRC->MX2.CTxBaseAddr11 = GLINT_SECONDARY_READ_REG(TxBaseAddr11); - pRC->MX2.CTexelLUT0 = GLINT_SECONDARY_READ_REG(TexelLUT0); - pRC->MX2.CTexelLUT1 = GLINT_SECONDARY_READ_REG(TexelLUT1); - pRC->MX2.CTexelLUT2 = GLINT_SECONDARY_READ_REG(TexelLUT2); - pRC->MX2.CTexelLUT3 = GLINT_SECONDARY_READ_REG(TexelLUT3); - pRC->MX2.CTexelLUT4 = GLINT_SECONDARY_READ_REG(TexelLUT4); - pRC->MX2.CTexelLUT5 = GLINT_SECONDARY_READ_REG(TexelLUT5); - pRC->MX2.CTexelLUT6 = GLINT_SECONDARY_READ_REG(TexelLUT6); - pRC->MX2.CTexelLUT7 = GLINT_SECONDARY_READ_REG(TexelLUT7); - pRC->MX2.CTexelLUT8 = GLINT_SECONDARY_READ_REG(TexelLUT8); - pRC->MX2.CTexelLUT9 = GLINT_SECONDARY_READ_REG(TexelLUT9); - pRC->MX2.CTexelLUT10 = GLINT_SECONDARY_READ_REG(TexelLUT10); - pRC->MX2.CTexelLUT11 = GLINT_SECONDARY_READ_REG(TexelLUT11); - pRC->MX2.CTexelLUT12 = GLINT_SECONDARY_READ_REG(TexelLUT12); - pRC->MX2.CTexelLUT13 = GLINT_SECONDARY_READ_REG(TexelLUT13); - pRC->MX2.CTexelLUT14 = GLINT_SECONDARY_READ_REG(TexelLUT14); - pRC->MX2.CTexelLUT15 = GLINT_SECONDARY_READ_REG(TexelLUT15); - pRC->MX2.CTexel0 = GLINT_SECONDARY_READ_REG(Texel0); - pRC->MX2.CTexel1 = GLINT_SECONDARY_READ_REG(Texel1); - pRC->MX2.CTexel2 = GLINT_SECONDARY_READ_REG(Texel2); - pRC->MX2.CTexel3 = GLINT_SECONDARY_READ_REG(Texel3); - pRC->MX2.CTexel4 = GLINT_SECONDARY_READ_REG(Texel4); - pRC->MX2.CTexel5 = GLINT_SECONDARY_READ_REG(Texel5); - pRC->MX2.CTexel6 = GLINT_SECONDARY_READ_REG(Texel6); - pRC->MX2.CTexel7 = GLINT_SECONDARY_READ_REG(Texel7); - pRC->MX2.CInterp0 = GLINT_SECONDARY_READ_REG(Interp0); - pRC->MX2.CInterp1 = GLINT_SECONDARY_READ_REG(Interp1); - pRC->MX2.CInterp2 = GLINT_SECONDARY_READ_REG(Interp2); - pRC->MX2.CInterp3 = GLINT_SECONDARY_READ_REG(Interp3); - pRC->MX2.CInterp4 = GLINT_SECONDARY_READ_REG(Interp4); - pRC->MX2.CTextureFilter = GLINT_SECONDARY_READ_REG(TextureFilter); - pRC->MX2.CTextureEnvColor = GLINT_SECONDARY_READ_REG(TextureEnvColor); - pRC->MX2.CFogColor = GLINT_SECONDARY_READ_REG(FogColor); - pRC->MX2.CFStart = GLINT_SECONDARY_READ_REG(FStart); - pRC->MX2.CdFdx = GLINT_SECONDARY_READ_REG(dFdx); - pRC->MX2.CdFdyDom = GLINT_SECONDARY_READ_REG(dFdyDom); - pRC->MX2.CKsStart = GLINT_SECONDARY_READ_REG(KsStart); - pRC->MX2.CdKsdx = GLINT_SECONDARY_READ_REG(dKsdx); - pRC->MX2.CdKsdyDom = GLINT_SECONDARY_READ_REG(dKsdyDom); - pRC->MX2.CKdStart = GLINT_SECONDARY_READ_REG(KdStart); - pRC->MX2.CdKdStart = GLINT_SECONDARY_READ_REG(dKdStart); - pRC->MX2.CdKddyDom = GLINT_SECONDARY_READ_REG(dKddyDom); - pRC->MX2.CRStart = GLINT_SECONDARY_READ_REG(RStart); - pRC->MX2.CdRdx = GLINT_SECONDARY_READ_REG(dRdx); - pRC->MX2.CdRdyDom = GLINT_SECONDARY_READ_REG(dRdyDom); - pRC->MX2.CGStart = GLINT_SECONDARY_READ_REG(GStart); - pRC->MX2.CdGdx = GLINT_SECONDARY_READ_REG(dGdx); - pRC->MX2.CdGdyDom = GLINT_SECONDARY_READ_REG(dGdyDom); - pRC->MX2.CBStart = GLINT_SECONDARY_READ_REG(BStart); - pRC->MX2.CdBdx = GLINT_SECONDARY_READ_REG(dBdx); - pRC->MX2.CdBdyDom = GLINT_SECONDARY_READ_REG(dBdyDom); - pRC->MX2.CAStart = GLINT_SECONDARY_READ_REG(AStart); - pRC->MX2.CdAdx = GLINT_SECONDARY_READ_REG(dAdx); - pRC->MX2.CdAdyDom = GLINT_SECONDARY_READ_REG(dAdyDom); - pRC->MX2.CConstantColor = GLINT_SECONDARY_READ_REG(ConstantColor); - pRC->MX2.CChromaUpper = GLINT_SECONDARY_READ_REG(ChromaUpper); - pRC->MX2.CChromaLower = GLINT_SECONDARY_READ_REG(ChromaLower); - pRC->MX2.CChromaTestMode = GLINT_SECONDARY_READ_REG(ChromaTestMode); - pRC->MX2.CStencilData = GLINT_SECONDARY_READ_REG(StencilData); - pRC->MX2.CGLINTStencil = GLINT_SECONDARY_READ_REG(GLINTStencil); - pRC->MX2.CZStartU = GLINT_SECONDARY_READ_REG(ZStartU); - pRC->MX2.CZStartL = GLINT_SECONDARY_READ_REG(ZStartL); - pRC->MX2.CdZdxU = GLINT_SECONDARY_READ_REG(dZdxU); - pRC->MX2.CdZdxL = GLINT_SECONDARY_READ_REG(dZdxL); - pRC->MX2.CdZdyDomU = GLINT_SECONDARY_READ_REG(dZdyDomU); - pRC->MX2.CdZdyDomL = GLINT_SECONDARY_READ_REG(dZdyDomL); - pRC->MX2.CFastClearDepth = GLINT_SECONDARY_READ_REG(FastClearDepth); - pRC->MX2.CMinRegion = GLINT_SECONDARY_READ_REG(MinRegion); - pRC->MX2.CMaxRegion = GLINT_SECONDARY_READ_REG(MaxRegion); - pRC->MX2.CKsRStart = GLINT_SECONDARY_READ_REG(KsRStart); - pRC->MX2.CdKsRdx = GLINT_SECONDARY_READ_REG(dKsRdx); - pRC->MX2.CdKsRdyDom = GLINT_SECONDARY_READ_REG(dKsRdyDom); - pRC->MX2.CKsGStart = GLINT_SECONDARY_READ_REG(KsGStart); - pRC->MX2.CdKsGdx = GLINT_SECONDARY_READ_REG(dKsGdx); - pRC->MX2.CdKsGdyDom = GLINT_SECONDARY_READ_REG(dKsGdyDom); - pRC->MX2.CKsBStart = GLINT_SECONDARY_READ_REG(KsBStart); - pRC->MX2.CdKsBdx = GLINT_SECONDARY_READ_REG(dKsBdx); - pRC->MX2.CdKsBdyDom = GLINT_SECONDARY_READ_REG(dKsBdyDom); - pRC->MX2.CKdRStart = GLINT_SECONDARY_READ_REG(KdRStart); - pRC->MX2.CdKdRdx = GLINT_SECONDARY_READ_REG(dKdRdx); - pRC->MX2.CdKdRdyDom = GLINT_SECONDARY_READ_REG(dKdRdyDom); - pRC->MX2.CKdGStart = GLINT_SECONDARY_READ_REG(KdGStart); - pRC->MX2.CdKdGdx = GLINT_SECONDARY_READ_REG(dKdGdx); - pRC->MX2.CdKdGdyDom = GLINT_SECONDARY_READ_REG(dKdGdyDom); - pRC->MX2.CKdBStart = GLINT_SECONDARY_READ_REG(KdBStart); - pRC->MX2.CdKdBdx = GLINT_SECONDARY_READ_REG(dKdBdx); - pRC->MX2.CdKdBdyDom = GLINT_SECONDARY_READ_REG(dKdBdyDom); + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + pRC->MX2.CSStart = GLINT_READ_REG(SStart); + pRC->MX2.CdSdx = GLINT_READ_REG(dSdx); + pRC->MX2.CdSdyDom = GLINT_READ_REG(dSdyDom); + pRC->MX2.CTStart = GLINT_READ_REG(TStart); + pRC->MX2.CdTdx = GLINT_READ_REG(dTdx); + pRC->MX2.CdTdyDom = GLINT_READ_REG(dTdyDom); + pRC->MX2.CQStart = GLINT_READ_REG(QStart); + pRC->MX2.CdQdx = GLINT_READ_REG(dQdx); + pRC->MX2.CdQdyDom = GLINT_READ_REG(dQdyDom); + pRC->MX2.CLOD = GLINT_READ_REG(LOD); + pRC->MX2.CdSdy = GLINT_READ_REG(dSdy); + pRC->MX2.CdTdy = GLINT_READ_REG(dTdy); + pRC->MX2.CdQdy = GLINT_READ_REG(dQdy); + pRC->MX2.CTextureFormat = GLINT_READ_REG(TextureFormat); + pRC->MX2.CTextureCacheControl = GLINT_READ_REG(TextureCacheControl); + pRC->MX2.CGLINTBorderColor = GLINT_READ_REG(GLINTBorderColor); + pRC->MX2.CTexelLUTIndex = GLINT_READ_REG(TexelLUTIndex); + pRC->MX2.CTexelLUTData = GLINT_READ_REG(TexelLUTData); + pRC->MX2.CTexelLUTAddress = GLINT_READ_REG(TexelLUTAddress); + pRC->MX2.CTexelLUTTransfer = GLINT_READ_REG(TexelLUTTransfer); + pRC->MX2.CTextureFilterMode = GLINT_READ_REG(TextureFilterMode); + pRC->MX2.CTextureChromaUpper = GLINT_READ_REG(TextureChromaUpper); + pRC->MX2.CTextureChromaLower = GLINT_READ_REG(TextureChromaLower); + pRC->MX2.CTxBaseAddr0 = GLINT_READ_REG(TxBaseAddr0); + pRC->MX2.CTxBaseAddr1 = GLINT_READ_REG(TxBaseAddr1); + pRC->MX2.CTxBaseAddr2 = GLINT_READ_REG(TxBaseAddr2); + pRC->MX2.CTxBaseAddr3 = GLINT_READ_REG(TxBaseAddr3); + pRC->MX2.CTxBaseAddr4 = GLINT_READ_REG(TxBaseAddr4); + pRC->MX2.CTxBaseAddr5 = GLINT_READ_REG(TxBaseAddr5); + pRC->MX2.CTxBaseAddr6 = GLINT_READ_REG(TxBaseAddr6); + pRC->MX2.CTxBaseAddr7 = GLINT_READ_REG(TxBaseAddr7); + pRC->MX2.CTxBaseAddr8 = GLINT_READ_REG(TxBaseAddr8); + pRC->MX2.CTxBaseAddr9 = GLINT_READ_REG(TxBaseAddr9); + pRC->MX2.CTxBaseAddr10 = GLINT_READ_REG(TxBaseAddr10); + pRC->MX2.CTxBaseAddr11 = GLINT_READ_REG(TxBaseAddr11); + pRC->MX2.CTexelLUT0 = GLINT_READ_REG(TexelLUT0); + pRC->MX2.CTexelLUT1 = GLINT_READ_REG(TexelLUT1); + pRC->MX2.CTexelLUT2 = GLINT_READ_REG(TexelLUT2); + pRC->MX2.CTexelLUT3 = GLINT_READ_REG(TexelLUT3); + pRC->MX2.CTexelLUT4 = GLINT_READ_REG(TexelLUT4); + pRC->MX2.CTexelLUT5 = GLINT_READ_REG(TexelLUT5); + pRC->MX2.CTexelLUT6 = GLINT_READ_REG(TexelLUT6); + pRC->MX2.CTexelLUT7 = GLINT_READ_REG(TexelLUT7); + pRC->MX2.CTexelLUT8 = GLINT_READ_REG(TexelLUT8); + pRC->MX2.CTexelLUT9 = GLINT_READ_REG(TexelLUT9); + pRC->MX2.CTexelLUT10 = GLINT_READ_REG(TexelLUT10); + pRC->MX2.CTexelLUT11 = GLINT_READ_REG(TexelLUT11); + pRC->MX2.CTexelLUT12 = GLINT_READ_REG(TexelLUT12); + pRC->MX2.CTexelLUT13 = GLINT_READ_REG(TexelLUT13); + pRC->MX2.CTexelLUT14 = GLINT_READ_REG(TexelLUT14); + pRC->MX2.CTexelLUT15 = GLINT_READ_REG(TexelLUT15); + pRC->MX2.CTexel0 = GLINT_READ_REG(Texel0); + pRC->MX2.CTexel1 = GLINT_READ_REG(Texel1); + pRC->MX2.CTexel2 = GLINT_READ_REG(Texel2); + pRC->MX2.CTexel3 = GLINT_READ_REG(Texel3); + pRC->MX2.CTexel4 = GLINT_READ_REG(Texel4); + pRC->MX2.CTexel5 = GLINT_READ_REG(Texel5); + pRC->MX2.CTexel6 = GLINT_READ_REG(Texel6); + pRC->MX2.CTexel7 = GLINT_READ_REG(Texel7); + pRC->MX2.CInterp0 = GLINT_READ_REG(Interp0); + pRC->MX2.CInterp1 = GLINT_READ_REG(Interp1); + pRC->MX2.CInterp2 = GLINT_READ_REG(Interp2); + pRC->MX2.CInterp3 = GLINT_READ_REG(Interp3); + pRC->MX2.CInterp4 = GLINT_READ_REG(Interp4); + pRC->MX2.CTextureFilter = GLINT_READ_REG(TextureFilter); + pRC->MX2.CTextureEnvColor = GLINT_READ_REG(TextureEnvColor); + pRC->MX2.CFogColor = GLINT_READ_REG(FogColor); + pRC->MX2.CFStart = GLINT_READ_REG(FStart); + pRC->MX2.CdFdx = GLINT_READ_REG(dFdx); + pRC->MX2.CdFdyDom = GLINT_READ_REG(dFdyDom); + pRC->MX2.CKsStart = GLINT_READ_REG(KsStart); + pRC->MX2.CdKsdx = GLINT_READ_REG(dKsdx); + pRC->MX2.CdKsdyDom = GLINT_READ_REG(dKsdyDom); + pRC->MX2.CKdStart = GLINT_READ_REG(KdStart); + pRC->MX2.CdKdStart = GLINT_READ_REG(dKdStart); + pRC->MX2.CdKddyDom = GLINT_READ_REG(dKddyDom); + pRC->MX2.CRStart = GLINT_READ_REG(RStart); + pRC->MX2.CdRdx = GLINT_READ_REG(dRdx); + pRC->MX2.CdRdyDom = GLINT_READ_REG(dRdyDom); + pRC->MX2.CGStart = GLINT_READ_REG(GStart); + pRC->MX2.CdGdx = GLINT_READ_REG(dGdx); + pRC->MX2.CdGdyDom = GLINT_READ_REG(dGdyDom); + pRC->MX2.CBStart = GLINT_READ_REG(BStart); + pRC->MX2.CdBdx = GLINT_READ_REG(dBdx); + pRC->MX2.CdBdyDom = GLINT_READ_REG(dBdyDom); + pRC->MX2.CAStart = GLINT_READ_REG(AStart); + pRC->MX2.CdAdx = GLINT_READ_REG(dAdx); + pRC->MX2.CdAdyDom = GLINT_READ_REG(dAdyDom); + pRC->MX2.CConstantColor = GLINT_READ_REG(ConstantColor); + pRC->MX2.CChromaUpper = GLINT_READ_REG(ChromaUpper); + pRC->MX2.CChromaLower = GLINT_READ_REG(ChromaLower); + pRC->MX2.CChromaTestMode = GLINT_READ_REG(ChromaTestMode); + pRC->MX2.CStencilData = GLINT_READ_REG(StencilData); + pRC->MX2.CGLINTStencil = GLINT_READ_REG(GLINTStencil); + pRC->MX2.CZStartU = GLINT_READ_REG(ZStartU); + pRC->MX2.CZStartL = GLINT_READ_REG(ZStartL); + pRC->MX2.CdZdxU = GLINT_READ_REG(dZdxU); + pRC->MX2.CdZdxL = GLINT_READ_REG(dZdxL); + pRC->MX2.CdZdyDomU = GLINT_READ_REG(dZdyDomU); + pRC->MX2.CdZdyDomL = GLINT_READ_REG(dZdyDomL); + pRC->MX2.CFastClearDepth = GLINT_READ_REG(FastClearDepth); + pRC->MX2.CMinRegion = GLINT_READ_REG(MinRegion); + pRC->MX2.CMaxRegion = GLINT_READ_REG(MaxRegion); + pRC->MX2.CKsRStart = GLINT_READ_REG(KsRStart); + pRC->MX2.CdKsRdx = GLINT_READ_REG(dKsRdx); + pRC->MX2.CdKsRdyDom = GLINT_READ_REG(dKsRdyDom); + pRC->MX2.CKsGStart = GLINT_READ_REG(KsGStart); + pRC->MX2.CdKsGdx = GLINT_READ_REG(dKsGdx); + pRC->MX2.CdKsGdyDom = GLINT_READ_REG(dKsGdyDom); + pRC->MX2.CKsBStart = GLINT_READ_REG(KsBStart); + pRC->MX2.CdKsBdx = GLINT_READ_REG(dKsBdx); + pRC->MX2.CdKsBdyDom = GLINT_READ_REG(dKsBdyDom); + pRC->MX2.CKdRStart = GLINT_READ_REG(KdRStart); + pRC->MX2.CdKdRdx = GLINT_READ_REG(dKdRdx); + pRC->MX2.CdKdRdyDom = GLINT_READ_REG(dKdRdyDom); + pRC->MX2.CKdGStart = GLINT_READ_REG(KdGStart); + pRC->MX2.CdKdGdx = GLINT_READ_REG(dKdGdx); + pRC->MX2.CdKdGdyDom = GLINT_READ_REG(dKdGdyDom); + pRC->MX2.CKdBStart = GLINT_READ_REG(KdBStart); + pRC->MX2.CdKdBdx = GLINT_READ_REG(dKdBdx); + pRC->MX2.CdKdBdyDom = GLINT_READ_REG(dKdBdyDom); + ACCESSCHIP1(); } /* send gamma the context dump command */ GLINT_WAIT(3); - if (pGlint->numMXDevices == 2) + if (pGlint->numMultiDevices == 2) GLINT_WRITE_REG(1, BroadcastMask); GLINT_WRITE_REG(3<<14, FilterMode); /* context bits on gamma */ GLINT_WRITE_REG(GLINT_GAMMA_CONTEXT_MASK, ContextDump); @@ -1175,7 +1191,7 @@ readValue = GLINT_READ_REG(OutputFIFO); GLINT_SLOW_WRITE_REG(1<<10, FilterMode); - if (pGlint->numMXDevices == 2) + if (pGlint->numMultiDevices == 2) GLINT_SLOW_WRITE_REG(3,BroadcastMask); } } @@ -1187,7 +1203,7 @@ /* send context restore command */ GLINT_WAIT(1); - if (pGlint->numMXDevices == 2) + if (pGlint->numMultiDevices == 2) GLINT_WRITE_REG(1, BroadcastMask); GLINT_WAIT(3); @@ -1216,7 +1232,7 @@ pGlint->AccelInfoRec->NeedToSync = TRUE; /* finally the MX portions */ - if (pGlint->numMXDevices == 2) + if (pGlint->numMultiDevices == 2) GLINT_SLOW_WRITE_REG(1, BroadcastMask); GLINT_SLOW_WRITE_REG(pWC->MX1.CSStart, SStart); GLINT_SLOW_WRITE_REG(pWC->MX1.CdSdx, dSdx); @@ -1340,7 +1356,7 @@ GLINT_SLOW_WRITE_REG(pWC->MX1.CdKdBdx, dKdBdx); GLINT_SLOW_WRITE_REG(pWC->MX1.CdKdBdyDom, dKdBdyDom); - if (pGlint->numMXDevices == 2) { + if (pGlint->numMultiDevices == 2) { GLINT_SLOW_WRITE_REG(2, BroadcastMask); GLINT_SLOW_WRITE_REG(pWC->MX2.CSStart, SStart); GLINT_SLOW_WRITE_REG(pWC->MX2.CdSdx, dSdx); @@ -1469,7 +1485,7 @@ /* restore the 2D portion of the new context */ /* Restore MX1's registers */ - if (pGlint->numMXDevices == 2) + if (pGlint->numMultiDevices == 2) GLINT_SLOW_WRITE_REG(1, BroadcastMask); GLINT_SLOW_WRITE_REG(pWC->MX1.CStartXDom, StartXDom); GLINT_SLOW_WRITE_REG(pWC->MX1.CdXDom, dXDom); @@ -1532,7 +1548,7 @@ GLINT_SLOW_WRITE_REG(pWC->MX1.CStatisticMode, StatisticMode); /* Restore MX2's registers */ - if (pGlint->numMXDevices == 2) { + if (pGlint->numMultiDevices == 2) { GLINT_SLOW_WRITE_REG(2, BroadcastMask); GLINT_SLOW_WRITE_REG(pWC->MX2.CStartXDom, StartXDom); GLINT_SLOW_WRITE_REG(pWC->MX2.CdXDom, dXDom); @@ -1625,7 +1641,7 @@ GLINT_WRITE_REG(0, FBWriteMode); GLINT_WRITE_REG(0, LBWindowBase); GLINT_WRITE_REG(1, LBWriteMode); - if (pGlint->numMXDevices == 2) { + if (pGlint->numMultiDevices == 2) { GLINT_WRITE_REG( pGlint->pprod | LBRM_ScanlineInt2 , LBReadMode); } else { Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h:1.4 Wed May 10 14:55:29 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h Wed Jan 31 11:14:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h,v 1.4 2000/05/10 18:55:29 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_dri.h,v 1.5 2001/01/31 16:14:55 alanh Exp $ */ /************************************************************************** Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. @@ -50,7 +50,7 @@ drmMapFlags flagsControlRegs1; drmMapFlags flagsControlRegs2; drmMapFlags flagsControlRegs3; - int numMXDevices; + int numMultiDevices; int pprod; } GLINTDRIRec, *GLINTDRIPtr; Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c:1.103 xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c:1.125.2.4 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c:1.103 Fri Dec 8 08:42:35 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c Tue May 29 07:32:22 2001 @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane, Wigan, England. + * Copyright 1997-2001 by Alan Hourihane, Wigan, England. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -28,7 +28,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen, * Siemens Nixdorf Informationssysteme and Appian Graphics. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.103 2000/12/08 13:42:35 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_driver.c,v 1.125.2.4 2001/05/29 11:32:22 alanh Exp $ */ #include "fb.h" #include "cfb8_32.h" @@ -42,7 +42,6 @@ #include "xf86cmap.h" #include "shadowfb.h" #include "fbdevhw.h" -#include "vgaHW.h" #include "xf86RAC.h" #include "xf86Resources.h" #include "xf86int10.h" @@ -53,23 +52,21 @@ #include "mibstore.h" +#include "pm3_regs.h" #include "glint_regs.h" #include "IBM.h" #include "TI.h" #include "glint.h" -#ifdef XFreeXDGA #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" -#endif -#ifdef DPMSExtension #include "globals.h" #define DPMS_SERVER #include "extensions/dpms.h" -#endif #define DEBUG 0 +#define PM3Video 1 #if DEBUG # define TRACE_ENTER(str) ErrorF("glint: " str " %d\n",pScrn->scrnIndex) @@ -81,7 +78,7 @@ # define TRACE(str) #endif -static OptionInfoPtr GLINTAvailableOptions(int chipid, int busid); +static const OptionInfoRec * GLINTAvailableOptions(int chipid, int busid); static void GLINTIdentify(int flags); static Bool GLINTProbe(DriverPtr drv, int flags); static Bool GLINTPreInit(ScrnInfoPtr pScrn, int flags); @@ -103,12 +100,13 @@ static void GLINTSave(ScrnInfoPtr pScrn); static void GLINTRestore(ScrnInfoPtr pScrn); static Bool GLINTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); +static void GLINTBlockHandler(int, pointer, pointer, pointer); /* * This is intentionally screen-independent. It indicates the binding * choice made in the first PreInit. */ -static int pix24bpp = 0; +static int GLINTEntityIndex = -1; static Bool FBDevProbed = FALSE; /* @@ -122,9 +120,6 @@ DriverRec GLINT = { VERSION, GLINT_DRIVER_NAME, -#if 0 - "accelerated driver for 3dlabs and derived chipsets", -#endif GLINTIdentify, GLINTProbe, GLINTAvailableOptions, @@ -132,6 +127,25 @@ 0 }; +static SymTabRec GLINTVGAChipsets[] = { + { PCI_VENDOR_TI_CHIP_PERMEDIA2, "ti_pm2" }, + { PCI_VENDOR_TI_CHIP_PERMEDIA, "ti_pm" }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, "pm3" }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, "pm2v" }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, "pm2" }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA, "pm" }, +}; + +static PciChipsets GLINTVGAPciChipsets[] = { + { PCI_VENDOR_TI_CHIP_PERMEDIA2, PCI_VENDOR_TI_CHIP_PERMEDIA2, RES_SHARED_VGA }, + { PCI_VENDOR_TI_CHIP_PERMEDIA, PCI_VENDOR_TI_CHIP_PERMEDIA, NULL }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, PCI_VENDOR_3DLABS_CHIP_PERMEDIA3, RES_SHARED_VGA }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V, RES_SHARED_VGA }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, PCI_VENDOR_3DLABS_CHIP_PERMEDIA2, RES_SHARED_VGA }, + { PCI_VENDOR_3DLABS_CHIP_PERMEDIA, PCI_VENDOR_3DLABS_CHIP_PERMEDIA, NULL }, + { -1, -1, RES_UNDEFINED } +}; + static SymTabRec GLINTChipsets[] = { { PCI_VENDOR_3DLABS_CHIP_GAMMA, "gamma" }, { PCI_VENDOR_TI_CHIP_PERMEDIA2, "ti_pm2" }, @@ -143,9 +157,7 @@ { PCI_VENDOR_3DLABS_CHIP_300SX, "300sx" }, { PCI_VENDOR_3DLABS_CHIP_500TX, "500tx" }, { PCI_VENDOR_3DLABS_CHIP_MX, "mx" }, -/* { PCI_VENDOR_3DLABS_CHIP_DELTA, "delta" }, -*/ { -1, NULL } }; @@ -160,42 +172,32 @@ { PCI_VENDOR_3DLABS_CHIP_300SX, PCI_VENDOR_3DLABS_CHIP_300SX, NULL }, { PCI_VENDOR_3DLABS_CHIP_500TX, PCI_VENDOR_3DLABS_CHIP_500TX, NULL }, { PCI_VENDOR_3DLABS_CHIP_MX, PCI_VENDOR_3DLABS_CHIP_MX, NULL }, -/* { PCI_VENDOR_3DLABS_CHIP_DELTA, PCI_VENDOR_3DLABS_CHIP_DELTA, NULL }, -*/ { -1, -1, RES_UNDEFINED } }; - typedef enum { OPTION_SW_CURSOR, - OPTION_HW_CURSOR, - OPTION_PCI_RETRY, OPTION_RGB_BITS, OPTION_NOACCEL, OPTION_BLOCK_WRITE, OPTION_FIREGL3000, - OPTION_MEM_CLK, OPTION_OVERLAY, OPTION_SHADOW_FB, OPTION_FBDEV, - OPTION_NOWRITEBITMAP, - OPTION_PM3_USE_GAMMA + OPTION_FLATPANEL } GLINTOpts; -static OptionInfoRec GLINTOptions[] = { - { OPTION_PM3_USE_GAMMA, "UseGamma", OPTV_BOOLEAN, {0}, FALSE }, +static const OptionInfoRec GLINTOptions[] = { { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_RGB_BITS, "RGBbits", OPTV_INTEGER, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_BLOCK_WRITE, "BlockWrite", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FIREGL3000, "FireGL3000", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_MEM_CLK, "SetMClk", OPTV_FREQ, {0}, FALSE }, { OPTION_OVERLAY, "Overlay", OPTV_ANYSTR, {0}, FALSE }, { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FLATPANEL, "UseFlatPanel", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -212,25 +214,6 @@ { -1 } }; - -static const char *vgahwSymbols[] = { - "vgaHWGetIndex", - "vgaHWSave", - "vgaHWRestore", - "vgaHWGetHWRec", - "vgaHWUnlock", - "vgaHWInit", - "vgaHWProtect", - "vgaHWSetMmioFuncs", - "vgaHWGetIOBase", - "vgaHWMapMem", - "vgaHWLock", - "vgaHWFreeHWRec", - "vgaHWSaveScreen", - "vgaHWddc1SetSpeed", - NULL -}; - static const char *xf8_32bppSymbols[] = { "xf86Overlay8Plus32Init", NULL @@ -246,14 +229,13 @@ "XAAScreenIndex", "XAAPolyLines", "XAAPolySegment", + "XAAFillSolidRects", NULL }; static const char *fbSymbols[] = { "cfb8_32ScreenInit", -#ifdef RENDER "fbPictureInit", -#endif "fbScreenInit", "fbBres", NULL @@ -285,6 +267,7 @@ static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", + "vbeFree", NULL }; @@ -383,7 +366,7 @@ if (!setupDone) { setupDone = TRUE; xf86AddDriver(&GLINT, module, 0); - LoaderRefSymLists(vgahwSymbols, fbSymbols, ddcSymbols, i2cSymbols, + LoaderRefSymLists(fbSymbols, ddcSymbols, i2cSymbols, xaaSymbols, xf8_32bppSymbols, shadowSymbols, fbdevHWSymbols, int10Symbols, vbeSymbols, @@ -479,7 +462,6 @@ -1, -1, -1, -1, 0}; -#ifdef DPMSExtension static void GLINTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -490,7 +472,14 @@ if((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_500TX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_MX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) { + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_300SX)) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_500TX)) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_MX)) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_MX)) ) { vtgpolarity = GLINT_READ_REG(VTGPolarity) & 0xFFFFFFF0; } else { videocontrol = GLINT_READ_REG(PMVideoControl) & 0xFFFFFFD6; @@ -524,13 +513,19 @@ if((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_500TX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_MX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) { + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_300SX)) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_500TX)) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_MX)) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_MX)) ) { GLINT_SLOW_WRITE_REG(vtgpolarity, VTGPolarity); } else { GLINT_SLOW_WRITE_REG(videocontrol, PMVideoControl); } } -#endif static Bool GLINTGetRec(ScrnInfoPtr pScrn) @@ -570,14 +565,13 @@ xf86PrintChipsets(GLINT_NAME, "driver for 3Dlabs chipsets", GLINTChipsets); } -static -OptionInfoPtr +static const OptionInfoRec * GLINTAvailableOptions(int chipid, int busid) { return GLINTOptions; } -void +static void GLINTProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; @@ -587,6 +581,7 @@ { pVbe = VBEInit(NULL,index); vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } @@ -686,9 +681,20 @@ } else if (checkusedPci) { - numUsed = xf86MatchPciInstances(GLINT_NAME, 0, - GLINTChipsets, GLINTPciChipsets, devSections, - numDevSections, drv, &usedChips); + if (flags & PROBE_DETECT) { + /* HACK, Currently when -configuring, we only return VGA + * based chips. Manual configuring is necessary to poke + * at the other chips */ + numUsed = xf86MatchPciInstances(GLINT_NAME, 0, + GLINTVGAChipsets, GLINTVGAPciChipsets, + devSections, + numDevSections, drv, &usedChips); + } else { + numUsed = xf86MatchPciInstances(GLINT_NAME, 0, + GLINTChipsets, GLINTPciChipsets, devSections, + numDevSections, drv, &usedChips); + } + xfree(devSections); if (numUsed <= 0) return FALSE; @@ -697,51 +703,112 @@ if (!(flags & PROBE_DETECT)) for (i = 0; i < numUsed; i++) { ScrnInfoPtr pScrn = NULL; + GLINTEntPtr pGlintEnt = NULL; + DevUnion *pPriv; + pPci = xf86GetPciInfoForEntity(usedChips[i]); /* Allocate a ScrnInfoRec and claim the slot */ if ((pScrn = xf86ConfigPciEntity(pScrn, 0, usedChips[i], GLINTPciChipsets, NULL, NULL, NULL, NULL, NULL))) { + - pPci = xf86GetPciInfoForEntity(usedChips[i]); + /* Claim specifics, when we KNOW ! the board */ - /* Only claim other chips when GAMMA is used */ - if (pPci->chipType == PCI_CHIP_GAMMA) { - while (*checkusedPci != NULL) { - int eIndex; + /* Appian Jeronimo J2000 */ + if ((pPci->subsysVendor == 0x1097) && + (pPci->subsysCard == 0x3d32)) { + int eIndex; + if (!xf86IsEntityShared(usedChips[i])) { + eIndex = xf86ClaimPciSlot(pPci->bus, + pPci->device, + 1, + drv, -1 /* XXX */, + NULL, FALSE); + xf86AddEntityToScreen(pScrn,eIndex); + } else { + eIndex = xf86ClaimPciSlot(pPci->bus, + pPci->device, + 2, + drv, -1 /* XXX */, + NULL, FALSE); + xf86AddEntityToScreen(pScrn,eIndex); + } + } else + /* Only claim other chips when GAMMA is used */ + if ((pPci->chipType == PCI_CHIP_GAMMA) || + (pPci->chipType == PCI_CHIP_DELTA)) { + while (*checkusedPci != NULL) { + int eIndex; /* make sure we claim all but our source device */ - if ((pPci->bus == (*checkusedPci)->bus && - pPci->device == (*checkusedPci)->device) && + if ((pPci->bus == (*checkusedPci)->bus && + pPci->device == (*checkusedPci)->device) && pPci->func != (*checkusedPci)->func) { - - /* Claim other entities on the same card */ - eIndex = xf86ClaimPciSlot((*checkusedPci)->bus, + + /* Claim other entities on the same card */ + eIndex = xf86ClaimPciSlot((*checkusedPci)->bus, (*checkusedPci)->device, (*checkusedPci)->func, drv, -1 /* XXX */, NULL, FALSE); - if (eIndex == -1) { - /* This can't happen */ - FatalError("someone claimed the free slot!\n"); - } - xf86AddEntityToScreen(pScrn,eIndex); - } - checkusedPci++; - } - } - /* Fill in what we can of the ScrnInfoRec */ - pScrn->driverVersion = VERSION; - pScrn->driverName = GLINT_DRIVER_NAME; - pScrn->name = GLINT_NAME; - pScrn->Probe = GLINTProbe; - pScrn->PreInit = GLINTPreInit; - pScrn->ScreenInit = GLINTScreenInit; - pScrn->SwitchMode = GLINTSwitchMode; - pScrn->FreeScreen = GLINTFreeScreen; - pScrn->EnterVT = GLINTEnterVT; + if (eIndex != -1) { + xf86AddEntityToScreen(pScrn,eIndex); + } else { + ErrorF("BusID %d:%d:%d already claimed\n", + (*checkusedPci)->bus, + (*checkusedPci)->device, + (*checkusedPci)->func); + xfree(usedChips); + return FALSE; + } + } + checkusedPci++; + } } - } + + /* Fill in what we can of the ScrnInfoRec */ + pScrn->driverVersion = VERSION; + pScrn->driverName = GLINT_DRIVER_NAME; + pScrn->name = GLINT_NAME; + pScrn->Probe = GLINTProbe; + pScrn->PreInit = GLINTPreInit; + pScrn->ScreenInit = GLINTScreenInit; + pScrn->SwitchMode = GLINTSwitchMode; + pScrn->FreeScreen = GLINTFreeScreen; + pScrn->EnterVT = GLINTEnterVT; + } + + /* Allow sharing if Appian J2000 detected */ + /* (later Diamond FireGL3000 support too) */ + + if ((pPci->subsysVendor == 0x1097) && + (pPci->subsysCard == 0x3d32)) { + xf86SetEntitySharable(usedChips[i]); + /* Allocate an entity private if necessary */ + if (GLINTEntityIndex < 0) + GLINTEntityIndex = xf86AllocateEntityPrivateIndex(); + pPriv = xf86GetEntityPrivate(pScrn->entityList[0], + GLINTEntityIndex); + if (!pPriv->ptr) { + pPriv->ptr = xnfcalloc(sizeof(GLINTEntRec), 1); + pGlintEnt = pPriv->ptr; + pGlintEnt->lastInstance = -1; + } else { + pGlintEnt = pPriv->ptr; + } + + /* + * Set the entity instance for this instance of the driver. + * For dual head per card, instance 0 is the "master" + * instance, driving the primary head, and instance 1 is + * the "slave". + */ + pGlintEnt->lastInstance++; + xf86SetEntityInstanceForScreen(pScrn, + pScrn->entityList[0], pGlintEnt->lastInstance); + } + } } xfree(usedChips); @@ -767,7 +834,6 @@ switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: case PCI_VENDOR_TI_CHIP_PERMEDIA: - case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA: @@ -776,9 +842,24 @@ case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: - case PCI_VENDOR_3DLABS_CHIP_GAMMA: linep = &partprod500TX[0]; break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_DELTA: + /* When GAMMA/DELTA in use, we always have MultiChip defined, even if + * only one chip is connected to GAMMA/DELTA as the entities > 1 + */ + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + case PCI_CHIP_500TX: + case PCI_CHIP_300SX: + linep = &partprod500TX[0]; + break; + case PCI_CHIP_PERMEDIA: + linep = &partprodPermedia[0]; + break; + } + break; } for (i = 0; linep[i] != 0; i++) { @@ -806,21 +887,12 @@ pGlint = GLINTPTR(pScrn); pGlint->RamDacRec = RamDacCreateInfoRec(); - if (pGlint->numMXDevices == 2) { - pGlint->RamDacRec->ReadDAC = DUALglintInTIIndReg; - pGlint->RamDacRec->WriteDAC = DUALglintOutTIIndReg; - pGlint->RamDacRec->ReadAddress = DUALglintTIReadAddress; - pGlint->RamDacRec->WriteAddress = DUALglintTIWriteAddress; - pGlint->RamDacRec->ReadData = DUALglintTIReadData; - pGlint->RamDacRec->WriteData = DUALglintTIWriteData; - } else { - pGlint->RamDacRec->ReadDAC = glintInTIIndReg; - pGlint->RamDacRec->WriteDAC = glintOutTIIndReg; - pGlint->RamDacRec->ReadAddress = glintTIReadAddress; - pGlint->RamDacRec->WriteAddress = glintTIWriteAddress; - pGlint->RamDacRec->ReadData = glintTIReadData; - pGlint->RamDacRec->WriteData = glintTIWriteData; - } + pGlint->RamDacRec->ReadDAC = glintInTIIndReg; + pGlint->RamDacRec->WriteDAC = glintOutTIIndReg; + pGlint->RamDacRec->ReadAddress = glintTIReadAddress; + pGlint->RamDacRec->WriteAddress = glintTIWriteAddress; + pGlint->RamDacRec->ReadData = glintTIReadData; + pGlint->RamDacRec->WriteData = glintTIWriteData; pGlint->RamDacRec->LoadPalette = TIramdacLoadPalette; if(!RamDacInit(pScrn, pGlint->RamDacRec)) { @@ -828,12 +900,12 @@ return; } GLINTMapMem(pScrn); - if (pGlint->numMXDevices == 2) { + if (pGlint->numMultiDevices == 2) { temp = GLINT_READ_REG(GCSRAperture); GLINT_SLOW_WRITE_REG(GCSRSecondaryGLINTMapEn, GCSRAperture); } pGlint->RamDac = TIramdacProbe(pScrn, TIRamdacs); - if (pGlint->numMXDevices == 2) { + if (pGlint->numMultiDevices == 2) { GLINT_SLOW_WRITE_REG(temp, GCSRAperture); } GLINTUnmapMem(pScrn); @@ -866,10 +938,9 @@ GLINTPreInit(ScrnInfoPtr pScrn, int flags) { GLINTPtr pGlint; + GLINTEntPtr pGlintEnt = NULL; MessageType from; int i; - int LinearFramebuffer = 0; - double real; Bool Overlay = FALSE; int maxwidth = 0, maxheight = 0; ClockRangePtr clockRanges; @@ -904,28 +975,24 @@ /* Get the entities, and make sure they are PCI. */ pGlint->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); - if (flags & PROBE_DETECT) { - GLINTProbeDDC(pScrn, pGlint->pEnt->index); - return TRUE; + /* Allocate an entity private if necessary */ + if (xf86IsEntityShared(pScrn->entityList[0])) { + pGlintEnt = xf86GetEntityPrivate(pScrn->entityList[0], + GLINTEntityIndex)->ptr; + pGlint->entityPrivate = pGlintEnt; } if (pGlint->pEnt->location.type == BUS_PCI) { - /* Initialize the card through int10 interface if needed */ - if ( xf86LoadSubModule(pScrn, "int10")){ - xf86Int10InfoPtr pInt; - - xf86LoaderReqSymLists(int10Symbols, NULL); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); - pInt = xf86InitInt10(pGlint->pEnt->index); - xf86FreeInt10(pInt); - } - pGlint->PciInfo = xf86GetPciInfoForEntity(pGlint->pEnt->index); pGlint->PciTag = pciTag(pGlint->PciInfo->bus, pGlint->PciInfo->device, pGlint->PciInfo->func); } + pGlint->InFifoSpace = 0; /* Force a Read of FIFO space on first run */ + pGlint->numMultiDevices = 0; + pGlint->IOOffset = 0; /* Set IO Offset for Gamma */ + if (pScrn->numEntities > 1) { pciVideoPtr pPci; EntityInfoPtr pEnt; @@ -933,29 +1000,52 @@ for (i = 1; i < pScrn->numEntities; i++) { pEnt = xf86GetEntityInfo(pScrn->entityList[i]); pPci = xf86GetPciInfoForEntity(pEnt->index); - if (pPci->chipType == PCI_CHIP_MX) { - if (pGlint->numMXDevices >= GLINT_MAX_MX_DEVICES) { + if ( (pPci->chipType == PCI_CHIP_MX) || + (pPci->chipType == PCI_CHIP_PERMEDIA) || + (pPci->chipType == PCI_CHIP_500TX) || + (pPci->chipType == PCI_CHIP_300SX) || + (pPci->chipType == PCI_CHIP_PERMEDIA3) ) { + pGlint->MultiChip = pPci->chipType; + if (pGlint->numMultiDevices >= GLINT_MAX_MULTI_DEVICES) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "%d MX chips unsupported, aborting. (Max - 2)\n", - pGlint->numMXDevices); + "%d multiple chips unsupported, aborting. (Max - 2)\n", + pGlint->numMultiDevices); return FALSE; } else { - LinearFramebuffer = pPci->memBase[2]; - pGlint->MXPciInfo[pGlint->numMXDevices] = pPci; - pGlint->numMXDevices++; + pGlint->MultiPciInfo[pGlint->numMultiDevices] = pPci; + pGlint->numMultiDevices++; } } } } - /* - * VGA isn't used, so mark it so. XXX Should check if any VGA resources - * are decoded or not, and if not, change them from Unused to Disabled. - * Mem resources seem to be disabled. This is importand to avoid conflicts - * with DGA - */ + { + EntityInfoPtr pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + pciVideoPtr pPci = xf86GetPciInfoForEntity(pEnt->index); + + if ( ((pPci->chipType == PCI_CHIP_GAMMA) || + (pPci->chipType == PCI_CHIP_DELTA)) && + (pGlint->numMultiDevices == 0) ) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Gamma/Delta with ZERO connected chips, aborting\n"); + return FALSE; + } + } + + if (flags & PROBE_DETECT) { + EntityInfoPtr pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + pciVideoPtr pPci = xf86GetPciInfoForEntity(pEnt->index); + + if ((pPci->chipType != PCI_CHIP_GAMMA) && + (pPci->chipType != PCI_CHIP_DELTA)) { + GLINTProbeDDC(pScrn, pGlint->pEnt->index); + return TRUE; + } else + return FALSE; + } + xf86SetOperatingState(resVgaMemShared, pGlint->pEnt->index, ResDisableOpr); - xf86SetOperatingState(resVgaIoShared, pGlint->pEnt->index, ResUnusedOpr); + xf86SetOperatingState(resVgaIoShared, pGlint->pEnt->index, ResDisableOpr); /* Operations for which memory access is required. */ pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; @@ -1002,10 +1092,6 @@ xf86PrintDepthBpp(pScrn); - /* Get the depth24 pixmap format */ - if (pScrn->depth == 24 && pix24bpp == 0) - pix24bpp = xf86GetBppFromDepth(pScrn, 24); - /* * This must happen after pScrn->display has been set because * xf86SetWeight references it. @@ -1054,37 +1140,36 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, GLINTOptions); + if (!(pGlint->Options = xalloc(sizeof(GLINTOptions)))) + return FALSE; + memcpy(pGlint->Options, GLINTOptions, sizeof(GLINTOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pGlint->Options); /* Default to 8bits per RGB */ if (pScrn->depth == 30) pScrn->rgbBits = 10; - else pScrn->rgbBits = 8; - if (xf86GetOptValInteger(GLINTOptions, OPTION_RGB_BITS, &pScrn->rgbBits)) { + else pScrn->rgbBits = 8; + if (xf86GetOptValInteger(pGlint->Options, OPTION_RGB_BITS, &pScrn->rgbBits)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Bits per RGB set to %d\n", pScrn->rgbBits); } - if (xf86GetOptValFreq(GLINTOptions, OPTION_MEM_CLK, OPTUNITS_MHZ, &real)) { - pGlint->MemClock = (int)real; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, - "Memory Clock override enabled, set to %dMHz\n", - pGlint->MemClock); - } from = X_DEFAULT; pGlint->HWCursor = TRUE; /* ON by default */ - if (xf86GetOptValBool(GLINTOptions, OPTION_HW_CURSOR, &pGlint->HWCursor)) - from = X_CONFIG; - if (xf86ReturnOptValBool(GLINTOptions, OPTION_SW_CURSOR, FALSE)) { + if (xf86ReturnOptValBool(pGlint->Options, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pGlint->HWCursor = FALSE; } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pGlint->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(GLINTOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pGlint->Options, OPTION_FLATPANEL, FALSE)) { + pGlint->UseFlatPanel = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using Flat Panel Interface\n"); + } + if (xf86ReturnOptValBool(pGlint->Options, OPTION_NOACCEL, FALSE)) { pGlint->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } - if (xf86ReturnOptValBool(GLINTOptions, OPTION_SHADOW_FB, FALSE)) { + if (xf86ReturnOptValBool(pGlint->Options, OPTION_SHADOW_FB, FALSE)) { pGlint->ShadowFB = TRUE; pGlint->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, @@ -1092,7 +1177,7 @@ } /* Check whether to use the FBDev stuff and fill in the rest of pScrn */ - if (xf86ReturnOptValBool(GLINTOptions, OPTION_FBDEV, FALSE)) { + if (xf86ReturnOptValBool(pGlint->Options, OPTION_FBDEV, FALSE)) { if (!FBDevProbed && !xf86LoadSubModule(pScrn, "fbdevhw")) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "couldn't load fbdevHW module!\n"); @@ -1127,15 +1212,9 @@ xf86DrvMsg(pScrn->scrnIndex, from, "%s Linux framebuffer device\n", pGlint->FBDev ? "Using" : "Not using"); - pGlint->UsePCIRetry = FALSE; - from = X_DEFAULT; - if (xf86GetOptValBool(GLINTOptions, OPTION_PCI_RETRY, &pGlint->UsePCIRetry)) - from = X_CONFIG; - if (pGlint->UsePCIRetry) - xf86DrvMsg(pScrn->scrnIndex, from, "PCI retry enabled\n"); pScrn->overlayFlags = 0; from = X_DEFAULT; - if ((s = xf86GetOptValString(GLINTOptions, OPTION_OVERLAY))) { + if ((s = xf86GetOptValString(pGlint->Options, OPTION_OVERLAY))) { if (!*s || !xf86NameCmp(s, "8,24") || !xf86NameCmp(s, "24,8")) { Overlay = TRUE; } else { @@ -1151,9 +1230,9 @@ } } - pGlint->VGAcore = FALSE; pGlint->DoubleBuffer = FALSE; pGlint->RamDac = NULL; + pGlint->STATE = FALSE; /* * Set the Chipset and ChipRev, allowing config file entries to * override. @@ -1208,74 +1287,20 @@ xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset); - /* SVEN : Claim a Gamma chip if available. */ - if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) { - int eIndex = -1; - from = X_DEFAULT; - pGlint->PM3_UseGamma = FALSE; - if (xf86ReturnOptValBool(GLINTOptions, OPTION_PM3_USE_GAMMA, FALSE)) { - from = X_CONFIG; - pGlint->PM3_UseGamma = TRUE; - } - xf86DrvMsg(pScrn->scrnIndex, from, "%s to use Gamma with Permedia 3.\n", - (pGlint->PM3_UseGamma ? "Trying" : "Not trying")); - if (pGlint->PM3_UseGamma) { - pciVideoPtr *checkusedPci; - checkusedPci = xf86GetPciVideoInfo(); - while (*checkusedPci != NULL) { - /* Is there a free gamma on the same device ? */ - if (((*checkusedPci)->chipType == PCI_CHIP_GAMMA) && - (((*checkusedPci)->bus == pGlint->PciInfo->bus)) && - (((*checkusedPci)->device == pGlint->PciInfo->device))) - if ((eIndex = xf86ClaimPciSlot((*checkusedPci)->bus, - (*checkusedPci)->device, - (*checkusedPci)->func, - pScrn->drv, -1, - NULL, FALSE)) != -1) break; - } - checkusedPci++; - } - if (eIndex == -1) { - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "No free Gamma chip was found.\n"); - pGlint->PM3_UseGamma = FALSE; - } else { - unsigned int r; - /* Add the Gamma to the screen info structure. */ - xf86AddEntityToScreen(pScrn,eIndex); - pGlint->PM3_GammaPciInfo = - xf86GetPciInfoForEntity(eIndex); - pGlint->PM3_GammaPciTag = pciTag( - pGlint->PM3_GammaPciInfo->bus, - pGlint->PM3_GammaPciInfo->device, - pGlint->PM3_GammaPciInfo->func); - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "Gamma Claimed at BusID PCI:%d:%d:%d.\n", - pGlint->PM3_GammaPciInfo->bus, - pGlint->PM3_GammaPciInfo->device, - pGlint->PM3_GammaPciInfo->func); - /* Let's dump the Gamma registers, at least some of them ... */ - pGlint->PM3_GammaIOAddress = - pGlint->PM3_GammaPciInfo->memBase[0] & 0xFFFFC000; - } - } if ((pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA2) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2)) { - if (xf86ReturnOptValBool(GLINTOptions, OPTION_BLOCK_WRITE, FALSE)) { + if (xf86ReturnOptValBool(pGlint->Options, OPTION_BLOCK_WRITE, FALSE)) { pGlint->UseBlockWrite = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Block Writes enabled\n"); } } - if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_500TX) { - if (xf86ReturnOptValBool(GLINTOptions, OPTION_FIREGL3000, FALSE)) { - /* Can't we detect a Fire GL 3000 ????? and remove this ? */ - pGlint->UseFireGL3000 = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + if (xf86ReturnOptValBool(pGlint->Options, OPTION_FIREGL3000, FALSE)) { + /* Can't we detect a Fire GL 3000 ????? and remove this ? */ + pGlint->UseFireGL3000 = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Diamond FireGL3000 mode enabled\n"); - } } if (!FBDevProbed) { @@ -1290,17 +1315,18 @@ pGlint->FbAddress = pGlint->PciInfo->memBase[2] & 0xFF800000; } - xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", + if (pGlint->FbAddress) + xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", (unsigned long)pGlint->FbAddress); /* Trap GAMMA & DELTA specification, with no linear address */ - /* Find the first SX/TX/MX chip and use that address */ + /* Find the first GLINT chip and use that address */ if (pGlint->FbAddress == 0) { - if (LinearFramebuffer) { - pGlint->FbAddress = LinearFramebuffer; + if (pGlint->MultiPciInfo[0]->memBase[2]) { + pGlint->FbAddress = pGlint->MultiPciInfo[0]->memBase[2]; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, - "FrameBuffer used from first SX/TX/MX chip at 0x%x\n", - LinearFramebuffer); + "FrameBuffer used from first rasterizer chip at 0x%x\n", + pGlint->MultiPciInfo[0]->memBase[2]); } else { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "No FrameBuffer memory - aborting\n"); @@ -1315,11 +1341,6 @@ */ pGlint->IOAddress = pGlint->pEnt->device->IOBase; from = X_CONFIG; -#if 0 /* This freezes the box, why ? */ - } else if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) && - pGlint->PM3_UseGamma) { - pGlint->IOAddress = pGlint->PM3_GammaPciInfo->memBase[0] & 0xFFFFC000; -#endif } else { pGlint->IOAddress = pGlint->PciInfo->memBase[0] & 0xFFFFC000; } @@ -1327,6 +1348,21 @@ pGlint->IOAddress += 0x10000; #endif + if ((IS_J2000) && (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) { + /* Fix up for dual head mode, offset gamma registers at 0x10000 */ + if ((xf86IsEntityShared(pScrn->entityList[0])) && + (xf86IsPrimInitDone(pScrn->entityList[0]))) { +#if 0 /* When we need gamma & acceleration, this should be used instead */ + pGlint->IOAddress += 0x10000; +#endif + } else { + xf86SetPrimInitDone(pScrn->entityList[0]); + } +#if 1 /* And then remove this */ + pGlint->IOAddress = pGlint->MultiPciInfo[0]->memBase[0] & 0xFFFFC000; +#endif + } + xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", (unsigned long)pGlint->IOAddress); @@ -1344,6 +1380,90 @@ } } + pGlint->FbMapSize = 0; + + { + /* We have to boot some multiple head type boards here */ + GLINTMapMem(pScrn); + switch (pGlint->Chipset) { + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + Permedia3PreInit(pScrn); + break; + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: + Permedia2VPreInit(pScrn); + break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA3: + Permedia3PreInit(pScrn); + break; + } + break; + case PCI_VENDOR_3DLABS_CHIP_DELTA: + /* Delta has a bug, we need to fix it here */ + { + int basecopro = + pGlint->MultiPciInfo[0]->memBase[0] & 0xFFFFC000; + int basedelta = pGlint->PciInfo->memBase[0] & 0xFFFFC000; + int glintdelta = pGlint->PciTag; + int glintcopro = pciTag(pGlint->MultiPciInfo[0]->bus, + pGlint->MultiPciInfo[0]->device, + pGlint->MultiPciInfo[0]->func); + int temp, base3copro, offset; + + if( (basedelta & 0x20000) ^ (basecopro & 0x20000) ) { + if (pGlint->MultiChip == PCI_CHIP_PERMEDIA) { + offset = 0x20; /* base4 */ + } else { + offset = 0x1c; /* base3 */ + } + base3copro = pciReadLong(glintcopro, offset); + if( (basecopro & 0x20000) ^ (base3copro & 0x20000) ) { + /* + * oops, still different; we know that base3 + * is at least 16 MB, so we just take 128k + * offset into it. + */ + base3copro += 0x20000; + } + /* + * and now for the magic. + * read old value + * write fffffffff + * read value + * write new value + */ + temp = pciReadLong(glintdelta, 0x10); + pciWriteLong(glintdelta, 0x10, 0xffffffff); + temp = pciReadLong(glintdelta, 0x10); + pciWriteLong(glintdelta, 0x10, base3copro); + + /* + * additionally,sometimes we see the baserom which might + * confuse the chip, so let's make sure that is disabled + */ + temp = pciReadLong(glintcopro, 0x30); + pciWriteLong(glintcopro, 0x30, 0xffffffff); + temp = pciReadLong(glintcopro, 0x30); + pciWriteLong(glintcopro, 0x30, 0); + + /* + * now update our internal structure accordingly + */ + pGlint->IOAddress = + pGlint->PciInfo->memBase[0] = base3copro; + xf86DrvMsg(pScrn->scrnIndex, from, + "Delta Bug - Changing MMIO registers to 0x%lX\n", + (unsigned long)pGlint->IOAddress); + } + } + break; + default: + break; + } + GLINTUnmapMem(pScrn); + } + /* HW bpp matches reported bpp */ pGlint->HwBpp = pScrn->bitsPerPixel; @@ -1352,32 +1472,66 @@ if (pGlint->pEnt->device->videoRam != 0) { pScrn->videoRam = pGlint->pEnt->device->videoRam; from = X_CONFIG; - } else if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) { - /* Need to initialize the memory timings of the second head - * of the Appian Jeronimo 2000 board here. - * Check this routine in pm3_dac.c if you have another board - * than a J2000, as memory timings will surely change. - */ - GLINTMapMem(pScrn); - Permedia3PreInit(pScrn); - GLINTUnmapMem(pScrn); - pScrn->videoRam = Permedia3MemorySizeDetect(pScrn); - } else if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) { - /* The PM2v has the same problem detecting memory as the PM3 */ - pScrn->videoRam = Permedia3MemorySizeDetect(pScrn); } else { - pGlint->FbMapSize = 0; /* Need to set FbMapSize for MMIO access */ /* Need to access MMIO to determine videoRam */ GLINTMapMem(pScrn); - if( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_500TX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_MX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) ) - pScrn->videoRam = 1024 * (1 << ((GLINT_READ_REG(FBMemoryCtl) & - 0xE0000000)>>29)); - else - pScrn->videoRam = 2048 * (((GLINT_READ_REG(PMMemConfig) >> 29) & - 0x03) + 1); + switch (pGlint->Chipset) { + case PCI_VENDOR_3DLABS_CHIP_500TX: + case PCI_VENDOR_3DLABS_CHIP_300SX: + case PCI_VENDOR_3DLABS_CHIP_MX: + pScrn->videoRam = (1 << ((GLINT_READ_REG(FBMemoryCtl) & + 0xE0000000)>>29)) * 1024; + break; + case PCI_VENDOR_TI_CHIP_PERMEDIA2: + case PCI_VENDOR_TI_CHIP_PERMEDIA: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: + pScrn->videoRam = (((GLINT_READ_REG(PMMemConfig) >> 29) & + 0x03) + 1) * 2048; + break; + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + pScrn->videoRam = Permedia3MemorySizeDetect(pScrn); + break; + case PCI_VENDOR_3DLABS_CHIP_DELTA: + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Attached Rasterizer is GLINT Permedia\n"); + pScrn->videoRam = (((GLINT_READ_REG(PMMemConfig)>>29) & + 0x03) + 1) * 2048; + break; + case PCI_CHIP_300SX: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Attached Rasterizer is GLINT 300SX\n"); + pScrn->videoRam = (1 << ((GLINT_READ_REG(FBMemoryCtl) & + 0xE0000000)>>29)) * 1024; + break; + case PCI_CHIP_500TX: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Attached Rasterizer is GLINT 500TX\n"); + pScrn->videoRam = (1 << ((GLINT_READ_REG(FBMemoryCtl) & + 0xE0000000)>>29)) * 1024; + break; + case PCI_CHIP_MX: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Attached Rasterizer is GLINT MX\n"); + pScrn->videoRam = + (1 << ((GLINT_READ_REG(FBMemoryCtl) & + 0xE0000000)>>29)) * 1024; + break; + case PCI_CHIP_PERMEDIA3: + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Attached Rasterizer is Permedia3\n"); + pScrn->videoRam = Permedia3MemorySizeDetect(pScrn); + break; + } + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Number of Rasterizers attached is %d\n", + pGlint->numMultiDevices); + break; + } GLINTUnmapMem(pScrn); } } else { @@ -1386,61 +1540,19 @@ pGlint->FbMapSize = pScrn->videoRam * 1024; - /* We should move this out somewhere ! */ + /* OVERRIDE videoRam/FbMapSize, for Multiply connected chips to GAMMA */ + pGlint->MultiAperture = FALSE; if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { + (pGlint->numMultiDevices == 2) ) { CARD32 chipconfig; + CARD32 size = 0; CARD32 temp; GLINTMapMem(pScrn); -#if 0 - /* We shouldn't really do this yet, we haven't saved the - * state of the chip. - * Best of all put a timer in to reset the engine if it - * doesn't respond - but later */ - /* - * This is needed before the first GLINT_SLOW_WRITE_REG -- - * otherwise the server will hang if it was left in a bad state. - */ - GLINT_WRITE_REG(0, ResetStatus); - while (GLINT_READ_REG(ResetStatus) & 0x80000000) { - xf86DrvMsg(pScrn->scrnIndex, from, "Resetting Core\n"); - } -#endif - temp = GLINT_READ_REG(GCSRAperture); GLINT_SLOW_WRITE_REG(GCSRSecondaryGLINTMapEn, GCSRAperture); -#if 0 - xf86DrvMsg(pScrn->scrnIndex, from, - "InFIFOSpace = %d, %d (after reset)\n", - GLINT_READ_REG(InFIFOSpace), - GLINT_SECONDARY_READ_REG(InFIFOSpace)); - xf86DrvMsg(pScrn->scrnIndex, from, - "OutFIFOSWords = %d, %d (after reset)\n", - GLINT_READ_REG(OutFIFOWords), - GLINT_SECONDARY_READ_REG(OutFIFOWords)); - - /* Reset doesn't appear to drain the Output - FIFO. Argh. */ - while (GLINT_READ_REG(OutFIFOWords)) { - GLINT_READ_REG(OutputFIFO); - } - while (GLINT_SECONDARY_READ_REG(OutFIFOWords)) { - GLINT_SECONDARY_READ_REG(OutputFIFO); - } - - xf86DrvMsg(pScrn->scrnIndex, from, - "InFIFOSpace = %d, %d (after drain)\n", - GLINT_READ_REG(InFIFOSpace), - GLINT_SECONDARY_READ_REG(InFIFOSpace)); - xf86DrvMsg(pScrn->scrnIndex, from, - "OutFIFOSWords = %d, %d (after drain)\n", - GLINT_READ_REG(OutFIFOWords), - GLINT_SECONDARY_READ_REG(OutFIFOWords)); -#endif - chipconfig = GLINT_READ_REG(GChipConfig); GLINT_SLOW_WRITE_REG(GCSRSecondaryGLINTMapEn, GCSRAperture); @@ -1449,18 +1561,26 @@ switch (chipconfig & GChipMultiGLINTApMask) { case GChipMultiGLINTAp_0M: - pGlint->FbMapSize = 0; + size = 0; break; case GChipMultiGLINTAp_16M: - pGlint->FbMapSize = 16 * 1024 * 1024; + size = 16 * 1024 * 1024; break; case GChipMultiGLINTAp_32M: - pGlint->FbMapSize = 32 * 1024 * 1024; + size = 32 * 1024 * 1024; break; case GChipMultiGLINTAp_64M: - pGlint->FbMapSize = 64 * 1024 * 1024; + size = 64 * 1024 * 1024; break; } + + if (size == 0) { + xf86DrvMsg(pScrn->scrnIndex, from, "MultiAperture: disabled\n"); + } else { + xf86DrvMsg(pScrn->scrnIndex, from, "MultiAperture: enabled\n"); + pGlint->FbMapSize = size; + pGlint->MultiAperture = TRUE; + } } xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", @@ -1474,10 +1594,10 @@ switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: + pGlint->FIFOSize = 256; maxheight = 2048; maxwidth = 2048; pGlint->RefClock = 14318; - pGlint->VGAcore = TRUE; /* chip has a vga core */ pGlint->RamDacRec = RamDacCreateInfoRec(); pGlint->RamDacRec->ReadDAC = Permedia2InIndReg; pGlint->RamDacRec->WriteDAC = Permedia2OutIndReg; @@ -1491,10 +1611,10 @@ } break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: + pGlint->FIFOSize = 256; maxheight = 2048; maxwidth = 2048; pGlint->RefClock = 14318; - pGlint->VGAcore = TRUE; /* chip has a vga core */ pGlint->RamDacRec = RamDacCreateInfoRec(); pGlint->RamDacRec->ReadDAC = Permedia2vInIndReg; pGlint->RamDacRec->WriteDAC = Permedia2vOutIndReg; @@ -1508,10 +1628,10 @@ } break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + pGlint->FIFOSize = 120; maxheight = 4096; maxwidth = 4096; pGlint->RefClock = 14318; - pGlint->VGAcore = TRUE; pGlint->RamDacRec = RamDacCreateInfoRec(); pGlint->RamDacRec->ReadDAC = Permedia2vInIndReg; pGlint->RamDacRec->WriteDAC = Permedia2vOutIndReg; @@ -1526,9 +1646,9 @@ break; case PCI_VENDOR_TI_CHIP_PERMEDIA: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA: + pGlint->FIFOSize = 31; maxheight = 1024; maxwidth = 1536; - pGlint->VGAcore = TRUE; /* chip has a vga core */ GLINTProbeIBMramdac(pScrn); if (pGlint->RamDac == NULL) return FALSE; if (pGlint->RamDac->RamDacType != (IBM526DB_RAMDAC) && @@ -1539,13 +1659,7 @@ case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: - case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - pGlint->UsePCIRetry) { - xf86DrvMsg(pScrn->scrnIndex, from, - "GAMMA in use - PCI retries disabled\n"); - pGlint->UsePCIRetry = FALSE; - } + pGlint->FIFOSize = 15; if (pScrn->bitsPerPixel == 24) { xf86DrvMsg(pScrn->scrnIndex, from, "-depth 24 -pixmap24 not supported by this chip.\n"); @@ -1571,32 +1685,161 @@ if (pGlint->RamDac->RamDacType == (IBM526DB_RAMDAC) || pGlint->RamDac->RamDacType == (IBM526_RAMDAC)) pGlint->RefClock = 40000; - else { - xf86DrvMsg(pScrn->scrnIndex, X_DEFAULT, - "Undefined RefClock\n"); - return FALSE; - } } } if (!pGlint->RamDac) return FALSE; break; + case PCI_VENDOR_3DLABS_CHIP_DELTA: + pGlint->FIFOSize = 15; + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA: + maxheight = 1024; + maxwidth = 1536; + GLINTProbeIBMramdac(pScrn); + if (pGlint->RamDac == NULL) return FALSE; + if (pGlint->RamDac->RamDacType != (IBM526DB_RAMDAC) && + pGlint->RamDac->RamDacType != (IBM526_RAMDAC)) + return FALSE; + pGlint->RefClock = 14318; + break; + case PCI_CHIP_500TX: + case PCI_CHIP_300SX: + case PCI_CHIP_MX: + if (pScrn->bitsPerPixel == 24) { + xf86DrvMsg(pScrn->scrnIndex, from, + "-depth 24 -pixmap24 not supported by this chip.\n"); + return FALSE; + } + maxheight = 4096; + maxwidth = 4096; + /* Test for an TI ramdac */ + if (!pGlint->RamDac) { + GLINTProbeTIramdac(pScrn); + if (pGlint->RamDac) + if ( (pGlint->RamDac->RamDacType == (TI3026_RAMDAC)) || + (pGlint->RamDac->RamDacType == (TI3030_RAMDAC)) ) + pGlint->RefClock = 14318; + } + /* Test for an IBM ramdac */ + if (!pGlint->RamDac) { + GLINTProbeIBMramdac(pScrn); + if (pGlint->RamDac) { + if (pGlint->RamDac->RamDacType == (IBM640_RAMDAC) || + pGlint->RamDac->RamDacType == (IBM526DB_RAMDAC) || + pGlint->RamDac->RamDacType == (IBM526_RAMDAC)) + pGlint->RefClock = 40000; + } + } + break; + } + break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + pGlint->FIFOSize = 32; + if (pScrn->bitsPerPixel == 24) { + xf86DrvMsg(pScrn->scrnIndex, from, + "-depth 24 -pixmap24 not supported by this chip.\n"); + return FALSE; + } + maxheight = 4096; + maxwidth = 4096; + /* Let's do board specific stuff first */ + if (IS_J2000) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Appian Jeronimo 2000 board detected\n"); + pGlint->RefClock = 14318; + pGlint->RamDacRec = RamDacCreateInfoRec(); + pGlint->RamDacRec->ReadDAC = Permedia2vInIndReg; + pGlint->RamDacRec->WriteDAC = Permedia2vOutIndReg; + pGlint->RamDacRec->ReadAddress = Permedia2ReadAddress; + pGlint->RamDacRec->WriteAddress = Permedia2WriteAddress; + pGlint->RamDacRec->ReadData = Permedia2ReadData; + pGlint->RamDacRec->WriteData = Permedia2WriteData; + if(!RamDacInit(pScrn, pGlint->RamDacRec)) { + RamDacDestroyInfoRec(pGlint->RamDacRec); + return FALSE; + } +#if 1 /* REMOVE LATER - see other IS_J2000 fixup code */ + /* As we push the acceleration through the pm3 (for now) we can + * safely set the FIFOSize to 120 again */ + pGlint->FIFOSize = 120; +#endif + break; + } + if (IS_GMX2000) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "3DLabs GMX2000 board detected\n"); + /* We need to wrap these after detection as the second MX + * is the only chip that can write to the TI3030 dac */ + ACCESSCHIP2(); + GLINTProbeTIramdac(pScrn); + ACCESSCHIP1(); + pGlint->RamDacRec->ReadDAC = GMX2000InIndReg; + pGlint->RamDacRec->WriteDAC = GMX2000OutIndReg; + pGlint->RamDacRec->ReadAddress = GMX2000ReadAddress; + pGlint->RamDacRec->WriteAddress = GMX2000WriteAddress; + pGlint->RamDacRec->ReadData = GMX2000ReadData; + pGlint->RamDacRec->WriteData = GMX2000WriteData; + pGlint->RefClock = 14318; + break; + } + /* Test for an TI ramdac */ + if (!pGlint->RamDac) { + GLINTProbeTIramdac(pScrn); + if (pGlint->RamDac) + if ( (pGlint->RamDac->RamDacType == (TI3026_RAMDAC)) || + (pGlint->RamDac->RamDacType == (TI3030_RAMDAC)) ) + pGlint->RefClock = 14318; + } + /* Test for an IBM ramdac */ + if (!pGlint->RamDac) { + GLINTProbeIBMramdac(pScrn); + if (pGlint->RamDac) { + if (pGlint->RamDac->RamDacType == (IBM640_RAMDAC)) + pGlint->RefClock = 28322; + else + if (pGlint->RamDac->RamDacType == (IBM526DB_RAMDAC) || + pGlint->RamDac->RamDacType == (IBM526_RAMDAC)) + pGlint->RefClock = 40000; + } + } + if (!pGlint->RamDac) { + if (pGlint->MultiChip == PCI_CHIP_PERMEDIA3) { + pGlint->RefClock = 14318; + pGlint->RamDacRec = RamDacCreateInfoRec(); + pGlint->RamDacRec->ReadDAC = Permedia2vInIndReg; + pGlint->RamDacRec->WriteDAC = Permedia2vOutIndReg; + pGlint->RamDacRec->ReadAddress = Permedia2ReadAddress; + pGlint->RamDacRec->WriteAddress = Permedia2WriteAddress; + pGlint->RamDacRec->ReadData = Permedia2ReadData; + pGlint->RamDacRec->WriteData = Permedia2WriteData; + } + if(!RamDacInit(pScrn, pGlint->RamDacRec)) { + RamDacDestroyInfoRec(pGlint->RamDacRec); + return FALSE; + } + } else + if (!pGlint->RamDac) + return FALSE; + break; } - if (pGlint->FBDev || FBDevProbed) - pGlint->VGAcore = FALSE; - - if (pGlint->VGAcore) { - /* The vgahw module should be loaded here when needed */ - if (!xf86LoadSubModule(pScrn, "vgahw")) - return FALSE; + if (pGlint->FIFOSize) + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "FIFO Size is %d DWORDS\n", + pGlint->FIFOSize); + + /* Initialize the card through int10 interface if needed */ + if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_GAMMA && + pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_DELTA && + !xf86IsPrimaryPci(pGlint->PciInfo)) { + if ( xf86LoadSubModule(pScrn, "int10")){ + xf86Int10InfoPtr pInt; - xf86LoaderReqSymLists(vgahwSymbols, NULL); - /* - * Allocate a vgaHWRec - */ - if (!vgaHWGetHWRec(pScrn)) - return FALSE; + xf86LoaderReqSymLists(int10Symbols, NULL); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); + pInt = xf86InitInt10(pGlint->pEnt->index); + xf86FreeInt10(pInt); + } } /* Set the min pixel clock */ @@ -1634,10 +1877,19 @@ if((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_500TX)|| (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_MX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) ) + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_300SX)) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_500TX)) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_MX)) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_MX)) ) pGlint->MaxClock = 220000; if ( (pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA) ) { + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_PERMEDIA)) ) { switch (pScrn->bitsPerPixel) { case 8: pGlint->MaxClock = 200000; @@ -1671,7 +1923,9 @@ break; } } - if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) + if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) pGlint->MaxClock = 300000; } xf86DrvMsg(pScrn->scrnIndex, from, "Max pixel clock is %d MHz\n", @@ -1698,7 +1952,9 @@ /* Select valid modes from those available */ if ((pGlint->NoAccel) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3)) { + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) { /* * XXX Assuming min pitch 256, max <maxwidth> * XXX Assuming min height 128, max <maxheight> @@ -1784,9 +2040,16 @@ if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_500TX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_MX) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) { + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_300SX)) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_500TX)) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_MX)) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_MX)) ) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, - "GLINT SX/TX/MX chipsets only support one modeline, using first\n"); + "This GLINT chip only supports one modeline, using first\n"); pScrn->modes->next = NULL; pScrn->virtualX = pScrn->modes->HDisplay; pScrn->virtualY = pScrn->modes->VDisplay; @@ -1800,6 +2063,20 @@ } } + /* Check Virtual resolution */ + if (pScrn->virtualX > maxwidth) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "GLINTModeInit: virtual width (%d) too big for hardware\n", + pScrn->virtualX); + return FALSE; + } + if (pScrn->virtualY > maxheight) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "GLINTModeInit: virtual height (%d) too big for hardware\n", + pScrn->virtualY); + return FALSE; + } + switch (pGlint->Chipset) { /* Now we know displaywidth, so set linepitch data */ case PCI_VENDOR_TI_CHIP_PERMEDIA2: @@ -1813,24 +2090,38 @@ case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_MX: case PCI_VENDOR_3DLABS_CHIP_300SX: - case PCI_VENDOR_3DLABS_CHIP_GAMMA: pGlint->pprod = partprod500TX[pScrn->displayWidth >> 5]; pGlint->bppalign = 0; break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_DELTA: + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + case PCI_CHIP_500TX: + case PCI_CHIP_300SX: + pGlint->pprod = partprod500TX[pScrn->displayWidth >> 5]; + pGlint->bppalign = 0; + break; + case PCI_CHIP_PERMEDIA: + pGlint->pprod = partprodPermedia[pScrn->displayWidth >> 5]; + pGlint->bppalign = bppand[(pScrn->bitsPerPixel>>3)-1]; + break; + } + break; } if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - int bytesPerPixel, realMXWidthBytes, inputXSpanBytes; + (pGlint->numMultiDevices == 2) ) { + int bytesPerPixel, realWidthBytes, inputXSpanBytes; CARD32 postMultiply, productEnable, use16xProduct, inputXSpan; CARD32 binaryEval, glintApSize; /* setup multi glint framebuffer aperture */ bytesPerPixel = (pScrn->bitsPerPixel >> 3); - realMXWidthBytes = pScrn->displayWidth * bytesPerPixel; + realWidthBytes = pScrn->displayWidth * bytesPerPixel; /* compute Input X Span field */ - binaryEval = ((realMXWidthBytes << 1) - 1); + binaryEval = ((realWidthBytes << 1) - 1); if (binaryEval & (8 << 10)) { /* 8K */ inputXSpan = 3; inputXSpanBytes = 8 * 1024; @@ -1849,7 +2140,7 @@ } /* compute post multiply */ - binaryEval = realMXWidthBytes >> 3; + binaryEval = realWidthBytes >> 3; postMultiply = 0; while ((postMultiply < 5) && !(binaryEval & 1)) { postMultiply++; @@ -1894,7 +2185,7 @@ glintApSize = 0 << 10; } - pGlint->realMXWidth = ( glintApSize | + pGlint->realWidth = ( glintApSize | postMultiply | productEnable | use16xProduct | @@ -2022,12 +2313,6 @@ pGlint->IOBase = fbdevHWMapMMIO(pScrn); if (pGlint->IOBase == NULL) return FALSE; - /* - * This does not work on Alphas ! They need VGA MMIO space - * mapped in a special way as they cannot access it byte - * or wordwise. - */ - pGlint->IOBaseVGA = pGlint->IOBase + GLINT_VGA_MMIO_OFF; TRACE_EXIT("GLINTMapMem"); return TRUE; @@ -2039,8 +2324,6 @@ */ pGlint->IOBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO_32BIT, pGlint->PciTag, pGlint->IOAddress, 0x20000); - pGlint->IOBaseVGA = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, - pGlint->PciTag, pGlint->IOAddress + GLINT_VGA_MMIO_OFF, 0x2000); if (pGlint->IOBase == NULL) return FALSE; @@ -2087,10 +2370,6 @@ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pGlint->IOBase, 0x20000); pGlint->IOBase = NULL; - if (pGlint->IOBaseVGA != NULL) - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pGlint->IOBaseVGA, 0x2000); - pGlint->IOBaseVGA = NULL; - if (pGlint->FbBase != NULL) xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pGlint->FbBase, pGlint->FbMapSize); pGlint->FbBase = NULL; @@ -2107,23 +2386,16 @@ { GLINTPtr pGlint; GLINTRegPtr glintReg; + GLINTRegPtr glintReg2; RamDacHWRecPtr pRAMDAC; RamDacRegRecPtr RAMDACreg; pGlint = GLINTPTR(pScrn); pRAMDAC = RAMDACHWPTR(pScrn); - glintReg = &pGlint->SavedReg; + glintReg = &pGlint->SavedReg[0]; + glintReg2 = &pGlint->SavedReg[1]; RAMDACreg = &pRAMDAC->SavedReg; TRACE_ENTER("GLINTSave"); - if (pGlint->VGAcore) { - vgaRegPtr vgaReg; - vgaReg = &VGAHWPTR(pScrn)->SavedReg; - if (xf86IsPrimaryPci(pGlint->PciInfo)) { - vgaHWSave(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_FONTS); - } else { - vgaHWSave(pScrn, vgaReg, VGA_SR_MODE); - } - } switch (pGlint->Chipset) { @@ -2145,15 +2417,39 @@ case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: + TXSave(pScrn, glintReg); + (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - DualMXSave(pScrn, glintReg); - } - else { + case PCI_VENDOR_3DLABS_CHIP_DELTA: + switch (pGlint->MultiChip) { + case PCI_CHIP_500TX: + case PCI_CHIP_300SX: + case PCI_CHIP_MX: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2() + TXSave(pScrn, glintReg2); +#if 0 + (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg2); +#endif + ACCESSCHIP1(); + } TXSave(pScrn, glintReg); + (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; + case PCI_CHIP_PERMEDIA: + PermediaSave(pScrn, glintReg); + (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; + case PCI_CHIP_PERMEDIA3: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + Permedia3Save(pScrn, glintReg2); + ACCESSCHIP1(); + } + Permedia3Save(pScrn, glintReg); + break; } - (*pGlint->RamDac->Save)(pScrn, pGlint->RamDacRec, RAMDACreg); break; } TRACE_EXIT("GLINTSave"); @@ -2171,18 +2467,10 @@ { int ret = -1; GLINTPtr pGlint = GLINTPTR(pScrn); - GLINTRegPtr glintReg; RamDacHWRecPtr pRAMDAC = RAMDACHWPTR(pScrn); RamDacRegRecPtr RAMDACreg; - - if (pGlint->VGAcore) { - vgaHWPtr hwp = VGAHWPTR(pScrn); - vgaHWUnlock(hwp); - - /* Initialise the ModeReg values */ - if (!vgaHWInit(pScrn, mode)) - return FALSE; - } + GLINTRegPtr glintReg = &pGlint->ModeReg[0]; + GLINTRegPtr glintReg2 = &pGlint->ModeReg[1]; pScrn->vtSema = TRUE; @@ -2195,7 +2483,7 @@ ret = Permedia2VInit(pScrn, mode); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: - ret = Permedia3Init(pScrn, mode); + ret = Permedia3Init(pScrn, mode, glintReg); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA: @@ -2204,31 +2492,45 @@ case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: + ret = TXInit(pScrn, mode, glintReg); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - ret = DualMXInit(pScrn, mode); - } - else { - ret = TXInit(pScrn, mode); + case PCI_VENDOR_3DLABS_CHIP_DELTA: + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + case PCI_CHIP_500TX: + case PCI_CHIP_300SX: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + ret = TXInit(pScrn, mode, glintReg2); + ACCESSCHIP1(); + } + ret = TXInit(pScrn, mode, glintReg); + break; + case PCI_CHIP_PERMEDIA: + ret = PermediaInit(pScrn, mode); + break; + case PCI_CHIP_PERMEDIA3: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + ret = Permedia3Init(pScrn, mode, glintReg2); + ACCESSCHIP1(); + } + ret = Permedia3Init(pScrn, mode, glintReg); + break; } break; } if (!ret) return FALSE; - - /* Program the registers */ - if (pGlint->VGAcore) { - vgaHWPtr hwp = VGAHWPTR(pScrn); - vgaRegPtr vgaReg = &hwp->ModeReg; - vgaHWProtect(pScrn, TRUE); - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); - } - glintReg = &pGlint->ModeReg; + glintReg = &pGlint->ModeReg[0]; + glintReg2 = &pGlint->ModeReg[1]; RAMDACreg = &pRAMDAC->ModeReg; + pGlint->STATE = FALSE; + switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: @@ -2248,22 +2550,42 @@ case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: + TXRestore(pScrn, glintReg); + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - DualMXRestore(pScrn, glintReg); - } - else { + case PCI_VENDOR_3DLABS_CHIP_DELTA: + switch (pGlint->MultiChip) { + case PCI_CHIP_500TX: + case PCI_CHIP_300SX: + case PCI_CHIP_MX: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + TXRestore(pScrn, glintReg2); +#if 0 + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec,RAMDACreg2); +#endif + ACCESSCHIP1(); + } TXRestore(pScrn, glintReg); + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; + case PCI_CHIP_PERMEDIA: + PermediaRestore(pScrn, glintReg); + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; + case PCI_CHIP_PERMEDIA3: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + Permedia3Restore(pScrn, glintReg2); + ACCESSCHIP1(); + } + Permedia3Restore(pScrn, glintReg); + break; } - (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; } - if (pGlint->VGAcore) { - vgaHWProtect(pScrn, FALSE); - } - if (xf86IsPc98()) outb(0xfac, 0x01); @@ -2278,18 +2600,17 @@ { GLINTPtr pGlint; GLINTRegPtr glintReg; + GLINTRegPtr glintReg2; RamDacHWRecPtr pRAMDAC; RamDacRegRecPtr RAMDACreg; pGlint = GLINTPTR(pScrn); pRAMDAC = RAMDACHWPTR(pScrn); - glintReg = &pGlint->SavedReg; + glintReg = &pGlint->SavedReg[0]; + glintReg2 = &pGlint->SavedReg[1]; RAMDACreg = &pRAMDAC->SavedReg; TRACE_ENTER("GLINTRestore"); - if (pGlint->VGAcore) { - vgaHWProtect(pScrn, TRUE); - } switch (pGlint->Chipset) { case PCI_VENDOR_TI_CHIP_PERMEDIA2: @@ -2302,6 +2623,10 @@ Permedia2VRestore(pScrn, glintReg); break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: +#ifdef PM3Video + TRACE("PM3Video : VideoLeaveVT"); + Permedia3VideoLeaveVT(pScrn); +#endif Permedia3Restore(pScrn, glintReg); break; case PCI_VENDOR_TI_CHIP_PERMEDIA: @@ -2312,28 +2637,46 @@ case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: + TXRestore(pScrn, glintReg); + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - DualMXRestore(pScrn, glintReg); - } - else { + case PCI_VENDOR_3DLABS_CHIP_DELTA: + switch (pGlint->MultiChip) { + case PCI_CHIP_MX: + case PCI_CHIP_500TX: + case PCI_CHIP_300SX: + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + TXRestore(pScrn, glintReg2); +#if 0 + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec,RAMDACreg2); +#endif + ACCESSCHIP1(); + } TXRestore(pScrn, glintReg); + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; + case PCI_CHIP_PERMEDIA: + PermediaRestore(pScrn, glintReg); + (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); + break; + case PCI_CHIP_PERMEDIA3: +#ifdef PM3Video + TRACE("PM3Video : VideoLeaveVT"); + Permedia3VideoLeaveVT(pScrn); +#endif + if (pGlint->numMultiDevices == 2) { + ACCESSCHIP2(); + Permedia3Restore(pScrn, glintReg2); + ACCESSCHIP1(); + } + Permedia3Restore(pScrn, glintReg); + break; } - (*pGlint->RamDac->Restore)(pScrn, pGlint->RamDacRec, RAMDACreg); break; } - if (pGlint->VGAcore) { - vgaHWPtr hwp = VGAHWPTR(pScrn); - vgaRegPtr vgaReg = &hwp->SavedReg; - if (xf86IsPrimaryPci(pGlint->PciInfo)) { - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | VGA_SR_FONTS); - } else { - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); - } - vgaHWProtect(pScrn, FALSE); - } TRACE_EXIT("GLINTRestore"); } @@ -2356,32 +2699,6 @@ if (!GLINTMapMem(pScrn)) return FALSE; - /* Initialize the MMIO vgahw functions */ - if (pGlint->VGAcore) { - vgaHWPtr hwp; - hwp = VGAHWPTR(pScrn); - if (xf86IsPrimaryPci(pGlint->PciInfo)) { - hwp->MapSize = 0x10000; /* Standard 64k VGA window */ - if (!vgaHWMapMem(pScrn)) - return FALSE; - } - - /* Timing problem with PM3 & PM2V chips dont like being blasted */ - /* This solves the dual head problem but trahses the console font. */ - if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) { - /* Graphics Index VGA register don't work in mmio mode - * for the Permedia3 chip, it thrashes the console font. - * Let's keep the IO functions for this instead ... */ - vgaHWWriteIndexProcPtr writeGr = hwp->writeGr; - vgaHWReadIndexProcPtr readGr = hwp->readGr; - vgaHWSetMmioFuncs(hwp, pGlint->IOBaseVGA, 0); - hwp->writeGr = writeGr; - hwp->readGr = readGr; - } else if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) - vgaHWSetMmioFuncs(hwp, pGlint->IOBaseVGA, 0); - vgaHWGetIOBase(hwp); - } - if (pGlint->FBDev) { fbdevHWSave(pScrn); if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) { @@ -2405,6 +2722,7 @@ xf86SetDDCproperties(pScrn,xf86PrintEDID(pMon)); } + /* Initialise the first mode */ if ( (!pGlint->FBDev) && !(GLINTModeInit(pScrn, pScrn->currentMode))) { xf86DrvMsg(scrnIndex, X_ERROR, @@ -2494,10 +2812,8 @@ pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); -#ifdef RENDER if (ret) fbPictureInit(pScreen, 0, 0); -#endif break; case 32: if(pScrn->overlayFlags & OVERLAY_8_32_PLANAR) @@ -2510,10 +2826,8 @@ pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); -#ifdef RENDER if (ret) fbPictureInit(pScreen, 0, 0); -#endif } break; default: @@ -2528,8 +2842,13 @@ xf86SetBlackWhitePixels(pScreen); + pGlint->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = GLINTBlockHandler; + +#if !defined(__sparc__) if (!pGlint->ShadowFB) GLINTDGAInit(pScreen); +#endif if (pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ @@ -2563,13 +2882,24 @@ break; case PCI_VENDOR_3DLABS_CHIP_500TX: case PCI_VENDOR_3DLABS_CHIP_MX: + TXAccelInit(pScreen); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - DualMXAccelInit(pScreen); - } - else { + case PCI_VENDOR_3DLABS_CHIP_DELTA: + switch (pGlint->MultiChip) { + case PCI_CHIP_500TX: + case PCI_CHIP_MX: TXAccelInit(pScreen); + break; + case PCI_CHIP_300SX: + SXAccelInit(pScreen); + break; + case PCI_CHIP_PERMEDIA: + PermediaAccelInit(pScreen); + break; + case PCI_CHIP_PERMEDIA3: + Permedia3AccelInit(pScreen); + break; } break; case PCI_VENDOR_3DLABS_CHIP_300SX: @@ -2592,7 +2922,9 @@ Permedia2HWCursorInit(pScreen); else if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3)) + (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) Permedia2vHWCursorInit(pScreen); else /* If we get here pGlint->Ramdac should have been set */ @@ -2610,8 +2942,19 @@ if (!miCreateDefColormap(pScreen)) return FALSE; + if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) { + if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, + (pGlint->FBDev) ? fbdevHWLoadPalette : + ((pScrn->depth == 16) ? Permedia3LoadPalette16:Permedia3LoadPalette), + NULL, + CMAP_RELOAD_ON_MODE_SWITCH | + ((pScrn->overlayFlags & OVERLAY_8_32_PLANAR) + ? 0 : CMAP_PALETTED_TRUECOLOR))) + return FALSE; + } else if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA2) || (pGlint->Chipset == PCI_VENDOR_TI_CHIP_PERMEDIA2)) { if (!xf86HandleColormaps(pScreen, 256, pScrn->rgbBits, @@ -2645,9 +2988,7 @@ if(pGlint->ShadowFB) ShadowFBInit(pScreen, GLINTRefreshArea); -#ifdef DPMSExtension xf86DPMSInit(pScreen, (DPMSSetProcPtr)GLINTDisplayPowerManagementSet, 0); -#endif #ifdef XF86DRI if (pGlint->directRenderingEnabled) { @@ -2679,6 +3020,19 @@ case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: Permedia2VideoInit(pScreen); + break; +#ifdef PM3Video + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + TRACE("PM3Video : VideoInit"); + Permedia3VideoInit(pScreen); + break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA3: + TRACE("PM3Video : VideoInit"); + Permedia3VideoInit(pScreen); + } +#endif } #if 0 @@ -2720,14 +3074,28 @@ PermediaInitializeEngine(pScrn); break; case PCI_VENDOR_3DLABS_CHIP_500TX: - case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: + TXInitializeEngine(pScrn); + break; + case PCI_VENDOR_3DLABS_CHIP_300SX: + SXInitializeEngine(pScrn); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2)) { - DualMXInitializeEngine(pScrn); - } else { - TXInitializeEngine(pScrn); + case PCI_VENDOR_3DLABS_CHIP_DELTA: + switch (pGlint->MultiChip) { + case PCI_CHIP_500TX: + case PCI_CHIP_MX: + TXInitializeEngine(pScrn); + break; + case PCI_CHIP_300SX: + SXInitializeEngine(pScrn); + break; + case PCI_CHIP_PERMEDIA: + PermediaInitializeEngine(pScrn); + break; + case PCI_CHIP_PERMEDIA3: + Permedia3InitializeEngine(pScrn); + break; } break; } @@ -2774,9 +3142,24 @@ case PCI_VENDOR_TI_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: + GLINT_SLOW_WRITE_REG(base, PMScreenBase); + break; case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + base = (y * pScrn->displayWidth + x) >> pGlint->BppShift; GLINT_SLOW_WRITE_REG(base, PMScreenBase); break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_DELTA: + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA3: + base = (y * pScrn->displayWidth + x) >> pGlint->BppShift; + GLINT_SLOW_WRITE_REG(base, PMScreenBase); + break; + case PCI_CHIP_PERMEDIA: + GLINT_SLOW_WRITE_REG(base, PMScreenBase); + break; + } + break; } TRACE_EXIT("GLINTAdjustFrame (normal)"); } @@ -2810,6 +3193,19 @@ case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: Permedia2VideoEnterVT(pScrn); + break; +#ifdef PM3Video + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + TRACE("PM3Video : VideoEnterVT"); + Permedia3VideoEnterVT(pScrn); + break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA3: + TRACE("PM3Video : VideoEnterVT"); + Permedia3VideoEnterVT(pScrn); + } +#endif } if (!pGlint->NoAccel) { @@ -2827,14 +3223,28 @@ PermediaInitializeEngine(pScrn); break; case PCI_VENDOR_3DLABS_CHIP_500TX: - case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: + TXInitializeEngine(pScrn); + break; + case PCI_VENDOR_3DLABS_CHIP_300SX: + SXInitializeEngine(pScrn); + break; case PCI_VENDOR_3DLABS_CHIP_GAMMA: - if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && - (pGlint->numMXDevices == 2) ) { - DualMXInitializeEngine(pScrn); - } else { - TXInitializeEngine(pScrn); + case PCI_VENDOR_3DLABS_CHIP_DELTA: + switch (pGlint->MultiChip) { + case PCI_CHIP_500TX: + case PCI_CHIP_MX: + TXInitializeEngine(pScrn); + break; + case PCI_CHIP_300SX: + SXInitializeEngine(pScrn); + break; + case PCI_CHIP_PERMEDIA: + PermediaInitializeEngine(pScrn); + break; + case PCI_CHIP_PERMEDIA3: + Permedia3InitializeEngine(pScrn); + break; } break; } @@ -2860,9 +3270,8 @@ GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("GLINTLeaveVT"); + pGlint->STATE = TRUE; GLINTRestore(pScrn); - if (pGlint->VGAcore) - vgaHWLock(VGAHWPTR(pScrn)); if (xf86IsPc98()) outb(0xfac, 0x00); @@ -2895,6 +3304,18 @@ case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: Permedia2VideoUninit(pScrn); + break; +#ifdef PM3Video + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + TRACE("PM3Video : VideoUninit"); + Permedia3VideoUninit(pScrn); + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA3: + TRACE("PM3Video : VideoUninit"); + Permedia3VideoUninit(pScrn); + } +#endif } if (pScrn->vtSema) { @@ -2903,9 +3324,8 @@ if (pGlint->FBDev) fbdevHWRestore(pScrn); else { + pGlint->STATE = TRUE; GLINTRestore(pScrn); - if (pGlint->VGAcore) - vgaHWLock(VGAHWPTR(pScrn)); } GLINTUnmapMem(pScrn); } @@ -2917,11 +3337,16 @@ xfree(pGlint->ShadowPtr); if (pGlint->DGAModes) xfree(pGlint->DGAModes); + if (pGlint->ScratchBuffer) + xfree(pGlint->ScratchBuffer); pScrn->vtSema = FALSE; if (xf86IsPc98()) outb(0xfac, 0x00); + if(pGlint->BlockHandler) + pScreen->BlockHandler = pGlint->BlockHandler; + pScreen->CloseScreen = pGlint->CloseScreen; TRACE_EXIT("GLINTCloseScreen"); return (*pScreen->CloseScreen)(scrnIndex, pScreen); @@ -2934,15 +3359,13 @@ static void GLINTFreeScreen(int scrnIndex, int flags) { +#if DEBUG ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - GLINTPtr pGlint = GLINTPTR(pScrn); - +#endif TRACE_ENTER("GLINTFreeScreen"); - if ((pGlint->FBDev || FBDevProbed) && xf86LoaderCheckSymbol("fbdevHWFreeRec")) + if (xf86LoaderCheckSymbol("fbdevHWFreeRec")) fbdevHWFreeRec(xf86Screens[scrnIndex]); - if (pGlint->VGAcore && xf86LoaderCheckSymbol("vgaHWFreeHWRec")) - vgaHWFreeHWRec(xf86Screens[scrnIndex]); - if (pGlint->RamDacRec && xf86LoaderCheckSymbol("RamDacFreeRec")) + if (xf86LoaderCheckSymbol("RamDacFreeRec")) RamDacFreeRec(xf86Screens[scrnIndex]); GLINTFreeRec(xf86Screens[scrnIndex]); TRACE_EXIT("GLINTFreeScreen"); @@ -3038,6 +3461,18 @@ case PCI_VENDOR_3DLABS_CHIP_300SX: case PCI_VENDOR_3DLABS_CHIP_MX: break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_DELTA: + switch (pGlint->MultiChip) { + case PCI_CHIP_PERMEDIA3: + case PCI_CHIP_PERMEDIA: + temp = GLINT_READ_REG(PMVideoControl); + if (unblank) temp |= 1; + else temp &= 0xFFFFFFFE; + GLINT_SLOW_WRITE_REG(temp, PMVideoControl); + break; + } + break; } } @@ -3045,22 +3480,232 @@ return TRUE; } +static void +GLINTBlockHandler ( + int i, + pointer blockData, + pointer pTimeout, + pointer pReadmask +){ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + GLINTPtr pGlint = GLINTPTR(pScrn); + + if(pGlint->CursorColorCallback) + (*pGlint->CursorColorCallback)(pScrn); + + if(pGlint->LoadCursorCallback) + (*pGlint->LoadCursorCallback)(pScrn); + + pScreen->BlockHandler = pGlint->BlockHandler; + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler = GLINTBlockHandler; +} + #ifdef DEBUG void GLINT_VERB_WRITE_REG(GLINTPtr pGlint, CARD32 v, int r, char *file, int line) { if (xf86GetVerbosity() > 2) ErrorF("[0x%04x] <- 0x%08x (%s, %d)\n", r, v, file, line); - *(volatile CARD32 *)((char *) pGlint->IOBase + r) = v; + *(volatile CARD32 *)((char *) pGlint->IOBase + pGlint->IOOffset + r) = v; } CARD32 GLINT_VERB_READ_REG(GLINTPtr pGlint, CARD32 r, char *file, int line) { - CARD32 v = *(volatile CARD32 *)((char *) pGlint->IOBase + r); + CARD32 v = + *(volatile CARD32 *)((char *) pGlint->IOBase + pGlint->IOOffset + r); if (xf86GetVerbosity() > 2) ErrorF("[0x%04x] -> 0x%08x (%s, %d)\n", r, v, file, line); return v; } #endif + +void GLINT_MoveBYTE( + register CARD32* dest, + register unsigned char* src, + register int dwords) +{ +#ifdef __alpha__ + write_mem_barrier(); +#endif + while(dwords) { + *dest = *src; + src += 1; + dest += 1; + dwords -= 1; + } +} + +void GLINT_MoveWORDS( + register CARD32* dest, + register unsigned short* src, + register int dwords) +{ +#ifdef __alpha__ + write_mem_barrier(); +#endif + while(dwords & ~0x01) { + *dest = *src; + *(dest + 1) = *(src + 1); + src += 2; + dest += 2; + dwords -= 2; + } + if (dwords) + *dest = *src; +} + +void GLINT_MoveDWORDS( + register CARD32* dest, + register CARD32* src, + register int dwords) +{ +#ifdef __alpha__ + write_mem_barrier(); +#endif + if ((unsigned long)src & 0x3UL) { + unsigned char *pchar; + while (dwords & ~0x03) { + pchar = (unsigned char *)(src + 0); + *(dest + 0) = (((CARD32)pchar[0] << 24) | + ((CARD32)pchar[1] << 16) | + ((CARD32)pchar[2] << 8) | + ((CARD32)pchar[3] << 0)); + pchar = (unsigned char *)(src + 1); + *(dest + 1) = (((CARD32)pchar[0] << 24) | + ((CARD32)pchar[1] << 16) | + ((CARD32)pchar[2] << 8) | + ((CARD32)pchar[3] << 0)); + pchar = (unsigned char *)(src + 2); + *(dest + 2) = (((CARD32)pchar[0] << 24) | + ((CARD32)pchar[1] << 16) | + ((CARD32)pchar[2] << 8) | + ((CARD32)pchar[3] << 0)); + pchar = (unsigned char *)(src + 3); + *(dest + 3) = (((CARD32)pchar[0] << 24) | + ((CARD32)pchar[1] << 16) | + ((CARD32)pchar[2] << 8) | + ((CARD32)pchar[3] << 0)); + src += 4; + dest += 4; + dwords -= 4; + } + if (!dwords) + return; + pchar = (unsigned char *)(src + 0); + *(dest + 0) = (((CARD32)pchar[0] << 24) | + ((CARD32)pchar[1] << 16) | + ((CARD32)pchar[2] << 8) | + ((CARD32)pchar[3] << 0)); + if (dwords == 1) + return; + pchar = (unsigned char *)(src + 1); + *(dest + 1) = (((CARD32)pchar[0] << 24) | + ((CARD32)pchar[1] << 16) | + ((CARD32)pchar[2] << 8) | + ((CARD32)pchar[3] << 0)); + if (dwords == 2) + return; + pchar = (unsigned char *)(src + 2); + *(dest + 2) = (((CARD32)pchar[0] << 24) | + ((CARD32)pchar[1] << 16) | + ((CARD32)pchar[2] << 8) | + ((CARD32)pchar[3] << 0)); + } else { + while (dwords & ~0x03) { + *dest = *src; + *(dest + 1) = *(src + 1); + *(dest + 2) = *(src + 2); + *(dest + 3) = *(src + 3); + src += 4; + dest += 4; + dwords -= 4; + } + if (!dwords) + return; + *dest = *src; + if (dwords == 1) + return; + *(dest + 1) = *(src + 1); + if (dwords == 2) + return; + *(dest + 2) = *(src + 2); + } +} + +int +Shiftbpp(ScrnInfoPtr pScrn, int value) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + int logbytesperaccess = 2; /* default */ + + switch (pGlint->Chipset) { + case PCI_VENDOR_TI_CHIP_PERMEDIA: + case PCI_VENDOR_TI_CHIP_PERMEDIA2: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2: + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA2V: + logbytesperaccess = 2; + break; + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + logbytesperaccess = 4; + break; + case PCI_VENDOR_3DLABS_CHIP_300SX: + case PCI_VENDOR_3DLABS_CHIP_500TX: + case PCI_VENDOR_3DLABS_CHIP_MX: + if ( (pGlint->RamDac->RamDacType == (IBM640_RAMDAC)) || + (pGlint->RamDac->RamDacType == (TI3030_RAMDAC)) ) + logbytesperaccess = 4; + else + logbytesperaccess = 3; + break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + case PCI_VENDOR_3DLABS_CHIP_DELTA: + switch (pGlint->MultiChip) { + case PCI_CHIP_500TX: + case PCI_CHIP_300SX: + case PCI_CHIP_MX: + if ( (pGlint->RamDac->RamDacType == (IBM640_RAMDAC)) || + (pGlint->RamDac->RamDacType == (TI3030_RAMDAC)) ) + logbytesperaccess = 4; + else + logbytesperaccess = 3; + break; + case PCI_CHIP_PERMEDIA: + logbytesperaccess = 2; + break; + case PCI_CHIP_PERMEDIA3: + logbytesperaccess = 4; + break; + } + } + + switch (pScrn->bitsPerPixel) { + case 8: + value >>= logbytesperaccess; + pGlint->BppShift = logbytesperaccess; + break; + case 16: + if (pGlint->DoubleBuffer) { + value >>= (logbytesperaccess-2); + pGlint->BppShift = logbytesperaccess-2; + } else { + value >>= (logbytesperaccess-1); + pGlint->BppShift = logbytesperaccess-1; + } + break; + case 24: + value *= 3; + value >>= logbytesperaccess; + pGlint->BppShift = logbytesperaccess; + break; + case 32: + value >>= (logbytesperaccess-2); + pGlint->BppShift = logbytesperaccess-2; + break; + } + return (value); +} Index: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h:1.21 xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h:1.26.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h:1.21 Tue Sep 19 10:12:32 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h Thu May 24 16:12:47 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.21 2000/09/19 14:12:32 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/glint_regs.h,v 1.26.2.1 2001/05/24 20:12:47 alanh Exp $ */ /* * glint register file @@ -19,16 +19,7 @@ #include "compiler.h" -/********************************************** -* GLINT 500TX Configuration Region Registers * -***********************************************/ - -/* Device Identification */ -#define CFGVendorId 0x0000 -#define PCI_VENDOR_3DLABS 0x3D3D -#define PCI_VENDOR_TI 0x104C -#define CFGDeviceId 0x0002 - +/* The chips we know */ #define PCI_CHIP_3DLABS_300SX 0x01 #define PCI_CHIP_3DLABS_500TX 0x02 #define PCI_CHIP_3DLABS_DELTA 0x03 @@ -40,6 +31,29 @@ #define PCI_CHIP_3DLABS_PERMEDIA3 0x0A #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)) + +#define IS_J2000 ((pGlint->PciInfo->subsysVendor == 0x1097) && \ + (pGlint->PciInfo->subsysCard == 0x3d32)) + +#define IS_JPRO ((pGlint->PciInfo->subsysVendor == 0x1097) && \ + (pGlint->PciInfo->subsysCard == 0x3db3)) + +/********************************************** +* GLINT 500TX Configuration Region Registers * +***********************************************/ + +/* Device Identification */ +#define CFGVendorId 0x0000 +#define PCI_VENDOR_3DLABS 0x3D3D +#define PCI_VENDOR_TI 0x104C +#define CFGDeviceId 0x0002 + #define CFGRevisionId 0x08 #define CFGClassCode 0x09 #define CFGHeaderType 0x0E @@ -323,6 +337,10 @@ #define PM2VDACRDDClk1PreScale 0x204 #define PM2VDACRDDClk1FeedbackScale 0x205 #define PM2VDACRDDClk1PostScale 0x206 +#define PM2VDACRDMClkControl 0x20D +#define PM2VDACRDMClkPreScale 0x20E +#define PM2VDACRDMClkFeedbackScale 0x20F +#define PM2VDACRDMClkPostScale 0x210 #define PM2VDACRDCursorPalette 0x303 #define PM2VDACRDCursorPattern 0x400 #define PM2VDACIndexRegLow 0x4020 @@ -981,6 +999,8 @@ #define FM_PassStatisticTag 0x1000 #define FM_PassStatisticData 0x2000 +#define Sync_tag 0x0188 + #define StatisticMode GLINT_TAG_ADDR(0x18,0x01) #define MinRegion GLINT_TAG_ADDR(0x18,0x02) #define MaxRegion GLINT_TAG_ADDR(0x18,0x03) @@ -1173,44 +1193,49 @@ GLINT_VERB_READ_REG(pGlint,r,__FILE__,__LINE__) #else -#define GLINT_WRITE_REG(v,r) MMIO_OUT32(pGlint->IOBase,(unsigned long)r, v) -#define GLINT_READ_REG(r) MMIO_IN32(pGlint->IOBase,(unsigned long)r) -#define GLINT_SECONDARY_WRITE_REG(v,r) \ - MMIO_OUT32(pGlint->IOBase,(unsigned long)r+0x10000, v) -#define GLINT_SECONDARY_READ_REG(r) \ - MMIO_IN32(pGlint->IOBase,(unsigned long)r+0x10000) +#define GLINT_WRITE_REG(v,r) \ + MMIO_OUT32(pGlint->IOBase + pGlint->IOOffset,(unsigned long)(r), (v)) +#define GLINT_READ_REG(r) \ + MMIO_IN32(pGlint->IOBase + pGlint->IOOffset,(unsigned long)(r)) #endif /* DEBUG */ #define GLINT_WAIT(n) \ do{ \ - if(!pGlint->UsePCIRetry) \ - while(GLINT_READ_REG(InFIFOSpace)<(n)){ \ - mem_barrier(); \ - } \ + if (pGlint->InFifoSpace>=(n)) \ + pGlint->InFifoSpace -= (n); \ + else { \ + int tmp; \ + while((tmp=GLINT_READ_REG(InFIFOSpace))<(n)); \ + /* Clamp value due to bugs in PM3 */ \ + if (tmp > pGlint->FIFOSize) \ + tmp = pGlint->FIFOSize; \ + pGlint->InFifoSpace = tmp - (n); \ + } \ }while(0) -#define GLINT_MASK_WRITE_REG(v,m,r) \ - GLINT_WRITE_REG((GLINT_READ_REG(r)&(m))|(v),r) - #define GLINTDACDelay(x) do { \ int delay = x; \ unsigned char tmp; \ while(delay--){tmp = GLINT_READ_REG(InFIFOSpace);}; \ } while(0) +#define GLINT_MASK_WRITE_REG(v,m,r) \ + GLINT_WRITE_REG((GLINT_READ_REG(r)&(m))|(v),r) + #define GLINT_SLOW_WRITE_REG(v,r) \ do{ \ - GLINTDACDelay(5); \ + mem_barrier(); \ + GLINT_WAIT(pGlint->FIFOSize); \ + mem_barrier(); \ GLINT_WRITE_REG(v,r); \ - GLINTDACDelay(5); \ }while(0) -#define GLINT_SECONDARY_SLOW_WRITE_REG(v,r) \ -do{ \ - while(GLINT_READ_REG(InFIFOSpace)<1); \ - GLINT_SECONDARY_WRITE_REG(v,r); \ -}while(0) +#define GLINT_SET_INDEX(index) \ +do{ \ + GLINT_SLOW_WRITE_REG(((index)>>8)&0xff,PM2VDACIndexRegHigh); \ + GLINT_SLOW_WRITE_REG((index)&0xff,PM2VDACIndexRegLow); \ +} while(0) #define REPLICATE(r) \ { \ @@ -1266,4 +1291,38 @@ GLINT_WRITE_REG(planemask, FBHardwareWriteMask);\ } #endif + +/* Permedia Save/Restore functions */ + +#define STOREREG(address,value) \ + pReg->glintRegs[address >> 3] = value; + +#define SAVEREG(address) \ + pReg->glintRegs[address >> 3] = GLINT_READ_REG(address); + +#define RESTOREREG(address) \ + GLINT_SLOW_WRITE_REG(pReg->glintRegs[address >> 3], address); + +#define STOREDAC(address,value) \ + pReg->DacRegs[address] = value; + +#define P2VOUT(address) \ + Permedia2vOutIndReg(pScrn, address, 0x00, pReg->DacRegs[address]); + +#define P2VIN(address) \ + pReg->DacRegs[address] = Permedia2vInIndReg(pScrn, address); + +/* RamDac Save/Restore functions, used by external DAC's */ + +#define STORERAMDAC(address,value) \ + ramdacReg->DacRegs[address] = value; + +/* Multi Chip access */ + +#define ACCESSCHIP1() \ + pGlint->IOOffset = 0; + +#define ACCESSCHIP2() \ + pGlint->IOOffset = 0x10000; + #endif Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c:1.24 xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c:1.29.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c:1.24 Fri Mar 31 17:55:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c Wed May 30 07:42:22 2001 @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane, Wigan, England. + * Copyright 1997-2001 by Alan Hourihane, Wigan, England. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -30,7 +30,7 @@ * * Permedia 2 accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c,v 1.24 2000/03/31 22:55:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_accel.c,v 1.29.2.1 2001/05/30 11:42:22 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -115,18 +115,10 @@ int h, unsigned char *src, int srcwidth, int rop, unsigned int planemask, int transparency_color, int bpp, int depth); -static void Permedia2WritePixmap24bpp(ScrnInfoPtr pScrn, int x, int y, int w, - int h, unsigned char *src, int srcwidth, - int rop, unsigned int planemask, - int transparency_color, int bpp, int depth); static void Permedia2WritePixmap32bpp(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, int rop, unsigned int planemask, int transparency_color, int bpp, int depth); -static void Permedia2SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop,unsigned int planemask); -static void Permedia2SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); static void Permedia2SetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, int fg, int bg, int rop, @@ -141,8 +133,6 @@ static void Permedia2PolySegmentThinSolidWrapper(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment *pSeg); -#define MAX_FIFO_ENTRIES 256 - #if X_BYTE_ORDER == X_BIG_ENDIAN # define STIPPLE_SWAP 1<<18 /* Mirror stipple pattern horizontally */ #else @@ -182,7 +172,7 @@ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LogicalOpMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StatisticMode); - GLINT_SLOW_WRITE_REG(0xc00, FilterMode); + GLINT_SLOW_WRITE_REG(0x400, FilterMode); GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask); GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RasterizerMode); @@ -328,51 +318,32 @@ Permedia2SubsequentMono8x8PatternFillRect; } - if (pGlint->UsePCIRetry) { - infoPtr->CPUToScreenColorExpandFillFlags = SYNC_AFTER_COLOR_EXPAND | - BIT_ORDER_IN_BYTE_LSBFIRST | - CPU_TRANSFER_PAD_DWORD; - - infoPtr->ColorExpandBase = pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForCPUToScreenColorExpandFill = - Permedia2SetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - Permedia2SubsequentCPUToScreenColorExpandFill; - } else { - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = - BIT_ORDER_IN_BYTE_LSBFIRST; + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + BIT_ORDER_IN_BYTE_LSBFIRST; - infoPtr->NumScanlineColorExpandBuffers = 1; - infoPtr->ScanlineColorExpandBuffers = + infoPtr->NumScanlineColorExpandBuffers = 1; + infoPtr->ScanlineColorExpandBuffers = pGlint->XAAScanlineColorExpandBuffers; - pGlint->XAAScanlineColorExpandBuffers[0] = + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = Permedia2SetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = Permedia2SubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = + infoPtr->SubsequentColorExpandScanline = Permedia2SubsequentColorExpandScanline; - } - - infoPtr->ColorExpandRange = MAX_FIFO_ENTRIES; infoPtr->WriteBitmap = Permedia2WriteBitmap; - if (pScrn->bitsPerPixel == 8) + if (pScrn->bitsPerPixel == 8) { infoPtr->WritePixmap = Permedia2WritePixmap8bpp; - else - if (pScrn->bitsPerPixel == 16) + infoPtr->WritePixmapFlags = NO_GXCOPY; + } else + if (pScrn->bitsPerPixel == 16) { infoPtr->WritePixmap = Permedia2WritePixmap16bpp; - else -#if 0 - if (pScrn->bitsPerPixel == 24) { - infoPtr->WritePixmap = Permedia2WritePixmap24bpp; - infoPtr->WritePixmapFlags |= NO_PLANEMASK; - } - else -#endif + infoPtr->WritePixmapFlags = NO_GXCOPY; + } else if (pScrn->bitsPerPixel == 32) infoPtr->WritePixmap = Permedia2WritePixmap32bpp; @@ -381,7 +352,6 @@ infoPtr->SolidFillFlags |= NO_PLANEMASK; infoPtr->ScreenToScreenCopyFlags |= NO_PLANEMASK; infoPtr->WriteBitmapFlags |= NO_PLANEMASK; - infoPtr->CPUToScreenColorExpandFillFlags |= NO_PLANEMASK; infoPtr->ScanlineCPUToScreenColorExpandFillFlags |= NO_PLANEMASK; infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK; } @@ -427,11 +397,11 @@ CHECKCLIPPING; while (GLINT_READ_REG(DMACount) != 0); - GLINT_WAIT(1); + GLINT_WAIT(2); + GLINT_WRITE_REG(0x400, FilterMode); GLINT_WRITE_REG(0, GlintSync); do { while(GLINT_READ_REG(OutFIFOWords) == 0); -#define Sync_tag 0x188 } while (GLINT_READ_REG(OutputFIFO) != Sync_tag); } @@ -733,63 +703,6 @@ TRACE_EXIT("Permedia2SubsequentFillRectSolid"); } -static void MoveBYTE( - register CARD32* dest, - register unsigned char* src, - register int dwords -) -{ - while(dwords) { - *dest = *src; - src += 1; - dest += 1; - dwords -= 1; - } -} - -static void MoveWORDS( - register CARD32* dest, - register unsigned short* src, - register int dwords -) -{ - while(dwords & ~0x01) { - *dest = *src; - *(dest + 1) = *(src + 1); - src += 2; - dest += 2; - dwords -= 2; - } - switch(dwords) { - case 0: return; - case 1: *dest = *src; - return; - } -} - -static void MoveDWORDS( - register CARD32* dest, - register CARD32* src, - register int dwords ) -{ - while(dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - *(dest + 3) = *(src + 3); - src += 4; - dest += 4; - dwords -= 4; - } - if (!dwords) return; - *dest = *src; - if (dwords == 1) return; - *(dest + 1) = *(src + 1); - if (dwords == 2) return; - *(dest + 2) = *(src + 2); -} - - static void Permedia2SetupForMono8x8PatternFill24bpp(ScrnInfoPtr pScrn, int patternx, int patterny, @@ -939,82 +852,6 @@ } static void -Permedia2SetupForCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - int dobackground = 0; - - TRACE_ENTER("Permedia2SetupForCPUToScreenColorExpandFill"); - if (bg != -1) dobackground |= ForceBackgroundColor; - - GLINT_WAIT(7); - DO_PLANEMASK(planemask); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - } - - pGlint->ForeGroundColor = fg; - pGlint->BackGroundColor = bg; - REPLICATE(fg); - REPLICATE(bg); - - if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { - GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); - if (dobackground) { - GLINT_WRITE_REG(bg, FBBlockColor); - } else { - GLINT_WRITE_REG(fg, FBBlockColor); - } - GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode); - pGlint->FrameBufferReadMode = FastFillEnable; - } else { - GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode); - GLINT_WRITE_REG(BitMaskPackingEachScanline|dobackground| - pGlint->RasterizerSwap,RasterizerMode); - GLINT_WRITE_REG(fg, ConstantColor); - if (dobackground) { - pGlint->FrameBufferReadMode = TextureEnable; - GLINT_WRITE_REG(bg, Texel0); - } else - pGlint->FrameBufferReadMode = 0; - } - LOADROP(rop); - TRACE_EXIT("Permedia2SetupForCPUToScreenColorExpandFill"); -} - -static void -Permedia2SubsequentCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - int dwords = ((w + 31) >> 5) * h; - - TRACE_ENTER("Permedia2SubsequentCPUToScreenColorExpandFill"); - GLINT_WAIT(8); - Permedia2LoadCoord(pScrn, x, y, w, h); - - if ((pGlint->ROP == GXcopy) && (pGlint->BackGroundColor != -1)) { - GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | FastFillEnable, Render); - REPLICATE(pGlint->ForeGroundColor) - GLINT_WRITE_REG(pGlint->ForeGroundColor, FBBlockColor); - } - - GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | SyncOnBitMask | - pGlint->FrameBufferReadMode, Render); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); - GLINT_WAIT(dwords); - TRACE_EXIT("Permedia2SubsequentCPUToScreenColorExpandFill"); -} - -static void Permedia2SetupForScanlineCPUToScreenColorExpandFill( ScrnInfoPtr pScrn, int fg, int bg, @@ -1141,64 +978,47 @@ } if(bg == -1) { - /* >>>>> set fg <<<<<<<< */ REPLICATE(fg); - if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { + if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { GLINT_WRITE_REG(fg, FBBlockColor); } else { GLINT_WRITE_REG(fg, ConstantColor); } - } else if(rop == GXcopy) { - /* >>>>> set bg <<<<<<< */ - /* >>>>> draw rect (x,y,w,h) */ + } else if((rop == GXcopy) && (pScrn->bitsPerPixel != 24)) { REPLICATE(bg); - if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { - GLINT_WRITE_REG(bg, FBBlockColor); - } else { - GLINT_WRITE_REG(bg, ConstantColor); - } - GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive |mode,Render); - /* >>>>>> set fg <<<<<< */ + GLINT_WRITE_REG(bg, FBBlockColor); + GLINT_WRITE_REG(PrimitiveRectangle | XPositive |YPositive |mode,Render); REPLICATE(fg); - if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { - GLINT_WRITE_REG(fg, FBBlockColor); - } else { - GLINT_WRITE_REG(fg, ConstantColor); - } + GLINT_WRITE_REG(fg, FBBlockColor); } else { SecondPass = TRUE; - /* >>>>> set fg <<<<<<< */ REPLICATE(fg); - if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { + if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { GLINT_WRITE_REG(fg, FBBlockColor); } else { GLINT_WRITE_REG(fg, ConstantColor); } } - /* >>>>>>>>> initiate transfer (x,y,w,h). Skipleft pixels on the - left edge will be clipped <<<<<< */ - SECOND_PASS: GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | mode | SyncOnBitMask, Render); height = h; srcpntr = src; while(height--) { - GLINT_WAIT(dwords); + GLINT_WAIT(dwords + 1); /* 0x0D is the TAG value for BitMaskPattern */ GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32 *)srcpntr, dwords); srcpntr += srcwidth; } if(SecondPass) { SecondPass = FALSE; - /* >>>>>> invert bitmask and set bg <<<<<<<< */ REPLICATE(bg); GLINT_WAIT(3); - if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { + if ((pScrn->bitsPerPixel != 24) && (rop == GXcopy)) { GLINT_WRITE_REG(InvertBitMask|pGlint->RasterizerSwap,RasterizerMode); GLINT_WRITE_REG(bg, FBBlockColor); } else { @@ -1276,24 +1096,27 @@ count = dwords; address = ((y * pScrn->displayWidth) + x) >> 2; srcp = (CARD32*)src; + GLINT_WAIT(1); /*??*/ GLINT_WRITE_REG(address, TextureDownloadOffset); - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x11 << 4) | 0x0D is the TAG for TextureData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x11 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - address += MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + address += pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x11 << 4) | 0x0D is the TAG for TextureData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -1305,6 +1128,7 @@ char align = (x & pGlint->bppalign); + GLINT_WAIT(1); /*??*/ GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); if (rop == GXcopy) { GLINT_WAIT(6); @@ -1324,22 +1148,24 @@ while(h--) { count = dwords; srcp = (CARD32*)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -1348,22 +1174,24 @@ while(h--) { count = w; srcpbyte = (unsigned char *)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (unsigned char *)srcpbyte, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcpbyte += MAX_FIFO_ENTRIES - 1; + GLINT_MoveBYTE( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (unsigned char *)srcpbyte, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcpbyte += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveBYTE( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (unsigned char *)srcpbyte, count); } src += srcwidth; @@ -1435,24 +1263,27 @@ count = dwords; address = ((y * pScrn->displayWidth) + x) >> 1; srcp = (CARD32*)src; + GLINT_WAIT(1); /*??*/ GLINT_WRITE_REG(address, TextureDownloadOffset); - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x11 << 4) | 0x0D is the TAG for TextureData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x11 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - address += MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + address += pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x11 << 4) | 0x0D is the TAG for TextureData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -1483,22 +1314,24 @@ while(h--) { count = dwords; srcp = (CARD32*)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -1507,22 +1340,24 @@ while(h--) { count = w; srcpword = (unsigned short *)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (unsigned short *)srcpword, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcpword += MAX_FIFO_ENTRIES - 1; + GLINT_MoveWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (unsigned short *)srcpword, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcpword += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (unsigned short *)srcpword, count); } src += srcwidth; @@ -1536,107 +1371,6 @@ } static void -Permedia2WritePixmap24bpp( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, - int rop, - unsigned int planemask, - int transparency_color, - int bpp, int depth -) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - GLINTPtr pGlint = GLINTPTR(pScrn); - int skipleft = 0, dwords, count; - unsigned char* srcpbyte; - CARD32* srcp; - - GLINT_WAIT(3); - GLINT_WRITE_REG(pGlint->RasterizerSwap,RasterizerMode); - GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - } - - dwords = ((w+1)*3)>>2; - if((skipleft = (long)src & 0x03L)) { - skipleft = 4 - skipleft; - - x -= skipleft; - w += skipleft; - - src = (unsigned char*)(src - (3*skipleft)); - } - - { - Permedia2SetClippingRectangle(pScrn,x+skipleft,y,x+w,y+h); - - GLINT_WAIT(4); - Permedia2LoadCoord(pScrn, x&0xFFFF, y, w, h); - LOADROP(rop); - GLINT_WRITE_REG(PrimitiveRectangle | XPositive | YPositive | - SyncOnHostData, Render); - -#if 1 - while(h--) { - count = w; - srcpbyte = (unsigned char *)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); - /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (unsigned char *)srcpbyte, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcpbyte += MAX_FIFO_ENTRIES - 1; - } - if(count) { - GLINT_WAIT(count + 1); - /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (unsigned char *)srcpbyte, count); - } - src += srcwidth; -#else - while(h--) { - count = dwords; - srcp = (CARD32*)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); - /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; - } - if(count) { - GLINT_WAIT(count + 1); - /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | - 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, count); - } - src += srcwidth; -#endif - } - } - - Permedia2DisableClipping(pScrn); - SET_SYNC_FLAG(infoRec); -} - - -static void Permedia2WritePixmap32bpp( ScrnInfoPtr pScrn, int x, int y, int w, int h, @@ -1689,24 +1423,27 @@ count = dwords; address = (y * pScrn->displayWidth) + x; srcp = (CARD32*)src; + GLINT_WAIT(1); /*??*/ GLINT_WRITE_REG(address, TextureDownloadOffset); - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x11 << 4) | 0x0D is the TAG for TextureData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x11 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - address += MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + address += pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x11 << 4) | 0x0D is the TAG for TextureData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -1727,22 +1464,24 @@ while(h--) { count = dwords; srcp = (CARD32*)src; - while(count >= MAX_FIFO_ENTRIES) { - GLINT_WAIT(MAX_FIFO_ENTRIES); + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ - GLINT_WRITE_REG(((MAX_FIFO_ENTRIES - 2) << 16) | (0x15 << 4) | + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), - (CARD32*)srcp, MAX_FIFO_ENTRIES - 1); - count -= MAX_FIFO_ENTRIES - 1; - srcp += MAX_FIFO_ENTRIES - 1; + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } if(count) { GLINT_WAIT(count + 1); /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c:1.20 xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c:1.23.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c:1.20 Mon Sep 11 12:58:56 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c Thu May 24 16:12:48 2001 @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane <alanh@fairlite.demon.co.uk> + * Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -28,7 +28,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and * Siemens Nixdorf Informationssysteme */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c,v 1.20 2000/09/11 16:58:56 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_dac.c,v 1.23.2.1 2001/05/24 20:12:48 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -45,40 +45,6 @@ #define MINCLK 110000 /* VCO frequency range */ #define MAXCLK 250000 -static int -Shiftbpp(ScrnInfoPtr pScrn, int value) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - /* shift horizontal timings for 64bit VRAM's or 32bit SGRAMs */ - int logbytesperaccess = 2; - - switch (pScrn->bitsPerPixel) { - case 8: - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 16: - if (pGlint->DoubleBuffer) { - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - } else { - value >>= (logbytesperaccess-1); - pGlint->BppShift = logbytesperaccess-1; - } - break; - case 24: - value *= 3; - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 32: - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - break; - } - return (value); -} - static unsigned long PM2DAC_CalculateMNPCForClock ( @@ -125,7 +91,7 @@ Permedia2Init(ScrnInfoPtr pScrn, DisplayModePtr mode) { GLINTPtr pGlint = GLINTPTR(pScrn); - GLINTRegPtr pReg = &pGlint->ModeReg; + GLINTRegPtr pReg = &pGlint->ModeReg[0]; CARD32 temp1, temp2, temp3, temp4; pReg->glintRegs[Aperture0 >> 3] = 0; @@ -133,13 +99,8 @@ pReg->glintRegs[PMFramebufferWriteMask >> 3] = 0xFFFFFFFF; pReg->glintRegs[PMBypassWriteMask >> 3] = 0xFFFFFFFF; - if (pGlint->UsePCIRetry) { - pReg->glintRegs[DFIFODis >> 3] = 1; - pReg->glintRegs[FIFODis >> 3] = 3; - } else { - pReg->glintRegs[DFIFODis >> 3] = 0; - pReg->glintRegs[FIFODis >> 3] = 1; - } + pReg->glintRegs[DFIFODis >> 3] = 0; + pReg->glintRegs[FIFODis >> 3] = 1; if (pGlint->UseBlockWrite) pReg->glintRegs[PMMemConfig >> 3] = GLINT_READ_REG(PMMemConfig) | 1<<21; @@ -201,18 +162,6 @@ pReg->DacRegs[PM2DACIndexClockAP] = p|0x08; } - if (pGlint->MemClock) { - /* Get the memory clock values */ - unsigned char m,n,p; - unsigned long clockused; - - clockused = PM2DAC_CalculateMNPCForClock(pGlint->MemClock*1000, - pGlint->RefClock,&m,&n,&p); - pReg->DacRegs[PM2DACIndexMemClockM] = m; - pReg->DacRegs[PM2DACIndexMemClockN] = n; - pReg->DacRegs[PM2DACIndexMemClockP] = p; - } - if (pScrn->rgbBits == 8) pReg->DacRegs[PM2DACIndexMCR] = 0x02; /* 8bit DAC */ else @@ -262,6 +211,11 @@ GLINTPtr pGlint = GLINTPTR(pScrn); int i; + /* We can't rely on the vgahw layer copying the font information + * back properly, due to problems with MMIO access to VGA space + * so we memcpy the information using the slow routines */ + xf86SlowBcopy((CARD8*)pGlint->FbBase, (CARD8*)pGlint->VGAdata, 65536); + glintReg->glintRegs[Aperture0 >> 3] = GLINT_READ_REG(Aperture0); glintReg->glintRegs[Aperture1 >> 3] = GLINT_READ_REG(Aperture1); glintReg->glintRegs[PMFramebufferWriteMask >> 3] = @@ -287,7 +241,6 @@ glintReg->glintRegs[VClkCtl >> 3] = GLINT_READ_REG(VClkCtl); glintReg->glintRegs[ChipConfig >> 3] = GLINT_READ_REG(ChipConfig); - for (i=0;i<768;i++) { Permedia2ReadAddress(pScrn, i); glintReg->cmap[i] = Permedia2ReadData(pScrn); @@ -310,19 +263,6 @@ Permedia2InIndReg(pScrn, PM2DACIndexClockAN); glintReg->DacRegs[PM2DACIndexClockAP] = Permedia2InIndReg(pScrn, PM2DACIndexClockAP); - -#if 0 /* In theory we should restore the memory clock, we can't as the register - * is write only. This code is here for completeness and possible - * restoring to a default clock */ - if (pGlint->MemClock) { - glintReg->DacRegs[PM2DACIndexMemClockM] = - Permedia2InIndReg(pScrn, PM2DACIndexMemClockM); - glintReg->DacRegs[PM2DACIndexMemClockN] = - Permedia2InIndReg(pScrn, PM2DACIndexMemClockN); - glintReg->DacRegs[PM2DACIndexMemClockP] = - Permedia2InIndReg(pScrn, PM2DACIndexMemClockP); - } -#endif } void @@ -331,6 +271,12 @@ GLINTPtr pGlint = GLINTPTR(pScrn); int i; + /* We can't rely on the vgahw layer copying the font information + * back properly, due to problems with MMIO access to VGA space + * so we memcpy the information using the slow routines */ + if (pGlint->STATE) + xf86SlowBcopy((CARD8*)pGlint->VGAdata, (CARD8*)pGlint->FbBase, 65536); + #if 0 GLINT_SLOW_WRITE_REG(0, ResetStatus); while(GLINT_READ_REG(ResetStatus) != 0) { @@ -338,6 +284,8 @@ }; #endif + GLINT_SLOW_WRITE_REG(0xFF, PM2DACReadMask); + GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture0 >> 3], Aperture0); GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture1 >> 3], Aperture1); GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMFramebufferWriteMask >> 3], @@ -388,15 +336,6 @@ Permedia2WriteAddress(pScrn, i); Permedia2WriteData(pScrn, glintReg->cmap[i]); } - - if (pGlint->MemClock) { - Permedia2OutIndReg(pScrn, PM2DACIndexMemClockM, 0x00, - glintReg->DacRegs[PM2DACIndexMemClockM]); - Permedia2OutIndReg(pScrn, PM2DACIndexMemClockN, 0x00, - glintReg->DacRegs[PM2DACIndexMemClockN]); - Permedia2OutIndReg(pScrn, PM2DACIndexMemClockP, 0x00, - glintReg->DacRegs[PM2DACIndexMemClockP]); - } } static void @@ -488,14 +427,11 @@ infoPtr->MaxWidth = 64; infoPtr->MaxHeight = 64; -#if X_BYTE_ORDER == X_LITTLE_ENDIAN infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | - HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED | - HARDWARE_CURSOR_BIT_ORDER_MSBFIRST; -#else - infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | - HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED; +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | #endif + HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED; infoPtr->SetCursorColors = Permedia2SetCursorColors; infoPtr->SetCursorPosition = Permedia2SetCursorPosition; infoPtr->LoadCursorImage = Permedia2LoadCursorImage; @@ -513,7 +449,7 @@ { GLINTPtr pGlint = (GLINTPtr) b->DriverPrivate.ptr; CARD32 ct1 = GLINT_READ_REG(PMCount); - CARD32 ct2 = usec * ((pGlint->MemClock > 0) ? pGlint->MemClock : 100); + CARD32 ct2 = usec * 100; if (GLINT_READ_REG(PMCount) != ct1) while ((GLINT_READ_REG(PMCount) - ct1) < ct2); Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c:1.17 xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c:1.17 Mon Jun 19 11:01:01 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c Fri May 4 15:05:38 2001 @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c,v 1.17 2000/06/19 15:01:01 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2_video.c,v 1.19 2001/05/04 19:05:38 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -211,6 +211,7 @@ OPTION_EXPOSE /* obsolete, ignored */ } OptToken; +/* XXX These should be made const, and per-screen/adaptor copies processed. */ static OptionInfoRec AdaptorOptions[] = { { OPTION_DEVICE, "Device", OPTV_STRING, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } @@ -841,7 +842,7 @@ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 5, "PutYUV %08x %08x\n", BufferBase, format)); - if (!nCookies || (!pGlint->UsePCIRetry && GLINT_READ_REG(InFIFOSpace) < 200)) + if (!nCookies || (GLINT_READ_REG(InFIFOSpace) < 200)) return; /* Denial of service fix, N/A for scaler */ CHECKCLIPPING; @@ -990,7 +991,6 @@ BlackOut(PortPrivPtr pPPriv, RegionPtr pRegion) { ScrnInfoPtr pScrn = pPPriv->pAdaptor->pScrn; - ScreenPtr pScreen = pScrn->pScreen; GLINTPtr pGlint = GLINTPTR(pScrn); RegionRec DRegion; BoxRec DBox; @@ -1123,7 +1123,7 @@ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 5, "GetYUV\n")); - if (!nCookies || (!pGlint->UsePCIRetry && GLINT_READ_REG(InFIFOSpace) < 200)) + if (!nCookies || (GLINT_READ_REG(InFIFOSpace) < 200)) return; GLINT_WAIT(25); Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2ramdac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm2ramdac.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/glint/pm2ramdac.c:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm2ramdac.c:1.10 Sat Jul 17 23:26:57 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2ramdac.c Fri Dec 22 05:39:24 2000 @@ -24,7 +24,7 @@ * Permedia2OutIndReg() and Permedia2InIndReg() are used to access * the indirect Permedia2 RAMDAC registers only. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2ramdac.c,v 1.10 1999/07/18 03:26:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2ramdac.c,v 1.11 2000/12/22 10:39:24 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -104,16 +104,21 @@ VisualPtr pVisual ){ GLINTPtr pGlint = GLINTPTR(pScrn); - int i, index, shift; + int i, index, shift = 0, j, repeat = 1; - shift = (pScrn->depth == 15) ? 3 : 0; + if (pScrn->depth == 15) { + repeat = 8; + shift = 3; + } for(i = 0; i < numColors; i++) { index = indices[i]; - Permedia2WriteAddress(pScrn, index << shift); - Permedia2WriteData(pScrn, colors[index].red); - Permedia2WriteData(pScrn, colors[index].green); - Permedia2WriteData(pScrn, colors[index].blue); + for (j = 0; j < repeat; j++) { + Permedia2WriteAddress(pScrn, (index << shift)+j); + Permedia2WriteData(pScrn, colors[index].red); + Permedia2WriteData(pScrn, colors[index].green); + Permedia2WriteData(pScrn, colors[index].blue); + } /* for video i/o */ GLINT_SLOW_WRITE_REG(index, TexelLUTIndex); GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | @@ -132,14 +137,16 @@ VisualPtr pVisual ){ GLINTPtr pGlint = GLINTPTR(pScrn); - int i, index; + int i, index, j; for(i = 0; i < numColors; i++) { index = indices[i]; - Permedia2WriteAddress(pScrn, index << 2); - Permedia2WriteData(pScrn, colors[index >> 1].red); - Permedia2WriteData(pScrn, colors[index].green); - Permedia2WriteData(pScrn, colors[index >> 1].blue); + for (j = 0; j < 4; j++) { + Permedia2WriteAddress(pScrn, (index << 2)+j); + Permedia2WriteData(pScrn, colors[index >> 1].red); + Permedia2WriteData(pScrn, colors[index].green); + Permedia2WriteData(pScrn, colors[index >> 1].blue); + } GLINT_SLOW_WRITE_REG(index, TexelLUTIndex); GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | ((colors[index].green & 0xFF) << 8) | @@ -147,10 +154,12 @@ TexelLUTData); if(index <= 31) { - Permedia2WriteAddress(pScrn, index << 3); - Permedia2WriteData(pScrn, colors[index].red); - Permedia2WriteData(pScrn, colors[(index << 1) + 1].green); - Permedia2WriteData(pScrn, colors[index].blue); + for (j = 0; j < 4; j++) { + Permedia2WriteAddress(pScrn, (index << 3)+j); + Permedia2WriteData(pScrn, colors[index].red); + Permedia2WriteData(pScrn, colors[(index << 1) + 1].green); + Permedia2WriteData(pScrn, colors[index].blue); + } } } } Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c:1.17.2.1 xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c:1.26 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c:1.17.2.1 Thu Mar 1 07:01:50 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c Wed May 16 03:56:07 2001 @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane <alanh@fairlite.demon.co.uk> + * Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -27,7 +27,7 @@ * this work is sponsored by S.u.S.E. GmbH, Fuerth, Elsa GmbH, Aachen and * Siemens Nixdorf Informationssysteme */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c,v 1.17.2.1 2001/03/01 12:01:50 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2v_dac.c,v 1.26 2001/05/16 07:56:07 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -39,40 +39,6 @@ #include "glint_regs.h" #include "glint.h" -static int -Shiftbpp(ScrnInfoPtr pScrn, int value) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - /* shift horizontal timings for 64bit VRAM's or 32bit SGRAMs */ - int logbytesperaccess = 2; - - switch (pScrn->bitsPerPixel) { - case 8: - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 16: - if (pGlint->DoubleBuffer) { - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - } else { - value >>= (logbytesperaccess-1); - pGlint->BppShift = logbytesperaccess-1; - } - break; - case 24: - value *= 3; - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 32: - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - break; - } - return (value); -} - static unsigned long PM2VDAC_CalculateClock ( @@ -108,25 +74,78 @@ return(actualclock); } +void +Permedia2VPreInit(ScrnInfoPtr pScrn) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + + if (IS_JPRO) { + /* Appian Jeronimo Pro 4x8mb (pm2v version) */ + /* BIOS doesn't initialize the secondary heads, so we need to */ + + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Appian Jeronimo Pro 4x8mb board detected and initialized.\n"); + + /* disable MCLK */ + Permedia2vOutIndReg(pScrn, PM2VDACRDMClkControl, 0x00, 0); + + /* boot new mclk values */ + Permedia2vOutIndReg(pScrn, PM2VDACRDMClkPreScale, 0x00, 0x09); + Permedia2vOutIndReg(pScrn, PM2VDACRDMClkFeedbackScale, 0x00, 0x58); + Permedia2vOutIndReg(pScrn, PM2VDACRDMClkPostScale, 0x00, 0x01); + + /* re-enable MCLK */ + Permedia2vOutIndReg(pScrn, PM2VDACRDMClkControl, 0x00, 1); + + /* spin until locked MCLK */ + while ( (Permedia2vInIndReg(pScrn, PM2VDACRDMClkControl) & 0x2) == 0); + + /* Now re-boot the SGRAM's */ + GLINT_SLOW_WRITE_REG(0xe6002021,PMMemConfig); + GLINT_SLOW_WRITE_REG(0x00000020,PMBootAddress); + } +} + Bool Permedia2VInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { GLINTPtr pGlint = GLINTPTR(pScrn); - GLINTRegPtr pReg = &pGlint->ModeReg; + GLINTRegPtr pReg = &pGlint->ModeReg[0]; CARD32 temp1, temp2, temp3, temp4; + + temp1 = 0; + temp2 = 0; +#if X_BYTE_ORDER == X_BIG_ENDIAN + switch (pGlint->HwBpp) { + case 8: + case 24: + temp1 = 0x00; + temp2 = 0x00; + break; + + case 15: + case 16: + temp1 = 0x02; + temp2 = 0x02; + break; + + case 32: + temp1 = 0x01; + temp2 = 0x01; + break; + default: + break; + }; +#endif /* BIG_ENDIAN */ - pReg->glintRegs[Aperture0 >> 3] = 0; - pReg->glintRegs[Aperture1 >> 3] = 0; + pReg->glintRegs[Aperture0 >> 3] = temp1; + pReg->glintRegs[Aperture1 >> 3] = temp2; + pReg->glintRegs[PMFramebufferWriteMask >> 3] = 0xFFFFFFFF; pReg->glintRegs[PMBypassWriteMask >> 3] = 0xFFFFFFFF; - if (pGlint->UsePCIRetry) { - pReg->glintRegs[DFIFODis >> 3] = 1; - pReg->glintRegs[FIFODis >> 3] = 3; - } else { - pReg->glintRegs[DFIFODis >> 3] = 0; - pReg->glintRegs[FIFODis >> 3] = 1; - } + pReg->glintRegs[DFIFODis >> 3] = 0; + pReg->glintRegs[FIFODis >> 3] = 1; if (pGlint->UseBlockWrite) pReg->glintRegs[PMMemConfig >> 3] = GLINT_READ_REG(PMMemConfig) | 1<<21; @@ -170,7 +189,7 @@ pReg->glintRegs[PMVTotal >> 3] -= 1; /* PMVTotal */ pReg->glintRegs[ChipConfig >> 3] = GLINT_READ_REG(ChipConfig) & 0xFFFFFFDD; - pReg->DacRegs[PM2VDACRDDACControl] = 0x80; + pReg->DacRegs[PM2VDACRDDACControl] = 0x00; { /* Get the programmable clock values */ @@ -192,9 +211,9 @@ pReg->DacRegs[PM2VDACRDMiscControl] = 0x00; /* 6bit DAC */ pReg->DacRegs[PM2VDACRDSyncControl] = 0x00; - if (!(mode->Flags & V_PHSYNC)) + if (mode->Flags & V_PHSYNC) pReg->DacRegs[PM2VDACRDSyncControl] |= 0x01; /* invert hsync */ - if (!(mode->Flags & V_PVSYNC)) + if (mode->Flags & V_PVSYNC) pReg->DacRegs[PM2VDACRDSyncControl] |= 0x08; /* invert vsync */ switch (pScrn->bitsPerPixel) @@ -204,6 +223,7 @@ pReg->DacRegs[PM2VDACRDColorFormat] = 0x2E; break; case 16: + pReg->DacRegs[PM2VDACRDMiscControl] |= 0x08; pReg->DacRegs[PM2VDACRDPixelSize] = 0x01; if (pScrn->depth == 15) pReg->DacRegs[PM2VDACRDColorFormat] = 0x61; @@ -211,14 +231,16 @@ pReg->DacRegs[PM2VDACRDColorFormat] = 0x70; break; case 24: + pReg->DacRegs[PM2VDACRDMiscControl] |= 0x08; pReg->DacRegs[PM2VDACRDPixelSize] = 0x04; pReg->DacRegs[PM2VDACRDColorFormat] = 0x60; break; case 32: + pReg->DacRegs[PM2VDACRDMiscControl] |= 0x08; pReg->DacRegs[PM2VDACRDPixelSize] = 0x02; pReg->DacRegs[PM2VDACRDColorFormat] = 0x20; if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) { - pReg->DacRegs[PM2VDACRDMiscControl] |= 0x10; + pReg->DacRegs[PM2VDACRDMiscControl] |= 0x18; pReg->DacRegs[PM2VDACRDOverlayKey] = pScrn->colorKey; } break; @@ -233,6 +255,11 @@ GLINTPtr pGlint = GLINTPTR(pScrn); int i; + /* We can't rely on the vgahw layer copying the font information + * back properly, due to problems with MMIO access to VGA space + * so we memcpy the information */ + memcpy((CARD8*)pGlint->VGAdata,(CARD8*)pGlint->FbBase, 65536); + glintReg->glintRegs[ChipConfig >> 3] = GLINT_READ_REG(ChipConfig); glintReg->glintRegs[Aperture0 >> 3] = GLINT_READ_REG(Aperture0); glintReg->glintRegs[Aperture1 >> 3] = GLINT_READ_REG(Aperture1); @@ -291,12 +318,11 @@ CARD32 temp; int i; -#if 0 - GLINT_SLOW_WRITE_REG(0, ResetStatus); - while(GLINT_READ_REG(ResetStatus) != 0) { - xf86MsgVerb(X_INFO, 2, "Resetting Engine - Please Wait.\n"); - }; -#endif + /* We can't rely on the vgahw layer copying the font information + * back properly, due to problems with MMIO access to VGA space + * so we memcpy the information */ + if (pGlint->STATE) + memcpy((CARD8*)pGlint->FbBase,(CARD8*)pGlint->VGAdata, 65536); GLINT_SLOW_WRITE_REG(glintReg->glintRegs[ChipConfig >> 3], ChipConfig); GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture0 >> 3], Aperture0); @@ -326,7 +352,8 @@ GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsStart >> 3], PMVsStart); GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsEnd >> 3], PMVsEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM2VDACRDIndexControl >> 3], PM2VDACRDIndexControl); + GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM2VDACRDIndexControl >> 3], + PM2VDACRDIndexControl); Permedia2vOutIndReg(pScrn, PM2VDACRDOverlayKey, 0x00, glintReg->DacRegs[PM2VDACRDOverlayKey]); Permedia2vOutIndReg(pScrn, PM2VDACRDSyncControl, 0x00, @@ -370,15 +397,33 @@ } static void +Permedia2vLoadCursorCallback( + ScrnInfoPtr pScrn +) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + int i; + + for (i=0; i<1024; i++) + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPattern+i, 0x00, + pGlint->HardwareCursorPattern[i]); + + pGlint->LoadCursorCallback = NULL; +} + +static void Permedia2vLoadCursorImage( ScrnInfoPtr pScrn, unsigned char *src ) { + GLINTPtr pGlint = GLINTPTR(pScrn); int i; for (i=0; i<1024; i++) - Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPattern+i, 0x00, *(src++)); + pGlint->HardwareCursorPattern[i] = *(src++); + + pGlint->LoadCursorCallback = Permedia2vLoadCursorCallback; } static void @@ -401,12 +446,18 @@ } static void -Permedia2vSetCursorColors( - ScrnInfoPtr pScrn, - int bg, int fg +Permedia2vCursorColorCallback( + ScrnInfoPtr pScrn ) { - /* A 2 color cursor uses last 2 indexes into hardware cursor palette */ + GLINTPtr pGlint = GLINTPTR(pScrn); + int fg = pGlint->FGCursor; + int bg = pGlint->BGCursor; + + if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_PERMEDIA3) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) && + (pGlint->MultiChip == PCI_CHIP_PERMEDIA3)) ) { + /* PM3 uses last 2 indexes into hardware cursor palette fg first...*/ Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+39, 0x00, (fg>>16)&0xff); Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+40, 0x00, (fg>>8)&0xff); Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+41, 0x00, fg & 0xff); @@ -414,8 +465,33 @@ Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+42, 0x00, (bg>>16)&0xff); Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+43, 0x00, (bg>>8)&0xff); Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+44, 0x00, bg & 0xff); + } else { + /* PM2v uses first 2 indexes into hardware cursor palette bg first...*/ + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+0, 0x00, (bg>>16)&0xff); + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+1, 0x00, (bg>>8)&0xff); + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+2, 0x00, bg & 0xff); + + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+3, 0x00, (fg>>16)&0xff); + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+4, 0x00, (fg>>8)&0xff); + Permedia2vOutIndReg(pScrn, PM2VDACRDCursorPalette+5, 0x00, fg & 0xff); + } + pGlint->CursorColorCallback = NULL; } +static void +Permedia2vSetCursorColors( + ScrnInfoPtr pScrn, + int bg, int fg +) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + + pGlint->FGCursor = fg; + pGlint->BGCursor = bg; + + pGlint->CursorColorCallback = Permedia2vCursorColorCallback; +} + static Bool Permedia2vUseHWCursor(ScreenPtr pScr, CursorPtr pCurs) { @@ -437,6 +513,9 @@ infoPtr->MaxWidth = 64; infoPtr->MaxHeight = 64; infoPtr->Flags = HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | +#if X_BYTE_ORDER == X_BIG_ENDIAN + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | +#endif HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_1; infoPtr->SetCursorColors = Permedia2vSetCursorColors; infoPtr->SetCursorPosition = Permedia2vSetCursorPosition; Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2vramdac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm2vramdac.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/glint/pm2vramdac.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm2vramdac.c:1.4 Fri Feb 12 17:52:05 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm2vramdac.c Wed Jan 31 11:15:00 2001 @@ -24,7 +24,7 @@ * Permedia2vOutIndReg() and Permedia2vInIndReg() are used to access * the indirect Permedia2v RAMDAC registers only. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2vramdac.c,v 1.4 1999/02/12 22:52:05 hohndel Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm2vramdac.c,v 1.6 2001/01/31 16:15:00 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -43,13 +43,12 @@ GLINTPtr pGlint = GLINTPTR(pScrn); unsigned char tmp = 0x00; - GLINT_SLOW_WRITE_REG((reg>>8) & 0xff, PM2VDACIndexRegHigh); - GLINT_SLOW_WRITE_REG(reg&0xff, PM2VDACIndexRegLow); + GLINT_SET_INDEX(reg); if (mask != 0x00) tmp = GLINT_READ_REG (PM2VDACIndexData) & mask; - GLINT_SLOW_WRITE_REG (tmp | data, PM2VDACIndexData); + GLINT_WRITE_REG (tmp | data, PM2VDACIndexData); } unsigned char @@ -58,8 +57,7 @@ GLINTPtr pGlint = GLINTPTR(pScrn); unsigned char ret; - GLINT_SLOW_WRITE_REG (reg&0xff, PM2VDACIndexRegLow); - GLINT_SLOW_WRITE_REG((reg>>8) & 0xff, PM2VDACIndexRegHigh); + GLINT_SET_INDEX(reg); ret = GLINT_READ_REG (PM2VDACIndexData); return (ret); Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c:1.7 Tue Nov 28 11:10:39 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c Wed Apr 18 05:24:47 2001 @@ -1,5 +1,5 @@ /* - * Copyright 2000 by Sven Luther <luther@dpt-info.u-strasbg.fr>. + * Copyright 2000-2001 by Sven Luther <luther@dpt-info.u-strasbg.fr>. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -26,7 +26,7 @@ * * Permedia 3 accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.7 2000/11/28 16:10:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_accel.c,v 1.25 2001/04/18 09:24:47 alanh Exp $ */ #include "Xarch.h" #include "xf86.h" @@ -47,7 +47,6 @@ #include "xaalocal.h" /* For replacements */ #define DEBUG 0 -#define USE_DIRECT_FIFO_WRITES 1 #if DEBUG # define TRACE_ENTER(str) ErrorF("pm3_accel: " str " %d\n",pScrn->scrnIndex) @@ -59,8 +58,6 @@ # define TRACE(str) #endif -/* Sync */ -void Permedia3Sync(ScrnInfoPtr pScrn); /* Clipping */ static void Permedia3SetClippingRectangle(ScrnInfoPtr pScrn, int x, int y, int w, int h); @@ -78,6 +75,8 @@ int rop, unsigned int planemask); static void Permedia3SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h); +static void Permedia3SubsequentFillRectSolid32bpp(ScrnInfoPtr pScrn, int x, + int y, int w, int h); /* 8x8 Mono Pattern Fills */ static void Permedia3SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, int patternx, int patterny, int fg, int bg, @@ -85,26 +84,28 @@ static void Permedia3SubsequentMono8x8PatternFillRect(ScrnInfoPtr pScrn, int x_offset, int y_offset, int x, int y, int w, int h); -/* Color Expansion Fills */ -static void Permedia3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop,unsigned int planemask); -static void Permedia3SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); -/* Direct Fifo Bitmap Writes */ -static void Permedia3WriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, - unsigned char *src, int srcwidth, int skipleft, - int fg, int bg, int rop,unsigned int planemask); -/* Images Writes */ -static void Permedia3SetupForImageWrite(ScrnInfoPtr pScrn, int rop, +static void Permedia3SetupForScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int fg, int bg, int rop, + unsigned int planemask); +static void Permedia3SubsequentScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, int x, + int y, int w, int h, int skipleft); +static void Permedia3SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); +static void Permedia3SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int trans_color, int bpp, int depth); -static void Permedia3SubsequentImageWriteRect(ScrnInfoPtr pScrn, +static void Permedia3SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); -/* Direct Fifo Pixmap Writes */ +static void Permedia3SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno); +static void Permedia3RestoreAccelState(ScrnInfoPtr pScrn); static void Permedia3WritePixmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, int rop, unsigned int planemask, int transparency_color, int bpp, int depth); +static void Permedia3WriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, + unsigned char *src, int srcwidth, int skipleft, + int fg, int bg, int rop,unsigned int planemask); void Permedia3InitializeEngine(ScrnInfoPtr pScrn) @@ -115,14 +116,23 @@ /* Initialize the Accelerator Engine to defaults */ TRACE_ENTER("Permedia3InitializeEngine"); + if (pGlint->MultiAperture) { + /* Only write the following register to the first PM3 */ + GLINT_SLOW_WRITE_REG(1, BroadcastMask); + GLINT_SLOW_WRITE_REG(0x00000001, ScanLineOwnership); + + /* Only write the following register to the second PM3 */ + GLINT_SLOW_WRITE_REG(2, BroadcastMask); + GLINT_SLOW_WRITE_REG(0x00000005, ScanLineOwnership); + + /* Make sure the rest of the register writes go to both PM3's */ + GLINT_SLOW_WRITE_REG(3, BroadcastMask); + } + /* Host out PreInit */ /* Set filter mode to enable sync tag & data output */ - GLINT_SLOW_WRITE_REG(0xc00, FilterMode); + GLINT_SLOW_WRITE_REG(0x400, FilterMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StatisticMode); - Permedia3Sync(pScrn); - - TRACE("Permedia3InitializeEngine : first sync"); - /* Disable most units by default */ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, PM3DeltaMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RasterizerMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ScissorMode); @@ -171,7 +181,6 @@ GLINT_SLOW_WRITE_REG(0, PM3DeltaControl); GLINT_SLOW_WRITE_REG(0xffffffff, BitMaskPattern); - Permedia3Sync(pScrn); /* ScissorStippleUnit Initialization (is it needed ?) */ pGlint->ClippingOn = FALSE; @@ -184,14 +193,12 @@ (0&0xffff)|((0&0xffff)<<16), WindowOrigin); */ - Permedia3Sync(pScrn); /* StencilDepthUnit Initialization */ GLINT_SLOW_WRITE_REG(0, PM3Window); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StencilMode); GLINT_SLOW_WRITE_REG(0, StencilData); - Permedia3Sync(pScrn); /* FBReadUnit Initialization */ TRACE("Permedia3InitializeEngine : only syncs upto now"); @@ -242,30 +249,29 @@ TRACE("Permedia3InitializeEngine : SourceRead"); switch (pScrn->bitsPerPixel) { case 8: - GLINT_SLOW_WRITE_REG(0x2, PixelSize); + pGlint->PM3_PixelSize = 2; #if X_BYTE_ORDER == X_BIG_ENDIAN pGlint->RasterizerSwap = 3<<15; /* Swap host data */ #endif break; case 16: - GLINT_SLOW_WRITE_REG(0x1, PixelSize); + pGlint->PM3_PixelSize = 1; #if X_BYTE_ORDER == X_BIG_ENDIAN pGlint->RasterizerSwap = 2<<15; /* Swap host data */ #endif break; case 32: - GLINT_SLOW_WRITE_REG(0x0, PixelSize); + pGlint->PM3_PixelSize = 0; break; } + GLINT_SLOW_WRITE_REG(pGlint->PM3_PixelSize, PixelSize); #if X_BYTE_ORDER == X_BIG_ENDIAN GLINT_SLOW_WRITE_REG(1 | pGlint->RasterizerSwap, RasterizerMode); #endif TRACE("Permedia3InitializeEngine : PixelSize"); - Permedia3Sync(pScrn); /* LogicalOpUnit Initialization */ GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask); - Permedia3Sync(pScrn); /* FBWriteUnit Initialization */ GLINT_SLOW_WRITE_REG( @@ -278,7 +284,6 @@ GLINT_SLOW_WRITE_REG( PM3FBWriteBufferWidth_Width(pScrn->displayWidth), PM3FBWriteBufferWidth0); - Permedia3Sync(pScrn); /* GLINT_SLOW_WRITE_REG(0, PM3FBWriteBufferAddr1); GLINT_SLOW_WRITE_REG(0, PM3FBWriteBufferOffset1); @@ -305,7 +310,6 @@ (pScrn->bitsPerPixel * pScrn->displayWidth)), PM3SizeOfFramebuffer); GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask); - Permedia3Sync(pScrn); TRACE("Permedia3InitializeEngine : FBHardwareWriteMask & SizeOfFramebuffer"); /* Color Format */ switch (pScrn->depth) { @@ -346,6 +350,8 @@ GLINT_SLOW_WRITE_REG(0, StartXSub); GLINT_SLOW_WRITE_REG(0, StartY); GLINT_SLOW_WRITE_REG(0, GLINTCount); + if (*pGlint->AccelInfoRec->Sync) + (*pGlint->AccelInfoRec->Sync)(pScrn); TRACE_EXIT("Permedia3InitializeEngine"); } @@ -355,41 +361,34 @@ XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; GLINTPtr pGlint = GLINTPTR(pScrn); - BoxRec AvailFBArea; pGlint->AccelInfoRec = infoPtr = XAACreateInfoRec(); if (!infoPtr) return FALSE; - Permedia3InitializeEngine(pScrn); - /* Generic accel engine flags */ - infoPtr->Flags = - PIXMAP_CACHE | - OFFSCREEN_PIXMAPS | - LINEAR_FRAMEBUFFER; + infoPtr->Flags = PIXMAP_CACHE | + OFFSCREEN_PIXMAPS | + LINEAR_FRAMEBUFFER; /* Synchronization of the accel engine */ - infoPtr->Sync = Permedia3Sync; + if (pGlint->MultiAperture) + infoPtr->Sync = DualPermedia3Sync; + else + infoPtr->Sync = Permedia3Sync; + + Permedia3InitializeEngine(pScrn); /* Clipping Setup */ infoPtr->ClippingFlags = 0; - /* This does not work correctly, i don't know why, but i guess it is - * because the clipping stuff is not ok ... - * Let's disable it for now (also in the respective functions, we - * clear the UserScissorEnable bit in Render2D. - HARDWARE_CLIP_MONO_8x8_FILL | - HARDWARE_CLIP_SOLID_FILL; - */ infoPtr->SetClippingRectangle = Permedia3SetClippingRectangle; infoPtr->DisableClipping = Permedia3DisableClipping; /* ScreenToScreenCopy */ - infoPtr->ScreenToScreenCopyFlags = - NO_TRANSPARENCY; + infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY; infoPtr->SetupForScreenToScreenCopy = - Permedia3SetupForScreenToScreenCopy; + Permedia3SetupForScreenToScreenCopy; infoPtr->SubsequentScreenToScreenCopy = - Permedia3SubsequentScreenToScreenCopy; + Permedia3SubsequentScreenToScreenCopy; /* SolidFill */ infoPtr->SolidFillFlags = 0; @@ -397,83 +396,97 @@ infoPtr->SubsequentSolidFillRect = Permedia3SubsequentFillRectSolid; /* 8x8 Mono Pattern Fills */ - infoPtr->Mono8x8PatternFillFlags = - HARDWARE_PATTERN_PROGRAMMED_ORIGIN | - HARDWARE_PATTERN_PROGRAMMED_BITS | - HARDWARE_PATTERN_SCREEN_ORIGIN | - BIT_ORDER_IN_BYTE_LSBFIRST; + infoPtr->Mono8x8PatternFillFlags = HARDWARE_PATTERN_PROGRAMMED_BITS | + HARDWARE_PATTERN_PROGRAMMED_ORIGIN | + HARDWARE_PATTERN_SCREEN_ORIGIN | + BIT_ORDER_IN_BYTE_LSBFIRST; infoPtr->SetupForMono8x8PatternFill = - Permedia3SetupForMono8x8PatternFill; + Permedia3SetupForMono8x8PatternFill; infoPtr->SubsequentMono8x8PatternFillRect = - Permedia3SubsequentMono8x8PatternFillRect; + Permedia3SubsequentMono8x8PatternFillRect; -#if USE_DIRECT_FIFO_WRITES - /* Direct Fifo Bitmap Writes */ - infoPtr->WriteBitmapFlags = 0; - infoPtr->WriteBitmap = Permedia3WriteBitmap; -#endif + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + LEFT_EDGE_CLIPPING | + LEFT_EDGE_CLIPPING_NEGATIVE_X | + BIT_ORDER_IN_BYTE_LSBFIRST | + CPU_TRANSFER_PAD_DWORD; + + infoPtr->NumScanlineColorExpandBuffers = 1; + pGlint->ScratchBuffer = xalloc(((pScrn->virtualX+62)/32*4) + + (pScrn->virtualX + * pScrn->bitsPerPixel / 8)); + infoPtr->ScanlineColorExpandBuffers = + pGlint->XAAScanlineColorExpandBuffers; + pGlint->XAAScanlineColorExpandBuffers[0] = + pGlint->IOBase + OutputFIFO + 4; + + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + Permedia3SetupForScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + Permedia3SubsequentScanlineCPUToScreenColorExpandFill; + infoPtr->SubsequentColorExpandScanline = + Permedia3SubsequentColorExpandScanline; + + infoPtr->ScanlineImageWriteFlags = NO_GXCOPY | + LEFT_EDGE_CLIPPING | + LEFT_EDGE_CLIPPING_NEGATIVE_X | + BIT_ORDER_IN_BYTE_LSBFIRST | + CPU_TRANSFER_PAD_DWORD; + infoPtr->NumScanlineImageWriteBuffers = 1; + infoPtr->ScanlineImageWriteBuffers = + pGlint->XAAScanlineColorExpandBuffers; + infoPtr->SetupForScanlineImageWrite = + Permedia3SetupForScanlineImageWrite; + infoPtr->SubsequentScanlineImageWriteRect = + Permedia3SubsequentScanlineImageWriteRect; + infoPtr->SubsequentImageWriteScanline = + Permedia3SubsequentImageWriteScanline; - /* Color Expand Fills */ - infoPtr->CPUToScreenColorExpandFillFlags = - /* - SYNC_AFTER_COLOR_EXPAND | - */ - LEFT_EDGE_CLIPPING | - BIT_ORDER_IN_BYTE_LSBFIRST | - CPU_TRANSFER_BASE_FIXED | - CPU_TRANSFER_PAD_DWORD; - infoPtr->ColorExpandBase = pGlint->IOBase + BitMaskPattern; - infoPtr->ColorExpandRange = 4; - infoPtr->SetupForCPUToScreenColorExpandFill = - Permedia3SetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - Permedia3SubsequentCPUToScreenColorExpandFill; + infoPtr->WriteBitmap = Permedia3WriteBitmap; + infoPtr->WriteBitmapFlags = 0; -#if USE_DIRECT_FIFO_WRITES - /* Direct Fifo Images Writes */ - infoPtr->WritePixmapFlags = 0; infoPtr->WritePixmap = Permedia3WritePixmap; -#else - /* Images Writes */ - infoPtr->ImageWriteFlags = - NO_GXCOPY | - /* - SYNC_AFTER_IMAGE_WRITE | - */ - LEFT_EDGE_CLIPPING | - LEFT_EDGE_CLIPPING_NEGATIVE_X | - BIT_ORDER_IN_BYTE_LSBFIRST | - CPU_TRANSFER_BASE_FIXED | - CPU_TRANSFER_PAD_DWORD; - infoPtr->ImageWriteBase = pGlint->IOBase + PM3FBSourceData; - infoPtr->ImageWriteRange = 4; - infoPtr->SetupForImageWrite = - Permedia3SetupForImageWrite; - infoPtr->SubsequentImageWriteRect = - Permedia3SubsequentImageWriteRect; -#endif + infoPtr->WritePixmapFlags = 0; + + { + Bool shared_accel = FALSE; + int i; + + for(i = 0; i < pScrn->numEntities; i++) { + if(xf86IsEntityShared(pScrn->entityList[i])) + shared_accel = TRUE; + } + if(shared_accel == TRUE) + infoPtr->RestoreAccelState = Permedia3RestoreAccelState; + } + + 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; - AvailFBArea.y2 = pGlint->FbMapSize / (pScrn->displayWidth * - pScrn->bitsPerPixel / 8); - /* Alan does this ??? + /* X coords are short's so we have to do this to make sure we dont wrap*/ AvailFBArea.y2 = ((pGlint->FbMapSize > 16384*1024) ? 16384*1024 : - pGlint->FbMapSize) / (pScrn->displayWidth + pGlint->FbMapSize) / (pScrn->displayWidth * pScrn->bitsPerPixel / 8); - */ /* Permedia3 has a maximum 4096x4096 framebuffer */ if (AvailFBArea.y2 > 4095) AvailFBArea.y2 = 4095; xf86InitFBManager(pScreen, &AvailFBArea); - - Permedia3Sync(pScrn); - return(XAAInit(pScreen, infoPtr)); } - #define CHECKCLIPPING \ { \ if (pGlint->ClippingOn) { \ @@ -491,13 +504,43 @@ CHECKCLIPPING; while (GLINT_READ_REG(DMACount) != 0); - GLINT_WAIT(1); + GLINT_WAIT(2); + GLINT_WRITE_REG(0x400, FilterMode); GLINT_WRITE_REG(0, GlintSync); do { while(GLINT_READ_REG(OutFIFOWords) == 0); - } while (GLINT_READ_REG(OutputFIFO) != PM3SyncTag); + } while (GLINT_READ_REG(OutputFIFO) != Sync_tag); } +void +DualPermedia3Sync( + ScrnInfoPtr pScrn +){ + GLINTPtr pGlint = GLINTPTR(pScrn); + + CHECKCLIPPING; + + while (GLINT_READ_REG(DMACount) != 0); + GLINT_WAIT(3); + GLINT_WRITE_REG(3, BroadcastMask); /* hack! this shouldn't need to be reloaded */ + GLINT_WRITE_REG(0x400, FilterMode); + GLINT_WRITE_REG(0, GlintSync); + + /* Read 1st PM3 until Sync Tag shows */ + ACCESSCHIP1(); + do { + while(GLINT_READ_REG(OutFIFOWords) == 0); + } while (GLINT_READ_REG(OutputFIFO) != Sync_tag); + + ACCESSCHIP2(); + /* Read 2nd PM3 until Sync Tag shows */ + do { + while(GLINT_READ_REG(OutFIFOWords) == 0); + } while (GLINT_READ_REG(OutputFIFO) != Sync_tag); + + ACCESSCHIP1(); +} + static void Permedia3SetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2) { @@ -523,26 +566,34 @@ { GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("Permedia3SetupForScreenToScreenCopy"); + pGlint->PM3_Render2D = PM3Render2D_SpanOperation | PM3Render2D_Operation_Normal; + pGlint->ClippingOn = TRUE; + pGlint->PM3_Config2D = PM3Config2D_UserScissorEnable | PM3Config2D_ForegroundROPEnable | PM3Config2D_ForegroundROP(rop) | PM3Config2D_FBWriteEnable; + if (xdir == 1) pGlint->PM3_Render2D |= PM3Render2D_XPositive; if (ydir == 1) pGlint->PM3_Render2D |= PM3Render2D_YPositive; + if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXnoop)&&(rop!=GXinvert)) { pGlint->PM3_Render2D |= PM3Render2D_FBSourceReadEnable; pGlint->PM3_Config2D |= PM3Config2D_Blocking; } + if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; + GLINT_WAIT(2); DO_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); + TRACE_EXIT("Permedia3SetupForScreenToScreenCopy"); } static void @@ -578,10 +629,8 @@ { GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("Permedia3SetupForFillRectSolid"); - REPLICATE(color); - /* Prepapre Common Render2D & Config2D data */ + /* Prepare Common Render2D & Config2D data */ pGlint->PM3_Render2D = - PM3Render2D_SpanOperation | PM3Render2D_XPositive | PM3Render2D_YPositive | PM3Render2D_Operation_Normal; @@ -590,28 +639,42 @@ PM3Config2D_ForegroundROPEnable | PM3Config2D_ForegroundROP(rop) | PM3Config2D_FBWriteEnable; - if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) - pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; - /* Clipping is not working ok yet, let's disable it. - if (pGlint->ClippingOn) - pGlint->PM3_Config2D |= PM3Config2D_UserScissorEnable; - */ GLINT_WAIT(3); - /* Using FBClockColor (have to disable SpanOperation) will fill only the - * first 32 pixels of the 64 pixels of a span. Lets use ForegroundColor - * instead (from the LogicOps unit) - GLINT_WRITE_REG(color, PM3FBBlockColor); + REPLICATE(color); + /* We can't do block fills properly at 32bpp, so we can stick the chip + * into 16bpp and double the width and xcoord, but it seems that at + * extremely high resolutions (above 1600) it doesn't fill. + * so, we fall back to the slower span filling method. */ - GLINT_WRITE_REG(color, PM3ForegroundColor); + if ((rop == GXcopy) && (pScrn->bitsPerPixel == 32) && + (pScrn->displayWidth <= 1600)) { + pGlint->AccelInfoRec->SubsequentSolidFillRect = + Permedia3SubsequentFillRectSolid32bpp; + GLINT_WRITE_REG(color, PM3FBBlockColor); + } else { + pGlint->AccelInfoRec->SubsequentSolidFillRect = + Permedia3SubsequentFillRectSolid; + /* Can't do block fills at 8bpp either */ + if ((rop == GXcopy) && (pScrn->bitsPerPixel == 16)) { + GLINT_WRITE_REG(color, PM3FBBlockColor); + } else { + pGlint->PM3_Render2D |= PM3Render2D_SpanOperation; + GLINT_WRITE_REG(color, PM3ForegroundColor); + } + } + if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) + pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; DO_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); TRACE_EXIT("Permedia3SetupForFillRectSolid"); } + static void Permedia3SubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, int w, int h) { GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("Permedia3SubsequentFillRectSolid"); + GLINT_WAIT(2); GLINT_WRITE_REG( PM3RectanglePosition_XOffset(x) | @@ -620,8 +683,42 @@ GLINT_WRITE_REG(pGlint->PM3_Render2D | PM3Render2D_Width(w) | PM3Render2D_Height(h), PM3Render2D); + TRACE_EXIT("Permedia3SubsequentFillRectSolid"); } + +static void +Permedia3SubsequentFillRectSolid32bpp(ScrnInfoPtr pScrn, int x, int y, int w, int h) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + TRACE_ENTER("Permedia3SubsequentFillRectSolid32bpp"); + + GLINT_WAIT(6); + + /* Put the chip into 16bpp mode */ + GLINT_WRITE_REG(1, PixelSize); + /* Now double the displayWidth */ + GLINT_WRITE_REG( + PM3FBWriteBufferWidth_Width(pScrn->displayWidth<<1), + PM3FBWriteBufferWidth0); + + /* and double the x,w coords */ + GLINT_WRITE_REG( + PM3RectanglePosition_XOffset(x<<1) | + PM3RectanglePosition_YOffset(y), + PM3RectanglePosition); + GLINT_WRITE_REG(pGlint->PM3_Render2D | + PM3Render2D_Width(w<<1) | PM3Render2D_Height(h), + PM3Render2D); + + /* Now fixup */ + GLINT_WRITE_REG( + PM3FBWriteBufferWidth_Width(pScrn->displayWidth), + PM3FBWriteBufferWidth0); + GLINT_WRITE_REG(0, PixelSize); + TRACE_EXIT("Permedia3SubsequentFillRectSolid32bpp"); +} + /* 8x8 Mono Pattern Fills */ static void Permedia3SetupForMono8x8PatternFill(ScrnInfoPtr pScrn, @@ -645,10 +742,6 @@ PM3Config2D_FBWriteEnable; if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; - /* Clipping is not working correctly yet ... - if (pGlint->ClippingOn) - pGlint->PM3_Config2D |= PM3Config2D_UserScissorEnable; - */ pGlint->PM3_AreaStippleMode = 1; /* Mirror stipple pattern horizontally */ #if X_BYTE_ORDER == X_BIG_ENDIAN @@ -699,12 +792,15 @@ TRACE_EXIT("Permedia3SubsequentMono8x8PatternFillRect"); } -/* Color Expansion Fills */ -static void Permedia3SetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop,unsigned int planemask) -{ +static void +Permedia3SetupForScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int fg, int bg, + int rop, + unsigned int planemask +){ GLINTPtr pGlint = GLINTPTR(pScrn); - TRACE_ENTER("Permedia3SetupForCPUToScreenColorExpandFill"); + REPLICATE(fg); pGlint->PM3_Render2D = PM3Render2D_SpanOperation | @@ -729,14 +825,23 @@ GLINT_WRITE_REG(fg, PM3ForegroundColor); DO_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); - TRACE_EXIT("Permedia3SetupForCPUToScreenColorExpandFill"); } -static void Permedia3SubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft) -{ + +static void +Permedia3SubsequentScanlineCPUToScreenColorExpandFill( + ScrnInfoPtr pScrn, + int x, int y, int w, int h, + int skipleft +){ GLINTPtr pGlint = GLINTPTR(pScrn); - TRACE_ENTER("Permedia3SubsequentCPUToScreenColorExpandFill"); - GLINT_WAIT(4); + + TRACE_ENTER("Permedia2SubsequentScanlineCPUToScreenColorExpandFill"); + + pGlint->dwords = ((w + 31) >> 5); /* dwords per scanline */ + + pGlint->cpucount = h; + + GLINT_WAIT(5); GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY); GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY); GLINT_WRITE_REG( @@ -746,16 +851,60 @@ GLINT_WRITE_REG(pGlint->PM3_Render2D | PM3Render2D_Width(w) | PM3Render2D_Height(h), PM3Render2D); - TRACE_EXIT("Permedia3SubsequentCPUToScreenColorExpandFill"); + +#if defined(__alpha__) + if (0) /* force Alpha to use indirect always */ +#else + if ((pGlint->dwords*h) < pGlint->FIFOSize) +#endif + { + /* Turn on direct for less than 120 dword colour expansion */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4; + pGlint->ScanlineDirect = 1; + GLINT_WRITE_REG(((pGlint->dwords*h)-1)<<16 | 0x0D, OutputFIFO); + GLINT_WAIT(pGlint->dwords*h); + } else { + /* Use indirect for anything else */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->ScratchBuffer; + pGlint->ScanlineDirect = 0; + } + + pGlint->cpucount--; } +static void +Permedia3SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ + GLINTPtr pGlint = GLINTPTR(pScrn); + CARD32 *srcp = (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno]; + int dwords = pGlint->dwords; + + if (!pGlint->ScanlineDirect) { + while(dwords >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + dwords -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; + } + if(dwords) { + GLINT_WAIT(dwords + 1); + GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, dwords); + } + } +} /* Images Writes */ -static void Permedia3SetupForImageWrite(ScrnInfoPtr pScrn, int rop, +static void Permedia3SetupForScanlineImageWrite(ScrnInfoPtr pScrn, int rop, unsigned int planemask, int trans_color, int bpp, int depth) { GLINTPtr pGlint = GLINTPTR(pScrn); - TRACE_ENTER("Permedia3SetupForImageWrite"); + TRACE_ENTER("Permedia3SetupForScanlineImageWrite"); pGlint->PM3_Render2D = PM3Render2D_SpanOperation | PM3Render2D_XPositive | @@ -771,14 +920,18 @@ GLINT_WAIT(2); DO_PLANEMASK(planemask); GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); - TRACE_EXIT("Permedia3SetupForImageWrite"); + TRACE_EXIT("Permedia3SetupForScanlineImageWrite"); } -static void Permedia3SubsequentImageWriteRect(ScrnInfoPtr pScrn, + +static void Permedia3SubsequentScanlineImageWriteRect(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft) { GLINTPtr pGlint = GLINTPTR(pScrn); - TRACE_ENTER("Permedia3SubsequentImageWrite"); - GLINT_WAIT(4); + TRACE_ENTER("Permedia3SubsequentScanlineImageWrite"); + pGlint->dwords = (((w * pScrn->bitsPerPixel) + 3) >> 2); /* per scanline */ + + pGlint->cpucount = h; + GLINT_WAIT(5); GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY); GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY); GLINT_WRITE_REG( @@ -788,83 +941,69 @@ GLINT_WRITE_REG(pGlint->PM3_Render2D | PM3Render2D_Width(w) | PM3Render2D_Height(h), PM3Render2D); - TRACE_EXIT("Permedia3SubsequentImageWrite"); -} - -/* Defines for Direct Fifo access */ - -#define WriteRange 120 -#define PciRetryWriteRange 1023 -#define WriteBase_Fixed ((CARD32 *)(pGlint->IOBase + PM3FBSourceData)) -#define WriteBase ((CARD32 *)(pGlint->IOBase + OutputFIFO + 4)) +#if defined(__alpha__) + if (0) /* force Alpha to use indirect always */ +#else + if (pGlint->dwords < pGlint->FIFOSize) +#endif + { + /* Turn on direct for less than 120 dword colour expansion */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4; + pGlint->ScanlineDirect = 1; + GLINT_WRITE_REG(((pGlint->dwords*h)-1)<<16 | (0x15<<4) | 0x05, + OutputFIFO); + GLINT_WAIT(pGlint->dwords); + } else { + /* Use indirect for anything else */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->ScratchBuffer; + pGlint->ScanlineDirect = 0; + } -/* Direct Fifo Bitmap Writes */ + pGlint->cpucount--; + TRACE_EXIT("Permedia3SubsequentScanlineImageWrite"); +} static void -Permedia3WriteBitmap(ScrnInfoPtr pScrn, - int x, int y, int w, int h, - unsigned char *src, - int srcwidth, int skipleft, - int fg, int bg, int rop, - unsigned int planemask -) +Permedia3SubsequentImageWriteScanline(ScrnInfoPtr pScrn, int bufno) { - int dwords; - int ApertureRange; GLINTPtr pGlint = GLINTPTR(pScrn); - TRACE_ENTER("Permedia3WriteBitmap"); + int dwords = pGlint->dwords; - w += skipleft; - x -= skipleft; - dwords = (w + 31) >>5; - if (pGlint->UsePCIRetry) ApertureRange = PciRetryWriteRange; - else ApertureRange = WriteRange; - - /* width of the stuff to copy in 32 bit words */ - Permedia3SetupForCPUToScreenColorExpandFill(pScrn, fg, bg, rop, planemask); - Permedia3SubsequentCPUToScreenColorExpandFill(pScrn, x, y, w, h, skipleft); - - if (dwords > ApertureRange) { - while(h--) { - XAAMoveDWORDS_FixedBase(WriteBase_Fixed, (CARD32*)src, dwords); - src += srcwidth; - } + if (pGlint->ScanlineDirect) { + if (pGlint->cpucount--) + GLINT_WAIT(dwords); + return; } else { - /* the src is exatcly as wide as the target rectangle. We copy all - * of it, so no need to separate stuff by scanline */ - if(srcwidth == (dwords << 5)) { - /* decrement contains the number of lines that can be - * put in the fifo */ - int decrement = ApertureRange/dwords; - - while(h > decrement) { - GLINT_WAIT(dwords * decrement); - GLINT_WRITE_REG((((dwords * decrement)-1) << 16) | 0xd, - OutputFIFO); - XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * decrement); - src += (srcwidth * decrement); - h -= decrement; - } - if(h) { - GLINT_WAIT(dwords * h); - GLINT_WRITE_REG((((dwords * h)-1) << 16) | 0xd, OutputFIFO); - XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * h); - } - } else { - while(h--) { - GLINT_WAIT(dwords); - GLINT_WRITE_REG(((dwords-1) << 16) | 0xd, OutputFIFO); - XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords); - src += srcwidth; - } + while(dwords >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno], + pGlint->FIFOSize - 1); + dwords -= pGlint->FIFOSize - 1; + } + if(dwords) { + GLINT_WAIT(dwords + 1); + GLINT_WRITE_REG(((dwords - 1) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno], + dwords); } } - TRACE_EXIT("Permedia3WriteBitmap"); } -/* Direct Fifo Images Writes */ static void +Permedia3RestoreAccelState(ScrnInfoPtr pScrn) +{ + Permedia3Sync(pScrn); +} + +static void Permedia3WritePixmap( ScrnInfoPtr pScrn, int x, int y, int w, int h, @@ -877,9 +1016,10 @@ ) { int dwords; + int count; int skipleft = (long)src & 0x03L; int Bpp = bpp >> 3; - int ApertureRange; + CARD32 *srcp; GLINTPtr pGlint = GLINTPTR(pScrn); TRACE_ENTER("Permedia3WritePixmap"); @@ -893,51 +1033,143 @@ x -= skipleft; w += skipleft; - + src = (unsigned char*)((long)src & ~0x03L); } - Permedia3SetupForImageWrite(pScrn, rop, planemask, trans, bpp, depth); - Permedia3SubsequentImageWriteRect(pScrn, x, y, w, h, skipleft); + pGlint->PM3_Render2D = + PM3Render2D_SpanOperation | + PM3Render2D_XPositive | + PM3Render2D_YPositive | + PM3Render2D_Operation_SyncOnHostData; + pGlint->PM3_Config2D = + PM3Config2D_UserScissorEnable | + PM3Config2D_ForegroundROPEnable | + PM3Config2D_ForegroundROP(rop) | + PM3Config2D_FBWriteEnable; + if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) + pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; + GLINT_WAIT(6); + DO_PLANEMASK(planemask); + GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); + GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY); + GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY); + GLINT_WRITE_REG( + PM3RectanglePosition_XOffset(x) | + PM3RectanglePosition_YOffset(y), + PM3RectanglePosition); + GLINT_WRITE_REG(pGlint->PM3_Render2D | + PM3Render2D_Width(w) | PM3Render2D_Height(h), + PM3Render2D); /* width of the stuff to copy in 32 bit words */ dwords = ((w * Bpp) + 3) >> 2; - if (pGlint->UsePCIRetry) ApertureRange = PciRetryWriteRange; - else ApertureRange = WriteRange; - if (dwords > ApertureRange) { - while(h--) { - XAAMoveDWORDS_FixedBase(WriteBase_Fixed, (CARD32*)src, dwords); - src += srcwidth; + while(h--) { + count = dwords; + srcp = (CARD32*)src; + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); + /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; } - } else { - /* the src is exatcly as wide as the target rectangle. We copy all - * of it, so no need to separate stuff by scanline */ - if(srcwidth == (dwords << 2)) { - /* decrement contains the number of lines that can be - * put in the fifo */ - int decrement = ApertureRange/dwords; - - while(h > decrement) { - GLINT_WAIT(dwords * decrement); - GLINT_WRITE_REG((((dwords * decrement)-1) << 16) | 0x155, - OutputFIFO); - XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * decrement); - src += (srcwidth * decrement); - h -= decrement; - } - if(h) { - GLINT_WAIT(dwords * h); - GLINT_WRITE_REG((((dwords * h)-1) << 16) | 0x155, OutputFIFO); - XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords * h); - } - } else { - while(h--) { - GLINT_WAIT(dwords); - GLINT_WRITE_REG(((dwords-1) << 16) | 0x155, OutputFIFO); - XAAMoveDWORDS(WriteBase, (CARD32*)src, dwords); - src += srcwidth; - } + if(count) { + GLINT_WAIT(count + 1); + /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ + GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, count); } + src += srcwidth; + } + + Permedia3DisableClipping(pScrn); + Permedia3Sync(pScrn); +} + +static void +Permedia3WriteBitmap(ScrnInfoPtr pScrn, + int x, int y, int w, int h, + unsigned char *src, + int srcwidth, int skipleft, + int fg, int bg, int rop, + unsigned int planemask +) +{ + int dwords; + GLINTPtr pGlint = GLINTPTR(pScrn); + int count; + CARD32 *srcp; + TRACE_ENTER("Permedia3WriteBitmap"); + + w += skipleft; + x -= skipleft; + dwords = (w + 31) >>5; + + REPLICATE(fg); + pGlint->PM3_Render2D = + PM3Render2D_SpanOperation | + PM3Render2D_XPositive | + PM3Render2D_YPositive | + PM3Render2D_Operation_SyncOnBitMask; + pGlint->PM3_Config2D = + PM3Config2D_UserScissorEnable | + PM3Config2D_UseConstantSource | + PM3Config2D_ForegroundROPEnable | + PM3Config2D_ForegroundROP(rop) | + PM3Config2D_FBWriteEnable; + if ((rop!=GXclear)&&(rop!=GXset)&&(rop!=GXcopy)&&(rop!=GXcopyInverted)) + pGlint->PM3_Config2D |= PM3Config2D_FBDestReadEnable; + if (bg != -1) { + REPLICATE(bg); + pGlint->PM3_Config2D |= PM3Config2D_OpaqueSpan; + GLINT_WAIT(8); + GLINT_WRITE_REG(bg, BackgroundColor); } - TRACE_EXIT("Permedia3WritePixmap"); + else GLINT_WAIT(7); + GLINT_WRITE_REG(fg, PM3ForegroundColor); + DO_PLANEMASK(planemask); + GLINT_WRITE_REG(pGlint->PM3_Config2D, PM3Config2D); + GLINT_WRITE_REG(((y&0x0fff)<<16)|((x+skipleft)&0x0fff), ScissorMinXY); + GLINT_WRITE_REG((((y+h)&0x0fff)<<16)|((x+w)&0x0fff), ScissorMaxXY); + GLINT_WRITE_REG( + PM3RectanglePosition_XOffset(x) | + PM3RectanglePosition_YOffset(y), + PM3RectanglePosition); + GLINT_WRITE_REG(pGlint->PM3_Render2D | + PM3Render2D_Width(w) | PM3Render2D_Height(h), + PM3Render2D); + + while(h--) { + count = dwords; + srcp = (CARD32*)src; + while(count >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | + 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + count -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; + } + if(count) { + GLINT_WAIT(count + 1); + GLINT_WRITE_REG(((count - 1) << 16) | 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, count); + } + src += srcwidth; + } + + Permedia3DisableClipping(pScrn); + Permedia3Sync(pScrn); } Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c:1.8.2.1 xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c:1.8.2.1 Thu Mar 1 07:01:51 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c Wed May 16 03:56:07 2001 @@ -1,5 +1,5 @@ /* - * Copyright 2000 by Sven Luther <luther@dpt-info.u-strasbg.fr>. + * Copyright 2000,2001 by Sven Luther <luther@dpt-info.u-strasbg.fr>. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -21,11 +21,12 @@ * * Authors: Sven Luther, <luther@dpt-info.u-strasbg.fr> * Thomas Witzel, <twitzel@nmr.mgh.harvard.edu> + * Alan Hourihane, <alanh@fairlite.demon.co.uk> * * this work is sponsored by Appian Graphics. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.8.2.1 2001/03/01 12:01:51 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_dac.c,v 1.24 2001/05/16 07:56:07 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -50,104 +51,78 @@ # define TRACE(str) #endif -int PM3QuickFillMemory(ScrnInfoPtr pScrn,int size); - -int -PM3QuickFillMemory(ScrnInfoPtr pScrn,int size) -{ - GLINTPtr pGlint = GLINTPTR (pScrn); - unsigned int * p; - unsigned int p_content; - unsigned int i, j; - long savemapsize; - - savemapsize = pGlint->FbMapSize; - pGlint->FbMapSize = size*1024*1024; - - pGlint->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, - pGlint->PciTag, pGlint->FbAddress, pGlint->FbMapSize); - if (pGlint->FbBase == NULL) { - pGlint->FbMapSize = savemapsize; - return FALSE; - } - - /* Set pointer to Aperture1 */ - p = (unsigned int *) pGlint->FbBase; - /* Fill in megs number of megabytes */ - for(i=0;i<size;i++) - for(j=0;j<1024*256;j+=1024) - p[j+(i*1024*256)] = j + (i * 1024*256); - - /* Set pointer to Aperture1 */ - p = (unsigned int *) pGlint->FbBase; - - /* If original ptr is 0x0 then no rollover occured */ - p_content = p[0]; - xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pGlint->FbBase, - pGlint->FbMapSize); - pGlint->FbBase = NULL; - pGlint->FbMapSize = savemapsize; - if (p_content == 0x0) - return TRUE; - else return FALSE; -} int Permedia3MemorySizeDetect(ScrnInfoPtr pScrn) { - GLINTPtr pGlint; - int size = 1; - pGlint = GLINTPTR (pScrn); - /* Fill memory until get a rollover of dram to 0 - * fill in powers of 2, 1,2,4,8,16,32 + GLINTPtr pGlint = GLINTPTR (pScrn); + CARD32 size = 0, temp, temp1, temp2, i; + + /* We can map 64MB, as that's the size of the Permedia3 aperture + * regardless of memory configuration */ + pGlint->FbMapSize = 64*1024*1024; + + /* Mark as VIDMEM_MMIO to avoid write-combining while detecting memory */ + pGlint->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, + pGlint->PciTag, pGlint->FbAddress, pGlint->FbMapSize); + + if (pGlint->FbBase == NULL) + return 0; + + temp = GLINT_READ_REG(PM3MemBypassWriteMask); + GLINT_SLOW_WRITE_REG(0xffffffff, PM3MemBypassWriteMask); + + /* The Permedia3 splits up memory, and even replicates it. Grrr. + * So that each 32MB appears at offset 0, and offset 32, unless + * there's really 64MB attached to the chip. + * So, 16MB appears at offset 0, nothing between 16-32, then it re-appears + * at offset 32. + * This below is to detect the cases of memory combinations + * It may also need closer examination for boards other than 16 or 32MB */ - while(PM3QuickFillMemory(pScrn,size)) - { - size = size*2; - if(size == 64) break; + + /* Test first 32MB */ + for(i=0;i<32;i++) { + /* write test pattern */ + MMIO_OUT32(pGlint->FbBase, i*1024*1024, i*0x00345678); + mem_barrier(); + temp1 = MMIO_IN32(pGlint->FbBase, i*1024*1024); + /* Let's check for wrapover, write will fail at 16MB boundary */ + if (temp1 == (i*0x00345678)) + size = i; + else + break; } - /* Correct memory amount since fail */ - if (size != 1) - size = size / 2; - else - return 1*1024; - /* Just to make sure */ - if (PM3QuickFillMemory(pScrn,size)) - return size*1024; - return 16*1024; -} -static int -Shiftbpp(ScrnInfoPtr pScrn, int value) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - /* shift horizontal timings for 128bit SGRAMs or SDRAMs */ - int logbytesperaccess = 4; - - switch (pScrn->bitsPerPixel) { - case 8: - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 16: - if (pGlint->DoubleBuffer) { - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - } else { - value >>= (logbytesperaccess-1); - pGlint->BppShift = logbytesperaccess-1; + /* Ok, we're satisfied we've got 32MB, let's test the second lot */ + if (size == i) { + for(i=0;i<32;i++) { + /* Clear first 32MB */ + MMIO_OUT32(pGlint->FbBase, i*1024*1024, 0); + mem_barrier(); } - break; - case 24: - value *= 3; - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 32: - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - break; + for(i=32;i<64;i++) { + /* write test pattern */ + MMIO_OUT32(pGlint->FbBase, i*1024*1024, i*0x00345678); + mem_barrier(); + temp1 = MMIO_IN32(pGlint->FbBase, i*1024*1024); + temp2 = MMIO_IN32(pGlint->FbBase, (i-32)*1024*1024); + /* Let's check for wrapover */ + if ( (temp1 == (i*0x00345678)) && (temp2 == 0) ) + size = i; + else + break; + } } - return (value); + + GLINT_SLOW_WRITE_REG(temp, PM3MemBypassWriteMask); + + xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pGlint->FbBase, + pGlint->FbMapSize); + + pGlint->FbBase = NULL; + pGlint->FbMapSize = 0; + + return ( (size+1) * 1024 ); } static unsigned long @@ -188,18 +163,17 @@ Permedia3PreInit(ScrnInfoPtr pScrn) { GLINTPtr pGlint = GLINTPTR(pScrn); + TRACE_ENTER("Permedia3PreInit"); - if ((pGlint->PciInfo->subsysVendor == 0x1097) && - (pGlint->PciInfo->subsysCard == 0x3d32)) { + if (IS_J2000) { unsigned char m,n,p; unsigned long clockused; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Appian Jeronimo 2000 board detected and initialized.\n\t" - "subsysVendor = 0x%04x, subsysCard = 0x%04x.\n", - pGlint->PciInfo->subsysVendor, pGlint->PciInfo->subsysCard); + + if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) + GLINT_SLOW_WRITE_REG(GCSRSecondaryGLINTMapEn, GCSRAperture); /* Memory timings for the Appian J2000 board. - * This is needed for the second head which is left unitilialized + * This is needed for the second head which is left un-initialized * by the bios, thus freezing the machine. */ GLINT_SLOW_WRITE_REG(0x02e311B8, PM3LocalMemCaps); GLINT_SLOW_WRITE_REG(0x07424905, PM3LocalMemTimings); @@ -231,98 +205,91 @@ PM3RD_SClkControl_SOURCE_PCLK | PM3RD_SClkControl_ENABLE); } - else xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Unknown Glint Permedia3 board detected.\n\t" - "subsysVendor = 0x%04x, subsysCard = 0x%04x.\n\t" - "Let's hope that it is correctly initialized by the bios.\n", - pGlint->PciInfo->subsysVendor, pGlint->PciInfo->subsysCard); + TRACE_EXIT("Permedia3PreInit"); } Bool -Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode) +Permedia3Init(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) { GLINTPtr pGlint = GLINTPTR(pScrn); - GLINTRegPtr pReg = &pGlint->ModeReg; CARD32 temp1, temp2, temp3, temp4; + + if ((pGlint->numMultiDevices == 2) || (IS_J2000)) { + STOREREG(GCSRAperture, GCSRSecondaryGLINTMapEn); + } - pReg->glintRegs[PM3MemBypassWriteMask >> 3] = 0xffffffff; - pReg->glintRegs[PM3ByAperture1Mode >> 3] = 0x00000000; - pReg->glintRegs[PM3ByAperture2Mode >> 3] = 0x00000000; - - pReg->glintRegs[Aperture0 >> 3] = 0; - pReg->glintRegs[Aperture1 >> 3] = 0; - - if (pGlint->UsePCIRetry) { - pReg->glintRegs[DFIFODis >> 3] = 1; - pReg->glintRegs[FIFODis >> 3] = 3; - } else { - pReg->glintRegs[DFIFODis >> 3] = 0; - pReg->glintRegs[FIFODis >> 3] = 1; + if (pGlint->MultiAperture) { + STOREREG(GMultGLINTAperture, pGlint->realWidth); + STOREREG(GMultGLINT1, + pGlint->MultiPciInfo[0]->memBase[2] & 0xFF800000); + STOREREG(GMultGLINT2, + pGlint->MultiPciInfo[1]->memBase[2] & 0xFF800000); } + STOREREG(PM3MemBypassWriteMask, 0xffffffff); + STOREREG(Aperture0, 0x00000000); + STOREREG(Aperture1, 0x00000000); + + if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) + STOREREG(DFIFODis, 0x00000001); + + STOREREG(FIFODis, 0x00000007); + temp1 = mode->CrtcHSyncStart - mode->CrtcHDisplay; temp2 = mode->CrtcVSyncStart - mode->CrtcVDisplay; temp3 = mode->CrtcHSyncEnd - mode->CrtcHSyncStart; temp4 = mode->CrtcVSyncEnd - mode->CrtcVSyncStart; - pReg->glintRegs[PMHTotal >> 3] = Shiftbpp(pScrn,mode->CrtcHTotal); - pReg->glintRegs[PMHsEnd >> 3] = Shiftbpp(pScrn, temp1 + temp3); - pReg->glintRegs[PMHsStart >> 3] = Shiftbpp(pScrn, temp1); - pReg->glintRegs[PMHbEnd >> 3] = - Shiftbpp(pScrn,mode->CrtcHTotal-mode->CrtcHDisplay); - pReg->glintRegs[PMHgEnd >> 3] = pReg->glintRegs[PMHbEnd >> 3]; - pReg->glintRegs[PMScreenStride >> 3] = - Shiftbpp(pScrn,pScrn->displayWidth); - - pReg->glintRegs[PMVTotal >> 3] = mode->CrtcVTotal; - pReg->glintRegs[PMVsEnd >> 3] = temp2 + temp4; - pReg->glintRegs[PMVsStart >> 3] = temp2; - pReg->glintRegs[PMVbEnd >> 3] = mode->CrtcVTotal - mode->CrtcVDisplay; - - pReg->glintRegs[PMHTotal >> 3] -= 1; - pReg->glintRegs[PMVTotal >> 3] -= 1; - pReg->glintRegs[PMVsStart >> 3] -= 1; - pReg->glintRegs[PMVsEnd >> 3] -= 1; - - /* The hw cursor needs /VSYNC to recognize vert retrace. We'll stick - both sync lines to active high here and if needed invert them - using the RAMDAC's RDSyncControl below. */ - /* We need to set the pixelsize (bit 19 & 20) also ... */ + STOREREG(PMHTotal, Shiftbpp(pScrn, mode->CrtcHTotal - 1)); + STOREREG(PMHsEnd, Shiftbpp(pScrn, temp1 + temp3)); + STOREREG(PMHsStart, Shiftbpp(pScrn, temp1)); + STOREREG(PMHbEnd, Shiftbpp(pScrn, mode->CrtcHTotal - mode->CrtcHDisplay)); + STOREREG(PMHgEnd, Shiftbpp(pScrn, mode->CrtcHTotal - mode->CrtcHDisplay)); + STOREREG(PMScreenStride, Shiftbpp(pScrn, pScrn->displayWidth)); + + STOREREG(PMVTotal, mode->CrtcVTotal - 1); + STOREREG(PMVsEnd, temp2 + temp4 - 1); + STOREREG(PMVsStart, temp2 - 1); + STOREREG(PMVbEnd, mode->CrtcVTotal - mode->CrtcVDisplay); + switch (pScrn->bitsPerPixel) { case 8: - pReg->glintRegs[PM3ByAperture1Mode >> 3] = - PM3ByApertureMode_PIXELSIZE_8BIT; - pReg->glintRegs[PM3ByAperture2Mode >> 3] = - PM3ByApertureMode_PIXELSIZE_8BIT; - pReg->glintRegs[PMVideoControl >> 3] = - 1 | (1 << 3) | (1 << 5) | (0 << 19); + STOREREG(PM3ByAperture1Mode, PM3ByApertureMode_PIXELSIZE_8BIT); + STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_8BIT); + STOREREG(PMVideoControl, 1 | (1 << 3) | (1 << 5) | (0 << 19)); break; case 16: - pReg->glintRegs[PM3ByAperture1Mode >> 3] = - PM3ByApertureMode_PIXELSIZE_16BIT; - pReg->glintRegs[PM3ByAperture2Mode >> 3] = - PM3ByApertureMode_PIXELSIZE_16BIT; - pReg->glintRegs[PMVideoControl >> 3] = - 1 | (1 << 3) | (1 << 5) | (1 << 19); +#if X_BYTE_ORDER != X_BIG_ENDIAN + STOREREG(PM3ByAperture1Mode, PM3ByApertureMode_PIXELSIZE_16BIT); + STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_16BIT); +#else + STOREREG(PM3ByAperture1Mode, PM3ByApertureMode_PIXELSIZE_16BIT | + PM3ByApertureMode_BYTESWAP_BADC); + STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_16BIT | + PM3ByApertureMode_BYTESWAP_BADC); +#endif + STOREREG(PMVideoControl, 1 | (1 << 3) | (1 << 5) | (1 << 19)); break; case 32: - pReg->glintRegs[PM3ByAperture1Mode >> 3] = - PM3ByApertureMode_PIXELSIZE_32BIT; - pReg->glintRegs[PM3ByAperture2Mode >> 3] = - PM3ByApertureMode_PIXELSIZE_32BIT; - pReg->glintRegs[PMVideoControl >> 3] = - 1 | (1 << 3) | (1 << 5) | (2 << 19); +#if X_BYTE_ORDER != X_BIG_ENDIAN + STOREREG(PM3ByAperture1Mode, PM3ByApertureMode_PIXELSIZE_32BIT); + STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_32BIT); +#else + STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_32BIT | + PM3ByApertureMode_BYTESWAP_DCBA); + STOREREG(PM3ByAperture2Mode, PM3ByApertureMode_PIXELSIZE_32BIT | + PM3ByApertureMode_BYTESWAP_DCBA); +#endif + STOREREG(PMVideoControl, 1 | (1 << 3) | (1 << 5) | (2 << 19)); break; } - pReg->glintRegs[VClkCtl >> 3] = (GLINT_READ_REG(VClkCtl) & 0xFFFFFFFC); - pReg->glintRegs[PMScreenBase >> 3] = 0; + STOREREG(VClkCtl, GLINT_READ_REG(VClkCtl) & 0xFFFFFFFC); + STOREREG(PMScreenBase, 0x00000000); + STOREREG(ChipConfig, GLINT_READ_REG(ChipConfig) & 0xFFFFFFFD); - pReg->glintRegs[ChipConfig >> 3] = GLINT_READ_REG(ChipConfig) & 0xFFFFFFDD; - pReg->DacRegs[PM2VDACRDDACControl] = 0x00; - { /* Get the programmable clock values */ unsigned char m,n,p; @@ -331,197 +298,282 @@ /* Let's program the dot clock */ clockused = PM3DAC_CalculateClock(mode->Clock, pGlint->RefClock, &m,&n,&p); - pReg->DacRegs[PM3RD_DClk0PreScale] = m; - pReg->DacRegs[PM3RD_DClk0FeedbackScale] = n; - pReg->DacRegs[PM3RD_DClk0PostScale] = p; + STOREDAC(PM3RD_DClk0PreScale, m); + STOREDAC(PM3RD_DClk0FeedbackScale, n); + STOREDAC(PM3RD_DClk0PostScale, p); } - pReg->glintRegs[PM2VDACRDIndexControl >> 3] = 0x00; + temp1 = 0; + temp2 = 0; + temp3 = 0; + + if (pGlint->UseFlatPanel) { + temp2 |= PM3RD_DACControl_BLANK_PEDESTAL_ENABLE; + temp3 |= PM3RD_MiscControl_VSB_OUTPUT_ENABLE; + STOREREG(VSConfiguration, 0x06); + STOREREG(VSBBase, 1<<14); + } + if (mode->Flags & V_PHSYNC) temp1 |= PM3RD_SyncControl_HSYNC_ACTIVE_HIGH; + if (mode->Flags & V_PVSYNC) temp1 |= PM3RD_SyncControl_VSYNC_ACTIVE_HIGH; + + STOREREG(PM2VDACRDIndexControl, 0x00); + STOREDAC(PM2VDACRDSyncControl, temp1); + STOREDAC(PM2VDACRDDACControl, temp2); + if (pScrn->rgbBits == 8) - pReg->DacRegs[PM2VDACRDMiscControl] = 0x01; /* 8bit DAC */ - else - pReg->DacRegs[PM2VDACRDMiscControl] = 0x00; /* 6bit DAC */ - - pReg->DacRegs[PM2VDACRDSyncControl] = 0x00; - if (!(mode->Flags & V_PHSYNC)) - pReg->DacRegs[PM2VDACRDSyncControl] |= 0x01; /* invert hsync */ - if (!(mode->Flags & V_PVSYNC)) - pReg->DacRegs[PM2VDACRDSyncControl] |= 0x08; /* invert vsync */ - -#if 0 /* Currently commented out while testing Flat Panel support */ - pReg->DacRegs[PM2VDACRDDACControl] = 0x01; - pReg->DacRegs[PM2VDACRDSyncControl] |= 0x40; - pReg->glintRegs[VSConfiguration >> 3] = (GLINT_READ_REG(VSConfiguration) & 0xFFFFFFF8) | 0x06; - pReg->glintRegs[VSBBase >> 3] = 1<<14; -#endif + temp3 |= 0x01; /* 8bit DAC */ switch (pScrn->bitsPerPixel) { case 8: - pReg->DacRegs[PM2VDACRDPixelSize] = 0x00; - pReg->DacRegs[PM2VDACRDColorFormat] = 0x2E; + STOREDAC(PM2VDACRDPixelSize, 0x00); + STOREDAC(PM2VDACRDColorFormat, 0x2E); break; case 16: - pReg->DacRegs[PM2VDACRDPixelSize] = 0x01; - if (pScrn->depth == 15) - pReg->DacRegs[PM2VDACRDColorFormat] = 0x61; - else - pReg->DacRegs[PM2VDACRDColorFormat] = 0x70; + temp3 |= PM3RD_MiscControl_DIRECTCOLOR_ENABLE; + STOREDAC(PM2VDACRDPixelSize, 0x01); + if (pScrn->depth == 15) { + STOREDAC(PM2VDACRDColorFormat, 0x61); + } else { + STOREDAC(PM2VDACRDColorFormat, 0x70); + } break; case 24: - pReg->DacRegs[PM2VDACRDPixelSize] = 0x04; - pReg->DacRegs[PM2VDACRDColorFormat] = 0x60; + temp3 |= PM3RD_MiscControl_DIRECTCOLOR_ENABLE; + STOREDAC(PM2VDACRDPixelSize, 0x04); + STOREDAC(PM2VDACRDColorFormat, 0x60); break; case 32: - pReg->DacRegs[PM2VDACRDPixelSize] = 0x02; - pReg->DacRegs[PM2VDACRDColorFormat] = 0x20; + temp3 |= PM3RD_MiscControl_DIRECTCOLOR_ENABLE; if (pScrn->overlayFlags & OVERLAY_8_32_PLANAR) { - pReg->DacRegs[PM2VDACRDMiscControl] |= 0x10; - pReg->DacRegs[PM2VDACRDOverlayKey] = pScrn->colorKey; + temp3 |= 0x18; + STOREDAC(PM2VDACRDOverlayKey, pScrn->colorKey); } + STOREDAC(PM2VDACRDPixelSize, 0x02); + STOREDAC(PM2VDACRDColorFormat, 0x20); break; } + STOREDAC(PM2VDACRDMiscControl, temp3); + STOREREG(PM3FifoControl, 0x905); /* Lower the default fifo threshold */ + return(TRUE); } void -Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) +Permedia3Save(ScrnInfoPtr pScrn, GLINTRegPtr pReg) { GLINTPtr pGlint = GLINTPTR(pScrn); int i; + /* We can't rely on the vgahw layer copying the font information + * back properly, due to problems with MMIO access to VGA space + * so we memcpy the information using the slow routines */ + xf86SlowBcopy((CARD8*)pGlint->FbBase, (CARD8*)pGlint->VGAdata, 65536); + + if ((pGlint->numMultiDevices == 2) || (IS_J2000)) { + SAVEREG(GCSRAperture); + } + + if (pGlint->MultiAperture) { + SAVEREG(GMultGLINTAperture); + SAVEREG(GMultGLINT1); + SAVEREG(GMultGLINT2); + } + /* Permedia 3 memory Timings */ - glintReg->glintRegs[PM3MemBypassWriteMask >> 3] = - GLINT_READ_REG(PM3MemBypassWriteMask); - glintReg->glintRegs[PM3ByAperture1Mode >> 3] = - GLINT_READ_REG(PM3ByAperture1Mode); - glintReg->glintRegs[PM3ByAperture2Mode >> 3] = - GLINT_READ_REG(PM3ByAperture2Mode); - - glintReg->glintRegs[ChipConfig >> 3] = GLINT_READ_REG(ChipConfig); - glintReg->glintRegs[Aperture0 >> 3] = GLINT_READ_REG(Aperture0); - glintReg->glintRegs[Aperture1 >> 3] = GLINT_READ_REG(Aperture1); - - glintReg->glintRegs[DFIFODis >> 3] = GLINT_READ_REG(DFIFODis); - glintReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis); - glintReg->glintRegs[PMHTotal >> 3] = GLINT_READ_REG(PMHTotal); - glintReg->glintRegs[PMHbEnd >> 3] = GLINT_READ_REG(PMHbEnd); - glintReg->glintRegs[PMHbEnd >> 3] = GLINT_READ_REG(PMHgEnd); - glintReg->glintRegs[PMScreenStride >> 3] = GLINT_READ_REG(PMScreenStride); - glintReg->glintRegs[PMHsStart >> 3] = GLINT_READ_REG(PMHsStart); - glintReg->glintRegs[PMHsEnd >> 3] = GLINT_READ_REG(PMHsEnd); - glintReg->glintRegs[PMVTotal >> 3] = GLINT_READ_REG(PMVTotal); - glintReg->glintRegs[PMVbEnd >> 3] = GLINT_READ_REG(PMVbEnd); - glintReg->glintRegs[PMVsStart >> 3] = GLINT_READ_REG(PMVsStart); - glintReg->glintRegs[PMVsEnd >> 3] = GLINT_READ_REG(PMVsEnd); - glintReg->glintRegs[PMScreenBase >> 3] = GLINT_READ_REG(PMScreenBase); - glintReg->glintRegs[PMVideoControl >> 3] = GLINT_READ_REG(PMVideoControl); - glintReg->glintRegs[VClkCtl >> 3] = GLINT_READ_REG(VClkCtl); -#if 0 /* Currently commented out while testing Flat Panel support */ - glintReg->glintRegs[VSConfiguration >> 3] = GLINT_READ_REG(VSConfiguration); - glintReg->glintRegs[VSBBase >> 3] = GLINT_READ_REG(VSBBase); -#endif + SAVEREG(PM3MemBypassWriteMask); + SAVEREG(PM3ByAperture1Mode); + SAVEREG(PM3ByAperture2Mode); + SAVEREG(ChipConfig); + SAVEREG(Aperture0); + SAVEREG(Aperture1); + SAVEREG(PM3FifoControl); + + if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) + SAVEREG(DFIFODis); + SAVEREG(FIFODis); + SAVEREG(PMHTotal); + SAVEREG(PMHbEnd); + SAVEREG(PMHgEnd); + SAVEREG(PMScreenStride); + SAVEREG(PMHsStart); + SAVEREG(PMHsEnd); + SAVEREG(PMVTotal); + SAVEREG(PMVbEnd); + SAVEREG(PMVsStart); + SAVEREG(PMVsEnd); + SAVEREG(PMScreenBase); + SAVEREG(PMVideoControl); + SAVEREG(VClkCtl); + if (pGlint->UseFlatPanel) { + SAVEREG(VSConfiguration); + SAVEREG(VSBBase); + } for (i=0;i<768;i++) { Permedia2ReadAddress(pScrn, i); - glintReg->cmap[i] = Permedia2ReadData(pScrn); + pReg->cmap[i] = Permedia2ReadData(pScrn); } - glintReg->glintRegs[PM2VDACRDIndexControl >> 3] = - GLINT_READ_REG(PM2VDACRDIndexControl); - glintReg->DacRegs[PM2VDACRDOverlayKey] = - Permedia2vInIndReg(pScrn, PM2VDACRDOverlayKey); - glintReg->DacRegs[PM2VDACRDSyncControl] = - Permedia2vInIndReg(pScrn, PM2VDACRDSyncControl); - glintReg->DacRegs[PM2VDACRDMiscControl] = - Permedia2vInIndReg(pScrn, PM2VDACRDMiscControl); - glintReg->DacRegs[PM2VDACRDDACControl] = - Permedia2vInIndReg(pScrn, PM2VDACRDDACControl); - glintReg->DacRegs[PM2VDACRDPixelSize] = - Permedia2vInIndReg(pScrn, PM2VDACRDPixelSize); - glintReg->DacRegs[PM2VDACRDColorFormat] = - Permedia2vInIndReg(pScrn, PM2VDACRDColorFormat); - - glintReg->DacRegs[PM2VDACRDDClk0PreScale] = Permedia2vInIndReg(pScrn, PM2VDACRDDClk0PreScale); - glintReg->DacRegs[PM2VDACRDDClk0FeedbackScale] = Permedia2vInIndReg(pScrn, PM2VDACRDDClk0FeedbackScale); - glintReg->DacRegs[PM2VDACRDDClk0PostScale] = Permedia2vInIndReg(pScrn, PM2VDACRDDClk0PostScale); + SAVEREG(PM2VDACRDIndexControl); + P2VIN(PM2VDACRDOverlayKey); + P2VIN(PM2VDACRDSyncControl); + P2VIN(PM2VDACRDMiscControl); + P2VIN(PM2VDACRDDACControl); + P2VIN(PM2VDACRDPixelSize); + P2VIN(PM2VDACRDColorFormat); + P2VIN(PM2VDACRDDClk0PreScale); + P2VIN(PM2VDACRDDClk0FeedbackScale); + P2VIN(PM2VDACRDDClk0PostScale); } void -Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) +Permedia3Restore(ScrnInfoPtr pScrn, GLINTRegPtr pReg) { GLINTPtr pGlint = GLINTPTR(pScrn); CARD32 temp; int i; -#if 0 - GLINT_SLOW_WRITE_REG(0, ResetStatus); - while(GLINT_READ_REG(ResetStatus) != 0) { - xf86MsgVerb(X_INFO, 2, "Resetting Engine - Please Wait.\n"); - }; -#endif - - /* Permedia 3 memory Timings */ - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3MemBypassWriteMask >> 3], - PM3MemBypassWriteMask); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3ByAperture1Mode >> 3], - PM3ByAperture1Mode); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM3ByAperture2Mode >> 3], - PM3ByAperture2Mode); - - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[ChipConfig >> 3], ChipConfig); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture0 >> 3], Aperture0); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture1 >> 3], Aperture1); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[DFIFODis >> 3], DFIFODis); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[FIFODis >> 3], FIFODis); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVideoControl >> 3], - PMVideoControl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHbEnd >> 3], PMHgEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMScreenBase >> 3], PMScreenBase); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VClkCtl >> 3], VClkCtl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMScreenStride >> 3], - PMScreenStride); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHTotal >> 3], PMHTotal); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHbEnd >> 3], PMHbEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHsStart >> 3], PMHsStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHsEnd >> 3], PMHsEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVTotal >> 3], PMVTotal); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVbEnd >> 3], PMVbEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsStart >> 3], PMVsStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsEnd >> 3], PMVsEnd); -#if 0 /* Currently commented out while testing Flat Panel support */ - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VSConfiguration >> 3], VSConfiguration); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VSBBase >> 3], VSBBase); -#endif + /* We can't rely on the vgahw layer copying the font information + * back properly, due to problems with MMIO access to VGA space + * so we memcpy the information using the slow routines */ + if (pGlint->STATE) + xf86SlowBcopy((CARD8*)pGlint->VGAdata, (CARD8*)pGlint->FbBase, 65536); + + if ((pGlint->numMultiDevices == 2) || (IS_J2000)) { + RESTOREREG(GCSRAperture); + } - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PM2VDACRDIndexControl >> 3], PM2VDACRDIndexControl); + if (pGlint->MultiAperture) { + RESTOREREG(GMultGLINTAperture); + RESTOREREG(GMultGLINT1); + RESTOREREG(GMultGLINT2); + } - Permedia2vOutIndReg(pScrn, PM2VDACRDOverlayKey, 0x00, - glintReg->DacRegs[PM2VDACRDOverlayKey]); - Permedia2vOutIndReg(pScrn, PM2VDACRDSyncControl, 0x00, - glintReg->DacRegs[PM2VDACRDSyncControl]); - Permedia2vOutIndReg(pScrn, PM2VDACRDMiscControl, 0x00, - glintReg->DacRegs[PM2VDACRDMiscControl]); - Permedia2vOutIndReg(pScrn, PM2VDACRDDACControl, 0x00, - glintReg->DacRegs[PM2VDACRDDACControl]); - Permedia2vOutIndReg(pScrn, PM2VDACRDPixelSize, 0x00, - glintReg->DacRegs[PM2VDACRDPixelSize]); - Permedia2vOutIndReg(pScrn, PM2VDACRDColorFormat, 0x00, - glintReg->DacRegs[PM2VDACRDColorFormat]); + /* Permedia 3 memory Timings */ + RESTOREREG(PM3MemBypassWriteMask); + RESTOREREG(PM3ByAperture1Mode); + RESTOREREG(PM3ByAperture2Mode); + RESTOREREG(ChipConfig); + RESTOREREG(Aperture0); + RESTOREREG(Aperture1); + RESTOREREG(PM3FifoControl); + if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) + RESTOREREG(DFIFODis); + RESTOREREG(FIFODis); + RESTOREREG(PMVideoControl); + RESTOREREG(PMHbEnd); + RESTOREREG(PMHgEnd); + RESTOREREG(PMScreenBase); + RESTOREREG(VClkCtl); + RESTOREREG(PMScreenStride); + RESTOREREG(PMHTotal); + RESTOREREG(PMHsStart); + RESTOREREG(PMHsEnd); + RESTOREREG(PMVTotal); + RESTOREREG(PMVbEnd); + RESTOREREG(PMVsStart); + RESTOREREG(PMVsEnd); + + if (pGlint->UseFlatPanel) { + RESTOREREG(VSConfiguration); + RESTOREREG(VSBBase); + } + + RESTOREREG(PM2VDACRDIndexControl); + P2VOUT(PM2VDACRDOverlayKey); + P2VOUT(PM2VDACRDSyncControl); + P2VOUT(PM2VDACRDMiscControl); + P2VOUT(PM2VDACRDDACControl); + P2VOUT(PM2VDACRDPixelSize); + P2VOUT(PM2VDACRDColorFormat); for (i=0;i<768;i++) { Permedia2WriteAddress(pScrn, i); - Permedia2WriteData(pScrn, glintReg->cmap[i]); + Permedia2WriteData(pScrn, pReg->cmap[i]); } temp = Permedia2vInIndReg(pScrn, PM2VDACIndexClockControl) & 0xFC; - Permedia2vOutIndReg(pScrn, PM2VDACRDDClk0PreScale, 0x00, - glintReg->DacRegs[PM2VDACRDDClk0PreScale]); - Permedia2vOutIndReg(pScrn, PM2VDACRDDClk0FeedbackScale, 0x00, - glintReg->DacRegs[PM2VDACRDDClk0FeedbackScale]); - Permedia2vOutIndReg(pScrn, PM2VDACRDDClk0PostScale, 0x00, - glintReg->DacRegs[PM2VDACRDDClk0PostScale]); + P2VOUT(PM2VDACRDDClk0PreScale); + P2VOUT(PM2VDACRDDClk0FeedbackScale); + P2VOUT(PM2VDACRDDClk0PostScale); Permedia2vOutIndReg(pScrn, PM2VDACIndexClockControl, 0x00, temp|0x03); +} + +void Permedia3LoadPalette( + ScrnInfoPtr pScrn, + int numColors, + int *indices, + LOCO *colors, + VisualPtr pVisual +){ +#if 0 /* NOT YET */ + GLINTPtr pGlint = GLINTPTR(pScrn); +#endif + int i, index, shift = 0, j, repeat = 1; + + if (pScrn->depth == 15) { + repeat = 8; + shift = 3; + } + + for(i = 0; i < numColors; i++) { + index = indices[i]; + for (j = 0; j < repeat; j++) { + Permedia2WriteAddress(pScrn, (index << shift)+j); + Permedia2WriteData(pScrn, colors[index].red); + Permedia2WriteData(pScrn, colors[index].green); + Permedia2WriteData(pScrn, colors[index].blue); + } + /* for video i/o */ +#if 0 /* NOT YET */ + GLINT_SLOW_WRITE_REG(index, PM3LUTIndex); + GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | + ((colors[index].green & 0xFF) << 8) | + ((colors[index].blue & 0xFF) << 16), + PM3LUTData); +#endif + } +} + +/* special one for 565 mode */ +void Permedia3LoadPalette16( + ScrnInfoPtr pScrn, + int numColors, + int *indices, + LOCO *colors, + VisualPtr pVisual +){ +#if 0 /* NOT YET */ + GLINTPtr pGlint = GLINTPTR(pScrn); +#endif + int i, index, j; + + for(i = 0; i < numColors; i++) { + index = indices[i]; + for (j = 0; j < 4; j++) { + Permedia2WriteAddress(pScrn, (index << 2)+j); + Permedia2WriteData(pScrn, colors[index >> 1].red); + Permedia2WriteData(pScrn, colors[index].green); + Permedia2WriteData(pScrn, colors[index >> 1].blue); + } +#if 0 /* NOT YET */ + GLINT_SLOW_WRITE_REG(index, PM3LUTIndex); + GLINT_SLOW_WRITE_REG((colors[index].red & 0xFF) | + ((colors[index].green & 0xFF) << 8) | + ((colors[index].blue & 0xFF) << 16), + PM3LUTData); +#endif + + if(index <= 31) { + for (j = 0; j < 4; j++) { + Permedia2WriteAddress(pScrn, (index << 3)+j); + Permedia2WriteData(pScrn, colors[index].red); + Permedia2WriteData(pScrn, colors[(index << 1) + 1].green); + Permedia2WriteData(pScrn, colors[index].blue); + } + } + } } Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h:1.3 Tue Oct 17 05:07:05 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h Tue May 8 15:31:22 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.3 2000/10/17 09:07:05 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_regs.h,v 1.7 2001/05/08 19:31:22 alanh Exp $ */ /* * glint register file @@ -157,22 +157,81 @@ #define PM3MiscControl 0x3088 #define PM3VideoOverlayUpdate 0x3100 + #define PM3VideoOverlayUpdate_DISABLE (0<<0) + #define PM3VideoOverlayUpdate_ENABLE (1<<0) #define PM3VideoOverlayMode 0x3108 #define PM3VideoOverlayMode_DISABLE (0<<0) #define PM3VideoOverlayMode_ENABLE (1<<0) - /* ... */ + #define PM3VideoOverlayMode_BUFFERSYNC_MANUAL (0<<1) + #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMA (1<<1) + #define PM3VideoOverlayMode_BUFFERSYNC_VIDEOSTREAMB (2<<1) + #define PM3VideoOverlayMode_FIELDPOLARITY_NORMAL (0<<4) + #define PM3VideoOverlayMode_FIELDPOLARITY_INVERT (1<<4) + #define PM3VideoOverlayMode_PIXELSIZE_8BIT (0<<5) + #define PM3VideoOverlayMode_PIXELSIZE_16BIT (1<<5) + #define PM3VideoOverlayMode_PIXELSIZE_32BIT (2<<5) + #define PM3VideoOverlayMode_COLORFORMAT_RGB8888 ((0<<7)|(1<<12)|(2<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_RGB4444 ((1<<7)|(1<<12)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_RGB5551 ((2<<7)|(1<<12)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_RGB565 ((3<<7)|(1<<12)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_RGB332 ((4<<7)|(1<<12)|(0<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR8888 ((0<<7)|(2<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR4444 ((1<<7)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR5551 ((2<<7)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR565 ((3<<7)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_BGR332 ((4<<7)|(0<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_CI8 ((5<<7)|(1<<12)|(0<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_VUY444 ((2<<10)|(1<<12)|(2<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_YUV444 ((2<<10)|(2<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_VUY422 ((1<<10)|(1<<12)|(1<<5)) + #define PM3VideoOverlayMode_COLORFORMAT_YUV422 ((1<<10)|(1<<5)) + #define PM3VideoOverlayMode_COLORORDER_BGR (0<<12) + #define PM3VideoOverlayMode_COLORORDER_RGB (1<<12) + #define PM3VideoOverlayMode_LINEARCOLOREXT_OFF (0<<13) + #define PM3VideoOverlayMode_LINEARCOLOREXT_ON (1<<13) + #define PM3VideoOverlayMode_FILTER_MASK (3<<14) + #define PM3VideoOverlayMode_FILTER_OFF (0<<14) + #define PM3VideoOverlayMode_FILTER_FULL (1<<14) + #define PM3VideoOverlayMode_FILTER_PARTIAL (2<<14) + #define PM3VideoOverlayMode_DEINTERLACE_OFF (0<<16) + #define PM3VideoOverlayMode_DEINTERLACE_BOB (1<<16) + #define PM3VideoOverlayMode_PATCHMODE_OFF (0<<18) + #define PM3VideoOverlayMode_PATCHMODE_ON (1<<18) + #define PM3VideoOverlayMode_FLIP_VIDEO (0<<20) + #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMA (1<<20) + #define PM3VideoOverlayMode_FLIP_VIDEOSTREAMB (2<<20) + #define PM3VideoOverlayMode_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 #define PM3VideoOverlayStride 0x3138 + #define PM3VideoOverlayStride_STRIDE(s) (((s)&0xfff)<<0) #define PM3VideoOverlayWidth 0x3140 + #define PM3VideoOverlayWidth_WIDTH(w) (((w)&0xfff)<<0) #define PM3VideoOverlayHeight 0x3148 + #define PM3VideoOverlayHeight_HEIGHT(h) (((h)&0xfff)<<0) #define PM3VideoOverlayOrigin 0x3150 + #define PM3VideoOverlayOrigin_XORIGIN(x) (((x)&0xfff)<<0) + #define PM3VideoOverlayOrigin_YORIGIN(y) (((y)&0xfff)<<16) #define PM3VideoOverlayShrinkXDelta 0x3158 + #define PM3VideoOverlayShrinkXDelta_NONE (1<<16) + #define PM3VideoOverlayShrinkXDelta_DELTA(s,d) \ + ((((s)<<16)/(d))&0x0ffffff0) #define PM3VideoOverlayZoomXDelta 0x3160 + #define PM3VideoOverlayZoomXDelta_NONE (1<<16) + #define PM3VideoOverlayZoomXDelta_DELTA(s,d) \ + ((((s)<<16)/(d))&0x0001fff0) #define PM3VideoOverlayYDelta 0x3168 + #define PM3VideoOverlayYDelta_NONE (1<<16) + #define PM3VideoOverlayYDelta_DELTA(s,d) \ + ((((s)<<16)/(d))&0x0ffffff0) #define PM3VideoOverlayFieldOffset 0x3170 #define PM3VideoOverlayStatus 0x3178 @@ -314,6 +373,19 @@ #define PM3RD_Scratch 0x01f #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) + #define PM3RD_VideoOverlayControl_MODE_BLEND (3<<1) + #define PM3RD_VideoOverlayControl_DIRECTCOLOR_DISABLED (0<<3) + #define PM3RD_VideoOverlayControl_DIRECTCOLOR_ENABLED (1<<3) + #define PM3RD_VideoOverlayControl_BLENDSRC_MAIN (0<<4) + #define PM3RD_VideoOverlayControl_BLENDSRC_REGISTER (1<<4) + #define PM3RD_VideoOverlayControl_KEY_COLOR (0<<5) + #define PM3RD_VideoOverlayControl_KEY_ALPHA (1<<5) #define PM3RD_VideoOverlayXStartLow 0x021 #define PM3RD_VideoOverlayXStartHigh 0x022 #define PM3RD_VideoOverlayYStartLow 0x023 @@ -326,6 +398,10 @@ #define PM3RD_VideoOverlayKeyG 0x02a #define PM3RD_VideoOverlayKeyB 0x02b #define PM3RD_VideoOverlayBlend 0x02c + #define PM3RD_VideoOverlayBlend_FACTOR_0_PERCENT (0<<6) + #define PM3RD_VideoOverlayBlend_FACTOR_25_PERCENT (1<<6) + #define PM3RD_VideoOverlayBlend_FACTOR_75_PERCENT (2<<6) + #define PM3RD_VideoOverlayBlend_FACTOR_100_PERCENT (3<<6) #define PM3RD_DClkSetup1 0x1f0 #define PM3RD_DClkSetup2 0x1f1 @@ -698,7 +774,7 @@ #define PM3LUT 0x8e80 #define PM3LUTAddress 0x84d0 #define PM3LUTData 0x84c8 -#define PM3LUTIndex 0x64c0 +#define PM3LUTIndex 0x84c0 #define PM3LUTMode 0xb378 #define PM3LUTModeAnd 0xad70 #define PM3LUTModeOr 0xad78 @@ -840,6 +916,23 @@ #define PM3TextureIndexMode1And 0xb3d0 #define PM3TextureIndexMode1Or 0xb3d8 /* ... */ +#define PM3TextureMapSize 0xb428 +#define PM3TextureMapWidth0 0x8580 +#define PM3TextureMapWidth1 0x8588 + #define PM3TextureMapWidth_Width(w) ((w&0xfff)<<0) + #define PM3TextureMapWidth_BorderLayout (1<<12) + #define PM3TextureMapWidth_Layout_Linear (0<<13) + #define PM3TextureMapWidth_Layout_Patch64 (1<<13) + #define PM3TextureMapWidth_Layout_Patch32_2 (2<<13) + #define PM3TextureMapWidth_Layout_Patch2 (3<<13) + #define PM3TextureMapWidth_HostTexture (1<<15) +#define PM3TextureReadMode0 0xb400 +#define PM3TextureReadMode0And 0xac30 +#define PM3TextureReadMode0Or 0xac38 +#define PM3TextureReadMode1 0xb408 +#define PM3TextureReadMode1And 0xad40 +#define PM3TextureReadMode1Or 0xad48 +/* ... */ #define PM3WaitForCompletion 0x80b8 #define PM3Window 0x8980 #define PM3Window_ForceLBUpdate 1<<3 @@ -955,11 +1048,6 @@ #define PM3FillRectanglePosition_XOffset(x) ((x)&0xffff) #define PM3FillRectanglePosition_YOffset(y) (((y)&0xffff)<<16) -/********************************************** -* GLINT Permedia3 Tags and other stuff * -***********************************************/ -#define PM3SyncTag 0x0188 - #if 0 /********************************************** @@ -985,16 +1073,6 @@ temp = READ_REG(base,offset); \ WRITE_REG(base,offset,temp&(~(val))); \ } - -#if 0 /* Old Xfree code ... */ -#define WAIT(n) \ -do{ \ - if(!pGlint->UsePCIRetry) \ - while(READ_REG(InFIFOSpace)<(n)){ \ - mem_barrier(); \ - } \ -}while(0) -#endif #define RAMDAC_DELAY(b,x) do { \ int delay = x; \ Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c:1.6 --- /dev/null Mon Jun 4 12:40:52 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c Tue May 8 15:31:22 2001 @@ -0,0 +1,1581 @@ +/* + * Permedia 3 Xv Driver + * + * Copyright (C) 2001 Sven Luther <luther@dpt-info.u-strasbg.fr> + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * + * Based on work of Michael H. Schimek <m.schimek@netway.at> + */ + +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm3_video.c,v 1.6 2001/05/08 19:31:22 alanh Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Pci.h" +#include "xf86PciInfo.h" +#include "xf86Xinput.h" +#include "xf86fbman.h" +#include "xf86xv.h" +#include "Xv.h" +#include "regionstr.h" +#include "xaa.h" +#include "xaalocal.h" + +#include "glint_regs.h" +#include "pm3_regs.h" +#include "glint.h" + +#define DEBUG(x) +#define USE_HARDWARE_COPY 1 +#define SUPPORT_CLIPPING 1 +#define BLACKNESS_WORKAROUND 1 + +#ifndef XvExtension + +void Permedia3VideoInit(ScreenPtr pScreen) {} +void Permedia3VideoUninit(ScrnInfoPtr pScrn) {} +void Permedia3VideoEnterVT(ScrnInfoPtr pScrn) {} +void Permedia3VideoLeaveVT(ScrnInfoPtr pScrn) {} + +#else + +#undef MIN +#undef ABS +#undef CLAMP +#undef ENTRIES + +#define MIN(a, b) (((a) < (b)) ? (a) : (b)) +#define ABS(n) (((n) < 0) ? -(n) : (n)) +#define CLAMP(v, min, max) (((v) < (min)) ? (min) : MIN(v, max)) +#define ENTRIES(array) (sizeof(array) / sizeof((array)[0])) + +enum { + OVERLAY_DATA_NONE, + OVERLAY_DATA_COLORKEY, + OVERLAY_DATA_ALPHAKEY, + OVERLAY_DATA_ALPHABLEND +} ; + +#define MAX_BUFFERS 3 + +typedef struct _PortPrivRec { + struct _AdaptorPrivRec * pAdaptor; + + /* Sync function */ + void (*Sync) (ScrnInfoPtr pScrn); + + /* Attributes */ + INT32 ColorKey; + INT32 OverlayAlpha; + INT32 OverlayMode; + INT32 Attribute[3]; + + /* Clipping */ + RegionRec clip; + +#if 0 /* Adding this cause the server to crash if we minimize the video */ + /* Frame counter */ + char Frames; +#endif + + /* Ramdac save values, ... */ + INT32 ramdac_x, ramdac_w; + INT32 ramdac_y, ramdac_h; + Bool ramdac_on; + + /* Buffers */ + int Id, Format; + int FB_Shift, Video_Shift; + short display, copy; + FBAreaPtr Buffer[MAX_BUFFERS]; + CARD32 BufferBase[MAX_BUFFERS]; + + /* Buffer and Drawable size and position */ + INT32 vx, vy, vw, vh; /* 12.10 fp */ + int dx, dy, dw, dh; + + /* Timer stuff */ + OsTimerPtr Timer; + Bool TimerInUse; + int Delay, Instant, StopDelay; + +} PortPrivRec, *PortPrivPtr; + +typedef struct _AdaptorPrivRec { + struct _AdaptorPrivRec * Next; + ScrnInfoPtr pScrn; + PortPrivPtr pPort; +} AdaptorPrivRec, *AdaptorPrivPtr; + +static AdaptorPrivPtr AdaptorPrivList = NULL; + +/* + * Proprietary Attributes + */ + +#define XV_FILTER "XV_FILTER" +/* We support 3 sorts of filters : + * 0 : None. + * 1 : Partial (only in the X directrion). + * 2 : Full (incompatible with X mirroring). + */ + +#define XV_MIRROR "XV_MIRROR" +/* We also support mirroring of the image : + * bit 0 : if set, will mirror in the X direction + * (incompatible with full filtering). + * bit 1 : if set, will mirror in the Y direction. + */ + +#define XV_ALPHA "XV_ALPHA" +/* We support the following alpha blend factors : + * 0 -> 0% Video, 100% Framebuffer + * 1 -> 25% Video, 75% Framebuffer + * 2 -> 75% Video, 25% Framebuffer + * 3 -> 100% Video, 0% Framebuffer + */ + +static XF86AttributeRec +ScalerAttributes[] = +{ + { XvSettable | XvGettable, 0, 2, XV_FILTER }, + { XvSettable | XvGettable, 0, 3, XV_MIRROR }, + { XvSettable | XvGettable, 0, 3, XV_ALPHA }, +}; + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvFilter, xvMirror, xvAlpha; + + +/* Scaler */ + +static XF86VideoEncodingRec +ScalerEncodings[] = +{ + { 0, "XV_IMAGE", 2047, 2047, { 1, 1 }}, +}; + +static XF86VideoFormatRec +ScalerVideoFormats[] = +{ + { 8, TrueColor }, /* Dithered */ + { 15, TrueColor }, + { 16, TrueColor }, + { 24, TrueColor }, +}; + +/* + * FOURCC from http://www.webartz.com/fourcc + * Generic GUID for legacy FOURCC XXXXXXXX-0000-0010-8000-00AA00389B71 + */ +#define LE4CC(a,b,c,d) (((CARD32)(a)&0xFF)|(((CARD32)(b)&0xFF)<<8)|(((CARD32)(c)&0xFF)<<16)|(((CARD32)(d)&0xFF)<<24)) +#define GUID4CC(a,b,c,d) { a,b,c,d,0,0,0,0x10,0x80,0,0,0xAA,0,0x38,0x9B,0x71 } + +#define NoOrder LSBFirst + +static XF86ImageRec +ScalerImages[] = +{ + /* Planar YVU 4:2:0 (emulated) */ + { LE4CC('Y','V','1','2'), XvYUV, NoOrder, GUID4CC('Y','V','1','2'), + 12, XvPlanar, 3, 0, 0, 0, 0, + 8, 8, 8, 1, 2, 2, 1, 2, 2, "YVU", XvTopToBottom }, + + /* Packed YUYV 4:2:2 */ + { LE4CC('Y','U','Y','2'), XvYUV, NoOrder, GUID4CC('Y','U','Y','2'), + 16, XvPacked, 1, 0, 0, 0, 0, + 8, 8, 8, 1, 2, 2, 1, 1, 1, "YUYV", XvTopToBottom }, + + /* Packed UYVY 4:2:2 */ + { LE4CC('U','Y','V','Y'), XvYUV, NoOrder, GUID4CC('U','Y','V','Y'), + 16, XvPacked, 1, 0, 0, 0, 0, + 8, 8, 8, 1, 2, 2, 1, 1, 1, "UYVY", XvTopToBottom }, + + /* Packed YUVA 4:4:4 */ + { LE4CC('Y','U','V','A') /* XXX not registered */, XvYUV, LSBFirst, { 0 }, + 32, XvPacked, 1, 0, 0, 0, 0, + 8, 8, 8, 1, 1, 1, 1, 1, 1, "YUVA", XvTopToBottom }, + + /* Packed VUYA 4:4:4 */ + { LE4CC('V','U','Y','A') /* XXX not registered */, XvYUV, LSBFirst, { 0 }, + 32, XvPacked, 1, 0, 0, 0, 0, + 8, 8, 8, 1, 1, 1, 1, 1, 1, "VUYA", XvTopToBottom }, + + /* RGBA 8:8:8:8 */ + { 0x41, XvRGB, LSBFirst, { 0 }, + 32, XvPacked, 1, 24, 0x0000FF, 0x00FF00, 0xFF0000, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGBA", XvTopToBottom }, + + /* RGB 5:6:5 */ + { 0x42, XvRGB, LSBFirst, { 0 }, + 16, XvPacked, 1, 16, 0x001F, 0x07E0, 0xF800, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGB", XvTopToBottom }, + + /* RGBA 5:5:5:1 */ + { 0x43, XvRGB, LSBFirst, { 0 }, + 16, XvPacked, 1, 15, 0x001F, 0x03E0, 0x7C00, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGBA", XvTopToBottom }, + + /* RGBA 4:4:4:4 */ + { 0x44, XvRGB, LSBFirst, { 0 }, + 16, XvPacked, 1, 12, 0x000F, 0x00F0, 0x0F00, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGBA", XvTopToBottom }, + + /* RGB 3:3:2 */ + { 0x46, XvRGB, NoOrder, { 0 }, + 8, XvPacked, 1, 8, 0x07, 0x38, 0xC0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "RGB", XvTopToBottom }, + + /* BGRA 8:8:8:8 */ + { 0x47, XvRGB, LSBFirst, { 0 }, + 32, XvPacked, 1, 24, 0xFF0000, 0x00FF00, 0x0000FF, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGRA", XvTopToBottom }, + + /* BGR 5:6:5 */ + { 0x48, XvRGB, LSBFirst, { 0 }, + 16, XvPacked, 1, 16, 0xF800, 0x07E0, 0x001F, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGR", XvTopToBottom }, + + /* BGRA 5:5:5:1 */ + { 0x49, XvRGB, LSBFirst, { 0 }, + 16, XvPacked, 1, 15, 0x7C00, 0x03E0, 0x001F, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGRA", XvTopToBottom }, + + /* BGRA 4:4:4:4 */ + { 0x4A, XvRGB, LSBFirst, { 0 }, + 16, XvPacked, 1, 12, 0x0F00, 0x00F0, 0x000F, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGRA", XvTopToBottom }, + + /* BGR 2:3:3 */ + { 0x4C, XvRGB, NoOrder, { 0 }, + 8, XvPacked, 1, 8, 0xC0, 0x38, 0x07, + 0, 0, 0, 0, 0, 0, 0, 0, 0, "BGR", XvTopToBottom }, +}; +/* + * Buffer management + */ + +static void +RemoveBufferCallback(FBAreaPtr Buffer) +{ + 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 +FreeBuffers(PortPrivPtr pPPriv, Bool from_timer) +{ + int i = -1; + + if (!from_timer) { + if (pPPriv->TimerInUse) { + pPPriv->TimerInUse = FALSE; + TimerCancel(pPPriv->Timer); + } + } + + pPPriv->display = -1; + pPPriv->copy = -1; + for (i=0; i < MAX_BUFFERS; i++) + if (pPPriv->Buffer[i]) { + xf86FreeOffscreenArea (pPPriv->Buffer[i]); + pPPriv->Buffer[i] = NULL; + } +} + +static CARD32 +TimerCallback(OsTimerPtr pTim, CARD32 now, pointer p) +{ + PortPrivPtr pPPriv = (PortPrivPtr) p; + + if (pPPriv->StopDelay >= 0) { + if (!(pPPriv->StopDelay--)) { + FreeBuffers(pPPriv, TRUE); + pPPriv->TimerInUse = FALSE; + } + } + + if (pPPriv->TimerInUse) + return pPPriv->Instant; + + return 0; /* Cancel */ +} + +static int +AllocateBuffers(PortPrivPtr pPPriv, int w_bpp, int h) +{ + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + ScrnInfoPtr pScrn = pAPriv->pScrn; + int i = -1; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "We try to allocate a %dx%d buffer.\n", w_bpp, h)); + /* we start a timer to free the buffers if they are nto used within + * 5 seconds (pPPriv->Delay * pPPriv->Instant) */ + pPPriv->StopDelay = pPPriv->Delay; + if (!pPPriv->TimerInUse) { + pPPriv->TimerInUse = TRUE; + TimerSet(pPPriv->Timer, 0, 80, TimerCallback, pAPriv); + } + + for (i=0; i < MAX_BUFFERS + && (i == pPPriv->display || i == pPPriv->copy); i++); + + if (pPPriv->Buffer[i]) { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Buffer %d exists.\n", i)); + if ((pPPriv->Buffer[i]->box.x2 - pPPriv->Buffer[i]->box.x1) == w_bpp && + (pPPriv->Buffer[i]->box.y2 - pPPriv->Buffer[i]->box.y1) == h) { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Buffer %d is of the good size, let's use it.\n", i)); + return (pPPriv->copy = i); + } + else if (xf86ResizeOffscreenArea (pPPriv->Buffer[i], w_bpp, h)) { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "I was able to resize buffer %d, let's use it.\n", i)); + pPPriv->BufferBase[i] = + ((pPPriv->Buffer[i]->box.y1 * pScrn->displayWidth) + + pPPriv->Buffer[i]->box.x1)<<pPPriv->FB_Shift; + return (pPPriv->copy = i); + } + else { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "I was not able to resize buffer %d.\n", i)); + xf86FreeOffscreenArea (pPPriv->Buffer[i]); + pPPriv->Buffer[i] = NULL; + } + } + if ((pPPriv->Buffer[i] = xf86AllocateOffscreenArea (pScrn->pScreen, + w_bpp, h, 4 >> pPPriv->FB_Shift, NULL, NULL, (pointer) pPPriv))) { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Sucessfully allocated buffer %d, let's use it.\n", i)); + pPPriv->BufferBase[i] = + ((pPPriv->Buffer[i]->box.y1 * pScrn->displayWidth) + + pPPriv->Buffer[i]->box.x1)<<pPPriv->FB_Shift; + return (pPPriv->copy = i); + } + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Unable to allocate a buffer.\n")); + return -1; +} + +/* + * Xv interface + */ + +#if USE_HARDWARE_COPY +static void +HWCopySetup(PortPrivPtr pPPriv, int x, int y, int w, int h) +{ + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + ScrnInfoPtr pScrn = pAPriv->pScrn; + GLINTPtr pGlint = GLINTPTR(pScrn); + DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "x = %d, y = %d, w = %d, h = %d.\n", x, y, w, h)); + + GLINT_WAIT(4); + GLINT_WRITE_REG(0xffffffff, FBHardwareWriteMask); + GLINT_WRITE_REG( + PM3Config2D_ForegroundROPEnable | + PM3Config2D_ForegroundROP(GXcopy) | + PM3Config2D_FBWriteEnable, + PM3Config2D); + GLINT_WRITE_REG( + PM3RectanglePosition_XOffset(x) | + PM3RectanglePosition_YOffset(y), + PM3RectanglePosition); + GLINT_WRITE_REG( + PM3Render2D_SpanOperation | + PM3Render2D_XPositive | + PM3Render2D_YPositive | + PM3Render2D_Operation_SyncOnHostData | + PM3Render2D_Width(w) | PM3Render2D_Height(h), + PM3Render2D); +} +static void +HWCopyYV12(PortPrivPtr pPPriv, CARD8 *Y, int w, int h) +{ + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + ScrnInfoPtr pScrn = pAPriv->pScrn; + GLINTPtr pGlint = GLINTPTR(pScrn); + int Y_size = w * h; + CARD8 *V = Y + Y_size; + CARD8 *U = V + (Y_size >> 2); + CARD32 *dst; + int dwords, i, x; + + dwords = Y_size >> 1; + + x = 0; + while (dwords >= pGlint->FIFOSize) { + dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + GLINT_WAIT(pGlint->FIFOSize); + /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + for (i = pGlint->FIFOSize - 1; i; i--, Y += 2, U++, V++, dst++, x++) { + /* mmm, i don't know if this is really needed, as we perform + * endianess inversion as usual, let's check it before removing */ +#if X_BYTE_ORDER == X_BIG_ENDIAN + *dst = V[0] + (Y[1] << 8) + (U[0] << 16) + (Y[0] << 24); +#else + *dst = Y[0] + (U[0] << 8) + (Y[1] << 16) + (V[0] << 24); +#endif + if (x == w>>1) { U -= w>>1; V -= w>>1; } + if (x == w) x = 0; + } + dwords -= pGlint->FIFOSize - 1; + } + if (dwords) { + dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + GLINT_WAIT(dwords + 1); + /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ + GLINT_WRITE_REG(((dwords - 1) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + for (i = dwords; i; i--, Y += 2, U++, V++, dst++, x++) { + /* mmm, i don't know if this is really needed, as we perform + * endianess inversion as usual, let's check it before removing */ +#if X_BYTE_ORDER == X_BIG_ENDIAN + *dst = V[0] + (Y[1] << 8) + (U[0] << 16) + (Y[0] << 24); +#else + *dst = Y[0] + (U[0] << 8) + (Y[1] << 16) + (V[0] << 24); +#endif + if (x == w>>1) { U -= w>>1; V -= w>>1; } + if (x == w) x = 0; + } + } +} +static void +HWCopyFlat(PortPrivPtr pPPriv, CARD8 *src, int w, int h) +{ + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + ScrnInfoPtr pScrn = pAPriv->pScrn; + GLINTPtr pGlint = GLINTPTR(pScrn); + int size = w * h; + int pitch = pScrn->displayWidth<<pPPriv->FB_Shift; + CARD32 *dst; + CARD8 *tmp_src; + int dwords, i; + + if (w == pitch) { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "HWCopyFlat : src = %08x, w = pitch = %d, h = %d.\n", + src, w, h)); + dwords = size >> pPPriv->Video_Shift; + while (dwords >= pGlint->FIFOSize) { + dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + GLINT_WAIT(pGlint->FIFOSize); + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + for (i = pGlint->FIFOSize - 1; i; i--, dst++, src++) *dst = *src; + dwords -= pGlint->FIFOSize - 1; + } + if (dwords) { + dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + GLINT_WAIT(dwords + 1); + GLINT_WRITE_REG(((dwords - 1) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + for (i = dwords; i; i--, dst++, src++) *dst = *src; + } + } else { + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "HWCopyFlat : src = %08x, w = %d, pitch = %d, h = %d.\n", + src, w, pitch, h)); + while (h) { + tmp_src = src; + dwords = w >> pPPriv->Video_Shift; + while (dwords >= pGlint->FIFOSize) { + dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + GLINT_WAIT(pGlint->FIFOSize); + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + for (i = pGlint->FIFOSize - 1; i; i--, dst++, src++) *dst = *src; + dwords -= pGlint->FIFOSize - 1; + } + if (dwords) { + dst = (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4); + GLINT_WAIT(dwords + 1); + GLINT_WRITE_REG(((dwords - 1) << 16) | (0x15 << 4) | + 0x05, OutputFIFO); + for (i = dwords; i; i--, dst++, src++) *dst = *src; + } + src = tmp_src + pitch; + } + } +} +#else +static void +CopyYV12(CARD8 *Y, CARD32 *dst, int width, int height, int pitch) +{ + int Y_size = width * height; + CARD8 *V = Y + Y_size; + CARD8 *U = V + (Y_size >> 2); + int pad = (pitch >> 2) - (width >> 1); + int x; + + width >>= 1; + + for (height >>= 1; height > 0; height--) { + for (x = 0; x < width; Y += 2, x++) +#if X_BYTE_ORDER == X_BIG_ENDIAN + *dst++ = V[x] + (Y[1] << 8) + (U[x] << 16) + (Y[0] << 24); +#else + *dst++ = Y[0] + (U[x] << 8) + (Y[1] << 16) + (V[x] << 24); +#endif + dst += pad; + for (x = 0; x < width; Y += 2, x++) +#if X_BYTE_ORDER == X_BIG_ENDIAN + *dst++ = V[x] + (Y[1] << 8) + (U[x] << 16) + (Y[0] << 24); +#else + *dst++ = Y[0] + (U[x] << 8) + (Y[1] << 16) + (V[x] << 24); +#endif + dst += pad; + U += width; + V += width; + } +} + +static void +CopyFlat(CARD8 *src, CARD8 *dst, int width, int height, int pitch) +{ + if (width == pitch) { + memcpy(dst, src, width * height); + return; + } + + while (height > 0) { + memcpy(dst, src, width); + dst += pitch; + src += width; + height--; + } +} +#endif + +#define FORMAT_RGB8888 PM3VideoOverlayMode_COLORFORMAT_RGB8888 +#define FORMAT_RGB4444 PM3VideoOverlayMode_COLORFORMAT_RGB4444 +#define FORMAT_RGB5551 PM3VideoOverlayMode_COLORFORMAT_RGB5551 +#define FORMAT_RGB565 PM3VideoOverlayMode_COLORFORMAT_RGB565 +#define FORMAT_RGB332 PM3VideoOverlayMode_COLORFORMAT_RGB332 +#define FORMAT_BGR8888 PM3VideoOverlayMode_COLORFORMAT_BGR8888 +#define FORMAT_BGR4444 PM3VideoOverlayMode_COLORFORMAT_BGR4444 +#define FORMAT_BGR5551 PM3VideoOverlayMode_COLORFORMAT_BGR5551 +#define FORMAT_BGR565 PM3VideoOverlayMode_COLORFORMAT_BGR565 +#define FORMAT_BGR332 PM3VideoOverlayMode_COLORFORMAT_BGR332 +#define FORMAT_CI8 PM3VideoOverlayMode_COLORFORMAT_CI8 +#define FORMAT_VUY444 PM3VideoOverlayMode_COLORFORMAT_VUY444 +#define FORMAT_YUV444 PM3VideoOverlayMode_COLORFORMAT_YUV444 +#define FORMAT_VUY422 PM3VideoOverlayMode_COLORFORMAT_VUY422 +#define FORMAT_YUV422 PM3VideoOverlayMode_COLORFORMAT_YUV422 + +#define RAMDAC_WRITE(data,index) \ +do{ \ + mem_barrier(); \ + GLINT_WAIT(3); \ + mem_barrier(); \ + GLINT_WRITE_REG(((index)>>8)&0xff, PM3RD_IndexHigh); \ + mem_barrier(); \ + GLINT_WRITE_REG((index)&0xff, PM3RD_IndexLow); \ + mem_barrier(); \ + GLINT_WRITE_REG(data, PM3RD_IndexedData); \ + mem_barrier(); \ +}while(0) + +#define RAMDAC_WRITE_OLD(data,index) \ + Permedia2vOutIndReg(pScrn, index, 0x00, data) + +/* Notice, have to check that we dont overflow the deltas here ... */ +static void +compute_scale_factor( + unsigned int* src_w, unsigned int* dst_w, + unsigned int* shrink_delta, unsigned int* zoom_delta) +{ + if (*src_w >= *dst_w) { + *dst_w &= ~0x3; + *shrink_delta = (((*src_w << 16) / *dst_w) & 0x0ffffff0) + 0x10; + *zoom_delta = 1<<16; + } else { + if (*src_w & 0x3) *src_w = (*src_w & ~0x3) + 4; + *shrink_delta = 1<<16; + for (;*dst_w > *src_w; (*dst_w)--) { + *zoom_delta = (*src_w << 16) / *dst_w; + if (((((*zoom_delta&0xf)+1) * *dst_w * *dst_w) >> 16) < *src_w) { + *zoom_delta = ((*zoom_delta & ~0xf) + 0x10) & 0x0001fff0; + return; + } + } + *zoom_delta = 1<<16; + } +} + +static void +BeginOverlay(PortPrivPtr pPPriv, int display) +{ + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + ScrnInfoPtr pScrn = pAPriv->pScrn; + GLINTPtr pGlint = GLINTPTR(pScrn); + unsigned int src_x = pPPriv->vx, dst_x = pPPriv->dx; + unsigned int src_y = pPPriv->vy, dst_y = pPPriv->dy; + unsigned int src_w = pPPriv->vw, dst_w = pPPriv->dw; + unsigned int src_h = pPPriv->vh, dst_h = pPPriv->dh; + unsigned int shrink_delta, zoom_delta; +#if BLACKNESS_WORKAROUND + static int Frames = 50; +#endif + unsigned int stride = + (pScrn->displayWidth << pPPriv->FB_Shift) >> pPPriv->Video_Shift; + + /* Let's overlay only to visible parts of the screen */ + if (pPPriv->dx < pScrn->frameX0) { + dst_w = dst_w - pScrn->frameX0 + dst_x; + dst_x = 0; + src_w = dst_w * pPPriv->vw / pPPriv->dw; + src_x = src_x + pPPriv->vw - src_w; + } else if (pScrn->frameX0 > 0) dst_x = dst_x - pScrn->frameX0; + if (pPPriv->dy < pScrn->frameY0) { + dst_h = dst_h - pScrn->frameY0 + pPPriv->dy; + dst_y = 0; + src_h = dst_h * pPPriv->vh / pPPriv->dh; + src_y = src_y + pPPriv->vh - src_h; + } else if (pScrn->frameY0 > 0) dst_y = dst_y - pScrn->frameY0; + if (dst_x + dst_w > (pScrn->frameX1 - pScrn->frameX0)) { + unsigned int old_w = dst_w; + dst_w = pScrn->frameX1 - pScrn->frameX0 - dst_x; + src_w = dst_w * src_w / old_w; + } + if (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); + +#if BLACKNESS_WORKAROUND + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "BeginOverlay %d (buffer %d)\n", Frames, display)); +#else + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "BeginOverlay (buffer %d)\n", display)); +#endif + if (src_w != pPPriv->vw) + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "BeginOverlay : Padding video width to 4 pixels %d->%d.\n", + pPPriv->vw, src_w)); + if (dst_w != pPPriv->dw) + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "BeginOverlay : Scaling destination width from %d to %d.\n" + "\tThe scaling factor is to high, and may cause problems.\n", + pPPriv->dw, dst_w)); + + if (display != -1) pPPriv->display = display; + +#if BLACKNESS_WORKAROUND + if (++Frames>25) { + Frames = 0; + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Registers (1) : %08x, %08x, %08x, %08x, %08x.\n", + GLINT_READ_REG(PM3VideoOverlayFifoControl), + GLINT_READ_REG(PM3VideoOverlayMode), + GLINT_READ_REG(PM3VideoOverlayBase0), + GLINT_READ_REG(PM3VideoOverlayBase1), + GLINT_READ_REG(PM3VideoOverlayBase2))); + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Registers (2) : %08x, %08x, %08x, %08x.\n", + GLINT_READ_REG(PM3VideoOverlayStride), + GLINT_READ_REG(PM3VideoOverlayWidth), + GLINT_READ_REG(PM3VideoOverlayHeight), + GLINT_READ_REG(PM3VideoOverlayOrigin))); + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Registers (3) : %08x, %08x, %08x, %08x.\n", + GLINT_READ_REG(PM3VideoOverlayYDelta), + GLINT_READ_REG(PM3VideoOverlayShrinkXDelta), + GLINT_READ_REG(PM3VideoOverlayZoomXDelta), + GLINT_READ_REG(PM3VideoOverlayIndex))); + GLINT_WAIT(8); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, + PM3VideoOverlayMode); + } else GLINT_WAIT(7); +#else + GLINT_WAIT(7); +#endif + GLINT_WRITE_REG(3|(12<<16), PM3VideoOverlayFifoControl); + /* Updating the Video Overlay Source Image Parameters */ + GLINT_WRITE_REG( + pPPriv->BufferBase[pPPriv->display]>>pPPriv->Video_Shift, + PM3VideoOverlayBase+(pPPriv->display*8)); + GLINT_WRITE_REG(pPPriv->Format | + PM3VideoOverlayMode_BUFFERSYNC_MANUAL | + PM3VideoOverlayMode_FLIP_VIDEO | + /* Filtering & Mirroring Attributes */ + pPPriv->OverlayMode | + PM3VideoOverlayMode_ENABLE, + PM3VideoOverlayMode); + /* Let's set the source stride. */ + GLINT_WRITE_REG(PM3VideoOverlayStride_STRIDE(stride), + 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(src_h), + PM3VideoOverlayHeight); + GLINT_WRITE_REG( + PM3VideoOverlayOrigin_XORIGIN(src_x) | + PM3VideoOverlayOrigin_YORIGIN(src_y), + PM3VideoOverlayOrigin); + + GLINT_WAIT(5); + /* Scale the source to the destinationsize */ + if (src_h == dst_h) { + GLINT_WRITE_REG( + PM3VideoOverlayYDelta_NONE, + PM3VideoOverlayYDelta); + } else { + GLINT_WRITE_REG( + PM3VideoOverlayYDelta_DELTA(src_h,dst_h), + PM3VideoOverlayYDelta); + } + GLINT_WRITE_REG(shrink_delta, PM3VideoOverlayShrinkXDelta); + GLINT_WRITE_REG(zoom_delta, PM3VideoOverlayZoomXDelta); + GLINT_WRITE_REG(pPPriv->display, PM3VideoOverlayIndex); + GLINT_WRITE_REG(PM3VideoOverlayUpdate_ENABLE, + PM3VideoOverlayUpdate); + + + /* Now set the ramdac video overlay region and mode */ + if ((pPPriv->ramdac_x != dst_x) || (pPPriv->ramdac_w != dst_w)) { + RAMDAC_WRITE((dst_x&0xff), PM3RD_VideoOverlayXStartLow); + RAMDAC_WRITE((dst_x&0xf00)>>8, PM3RD_VideoOverlayXStartHigh); + RAMDAC_WRITE(((dst_x+dst_w)&0xff), PM3RD_VideoOverlayXEndLow); + RAMDAC_WRITE(((dst_x+dst_w)&0xf00)>>8,PM3RD_VideoOverlayXEndHigh); + pPPriv->ramdac_x = dst_x; + pPPriv->ramdac_w = dst_w; + } + if ((pPPriv->ramdac_y != dst_y) || (pPPriv->ramdac_h != dst_h)) { + RAMDAC_WRITE((dst_y&0xff), PM3RD_VideoOverlayYStartLow); + RAMDAC_WRITE((dst_y&0xf00)>>8, PM3RD_VideoOverlayYStartHigh); + RAMDAC_WRITE(((dst_y+dst_h)&0xff), PM3RD_VideoOverlayYEndLow); + RAMDAC_WRITE(((dst_y+dst_h)&0xf00)>>8,PM3RD_VideoOverlayYEndHigh); + pPPriv->ramdac_y = dst_y; + pPPriv->ramdac_h = dst_h; + } + + if (!pPPriv->ramdac_on) { + if (pPPriv->OverlayAlpha<(3<<6)) { + RAMDAC_WRITE(pPPriv->OverlayAlpha, PM3RD_VideoOverlayBlend); + RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | + PM3RD_VideoOverlayControl_MODE_BLEND | + PM3RD_VideoOverlayControl_BLENDSRC_REGISTER, + PM3RD_VideoOverlayControl); + } else { +#if SUPPORT_CLIPPING + switch (pScrn->depth) { + case 8: + case 16: + RAMDAC_WRITE((pPPriv->ColorKey&0xff0000)>>16, + PM3RD_VideoOverlayKeyR); + RAMDAC_WRITE((pPPriv->ColorKey&0x00ff00)>>8, + PM3RD_VideoOverlayKeyG); + RAMDAC_WRITE(pPPriv->ColorKey&0x0000ff, + PM3RD_VideoOverlayKeyB); + RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | + PM3RD_VideoOverlayControl_MODE_MAINKEY | + PM3RD_VideoOverlayControl_KEY_COLOR, + PM3RD_VideoOverlayControl); + break; + case 15: + RAMDAC_WRITE(0x1, PM3RD_VideoOverlayKeyR); + RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | + PM3RD_VideoOverlayControl_MODE_MAINKEY | + PM3RD_VideoOverlayControl_KEY_ALPHA, + PM3RD_VideoOverlayControl); + break; + case 24: + RAMDAC_WRITE(0xff, PM3RD_VideoOverlayKeyR); + RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | + PM3RD_VideoOverlayControl_MODE_MAINKEY | + PM3RD_VideoOverlayControl_KEY_ALPHA, + PM3RD_VideoOverlayControl); + break; + } +#else + RAMDAC_WRITE(PM3RD_VideoOverlayControl_ENABLE | + PM3RD_VideoOverlayControl_MODE_ALWAYS, + PM3RD_VideoOverlayControl); +#endif + } + pPPriv->ramdac_on = TRUE; + } + + pPPriv->Buffer[pPPriv->display]->RemoveAreaCallback = + RemoveBufferCallback; + if (display != -1) pPPriv->copy = -1; +} + +#if SUPPORT_CLIPPING + +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if(num != REGION_NUM_RECTS(B)) + return FALSE; + + if((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || + (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int*)REGION_RECTS(A); + dataB = (int*)REGION_RECTS(B); + + while(num--) { + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } + + return TRUE; +} +static void Clip (PortPrivPtr pPPriv, RegionPtr clipBoxes) +{ + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + ScrnInfoPtr pScrn = pAPriv->pScrn; + + /* Let's handle the clipping here. */ + if(!RegionsEqual(&pPPriv->clip, clipBoxes)) { + REGION_COPY(pScrn->pScreen, &pPPriv->clip, clipBoxes); + if (pPPriv->OverlayAlpha<(3<<6)) { + XAAFillSolidRects(pScrn, pPPriv->OverlayAlpha<<24, GXcopy, + 0xff000000, REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } else { + switch (pScrn->depth) { + case 8: /* CI8 */ + XAAFillSolidRects(pScrn, pPPriv->ColorKey, + GXcopy, 0xffffffff, REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + break; + case 15: /* RGB5551 */ + XAAFillSolidRects(pScrn, 0xffffffff, GXcopy, 0x80008000, + REGION_NUM_RECTS(clipBoxes), REGION_RECTS(clipBoxes)); + break; + case 16: /* RGB565 */ + XAAFillSolidRects(pScrn, pPPriv->ColorKey, GXcopy, + 0xffffffff, REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + break; + case 24: /* RGB8888 */ + XAAFillSolidRects(pScrn, 0xffffffff, GXcopy, + 0xff000000, REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + break; + } + } + } +} +#endif + +static void +StopOverlay(PortPrivPtr pPPriv, int cleanup) +{ + AdaptorPrivPtr pAPriv = pPPriv->pAdaptor; + ScrnInfoPtr pScrn = pAPriv->pScrn; + GLINTPtr pGlint = GLINTPTR(pScrn); + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, "StopOverlay.\n")); + /* Stop the Video Overlay in the RAMDAC */ + if (pPPriv->ramdac_on) { + RAMDAC_WRITE(PM3RD_VideoOverlayControl_DISABLE, + PM3RD_VideoOverlayControl); + pPPriv->ramdac_on = FALSE; + } + /* Stop the Video Overlay in the Video Overlay Unit */ + GLINT_WAIT(1); + GLINT_WRITE_REG(PM3VideoOverlayMode_DISABLE, + PM3VideoOverlayMode); +} +/* ReputImage is used if only the destination position or + * the clipboxes change. */ +static int +Permedia3ReputImage(ScrnInfoPtr pScrn, + short drw_x, short drw_y, + RegionPtr clipBoxes, pointer data) +{ + PortPrivPtr pPPriv = (PortPrivPtr) data; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "ReputImage %d,%d.\n", drw_x, drw_y)); + +#if !SUPPORT_CLIPPING + /* If the clip region is not a rectangle */ + if (REGION_SIZE(clipBoxes) != 0) { + StopOverlay (pPPriv, FALSE); + return Success; + } +#endif + + /* If the buffer was freed, we cannot overlay it. */ + if (pPPriv->display == -1) { + StopOverlay (pPPriv, FALSE); + return Success; + } + + /* Check that the dst area is some part of the visible screen. */ + if ((drw_x + pPPriv->dw) < pScrn->frameX0 || + (drw_y + pPPriv->dh) < pScrn->frameY0 || + drw_x > pScrn->frameX1 || drw_y > pScrn->frameY1) { + return Success; + } + /* Copy the destinations coordinates */ + pPPriv->dx = drw_x; + pPPriv->dy = drw_y; + +#if SUPPORT_CLIPPING + /* Clipping */ + Clip (pPPriv, clipBoxes); +#endif + + /* Restart the overlay */ + BeginOverlay(pPPriv, -1); + + return Success; +} + +static int +Permedia3PutImage(ScrnInfoPtr pScrn, + short src_x, short src_y, short drw_x, short drw_y, + short src_w, short src_h, short drw_w, short drw_h, + int id, unsigned char *buf, short width, short height, + Bool sync, RegionPtr clipBoxes, pointer data) +{ + PortPrivPtr pPPriv = (PortPrivPtr) data; +#if !USE_HARDWARE_COPY + GLINTPtr pGlint = GLINTPTR(pScrn); +#endif + int copy = -1; + Bool copy_flat = TRUE; + int w_bpp; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "PutImage %d,%d,%d,%d -> %d,%d,%d,%d " + "id=0x%08x buf=%p w=%d h=%d sync=%d\n", + src_x, src_y, src_w, src_h, drw_x, drw_y, drw_w, drw_h, + id, buf, width, height, sync)); + +#if !SUPPORT_CLIPPING + /* If the clip region is not a rectangle */ + if (REGION_SIZE(clipBoxes) != 0) { + StopOverlay (pPPriv, FALSE); + return Success; + } +#endif + + /* Check that the src area to put is included in the buffer. */ + if ((src_x + src_w) > width || + (src_y + src_h) > height || + src_x < 0 || src_y < 0) { + StopOverlay(pPPriv, FALSE); + return BadValue; + } + + /* Check that the dst area is some part of the visible screen. */ + if ((drw_x + drw_w) < pScrn->frameX0 || + (drw_y + drw_h) < pScrn->frameY0 || + drw_x > pScrn->frameX1 || drw_y > pScrn->frameY1) { + StopOverlay(pPPriv, FALSE); + return Success; + } + + /* Copy the source and destinations coordinates and size */ + pPPriv->vx = src_x; + pPPriv->vy = src_y; + pPPriv->vw = src_w; + pPPriv->vh = src_h; + + pPPriv->dx = drw_x; + pPPriv->dy = drw_y; + pPPriv->dw = drw_w; + pPPriv->dh = drw_h; + + /* If the image format changed since a previous call, + * let's check if it is supported. By default, we suppose that + * the previous image format was ScalerImages[0].id */ + if (id != pPPriv->Id) { + int i; + for (i = 0; i < ENTRIES(ScalerImages); i++) + if (id == ScalerImages[i].id) + break; + if (i >= ENTRIES(ScalerImages)) + return XvBadAlloc; + pPPriv->Id = id; + } + + /* Let's find the image format and Video_Shift values */ + switch (id) { + case LE4CC('Y','V','1','2'): + pPPriv->Format = FORMAT_YUV422; + pPPriv->Video_Shift = 1; + copy_flat = FALSE; + break; + case LE4CC('Y','U','Y','2'): + pPPriv->Format = FORMAT_YUV422; + pPPriv->Video_Shift = 1; + break; + case LE4CC('U','Y','V','Y'): + pPPriv->Format = FORMAT_VUY422; + pPPriv->Video_Shift = 1; + break; + case LE4CC('Y','U','V','A'): + pPPriv->Format = FORMAT_YUV444; + pPPriv->Video_Shift = 2; + break; + case LE4CC('V','U','Y','A'): + pPPriv->Format = FORMAT_VUY444; + pPPriv->Video_Shift = 2; + break; + case 0x41: /* RGBA 8:8:8:8 */ + pPPriv->Format = FORMAT_RGB8888; + pPPriv->Video_Shift = 2; + break; + case 0x42: /* RGB 5:6:5 */ + pPPriv->Format = FORMAT_RGB565; + pPPriv->Video_Shift = 1; + break; + case 0x43: /* RGB 1:5:5:5 */ + pPPriv->Format = FORMAT_RGB5551; + pPPriv->Video_Shift = 1; + break; + case 0x44: /* RGB 4:4:4:4 */ + pPPriv->Format = FORMAT_RGB4444; + pPPriv->Video_Shift = 1; + break; + case 0x46: /* RGB 2:3:3 */ + pPPriv->Format = FORMAT_RGB332; + pPPriv->Video_Shift = 0; + break; + case 0x47: /* BGRA 8:8:8:8 */ + pPPriv->Format = FORMAT_BGR8888; + pPPriv->Video_Shift = 2; + break; + case 0x48: /* BGR 5:6:5 */ + pPPriv->Format = FORMAT_BGR565; + pPPriv->Video_Shift = 1; + break; + case 0x49: /* BGR 1:5:5:5 */ + pPPriv->Format = FORMAT_BGR5551; + pPPriv->Video_Shift = 1; + break; + case 0x4A: /* BGR 4:4:4:4 */ + pPPriv->Format = FORMAT_BGR4444; + pPPriv->Video_Shift = 1; + break; + case 0x4C: /* BGR 2:3:3 */ + pPPriv->Format = FORMAT_BGR332; + pPPriv->Video_Shift = 0; + break; + default: + return XvBadAlloc; + } + + /* Now we allocate a buffer, if it is needed */ + w_bpp = (width << pPPriv->Video_Shift) >> pPPriv->FB_Shift; + if ((copy = AllocateBuffers(pPPriv, w_bpp, height)) == -1) + return XvBadAlloc; + + /* Let's copy the image to the framebuffer */ +#if USE_HARDWARE_COPY + /* Erm, ... removing this log message will make the server crash. */ + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Hardware image upload.\n")); + HWCopySetup(pPPriv, pPPriv->Buffer[copy]->box.x1, + pPPriv->Buffer[copy]->box.y1, w_bpp, height); + if (copy_flat) HWCopyFlat(pPPriv, buf, width, height); + else HWCopyYV12(pPPriv, buf, width, height); +#else + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Software image upload (1).\n")); + pPPriv->Sync(pScrn); + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Software image upload (2).\n")); + if (copy_flat) CopyFlat(buf, + (CARD8 *) pGlint->FbBase + pPPriv->BufferBase[copy], + width << pPPriv->FB_Shift, height, + pScrn->displayWidth << pPPriv->FB_Shift); + else CopyYV12(buf, + (CARD32 *)((CARD8 *) pGlint->FbBase + pPPriv->BufferBase[copy]), + width, height, pScrn->displayWidth << pPPriv->FB_Shift); + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Software image upload (3).\n")); + pPPriv->Sync(pScrn); + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "Software image upload (4).\n")); +#endif + +#if SUPPORT_CLIPPING + /* Clipping*/ + Clip (pPPriv, clipBoxes); +#endif + + /* We start the overlay */ + BeginOverlay(pPPriv, copy); + + /* We sync the chip again (if needed). */ + if (sync) pPPriv->Sync(pScrn); + + return Success; +} + +static void +Permedia3StopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) +{ + PortPrivPtr pPPriv = (PortPrivPtr) data; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "StopVideo : exit=%d\n", cleanup)); + + REGION_EMPTY(pScrn->pScreen, &pPPriv->clip); + StopOverlay(pPPriv, cleanup); + + if (cleanup) { + FreeBuffers(pPPriv, FALSE); + } +} + +static int +Permedia3SetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 value, pointer data) +{ + PortPrivPtr pPPriv = (PortPrivPtr) data; + + if (attribute == xvFilter) { + switch (value) { + case 0: /* No Filtering */ + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~PM3VideoOverlayMode_FILTER_MASK) | + PM3VideoOverlayMode_FILTER_OFF; + break; + case 1: /* Partial Filtering (X axis only) */ + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~PM3VideoOverlayMode_FILTER_MASK) | + PM3VideoOverlayMode_FILTER_PARTIAL; + break; + case 2: /* Full Bilinear Filtering */ + /* We have to disable X mirroring also */ + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~(PM3VideoOverlayMode_FILTER_MASK | + PM3VideoOverlayMode_MIRRORX_ON)) | + PM3VideoOverlayMode_FILTER_FULL; + pPPriv->Attribute[1] &= 2; + break; + default: + return BadValue; + } + pPPriv->Attribute[0] = value; + } + else if (attribute == xvMirror) { + switch (value) { + case 0: /* No Mirroring */ + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~PM3VideoOverlayMode_MIRROR_MASK) | + PM3VideoOverlayMode_MIRRORX_OFF | + PM3VideoOverlayMode_MIRRORY_OFF; + break; + case 1: /* X Axis Mirroring */ + /* If full filtering was enabled, rever to partial. */ + if (pPPriv->Attribute[0] == 2) { + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~(PM3VideoOverlayMode_MIRROR_MASK | + PM3VideoOverlayMode_FILTER_MASK)) | + PM3VideoOverlayMode_MIRRORX_ON | + PM3VideoOverlayMode_MIRRORY_OFF | + PM3VideoOverlayMode_FILTER_PARTIAL; + pPPriv->Attribute[0] = 1; + } else { + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~PM3VideoOverlayMode_MIRROR_MASK) | + PM3VideoOverlayMode_MIRRORX_ON | + PM3VideoOverlayMode_MIRRORY_OFF; + } + break; + case 2: /* Y Axis Mirroring */ + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~PM3VideoOverlayMode_MIRROR_MASK) | + PM3VideoOverlayMode_MIRRORX_OFF | + PM3VideoOverlayMode_MIRRORY_ON; + break; + case 3: /* X and Y Axis Mirroring */ + /* If full filtering was enabled, rever to partial. */ + if (pPPriv->Attribute[0] == 2) { + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~(PM3VideoOverlayMode_MIRROR_MASK | + PM3VideoOverlayMode_FILTER_MASK)) | + PM3VideoOverlayMode_MIRRORX_ON | + PM3VideoOverlayMode_MIRRORY_ON | + PM3VideoOverlayMode_FILTER_PARTIAL; + pPPriv->Attribute[0] = 1; + } else { + pPPriv->OverlayMode = + (pPPriv->OverlayMode & + ~PM3VideoOverlayMode_MIRROR_MASK) | + PM3VideoOverlayMode_MIRRORX_ON | + PM3VideoOverlayMode_MIRRORY_ON; + } + break; + default: + return BadValue; + } + pPPriv->Attribute[1] = value; + } + else if (attribute == xvAlpha) { + if (value >= 0 && value <= 3) { + pPPriv->OverlayAlpha = value << 6; + } else return BadValue; + pPPriv->Attribute[2] = value; + } + else return BadMatch; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "SPA attr=%d val=%d\n", + attribute, value)); + + return Success; +} + +static int +Permedia3GetPortAttribute(ScrnInfoPtr pScrn, + Atom attribute, INT32 *value, pointer data) +{ + PortPrivPtr pPPriv = (PortPrivPtr) data; + + if (attribute == xvFilter) + *value = pPPriv->Attribute[0]; + else if (attribute == xvMirror) + *value = pPPriv->Attribute[1]; + else if (attribute == xvAlpha) + *value = pPPriv->Attribute[2]; + else return BadMatch; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 3, + "GPA attr=%d val=%d\n", + attribute, *value)); + + return Success; +} + +static void +Permedia3QueryBestSize(ScrnInfoPtr pScrn, Bool motion, + short vid_w, short vid_h, short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, pointer data) +{ + unsigned int zoom_delta, shrink_delta, src_w; + + *p_w = drw_w; + compute_scale_factor (&src_w, p_w, &shrink_delta, &zoom_delta); + *p_h = drw_h; +} + +static int +Permedia3QueryImageAttributes(ScrnInfoPtr pScrn, + int id, unsigned short *width, unsigned short *height, + int *pitches, int *offsets) +{ + int i, pitch; + + *width = CLAMP(*width, 1, 2047); + *height = CLAMP(*height, 1, 2047); + + if (offsets) + offsets[0] = 0; + + switch (id) { + case LE4CC('Y','V','1','2'): /* Planar YVU 4:2:0 (emulated) */ + *width = CLAMP((*width + 1) & ~1, 2, 2046); + *height = CLAMP((*height + 1) & ~1, 2, 2046); + + pitch = *width; /* luma component */ + + if (offsets) { + offsets[1] = pitch * *height; + offsets[2] = offsets[1] + (offsets[1] >> 2); + } + + if (pitches) { + pitches[0] = pitch; + pitches[1] = pitches[2] = pitch >> 1; + } + + return pitch * *height * 3 / 2; + + case LE4CC('Y','U','Y','2'): /* Packed YUYV 4:2:2 */ + case LE4CC('U','Y','V','Y'): /* Packed UYVY 4:2:2 */ + *width = CLAMP((*width + 1) & ~1, 2, 2046); + + pitch = *width * 2; + + if (pitches) + pitches[0] = pitch; + + return pitch * *height; + + default: + for (i = 0; i < ENTRIES(ScalerImages); i++) + if (ScalerImages[i].id == id) + break; + + if (i >= ENTRIES(ScalerImages)) + break; + + pitch = *width * (ScalerImages[i].bits_per_pixel >> 3); + + if (pitches) + pitches[0] = pitch; + + return pitch * *height; + } + + return 0; +} + +static void +DeleteAdaptorPriv(AdaptorPrivPtr pAPriv) +{ + FreeBuffers(pAPriv->pPort, FALSE); + + TimerFree(pAPriv->pPort->Timer); + + xfree(pAPriv); +} + +static AdaptorPrivPtr +NewAdaptorPriv(ScrnInfoPtr pScrn) +{ + AdaptorPrivPtr pAPriv = (AdaptorPrivPtr) xcalloc(1, sizeof(AdaptorPrivRec)); + PortPrivPtr pPPriv = (PortPrivPtr) xcalloc(1, sizeof(PortPrivRec)); + GLINTPtr pGlint = GLINTPTR(pScrn); + int i; + + if (!pAPriv) return NULL; + pAPriv->pScrn = pScrn; + if (!pPPriv) return NULL; + pAPriv->pPort = pPPriv; + + + /* We allocate a timer */ + if (!(pPPriv->Timer = TimerSet(NULL, 0, 0, TimerCallback, pPPriv))) { + DeleteAdaptorPriv(pAPriv); + return NULL; + } + + pPPriv->pAdaptor = pAPriv; + /* Sync */ + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, + "Sync is using : %sPermedia3Sync.\n", + pGlint->MultiAperture?"Dual":"")); + if (pGlint->MultiAperture) pPPriv->Sync = DualPermedia3Sync; + else pPPriv->Sync = Permedia3Sync; + + /* Framebuffer bpp shift */ + pPPriv->FB_Shift = pScrn->bitsPerPixel >> 4; + + /* Attributes */ + pPPriv->Attribute[0] = 2; /* Full filtering enabled */ + pPPriv->Attribute[1] = 0; /* No mirroring */ + pPPriv->Attribute[2] = 3; /* Opaque overlay mode */ + pPPriv->ColorKey = 0; + pPPriv->OverlayAlpha = + PM3RD_VideoOverlayBlend_FACTOR_100_PERCENT; + pPPriv->OverlayMode = + PM3VideoOverlayMode_FILTER_FULL | + PM3VideoOverlayMode_MIRRORX_OFF | + PM3VideoOverlayMode_MIRRORY_OFF; + + /* Clipping */ + REGION_EMPTY(pScrn->pScreen, &pPPriv->clip); + + /* RAMDAC saved values */ + pPPriv->ramdac_x = 0; + pPPriv->ramdac_w = 0; + pPPriv->ramdac_y = 0; + pPPriv->ramdac_h = 0; + pPPriv->ramdac_on = FALSE; + + /* Buffers */ + pPPriv->Id = ScalerImages[0].id; + pPPriv->copy = -1; + pPPriv->display = -1; + for (i = 0; i < MAX_BUFFERS; i++) + pPPriv->Buffer[i] = NULL; + + /* Timer */ + pPPriv->StopDelay = -1; + pPPriv->Delay = 125; + pPPriv->Instant = 1000 / 25; + + return pAPriv; +} + +/* + * Glint interface + */ + +void +Permedia3VideoEnterVT(ScrnInfoPtr pScrn) +{ + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv enter VT\n")); +} + +void +Permedia3VideoLeaveVT(ScrnInfoPtr pScrn) +{ + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv leave VT\n")); +} + +void +Permedia3VideoUninit(ScrnInfoPtr pScrn) +{ + AdaptorPrivPtr pAPriv, *ppAPriv; + + for (ppAPriv = &AdaptorPrivList; (pAPriv = *ppAPriv); ppAPriv = &(pAPriv->Next)) + if (pAPriv->pScrn == pScrn) { + *ppAPriv = pAPriv->Next; + DeleteAdaptorPriv(pAPriv); + break; + } + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv cleanup\n")); +} + +void +Permedia3VideoInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + GLINTPtr pGlint = GLINTPTR(pScrn); + AdaptorPrivPtr pAPriv; + DevUnion Private[1]; + XF86VideoAdaptorRec VAR; + XF86VideoAdaptorPtr VARPtrs; + + switch (pGlint->Chipset) { + case PCI_VENDOR_3DLABS_CHIP_PERMEDIA3: + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, + "Using the Permedia3 chipset.\n"); + break; + case PCI_VENDOR_3DLABS_CHIP_GAMMA: + if (pGlint->MultiChip == PCI_CHIP_PERMEDIA3) { + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, + "Using the Gamma chipset.\n"); + break; + } + default: + xf86DrvMsgVerb(pScrn->scrnIndex, X_ERROR, 1, + "No Xv support for chipset %d.\n", pGlint->Chipset); + return; + } + + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 1, + "Initializing Permedia3 Xv driver rev. 1\n"); + + if (pGlint->NoAccel) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Xv initialization failed : XAA is needed\n"); + return; + } + + if (!(pAPriv = NewAdaptorPriv(pScrn))) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Xv initialization failed\n"); + return; + } + + memset(&VAR, 0, sizeof(VAR)); + + Private[0].ptr = (pointer) pAPriv->pPort; + + VARPtrs = &VAR; + + VAR.type = XvInputMask | XvWindowMask | XvImageMask; + VAR.flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + VAR.name = "Permedia 3 Frontend Scaler"; + VAR.nEncodings = ENTRIES(ScalerEncodings); + VAR.pEncodings = ScalerEncodings; + VAR.nFormats = ENTRIES(ScalerVideoFormats); + VAR.pFormats = ScalerVideoFormats; + VAR.nPorts = 1; + VAR.pPortPrivates = &Private[0]; + VAR.nAttributes = ENTRIES(ScalerAttributes); + VAR.pAttributes = ScalerAttributes; + VAR.nImages = ENTRIES(ScalerImages); + VAR.pImages = ScalerImages; + + VAR.PutVideo = NULL; + VAR.PutStill = NULL; + VAR.GetVideo = NULL; + VAR.GetStill = NULL; + VAR.StopVideo = Permedia3StopVideo; + VAR.SetPortAttribute = Permedia3SetPortAttribute; + VAR.GetPortAttribute = Permedia3GetPortAttribute; + VAR.QueryBestSize = Permedia3QueryBestSize; + VAR.PutImage = Permedia3PutImage; + VAR.ReputImage = Permedia3ReputImage; + VAR.QueryImageAttributes = Permedia3QueryImageAttributes; + + if (xf86XVScreenInit(pScreen, &VARPtrs, 1)) { + xvFilter = MAKE_ATOM(XV_FILTER); + xvMirror = MAKE_ATOM(XV_MIRROR); + xvAlpha = MAKE_ATOM(XV_ALPHA); + +#if USE_HARDWARE_COPY + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Xv frontend scaler enabled (HW)\n"); +#else + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Xv frontend scaler enabled (SW)\n"); +#endif + } else { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Xv initialization failed\n"); + DeleteAdaptorPriv(pAPriv); + } +} + +#endif /* XvExtension */ Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c:1.21.2.2 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c:1.19 Wed Jun 21 09:35:52 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c Tue May 29 07:32:23 2001 @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane, Wigan, England. + * Copyright 1997-2001 by Alan Hourihane, Wigan, England. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -28,7 +28,7 @@ * * Permedia accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c,v 1.19 2000/06/21 13:35:52 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_accel.c,v 1.21.2.2 2001/05/29 11:32:23 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -73,10 +73,6 @@ ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft); static void PermediaSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno); -static void PermediaSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int fg, int bg, int rop,unsigned int planemask); -static void PermediaSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, - int x, int y, int w, int h, int skipleft); static void PermediaWriteBitmap(ScrnInfoPtr pScrn, int x, int y, int w, int h, unsigned char *src, int srcwidth, int skipleft, int fg, int bg, int rop,unsigned int planemask); @@ -106,8 +102,6 @@ static void PermediaPolySegmentThinSolidWrapper(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment *pSeg); -#define MAX_FIFO_ENTRIES 15 - void PermediaInitializeEngine(ScrnInfoPtr pScrn) { @@ -139,7 +133,7 @@ GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LogicalOpMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, DepthMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, StatisticMode); - GLINT_SLOW_WRITE_REG(0xc00, FilterMode); + GLINT_SLOW_WRITE_REG(0x400, FilterMode); GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask); GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RasterizerMode); @@ -221,8 +215,7 @@ infoPtr->PolySegmentThinSolid = PermediaPolySegmentThinSolidWrapper; infoPtr->PolylinesThinSolid = PermediaPolylinesThinSolidWrapper; - infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | - ONLY_LEFT_TO_RIGHT_BITBLT; + infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY; infoPtr->SetupForScreenToScreenCopy = PermediaSetupForScreenToScreenCopy; infoPtr->SubsequentScreenToScreenCopy = PermediaSubsequentScreenToScreenCopy; @@ -237,45 +230,30 @@ infoPtr->SubsequentMono8x8PatternFillRect = PermediaSubsequentMono8x8PatternFillRect; - if (!pGlint->UsePCIRetry) { - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = #if 0 LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X | #endif BIT_ORDER_IN_BYTE_LSBFIRST; - - pGlint->XAAScanlineColorExpandBuffers[0] = - xnfalloc(((pScrn->virtualX + 63)/32) *4* (pScrn->bitsPerPixel / 8)); - pGlint->XAAScanlineColorExpandBuffers[1] = - xnfalloc(((pScrn->virtualX + 63)/32) *4* (pScrn->bitsPerPixel / 8)); - infoPtr->NumScanlineColorExpandBuffers = 2; - infoPtr->ScanlineColorExpandBuffers = + infoPtr->NumScanlineColorExpandBuffers = 1; + pGlint->ScratchBuffer = xalloc(((pScrn->virtualX+62)/32*4) + + (pScrn->virtualX + * pScrn->bitsPerPixel / 8)); + infoPtr->ScanlineColorExpandBuffers = pGlint->XAAScanlineColorExpandBuffers; + pGlint->XAAScanlineColorExpandBuffers[0] = + pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = PermediaSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = PermediaSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = + infoPtr->SubsequentColorExpandScanline = PermediaSubsequentColorExpandScanline; - } else { - infoPtr->CPUToScreenColorExpandFillFlags = CPU_TRANSFER_PAD_DWORD | -#if 0 - LEFT_EDGE_CLIPPING | - LEFT_EDGE_CLIPPING_NEGATIVE_X | -#endif - BIT_ORDER_IN_BYTE_LSBFIRST; - - infoPtr->ColorExpandBase = pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForCPUToScreenColorExpandFill = - PermediaSetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - PermediaSubsequentCPUToScreenColorExpandFill; - } - infoPtr->ColorExpandRange = MAX_FIFO_ENTRIES; + infoPtr->ColorExpandRange = pGlint->FIFOSize; infoPtr->WriteBitmap = PermediaWriteBitmap; @@ -301,62 +279,6 @@ return (XAAInit(pScreen, infoPtr)); } -static void MoveBYTE( - register CARD32* dest, - register unsigned char* src, - register int dwords -) -{ - while(dwords) { - *dest = *src; - src += 1; - dest += 1; - dwords -= 1; - } -} - -static void MoveWORDS( - register CARD32* dest, - register unsigned short* src, - register int dwords -) -{ - while(dwords & ~0x01) { - *dest = *src; - *(dest + 1) = *(src + 1); - src += 2; - dest += 2; - dwords -= 2; - } - switch(dwords) { - case 0: return; - case 1: *dest = *src; - return; - } -} - -static void MoveDWORDS( - register CARD32* dest, - register CARD32* src, - register int dwords ) -{ - while(dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - *(dest + 3) = *(src + 3); - src += 4; - dest += 4; - dwords -= 4; - } - if (!dwords) return; - *dest = *src; - if (dwords == 1) return; - *(dest + 1) = *(src + 1); - if (dwords == 2) return; - *(dest + 2) = *(src + 2); -} - static void PermediaLoadCoord( ScrnInfoPtr pScrn, int x, int y, @@ -399,11 +321,11 @@ CHECKCLIPPING; while (GLINT_READ_REG(DMACount) != 0); - GLINT_WAIT(1); + GLINT_WAIT(2); + GLINT_WRITE_REG(0x400, FilterMode); GLINT_WRITE_REG(0, GlintSync); do { while(GLINT_READ_REG(OutFIFOWords) == 0); -#define Sync_tag 0x188 } while (GLINT_READ_REG(OutputFIFO) != Sync_tag); } @@ -628,15 +550,11 @@ register CARD32* pattern; int dobackground = 0; - skipleft = 0; - w += skipleft; x -= skipleft; dwords = (w + 31) >> 5; -#if 0 PermediaSetClippingRectangle(pScrn, x+skipleft, y, x+w, y+h); -#endif GLINT_WAIT(14); DO_PLANEMASK(planemask); @@ -695,6 +613,7 @@ srcpntr += srcwidth; } + PermediaDisableClipping(pScrn); SET_SYNC_FLAG(infoRec); } @@ -752,108 +671,61 @@ #if 0 PermediaSetClippingRectangle(pScrn, x+skipleft, y, x+w, y+h); #endif - - pGlint->cpucount = y; - pGlint->cpuheight = h; - - GLINT_WAIT(6); - PermediaLoadCoord(pScrn, x<<16, y<<16, (x+w)<<16, 1, 0, 1<<16); -} - -static void -PermediaSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - GLINTPtr pGlint = GLINTPTR(pScrn); - CARD32 *src; - int dwords = pGlint->dwords; - GLINT_WAIT(7); - PermediaLoadCoord(pScrn, pGlint->startxdom, pGlint->cpucount<<16, pGlint->startxsub, 1, 0, 1<<16); + pGlint->cpucount = h; + GLINT_WAIT(8); + PermediaLoadCoord(pScrn, x<<16, y<<16, (x+w)<<16, h, 0, 1<<16); GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode | SyncOnBitMask, Render); - dwords = pGlint->dwords; - - src = (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno]; - while (dwords >= infoRec->ColorExpandRange) { - GLINT_WAIT(infoRec->ColorExpandRange); - GLINT_WRITE_REG((infoRec->ColorExpandRange - 2)<<16 | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src, - infoRec->ColorExpandRange - 1); - dwords -= (infoRec->ColorExpandRange - 1); - src += (infoRec->ColorExpandRange - 1); - } - if (dwords) { - GLINT_WAIT(dwords); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords); - } - pGlint->cpucount += 1; -#if 0 - if (pGlint->cpucount == (pGlint->cpuheight + 1)) - CHECKCLIPPING; +#if defined(__alpha__) + if (0) /* force Alpha to use indirect always */ +#else + if ((pGlint->dwords*h) < pGlint->FIFOSize) #endif -} - -static void -PermediaSetupForCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - int dobackground = 0; - - if (bg != -1) dobackground |= ForceBackgroundColor; - - DO_PLANEMASK(planemask); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); + { + /* Turn on direct for less than FIFOSize dword colour expansion */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4; + pGlint->ScanlineDirect = 1; + GLINT_WRITE_REG(((pGlint->dwords*h)-1)<<16 | 0x0D, OutputFIFO); + GLINT_WAIT(pGlint->dwords*h); } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); + /* Use indirect for anything else */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->ScratchBuffer; + pGlint->ScanlineDirect = 0; } - pGlint->ForeGroundColor = fg; - pGlint->BackGroundColor = bg; - REPLICATE(fg); - REPLICATE(bg); - - if ((rop == GXcopy) && (pGlint->BackGroundColor == -1)) { - GLINT_WRITE_REG(UNIT_DISABLE, ColorDDAMode); - GLINT_WRITE_REG(fg, FBBlockColor); - GLINT_WRITE_REG(0, RasterizerMode); - pGlint->FrameBufferReadMode = FastFillEnable; - } else { - GLINT_WRITE_REG(UNIT_ENABLE, ColorDDAMode); - GLINT_WRITE_REG(BitMaskPackingEachScanline|dobackground,RasterizerMode); - GLINT_WRITE_REG(fg, ConstantColor); - if (dobackground) { - GLINT_WRITE_REG(bg, Texel0); - pGlint->FrameBufferReadMode = TextureEnable; - } else - pGlint->FrameBufferReadMode = 0; - } - LOADROP(rop); + pGlint->cpucount--; } static void -PermediaSubsequentCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft -){ +PermediaSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ GLINTPtr pGlint = GLINTPTR(pScrn); - int dwords = ((w + 31) >> 5) * h; - - PermediaLoadCoord(pScrn, x<<16, y<<16, (x+w)<<16, h, 0, 1<<16); + CARD32 *srcp = (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno]; + int dwords = pGlint->dwords; - GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode | - SyncOnBitMask, Render); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); + if (!pGlint->ScanlineDirect) { + while(dwords >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + dwords -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; + } + if(dwords) { + GLINT_WAIT(dwords + 1); + GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, dwords); + } + } } + static void PermediaWritePixmap8bpp( ScrnInfoPtr pScrn, @@ -915,7 +787,8 @@ /* (0x11 << 4) | 0x0D is the TAG for TextureData */ GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, infoRec->ColorExpandRange - 1); count -= infoRec->ColorExpandRange - 1; address += infoRec->ColorExpandRange - 1; @@ -926,7 +799,8 @@ /* (0x11 << 4) | 0x0D is the TAG for TextureData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -955,7 +829,8 @@ /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveBYTE( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (unsigned char *)srcpbyte, infoRec->ColorExpandRange-1); count -= infoRec->ColorExpandRange - 1; srcpbyte += infoRec->ColorExpandRange - 1; @@ -965,7 +840,8 @@ /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveBYTE((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveBYTE( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (unsigned char *)srcpbyte, count); } src += srcwidth; @@ -1038,7 +914,8 @@ /* (0x11 << 4) | 0x0D is the TAG for TextureData */ GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, infoRec->ColorExpandRange - 1); count -= infoRec->ColorExpandRange - 1; address += infoRec->ColorExpandRange - 1; @@ -1049,7 +926,8 @@ /* (0x11 << 4) | 0x0D is the TAG for TextureData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -1078,7 +956,8 @@ /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (unsigned short *)srcpword,infoRec->ColorExpandRange-1); count -= infoRec->ColorExpandRange - 1; srcpword += infoRec->ColorExpandRange - 1; @@ -1088,7 +967,8 @@ /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (unsigned short *)srcpword, count); } src += srcwidth; @@ -1162,7 +1042,8 @@ /* (0x11 << 4) | 0x0D is the TAG for TextureData */ GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, infoRec->ColorExpandRange - 1); count -= infoRec->ColorExpandRange - 1; address += infoRec->ColorExpandRange - 1; @@ -1173,7 +1054,8 @@ /* (0x11 << 4) | 0x0D is the TAG for TextureData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x11 << 4) | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; @@ -1196,7 +1078,8 @@ /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, infoRec->ColorExpandRange - 1); count -= infoRec->ColorExpandRange - 1; srcp += infoRec->ColorExpandRange - 1; @@ -1206,7 +1089,8 @@ /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; Index: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c:1.9.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c:1.7 Sun Mar 28 10:32:39 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c Thu May 24 16:12:48 2001 @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane <alanh@fairlite.demon.co.uk> + * Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -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/pm_dac.c,v 1.7 1999/03/28 15:32:39 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/pm_dac.c,v 1.9.2.1 2001/05/24 20:12:48 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -40,61 +40,23 @@ #include "glint_regs.h" #include "glint.h" -static int -Shiftbpp(ScrnInfoPtr pScrn, int value) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - /* shift horizontal timings for 64bit VRAM's or 32bit SGRAMs */ - int logbytesperaccess = 2; - - switch (pScrn->bitsPerPixel) { - case 8: - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 16: - if (pGlint->DoubleBuffer) { - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - } else { - value >>= (logbytesperaccess-1); - pGlint->BppShift = logbytesperaccess-1; - } - break; - case 24: - value *= 3; - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 32: - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - break; - } - return (value); -} - Bool PermediaInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { GLINTPtr pGlint = GLINTPTR(pScrn); - GLINTRegPtr pReg = &pGlint->ModeReg; + GLINTRegPtr pReg = &pGlint->ModeReg[0]; RamDacHWRecPtr pIBM = RAMDACHWPTR(pScrn); RamDacRegRecPtr ramdacReg = &pIBM->ModeReg; CARD32 temp1, temp2, temp3, temp4; + + STOREREG(Aperture0, 0x00000000); + STOREREG(Aperture1, 0x00000000); - pReg->glintRegs[Aperture0 >> 3] = 0; - pReg->glintRegs[Aperture1 >> 3] = 0; pReg->glintRegs[PMFramebufferWriteMask >> 3] = 0xFFFFFFFF; pReg->glintRegs[PMBypassWriteMask >> 3] = 0xFFFFFFFF; - if (pGlint->UsePCIRetry) { - pReg->glintRegs[DFIFODis >> 3] = 1; - pReg->glintRegs[FIFODis >> 3] = 3; - } else { - pReg->glintRegs[DFIFODis >> 3] = 0; - pReg->glintRegs[FIFODis >> 3] = 1; - } + pReg->glintRegs[DFIFODis >> 3] = 1; + pReg->glintRegs[FIFODis >> 3] = 3; temp1 = mode->CrtcHSyncStart - mode->CrtcHDisplay; temp2 = mode->CrtcVSyncStart - mode->CrtcVDisplay; @@ -104,6 +66,8 @@ pReg->glintRegs[PMHTotal >> 3] = Shiftbpp(pScrn,mode->CrtcHTotal); pReg->glintRegs[PMHsEnd >> 3] = Shiftbpp(pScrn, temp1 + temp3); pReg->glintRegs[PMHsStart >> 3] = Shiftbpp(pScrn, temp1); + pReg->glintRegs[PMHbEnd >> 3] = Shiftbpp(pScrn, mode->CrtcHTotal - + mode->CrtcHDisplay); pReg->glintRegs[PMHgEnd >> 3] = Shiftbpp(pScrn, mode->CrtcHTotal - mode->CrtcHDisplay); pReg->glintRegs[PMScreenStride >> 3] = @@ -158,6 +122,7 @@ ramdacReg->DacRegs[IBMRGB_misc2] |= PCLK_SEL_LCLK; else ramdacReg->DacRegs[IBMRGB_misc2] |= PCLK_SEL_PLL; + ramdacReg->DacRegs[IBMRGB_misc3] = 0; ramdacReg->DacRegs[IBMRGB_misc_clock] = 1; ramdacReg->DacRegs[IBMRGB_sync] = 0; ramdacReg->DacRegs[IBMRGB_hsync_pos] = 0; @@ -175,6 +140,11 @@ { GLINTPtr pGlint = GLINTPTR(pScrn); + /* We can't rely on the vgahw layer copying the font information + * back properly, due to problems with MMIO access to VGA space + * so we memcpy the information using the slow routines */ + xf86SlowBcopy((CARD8*)pGlint->FbBase, (CARD8*)pGlint->VGAdata, 65536); + glintReg->glintRegs[Aperture0 >> 3] = GLINT_READ_REG(Aperture0); glintReg->glintRegs[Aperture1 >> 3] = GLINT_READ_REG(Aperture1); glintReg->glintRegs[PMFramebufferWriteMask] = @@ -185,7 +155,7 @@ glintReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis); glintReg->glintRegs[PMHTotal >> 3] = GLINT_READ_REG(PMHTotal); - glintReg->glintRegs[PMHgEnd >> 3] = GLINT_READ_REG(PMHbEnd); + glintReg->glintRegs[PMHbEnd >> 3] = GLINT_READ_REG(PMHbEnd); glintReg->glintRegs[PMHgEnd >> 3] = GLINT_READ_REG(PMHgEnd); glintReg->glintRegs[PMScreenStride >> 3] = GLINT_READ_REG(PMScreenStride); glintReg->glintRegs[PMHsStart >> 3] = GLINT_READ_REG(PMHsStart); @@ -201,40 +171,34 @@ } void -PermediaRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) +PermediaRestore(ScrnInfoPtr pScrn, GLINTRegPtr pReg) { GLINTPtr pGlint = GLINTPTR(pScrn); -#if 0 - GLINT_SLOW_WRITE_REG(0, ResetStatus); - while(GLINT_READ_REG(ResetStatus) != 0) { - xf86MsgVerb(X_INFO, 2, "Resetting Engine - Please Wait.\n"); - }; -#endif - - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[ChipConfig >> 3], ChipConfig); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[DFIFODis >> 3], DFIFODis); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[FIFODis >> 3], FIFODis); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture0 >> 3], Aperture0); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture1 >> 3], Aperture1); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMFramebufferWriteMask >> 3], - PMFramebufferWriteMask); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMBypassWriteMask >> 3], - PMBypassWriteMask); - - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVideoControl >> 3], - PMVideoControl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHgEnd >> 3], PMHgEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VClkCtl >> 3], VClkCtl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHTotal >> 3], PMHTotal); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHgEnd >> 3], PMHbEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHsStart >> 3], PMHsStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMHsEnd >> 3], PMHsEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVTotal >> 3], PMVTotal); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVbEnd >> 3], PMVbEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsStart >> 3], PMVsStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMVsEnd >> 3], PMVsEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMScreenBase >> 3], PMScreenBase); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[PMScreenStride >> 3], - PMScreenStride); + /* We can't rely on the vgahw layer copying the font information + * back properly, due to problems with MMIO access to VGA space + * so we memcpy the information using the slow routines */ + if (pGlint->STATE) + xf86SlowBcopy((CARD8*)pGlint->VGAdata, (CARD8*)pGlint->FbBase, 65536); + + RESTOREREG(ChipConfig); + RESTOREREG(DFIFODis); + RESTOREREG(FIFODis); + RESTOREREG(Aperture0); + RESTOREREG(Aperture1); + RESTOREREG(PMFramebufferWriteMask); + RESTOREREG(PMBypassWriteMask); + RESTOREREG(PMVideoControl); + RESTOREREG(PMHgEnd); + RESTOREREG(VClkCtl); + RESTOREREG(PMHTotal); + RESTOREREG(PMHbEnd); + RESTOREREG(PMHsStart); + RESTOREREG(PMHsEnd); + RESTOREREG(PMVTotal); + RESTOREREG(PMVbEnd); + RESTOREREG(PMVsStart); + RESTOREREG(PMVsEnd); + RESTOREREG(PMScreenBase); + RESTOREREG(PMScreenStride); } Index: xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c:1.6.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c:1.3 Wed Apr 12 10:44:41 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c Tue May 29 07:32:23 2001 @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane, Wigan, England. + * Copyright 1997-2001 by Alan Hourihane, Wigan, England. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -28,7 +28,7 @@ * * GLINT 300SX accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c,v 1.3 2000/04/12 14:44:41 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/sx_accel.c,v 1.6.2.1 2001/05/29 11:32:23 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -74,10 +74,6 @@ unsigned char *src, int srcwidth, int rop, unsigned int planemask, int trans, int bpp, int depth); -static void SXSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, - int bg, int rop, unsigned int planemask); -static void SXSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, - int y, int w, int h, int skipleft); static void SXSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); static void SXSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, @@ -215,37 +211,26 @@ SXSubsequentMono8x8PatternFillRect; #if 0 - if (!pGlint->UsePCIRetry) { - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = TRANSPARENCY_ONLY | BIT_ORDER_IN_BYTE_LSBFIRST; - pGlint->XAAScanlineColorExpandBuffers[0] = - xnfalloc(((pScrn->virtualX + 63)/32) *4* (pScrn->bitsPerPixel / 8)); - pGlint->XAAScanlineColorExpandBuffers[1] = - xnfalloc(((pScrn->virtualX + 63)/32) *4* (pScrn->bitsPerPixel / 8)); - - infoPtr->NumScanlineColorExpandBuffers = 2; - infoPtr->ScanlineColorExpandBuffers = + infoPtr->NumScanlineColorExpandBuffers = 1; + pGlint->ScratchBuffer = xalloc(((pScrn->virtualX+62)/32*4) + + (pScrn->virtualX + * pScrn->bitsPerPixel / 8)); + infoPtr->ScanlineColorExpandBuffers = pGlint->XAAScanlineColorExpandBuffers; + pGlint->XAAScanlineColorExpandBuffers[0] = + pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = SXSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = SXSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = + infoPtr->SubsequentColorExpandScanline = SXSubsequentColorExpandScanline; - } else { - infoPtr->CPUToScreenColorExpandFillFlags = TRANSPARENCY_ONLY | - SYNC_AFTER_COLOR_EXPAND | - CPU_TRANSFER_PAD_DWORD | - BIT_ORDER_IN_BYTE_LSBFIRST; - infoPtr->ColorExpandBase = pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForCPUToScreenColorExpandFill = - SXSetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - SXSubsequentCPUToScreenColorExpandFill; - } + infoPtr->WriteBitmap = SXWriteBitmap; infoPtr->ColorExpandRange = MAX_FIFO_ENTRIES; @@ -259,6 +244,8 @@ AvailFBArea.y2 = memory / (pScrn->displayWidth * pScrn->bitsPerPixel / 8); + if (AvailFBArea.y2 > 2047) AvailFBArea.y2 = 2047; + xf86InitFBManager(pScreen, &AvailFBArea); return (XAAInit(pScreen, infoPtr)); @@ -298,28 +285,6 @@ } } -static void MoveDWORDS( - register CARD32* dest, - register CARD32* src, - register int dwords ) -{ - while(dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - *(dest + 3) = *(src + 3); - src += 4; - dest += 4; - dwords -= 4; - } - if (!dwords) return; - *dest = *src; - if (dwords == 1) return; - *(dest + 1) = *(src + 1); - if (dwords == 2) return; - *(dest + 2) = *(src + 2); -} - static void SXSync( ScrnInfoPtr pScrn @@ -335,7 +300,6 @@ GLINT_WRITE_REG(0, GlintSync); do { while(GLINT_READ_REG(OutFIFOWords) == 0); -#define Sync_tag 0x188 readValue = GLINT_READ_REG(OutputFIFO); } while (readValue != Sync_tag); } @@ -494,82 +458,58 @@ GLINTPtr pGlint = GLINTPTR(pScrn); pGlint->dwords = ((w + 31) >> 5); /* dwords per scanline */ - - pGlint->cpucount = y; - pGlint->cpuheight = h; - GLINT_WAIT(6); - SXLoadCoord(pScrn, x, pGlint->cpucount, x+w, 1, 0, 1); -} - -static void -SXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - GLINTPtr pGlint = GLINTPTR(pScrn); - CARD32 *src; - int dwords = pGlint->dwords; - GLINT_WAIT(7); - SXLoadCoord(pScrn, pGlint->startxdom, pGlint->cpucount, pGlint->startxsub, 1, 0, 1); + pGlint->cpucount = h; + GLINT_WAIT(8); + SXLoadCoord(pScrn, x, y, x+w, 1, 0, 1); GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode | SyncOnBitMask, Render); - - src = (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno]; - while (dwords >= infoRec->ColorExpandRange) { - GLINT_WAIT(infoRec->ColorExpandRange); - GLINT_WRITE_REG((infoRec->ColorExpandRange - 2)<<16 | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src, - infoRec->ColorExpandRange - 1); - dwords -= (infoRec->ColorExpandRange - 1); - src += (infoRec->ColorExpandRange - 1); - } - if (dwords) { - GLINT_WAIT(dwords); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords); - } - pGlint->cpucount += 1; -} - -static void -SXSetupForCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - REPLICATE(fg); - - DO_PLANEMASK(planemask); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - GLINT_WRITE_REG(fg, FBBlockColor); - pGlint->FrameBufferReadMode = FastFillEnable; +#if defined(__alpha__) + if (0) /* force Alpha to use indirect always */ +#else + if ((pGlint->dwords*h) < pGlint->FIFOSize) +#endif + { + /* Turn on direct for less than FIFOSize dword colour expansion */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4; + pGlint->ScanlineDirect = 1; + GLINT_WRITE_REG(((pGlint->dwords*h)-1)<<16 | 0x0D, OutputFIFO); + GLINT_WAIT(pGlint->dwords*h); } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - GLINT_WRITE_REG(fg, PatternRamData0); - pGlint->FrameBufferReadMode = FastFillEnable | SpanOperation; + /* Use indirect for anything else */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->ScratchBuffer; + pGlint->ScanlineDirect = 0; } - LOADROP(rop); + + pGlint->cpucount--; } static void -SXSubsequentCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft -){ +SXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ GLINTPtr pGlint = GLINTPTR(pScrn); - int dwords = ((w + 31) >> 5) * h; + CARD32 *srcp = (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno]; + int dwords = pGlint->dwords; - SXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode | - SyncOnBitMask, Render); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); + if (!pGlint->ScanlineDirect) { + while(dwords >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + dwords -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; + } + if(dwords) { + GLINT_WAIT(dwords + 1); + GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, dwords); + } + } } void SXSetupForMono8x8PatternFill( @@ -614,7 +554,6 @@ int w, int h ){ GLINTPtr pGlint = GLINTPTR(pScrn); - int span = 0; GLINT_WAIT(12); SXLoadCoord(pScrn, x, y, x+w, h, 0, 1); @@ -672,7 +611,6 @@ SXLoadCoord(pScrn, x, y, x+w, h, 0, 1); if(bg == -1) { - /* >>>>> set fg <<<<<<<< */ REPLICATE(fg); GLINT_WAIT(3); if (rop == GXcopy) { @@ -809,7 +747,8 @@ /* (0x0f << 4) | 0x0e is the TAG for GLINTColor */ GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x0F << 4) | 0x0E, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, infoRec->ColorExpandRange - 1); count -= infoRec->ColorExpandRange - 1; srcp += infoRec->ColorExpandRange - 1; @@ -819,7 +758,8 @@ /* (0x0F << 4) | 0x0E is the TAG for GLINTColor */ GLINT_WRITE_REG(((count - 1) << 16) | (0x0f << 4) | 0x0e, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; Index: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c:1.22 xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c:1.26.2.2 --- xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c:1.22 Wed May 10 16:01:32 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c Wed May 30 06:08:19 2001 @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane, Wigan, England. + * Copyright 1997-2001 by Alan Hourihane, Wigan, England. * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -28,7 +28,7 @@ * * GLINT 500TX / MX accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c,v 1.22 2000/05/10 20:01:32 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_accel.c,v 1.26.2.2 2001/05/30 10:08:19 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -47,6 +47,7 @@ #include "xaalocal.h" /* For replacements */ static void TXSync(ScrnInfoPtr pScrn); +static void DualTXSync(ScrnInfoPtr pScrn); static void TXSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, unsigned int planemask); static void TXSubsequentFillRectSolid(ScrnInfoPtr pScrn, int x, int y, @@ -74,10 +75,6 @@ unsigned char *src, int srcwidth, int rop, unsigned int planemask, int trans, int bpp, int depth); -static void TXSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, - int bg, int rop, unsigned int planemask); -static void TXSubsequentCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, - int y, int w, int h, int skipleft); static void TXSetupForScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); static void TXSubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, @@ -97,16 +94,33 @@ static void TXPolySegmentThinSolidWrapper(DrawablePtr pDraw, GCPtr pGC, int nseg, xSegment *pSeg); -#define MAX_FIFO_ENTRIES 15 - void TXInitializeEngine(ScrnInfoPtr pScrn) { GLINTPtr pGlint = GLINTPTR(pScrn); /* Initialize the Accelerator Engine to defaults */ + pGlint->rasterizerMode = UNIT_DISABLE; + + if (pGlint->MultiAperture) { + pGlint->rasterizerMode = RMMultiGLINT; + + /* Only write the following register to the first chip */ + GLINT_SLOW_WRITE_REG(1, BroadcastMask); + GLINT_SLOW_WRITE_REG(0x00000001, ScanLineOwnership); + + /* Only write the following register to the second chip */ + GLINT_SLOW_WRITE_REG(2, BroadcastMask); + GLINT_SLOW_WRITE_REG(0x00000005, ScanLineOwnership); + + /* Make sure the rest of the register writes go to both chip's */ + GLINT_SLOW_WRITE_REG(3, BroadcastMask); + pGlint->pprod |= FBRM_ScanlineInt2; + } + + GLINT_SLOW_WRITE_REG(pGlint->pprod, LBReadMode); + GLINT_SLOW_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, ScissorMode); - GLINT_SLOW_WRITE_REG(pGlint->pprod, LBReadMode); GLINT_SLOW_WRITE_REG(pGlint->pprod, FBReadMode); GLINT_SLOW_WRITE_REG(0, dXSub); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, LBWriteMode); @@ -134,7 +148,6 @@ GLINT_SLOW_WRITE_REG(0x400, FilterMode); GLINT_SLOW_WRITE_REG(0xffffffff, FBHardwareWriteMask); GLINT_SLOW_WRITE_REG(0xffffffff, FBSoftwareWriteMask); - GLINT_SLOW_WRITE_REG(UNIT_DISABLE, RasterizerMode); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, GLINTDepth); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBSourceOffset); GLINT_SLOW_WRITE_REG(UNIT_DISABLE, FBPixelOffset); @@ -192,7 +205,10 @@ LINEAR_FRAMEBUFFER | OFFSCREEN_PIXMAPS; - infoPtr->Sync = TXSync; + if (pGlint->MultiAperture) + infoPtr->Sync = DualTXSync; + else + infoPtr->Sync = TXSync; infoPtr->SetClippingRectangle = TXSetClippingRectangle; infoPtr->DisableClipping = TXDisableClipping; @@ -217,10 +233,12 @@ infoPtr->PolySegmentThinSolid = TXPolySegmentThinSolidWrapper; infoPtr->PolylinesThinSolid = TXPolylinesThinSolidWrapper; - infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | - ONLY_LEFT_TO_RIGHT_BITBLT; - infoPtr->SetupForScreenToScreenCopy = TXSetupForScreenToScreenCopy; - infoPtr->SubsequentScreenToScreenCopy = TXSubsequentScreenToScreenCopy; + if (!pGlint->MultiAperture) { + infoPtr->ScreenToScreenCopyFlags = NO_TRANSPARENCY | + ONLY_LEFT_TO_RIGHT_BITBLT; + infoPtr->SetupForScreenToScreenCopy = TXSetupForScreenToScreenCopy; + infoPtr->SubsequentScreenToScreenCopy = TXSubsequentScreenToScreenCopy; + } infoPtr->Mono8x8PatternFillFlags = HARDWARE_PATTERN_PROGRAMMED_ORIGIN | HARDWARE_PATTERN_SCREEN_ORIGIN | @@ -228,39 +246,27 @@ infoPtr->SetupForMono8x8PatternFill = TXSetupForMono8x8PatternFill; infoPtr->SubsequentMono8x8PatternFillRect = TXSubsequentMono8x8PatternFillRect; - if (!pGlint->UsePCIRetry) { - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = TRANSPARENCY_ONLY | BIT_ORDER_IN_BYTE_LSBFIRST; - pGlint->XAAScanlineColorExpandBuffers[0] = - xnfalloc(((pScrn->virtualX + 63)/32) *4* (pScrn->bitsPerPixel / 8)); - pGlint->XAAScanlineColorExpandBuffers[1] = - xnfalloc(((pScrn->virtualX + 63)/32) *4* (pScrn->bitsPerPixel / 8)); - - infoPtr->NumScanlineColorExpandBuffers = 2; - infoPtr->ScanlineColorExpandBuffers = + infoPtr->NumScanlineColorExpandBuffers = 1; + pGlint->ScratchBuffer = xalloc(((pScrn->virtualX+62)/32*4) + + (pScrn->virtualX + * pScrn->bitsPerPixel / 8)); + infoPtr->ScanlineColorExpandBuffers = pGlint->XAAScanlineColorExpandBuffers; + pGlint->XAAScanlineColorExpandBuffers[0] = + pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForScanlineCPUToScreenColorExpandFill = + infoPtr->SetupForScanlineCPUToScreenColorExpandFill = TXSetupForScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = + infoPtr->SubsequentScanlineCPUToScreenColorExpandFill = TXSubsequentScanlineCPUToScreenColorExpandFill; - infoPtr->SubsequentColorExpandScanline = + infoPtr->SubsequentColorExpandScanline = TXSubsequentColorExpandScanline; - } else { - infoPtr->CPUToScreenColorExpandFillFlags = TRANSPARENCY_ONLY | - SYNC_AFTER_COLOR_EXPAND | - CPU_TRANSFER_PAD_DWORD | - BIT_ORDER_IN_BYTE_LSBFIRST; - infoPtr->ColorExpandBase = pGlint->IOBase + OutputFIFO + 4; - infoPtr->SetupForCPUToScreenColorExpandFill = - TXSetupForCPUToScreenColorExpandFill; - infoPtr->SubsequentCPUToScreenColorExpandFill = - TXSubsequentCPUToScreenColorExpandFill; - } - infoPtr->ColorExpandRange = MAX_FIFO_ENTRIES; + infoPtr->ColorExpandRange = pGlint->FIFOSize; infoPtr->WriteBitmap = TXWriteBitmap; infoPtr->WritePixmap = TXWritePixmap; @@ -272,6 +278,8 @@ AvailFBArea.y2 = memory / (pScrn->displayWidth * pScrn->bitsPerPixel / 8); + if (AvailFBArea.y2 > 4095) AvailFBArea.y2 = 4095; + xf86InitFBManager(pScreen, &AvailFBArea); return (XAAInit(pScreen, infoPtr)); @@ -312,42 +320,20 @@ } #else GLINT_WRITE_REG(w<<16, StartXSub); - pGlint->startxsub = w; GLINT_WRITE_REG(x<<16,StartXDom); - pGlint->startxdom = x; GLINT_WRITE_REG(y<<16,StartY); - pGlint->starty = y; GLINT_WRITE_REG(h,GLINTCount); - pGlint->count = h; GLINT_WRITE_REG(a<<16,dXDom); - pGlint->dxdom = a; GLINT_WRITE_REG(d<<16,dY); + pGlint->startxsub = w; + pGlint->startxdom = x; + pGlint->starty = y; + pGlint->count = h; + pGlint->dxdom = a; pGlint->dy = d; #endif } -static void MoveDWORDS( - register CARD32* dest, - register CARD32* src, - register int dwords ) -{ - while(dwords & ~0x03) { - *dest = *src; - *(dest + 1) = *(src + 1); - *(dest + 2) = *(src + 2); - *(dest + 3) = *(src + 3); - src += 4; - dest += 4; - dwords -= 4; - } - if (!dwords) return; - *dest = *src; - if (dwords == 1) return; - *(dest + 1) = *(src + 1); - if (dwords == 2) return; - *(dest + 2) = *(src + 2); -} - static void TXSync( ScrnInfoPtr pScrn @@ -363,12 +349,46 @@ GLINT_WRITE_REG(0, GlintSync); do { while(GLINT_READ_REG(OutFIFOWords) == 0); -#define Sync_tag 0x188 readValue = GLINT_READ_REG(OutputFIFO); } while (readValue != Sync_tag); } static void +DualTXSync( + ScrnInfoPtr pScrn +){ + GLINTPtr pGlint = GLINTPTR(pScrn); + unsigned long readValue; + + CHECKCLIPPING; + + while (GLINT_READ_REG(DMACount) != 0); + GLINT_WAIT(3); + + /* hack! this shouldn't need to be reloaded */ + GLINT_WRITE_REG(3, BroadcastMask); + GLINT_WRITE_REG(0x400, FilterMode); + GLINT_WRITE_REG(0, GlintSync); + + /* Read 1st MX until Sync Tag shows */ + ACCESSCHIP1(); + do { + while(GLINT_READ_REG(OutFIFOWords) == 0); + readValue = GLINT_READ_REG(OutputFIFO); + } while (readValue != Sync_tag); + + ACCESSCHIP2(); + /* Read 2nd MX until Sync Tag shows */ + do { + while(GLINT_READ_REG(OutFIFOWords) == 0); + readValue = GLINT_READ_REG(OutputFIFO); + } while (readValue != Sync_tag); + + ACCESSCHIP1(); +} + + +static void TXSetupForFillRectSolid( ScrnInfoPtr pScrn, int color, int rop, @@ -492,7 +512,7 @@ REPLICATE(bg); GLINT_WAIT(6); DO_PLANEMASK(planemask); - GLINT_WRITE_REG(0, RasterizerMode); + GLINT_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); if (rop == GXcopy) { GLINT_WRITE_REG(pGlint->pprod, FBReadMode); GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); @@ -517,81 +537,57 @@ pGlint->dwords = ((w + 31) >> 5); /* dwords per scanline */ - pGlint->cpucount = y; - pGlint->cpuheight = h; - GLINT_WAIT(6); - TXLoadCoord(pScrn, x, pGlint->cpucount, x+w, 1, 0, 1); -} + pGlint->cpucount = h; -static void -TXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) -{ - XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_SCRNINFOPTR(pScrn); - GLINTPtr pGlint = GLINTPTR(pScrn); - CARD32 *src; - int dwords = pGlint->dwords; - - GLINT_WAIT(7); - TXLoadCoord(pScrn, pGlint->startxdom, pGlint->cpucount, pGlint->startxsub, 1, 0, 1); - + GLINT_WAIT(8); + TXLoadCoord(pScrn, x, y, (x+w), h, 0, 1); GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode | SyncOnBitMask, Render); - - src = (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno]; - while (dwords >= infoRec->ColorExpandRange) { - GLINT_WAIT(infoRec->ColorExpandRange); - GLINT_WRITE_REG((infoRec->ColorExpandRange - 2)<<16 | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src, - infoRec->ColorExpandRange - 1); - dwords -= (infoRec->ColorExpandRange - 1); - src += (infoRec->ColorExpandRange - 1); - } - if (dwords) { - GLINT_WAIT(dwords); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), src,dwords); +#if defined(__alpha__) + if (0) /* force Alpha to use indirect always */ +#else + if ((pGlint->dwords*h) < pGlint->FIFOSize) +#endif + { + /* Turn on direct for less than FIFOSize dword colour expansion */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->IOBase+OutputFIFO+4; + pGlint->ScanlineDirect = 1; + GLINT_WRITE_REG(((pGlint->dwords*h)-1)<<16 | 0x0D, OutputFIFO); + GLINT_WAIT(pGlint->dwords*h); + } else { + /* Use indirect for anything else */ + pGlint->XAAScanlineColorExpandBuffers[0] = pGlint->ScratchBuffer; + pGlint->ScanlineDirect = 0; } - pGlint->cpucount += 1; -} - -static void -TXSetupForCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int fg, int bg, - int rop, - unsigned int planemask -){ - GLINTPtr pGlint = GLINTPTR(pScrn); - REPLICATE(fg); - DO_PLANEMASK(planemask); - if (rop == GXcopy) { - GLINT_WRITE_REG(pGlint->pprod, FBReadMode); - GLINT_WRITE_REG(UNIT_DISABLE, PatternRamMode); - GLINT_WRITE_REG(fg, FBBlockColor); - pGlint->FrameBufferReadMode = FastFillEnable; - } else { - GLINT_WRITE_REG(pGlint->pprod | FBRM_DstEnable, FBReadMode); - GLINT_WRITE_REG(UNIT_ENABLE, PatternRamMode); - GLINT_WRITE_REG(fg, PatternRamData0); - pGlint->FrameBufferReadMode = FastFillEnable | SpanOperation; - } - LOADROP(rop); + pGlint->cpucount--; } static void -TXSubsequentCPUToScreenColorExpandFill( - ScrnInfoPtr pScrn, - int x, int y, int w, int h, - int skipleft -){ +TXSubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) +{ GLINTPtr pGlint = GLINTPTR(pScrn); - int dwords = ((w + 31) >> 5) * h; + CARD32 *srcp = (CARD32*)pGlint->XAAScanlineColorExpandBuffers[bufno]; + int dwords = pGlint->dwords; - TXLoadCoord(pScrn, x, y, x+w, h, 0, 1); - GLINT_WRITE_REG(PrimitiveTrapezoid | pGlint->FrameBufferReadMode | - SyncOnBitMask, Render); - GLINT_WRITE_REG((dwords - 1)<<16 | 0x0D, OutputFIFO); + if (!pGlint->ScanlineDirect) { + while(dwords >= pGlint->FIFOSize) { + GLINT_WAIT(pGlint->FIFOSize); + GLINT_WRITE_REG(((pGlint->FIFOSize - 2) << 16) | 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, pGlint->FIFOSize - 1); + dwords -= pGlint->FIFOSize - 1; + srcp += pGlint->FIFOSize - 1; + } + if(dwords) { + GLINT_WAIT(dwords + 1); + GLINT_WRITE_REG(((dwords - 1) << 16) | 0x0D, OutputFIFO); + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + (CARD32*)srcp, dwords); + } + } } void TXSetupForMono8x8PatternFill( @@ -696,7 +692,7 @@ GLINT_WAIT(11); DO_PLANEMASK(planemask); - GLINT_WRITE_REG(0, RasterizerMode); + GLINT_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); LOADROP(rop); if (rop == GXcopy) { mode = 0; @@ -710,7 +706,6 @@ TXLoadCoord(pScrn, x, y, x+w, h, 0, 1); if(bg == -1) { - /* >>>>> set fg <<<<<<<< */ REPLICATE(fg); GLINT_WAIT(3); if (rop == GXcopy) { @@ -775,7 +770,7 @@ SecondPass = FALSE; REPLICATE(bg); GLINT_WAIT(4); - GLINT_WRITE_REG(InvertBitMask, RasterizerMode); + GLINT_WRITE_REG(InvertBitMask | pGlint->rasterizerMode, RasterizerMode); if (rop == GXcopy) { GLINT_WRITE_REG(bg, FBBlockColor); } else { @@ -785,7 +780,7 @@ } GLINT_WAIT(2); - GLINT_WRITE_REG(0, RasterizerMode); + GLINT_WRITE_REG(pGlint->rasterizerMode, RasterizerMode); CHECKCLIPPING; SET_SYNC_FLAG(infoRec); } @@ -848,7 +843,8 @@ /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((infoRec->ColorExpandRange - 2) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, infoRec->ColorExpandRange - 1); count -= infoRec->ColorExpandRange - 1; srcp += infoRec->ColorExpandRange - 1; @@ -858,7 +854,8 @@ /* (0x15 << 4) | 0x05 is the TAG for FBSourceData */ GLINT_WRITE_REG(((count - 1) << 16) | (0x15 << 4) | 0x05, OutputFIFO); - MoveDWORDS((CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), + GLINT_MoveDWORDS( + (CARD32*)((char*)pGlint->IOBase + OutputFIFO + 4), (CARD32*)srcp, count); } src += srcwidth; Index: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c:1.13.2.2 --- xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c:1.10 Wed May 10 14:55:30 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c Tue May 29 07:32:23 2001 @@ -1,5 +1,5 @@ /* - * Copyright 1997,1998 by Alan Hourihane <alanh@fairlite.demon.co.uk> + * Copyright 1997-2001 by Alan Hourihane <alanh@fairlite.demon.co.uk> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -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.10 2000/05/10 18:55:30 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/glint/tx_dac.c,v 1.13.2.2 2001/05/29 11:32:23 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -41,122 +41,139 @@ #include "glint_regs.h" #include "glint.h" -static int -Shiftbpp(ScrnInfoPtr pScrn, int value) -{ - GLINTPtr pGlint = GLINTPTR(pScrn); - int logbytesperaccess; - - if ( (pGlint->RamDac->RamDacType == (IBM640_RAMDAC)) || - (pGlint->RamDac->RamDacType == (TI3030_RAMDAC)) ) - logbytesperaccess = 4; - else - logbytesperaccess = 3; - - switch (pScrn->bitsPerPixel) { - case 8: - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 16: - if (pGlint->DoubleBuffer) { - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - } else { - value >>= (logbytesperaccess-1); - pGlint->BppShift = logbytesperaccess-1; - } - break; - case 24: - value *= 3; - value >>= logbytesperaccess; - pGlint->BppShift = logbytesperaccess; - break; - case 32: - value >>= (logbytesperaccess-2); - pGlint->BppShift = logbytesperaccess-2; - break; - } - return (value); -} - Bool -TXInit(ScrnInfoPtr pScrn, DisplayModePtr mode) +TXInit(ScrnInfoPtr pScrn, DisplayModePtr mode, GLINTRegPtr pReg) { GLINTPtr pGlint = GLINTPTR(pScrn); - GLINTRegPtr pReg = &pGlint->ModeReg; - RamDacHWRecPtr pIBM = RAMDACHWPTR(pScrn); - RamDacRegRecPtr ramdacReg = &pIBM->ModeReg; + RamDacHWRecPtr pRamDac = RAMDACHWPTR(pScrn); + RamDacRegRecPtr ramdacReg = &pRamDac->ModeReg; CARD32 temp1, temp2, temp3, temp4; - pReg->glintRegs[Aperture0 >> 3] = 0; - pReg->glintRegs[Aperture1 >> 3] = 0; + if (pGlint->numMultiDevices == 2) { + STOREREG(GCSRAperture, GCSRSecondaryGLINTMapEn); + } - if (pGlint->UsePCIRetry) { - pReg->glintRegs[DFIFODis >> 3] = GLINT_READ_REG(DFIFODis) | 0x01; - if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA) - pReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis) | 0x01; - else - pReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis) | 0x03; - } else { - pReg->glintRegs[DFIFODis >> 3] = GLINT_READ_REG(DFIFODis) & 0xFFFFFFFE; - pReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis) | 0x01; + if (pGlint->MultiAperture) { + /* + * Setup HW + * + * Note: The order of discovery for the MX devices is dependent + * on which way the resource allocation code decides to scan the + * bus. This setup assumes the first MX found owns the even + * scanlines. Should the implementation change an scan the bus + * in the opposite direction, then simple invert the indices for + * MultiPciInfo below. If this is setup wrong, the bug will appear + * as incorrect scanline interleaving when software rendering. + */ + STOREREG(GMultGLINTAperture, pGlint->realWidth); + STOREREG(GMultGLINT1, + pGlint->MultiPciInfo[0]->memBase[2] & 0xFF800000); + STOREREG(GMultGLINT2, + pGlint->MultiPciInfo[1]->memBase[2] & 0xFF800000); + } + + if (IS_GMX2000 || IS_GLORIAXXL) { + pReg->glintRegs[LBMemoryEDO >> 3] = GLINT_READ_REG(LBMemoryEDO); + pReg->glintRegs[LBMemoryEDO >> 3] &= ~(LBEDOMask | + LBEDOBankSizeMask | + LBTwoPageDetectorMask); + pReg->glintRegs[LBMemoryEDO >> 3] |= (LBEDOEnabled | + LBEDOBankSize4M | + LBTwoPageDetector); + pReg->glintRegs[LBMemoryCtl >> 3] = GLINT_READ_REG(LBMemoryCtl); + pReg->glintRegs[LBMemoryCtl >> 3] &= ~(LBNumBanksMask | + LBPageSizeMask | + LBRASCASLowMask | + LBRASPrechargeMask | + LBCASLowMask | + LBPageModeMask | + LBRefreshCountMask); + pReg->glintRegs[LBMemoryCtl >> 3] |= (LBNumBanks2 | + LBPageSize1024 | + LBRASCASLow2 | + LBRASPrecharge2 | + LBCASLow1 | + LBPageModeEnabled | + (0x20 << LBRefreshCountShift)); } + STOREREG(Aperture0, 0); + STOREREG(Aperture1, 0); + + STOREREG(DFIFODis, GLINT_READ_REG(DFIFODis) & 0xFFFFFFFE); + STOREREG(FIFODis, GLINT_READ_REG(FIFODis) | 0x01); + temp1 = mode->CrtcHSyncStart - mode->CrtcHDisplay; temp2 = mode->CrtcVSyncStart - mode->CrtcVDisplay; temp3 = mode->CrtcHSyncEnd - mode->CrtcHSyncStart; temp4 = mode->CrtcVSyncEnd - mode->CrtcVSyncStart; + + STOREREG(VTGHLimit, Shiftbpp(pScrn, mode->CrtcHTotal)); + STOREREG(VTGHSyncEnd, Shiftbpp(pScrn, temp1 + temp3)); + STOREREG(VTGHSyncStart, Shiftbpp(pScrn, temp1)); + STOREREG(VTGHBlankEnd, + Shiftbpp(pScrn, mode->CrtcHTotal - mode->CrtcHDisplay)); + + STOREREG(VTGVLimit, mode->CrtcVTotal); + STOREREG(VTGVSyncEnd, temp2 + temp4); + STOREREG(VTGVSyncStart, temp2); + STOREREG(VTGVBlankEnd, mode->CrtcVTotal - mode->CrtcVDisplay); + + if (IS_GMX2000) { + STOREREG(VTGPolarity, 0xba); + } else { + STOREREG(VTGPolarity, (((mode->Flags & V_PHSYNC ? 0:2)<<2) | + ((mode->Flags & V_PVSYNC) ? 0 : 2) | (0xb0))); + } - pReg->glintRegs[VTGHLimit >> 3] = Shiftbpp(pScrn,mode->CrtcHTotal); - pReg->glintRegs[VTGHSyncEnd >> 3] = Shiftbpp(pScrn, temp1 + temp3); - pReg->glintRegs[VTGHSyncStart >> 3] = Shiftbpp(pScrn, temp1); - pReg->glintRegs[VTGHBlankEnd >> 3] = Shiftbpp(pScrn, mode->CrtcHTotal - - mode->CrtcHDisplay); - - pReg->glintRegs[VTGVLimit >> 3] = mode->CrtcVTotal; - pReg->glintRegs[VTGVSyncEnd >> 3] = temp2 + temp4; - pReg->glintRegs[VTGVSyncStart >> 3] = temp2; - pReg->glintRegs[VTGVBlankEnd >> 3] = mode->CrtcVTotal - mode->CrtcVDisplay; - - pReg->glintRegs[VTGPolarity >> 3] = (((mode->Flags & V_PHSYNC) ? 0:2)<<2) | - ((mode->Flags & V_PVSYNC) ? 0 : 2) | (0xb0); - - pReg->glintRegs[VClkCtl >> 3] = 0; - pReg->glintRegs[VTGVGateStart >> 3] = pReg->glintRegs[VTGVBlankEnd>>3] - 1; - pReg->glintRegs[VTGVGateEnd >> 3] = pReg->glintRegs[VTGVBlankEnd>>3]; - /* - * tell DAC to use the ICD chip clock 0 as ref clock - * and set up some more video timining generator registers - */ - pReg->glintRegs[VTGSerialClk >> 3] = 0x05; + STOREREG(VClkCtl, 0); + STOREREG(VTGVGateStart, mode->CrtcVTotal - mode->CrtcVDisplay - 1); + STOREREG(VTGVGateEnd, mode->CrtcVTotal - mode->CrtcVDisplay); /* This is ugly */ if (pGlint->UseFireGL3000) { - pReg->glintRegs[VTGHGateStart >> 3] = - pReg->glintRegs[VTGHBlankEnd>>3] - 1; - pReg->glintRegs[VTGHGateEnd >> 3] = pReg->glintRegs[VTGHLimit>>3] - 1; - pReg->glintRegs[FBModeSel >> 3] = 0x907; - pReg->glintRegs[VTGModeCtl >> 3] = 0x00; + STOREREG(VTGSerialClk, 0x05); + STOREREG(VTGHGateStart, + Shiftbpp(pScrn, mode->CrtcHTotal - mode->CrtcHDisplay - 1)); + STOREREG(VTGHGateEnd, Shiftbpp(pScrn, mode->CrtcHTotal) - 1); + STOREREG(FBModeSel, 0x907); + STOREREG(VTGModeCtl, 0x00); + } else + if (IS_GMX2000) { + STOREREG(VTGSerialClk, 0x02); + STOREREG(VTGHGateStart, + Shiftbpp(pScrn, mode->CrtcHTotal - mode->CrtcHDisplay - 1)); + STOREREG(VTGHGateEnd, Shiftbpp(pScrn, mode->CrtcHTotal) - 1); + STOREREG(FBModeSel, 0x907); + STOREREG(VTGModeCtl, 0x04); } else { - pReg->glintRegs[VTGHGateStart >> 3] = - pReg->glintRegs[VTGHBlankEnd>>3] - 2; - pReg->glintRegs[VTGHGateEnd >> 3] = pReg->glintRegs[VTGHLimit>>3] - 2; - pReg->glintRegs[FBModeSel >> 3] = 0x0A07; - pReg->glintRegs[VTGModeCtl >> 3] = 0x44; + STOREREG(VTGSerialClk, 0x05); + STOREREG(VTGHGateStart, + Shiftbpp(pScrn, mode->CrtcHTotal - mode->CrtcHDisplay) - 2); + STOREREG(VTGHGateEnd, Shiftbpp(pScrn, mode->CrtcHTotal) - 2); + STOREREG(FBModeSel, 0x0A07); + STOREREG(VTGModeCtl, 0x44); } + if (IS_GMX2000 || IS_GLORIAXXL) { + STOREREG(FBMemoryCtl, 0x800); /* Optimum memory timings */ + } else { + STOREREG(FBMemoryCtl, GLINT_READ_REG(FBMemoryCtl)); + } + /* Override FBModeSel for 300SX chip */ - if (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) { + if ( (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_300SX) || + ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) && + (pGlint->MultiChip == PCI_CHIP_300SX)) ) { switch (pScrn->bitsPerPixel) { case 8: - pReg->glintRegs[FBModeSel >> 3] = 0x905; + STOREREG(FBModeSel, 0x905); break; case 16: - pReg->glintRegs[FBModeSel >> 3] = 0x903; + STOREREG(FBModeSel, 0x903); break; case 32: - pReg->glintRegs[FBModeSel >> 3] = 0x901; + STOREREG(FBModeSel, 0x901); break; } } @@ -172,33 +189,33 @@ clock = IBMramdac526CalculateMNPCForClock(pGlint->RefClock, mode->Clock, 1, pGlint->MinClock, pGlint->MaxClock, &m, &n, &p, &c); - ramdacReg->DacRegs[IBMRGB_m0] = m; - ramdacReg->DacRegs[IBMRGB_n0] = n; - ramdacReg->DacRegs[IBMRGB_p0] = p; - ramdacReg->DacRegs[IBMRGB_c0] = c; + STORERAMDAC(IBMRGB_m0, m); + STORERAMDAC(IBMRGB_n0, n); + STORERAMDAC(IBMRGB_p0, p); + STORERAMDAC(IBMRGB_c0, c); - ramdacReg->DacRegs[IBMRGB_pll_ctrl1] = 0x05; - ramdacReg->DacRegs[IBMRGB_pll_ctrl2] = 0x00; + STORERAMDAC(IBMRGB_pll_ctrl1, 0x05); + STORERAMDAC(IBMRGB_pll_ctrl2, 0x00); p = 1; clock = IBMramdac526CalculateMNPCForClock(pGlint->RefClock, mode->Clock, 0, pGlint->MinClock, pGlint->MaxClock, &m, &n, &p, &c); - ramdacReg->DacRegs[IBMRGB_sysclk] = 0x05; - ramdacReg->DacRegs[IBMRGB_sysclk_m] = m; - ramdacReg->DacRegs[IBMRGB_sysclk_n] = n; - ramdacReg->DacRegs[IBMRGB_sysclk_p] = p; - ramdacReg->DacRegs[IBMRGB_sysclk_c] = c; - } - ramdacReg->DacRegs[IBMRGB_misc1] = SENS_DSAB_DISABLE | VRAM_SIZE_64; - ramdacReg->DacRegs[IBMRGB_misc2] = COL_RES_8BIT|PORT_SEL_VRAM|PCLK_SEL_PLL; - ramdacReg->DacRegs[IBMRGB_misc3] = 0; - ramdacReg->DacRegs[IBMRGB_misc_clock] = 1; - ramdacReg->DacRegs[IBMRGB_sync] = 0; - ramdacReg->DacRegs[IBMRGB_hsync_pos] = 0; - ramdacReg->DacRegs[IBMRGB_pwr_mgmt] = 0; - ramdacReg->DacRegs[IBMRGB_dac_op] = 0; - ramdacReg->DacRegs[IBMRGB_pal_ctrl] = 0; + STORERAMDAC(IBMRGB_sysclk, 0x05); + STORERAMDAC(IBMRGB_sysclk_m, m); + STORERAMDAC(IBMRGB_sysclk_n, n); + STORERAMDAC(IBMRGB_sysclk_p, p); + STORERAMDAC(IBMRGB_sysclk_c, c); + } + STORERAMDAC(IBMRGB_misc1, SENS_DSAB_DISABLE | VRAM_SIZE_64); + STORERAMDAC(IBMRGB_misc2, COL_RES_8BIT | PORT_SEL_VRAM | PCLK_SEL_PLL); + STORERAMDAC(IBMRGB_misc3, 0); + STORERAMDAC(IBMRGB_misc_clock, 1); + STORERAMDAC(IBMRGB_sync, 0); + STORERAMDAC(IBMRGB_hsync_pos, 0); + STORERAMDAC(IBMRGB_pwr_mgmt, 0); + STORERAMDAC(IBMRGB_dac_op, 0); + STORERAMDAC(IBMRGB_pal_ctrl, 0); break; case IBM640_RAMDAC: @@ -210,24 +227,27 @@ clock = IBMramdac640CalculateMNPCForClock(pGlint->RefClock, mode->Clock, 1, pGlint->MinClock, pGlint->MaxClock, &m, &n, &p, &c); - ramdacReg->DacRegs[RGB640_PLL_N] = n; - ramdacReg->DacRegs[RGB640_PLL_M] = m; - ramdacReg->DacRegs[RGB640_PLL_P] = p<<1; - ramdacReg->DacRegs[RGB640_PLL_CTL] = c | IBM640_PLL_EN; - ramdacReg->DacRegs[RGB640_AUX_PLL_CTL] = 0; /* Disable AUX PLL */ + STORERAMDAC(RGB640_PLL_N, n); + STORERAMDAC(RGB640_PLL_M, m); + STORERAMDAC(RGB640_PLL_P, p<<1); + STORERAMDAC(RGB640_PLL_CTL, c | IBM640_PLL_EN); + STORERAMDAC(RGB640_AUX_PLL_CTL, 0); /* Disable AUX PLL */ } - ramdacReg->DacRegs[RGB640_PIXEL_INTERLEAVE] = 0x00; - ramdacReg->DacRegs[RGB640_VGA_CONTROL] = IBM640_RDBK | IBM640_VRAM; + STORERAMDAC(RGB640_PIXEL_INTERLEAVE, 0x00); + + temp1 = IBM640_RDBK | IBM640_VRAM; if (pScrn->rgbBits == 8) - ramdacReg->DacRegs[RGB640_VGA_CONTROL] |= IBM640_PSIZE8; - ramdacReg->DacRegs[RGB640_DAC_CONTROL] = IBM640_DACENBL | IBM640_SHUNT; - ramdacReg->DacRegs[RGB640_OUTPUT_CONTROL] = IBM640_WATCTL; - ramdacReg->DacRegs[RGB640_SYNC_CONTROL] = 0x00; - ramdacReg->DacRegs[RGB640_VRAM_MASK0] = 0xFF; - ramdacReg->DacRegs[RGB640_VRAM_MASK1] = 0xFF; - ramdacReg->DacRegs[RGB640_VRAM_MASK2] = 0x0F; + temp1 |= IBM640_PSIZE8; + STORERAMDAC(RGB640_VGA_CONTROL, temp1); + + STORERAMDAC(RGB640_DAC_CONTROL, IBM640_DACENBL | IBM640_SHUNT); + STORERAMDAC(RGB640_OUTPUT_CONTROL, IBM640_RDAI | IBM640_WATCTL); + STORERAMDAC(RGB640_SYNC_CONTROL, 0x00); + STORERAMDAC(RGB640_VRAM_MASK0, 0xFF); + STORERAMDAC(RGB640_VRAM_MASK1, 0xFF); + STORERAMDAC(RGB640_VRAM_MASK2, 0x0F); - pReg->glintRegs[VTGModeCtl >> 3] = 0x04; + STOREREG(VTGModeCtl, 0x04); break; case TI3026_RAMDAC: @@ -236,16 +256,15 @@ /* Get the programmable clock values */ unsigned long m=0,n=0,p=0; unsigned long clock; - int count; - unsigned long q, status, VCO; + unsigned long q, VCO = 0; clock = TIramdacCalculateMNPForClock(pGlint->RefClock, mode->Clock, 1, pGlint->MinClock, pGlint->MaxClock, &m, &n, &p); - ramdacReg->DacRegs[TIDAC_PIXEL_N] = ((n & 0x3f) | 0xC0); - ramdacReg->DacRegs[TIDAC_PIXEL_M] = (m & 0x3f) ; - ramdacReg->DacRegs[TIDAC_PIXEL_P] = ((p & 0x03) | 0xbc); - ramdacReg->DacRegs[TIDAC_PIXEL_VALID] = TRUE; + STORERAMDAC(TIDAC_PIXEL_N, ((n & 0x3f) | 0xC0)); + STORERAMDAC(TIDAC_PIXEL_M, (m & 0x3f)); + STORERAMDAC(TIDAC_PIXEL_P, ((p & 0x03) | 0xbc)); + STORERAMDAC(TIDAC_PIXEL_VALID, TRUE); if (pGlint->RamDac->RamDacType == (TI3026_RAMDAC)) n = 65 - ((64 << 2) / pScrn->bitsPerPixel); @@ -261,15 +280,15 @@ } if (VCO >= 110000) { break; } } - ramdacReg->DacRegs[TIDAC_clock_ctrl] = (q | 0x38); + STORERAMDAC(TIDAC_clock_ctrl, (q | 0x38)); - ramdacReg->DacRegs[TIDAC_LOOP_N] = ((n & 0x3f) | 0xC0); - ramdacReg->DacRegs[TIDAC_LOOP_M] = (m & 0x3f) ; - ramdacReg->DacRegs[TIDAC_LOOP_P] = ((p & 0x03) | 0xF0); - ramdacReg->DacRegs[TIDAC_LOOP_VALID] = TRUE; + STORERAMDAC(TIDAC_LOOP_N, ((n & 0x3f) | 0xC0)); + STORERAMDAC(TIDAC_LOOP_M, (m & 0x3f)); + STORERAMDAC(TIDAC_LOOP_P, ((p & 0x03) | 0xF0)); + STORERAMDAC(TIDAC_LOOP_VALID, TRUE); } if (pGlint->RamDac->RamDacType == (TI3030_RAMDAC)) - pReg->glintRegs[VTGModeCtl >> 3] = 0x04; + STOREREG(VTGModeCtl, 0x04); break; } @@ -280,71 +299,99 @@ } void -TXSave(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) +TXSave(ScrnInfoPtr pScrn, GLINTRegPtr pReg) { GLINTPtr pGlint = GLINTPTR(pScrn); - glintReg->glintRegs[Aperture0 >> 3] = GLINT_READ_REG(Aperture0); - glintReg->glintRegs[Aperture1 >> 3] = GLINT_READ_REG(Aperture1); + if (pGlint->numMultiDevices == 2) { + SAVEREG(GCSRAperture); + } - if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) - glintReg->glintRegs[DFIFODis >> 3] = GLINT_READ_REG(DFIFODis); + if (pGlint->MultiAperture) { + SAVEREG(GMultGLINTAperture); + SAVEREG(GMultGLINT1); + SAVEREG(GMultGLINT2); + } + SAVEREG(Aperture0); + SAVEREG(Aperture1); + + SAVEREG(DFIFODis); + if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_300SX) { - glintReg->glintRegs[FIFODis >> 3] = GLINT_READ_REG(FIFODis); - glintReg->glintRegs[VTGModeCtl >> 3] = GLINT_READ_REG(VTGModeCtl); + SAVEREG(FIFODis); + SAVEREG(VTGModeCtl); } - glintReg->glintRegs[VClkCtl >> 3] = GLINT_READ_REG(VClkCtl); - glintReg->glintRegs[VTGPolarity >> 3] = GLINT_READ_REG(VTGPolarity); - glintReg->glintRegs[VTGHLimit >> 3] = GLINT_READ_REG(VTGHLimit); - glintReg->glintRegs[VTGHBlankEnd >> 3] = GLINT_READ_REG(VTGHBlankEnd); - glintReg->glintRegs[VTGHSyncStart >> 3] = GLINT_READ_REG(VTGHSyncStart); - glintReg->glintRegs[VTGHSyncEnd >> 3] = GLINT_READ_REG(VTGHSyncEnd); - glintReg->glintRegs[VTGVLimit >> 3] = GLINT_READ_REG(VTGVLimit); - glintReg->glintRegs[VTGVBlankEnd >> 3] = GLINT_READ_REG(VTGVBlankEnd); - glintReg->glintRegs[VTGVSyncStart >> 3] = GLINT_READ_REG(VTGVSyncStart); - glintReg->glintRegs[VTGVSyncEnd >> 3] = GLINT_READ_REG(VTGVSyncEnd); - glintReg->glintRegs[VTGVGateStart >> 3] = GLINT_READ_REG(VTGVGateStart); - glintReg->glintRegs[VTGVGateEnd >> 3] = GLINT_READ_REG(VTGVGateEnd); - glintReg->glintRegs[VTGSerialClk >> 3] = GLINT_READ_REG(VTGSerialClk); - glintReg->glintRegs[FBModeSel >> 3] = GLINT_READ_REG(FBModeSel); - glintReg->glintRegs[VTGHGateStart >> 3] = GLINT_READ_REG(VTGHGateStart); - glintReg->glintRegs[VTGHGateEnd >> 3] = GLINT_READ_REG(VTGHGateEnd); + SAVEREG(VClkCtl); + SAVEREG(VTGPolarity); + SAVEREG(VTGHLimit); + SAVEREG(VTGHBlankEnd); + SAVEREG(VTGHSyncStart); + SAVEREG(VTGHSyncEnd); + SAVEREG(VTGVLimit); + SAVEREG(VTGVBlankEnd); + SAVEREG(VTGVSyncStart); + SAVEREG(VTGVSyncEnd); + SAVEREG(VTGVGateStart); + SAVEREG(VTGVGateEnd); + SAVEREG(VTGSerialClk); + SAVEREG(FBModeSel); + SAVEREG(VTGHGateStart); + SAVEREG(VTGHGateEnd); + SAVEREG(FBMemoryCtl); + + if (IS_GMX2000 || IS_GLORIAXXL) { + SAVEREG(LBMemoryEDO); + SAVEREG(LBMemoryCtl); + } } void -TXRestore(ScrnInfoPtr pScrn, GLINTRegPtr glintReg) +TXRestore(ScrnInfoPtr pScrn, GLINTRegPtr pReg) { GLINTPtr pGlint = GLINTPTR(pScrn); + + if (pGlint->numMultiDevices == 2) { + RESTOREREG(GCSRAperture); + } + + if (pGlint->MultiAperture) { + RESTOREREG(GMultGLINTAperture); + RESTOREREG(GMultGLINT1); + RESTOREREG(GMultGLINT2); + } - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture0 >> 3], Aperture0); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[Aperture1 >> 3], Aperture1); + RESTOREREG(Aperture0); + RESTOREREG(Aperture1); - if ((pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_DELTA) || - (pGlint->Chipset == PCI_VENDOR_3DLABS_CHIP_GAMMA)) - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[DFIFODis >> 3], DFIFODis); + RESTOREREG(DFIFODis); if (pGlint->Chipset != PCI_VENDOR_3DLABS_CHIP_300SX) { - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[FIFODis >> 3], FIFODis); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGModeCtl >> 3], VTGModeCtl); + RESTOREREG(FIFODis); + RESTOREREG(VTGModeCtl); } - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGPolarity >> 3], VTGPolarity); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VClkCtl >> 3], VClkCtl); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGSerialClk >> 3], VTGSerialClk); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHLimit >> 3], VTGHLimit); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHSyncStart >> 3],VTGHSyncStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHSyncEnd >> 3], VTGHSyncEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHBlankEnd >> 3], VTGHBlankEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVLimit >> 3], VTGVLimit); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVSyncStart >> 3],VTGVSyncStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVSyncEnd >> 3], VTGVSyncEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVBlankEnd >> 3], VTGVBlankEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVGateStart >> 3],VTGVGateStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGVGateEnd >> 3], VTGVGateEnd); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[FBModeSel >> 3], FBModeSel); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHGateStart >> 3],VTGHGateStart); - GLINT_SLOW_WRITE_REG(glintReg->glintRegs[VTGHGateEnd >> 3], VTGHGateEnd); + RESTOREREG(VTGPolarity); + RESTOREREG(VClkCtl); + RESTOREREG(VTGSerialClk); + RESTOREREG(VTGHLimit); + RESTOREREG(VTGHSyncStart); + RESTOREREG(VTGHSyncEnd); + RESTOREREG(VTGHBlankEnd); + RESTOREREG(VTGVLimit); + RESTOREREG(VTGVSyncStart); + RESTOREREG(VTGVSyncEnd); + RESTOREREG(VTGVBlankEnd); + RESTOREREG(VTGVGateStart); + RESTOREREG(VTGVGateEnd); + RESTOREREG(FBModeSel); + RESTOREREG(VTGHGateStart); + RESTOREREG(VTGHGateEnd); + RESTOREREG(FBMemoryCtl); + + if (IS_GMX2000 || IS_GLORIAXXL) { + RESTOREREG(LBMemoryEDO); + RESTOREREG(LBMemoryCtl); + } } Index: xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile:1.3 xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile:1.3 Sun Dec 10 20:53:00 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile Tue Jan 23 19:06:19 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile,v 1.3 2000/12/11 01:53:00 robin Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/Imakefile,v 1.4 2001/01/24 00:06:19 dawes Exp $ XCOMM XCOMM This is the Imakefile for the I128 driver. XCOMM @@ -36,7 +36,6 @@ InstallObjectModule(i128,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(i128,) InstallModuleManPage(i128) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h:1.1 Wed Oct 4 19:34:58 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h Sat Mar 3 17:26:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h,v 1.1 2000/10/04 23:34:58 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/Ti302X.h,v 1.2 2001/03/03 22:26:11 tsi Exp $ */ /* * Copyright 1994-2000 by Robin Cutshaw <robin@XFree86.Org> * @@ -24,8 +24,6 @@ /* $XConsortium: $ */ #include "compiler.h" -#include <X11/Xfuncproto.h> - /* Indirect indexed registers */ Index: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/i128/i128.cpp:1.2 xc/programs/Xserver/hw/xfree86/drivers/i128/i128.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/i128/i128.cpp:1.2 Mon Dec 11 15:18:14 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/i128.cpp Mon Jun 4 12:40:54 2001 @@ -1,70 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.cpp,v 1.2 2000/12/11 20:18:14 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH I128 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -i128 \- Number 9 I128 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qi128\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B i128 -is an XFree86 driver for Number 9 I128 video cards. The driver is -accelerated and provides support for all versions of the I128 chip family, -including the SGI flatpanel configuration. Multi-head configurations are -supported. -.SH SUPPORTED HARDWARE -The -.B i128 -driver supports PCI and AGP video cards based on the following I128 chips: -.TP 12 -.B I128 rev 1 -(original) -.TP 12 -.B I128-II -.TP 12 -.B I128-T2R -Ticket 2 Ride -.TP 12 -.B I128-T2R4 -Ticket 2 Ride IV -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type and may not be overridden. -.PP -The driver auto-detects the amount of video memory present for all -chips and may not be overridden. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qSyncOnGreen\*q \*q" boolean \*q -Enable or disable combining the sync signals with the green signal. -Default: off. -.TP -.BI "Option \*qDac6Bit\*q \*q" boolean \*q -Reduce DAC operations to 6 bits. -Default: false. -.TP -.BI "Option \*qDebug\*q \*q" boolean \*q -This turns on verbose debug information from the driver. -Default: off. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Robin Cutshaw (driver), Galen Brooks (flatpanel support). Index: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h:1.4 Sun Dec 10 20:53:00 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h Fri May 4 15:05:39 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h,v 1.4 2000/12/11 01:53:00 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.h,v 1.6 2001/05/04 19:05:39 dawes Exp $ */ /* * Number Nine I128 functions * @@ -99,6 +99,8 @@ unsigned int (*ddc1Read)(ScrnInfoPtr); Bool (*i2cInit)(ScrnInfoPtr); + OptionInfoPtr Options; + } I128Rec, *I128Ptr; @@ -135,6 +137,6 @@ void I128DumpBaseRegisters(ScrnInfoPtr pScrn); void I128DumpActiveRegisters(ScrnInfoPtr pScrn); -void I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile unsigned long *vrbg); +void I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile CARD32 *vrbg); #endif Index: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i128/i128.man:1.2 --- /dev/null Mon Jun 4 12:40:54 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/i128.man Sat Jan 27 13:20:48 2001 @@ -0,0 +1,70 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128.man,v 1.2 2001/01/27 18:20:48 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH I128 __drivermansuffix__ __vendorversion__ +.SH NAME +i128 \- Number 9 I128 video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qi128\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B i128 +is an XFree86 driver for Number 9 I128 video cards. The driver is +accelerated and provides support for all versions of the I128 chip family, +including the SGI flatpanel configuration. Multi-head configurations are +supported. +.SH SUPPORTED HARDWARE +The +.B i128 +driver supports PCI and AGP video cards based on the following I128 chips: +.TP 12 +.B I128 rev 1 +(original) +.TP 12 +.B I128-II +.TP 12 +.B I128-T2R +Ticket 2 Ride +.TP 12 +.B I128-T2R4 +Ticket 2 Ride IV +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto-detects the chipset type and may not be overridden. +.PP +The driver auto-detects the amount of video memory present for all +chips and may not be overridden. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +Enable or disable the HW cursor. Default: on. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.TP +.BI "Option \*qSyncOnGreen\*q \*q" boolean \*q +Enable or disable combining the sync signals with the green signal. +Default: off. +.TP +.BI "Option \*qDac6Bit\*q \*q" boolean \*q +Reduce DAC operations to 6 bits. +Default: false. +.TP +.BI "Option \*qDebug\*q \*q" boolean \*q +This turns on verbose debug information from the driver. +Default: off. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Robin Cutshaw (driver), Galen Brooks (flatpanel support). Index: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c:1.17 xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c:1.17 Sun Dec 10 20:53:01 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c Fri May 4 15:05:39 2001 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.17 2000/12/11 01:53:01 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128_driver.c,v 1.20 2001/05/04 19:05:39 dawes Exp $ */ /* All drivers should typically include these */ @@ -71,7 +71,7 @@ */ /* Mandatory functions */ -static OptionInfoPtr I128AvailableOptions(int chipid, int busid); +static const OptionInfoRec * I128AvailableOptions(int chipid, int busid); static void I128Identify(int flags); static Bool I128Probe(DriverPtr drv, int flags); static Bool I128PreInit(ScrnInfoPtr pScrn, int flags); @@ -86,11 +86,9 @@ static void I128FreeScreen(int scrnIndex, int flags); static int I128ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); -#ifdef DPMSExtension static void I128DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif /* Internally used functions */ static Bool I128GetRec(ScrnInfoPtr pScrn); @@ -188,9 +186,7 @@ static const char *fbSymbols[] = { "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif NULL }; @@ -464,7 +460,7 @@ OPTION_DEBUG } I128Opts; -static OptionInfoRec I128Options[] = { +static const OptionInfoRec I128Options[] = { { OPTION_FLATPANEL, "FlatPanel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, @@ -486,10 +482,10 @@ * int chipid - currently unused * int busid - currently unused * Returns: - * OptionInfoPtr - all accepted options + * const OptionInfoRec * - all accepted options */ -static OptionInfoPtr +static const OptionInfoRec * I128AvailableOptions(int chipid, int busid) { return I128Options; @@ -641,7 +637,10 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, I128Options); + if (!(pI128->Options = xalloc(sizeof(I128Options)))) + return FALSE; + memcpy(pI128->Options, I128Options, sizeof(I128Options)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI128->Options); if (pScrn->depth == 8) pScrn->rgbBits = 8; @@ -652,38 +651,38 @@ */ from = X_DEFAULT; pI128->HWCursor = TRUE; - if (xf86GetOptValBool(I128Options, OPTION_HW_CURSOR, &pI128->HWCursor)) { + if (xf86GetOptValBool(pI128->Options, OPTION_HW_CURSOR, &pI128->HWCursor)) { from = X_CONFIG; } /* For compatibility, accept this too (as an override) */ - if (xf86ReturnOptValBool(I128Options, OPTION_SW_CURSOR, FALSE)) { + if (xf86ReturnOptValBool(pI128->Options, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pI128->HWCursor = FALSE; } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pI128->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(I128Options, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pI128->Options, OPTION_NOACCEL, FALSE)) { pI128->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } else pI128->NoAccel = FALSE; - if (xf86ReturnOptValBool(I128Options, OPTION_SYNC_ON_GREEN, FALSE)) { + if (xf86ReturnOptValBool(pI128->Options, OPTION_SYNC_ON_GREEN, FALSE)) { pI128->DACSyncOnGreen = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Sync-on-Green enabled\n"); } else pI128->DACSyncOnGreen = FALSE; - if (xf86ReturnOptValBool(I128Options, OPTION_SHOWCACHE, FALSE)) { + if (xf86ReturnOptValBool(pI128->Options, OPTION_SHOWCACHE, FALSE)) { pI128->ShowCache = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache enabled\n"); } else pI128->ShowCache = FALSE; - if (xf86ReturnOptValBool(I128Options, OPTION_DAC6BIT, FALSE)) { + if (xf86ReturnOptValBool(pI128->Options, OPTION_DAC6BIT, FALSE)) { pI128->DAC8Bit = FALSE; pScrn->rgbBits = 6; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Dac6Bit enabled\n"); } else pI128->DAC8Bit = TRUE; - if (xf86ReturnOptValBool(I128Options, OPTION_DEBUG, FALSE)) { + if (xf86ReturnOptValBool(pI128->Options, OPTION_DEBUG, FALSE)) { pI128->Debug = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Debug enabled\n"); } else pI128->Debug = FALSE; - if (xf86ReturnOptValBool(I128Options, OPTION_FLATPANEL, FALSE)) { + if (xf86ReturnOptValBool(pI128->Options, OPTION_FLATPANEL, FALSE)) { pI128->FlatPanel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "FlatPanel forced\n"); } else pI128->FlatPanel = FALSE; @@ -1158,10 +1157,7 @@ I128FreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", NULL); -#ifdef RENDER - xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif + xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); /* Load XAA if needed */ if (!pI128->NoAccel) { @@ -1536,9 +1532,7 @@ if (!ret) return FALSE; -#ifdef RENDER fbPictureInit(pScreen, 0, 0); -#endif if (pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ @@ -1603,9 +1597,7 @@ CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; -#ifdef DPMSExtension xf86DPMSInit(pScreen, I128DisplayPowerManagementSet, 0); -#endif pScrn->memPhysBase = (unsigned long)pI128->MemoryPtr; pScrn->fbOffset = 0; @@ -1980,7 +1972,6 @@ * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -#ifdef DPMSExtension void I128DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -2019,8 +2010,6 @@ pI128->mem.rbase_g[DATA_I] = snc; MB; } -#endif - void I128DumpBaseRegisters(ScrnInfoPtr pScrn) { @@ -2119,7 +2108,7 @@ unsigned short iobase; unsigned long rbase_g, rbase_w, rbase_a, rbase_b, rbase_i, rbase_e; unsigned long id, config1, config2, sgram, soft_sw, ddc, vga_ctl; - volatile unsigned long *vrba, *vrbg, *vrbw; + volatile CARD32 *vrba, *vrbg, *vrbw; vrba = pI128->mem.rbase_a; vrbg = pI128->mem.rbase_g; @@ -2357,7 +2346,7 @@ }; void -I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile unsigned long *vrbg) +I128DumpIBMDACRegisters(ScrnInfoPtr pScrn, volatile CARD32 *vrbg) { unsigned char ibmr[0x100]; char buf[128], tbuf[10]; Index: xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c:1.1 Sun Dec 10 20:53:01 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c Sun Apr 1 10:00:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c,v 1.1 2000/12/11 01:53:01 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i128/i128dga.c,v 1.2 2001/04/01 14:00:11 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -260,7 +260,7 @@ int *flags ){ I128Ptr pI128 = I128PTR(pScrn); - CARD32 FbAddress = pI128->PciInfo->memBase[0] & 0xFFC00000; + unsigned long FbAddress = pI128->PciInfo->memBase[0] & 0xFFC00000; *name = NULL; /* no special device */ *mem = (unsigned char*)FbAddress; Index: xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile:1.6 xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile:1.6 Wed Oct 11 12:18:32 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile Tue May 15 06:19:38 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile,v 1.6 2000/10/11 16:18:32 mvojkovi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/Imakefile,v 1.8 2001/05/15 10:19:38 eich Exp $ XCOMM XCOMM This is the Imakefile for the i740 driver. XCOMM @@ -18,7 +18,7 @@ -I$(XF86SRC)/xaa -I$(XF86SRC)/rac \ -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa -I$(XF86SRC)/ramdac \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ - -I$(SERVERSRC)/Xext -I$(XF86OSSRC)/vbe \ + -I$(SERVERSRC)/Xext -I$(XF86OSSRC)/vbe -I$(SERVERSRC)/fb\ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(EXTINCSRC) -I$(XF86SRC)/int10 -I$(SERVERSRC)/render #endif @@ -34,7 +34,6 @@ InstallObjectModule(i740,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(i740,) InstallModuleManPage(i740) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/i740.cpp:1.5 xc/programs/Xserver/hw/xfree86/drivers/i740/i740.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/i740/i740.cpp:1.5 Mon Dec 11 15:18:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740.cpp Mon Jun 4 12:40:55 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.cpp,v 1.5 2000/12/11 20:18:15 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH I740 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -i740 \- Intel i740 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qi740\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B i740 -is an XFree86 driver for Intel i740 video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B i740 -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h:1.3 Tue Feb 22 23:47:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h Fri May 4 15:05:39 2001 @@ -25,7 +25,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h,v 1.3 2000/02/23 04:47:12 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.h,v 1.4 2001/05/04 19:05:39 dawes Exp $ */ /* * Authors: @@ -113,6 +113,7 @@ I740ReadIndexedByteFunc readControl; I740WriteByteFunc writeStandard; I740ReadByteFunc readStandard; + OptionInfoPtr Options; } I740Rec; #define I740PTR(p) ((I740Ptr)((p)->driverPrivate)) Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i740/i740.man:1.2 --- /dev/null Mon Jun 4 12:40:55 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740.man Sat Jan 27 13:20:48 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740.man,v 1.2 2001/01/27 18:20:48 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH I740 __drivermansuffix__ __vendorversion__ +.SH NAME +i740 \- Intel i740 video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qi740\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B i740 +is an XFree86 driver for Intel i740 video cards. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B i740 +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c:1.4 Wed Apr 5 14:13:47 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c Sat Mar 3 17:26:12 2001 @@ -25,17 +25,13 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c,v 1.4 2000/04/05 18:13:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_accel.c,v 1.5 2001/03/03 22:26:12 tsi Exp $ */ /* * Authors: * Daryll Strauss <daryll@precisioninsight.com> * */ - -#if 0 -#include <math.h> -#endif #include "xf86.h" #include "xf86_OSproc.h" Index: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c:1.26 xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c:1.30 --- xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c:1.26 Sat Dec 2 10:30:41 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c Tue May 15 06:19:38 2001 @@ -25,7 +25,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c,v 1.26 2000/12/02 15:30:41 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i740/i740_driver.c,v 1.30 2001/05/15 10:19:38 eich Exp $ */ /* * Authors: @@ -71,6 +71,11 @@ #include "micmap.h" +#define USE_FB + +#ifdef USE_FB +#include "fb.h" +#else /* Drivers using cfb need: */ #define PSZ 8 @@ -82,6 +87,7 @@ #include "cfb16.h" #include "cfb24.h" #include "cfb32.h" +#endif /* The driver's own header file: */ @@ -95,7 +101,7 @@ #include "vbe.h" /* Required Functions: */ -static OptionInfoPtr I740AvailableOptions(int chipid, int busid); +static const OptionInfoRec * I740AvailableOptions(int chipid, int busid); /* Print a driver identifying message. */ static void I740Identify(int flags); @@ -133,12 +139,12 @@ static int I740ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); -#ifdef DPMSExtension /* Switch to various Display Power Management System levels */ static void I740DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagermentMode, int flags); -#endif +static void I740ProbeDDC(ScrnInfoPtr pScrn, int index); + #define VERSION 4000 #define I740_NAME "I740" #define I740_DRIVER_NAME "i740" @@ -149,9 +155,6 @@ DriverRec I740 = { VERSION, I740_DRIVER_NAME, -#if 0 - "Accelerated driver for Intel i740 cards", -#endif I740Identify, I740Probe, I740AvailableOptions, @@ -182,7 +185,7 @@ OPTION_USE_PIO } I740Opts; -static OptionInfoRec I740Options[] = { +static const OptionInfoRec I740Options[] = { { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SDRAM, "SDRAM", OPTV_BOOLEAN, {0}, FALSE}, @@ -210,11 +213,16 @@ 0 }; -static const char *cfbSymbols[] = { +static const char *fbSymbols[] = { +#ifdef USE_FB + "fbScreenInit", + "fbPictureInit", +#else "cfbScreenInit", "cfb16ScreenInit", "cfb24ScreenInit", "cfb32ScreenInit", +#endif "cfb8_32ScreenInit", "cfb24_32ScreenInit", NULL @@ -289,7 +297,7 @@ * Tell the loader about symbols from other modules that this module * might refer to. */ - LoaderRefSymLists(vgahwSymbols, cfbSymbols, xaaSymbols, + LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, xf8_32bppSymbols, ramdacSymbols, vbeSymbols, NULL /* ddcsymbols */, NULL /* i2csymbols */, NULL /* shadowSymbols */, NULL /* fbdevsymbols */, NULL); @@ -330,8 +338,7 @@ pScrn->driverPrivate=0; } -static -OptionInfoPtr +static const OptionInfoRec * I740AvailableOptions(int chipid, int busid) { return I740Options; @@ -445,7 +452,7 @@ return foundScreen; } -void +static void I740ProbeDDC(ScrnInfoPtr pScrn, int index) { vbeInfoPtr pVbe; @@ -470,7 +477,9 @@ int i; MessageType from; int temp; +#ifndef USE_FB char *mod=0, *reqSym=0; +#endif int flags24; rgb defaultWeight = {0, 0, 0}; @@ -532,7 +541,7 @@ xf86PrintDepthBpp(pScrn); pScrn->rgbBits=8; - if (xf86ReturnOptValBool(I740Options, OPTION_DAC_6BIT, FALSE)) + if (xf86ReturnOptValBool(pI740->Options, OPTION_DAC_6BIT, FALSE)) pScrn->rgbBits=6; if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE; @@ -557,13 +566,16 @@ /* Process the options */ xf86CollectOptions(pScrn, NULL); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, I740Options); + if (!(pI740->Options = xalloc(sizeof(I740Options)))) + return FALSE; + memcpy(pI740->Options, I740Options, sizeof(I740Options)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI740->Options); /* 6-BIT dac isn't reasonable for modes with > 8bpp */ - if (xf86ReturnOptValBool(I740Options, OPTION_DAC_6BIT, FALSE) && + if (xf86ReturnOptValBool(pI740->Options, OPTION_DAC_6BIT, FALSE) && pScrn->bitsPerPixel>8) { OptionInfoPtr ptr; - ptr=xf86TokenToOptinfo(I740Options, OPTION_DAC_6BIT); + ptr=xf86TokenToOptinfo(pI740->Options, OPTION_DAC_6BIT); ptr->found=FALSE; } @@ -642,24 +654,24 @@ temp=pI740->readControl(pI740, XRX, DRAM_ROW_CNTL_LO); pI740->HasSGRAM = !((temp&DRAM_RAS_TIMING)||(temp&DRAM_RAS_PRECHARGE)); - if (xf86IsOptionSet(I740Options, OPTION_SDRAM)) { - if (xf86IsOptionSet(I740Options, OPTION_SGRAM)) { + if (xf86IsOptionSet(pI740->Options, OPTION_SDRAM)) { + if (xf86IsOptionSet(pI740->Options, OPTION_SGRAM)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "It is nonsensical to set both SDRAM and SGRAM options\n"); return FALSE; } - if (xf86ReturnOptValBool(I740Options, OPTION_SDRAM, FALSE)) { + if (xf86ReturnOptValBool(pI740->Options, OPTION_SDRAM, FALSE)) { pI740->HasSGRAM = FALSE; } else { pI740->HasSGRAM = TRUE; } } else { - if (xf86IsOptionSet(I740Options, OPTION_SDRAM)) { + if (xf86IsOptionSet(pI740->Options, OPTION_SDRAM)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "It is nonsensical to set both SDRAM and SGRAM options\n"); return FALSE; } - if (xf86ReturnOptValBool(I740Options, OPTION_SGRAM, FALSE)) { + if (xf86ReturnOptValBool(pI740->Options, OPTION_SGRAM, FALSE)) { pI740->HasSGRAM = TRUE; } else { pI740->HasSGRAM = FALSE; @@ -756,6 +768,13 @@ xf86SetDpi(pScrn, 0, 0); +#ifdef USE_FB + if (!xf86LoadSubModule(pScrn, "fb")) { + I740FreeRec(pScrn); + return FALSE; + } + xf86LoaderReqSymbols("fbScreenInit","fbPictureInit", NULL); +#else switch (pScrn->bitsPerPixel) { case 8: mod = "cfb"; @@ -779,15 +798,16 @@ return FALSE; } xf86LoaderReqSymbols(reqSym, NULL); +#endif - if (!xf86ReturnOptValBool(I740Options, OPTION_NOACCEL, FALSE)) { + if (!xf86ReturnOptValBool(pI740->Options, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) { I740FreeRec(pScrn); return FALSE; } } - if (!xf86ReturnOptValBool(I740Options, OPTION_SW_CURSOR, FALSE)) { + if (!xf86ReturnOptValBool(pI740->Options, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) { I740FreeRec(pScrn); return FALSE; @@ -796,7 +816,7 @@ } /* We wont be using the VGA access after the probe */ - if (!xf86ReturnOptValBool(I740Options, OPTION_USE_PIO, FALSE)) { + if (!xf86ReturnOptValBool(pI740->Options, OPTION_USE_PIO, FALSE)) { resRange vgaio[] = { {ResShrIoBlock,0x3B0,0x3BB}, {ResShrIoBlock,0x3C0,0x3DF}, _END }; @@ -1289,7 +1309,7 @@ } /* Turn on 8 bit dac if requested */ - if (xf86ReturnOptValBool(I740Options, OPTION_DAC_6BIT, FALSE)) + if (xf86ReturnOptValBool(pI740->Options, OPTION_DAC_6BIT, FALSE)) i740Reg->PixelPipeCfg0 = DAC_6_BIT; else i740Reg->PixelPipeCfg0 = DAC_8_BIT; @@ -1306,7 +1326,7 @@ i740Reg->DisplayControl = HIRES_MODE; /* Set the MCLK freq */ - if (xf86ReturnOptValBool(I740Options, OPTION_SLOW_RAM, FALSE)) + if (xf86ReturnOptValBool(pI740->Options, OPTION_SLOW_RAM, FALSE)) i740Reg->PLLControl = PLL_MEMCLK__66667KHZ; /* 66 MHz */ else i740Reg->PLLControl = PLL_MEMCLK_100000KHZ; /* 100 MHz -- use as default */ @@ -1317,7 +1337,15 @@ i740Reg->ExtVertSyncStart = mode->CrtcVSyncStart >> 8; i740Reg->ExtVertBlankStart = mode->CrtcVBlankStart >> 8; i740Reg->ExtHorizTotal = ((mode->CrtcHTotal >> 3) - 5) >> 8; - i740Reg->ExtHorizBlank = ((mode->CrtcHSyncEnd >> 3) & 0x40) >> 6; + /* + * the KGA fix in vgaHW.c results in the first + * scanline and the first character clock (8 pixels) + * of each scanline thereafter on display with an i740 + * to be blank. Restoring CRTC 3, 5, & 22 to their + * "theoretical" values corrects the problem. KAO. + */ + i740Reg->ExtHorizBlank = vgaHWHBlankKGA(mode, pVga, 7, 0) << 6; + vgaHWVBlankKGA(mode, pVga, 8, 0); /* Turn on interlaced mode if necessary */ if (mode->Flags & V_INTERLACE) @@ -1351,7 +1379,6 @@ { vgaHWPtr hwp; I740Ptr pI740; - vgaRegPtr pVga; hwp = VGAHWPTR(pScrn); pI740 = I740PTR(pScrn); @@ -1359,18 +1386,6 @@ vgaHWUnlock(hwp); if (!vgaHWInit(pScrn, mode)) return FALSE; - /* - * the KGA fix in vgaHW.c results in the first - * scanline and the first character clock (8 pixels) - * of each scanline thereafter on display with an i740 - * to be blank. Restoring CRTC 3, 5, & 22 to their - * "theoretical" values corrects the problem. KAO. - */ - pVga = &VGAHWPTR(pScrn)->ModeReg; - pVga->CRTC[3] = (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F) | 0x80; - pVga->CRTC[5] = ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2) - | (((mode->CrtcHSyncEnd >> 3)) & 0x1F); - pVga->CRTC[22] = (mode->CrtcVBlankEnd - 1) & 0xFF; pScrn->vtSema = TRUE; @@ -1466,9 +1481,24 @@ if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; +#ifdef USE_FB + if (!miSetPixmapDepths ()) return FALSE; +#endif switch (pScrn->bitsPerPixel) { +#ifdef USE_FB case 8: + case 16: + case 24: + case 32: + if (!fbScreenInit(pScreen, pI740->FbBase, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth,pScrn->bitsPerPixel)) + return FALSE; + break; +#else + case 8: if (!cfbScreenInit(pScreen, pI740->FbBase, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, @@ -1496,12 +1526,16 @@ pScrn->displayWidth)) return FALSE; break; +#endif default: xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) in I740ScrnInit\n", pScrn->bitsPerPixel); return FALSE; } +#ifdef USE_FB + fbPictureInit(pScreen,0,0); +#endif xf86SetBlackWhitePixels(pScreen); @@ -1537,9 +1571,7 @@ return FALSE; } -#ifdef DPMSExtension xf86DPMSInit(pScreen, I740DisplayPowerManagementSet, 0); -#endif #ifdef XvExtension { @@ -1563,14 +1595,14 @@ return FALSE; } - if (!xf86ReturnOptValBool(I740Options, OPTION_NOACCEL, FALSE)) { + if (!xf86ReturnOptValBool(pI740->Options, OPTION_NOACCEL, FALSE)) { if (!I740AccelInit(pScreen)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware acceleration initialization failed\n"); } } - if (!xf86ReturnOptValBool(I740Options, OPTION_SW_CURSOR, FALSE)) { + if (!xf86ReturnOptValBool(pI740->Options, OPTION_SW_CURSOR, FALSE)) { if (!I740CursorInit(pScreen)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware cursor initialization failed\n"); @@ -1715,7 +1747,6 @@ return vgaHWSaveScreen(pScreen, mode); } -#ifdef DPMSExtension static void I740DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { @@ -1754,4 +1785,3 @@ /* Set the DPMS mode */ pI740->writeControl(pI740, XRX, DPMS_SYNC_SELECT, DPMSSyncSelect); } -#endif Index: xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile:1.13 xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile:1.13 Tue Sep 19 20:09:21 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile Tue Jan 23 19:06:20 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile,v 1.13 2000/09/20 00:09:21 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/Imakefile,v 1.14 2001/01/24 00:06:20 dawes Exp $ XCOMM XCOMM This is the Imakefile for the i810 driver. XCOMM @@ -47,7 +47,6 @@ InstallObjectModule(i810,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(i810,) InstallModuleManPage(i810) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810.cpp:1.6 xc/programs/Xserver/hw/xfree86/drivers/i810/i810.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810.cpp:1.6 Mon Dec 11 15:18:17 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810.cpp Mon Jun 4 12:40:55 2001 @@ -1,71 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.cpp,v 1.6 2000/12/11 20:18:17 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH I810 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -i810 \- Intel i810 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qi810\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B i810 -is an XFree86 driver for the Intel i810 family of graphics chipsets. -The driver supports depths 8, 15, 16 and 24. All visual types are -supported in depth 8, other depths only support TrueColor. The driver -supports hardware accelerated 3D via the Direct Rendering Infrastructure (DRI), -but only in depth 16. -.SH SUPPORTED HARDWARE -.B i810 -supports the i810, i810-DC100, i810e and i815 chipsets. - -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The i810 has a unified memory architecture and uses system memory -for video ram. By default 8 Megabytes of system memory are used -for graphics. This amount may be changed with the -.B VideoRam -entry in the config file -.B "Device" -section. It may be set to any power of two between 4 and 32 Megabytes -inclusive to allow the user to customize the balance between main -memory usage and graphics performance. Too little memory reserved for -graphics can result in decreased 3D and 2D graphics performance and -features. -.PP -The following driver -.B Options -are supported -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Disable or enable software cursor. Default: software cursor is disable -and a hardware cursor is used. -.TP -.BI "Option \*qColorKey\*q \*q" integer \*q -This sets the default pixel value for the YUV video overlay key. -Default: undefined. -.TP -.BI "Option \*qCacheLines\*q \*q" integer \*q -This allows the user to change the amount of graphics memory used for -2D acceleration and video. Decreasing this amount leaves more for 3D -textures. Increasing it can improve 2D performance at the expense of -3D performance. -Default: 256 to 768 depending on the resolution and depth. - - - -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Keith Whitwell, and also Jonathan Bian, Matthew J Sottek, -Jeff Hartmann, Mark Vojkovich, Alan Hourihane, H. J. Lu. Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h:1.19 xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h:1.19 Fri Dec 1 09:28:56 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h Fri May 18 20:26:44 2001 @@ -25,7 +25,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h,v 1.19 2000/12/01 14:28:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.h,v 1.21 2001/05/19 00:26:44 dawes Exp $ */ /* * Authors: @@ -136,6 +136,8 @@ unsigned char *MMIOBase; unsigned char *FbBase; long FbMapSize; + long DepthOffset; + long BackOffset; int cpp; int MaxClock; @@ -230,6 +232,7 @@ Bool agpAcquired2d; XF86VideoAdaptorPtr adaptor; + OptionInfoPtr Options; } I810Rec; #define I810PTR(p) ((I810Ptr)((p)->driverPrivate)) Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/i810/i810.man:1.2 --- /dev/null Mon Jun 4 12:40:55 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810.man Sat Jan 27 13:20:48 2001 @@ -0,0 +1,71 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810.man,v 1.2 2001/01/27 18:20:48 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH I810 __drivermansuffix__ __vendorversion__ +.SH NAME +i810 \- Intel i810 video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qi810\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B i810 +is an XFree86 driver for the Intel i810 family of graphics chipsets. +The driver supports depths 8, 15, 16 and 24. All visual types are +supported in depth 8, other depths only support TrueColor. The driver +supports hardware accelerated 3D via the Direct Rendering Infrastructure (DRI), +but only in depth 16. +.SH SUPPORTED HARDWARE +.B i810 +supports the i810, i810-DC100, i810e and i815 chipsets. + +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The i810 has a unified memory architecture and uses system memory +for video ram. By default 8 Megabytes of system memory are used +for graphics. This amount may be changed with the +.B VideoRam +entry in the config file +.B "Device" +section. It may be set to any power of two between 4 and 32 Megabytes +inclusive to allow the user to customize the balance between main +memory usage and graphics performance. Too little memory reserved for +graphics can result in decreased 3D and 2D graphics performance and +features. +.PP +The following driver +.B Options +are supported +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +Disable or enable software cursor. Default: software cursor is disable +and a hardware cursor is used. +.TP +.BI "Option \*qColorKey\*q \*q" integer \*q +This sets the default pixel value for the YUV video overlay key. +Default: undefined. +.TP +.BI "Option \*qCacheLines\*q \*q" integer \*q +This allows the user to change the amount of graphics memory used for +2D acceleration and video. Decreasing this amount leaves more for 3D +textures. Increasing it can improve 2D performance at the expense of +3D performance. +Default: 256 to 768 depending on the resolution and depth. + + + +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Keith Whitwell, and also Jonathan Bian, Matthew J Sottek, +Jeff Hartmann, Mark Vojkovich, Alan Hourihane, H. J. Lu. Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c:1.13 Fri Dec 1 09:28:56 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c Fri May 18 20:26:44 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.13 2000/12/01 14:28:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.c,v 1.21 2001/05/19 00:26:44 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -19,18 +19,18 @@ static char I810ClientDriverName[] = "i810"; static Bool I810InitVisualConfigs(ScreenPtr pScreen); -static Bool I810CreateContext(ScreenPtr pScreen, VisualPtr visual, +static Bool I810CreateContext(ScreenPtr pScreen, VisualPtr visual, drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore); static void I810DestroyContext(ScreenPtr pScreen, drmContext hwContext, DRIContextType contextStore); -static void I810DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType readContextType, +static void I810DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, + DRIContextType readContextType, void *readContextStore, - DRIContextType writeContextType, + DRIContextType writeContextType, void *writeContextStore); static void I810DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -static void I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, +static void I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); extern void GlxSetVisualConfigs(int nconfigs, @@ -57,10 +57,10 @@ { I810Ptr pI810 = I810PTR(pScrn); Bool ret_val; - + ret_val = drmI810CleanupDma(pI810->drmSubFD); if (ret_val == FALSE) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "I810 Dma Cleanup Failed\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[dri] I810 Dma Cleanup Failed\n"); return ret_val; } @@ -68,14 +68,15 @@ { I810Ptr pI810 = I810PTR(pScrn); I810RingBuffer *ring = &(pI810->LpRing); + I810DRIPtr pI810DRI = (I810DRIPtr) pI810->pDRIInfo->devPrivate; drmI810Init info; Bool ret_val; - + info.start = ring->mem.Start; - info.end = ring->mem.End; + info.end = ring->mem.End; info.size = ring->mem.Size; - info.ring_map_idx = 6; - info.buffer_map_idx = 5; + info.mmio_offset = (unsigned int)pI810DRI->regs; + info.buffers_offset = (unsigned int)pI810->buffer_map; info.sarea_off = sizeof(XF86DRISAREARec); info.front_offset = 0; @@ -87,7 +88,10 @@ info.pitch_bits = pI810->auxPitchBits; ret_val = drmI810InitDma(pI810->drmSubFD, &info); - if(ret_val == FALSE) ErrorF("I810 Dma Initialization Failed\n"); + if(ret_val == FALSE) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "[drm] I810 Dma Initialization failed.\n"); + } return ret_val; } @@ -111,24 +115,24 @@ 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); return FALSE; } - for (i=0; i<numConfigs; i++) + for (i=0; i<numConfigs; i++) pI810ConfigPtrs[i] = &pI810Configs[i]; i = 0; @@ -167,7 +171,7 @@ pConfigs[i].depthSize = 0; if (stencil) pConfigs[i].stencilSize = 8; - else + else pConfigs[i].stencilSize = 0; pConfigs[i].auxBuffers = 0; pConfigs[i].level = 0; @@ -203,7 +207,6 @@ return log2; } - Bool I810DRIScreenInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -219,7 +222,7 @@ int bufs; int width = pScrn->displayWidth * pI810->cpp; int i; - + /* Hardware 3D rendering only implemented for 16bpp */ /* And it only works for 5:6:5 (Mark) */ if (pScrn->depth != 16) @@ -232,17 +235,19 @@ if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE; if (!xf86LoaderCheckSymbol("DRIQueryVersion")) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "TDFXDRIScreenInit failed (libdri.a too old)\n"); + "[dri] I810DRIScreenInit failed (libdri.a too old)\n"); return FALSE; } - + /* Check the DRI version */ { int major, minor, patch; DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 0 || patch < 0) { + if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "I810DRIScreenInit failed (DRI version = %d.%d.%d, expected 3.0.x). Disabling DRI.\n", + "[dri] I810DRIScreenInit failed because of a version mismatch.\n" + "[dri] libDRI version is %d.%d.%d bug version 4.0.x is needed.\n" + "[dri] Disabling DRI.\n", major, minor, patch); return FALSE; } @@ -250,7 +255,8 @@ pDRIInfo = DRICreateInfoRec(); if (!pDRIInfo) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "DRICreateInfoRec failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] DRICreateInfoRec failed. Disabling DRI.\n"); return FALSE; } @@ -273,8 +279,8 @@ pDRIInfo->ddxDriverMinorVersion = I810_MINOR_VERSION; pDRIInfo->ddxDriverPatchVersion = I810_PATCHLEVEL; pDRIInfo->frameBufferPhysicalAddress = pI810->LinearAddr; - pDRIInfo->frameBufferSize = (((pScrn->displayWidth * - pScrn->virtualY * pI810->cpp) + + pDRIInfo->frameBufferSize = (((pScrn->displayWidth * + pScrn->virtualY * pI810->cpp) + 4096 - 1) / 4096) * 4096; pDRIInfo->frameBufferStride = pScrn->displayWidth*pI810->cpp; @@ -289,12 +295,12 @@ * in the SAREA header */ if (sizeof(XF86DRISAREARec)+sizeof(I810SAREARec)>SAREA_MAX) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "Data does not fit in SAREA\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "[dri] Data does not fit in SAREA\n"); return FALSE; } 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; @@ -302,37 +308,41 @@ pDRIInfo->devPrivate = pI810DRI; pDRIInfo->devPrivateSize = sizeof(I810DRIRec); pDRIInfo->contextSize = sizeof(I810DRIContextRec); - + pDRIInfo->CreateContext = I810CreateContext; pDRIInfo->DestroyContext = I810DestroyContext; pDRIInfo->SwapContext = I810DRISwapContext; pDRIInfo->InitBuffers = I810DRIInitBuffers; pDRIInfo->MoveBuffers = I810DRIMoveBuffers; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; - - + + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; + /* This adds the framebuffer as a drm map *before* we have asked agp * to allocate it. Scary stuff, hold on... */ if (!DRIScreenInit(pScreen, pDRIInfo, &pI810->drmSubFD)) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] DRIScreenInit failed. Disabling DRI.\n"); xfree(pDRIInfo->devPrivate); pDRIInfo->devPrivate=0; DRIDestroyInfoRec(pI810->pDRIInfo); pI810->pDRIInfo=0; return FALSE; } - + /* Check the i810 DRM version */ { drmVersionPtr version = drmGetVersion(pI810->drmSubFD); if (version) { if (version->version_major != 1 || - version->version_minor != 1 || - version->version_patchlevel < 0) { + version->version_minor < 1) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, - "I810DRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n", + "[dri] I810DRIScreenInit failed because of a version mismatch.\n" + "[dri] i810.o kernel module version is %d.%d.%d but version 1.0.x is needed.\n" + "[dri] Disabling DRI.\n", version->version_major, version->version_minor, version->version_patchlevel); @@ -345,33 +355,33 @@ } pI810DRI->regsSize=I810_REG_SIZE; - if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->MMIOAddr, + if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->MMIOAddr, pI810DRI->regsSize, DRM_REGISTERS, 0, &pI810DRI->regs)<0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(regs) failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAddMap(regs) failed\n"); DRICloseScreen(pScreen); return FALSE; } xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n", pI810DRI->regs); - + pI810->backHandle = 0; pI810->zHandle = 0; pI810->cursorHandle = 0; pI810->sysmemHandle = 0; pI810->agpAcquired = FALSE; pI810->dcacheHandle = 0; - + /* Agp Support - Need this just to get the framebuffer. */ if(drmAgpAcquire(pI810->drmSubFD) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAgpAquire failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpAquire failed\n"); DRICloseScreen(pScreen); return FALSE; } pI810->agpAcquired = TRUE; - + if (drmAgpEnable(pI810->drmSubFD, 0) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAgpEnable failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpEnable failed\n"); DRICloseScreen(pScreen); return FALSE; } @@ -380,23 +390,23 @@ memset (&pI810->BackBuffer, 0, sizeof(I810MemRange)); memset (&pI810->DepthBuffer, 0, sizeof(I810MemRange)); pI810->CursorPhysical = 0; - + /* Dcache - half the speed of normal ram, but has use as a Z buffer - * under the DRI. + * under the DRI. */ drmAgpAlloc(pI810->drmSubFD, 4096 * 1024, 1, NULL, &dcacheHandle); pI810->dcacheHandle = dcacheHandle; - xf86DrvMsg(pScreen->myNum, X_INFO, "dcacheHandle : %p\n", dcacheHandle); - + xf86DrvMsg(pScreen->myNum, X_INFO, "[agp] dcacheHandle : %p\n", dcacheHandle); + #define Elements(x) sizeof(x)/sizeof(*x) - for (pitch_idx = 0 ; pitch_idx < Elements(i810_pitches) ; pitch_idx++) - if (width <= i810_pitches[pitch_idx]) + for (pitch_idx = 0 ; pitch_idx < Elements(i810_pitches) ; pitch_idx++) + if (width <= i810_pitches[pitch_idx]) break; - + if (pitch_idx == Elements(i810_pitches)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Couldn't find depth/back buffer pitch"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[dri] Couldn't find depth/back buffer pitch"); DRICloseScreen(pScreen); return FALSE; } @@ -404,11 +414,11 @@ back_size = i810_pitches[pitch_idx] * (pScrn->virtualY + 4); back_size = ((back_size + 4096 - 1) / 4096) * 4096; } - + sysmem_size = pScrn->videoRam * 1024; if (dcacheHandle != 0) { if (back_size > 4*1024*1024) { - xf86DrvMsg(pScreen->myNum, X_INFO, "Backsize is larger then 4 meg\n"); + xf86DrvMsg(pScreen->myNum, X_INFO, "[dri] Backsize is larger then 4 meg\n"); sysmem_size = sysmem_size - 2*back_size; drmAgpFree(pI810->drmSubFD, dcacheHandle); pI810->dcacheHandle = dcacheHandle = 0; @@ -421,13 +431,13 @@ sysmem_size = sysmem_size - 2*back_size; } - if(sysmem_size > 48*1024*1024) { - sysmem_size = 48*1024*1024; + if(sysmem_size > pI810->FbMapSize) { + sysmem_size = pI810->FbMapSize; xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "User requested more memory then fits in the agp aperture\n" - "Truncating to %d bytes of memory\n", - sysmem_size); + "[dri] User requested more memory then fits in the agp" + " aperture\n\tTruncating to %d bytes of memory\n", + sysmem_size); } sysmem_size -= 4096; /* remove 4k for the hw cursor */ @@ -440,121 +450,119 @@ pI810->SavedSysMem = pI810->SysMem; if (dcacheHandle != 0) { - /* The Z buffer is always aligned to the 48 mb mark in the aperture */ - if(drmAgpBind(pI810->drmSubFD, dcacheHandle, 48*1024*1024) == 0) { + if(drmAgpBind(pI810->drmSubFD, dcacheHandle, pI810->DepthOffset) == 0) { memset (&pI810->DcacheMem, 0, sizeof(I810MemRange)); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "GART: Found 4096K Z buffer memory\n"); - pI810->DcacheMem.Start = 48*1024*1024; + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[agp] GART: Found 4096K Z buffer memory\n"); + pI810->DcacheMem.Start = pI810->DepthOffset; pI810->DcacheMem.Size = 1024 * 4096; pI810->DcacheMem.End = pI810->DcacheMem.Start + pI810->DcacheMem.Size; - if (!I810AllocLow(&(pI810->DepthBuffer), + if (!I810AllocLow(&(pI810->DepthBuffer), &(pI810->DcacheMem), - back_size)) + back_size)) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Depth buffer allocation failed\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[agp] Depth buffer allocation failed\n"); DRICloseScreen(pScreen); return FALSE; } } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: dcache bind failed\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] GART: dcache bind failed\n"); drmAgpFree(pI810->drmSubFD, dcacheHandle); pI810->dcacheHandle = dcacheHandle = 0; - } + } } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: no dcache memory found\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] GART: no dcache memory found\n"); } drmAgpAlloc(pI810->drmSubFD, back_size, 0, NULL, &agpHandle); pI810->backHandle = agpHandle; - + if (agpHandle != 0) { - /* The backbuffer is always aligned to the 56 mb mark in the aperture */ - if(drmAgpBind(pI810->drmSubFD, agpHandle, 56*1024*1024) == 0) { + if(drmAgpBind(pI810->drmSubFD, agpHandle, pI810->BackOffset) == 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Bound backbuffer memory\n"); - - pI810->BackBuffer.Start = 56*1024*1024; + "[agp] Bound backbuffer memory\n"); + + pI810->BackBuffer.Start = pI810->BackOffset; pI810->BackBuffer.Size = back_size; - pI810->BackBuffer.End = (pI810->BackBuffer.Start + + pI810->BackBuffer.End = (pI810->BackBuffer.Start + pI810->BackBuffer.Size); } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Unable to bind backbuffer\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[agp] Unable to bind backbuffer. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Unable to allocate backbuffer memory\n"); + "[dri] Unable to allocate backbuffer memory. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } - + if(dcacheHandle == 0) { - /* The Z buffer is always aligned to the 48 mb mark in the aperture */ drmAgpAlloc(pI810->drmSubFD, back_size, 0, NULL, &agpHandle); pI810->zHandle = agpHandle; if(agpHandle != 0) { - if(drmAgpBind(pI810->drmSubFD, agpHandle, 48*1024*1024) == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Bound depthbuffer memory\n"); - pI810->DepthBuffer.Start = 48*1024*1024; + if(drmAgpBind(pI810->drmSubFD, agpHandle, pI810->DepthOffset) == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] Bound depthbuffer memory\n"); + pI810->DepthBuffer.Start = pI810->DepthOffset; pI810->DepthBuffer.Size = back_size; - pI810->DepthBuffer.End = (pI810->DepthBuffer.Start + + pI810->DepthBuffer.End = (pI810->DepthBuffer.Start + pI810->DepthBuffer.Size); } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Unable to bind depthbuffer\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[agp] Unable to bind depthbuffer. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } } else { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Unable to allocate depthbuffer memory\n"); + "[agp] Unable to allocate depthbuffer memory. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } - } - + } + /* Now allocate and bind the agp space. This memory will include the * regular framebuffer as well as texture memory. */ drmAgpAlloc(pI810->drmSubFD, sysmem_size, 0, NULL, &agpHandle); if (agpHandle == 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAgpAlloc failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpAlloc failed\n"); DRICloseScreen(pScreen); return FALSE; } pI810->sysmemHandle = agpHandle; if (drmAgpBind(pI810->drmSubFD, agpHandle, 0) != 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAgpBind failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, "[agp] drmAgpBind failed\n"); DRICloseScreen(pScreen); return FALSE; } - - drmAgpAlloc(pI810->drmSubFD, 4096, 2, - (unsigned long *)&pI810->CursorPhysical, &agpHandle); + + drmAgpAlloc(pI810->drmSubFD, 4096, 2, + (unsigned long *)&pI810->CursorPhysical, &agpHandle); pI810->cursorHandle = agpHandle; if (agpHandle != 0) { tom = sysmem_size; - if (drmAgpBind(pI810->drmSubFD, agpHandle, tom) == 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "GART: Allocated 4K for mouse cursor image\n"); - pI810->CursorStart = tom; + if (drmAgpBind(pI810->drmSubFD, agpHandle, tom) == 0) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "[agp] GART: Allocated 4K for mouse cursor image\n"); + pI810->CursorStart = tom; tom += 4096; } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: cursor bind failed\n"); - pI810->CursorPhysical = 0; - } + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] GART: cursor bind failed\n"); + pI810->CursorPhysical = 0; + } } else { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "GART: cursor alloc failed\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[agp] GART: cursor alloc failed\n"); pI810->CursorPhysical = 0; } @@ -572,34 +580,36 @@ pI810->DepthBuffer.Start, i810_pitches[pitch_idx], 8*1024*1024); - + I810SetTiledMemory(pScrn, 2, pI810->BackBuffer.Start, i810_pitches[pitch_idx], 8*1024*1024); - + pI810->auxPitch = i810_pitches[pitch_idx]; pI810->auxPitchBits = i810_pitch_flags[pitch_idx]; pI810->SavedDcacheMem = pI810->DcacheMem; pI810DRI->backbufferSize = pI810->BackBuffer.Size; if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->BackBuffer.Start, - pI810->BackBuffer.Size, DRM_AGP, 0, + pI810->BackBuffer.Size, DRM_AGP, 0, &pI810DRI->backbuffer) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(backbuffer) failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAddMap(backbuffer) failed. Disabling DRI\n"); DRICloseScreen(pScreen); return FALSE; } - + pI810DRI->depthbufferSize = pI810->DepthBuffer.Size; if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->DepthBuffer.Start, - pI810->DepthBuffer.Size, DRM_AGP, 0, + pI810->DepthBuffer.Size, DRM_AGP, 0, &pI810DRI->depthbuffer) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(depthbuffer) failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAddMap(depthbuffer) failed. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } - + /* Allocate FrontBuffer etc. */ if (!I810AllocateFront(pScrn)) { DRICloseScreen(pScreen); @@ -607,24 +617,25 @@ } /* Allocate buffer memory */ - I810AllocHigh( &(pI810->BufferMem), &(pI810->SysMem), + I810AllocHigh( &(pI810->BufferMem), &(pI810->SysMem), I810_DMA_BUF_NR * I810_DMA_BUF_SZ); - - xf86DrvMsg(pScreen->myNum, X_INFO, "Buffer map : %lx\n", + + xf86DrvMsg(pScreen->myNum, X_INFO, "[dri] Buffer map : %lx\n", pI810->BufferMem.Start); - - if (pI810->BufferMem.Start == 0 || - pI810->BufferMem.End - pI810->BufferMem.Start > + + if (pI810->BufferMem.Start == 0 || + pI810->BufferMem.End - pI810->BufferMem.Start > I810_DMA_BUF_NR * I810_DMA_BUF_SZ) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "Not enough memory for dma buffers\n"); + "[dri] Not enough memory for dma buffers. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->BufferMem.Start, pI810->BufferMem.Size, DRM_AGP, 0, &pI810->buffer_map) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(buffer_map) failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAddMap(buffer_map) failed. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } @@ -635,11 +646,12 @@ if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->LpRing.mem.Start, pI810->LpRing.mem.Size, DRM_AGP, 0, &pI810->ring_map) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(ring_map) failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAddMap(ring_map) failed. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } - + /* Use the rest of memory for textures. */ pI810DRI->textureSize = pI810->SysMem.Size; @@ -652,28 +664,30 @@ pI810DRI->textureSize = (pI810DRI->textureSize >> i) << i; /* truncate */ if(pI810DRI->textureSize < 512*1024) { - ErrorF("Less then 512k for textures\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] Less then 512k memory left for textures. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } - + I810AllocLow( &(pI810->TexMem), &(pI810->SysMem), pI810DRI->textureSize); - + if (drmAddMap(pI810->drmSubFD, (drmHandle)pI810->TexMem.Start, pI810->TexMem.Size, DRM_AGP, 0, &pI810DRI->textures) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap(textures) failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[drm] drmAddMap(textures) failed. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } - + if((bufs = drmAddBufs(pI810->drmSubFD, I810_DMA_BUF_NR, I810_DMA_BUF_SZ, DRM_AGP_BUFFER, pI810->BufferMem.Start)) <= 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] failure adding %d %d byte DMA buffers\n", + "[drm] failure adding %d %d byte DMA buffers. Disabling DRI.\n", I810_DMA_BUF_NR, I810_DMA_BUF_SZ); DRICloseScreen(pScreen); @@ -683,9 +697,10 @@ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] added %d %d byte DMA buffers\n", bufs, I810_DMA_BUF_SZ); + xf86EnablePciBusMaster(pI810->PciInfo, TRUE); I810InitDma(pScrn); - + /* Okay now initialize the dma engine */ if (!pI810DRI->irq) { @@ -700,7 +715,7 @@ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] failure adding irq handler, there is a device " "already using that irq\n Consider rearranging your " - "PCI cards\n"); + "PCI cards. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } @@ -709,40 +724,41 @@ xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] dma control initialized, using IRQ %d\n", pI810DRI->irq); - - pI810DRI=(I810DRIPtr)pI810->pDRIInfo->devPrivate; + pI810DRI->deviceID=pI810->PciInfo->chipType; pI810DRI->width=pScrn->virtualX; pI810DRI->height=pScrn->virtualY; pI810DRI->mem=pScrn->videoRam*1024; pI810DRI->cpp=pI810->cpp; - + pI810DRI->fbOffset=pI810->FrontBuffer.Start; pI810DRI->fbStride=pI810->auxPitch; - + pI810DRI->bitsPerPixel = pScrn->bitsPerPixel; - - + + pI810DRI->textureOffset=pI810->TexMem.Start; - + pI810DRI->backOffset=pI810->BackBuffer.Start; pI810DRI->depthOffset=pI810->DepthBuffer.Start; - + pI810DRI->ringOffset=pI810->LpRing.mem.Start; pI810DRI->ringSize=pI810->LpRing.mem.Size; - + pI810DRI->auxPitch = pI810->auxPitch; pI810DRI->auxPitchBits = pI810->auxPitchBits; + pI810DRI->sarea_priv_offset = sizeof(XF86DRISAREARec); if (!(I810InitVisualConfigs(pScreen))) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "I810InitVisualConfigs failed\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] I810InitVisualConfigs failed. Disabling DRI.\n"); DRICloseScreen(pScreen); return FALSE; } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "visual configs initialized\n" ); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized.\n" ); pI810->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; - + return TRUE; } @@ -761,7 +777,7 @@ if(pI810->sysmemHandle) drmAgpFree(pI810->drmSubFD, pI810->sysmemHandle); if(pI810->agpAcquired == TRUE) drmAgpRelease(pI810->drmSubFD); - + pI810->backHandle = 0; pI810->zHandle = 0; pI810->cursorHandle = 0; @@ -769,7 +785,7 @@ pI810->agpAcquired = FALSE; pI810->dcacheHandle = 0; - + DRICloseScreen(pScreen); if (pI810->pDRIInfo) { @@ -785,7 +801,7 @@ } static Bool -I810CreateContext(ScreenPtr pScreen, VisualPtr visual, +I810CreateContext(ScreenPtr pScreen, VisualPtr visual, drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore) { @@ -793,7 +809,7 @@ } static void -I810DestroyContext(ScreenPtr pScreen, drmContext hwContext, +I810DestroyContext(ScreenPtr pScreen, drmContext hwContext, DRIContextType contextStore) { } @@ -808,29 +824,29 @@ } void -I810DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, +I810DRISwapContext(ScreenPtr pScreen, DRISyncType syncType, DRIContextType oldContextType, void *oldContext, DRIContextType newContextType, void *newContext) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; I810Ptr pI810 = I810PTR(pScrn); - if (syncType == DRI_3D_SYNC && + if (syncType == DRI_3D_SYNC && oldContextType == DRI_2D_CONTEXT && - newContextType == DRI_2D_CONTEXT) - { + newContextType == DRI_2D_CONTEXT) + { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("I810DRISwapContext (in)\n"); - + pI810->LockHeld = 1; I810RefreshRing( pScrn ); } - else if (syncType == DRI_2D_SYNC && + else if (syncType == DRI_2D_SYNC && oldContextType == DRI_NO_CONTEXT && - newContextType == DRI_2D_CONTEXT) - { + newContextType == DRI_2D_CONTEXT) + { pI810->LockHeld = 0; if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF("I810DRISwapContext (out)\n"); @@ -854,7 +870,7 @@ I810SetupForSolidFill(pScrn, 0, GXcopy, -1); while (nbox--) { I810SelectBuffer(pScrn, I810_BACK); - I810SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + I810SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, pbox->x2-pbox->x1, pbox->y2-pbox->y1); pbox++; } @@ -865,8 +881,8 @@ nbox = REGION_NUM_RECTS(prgn); I810SelectBuffer(pScrn, I810_DEPTH); I810SetupForSolidFill(pScrn, 0xffff, GXcopy, -1); - while (nbox--) { - I810SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + while (nbox--) { + I810SubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, pbox->x2-pbox->x1, pbox->y2-pbox->y1); pbox++; } @@ -877,12 +893,12 @@ /* This routine is a modified form of XAADoBitBlt with the calls to * ScreenToScreenBitBlt built in. My routine has the prgnSrc as source * instead of destination. My origin is upside down so the ydir cases - * are reversed. + * are reversed. * * KW: can you believe that this is called even when a 2d window moves? */ static void -I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, +I810DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index) { ScreenPtr pScreen = pParent->drawable.pScreen; @@ -985,21 +1001,21 @@ I810EmitFlush(pScrn); I810SetupForScreenToScreenCopy(pScrn, xdir, ydir, GXcopy, -1, -1); for ( ; nbox-- ; pbox++ ) { - + int x1 = pbox->x1; int y1 = pbox->y1; int destx = x1 + dx; int desty = y1 + dy; int w = pbox->x2 - x1 + 1; int h = pbox->y2 - y1 + 1; - - if ( destx < 0 ) x1 -= destx, w += destx, destx = 0; + + if ( destx < 0 ) x1 -= destx, w += destx, destx = 0; if ( desty < 0 ) y1 -= desty, h += desty, desty = 0; if ( destx + w > screenwidth ) w = screenwidth - destx; if ( desty + h > screenheight ) h = screenheight - desty; if ( w <= 0 ) continue; if ( h <= 0 ) continue; - + if (I810_DEBUG & DEBUG_VERBOSE_DRI) ErrorF( "MoveBuffers %d,%d %dx%d dx: %d dy: %d\n", Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h:1.3 Fri Jun 16 20:03:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h Wed Mar 21 12:02:23 2001 @@ -1,10 +1,10 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.3 2000/06/17 00:03:18 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_dri.h,v 1.5 2001/03/21 17:02:23 dawes Exp $ */ #ifndef _I810_DRI_ #define _I810_DRI_ -#include <xf86drm.h> -#include <xf86drmI810.h> +#include "xf86drm.h" +#include "xf86drmI810.h" #define I810_MAX_DRAWABLES 256 @@ -50,6 +50,7 @@ drmBufMapPtr drmBufs; int irq; + unsigned int sarea_priv_offset; } I810DRIRec, *I810DRIPtr; Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c:1.39.2.1 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c:1.49.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c:1.39.2.1 Thu Feb 8 14:31:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c Wed May 23 16:21:52 2001 @@ -25,7 +25,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.39.2.1 2001/02/08 19:31:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_driver.c,v 1.49.2.1 2001/05/23 20:21:52 dawes Exp $ */ /* * Authors: @@ -35,7 +35,6 @@ /* * This server does not support these XFree86 4.0 features yet - * DDC1 & DDC2 (requires I2C) * shadowFb (if requested or acceleration is off) * Overlay planes * DGA @@ -72,7 +71,7 @@ /* Required Functions: */ static void I810Identify(int flags); -static OptionInfoPtr I810AvailableOptions(int chipid, int busid); +static const OptionInfoRec * I810AvailableOptions(int chipid, int busid); static Bool I810Probe(DriverPtr drv, int flags); static Bool I810PreInit(ScrnInfoPtr pScrn, int flags); static Bool I810ScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv); @@ -84,11 +83,9 @@ static int I810ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); -#ifdef DPMSExtension static void I810DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagermentMode, int flags); -#endif DriverRec I810 = { I810_VERSION, @@ -123,16 +120,18 @@ OPTION_COLOR_KEY, OPTION_CACHE_LINES, OPTION_DAC_6BIT, - OPTION_DRI + OPTION_DRI, + OPTION_NO_DDC } I810Opts; -static OptionInfoRec I810Options[] = { +static const OptionInfoRec I810Options[] = { { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_COLOR_KEY, "ColorKey", OPTV_INTEGER, {0}, FALSE }, { OPTION_CACHE_LINES, "CacheLines", OPTV_INTEGER, {0}, FALSE}, { OPTION_DAC_6BIT, "Dac6Bit", OPTV_BOOLEAN, {0}, FALSE}, { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_NO_DDC, "NoDDC", OPTV_BOOLEAN, {0}, FALSE}, { -1, NULL, OPTV_NONE, {0}, FALSE} }; @@ -158,13 +157,24 @@ NULL }; - static const char *miscSymbols[] = { "GetTimeInMillis", NULL }; +static const char *vbeSymbols[] = { + "VBEInit", + "vbeDoEDID", + "vbeFree", + NULL +}; +static const char *ddcSymbols[] = { + "xf86PrintEDID", + "xf86SetDDCproperties", + NULL +}; + static const char *xaaSymbols[] = { "XAADestroyInfoRec", "XAACreateInfoRec", @@ -290,7 +300,8 @@ drmSymbols, driSymbols, #endif - NULL /* ddcsymbols */, + vbeSymbols, + ddcSymbols, NULL /* i2csymbols */, NULL /* shadowSymbols */, NULL /* fbdevsymbols */, @@ -344,8 +355,7 @@ xf86PrintChipsets(I810_NAME, "Driver for Intel i810 chipset", I810Chipsets); } -static -OptionInfoPtr +static const OptionInfoRec * I810AvailableOptions(int chipid, int busid) { return I810Options; @@ -424,6 +434,30 @@ } } +static xf86MonPtr +I810DoDDC(ScrnInfoPtr pScrn, int index) +{ + vbeInfoPtr pVbe; + xf86MonPtr MonInfo = NULL; + I810Ptr pI810 = I810PTR(pScrn); + + /* Honour Option "noDDC" */ + if (xf86ReturnOptValBool(pI810->Options, OPTION_NO_DDC, FALSE) ) { + return MonInfo; + } + + if (xf86LoadSubModule(pScrn, "vbe") && (pVbe = VBEInit(NULL,index))) { + MonInfo = vbeDoEDID(pVbe, NULL); + xf86PrintEDID( MonInfo ); + xf86SetDDCproperties(pScrn, MonInfo); + vbeFree(pVbe); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "this driver cannot do DDC without VBE\n"); + } + + return MonInfo; +} + /* * I810PreInit -- * @@ -444,14 +478,6 @@ if (pScrn->numEntities != 1) return FALSE; - /* The vgahw module should be loaded here when needed */ - if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; - - xf86LoaderReqSymLists(vgahwSymbols, NULL); - - /* Allocate a vgaHWRec */ - if (!vgaHWGetHWRec(pScrn)) return FALSE; - /* Allocate driverPrivate */ if (!I810GetRec(pScrn)) return FALSE; @@ -465,6 +491,14 @@ return TRUE; } + /* The vgahw module should be loaded here when needed */ + if (!xf86LoadSubModule(pScrn, "vgahw")) return FALSE; + + xf86LoaderReqSymLists(vgahwSymbols, NULL); + + /* Allocate a vgaHWRec */ + if (!vgaHWGetHWRec(pScrn)) return FALSE; + pI810->PciInfo = xf86GetPciInfoForEntity(pI810->pEnt->index); pI810->PciTag = pciTag(pI810->PciInfo->bus, pI810->PciInfo->device, pI810->PciInfo->func); @@ -507,24 +541,12 @@ return FALSE; } - pScrn->rgbBits=8; - if (xf86ReturnOptValBool(I810Options, OPTION_DAC_6BIT, FALSE)) - pScrn->rgbBits=6; - if (!xf86SetWeight(pScrn, defaultWeight, defaultWeight)) return FALSE; 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; @@ -533,16 +555,30 @@ /* Process the options */ xf86CollectOptions(pScrn, NULL); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, I810Options); + if (!(pI810->Options = xalloc(sizeof(I810Options)))) + return FALSE; + memcpy(pI810->Options, I810Options, sizeof(I810Options)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pI810->Options); + pScrn->rgbBits=8; + if (xf86ReturnOptValBool(pI810->Options, OPTION_DAC_6BIT, FALSE)) + pScrn->rgbBits=6; + /* 6-BIT dac isn't reasonable for modes with > 8bpp */ - if (xf86ReturnOptValBool(I810Options, OPTION_DAC_6BIT, FALSE) && + if (xf86ReturnOptValBool(pI810->Options, OPTION_DAC_6BIT, FALSE) && pScrn->bitsPerPixel>8) { OptionInfoPtr ptr; - ptr=xf86TokenToOptinfo(I810Options, OPTION_DAC_6BIT); + ptr=xf86TokenToOptinfo(pI810->Options, OPTION_DAC_6BIT); ptr->found=FALSE; } + /* Get DDC info from monitor */ + /* after xf86ProcessOptions, + * because it is controlled by options [no]vbe and [no]ddc + */ + pScrn->monitor->DDC = I810DoDDC(pScrn, pI810->pEnt->index); + + /* We have to use PIO to probe, because we haven't mapped yet */ I810SetPIOAccess(pI810); @@ -656,10 +692,24 @@ xf86DrvMsg(pScrn->scrnIndex, from, "Will alloc AGP framebuffer: %d kByte\n", pScrn->videoRam); + + /* Calculate Fixed Offsets depending on graphics aperture size */ + { + PCITAG bridge; + long smram_miscc; - /* Since we always want write combining on first 32 mb of framebuffer - * we pass a mapsize of 32 mb */ - pI810->FbMapSize = 32*1024*1024; + bridge = pciTag(0,0,0); /* This is always the host bridge */ + smram_miscc = pciReadLong(bridge, SMRAM_MISCC); + if((smram_miscc & GFX_MEM_WIN_SIZE) == GFX_MEM_WIN_32M) { + pI810->FbMapSize = 0x1000000; + pI810->DepthOffset = 0x1000000; + pI810->BackOffset = 0x1800000; + } else { + pI810->FbMapSize = 0x3000000; + pI810->DepthOffset = 0x3000000; + pI810->BackOffset = 0x3800000; + } + } /* * If the driver can do gamma correction, it should call xf86SetGamma() @@ -753,14 +803,14 @@ } xf86LoaderReqSymbols("fbScreenInit", NULL); - if (!xf86ReturnOptValBool(I810Options, OPTION_NOACCEL, FALSE)) { + if (!xf86ReturnOptValBool(pI810->Options, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) { I810FreeRec(pScrn); return FALSE; } } - if (!xf86ReturnOptValBool(I810Options, OPTION_SW_CURSOR, FALSE)) { + if (!xf86ReturnOptValBool(pI810->Options, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) { I810FreeRec(pScrn); return FALSE; @@ -768,7 +818,7 @@ xf86LoaderReqSymLists(ramdacSymbols, NULL); } - if (xf86GetOptValInteger(I810Options, OPTION_COLOR_KEY, &(pI810->colorKey))) + if (xf86GetOptValInteger(pI810->Options, OPTION_COLOR_KEY, &(pI810->colorKey))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video overlay key set to 0x%x\n", pI810->colorKey); @@ -1342,6 +1392,9 @@ 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; @@ -1349,13 +1402,16 @@ 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; } /* Turn on 8 bit dac if requested */ - if (xf86ReturnOptValBool(I810Options, OPTION_DAC_6BIT, FALSE)) + if (xf86ReturnOptValBool(pI810->Options, OPTION_DAC_6BIT, FALSE)) i810Reg->PixelPipeCfg0 = DAC_6_BIT; else i810Reg->PixelPipeCfg0 = DAC_8_BIT; @@ -1487,7 +1543,33 @@ return TRUE; } + static void +I810LoadPalette15(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, + VisualPtr pVisual) { + I810Ptr pI810; + vgaHWPtr hwp; + int i, j, index; + unsigned char r, g, b; + + pI810 = I810PTR(pScrn); + hwp = VGAHWPTR(pScrn); + + for (i=0; i<numColors; i++) { + index=indices[i]; + r=colors[index].red; + g=colors[index].green; + b=colors[index].blue; + for (j=0; j<8; j++) { + hwp->writeDacWriteAddr(hwp, (index<<3)+j); + hwp->writeDacData(hwp, r); + hwp->writeDacData(hwp, g); + hwp->writeDacData(hwp, b); + } + } +} + +static void I810LoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual) { I810Ptr pI810; @@ -1497,23 +1579,58 @@ 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); } } @@ -1527,12 +1644,12 @@ 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); @@ -1555,7 +1672,7 @@ pI810->FbMemBox.y1=0; pI810->FbMemBox.y2=pScrn->virtualY; - xf86GetOptValInteger(I810Options, OPTION_CACHE_LINES, &cache_lines); + xf86GetOptValInteger(pI810->Options, OPTION_CACHE_LINES, &cache_lines); if (cache_lines < 0) { /* make sure there is enough for two DVD sized YUV buffers */ @@ -1563,14 +1680,25 @@ if (pScrn->displayWidth <= 1024) cache_lines *= 2; } - /* Make sure there's enough space for cache_lines. */ + /* Make sure there's enough space for cache_lines. + * + * Had a bug here where maxCacheLines was computed to be less than 0. + * Not sure why 256 was initially subtracted from videoRam in the + * maxCacheLines calculation, but that was causing a problem + * for configurations that have exactly enough Ram for the framebuffer. + * Common code should catch the case where there isn't enough space for + * framebuffer, we'll just check for no space for cache_lines. -jens + * + */ { int maxCacheLines; - maxCacheLines = ((pScrn->videoRam - 256) * 1024 / + maxCacheLines = (pScrn->videoRam * 1024 / (pScrn->bitsPerPixel / 8) / pScrn->displayWidth) - pScrn->virtualY; - if (maxCacheLines >= 0 && cache_lines > maxCacheLines) + if (maxCacheLines < 0) + maxCacheLines = 0; + if (cache_lines > maxCacheLines) cache_lines = maxCacheLines; } pI810->FbMemBox.y2 += cache_lines; @@ -1622,6 +1750,7 @@ vgaHWPtr hwp; I810Ptr pI810; VisualPtr visual; + MessageType driFrom = X_DEFAULT; pScrn = xf86Screens[pScreen->myNum]; pI810 = I810PTR(pScrn); @@ -1631,19 +1760,14 @@ 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; + { I810RegPtr i810Reg = &pI810->ModeReg; int i; @@ -1665,11 +1789,12 @@ * InitGLXVisuals call back. */ - if (!xf86ReturnOptValBool(I810Options, OPTION_NOACCEL, FALSE) && - xf86ReturnOptValBool(I810Options, OPTION_DRI, TRUE)) { - pI810->directRenderingEnabled = I810DRIScreenInit(pScreen); - } else { + if (xf86ReturnOptValBool(pI810->Options, OPTION_NOACCEL, FALSE) || + !xf86ReturnOptValBool(pI810->Options, OPTION_DRI, TRUE)) { pI810->directRenderingEnabled = FALSE; + driFrom = X_CONFIG; + } else { + pI810->directRenderingEnabled = I810DRIScreenInit(pScreen); } #else @@ -1682,7 +1807,7 @@ 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); @@ -1717,11 +1842,14 @@ } } + fbPictureInit (pScreen, 0, 0); + xf86SetBlackWhitePixels(pScreen); #ifdef XF86DRI if (pI810->LpRing.mem.Start == 0 && pI810->directRenderingEnabled) { - pI810->directRenderingEnabled = 0; + pI810->directRenderingEnabled = FALSE; + driFrom = X_PROBED; I810DRICloseScreen(pScreen); } @@ -1742,7 +1870,7 @@ return FALSE; } - if (!xf86ReturnOptValBool(I810Options, OPTION_NOACCEL, FALSE)) { + if (!xf86ReturnOptValBool(pI810->Options, OPTION_NOACCEL, FALSE)) { if (pI810->LpRing.mem.Size != 0) { I810SetRingRegs( pScrn ); @@ -1759,7 +1887,7 @@ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - if (!xf86ReturnOptValBool(I810Options, OPTION_SW_CURSOR, FALSE)) { + if (!xf86ReturnOptValBool(pI810->Options, OPTION_SW_CURSOR, FALSE)) { if (!I810CursorInit(pScreen)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware cursor initialization failed\n"); @@ -1768,26 +1896,27 @@ 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| - CMAP_RELOAD_ON_MODE_SWITCH)) + if (pScrn->depth == 15) { + if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette15, 0, + CMAP_PALETTED_TRUECOLOR| + CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; + } else { + if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette16, 0, + CMAP_PALETTED_TRUECOLOR| + CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; + } } else { if (!xf86HandleColormaps(pScreen, 256, 8, I810LoadPalette24, 0, CMAP_PALETTED_TRUECOLOR| CMAP_RELOAD_ON_MODE_SWITCH)) return FALSE; } -#else - if (!vgaHWHandleColormaps(pScreen)) - return FALSE; -#endif -#ifdef DPMSExtension xf86DPMSInit(pScreen, I810DisplayPowerManagementSet, 0); -#endif I810InitVideo(pScreen); @@ -1801,15 +1930,9 @@ #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; @@ -1981,6 +2104,11 @@ pI810->DcacheMem = pI810->SavedDcacheMem; pI810->DoneFrontAlloc = FALSE; + /* Need to actually close the gart fd, or the unbound memory will just sit + * around. Will prevent the Xserver from recycling. + */ + xf86GARTCloseScreen(scrnIndex); + pScrn->vtSema=FALSE; pScreen->CloseScreen = pI810->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); @@ -2012,7 +2140,6 @@ return vgaHWSaveScreen(pScreen, unblack); } -#ifdef DPMSExtension static void I810DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { @@ -2051,10 +2178,3 @@ /* Set the DPMS mode */ OUTREG8(DPMS_SYNC_SELECT, DPMSSyncSelect); } -#endif - - - - - - Index: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c:1.14 Tue Dec 5 20:40:49 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c Wed Apr 18 10:52:41 2001 @@ -23,18 +23,15 @@ THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.14 2000/12/06 01:40:49 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/i810/i810_video.c,v 1.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> - * - * Notes: - * This module currently allocates 810*2KB out of "SysMem" for the YUV - * buffers. This may not be the best solution ... - * + * Offscreen Images: + * Matt Sottek <matthew.j.sottek@intel.com> */ #include "xf86.h" @@ -64,6 +61,8 @@ #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); @@ -133,6 +132,9 @@ #define BUFFER1_FIELD0 0x00000004 #define OVERLAY_ENABLE 0x00000001 +#define UV_VERT_BUF1 0x02 +#define UV_VERT_BUF0 0x04 + /* * DOV0STA - Display/Overlay 0 Status Register */ @@ -156,6 +158,7 @@ if (pScrn->bitsPerPixel != 8) { newAdaptor = I810SetupImageVideo(pScreen); + I810InitOffscreenImages(pScreen); } num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); @@ -600,6 +603,9 @@ unsigned int *p_w, unsigned int *p_h, pointer data ){ + if(vid_w > (drw_w << 1)) drw_w = vid_w >> 1; + if(vid_h > (drw_h << 1)) drw_h = vid_h >> 1; + *p_w = drw_w; *p_h = drw_h; } @@ -856,6 +862,9 @@ switch(id) { case FOURCC_YV12: case FOURCC_I420: + /* set UV vertical phase to -0.25 */ + overlay->UV_VPH = 0x30003000; + overlay->INIT_PH = UV_VERT_BUF0 | UV_VERT_BUF1; overlay->OV0STRIDE = (dstPitch << 1) | (dstPitch << 16); overlay->OV0CMD &= ~SOURCE_FORMAT; overlay->OV0CMD |= YUV_420; @@ -863,6 +872,8 @@ case FOURCC_UYVY: case FOURCC_YUY2: default: + overlay->UV_VPH = 0; + overlay->INIT_PH = 0; overlay->OV0STRIDE = dstPitch; overlay->OV0CMD &= ~SOURCE_FORMAT; overlay->OV0CMD |= YUV_422; @@ -1126,3 +1137,236 @@ } } } + + +/*************************************************************************** + * 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); +} + Index: xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile:1.3 xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile:1.3 Wed Oct 11 12:21:21 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile Wed May 16 02:48:09 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile,v 1.3 2000/10/11 16:21:21 mvojkovi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/Imakefile,v 1.5 2001/05/16 06:48:09 keithp Exp $ /* * * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -16,10 +16,10 @@ 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$(SERVERSRC)/mi \ + -I$(XF86SRC)/xaa \ -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ - -I$(XF86SRC)/xf24_32bpp -I$(SERVERSRC)/Xext \ + -I$(SERVERSRC)/Xext \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \ -I$(XF86SRC)/fbdevhw -I$(SERVERSRC)/render \ @@ -39,7 +39,6 @@ InstallObjectModule(imstt,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(imstt,) InstallModuleManPage(imstt) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.cpp:1.3 xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.cpp:1.3 Mon Dec 11 15:18:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.cpp Mon Jun 4 12:40:56 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.cpp,v 1.3 2000/12/11 20:18:18 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH IMSTT __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -imstt \- Integrated Micro Solutions Twin Turbo 128 driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qimstt\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B imstt -is an XFree86 driver for Integrated Micro Solutions Twin Turbo 128 video chips. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B imstt -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h diff -u xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h:1.3 Wed Aug 2 19:50:49 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h Wed May 16 02:48:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h,v 1.3 2000/08/02 23:50:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.h,v 1.5 2001/05/16 06:48:09 keithp Exp $ */ #ifndef _IMSTT_H #define _IMSTT_H @@ -34,6 +34,7 @@ Bool FBDev; int Chipset, ChipRev; int ydir; + int color; unsigned long pitch; unsigned long ll; unsigned long screen_width; @@ -58,9 +59,11 @@ } IMSTTRec, *IMSTTPtr; #if 0 -#define IMSTTTRACE ErrorF +#define IMSTTTRACE(s) ErrorF(s) +#define IMSTTTRACE1(s,a) ErrorF(s,a) #else -#define IMSTTTRACE +#define IMSTTTRACE(s) +#define IMSTTTRACE1(s,a) #endif #define IMSTTPTR(p) ((IMSTTPtr)((p)->driverPrivate)) @@ -71,4 +74,6 @@ #define RAMDAC_IBM 1 #define RAMDAC_TVP 2 +Bool IMSTTAccelInit(ScreenPtr pScreen); + #endif /* _IMSTT_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.man:1.2 --- /dev/null Mon Jun 4 12:40:56 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.man Sat Jan 27 13:20:48 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt.man,v 1.2 2001/01/27 18:20:48 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH IMSTT __drivermansuffix__ __vendorversion__ +.SH NAME +imstt \- Integrated Micro Solutions Twin Turbo 128 driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qimstt\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B imstt +is an XFree86 driver for Integrated Micro Solutions Twin Turbo 128 video chips. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B imstt +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c:1.4 Tue Aug 1 16:05:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c Wed May 16 02:48:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c,v 1.4 2000/08/01 20:05:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_accel.c,v 1.6 2001/05/16 06:48:09 keithp Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -41,10 +41,11 @@ static void IMSTTSync(ScrnInfoPtr pScrn) { IMSTTPtr iptr = IMSTTPTR(pScrn); - IMSTTMMIO_VARS(); +/* IMSTTMMIO_VARS(); */ while(INREG(IMSTT_SSTATUS) & 0x80); while(INREG(IMSTT_SSTATUS) & 0x40); + return; } @@ -53,13 +54,20 @@ int rop, unsigned int planemask) { IMSTTPtr iptr = IMSTTPTR(pScrn); - IMSTTMMIO_VARS(); +/* IMSTTMMIO_VARS(); */ - OUTREG(IMSTT_DP_OCTL, iptr->ll); - OUTREG(IMSTT_SP, iptr->ll); - OUTREG(IMSTT_BI, 0xffffffff); - OUTREG(IMSTT_MBC, 0xffffffff); - OUTREG(IMSTT_CLR, color); + switch (pScrn->depth) { + case 8: + iptr->color = color | (color << 8) | (color << 16) | (color << 24); + break; + case 15: + case 16: + iptr->color = color | (color << 8) | (color << 16); + break; + default: + iptr->color = color; + break; + } } @@ -67,15 +75,30 @@ int x, int y, int w, int h) { IMSTTPtr iptr = IMSTTPTR(pScrn); - IMSTTMMIO_VARS(); +/* IMSTTMMIO_VARS(); */ + + x *= (pScrn->bitsPerPixel >> 3); + y *= iptr->ll; + w *= (pScrn->bitsPerPixel >> 3); + h--; + w--; - OUTREG(IMSTT_DSA, y * iptr->ll + x * (pScrn->bitsPerPixel >> 3)); - OUTREG(IMSTT_S1SA, y * iptr->ll + x * (pScrn->bitsPerPixel >> 3)); - OUTREG(IMSTT_CNT, ((h - 1) << 16) | (w * (pScrn->bitsPerPixel >> 3) - 1)); + while(INREG(IMSTT_SSTATUS) & 0x80); + OUTREG(IMSTT_DSA, x + y); + OUTREG(IMSTT_CNT, (h << 16) | w); + OUTREG(IMSTT_DP_OCTL, iptr->ll); + OUTREG(IMSTT_SP, iptr->ll); + OUTREG(IMSTT_BI, 0xffffffff); + OUTREG(IMSTT_MBC, 0xffffffff); + OUTREG(IMSTT_CLR, iptr->color); + if (iptr->rev == 2) OUTREG(IMSTT_BLTCTL, 0x200000); else OUTREG(IMSTT_BLTCTL, 0x840); + + while(INREG(IMSTT_SSTATUS) & 0x80); + while(INREG(IMSTT_SSTATUS) & 0x40); } @@ -84,21 +107,24 @@ int trans_color) { IMSTTPtr iptr = IMSTTPTR(pScrn); - IMSTTMMIO_VARS(); - unsigned long sp, dp, ll, cnt; +/* IMSTTMMIO_VARS(); */ + unsigned long sp, dp, ll; iptr->bltctl = 0x05; + + ll = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3); ll = iptr->ll; + sp = ll << 16; - if (xdir > 0) { + if (xdir < 0) { iptr->bltctl |= 0x80; iptr->cnt = 1; } else { iptr->cnt = 0; } - if (ydir > 0) { + if (ydir < 0) { sp |= -(ll) & 0xffff; dp = -(ll) & 0xffff; iptr->ydir = 1; @@ -110,6 +136,7 @@ iptr->sp = sp; iptr->dp = dp; + iptr->ll = ll; } @@ -119,9 +146,12 @@ int w, int h) { IMSTTPtr iptr = IMSTTPTR(pScrn); - IMSTTMMIO_VARS(); +/* IMSTTMMIO_VARS(); */ unsigned long cnt; + x1 *= (pScrn->bitsPerPixel >> 3); + x2 *= (pScrn->bitsPerPixel >> 3); + w *= (pScrn->bitsPerPixel >> 3); w--; h--; cnt = h << 16; @@ -145,6 +175,8 @@ OUTREG(IMSTT_CNT, cnt); OUTREG(IMSTT_DP_OCTL, iptr->dp); OUTREG(IMSTT_BLTCTL, iptr->bltctl); + while(INREG(IMSTT_SSTATUS) & 0x80); + while(INREG(IMSTT_SSTATUS) & 0x40); } @@ -160,14 +192,28 @@ iptr->ll = pScrn->displayWidth * (pScrn->bitsPerPixel >> 3); - iptr->screen_width = iptr->pitch = iptr->ll; + switch (pScrn->bitsPerPixel) { + case 16: + iptr->screen_width = iptr->pitch >> 1; + break; + case 24: + case 32: + iptr->screen_width = iptr->pitch >> 2; + break; + default: + iptr->screen_width = iptr->pitch = iptr->ll; + break; + } xaaptr->Flags = (PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER); xaaptr->Sync = IMSTTSync; - xaaptr->SetupForSolidFill = IMSTTSetupForSolidFill; - xaaptr->SubsequentSolidFillRect = IMSTTSubsequentSolidFillRect; + if (pScrn->bitsPerPixel == 8) { + /* FIXME fills are broken > 8bpp, iptr->color needs to be setup right */ + xaaptr->SetupForSolidFill = IMSTTSetupForSolidFill; + xaaptr->SubsequentSolidFillRect = IMSTTSubsequentSolidFillRect; + } xaaptr->ScreenToScreenCopyFlags = NO_TRANSPARENCY; xaaptr->SetupForScreenToScreenCopy = IMSTTSetupForScreenToScreenCopy; Index: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c:1.10 xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c:1.10 Sat Dec 2 10:30:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c Wed May 16 02:48:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.10 2000/12/02 15:30:43 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/imstt/imstt_driver.c,v 1.15 2001/05/16 06:48:09 keithp Exp $ */ /* * Copyright 2000 Ani Joshi <ajoshi@unixbox.com> @@ -46,12 +46,7 @@ #include "mibstore.h" #include "fbdevhw.h" -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb16.h" -#include "cfb24.h" -#include "cfb32.h" +#include "fb.h" #include "xf86cmap.h" @@ -67,19 +62,23 @@ /* * prototypes */ -static OptionInfoPtr IMSTTAvailableOptions(int chipid, int busid); +static const OptionInfoRec * IMSTTAvailableOptions(int chipid, int busid); static void IMSTTIdentify(int flags); static Bool IMSTTProbe(DriverPtr drv, int flags); static Bool IMSTTPreInit(ScrnInfoPtr pScrn, int flags); +#if 0 static Bool IMSTTEnterVT(int scrnIndex, int flags); static void IMSTTLeaveVT(int scrnIndex, int flags); static void IMSTTSave(ScrnInfoPtr pScrn); +#endif static Bool IMSTTScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv); +#if 0 static int IMSTTInternalScreenInit(int scrnIndex, ScreenPtr pScreen); static ModeStatus IMSTTValidMode(int index, DisplayModePtr mode, Bool verbose, int flags); +#endif static Bool IMSTTMapMem(ScrnInfoPtr pScrn); static void IMSTTUnmapMem(ScrnInfoPtr pScrn); @@ -87,10 +86,11 @@ static void IMSTTAdjustFrame(int scrnIndex, int x, int y, int flags); Bool IMSTTCloseScreen(int scrnIndex, ScreenPtr pScreen); Bool IMSTTSaveScreen(ScreenPtr pScreen, int mode); +#if 0 static void IMSTTLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, VisualPtr pVisual); - +#endif static void IMSTTGetVideoMemSize(ScrnInfoPtr pScrn); static void IMSTTSetClock(ScrnInfoPtr pScrn, unsigned long mhz); static void IMSTTWriteMode(ScrnInfoPtr pScrn); @@ -137,28 +137,20 @@ OPTION_FBDEV } IMSTTOpts; -static OptionInfoRec IMSTTOptions[] = +static const OptionInfoRec IMSTTOptions[] = { { OPTION_NOACCEL, "noaccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SWCURSOR, "swcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_INITDAC, "initdac", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE } + { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } }; - -static const char *cfbSymbols[] = { - "cfbScreenInit", - "cfb16ScreenInit", - "cfb24ScreenInit", - "cfb32ScreenInit", - "cfb16BresS", - "cfb24BresS", - NULL -}; - - static const char *fbSymbols[] = { "fbScreenInit", +#ifdef RENDER + "fbPictureInit", +#endif NULL }; @@ -225,7 +217,7 @@ if (!setupDone) { setupDone = TRUE; xf86AddDriver(&IMSTT, module, 0); - LoaderRefSymLists(cfbSymbols, xaaSymbols, fbdevHWSymbols, NULL); + LoaderRefSymLists(fbSymbols, xaaSymbols, fbdevHWSymbols, NULL); return (pointer) 1; } else { if (errmaj) @@ -260,7 +252,7 @@ } -static OptionInfoPtr IMSTTAvailableOptions(int chipid, int busid) +static const OptionInfoRec * IMSTTAvailableOptions(int chipid, int busid) { return IMSTTOptions; } @@ -333,11 +325,8 @@ { EntityInfoPtr pEnt; IMSTTPtr iptr; - MessageType from = X_DEFAULT; int i; ClockRangePtr clockRanges; - char *mod = NULL; - const char *reqSym = NULL; rgb zeros = {0, 0, 0}; Gamma gzeros = {0.0, 0.0, 0.0}; @@ -374,8 +363,7 @@ return FALSE; } - if (pScrn->depth == 8) - pScrn->rgbBits = 8; + pScrn->rgbBits = 8; if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE; @@ -388,15 +376,18 @@ xf86CollectOptions(pScrn, NULL); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, IMSTTOptions); + if (!(iptr->Options = xalloc(sizeof(IMSTTOptions)))) + return FALSE; + memcpy(iptr->Options, IMSTTOptions, sizeof(IMSTTOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, iptr->Options); - if (xf86ReturnOptValBool(IMSTTOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(iptr->Options, OPTION_NOACCEL, FALSE)) { iptr->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: NoAccel - acceleration disabled\n"); } else iptr->NoAccel = FALSE; #if 0 - if (xf86ReturnOptValBool(IMSTTOptions, OPTION_SWCURSOR, FALSE)) + if (xf86ReturnOptValBool(iptr->Options, OPTION_SWCURSOR, FALSE)) iptr->HWCursor = FALSE; else iptr->HWCursor = TRUE; @@ -408,14 +399,14 @@ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using %s cursor\n", iptr->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(IMSTTOptions, OPTION_INITDAC, FALSE)) { + if (xf86ReturnOptValBool(iptr->Options, OPTION_INITDAC, FALSE)) { iptr->InitDAC = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: not initalizing DACn"); } else { iptr->InitDAC = FALSE; } - if (xf86ReturnOptValBool(IMSTTOptions, OPTION_FBDEV, FALSE)) { + if (xf86ReturnOptValBool(iptr->Options, OPTION_FBDEV, FALSE)) { iptr->FBDev = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using framebuffer device\n"); @@ -423,6 +414,9 @@ iptr->FBDev = FALSE; } + /* hack */ + iptr->FBDev = TRUE; + if (iptr->FBDev) { if (!xf86LoadSubModule(pScrn, "fbdevhw")) return FALSE; @@ -528,7 +522,7 @@ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, NULL, 256, 2048, pScrn->bitsPerPixel, - 128, 2048, pScrn->virtualX, + 128, 2048, pScrn->display->virtualX, pScrn->display->virtualY, iptr->videoRam, LOOKUP_BEST_REFRESH); @@ -558,8 +552,7 @@ xf86SetDpi(pScrn, 0, 0); xf86LoadSubModule(pScrn, "fb"); -/* xf86LoaderReqSymbols(fbSymbols, NULL); */ - xf86LoaderReqSymbols("fbScreenInit", NULL); + xf86LoaderReqSymLists(fbSymbols, NULL); if (!xf86LoadSubModule(pScrn, "xaa")) return FALSE; @@ -588,7 +581,7 @@ return FALSE; } - IMSTTTRACE("Mapped MMIO @ 0x%x with size 0x1000\n", iptr->PciInfo->memBase[0] + 0x800000); + IMSTTTRACE1("Mapped MMIO @ 0x%x with size 0x1000\n", iptr->PciInfo->memBase[0] + 0x800000); IMSTTGetVideoMemSize(pScrn); @@ -654,8 +647,7 @@ static void IMSTTGetVideoMemSize(ScrnInfoPtr pScrn) { - IMSTTPtr iptr; - IMSTTMMIO_VARS(); + IMSTTPtr iptr = IMSTTPTR(pScrn); unsigned long tmp; if (iptr->FBDev) { @@ -678,7 +670,6 @@ { ScrnInfoPtr pScrn; IMSTTPtr iptr; - IMSTTMMIO_VARS(); unsigned long tmp; VisualPtr visual; int r = TRUE; @@ -772,6 +763,8 @@ } } + iptr->pitch = pScrn->displayWidth; + if (iptr->FBDev) { if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -786,7 +779,7 @@ if (pScrn->bitsPerPixel > 8) { if (!miSetVisualTypes(pScrn->depth, TrueColorMask, - pScrn->rgbBits, pScrn->defaultVisual)) + pScrn->rgbBits, TrueColor)) return FALSE; } else { if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), @@ -794,26 +787,20 @@ return FALSE; } - switch (pScrn->bitsPerPixel) { - case 8: - case 16: - case 24: - case 32: - r = fbScreenInit(pScreen, iptr->FBBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, pScrn->bitsPerPixel); - break; - default: - ErrorF("invalid bpp %d\n", pScrn->bitsPerPixel); - return FALSE; - } + miSetPixmapDepths (); + + r = fbScreenInit(pScreen, iptr->FBBase, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, pScrn->bitsPerPixel); if (!r) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ScreenInit failed\n"); return FALSE; } - xf86SetBlackWhitePixels(pScreen); +#ifdef RENDER + fbPictureInit (pScreen, 0, 0); +#endif if (pScrn->bitsPerPixel > 8) { visual = pScreen->visuals + pScreen->numVisuals; @@ -829,6 +816,7 @@ } } + xf86SetBlackWhitePixels(pScreen); miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); @@ -848,8 +836,8 @@ if (!miCreateDefColormap(pScreen)) return FALSE; - if (!xf86HandleColormaps(pScreen, 256, 8, (iptr->FBDev ? fbdevHWLoadPalette : NULL), - NULL, CMAP_RELOAD_ON_MODE_SWITCH)) + if (!xf86HandleColormaps(pScreen, 256, 8, fbdevHWLoadPalette, + NULL, CMAP_PALETTED_TRUECOLOR)) return FALSE; if (serverGeneration == 1) @@ -870,7 +858,6 @@ static Bool IMSTTModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) { IMSTTPtr iptr; - IMSTTMMIO_VARS(); unsigned long mhz; unsigned short hes, heb, veb, htp, vtp; @@ -1113,9 +1100,8 @@ { IMSTTPtr iptr; unsigned char pixformat; - unsigned long ctl, pitch, byteswap, scr; - unsigned char tcc, mxc, lckl_n, mic, mlc, lckl_p; - IMSTTMMIO_VARS(); + unsigned long ctl = 0, pitch = 0, byteswap = 0, scr = 0; + unsigned char tcc = 0, mxc = 0, lckl_n = 0, mic, mlc = 0, lckl_p = 0; iptr = IMSTTPTR(pScrn); @@ -1286,7 +1272,6 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; IMSTTPtr iptr; - IMSTTMMIO_VARS(); unsigned long offset; iptr = IMSTTPTR(pScrn); @@ -1314,7 +1299,5 @@ Bool IMSTTSaveScreen(ScreenPtr pScreen, int mode) { - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - return TRUE; } Index: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile:1.39 xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile:1.43 --- xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile:1.39 Thu Dec 14 11:38:49 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile Thu Apr 5 13:42:32 2001 @@ -1,6 +1,6 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.39 2000/12/14 16:38:49 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/Imakefile,v 1.43 2001/04/05 17:42:32 dawes Exp $ XCOMM -XCOMM This is an Imakefile for the MGA driver. +XCOMM This is an Imakefile for the MGA driver. XCOMM #define IHaveModules @@ -12,8 +12,8 @@ #endif #if BuildXF86DRI -DRISRCS = mga_dri.c mga_warp.c mga_wrap.c -DRIOBJS = mga_dri.o mga_warp.o mga_wrap.o +DRISRCS = mga_dri.c +DRIOBJS = mga_dri.o DRIINCLUDES = -I$(SERVERSRC)/GL/dri -I$(LIBSRC)/GL/dri \ -I$(TOP)/include DRIDEFINES = $(GLX_DEFINES) @@ -57,10 +57,10 @@ MGASRCS = mga_driver.c mga_hwcurs.c /* mga_cmap.c */ mga_dac3026.c mga_dacG.c \ mga_storm8.c mga_storm16.c mga_storm24.c mga_storm32.c mga_arc.c \ - mga_dga.c mga_shadow.c mga_video.c $(DRISRCS) + mga_dga.c mga_shadow.c mga_video.c mga_g450pll.c mga_dh.c $(DRISRCS) MGAOBJS = mga_driver.o mga_hwcurs.o /* mga_cmap.o */ mga_dac3026.o mga_dacG.o \ mga_storm8.o mga_storm16.o mga_storm24.o mga_storm32.o mga_arc.o \ - mga_dga.o mga_shadow.o mga_video.o $(DRIOBJS) + mga_dga.o mga_shadow.o mga_video.o mga_g450pll.o mga_dh.o $(DRIOBJS) SRCS = $(MGASRCS) $(MGAHALSRCS) OBJS = $(MGAOBJS) $(MGAHALOBJS) @@ -102,14 +102,13 @@ ObjectFromSpecialSource(mga_storm16, mga_storm, -DPSZ=16) ObjectFromSpecialSource(mga_storm24, mga_storm, -DPSZ=24) ObjectFromSpecialSource(mga_storm32, mga_storm, -DPSZ=32) - + InstallObjectModule(mga,$(MODULEDIR),drivers) #if BuildHalModule InstallObjectModule(mga_hal,$(MODULEDIR),drivers) #endif #if !defined(XF86DriverSDK) -CppManTarget(mga,) InstallModuleManPage(mga) #endif @@ -142,4 +141,3 @@ ForceSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) #endif - Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga.cpp:1.20 xc/programs/Xserver/hw/xfree86/drivers/mga/mga.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga.cpp:1.20 Tue Dec 12 13:54:30 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga.cpp Mon Jun 4 12:40:57 2001 @@ -1,138 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.cpp,v 1.20 2000/12/12 18:54:30 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH MGA __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -mga \- Matrox video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qmga\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B mga -is an XFree86 driver for Matrox video cards. The driver is fully -accelerated, and provides support for the following framebuffer depths: -8, 15, 16, 24, and an 8+24 overlay mode. All -visual types are supported for depth 8, and both TrueColor and DirectColor -visuals are supported for the other depths except 8+24 mode which supports -PseudoColor, GrayScale and TrueColor. Multi-head configurations -are supported. -.SH SUPPORTED HARDWARE -The -.B mga -driver supports PCI and AGP video cards based on the following Matrox chips: -.TP 12 -.B MGA2064W -Millennium (original) -.TP 12 -.B MGA1064SG -Mystique -.TP 12 -.B MGA2164W -Millennium II -.TP 12 -.B G100 -.TP 12 -.B G200 -Millennium G200 and Mystique G200 -.TP 12 -.B G400 -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type, but the following -.B ChipSet -names may optionally be specified in the config file -.B \*qDevice\*q -section, and will override the auto-detection: -.PP -.RS 4 -"mga2064w", "mga1064sg", "mga2164w", "mga2164w agp", "mgag100", "mgag200", -"mgag200 pci" "mgag400". -.RE -.PP -The driver will auto-detect the amount of video memory present for all -chips except the Millennium II. In the Millennium II case it defaults -to 4096\ kBytes. When using a Millennium II, the actual amount of video -memory should be specified with a -.B VideoRam -entry in the config file -.B \*qDevice\*q -section. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qColorKey\*q \*q" integer \*q -Set the colormap index used for the transparency key for the depth 8 plane -when operating in 8+24 overlay mode. The value must be in the range -2\-255. Default: 255. -.TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option \*qMGASDRAM\*q \*q" boolean \*q -Specify whether G100, G200 or G400 cards have SDRAM. The driver attempts to -auto-detect this based on the card's PCI subsystem ID. This option may -be used to override that auto-detection. The mga driver is not able to -auto-detect the presence of of SDRAM on secondary heads in multihead configurations -so this option will often need to be specified in multihead configurations. -Default: auto-detected. -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qOverclockMem\*q" -Set clocks to values used by some commercial X-Servers (G100, G200 and G400 -only). Default: off. -.TP -.BI "Option \*qOverlay\*q" -Enable 8+24 overlay mode. Only appropriate for depth 24. -.RB ( Note: -the G100 is unaccelerated in the 8+24 overlay mode due to a missing -hardware feature) Default: off. -.TP -.BI "Option \*qPciRetry\*q \*q" boolean \*q -Enable or disable PCI retries. Default: off. -.TP -.BI "Option \*qRotate\*q \*qCW\*q" -.TP -.BI "Option \*qRotate\*q \*qCCW\*q" -Rotate the display clockwise or counterclockwise. This mode is unaccelerated. -Default: no rotation. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: off. -.TP -.BI "Option \*qSyncOnGreen\*q \*q" boolean \*q -Enable or disable combining the sync signals with the green signal. -Default: off. -.TP -.BI "Option \*qUseFBDev\*q \*q" boolean \*q -Enable or disable use of on OS-specific fb interface (and is not supported -on all OSs). See fbdevhw(__drivermansuffix__) for further information. -Default: off. -.TP -.BI "Option \*qVideoKey\*q \*q" integer \*q -This sets the default pixel value for the YUV video overlay key. -Default: undefined. -.TP -.BI "Option \*qTexturedVideo\*q \*q" boolean \*q -This has XvImage support use the texture engine rather than the video overlay. -This option is only supported by the G200 and G400, and only in 16 and 32 -bits per pixel. -Default: off. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Radoslaw Kapitan, Mark Vojkovich, and also David Dawes, Guy -Desbief, Dirk Hohndel, Doug Merritt, Andrew E. Mileski, Andrew van der Stock, -Leonard N. Zubkoff. Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h:1.70 xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h:1.75 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h:1.70 Wed Dec 6 10:35:19 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h Fri May 4 15:05:41 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.70 2000/12/06 15:35:19 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.h,v 1.75 2001/05/04 19:05:41 dawes Exp $ */ /* * MGA Millennium (MGA2064W) functions * @@ -22,16 +22,31 @@ #include "xf86DDC.h" #include "xf86xv.h" + + #ifdef XF86DRI #include "xf86drm.h" -#include "sarea.h" + + #define _XF86DRI_SERVER_ +#include "mga_dripriv.h" +#include "dri.h" +#include "GL/glxint.h" + + + + #include "xf86dri.h" #include "dri.h" + + + #include "GL/glxint.h" #include "mga_dri.h" #endif + + #ifdef USEMGAHAL #include "client.h" #endif @@ -59,6 +74,32 @@ #define OUTREG(addr,val) dbg_outreg32(pScrn,addr,val) #endif /* EXTRADEBUG */ +/* + * Read/write to the DAC via MMIO + */ + +/* + * These were functions. Use macros instead to avoid the need to + * pass pMga to them. + */ + +#define inMGAdreg(reg) INREG8(RAMDAC_OFFSET + (reg)) + +#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val) + +#define inMGAdac(reg) \ + (outMGAdreg(MGA1064_INDEX, reg), inMGAdreg(MGA1064_DATA)) + +#define outMGAdac(reg, val) \ + (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val)) + +#define outMGAdacmsk(reg, mask, val) \ + do { /* note: mask and reg may get evaluated twice */ \ + unsigned char tmp = (mask) ? (inMGAdac(reg) & (mask)) : 0; \ + outMGAdreg(MGA1064_INDEX, reg); \ + outMGAdreg(MGA1064_DATA, tmp | (val)); \ + } while (0) + #define PORT_OFFSET (0x1F00 - 0x300) #define MGA_VERSION 4000 @@ -74,11 +115,30 @@ unsigned char ExtVga[6]; unsigned char DacClk[6]; unsigned char * DacRegs; + unsigned long crtc2[0x58]; + unsigned char dac2[0x21]; CARD32 Option; CARD32 Option2; CARD32 Option3; } MGARegRec, *MGARegPtr; +/* For programming the second CRTC */ +typedef struct { + CARD32 ulDispWidth; /* Display Width in pixels*/ + CARD32 ulDispHeight; /* Display Height in pixels*/ + CARD32 ulBpp; /* Bits Per Pixels / input format*/ + CARD32 ulPixClock; /* Pixel Clock in kHz*/ + CARD32 ulHFPorch; /* Horizontal front porch in pixels*/ + CARD32 ulHSync; /* Horizontal Sync in pixels*/ + CARD32 ulHBPorch; /* Horizontal back porch in pixels*/ + CARD32 ulVFPorch; /* Vertical front porch in lines*/ + CARD32 ulVSync; /* Vertical Sync in lines*/ + CARD32 ulVBPorch; /* Vertical back Porch in lines*/ + CARD32 ulFBPitch; /* Pitch*/ + CARD32 flSignalMode; /* Signal Mode*/ +} xMODEINFO; + + typedef struct { int brightness; int contrast; @@ -136,6 +196,11 @@ #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; @@ -261,7 +326,6 @@ int MaxBlitDWORDS; Bool TexturedVideo; MGAPortPrivPtr portPrivate; - int numXAALines; unsigned char *ScratchBuffer; unsigned char *ColorExpandBase; int expandRows; @@ -270,18 +334,21 @@ int expandHeight; int expandY; #ifdef XF86DRI - int agp_mode; - Bool ReallyUseIrqZero; - Bool have_quiescense; Bool directRenderingEnabled; DRIInfoPtr pDRIInfo; - int drmSubFD; + int drmFD; int numVisualConfigs; __GLXvisualConfig* pVisualConfigs; MGAConfigPrivPtr pVisualConfigsPriv; + MGADRIServerPrivatePtr DRIServerInfo; + MGARegRec DRContextRegs; - MGADRIServerPrivatePtr DRIServerInfo; + + Bool haveQuiescense; void (*GetQuiescence)(ScrnInfoPtr pScrn); + + int agpMode; + #endif XF86VideoAdaptorPtr adaptor; Bool SecondCrtc; @@ -305,14 +372,9 @@ #ifdef USEMGAHAL Bool HALLoaded; #endif + OptionInfoPtr Options; } MGARec, *MGAPtr; -#ifdef XF86DRI -extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, - void **configprivs); -#endif - - extern CARD32 MGAAtype[16]; extern CARD32 MGAAtypeNoBLK[16]; @@ -333,10 +395,6 @@ #define TRANSPARENCY_KEY 255 #define KEY_COLOR 0 -#define MGA_FRONT 0x1 -#define MGA_BACK 0x2 -#define MGA_DEPTH 0x4 - /* Prototypes */ @@ -365,22 +423,6 @@ Bool MGADGAInit(ScreenPtr pScreen); -Bool MGADRIScreenInit(ScreenPtr pScreen); -void MGADRICloseScreen(ScreenPtr pScreen); -Bool MGADRIFinishScreenInit(ScreenPtr pScreen); -void MGASwapContext(ScreenPtr pScreen); -void MGASwapContext_shared(ScreenPtr pScreen); -Bool mgaConfigureWarp(ScrnInfoPtr pScrn); -unsigned int mgaInstallMicrocode(ScreenPtr pScreen, int agp_offset); -unsigned int mgaGetMicrocodeSize(ScreenPtr pScreen); -void MGASelectBuffer(ScrnInfoPtr pScrn, int which); -Bool MgaCleanupDma(ScrnInfoPtr pScrn); -Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size); -#ifdef XF86DRI -Bool MgaLockUpdate(ScrnInfoPtr pScrn, drmLockFlags flags); -void mgaGetQuiescence(ScrnInfoPtr pScrn); -void mgaGetQuiescence_shared(ScrnInfoPtr pScrn); -#endif void MGARefreshArea(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void MGARefreshArea8(ScrnInfoPtr pScrn, int num, BoxPtr pbox); void MGARefreshArea16(ScrnInfoPtr pScrn, int num, BoxPtr pbox); @@ -412,6 +454,43 @@ void MGAPointerMoved(int index, int x, int y); void MGAInitVideo(ScreenPtr pScreen); -void MGAResetVideo(ScrnInfoPtr pScrn); +void MGAResetVideo(ScrnInfoPtr pScrn); + +#ifdef XF86DRI + +#define MGA_FRONT 0x1 +#define MGA_BACK 0x2 +#define MGA_DEPTH 0x4 + +Bool MGADRIScreenInit( ScreenPtr pScreen ); +void MGADRICloseScreen( ScreenPtr pScreen ); +Bool MGADRIFinishScreenInit( ScreenPtr pScreen ); + +Bool MGALockUpdate( ScrnInfoPtr pScrn, drmLockFlags flags ); + +void MGAGetQuiescence( ScrnInfoPtr pScrn ); +void MGAGetQuiescenceShared( ScrnInfoPtr pScrn ); + +void MGASelectBuffer(ScrnInfoPtr pScrn, int which); +Bool MgaCleanupDma(ScrnInfoPtr pScrn); +Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size); + +#define MGA_AGP_1X_MODE 0x01 +#define MGA_AGP_2X_MODE 0x02 +#define MGA_AGP_4X_MODE 0x04 +#define MGA_AGP_MODE_MASK 0x07 + +#endif +void CRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo); +void EnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo); +void CRTC2SetPitch(ScrnInfoPtr pSrcn, xMODEINFO *pModeInfo); +void CRTC2SetDisplayStart(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY); + +void CRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo); +void CRTC2GetPitch(ScrnInfoPtr pSrcn, xMODEINFO *pModeInfo); +void CRTC2GetDisplayStart(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY); + +double G450SetPLLFreq(ScrnInfoPtr pScrn, long f_out); +void printDac(ScrnInfoPtr pScrn); #endif Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man:1.3 --- /dev/null Mon Jun 4 12:40:57 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man Thu May 10 17:53:48 2001 @@ -0,0 +1,141 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga.man,v 1.3 2001/05/10 21:53:48 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH MGA __drivermansuffix__ __vendorversion__ +.SH NAME +mga \- Matrox video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qmga\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B mga +is an XFree86 driver for Matrox video cards. The driver is fully +accelerated, and provides support for the following framebuffer depths: +8, 15, 16, 24, and an 8+24 overlay mode. All +visual types are supported for depth 8, and both TrueColor and DirectColor +visuals are supported for the other depths except 8+24 mode which supports +PseudoColor, GrayScale and TrueColor. Multi-head configurations +are supported. XVideo is supported on G200 and newer systems, with +either +.B TexturedVideo +or video overlay. +.SH SUPPORTED HARDWARE +The +.B mga +driver supports PCI and AGP video cards based on the following Matrox chips: +.TP 12 +.B MGA2064W +Millennium (original) +.TP 12 +.B MGA1064SG +Mystique +.TP 12 +.B MGA2164W +Millennium II +.TP 12 +.B G100 +.TP 12 +.B G200 +Millennium G200 and Mystique G200 +.TP 12 +.B G400 +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto-detects the chipset type, but the following +.B ChipSet +names may optionally be specified in the config file +.B \*qDevice\*q +section, and will override the auto-detection: +.PP +.RS 4 +"mga2064w", "mga1064sg", "mga2164w", "mga2164w agp", "mgag100", "mgag200", +"mgag200 pci" "mgag400". +.RE +.PP +The driver will auto-detect the amount of video memory present for all +chips except the Millennium II. In the Millennium II case it defaults +to 4096\ kBytes. When using a Millennium II, the actual amount of video +memory should be specified with a +.B VideoRam +entry in the config file +.B \*qDevice\*q +section. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qColorKey\*q \*q" integer \*q +Set the colormap index used for the transparency key for the depth 8 plane +when operating in 8+24 overlay mode. The value must be in the range +2\-255. Default: 255. +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +Enable or disable the HW cursor. Default: on. +.TP +.BI "Option \*qMGASDRAM\*q \*q" boolean \*q +Specify whether G100, G200 or G400 cards have SDRAM. The driver attempts to +auto-detect this based on the card's PCI subsystem ID. This option may +be used to override that auto-detection. The mga driver is not able to +auto-detect the presence of of SDRAM on secondary heads in multihead configurations +so this option will often need to be specified in multihead configurations. +Default: auto-detected. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.TP +.BI "Option \*qOverclockMem\*q" +Set clocks to values used by some commercial X-Servers (G100, G200 and G400 +only). Default: off. +.TP +.BI "Option \*qOverlay\*q" +Enable 8+24 overlay mode. Only appropriate for depth 24. +.RB ( Note: +the G100 is unaccelerated in the 8+24 overlay mode due to a missing +hardware feature.) Default: off. +.TP +.BI "Option \*qPciRetry\*q \*q" boolean \*q +Enable or disable PCI retries. Default: off. +.TP +.BI "Option \*qRotate\*q \*qCW\*q" +.TP +.BI "Option \*qRotate\*q \*qCCW\*q" +Rotate the display clockwise or counterclockwise. This mode is unaccelerated. +Default: no rotation. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. See +shadowfb(__drivermansuffix__) for further information. Default: off. +.TP +.BI "Option \*qSyncOnGreen\*q \*q" boolean \*q +Enable or disable combining the sync signals with the green signal. +Default: off. +.TP +.BI "Option \*qUseFBDev\*q \*q" boolean \*q +Enable or disable use of on OS-specific fb interface (and is not supported +on all OSs). See fbdevhw(__drivermansuffix__) for further information. +Default: off. +.TP +.BI "Option \*qVideoKey\*q \*q" integer \*q +This sets the default pixel value for the YUV video overlay key. +Default: undefined. +.TP +.BI "Option \*qTexturedVideo\*q \*q" boolean \*q +This has XvImage support use the texture engine rather than the video overlay. +This option is only supported by the G200 and G400, and only in 16 and 32 +bits per pixel. +Default: off. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Radoslaw Kapitan, Mark Vojkovich, and also David Dawes, Guy +Desbief, Dirk Hohndel, Doug Merritt, Andrew E. Mileski, Andrew van der Stock, +Leonard N. Zubkoff. Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c:1.55 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c:1.56 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c:1.55 Wed Nov 1 21:51:19 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c Thu Apr 5 17:29:14 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c,v 1.55 2000/11/02 02:51:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dac3026.c,v 1.56 2001/04/05 21:29:14 dawes Exp $ */ /* * Copyright 1994 by Robin Cutshaw <robin@XFree86.org> * @@ -1071,7 +1071,10 @@ MGAdac->HideCursor = MGA3026HideCursor; MGAdac->ShowCursor = MGA3026ShowCursor; MGAdac->UseHWCursor = MGA3026UseHWCursor; - MGAdac->CursorFlags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | + MGAdac->CursorFlags = +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | +#endif HARDWARE_CURSOR_TRUECOLOR_AT_8BPP | HARDWARE_CURSOR_SOURCE_MASK_NOT_INTERLEAVED; Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c:1.42 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c:1.46 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c:1.42 Wed Dec 6 10:35:20 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c Fri Apr 6 12:51:19 2001 @@ -2,7 +2,7 @@ * MGA-1064, MGA-G100, MGA-G200, MGA-G400 RAMDAC driver */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.42 2000/12/06 15:35:20 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dacG.c,v 1.46 2001/04/06 16:51:19 dawes Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -49,33 +49,6 @@ #define OPTION1_MASK_PRIMARY 0xFFFC0FF -/* - * Read/write to the DAC via MMIO - */ - -/* - * These were functions. Use macros instead to avoid the need to - * pass pMga to them. - */ - -#define inMGAdreg(reg) INREG8(RAMDAC_OFFSET + (reg)) - -#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val) - -#define inMGAdac(reg) \ - (outMGAdreg(MGA1064_INDEX, reg), inMGAdreg(MGA1064_DATA)) - -#define outMGAdac(reg, val) \ - (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val)) - -#define outMGAdacmsk(reg, mask, val) \ - do { /* note: mask and reg may get evaluated twice */ \ - unsigned char tmp = (mask) ? (inMGAdac(reg) & (mask)) : 0; \ - outMGAdreg(MGA1064_INDEX, reg); \ - outMGAdreg(MGA1064_DATA, tmp | (val)); \ - } while (0) - - static void MGAGRamdacInit(ScrnInfoPtr); static void MGAGSave(ScrnInfoPtr, vgaRegPtr, MGARegPtr, Bool); static void MGAGRestore(ScrnInfoPtr, vgaRegPtr, MGARegPtr, Bool); @@ -237,6 +210,11 @@ /* The actual frequency output by the clock */ double f_pll; + if(MGAISG450(pMga)) { + G450SetPLLFreq(pScrn, f_out); + return; + } + /* Do the calculations for m, n, p and s */ f_pll = MGAGCalcClock( pScrn, f_out, &m, &n, &p, &s ); @@ -275,7 +253,21 @@ MGARegPtr pReg; vgaRegPtr pVga; MGAFBLayout *pLayout; - + xMODEINFO ModeInfo; + + ModeInfo.ulDispWidth = mode->HDisplay; + ModeInfo.ulDispHeight = mode->VDisplay; + ModeInfo.ulFBPitch = mode->HDisplay; + ModeInfo.ulBpp = pScrn->bitsPerPixel; + ModeInfo.flSignalMode = 0; + ModeInfo.ulPixClock = mode->Clock; + ModeInfo.ulHFPorch = mode->HSyncStart - mode->HDisplay; + ModeInfo.ulHSync = mode->HSyncEnd - mode->HSyncStart; + ModeInfo.ulHBPorch = mode->HTotal - mode->HSyncEnd; + ModeInfo.ulVFPorch = mode->VSyncStart - mode->VDisplay; + ModeInfo.ulVSync = mode->VSyncEnd - mode->VSyncStart; + ModeInfo.ulVBPorch = mode->VTotal - mode->VSyncEnd; + pMga = MGAPTR(pScrn); pReg = &pMga->ModeReg; pVga = &VGAHWPTR(pScrn)->ModeReg; @@ -338,6 +330,9 @@ #ifdef USEMGAHAL MGA_HAL(break;); #endif + if (MGAISG450(pMga)) + break; + if(pMga->Dac.maxPixelClock == 360000) { /* G400 MAX */ if(pMga->OverclockMem) { /* 150/200 */ @@ -379,7 +374,7 @@ case PCI_CHIP_MGAG200_PCI: default: #ifdef USEMGAHAL - MGA_HAL(break;); + MGA_HAL(break;); #endif if(pMga->OverclockMem) { /* 143 Mhz */ @@ -528,11 +523,30 @@ if (mode->Flags & V_DBLSCAN) pVga->CRTC[9] |= 0x80; + if(MGAISG450(pMga)) { + OUTREG(MGAREG_ZORG, 0); + } + MGAGSetPCLK(pScrn, mode->Clock); ); /* MGA_NOT_HAL */ /* This disables the VGA memory aperture */ pVga->MiscOutReg &= ~0x02; + + /* Urgh. Why do we define our own xMODEINFO structure instead + * of just passing the blinkin' DisplayModePtr? If we're going to + * just cut'n'paste routines from the HALlib, it would be better + * just to strip the MacroVision stuff out of the HALlib and release + * that, surely? + */ + /********************* Second Crtc programming **************/ + /* Writing values to crtc2[] array */ + if (pMga->SecondCrtc) + { + CRTC2Get(pScrn, &ModeInfo); + CRTC2GetPitch(pScrn, &ModeInfo); + CRTC2GetDisplayStart(pScrn, &ModeInfo,0,0,0); + } return(TRUE); } @@ -640,57 +654,81 @@ MGAPtr pMga = MGAPTR(pScrn); CARD32 optionMask; - MGA_NOT_HAL( - /* - * Code is needed to get things back to bank zero. - */ - - /* restore DAC registers - * according to the docs we shouldn't write to reserved regs*/ - for (i = 0; i < DACREGSIZE; i++) { - if( (i <= 0x03) || - (i == 0x07) || - (i == 0x0b) || - (i == 0x0f) || - ((i >= 0x13) && (i <= 0x17)) || - (i == 0x1b) || - (i == 0x1c) || - ((i >= 0x1f) && (i <= 0x29)) || - ((i >= 0x30) && (i <= 0x37)) ) - continue; - outMGAdac(i, mgaReg->DacRegs[i]); - } - - /* Do not set the memory config for primary cards as it - should be correct already */ - optionMask = (pMga->Primary) ? OPTION1_MASK_PRIMARY : OPTION1_MASK; - - /* restore pci_option register */ - pciSetBitsLong(pMga->PciTag, PCI_OPTION_REG, optionMask, - mgaReg->Option); - if (pMga->Chipset != PCI_CHIP_MGA1064) - pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION2, OPTION2_MASK, - mgaReg->Option2); - if (pMga->Chipset == PCI_CHIP_MGAG400) - pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION3, OPTION3_MASK, - mgaReg->Option3); - ); /* MGA_NOT_HAL */ - - /* restore CRTCEXT regs */ - for (i = 0; i < 6; i++) - OUTREG16(0x1FDE, (mgaReg->ExtVga[i] << 8) | i); - - /* - * This function handles restoring the generic VGA registers. - */ - vgaHWRestore(pScrn, vgaReg, + if(!pMga->SecondCrtc) { +MGA_NOT_HAL( + /* + * Code is needed to get things back to bank zero. + */ + + /* restore DAC registers + * according to the docs we shouldn't write to reserved regs*/ + for (i = 0; i < DACREGSIZE; i++) { + if( (i <= 0x03) || + (i == 0x07) || + (i == 0x0b) || + (i == 0x0f) || + ((i >= 0x13) && (i <= 0x17)) || + (i == 0x1b) || + (i == 0x1c) || + ((i >= 0x1f) && (i <= 0x29)) || + ((i >= 0x30) && (i <= 0x37)) || + (MGAISG450(pMga) && + ((i == 0x2c) || (i == 0x2d) || (i == 0x2e) || + (i == 0x4c) || (i == 0x4d) || (i == 0x4e)))) + continue; + outMGAdac(i, mgaReg->DacRegs[i]); + } + + /* Do not set the memory config for primary cards as it + should be correct already */ + optionMask = (pMga->Primary) ? OPTION1_MASK_PRIMARY : OPTION1_MASK; + + if (!MGAISG450(pMga)) { + /* restore pci_option register */ + pciSetBitsLong(pMga->PciTag, PCI_OPTION_REG, optionMask, + mgaReg->Option); + if (pMga->Chipset != PCI_CHIP_MGA1064) + pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION2, OPTION2_MASK, + mgaReg->Option2); + if (pMga->Chipset == PCI_CHIP_MGAG400) + pciSetBitsLong(pMga->PciTag, PCI_MGA_OPTION3, OPTION3_MASK, + mgaReg->Option3); + } +); /* MGA_NOT_HAL */ + + /* restore CRTCEXT regs */ + for (i = 0; i < 6; i++) + OUTREG16(0x1FDE, (mgaReg->ExtVga[i] << 8) | i); + + /* + * This function handles restoring the generic VGA registers. + */ + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE | (restoreFonts ? VGA_SR_FONTS : 0)); - MGAGRestorePalette(pScrn, vgaReg->DAC); - - /* - * this is needed to properly restore start address - */ - OUTREG16(0x1FDE, (mgaReg->ExtVga[0] << 8) | 0); + MGAGRestorePalette(pScrn, vgaReg->DAC); + + /* + * this is needed to properly restore start address + */ + OUTREG16(0x1FDE, (mgaReg->ExtVga[0] << 8) | 0); + } else { + /* Second Crtc */ + xMODEINFO ModeInfo; + + /* Enable Dual Head */ + CRTC2Set(pScrn, &ModeInfo); + EnableSecondOutPut(pScrn, &ModeInfo); + CRTC2SetPitch(pScrn, &ModeInfo); + CRTC2SetDisplayStart(pScrn, &ModeInfo,0,0,0); + + for (i = 0x80; i <= 0xa0; i ++) { + if (i== 0x8d) { + i = 0x8f; + continue; + } + outMGAdac(i, mgaReg->dac2[ i - 0x80]); + } + } /* endif pMga->SecondCrtc */ #ifdef DEBUG ErrorF("Setting DAC:"); @@ -722,8 +760,14 @@ { int i; MGAPtr pMga = MGAPTR(pScrn); + + if(pMga->SecondCrtc == TRUE) { + for(i = 0x80; i < 0xa0; i++) + mgaReg->dac2[i-0x80] = inMGAdac(i); - if(pMga->SecondCrtc == TRUE) return; + return; + } + MGA_NOT_HAL( /* Allocate the DacRegs space if not done already */ if (mgaReg->DacRegs == NULL) { @@ -825,7 +869,10 @@ while( INREG( MGAREG_Status ) & 0x08 ); /* Output position - "only" 12 bits of location documented */ - OUTREG( RAMDAC_OFFSET + MGA1064_CUR_XLOW, (y << 16) | (x & 0xFFFF)); + OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_XLOW, (x & 0xFF)); + OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_XHI, (x & 0xF00) >> 8); + OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_YLOW, (y & 0xFF)); + OUTREG8( RAMDAC_OFFSET + MGA1064_CUR_YHI, (y & 0xF00) >> 8); } static void @@ -969,7 +1016,9 @@ MGAdac->ShowCursor = MGAGShowCursor; MGAdac->UseHWCursor = MGAGUseHWCursor; MGAdac->CursorFlags = +#if X_BYTE_ORDER == X_LITTLE_ENDIAN HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | +#endif HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c:1.1 --- /dev/null Mon Jun 4 12:40:57 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c Thu Apr 5 13:42:32 2001 @@ -0,0 +1,502 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dh.c,v 1.1 2001/04/05 17:42:32 dawes Exp $ */ +/********************************************************************* +* G450: This is for Dual Head. +* Matrox Graphics +* Author : Luugi Marsan +**********************************************************************/ + + +/* All drivers should typically include these */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + +/* Drivers for PCI hardware need this */ +#include "xf86PciInfo.h" + +/* Drivers that need to access the PCI config space directly need this */ +#include "xf86Pci.h" + +#include "mga_bios.h" +#include "mga_reg.h" +#include "mga.h" + +#define MNP_TABLE_SIZE 64 +#define CLKSEL_MGA 0x0c +#define PLLLOCK 0x40 + +/* CRTC2 control field*/ +#define C2_EN_A 0 +#define C2_EN_M (1 << C2_EN_A) +#define C2_HIPRILVL_A 4 +#define C2_HIPRILVL_M (7 << C2_HIPRILVL_A) +#define C2_MAXHIPRI_A 8 +#define C2_MAXHIPRI_M (7 << C2_MAXHIPRI_A) + +#define C2CTL_PIXCLKSEL_SHIFT 1L +#define C2CTL_PIXCLKSEL_MASK (3L << C2CTL_PIXCLKSEL_SHIFT) +#define C2CTL_PIXCLKSELH_SHIFT 14L +#define C2CTL_PIXCLKSELH_MASK (1L << C2CTL_PIXCLKSELH_SHIFT) +#define C2CTL_PIXCLKSEL_PCICLK 0L +#define C2CTL_PIXCLKSEL_VDOCLK (1L << C2CTL_PIXCLKSEL_SHIFT) +#define C2CTL_PIXCLKSEL_PIXELPLL (2L << C2CTL_PIXCLKSEL_SHIFT) +#define C2CTL_PIXCLKSEL_VIDEOPLL (3L << C2CTL_PIXCLKSEL_SHIFT) +#define C2CTL_PIXCLKSEL_VDCLK (1L << C2CTL_PIXCLKSELH_SHIFT) + +#define C2CTL_PIXCLKSEL_CRISTAL (1L << C2CTL_PIXCLKSEL_SHIFT) | (1L << C2CTL_PIXCLKSELH_SHIFT) +#define C2CTL_PIXCLKSEL_SYSTEMPLL (2L << C2CTL_PIXCLKSEL_SHIFT) | (1L << C2CTL_PIXCLKSELH_SHIFT) + +#define C2CTL_PIXCLKDIS_SHIFT 3L +#define C2CTL_PIXCLKDIS_MASK (1L << C2CTL_PIXCLKDIS_SHIFT) +#define C2CTL_PIXCLKDIS_DISABLE (1L << C2CTL_PIXCLKDIS_SHIFT) + +#define C2CTL_CRTCDACSEL_SHIFT 20L +#define C2CTL_CRTCDACSEL_MASK (1L << C2CTL_CRTCDACSEL_SHIFT) +#define C2CTL_CRTCDACSEL_CRTC1 0 +#define C2CTL_CRTCDACSEL_CRTC2 (1L << C2CTL_CRTCDACSEL_SHIFT) + +/* Misc field*/ +#define IOADDSEL 0x01 +#define RAMMAPEN 0x02 +#define CLKSEL_25175 0x00 +#define CLKSEL_28322 0x04 +#define CLKSEL_MGA 0x0c +#define VIDEODIS 0x10 +#define HPGODDEV 0x20 +#define HSYNCPOL 0x40 +#define VSYNCPOL 0x80 + +/* XSYNCCTRL field */ +#define XSYNCCTRL_DAC1HSPOL_SHIFT 2 +#define XSYNCCTRL_DAC1HSPOL_MASK (1 << XSYNCCTRL_DAC1HSPOL_SHIFT) +#define XSYNCCTRL_DAC1HSPOL_NEG (1 << XSYNCCTRL_DAC1HSPOL_SHIFT) +#define XSYNCCTRL_DAC1HSPOL_POS 0 +#define XSYNCCTRL_DAC1VSPOL_SHIFT 3 +#define XSYNCCTRL_DAC1VSPOL_MASK (1 << XSYNCCTRL_DAC1VSPOL_SHIFT) +#define XSYNCCTRL_DAC1VSPOL_NEG (1 << XSYNCCTRL_DAC1VSPOL_SHIFT) +#define XSYNCCTRL_DAC1VSPOL_POS 0 +#define XSYNCCTRL_DAC2HSPOL_SHIFT 6 +#define XSYNCCTRL_DAC2HSPOL_MASK (1 << XSYNCCTRL_DAC2HSPOL_SHIFT) +#define XSYNCCTRL_DAC2HSPOL_NEG (1 << XSYNCCTRL_DAC2HSPOL_SHIFT) +#define XSYNCCTRL_DAC2HSPOL_POS 0 +#define XSYNCCTRL_DAC2VSPOL_SHIFT 7 +#define XSYNCCTRL_DAC2VSPOL_MASK (1 << XSYNCCTRL_DAC2VSPOL_SHIFT) +#define XSYNCCTRL_DAC2VSPOL_NEG (1 << XSYNCCTRL_DAC2VSPOL_SHIFT) +#define XSYNCCTRL_DAC2VSPOL_POS 0 +#define XSYNCCTRL_DAC1HSOFF_SHIFT 0 +#define XSYNCCTRL_DAC1HSOFF_MASK (1 << XSYNCCTRL_DAC1HSOFF_SHIFT) +#define XSYNCCTRL_DAC1HSOFF_OFF (1 << XSYNCCTRL_DAC1HSOFF_SHIFT) +#define XSYNCCTRL_DAC1HSOFF_ON 1 +#define XSYNCCTRL_DAC1VSOFF_SHIFT 1 +#define XSYNCCTRL_DAC1VSOFF_MASK (1 << XSYNCCTRL_DAC1VSOFF_SHIFT) +#define XSYNCCTRL_DAC1VSOFF_OFF (1 << XSYNCCTRL_DAC1VSOFF_SHIFT) +#define XSYNCCTRL_DAC1VSOFF_ON 0 +#define XSYNCCTRL_DAC2HSOFF_SHIFT 4 +#define XSYNCCTRL_DAC2HSOFF_MASK (1 << XSYNCCTRL_DAC2HSOFF_SHIFT) +#define XSYNCCTRL_DAC2HSOFF_OFF (1 << XSYNCCTRL_DAC2HSOFF_SHIFT) +#define XSYNCCTRL_DAC2HSOFF_ON 0 +#define XSYNCCTRL_DAC2VSOFF_SHIFT 5 +#define XSYNCCTRL_DAC2VSOFF_MASK (1 << XSYNCCTRL_DAC2VSOFF_SHIFT) +#define XSYNCCTRL_DAC2VSOFF_OFF (1 << XSYNCCTRL_DAC2VSOFF_SHIFT) +#define XSYNCCTRL_DAC2VSOFF_ON 0 + + +/* XDISPCTRL field */ +#define XDISPCTRL_DAC1OUTSEL_SHIFT 0L +#define XDISPCTRL_DAC1OUTSEL_MASK 1L +#define XDISPCTRL_DAC1OUTSEL_DIS 0L +#define XDISPCTRL_DAC1OUTSEL_EN 1L +#define XDISPCTRL_DAC2OUTSEL_SHIFT 2L +#define XDISPCTRL_DAC2OUTSEL_MASK (3L << XDISPCTRL_DAC2OUTSEL_SHIFT) +#define XDISPCTRL_DAC2OUTSEL_DIS 0L +#define XDISPCTRL_DAC2OUTSEL_CRTC1 (1L << XDISPCTRL_DAC2OUTSEL_SHIFT) +#define XDISPCTRL_DAC2OUTSEL_CRTC2 (2L << XDISPCTRL_DAC2OUTSEL_SHIFT) +#define XDISPCTRL_DAC2OUTSEL_TVE (3L << XDISPCTRL_DAC2OUTSEL_SHIFT) +#define XDISPCTRL_PANOUTSEL_SHIFT 5L +#define XDISPCTRL_PANOUTSEL_MASK (3L << XDISPCTRL_PANOUTSEL_SHIFT) +#define XDISPCTRL_PANOUTSEL_DIS 0L +#define XDISPCTRL_PANOUTSEL_CRTC1 (1L << XDISPCTRL_PANOUTSEL_SHIFT) +#define XDISPCTRL_PANOUTSEL_CRTC2RGB (2L << XDISPCTRL_PANOUTSEL_SHIFT) +#define XDISPCTRL_PANOUTSEL_CRTC2656 (3L << XDISPCTRL_PANOUTSEL_SHIFT) + +/* XPWRCTRL field*/ +#define XPWRCTRL_DAC2PDN_SHIFT 0 +#define XPWRCTRL_DAC2PDN_MASK (1 << XPWRCTRL_DAC2PDN_SHIFT) +#define XPWRCTRL_VIDPLLPDN_SHIFT 1 +#define XPWRCTRL_VIDPLLPDN_MASK (1 << XPWRCTRL_VIDPLLPDN_SHIFT) +#define XPWRCTRL_PANPDN_SHIFT 2 +#define XPWRCTRL_PANPDN_MASK (1 << XPWRCTRL_PANPDN_SHIFT) +#define XPWRCTRL_RFIFOPDN_SHIFT 3 +#define XPWRCTRL_RFIFOPDN_MASK (1 << XPWRCTRL_RFIFOPDN_SHIFT) +#define XPWRCTRL_CFIFOPDN_SHIFT 4 +#define XPWRCTRL_CFIFOPDN_MASK (1 << XPWRCTRL_CFIFOPDN_SHIFT) + + + +#define POS_HSYNC 0x00000004 +#define POS_VSYNC 0x00000008 + + +/* Set CRTC 2*/ +/* Uses the mode given by xfree86 to setup the registry */ +/* Does not write to the hard yet */ +void CRTC2Get(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +{ + + + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg = &pMga->ModeReg; + + xMODEINFO tmpModeInfo; + CARD32 ulHTotal; + CARD32 ulHDispEnd; + CARD32 ulHBlkStr; + CARD32 ulHBlkEnd; + CARD32 ulHSyncStr; + CARD32 ulHSyncEnd; + CARD32 ulVTotal; + CARD32 ulVDispEnd; + CARD32 ulVBlkStr; + CARD32 ulVBlkEnd; + CARD32 ulVSyncStr; + CARD32 ulVSyncEnd; + CARD32 ulOffset; + CARD32 ulCtl2; + CARD32 ulDataCtl2; + CARD32 ulDispHeight = pModeInfo->ulDispHeight; + +#ifdef DEBUG + ErrorF("ENTER CRTC2Get\n"); +#endif + + tmpModeInfo = *pModeInfo; + + + /* First compute the Values */ + + ulHTotal = tmpModeInfo.ulDispWidth + + tmpModeInfo.ulHFPorch + + tmpModeInfo.ulHBPorch + + tmpModeInfo.ulHSync; + + ulHDispEnd = tmpModeInfo.ulDispWidth; + ulHBlkStr = ulHDispEnd; + ulHBlkEnd = ulHBlkStr + tmpModeInfo.ulHBPorch + tmpModeInfo.ulHFPorch + tmpModeInfo.ulHSync; + ulHSyncStr = ulHBlkStr + tmpModeInfo.ulHFPorch; + ulHSyncEnd = ulHSyncStr + tmpModeInfo.ulHSync; + + ulVTotal = ulDispHeight + + tmpModeInfo.ulVFPorch + + tmpModeInfo.ulVBPorch + + tmpModeInfo.ulVSync; + + + ulVDispEnd = ulDispHeight; + ulVBlkStr = ulVDispEnd; + ulVBlkEnd = ulVBlkStr + tmpModeInfo.ulVBPorch + tmpModeInfo.ulVFPorch + tmpModeInfo.ulVSync; + ulVSyncStr = ulVBlkStr + tmpModeInfo.ulVFPorch; + ulVSyncEnd = ulVSyncStr + tmpModeInfo.ulVSync; + + ulOffset = tmpModeInfo.ulFBPitch; + + + + ulCtl2 = INREG(MGAREG_C2CTL); + ulDataCtl2 = INREG(MGAREG_C2DATACTL); + + ulCtl2 &= 0xFF1FFFFF; + ulDataCtl2 &= 0xFFFFFF00; + + switch (tmpModeInfo.ulBpp) + { + case 15: ulCtl2 |= 0x00200000; + ulOffset <<= 1; + break; + case 16: ulCtl2 |= 0x00400000; + ulOffset <<= 1; + break; + case 32: ulCtl2 |= 0x00800000; + ulOffset <<= 2; + break; + } + + + pReg->crtc2[ MGAREG2_C2CTL ] = ulCtl2; + pReg->crtc2[ MGAREG2_C2DATACTL ] = ulDataCtl2; + + /* Horizontal Value*/ + pReg->crtc2[MGAREG2_C2HPARAM] = (((ulHDispEnd-8) << 16) | (ulHTotal-8)) ; + pReg->crtc2[MGAREG2_C2HSYNC] = (((ulHSyncEnd-8) << 16) | (ulHSyncStr-8)) ; + + + /*Vertical Value*/ + pReg->crtc2[MGAREG2_C2VPARAM] = (((ulVDispEnd-1) << 16) | (ulVTotal-1)) ; + pReg->crtc2[MGAREG2_C2VSYNC] = (((ulVSyncEnd-1) << 16) | (ulVSyncStr-1)) ; + + /** Offset value*/ + + pReg->crtc2[MGAREG2_C2OFFSET] = ulOffset; + +#ifdef DEBUG + ErrorF("EXIT CRTC2Get\n"); +#endif + +} + +/* Set CRTC 2*/ +/* Writes to the hardware */ +void CRTC2Set(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +{ + + + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg = &pMga->ModeReg; + +#ifdef DEBUG + ErrorF("ENTER CRTC2Set\n"); +#endif + + + /* This writes to the registers manually */ + OUTREG(MGAREG_C2CTL, pReg->crtc2[MGAREG2_C2CTL]); + OUTREG(MGAREG_C2DATACTL,pReg->crtc2[MGAREG2_C2DATACTL]); + + + /* Horizontal Value*/ + OUTREG(MGAREG_C2HPARAM, pReg->crtc2[MGAREG2_C2HPARAM]); + OUTREG(MGAREG_C2HSYNC, pReg->crtc2[MGAREG2_C2HSYNC]); + + + /*Vertical Value*/ + OUTREG(MGAREG_C2VPARAM, pReg->crtc2[MGAREG2_C2VPARAM]); + OUTREG(MGAREG_C2VSYNC, pReg->crtc2[MGAREG2_C2VSYNC]); + + /** Offset value*/ + + OUTREG(MGAREG_C2OFFSET, pReg->crtc2[MGAREG2_C2VSYNC]); +#ifdef DEBUG + ErrorF("EXIT CRTC2Set\n"); +#endif + +} + + + /* Set CRTC2 on Second OutPut*/ +void EnableSecondOutPut(ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +{ + CARD8 ucByte, ucXDispCtrl; + CARD32 ulC2CTL, ulStatusReg; + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg; + pReg = &pMga->ModeReg; +#ifdef DEBUG + ErrorF("ENTER EnableSecondOutPut\n"); +#endif + + + /* Route Video PLL on second CRTC */ + ulC2CTL = INREG( MGAREG_C2CTL); + + /*--- Disable Pixel clock oscillations On Crtc1 */ + OUTREG( MGAREG_C2CTL, ulC2CTL | C2CTL_PIXCLKDIS_MASK); + /*--- Have to wait minimum time (2 acces will be ok) */ + ulStatusReg = INREG( MGAREG_Status); + ulStatusReg = INREG( MGAREG_Status); + + + ulC2CTL &= ~(C2CTL_PIXCLKSEL_MASK | C2CTL_PIXCLKSELH_MASK); + + ulC2CTL |= C2CTL_PIXCLKSEL_VIDEOPLL; + + + OUTREG( MGAREG_C2CTL, ulC2CTL); + /*--- Enable Pixel clock oscillations on CRTC2*/ + OUTREG( MGAREG_C2CTL, ulC2CTL & ~C2CTL_PIXCLKDIS_MASK); + + + /* We don't use MISC synch pol, must be 0*/ + ucByte = inMGAdreg( MGAREG_MISC_READ); + + OUTREG8(MGAREG_MISC_WRITE, (CARD8)(ucByte & ~(HSYNCPOL| VSYNCPOL) )); + + + + + /* Set Rset to 0.7 V*/ + ucByte = inMGAdac(MGA1064_GEN_IO_CTL); + ucByte &= ~0x40; + pReg->DacRegs[MGA1064_GEN_IO_CTL] = ucByte; + outMGAdac (MGA1064_GEN_IO_CTL, ucByte); + + ucByte = inMGAdac( MGA1064_GEN_IO_DATA); + ucByte &= ~0x40; + pReg->DacRegs[MGA1064_GEN_IO_DATA]= ucByte; + outMGAdac (MGA1064_GEN_IO_DATA, ucByte); + + + + /* Route Crtc2 on Dac2*/ + ulC2CTL = INREG( MGAREG_C2CTL); + ucXDispCtrl = inMGAdac( MGA1064_DISP_CTL); + + ucXDispCtrl &= ~XDISPCTRL_DAC2OUTSEL_MASK; + ucXDispCtrl |= XDISPCTRL_DAC2OUTSEL_CRTC2; + + /* Enable CRTC2*/ + ulC2CTL |= C2_EN_M; + + pReg->dac2[ MGA1064_DISP_CTL - 0x80] = ucXDispCtrl; + + + + OUTREG( MGAREG_C2CTL, ulC2CTL); + + /* Set DAC2 Synch polarity*/ + ucByte = inMGAdac( MGA1064_SYNC_CTL); + ucByte &= ~(XSYNCCTRL_DAC2HSPOL_MASK | XSYNCCTRL_DAC2VSPOL_MASK); + if ( !(pModeInfo->flSignalMode & POS_HSYNC) ) + { + ucByte |= XSYNCCTRL_DAC2HSPOL_NEG; + } + if ( !(pModeInfo->flSignalMode & POS_VSYNC) ) + { + ucByte |= XSYNCCTRL_DAC2VSPOL_NEG; + } + + /* Enable synch output*/ + ucByte &= ~(XSYNCCTRL_DAC2HSOFF_MASK | XSYNCCTRL_DAC2VSOFF_MASK); + pReg->dac2[ MGA1064_SYNC_CTL - 0x80] = ucByte; + + /* Powerup DAC2*/ + ucByte = inMGAdac( MGA1064_PWR_CTL); + pReg->dac2[ MGA1064_PWR_CTL - 0x80] = /* 0x0b; */ (ucByte | XPWRCTRL_DAC2PDN_MASK); + + + + /* Power up Fifo*/ + ucByte = inMGAdac( MGA1064_PWR_CTL); + pReg->dac2[ MGA1064_PWR_CTL - 0x80] = 0x1b; /* (ucByte | XPWRCTRL_CFIFOPDN_MASK) */; + + +#ifdef DEBUG + ErrorF("EXIT EnableSecondOutPut\n"); +#endif +} + + + + + +void CRTC2GetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +{ + CARD32 ulOffset; + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg; + + pReg = &pMga->ModeReg; +#ifdef DEBUG + ErrorF("ENTER CRTC2GetPitch\n"); +#endif + + + switch(pModeInfo->ulBpp) + { + case 15: + case 16: + ulOffset = pModeInfo->ulFBPitch * 2; + break; + case 32: + ulOffset = pModeInfo->ulFBPitch * 4; + break; + } + + pReg->crtc2[MGAREG2_C2OFFSET] = ulOffset; + +#ifdef DEBUG + ErrorF("EXIT CRTC2GetPitch\n"); +#endif + +} + +void CRTC2SetPitch (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo) +{ + + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg; + pReg = &pMga->ModeReg; + +#ifdef DEBUG + ErrorF("ENTER CRCT2SetPitch\n"); +#endif + + + OUTREG(MGAREG_C2OFFSET, pReg->crtc2[MGAREG2_C2OFFSET]); +#ifdef DEBUG + ErrorF("EXIT CRCT2SetPitch\n"); +#endif + +} + + + /* Set Display Start*/ + /* base in bytes*/ +void CRTC2GetDisplayStart (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY) +{ + + CARD32 ulAddress; + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg; + pReg = &pMga->ModeReg; + +#ifdef DEBUG + ErrorF("ENTER CRTC2GetDisplayStart\n"); +#endif + + + pReg = &pMga->ModeReg; + + ulAddress = (pModeInfo->ulFBPitch * ulY + ulX); + switch(pModeInfo->ulBpp) + { + case 15: + case 16: + ulAddress <<= 1; + break; + case 32: + ulAddress <<= 2; + break; + } + + pReg->crtc2[MGAREG2_C2STARTADD0] = ulAddress + base; +#ifdef DEBUG + ErrorF("EXIT CRTC2GetDisplayStart\n"); +#endif + +} + +void CRTC2SetDisplayStart (ScrnInfoPtr pScrn, xMODEINFO *pModeInfo, CARD32 base, CARD32 ulX, CARD32 ulY) +{ + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg; + pReg = &pMga->ModeReg; +#ifdef DEBUG + ErrorF("ENTER CRTC2SetDisplayStart\n"); +#endif + + OUTREG(MGAREG2_C2STARTADD0, pReg->crtc2[MGAREG2_C2STARTADD0]); +#ifdef DEBUG + ErrorF("EXIT CRTC2GetDisplayStart\n"); +#endif + +} + + + + + + + + + + + Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c:1.14 Mon Dec 11 17:34:55 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c Wed May 2 11:06:09 2001 @@ -1,5 +1,33 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.14 2000/12/11 22:34:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.c,v 1.21 2001/05/02 15:06:09 dawes Exp $ */ +/* + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith WHitwell <keithw@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -15,219 +43,172 @@ #include "miline.h" -#include "GL/glxtokens.h" + + #include "mga_bios.h" #include "mga_reg.h" #include "mga.h" #include "mga_macros.h" #include "mga_dri.h" -#include "mga_wrap.h" +#include "mga_sarea.h" -static char MGAKernelDriverName[] = "mga"; -static char MGAClientDriverName[] = "mga"; +#define _XF86DRI_SERVER_ +#include "GL/glxtokens.h" +#include "sarea.h" -static Bool MGAInitVisualConfigs(ScreenPtr pScreen); -static Bool MGACreateContext(ScreenPtr pScreen, VisualPtr visual, - drmContext hwContext, void *pVisualConfigPriv, - DRIContextType contextStore); -static void MGADestroyContext(ScreenPtr pScreen, drmContext hwContext, - DRIContextType contextStore); -static void MGADRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType readContextType, - void *readContextStore, - DRIContextType writeContextType, - void *writeContextStore); -static void MGADRISwapContext_shared(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType readContextType, - void *readContextStore, - DRIContextType writeContextType, - void *writeContextStore); -extern void Mga8DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -extern void Mga8DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index); -extern void Mga16DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -extern void Mga16DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index); -extern void Mga24DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -extern void Mga24DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index); -extern void Mga32DRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -extern void Mga32DRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, - RegionPtr prgnSrc, CARD32 index); - -Bool MgaCleanupDma(ScrnInfoPtr pScrn) -{ - MGAPtr pMGA = MGAPTR(pScrn); - Bool ret_val; - - ret_val = drmMgaCleanupDma(pMGA->drmSubFD); - if (ret_val == FALSE) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Mga Dma Cleanup Failed\n"); - - return ret_val; -} - -Bool MgaLockUpdate(ScrnInfoPtr pScrn, drmLockFlags flags) -{ - MGAPtr pMGA = MGAPTR(pScrn); - Bool ret_val; - - ret_val = drmMgaLockUpdate(pMGA->drmSubFD, flags); - if (ret_val == FALSE) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "LockUpdate failed\n"); - - return ret_val; -} - -Bool MgaInitDma(ScrnInfoPtr pScrn, int prim_size) -{ - MGAPtr pMGA = MGAPTR(pScrn); - MGADRIPtr pMGADRI = (MGADRIPtr)pMGA->pDRIInfo->devPrivate; - MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo; - drmMgaInit init; - Bool ret_val; - - memset(&init, 0, sizeof(drmMgaInit)); - init.reserved_map_agpstart = 0; - init.reserved_map_idx = 3; - init.buffer_map_idx = 4; - init.sarea_priv_offset = sizeof(XF86DRISAREARec); - init.primary_size = prim_size; - init.warp_ucode_size = pMGADRIServer->warp_ucode_size; - switch(pMGA->Chipset) { - case PCI_CHIP_MGAG400: - init.chipset = MGA_CARD_TYPE_G400; - break; - case PCI_CHIP_MGAG200: - case PCI_CHIP_MGAG200_PCI: - init.chipset = MGA_CARD_TYPE_G200; - break; - default: - return FALSE; - } - init.frontOffset = pMGADRI->frontOffset; - init.backOffset = pMGADRI->backOffset; - init.depthOffset = pMGADRI->depthOffset; - init.textureOffset = pMGADRI->textureOffset; - init.textureSize = pMGADRI->textureSize; - init.agpTextureSize = pMGADRI->agpTextureSize; - init.cpp = pMGADRI->cpp; - init.stride = pMGADRI->frontPitch; - init.mAccess = pMGA->MAccess; - init.sgram = !pMGA->HasSDRAM; - - memcpy(&init.WarpIndex, &pMGADRIServer->WarpIndex, - sizeof(drmMgaWarpIndex) * MGA_MAX_WARP_PIPES); - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Mga Dma Initialization start\n"); - - ret_val = drmMgaInitDma(pMGA->drmSubFD, &init); - if (ret_val == FALSE) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Mga Dma Initialization Failed\n"); - else - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Mga Dma Initialization done\n"); - return ret_val; -} + -static Bool -MGAInitVisualConfigs(ScreenPtr pScreen) +#include "GL/glxtokens.h" + +#include "mga_bios.h" +#include "mga_reg.h" +#include "mga.h" +#include "mga_macros.h" +#include "mga_dri.h" + +#include "mga_sarea.h" + +static char MGAKernelDriverName[] = "mga"; +static char MGAClientDriverName[] = "mga"; + +/* DRI buffer management + */ +extern void Mga8DRIInitBuffers( WindowPtr pWin, RegionPtr prgn, + CARD32 index ); +extern void Mga8DRIMoveBuffers( WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index ); + +extern void Mga16DRIInitBuffers( WindowPtr pWin, RegionPtr prgn, + CARD32 index ); +extern void Mga16DRIMoveBuffers( WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index ); + +extern void Mga24DRIInitBuffers( WindowPtr pWin, RegionPtr prgn, + CARD32 index ); +extern void Mga24DRIMoveBuffers( WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index ); + +extern void Mga32DRIInitBuffers( WindowPtr pWin, RegionPtr prgn, + CARD32 index ); +extern void Mga32DRIMoveBuffers( WindowPtr pParent, DDXPointRec ptOldOrg, + RegionPtr prgnSrc, CARD32 index ); + + +/* Initialize the visual configs that are supported by the hardware. + * These are combined with the visual configs that the indirect + * rendering core supports, and the intersection is exported to the + * client. + */ +static Bool MGAInitVisualConfigs( ScreenPtr pScreen ) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(pScrn); int numConfigs = 0; __GLXvisualConfig *pConfigs = 0; MGAConfigPrivPtr pMGAConfigs = 0; MGAConfigPrivPtr *pMGAConfigPtrs = 0; int i, db, depth, stencil, accum; - switch (pScrn->bitsPerPixel) { + switch ( pScrn->bitsPerPixel ) { case 8: case 24: break; + case 16: numConfigs = 8; - if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), - numConfigs))) { + pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig), + numConfigs ); + if ( !pConfigs ) { return FALSE; } - if (!(pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc(sizeof(MGAConfigPrivRec), - numConfigs))) { - xfree(pConfigs); + + pMGAConfigs = (MGAConfigPrivPtr)xcalloc( sizeof(MGAConfigPrivRec), + numConfigs ); + if ( !pMGAConfigs ) { + xfree( pConfigs ); return FALSE; } - if (!(pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc(sizeof(MGAConfigPrivPtr), - numConfigs))) { - xfree(pConfigs); - xfree(pMGAConfigs); + + pMGAConfigPtrs = (MGAConfigPrivPtr*)xcalloc( sizeof(MGAConfigPrivPtr), + numConfigs ); + if ( !pMGAConfigPtrs ) { + xfree( pConfigs ); + xfree( pMGAConfigs ); return FALSE; } - for (i=0; i<numConfigs; i++) + + for ( i = 0 ; i < numConfigs ; i++ ) { pMGAConfigPtrs[i] = &pMGAConfigs[i]; + } i = 0; depth = 1; - for (accum = 0; accum <= 1; accum++) { - for (stencil = 0; stencil <= 1; stencil++) { /* no stencil for now */ - for (db=1; db>=0; db--) { - pConfigs[i].vid = -1; - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - pConfigs[i].redSize = 5; - pConfigs[i].greenSize = 6; - pConfigs[i].blueSize = 5; - pConfigs[i].alphaSize = 0; - pConfigs[i].redMask = 0x0000F800; - pConfigs[i].greenMask = 0x000007E0; - pConfigs[i].blueMask = 0x0000001F; - pConfigs[i].alphaMask = 0; - if (accum) { - pConfigs[i].accumRedSize = 16; - pConfigs[i].accumGreenSize = 16; - pConfigs[i].accumBlueSize = 16; - pConfigs[i].accumAlphaSize = 0; + for ( accum = 0 ; accum <= 1 ; accum++ ) { + for ( stencil = 0 ; stencil <= 1 ; stencil++ ) { + for ( db = 1 ; db >= 0 ; db-- ) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 5; + pConfigs[i].greenSize = 6; + pConfigs[i].blueSize = 5; + pConfigs[i].alphaSize = 0; + pConfigs[i].redMask = 0x0000F800; + pConfigs[i].greenMask = 0x000007E0; + pConfigs[i].blueMask = 0x0000001F; + pConfigs[i].alphaMask = 0; + if ( accum ) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 0; } else { - pConfigs[i].accumRedSize = 0; - pConfigs[i].accumGreenSize = 0; - pConfigs[i].accumBlueSize = 0; - pConfigs[i].accumAlphaSize = 0; + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; } - if (db) - pConfigs[i].doubleBuffer = TRUE; - else - pConfigs[i].doubleBuffer = FALSE; - pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 16; - if (depth) - pConfigs[i].depthSize = 16; - else - pConfigs[i].depthSize = 0; - if (stencil) - pConfigs[i].stencilSize = 8; - else - pConfigs[i].stencilSize = 0; - pConfigs[i].auxBuffers = 0; - pConfigs[i].level = 0; - if (stencil || accum) - pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; - else - pConfigs[i].visualRating = GLX_NONE_EXT; - pConfigs[i].transparentPixel = 0; - pConfigs[i].transparentRed = 0; - pConfigs[i].transparentGreen = 0; - pConfigs[i].transparentBlue = 0; - pConfigs[i].transparentAlpha = 0; - pConfigs[i].transparentIndex = 0; + if ( db ) { + pConfigs[i].doubleBuffer = TRUE; + } else { + pConfigs[i].doubleBuffer = FALSE; + } + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 16; + if ( depth ) { + pConfigs[i].depthSize = 16; + } else { + pConfigs[i].depthSize = 0; + } + if ( stencil ) { + pConfigs[i].stencilSize = 8; + } else { + pConfigs[i].stencilSize = 0; + } + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if ( accum || stencil ) { + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + } else { + pConfigs[i].visualRating = GLX_NONE_EXT; + } + pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; i++; } } } - if (i != numConfigs) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] Incorrect initialization of visuals\n"); + if ( i != numConfigs ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Incorrect initialization of visuals\n" ); return FALSE; } break; @@ -235,152 +216,689 @@ case 32: numConfigs = 8; - if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), - numConfigs))) { + pConfigs = (__GLXvisualConfig*)xcalloc( sizeof(__GLXvisualConfig), + numConfigs ); + if ( !pConfigs ) { return FALSE; } - if (!(pMGAConfigs = (MGAConfigPrivPtr)xnfcalloc(sizeof(MGAConfigPrivRec), - numConfigs))) { - xfree(pConfigs); + + pMGAConfigs = (MGAConfigPrivPtr)xcalloc( sizeof(MGAConfigPrivRec), + numConfigs ); + if ( !pMGAConfigs ) { + xfree( pConfigs ); return FALSE; } - if (!(pMGAConfigPtrs = (MGAConfigPrivPtr*)xnfcalloc(sizeof(MGAConfigPrivPtr), - numConfigs))) { - xfree(pConfigs); - xfree(pMGAConfigs); + + pMGAConfigPtrs = (MGAConfigPrivPtr*)xcalloc( sizeof(MGAConfigPrivPtr), + numConfigs ); + if ( !pMGAConfigPtrs ) { + xfree( pConfigs ); + xfree( pMGAConfigs ); return FALSE; } - for (i=0; i<numConfigs; i++) + + for ( i = 0 ; i < numConfigs ; i++ ) { pMGAConfigPtrs[i] = &pMGAConfigs[i]; + } i = 0; - for (accum = 0; accum <= 1; accum++) { - for (depth = 0; depth <= 1; depth++) { /* and stencil */ - for (db=1; db>=0; db--) { - pConfigs[i].vid = -1; - pConfigs[i].class = -1; - pConfigs[i].rgba = TRUE; - pConfigs[i].redSize = 8; - pConfigs[i].greenSize = 8; - pConfigs[i].blueSize = 8; - pConfigs[i].alphaSize = 0; - pConfigs[i].redMask = 0x00FF0000; - pConfigs[i].greenMask = 0x0000FF00; - pConfigs[i].blueMask = 0x000000FF; - pConfigs[i].alphaMask = 0; - if (accum) { - pConfigs[i].accumRedSize = 16; - pConfigs[i].accumGreenSize = 16; - pConfigs[i].accumBlueSize = 16; - pConfigs[i].accumAlphaSize = 0; + for ( accum = 0 ; accum <= 1 ; accum++ ) { + for ( depth = 0 ; depth <= 1 ; depth++ ) { /* and stencil */ + for ( db = 1 ; db >= 0 ; db-- ) { + pConfigs[i].vid = -1; + pConfigs[i].class = -1; + pConfigs[i].rgba = TRUE; + pConfigs[i].redSize = 8; + pConfigs[i].greenSize = 8; + pConfigs[i].blueSize = 8; + pConfigs[i].alphaSize = 8; + pConfigs[i].redMask = 0x00FF0000; + pConfigs[i].greenMask = 0x0000FF00; + pConfigs[i].blueMask = 0x000000FF; + pConfigs[i].alphaMask = 0; + if ( accum ) { + pConfigs[i].accumRedSize = 16; + pConfigs[i].accumGreenSize = 16; + pConfigs[i].accumBlueSize = 16; + pConfigs[i].accumAlphaSize = 0; } else { - pConfigs[i].accumRedSize = 0; - pConfigs[i].accumGreenSize = 0; - pConfigs[i].accumBlueSize = 0; - pConfigs[i].accumAlphaSize = 0; + pConfigs[i].accumRedSize = 0; + pConfigs[i].accumGreenSize = 0; + pConfigs[i].accumBlueSize = 0; + pConfigs[i].accumAlphaSize = 0; } - if (db) - pConfigs[i].doubleBuffer = TRUE; - else - pConfigs[i].doubleBuffer = FALSE; - pConfigs[i].stereo = FALSE; - pConfigs[i].bufferSize = 32; - if (depth) { - pConfigs[i].depthSize = 24; - pConfigs[i].stencilSize = 8; + if ( db ) { + pConfigs[i].doubleBuffer = TRUE; + } else { + pConfigs[i].doubleBuffer = FALSE; + } + pConfigs[i].stereo = FALSE; + pConfigs[i].bufferSize = 32; + if ( depth ) { + pConfigs[i].depthSize = 24; + pConfigs[i].stencilSize = 8; } else { - pConfigs[i].depthSize = 0; - pConfigs[i].stencilSize = 0; + pConfigs[i].depthSize = 0; + pConfigs[i].stencilSize = 0; } - pConfigs[i].auxBuffers = 0; - pConfigs[i].level = 0; - if (accum) - pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; - else - pConfigs[i].visualRating = GLX_NONE_EXT; - pConfigs[i].transparentPixel = 0; - pConfigs[i].transparentRed = 0; - pConfigs[i].transparentGreen = 0; - pConfigs[i].transparentBlue = 0; - pConfigs[i].transparentAlpha = 0; - pConfigs[i].transparentIndex = 0; + pConfigs[i].auxBuffers = 0; + pConfigs[i].level = 0; + if ( accum ) { + pConfigs[i].visualRating = GLX_SLOW_VISUAL_EXT; + } else { + pConfigs[i].visualRating = GLX_NONE_EXT; + } + pConfigs[i].transparentPixel = 0; + pConfigs[i].transparentRed = 0; + pConfigs[i].transparentGreen = 0; + pConfigs[i].transparentBlue = 0; + pConfigs[i].transparentAlpha = 0; + pConfigs[i].transparentIndex = 0; i++; } } } - if (i != numConfigs) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] Incorrect initialization of visuals\n"); + if ( i != numConfigs ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Incorrect initialization of visuals\n" ); return FALSE; } break; default: - ; /* unexpected bits/pixelx */ + /* Unexpected bits/pixels */ + break; } - pMGA->numVisualConfigs = numConfigs; - pMGA->pVisualConfigs = pConfigs; - pMGA->pVisualConfigsPriv = pMGAConfigs; - GlxSetVisualConfigs(numConfigs, pConfigs, (void**)pMGAConfigPtrs); + + pMga->numVisualConfigs = numConfigs; + pMga->pVisualConfigs = pConfigs; + pMga->pVisualConfigsPriv = pMGAConfigs; + + GlxSetVisualConfigs( numConfigs, pConfigs, (void **)pMGAConfigPtrs ); + + return TRUE; +} + +static Bool MGACreateContext( ScreenPtr pScreen, VisualPtr visual, + drmContext hwContext, void *pVisualConfigPriv, + DRIContextType contextStore ) +{ + /* Nothing yet */ return TRUE; } + +static void MGADestroyContext( ScreenPtr pScreen, drmContext hwContext, + DRIContextType contextStore ) +{ + /* Nothing yet */ +} + + +/* Quiescence, locking + */ +#define MGA_TIMEOUT 2048 + +static void MGAWaitForIdleDMA( ScrnInfoPtr pScrn ) +{ + MGAPtr pMga = MGAPTR(pScrn); + int ret; + int i = 0; + + for (;;) { + do { + ret = drmMGAFlushDMA( pMga->drmFD, + DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH ); + } while ( ( ret == -EBUSY ) && ( i++ < MGA_TIMEOUT ) ); + + if ( ret == 0 ) + return; + + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[dri] Idle timed out, resetting engine...\n" ); + + drmMGAEngineReset( pMga->drmFD ); + } +} + + +void MGAGetQuiescence( ScrnInfoPtr pScrn ) +{ + MGAPtr pMga = MGAPTR(pScrn); + + DRILock( screenInfo.screens[pScrn->scrnIndex], 0 ); + pMga->haveQuiescense = 1; + + if ( pMga->directRenderingEnabled ) { + MGAFBLayout *pLayout = &pMga->CurrentLayout; + + MGAWaitForIdleDMA( pScrn ); + + WAITFIFO( 11 ); + OUTREG( MGAREG_MACCESS, pMga->MAccess ); + OUTREG( MGAREG_PITCH, pLayout->displayWidth ); + + pMga->PlaneMask = ~0; + OUTREG( MGAREG_PLNWT, pMga->PlaneMask ); + + pMga->BgColor = 0; + pMga->FgColor = 0; + OUTREG( MGAREG_BCOL, pMga->BgColor ); + OUTREG( MGAREG_FCOL, pMga->FgColor ); + OUTREG( MGAREG_SRCORG, pMga->realSrcOrg ); + + pMga->SrcOrg = 0; + OUTREG( MGAREG_DSTORG, pMga->DstOrg ); + OUTREG( MGAREG_OPMODE, MGAOPM_DMA_BLIT ); + OUTREG( MGAREG_CXBNDRY, 0xFFFF0000 ); /* (maxX << 16) | minX */ + OUTREG( MGAREG_YTOP, 0x00000000 ); /* minPixelPointer */ + OUTREG( MGAREG_YBOT, 0x007FFFFF ); /* maxPixelPointer */ + + pMga->AccelFlags &= ~CLIPPER_ON; + } +} + +void MGAGetQuiescenceShared( ScrnInfoPtr pScrn ) +{ + MGAPtr pMga = MGAPTR(pScrn); + MGAEntPtr pMGAEnt = pMga->entityPrivate; + MGAPtr pMGA2 = MGAPTR(pMGAEnt->pScrn_2); + + DRILock( screenInfo.screens[pMGAEnt->pScrn_1->scrnIndex], 0 ); + + pMga = MGAPTR(pMGAEnt->pScrn_1); + pMga->haveQuiescense = 1; + pMGA2->haveQuiescense = 1; + + if ( pMGAEnt->directRenderingEnabled ) { + MGAWaitForIdleDMA( pMGAEnt->pScrn_1 ); + pMga->RestoreAccelState( pScrn ); + xf86SetLastScrnFlag( pScrn->entityList[0], pScrn->scrnIndex ); + } +} + +static void MGASwapContext( ScreenPtr pScreen ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + + /* Arrange for dma_quiescence and xaa sync to be called as + * appropriate. + */ + pMga->haveQuiescense = 0; + pMga->AccelInfoRec->NeedToSync = TRUE; +} -static unsigned int mylog2(unsigned int n) +static void MGASwapContextShared( ScreenPtr pScreen ) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + MGAEntPtr pMGAEnt = pMga->entityPrivate; + MGAPtr pMGA2 = MGAPTR(pMGAEnt->pScrn_2); + + pMga = MGAPTR(pMGAEnt->pScrn_1); + + pMga->haveQuiescense = 0; + pMga->AccelInfoRec->NeedToSync = TRUE; + + pMGA2->haveQuiescense = 0; + pMGA2->AccelInfoRec->NeedToSync = TRUE; +} + +/* This is really only called from validate/postvalidate as we + * override the dri lock/unlock. Want to remove validate/postvalidate + * processing, but need to remove all client-side use of drawable lock + * first (otherwise there is noone recover when a client dies holding + * the drawable lock). + * + * What does this mean? + * + * - The above code gets executed every time a + * window changes shape or the focus changes, which isn't really + * optimal. + * - The X server therefore believes it needs to do an XAA sync + * *and* a dma quiescense ioctl each time that happens. + * + * We don't wrap wakeuphandler any longer, so at least we can say that + * this doesn't happen *every time the mouse moves*... + */ +static void +MGADRISwapContext( ScreenPtr pScreen, DRISyncType syncType, + DRIContextType oldContextType, void *oldContext, + DRIContextType newContextType, void *newContext ) +{ +#if 0 + if ( syncType == DRI_3D_SYNC && + oldContextType == DRI_2D_CONTEXT && + newContextType == DRI_2D_CONTEXT ) + { + MGASwapContext( pScreen ); + } +#endif +} + +static void +MGADRISwapContextShared( ScreenPtr pScreen, DRISyncType syncType, + DRIContextType oldContextType, void *oldContext, + DRIContextType newContextType, void *newContext ) +{ +#if 0 + if ( syncType == DRI_3D_SYNC && + oldContextType == DRI_2D_CONTEXT && + newContextType == DRI_2D_CONTEXT ) + { + MGASwapContextShared( pScreen ); + } +#endif +} + + +static void MGAWakeupHandler( int screenNum, pointer wakeupData, + unsigned long result, pointer pReadmask ) +{ + ScreenPtr pScreen = screenInfo.screens[screenNum]; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + + if ( xf86IsEntityShared( pScrn->entityList[0] ) ) { + MGASwapContextShared( pScreen ); + } else { + MGASwapContext( pScreen ); + } +} + +static void MGABlockHandler( int screenNum, pointer blockData, + pointer pTimeout, pointer pReadmask ) + +{ + ScreenPtr pScreen = screenInfo.screens[screenNum]; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + MGAEntPtr pMGAEnt; + + if ( pMga->haveQuiescense ) { + if ( xf86IsEntityShared( pScrn->entityList[0] ) ) { + /* Restore to first screen */ + pMga->RestoreAccelState( pScrn ); + xf86SetLastScrnFlag( pScrn->entityList[0], pScrn->scrnIndex ); + pMGAEnt = pMga->entityPrivate; + + if ( pMGAEnt->directRenderingEnabled ) { + DRIUnlock( screenInfo.screens[pMGAEnt->pScrn_1->scrnIndex] ); + } + } else { + if ( pMga->directRenderingEnabled ) { + DRIUnlock( pScreen ); + } + } + pMga->haveQuiescense = 0; + } +} + +void MGASelectBuffer( ScrnInfoPtr pScrn, int which ) +{ + MGAPtr pMga = MGAPTR(pScrn); + MGADRIPtr pMGADRI = (MGADRIPtr)pMga->pDRIInfo->devPrivate; + + switch ( which ) { + case MGA_BACK: + OUTREG( MGAREG_DSTORG, pMGADRI->backOffset ); + OUTREG( MGAREG_SRCORG, pMGADRI->backOffset ); + break; + case MGA_DEPTH: + OUTREG( MGAREG_DSTORG, pMGADRI->depthOffset ); + OUTREG( MGAREG_SRCORG, pMGADRI->depthOffset ); + break; + default: + case MGA_FRONT: + OUTREG( MGAREG_DSTORG, pMGADRI->frontOffset ); + OUTREG( MGAREG_SRCORG, pMGADRI->frontOffset ); + break; + } +} + + +static unsigned int mylog2( unsigned int n ) +{ unsigned int log2 = 1; - while (n>1) n >>= 1, log2++; + while ( n > 1 ) n >>= 1, log2++; return log2; } -static unsigned long MGAParseAgpMode(ScreenPtr pScreen) +static Bool MGADRIAgpInit(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; MGAPtr pMga = MGAPTR(pScrn); - unsigned long mode_mask; + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + unsigned long mode; + unsigned int vendor, device; + int ret, count; + + /* FIXME: Make these configurable... + */ + pMGADRIServer->agp.size = 12 * 1024 * 1024; + + pMGADRIServer->warp.offset = 0; + pMGADRIServer->warp.size = MGA_WARP_UCODE_SIZE; - switch(pMga->agp_mode) { + pMGADRIServer->primary.offset = (pMGADRIServer->warp.offset + + pMGADRIServer->warp.size); + pMGADRIServer->primary.size = 1024 * 1024; + + pMGADRIServer->buffers.offset = (pMGADRIServer->primary.offset + + pMGADRIServer->primary.size); + pMGADRIServer->buffers.size = MGA_NUM_BUFFERS * MGA_BUFFER_SIZE; + + if ( drmAgpAcquire( pMga->drmFD ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not available\n" ); + return FALSE; + } + + mode = drmAgpGetMode( pMga->drmFD ); /* Default mode */ + vendor = drmAgpVendorId( pMga->drmFD ); + device = drmAgpDeviceId( pMga->drmFD ); + + mode &= ~MGA_AGP_MODE_MASK; + switch ( pMga->agpMode ) { case 4: - mode_mask = ~0x00000003; - break; + mode |= MGA_AGP_4X_MODE; case 2: - if (pMga->Chipset == PCI_CHIP_MGAG200) { - xf86DrvMsg(pScreen->myNum, X_INFO, - "[drm] Enabling AGP 2x pll encoding\n"); - OUTREG(MGAREG_AGP_PLL, AGP_PLL_agp2xpllen_enable); - } - mode_mask = ~0x00000005; - break; - default: - /* Default to 1X agp mode */ + mode |= MGA_AGP_2X_MODE; case 1: - if (pMga->Chipset == PCI_CHIP_MGAG200) { - xf86DrvMsg(pScreen->myNum, X_INFO, - "[drm] Disabling AGP 2x pll encoding\n"); - OUTREG(MGAREG_AGP_PLL, AGP_PLL_agp2xpllen_disable); + default: + mode |= MGA_AGP_1X_MODE; + } + + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] Mode 0x%08lx [AGP 0x%04x/0x%04x; Card 0x%04x/0x%04x]\n", + mode, vendor, device, + pMga->PciInfo->vendor, + pMga->PciInfo->chipType ); + + if ( drmAgpEnable( pMga->drmFD, mode ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] AGP not enabled\n" ); + drmAgpRelease( pMga->drmFD ); + return FALSE; + } + + if ( pMga->Chipset == PCI_CHIP_MGAG200 ) { + switch ( pMga->agpMode ) { + case 2: + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Enabling AGP 2x PLL encoding\n" ); + OUTREG( MGAREG_AGP_PLL, MGA_AGP2XPLL_ENABLE ); + break; + + case 1: + default: + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Disabling AGP 2x PLL encoding\n" ); + OUTREG( MGAREG_AGP_PLL, MGA_AGP2XPLL_DISABLE ); + pMga->agpMode = 1; + break; } - pMga->agp_mode = 1; - mode_mask = ~0x00000006; + } + + ret = drmAgpAlloc( pMga->drmFD, pMGADRIServer->agp.size, + 0, NULL, &pMGADRIServer->agp.handle ); + if ( ret < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] Out of memory (%d)\n", ret ); + drmAgpRelease( pMga->drmFD ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] %d kB allocated with handle 0x%08x\n", + pMGADRIServer->agp.size/1024, pMGADRIServer->agp.handle ); + + if ( drmAgpBind( pMga->drmFD, pMGADRIServer->agp.handle, 0 ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, "[agp] Could not bind memory\n" ); + drmAgpFree( pMga->drmFD, pMGADRIServer->agp.handle ); + drmAgpRelease( pMga->drmFD ); + return FALSE; + } + + /* WARP microcode space + */ + if ( drmAddMap( pMga->drmFD, + pMGADRIServer->warp.offset, + pMGADRIServer->warp.size, + DRM_AGP, DRM_READ_ONLY, + &pMGADRIServer->warp.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not add WARP microcode mapping\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] WARP microcode handle = 0x%08lx\n", + pMGADRIServer->warp.handle ); + + if ( drmMap( pMga->drmFD, + pMGADRIServer->warp.handle, + pMGADRIServer->warp.size, + &pMGADRIServer->warp.map ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not map WARP microcode\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] WARP microcode mapped at 0x%08lx\n", + (unsigned long)pMGADRIServer->warp.map ); + + /* Primary DMA space + */ + if ( drmAddMap( pMga->drmFD, + pMGADRIServer->primary.offset, + pMGADRIServer->primary.size, + DRM_AGP, DRM_READ_ONLY, + &pMGADRIServer->primary.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not add primary DMA mapping\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] Primary DMA handle = 0x%08lx\n", + pMGADRIServer->primary.handle ); + + if ( drmMap( pMga->drmFD, + pMGADRIServer->primary.handle, + pMGADRIServer->primary.size, + &pMGADRIServer->primary.map ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not map primary DMA\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] Primary DMA mapped at 0x%08lx\n", + (unsigned long)pMGADRIServer->primary.map ); + + /* DMA buffers + */ + if ( drmAddMap( pMga->drmFD, + pMGADRIServer->buffers.offset, + pMGADRIServer->buffers.size, + DRM_AGP, 0, + &pMGADRIServer->buffers.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not add DMA buffers mapping\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] DMA buffers handle = 0x%08lx\n", + pMGADRIServer->buffers.handle ); + + if ( drmMap( pMga->drmFD, + pMGADRIServer->buffers.handle, + pMGADRIServer->buffers.size, + &pMGADRIServer->buffers.map ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not map DMA buffers\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] DMA buffers mapped at 0x%08lx\n", + (unsigned long)pMGADRIServer->buffers.map ); + + count = drmAddBufs( pMga->drmFD, + MGA_NUM_BUFFERS, MGA_BUFFER_SIZE, + DRM_AGP_BUFFER, pMGADRIServer->buffers.offset ); + if ( count <= 0 ) { + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "[drm] failure adding %d %d byte DMA buffers\n", + MGA_NUM_BUFFERS, MGA_BUFFER_SIZE ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Added %d %d byte DMA buffers\n", + count, MGA_BUFFER_SIZE ); + + xf86EnablePciBusMaster( pMga->PciInfo, TRUE ); + + return TRUE; +} + +static Bool MGADRIMapInit( ScreenPtr pScreen ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + + pMGADRIServer->registers.size = MGAIOMAPSIZE; + + if ( drmAddMap( pMga->drmFD, + (drmHandle)pMga->IOAddress, + pMGADRIServer->registers.size, + DRM_REGISTERS, DRM_READ_ONLY, + &pMGADRIServer->registers.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[drm] Could not add MMIO registers mapping\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Registers handle = 0x%08lx\n", + pMGADRIServer->registers.handle ); + + pMGADRIServer->status.size = SAREA_MAX; + + if ( drmAddMap( pMga->drmFD, 0, pMGADRIServer->status.size, + DRM_SHM, DRM_READ_ONLY | DRM_LOCKED | DRM_KERNEL, + &pMGADRIServer->status.handle ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[drm] Could not add status page mapping\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Status handle = 0x%08lx\n", + pMGADRIServer->status.handle ); + + if ( drmMap( pMga->drmFD, + pMGADRIServer->status.handle, + pMGADRIServer->status.size, + &pMGADRIServer->status.map ) < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[agp] Could not map status page\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[agp] Status page mapped at 0x%08lx\n", + (unsigned long)pMGADRIServer->status.map ); + + return TRUE; +} + +static Bool MGADRIKernelInit( ScreenPtr pScreen ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + drmMGAInit init; + int ret; + + memset( &init, 0, sizeof(drmMGAInit) ); + + init.sarea_priv_offset = sizeof(XF86DRISAREARec); + + switch ( pMga->Chipset ) { + case PCI_CHIP_MGAG400: + init.chipset = MGA_CARD_TYPE_G400; break; + case PCI_CHIP_MGAG200: + case PCI_CHIP_MGAG200_PCI: + init.chipset = MGA_CARD_TYPE_G200; + break; + default: + return FALSE; + } + init.sgram = !pMga->HasSDRAM; + + init.maccess = pMga->MAccess; + + init.fb_cpp = pScrn->bitsPerPixel / 8; + init.front_offset = pMGADRIServer->frontOffset; + init.front_pitch = pMGADRIServer->frontPitch / init.fb_cpp; + init.back_offset = pMGADRIServer->backOffset; + init.back_pitch = pMGADRIServer->backPitch / init.fb_cpp; + + init.depth_cpp = pScrn->bitsPerPixel / 8; + init.depth_offset = pMGADRIServer->depthOffset; + init.depth_pitch = pMGADRIServer->depthPitch / init.depth_cpp; + + init.texture_offset[0] = pMGADRIServer->textureOffset; + init.texture_size[0] = pMGADRIServer->textureSize; + + init.fb_offset = pMga->FbAddress; + init.mmio_offset = pMGADRIServer->registers.handle; + init.status_offset = pMGADRIServer->status.handle; + + init.warp_offset = pMGADRIServer->warp.handle; + init.primary_offset = pMGADRIServer->primary.handle; + init.buffers_offset = pMGADRIServer->buffers.handle; + + ret = drmMGAInitDMA( pMga->drmFD, &init ); + if ( ret < 0 ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Failed to initialize DMA! (%d)\n", ret ); + return FALSE; } + +#if 0 + /* FIXME: This is just here to clean up after the engine reset test + * in the kernel module. Please remove it later... + */ + pMga->GetQuiescence( pScrn ); +#endif + + return TRUE; +} - return mode_mask; +static Bool MGADRIBuffersInit( ScreenPtr pScreen ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + + + pMGADRIServer->drmBuffers = drmMapBufs( pMga->drmFD ); + if ( !pMGADRIServer->drmBuffers ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[drm] Failed to map DMA buffers list\n" ); + return FALSE; + } + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] Mapped %d DMA buffers\n", + pMGADRIServer->drmBuffers->count ); + + return TRUE; } -Bool MGADRIScreenInit(ScreenPtr pScreen) + +Bool MGADRIScreenInit( ScreenPtr pScreen ) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(pScrn); DRIInfoPtr pDRIInfo; MGADRIPtr pMGADRI; MGADRIServerPrivatePtr pMGADRIServer; - int bufs, size; - int prim_size; - int init_offset; - int i; - unsigned long mode_mask; - switch(pMGA->Chipset) { + switch ( pMga->Chipset ) { case PCI_CHIP_MGAG400: case PCI_CHIP_MGAG200: #if 0 @@ -388,112 +906,134 @@ #endif break; default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Direct rendering only supported with G200/G400 AGP\n"); + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Direct rendering only supported with AGP G200/G400 cards!\n" ); return FALSE; } /* Check that the GLX, DRI, and DRM modules have been loaded by testing - * for canonical symbols in each module. */ - if (!xf86LoaderCheckSymbol("GlxSetVisualConfigs")) return FALSE; - if (!xf86LoaderCheckSymbol("DRIScreenInit")) return FALSE; - if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE; - if (!xf86LoaderCheckSymbol("DRIQueryVersion")) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "MGADRIScreenInit failed (libdri.a too old)\n"); + * for canonical symbols in each module. + */ + if ( !xf86LoaderCheckSymbol( "GlxSetVisualConfigs" ) ) return FALSE; + if ( !xf86LoaderCheckSymbol( "DRIScreenInit" ) ) return FALSE; + if ( !xf86LoaderCheckSymbol( "drmAvailable" ) ) return FALSE; + if ( !xf86LoaderCheckSymbol( "DRIQueryVersion" ) ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[dri] MGADRIScreenInit failed (libdri.a too old)\n" ); return FALSE; } - + /* Check the DRI version */ { int major, minor, patch; - DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 0 || patch < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] MGADRIScreenInit failed (DRI version = %d.%d.%d, expected 3.0.x). Disabling DRI.\n", - major, minor, patch); + DRIQueryVersion( &major, &minor, &patch ); + if ( major != 4 || minor < 0 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[dri] MGADRIScreenInit failed because of a version mismatch.\n" + "[dri] libDRI version = %d.%d.%d but version 4.0.x is needed.\n" + "[dri] Disabling the DRI.\n", + major, minor, patch ); return FALSE; } } - - xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] bpp: %d depth: %d\n", pScrn->bitsPerPixel, pScrn->depth); - if ((pScrn->bitsPerPixel / 8) != 2 && - (pScrn->bitsPerPixel / 8) != 4) { - xf86DrvMsg(pScreen->myNum, X_INFO, - "[drm] Direct rendering only supported in 16 and 32 bpp modes\n"); + xf86DrvMsg( pScreen->myNum, X_INFO, + "[drm] bpp: %d depth: %d\n", + pScrn->bitsPerPixel, pScrn->depth ); + + if ( (pScrn->bitsPerPixel / 8) != 2 && + (pScrn->bitsPerPixel / 8) != 4 ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[dri] Direct rendering only supported in 16 and 32 bpp modes\n" ); return FALSE; } - + pDRIInfo = DRICreateInfoRec(); - if (!pDRIInfo) + if ( !pDRIInfo ) { + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[dri] DRICreateInfoRec() failed\n" ); return FALSE; - pMGA->pDRIInfo = pDRIInfo; + } + pMga->pDRIInfo = pDRIInfo; pDRIInfo->drmDriverName = MGAKernelDriverName; pDRIInfo->clientDriverName = MGAClientDriverName; pDRIInfo->busIdString = xalloc(64); - sprintf(pDRIInfo->busIdString, "PCI:%d:%d:%d", - ((pciConfigPtr)pMGA->PciInfo->thisCard)->busnum, - ((pciConfigPtr)pMGA->PciInfo->thisCard)->devnum, - ((pciConfigPtr)pMGA->PciInfo->thisCard)->funcnum); + sprintf( pDRIInfo->busIdString, "PCI:%d:%d:%d", + ((pciConfigPtr)pMga->PciInfo->thisCard)->busnum, + ((pciConfigPtr)pMga->PciInfo->thisCard)->devnum, + ((pciConfigPtr)pMga->PciInfo->thisCard)->funcnum ); pDRIInfo->ddxDriverMajorVersion = MGA_MAJOR_VERSION; pDRIInfo->ddxDriverMinorVersion = MGA_MINOR_VERSION; pDRIInfo->ddxDriverPatchVersion = MGA_PATCHLEVEL; - pDRIInfo->frameBufferPhysicalAddress = pMGA->FbAddress; - pDRIInfo->frameBufferSize = pMGA->FbMapSize; + pDRIInfo->frameBufferPhysicalAddress = pMga->FbAddress; + pDRIInfo->frameBufferSize = pMga->FbMapSize; pDRIInfo->frameBufferStride = pScrn->displayWidth*(pScrn->bitsPerPixel/8); pDRIInfo->ddxDrawableTableEntry = MGA_MAX_DRAWABLES; + + pDRIInfo->wrap.BlockHandler = MGABlockHandler; + pDRIInfo->wrap.WakeupHandler = MGAWakeupHandler; + pDRIInfo->wrap.ValidateTree = NULL; + pDRIInfo->wrap.PostValidateTree = NULL; - MGADRIWrapFunctions( pScreen, pDRIInfo ); + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; - if (SAREA_MAX_DRAWABLES < MGA_MAX_DRAWABLES) + if ( SAREA_MAX_DRAWABLES < MGA_MAX_DRAWABLES ) { pDRIInfo->maxDrawableTableEntry = SAREA_MAX_DRAWABLES; - else + } else { pDRIInfo->maxDrawableTableEntry = MGA_MAX_DRAWABLES; + } /* For now the mapping works by using a fixed size defined - * in the SAREA header + * in the SAREA header. */ - if (sizeof(XF86DRISAREARec)+sizeof(MGASAREARec)>SAREA_MAX) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "[drm] Data does not fit in SAREA\n"); + if ( sizeof(XF86DRISAREARec) + sizeof(MGASAREAPrivRec) > SAREA_MAX ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Data does not fit in SAREA\n" ); return FALSE; } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[drm] Sarea %d+%d: %d\n", - sizeof(XF86DRISAREARec), sizeof(MGASAREARec), - sizeof(XF86DRISAREARec) + sizeof(MGASAREARec)); + + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "[drm] Sarea %d+%d: %d\n", + sizeof(XF86DRISAREARec), sizeof(MGASAREAPrivRec), + sizeof(XF86DRISAREARec) + sizeof(MGASAREAPrivRec) ); pDRIInfo->SAREASize = SAREA_MAX; - if (!(pMGADRI = (MGADRIPtr)xnfcalloc(sizeof(MGADRIRec),1))) { - DRIDestroyInfoRec(pMGA->pDRIInfo); - pMGA->pDRIInfo=0; - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] Failed to allocate memory for private record\n"); + pMGADRI = (MGADRIPtr)xcalloc( sizeof(MGADRIRec), 1 ); + if ( !pMGADRI ) { + DRIDestroyInfoRec( pMga->pDRIInfo ); + pMga->pDRIInfo = 0; + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Failed to allocate memory for private record\n" ); return FALSE; } - if (!(pMGADRIServer = (MGADRIServerPrivatePtr) - xnfcalloc(sizeof(MGADRIServerPrivateRec),1))) { - xfree(pMGADRI); - DRIDestroyInfoRec(pMGA->pDRIInfo); - pMGA->pDRIInfo=0; - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] Failed to allocate memory for private record\n"); + + pMGADRIServer = (MGADRIServerPrivatePtr) + xcalloc( sizeof(MGADRIServerPrivateRec), 1 ); + if ( !pMGADRIServer ) { + xfree( pMGADRI ); + DRIDestroyInfoRec( pMga->pDRIInfo ); + pMga->pDRIInfo = 0; + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "[drm] Failed to allocate memory for private record\n" ); return FALSE; } + pMga->DRIServerInfo = pMGADRIServer; pDRIInfo->devPrivate = pMGADRI; - pMGA->DRIServerInfo = pMGADRIServer; pDRIInfo->devPrivateSize = sizeof(MGADRIRec); pDRIInfo->contextSize = sizeof(MGADRIContextRec); pDRIInfo->CreateContext = MGACreateContext; pDRIInfo->DestroyContext = MGADestroyContext; - if (xf86IsEntityShared(pScrn->entityList[0])) - pDRIInfo->SwapContext = MGADRISwapContext_shared; - else + if ( xf86IsEntityShared( pScrn->entityList[0] ) ) { + pDRIInfo->SwapContext = MGADRISwapContextShared; + } else { pDRIInfo->SwapContext = MGADRISwapContext; - + } + switch( pScrn->bitsPerPixel ) { case 8: pDRIInfo->InitBuffers = Mga8DRIInitBuffers; @@ -508,141 +1048,115 @@ pDRIInfo->InitBuffers = Mga32DRIInitBuffers; pDRIInfo->MoveBuffers = Mga32DRIMoveBuffers; } - + pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; - if (!DRIScreenInit(pScreen, pDRIInfo, &pMGA->drmSubFD)) { - xfree(pMGADRIServer); - pMGA->DRIServerInfo = 0; - xfree(pDRIInfo->devPrivate); + if ( !DRIScreenInit( pScreen, pDRIInfo, &pMga->drmFD ) ) { + xfree( pMGADRIServer ); + pMga->DRIServerInfo = 0; + xfree( pDRIInfo->devPrivate ); pDRIInfo->devPrivate = 0; - DRIDestroyInfoRec(pMGA->pDRIInfo); - pMGA->pDRIInfo = 0; - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] DRIScreenInit Failed\n"); + DRIDestroyInfoRec( pMga->pDRIInfo ); + pMga->pDRIInfo = 0; + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[drm] DRIScreenInit failed. Disabling DRI.\n" ); return FALSE; } /* Check the MGA DRM version */ { - drmVersionPtr version = drmGetVersion(pMGA->drmSubFD); - if (version) { - if (version->version_major != 2 || - version->version_minor != 0 || - version->version_patchlevel < 0) { + drmVersionPtr version = drmGetVersion(pMga->drmFD); + if ( version ) { + if ( version->version_major != 3 || + version->version_minor < 0 ) { /* incompatible drm version */ - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] MGADRIScreenInit failed (DRM version = %d.%d.%d, expected 2.0.x). Disabling DRI.\n", - version->version_major, - version->version_minor, - version->version_patchlevel); -/* MGADRICloseScreen(pScreen); */ - - drmFreeVersion(version); + xf86DrvMsg( pScreen->myNum, X_ERROR, + "[dri] MGADRIScreenInit failed because of a version mismatch.\n" + "[dri] mga.o kernel module version is %d.%d.%d but version 3.0.x is needed.\n" + "[dri] Disabling DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel ); + drmFreeVersion( version ); + MGADRICloseScreen( pScreen ); /* FIXME: ??? */ return FALSE; } - drmFreeVersion(version); + drmFreeVersion( version ); } } - pMGADRIServer->regsSize = MGAIOMAPSIZE; - if (drmAddMap(pMGA->drmSubFD, (drmHandle)pMGA->IOAddress, - pMGADRIServer->regsSize, DRM_REGISTERS, 0, - &pMGADRIServer->regs)<0) { - DRICloseScreen(pScreen); - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAddMap failed Register MMIO region\n"); - return FALSE; +#if 0 + /* Calculate texture constants for AGP texture space. + * FIXME: move! + */ + { + CARD32 agpTextureOffset = MGA_DMA_BUF_SZ * MGA_DMA_BUF_NR; + CARD32 agpTextureSize = pMGADRI->agp.size - agpTextureOffset; + + i = mylog2(agpTextureSize / MGA_NR_TEX_REGIONS); + if (i < MGA_LOG_MIN_TEX_REGION_SIZE) + i = MGA_LOG_MIN_TEX_REGION_SIZE; + + pMGADRI->logAgpTextureGranularity = i; + pMGADRI->agpTextureSize = (agpTextureSize >> i) << i; + pMGADRI->agpTextureOffset = agpTextureOffset; } - xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Registers = 0x%08lx\n", - pMGADRIServer->regs); - - /* Agp Support */ - pMGADRIServer->agpAcquired = FALSE; - pMGADRIServer->agpHandle = 0; - pMGADRIServer->agpSizep = 0; - pMGADRIServer->agp_map = 0; - - if (drmAgpAcquire(pMGA->drmSubFD) < 0) { - DRICloseScreen(pScreen); - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpAcquire failed\n"); +#endif + + if ( !MGADRIAgpInit( pScreen ) ) { + DRICloseScreen( pScreen ); return FALSE; } - pMGADRIServer->agpAcquired = TRUE; - pMGADRIServer->warp_ucode_size = mgaGetMicrocodeSize(pScreen); - if (pMGADRIServer->warp_ucode_size == 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] microcodeSize is zero\n"); - DRICloseScreen(pScreen); + if ( !MGADRIMapInit( pScreen ) ) { + DRICloseScreen( pScreen ); return FALSE; } - - mode_mask = MGAParseAgpMode(pScreen); - pMGADRIServer->agpMode = drmAgpGetMode(pMGA->drmSubFD); - pMGADRIServer->agpMode &= mode_mask; - if (drmAgpEnable(pMGA->drmSubFD, pMGADRIServer->agpMode) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n"); - DRICloseScreen(pScreen); + if ( !MGAInitVisualConfigs( pScreen ) ) { + DRICloseScreen( pScreen ); return FALSE; } - ErrorF("[drm] drmAgpEnabled succeeded for AGP mode %dx\n", pMGA->agp_mode); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized\n" ); - prim_size = 65536; - init_offset = ((prim_size + pMGADRIServer->warp_ucode_size + - 4096 - 1) / 4096) * 4096; - - pMGADRIServer->agpSizep = init_offset; - pMGADRI->agpSize = (drmAgpSize(pMGA->drmSubFD)) - init_offset; + return TRUE; +} - pMGADRIServer->agpBase = (drmAddress) drmAgpBase(pMGA->drmSubFD); - if (drmAddMap(pMGA->drmSubFD, 0, - init_offset, DRM_AGP, 0, - &pMGADRIServer->agp_private) < 0) { - DRICloseScreen(pScreen); - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAddMap failed on AGP aperture\n"); - return FALSE; - } - - if (drmMap(pMGA->drmSubFD, (drmHandle)pMGADRIServer->agp_private, - init_offset, - (drmAddressPtr)&pMGADRIServer->agp_map) < -1) { - DRICloseScreen(pScreen); - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmMap failed on AGP aperture\n"); + +Bool MGADRIFinishScreenInit( ScreenPtr pScreen ) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + MGAPtr pMga = MGAPTR(pScrn); + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + MGADRIPtr pMGADRI = (MGADRIPtr)pMga->pDRIInfo->devPrivate; + int i; + + if ( !pMga->pDRIInfo ) return FALSE; - } - - /* Now allocate and bind a default of 8 megs */ - drmAgpAlloc(pMGA->drmSubFD, 0x00800000, 0, 0, - &pMGADRIServer->agpHandle); - - if (pMGADRIServer->agpHandle == 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAgpAlloc failed\n"); - DRICloseScreen(pScreen); + + pMga->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; + + /* NOTE: DRIFinishScreenInit must be called before *DRIKernelInit + * because *DRIKernelInit requires that the hardware lock is held by + * the X server, and the first time the hardware lock is grabbed is + * in DRIFinishScreenInit. + */ + if ( !DRIFinishScreenInit( pScreen ) ) { + MGADRICloseScreen( pScreen ); return FALSE; } - - if (drmAgpBind(pMGA->drmSubFD, pMGADRIServer->agpHandle, 0) < 0) { - DRICloseScreen(pScreen); - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] drmAgpBind failed\n"); + + if ( !MGADRIKernelInit( pScreen ) ) { + MGADRICloseScreen( pScreen ); return FALSE; } - mgaInstallMicrocode(pScreen, prim_size); - - if (drmAddMap(pMGA->drmSubFD, (drmHandle)init_offset, - pMGADRI->agpSize, DRM_AGP, 0, - &pMGADRI->agp) < 0) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Failed to map public agp area\n"); - DRICloseScreen(pScreen); + if ( !MGADRIBuffersInit( pScreen ) ) { + MGADRICloseScreen( pScreen ); return FALSE; } - switch(pMGA->Chipset) { + switch ( pMga->Chipset ) { case PCI_CHIP_MGAG400: pMGADRI->chipset = MGA_CARD_TYPE_G400; break; @@ -652,357 +1166,98 @@ break; default: return FALSE; - } - - pMGADRI->width = pScrn->virtualX; - pMGADRI->height = pScrn->virtualY; - pMGADRI->mem = pScrn->videoRam * 1024; - pMGADRI->cpp = pScrn->bitsPerPixel / 8; - pMGADRI->frontPitch = pScrn->displayWidth * (pScrn->bitsPerPixel / 8); - - - pMGADRI->frontOffset = 0; /* pMGA->YDstOrg * (pScrn->bitsPerPixel / 8) */ - pMGADRI->backOffset = ((pScrn->virtualY + pMGA->numXAALines + 1) * - pScrn->displayWidth * - pMGADRI->cpp + 4095) & ~0xFFF; - - - xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] calced backoffset: 0x%x\n", - pMGADRI->backOffset); - - - size = pMGADRI->cpp * pScrn->virtualX * pScrn->virtualY; - size += 4095; - size &= ~4095; - pMGADRI->depthOffset = pMGA->FbUsableSize - size; - pMGADRI->depthOffset &= ~4095; - pMGADRI->textureOffset = pMGADRI->backOffset + size; - pMGADRI->textureSize = pMGADRI->depthOffset - pMGADRI->textureOffset; - - if (pMGADRI->depthOffset < pMGADRI->textureOffset + 512*1024) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Insufficient memory for direct rendering\n"); - DRICloseScreen(pScreen); - return FALSE; } + pMGADRI->width = pScrn->virtualX; + pMGADRI->height = pScrn->virtualY; + pMGADRI->mem = pScrn->videoRam * 1024; + pMGADRI->cpp = pScrn->bitsPerPixel / 8; + + pMGADRI->agpMode = pMga->agpMode; + + pMGADRI->frontOffset = pMGADRIServer->frontOffset; + pMGADRI->frontPitch = pMGADRIServer->frontPitch; + pMGADRI->backOffset = pMGADRIServer->backOffset; + pMGADRI->backPitch = pMGADRIServer->backPitch; + pMGADRI->depthOffset = pMGADRIServer->depthOffset; + pMGADRI->depthPitch = pMGADRIServer->depthPitch; + pMGADRI->textureOffset = pMGADRIServer->textureOffset; + pMGADRI->textureSize = pMGADRIServer->textureSize; - pMGADRI->mAccess = pMGA->MAccess; - - i = mylog2(pMGADRI->textureSize / MGA_NR_TEX_REGIONS); - if (i < MGA_LOG_MIN_TEX_REGION_SIZE) + i = mylog2( pMGADRI->textureSize / MGA_NR_TEX_REGIONS ); + if ( i < MGA_LOG_MIN_TEX_REGION_SIZE ) i = MGA_LOG_MIN_TEX_REGION_SIZE; - + pMGADRI->logTextureGranularity = i; pMGADRI->textureSize = (pMGADRI->textureSize >> i) << i; /* truncate */ - - /* Here is where we need to do initialization of the dma engine */ - if((bufs = drmAddBufs(pMGA->drmSubFD, - MGA_DMA_BUF_NR, - MGA_DMA_BUF_SZ, - DRM_AGP_BUFFER, - init_offset)) <= 0) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] failure adding %d %d byte DMA buffers\n", - MGA_DMA_BUF_NR, - MGA_DMA_BUF_SZ); - DRICloseScreen(pScreen); - return FALSE; - } - - pMGADRI->agpBufferOffset = init_offset + pMGADRIServer->agp_private; - - /* Calculate texture constants for AGP texture space - */ - { - CARD32 agpTextureOffset = MGA_DMA_BUF_SZ * MGA_DMA_BUF_NR; - CARD32 agpTextureSize = pMGADRI->agpSize - agpTextureOffset; - - i = mylog2(agpTextureSize / MGA_NR_TEX_REGIONS); - if (i < MGA_LOG_MIN_TEX_REGION_SIZE) - i = MGA_LOG_MIN_TEX_REGION_SIZE; - - pMGADRI->logAgpTextureGranularity = i; - pMGADRI->agpTextureSize = (agpTextureSize >> i) << i; - pMGADRI->agpTextureOffset = agpTextureOffset; - } - - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] added %d %d byte DMA buffers\n", - bufs, MGA_DMA_BUF_SZ); - - - if ((MgaInitDma(pScrn, prim_size)) != TRUE) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] Failed to initialize dma engine\n"); - DRICloseScreen(pScreen); - return FALSE; - } - - xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Initialized Dma Engine\n"); - - if (!pMGADRIServer->irq) { - pMGADRIServer->irq = drmGetInterruptFromBusID(pMGA->drmSubFD, - ((pciConfigPtr)pMGA->PciInfo - ->thisCard)->busnum, - ((pciConfigPtr)pMGA->PciInfo - ->thisCard)->devnum, - ((pciConfigPtr)pMGA->PciInfo - ->thisCard)->funcnum); - - if(!pMGADRIServer->irq && !pMGA->ReallyUseIrqZero) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] Your graphics card has Interrupt zero" - " assigned to it.\n" - "This is highly unlikely so I'm disabling the DRI.\n" - "If your graphics card really has Interrupt zero, please" - "add the config option UseIrqZero\n" - "to the device section in your XF86Config file.\n" - "Please be warned that Interrupt zero is normally " - "the timer interrupt on X86 systems.\n" - "Using this option could make your system unusable.\n" - "The more likely solution is that your graphics card has" - " no interrupt assigned to it.\nPlease consult your" - " system BIOS manual for instructions on how to enable " - "an interrupt for your graphics card.\n"); - MGADRICloseScreen(pScreen); - return FALSE; - } - drmCtlInstHandler(pMGA->drmSubFD, pMGADRIServer->irq); - } - - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "[drm] dma control initialized, using IRQ %d\n", - pMGADRIServer->irq); - - - if (!(MGAInitVisualConfigs(pScreen))) { - DRICloseScreen(pScreen); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "visual configs initialized\n" ); - + pMGADRI->registers.handle = pMGADRIServer->registers.handle; + pMGADRI->registers.size = pMGADRIServer->registers.size; + pMGADRI->status.handle = pMGADRIServer->status.handle; + pMGADRI->status.size = pMGADRIServer->status.size; + pMGADRI->primary.handle = pMGADRIServer->primary.handle; + pMGADRI->primary.size = pMGADRIServer->primary.size; + pMGADRI->buffers.handle = pMGADRIServer->buffers.handle; + pMGADRI->buffers.size = pMGADRIServer->buffers.size; + pMGADRI->sarea_priv_offset = sizeof(XF86DRISAREARec); return TRUE; } -void -MGADRICloseScreen(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); - MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo; - -/* The DRI will automagically clean these up when driFD is closed */ - if(pMGADRIServer->agp_map) { - drmUnmap(pMGADRIServer->agp_map, pMGADRIServer->agpSizep); - pMGADRIServer->agp_map = 0; - } - if(pMGADRIServer->agpHandle) { - pMGADRIServer->agpHandle = 0; - pMGADRIServer->agpSizep = 0; - } - if(pMGADRIServer->agpAcquired == TRUE) { - pMGADRIServer->agpAcquired = FALSE; - } - - DRICloseScreen(pScreen); - - if (pMGA->pDRIInfo) { - if (pMGA->pDRIInfo->devPrivate) { - xfree(pMGA->pDRIInfo->devPrivate); - pMGA->pDRIInfo->devPrivate = 0; - } - DRIDestroyInfoRec(pMGA->pDRIInfo); - pMGA->pDRIInfo = 0; - } - if(pMGA->DRIServerInfo) { - xfree(pMGA->DRIServerInfo); - pMGA->DRIServerInfo = 0; - } - if (pMGA->pVisualConfigs) { - xfree(pMGA->pVisualConfigs); - } - if (pMGA->pVisualConfigsPriv) { - xfree(pMGA->pVisualConfigsPriv); - } -} - -static Bool -MGACreateContext(ScreenPtr pScreen, VisualPtr visual, - drmContext hwContext, void *pVisualConfigPriv, - DRIContextType contextStore) -{ - return TRUE; -} - -static void -MGADestroyContext(ScreenPtr pScreen, drmContext hwContext, - DRIContextType contextStore) -{ -} - -Bool -MGADRIFinishScreenInit(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGASAREAPtr sPriv; - MGAPtr pMGA = MGAPTR(pScrn); - - if (!pMGA->pDRIInfo) return FALSE; - - sPriv = (MGASAREAPtr)DRIGetSAREAPrivate(pScreen); - pMGA->pDRIInfo->driverSwapMethod = DRI_HIDE_X_CONTEXT; - xf86memset( sPriv, 0, sizeof(MGASAREARec) ); - - return DRIFinishScreenInit(pScreen); -} - - -void -mgaGetQuiescence( ScrnInfoPtr pScrn ) +void MGADRICloseScreen( ScreenPtr pScreen ) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; MGAPtr pMga = MGAPTR(pScrn); - - pMga->have_quiescense = 1; - - if (pMga->directRenderingEnabled) { - MGAFBLayout *pLayout = &pMga->CurrentLayout; - - MgaLockUpdate(pScrn, (DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH)); + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; - WAITFIFO(11); - OUTREG(MGAREG_MACCESS, pMga->MAccess); - OUTREG(MGAREG_PITCH, pLayout->displayWidth); - pMga->PlaneMask = ~0; - OUTREG(MGAREG_PLNWT, pMga->PlaneMask); - pMga->BgColor = 0; - pMga->FgColor = 0; - OUTREG(MGAREG_BCOL, pMga->BgColor); - OUTREG(MGAREG_FCOL, pMga->FgColor); - OUTREG(MGAREG_SRCORG, pMga->realSrcOrg); - pMga->SrcOrg = 0; - OUTREG(MGAREG_DSTORG, pMga->DstOrg); - OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); - OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ - OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ - OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ - pMga->AccelFlags &= ~CLIPPER_ON; + if ( pMGADRIServer->drmBuffers ) { + drmUnmapBufs( pMGADRIServer->drmBuffers ); + pMGADRIServer->drmBuffers = NULL; } -} - -void -mgaGetQuiescence_shared( ScrnInfoPtr pScrn ) -{ - MGAPtr pMga = MGAPTR(pScrn); - MGAEntPtr pMgaEnt = pMga->entityPrivate; - MGAPtr pMga2 = MGAPTR(pMgaEnt->pScrn_2); + drmMGACleanupDMA( pMga->drmFD ); - pMga = MGAPTR(pMgaEnt->pScrn_1); - pMga->have_quiescense = 1; - pMga2->have_quiescense = 1; - - if (pMgaEnt->directRenderingEnabled) { - MgaLockUpdate(pMgaEnt->pScrn_1, (DRM_LOCK_QUIESCENT | DRM_LOCK_FLUSH)); - pMga->RestoreAccelState(pScrn); - xf86SetLastScrnFlag(pScrn->entityList[0], pScrn->scrnIndex); + if ( pMGADRIServer->status.map ) { + drmUnmap( pMGADRIServer->status.map, pMGADRIServer->status.size ); + pMGADRIServer->status.map = NULL; } -} - - -void -MGASwapContext(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMga = MGAPTR(pScrn); - - /* Arrange for dma_quiescence and xaa sync to be called as - * appropriate. - */ - pMga->have_quiescense = 0; - pMga->AccelInfoRec->NeedToSync = TRUE; -} - -void -MGASwapContext_shared(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMga = MGAPTR(pScrn); - MGAEntPtr pMgaEnt = pMga->entityPrivate; - MGAPtr pMga2 = MGAPTR(pMgaEnt->pScrn_2); - - pMga = MGAPTR(pMgaEnt->pScrn_1); - pMga->have_quiescense = 0; - pMga->AccelInfoRec->NeedToSync = TRUE; - pMga2->have_quiescense = 0; - pMga2->AccelInfoRec->NeedToSync = TRUE; -} - - -/* This is really only called from validate/postvalidate as we - * override the dri lock/unlock. Want to remove validate/postvalidate - * processing, but need to remove all client-side use of drawable lock - * first (otherwise there is noone recover when a client dies holding - * the drawable lock). - * - * What does this mean? - * - * - The above code gets executed every time a - * window changes shape or the focus changes, which isn't really - * optimal. - * - The X server therefore believes it needs to do an XAA sync - * *and* a dma quiescense ioctl each time that happens. - * - * We don't wrap wakeuphandler any longer, so at least we can say that - * this doesn't happen *every time the mouse moves*... - */ -static void -MGADRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType oldContextType, void *oldContext, - DRIContextType newContextType, void *newContext) -{ - if (syncType == DRI_3D_SYNC && - oldContextType == DRI_2D_CONTEXT && - newContextType == DRI_2D_CONTEXT) - { - MGASwapContext(pScreen); + if ( pMGADRIServer->buffers.map ) { + drmUnmap( pMGADRIServer->buffers.map, pMGADRIServer->buffers.size ); + pMGADRIServer->buffers.map = NULL; } -} + if ( pMGADRIServer->primary.map ) { + drmUnmap( pMGADRIServer->primary.map, pMGADRIServer->primary.size ); + pMGADRIServer->primary.map = NULL; + } + if ( pMGADRIServer->warp.map ) { + drmUnmap( pMGADRIServer->warp.map, pMGADRIServer->warp.size ); + pMGADRIServer->warp.map = NULL; + } -static void -MGADRISwapContext_shared(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType oldContextType, void *oldContext, - DRIContextType newContextType, void *newContext) -{ - if (syncType == DRI_3D_SYNC && - oldContextType == DRI_2D_CONTEXT && - newContextType == DRI_2D_CONTEXT) - { - MGASwapContext_shared(pScreen); + if ( pMGADRIServer->agp.handle ) { + drmAgpUnbind( pMga->drmFD, pMGADRIServer->agp.handle ); + drmAgpFree( pMga->drmFD, pMGADRIServer->agp.handle ); + pMGADRIServer->agp.handle = 0; + drmAgpRelease( pMga->drmFD ); } -} -void -MGASelectBuffer(ScrnInfoPtr pScrn, int which) -{ - MGAPtr pMga = MGAPTR(pScrn); - MGADRIPtr pMGADRI = (MGADRIPtr)pMga->pDRIInfo->devPrivate; + DRICloseScreen( pScreen ); - switch (which) { - case MGA_BACK: - OUTREG(MGAREG_DSTORG, pMGADRI->backOffset); - OUTREG(MGAREG_SRCORG, pMGADRI->backOffset); - break; - case MGA_DEPTH: - OUTREG(MGAREG_DSTORG, pMGADRI->depthOffset); - OUTREG(MGAREG_SRCORG, pMGADRI->depthOffset); - break; - default: - case MGA_FRONT: - OUTREG(MGAREG_DSTORG, pMGADRI->frontOffset); - OUTREG(MGAREG_SRCORG, pMGADRI->frontOffset); - break; + if ( pMga->pDRIInfo ) { + if ( pMga->pDRIInfo->devPrivate ) { + xfree( pMga->pDRIInfo->devPrivate ); + pMga->pDRIInfo->devPrivate = 0; + } + DRIDestroyInfoRec( pMga->pDRIInfo ); + pMga->pDRIInfo = 0; + } + if ( pMga->DRIServerInfo ) { + xfree( pMga->DRIServerInfo ); + pMga->DRIServerInfo = 0; + } + if ( pMga->pVisualConfigs ) { + xfree( pMga->pVisualConfigs ); + } + if ( pMga->pVisualConfigsPriv ) { + xfree( pMga->pVisualConfigsPriv ); } } Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h:1.3 Wed Jun 21 23:58:25 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h Tue Apr 10 12:08:01 2001 @@ -1,13 +1,46 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.3 2000/06/22 03:58:25 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dri.h,v 1.6 2001/04/10 16:08:01 dawes Exp $ */ -#ifndef _MGA_DRI_ -#define _MGA_DRI_ +/* + * Copyright 2000 VA Linux Systems Inc., Fremont, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Keith WHitwell <keithw@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __MGA_DRI_H__ +#define __MGA_DRI_H__ + +#include "xf86drm.h" +#include "xf86drmMga.h" + +#define MGA_DEFAULT_AGP_MODE 1 +#define MGA_MAX_AGP_MODE 4 + +/* Buffer are aligned on 4096 byte boundaries. + */ +#define MGA_BUFFER_ALIGN 0x00000fff -#include <xf86drm.h> -#include <xf86drmMga.h> - -#define MGA_MAX_DRAWABLES 256 - typedef struct { int reserved_map_agpstart; int reserved_map_idx; @@ -17,19 +50,33 @@ int warp_ucode_size; int chipset; int sgram; - unsigned long agpMode; - unsigned long agpHandle; - Bool agpAcquired; - drmHandle agp_private; - drmSize agpSizep; - drmAddress agpBase; - int irq; - drmHandle regs; - drmSize regsSize; - drmAddress regsMap; - drmMgaWarpIndex WarpIndex[MGA_MAX_WARP_PIPES]; - drmBufMapPtr drmBufs; - CARD8 *agp_map; + + unsigned int frontOffset; + unsigned int frontPitch; + + unsigned int backOffset; + unsigned int backPitch; + + unsigned int depthOffset; + unsigned int depthPitch; + + unsigned int textureOffset; + int textureSize; + + drmRegion agp; + + /* PCI mappings */ + drmRegion registers; + drmRegion status; + + /* AGP mappings */ + drmRegion warp; + drmRegion primary; + drmRegion buffers; + drmRegion agpTextures; + + drmBufMapPtr drmBuffers; + } MGADRIServerPrivateRec, *MGADRIServerPrivatePtr; typedef struct { @@ -38,6 +85,9 @@ int height; int mem; int cpp; + + int agpMode; + unsigned int frontOffset; unsigned int frontPitch; @@ -59,83 +109,13 @@ unsigned int agpTextureSize; int logAgpTextureGranularity; - /* Redundant? - */ - unsigned int frontOrg; - unsigned int backOrg; - unsigned int depthOrg; - unsigned int mAccess; - drmHandle agp; - drmSize agpSize; + drmRegion registers; + drmRegion status; + drmRegion primary; + drmRegion buffers; + unsigned int sarea_priv_offset; } MGADRIRec, *MGADRIPtr; - - -/* WARNING: Do not change the SAREA structure without changing the kernel - * as well */ -typedef struct { - unsigned char next, prev; - unsigned char in_use; - unsigned int age; -} MGATexRegionRec, *MGATexRegionPtr; - -typedef struct { - /* The channel for communication of state information to the kernel - * on firing a vertex dma buffer. - */ - unsigned int ContextState[MGA_CTX_SETUP_SIZE]; - unsigned int ServerState[MGA_2D_SETUP_SIZE]; - unsigned int TexState[2][MGA_TEX_SETUP_SIZE]; - unsigned int WarpPipe; - unsigned int dirty; - - unsigned int nbox; - XF86DRIClipRectRec boxes[MGA_NR_SAREA_CLIPRECTS]; - - /* Information about the most recently used 3d drawable. The - * client fills in the req_* fields, the server fills in the - * exported_ fields and puts the cliprects into boxes, above. - * - * The client clears the exported_drawable field before - * clobbering the boxes data. - */ - unsigned int req_drawable; /* the X drawable id */ - unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ - - unsigned int exported_drawable; - unsigned int exported_index; - unsigned int exported_stamp; - unsigned int exported_buffers; - int exported_nfront; - int exported_nback; - int exported_back_x, exported_front_x, exported_w; - int exported_back_y, exported_front_y, exported_h; - XF86DRIClipRectRec exported_boxes[MGA_NR_SAREA_CLIPRECTS]; - - /* Counters for aging textures and for client-side throttling. - */ - unsigned int last_enqueue; /* last time a buffer was enqueued */ - unsigned int last_dispatch; /* age of the most recently dispatched buffer */ - unsigned int last_quiescent; /* */ - - /* LRU lists for texture memory in agp space and on the card */ - - MGATexRegionRec texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1]; - unsigned int texAge[MGA_NR_TEX_HEAPS]; - /* Mechanism to validate card state. - */ - int ctxOwner; -} MGASAREARec, *MGASAREAPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} MGAConfigPrivRec, *MGAConfigPrivPtr; - -typedef struct { - /* Nothing here yet */ - int dummy; -} MGADRIContextRec, *MGADRIContextPtr; #endif Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h:1.4 --- /dev/null Mon Jun 4 12:40:57 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_dripriv.h Tue Apr 10 12:08:01 2001 @@ -0,0 +1,51 @@ +/* $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. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES + * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __MGA_DRIPRIV_H__ +#define __MGA_DRIPRIV_H__ + +#include "GL/glxint.h" + +#define MGA_MAX_DRAWABLES 256 + +extern void GlxSetVisualConfigs( int nconfigs, + __GLXvisualConfig *configs, + void **configprivs ); + +typedef struct { + /* Nothing here yet */ + int dummy; +} MGAConfigPrivRec, *MGAConfigPrivPtr; + +typedef struct { + /* Nothing here yet */ + int dummy; +} MGADRIContextRec, *MGADRIContextPtr; + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c:1.185.2.3 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c:1.202.2.2 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c:1.185.2.3 Fri Mar 9 13:03:32 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c Mon May 28 10:23:38 2001 @@ -41,9 +41,11 @@ * Doug Merritt * doug@netcom.com * Fixed 32bpp hires 8MB horizontal line glitch at middle right + * Niels Gram Jeppesen + * Added digital screen option for first head */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.185.2.3 2001/03/09 18:03:32 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_driver.c,v 1.202.2.2 2001/05/28 14:23:38 eich Exp $ */ /* * This is a first cut at a non-accelerated version to work with the @@ -92,21 +94,16 @@ #include "shadowfb.h" #include "fbdevhw.h" -#ifdef XF86DRI +#ifdef XF86DRI #include "dri.h" #endif - -#ifdef RENDER -#include "picturestr.h" -#endif - /* * Forward definitions for the functions that make up the driver. */ /* Mandatory functions */ -static OptionInfoPtr MGAAvailableOptions(int chipid, int busid); +static const OptionInfoRec * MGAAvailableOptions(int chipid, int busid); static void MGAIdentify(int flags); static Bool MGAProbe(DriverPtr drv, int flags); static Bool MGAPreInit(ScrnInfoPtr pScrn, int flags); @@ -129,11 +126,12 @@ static void MGAFreeScreen(int scrnIndex, int flags); static int MGAValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); -#ifdef DPMSExtension static void MGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif +static void MGADisplayPowerManagementSetCrtc2(ScrnInfoPtr pScrn, + int PowerManagementMode, + int flags); /* Internally used functions */ static Bool MGAMapMem(ScrnInfoPtr pScrn); @@ -147,7 +145,7 @@ static int MGAEntityIndex = -1; -/* +/* * This contains the functions needed by the server after loading the * driver module. It must be supplied, and gets added the driver list by * the Module Setup funtion in the dynamic case. In the static case a @@ -158,9 +156,6 @@ DriverRec MGA_C_NAME = { MGA_VERSION, MGA_DRIVER_NAME, -#if 0 - "accelerated driver for Matrox Millennium and Mystique cards", -#endif MGAIdentify, MGAProbe, MGAAvailableOptions, @@ -212,20 +207,21 @@ OPTION_VIDEO_KEY, OPTION_ROTATE, OPTION_TEXTURED_VIDEO, - OPTION_XAALINES, OPTION_CRTC2HALF, + OPTION_CRTC2RAM, OPTION_INT10, - OPTION_AGP_MODE_2X, - OPTION_AGP_MODE_4X, + OPTION_AGP_MODE, OPTION_DIGITAL, OPTION_TV, OPTION_TVSTANDARD, OPTION_CABLETYPE, OPTION_USEIRQZERO, - OPTION_NOHAL + OPTION_NOHAL, + OPTION_SWAPPED_HEAD, + OPTION_DRI } MGAOpts; -static OptionInfoRec MGAOptions[] = { +static const OptionInfoRec MGAOptions[] = { { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, @@ -242,17 +238,17 @@ { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, { OPTION_TEXTURED_VIDEO, "TexturedVideo",OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_XAALINES, "XAALines", OPTV_INTEGER, {0}, FALSE }, { OPTION_CRTC2HALF, "Crtc2Half", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CRTC2RAM, "Crtc2Ram", OPTV_INTEGER, {0}, FALSE }, { OPTION_INT10, "Int10", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_AGP_MODE_2X, "AGPMode2x", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_AGP_MODE_4X, "AGPMode4x", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_AGP_MODE, "AGPMode", OPTV_INTEGER, {0}, FALSE }, { OPTION_DIGITAL, "DigitalScreen",OPTV_BOOLEAN, {0}, FALSE }, { OPTION_TV, "TV", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_TVSTANDARD, "TVStandard", OPTV_ANYSTR, {0}, FALSE }, { OPTION_CABLETYPE, "CableType", OPTV_ANYSTR, {0}, FALSE }, - { OPTION_USEIRQZERO, "UseIrqZero", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOHAL, "NoHal", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SWAPPED_HEAD, "SwappedHead", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -317,27 +313,35 @@ NULL }; -#ifdef XF86DRI +#ifdef XF86DRI static const char *drmSymbols[] = { "drmAvailable", "drmAddBufs", "drmAddMap", "drmCtlInstHandler", "drmGetInterruptFromBusID", + "drmFreeVersion", + "drmGetVersion", + "drmMap", + "drmUnmap", + "drmMapBufs", + "drmUnmapBufs", "drmAgpAcquire", "drmAgpRelease", "drmAgpEnable", "drmAgpAlloc", "drmAgpFree", "drmAgpBind", + "drmAgpUnbind", "drmAgpGetMode", "drmAgpBase", "drmAgpSize", - "drmMgaCleanupDma", - "drmMgaLockUpdate", - "drmMgaInitDma", - "drmFreeVersion", - "drmGetVersion", + "drmAgpVendorId", + "drmAgpDeviceId", + "drmMGAInitDMA", + "drmMGACleanupDMA", + "drmMGAFlushDMA", + "drmMGAEngineReset", NULL }; @@ -421,7 +425,7 @@ "fbdevHWUnmapVidmem", "fbdevHWMapMMIO", "fbdevHWMapVidmem", - + NULL }; @@ -437,7 +441,7 @@ "MGAGetBOARDHANDLESize", "MGAGetHardwareInfo", "MGAOpenLibrary", - NULL + NULL }; #endif #ifdef XFree86LOADER @@ -485,7 +489,7 @@ ddcSymbols, i2cSymbols, shadowSymbols, fbdevHWSymbols, vbeSymbols, fbSymbols, int10Symbols, -#ifdef XF86DRI +#ifdef XF86DRI drmSymbols, driSymbols, #endif #ifdef USEMGAHAL @@ -507,14 +511,14 @@ #endif /* XFree86LOADER */ -/* +/* * ramdac info structure initialization */ static MGARamdacRec DacInit = { FALSE, 0, 0, 0, 0, NULL, NULL, NULL, NULL, NULL, NULL, 90000, /* maxPixelClock */ 0, X_DEFAULT, X_DEFAULT, FALSE -}; +}; static Bool MGAGetRec(ScrnInfoPtr pScrn) @@ -543,8 +547,7 @@ pScrn->driverPrivate = NULL; } -static -OptionInfoPtr +static const OptionInfoRec * MGAAvailableOptions(int chipid, int busid) { return MGAOptions; @@ -631,14 +634,14 @@ #ifdef DISABLE_VGA_IO MgaSavePtr smga; #endif - + /* Allocate a ScrnInfoRec and claim the slot */ pScrn = NULL; - + #ifndef DISABLE_VGA_IO if ((pScrn = xf86ConfigPciEntity(pScrn, 0,usedChips[i], MGAPciChipsets, NULL, NULL, - NULL, NULL, NULL))) + NULL, NULL, NULL))) #else smga = xnfalloc(sizeof(MgaSave)); smga->pvp = xf86GetPciInfoForEntity(usedChips[i]); @@ -647,7 +650,7 @@ VgaIOSave, VgaIORestore,smga))) #endif { - + /* Fill in what we can of the ScrnInfoRec */ pScrn->driverVersion = MGA_VERSION; pScrn->driverName = MGA_DRIVER_NAME; @@ -663,7 +666,7 @@ pScrn->ValidMode = MGAValidMode; foundScreen = TRUE; } - + /* * For cards that can do dual head per entity, mark the entity * as sharable. @@ -697,7 +700,7 @@ } xfree(usedChips); - + return foundScreen; } @@ -722,26 +725,27 @@ * HISTORY * August 31, 1997 - [ajv] Andrew van der Stock * Fixed to understand Mystique and Millennium II - * + * * January 11, 1997 - [aem] Andrew E. Mileski * Set default values for GCLK (= MCLK / pre-scale ). * * October 7, 1996 - [aem] Andrew E. Mileski * Written and tested. - */ + */ static void MGAReadBios(ScrnInfoPtr pScrn) { - CARD8 tmp[ 64 ]; + CARD8 BIOS[0x10000]; CARD16 offset; CARD8 chksum; - CARD8 *pPINSInfo; + CARD8 *pPINSInfo; MGAPtr pMga; MGABiosInfo *pBios; MGABios2Info *pBios2; Bool pciBIOS = TRUE; - + int rlen; + pMga = MGAPTR(pScrn); pBios = &pMga->Bios; pBios2 = &pMga->Bios2; @@ -755,33 +759,37 @@ pciBIOS = FALSE; else if (pMga->BiosFrom == X_CONFIG && pMga->BiosAddress < 0x100000) pciBIOS = TRUE; + + if (pciBIOS) + rlen = xf86ReadPciBIOS(0, pMga->PciTag, pMga->FbBaseReg, + BIOS, sizeof(BIOS)); + else + rlen = xf86ReadBIOS(pMga->BiosAddress, 0, BIOS, sizeof(BIOS)); + + if (rlen < (BIOS[2] << 9)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + "Could not retrieve video BIOS!\n"); + return; + } -#define MGADoBIOSRead(offset, buf, len) \ - (pciBIOS ? \ - xf86ReadPciBIOS(offset, pMga->PciTag, pMga->FbBaseReg, buf, len) : \ - xf86ReadBIOS(pMga->BiosAddress, offset, buf, len)) - - MGADoBIOSRead(0, tmp, sizeof( tmp )); - if ( - tmp[ 0 ] != 0x55 - || tmp[ 1 ] != 0xaa - || strncmp(( char * )( tmp + 45 ), "MATROX", 6 ) - ) { + if (strncmp((char *)(&BIOS[45]), "MATROX", 6)) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Video BIOS info block not detected!\n"); return; } /* Get the info block offset */ - MGADoBIOSRead(0x7ffc, ( CARD8 * ) & offset, sizeof( offset )); + offset = (BIOS[0x7ffd] << 8) | BIOS[0x7ffc]; - /* Let the world know what we are up to */ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Video BIOS info block at offset 0x%05lX\n", (long)(offset)); +#define MGADoBIOSRead(offset, buf, len) memcpy(buf, &BIOS[offset], len) + /* Copy the info block */ + /* XXX What about big-endianness? */ switch (pMga->Chipset){ case PCI_CHIP_MGA2064: MGADoBIOSRead(offset, @@ -792,9 +800,8 @@ ( CARD8 * ) & pBios2->PinID, sizeof( MGABios2Info )); } - /* matrox millennium-2 and mystique pins info */ - if ( pBios2->PinID == 0x412e ) { + if ( pBios2->PinID == 0x412e ) { int i; /* check that the pins info is correct */ if ( pBios2->StructLen != 0x40 ) { @@ -843,7 +850,6 @@ ErrorF("Pins[0x%02x] is 0x%02x\n", i, ((unsigned char *)pBios2)[i]); #endif - return; } else { /* Set default MCLK values (scaled by 10 kHz) */ if ( pBios->ClkBase == 0 ) @@ -853,7 +859,6 @@ if ( pBios->Clk8MB == 0 ) pBios->Clk8MB = pBios->Clk4MB; pBios2->PinID = 0; /* not in use */ - return; } } @@ -885,8 +890,8 @@ /* wait until drawing engine is ready */ while ( MGAISBUSY() ) usleep(1000); - - /* flush FIFO */ + + /* flush FIFO */ i = 32; WAITFIFO(i); while ( i-- ) @@ -899,7 +904,7 @@ /* * MGACountRAM -- * - * Counts amount of installed RAM + * Counts amount of installed RAM */ static int MGACountRam(ScrnInfoPtr pScrn) @@ -912,7 +917,7 @@ #if 0 /* This isn't correct. It looks like this can have arbitrary data for the memconfig even when the bios has initialized - it. At least, my cards don't advertise the documented + it. At least, my cards don't advertise the documented values (my 8 and 16 Meg G200s have the same values) */ if(pMga->Primary) /* can only trust this for primary cards */ biosInfo = pciReadLong(pMga->PciTag, PCI_OPTION_REG); @@ -921,7 +926,7 @@ switch(pMga->Chipset) { case PCI_CHIP_MGA2164: case PCI_CHIP_MGA2164_AGP: - xf86DrvMsg(pScrn->scrnIndex, X_WARNING, + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Unable to probe memory amount due to hardware bug. " "Assuming 4096 KB\n"); return 4096; @@ -931,12 +936,12 @@ case 0: return (biosInfo & (1 << 14)) ? 32768 : 16384; case 1: - case 2: + case 2: return 16384; - case 3: - case 5: + case 3: + case 5: return 65536; - case 4: + case 4: return 32768; } } @@ -970,15 +975,15 @@ volatile unsigned char* base; unsigned char tmp; int i; - + pMga->FbMapSize = ProbeSize * 1024; MGAMapMem(pScrn); base = pMga->FbBase; - + /* turn MGA mode on - enable linear frame buffer (CRTCEXT3) */ - OUTREG8(0x1FDE, 3); - tmp = INREG8(0x1FDF); - 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) { @@ -990,10 +995,10 @@ break; } } - + /* restore CRTCEXT3 state */ - OUTREG8(0x1FDE, 3); - OUTREG8(0x1FDF, tmp); + OUTREG8(MGAREG_CRTCEXT_INDEX, 3); + OUTREG8(MGAREG_CRTCEXT_DATA, tmp); MGAUnmapMem(pScrn); } @@ -1012,6 +1017,36 @@ pMga = MGAPTR(pScrn); MGAdac = &pMga->Dac; + /* Load DDC if we have the code to use it */ + /* This gives us DDC1 */ + if (pMga->ddc1Read || pMga->i2cInit) { + if (xf86LoadSubModule(pScrn, "ddc")) { + xf86LoaderReqSymLists(ddcSymbols, NULL); + } else { + /* ddc module not found, we can do without it */ + pMga->ddc1Read = NULL; + + /* Without DDC, we have no use for the I2C bus */ + pMga->i2cInit = NULL; + return NULL; + } + } else + return NULL; + +#if MGAuseI2C + /* - DDC can use I2C bus */ + /* Load I2C if we have the code to use it */ + if (pMga->i2cInit) { + if ( xf86LoadSubModule(pScrn, "i2c") ) { + xf86LoaderReqSymLists(i2cSymbols,NULL); + } else { + /* i2c module not found, we can do without it */ + pMga->i2cInit = NULL; + pMga->I2C = NULL; + } + } +#endif /* MGAuseI2C */ + /* Map the MGA memory and MMIO areas */ if (!MGAMapMem(pScrn)) return NULL; @@ -1032,7 +1067,7 @@ xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "DDC1 disabled - chip not in VGA mode\n"); } - } + } /* Save the current state */ MGASave(pScrn); @@ -1086,7 +1121,7 @@ #ifdef DEBUG ErrorF("mga: VgaIOSave: %d:%d:%d\n", sMga->pvp->bus, sMga->pvp->device, - sMga->pvp->func); + sMga->pvp->func); #endif sMga->enable = (pciReadLong(tag, PCI_OPTION_REG) & 0x100) != 0; } @@ -1143,6 +1178,7 @@ if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } @@ -1162,8 +1198,12 @@ 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 /* @@ -1171,7 +1211,7 @@ * not at the start of each server generation. This means that * only things that are persistent across server generations can * be initialised here. xf86Screens[] is (pScrn is a pointer to one - * of these). Privates allocated using xf86AllocateScrnInfoPrivateIndex() + * of these). Privates allocated using xf86AllocateScrnInfoPrivateIndex() * are too, and should be used for data that must persist across * server generations. * @@ -1191,7 +1231,7 @@ pMga = MGAPTR(pScrn); /* Set here until dri is enabled */ #ifdef XF86DRI - pMga->have_quiescense = 1; + pMga->haveQuiescense = 1; #endif /* Get the entity, and make sure it is PCI. */ pMga->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); @@ -1261,7 +1301,7 @@ xf86SetAccessFuncs(pMga->pEnt, &pMga->Access, &pMga->Access, &pMga->Access, NULL); #endif - + /* Set pScrn->monitor */ pScrn->monitor = pScrn->confScreen->monitor; @@ -1272,7 +1312,7 @@ * unexpected behaviour when the config file marks the primary CRTC * as the second screen. */ - if(xf86IsEntityShared(pScrn->entityList[0]) && + if(xf86IsEntityShared(pScrn->entityList[0]) && xf86IsPrimInitDone(pScrn->entityList[0])) { /* This is the second crtc */ pMga->SecondCrtc = TRUE; @@ -1280,7 +1320,7 @@ pScrn->AdjustFrame = MGAAdjustFrameCrtc2; pMgaEnt->pScrn_2 = pScrn; #ifdef XF86DRI - pMga->GetQuiescence = mgaGetQuiescence_shared; + pMga->GetQuiescence = MGAGetQuiescenceShared; #endif } else { pMga->SecondCrtc = FALSE; @@ -1288,11 +1328,11 @@ if (xf86IsEntityShared(pScrn->entityList[0])) { pMgaEnt->pScrn_1 = pScrn; #ifdef XF86DRI - pMga->GetQuiescence = mgaGetQuiescence_shared; + pMga->GetQuiescence = MGAGetQuiescenceShared; #endif } else { #ifdef XF86DRI - pMga->GetQuiescence = mgaGetQuiescence; + pMga->GetQuiescence = MGAGetQuiescence; #endif } } @@ -1320,13 +1360,17 @@ * 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; @@ -1376,12 +1420,15 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, MGAOptions); + if (!(pMga->Options = xalloc(sizeof(MGAOptions)))) + return FALSE; + memcpy(pMga->Options, MGAOptions, sizeof(MGAOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pMga->Options); +#if !defined(__powerpc__) pMga->softbooted = FALSE; - if (xf86ReturnOptValBool(MGAOptions, OPTION_INT10, FALSE) && - xf86LoadSubModule(pScrn, "int10")) - { + if (xf86ReturnOptValBool(pMga->Options, OPTION_INT10, FALSE) && + xf86LoadSubModule(pScrn, "int10")) { xf86Int10InfoPtr pInt; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Initializing int10\n"); @@ -1389,12 +1436,12 @@ if (pInt) pMga->softbooted = TRUE; xf86FreeInt10(pInt); } +#endif /* Set the bits per RGB for 8bpp mode */ - if (pScrn->depth == 8) + if (pScrn->depth == 8) pScrn->rgbBits = 8; - /* * Set the Chipset and ChipRev, allowing config file entries to * override. @@ -1423,20 +1470,15 @@ } #ifdef USEMGAHAL - if (HAL_CHIPSETS && !xf86ReturnOptValBool(MGAOptions, OPTION_NOHAL, FALSE) - && xf86LoadSubModule(pScrn, "mga_hal")) { + if (HAL_CHIPSETS && !xf86ReturnOptValBool(pMga->Options, OPTION_NOHAL, FALSE) + && xf86LoadSubModule(pScrn, "mga_hal")) { xf86LoaderReqSymLists(halSymbols, NULL); xf86DrvMsg(pScrn->scrnIndex, X_INFO,"Matrox HAL module used\n"); pMga->HALLoaded = TRUE; - } else { - pMga->HALLoaded = FALSE; - if (MGAISG450(pMga)) { - /* Ouch. We cannot drive a G450 without HALlib. Don't try. */ - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "G450 support not available without Matrox HAL module\n"); - return FALSE; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Matrox HAL module not found - using builtin mode setup instead\n"); - } + } else { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Matrox HAL module not found - using builtin mode setup instead\n"); + pMga->HALLoaded = FALSE; + } #endif /* @@ -1456,60 +1498,23 @@ xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset); - - if(xf86GetOptValInteger(MGAOptions, OPTION_XAALINES, - &(pMga->numXAALines))) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Will Use %d lines for " - "offscreen memory if the DRI is enabled.\n", - pMga->numXAALines); - } else { - /* The default is to use 512 lines on a G400, 128 on a G200 */ - switch (pMga->Chipset) { - case PCI_CHIP_MGAG200: - case PCI_CHIP_MGAG200_PCI: - pMga->numXAALines = 128; - break; - default: - pMga->numXAALines = 512; - break; - } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Offscreen memory usage " - "will be limited to %d lines if the DRI is enabled.\n", - pMga->numXAALines); - } - #ifdef XF86DRI - { - Bool temp; - - from = X_DEFAULT; - - pMga->agp_mode = 1; - if (xf86GetOptValBool(MGAOptions, OPTION_AGP_MODE_2X, - &temp)) { - pMga->agp_mode = 2; - from = X_CONFIG; - } - - if (xf86GetOptValBool(MGAOptions, OPTION_AGP_MODE_4X, - &temp)) { - pMga->agp_mode = 4; - from = X_CONFIG; - } - xf86DrvMsg(pScrn->scrnIndex, from, "Using AGP Mode %dx\n", - pMga->agp_mode); - - pMga->ReallyUseIrqZero = 0; - - if (xf86GetOptValBool(MGAOptions, OPTION_USEIRQZERO, - &temp)) { - pMga->ReallyUseIrqZero = 1; - from = X_CONFIG; - xf86DrvMsg(pScrn->scrnIndex, from, "Enabling use of IRQ " - "Zero (Dangerous)\n"); - } + from = X_DEFAULT; + pMga->agpMode = MGA_DEFAULT_AGP_MODE; + if (xf86GetOptValInteger(pMga->Options, + OPTION_AGP_MODE, &(pMga->agpMode))) { + if (pMga->agpMode < 1) { + pMga->agpMode = 1; + } + if (pMga->agpMode > MGA_MAX_AGP_MODE) { + pMga->agpMode = MGA_MAX_AGP_MODE; + } + from = X_CONFIG; } + + xf86DrvMsg(pScrn->scrnIndex, from, "Using AGP %dx mode\n", + pMga->agpMode); #endif from = X_DEFAULT; @@ -1518,91 +1523,80 @@ * The preferred method is to use the "hw cursor" option as a tri-state * option, with the default set above. */ - if (xf86GetOptValBool(MGAOptions, OPTION_HW_CURSOR, &pMga->HWCursor)) { + if (xf86GetOptValBool(pMga->Options, 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)) { + if (xf86ReturnOptValBool(pMga->Options, OPTION_NOACCEL, FALSE)) { pMga->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } - if (xf86ReturnOptValBool(MGAOptions, OPTION_PCI_RETRY, FALSE)) { + if (xf86ReturnOptValBool(pMga->Options, OPTION_PCI_RETRY, FALSE)) { pMga->UsePCIRetry = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry enabled\n"); } - if (xf86ReturnOptValBool(MGAOptions, OPTION_SYNC_ON_GREEN, FALSE)) { + if (xf86ReturnOptValBool(pMga->Options, OPTION_SYNC_ON_GREEN, FALSE)) { pMga->SyncOnGreen = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Sync-on-Green enabled\n"); } - if (xf86ReturnOptValBool(MGAOptions, OPTION_SHOWCACHE, FALSE)) { + if (xf86ReturnOptValBool(pMga->Options, OPTION_SHOWCACHE, FALSE)) { pMga->ShowCache = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache enabled\n"); } - if (xf86ReturnOptValBool(MGAOptions, OPTION_MGA_SDRAM, FALSE)) { + if (xf86ReturnOptValBool(pMga->Options, OPTION_MGA_SDRAM, FALSE)) { pMga->HasSDRAM = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Has SDRAM\n"); } - if (xf86GetOptValFreq(MGAOptions, OPTION_SET_MCLK, OPTUNITS_MHZ, &real)) { + if (xf86GetOptValFreq(pMga->Options, OPTION_SET_MCLK, OPTUNITS_MHZ, &real)) { pMga->MemClk = (int)(real * 1000.0); } - if ((s = xf86GetOptValString(MGAOptions, OPTION_OVERLAY))) { + if ((s = xf86GetOptValString(pMga->Options, OPTION_OVERLAY))) { if (!*s || !xf86NameCmp(s, "8,24") || !xf86NameCmp(s, "24,8")) { if(pScrn->bitsPerPixel == 32 && pMga->SecondCrtc == FALSE) { pMga->Overlay8Plus24 = TRUE; if(!xf86GetOptValInteger( - MGAOptions, OPTION_COLOR_KEY,&(pMga->colorKey))) + pMga->Options, OPTION_COLOR_KEY,&(pMga->colorKey))) pMga->colorKey = TRANSPARENCY_KEY; - pScrn->colorKey = pMga->colorKey; + pScrn->colorKey = pMga->colorKey; pScrn->overlayFlags = OVERLAY_8_32_PLANAR; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PseudoColor overlay enabled\n"); } else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option \"Overlay\" is only supported in 32 bits per pixel on" "the first CRTC\n"); } } else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid value for Option \"Overlay\"\n", s); } } - - if(xf86GetOptValInteger(MGAOptions, OPTION_VIDEO_KEY, &(pMga->videoKey))) { + + if(xf86GetOptValInteger(pMga->Options, OPTION_VIDEO_KEY, &(pMga->videoKey))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", pMga->videoKey); } else { - pMga->videoKey = (1 << pScrn->offset.red) | + pMga->videoKey = (1 << pScrn->offset.red) | (1 << pScrn->offset.green) | - (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); + (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); } - if (xf86ReturnOptValBool(MGAOptions, OPTION_SHADOW_FB, FALSE)) { + if (xf86ReturnOptValBool(pMga->Options, OPTION_SHADOW_FB, FALSE)) { pMga->ShadowFB = TRUE; pMga->NoAccel = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using \"Shadow Framebuffer\" - acceleration disabled\n"); } - if (xf86ReturnOptValBool(MGAOptions, OPTION_FBDEV, FALSE)) { + if (xf86ReturnOptValBool(pMga->Options, OPTION_FBDEV, FALSE)) { pMga->FBDev = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using framebuffer device\n"); } - if (xf86ReturnOptValBool(MGAOptions, OPTION_OVERCLOCK_MEM, FALSE)) { + if (xf86ReturnOptValBool(pMga->Options, OPTION_OVERCLOCK_MEM, FALSE)) { pMga->OverclockMem = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Overclocking memory\n"); } - if (xf86ReturnOptValBool(MGAOptions, OPTION_TEXTURED_VIDEO, FALSE)) { + if (xf86ReturnOptValBool(pMga->Options, OPTION_TEXTURED_VIDEO, FALSE)) { pMga->TexturedVideo = TRUE; } if (pMga->FBDev) { @@ -1619,13 +1613,13 @@ pScrn->ValidMode = fbdevHWValidMode; } pMga->Rotate = 0; - if ((s = xf86GetOptValString(MGAOptions, OPTION_ROTATE))) { + if ((s = xf86GetOptValString(pMga->Options, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) { pMga->ShadowFB = TRUE; pMga->NoAccel = TRUE; pMga->HWCursor = FALSE; pMga->Rotate = 1; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen clockwise - acceleration disabled\n"); } else if(!xf86NameCmp(s, "CCW")) { @@ -1633,12 +1627,12 @@ pMga->NoAccel = TRUE; pMga->HWCursor = FALSE; pMga->Rotate = -1; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Rotating screen counter clockwise - acceleration disabled\n"); } else { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"%s\" is not a valid value for Option \"Rotate\"\n", s); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Valid options are \"CW\" or \"CCW\"\n"); } } @@ -1696,6 +1690,7 @@ xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", (unsigned long)pMga->FbAddress); +#if !defined(__powerpc__) if (pMga->device->IOBase != 0) { /* Require that the config file value matches one of the PCI values. */ if (!xf86CheckPciMemBase(pMga->PciInfo, pMga->device->IOBase)) { @@ -1721,21 +1716,25 @@ return FALSE; } } +#else + pMga->IOAddress = pMga->PciInfo->memBase[0]; +#endif xf86DrvMsg(pScrn->scrnIndex, from, "MMIO registers at 0x%lX\n", (unsigned long)pMga->IOAddress); + - pMga->ILOADAddress = 0; if ( pMga->Chipset != PCI_CHIP_MGA2064 ) { if (pMga->PciInfo->memBase[2] != 0) { pMga->ILOADAddress = pMga->PciInfo->memBase[2] & 0xffffc000; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Pseudo-DMA transfer window at 0x%lX\n", (unsigned long)pMga->ILOADAddress); - } + } } +#if !defined(__powerpc__) /* * Find the BIOS base. Get it from the PCI config if possible. Otherwise * use the VGA default. Allow the config file to override this. @@ -1774,8 +1773,9 @@ MGAReadBios(pScrn); - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "MGABios.RamdacType = 0x%x\n", pMga->Bios.RamdacType); +#endif /* !__powerpc__ */ /* HW bpp matches reported bpp */ pMga->HwBpp = pScrn->bitsPerPixel; @@ -1806,15 +1806,16 @@ if(pMga->SecondCrtc == FALSE) { Bool UseHalf = FALSE; int adjust; - - xf86GetOptValBool(MGAOptions, OPTION_CRTC2HALF, &UseHalf); + + xf86GetOptValBool(pMga->Options, OPTION_CRTC2HALF, &UseHalf); adjust = pScrn->videoRam / 2; - if (UseHalf == TRUE) { - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + if (UseHalf == TRUE || + xf86GetOptValInteger(pMga->Options, OPTION_CRTC2RAM, &adjust)) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Crtc2 will use %dK of VideoRam\n", adjust); - } else { + } else { adjust = min(adjust, 8192); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Crtc2 will use %dK of VideoRam\n", @@ -1824,9 +1825,9 @@ pScrn->videoRam = pMgaEnt->mastervideoRam; pMgaEnt->slavevideoRam = adjust; pMgaEnt->masterFbAddress = pMga->FbAddress; - pMga->FbMapSize = + pMga->FbMapSize = pMgaEnt->masterFbMapSize = pScrn->videoRam * 1024; - pMgaEnt->slaveFbAddress = pMga->FbAddress + + pMgaEnt->slaveFbAddress = pMga->FbAddress + pMgaEnt->masterFbMapSize; pMgaEnt->slaveFbMapSize = pMgaEnt->slavevideoRam * 1024; pMga->realSrcOrg = pMga->SrcOrg = 0; @@ -1835,8 +1836,8 @@ pMga->FbAddress = pMgaEnt->slaveFbAddress; pMga->FbMapSize = pMgaEnt->slaveFbMapSize; pScrn->videoRam = pMgaEnt->slavevideoRam; - pMga->DstOrg = pMga->realSrcOrg = - pMgaEnt->slaveFbAddress - pMgaEnt->masterFbAddress; + pMga->DstOrg = pMga->realSrcOrg = + pMgaEnt->slaveFbAddress - pMgaEnt->masterFbAddress; pMga->SrcOrg = 0; /* This is not stored in hw format!! */ } pMgaEnt->refCount++; @@ -1856,7 +1857,7 @@ } xf86DrvMsg(pScrn->scrnIndex, from, "VideoRAM: %d kByte\n", pScrn->videoRam); - + /* Set the bpp shift value */ pMga->BppShifts[0] = 0; pMga->BppShifts[1] = 1; @@ -1869,35 +1870,11 @@ */ (*pMga->PreInit)(pScrn); - /* Load DDC if we have the code to use it */ - /* This gives us DDC1 */ - if (pMga->ddc1Read || pMga->i2cInit) { - if (xf86LoadSubModule(pScrn, "ddc")) { - xf86LoaderReqSymLists(ddcSymbols, NULL); - } else { - /* ddc module not found, we can do without it */ - pMga->ddc1Read = NULL; +#if !defined(__powerpc__) - /* Without DDC, we have no use for the I2C bus */ - pMga->i2cInit = NULL; - } - } -#if MGAuseI2C - /* - DDC can use I2C bus */ - /* Load I2C if we have the code to use it */ - if (pMga->i2cInit) { - if ( xf86LoadSubModule(pScrn, "i2c") ) { - xf86LoaderReqSymLists(i2cSymbols,NULL); - } else { - /* i2c module not found, we can do without it */ - pMga->i2cInit = NULL; - pMga->I2C = NULL; - } - } -#endif /* MGAuseI2C */ - /* Read and print the Monitor DDC info */ pScrn->monitor->DDC = MGAdoDDC(pScrn); +#endif /* !__powerpc__ */ /* * If the driver can do gamma correction, it should call xf86SetGamma() @@ -1951,11 +1928,16 @@ } if(pMga->SecondCrtc == TRUE) { /* Override on 2nd crtc */ - pMga->MaxClock = 112000; + + if (pMga->ChipRev >= 0x80) { /* G450 */ + pMga->MaxClock = 234000; + } else { + pMga->MaxClock = 135000; + } } xf86DrvMsg(pScrn->scrnIndex, from, "Max pixel clock is %d MHz\n", pMga->MaxClock / 1000); - /* + /* * Setup the ClockRanges, which describe what clock ranges are available, * and what sort of modes they can be used for. */ @@ -1975,7 +1957,7 @@ clockRanges->ClockMulFactor = 1; clockRanges->ClockDivFactor = 1; - + /* Only set MemClk if appropriate for the ramdac */ if (pMga->Dac.SetMemClk) { if (pMga->MemClk == 0) { @@ -1994,15 +1976,15 @@ * care of this, we don't worry about setting them here. */ { - int Pitches1[] = + int Pitches1[] = {640, 768, 800, 960, 1024, 1152, 1280, 1600, 1920, 2048, 0}; - int Pitches2[] = - {512, 640, 768, 800, 832, 960, 1024, 1152, 1280, 1600, 1664, + int Pitches2[] = + {512, 640, 768, 800, 832, 960, 1024, 1152, 1280, 1600, 1664, 1920, 2048, 0}; int *linePitches = NULL; int minPitch = 256; - int maxPitch = 2048; - + int maxPitch = 2048; + switch(pMga->Chipset) { case PCI_CHIP_MGA2064: if (!pMga->NoAccel) { @@ -2034,7 +2016,7 @@ i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, linePitches, minPitch, maxPitch, - pMga->Roundings[(pScrn->bitsPerPixel >> 3) - 1] * + pMga->Roundings[(pScrn->bitsPerPixel >> 3) - 1] * pScrn->bitsPerPixel, 128, 2048, pScrn->display->virtualX, pScrn->display->virtualY, @@ -2067,76 +2049,128 @@ } #ifdef USEMGAHAL MGA_HAL( + swap_head + = xf86ReturnOptValBool(pMga->Options, 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); + MGAMapMem(pScrn); MGAOpenLibrary(pMga->pBoard,pMga->pClientStruct,sizeof(CLIENTDATA)); - MGAUnmapMem(pScrn); - pMga->pMgaHwInfo = (LPMGAHWINFO) xalloc (sizeof(MGAHWINFO)); + MGAUnmapMem(pScrn); + pMga->pMgaHwInfo = xalloc(sizeof(MGAHWINFO)); MGAGetHardwareInfo(pMga->pBoard,pMga->pMgaHwInfo); + 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 { + 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.flOutput = MGAMODEINFO_ANALOG1; + 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; mgaModeInfo.ulDeskHeight = pScrn->virtualY; - mgaModeInfo.ulBpp = pScrn->bitsPerPixel; + 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 { - mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2 | - MGAMODEINFO_SECOND_CRTC; + if (!swap_head) { + mgaModeInfo.flOutput = MGAMODEINFO_ANALOG2 | + MGAMODEINFO_SECOND_CRTC; + } else { + mgaModeInfo.flOutput = MGAMODEINFO_ANALOG1 | + MGAMODEINFO_SECOND_CRTC; + } } mgaModeInfo.ulDispWidth = pScrn->virtualX; mgaModeInfo.ulDispHeight = pScrn->virtualY; mgaModeInfo.ulDeskWidth = pScrn->virtualX; mgaModeInfo.ulDeskHeight = pScrn->virtualY; - mgaModeInfo.ulBpp = pScrn->bitsPerPixel; + mgaModeInfo.ulBpp = pScrn->bitsPerPixel; mgaModeInfo.ulZoom = 1; pMga->pBoard = pMgaEnt->pBoard; pMga->pClientStruct = pMgaEnt->pClientStruct; - pMga->pMgaHwInfo = pMga->pMgaHwInfo; + 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(MGAValidateMode(pMga->pBoard,&mgaModeInfo) != 0) { + + if((status = MGAValidateMode(pMga->pBoard,&mgaModeInfo)) != 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "MGAValidateMode from HALlib found the mode to be invalid\n"); + "MGAValidateMode from HALlib found the mode to be invalid.\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) || (pMga->PciInfo->subsysCard == PCI_CARD_PROD_G100_SD)) { pMga->HasSDRAM = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Has SDRAM\n"); - } - /* - * Can we trust HALlib to set the memory configuration + } + /* + * Can we trust HALlib to set the memory configuration * registers correctly? */ - else if ((pMga->softbooted || pMga->Primary /*|| pMga->HALLoaded*/ ) && - (pMga->Chipset != PCI_CHIP_MGA2064) && - (pMga->Chipset != PCI_CHIP_MGA2164) && - (pMga->Chipset != PCI_CHIP_MGA2164_AGP)) { + else if ((pMga->softbooted || pMga->Primary /*|| pMga->HALLoaded*/ ) && + (pMga->Chipset != PCI_CHIP_MGA2064) && + (pMga->Chipset != PCI_CHIP_MGA2164) && + (pMga->Chipset != PCI_CHIP_MGA2164_AGP)) { CARD32 option_reg = pciReadLong(pMga->PciTag, PCI_OPTION_REG); if(!(option_reg & (1 << 14))) { pMga->HasSDRAM = TRUE; @@ -2153,11 +2187,9 @@ * are not pre-initialised at all. */ #ifdef USEMGAHAL - MGA_HAL(xf86SetCrtcForModes(pScrn, 0)); - MGA_NOT_HAL(xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V)); -#else - xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); + MGA_HAL(xf86SetCrtcForModes(pScrn, 0)); #endif + MGA_NOT_HAL(xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V)); /* Set the current mode to the first in the list */ pScrn->currentMode = pScrn->modes; @@ -2178,10 +2210,10 @@ */ pMga->YDstOrg = 0; - if (((pMga->Chipset == PCI_CHIP_MGA2064) || + if (((pMga->Chipset == PCI_CHIP_MGA2064) || (pMga->Chipset == PCI_CHIP_MGA2164) || (pMga->Chipset == PCI_CHIP_MGA2164_AGP)) && - (pScrn->virtualX * pScrn->virtualY * bytesPerPixel > 4*1024*1024)) + (pScrn->virtualX * pScrn->virtualY * bytesPerPixel > 4*1024*1024)) { int offset, offset_modulo, ydstorg_modulo; @@ -2222,12 +2254,12 @@ pMga->FbUsableSize = pMgaEnt->masterFbMapSize; /* Allocate HW cursor buffer at the end of video ram */ if( pMga->HWCursor && pMga->Dac.CursorOffscreenMemSize ) { - if( pScrn->virtualY * pScrn->displayWidth * + if( pScrn->virtualY * pScrn->displayWidth * pScrn->bitsPerPixel / 8 <= pMga->FbUsableSize - pMga->Dac.CursorOffscreenMemSize ) { pMga->FbUsableSize -= pMga->Dac.CursorOffscreenMemSize; pMga->FbCursorOffset = - pMgaEnt->masterFbMapSize - + pMgaEnt->masterFbMapSize - pMga->Dac.CursorOffscreenMemSize; } else { pMga->HWCursor = FALSE; @@ -2244,7 +2276,7 @@ pMga->FbUsableSize = pMga->FbMapSize - pMga->YDstOrg * bytesPerPixel; /* Allocate HW cursor buffer at the end of video ram */ if( pMga->HWCursor && pMga->Dac.CursorOffscreenMemSize ) { - if( pScrn->virtualY * pScrn->displayWidth * + if( pScrn->virtualY * pScrn->displayWidth * pScrn->bitsPerPixel / 8 <= pMga->FbUsableSize - pMga->Dac.CursorOffscreenMemSize ) { pMga->FbUsableSize -= pMga->Dac.CursorOffscreenMemSize; @@ -2277,9 +2309,7 @@ return FALSE; } reqSym = "fbScreenInit"; -#ifdef RENDER xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif } xf86LoaderReqSymbols(reqSym, NULL); @@ -2331,7 +2361,7 @@ if(pMgaEnt->refCount == 2) { /* Both boards have done there initialization */ MGACloseLibrary(pMga->pBoard); - + if (pMga->pBoard) xfree(pMga->pBoard); if (pMga->pClientStruct) @@ -2344,7 +2374,7 @@ } } else { MGACloseLibrary(pMga->pBoard); - + if (pMga->pBoard) xfree(pMga->pBoard); if (pMga->pClientStruct) @@ -2375,7 +2405,7 @@ /* * Map IO registers to virtual address space - */ + */ /* * For Alpha, we need to map SPARSE memory, since we need * byte/short access. This is taken care of automatically by the @@ -2409,7 +2439,7 @@ if (pMga->ILOADAddress) { pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO | VIDMEM_MMIO_32BIT | - VIDMEM_READSIDEEFFECT, + VIDMEM_READSIDEEFFECT, pMga->PciTag, pMga->ILOADAddress, 0x800000); } else pMga->ILOADBase = NULL; @@ -2439,7 +2469,7 @@ /* Map the ILOAD transfer window if there is one. We only make DWORD access on DWORD boundaries to this window */ if(pMga->ILOADAddress) - pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, + pMga->ILOADBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pMga->PciTag, pMga->ILOADAddress, 0x800000); else pMga->ILOADBase = NULL; #endif @@ -2461,7 +2491,7 @@ /* * Unmap IO registers to virtual address space - */ + */ xf86UnMapVidMem(pScrn->scrnIndex, (pointer)pMga->IOBase, 0x4000); pMga->IOBase = NULL; @@ -2506,10 +2536,13 @@ if(pMga->SecondCrtc == TRUE) return; #ifdef USEMGAHAL - if (pMga->HALLoaded) - MGA_HAL(if (pMga->pBoard != NULL) MGASaveVgaState(pMga->pBoard)); + MGA_HAL(if (pMga->pBoard != NULL) MGASaveVgaState(pMga->pBoard)); #endif + /* I need to save the registers for the second head also */ + /* Save the register for 0x80 to 0xa0 */ + /* Could call it dac2Saved */ + /* Only save text mode fonts/text for the primary card */ (*pMga->Save)(pScrn, vgaReg, mgaReg, pMga->Primary); } @@ -2521,19 +2554,19 @@ 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; pMga->pMgaModeInfo->ulDeskWidth = pScrn->virtualX; pMga->pMgaModeInfo->ulDeskHeight = pScrn->virtualY; pMga->pMgaModeInfo->ulFBPitch = 0; - pMga->pMgaModeInfo->ulBpp = pScrn->bitsPerPixel; + pMga->pMgaModeInfo->ulBpp = pScrn->bitsPerPixel; pMga->pMgaModeInfo->ulZoom = 1; pMga->pMgaModeInfo->flSignalMode = 0x10; /* Set TV standard */ - if ((s = xf86GetOptValString(MGAOptions, OPTION_TVSTANDARD))) { + if ((s = xf86GetOptValString(pMga->Options, OPTION_TVSTANDARD))) { if (!xf86NameCmp(s, "PAL")) { pMga->pMgaModeInfo->flSignalMode = 0x00; pMga->pMgaModeInfo->ulRefreshRate = 50; @@ -2543,12 +2576,12 @@ pMga->pMgaModeInfo->ulTVStandard = TV_NTSC; } } else { - pMga->pMgaModeInfo->ulRefreshRate = 60; + pMga->pMgaModeInfo->ulRefreshRate = 0; pMga->pMgaModeInfo->ulTVStandard = TV_NTSC; } /* Set Cable Type */ - if ((s = xf86GetOptValString(MGAOptions, OPTION_CABLETYPE))) { + if ((s = xf86GetOptValString(pMga->Options, OPTION_CABLETYPE))) { if (!xf86NameCmp(s, "SCART_RGB")) { pMga->pMgaModeInfo->ulCableType = TV_SCART_RGB; } else if (!xf86NameCmp(s, "SCART_COMPOSITE")) { @@ -2593,15 +2626,20 @@ 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 + = xf86ReturnOptValBool(pMga->Options, OPTION_SWAPPED_HEAD, FALSE); - if (pMga->HALLoaded) { - /* Verify if user wants digital screen output */ - xf86GetOptValBool(MGAOptions, OPTION_DIGITAL, &digital); - /* Verify if user wants TV output */ - xf86GetOptValBool(MGAOptions, OPTION_TV, &tv); + if (pMga->pMgaHwInfo) + { + digital1 = ISDIGITAL1(pMga); + digital2 = ISDIGITAL2(pMga); + tv1 = ISTV1(pMga); + tv2 = ISTV2(pMga); } #endif @@ -2621,41 +2659,55 @@ mgaReg = &pMga->ModeReg; #ifdef USEMGAHAL - MGA_HAL( + MGA_HAL( 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 { - pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG2 | - MGAMODEINFO_SECOND_CRTC | - MGAMODEINFO_FORCE_PITCH | - MGAMODEINFO_FORCE_DISPLAYORG; - } - } else { - pMga->pMgaModeInfo->flOutput = MGAMODEINFO_ANALOG1 | - MGAMODEINFO_FORCE_PITCH; + if (!swap_head) { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG2; + } else { + pMga->pMgaModeInfo->flOutput |= MGAMODEINFO_ANALOG1; + } + } + } else { + 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 */ @@ -2672,24 +2724,20 @@ /* 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 */ -#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val) -#define outMGAdac(reg, val) (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val)) - MGA_HAL( if(pMga->SecondCrtc == FALSE && pMga->HWCursor == TRUE) { outMGAdac(MGA1064_CURSOR_BASE_ADR_LOW, pMga->FbCursorOffset >> 10); outMGAdac(MGA1064_CURSOR_BASE_ADR_HI, pMga->FbCursorOffset >> 18); } ); /* MGA_HAL */ - MGA_NOT_HAL((*pMga->Restore)(pScrn, vgaReg, mgaReg, FALSE)); -#else - (*pMga->Restore)(pScrn, vgaReg, mgaReg, FALSE); #endif + MGA_NOT_HAL((*pMga->Restore)(pScrn, vgaReg, mgaReg, FALSE)); MGAStormSync(pScrn); MGAStormEngineInit(pScrn); @@ -2703,7 +2751,7 @@ } pMga->CurrentLayout.mode = mode; - + #ifdef XF86DRI if (pMga->directRenderingEnabled) DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); @@ -2715,7 +2763,7 @@ /* * Restore the initial (text) mode. */ -static void +static void MGARestore(ScrnInfoPtr pScrn) { vgaHWPtr hwp = VGAHWPTR(pScrn); @@ -2732,12 +2780,12 @@ vgaHWProtect(pScrn, TRUE); if (pMga->Primary) { #ifdef USEMGAHAL - MGA_HAL( - if(pMga->pBoard != NULL) { - MGASetVgaMode(pMga->pBoard); - MGARestoreVgaState(pMga->pBoard); - } - ); /* MGA_HAL */ + MGA_HAL( + if(pMga->pBoard != NULL) { + MGASetVgaMode(pMga->pBoard); + MGARestoreVgaState(pMga->pBoard); + } + ); /* MGA_HAL */ #endif (*pMga->Restore)(pScrn, vgaReg, mgaReg, TRUE); } else { @@ -2786,8 +2834,9 @@ int width, height, displayWidth; MGAEntPtr pMgaEnt = NULL; int f; + MessageType driFrom = X_DEFAULT; - /* + /* * First get the ScrnInfoRec */ pScrn = xf86Screens[pScreen->myNum]; @@ -2795,7 +2844,7 @@ hwp = VGAHWPTR(pScrn); pMga = MGAPTR(pScrn); MGAdac = &pMga->Dac; - + /* Map the MGA memory and MMIO areas */ if (pMga->FBDev) { if (!MGAMapMemFBDev(pScrn)) @@ -2805,8 +2854,8 @@ 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])) { @@ -2817,20 +2866,27 @@ #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_INFO, "TV detected\n"); + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "TV detected\n"); + } + if (pMga->pMgaHwInfo->ulCapsFirstOutput & + MGAHWINFOCAPS_OUTPUT_DIGITAL) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Digital Screen detected\n"); } - if (pMga->pMgaHwInfo->ulCapsSecondOutput & MGAHWINFOCAPS_OUTPUT_DIGITAL) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Digital Screen detected\n"); + if (pMga->pMgaHwInfo->ulCapsSecondOutput & + MGAHWINFOCAPS_OUTPUT_DIGITAL) { + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "Digital Screen detected\n"); } /* Now copy these to the entitystructure */ @@ -2842,31 +2898,31 @@ pMga->pBoard = pMgaEnt->pBoard; pMga->pMgaHwInfo = pMgaEnt->pMgaHwInfo; } - ); + ); /* MGA_HAL */ #endif } 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 } #ifdef USEMGAHAL MGA_HAL( - /* There is a problem in the HALlib: set soft reset bit */ - if ( !pMga->Primary && !pMga->FBDev && - (pMga->PciInfo->subsysCard == PCI_CARD_MILL_G200_SG) ) { - OUTREG(MGAREG_Reset, 1); - usleep(200); - OUTREG(MGAREG_Reset, 0); - } - ) + /* There is a problem in the HALlib: set soft reset bit */ + if (!pMga->Primary && !pMga->FBDev && + (pMga->PciInfo->subsysCard == PCI_CARD_MILL_G200_SG) ) { + OUTREG(MGAREG_Reset, 1); + usleep(200); + OUTREG(MGAREG_Reset, 0); + } + ); /* MGA_HAL */ #endif /* Initialise the MMIO vgahw functions */ @@ -2886,6 +2942,22 @@ pciSetBitsLong(pMga->PciTag, PCI_OPTION_REG, 0x100, 0x000); if (!fbdevHWModeInit(pScrn, pScrn->currentMode)) return FALSE; + if(pMga->SecondCrtc == FALSE && pMga->HWCursor == TRUE) { + switch (pMga->Chipset) { + case PCI_CHIP_MGA1064: + case PCI_CHIP_MGAG100: + case PCI_CHIP_MGAG100_PCI: + case PCI_CHIP_MGAG200: + case PCI_CHIP_MGAG200_PCI: + case PCI_CHIP_MGAG400: + outMGAdac(MGA1064_CURSOR_BASE_ADR_LOW, pMga->FbCursorOffset >> 10); + outMGAdac(MGA1064_CURSOR_BASE_ADR_HI, pMga->FbCursorOffset >> 18); + break; + default: + break; + } + } + MGAStormEngineInit(pScrn); } else { /* Save the current state */ @@ -2981,15 +3053,41 @@ * 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(pMga->Options, 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 - - + + if (pMga->Overlay8Plus24) { ret = cfb8_32ScreenInit(pScreen, FBStart, width, height, @@ -2999,10 +3097,8 @@ ret = fbScreenInit(pScreen, FBStart, width, height, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); -#ifdef RENDER if (ret) fbPictureInit (pScreen, 0, 0); -#endif } if (!ret) @@ -3039,15 +3135,15 @@ xf86SetBackingStore(pScreen); xf86SetSilkenMouse(pScreen); - /* Initialize software cursor. + /* Initialize software cursor. Must precede creation of the default colormap */ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - /* Initialize HW cursor layer. + /* Initialize HW cursor layer. Must follow software cursor initialization*/ - if (pMga->HWCursor) { + if (pMga->HWCursor) { if(!MGAHWCursorInit(pScreen)) - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware cursor initialization failed\n"); } @@ -3055,13 +3151,13 @@ if (!miCreateDefColormap(pScreen)) return FALSE; - /* Initialize colormap layer. + /* Initialize colormap layer. Must follow initialization of the default colormap */ if (!pMga->SecondCrtc) f = CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH; else f = CMAP_RELOAD_ON_MODE_SWITCH; - if(!xf86HandleColormaps(pScreen, 256, 8, + if(!xf86HandleColormaps(pScreen, 256, 8, (pMga->FBDev ? fbdevHWLoadPalette : MGAdac->LoadPalette), NULL, f)) return FALSE; @@ -3078,7 +3174,7 @@ pMga->PointerMoved = pScrn->PointerMoved; pScrn->PointerMoved = MGAPointerMoved; } - + switch(pScrn->bitsPerPixel) { case 8: refreshArea = MGARefreshArea8; break; case 16: refreshArea = MGARefreshArea16; break; @@ -3090,10 +3186,12 @@ ShadowFBInit(pScreen, refreshArea); } -#ifdef DPMSExtension - xf86DPMSInit(pScreen, MGADisplayPowerManagementSet, 0); -#endif - + if(pMga->SecondCrtc == TRUE) { + xf86DPMSInit(pScreen, MGADisplayPowerManagementSetCrtc2, 0); + } else { + xf86DPMSInit(pScreen, MGADisplayPowerManagementSet, 0); + } + pScrn->memPhysBase = pMga->FbAddress; pScrn->fbOffset = pMga->YDstOrg * (pScrn->bitsPerPixel / 8); @@ -3105,26 +3203,22 @@ MGAInitVideo(pScreen); #ifdef XF86DRI - /* Initialize the Warp engine */ - if (pMga->directRenderingEnabled) { - pMga->directRenderingEnabled = mgaConfigureWarp(pScrn); - } if (pMga->directRenderingEnabled) { - /* Now that mi, cfb, drm and others have done their thing, + /* Now that mi, cfb, drm and others have done their thing, * complete the DRI setup. */ pMga->directRenderingEnabled = MGADRIFinishScreenInit(pScreen); } if (pMga->directRenderingEnabled) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "direct rendering enabled\n"); + xf86DrvMsg(pScrn->scrnIndex, 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; - pMga->have_quiescense = 1; + pMga->haveQuiescense = 1; #endif - + /* Wrap the current CloseScreen function */ pMga->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = MGACloseScreen; @@ -3137,6 +3231,9 @@ /* For the second head, work around display problem. */ if (pMga->SecondCrtc) { MGACrtc2FillStrip(pScrn); + } else { + /* shut second head */ + outMGAdac(0xa0,0x08); } /* Done */ @@ -3157,7 +3254,7 @@ * displayed location in the video memory. */ /* Usually mandatory */ -void +void MGAAdjustFrame(int scrnIndex, int x, int y, int flags) { ScrnInfoPtr pScrn; @@ -3184,11 +3281,11 @@ /* find start of retrace */ while (INREG8(0x1FDA) & 0x08); - while (!(INREG8(0x1FDA) & 0x08)); + while (!(INREG8(0x1FDA) & 0x08)); /* wait until we're past the start (fixseg.c in the DDK) */ count = INREG(MGAREG_VCOUNT) + 2; while(INREG(MGAREG_VCOUNT) < count); - + OUTREG16(MGAREG_CRTC_INDEX, (Base & 0x00FF00) | 0x0C); OUTREG16(MGAREG_CRTC_INDEX, ((Base & 0x0000FF) << 8) | 0x0D); OUTREG8(MGAREG_CRTCEXT_INDEX, 0x00); @@ -3218,7 +3315,7 @@ * 3-93 c2startadd0 * 3-96 c2vcount */ - + Base = (y * pLayout->displayWidth + x) * pLayout->bitsPerPixel >> 3; Base += pMga->DstOrg; Base &= 0x01ffffc0; @@ -3238,7 +3335,7 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; MGAPtr pMga; -#ifdef XF86DRI +#ifdef XF86DRI ScreenPtr pScreen; #endif @@ -3250,7 +3347,11 @@ DRIUnlock(pScreen); } #endif - + + if (!pMga->SecondCrtc) { + outMGAdac(0xa0,0x08); + } + if (!MGAModeInit(pScrn, pScrn->currentMode)) return FALSE; MGAAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); @@ -3267,12 +3368,12 @@ MGAEnterVTFBDev(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; -#ifdef XF86DRI +#ifdef XF86DRI ScreenPtr pScreen; - MGAPtr pMGA; + MGAPtr pMga; - pMGA = MGAPTR(pScrn); - if (pMGA->directRenderingEnabled) { + pMga = MGAPTR(pScrn); + if (pMga->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; DRIUnlock(pScreen); } @@ -3296,24 +3397,26 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; vgaHWPtr hwp = VGAHWPTR(pScrn); + MGAPtr pMga = MGAPTR(pScrn); #ifdef XF86DRI ScreenPtr pScreen; - MGAPtr pMGA; #endif + /* Close second Crtc */ + outMGAdac(0xa0, 0x08); + MGARestore(pScrn); vgaHWLock(hwp); if (xf86IsPc98()) outb(0xfac, 0x00); #ifdef XF86DRI - pMGA = MGAPTR(pScrn); - if (pMGA->directRenderingEnabled) { + if (pMga->directRenderingEnabled) { pScreen = screenInfo.screens[scrnIndex]; DRILock(pScreen, 0); } #endif - + } @@ -3332,7 +3435,9 @@ vgaHWPtr hwp = VGAHWPTR(pScrn); MGAPtr pMga = MGAPTR(pScrn); MGAEntPtr pMgaEnt = NULL; - + + MGA_NOT_HAL(outMGAdac(0xa0, 0x08)); + if (pScrn->vtSema) { if (pMga->FBDev) { fbdevHWRestore(pScrn); @@ -3344,7 +3449,7 @@ vgaHWUnmapMem(pScrn); } } -#ifdef XF86DRI +#ifdef XF86DRI if (pMga->directRenderingEnabled) { MGADRICloseScreen(pScreen); pMga->directRenderingEnabled=FALSE; @@ -3364,7 +3469,7 @@ if(pMgaEnt->refCount == 0) { /* Both boards have closed there screen */ MGACloseLibrary(pMga->pBoard); - + if (pMga->pBoard) xfree(pMga->pBoard); if (pMga->pClientStruct) @@ -3376,7 +3481,7 @@ } } else { MGACloseLibrary(pMga->pBoard); - + if (pMga->pBoard) xfree(pMga->pBoard); if (pMga->pClientStruct) @@ -3385,7 +3490,7 @@ xfree(pMga->pMgaModeInfo); if (pMga->pMgaHwInfo) xfree(pMga->pMgaHwInfo); - } + } ); /* MGA_HAL */ #endif @@ -3448,8 +3553,8 @@ lace = 1 + ((mode->Flags & V_INTERLACE) != 0); if ((mode->CrtcHDisplay <= 2048) && - (mode->CrtcHSyncStart <= 4096) && - (mode->CrtcHSyncEnd <= 4096) && + (mode->CrtcHSyncStart <= 4096) && + (mode->CrtcHSyncEnd <= 4096) && (mode->CrtcHTotal <= 4096) && (mode->CrtcVDisplay <= 2048 * lace) && (mode->CrtcVSyncStart <= 4096 * lace) && @@ -3472,40 +3577,20 @@ } } - -/* 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) { @@ -3518,7 +3603,6 @@ * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -#ifdef DPMSExtension static void MGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -3550,14 +3634,27 @@ 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); } -#endif + + +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); +} static void @@ -3571,7 +3668,7 @@ ScrnInfoPtr pScrn = xf86Screens[i]; MGAPtr pMga = MGAPTR(pScrn); - if(pMga->PaletteLoadCallback) + if(pMga->PaletteLoadCallback) (*pMga->PaletteLoadCallback)(pScrn); pScreen->BlockHandler = pMga->BlockHandler; @@ -3583,7 +3680,7 @@ (*pMga->VideoTimerCallback)(pScrn, currentTime.milliseconds); } - if(pMga->RenderCallback) + if(pMga->RenderCallback) (*pMga->RenderCallback)(pScrn); } @@ -3601,7 +3698,8 @@ 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; } @@ -3614,7 +3712,8 @@ 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; } @@ -3627,7 +3726,8 @@ 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; } @@ -3639,12 +3739,13 @@ 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); @@ -3659,12 +3760,13 @@ 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); } @@ -3674,7 +3776,7 @@ MGAPtr pMga; CARD32 ret; - if (((addr & 0xff00) == 0x1c00) + if (((addr & 0xff00) == 0x1c00) && (addr != 0x1c04) /* && (addr != 0x1c1c) */ && (addr != 0x1c20) @@ -3690,7 +3792,8 @@ } 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 */ Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c:1.2 --- /dev/null Mon Jun 4 12:40:57 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c Thu Apr 5 13:42:32 2001 @@ -0,0 +1,451 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_g450pll.c,v 1.2 2001/04/05 17:42:32 dawes Exp $ */ + +/* All drivers should typically include these */ +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" + +/* Drivers for PCI hardware need this */ +#include "xf86PciInfo.h" + +/* Drivers that need to access the PCI config space directly need this */ +#include "xf86Pci.h" + +#include "mga_bios.h" +#include "mga_reg.h" +#include "mga.h" + +#define MNP_TABLE_SIZE 64 +#define CLKSEL_MGA 0x0c +#define PLLLOCK 0x40 + +static CARD32 G450ApplyPFactor(ScrnInfoPtr pScrn, CARD8 ucP, CARD32 *pulFIn) +{ + if(!(ucP & 0x40)) + { + *pulFIn = *pulFIn / (2L << (ucP & 3)); + } + + return TRUE; +} + + +static CARD32 G450RemovePFactor(ScrnInfoPtr pScrn, CARD8 ucP, CARD32 *pulFIn) +{ + if(!(ucP & 0x40)) + { + *pulFIn = *pulFIn * (2L << (ucP & 3)); + } + + return TRUE; +} + + +static CARD32 G450CalculVCO(ScrnInfoPtr pScrn, CARD32 ulMNP, CARD32 *pulF) +{ + CARD8 ucM, ucN, ucP; + + ucM = (CARD8)((ulMNP >> 16) & 0xff); + ucN = (CARD8)((ulMNP >> 8) & 0xff); + ucP = (CARD8)(ulMNP & 0x03); + + *pulF = (27000 * (2 * (ucN + 2)) + ((ucM + 1) >> 1)) / (ucM + 1); + + return TRUE; +} + + +static CARD32 G450CalculDeltaFreq(ScrnInfoPtr pScrn, CARD32 ulF1, + CARD32 ulF2, CARD32 *pulDelta) +{ + if(ulF2 < ulF1) + { + *pulDelta = ((ulF1 - ulF2) * 1000) / ulF1; + } + else + { + *pulDelta = ((ulF2 - ulF1) * 1000) / ulF1; + } + + return TRUE; +} + + + + +static CARD32 G450FindNextPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout, + CARD32 *pulPLLMNP) +{ + CARD8 ucM, ucN, ucP, ucS; + CARD32 ulVCO, ulVCOMin; + + ucM = (CARD8)((*pulPLLMNP >> 16) & 0xff); + ucN = (CARD8)((*pulPLLMNP >> 8) & 0xff); + ucP = (CARD8)(*pulPLLMNP & 0x43); + + ulVCOMin = 256000; + + if(ulVCOMin >= (255L * 8000)) + { + ulVCOMin = 230000; + } + + if((ucM == 9) && (ucP & 0x40)) + { + *pulPLLMNP = 0xffffffff; + } else if (ucM == 9) + { + if(ucP) + { + ucP--; + } + else + { + ucP = 0x40; + } + ucM = 0; + } + else + { + ucM++; + } + + ulVCO = ulFout; + + G450RemovePFactor(pScrn, ucP, &ulVCO); + + if(ulVCO < ulVCOMin) + { + *pulPLLMNP = 0xffffffff; + } + + if(*pulPLLMNP != 0xffffffff) + { + ucN = (CARD8)(((ulVCO * (ucM+1) + 27000)/(27000 * 2)) - 2); + + ucS = 5; + if(ulVCO < 1300000) ucS = 4; + if(ulVCO < 1100000) ucS = 3; + if(ulVCO < 900000) ucS = 2; + if(ulVCO < 700000) ucS = 1; + if(ulVCO < 550000) ucS = 0; + + ucP |= (CARD8)(ucS << 3); + + *pulPLLMNP &= 0xff000000; + *pulPLLMNP |= (CARD32)ucM << 16; + *pulPLLMNP |= (CARD32)ucN << 8; + *pulPLLMNP |= (CARD32)ucP; +#ifdef DEBUG + ErrorF("FINS_S: VCO = %d, S = %02X, *pulPLLMNP = %08X\n", ulVCO, (ULONG)ucS, *pulPLLMNP); +#endif + } + + return TRUE; +} + + +static CARD32 G450FindFirstPLLParam(ScrnInfoPtr pScrn, CARD32 ulFout, + CARD32 *pulPLLMNP) +{ + CARD8 ucP; + CARD32 ulVCO; + CARD32 ulVCOMax; + + /* Default value */ + ulVCOMax = 1300000; + + if(ulFout > (ulVCOMax/2)) + { + ucP = 0x40; + ulVCO = ulFout; + } + else + { + ucP = 3; + ulVCO = ulFout; + G450RemovePFactor(pScrn, ucP, &ulVCO); + while(ucP && (ulVCO > ulVCOMax)) + { + ucP--; + ulVCO = ulFout; + G450RemovePFactor(pScrn, ucP, &ulVCO); + } + } + + if(ulVCO > ulVCOMax) + { + *pulPLLMNP = 0xffffffff; + } + else + { + /* Pixel clock: 1 */ + *pulPLLMNP = (1 << 24) + 0xff0000 + ucP; + G450FindNextPLLParam(pScrn, ulFout, pulPLLMNP); + } + + return TRUE; + +} + + +static CARD32 G450WriteMNP(ScrnInfoPtr pScrn, CARD32 ulMNP) +{ + MGAPtr pMga = MGAPTR(pScrn); + MGARegPtr pReg; + + pReg = &pMga->ModeReg; + + if (!pMga->SecondCrtc) { + outMGAdac(MGA1064_PIX_PLLC_M, (CARD8)(ulMNP >> 16)); + outMGAdac(MGA1064_PIX_PLLC_N, (CARD8)(ulMNP >> 8)); + outMGAdac(MGA1064_PIX_PLLC_P, (CARD8) ulMNP); + } else { + outMGAdac(MGA1064_VID_PLL_M, (CARD8)(ulMNP >> 16)); + outMGAdac(MGA1064_VID_PLL_N, (CARD8)(ulMNP >> 8)); + outMGAdac(MGA1064_VID_PLL_P, (CARD8) ulMNP); + } + return TRUE; +} + + +static CARD32 G450CompareMNP(ScrnInfoPtr pScrn, CARD32 ulFout, CARD32 ulMNP1, + CARD32 ulMNP2, long *pulResult) +{ + CARD32 ulFreq, ulDelta1, ulDelta2; + + G450CalculVCO(pScrn, ulMNP1, &ulFreq); + G450ApplyPFactor(pScrn, (CARD8) ulMNP1, &ulFreq); + G450CalculDeltaFreq(pScrn, ulFout, ulFreq, &ulDelta1); + + G450CalculVCO(pScrn, ulMNP2, &ulFreq); + G450ApplyPFactor(pScrn, (CARD8) ulMNP2, &ulFreq); + G450CalculDeltaFreq(pScrn, ulFout, ulFreq, &ulDelta2); + + if(ulDelta1 < ulDelta2) + { + *pulResult = -1; + } + else if(ulDelta1 > ulDelta2) + { + *pulResult = 1; + } + else + { + *pulResult = 0; + } + + if((ulDelta1 <= 5) && (ulDelta2 <= 5)) + { + if((ulMNP1 & 0xff0000) < (ulMNP2 & 0xff0000)) + { + *pulResult = -1; + } + else if((ulMNP1 & 0xff0000) > (ulMNP2 & 0xff0000)) + { + *pulResult = 1; + } + } + + return TRUE; +} + + +static CARD32 G450IsPllLocked(ScrnInfoPtr pScrn, Bool *lpbLocked) +{ + CARD32 ulFallBackCounter, ulLockCount, ulCount; + CARD8 ucPLLStatus; + + MGAPtr pMga = MGAPTR(pScrn); + + /* Pixel PLL */ + if (!pMga->SecondCrtc) + OUTREG8(0x3c00, 0x4f); + else + OUTREG8(0x3c00, 0x8f); + + ulFallBackCounter = 0; + + do + { + ucPLLStatus = INREG8(0x3c0a); + ulFallBackCounter++; + } while(!(ucPLLStatus & PLLLOCK) && (ulFallBackCounter < 1000)); + + ulLockCount = 0; + if(ulFallBackCounter < 1000) + { + for(ulCount = 0; ulCount < 100; ulCount++) + { + ucPLLStatus = INREG8(0x3c0a); + if(ucPLLStatus & PLLLOCK) + { + ulLockCount++; + } + } + } + + *lpbLocked = ulLockCount >= 90; + + return TRUE; +} + + +double G450SetPLLFreq(ScrnInfoPtr pScrn, long f_out) +{ + Bool bFoundValidPLL; + Bool bLocked; + CARD8 ucMisc; + CARD32 ulMaxIndex; + CARD32 ulMNP; + CARD32 ulMNPTable[MNP_TABLE_SIZE]; + CARD32 ulIndex; + CARD32 ulTryMNP; + long lCompareResult; + + MGAPtr pMga = MGAPTR(pScrn); + + G450FindFirstPLLParam(pScrn, f_out, &ulMNP); + ulMNPTable[0] = ulMNP; + G450FindNextPLLParam(pScrn, f_out, &ulMNP); + ulMaxIndex = 1; + while(ulMNP != 0xffffffff) + { + int ulIndex; + Bool bSkipValue; + + bSkipValue = FALSE; + if(ulMaxIndex == MNP_TABLE_SIZE) + { + G450CompareMNP(pScrn, f_out, ulMNP, ulMNPTable[MNP_TABLE_SIZE - 1], + &lCompareResult); + + if(lCompareResult > 0) + { + bSkipValue = TRUE; + } + else + { + ulMaxIndex--; + } + } + + if(!bSkipValue) + { + for(ulIndex = ulMaxIndex; !bSkipValue && (ulIndex > 0); ulIndex--) + { + G450CompareMNP(pScrn, f_out, ulMNP, ulMNPTable[ulIndex - 1], + &lCompareResult); + + if(lCompareResult < 0) + { + ulMNPTable[ulIndex] = ulMNPTable[ulIndex - 1]; + } + else + { + break; + } + } + ulMNPTable[ulIndex] = ulMNP; + ulMaxIndex++; + } + + G450FindNextPLLParam(pScrn, f_out, &ulMNP); + } + + bFoundValidPLL = FALSE; + ulMNP = 0; + + /* For pixel pll */ + ucMisc = INREG8(0x1FCC); + OUTREG8(0x1fc2, (CARD8)(ucMisc | CLKSEL_MGA)); + + for(ulIndex = 0; !bFoundValidPLL && (ulIndex < ulMaxIndex); ulIndex++) + { + ulTryMNP = ulMNPTable[ulIndex]; + +/* for(ucS = 0; !bFoundValidPLL && (ucS < 0x40); ucS += 8)*/ + { +/* ulTryMNP &= 0xffffffc7;*/ +/* ulTryMNP |= (CARD32)ucS;*/ + + bLocked = TRUE; + if((ulMNPTable[ulIndex] & 0xff00) < 0x300 || + (ulMNPTable[ulIndex] & 0xff00) > 0x7a00) + { + bLocked = FALSE; + } + + if(bLocked) + { + G450WriteMNP(pScrn, ulTryMNP - 0x300); + G450IsPllLocked(pScrn, &bLocked); + } + + if(bLocked) + { + G450WriteMNP(pScrn, ulTryMNP + 0x300); + G450IsPllLocked(pScrn, &bLocked); + } + + if(bLocked) + { + G450WriteMNP(pScrn, ulTryMNP - 0x200); + G450IsPllLocked(pScrn, &bLocked); + } + + if(bLocked) + { + G450WriteMNP(pScrn, ulTryMNP + 0x200); + G450IsPllLocked(pScrn, &bLocked); + } + + if(bLocked) + { + G450WriteMNP(pScrn, ulTryMNP - 0x100); + G450IsPllLocked(pScrn, &bLocked); + } + + if(bLocked) + { + G450WriteMNP(pScrn, ulTryMNP + 0x100); + G450IsPllLocked(pScrn, &bLocked); + } + + if(bLocked) + { + G450WriteMNP(pScrn, ulTryMNP); + G450IsPllLocked(pScrn, &bLocked); + } + else if(!ulMNP) + { + G450WriteMNP(pScrn, ulTryMNP); + G450IsPllLocked(pScrn, &bLocked); + if(bLocked) + { + ulMNP = ulMNPTable[ulIndex]; + } + bLocked = FALSE; + } + + if(bLocked) + { + bFoundValidPLL = TRUE; + } + } + } + + if(!bFoundValidPLL) + { + if(ulMNP) + { + G450WriteMNP(pScrn, ulMNP); + } + else + { + G450WriteMNP(pScrn, ulMNPTable[0]); + } + } + + return TRUE; +} Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h:1.18.2.1 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h:1.18.2.1 Wed Feb 28 16:44:26 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h Wed Mar 21 12:02:24 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.18.2.1 2001/02/28 21:44:26 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_macros.h,v 1.20 2001/03/21 17:02:24 dawes Exp $ */ #ifndef _MGA_MACROS_H_ #define _MGA_MACROS_H_ @@ -83,7 +83,7 @@ #ifdef XF86DRI #define CHECK_DMA_QUIESCENT(pMGA, pScrn) { \ - if (!pMGA->have_quiescense) { \ + if (!pMGA->haveQuiescense) { \ pMGA->GetQuiescence( pScrn ); \ } \ } Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h:1.14 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h:1.14 Wed Nov 8 00:03:04 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h Wed Apr 25 10:23:00 2001 @@ -2,7 +2,7 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.14 2000/11/08 05:03:04 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_reg.h,v 1.17 2001/04/25 14:23:00 dawes Exp $ */ @@ -22,8 +22,8 @@ * g.desbief@aix.pacwan.net * MGA1064SG Mystique register file */ - + #ifndef _MGA_REG_H_ #define _MGA_REG_H_ @@ -170,7 +170,7 @@ /* z drawing mode. use MGADWG_NOZCMP for always */ #define MGADWG_NOZCMP ( 0x00 << 8 ) -#define MGADWG_ZE ( 0x02 << 8 ) +#define MGADWG_ZE ( 0x02 << 8 ) #define MGADWG_ZNE ( 0x03 << 8 ) #define MGADWG_ZLT ( 0x04 << 8 ) #define MGADWG_ZLTE ( 0x05 << 8 ) @@ -219,14 +219,17 @@ #define MGAREG_MISC_CLK_SEL_MGA_MSK (0x3 << 2) #define MGAREG_MISC_VIDEO_DIS (0x1 << 4) #define MGAREG_MISC_HIGH_PG_SEL (0x1 << 5) - + /* MMIO VGA registers */ +#define MGAREG_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 ) @@ -387,6 +390,44 @@ #define MGA1064_PIX_PLL_STAT 0x4f +/*Added for G450 dual head*/ +/* Supported PLL*/ +#define __PIXEL_PLL 1 +#define __SYSTEM_PLL 2 +#define __VIDEO_PLL 3 + +#define MGA1064_VID_PLL_P 0x8D +#define MGA1064_VID_PLL_M 0x8E +#define MGA1064_VID_PLL_N 0x8F + +#define MGA1064_DISP_CTL 0x8a +#define MGA1064_SYNC_CTL 0x8b +#define MGA1064_PWR_CTL 0xa0 +/* Using crtc2 */ +#define MGAREG2_C2CTL 0x10 +#define MGAREG2_C2HPARAM 0x14 +#define MGAREG2_C2HSYNC 0x18 +#define MGAREG2_C2VPARAM 0x1c +#define MGAREG2_C2VSYNC 0x20 +#define MGAREG2_C2STARTADD0 0x28 + +#define MGAREG2_C2OFFSET 0x40 +#define MGAREG2_C2DATACTL 0x4c + +#define MGAREG_C2CTL 0x3c10 +#define MGAREG_C2HPARAM 0x3c14 +#define MGAREG_C2HSYNC 0x3c18 +#define MGAREG_C2VPARAM 0x3c1c +#define MGAREG_C2VSYNC 0x3c20 +#define MGAREG_C2STARTADD0 0x3c28 + +#define MGAREG_C2OFFSET 0x3c40 +#define MGAREG_C2DATACTL 0x3c4c + +#define MGA1064_DISP_CTL 0x8a +#define MGA1064_SYNC_CTL 0x8b +#define MGA1064_PWR_CTL 0xa0 + /* video register */ #define MGAREG_BESA1C3ORG 0x3d60 @@ -431,9 +472,8 @@ #define MGAREG_ALPHACTRL 0x2c7c #define MGAREG_DWGSYNC 0x2c4c -#define MGAREG_AGP_PLL 0x1e4c -#define AGP_PLL_agp2xpllen_enable 0x1 -#define AGP_PLL_agp2xpllen_disable 0x0 +#define MGAREG_AGP_PLL 0x1e4c +#define MGA_AGP2XPLL_ENABLE 0x1 +#define MGA_AGP2XPLL_DISABLE 0x0 #endif - Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h:1.1 --- /dev/null Mon Jun 4 12:40:58 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h Wed Mar 21 12:11:47 2001 @@ -0,0 +1,222 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_sarea.h,v 1.1 2001/03/21 17:11:47 dawes Exp $ */ + +/* + * Copyright 2000 Gareth Hughes + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * GARETH HUGHES BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER + * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __MGA_SAREA_H__ +#define __MGA_SAREA_H__ + +/* WARNING: If you change any of these defines, make sure to change + * the kernel include file as well (mga_drm.h) + */ +#ifndef __MGA_SAREA_DEFINES__ +#define __MGA_SAREA_DEFINES__ + +/* WARP pipe flags + */ +#define MGA_F 0x1 /* fog */ +#define MGA_A 0x2 /* alpha */ +#define MGA_S 0x4 /* specular */ +#define MGA_T2 0x8 /* multitexture */ + +#define MGA_WARP_TGZ 0 +#define MGA_WARP_TGZF (MGA_F) +#define MGA_WARP_TGZA (MGA_A) +#define MGA_WARP_TGZAF (MGA_F|MGA_A) +#define MGA_WARP_TGZS (MGA_S) +#define MGA_WARP_TGZSF (MGA_S|MGA_F) +#define MGA_WARP_TGZSA (MGA_S|MGA_A) +#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) +#define MGA_WARP_T2GZ (MGA_T2) +#define MGA_WARP_T2GZF (MGA_T2|MGA_F) +#define MGA_WARP_T2GZA (MGA_T2|MGA_A) +#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) +#define MGA_WARP_T2GZS (MGA_T2|MGA_S) +#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) +#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) +#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) + +#define MGA_MAX_G200_PIPES 8 /* no multitex */ +#define MGA_MAX_G400_PIPES 16 +#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES +#define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ + +#define MGA_CARD_TYPE_G200 1 +#define MGA_CARD_TYPE_G400 2 + + +#define MGA_FRONT 0x1 +#define MGA_BACK 0x2 +#define MGA_DEPTH 0x4 + +/* What needs to be changed for the current vertex dma buffer? + */ +#define MGA_UPLOAD_CONTEXT 0x1 +#define MGA_UPLOAD_TEX0 0x2 +#define MGA_UPLOAD_TEX1 0x4 +#define MGA_UPLOAD_PIPE 0x8 +#define MGA_UPLOAD_TEX0IMAGE 0x10 +#define MGA_UPLOAD_TEX1IMAGE 0x20 +#define MGA_UPLOAD_2D 0x40 +#define MGA_WAIT_AGE 0x80 /* handled client-side */ +#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ +#if 0 +#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock + quiescent */ +#endif + +/* 32 buffers of 64k each, total 1 meg. + */ +#define MGA_BUFFER_SIZE (1 << 16) +#define MGA_NUM_BUFFERS 128 + +/* Keep these small for testing. + */ +#define MGA_NR_SAREA_CLIPRECTS 8 + +/* 2 heaps (1 for card, 1 for agp), each divided into upto 128 + * regions, subject to a minimum region size of (1<<16) == 64k. + * + * Clients may subdivide regions internally, but when sharing between + * clients, the region size is the minimum granularity. + */ + +#define MGA_CARD_HEAP 0 +#define MGA_AGP_HEAP 1 +#define MGA_NR_TEX_HEAPS 2 +#define MGA_NR_TEX_REGIONS 16 +#define MGA_LOG_MIN_TEX_REGION_SIZE 16 + +#endif /* __MGA_SAREA_DEFINES__ */ + + +/* Setup registers for 3D context + */ +typedef struct { + unsigned int dstorg; + unsigned int maccess; + unsigned int plnwt; + unsigned int dwgctl; + unsigned int alphactrl; + unsigned int fogcolor; + unsigned int wflag; + unsigned int tdualstage0; + unsigned int tdualstage1; + unsigned int fcol; + unsigned int stencil; + unsigned int stencilctl; +} mga_context_regs_t; + +/* Setup registers for 2D, X server + */ +typedef struct { + unsigned int pitch; +} mga_server_regs_t; + +/* Setup registers for each texture unit + */ +typedef struct { + unsigned int texctl; + unsigned int texctl2; + unsigned int texfilter; + unsigned int texbordercol; + unsigned int texorg; + unsigned int texwidth; + unsigned int texheight; + unsigned int texorg1; + unsigned int texorg2; + unsigned int texorg3; + unsigned int texorg4; +} mga_texture_regs_t; + +/* General ageing mechanism + */ +typedef struct { + unsigned int head; /* Position of head pointer */ + unsigned int wrap; /* Primary DMA wrap count */ +} mga_age_t; + + +/* WARNING: Do not change the SAREA structure without changing the kernel + * as well. + */ +typedef struct { + /* The channel for communication of state information to the kernel + * on firing a vertex dma buffer. + */ + mga_context_regs_t ContextState; + mga_server_regs_t ServerState; + mga_texture_regs_t TexState[2]; + unsigned int WarpPipe; + unsigned int dirty; + unsigned int vertsize; + + /* The current cliprects, or a subset thereof. + */ + XF86DRIClipRectRec boxes[MGA_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Information about the most recently used 3d drawable. The + * client fills in the req_* fields, the server fills in the + * exported_ fields and puts the cliprects into boxes, above. + * + * The client clears the exported_drawable field before + * clobbering the boxes data. + */ + unsigned int req_drawable; /* the X drawable id */ + unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ + + unsigned int exported_drawable; + unsigned int exported_index; + unsigned int exported_stamp; + unsigned int exported_buffers; + unsigned int exported_nfront; /* FIXME: verify signedness... */ + unsigned int exported_nback; + int exported_back_x, exported_front_x, exported_w; + int exported_back_y, exported_front_y, exported_h; + XF86DRIClipRectRec exported_boxes[MGA_NR_SAREA_CLIPRECTS]; + + /* Counters for aging textures and for client-side throttling. + */ + unsigned int status[4]; + unsigned int last_wrap; + + mga_age_t last_frame; + unsigned int last_enqueue; /* last time a buffer was enqueued */ + unsigned int last_dispatch; /* age of the most recently dispatched buffer */ + unsigned int last_quiescent; /* */ + + /* LRU lists for texture memory in agp space and on the card. + */ + drmTextureRegion texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1]; + unsigned int texAge[MGA_NR_TEX_HEAPS]; + + /* Last context that uploaded statel + */ + int ctxOwner; +} MGASAREAPrivRec, *MGASAREAPrivPtr; + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c:1.81.2.1 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c:1.91 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c:1.81.2.1 Fri Mar 9 13:03:34 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c Thu May 10 17:53:48 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.81.2.1 2001/03/09 18:03:34 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_storm.c,v 1.91 2001/05/10 21:53:48 dawes Exp $ */ /* All drivers should typically include these */ @@ -37,6 +37,12 @@ #include "mga_dri.h" #endif +#define MGAMoveDWORDS(d,s,c) \ +do { \ + write_mem_barrier(); \ + XAAMoveDWORDS((d),(s),(c)); \ +} while (0) + static void MGANAME(SubsequentScreenToScreenCopy)(ScrnInfoPtr pScrn, int srcX, int srcY, int dstX, int dstY, int w, int h); @@ -55,7 +61,7 @@ int bufno); static void MGANAME(SubsequentSolidFillRect)(ScrnInfoPtr pScrn, int x, int y, int w, int h); -static void MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, +static void MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, int left, int dxL, int dyL, int eL, int right, int dxR, int dyR, int eR); static void MGANAME(SubsequentSolidHorVertLine) (ScrnInfoPtr pScrn, @@ -72,8 +78,8 @@ ScrnInfoPtr pScrn, int patx, int paty, int x, int y, int w, int h ); static void MGANAME(SubsequentMono8x8PatternFillTrap)( ScrnInfoPtr pScrn, - int patx, int paty, int y, int h, - int left, int dxL, int dyL, int eL, + int patx, int paty, int y, int h, + int left, int dxL, int dyL, int eL, int right, int dxR, int dyR, int eR); static void MGANAME(SetupForScanlineImageWrite)(ScrnInfoPtr pScrn, int rop, unsigned int planemask, @@ -83,7 +89,7 @@ static void MGANAME(SubsequentImageWriteScanline)(ScrnInfoPtr pScrn, int num); #if PSZ != 24 static void MGANAME(SetupForPlanarScreenToScreenColorExpandFill)( - ScrnInfoPtr pScrn, int fg, int bg, int rop, + ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); static void MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)( ScrnInfoPtr pScrn, @@ -91,16 +97,16 @@ int srcx, int srcy, int skipleft); #endif static void MGANAME(SetupForScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn, - int fg, int bg, int rop, + int fg, int bg, int rop, unsigned int planemask); static void MGANAME(SubsequentScreenToScreenColorExpandFill)(ScrnInfoPtr pScrn, int x, int y, int w, int h, int srcx, int srcy, int skipleft); -static void MGANAME(SetupForDashedLine)(ScrnInfoPtr pScrn, int fg, int bg, +static void MGANAME(SetupForDashedLine)(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask, int length, unsigned char *pattern); static void MGANAME(SubsequentDashedTwoPointLine)(ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, + int x1, int y1, int x2, int y2, int flags, int phase); void MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn); #if PSZ == 8 @@ -110,7 +116,7 @@ #endif #ifdef XF86DRI -void MGANAME(DRIInitBuffers)(WindowPtr pWin, +void MGANAME(DRIInitBuffers)(WindowPtr pWin, RegionPtr prgn, CARD32 index); void MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); @@ -120,14 +126,14 @@ extern void MGASetClippingRectangle(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2); extern void MGADisableClipping(ScrnInfoPtr pScrn); -extern void MGAFillSolidRectsDMA(ScrnInfoPtr pScrn, int fg, int rop, +extern void MGAFillSolidRectsDMA(ScrnInfoPtr pScrn, int fg, int rop, unsigned int planemask, int nBox, BoxPtr pBox); -extern void MGAFillSolidSpansDMA(ScrnInfoPtr pScrn, int fg, int rop, +extern void MGAFillSolidSpansDMA(ScrnInfoPtr pScrn, int fg, int rop, unsigned int planemask, int n, DDXPointPtr ppt, int *pwidth, int fSorted); extern void MGAFillMono8x8PatternRectsTwoPass(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask, int nBox, - BoxPtr pBox, int pattern0, int pattern1, + BoxPtr pBox, int pattern0, int pattern1, int xorigin, int yorigin); extern void MGAValidatePolyArc(GCPtr, unsigned long, DrawablePtr); extern void MGAValidatePolyPoint(GCPtr, unsigned long, DrawablePtr); @@ -136,7 +142,7 @@ #ifdef RENDER -extern Bool +extern Bool MGASetupForCPUToScreenAlphaTexture ( ScrnInfoPtr pScrn, int op, @@ -152,7 +158,7 @@ int flags ); -extern Bool +extern Bool MGASetupForCPUToScreenAlphaTextureFaked ( ScrnInfoPtr pScrn, int op, @@ -169,7 +175,7 @@ ); -extern Bool +extern Bool MGASetupForCPUToScreenTexture ( ScrnInfoPtr pScrn, int op, @@ -181,7 +187,7 @@ int flags ); -extern void +extern void MGASubsequentCPUToScreenTexture ( ScrnInfoPtr pScrn, int dstx, @@ -202,7 +208,7 @@ CARD32 MGAAlphaTextureFormats[2] = {PICT_a8, 0}; CARD32 MGATextureFormats[2] = {PICT_a8r8g8b8, 0}; -static void +static void RemoveLinear (FBLinearPtr linear) { MGAPtr pMga = (MGAPtr)(linear->devPrivate.ptr); @@ -237,19 +243,19 @@ pMga->RenderCallback = RenderCallback; if(pMga->LinearScratch) { - if(pMga->LinearScratch->size >= sizeNeeded) + if(pMga->LinearScratch->size >= sizeNeeded) return TRUE; else { if(xf86ResizeOffscreenLinear(pMga->LinearScratch, sizeNeeded)) return TRUE; - + xf86FreeOffscreenLinear(pMga->LinearScratch); pMga->LinearScratch = NULL; } } pMga->LinearScratch = xf86AllocateOffscreenLinear( - pScrn->pScreen, sizeNeeded, 32, + pScrn->pScreen, sizeNeeded, 32, NULL, RemoveLinear, pMga); return (pMga->LinearScratch != NULL); @@ -258,15 +264,15 @@ static int GetPowerOfTwo(int w) { - int Pof2; + int Pof2 = 0; int i = 12; while(--i) { if(w & (1 << i)) { Pof2 = i; - if(w & ((1 << i) - 1)) + if(w & ((1 << i) - 1)) Pof2++; - break; + break; } } return Pof2; @@ -275,7 +281,7 @@ static int tex_padw, tex_padh; -Bool +Bool MGASetupForCPUToScreenAlphaTextureFaked ( ScrnInfoPtr pScrn, int op, @@ -312,7 +318,7 @@ pitch = (width + 15) & ~15; sizeNeeded = pitch * height; - if(pScrn->bitsPerPixel == 16) + if(pScrn->bitsPerPixel == 16) sizeNeeded <<= 1; if(!AllocateLinear(pScrn, sizeNeeded)) @@ -322,12 +328,12 @@ if(pScrn->bitsPerPixel == 32) offset <<= 1; - if(pMga->AccelInfoRec->NeedToSync) + if(pMga->AccelInfoRec->NeedToSync) MGAStormSync(pScrn); XAA_888_plus_PICT_a8_to_8888( - (blue >> 8) | (green & 0xff00) | ((red & 0xff00) << 8), - alphaPtr, alphaPitch, (CARD32*)(pMga->FbStart + offset), + (blue >> 8) | (green & 0xff00) | ((red & 0xff00) << 8), + alphaPtr, alphaPitch, (CARD32*)(pMga->FbStart + offset), pitch, width, height); tex_padw = 1 << log2w; @@ -338,24 +344,24 @@ OUTREG(MGAREG_TMR1, 0); /* sy inc */ OUTREG(MGAREG_TMR2, 0); /* tx inc */ OUTREG(MGAREG_TMR3, (1 << 20) / tex_padh); /* ty inc */ - OUTREG(MGAREG_TMR4, 0x00000000); + OUTREG(MGAREG_TMR4, 0x00000000); OUTREG(MGAREG_TMR5, 0x00000000); OUTREG(MGAREG_TMR8, 0x00010000); - OUTREG(MGAREG_TEXORG, offset); - OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) | + OUTREG(MGAREG_TEXORG, offset); + OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) | ((width - 1) << 18)); - OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) | + OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) | ((height - 1) << 18)); OUTREG(MGAREG_TEXCTL, 0x1A000106 | ((pitch & 0x07FF) << 9)); OUTREG(MGAREG_TEXCTL2, 0x00000014); - OUTREG(MGAREG_DWGCTL, 0x000c7076); + OUTREG(MGAREG_DWGCTL, 0x000c7076); OUTREG(MGAREG_TEXFILTER, 0x01e00020); OUTREG(MGAREG_ALPHACTRL, 0x00000154); return TRUE; } -Bool +Bool MGASetupForCPUToScreenAlphaTexture ( ScrnInfoPtr pScrn, int op, @@ -393,7 +399,7 @@ pitch = (width + 15) & ~15; sizeNeeded = (pitch * height) >> 1; - if(pScrn->bitsPerPixel == 32) + if(pScrn->bitsPerPixel == 32) sizeNeeded >>= 1; if(!AllocateLinear(pScrn, sizeNeeded)) @@ -403,7 +409,7 @@ if(pScrn->bitsPerPixel == 32) offset <<= 1; - if(pMga->AccelInfoRec->NeedToSync) + if(pMga->AccelInfoRec->NeedToSync) MGAStormSync(pScrn); i = height; @@ -417,7 +423,7 @@ tex_padw = 1 << log2w; tex_padh = 1 << log2h; - + WAITFIFO(12); OUTREG(MGAREG_DR4, red << 7); /* red start */ OUTREG(MGAREG_DR6, 0); @@ -429,25 +435,25 @@ OUTREG(MGAREG_DR14, 0); OUTREG(MGAREG_DR15, 0); OUTREG(MGAREG_ALPHASTART, alpha << 7); /* alpha start */ - OUTREG(MGAREG_ALPHAXINC, 0); - OUTREG(MGAREG_ALPHAYINC, 0); + OUTREG(MGAREG_ALPHAXINC, 0); + OUTREG(MGAREG_ALPHAYINC, 0); WAITFIFO(15); OUTREG(MGAREG_TMR0, (1 << 20) / tex_padw); /* sx inc */ OUTREG(MGAREG_TMR1, 0); /* sy inc */ OUTREG(MGAREG_TMR2, 0); /* tx inc */ OUTREG(MGAREG_TMR3, (1 << 20) / tex_padh); /* ty inc */ - OUTREG(MGAREG_TMR4, 0x00000000); + OUTREG(MGAREG_TMR4, 0x00000000); OUTREG(MGAREG_TMR5, 0x00000000); OUTREG(MGAREG_TMR8, 0x00010000); - OUTREG(MGAREG_TEXORG, offset); - OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) | + OUTREG(MGAREG_TEXORG, offset); + OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) | ((width - 1) << 18)); - OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) | + OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) | ((height - 1) << 18)); OUTREG(MGAREG_TEXCTL, 0x3A000107 | ((pitch & 0x07FF) << 9)); OUTREG(MGAREG_TEXCTL2, 0x00000014); - OUTREG(MGAREG_DWGCTL, 0x000c7076); + OUTREG(MGAREG_DWGCTL, 0x000c7076); OUTREG(MGAREG_TEXFILTER, 0x01e00020); OUTREG(MGAREG_ALPHACTRL, 0x02000151); @@ -455,7 +461,7 @@ } -Bool +Bool MGASetupForCPUToScreenTexture ( ScrnInfoPtr pScrn, int op, @@ -488,7 +494,7 @@ pitch = (width + 15) & ~15; sizeNeeded = pitch * height; - if(pScrn->bitsPerPixel == 16) + if(pScrn->bitsPerPixel == 16) sizeNeeded <<= 1; if(!AllocateLinear(pScrn, sizeNeeded)) @@ -498,7 +504,7 @@ if(pScrn->bitsPerPixel == 32) offset <<= 1; - if(pMga->AccelInfoRec->NeedToSync) + if(pMga->AccelInfoRec->NeedToSync) MGAStormSync(pScrn); { @@ -519,23 +525,23 @@ OUTREG(MGAREG_TMR1, 0); /* sy inc */ OUTREG(MGAREG_TMR2, 0); /* tx inc */ OUTREG(MGAREG_TMR3, (1 << 20) / tex_padh); /* ty inc */ - OUTREG(MGAREG_TMR4, 0x00000000); + OUTREG(MGAREG_TMR4, 0x00000000); OUTREG(MGAREG_TMR5, 0x00000000); OUTREG(MGAREG_TMR8, 0x00010000); - OUTREG(MGAREG_TEXORG, offset); - OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) | + OUTREG(MGAREG_TEXORG, offset); + OUTREG(MGAREG_TEXWIDTH, log2w | (((8 - log2w) & 63) << 9) | ((width - 1) << 18)); - OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) | + OUTREG(MGAREG_TEXHEIGHT, log2h | (((8 - log2h) & 63) << 9) | ((height - 1) << 18)); OUTREG(MGAREG_TEXCTL, 0x1A000106 | ((pitch & 0x07FF) << 9)); OUTREG(MGAREG_TEXCTL2, 0x00000014); - OUTREG(MGAREG_DWGCTL, 0x000c7076); + OUTREG(MGAREG_DWGCTL, 0x000c7076); OUTREG(MGAREG_TEXFILTER, 0x01e00020); OUTREG(MGAREG_ALPHACTRL, 0x00000151); return TRUE; } -void +void MGASubsequentCPUToScreenTexture ( ScrnInfoPtr pScrn, int dstx, @@ -561,7 +567,7 @@ #endif Bool -MGANAME(AccelInit)(ScreenPtr pScreen) +MGANAME(AccelInit)(ScreenPtr pScreen) { XAAInfoRecPtr infoPtr; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -572,7 +578,7 @@ pMga->ScratchBuffer = xalloc(((pScrn->displayWidth * PSZ) + 127) >> 3); if(!pMga->ScratchBuffer) return FALSE; - + pMga->AccelInfoRec = infoPtr = XAACreateInfoRec(); if(!infoPtr) return FALSE; @@ -587,7 +593,7 @@ case PCI_CHIP_MGA2164_AGP: pMga->AccelFlags = BLK_OPAQUE_EXPANSION | TRANSC_SOLID_FILL | - USE_RECTS_FOR_LINES; + USE_RECTS_FOR_LINES; break; case PCI_CHIP_MGAG400: if(pMga->SecondCrtc == TRUE) { @@ -632,7 +638,7 @@ } /* fill out infoPtr here */ - infoPtr->Flags = PIXMAP_CACHE | + infoPtr->Flags = PIXMAP_CACHE | OFFSCREEN_PIXMAPS | LINEAR_FRAMEBUFFER | MICROSOFT_ZERO_LINE_BIAS; @@ -660,7 +666,7 @@ infoPtr->SetupForSolidLine = infoPtr->SetupForSolidFill; infoPtr->SubsequentSolidHorVertLine = MGANAME(SubsequentSolidHorVertLine); - infoPtr->SubsequentSolidTwoPointLine = + infoPtr->SubsequentSolidTwoPointLine = MGANAME(SubsequentSolidTwoPointLine); /* clipping */ @@ -669,15 +675,16 @@ infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_LINE | HARDWARE_CLIP_DASHED_LINE | HARDWARE_CLIP_SOLID_FILL | - HARDWARE_CLIP_MONO_8x8_FILL; + HARDWARE_CLIP_MONO_8x8_FILL; +#if X_BYTE_ORDER == X_LITTLE_ENDIAN /* dashed lines */ infoPtr->DashedLineFlags = LINE_PATTERN_MSBFIRST_LSBJUSTIFIED; infoPtr->SetupForDashedLine = MGANAME(SetupForDashedLine); - infoPtr->SubsequentDashedTwoPointLine = + infoPtr->SubsequentDashedTwoPointLine = MGANAME(SubsequentDashedTwoPointLine); infoPtr->DashPatternMaxLength = 128; - +#endif /* 8x8 mono patterns */ infoPtr->Mono8x8PatternFillFlags = HARDWARE_PATTERN_PROGRAMMED_BITS | @@ -685,16 +692,20 @@ HARDWARE_PATTERN_SCREEN_ORIGIN | BIT_ORDER_IN_BYTE_MSBFIRST; infoPtr->SetupForMono8x8PatternFill = MGANAME(SetupForMono8x8PatternFill); - infoPtr->SubsequentMono8x8PatternFillRect = + infoPtr->SubsequentMono8x8PatternFillRect = MGANAME(SubsequentMono8x8PatternFillRect); - infoPtr->SubsequentMono8x8PatternFillTrap = + infoPtr->SubsequentMono8x8PatternFillTrap = MGANAME(SubsequentMono8x8PatternFillTrap); /* cpu to screen color expansion */ - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD | +#if X_BYTE_ORDER == X_BIG_ENDIAN + BIT_ORDER_IN_BYTE_MSBFIRST | +#else BIT_ORDER_IN_BYTE_LSBFIRST | +#endif LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X; @@ -713,23 +724,23 @@ MGANAME(SubsequentScanlineCPUToScreenColorExpandFill); infoPtr->SubsequentColorExpandScanline = MGANAME(SubsequentColorExpandScanline); - infoPtr->NumScanlineColorExpandBuffers = 1; + infoPtr->NumScanlineColorExpandBuffers = 1; infoPtr->ScanlineColorExpandBuffers = &(pMga->ColorExpandBase); /* screen to screen color expansion */ if(pMga->AccelFlags & USE_LINEAR_EXPANSION) { - infoPtr->ScreenToScreenColorExpandFillFlags = + infoPtr->ScreenToScreenColorExpandFillFlags = BIT_ORDER_IN_BYTE_LSBFIRST; - infoPtr->SetupForScreenToScreenColorExpandFill = + infoPtr->SetupForScreenToScreenColorExpandFill = MGANAME(SetupForScreenToScreenColorExpandFill); - infoPtr->SubsequentScreenToScreenColorExpandFill = + infoPtr->SubsequentScreenToScreenColorExpandFill = MGANAME(SubsequentScreenToScreenColorExpandFill); } else { #if PSZ != 24 /* Alternate (but slower) planar expansions */ - infoPtr->SetupForScreenToScreenColorExpandFill = + infoPtr->SetupForScreenToScreenColorExpandFill = MGANAME(SetupForPlanarScreenToScreenColorExpandFill); - infoPtr->SubsequentScreenToScreenColorExpandFill = + infoPtr->SubsequentScreenToScreenColorExpandFill = MGANAME(SubsequentPlanarScreenToScreenColorExpandFill); infoPtr->CacheColorExpandDensity = PSZ; infoPtr->CacheMonoStipple = XAACachePlanarMonoStipple; @@ -747,15 +758,15 @@ NO_TRANSPARENCY | NO_GXCOPY; - infoPtr->SetupForScanlineImageWrite = + infoPtr->SetupForScanlineImageWrite = MGANAME(SetupForScanlineImageWrite); - infoPtr->SubsequentScanlineImageWriteRect = + infoPtr->SubsequentScanlineImageWriteRect = MGANAME(SubsequentScanlineImageWriteRect); - infoPtr->SubsequentImageWriteScanline = + infoPtr->SubsequentImageWriteScanline = MGANAME(SubsequentImageWriteScanline); - infoPtr->NumScanlineImageWriteBuffers = 1; + infoPtr->NumScanlineImageWriteBuffers = 1; infoPtr->ScanlineImageWriteBuffers = &(pMga->ScratchBuffer); - + /* midrange replacements */ @@ -766,13 +777,13 @@ if(pMga->AccelFlags & TWO_PASS_COLOR_EXPAND) { if(infoPtr->SetupForMono8x8PatternFill) - infoPtr->FillMono8x8PatternRects = + infoPtr->FillMono8x8PatternRects = MGAFillMono8x8PatternRectsTwoPass; } if(infoPtr->SetupForSolidFill) { infoPtr->ValidatePolyArc = MGAValidatePolyArc; - infoPtr->PolyArcMask = GCFunction | GCLineWidth | GCPlaneMask | + infoPtr->PolyArcMask = GCFunction | GCLineWidth | GCPlaneMask | GCLineStyle | GCFillStyle; infoPtr->ValidatePolyPoint = MGAValidatePolyPoint; infoPtr->PolyPointMask = GCFunction | GCPlaneMask; @@ -784,7 +795,7 @@ infoPtr->SolidFillFlags |= NO_PLANEMASK; infoPtr->SolidLineFlags |= NO_PLANEMASK; infoPtr->DashedLineFlags |= NO_PLANEMASK; - infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK; + infoPtr->Mono8x8PatternFillFlags |= NO_PLANEMASK; infoPtr->ScreenToScreenColorExpandFillFlags |= NO_PLANEMASK; infoPtr->FillSolidRectsFlags |= NO_PLANEMASK; infoPtr->FillSolidSpansFlags |= NO_PLANEMASK; @@ -792,47 +803,140 @@ infoPtr->FillCacheBltRectsFlags |= NO_PLANEMASK; } - + maxFastBlitMem = (pMga->Interleave ? 4096 : 2048) * 1024; if(pMga->FbMapSize > maxFastBlitMem) { pMga->MaxFastBlitY = maxFastBlitMem / (pScrn->displayWidth * PSZ / 8); } - maxlines = (min(pMga->FbUsableSize, 16*1024*1024)) / + maxlines = (min(pMga->FbUsableSize, 16*1024*1024)) / (pScrn->displayWidth * PSZ / 8); + #ifdef XF86DRI - if (pMga->directRenderingEnabled) { - if(maxlines > (pMga->numXAALines + pScrn->virtualY)) - maxlines = pMga->numXAALines + pScrn->virtualY; - - if(maxlines < (pMga->numXAALines + pScrn->virtualY)) - pMga->numXAALines = maxlines - pScrn->virtualY; - - /* not like the 3D will even work when there's not - even enough memory for a tiny pixmap cache */ - } - -#endif - - AvailFBArea.x1 = 0; - AvailFBArea.x2 = pScrn->displayWidth; - AvailFBArea.y1 = 0; - AvailFBArea.y2 = maxlines; - - /* - * Need to keep a strip of memory to the right of screen to workaround - * a display problem with the second CRTC. - */ - if (pMga->SecondCrtc) - AvailFBArea.x2 = pScrn->virtualX; - - xf86InitFBManager(pScreen, &AvailFBArea); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %d lines for offscreen " - "memory.\n", - maxlines - pScrn->virtualY); + if ( pMga->directRenderingEnabled ) { + MGADRIServerPrivatePtr pMGADRIServer = pMga->DRIServerInfo; + BoxRec MemBox; + int cpp = pScrn->bitsPerPixel / 8; + int widthBytes = pScrn->displayWidth * cpp; + int bufferSize = ((pScrn->virtualY * widthBytes + MGA_BUFFER_ALIGN) + & ~MGA_BUFFER_ALIGN); + int scanlines; + + pMGADRIServer->frontOffset = 0; + pMGADRIServer->frontPitch = widthBytes; + + /* Try for front, back, depth, and two framebuffers worth of + * pixmap cache. Should be enough for a fullscreen background + * image plus some leftovers. + */ + pMGADRIServer->textureSize = pMga->FbMapSize - 5 * bufferSize; + + /* If that gives us less than half the available memory, let's + * be greedy and grab some more. Sorry, I care more about 3D + * performance than playing nicely, and you'll get around a full + * framebuffer's worth of pixmap cache anyway. + */ + if ( pMGADRIServer->textureSize < (int)pMga->FbMapSize / 2 ) { + pMGADRIServer->textureSize = pMga->FbMapSize - 4 * bufferSize; + } + + /* Check to see if there is more room available after the maximum + * scanline for textures. + */ + if ( (int)pMga->FbMapSize - maxlines * widthBytes - bufferSize * 2 + > pMGADRIServer->textureSize ) { + pMGADRIServer->textureSize = (pMga->FbMapSize - + maxlines * widthBytes - + bufferSize * 2); + } + /* Set a minimum usable local texture heap size. This will fit + * two 256x256x32bpp textures. + */ + if ( pMGADRIServer->textureSize < 512 * 1024 ) { + pMGADRIServer->textureOffset = 0; + pMGADRIServer->textureSize = 0; + } + + /* Reserve space for textures */ + pMGADRIServer->textureOffset = (pMga->FbMapSize - + pMGADRIServer->textureSize + + MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN; + + /* Reserve space for the shared depth buffer */ + pMGADRIServer->depthOffset = (pMGADRIServer->textureOffset - + bufferSize + + MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN; + pMGADRIServer->depthPitch = widthBytes; + + /* Reserve space for the shared back buffer */ + pMGADRIServer->backOffset = (pMGADRIServer->depthOffset - bufferSize + + MGA_BUFFER_ALIGN) & ~MGA_BUFFER_ALIGN; + pMGADRIServer->backPitch = widthBytes; + + scanlines = pMGADRIServer->backOffset / widthBytes - 1; + if ( scanlines > maxlines ) scanlines = maxlines; + + MemBox.x1 = 0; + MemBox.y1 = 0; + MemBox.x2 = pScrn->displayWidth; + MemBox.y2 = scanlines; + + if ( !xf86InitFBManager( pScreen, &MemBox ) ) { + xf86DrvMsg( pScrn->scrnIndex, X_ERROR, + "Memory manager initialization to (%d,%d) (%d,%d) failed\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2 ); + return FALSE; + } else { + int width, height; + + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "Memory manager initialized to (%d,%d) (%d,%d)\n", + MemBox.x1, MemBox.y1, MemBox.x2, MemBox.y2 ); + + if ( xf86QueryLargestOffscreenArea( pScreen, &width, + &height, 0, 0, 0 ) ) { + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "Largest offscreen area available: %d x %d\n", + width, height ); + } + } + + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "Reserved back buffer at offset 0x%x\n", + pMGADRIServer->backOffset ); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "Reserved depth buffer at offset 0x%x\n", + pMGADRIServer->depthOffset ); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "Reserved %d kb for textures at offset 0x%x\n", + pMGADRIServer->textureSize/1024, + pMGADRIServer->textureOffset ); + } + else +#endif { + AvailFBArea.x1 = 0; + AvailFBArea.x2 = pScrn->displayWidth; + AvailFBArea.y1 = 0; + AvailFBArea.y2 = maxlines; + + /* + * Need to keep a strip of memory to the right of screen to workaround + * a display problem with the second CRTC. + */ + if (pMga->SecondCrtc) + AvailFBArea.x2 = pScrn->virtualX; + + xf86InitFBManager(pScreen, &AvailFBArea); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using %d lines for offscreen " + "memory.\n", + maxlines - pScrn->virtualY); + + } + + { Bool shared_accel = FALSE; int i; @@ -849,15 +953,15 @@ { if(pMga->Chipset == PCI_CHIP_MGAG400) { infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE; - infoPtr->SetupForCPUToScreenAlphaTexture = + infoPtr->SetupForCPUToScreenAlphaTexture = MGASetupForCPUToScreenAlphaTexture; } else { infoPtr->CPUToScreenAlphaTextureFlags = XAA_RENDER_NO_TILE | XAA_RENDER_NO_SRC_ALPHA; - infoPtr->SetupForCPUToScreenAlphaTexture = + infoPtr->SetupForCPUToScreenAlphaTexture = MGASetupForCPUToScreenAlphaTextureFaked; } - infoPtr->SubsequentCPUToScreenAlphaTexture = + infoPtr->SubsequentCPUToScreenAlphaTexture = MGASubsequentCPUToScreenTexture; infoPtr->CPUToScreenAlphaTextureFormats = MGAAlphaTextureFormats; @@ -879,7 +983,7 @@ } /* Support for multiscreen */ -void +void MGANAME(RestoreAccelState)(ScrnInfoPtr pScrn) { MGAPtr pMga = MGAPTR(pScrn); @@ -903,42 +1007,46 @@ SET_FOREGROUND(tmp); OUTREG(MGAREG_SRCORG, pMga->realSrcOrg); OUTREG(MGAREG_DSTORG, pMga->DstOrg); - OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT ); +#else + OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | 0x10000); +#endif OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ - OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ + OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ pMga->AccelFlags &= ~CLIPPER_ON; } #if PSZ == 8 CARD32 MGAAtype[16] = { - MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000, + MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000, MGADWG_RSTR | 0x00040000, MGADWG_BLK | 0x000c0000, - MGADWG_RSTR | 0x00020000, MGADWG_RSTR | 0x000a0000, + MGADWG_RSTR | 0x00020000, MGADWG_RSTR | 0x000a0000, MGADWG_RSTR | 0x00060000, MGADWG_RSTR | 0x000e0000, - MGADWG_RSTR | 0x00010000, MGADWG_RSTR | 0x00090000, + MGADWG_RSTR | 0x00010000, MGADWG_RSTR | 0x00090000, MGADWG_RSTR | 0x00050000, MGADWG_RSTR | 0x000d0000, - MGADWG_RPL | 0x00030000, MGADWG_RSTR | 0x000b0000, + MGADWG_RPL | 0x00030000, MGADWG_RSTR | 0x000b0000, MGADWG_RSTR | 0x00070000, MGADWG_RPL | 0x000f0000 }; CARD32 MGAAtypeNoBLK[16] = { - MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000, + MGADWG_RPL | 0x00000000, MGADWG_RSTR | 0x00080000, MGADWG_RSTR | 0x00040000, MGADWG_RPL | 0x000c0000, - MGADWG_RSTR | 0x00020000, MGADWG_RSTR | 0x000a0000, + MGADWG_RSTR | 0x00020000, MGADWG_RSTR | 0x000a0000, MGADWG_RSTR | 0x00060000, MGADWG_RSTR | 0x000e0000, - MGADWG_RSTR | 0x00010000, MGADWG_RSTR | 0x00090000, + MGADWG_RSTR | 0x00010000, MGADWG_RSTR | 0x00090000, MGADWG_RSTR | 0x00050000, MGADWG_RSTR | 0x000d0000, - MGADWG_RPL | 0x00030000, MGADWG_RSTR | 0x000b0000, + MGADWG_RPL | 0x00030000, MGADWG_RSTR | 0x000b0000, MGADWG_RSTR | 0x00070000, MGADWG_RPL | 0x000f0000 }; -Bool +Bool MGAStormAccelInit(ScreenPtr pScreen) -{ +{ ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; switch( pScrn->bitsPerPixel ) @@ -958,34 +1066,37 @@ void -MGAStormSync(ScrnInfoPtr pScrn) +MGAStormSync(ScrnInfoPtr pScrn) { MGAPtr pMga = MGAPTR(pScrn); CHECK_DMA_QUIESCENT(pMga, pScrn); - + while(MGAISBUSY()); /* flush cache before a read (mga-1064g 5.1.6) */ - OUTREG8(MGAREG_CRTC_INDEX, 0); + OUTREG8(MGAREG_CRTC_INDEX, 0); if(pMga->AccelFlags & CLIPPER_ON) { pMga->AccelFlags &= ~CLIPPER_ON; OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); } } -void +void MGAStormEngineInit(ScrnInfoPtr pScrn) { long maccess = 0; MGAPtr pMga = MGAPTR(pScrn); MGAFBLayout *pLayout = &pMga->CurrentLayout; + CARD32 opmode; CHECK_DMA_QUIESCENT(pMga, pScrn); - if ((pMga->Chipset == PCI_CHIP_MGAG100) + if ((pMga->Chipset == PCI_CHIP_MGAG100) || (pMga->Chipset == PCI_CHIP_MGAG100_PCI)) maccess = 1 << 14; - + + opmode = INREG(MGAREG_OPMODE); + switch( pLayout->bitsPerPixel ) { case 8: @@ -997,19 +1108,25 @@ maccess |= (1 << 31); Mga16InitSolidFillRectFuncs(pMga); pMga->RestoreAccelState = Mga16RestoreAccelState; + opmode |= 0x10000; break; case 24: maccess |= 3; Mga24InitSolidFillRectFuncs(pMga); pMga->RestoreAccelState = Mga24RestoreAccelState; + opmode |= 0x20000; break; case 32: maccess |= 2; Mga32InitSolidFillRectFuncs(pMga); pMga->RestoreAccelState = Mga32RestoreAccelState; + opmode |= 0x20000; break; } - +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + opmode &= ~0x30000; +#endif + pMga->fifoCount = 0; while(MGAISBUSY()); @@ -1027,7 +1144,7 @@ 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); @@ -1035,12 +1152,12 @@ OUTREG(MGAREG_FCOL, pMga->FgColor); pMga->BgColor = 0; OUTREG(MGAREG_BCOL, pMga->BgColor); - OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); + OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT | opmode); /* put clipping in a known state */ - OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ - OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ - OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ + OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ + OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ + OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ pMga->AccelFlags &= ~CLIPPER_ON; switch(pMga->Chipset) { @@ -1066,9 +1183,9 @@ CHECK_DMA_QUIESCENT(pMga, pScrn); WAITFIFO(3); - OUTREG(MGAREG_CXBNDRY,(x2 << 16) | x1); - OUTREG(MGAREG_YTOP, (y1 * pScrn->displayWidth) + pMga->YDstOrg); - OUTREG(MGAREG_YBOT, (y2 * pScrn->displayWidth) + pMga->YDstOrg); + OUTREG(MGAREG_CXBNDRY,(x2 << 16) | x1); + OUTREG(MGAREG_YTOP, (y1 * pScrn->displayWidth) + pMga->YDstOrg); + OUTREG(MGAREG_YBOT, (y2 * pScrn->displayWidth) + pMga->YDstOrg); pMga->AccelFlags |= CLIPPER_ON; } @@ -1079,9 +1196,9 @@ CHECK_DMA_QUIESCENT(pMga, pScrn); WAITFIFO(3); - OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ - OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ - OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ + OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ + OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ + OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ pMga->AccelFlags &= ~CLIPPER_ON; } @@ -1095,40 +1212,40 @@ #define BLIT_LEFT 1 #define BLIT_UP 4 -void +void MGANAME(SetupForScreenToScreenCopy)( ScrnInfoPtr pScrn, int xdir, int ydir, int rop, unsigned int planemask, - int trans + int trans ){ MGAPtr pMga = MGAPTR(pScrn); - CARD32 dwgctl = pMga->AtypeNoBLK[rop] | MGADWG_SHIFTZERO | + CARD32 dwgctl = pMga->AtypeNoBLK[rop] | MGADWG_SHIFTZERO | MGADWG_BITBLT | MGADWG_BFCOL; CHECK_DMA_QUIESCENT(pMga, pScrn); - pMga->AccelInfoRec->SubsequentScreenToScreenCopy = + pMga->AccelInfoRec->SubsequentScreenToScreenCopy = MGANAME(SubsequentScreenToScreenCopy); pMga->BltScanDirection = 0; if(ydir == -1) pMga->BltScanDirection |= BLIT_UP; if(xdir == -1) pMga->BltScanDirection |= BLIT_LEFT; - else if(pMga->HasFBitBlt && (rop == GXcopy) && !pMga->DrawTransparent) - pMga->AccelInfoRec->SubsequentScreenToScreenCopy = + else if(pMga->HasFBitBlt && (rop == GXcopy) && !pMga->DrawTransparent) + pMga->AccelInfoRec->SubsequentScreenToScreenCopy = MGANAME(SubsequentScreenToScreenCopy_FastBlit); - if(pMga->DrawTransparent) { + if(pMga->DrawTransparent) { dwgctl |= MGADWG_TRANSC; WAITFIFO(2); SET_FOREGROUND(trans); trans = ~0; SET_BACKGROUND(trans); - } + } - WAITFIFO(4); + WAITFIFO(4); OUTREG(MGAREG_DWGCTL, dwgctl); OUTREG(MGAREG_SGN, pMga->BltScanDirection); SET_PLANEMASK(planemask); @@ -1136,7 +1253,7 @@ } -static void +static void MGANAME(SubsequentScreenToScreenCopy)( ScrnInfoPtr pScrn, int srcX, int srcY, int dstX, int dstY, int w, int h @@ -1159,10 +1276,10 @@ start = end = XYADDRESS(srcX, srcY); if(pMga->BltScanDirection & BLIT_LEFT) start += w; - else end += w; + else end += w; if (pMga->AccelFlags & LARGE_ADDRESSES) { - WAITFIFO(7); + WAITFIFO(7); if(DstOrg) OUTREG(MGAREG_DSTORG, (DstOrg << 6) + pMga->DstOrg); if(SrcOrg != pMga->SrcOrg) { @@ -1181,7 +1298,7 @@ if(DstOrg) OUTREG(MGAREG_DSTORG, pMga->DstOrg); } else { - WAITFIFO(4); + WAITFIFO(4); OUTREG(MGAREG_AR0, end); OUTREG(MGAREG_AR3, start); OUTREG(MGAREG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff)); @@ -1190,7 +1307,7 @@ } -static void +static void MGANAME(SubsequentScreenToScreenCopy_FastBlit)( ScrnInfoPtr pScrn, int srcX, int srcY, int dstX, int dstY, int w, int h @@ -1222,11 +1339,11 @@ if(pMga->MaxFastBlitY) { if(pMga->BltScanDirection & BLIT_UP) { if((srcY >= pMga->MaxFastBlitY) || - (dstY >= pMga->MaxFastBlitY)) + (dstY >= pMga->MaxFastBlitY)) goto FASTBLIT_BAILOUT; } else { if(((srcY + h) > pMga->MaxFastBlitY) || - ((dstY + h) > pMga->MaxFastBlitY)) + ((dstY + h) > pMga->MaxFastBlitY)) goto FASTBLIT_BAILOUT; } } @@ -1241,7 +1358,7 @@ if((dstX & (1 << 5)) && (((fxright >> 5) - (dstX >> 5)) & 7) == 7) { fxright |= 1 << 5; #elif PSZ == 24 - if(((dstX * 3) & (1 << 6)) && + if(((dstX * 3) & (1 << 6)) && ((((fxright * 3 + 2) >> 6) - ((dstX * 3) >> 6)) & 7) == 7) { fxright = ((fxright * 3 + 2) | (1 << 6)) / 3; #elif PSZ == 32 @@ -1255,39 +1372,39 @@ OUTREG(MGAREG_AR3, start); OUTREG(MGAREG_FXBNDRY, (fxright << 16) | (dstX & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dstY << 16) | h); - OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] | + OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] | MGADWG_SHIFTZERO | MGADWG_BITBLT | MGADWG_BFCOL); OUTREG(MGAREG_CXRIGHT, 0xFFFF); return; } /* } } } (preserve pairs for pair matching) */ } - - WAITFIFO(6); + + WAITFIFO(6); OUTREG(MGAREG_DWGCTL, 0x040A400C); OUTREG(MGAREG_AR0, end); OUTREG(MGAREG_AR3, start); OUTREG(MGAREG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dstY << 16) | h); - OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] | MGADWG_SHIFTZERO | + OUTREG(MGAREG_DWGCTL, pMga->AtypeNoBLK[GXcopy] | MGADWG_SHIFTZERO | MGADWG_BITBLT | MGADWG_BFCOL); return; - } + } FASTBLIT_BAILOUT: - - WAITFIFO(4); + + WAITFIFO(4); OUTREG(MGAREG_AR0, end); OUTREG(MGAREG_AR3, start); OUTREG(MGAREG_FXBNDRY, ((dstX + w) << 16) | (dstX & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (dstY << 16) | h); } + - /******************\ | Solid Fills | \******************/ -void +void MGANAME(SetupForSolidFill)( ScrnInfoPtr pScrn, int color, @@ -1300,28 +1417,28 @@ #if PSZ == 24 if(!RGBEQUAL(color)) - pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO | - MGADWG_SGNZERO | MGADWG_SHIFTZERO | + pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO | + MGADWG_SGNZERO | MGADWG_SHIFTZERO | MGADWG_BMONOLEF | pMga->AtypeNoBLK[rop]; else #endif - pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO | - MGADWG_SGNZERO | MGADWG_SHIFTZERO | + pMga->FilledRectCMD = MGADWG_TRAP | MGADWG_SOLID | MGADWG_ARZERO | + MGADWG_SGNZERO | MGADWG_SHIFTZERO | MGADWG_BMONOLEF | pMga->Atype[rop]; - pMga->SolidLineCMD = MGADWG_SOLID | MGADWG_SHIFTZERO | MGADWG_BFCOL | + pMga->SolidLineCMD = MGADWG_SOLID | MGADWG_SHIFTZERO | MGADWG_BFCOL | pMga->AtypeNoBLK[rop]; - if(pMga->AccelFlags & TRANSC_SOLID_FILL) + if(pMga->AccelFlags & TRANSC_SOLID_FILL) pMga->FilledRectCMD |= MGADWG_TRANSC; WAITFIFO(3); SET_FOREGROUND(color); SET_PLANEMASK(planemask); OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD); -} +} -static void +static void MGANAME(SubsequentSolidFillRect)( ScrnInfoPtr pScrn, int x, int y, int w, int h ) @@ -1331,10 +1448,10 @@ WAITFIFO(2); OUTREG(MGAREG_FXBNDRY, ((x + w) << 16) | (x & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); -} +} -static void -MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, +static void +MGANAME(SubsequentSolidFillTrap)(ScrnInfoPtr pScrn, int y, int h, int left, int dxL, int dyL, int eL, int right, int dxR, int dyR, int eR ) { @@ -1345,7 +1462,7 @@ int ar5 = sdxr? dxR : -dxR; WAITFIFO(11); - OUTREG(MGAREG_DWGCTL, + OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD & ~(MGADWG_ARZERO | MGADWG_SGNZERO)); OUTREG(MGAREG_AR0, dyL); OUTREG(MGAREG_AR1, ar2 - eL); @@ -1364,10 +1481,10 @@ \***************/ -static void +static void MGANAME(SubsequentSolidHorVertLine) ( ScrnInfoPtr pScrn, - int x, int y, + int x, int y, int len, int dir ){ MGAPtr pMga = MGAPTR(pScrn); @@ -1385,12 +1502,12 @@ OUTREG(MGAREG_DWGCTL, pMga->SolidLineCMD | MGADWG_AUTOLINE_OPEN); OUTREG(MGAREG_XYSTRT, (y << 16) | (x & 0xffff)); OUTREG(MGAREG_XYEND + MGAREG_EXEC, ((y + len) << 16) | (x & 0xffff)); - OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD); + OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD); } } -static void +static void MGANAME(SubsequentSolidTwoPointLine)( ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags @@ -1398,11 +1515,11 @@ MGAPtr pMga = MGAPTR(pScrn); WAITFIFO(4); - OUTREG(MGAREG_DWGCTL, pMga->SolidLineCMD | + OUTREG(MGAREG_DWGCTL, pMga->SolidLineCMD | ((flags & OMIT_LAST) ? MGADWG_AUTOLINE_OPEN : MGADWG_AUTOLINE_CLOSE)); OUTREG(MGAREG_XYSTRT, (y1 << 16) | (x1 & 0xFFFF)); OUTREG(MGAREG_XYEND + MGAREG_EXEC, (y2 << 16) | (x2 & 0xFFFF)); - OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD); + OUTREG(MGAREG_DWGCTL, pMga->FilledRectCMD); } @@ -1412,7 +1529,7 @@ \***************************/ -static void +static void MGANAME(SetupForMono8x8PatternFill)( ScrnInfoPtr pScrn, int patx, int paty, @@ -1425,12 +1542,12 @@ CHECK_DMA_QUIESCENT(pMga, pScrn); - pMga->PatternRectCMD = MGADWG_TRAP | MGADWG_ARZERO | MGADWG_SGNZERO | + pMga->PatternRectCMD = MGADWG_TRAP | MGADWG_ARZERO | MGADWG_SGNZERO | MGADWG_BMONOLEF; - infoRec->SubsequentMono8x8PatternFillRect = + infoRec->SubsequentMono8x8PatternFillRect = MGANAME(SubsequentMono8x8PatternFillRect); - + if(bg == -1) { #if PSZ == 24 if(!RGBEQUAL(fg)) @@ -1442,9 +1559,9 @@ WAITFIFO(5); } else { #if PSZ == 24 - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && RGBEQUAL(fg) && RGBEQUAL(bg)) + if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && RGBEQUAL(fg) && RGBEQUAL(bg)) #else - if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) + if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) #endif pMga->PatternRectCMD |= pMga->Atype[rop]; else @@ -1462,7 +1579,7 @@ -static void +static void MGANAME(SubsequentMono8x8PatternFillRect)( ScrnInfoPtr pScrn, int patx, int paty, @@ -1474,11 +1591,11 @@ OUTREG(MGAREG_SHIFT, (paty << 4) | patx); OUTREG(MGAREG_FXBNDRY, ((x + w) << 16) | (x & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); - pMga->AccelInfoRec->SubsequentMono8x8PatternFillRect = + pMga->AccelInfoRec->SubsequentMono8x8PatternFillRect = MGANAME(SubsequentMono8x8PatternFillRect_Additional); } -static void +static void MGANAME(SubsequentMono8x8PatternFillRect_Additional)( ScrnInfoPtr pScrn, int patx, int paty, @@ -1492,12 +1609,12 @@ } -static void +static void MGANAME(SubsequentMono8x8PatternFillTrap)( ScrnInfoPtr pScrn, - int patx, int paty, - int y, int h, - int left, int dxL, int dyL, int eL, + int patx, int paty, + int y, int h, + int left, int dxL, int dyL, int eL, int right, int dxR, int dyR, int eR ){ MGAPtr pMga = MGAPTR(pScrn); @@ -1509,7 +1626,7 @@ WAITFIFO(12); OUTREG(MGAREG_SHIFT, (paty << 4) | patx); - OUTREG(MGAREG_DWGCTL, + OUTREG(MGAREG_DWGCTL, pMga->PatternRectCMD & ~(MGADWG_ARZERO | MGADWG_SGNZERO)); OUTREG(MGAREG_AR0, dyL); OUTREG(MGAREG_AR1, ar2 - eL); @@ -1528,7 +1645,7 @@ \***********************/ -static void +static void MGANAME(SetupForScanlineCPUToScreenColorExpandFill)( ScrnInfoPtr pScrn, int fg, int bg, @@ -1536,7 +1653,7 @@ unsigned int planemask ) { MGAPtr pMga = MGAPTR(pScrn); - CARD32 mgaCMD = MGADWG_ILOAD | MGADWG_LINEAR | MGADWG_SGNZERO | + CARD32 mgaCMD = MGADWG_ILOAD | MGADWG_LINEAR | MGADWG_SGNZERO | MGADWG_SHIFTZERO | MGADWG_BMONOLEF; CHECK_DMA_QUIESCENT(pMga, pScrn); @@ -1552,10 +1669,10 @@ WAITFIFO(3); } else { #if PSZ == 24 - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && - RGBEQUAL(fg) && RGBEQUAL(bg)) + if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && + RGBEQUAL(fg) && RGBEQUAL(bg)) #else - if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) + if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) #endif mgaCMD |= pMga->Atype[rop]; else @@ -1567,9 +1684,9 @@ SET_FOREGROUND(fg); SET_PLANEMASK(planemask); OUTREG(MGAREG_DWGCTL, mgaCMD); -} +} -static void +static void MGANAME(SubsequentScanlineCPUToScreenColorExpandFill)( ScrnInfoPtr pScrn, int x, int y, int w, int h, @@ -1599,7 +1716,12 @@ OUTREG(MGAREG_FXBNDRY, ((x + w - 1) << 16) | (x & 0xFFFF)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | h); - if(pMga->expandDWORDs > pMga->FifoSize) { +#if defined(__alpha__) + if(1) /* force indirect always on Alpha */ +#else + if(pMga->expandDWORDs > pMga->FifoSize) +#endif + { pMga->AccelInfoRec->SubsequentColorExpandScanline = MGANAME(SubsequentColorExpandScanlineIndirect); pMga->AccelInfoRec->ScanlineColorExpandBuffers = @@ -1621,23 +1743,23 @@ MGAPtr pMga = MGAPTR(pScrn); int dwords = pMga->expandDWORDs; CARD32 *src = (CARD32*)(pMga->ScratchBuffer); - + while(dwords > pMga->FifoSize) { WAITFIFO(pMga->FifoSize); - XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize); + MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize); src += pMga->FifoSize; dwords -= pMga->FifoSize; } - + WAITFIFO(dwords); - XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords); + MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords); if(!(--pMga->expandRows)) { if(pMga->expandRemaining) { WAITFIFO(3); OUTREG(MGAREG_AR0,((pMga->expandDWORDs<< 5)*pMga->expandHeight)-1); OUTREG(MGAREG_AR3, 0); /* crashes occasionally without this */ - OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pMga->expandY << 16) | + OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pMga->expandY << 16) | pMga->expandHeight); pMga->expandY += pMga->expandHeight; pMga->expandRows = pMga->expandHeight; @@ -1661,7 +1783,7 @@ WAITFIFO(3); OUTREG(MGAREG_AR0,((pMga->expandDWORDs<<5)*pMga->expandHeight)-1); OUTREG(MGAREG_AR3, 0); /* crashes occasionally without this */ - OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pMga->expandY << 16) | + OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pMga->expandY << 16) | pMga->expandHeight); pMga->expandY += pMga->expandHeight; pMga->expandRows = pMga->expandHeight; @@ -1678,7 +1800,7 @@ \*******************/ -static void MGANAME(SetupForScanlineImageWrite)( +static void MGANAME(SetupForScanlineImageWrite)( ScrnInfoPtr pScrn, int rop, unsigned int planemask, @@ -1726,13 +1848,13 @@ while(dwords > pMga->FifoSize) { WAITFIFO(pMga->FifoSize); - XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize); + MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, pMga->FifoSize); src += pMga->FifoSize; dwords -= pMga->FifoSize; } WAITFIFO(dwords); - XAAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords); + MGAMoveDWORDS((CARD32*)(pMga->ColorExpandBase), src, dwords); if(!(--pMga->expandRows)) { DISABLE_CLIP(); @@ -1747,7 +1869,7 @@ void MGANAME(SetupForDashedLine)( - ScrnInfoPtr pScrn, + ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask, int length, @@ -1782,7 +1904,7 @@ case 4: NiceDashPattern |= NiceDashPattern << 4; case 8: NiceDashPattern |= byte_reversed[NiceDashPattern] << 16; NiceDashPattern |= NiceDashPattern << 8; - pMga->NiceDashCMD = MGADWG_TRAP | MGADWG_ARZERO | + pMga->NiceDashCMD = MGADWG_TRAP | MGADWG_ARZERO | MGADWG_SGNZERO | MGADWG_BMONOLEF; pMga->AccelFlags |= NICE_DASH_PATTERN; if(bg == -1) { @@ -1794,10 +1916,10 @@ pMga->NiceDashCMD |= MGADWG_TRANSC | pMga->Atype[rop]; } else { #if PSZ == 24 - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && - RGBEQUAL(fg) && RGBEQUAL(bg)) + if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && + RGBEQUAL(fg) && RGBEQUAL(bg)) #else - if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) + if(pMga->AccelFlags & BLK_OPAQUE_EXPANSION) #endif pMga->NiceDashCMD |= pMga->Atype[rop]; else @@ -1818,8 +1940,8 @@ void MGANAME(SubsequentDashedTwoPointLine)( - ScrnInfoPtr pScrn, - int x1, int y1, int x2, int y2, + ScrnInfoPtr pScrn, + int x1, int y1, int x2, int y2, int flags, int phase ){ MGAPtr pMga = MGAPTR(pScrn); @@ -1829,20 +1951,20 @@ OUTREG(MGAREG_DWGCTL, pMga->NiceDashCMD); if(x2 < x1) { if(flags & OMIT_LAST) x2++; - OUTREG(MGAREG_SHIFT, ((-y1 & 0x07) << 4) | - ((7 - phase - x1) & 0x07)); + OUTREG(MGAREG_SHIFT, ((-y1 & 0x07) << 4) | + ((7 - phase - x1) & 0x07)); OUTREG(MGAREG_FXBNDRY, ((x1 + 1) << 16) | (x2 & 0xffff)); } else { if(!flags) x2++; - OUTREG(MGAREG_SHIFT, (((1 - y1) & 0x07) << 4) | - ((phase - x1) & 0x07)); + OUTREG(MGAREG_SHIFT, (((1 - y1) & 0x07) << 4) | + ((phase - x1) & 0x07)); OUTREG(MGAREG_FXBNDRY, (x2 << 16) | (x1 & 0xffff)); - } + } OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y1 << 16) | 1); } else { - OUTREG(MGAREG_SHIFT, (pMga->StyleLen << 16 ) | - (pMga->StyleLen - phase)); - OUTREG(MGAREG_DWGCTL, pMga->DashCMD | ((flags & OMIT_LAST) ? + OUTREG(MGAREG_SHIFT, (pMga->StyleLen << 16 ) | + (pMga->StyleLen - phase)); + OUTREG(MGAREG_DWGCTL, pMga->DashCMD | ((flags & OMIT_LAST) ? MGADWG_AUTOLINE_OPEN : MGADWG_AUTOLINE_CLOSE)); OUTREG(MGAREG_XYSTRT, (y1 << 16) | (x1 & 0xFFFF)); OUTREG(MGAREG_XYEND + MGAREG_EXEC, (y2 << 16) | (x2 & 0xFFFF)); @@ -1856,15 +1978,15 @@ | Planar Screen to Screen Color Expansion | \******************************************/ -static void +static void MGANAME(SetupForPlanarScreenToScreenColorExpandFill)( ScrnInfoPtr pScrn, - int fg, int bg, + int fg, int bg, int rop, unsigned int planemask ){ MGAPtr pMga = MGAPTR(pScrn); - CARD32 mgaCMD = pMga->AtypeNoBLK[rop] | MGADWG_BITBLT | + CARD32 mgaCMD = pMga->AtypeNoBLK[rop] | MGADWG_BITBLT | MGADWG_SGNZERO | MGADWG_BPLAN; CHECK_DMA_QUIESCENT(pMga, pScrn); @@ -1883,11 +2005,11 @@ OUTREG(MGAREG_DWGCTL, mgaCMD); } -static void +static void MGANAME(SubsequentPlanarScreenToScreenColorExpandFill)( ScrnInfoPtr pScrn, int x, int y, int w, int h, - int srcx, int srcy, + int srcx, int srcy, int skipleft ){ MGAPtr pMga = MGAPTR(pScrn); @@ -1910,10 +2032,10 @@ | Screen to Screen Color Expansion | \***********************************/ -static void +static void MGANAME(SetupForScreenToScreenColorExpandFill)( ScrnInfoPtr pScrn, - int fg, int bg, + int fg, int bg, int rop, unsigned int planemask ){ @@ -1933,10 +2055,10 @@ WAITFIFO(4); } else { #if PSZ == 24 - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && - RGBEQUAL(fg) && RGBEQUAL(bg)) + if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION) && + RGBEQUAL(fg) && RGBEQUAL(bg)) #else - if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION)) + if((pMga->AccelFlags & BLK_OPAQUE_EXPANSION)) #endif mgaCMD |= pMga->Atype[rop]; else @@ -1952,11 +2074,11 @@ } -static void +static void MGANAME(SubsequentScreenToScreenColorExpandFill)( ScrnInfoPtr pScrn, int x, int y, int w, int h, - int srcx, int srcy, + int srcx, int srcy, int skipleft ){ MGAPtr pMga = MGAPTR(pScrn); @@ -2004,10 +2126,10 @@ OUTREG(MGAREG_AR0, start + num); OUTREG(MGAREG_FXBNDRY, ((x + num) << 16) | (x & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | 1); - + OUTREG(MGAREG_AR3, next); OUTREG(MGAREG_AR0, start + w ); - OUTREG(MGAREG_FXBNDRY + MGAREG_EXEC, ((x + w) << 16) | + OUTREG(MGAREG_FXBNDRY + MGAREG_EXEC, ((x + w) << 16) | ((x + num + 1) & 0xffff)); start += pitch; h--; y++; @@ -2022,7 +2144,7 @@ OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (y << 16) | num); start += num * pitch; - h -= num; y += num; + h -= num; y += num; } } } @@ -2056,7 +2178,7 @@ if(nBox & 1) { OUTREG(MGAREG_FXBNDRY, ((pBox->x2) << 16) | (pBox->x1 & 0xffff)); - OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, + OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pBox->y1 << 16) | (pBox->y2 - pBox->y1)); nBox--; pBox++; } @@ -2075,7 +2197,7 @@ pBox++; base += 5; nBox -= 2; } - OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); + OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); } void @@ -2085,7 +2207,7 @@ unsigned int planemask, int n, DDXPointPtr ppt, - int *pwidth, int fSorted + int *pwidth, int fSorted ){ MGAPtr pMga = MGAPTR(pScrn); XAAInfoRecPtr infoRec = pMga->AccelInfoRec; @@ -2093,14 +2215,14 @@ CHECK_DMA_QUIESCENT(pMga, pScrn); SET_SYNC_FLAG(infoRec); - + if(infoRec->ClipBox) { OUTREG(MGAREG_CXBNDRY, - ((infoRec->ClipBox->x2 - 1) << 16) | infoRec->ClipBox->x1); - OUTREG(MGAREG_YTOP, - (infoRec->ClipBox->y1 * pScrn->displayWidth) + pMga->YDstOrg); - OUTREG(MGAREG_YBOT, - ((infoRec->ClipBox->y2 - 1) * pScrn->displayWidth) + pMga->YDstOrg); + ((infoRec->ClipBox->x2 - 1) << 16) | infoRec->ClipBox->x1); + OUTREG(MGAREG_YTOP, + (infoRec->ClipBox->y1 * pScrn->displayWidth) + pMga->YDstOrg); + OUTREG(MGAREG_YBOT, + ((infoRec->ClipBox->y2 - 1) * pScrn->displayWidth) + pMga->YDstOrg); } (*infoRec->SetupForSolidFill)(pScrn, fg, rop, planemask); @@ -2126,13 +2248,13 @@ ppt++; base += 5; n -= 2; } - OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); + OUTREG(MGAREG_OPMODE, MGAOPM_DMA_BLIT); } if(infoRec->ClipBox) { - OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ - OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ - OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ + OUTREG(MGAREG_CXBNDRY, 0xFFFF0000); /* (maxX << 16) | minX */ + OUTREG(MGAREG_YTOP, 0x00000000); /* minPixelPointer */ + OUTREG(MGAREG_YBOT, 0x007FFFFF); /* maxPixelPointer */ } } @@ -2173,7 +2295,7 @@ while(nBox--) { WAITFIFO(2); OUTREG(MGAREG_FXBNDRY, ((pBox->x2) << 16) | (pBox->x1 & 0xffff)); - OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, + OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (pBox->y1 << 16) | (pBox->y2 - pBox->y1)); pBox++; } @@ -2200,17 +2322,17 @@ MGAPtr pMga = MGAPTR(pScrn); Bool fullPlanemask = TRUE; - if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) != + if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) != pMga->AccelInfoRec->FullPlanemask) { if(pMga->AccelFlags & MGA_NO_PLANEMASK) return; - fullPlanemask = FALSE; + fullPlanemask = FALSE; } - if(!pGC->lineWidth && + if(!pGC->lineWidth && (pGC->fillStyle == FillSolid) && (pGC->lineStyle == LineSolid) && - ((pGC->alu != GXcopy) || !fullPlanemask)) + ((pGC->alu != GXcopy) || !fullPlanemask)) { pGC->ops->PolyArc = MGAPolyArcThinSolid; } @@ -2220,7 +2342,7 @@ MGAPolyPoint ( DrawablePtr pDraw, GCPtr pGC, - int mode, + int mode, int npt, xPoint *ppt ){ @@ -2231,7 +2353,7 @@ int xorg, yorg; if(!numRects) return; - + if(numRects != 1) { XAAFallbackOps.PolyPoint(pDraw, pGC, mode, npt, ppt); return; @@ -2257,7 +2379,7 @@ OUTREG(MGAREG_FXBNDRY, ((xorg + 1) << 16) | (xorg & 0xffff)); OUTREG(MGAREG_YDSTLEN + MGAREG_EXEC, (yorg << 16) | 1); ppt++; - } + } } else { int x; while(npt--) { @@ -2268,9 +2390,9 @@ ppt++; } } - + (*infoRec->DisableClipping)(infoRec->pScrn); - + SET_SYNC_FLAG(infoRec); } @@ -2287,11 +2409,11 @@ pGC->ops->PolyPoint = XAAFallbackOps.PolyPoint; - if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) != + if((pGC->planemask & pMga->AccelInfoRec->FullPlanemask) != pMga->AccelInfoRec->FullPlanemask) { if(pMga->AccelFlags & MGA_NO_PLANEMASK) return; - fullPlanemask = FALSE; + fullPlanemask = FALSE; } if((pGC->alu != GXcopy) || !fullPlanemask) @@ -2299,7 +2421,7 @@ } -void +void MGAFillCacheBltRects( ScrnInfoPtr pScrn, int rop, @@ -2328,11 +2450,11 @@ start = phaseY ? (pCache->orig_h - phaseY) : 0; /* This is optimized for WRAM */ - - if ((rop == GXcopy) && (height >= (pCache->orig_h + start))) { + + if ((rop == GXcopy) && (height >= (pCache->orig_h + start))) { w = width; skipleft = phaseX; x = pBox->x1; blit_h = pCache->orig_h; - + while(1) { blit_w = pCache->w - skipleft; if(blit_w > w) blit_w = w; @@ -2353,7 +2475,7 @@ y += start; } start = blit_h; - + while(height) { if(blit_h > height) blit_h = height; (*infoRec->SubsequentScreenToScreenCopy)(pScrn, @@ -2368,7 +2490,7 @@ w = width; skipleft = phaseX; x = pBox->x1; blit_h = pCache->h - phaseY; if(blit_h > height) blit_h = height; - + while(1) { blit_w = pCache->w - skipleft; if(blit_w > w) blit_w = w; @@ -2388,7 +2510,7 @@ } pBox++; } - + SET_SYNC_FLAG(infoRec); } @@ -2400,7 +2522,7 @@ { ScreenPtr pScreen = pWin->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(pScrn); BoxPtr pbox = REGION_RECTS(prgn); int nbox = REGION_NUM_RECTS(prgn); @@ -2418,7 +2540,7 @@ } MGASelectBuffer(pScrn, MGA_FRONT); - pMGA->AccelInfoRec->NeedToSync = TRUE; + pMga->AccelInfoRec->NeedToSync = TRUE; } /* @@ -2427,14 +2549,14 @@ instead of destination. My origin is upside down so the ydir cases are reversed. */ - + void -MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, +MGANAME(DRIMoveBuffers)(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index) { ScreenPtr pScreen = pParent->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); + MGAPtr pMga = MGAPTR(pScrn); int nbox; BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; DDXPointPtr pptTmp, pptNew1, pptNew2; @@ -2511,7 +2633,7 @@ } pboxBase = pboxNext = pbox; while (pboxBase < pbox+nbox) { - while ((pboxNext < pbox+nbox) && + while ((pboxNext < pbox+nbox) && (pboxNext->y1 == pboxBase->y1)) pboxNext++; pboxTmp = pboxNext; @@ -2531,9 +2653,9 @@ /* No changes are needed */ xdir = 1; } - + MGANAME(SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, -1, -1); - for ( ; nbox-- ; pbox++) + for ( ; nbox-- ; pbox++) { int x1 = pbox->x1; int y1 = pbox->y1; @@ -2542,7 +2664,7 @@ int w = pbox->x2 - x1 + 1; int h = pbox->y2 - y1 + 1; - if ( destx < 0 ) x1 -= destx, w += destx, destx = 0; + if ( destx < 0 ) x1 -= destx, w += destx, destx = 0; if ( desty < 0 ) y1 -= desty, h += desty, desty = 0; if ( destx + w > screenwidth ) w = screenwidth - destx; if ( desty + h > screenheight ) h = screenheight - desty; @@ -2550,10 +2672,10 @@ if ( h <= 0 ) continue; MGASelectBuffer(pScrn, MGA_BACK); - MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1, y1, + MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1, y1, destx,desty, w, h); MGASelectBuffer(pScrn, MGA_DEPTH); - MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1,y1, + MGANAME(SubsequentScreenToScreenCopy)(pScrn, x1,y1, destx,desty, w, h); } MGASelectBuffer(pScrn, MGA_FRONT); @@ -2567,8 +2689,7 @@ DEALLOCATE_LOCAL(pboxNew1); } - pMGA->AccelInfoRec->NeedToSync = TRUE; + pMga->AccelInfoRec->NeedToSync = TRUE; } - -#endif /* XF86DRI */ +#endif /* XF86DRI */ Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c:1.21 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c:1.24.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c:1.21 Tue Dec 5 15:03:45 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c Thu May 31 22:24:18 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.21 2000/12/05 20:03:45 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_video.c,v 1.24.2.1 2001/06/01 02:24:18 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -164,10 +164,6 @@ XVIMAGE_UYVY }; -#define outMGAdreg(reg, val) OUTREG8(RAMDAC_OFFSET + (reg), val) -#define outMGAdac(reg, val) \ - (outMGAdreg(MGA1064_INDEX, reg), outMGAdreg(MGA1064_DATA, val)) - static void MGAResetVideoOverlay(ScrnInfoPtr pScrn) { @@ -681,7 +677,7 @@ short drw_w, short drw_h ){ MGAPtr pMga = MGAPTR(pScrn); - int tmp; + int tmp, hzoom, intrep; CHECK_DMA_QUIESCENT(pMga, pScrn); @@ -690,22 +686,25 @@ if(tmp > pScrn->currentMode->VDisplay) tmp -= pScrn->currentMode->VDisplay; + /* enable accelerated 2x horizontal zoom when pixelclock >135MHz */ + hzoom = (pScrn->currentMode->Clock > 135000) ? 1 : 0; + 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; } OUTREG(MGAREG_BESA1ORG, offset); if(y1 & 0x00010000) - OUTREG(MGAREG_BESCTL, 0x00050c41); + OUTREG(MGAREG_BESCTL, 0x00040c41); else - OUTREG(MGAREG_BESCTL, 0x00050c01); + OUTREG(MGAREG_BESCTL, 0x00040c01); OUTREG(MGAREG_BESHCOORD, (dstBox->x1 << 16) | (dstBox->x2 - 1)); OUTREG(MGAREG_BESVCOORD, (dstBox->y1 << 16) | (dstBox->y2 - 1)); @@ -719,12 +718,14 @@ OUTREG(MGAREG_BESV1WGHT, y1 & 0x0000fffc); OUTREG(MGAREG_BESV1SRCLST, height - 1 - (y1 >> 16)); - tmp = ((src_h - 1) << 16)/drw_h; + intrep = ((drw_h == src_h) || (drw_h < 2)) ? 0 : 1; + tmp = ((src_h - intrep) << 16)/(drw_h - intrep); if(tmp >= (32 << 16)) tmp = (32 << 16) - 1; OUTREG(MGAREG_BESVISCAL, tmp & 0x001ffffc); - tmp = (((src_w - 1) << 16)/drw_w) << 1; + intrep = ((drw_w == src_w) || (drw_w < 2)) ? 0 : 1; + tmp = (((src_w - intrep) << 16)/(drw_w - intrep)) << hzoom; if(tmp >= (32 << 16)) tmp = (32 << 16) - 1; OUTREG(MGAREG_BESHISCAL, tmp & 0x001ffffc); Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c:1.5 Thu Nov 2 14:10:53 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c Mon Jun 4 12:40:58 2001 @@ -1,200 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_warp.c,v 1.5 2000/11/02 19:10:53 dawes Exp $ */ - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86Resources.h" -#include "xf86_ansic.h" -#include "compiler.h" -#include "xf86PciInfo.h" -#include "xf86Pci.h" -#include "mga_bios.h" -#include "mga_reg.h" -#include "mga.h" -#include "mga_macros.h" -#include "mgareg_flags.h" -#include "mga_ucode.h" -#include "mga_dri.h" - -Bool mgaConfigureWarp(ScrnInfoPtr pScrn) -{ - MGAPtr pMga = MGAPTR(pScrn); - int wmisc; - - CHECK_DMA_QUIESCENT(pMga, pScrn); - WAITFIFO(3); - - switch(pMga->Chipset) { - case PCI_CHIP_MGAG400: - OUTREG(MGAREG_WIADDR2, WIA_wmode_suspend); - OUTREG(MGAREG_WGETMSB, 0x00000E00); - OUTREG(MGAREG_WVRTXSZ, 0x00001807); - OUTREG(MGAREG_WACCEPTSEQ, 0x18000000); - break; - case PCI_CHIP_MGAG200: - case PCI_CHIP_MGAG200_PCI: - OUTREG(MGAREG_WIADDR, WIA_wmode_suspend); - OUTREG(MGAREG_WGETMSB, 0x1606); - OUTREG(MGAREG_WVRTXSZ, 7); /* may be set on something else later on */ - break; - default: - return FALSE; - } - - WAITFIFO(1); - OUTREG(MGAREG_WMISC, WM_wucodecache_enable | - WM_wmaster_enable | - WM_wcacheflush_enable); - wmisc = INREG(MGAREG_WMISC); - if (wmisc != (WM_wucodecache_enable | WM_wmaster_enable)) { - FatalError("[mga] WARP engine wrongly configured (%d != %d)." - " Switch off your PC and try again.\n", wmisc, - WM_wmaster_enable | WM_wucodecache_enable); - } - return TRUE; -} - -static unsigned int mgaG400GetMicrocodeSize(MGAPtr pMGA) -{ -#define CODESIZE(which) ((sizeof(which)/256 + 1)*256) - unsigned int microcode_size = 0; - - microcode_size = CODESIZE(WARP_G400_t2gz) + CODESIZE(WARP_G400_t2gza) + - CODESIZE(WARP_G400_t2gzaf) + CODESIZE(WARP_G400_t2gzf) + - CODESIZE(WARP_G400_t2gzs) + CODESIZE(WARP_G400_t2gzsa) + - CODESIZE(WARP_G400_t2gzsaf) + CODESIZE(WARP_G400_t2gzsf) + - CODESIZE(WARP_G400_tgz) + CODESIZE(WARP_G400_tgza) + - CODESIZE(WARP_G400_tgzaf) + CODESIZE(WARP_G400_tgzf) + - CODESIZE(WARP_G400_tgzs) + CODESIZE(WARP_G400_tgzsa) + - CODESIZE(WARP_G400_tgzsaf) + CODESIZE(WARP_G400_tgzsf); - microcode_size = ((microcode_size + 4096 - 1) / 4096) * 4096; - return(microcode_size); -#undef CODESIZE -} - -static unsigned int mgaG200GetMicrocodeSize(MGAPtr pMGA) -{ -#define CODESIZE(which) ((sizeof(which)/256 + 1)*256) - unsigned int microcode_size; - - microcode_size = CODESIZE(WARP_G200_tgz) + - CODESIZE(WARP_G200_tgza) + CODESIZE(WARP_G200_tgzaf) + - CODESIZE(WARP_G200_tgzf) + CODESIZE(WARP_G200_tgzs) + - CODESIZE(WARP_G200_tgzsa) + CODESIZE(WARP_G200_tgzsaf) + - CODESIZE(WARP_G200_tgzsf); - microcode_size = ((microcode_size + 4096 - 1) / 4096) * 4096; - return(microcode_size); -#undef CODESIZE -} - -static unsigned int mgaG400InstallMicrocode(MGAPtr pMGA, int agp_offset) -{ -#define mgaWarpInstallCode(which, where) {\ - pMGADRIServer->WarpIndex[where].installed = 1; \ - pMGADRIServer->WarpIndex[where].phys_addr = pcbase; \ - pMGADRIServer->WarpIndex[where].size = sizeof(WARP_G400_ ## which); \ - memcpy(vcbase, WARP_G400_ ## which, sizeof(WARP_G400_ ## which)); \ - pcbase += (sizeof(WARP_G400_ ## which) / 256 + 1) * 256; \ - vcbase += (sizeof(WARP_G400_ ## which) / 256 + 1) * 256; \ - } - MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo; - CARD8 *vcbase = pMGADRIServer->agp_map + agp_offset; - unsigned long pcbase = (unsigned long)pMGADRIServer->agpBase + agp_offset; - unsigned int microcode_size = 0; - - memset(pMGADRIServer->WarpIndex, 0, - sizeof(drmMgaWarpIndex) * MGA_MAX_WARP_PIPES); - - microcode_size = mgaG400GetMicrocodeSize(pMGA); - mgaWarpInstallCode(tgz, MGA_WARP_TGZ); - mgaWarpInstallCode(tgzf, MGA_WARP_TGZF); - mgaWarpInstallCode(tgza, MGA_WARP_TGZA); - mgaWarpInstallCode(tgzaf, MGA_WARP_TGZAF); - mgaWarpInstallCode(tgzs, MGA_WARP_TGZS); - mgaWarpInstallCode(tgzsf, MGA_WARP_TGZSF); - mgaWarpInstallCode(tgzsa, MGA_WARP_TGZSA); - mgaWarpInstallCode(tgzsaf, MGA_WARP_TGZSAF); - mgaWarpInstallCode(t2gz, MGA_WARP_T2GZ); - mgaWarpInstallCode(t2gzf, MGA_WARP_T2GZF); - mgaWarpInstallCode(t2gza, MGA_WARP_T2GZA); - mgaWarpInstallCode(t2gzaf, MGA_WARP_T2GZAF); - mgaWarpInstallCode(t2gzs, MGA_WARP_T2GZS); - mgaWarpInstallCode(t2gzsf, MGA_WARP_T2GZSF); - mgaWarpInstallCode(t2gzsa, MGA_WARP_T2GZSA); - mgaWarpInstallCode(t2gzsaf, MGA_WARP_T2GZSAF); -#undef mgaWarpInstallCode - return microcode_size; -} - -static unsigned int mgaG200InstallMicrocode(MGAPtr pMGA, int agp_offset) -{ -#define mgaWarpInstallCode(which,where) {\ - pMGADRIServer->WarpIndex[where].installed = 1; \ - pMGADRIServer->WarpIndex[where].phys_addr = pcbase; \ - pMGADRIServer->WarpIndex[where].size = sizeof(WARP_G200_ ## which); \ - memcpy(vcbase, WARP_G200_ ## which, sizeof(WARP_G200_ ## which)); \ - pcbase += (sizeof(WARP_G200_ ## which) / 256 + 1) * 256; \ - vcbase += (sizeof(WARP_G200_ ## which) / 256 + 1) * 256; \ - } - MGADRIServerPrivatePtr pMGADRIServer = pMGA->DRIServerInfo; - CARD8 *vcbase = pMGADRIServer->agp_map + agp_offset; - unsigned long pcbase = (unsigned long)pMGADRIServer->agpBase + agp_offset; - unsigned int microcode_size = 0; - - memset(pMGADRIServer->WarpIndex, 0, - sizeof(drmMgaWarpIndex) * MGA_MAX_WARP_PIPES); - - microcode_size = mgaG400GetMicrocodeSize(pMGA); - mgaWarpInstallCode(tgz, MGA_WARP_TGZ); - mgaWarpInstallCode(tgza, MGA_WARP_TGZA); - mgaWarpInstallCode(tgzaf, MGA_WARP_TGZAF); - mgaWarpInstallCode(tgzf, MGA_WARP_TGZF); - mgaWarpInstallCode(tgzs, MGA_WARP_TGZS); - mgaWarpInstallCode(tgzsa, MGA_WARP_TGZSA); - mgaWarpInstallCode(tgzsaf, MGA_WARP_TGZSAF); - mgaWarpInstallCode(tgzsf, MGA_WARP_TGZSF); -#undef mgaWarpInstallCode - return microcode_size; -} - -unsigned int mgaGetMicrocodeSize(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); - int retval; - - switch(pMGA->Chipset) { - case PCI_CHIP_MGAG400: - retval = mgaG400GetMicrocodeSize(pMGA); - break; - case PCI_CHIP_MGAG200: - case PCI_CHIP_MGAG200_PCI: - retval = mgaG200GetMicrocodeSize(pMGA); - break; - default: - retval = 0; - } - return(retval); -} - -unsigned int mgaInstallMicrocode(ScreenPtr pScreen, int agp_offset) -{ - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMGA = MGAPTR(pScrn); - int retval; - - switch(pMGA->Chipset) { - case PCI_CHIP_MGAG400: - retval = mgaG400InstallMicrocode(pMGA, agp_offset); - break; - case PCI_CHIP_MGAG200: - case PCI_CHIP_MGAG200_PCI: - retval = mgaG200InstallMicrocode(pMGA, agp_offset); - break; - default: - retval = 0; - } - - if (retval) - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "WARP Microcode Loaded\n"); - return retval; -} Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c:1.2 Sun Sep 24 09:51:28 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c Mon Jun 4 12:40:58 2001 @@ -1,209 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.c,v 1.2 2000/09/24 13:51:28 alanh Exp $ */ -/************************************************************************** - -Copyright 1998-1999 Precision Insight, Inc., Cedar Park, Texas. -All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sub license, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice (including the -next paragraph) shall be included in all copies or substantial portions -of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. -IN NO EVENT SHALL PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR -ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -**************************************************************************/ - -/* - * Authors: - * Keith Whitwell <keithw@precisioninsight.com> - * - */ - - -#include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" -#include "xf86Priv.h" - -#include "xf86PciInfo.h" -#include "xf86Pci.h" -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb16.h" -#include "cfb32.h" - -#include "miline.h" - -#include "GL/glxtokens.h" - -#include "mga_bios.h" -#include "mga_reg.h" -#include "mga.h" -#include "mga_macros.h" -#include "mga_dri.h" -#include "mga_wrap.h" - - - -static void MGAWakeupHandler(int screenNum, - pointer wakeupData, - unsigned long result, - pointer pReadmask) -{ - ScreenPtr pScreen = screenInfo.screens[screenNum]; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - /*DRIWrappedFuncsRec *pDRIWrap = DRIGetWrappedFuncs(pScreen);*/ - - if (0) ErrorF("MGAWakeupHandler (in)\n"); - - /* Disabled: Check contention like the 3d clients do before trying - * to restore state. - */ - DRILock(pScreen, 0); - if (xf86IsEntityShared(pScrn->entityList[0])) - MGASwapContext_shared(pScreen); - else - MGASwapContext(pScreen); -} - -static void MGABlockHandler(int screenNum, - pointer blockData, - pointer pTimeout, - pointer pReadmask) - -{ - ScreenPtr pScreen = screenInfo.screens[screenNum]; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - MGAPtr pMga = MGAPTR(pScrn); - /*DRIWrappedFuncsRec *pDRIWrap = DRIGetWrappedFuncs(pScreen);*/ - MGASAREAPtr sa = (MGASAREAPtr)DRIGetSAREAPrivate( pScreen ); - - if (0) ErrorF("MGABlockHandler (out)\n"); - - - /* Examine the cliprects for the most recently used 3d drawable. - * If they've changed, attempt to push the updated values into the - * sarea. - * - * This avoids the protocol round trip in all single-client - * frontbuffer rendering cases providing the cliprects fit into the - * sarea, and in all single-client backbuffer rendering with arbitary - * numbers of cliprects, for all operations except swapbuffers. - * - * Thus the number of round trips in the cases where comparison is - * possible is reduced to no more (and usually fewer) than the number - * Utah requires. - */ - - if (sa->req_drawable != sa->exported_drawable || - sa->exported_stamp != DRIGetDrawableStamp( pScreen, sa->exported_index )) - { - int i; - XF86DRIClipRectPtr frontboxes, backboxes; - XF86DRIClipRectPtr boxes = (XF86DRIClipRectPtr)sa->exported_boxes; - WindowPtr window = LookupIDByType( sa->req_drawable, RT_WINDOW ); - - if (0) - ErrorF("Trying to update req_drawable: %d (exp %d), stamp %d/%d\n", - sa->req_drawable, sa->exported_drawable); - - sa->exported_drawable = 0; - - if (!window) { - if (0) - ErrorF("Couldn't retreive window\n"); - sa->req_drawable = 0; - goto finished; - } - - if (!DRIGetDrawableInfo( pScreen, &(window->drawable), - &sa->exported_index, - &sa->exported_stamp, - &sa->exported_front_x, - &sa->exported_front_y, - &sa->exported_w, - &sa->exported_h, - &sa->exported_nfront, - &frontboxes, - &sa->exported_back_x, - &sa->exported_back_y, - &sa->exported_nback, - &backboxes )) - { - if (0) - ErrorF("Couldn't get DRI info\n"); - sa->req_drawable = 0; - goto finished; - } - - /* If we can't fit both sets of cliprects into the sarea, try to - * fit the current draw buffer. Otherwise return. - */ - - sa->exported_buffers = MGA_FRONT | MGA_BACK; - - if (sa->exported_nback + sa->exported_nfront >= MGA_NR_SAREA_CLIPRECTS) { - if (sa->req_draw_buffer == MGA_FRONT) { - sa->exported_buffers = MGA_FRONT; - if (sa->exported_nfront >= MGA_NR_SAREA_CLIPRECTS) - goto finished; - } else { - sa->exported_buffers = MGA_BACK; - if (sa->exported_nback >= MGA_NR_SAREA_CLIPRECTS) - goto finished; - } - } - - if (sa->exported_buffers & MGA_BACK) { - for (i = 0 ; i < sa->exported_nback ; i++) - *boxes++ = backboxes[i]; - } - - if (sa->exported_buffers & MGA_FRONT) { - for (i = 0 ; i < sa->exported_nfront ; i++) - *boxes++ = frontboxes[i]; - } - - sa->exported_drawable = sa->req_drawable; - } - - finished: - if (xf86IsEntityShared(pScrn->entityList[0])) { - /* Restore to first screen */ - pMga->RestoreAccelState(pScrn); - xf86SetLastScrnFlag(pScrn->entityList[0], pScrn->scrnIndex); - } - - DRIUnlock(pScreen); -} - - - - -/* Just wrap validate tree for now to remove the quiescense hack. - * This is more of a win for the i810 than the mga, but should be useful - * here too. - */ -void MGADRIWrapFunctions(ScreenPtr pScreen, DRIInfoPtr pDRIInfo) -{ - pDRIInfo->wrap.BlockHandler = MGABlockHandler; - pDRIInfo->wrap.WakeupHandler = MGAWakeupHandler; -/* pDRIInfo->wrap.ValidateTree = NULL; */ -/* pDRIInfo->wrap.PostValidateTree = NULL; */ -} - - Index: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.h diff -u xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.h:1.2 Sat Jun 17 14:23:23 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.h Mon Jun 4 12:40:58 2001 @@ -1,8 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/mga/mga_wrap.h,v 1.2 2000/06/17 18:23:23 dawes Exp $ */ - -#ifndef MGA_WRAP_H -#define MGA_WRAP_H - -void MGADRIWrapFunctions(ScreenPtr pScreen, DRIInfoPtr pDRIInfo); - -#endif Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile:1.10 xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile:1.11 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile:1.10 Fri Nov 3 13:46:11 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile Tue Jan 23 19:06:21 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile,v 1.10 2000/11/03 18:46:11 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/Imakefile,v 1.11 2001/01/24 00:06:21 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -37,7 +37,6 @@ InstallObjectModule(neomagic,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(neomagic,) InstallModuleManPage(neomagic) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c:1.12.2.1 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c:1.12.2.1 Mon Jan 22 14:59:11 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c Mon Jan 22 15:12:51 2001 @@ -22,7 +22,7 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c,v 1.12.2.1 2001/01/22 19:59:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_2200.c,v 1.13 2001/01/22 20:12:51 dawes Exp $ */ /* * The original Precision Insight driver for * XFree86 v.3.3 has been sponsored by Red Hat. Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c:1.46.2.2 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c:1.52 --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c:1.46.2.2 Fri Mar 9 13:03:36 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c Tue May 15 06:19:39 2001 @@ -22,7 +22,7 @@ CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. **********************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c,v 1.46.2.2 2001/03/09 18:03:36 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neo_driver.c,v 1.52 2001/05/15 10:19:39 eich Exp $ */ /* * The original Precision Insight driver for @@ -87,11 +87,7 @@ /* Needed for Device Data Channel (DDC) support */ #include "xf86DDC.h" -#ifdef RENDER #include "picturestr.h" -#endif - -#include "picturestr.h" #ifdef XvExtension #include "xf86xv.h" @@ -106,17 +102,15 @@ #include "neo_macros.h" /* These need to be checked */ -#ifdef XFreeXDGA #include "X.h" #include "Xproto.h" #include "scrnintstr.h" #include "servermd.h" #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" -#endif /* Mandatory functions */ -static OptionInfoPtr NEOAvailableOptions(int chipid, int busid); +static const OptionInfoRec * NEOAvailableOptions(int chipid, int busid); static void NEOIdentify(int flags); static Bool NEOProbe(DriverPtr drv, int flags); static Bool NEOPreInit(ScrnInfoPtr pScrn, int flags); @@ -209,9 +203,6 @@ DriverRec NEOMAGIC = { VERSION, NEO_DRIVER_NAME, -#if 0 - "Driver for the Neomagic chipsets", -#endif NEOIdentify, NEOProbe, NEOAvailableOptions, @@ -274,7 +265,7 @@ OPTION_ROTATE } NEOOpts; -static OptionInfoRec NEO_2070_Options[] = { +static const OptionInfoRec NEO_2070_Options[] = { { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NO_MMIO, "noMMIO", OPTV_BOOLEAN, {0}, FALSE }, @@ -294,7 +285,7 @@ { -1, NULL, OPTV_NONE, {0}, FALSE } }; -static OptionInfoRec NEOOptions[] = { +static const OptionInfoRec NEOOptions[] = { { OPTION_NOLINEAR_MODE,"NoLinear", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, @@ -373,6 +364,8 @@ static const char *vbeSymbols[] = { "VBEInit", + "vbeDoEDID", + "vbeFree", NULL }; @@ -467,8 +460,7 @@ pScrn->driverPrivate = NULL; } -static -OptionInfoPtr +static const OptionInfoRec * NEOAvailableOptions(int chipid, int busid) { int chip = (chipid & 0x0000ffff); @@ -915,10 +907,15 @@ /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); /* Process the options */ - if (nPtr->NeoChipset == NM2070) - nPtr->Options = (OptionInfoPtr)NEO_2070_Options; - else - nPtr->Options = (OptionInfoPtr)NEOOptions; + if (nPtr->NeoChipset == NM2070) { + if (!(nPtr->Options = xalloc(sizeof(NEO_2070_Options)))) + return FALSE; + memcpy(nPtr->Options, NEO_2070_Options, sizeof(NEO_2070_Options)); + } else { + if (!(nPtr->Options = xalloc(sizeof(NEOOptions)))) + return FALSE; + memcpy(nPtr->Options, NEOOptions, sizeof(NEOOptions)); + } xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, nPtr->Options); @@ -1193,10 +1190,7 @@ RETURN; } - xf86LoaderReqSymbols("fbScreenInit", NULL); -#ifdef RENDER - xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif + xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); if (!nPtr->noLinear) { if (!xf86LoadSubModule(pScrn, "xaa")) @@ -1344,7 +1338,7 @@ pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; - miSetPixmapDepths (); + if (!miSetPixmapDepths ()) return FALSE; /* * Call the framebuffer layer's ScreenInit function, and fill in other @@ -1373,13 +1367,11 @@ width, height, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); -#ifdef RENDER - if (ret) - fbPictureInit (pScreen, 0, 0); -#endif if (!ret) return FALSE; + fbPictureInit(pScreen, 0, 0); + if (pScrn->depth > 8) { /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; @@ -1564,12 +1556,10 @@ pScreen->SaveScreen = vgaHWSaveScreen; -#ifdef DPMSExtension /* Setup DPMS mode */ if (nPtr->NeoChipset != NM2070) xf86DPMSInit(pScreen, (DPMSSetProcPtr)NeoDisplayPowerManagementSet, 0); -#endif if (!nPtr->noLinear) { pScrn->memPhysBase = (unsigned long)nPtr->NeoFbBase; @@ -2616,7 +2606,6 @@ * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -#ifdef DPMSExtension static void NeoDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -2674,7 +2663,6 @@ LogicPowerMgmt |= VGArGR(0x01) & ~0xF0; VGAwGR(0x01,LogicPowerMgmt); } -#endif static unsigned int neo_ddc1Read(ScrnInfoPtr pScrn) @@ -2815,7 +2803,9 @@ vbeInfoPtr pVbe; if (xf86LoadSubModule(pScrn, "vbe")) { - pVbe = VBEInit(NULL,index); - ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + if ((pVbe = VBEInit(NULL,index))) { + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); + } } } Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp:1.7 xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp:1.7 Thu Dec 14 03:11:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp Mon Jun 4 12:40:59 2001 @@ -1,90 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.cpp,v 1.7 2000/12/14 08:11:15 herrb Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH NEOMAGIC __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -neomagic \- Neomagic video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qneomagic\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B neomagic -is an XFree86 driver for the Neomagic graphics chipsets found in many -laptop computers. -.SH SUPPORTED HARDWARE -.B neomagic -supports the following chipsets: -.PP -.TP -MagicGraph 128 (NM2070) -.TP -MagicGraph 128V (NM2090) -.TP -MagicGraph 128ZV (NM2093) -.TP -MagicGraph 128ZV+ (NM2097) -.TP -MagicGraph 128XD (NM2160) -.TP -MagicGraph 256AV (NM2200) -.TP -MagicGraph 256AV+ (NM2230) -.TP -MagicGraph 256ZX (NM2360) -.TP -MagicGraph 256XL+ (NM2380) -.PP -The driver supports depths 8, 15, 16 and 24 for all chipsets except the -NM2070 which does not support depth 24. All depths are accelerated except for -depth 24 which is only accelerated on NM2200 -and newer models. All visuals are supported in depth 8. TrueColor and -DirectColor visuals are supported in the other depths. - -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The following driver -.B Options -are supported -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Disable or enable software cursor. Default: software cursor is disable -and a hardware cursor is used. -.TP -.BI "Option \*qPCIBurst\*q \*q" boolean \*q -Disable or enable PCI burst modes. Default: enabled. -.TP -.BI "Option \*qRotate\*q \*qCW\*q" -.TP -.BI "Option \*qRotate\*q \*qCCW\*q" -Rotate the display clockwise or counterclockwise. This mode is unaccelerated. -Default: no rotation. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: off. -.PP -.B Note -.br -On some laptops using the 2160 chipset (MagicGraph 128XD) the -following options are needed to avoid a lock-up of the graphic engine: -.nf - Option "XaaNoScanlineImageWriteRect" - Option "XaaNoScanlineCPUToScreenColorExpandFill" -.fi - -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jens Owen, Kevin E. Martin, and also Egbert Eich, -Mark Vojkovich, Alan Hourihane. Index: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man:1.2 --- /dev/null Mon Jun 4 12:40:59 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man Sat Jan 27 13:20:51 2001 @@ -0,0 +1,90 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/neomagic/neomagic.man,v 1.2 2001/01/27 18:20:51 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH NEOMAGIC __drivermansuffix__ __vendorversion__ +.SH NAME +neomagic \- Neomagic video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qneomagic\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B neomagic +is an XFree86 driver for the Neomagic graphics chipsets found in many +laptop computers. +.SH SUPPORTED HARDWARE +.B neomagic +supports the following chipsets: +.PP +.TP +MagicGraph 128 (NM2070) +.TP +MagicGraph 128V (NM2090) +.TP +MagicGraph 128ZV (NM2093) +.TP +MagicGraph 128ZV+ (NM2097) +.TP +MagicGraph 128XD (NM2160) +.TP +MagicGraph 256AV (NM2200) +.TP +MagicGraph 256AV+ (NM2230) +.TP +MagicGraph 256ZX (NM2360) +.TP +MagicGraph 256XL+ (NM2380) +.PP +The driver supports depths 8, 15, 16 and 24 for all chipsets except the +NM2070 which does not support depth 24. All depths are accelerated except for +depth 24 which is only accelerated on NM2200 +and newer models. All visuals are supported in depth 8. TrueColor and +DirectColor visuals are supported in the other depths. + +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The following driver +.B Options +are supported +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +Disable or enable software cursor. Default: software cursor is disable +and a hardware cursor is used. +.TP +.BI "Option \*qPCIBurst\*q \*q" boolean \*q +Disable or enable PCI burst modes. Default: enabled. +.TP +.BI "Option \*qRotate\*q \*qCW\*q" +.TP +.BI "Option \*qRotate\*q \*qCCW\*q" +Rotate the display clockwise or counterclockwise. This mode is unaccelerated. +Default: no rotation. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. See +shadowfb(__drivermansuffix__) for further information. Default: off. +.PP +.B Note +.br +On some laptops using the 2160 chipset (MagicGraph 128XD) the +following options are needed to avoid a lock-up of the graphic engine: +.nf + Option "XaaNoScanlineImageWriteRect" + Option "XaaNoScanlineCPUToScreenColorExpandFill" +.fi + +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Jens Owen, Kevin E. Martin, and also Egbert Eich, +Mark Vojkovich, Alan Hourihane. Index: xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile:1.2 Thu Dec 14 15:59:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile Wed May 16 02:48:09 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile,v 1.2 2000/12/14 20:59:12 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/Imakefile,v 1.4 2001/05/16 06:48:09 keithp Exp $ #define IHaveModules #include <Server.tmpl> @@ -14,10 +14,9 @@ #else INCLUDES = -I. \ -I$(XF86COMSRC) -I$(XF86OSSRC) \ - -I$(SERVERSRC)/mi -I$(SERVERSRC)/cfb \ - -I$(SERVERSRC)/mfb -I$(XF86SRC)/shadowfb \ + -I$(SERVERSRC)/mi -I$(SERVERSRC)/fb \ + -I$(XF86SRC)/shadowfb \ -I$(XF86SRC)/xaa -I$(XF86SRC)/ramdac \ - -I$(XF86SRC)/xf24_32bpp \ -I$(EXTINCSRC) -I$(SERVERSRC)/Xext -I$(SERVERSRC)/render \ -I$(SERVERSRC)/include -I$(FONTINCSRC) -I$(XINCLUDESRC) #endif @@ -34,7 +33,6 @@ InstallNamedNonExec($(XF86CONFIG),$(XF86CONFIG),$(LIBDIR)) #if !defined(XF86DriverSDK) -CppManTarget(newport,) InstallModuleManPage(newport) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport.cpp:1.1 xc/programs/Xserver/hw/xfree86/drivers/newport/newport.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport.cpp:1.1 Thu Dec 14 15:59:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport.cpp Mon Jun 4 12:40:59 2001 @@ -1,40 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.cpp,v 1.1 2000/12/14 20:59:12 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH NEWPORT __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -newport \- Newport video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qnewport\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B newport -is an XFree86 driver for the SGI Indy's newport video cards. -.SH SUPPORTED HARDWARE -The -.B newport -driver supports the Newport(sometimes called XL) cards found in SGI Indys. It -does not support the XZ boards. The driver is currently limited to 8bit only. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects all device information necessary to initialize -the card. However, if you have problems with auto-detection, you can -specify: -.br -.TP -.BI "Option \*qbitplanes\*q \*q" integer \*q -number of bitplanes of the board (8 or 24) -Default: auto-detected. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors: -Guido Guenther \fIguido.guenther@gmx.net\fP Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h:1.2 Wed Dec 6 17:00:46 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h Fri May 4 15:05:42 2001 @@ -1,7 +1,7 @@ /* * Id: newport.h,v 1.4 2000/11/29 20:58:10 agx Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h,v 1.2 2000/12/06 22:00:46 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.h,v 1.3 2001/05/04 19:05:42 dawes Exp $ */ #ifndef __NEWPORT_H__ #define __NEWPORT_H__ @@ -50,6 +50,7 @@ CARD8 txt_xmap9_cfg1; /* 1. Xmap9's control register */ CARD8 txt_xmap9_mi; /* Xmap9's mode index register */ LOCO txt_colormap[256]; + OptionInfoPtr Options; } NewportRec, *NewportPtr; #define NEWPORTPTR(p) ((NewportPtr)((p)->driverPrivate)) Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man:1.2 --- /dev/null Mon Jun 4 12:40:59 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man Sat Jan 27 13:20:51 2001 @@ -0,0 +1,40 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport.man,v 1.2 2001/01/27 18:20:51 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH NEWPORT __drivermansuffix__ __vendorversion__ +.SH NAME +newport \- Newport video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qnewport\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B newport +is an XFree86 driver for the SGI Indy's newport video cards. +.SH SUPPORTED HARDWARE +The +.B newport +driver supports the Newport(sometimes called XL) cards found in SGI Indys. It +does not support the XZ boards. The driver is currently limited to 8bit only. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto-detects all device information necessary to initialize +the card. However, if you have problems with auto-detection, you can +specify: +.br +.TP +.BI "Option \*qbitplanes\*q \*q" integer \*q +number of bitplanes of the board (8 or 24) +Default: auto-detected. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors: +Guido Guenther \fIguido.guenther@gmx.net\fP Index: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c:1.6 Thu Dec 14 15:59:12 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c Wed May 16 02:48:09 2001 @@ -30,7 +30,7 @@ * Project. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c,v 1.6 2000/12/14 20:59:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/newport/newport_driver.c,v 1.10 2001/05/16 06:48:09 keithp Exp $ */ /* function prototypes, common data structures & generic includes */ #include "newport.h" @@ -42,12 +42,8 @@ /* Drivers using the mi colourmap code need: */ #include "micmap.h" -/* Drivers using cfb need: */ -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb24.h" -#include "cfb24_32.h" +/* Drivers using fb need: */ +#include "fb.h" /* Drivers using the shadow frame buffer need: */ #include "shadowfb.h" @@ -56,14 +52,6 @@ #include "xf86xv.h" #include "Xv.h" -/* Temporary workaround. A module really shouldn't need this */ -#ifndef XFree86LOADER -# include "xf86_OSlib.h" -# ifndef MAP_FAILED -# define MAP_FAILED ((pointer)(-1)) -# endif -#endif - #define VERSION 4000 #define NEWPORT_NAME "Newport" #define NEWPORT_DRIVER_NAME "newport" @@ -74,7 +62,7 @@ /* Prototypes ------------------------------------------------------- */ static void NewportIdentify(int flags); -static OptionInfoPtr NewportAvailableOptions(int chipid, int busid); +static const OptionInfoRec * NewportAvailableOptions(int chipid, int busid); static Bool NewportProbe(DriverPtr drv, int flags); static Bool NewportPreInit(ScrnInfoPtr pScrn, int flags); static Bool NewportScreenInit(int Index, ScreenPtr pScreen, int argc, char **argv); @@ -112,8 +100,11 @@ /* List of Symbols from other modules that this module references */ -static const char *cfbSymbols[] = { - "cfbScreenInit", +static const char *fbSymbols[] = { + "fbScreenInit", +#ifdef RENDER + "fbPictureInit", +#endif NULL }; @@ -161,7 +152,7 @@ * might refer to. * */ - LoaderRefSymLists( cfbSymbols, shadowSymbols, NULL); + LoaderRefSymLists( fbSymbols, shadowSymbols, NULL); /* @@ -183,7 +174,7 @@ } NewportOpts; /* Supported options */ -static OptionInfoRec NewportOptions [] = { +static const OptionInfoRec NewportOptions [] = { { OPTION_BITPLANES, "bitplanes", OPTV_INTEGER, {0}, FALSE }, { OPTION_BUS_ID, "BusID", OPTV_INTEGER, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } @@ -268,7 +259,7 @@ pScrn->ScreenInit = NewportScreenInit; pScrn->EnterVT = NewportEnterVT; pScrn->LeaveVT = NewportLeaveVT; - pScrn->driverPrivate = (void*)busID; + pScrn->driverPrivate = (void*)(long)busID; foundScreen = TRUE; break; } @@ -287,14 +278,13 @@ NewportPtr pNewport; MessageType from; ClockRangePtr clockRanges; - char *mod=0, *reqSym=0; if (flags & PROBE_DETECT) return FALSE; if (pScrn->numEntities != 1) return FALSE; - busID = (int)(pScrn->driverPrivate); + busID = (long)(pScrn->driverPrivate); pScrn->driverPrivate = NULL; /* Fill in the monitor field */ @@ -360,7 +350,10 @@ /* Fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, NewportOptions); + if (!(pNewport->Options = xalloc(sizeof(NewportOptions)))) + return FALSE; + memcpy(pNewport->Options, NewportOptions, sizeof(NewportOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pNewport->Options); /* Set fields in ScreenInfoRec && NewportRec */ pScrn->videoRam = 1280 * (pScrn->bitsPerPixel >> 3); @@ -377,7 +370,7 @@ pNewport->board_rev, pNewport->rex3_rev, pNewport->cmap_rev, pNewport->xmap9_rev); - if ( (xf86GetOptValInteger(NewportOptions, OPTION_BITPLANES, &pNewport->bitplanes))) + if ( (xf86GetOptValInteger(pNewport->Options, OPTION_BITPLANES, &pNewport->bitplanes))) from = X_CONFIG; xf86DrvMsg(pScrn->scrnIndex, from, "Newport has %d bitplanes\n", pNewport->bitplanes); @@ -437,17 +430,12 @@ xf86PrintModes(pScrn); xf86SetDpi (pScrn, 0, 0); - switch(pScrn->bitsPerPixel) { - case 8: - mod = "cfb"; - reqSym = "cfbScreenInit"; - break; - } - if ( mod && (!xf86LoadSubModule(pScrn, mod))) { + /* Load FB module */ + if (!xf86LoadSubModule (pScrn, "fb")) { NewportFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols( reqSym, NULL); + xf86LoaderReqSymLists( fbSymbols, NULL); /* Load ShadowFB module */ if (!xf86LoadSubModule(pScrn, "shadowfb")) { @@ -484,6 +472,8 @@ pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; + miSetPixmapDepths (); + pNewport->Bpp = pScrn->bitsPerPixel >> 3; /* Setup the stuff for the shadow framebuffer */ pNewport->ShadowPitch = (( pScrn->virtualX * pNewport->Bpp ) + 3) & ~3L; @@ -492,23 +482,19 @@ if (!NewportModeInit(pScrn, pScrn->currentMode)) return FALSE; - switch( pScrn->bitsPerPixel) { - case 8: - ret=cfbScreenInit(pScreen, pNewport->ShadowPtr, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; - default: - xf86Msg(X_ERROR, - "Internal Error: Display depth not supported in NewportScreenInit.\n"); - ret=FALSE; - break; - } + ret = fbScreenInit(pScreen, pNewport->ShadowPtr, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, + pScrn->bitsPerPixel); if(!ret) return FALSE; +#ifdef RENDER + fbPictureInit (pScreen, 0, 0); +#endif + /* we need rgb ordering if bitsPerPixel > 8 */ if (pScrn->bitsPerPixel > 8) { for (i = 0, visual = pScreen->visuals; @@ -630,7 +616,7 @@ } -static OptionInfoPtr +static const OptionInfoRec * NewportAvailableOptions(int chipid, int busid) { return NewportOptions; Index: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile:1.14 xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile:1.14 Fri Oct 6 08:31:03 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile Sun Apr 1 16:51:25 2001 @@ -1,19 +1,16 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile,v 1.14 2000/10/06 12:31:03 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile,v 1.17 2001/04/01 20:51:25 tsi Exp $ XCOMM XCOMM This is an Imakefile for the NVIDIA driver. XCOMM - -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/Imakefile,v 1.14 2000/10/06 12:31:03 eich Exp $ - #define IHaveModules #include <Server.tmpl> SRCS = nv_driver.c nv_dac.c nv_setup.c nv_cursor.c nv_xaa.c nv_dga.c \ - nv_shadow.c riva_hw.c + nv_shadow.c riva_hw.c nv_video.c OBJS = nv_driver.o nv_dac.o nv_setup.o nv_cursor.o nv_xaa.o nv_dga.o \ - nv_shadow.o riva_hw.o + nv_shadow.o riva_hw.o nv_video.o #if defined(XF86DriverSDK) @@ -42,7 +39,6 @@ InstallObjectModule(nv,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(nv,) InstallModuleManPage(nv) #endif @@ -58,6 +54,7 @@ InstallDriverSDKNonExecFile(nv_local.h,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_proto.h,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_setup.c,$(DRIVERSDKDIR)/drivers/nv) +InstallDriverSDKNonExecFile(nv_video.c,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_shadow.c,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_type.h,$(DRIVERSDKDIR)/drivers/nv) InstallDriverSDKNonExecFile(nv_xaa.c,$(DRIVERSDKDIR)/drivers/nv) Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv.cpp:1.11.2.2 xc/programs/Xserver/hw/xfree86/drivers/nv/nv.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv.cpp:1.11.2.2 Thu Mar 15 18:01:31 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv.cpp Mon Jun 4 12:40:59 2001 @@ -1,83 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv.cpp,v 1.11.2.2 2001/03/15 23:01:31 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH NV __drivermansuffix__ "Version 4.0.3" "XFree86" -.SH NAME -nv \- NVIDIA video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qnv\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B nv -is an XFree86 driver for NVIDIA video cards. The -driver is fully accelerated and provides support for the -following framebuffer depths: 8, 15, 16 (except Riva128) -and 24. All visual types are supported for depth 8, -TrueColor and DirectColor visuals are supported for the -other depths with the exception of the Riva128 which only -supports TrueColor in the higher depths. Multi-head -configurations are supported. -.SH SUPPORTED HARDWARE -The -.B nv -driver supports PCI and AGP video cards based on the following NVIDIA chips: -.TP 22 -.B RIVA 128 -NV3 -.TP 22 -.B RIVA TNT -NV4 -.TP 22 -.B RIVA TNT2 -NV5 -.TP 22 -.B GeForce 256, QUADRO -NV10 -.TP 22 -.B GeForce2, QUADRO2 -NV11 & NV15 -.TP 22 -.B GeForce3 -NV20 -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type and the amount of video memory -present for all chips. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qUseFBDev\*q \*q" boolean \*q -Enable or disable use of on OS-specific fb interface (and is not supported -on all OSs). See fbdevhw(__drivermansuffix__) for further information. -Default: off. -.TP -.BI "Option \*qRotate\*q \*qCW\*q" -.TP -.BI "Option \*qRotate\*q \*qCCW\*q" -Rotate the display clockwise or counterclockwise. This mode is unaccelerated. -Default: no rotation. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: off. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: David McKay, Jarno Paananen, Chas Inman, Dave Schmenk, -Mark Vojkovich Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man:1.4 --- /dev/null Mon Jun 4 12:40:59 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man Sun Feb 18 18:47:29 2001 @@ -0,0 +1,79 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv.man,v 1.4 2001/02/18 23:47:29 mvojkovi Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH NV __drivermansuffix__ __vendorversion__ +.SH NAME +nv \- NVIDIA video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qnv\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B nv +is an XFree86 driver for NVIDIA video cards. The driver is fully +accelerated and provides support for the following framebuffer depths: +8, 15, 16 (except Riva128) and 24. All +visual types are supported for depth 8, TrueColor and DirectColor +visuals are supported for the other depths with the exception of +the Riva128 which only supports TrueColor in the higher depths. Multi-head configurations +are supported. +.SH SUPPORTED HARDWARE +The +.B nv +driver supports PCI and AGP video cards based on the following NVIDIA chips: +.TP 22 +.B RIVA 128 +NV3 +.TP 22 +.B RIVA TNT +NV4 +.TP 22 +.B RIVA TNT2 +NV5 +.TP 22 +.B GeForce 256, QUADRO +NV10 +.TP 22 +.B GeForce2, QUADRO2 +NV11 & NV15 +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto-detects the chipset type and the amount of video memory +present for all chips. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +Enable or disable the HW cursor. Default: on. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.TP +.BI "Option \*qUseFBDev\*q \*q" boolean \*q +Enable or disable use of on OS-specific fb interface (and is not supported +on all OSs). See fbdevhw(__drivermansuffix__) for further information. +Default: off. +.TP +.BI "Option \*qRotate\*q \*qCW\*q" +.TP +.BI "Option \*qRotate\*q \*qCCW\*q" +Rotate the display clockwise or counterclockwise. This mode is unaccelerated. +Default: no rotation. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. See +shadowfb(__drivermansuffix__) for further information. Default: off. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: David McKay, Jarno Paananen, Chas Inman, Dave Schmenk, +Mark Vojkovich Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c:1.2.2.1 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c:1.2.2.1 Tue Mar 6 14:44:47 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c Mon Jan 22 16:32:36 2001 @@ -24,7 +24,7 @@ /* Rewritten with reference from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c,v 1.2.2.1 2001/03/06 19:44:47 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_cursor.c,v 1.3 2001/01/22 21:32:36 dawes Exp $ */ #include "nv_include.h" Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c:1.8.2.1 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c:1.8.2.1 Tue Mar 6 14:44:47 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c Sun Feb 18 18:47:29 2001 @@ -24,7 +24,7 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c,v 1.8.2.1 2001/03/06 19:44:47 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dac.c,v 1.10 2001/02/18 23:47:29 mvojkovi Exp $ */ #include "nv_include.h" Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c:1.9.2.1 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c:1.9.2.1 Tue Mar 6 14:44:47 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c Mon Jan 22 16:32:36 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c,v 1.9.2.1 2001/03/06 19:44:47 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_dga.c,v 1.10 2001/01/22 21:32:36 dawes Exp $ */ #include "nv_local.h" #include "nv_include.h" Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c:1.53.2.1 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c:1.66 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c:1.53.2.1 Tue Mar 6 14:44:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c Tue May 15 06:19:39 2001 @@ -24,7 +24,7 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.53.2.1 2001/03/06 19:44:48 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_driver.c,v 1.66 2001/05/15 10:19:39 eich Exp $ */ #include "nv_include.h" @@ -40,7 +40,7 @@ * Forward definitions for the functions that make up the driver. */ /* Mandatory functions */ -static OptionInfoPtr NVAvailableOptions(int chipid, int busid); +static const OptionInfoRec * NVAvailableOptions(int chipid, int busid); static void NVIdentify(int flags); static Bool NVProbe(DriverPtr drv, int flags); static Bool NVPreInit(ScrnInfoPtr pScrn, int flags); @@ -293,11 +293,13 @@ OPTION_SHOWCACHE, OPTION_SHADOW_FB, OPTION_FBDEV, - OPTION_ROTATE + OPTION_ROTATE, + OPTION_VIDEO_KEY, + OPTION_FLAT_PANEL } NVOpts; -static OptionInfoRec NVOptions[] = { +static const OptionInfoRec NVOptions[] = { { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, @@ -305,6 +307,8 @@ { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FBDEV, "UseFBDev", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE }, + { OPTION_FLAT_PANEL, "FlatPanel", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -401,8 +405,7 @@ #endif /* XFree86LOADER */ -static -OptionInfoPtr +static const OptionInfoRec * NVAvailableOptions(int chipid, int busid) { return NVOptions; @@ -601,6 +604,30 @@ vgaHWLock(hwp); } + + +static void +NVBlockHandler ( + int i, + pointer blockData, + pointer pTimeout, + pointer pReadmask +) +{ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrnInfo = xf86Screens[i]; + NVPtr pNv = NVPTR(pScrnInfo); + + pScreen->BlockHandler = pNv->BlockHandler; + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler = NVBlockHandler; + + if (pNv->VideoTimerCallback) + (*pNv->VideoTimerCallback)(pScrnInfo, currentTime.milliseconds); + +} + + /* * This is called at the end of each server generation. It restores the * original (text) mode. It should also unmap the video memory, and free @@ -626,6 +653,8 @@ NVUnmapMem(pScrn); vgaHWUnmapMem(pScrn); + if (pNv->pInt) + xf86FreeInt10(pNv->pInt); if (pNv->AccelInfoRec) XAADestroyInfoRec(pNv->AccelInfoRec); if (pNv->CursorInfoRec) @@ -636,9 +665,12 @@ xfree(pNv->DGAModes); if ( pNv->expandBuffer ) xfree(pNv->expandBuffer); + if (pNv->overlayAdaptor) + xfree(pNv->overlayAdaptor); pScrn->vtSema = FALSE; pScreen->CloseScreen = pNv->CloseScreen; + pScreen->BlockHandler = pNv->BlockHandler; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } @@ -794,6 +826,7 @@ if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } @@ -915,11 +948,13 @@ if (pScrn->chipset == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04X is not recognised\n", pNv->Chipset); + xf86FreeInt10(pNv->pInt); return FALSE; } if (pNv->Chipset < 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Chipset \"%s\" is not recognised\n", pScrn->chipset); + xf86FreeInt10(pNv->pInt); return FALSE; } @@ -932,6 +967,7 @@ */ if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) { + xf86FreeInt10(pNv->pInt); return FALSE; } else { /* Check that the returned depth is one we support */ @@ -953,6 +989,7 @@ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given depth (%d) is not supported by this driver\n", pScrn->depth); + xf86FreeInt10(pNv->pInt); return FALSE; } } @@ -970,11 +1007,14 @@ /* The defaults are OK for us */ rgb zeros = {0, 0, 0}; - if (!xf86SetWeight(pScrn, zeros, zeros)) + if (!xf86SetWeight(pScrn, zeros, zeros)) { + xf86FreeInt10(pNv->pInt); return FALSE; + } } if (!xf86SetDefaultVisual(pScrn, -1)) { + xf86FreeInt10(pNv->pInt); return FALSE; } else { /* We don't currently support DirectColor at > 8bpp */ @@ -982,6 +1022,7 @@ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual" " (%s) is not supported at depth %d\n", xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); + xf86FreeInt10(pNv->pInt); return FALSE; } } @@ -989,17 +1030,21 @@ bytesPerPixel = pScrn->bitsPerPixel / 8; /* The vgahw module should be loaded here when needed */ - if (!xf86LoadSubModule(pScrn, "vgahw")) + if (!xf86LoadSubModule(pScrn, "vgahw")) { + xf86FreeInt10(pNv->pInt); return FALSE; - + } + xf86LoaderReqSymLists(vgahwSymbols, NULL); /* * Allocate a vgaHWRec */ - if (!vgaHWGetHWRec(pScrn)) + if (!vgaHWGetHWRec(pScrn)) { + xf86FreeInt10(pNv->pInt); return FALSE; - + } + /* We use a programamble clock */ pScrn->progClock = TRUE; @@ -1007,7 +1052,10 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, NVOptions); + if (!(pNv->Options = xalloc(sizeof(NVOptions)))) + return FALSE; + memcpy(pNv->Options, NVOptions, sizeof(NVOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pNv->Options); /* Set the bits per RGB for 8bpp mode */ if (pScrn->depth == 8) @@ -1019,42 +1067,47 @@ * The preferred method is to use the "hw cursor" option as a tri-state * option, with the default set above. */ - if (xf86GetOptValBool(NVOptions, OPTION_HW_CURSOR, &pNv->HWCursor)) { + if (xf86GetOptValBool(pNv->Options, OPTION_HW_CURSOR, &pNv->HWCursor)) { from = X_CONFIG; } /* For compatibility, accept this too (as an override) */ - if (xf86ReturnOptValBool(NVOptions, OPTION_SW_CURSOR, FALSE)) { + if (xf86ReturnOptValBool(pNv->Options, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pNv->HWCursor = FALSE; } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pNv->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(NVOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pNv->Options, OPTION_NOACCEL, FALSE)) { pNv->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } - if (xf86ReturnOptValBool(NVOptions, OPTION_SHOWCACHE, FALSE)) { + if (xf86ReturnOptValBool(pNv->Options, OPTION_SHOWCACHE, FALSE)) { pNv->ShowCache = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache enabled\n"); } - if (xf86ReturnOptValBool(NVOptions, OPTION_SHADOW_FB, FALSE)) { + if (xf86ReturnOptValBool(pNv->Options, OPTION_SHADOW_FB, FALSE)) { pNv->ShadowFB = TRUE; pNv->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using \"Shadow Framebuffer\" - acceleration disabled\n"); } - if (xf86ReturnOptValBool(NVOptions, OPTION_FBDEV, FALSE)) { + if (xf86ReturnOptValBool(pNv->Options, OPTION_FBDEV, FALSE)) { pNv->FBDev = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using framebuffer device\n"); } if (pNv->FBDev) { /* check for linux framebuffer device */ - if (!xf86LoadSubModule(pScrn, "fbdevhw")) + if (!xf86LoadSubModule(pScrn, "fbdevhw")) { + xf86FreeInt10(pNv->pInt); return FALSE; + } + xf86LoaderReqSymLists(fbdevHWSymbols, NULL); - if (!fbdevHWInit(pScrn, pNv->PciInfo, NULL)) + if (!fbdevHWInit(pScrn, pNv->PciInfo, NULL)) { + xf86FreeInt10(pNv->pInt); return FALSE; + } pScrn->SwitchMode = fbdevHWSwitchMode; pScrn->AdjustFrame = fbdevHWAdjustFrame; pScrn->EnterVT = NVEnterVTFBDev; @@ -1062,7 +1115,7 @@ pScrn->ValidMode = fbdevHWValidMode; } pNv->Rotate = 0; - if ((s = xf86GetOptValString(NVOptions, OPTION_ROTATE))) { + if ((s = xf86GetOptValString(pNv->Options, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) { pNv->ShadowFB = TRUE; pNv->NoAccel = TRUE; @@ -1085,6 +1138,19 @@ "Valid options are \"CW\" or \"CCW\"\n"); } } + if(xf86GetOptValInteger(pNv->Options, OPTION_VIDEO_KEY, &(pNv->videoKey))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", + pNv->videoKey); + } else { + pNv->videoKey = (1 << pScrn->offset.red) | + (1 << pScrn->offset.green) | + (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); + } + + if (xf86ReturnOptValBool(pNv->Options, OPTION_FLAT_PANEL, FALSE)) { + pNv->FlatPanel = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "using flat panel\n"); + } if (pNv->pEnt->device->MemBase != 0) { /* Require that the config file value matches one of the PCI values. */ @@ -1092,6 +1158,7 @@ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "MemBase 0x%08lX doesn't match any PCI base register.\n", pNv->pEnt->device->MemBase); + xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); return FALSE; } @@ -1106,6 +1173,7 @@ } else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid FB address in PCI config space\n"); + xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); return FALSE; } @@ -1119,6 +1187,7 @@ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "IOBase 0x%08lX doesn't match any PCI base register.\n", pNv->pEnt->device->IOBase); + xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); return FALSE; } @@ -1132,6 +1201,7 @@ } else { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid MMIO address in PCI config space\n"); + xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); return FALSE; } @@ -1142,6 +1212,7 @@ if (xf86RegisterResources(pNv->pEnt->index, NULL, ResExclusive)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "xf86RegisterResources() found resource conflicts\n"); + xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); return FALSE; } @@ -1251,6 +1322,7 @@ Gamma zeros = {0.0, 0.0, 0.0}; if (!xf86SetGamma(pScrn, zeros)) { + xf86FreeInt10(pNv->pInt); return FALSE; } } @@ -1307,6 +1379,7 @@ i = 1; } if (i == -1) { + xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); return FALSE; } @@ -1316,6 +1389,7 @@ if (i == 0 || pScrn->modes == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); return FALSE; } @@ -1361,9 +1435,11 @@ reqSym = "cfb32ScreenInit"; break; default: + xf86FreeInt10(pNv->pInt); return FALSE; } if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { + xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); return FALSE; } @@ -1371,6 +1447,7 @@ xf86LoaderReqSymbols(reqSym, NULL); #else if (xf86LoadSubModule(pScrn, "fb") == NULL) { + xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); return FALSE; } @@ -1381,6 +1458,7 @@ /* Load XAA if needed */ if (!pNv->NoAccel) { if (!xf86LoadSubModule(pScrn, "xaa")) { + xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); return FALSE; } @@ -1390,6 +1468,7 @@ /* Load ramdac if needed */ if (pNv->HWCursor) { if (!xf86LoadSubModule(pScrn, "ramdac")) { + xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); return FALSE; } @@ -1399,6 +1478,7 @@ /* Load shadowfb if needed */ if (pNv->ShadowFB) { if (!xf86LoadSubModule(pScrn, "shadowfb")) { + xf86FreeInt10(pNv->pInt); NVFreeRec(pScrn); return FALSE; } @@ -1780,8 +1860,7 @@ Must follow initialization of the default colormap */ if(!xf86HandleColormaps(pScreen, 256, 8, (pNv->FBDev ? fbdevHWLoadPalette : NVdac->LoadPalette), - NULL, CMAP_RELOAD_ON_MODE_SWITCH | - ((pNv->riva.Architecture != NV_ARCH_03) ? CMAP_PALETTED_TRUECOLOR : 0))) + NULL, CMAP_RELOAD_ON_MODE_SWITCH | CMAP_PALETTED_TRUECOLOR)) return FALSE; DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Palette loaded\n")); @@ -1813,24 +1892,16 @@ pScrn->memPhysBase = pNv->FbAddress; pScrn->fbOffset = 0; -#ifdef XvExtension - { - XF86VideoAdaptorPtr *ptr; - int n; - - n = xf86XVListGenericAdaptors(pScrn,&ptr); - if (n) { - xf86XVScreenInit(pScreen, ptr, n); - } - } - DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- Xv set up\n")); -#endif + NVInitVideo(pScreen); pScreen->SaveScreen = NVSaveScreen; /* Wrap the current CloseScreen function */ pNv->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = NVCloseScreen; + + pNv->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = NVBlockHandler; /* Report any unused options (only for the first generation) */ if (serverGeneration == 1) { Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h:1.9 Fri Oct 6 08:31:03 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h Tue Mar 27 20:17:43 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h,v 1.9 2000/10/06 12:31:03 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_include.h,v 1.10 2001/03/28 01:17:43 mvojkovi Exp $ */ #ifndef __NV_INCLUDE_H__ #define __NV_INCLUDE_H__ @@ -31,6 +31,10 @@ #include "xf86RAC.h" #include "nv_const.h" + +#include "dixstruct.h" +#include "scrnintstr.h" + #ifndef NV_USE_FB /* * If using cfb, cfb.h is required. Select the others for the bpp values Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h:1.3.2.1 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h:1.3.2.1 Tue Mar 6 14:44:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h Tue Mar 27 20:17:43 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h,v 1.3.2.1 2001/03/06 19:44:48 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_proto.h,v 1.6 2001/03/28 01:17:43 mvojkovi Exp $ */ #ifndef __NV_PROTO_H__ #define __NV_PROTO_H__ @@ -16,6 +16,9 @@ NVRegPtr nvReg, Bool restoreFonts); void NVDACLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, VisualPtr pVisual ); + +/* in nv_video.c */ +void NVInitVideo(ScreenPtr); /* in nv_setup.c */ void RivaEnterLeave(ScrnInfoPtr pScrn, Bool enter); Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c:1.7.2.1 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c:1.7.2.1 Tue Mar 6 14:44:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c Tue Mar 27 20:17:43 2001 @@ -24,7 +24,7 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.7.2.1 2001/03/06 19:44:48 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_setup.c,v 1.9 2001/03/28 01:17:43 mvojkovi Exp $ */ #include "nv_include.h" @@ -235,7 +235,7 @@ regBase+0x00009000, 0x00001000); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- PTIMER %x\n", pNv->riva.PTIMER)); pNv->riva.PMC = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, - regBase+0x00000000, 0x00001000); + regBase+0x00000000, 0x00009000); DEBUG(xf86DrvMsg(pScrn->scrnIndex, X_INFO, "- PMC %x\n", pNv->riva.PMC)); pNv->riva.FIFO = xf86MapPciMem(pScrn->scrnIndex, mmioFlags, pNv->PciTag, regBase+0x00800000, 0x00010000); Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c:1.5.2.1 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c:1.5.2.1 Tue Mar 6 14:44:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c Mon Jan 22 16:32:36 2001 @@ -2,7 +2,7 @@ Copyright (c) 1999, The XFree86 Project Inc. Written by Mark Vojkovich <markv@valinux.com> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c,v 1.5.2.1 2001/03/06 19:44:48 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_shadow.c,v 1.6 2001/01/22 21:32:36 dawes Exp $ */ #include "nv_local.h" #include "nv_include.h" Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h:1.18.2.1 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h:1.24 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h:1.18.2.1 Tue Mar 6 14:44:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h Tue May 8 20:39:51 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h,v 1.18.2.1 2001/03/06 19:44:48 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_type.h,v 1.24 2001/05/09 00:39:51 mvojkovi Exp $ */ #ifndef __NV_STRUCT_H__ #define __NV_STRUCT_H__ @@ -85,6 +85,7 @@ void (*Restore)(ScrnInfoPtr, vgaRegPtr, NVRegPtr, Bool); Bool (*ModeInit)(ScrnInfoPtr, DisplayModePtr); void (*PointerMoved)(int index, int x, int y); + ScreenBlockHandlerProcPtr BlockHandler; CloseScreenProcPtr CloseScreen; Bool FBDev; /* Color expansion */ @@ -113,6 +114,11 @@ Bool (*i2cInit)(ScrnInfoPtr); I2CBusPtr I2C; xf86Int10InfoPtr pInt; + void (*VideoTimerCallback)(ScrnInfoPtr, Time); + XF86VideoAdaptorPtr overlayAdaptor; + int videoKey; + Bool FlatPanel; + OptionInfoPtr Options; } NVRec, *NVPtr; #define NVPTR(p) ((NVPtr)((p)->driverPrivate)) Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c:1.2 --- /dev/null Mon Jun 4 12:41:00 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c Sun Apr 1 10:00:11 2001 @@ -0,0 +1,1221 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_video.c,v 1.2 2001/04/01 14:00:11 tsi Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86Resources.h" +#include "xf86_ansic.h" +#include "compiler.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "xf86fbman.h" +#include "regionstr.h" + +#include "xf86xv.h" +#include "Xv.h" +#include "xaa.h" +#include "xaalocal.h" +#include "dixstruct.h" +#include "fourcc.h" + +#include "nv_include.h" +#include "nvreg.h" +#include "nvvga.h" + + + +#define OFF_DELAY 450 /* milliseconds */ +#define FREE_DELAY 10000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 + +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + + + +#ifndef XvExtension +void NVInitVideo(ScreenPtr pScreen) {} +#else + +typedef struct _NVPortPrivRec { + short brightness; + short contrast; + short saturation; + short hue; + RegionRec clip; + CARD32 colorKey; + Bool autopaintColorKey; + Bool doubleBuffer; + CARD32 videoStatus; + int currentBuffer; + Time videoTime; + Bool grabbedByV4L; + FBLinearPtr linear; + int pitch; + int offset; +} NVPortPrivRec, *NVPortPrivPtr; + + +static XF86VideoAdaptorPtr NVSetupImageVideo(ScreenPtr); + +static void NVResetVideo(ScrnInfoPtr); + +static void NVStopOverlay (ScrnInfoPtr); +static void NVPutOverlayImage(ScrnInfoPtr pScrnInfo, + int offset, + int id, + int dstPitch, + BoxPtr dstBox, + int x1, int y1, int x2, int y2, + short width, short height, + short src_w, short src_h, + short dst_w, short dst_h, + RegionPtr cliplist); + +static int NVSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int NVGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); + +static void NVStopOverlayVideo(ScrnInfoPtr, pointer, Bool); + +static int NVPutImage( ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static void NVQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); +static int NVQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); + +static void NVVideoTimerCallback(ScrnInfoPtr, Time); + +static void NVInitOffscreenImages (ScreenPtr pScreen); + + +#define GET_OVERLAY_PRIVATE(pNv) \ + (NVPortPrivPtr)((pNv)->overlayAdaptor->pPortPrivates[0].ptr) + +#define GET_BLIT_PRIVATE(pNv) \ + (NVPortPrivPtr)((pNv)->blitAdaptor->pPortPrivates[0].ptr) + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvBrightness, xvContrast, xvColorKey, xvSaturation, + xvHue, xvAutopaintColorKey, xvSetDefaults, xvDoubleBuffer; + +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding = +{ + 0, + "XV_IMAGE", + 2046, 2047, + {1, 1} +}; + +#define NUM_FORMATS_ALL 6 + +XF86VideoFormatRec NVFormats[NUM_FORMATS_ALL] = +{ + {15, TrueColor}, {16, TrueColor}, {24, TrueColor}, + {15, DirectColor}, {16, DirectColor}, {24, DirectColor} +}; + +#define NUM_ATTRIBUTES 8 + +XF86AttributeRec NVAttributes[NUM_ATTRIBUTES] = +{ + {XvSettable | XvGettable, 0, 1, "XV_DOUBLE_BUFFER"}, + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_AUTOPAINT_COLORKEY"}, + {XvSettable , 0, 0, "XV_SET_DEFAULTS"}, + {XvSettable | XvGettable, -512, 511, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 8191, "XV_CONTRAST"}, + {XvSettable | XvGettable, 0, 8191, "XV_SATURATION"}, + {XvSettable | XvGettable, 0, 360, "XV_HUE"} +}; + +#define NUM_IMAGES_ALL 4 + +static XF86ImageRec NVImages[NUM_IMAGES_ALL] = +{ + XVIMAGE_YUY2, + XVIMAGE_YV12, + XVIMAGE_UYVY, + XVIMAGE_I420 +}; + +static void +NVSetPortDefaults (ScrnInfoPtr pScrnInfo, NVPortPrivPtr pPriv) +{ + NVPtr pNv = NVPTR(pScrnInfo); + + pPriv->brightness = 0; + pPriv->contrast = 4096; + pPriv->saturation = 4096; + pPriv->hue = 0; + pPriv->colorKey = pNv->videoKey; + pPriv->autopaintColorKey = TRUE; + pPriv->doubleBuffer = TRUE; +} + + +static void +NVResetVideo (ScrnInfoPtr pScrnInfo) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); + RIVA_HW_INST *pRiva = &(pNv->riva); + int satSine, satCosine; + double angle; + + angle = (double)pPriv->hue * 3.1415927 / 180.0; + + satSine = pPriv->saturation * sin(angle); + if (satSine < -1024) + satSine = -1024; + satCosine = pPriv->saturation * cos(angle); + if (satCosine < -1024) + satCosine = -1024; + + pRiva->PMC[0x00008910/4] = (pPriv->brightness << 16) | pPriv->contrast; + pRiva->PMC[0x00008914/4] = (pPriv->brightness << 16) | pPriv->contrast; + pRiva->PMC[0x00008918/4] = (satSine << 16) | (satCosine & 0xffff); + pRiva->PMC[0x0000891C/4] = (satSine << 16) | (satCosine & 0xffff); + pRiva->PMC[0x00008b00/4] = pPriv->colorKey; +} + + + +static void +NVStopOverlay (ScrnInfoPtr pScrnInfo) +{ + NVPtr pNv = NVPTR(pScrnInfo); + RIVA_HW_INST *pRiva = &(pNv->riva); + + pRiva->PMC[0x00008704/4] = 1; +} + +static FBLinearPtr +NVAllocateOverlayMemory( + ScrnInfoPtr pScrn, + FBLinearPtr linear, + int size +){ + ScreenPtr pScreen; + FBLinearPtr new_linear; + + if(linear) { + if(linear->size >= size) + return linear; + + if(xf86ResizeOffscreenLinear(linear, size)) + return linear; + + xf86FreeOffscreenLinear(linear); + } + + pScreen = screenInfo.screens[pScrn->scrnIndex]; + + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 32, + NULL, NULL, NULL); + + if(!new_linear) { + int max_size; + + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 32, + PRIORITY_EXTREME); + + if(max_size < size) + return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 32, + NULL, NULL, NULL); + } + + return new_linear; +} + +static void NVFreeOverlayMemory(ScrnInfoPtr pScrnInfo) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); + + if(pPriv->linear) { + xf86FreeOffscreenLinear(pPriv->linear); + pPriv->linear = NULL; + } +} + + +void NVInitVideo (ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr overlayAdaptor = NULL; + NVPtr pNv = NVPTR(pScrn); + int num_adaptors; + + if (pNv->AccelInfoRec && pNv->AccelInfoRec->FillSolidRects && + (pScrn->bitsPerPixel != 8) && (pNv->riva.Architecture >= NV_ARCH_10)) + { + + overlayAdaptor = NVSetupImageVideo(pScreen); + + if(overlayAdaptor) + NVInitOffscreenImages(pScreen); + } + + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + + if(overlayAdaptor) { + int size = num_adaptors + 1; + + if((newAdaptors = xalloc(size * sizeof(XF86VideoAdaptorPtr*)))) { + if(num_adaptors) + memcpy(newAdaptors, adaptors, + num_adaptors * sizeof(XF86VideoAdaptorPtr)); + + if(overlayAdaptor) { + newAdaptors[num_adaptors] = overlayAdaptor; + num_adaptors++; + } + adaptors = newAdaptors; + } + } + + if (num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + + if (newAdaptors) + xfree(newAdaptors); +} + + +static XF86VideoAdaptorPtr +NVSetupImageVideo (ScreenPtr pScreen) +{ + ScrnInfoPtr pScrnInfo = xf86Screens[pScreen->myNum]; + NVPtr pNv = NVPTR(pScrnInfo); + XF86VideoAdaptorPtr adapt; + NVPortPrivPtr pPriv; + + if (!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(NVPortPrivRec) + + sizeof(DevUnion)))) + { + return NULL; + } + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES|VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "NV Video Overlay"; + adapt->nEncodings = 1; + adapt->pEncodings = &DummyEncoding; + adapt->nFormats = NUM_FORMATS_ALL; + adapt->pFormats = NVFormats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion*)(&adapt[1]); + pPriv = (NVPortPrivPtr)(&adapt->pPortPrivates[1]); + adapt->pPortPrivates[0].ptr = (pointer)(pPriv); + adapt->pAttributes = NVAttributes; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pImages = NVImages; + adapt->nImages = NUM_IMAGES_ALL; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = NVStopOverlayVideo; + adapt->SetPortAttribute = NVSetPortAttribute; + adapt->GetPortAttribute = NVGetPortAttribute; + adapt->QueryBestSize = NVQueryBestSize; + adapt->PutImage = NVPutImage; + adapt->QueryImageAttributes = NVQueryImageAttributes; + + pPriv->videoStatus = 0; + pPriv->currentBuffer = 0; + pPriv->grabbedByV4L = FALSE; + + NVSetPortDefaults (pScrnInfo, pPriv); + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + pNv->overlayAdaptor = adapt; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvDoubleBuffer = MAKE_ATOM("XV_DOUBLE_BUFFER"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvSaturation = MAKE_ATOM("XV_SATURATION"); + xvHue = MAKE_ATOM("XV_HUE"); + xvAutopaintColorKey = MAKE_ATOM("XV_AUTOPAINT_COLORKEY"); + xvSetDefaults = MAKE_ATOM("XV_SET_DEFAULTS"); + + NVResetVideo(pScrnInfo); + + return adapt; +} + +/* + * RegionsEqual + */ +static Bool RegionsEqual +( + RegionPtr A, + RegionPtr B +) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if (num != REGION_NUM_RECTS(B)) + return FALSE; + + if ((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || + (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int*)REGION_RECTS(A); + dataB = (int*)REGION_RECTS(B); + + while(num--) + { + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } + return TRUE; +} +/* NVClipVideo - + + Takes the dst box in standard X BoxRec form (top and left + edges inclusive, bottom and right exclusive). The new dst + box is returned. The source boundaries are given (x1, y1 + inclusive, x2, y2 exclusive) and returned are the new source + boundaries in 16.16 fixed point. +*/ + +#define DummyScreen screenInfo.screens[0] + +static Bool +NVClipVideo( + BoxPtr dst, + INT32 *xa, + INT32 *xb, + INT32 *ya, + INT32 *yb, + RegionPtr reg, + INT32 width, + INT32 height +){ + INT32 vscale, hscale, delta; + BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); + int diff; + + hscale = ((*xb - *xa) << 16) / (dst->x2 - dst->x1); + vscale = ((*yb - *ya) << 16) / (dst->y2 - dst->y1); + + *xa <<= 16; *xb <<= 16; + *ya <<= 16; *yb <<= 16; + + diff = extents->x1 - dst->x1; + if(diff > 0) { + dst->x1 = extents->x1; + *xa += diff * hscale; + } + diff = dst->x2 - extents->x2; + if(diff > 0) { + dst->x2 = extents->x2; + *xb -= diff * hscale; + } + diff = extents->y1 - dst->y1; + if(diff > 0) { + dst->y1 = extents->y1; + *ya += diff * vscale; + } + diff = dst->y2 - extents->y2; + if(diff > 0) { + dst->y2 = extents->y2; + *yb -= diff * vscale; + } + + if(*xa < 0) { + diff = (- *xa + hscale - 1)/ hscale; + dst->x1 += diff; + *xa += diff * hscale; + } + delta = *xb - (width << 16); + if(delta > 0) { + diff = (delta + hscale - 1)/ hscale; + dst->x2 -= diff; + *xb -= diff * hscale; + } + if(*xa >= *xb) return FALSE; + + if(*ya < 0) { + diff = (- *ya + vscale - 1)/ vscale; + dst->y1 += diff; + *ya += diff * vscale; + } + delta = *yb - (height << 16); + if(delta > 0) { + diff = (delta + vscale - 1)/ vscale; + dst->y2 -= diff; + *yb -= diff * vscale; + } + if(*ya >= *yb) return FALSE; + + if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || + (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) + { + RegionRec clipReg; + REGION_INIT(DummyScreen, &clipReg, dst, 1); + REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); + REGION_UNINIT(DummyScreen, &clipReg); + } + return TRUE; +} + +static void +NVPutOverlayImage ( + ScrnInfoPtr pScrnInfo, + int offset, + int id, + int dstPitch, + BoxPtr dstBox, + int x1, + int y1, + int x2, + int y2, + short width, + short height, + short src_w, + short src_h, + short drw_w, + short drw_h, + RegionPtr clipBoxes +) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); + RIVA_HW_INST *pRiva = &(pNv->riva); + int buffer = pPriv->currentBuffer; + + /* paint the color key */ + if(pPriv->autopaintColorKey && + (pPriv->grabbedByV4L || !RegionsEqual(&pPriv->clip, clipBoxes))) + { + /* we always paint V4L's color key */ + if(!pPriv->grabbedByV4L) + REGION_COPY(pScrnInfo->pScreen, &pPriv->clip, clipBoxes); + (*pNv->AccelInfoRec->FillSolidRects)(pScrnInfo, pPriv->colorKey, + GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + + pRiva->PMC[(0x8900/4) + buffer] = offset; + pRiva->PMC[(0x8928/4) + buffer] = (height << 16) | width; + pRiva->PMC[(0x8930/4) + buffer] = ((y1 << 4) & 0xffff0000) | (x1 >> 12); + pRiva->PMC[(0x8938/4) + buffer] = (src_w << 20) / drw_w; + pRiva->PMC[(0x8940/4) + buffer] = (src_h << 20) / drw_h; + pRiva->PMC[(0x8948/4) + buffer] = (dstBox->y1 << 16) | dstBox->x1; + pRiva->PMC[(0x8950/4) + buffer] = ((dstBox->y2 - dstBox->y1) << 16) | + (dstBox->x2 - dstBox->x1); + + dstPitch |= 1 << 20; /* use color key */ + + if(id != FOURCC_UYVY) + dstPitch |= 1 << 16; + + pRiva->PMC[(0x8958/4) + buffer] = dstPitch; + pRiva->PMC[0x00008704/4] = 0; + pRiva->PMC[0x8700/4] = 1 << (buffer << 2); + + pPriv->videoStatus = CLIENT_VIDEO_ON; +} + + + +/* + * StopVideo + */ +static void NVStopOverlayVideo +( + ScrnInfoPtr pScrnInfo, + pointer data, + Bool Exit +) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = (NVPortPrivPtr)data; + + if(pPriv->grabbedByV4L) return; + + REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip); + + if(Exit) + { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) + NVStopOverlay(pScrnInfo); + NVFreeOverlayMemory(pScrnInfo); + pPriv->videoStatus = 0; + pNv->VideoTimerCallback = NULL; + } + else + { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) + { + pPriv->videoStatus = OFF_TIMER | CLIENT_VIDEO_ON; + pPriv->videoTime = currentTime.milliseconds + OFF_DELAY; + pNv->VideoTimerCallback = NVVideoTimerCallback; + } + } +} + + + +static int NVSetPortAttribute +( + ScrnInfoPtr pScrnInfo, + Atom attribute, + INT32 value, + pointer data +) +{ + NVPortPrivPtr pPriv = (NVPortPrivPtr)data; + + if (attribute == xvBrightness) + { + if ((value < -512) || (value > 512)) + return BadValue; + pPriv->brightness = value; + } + else if (attribute == xvDoubleBuffer) + { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->doubleBuffer = value; + } + else if (attribute == xvContrast) + { + if ((value < 0) || (value > 8191)) + return BadValue; + pPriv->contrast = value; + } + else if (attribute == xvHue) + { + value %= 360; + if (value < 0) + value += 360; + pPriv->hue = value; + } + else if (attribute == xvSaturation) + { + if ((value < 0) || (value > 8191)) + return BadValue; + pPriv->saturation = value; + } + else if (attribute == xvColorKey) + { + pPriv->colorKey = value; + REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip); + } + else if (attribute == xvAutopaintColorKey) + { + if ((value < 0) || (value > 1)) + return BadValue; + pPriv->autopaintColorKey = value; + } + else if (attribute == xvSetDefaults) + { + NVSetPortDefaults(pScrnInfo, pPriv); + } + else + return BadMatch; + + NVResetVideo(pScrnInfo); + return Success; +} + + + + +static int NVGetPortAttribute +( + ScrnInfoPtr pScrnInfo, + Atom attribute, + INT32 *value, + pointer data +) +{ + NVPortPrivPtr pPriv = (NVPortPrivPtr)data; + + if (attribute == xvBrightness) + *value = pPriv->brightness; + else if (attribute == xvDoubleBuffer) + *value = (pPriv->doubleBuffer) ? 1 : 0; + else if (attribute == xvContrast) + *value = pPriv->contrast; + else if (attribute == xvSaturation) + *value = pPriv->saturation; + else if (attribute == xvHue) + *value = pPriv->hue; + else if (attribute == xvColorKey) + *value = pPriv->colorKey; + else if (attribute == xvAutopaintColorKey) + *value = (pPriv->autopaintColorKey) ? 1 : 0; + else + return BadMatch; + + return Success; +} + + +/* + * QueryBestSize + */ +static void NVQueryBestSize +( + ScrnInfoPtr pScrnInfo, + Bool motion, + short vid_w, + short vid_h, + short drw_w, + short drw_h, + unsigned int *p_w, + unsigned int *p_h, + pointer data +) +{ + if(vid_w > (drw_w << 3)) + drw_w = vid_w >> 3; + if(vid_h > (drw_h << 3)) + drw_h = vid_h >> 3; + + *p_w = drw_w; + *p_h = drw_h; +} +/* + * CopyData + */ +static void NVCopyData422 +( + unsigned char *src, + unsigned char *dst, + int srcPitch, + int dstPitch, + int h, + int w +) +{ + w <<= 1; + while(h--) + { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +} +/* + * CopyMungedData + */ +static void NVCopyData420 +( + unsigned char *src1, + unsigned char *src2, + unsigned char *src3, + unsigned char *dst1, + int srcPitch, + int srcPitch2, + int dstPitch, + int h, + int w +) +{ + CARD32 *dst; + CARD8 *s1, *s2, *s3; + int i, j; + + w >>= 1; + + for(j = 0; j < h; j++) { + dst = (CARD32*)dst1; + s1 = src1; s2 = src2; s3 = src3; + i = w; + while(i > 4) { + dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); + dst[1] = s1[2] | (s1[3] << 16) | (s3[1] << 8) | (s2[1] << 24); + dst[2] = s1[4] | (s1[5] << 16) | (s3[2] << 8) | (s2[2] << 24); + dst[3] = s1[6] | (s1[7] << 16) | (s3[3] << 8) | (s2[3] << 24); + dst += 4; s2 += 4; s3 += 4; s1 += 8; + i -= 4; + } + + while(i--) { + dst[0] = s1[0] | (s1[1] << 16) | (s3[0] << 8) | (s2[0] << 24); + dst++; s2++; s3++; + s1 += 2; + } + + dst1 += dstPitch; + src1 += srcPitch; + if(j & 1) { + src2 += srcPitch2; + src3 += srcPitch2; + } + } +} +/* + * PutImage + */ +static int NVPutImage +( + ScrnInfoPtr pScrnInfo, + short src_x, + short src_y, + short drw_x, + short drw_y, + short src_w, + short src_h, + short drw_w, + short drw_h, + int id, + unsigned char *buf, + short width, + short height, + Bool Sync, + RegionPtr clipBoxes, + pointer data +) +{ + NVPortPrivPtr pPriv = (NVPortPrivPtr)data; + NVPtr pNv = NVPTR(pScrnInfo); + INT32 xa, xb, ya, yb; + unsigned char *dst_start; + int pitch, newSize, offset, s2offset, s3offset; + int srcPitch, srcPitch2, dstPitch; + int top, left, npixels, nlines, bpp; + BoxRec dstBox; + CARD32 tmp; + + /* + * s2offset, s3offset - byte offsets into U and V plane of the + * source where copying starts. Y plane is + * done by editing "buf". + * + * offset - byte offset to the first line of the destination. + * + * dst_start - byte address to the first displayed pel. + * + */ + + if(pPriv->grabbedByV4L) return Success; + + /* make the compiler happy */ + s2offset = s3offset = srcPitch2 = 0; + + if(src_w > (drw_w << 3)) + drw_w = src_w >> 3; + if(src_h > (drw_h << 3)) + drw_h = src_h >> 3; + + /* Clip */ + xa = src_x; + xb = src_x + src_w; + ya = src_y; + yb = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if(!NVClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, width, height)) + return Success; + + dstBox.x1 -= pScrnInfo->frameX0; + dstBox.x2 -= pScrnInfo->frameX0; + dstBox.y1 -= pScrnInfo->frameY0; + dstBox.y2 -= pScrnInfo->frameY0; + + bpp = pScrnInfo->bitsPerPixel >> 3; + pitch = bpp * pScrnInfo->displayWidth; + + dstPitch = ((width << 1) + 63) & ~63; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + srcPitch = (width + 3) & ~3; /* of luma */ + s2offset = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + s3offset = (srcPitch2 * (height >> 1)) + s2offset; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + srcPitch = (width << 1); + break; + } + + newSize = height * dstPitch / bpp; + + if(pPriv->doubleBuffer) + newSize <<= 1; + + pPriv->linear = NVAllocateOverlayMemory(pScrnInfo, + pPriv->linear, + newSize); + + if(!pPriv->linear) return BadAlloc; + + offset = pPriv->linear->offset * bpp; + + if(pPriv->doubleBuffer && pPriv->currentBuffer) + offset += (newSize * bpp) >> 1; + + dst_start = pNv->FbStart + offset; + + /* copy data */ + top = ya >> 16; + left = (xa >> 16) & ~1; + npixels = ((((xb + 0xffff) >> 16) + 1) & ~1) - left; + +#if 0 + /* I have my reservations about this */ + if(pPriv->doubleBuffer) { + RIVA_HW_INST *pRiva = &(pNv->riva); + int mask = 1 << (pPriv->currentBuffer << 2); + while(pRiva->PMC[0x00008700/4] & mask); + } +#endif + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + dst_start += (left << 1) + (top * dstPitch); + tmp = ((top >> 1) * srcPitch2) + (left >> 1); + s2offset += tmp; + s3offset += tmp; + if(id == FOURCC_I420) { + tmp = s2offset; + s2offset = s3offset; + s3offset = tmp; + } + nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; + NVCopyData420(buf + (top * srcPitch) + left, buf + s2offset, + buf + s3offset, dst_start, srcPitch, srcPitch2, + dstPitch, nlines, npixels); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + left <<= 1; + buf += (top * srcPitch) + left; + nlines = ((yb + 0xffff) >> 16) - top; + dst_start += left + (top * dstPitch); + NVCopyData422(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + break; + } + + NVPutOverlayImage(pScrnInfo, offset, id, dstPitch, &dstBox, xa, ya, xb, yb, + width, height, src_w, src_h, drw_w, drw_h, clipBoxes); + + pPriv->currentBuffer ^= 1; + + return Success; +} +/* + * QueryImageAttributes + */ +static int NVQueryImageAttributes +( + ScrnInfoPtr pScrnInfo, + int id, + unsigned short *w, + unsigned short *h, + int *pitches, + int *offsets +) +{ + int size, tmp; + + if(*w > 2046) + *w = 2046; + if(*h > 2047) + *h = 2047; + + *w = (*w + 1) & ~1; + if (offsets) + offsets[0] = 0; + + switch (id) + { + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if (pitches) + pitches[0] = size; + size *= *h; + if (offsets) + offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if (pitches) + pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if (offsets) + offsets[2] = size; + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if (pitches) + pitches[0] = size; + size *= *h; + break; + } + return size; +} + +static void NVVideoTimerCallback +( + ScrnInfoPtr pScrnInfo, + Time currentTime +) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pOverPriv = NULL; + + pNv->VideoTimerCallback = NULL; + + if(!pScrnInfo->vtSema) return; + + if(pNv->overlayAdaptor) { + pOverPriv = GET_OVERLAY_PRIVATE(pNv); + if(!pOverPriv->videoStatus) + pOverPriv = NULL; + } + + if(pOverPriv) { + if(pOverPriv->videoTime < currentTime) { + if(pOverPriv->videoStatus & OFF_TIMER) { + NVStopOverlay(pScrnInfo); + pOverPriv->videoStatus = FREE_TIMER; + pOverPriv->videoTime = currentTime + FREE_DELAY; + pNv->VideoTimerCallback = NVVideoTimerCallback; + } else + if(pOverPriv->videoStatus & FREE_TIMER) { + NVFreeOverlayMemory(pScrnInfo); + pOverPriv->videoStatus = 0; + } + } else + pNv->VideoTimerCallback = NVVideoTimerCallback; + } +} + + +/***** Exported offscreen surface stuff ****/ + + +static int +NVAllocSurface ( + ScrnInfoPtr pScrnInfo, + int id, + unsigned short w, + unsigned short h, + XF86SurfacePtr surface +) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); + CARD8 *address; + int size, bpp; + + bpp = pScrnInfo->bitsPerPixel >> 3; + + if(pPriv->grabbedByV4L) return BadAlloc; + + if((w > 2046) || (h > 2047)) return BadValue; + + w = (w + 1) & ~1; + pPriv->pitch = ((w << 1) + 63) & ~63; + size = h * pPriv->pitch / bpp; + + pPriv->linear = NVAllocateOverlayMemory(pScrnInfo, pPriv->linear, + size); + + if(!pPriv->linear) return BadAlloc; + + pPriv->offset = pPriv->linear->offset * bpp; + address = pPriv->offset + pNv->FbStart; + + surface->width = w; + surface->height = h; + surface->pScrn = pScrnInfo; + surface->pitches = &pPriv->pitch; + surface->offsets = &pPriv->offset; + surface->devPrivate.ptr = (pointer)pPriv; + + /* grab the video */ + NVStopOverlay(pScrnInfo); + pPriv->videoStatus = 0; + REGION_EMPTY(pScrnInfo->pScreen, &pPriv->clip); + pNv->VideoTimerCallback = NULL; + pPriv->grabbedByV4L = TRUE; + + return Success; +} + +static int +NVStopSurface (XF86SurfacePtr surface) +{ + NVPortPrivPtr pPriv = (NVPortPrivPtr)(surface->devPrivate.ptr); + + if(pPriv->grabbedByV4L && pPriv->videoStatus) { + NVStopOverlay(surface->pScrn); + pPriv->videoStatus = 0; + } + + return Success; +} + +static int +NVFreeSurface (XF86SurfacePtr surface) +{ + NVPortPrivPtr pPriv = (NVPortPrivPtr)(surface->devPrivate.ptr); + + if(pPriv->grabbedByV4L) { + NVStopSurface(surface); + NVFreeOverlayMemory(surface->pScrn); + pPriv->grabbedByV4L = FALSE; + } + + return Success; +} + +static int +NVGetSurfaceAttribute ( + ScrnInfoPtr pScrnInfo, + Atom attribute, + INT32 *value +) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); + + return NVGetPortAttribute(pScrnInfo, attribute, value, (pointer)pPriv); +} + +static int +NVSetSurfaceAttribute( + ScrnInfoPtr pScrnInfo, + Atom attribute, + INT32 value +) +{ + NVPtr pNv = NVPTR(pScrnInfo); + NVPortPrivPtr pPriv = GET_OVERLAY_PRIVATE(pNv); + + return NVSetPortAttribute(pScrnInfo, attribute, value, (pointer)pPriv); +} + +static int +NVDisplaySurface ( + XF86SurfacePtr surface, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + RegionPtr clipBoxes +) +{ + ScrnInfoPtr pScrnInfo = surface->pScrn; + NVPortPrivPtr pPriv = (NVPortPrivPtr)(surface->devPrivate.ptr); + INT32 xa, xb, ya, yb; + BoxRec dstBox; + + if(!pPriv->grabbedByV4L) return Success; + + if(src_w > (drw_w << 3)) + drw_w = src_w >> 3; + if(src_h > (drw_h << 3)) + drw_h = src_h >> 3; + + /* Clip */ + xa = src_x; + xb = src_x + src_w; + ya = src_y; + yb = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if(!NVClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, + surface->width, surface->height)) + { + return Success; + } + + dstBox.x1 -= pScrnInfo->frameX0; + dstBox.x2 -= pScrnInfo->frameX0; + dstBox.y1 -= pScrnInfo->frameY0; + dstBox.y2 -= pScrnInfo->frameY0; + + pPriv->currentBuffer = 0; + + NVPutOverlayImage (pScrnInfo, surface->offsets[0], surface->id, + surface->pitches[0], &dstBox, xa, xb, ya, yb, + surface->width, surface->height, src_w, src_h, + drw_w, drw_h, clipBoxes); + + return Success; +} + +XF86OffscreenImageRec NVOffscreenImages[2] = +{ + { + &NVImages[0], + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + NVAllocSurface, + NVFreeSurface, + NVDisplaySurface, + NVStopSurface, + NVGetSurfaceAttribute, + NVSetSurfaceAttribute, + 2046, 2047, + NUM_ATTRIBUTES - 1, + &NVAttributes[1] + }, + { + &NVImages[2], + VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT, + NVAllocSurface, + NVFreeSurface, + NVDisplaySurface, + NVStopSurface, + NVGetSurfaceAttribute, + NVSetSurfaceAttribute, + 2046, 2047, + NUM_ATTRIBUTES - 1, + &NVAttributes[1] + }, +}; + +static void +NVInitOffscreenImages (ScreenPtr pScreen) +{ + xf86XVRegisterOffscreenImages(pScreen, NVOffscreenImages, 2); +} + +#endif + + Index: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c:1.18.2.1 xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c:1.18.2.1 Tue Mar 6 14:44:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c Sat Mar 31 15:32:13 2001 @@ -41,7 +41,7 @@ /* Hacked together from mga driver and 3.3.4 NVIDIA driver by Jarno Paananen <jpaana@s2.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c,v 1.18.2.1 2001/03/06 19:44:48 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/nv_xaa.c,v 1.22 2001/03/31 20:32:13 mvojkovi Exp $ */ #include "nv_include.h" #include "xaalocal.h" @@ -324,8 +324,10 @@ write_mem_barrier(); } - if (!(--pNv->expandRows)) - RIVA_BUSY(pNv->riva); + if (!(--pNv->expandRows)) { /* hardware bug workaround */ + RIVA_FIFO_FREE(pNv->riva, Blt, 1); + pNv->riva.Blt->TopLeftSrc = 0; + } } static void @@ -335,8 +337,9 @@ if ( --pNv->expandRows ) { RIVA_FIFO_FREE(pNv->riva, Bitmap, pNv->expandWidth); - } else { - RIVA_BUSY(pNv->riva); + } else { /* hardware bug workaround */ + RIVA_FIFO_FREE(pNv->riva, Blt, 1); + pNv->riva.Blt->TopLeftSrc = 0; } write_mem_barrier(); } @@ -389,8 +392,6 @@ NVSubsequentColorExpandScanlineFifo; RIVA_FIFO_FREE(pNv->riva, Bitmap, pNv->expandWidth); } - - RIVA_BUSY(pNv->riva); } @@ -417,8 +418,6 @@ pNv->riva.Pixmap->TopLeft = (y << 16) | (x & 0xFFFF); pNv->riva.Pixmap->WidthHeight = (h << 16) | w; pNv->riva.Pixmap->WidthHeightIn = (h << 16) | bw; - - RIVA_BUSY(pNv->riva); } @@ -479,7 +478,6 @@ NVSetRopSolid(pNv, rop); write_mem_barrier(); - RIVA_FIFO_FREE(pNv->riva, Line, 1); pNv->FgColor = color; } @@ -629,8 +627,7 @@ /* LEFT_EDGE_CLIPPING | LEFT_EDGE_CLIPPING_NEGATIVE_X; */ NO_PLANEMASK | NO_TRANSPARENCY | - NO_GXCOPY | - SYNC_AFTER_IMAGE_WRITE; + NO_GXCOPY; infoPtr->SetupForScanlineImageWrite = NVSetupForScanlineImageWrite; infoPtr->SubsequentScanlineImageWriteRect = Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c:1.8.2.1 xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c:1.8.2.1 Tue Mar 6 14:44:48 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c Tue Mar 27 20:17:43 2001 @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c,v 1.8.2.1 2001/03/06 19:44:48 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.c,v 1.13 2001/03/28 01:17:43 mvojkovi Exp $ */ #include "nv_local.h" #include "riva_hw.h" @@ -1450,6 +1450,12 @@ chip->PGRAPH[0x000009A4/4] = chip->PFB[0x00000200/4]; chip->PGRAPH[0x000009A8/4] = chip->PFB[0x00000204/4]; } + chip->PMC[0x00008704/4] = 1; + chip->PMC[0x00008140/4] = 0; + chip->PMC[0x00008920/4] = 0; + chip->PMC[0x00008924/4] = 0; + chip->PMC[0x00008908/4] = 0x01ffffff; + chip->PMC[0x0000890C/4] = 0x01ffffff; chip->PGRAPH[0x00000B00/4] = chip->PFB[0x00000240/4]; chip->PGRAPH[0x00000B04/4] = chip->PFB[0x00000244/4]; Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h:1.7.2.1 xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h:1.7.2.1 Tue Mar 6 14:44:49 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h Tue Feb 20 19:42:58 2001 @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.7.2.1 2001/03/06 19:44:49 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_hw.h,v 1.10 2001/02/21 00:42:58 mvojkovi Exp $ */ #ifndef __RIVA_HW_H__ #define __RIVA_HW_H__ #define RIVA_SW_VERSION 0x00010003 Index: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h diff -u xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h:1.6.2.1 xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h:1.6.2.1 Tue Mar 6 14:44:49 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h Tue Feb 20 19:42:58 2001 @@ -36,7 +36,7 @@ |* those rights set forth herein. *| |* *| \***************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.6.2.1 2001/03/06 19:44:49 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/nv/riva_tbl.h,v 1.7 2001/02/21 00:42:58 mvojkovi Exp $ */ /* Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile:1.17 xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile:1.17 Tue Sep 19 20:09:27 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile Wed May 16 02:48:10 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile,v 1.17 2000/09/20 00:09:27 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/Imakefile,v 1.19 2001/05/16 06:48:10 keithp Exp $ XCOMM XCOMM This is an Imakefile for the Rendition driver. @@ -16,14 +16,12 @@ #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include #else -INCLUDES = -I. -I$(XF86SRC)/xf4bpp -I$(XF86SRC)/xf1bpp \ - -I$(SERVERSRC)/cfb -I$(SERVERSRC)/mfb \ +INCLUDES = -I. -I$(SERVERSRC)/fb \ -I$(SERVERSRC)/mi -I$(SERVERSRC)/cfb\ -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c -I$(XF86SRC)/vgahw \ -I$(XF86SRC)/rac -I$(XF86SRC)/int10 -I$(XF86OSSRC)/vbe \ -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(FONTINCSRC) -I$(XINCLUDESRC) \ -I$(SERVERSRC)/include -I$(XF86SRC)/xaa \ - -I$(XF86SRC)/xf24_32bpp -I$(XF86SRC)/xf8_32bpp \ -I$(XF86SRC)/ramdac -I$(SERVERSRC)/Xext \ -I$(XF86SRC)/shadowfb -I$(XF86SRC)/rac -I$(XF86SRC)/loader \ -I$(SERVERSRC)/render -I$(EXTINCSRC) @@ -50,7 +48,6 @@ InstallNonExecFile(v20002d.uc,$(MODULEDIR)) #if !defined(XF86DriverSDK) -CppManTarget(rendition,) InstallModuleManPage(rendition) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c:1.8 Mon Jun 12 22:28:33 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c Wed May 16 02:48:10 2001 @@ -3,7 +3,7 @@ * * accelerator functions for X */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c,v 1.8 2000/06/13 02:28:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/accelX.c,v 1.9 2001/05/16 06:48:10 keithp Exp $ */ @@ -112,7 +112,6 @@ RENDITIONAccelPreInit(ScrnInfoPtr pScreenInfo) { renditionPtr pRendition = RENDITIONPTR(pScreenInfo); - int c; #ifdef DEBUG ErrorF("RENDITION: RENDITIONAccelPreInit called\n"); @@ -140,7 +139,6 @@ XAAInfoRecPtr pXAAinfo; BoxRec AvailFBArea; - int c; #ifdef DEBUG ErrorF("RENDITION: RENDITIONAccelInit called\n"); Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c:1.38 xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c:1.42 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c:1.38 Thu Dec 14 11:33:10 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c Wed May 16 02:48:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c,v 1.38 2000/12/14 16:33:10 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.c,v 1.42 2001/05/16 06:48:10 keithp Exp $ */ /* * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. * @@ -82,7 +82,7 @@ * local function prototypes */ -static OptionInfoPtr renditionAvailableOptions(int, int); +static const OptionInfoRec * renditionAvailableOptions(int, int); static void renditionIdentify(int); static Bool renditionProbe(DriverPtr, int); static Bool renditionPreInit(ScrnInfoPtr, int); @@ -108,7 +108,7 @@ * global data */ -OptionInfoRec renditionOptions[]={ +OptionInfoRec const renditionOptions[]={ { OPTION_FBWC, "FramebufferWC", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SW_Cursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, @@ -187,9 +187,10 @@ static const char *fbSymbols[]={ "xf1bppScreenInit", "xf4bppScreenInit", - "cfbScreenInit", - "cfb16ScreenInit", - "cfb32ScreenInit", + "fbScreenInit", +#ifdef RENDER + "fbPictureInit", +#endif NULL }; @@ -274,7 +275,7 @@ * functions */ -static OptionInfoPtr +static const OptionInfoRec * renditionAvailableOptions(int chipid, int busid) { return renditionOptions; @@ -466,12 +467,10 @@ { static ClockRange renditionClockRange = {NULL, 0, 135000, -1, FALSE, TRUE, 1, 1, 0}; MessageType From; - int i, videoRam, Rounding, nModes = 0; - char *Module; - const char *Sym; - vgaHWPtr pvgaHW; + int videoRam, Rounding, nModes = 0; renditionPtr pRendition; char *in_string; + vgaHWPtr pvgaHW; #ifdef DEBUG ErrorF("Rendition: renditionPreInit() called\n"); @@ -527,52 +526,44 @@ _END }; xf86SetOperatingState(vgamem, pRendition->pEnt->index, ResUnusedOpr); } + + if (xf86RegisterResources(pRendition->pEnt->index, NULL, ResExclusive)) + return FALSE; + /* Operations for which memory access is required. */ - pScreenInfo->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; + pScreenInfo->racMemFlags = RAC_FB | RAC_CURSOR; /* Operations for which I/O access is required. (XXX Check this) */ pScreenInfo->racIoFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; /* determine depth, bpp, etc. */ if (!xf86SetDepthBpp(pScreenInfo, 8, 8, 8, Support32bppFb)) return FALSE; - - switch (pScreenInfo->depth) { - case 8: Module = "cfb"; Sym = "cfbScreenInit"; break; - case 15: if (PCI_CHIP_V1000==pRendition->PciInfo->chipType){ - Module = "cfb16"; Sym = "cfbScreenInit16"; break; - } - else { - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, + if (pScreenInfo->depth == 15) + { + if (PCI_CHIP_V1000 != pRendition->PciInfo->chipType) { + xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, "Given depth (%d) is not supported by this chipset.\n", pScreenInfo->depth); - return FALSE; - } - case 16: Module = "cfb16"; Sym = "cfbScreenInit16"; break; - - case 24: Module = "cfb32"; Sym = "cfbScreenInit32"; break; - - default: - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Given depth (%d) is not supported by this driver.\n", - pScreenInfo->depth); - return FALSE; + return FALSE; + } } - - /* collect all of the options flags and process them */ xf86CollectOptions(pScreenInfo, NULL); + if (!(pRendition->Options = xalloc(sizeof(renditionOptions)))) + return FALSE; + memcpy(pRendition->Options, renditionOptions, sizeof(renditionOptions)); xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options, - renditionOptions); + pRendition->Options); - /* Ensure depth-specific entry points are available */ - if (!xf86LoadSubModule(pScreenInfo, Module)) + /* Load fb */ + if (!xf86LoadSubModule(pScreenInfo, "fb")) return FALSE; - xf86LoaderReqSymbols(Sym, NULL); + xf86LoaderReqSymbols("fbScreenInit", NULL); /* determine colour weights */ pScreenInfo->rgbBits=8; @@ -644,10 +635,7 @@ pRendition->board.mem_base); /* First of all get a "clean" starting state */ -#if 1 verite_resetboard(pScreenInfo); -#endif - /* determine video ram -- to do so, we assume a full size memory of 16M, * then map it and use verite_getmemorysize() to determine the real amount of * memory */ @@ -655,12 +643,12 @@ renditionMapMem(pScreenInfo); videoRam=verite_getmemorysize(pScreenInfo)>>10; - /* Unmaping delayed until after micrcode loading */ + /* Unmapping delayed until after micrcode loading */ /****************************************/ /* Reserv memory and load the microcode */ /****************************************/ #if USE_ACCEL - if (!xf86ReturnOptValBool(renditionOptions, OPTION_NOACCEL,0)) { + if (!xf86ReturnOptValBool(pRendition->Options, OPTION_NOACCEL,0)) { RENDITIONAccelPreInit (pScreenInfo); } else @@ -671,8 +659,6 @@ ("Skipping acceleration\n")); #endif - xf86MarkOptionUsedByName(renditionOptions,"NoAccel"); - From = X_PROBED; xf86DrvMsg(pScreenInfo->scrnIndex, From, "videoRam: %d kBytes\n", videoRam); pScreenInfo->videoRam=videoRam; @@ -688,7 +674,7 @@ pRendition->board.shadowfb=TRUE; - if ((in_string = xf86GetOptValString(renditionOptions, OPTION_ROTATE))) { + if ((in_string = xf86GetOptValString(pRendition->Options, OPTION_ROTATE))) { if(!xf86NameCmp(in_string, "CW")) { /* accel is disabled below for shadowFB */ pRendition->board.shadowfb = TRUE; @@ -707,9 +693,8 @@ "Valid options are \"CW\" or \"CCW\"\n"); } } - xf86MarkOptionUsedByName(renditionOptions,"Rotate"); - if (xf86ReturnOptValBool(renditionOptions, OPTION_SHADOW_FB,1)|| + if (xf86ReturnOptValBool(pRendition->Options, OPTION_SHADOW_FB,1)|| pRendition->board.rotate) { if (!xf86LoadSubModule(pScreenInfo, "shadowfb")) { xf86DrvMsg(pScreenInfo->scrnIndex, X_WARNING, @@ -727,22 +712,20 @@ xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, "\"Shadow Framebuffer\" disabled\n"); } - xf86MarkOptionUsedByName(renditionOptions,"ShadowFB"); /* Load Ramdac module if needed */ - if (!xf86ReturnOptValBool(renditionOptions, OPTION_SW_CURSOR,0) && + if (!xf86ReturnOptValBool(pRendition->Options, OPTION_SW_CURSOR,0) && !pRendition->board.rotate){ if (!xf86LoadSubModule(pScreenInfo, "ramdac")) { return FALSE; } xf86LoaderReqSymLists(ramdacSymbols, NULL); } - xf86MarkOptionUsedByName(renditionOptions,"SWCursor"); #if USE_ACCEL /* Load XAA if needed */ - if (!xf86ReturnOptValBool(renditionOptions, OPTION_NOACCEL,0) && + if (!xf86ReturnOptValBool(pRendition->Options, OPTION_NOACCEL,0) && !pRendition->board.rotate) { if (!xf86LoadSubModule(pScreenInfo, "xaa")) { return FALSE; @@ -753,7 +736,7 @@ #if 0 /* Load DDC module if needed */ - if (!xf86ReturnOptValBool(renditionOptions, OPTION_NO_DDC,0)){ + if (!xf86ReturnOptValBool(pRendition->Options, OPTION_NO_DDC,0)){ if (!xf86LoadSubModule(pScreenInfo, "ddc")) { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, ("Loading of DDC library failed, skipping DDC-probe\n")); @@ -769,7 +752,7 @@ } #else /* Load DDC module if needed */ - if (!xf86ReturnOptValBool(renditionOptions, OPTION_NO_DDC,0)){ + if (!xf86ReturnOptValBool(pRendition->Options, OPTION_NO_DDC,0)){ if (!xf86LoadSubModule(pScreenInfo, "vbe")) { xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, ("Loading of DDC library failed, skipping DDC-probe\n")); @@ -801,6 +784,7 @@ * XXX Aren't the clocks programmable? If so, this discrete clock stuff * shouldn't be used. */ +#if 0 if ((pScreenInfo->numClocks = pRendition->pEnt->device->numclocks)) { if (pScreenInfo->numClocks > 4) @@ -816,33 +800,31 @@ From = X_PROBED; } xf86ShowClocks(pScreenInfo, From); +#endif - if (pScreenInfo->display->modes && pScreenInfo->display->modes[0]) - { - /* Set the virtual X rounding (in bits) */ - if (pScreenInfo->depth == 8) - Rounding = 16 * 8; - else - Rounding = 16; - - /* - * Validate the modes. Note that the limits passed to - * xf86ValidateModes() are VGA CRTC architectural limits. - */ - pScreenInfo->maxHValue = 2080; - pScreenInfo->maxVValue = 1025; - nModes = xf86ValidateModes(pScreenInfo, + /* Set the virtual X rounding (in bits) */ + if (pScreenInfo->depth == 8) + Rounding = 16 * 8; + else + Rounding = 16; + + /* + * Validate the modes. Note that the limits passed to + * xf86ValidateModes() are VGA CRTC architectural limits. + */ + pScreenInfo->maxHValue = 2080; + pScreenInfo->maxVValue = 1025; + nModes = xf86ValidateModes(pScreenInfo, pScreenInfo->monitor->Modes, pScreenInfo->display->modes, &renditionClockRange, NULL, 8, 2040, Rounding, 1, 1024, pScreenInfo->display->virtualX, pScreenInfo->display->virtualY, 0x10000, LOOKUP_CLOSEST_CLOCK | LOOKUP_CLKDIV2); - if (nModes < 0) - return FALSE; + if (nModes < 0) + return FALSE; - /* Remove invalid modes */ - xf86PruneDriverModes(pScreenInfo); - } + /* Remove invalid modes */ + xf86PruneDriverModes(pScreenInfo); /* Set CRTC values for the modes */ xf86SetCrtcForModes(pScreenInfo, 0); @@ -860,7 +842,7 @@ if (!pScreenInfo->chipset) pScreenInfo->chipset = (char *)renditionChipsets[0].name; - if(!xf86ReturnOptValBool(renditionOptions, OPTION_SW_CURSOR,0)){ + if(!xf86ReturnOptValBool(pRendition->Options, OPTION_SW_CURSOR,0)){ if(!pRendition->board.rotate) /* Do preemtive things for HW cursor */ RenditionHWCursorPreInit(pScreenInfo); @@ -917,6 +899,7 @@ vgaHWProtect(pScreenInfo, FALSE); verite_setmode(pScreenInfo, &RENDITIONPTR(pScreenInfo)->mode); + #ifdef DEBUG ErrorF("Restore OK...!!!!\n"); sleep(1); @@ -1008,7 +991,6 @@ modeinfo->flags=pMode->Flags; verite_setmode(pScreenInfo,&RENDITIONPTR(pScreenInfo)->mode); - #ifdef DEBUG ErrorF("Setmode OK...!!!!\n"); sleep(1); @@ -1065,11 +1047,15 @@ ErrorF("Leavegraphics..!!!!\n"); sleep(1); #endif - +#if 0 + verite_textmode(&RENDITIONPTR(pScreenInfo)->board); +#endif renditionRestore(pScreenInfo); vgaHWLock(VGAHWPTR(pScreenInfo)); +#if 0 verite_textmode(&RENDITIONPTR(pScreenInfo)->board); +#endif #ifdef DEBUG ErrorF("Leavegraphics OK...!!!!\n"); sleep(1); @@ -1115,7 +1101,6 @@ } -#ifdef DPMSExtension static void renditionDPMSSet(ScrnInfoPtr pScreen, int mode, int flags) { @@ -1125,7 +1110,6 @@ vgaHWDPMSSet(pScreen, mode, flags); } -#endif static Bool @@ -1137,10 +1121,9 @@ Bool Inited = FALSE; unsigned char *FBBase; VisualPtr visual; + vgaHWPtr pvgaHW; int displayWidth,width,height; - vgaHWPtr pvgaHW; - #ifdef DEBUG ErrorF("RENDITION: renditionScreenInit() called\n"); sleep(1); @@ -1165,6 +1148,8 @@ pScreenInfo->rgbBits, pScreenInfo->defaultVisual)) return FALSE; + miSetPixmapDepths (); + if (pRendition->board.rotate) { height = pScreenInfo->virtualX; width = pScreenInfo->virtualY; @@ -1184,39 +1169,19 @@ FBBase = pRendition->board.vmem_base+prenditionPriv->board.fbOffset; displayWidth=pScreenInfo->displayWidth; } - - - /* initialise the framebuffer */ - switch (pScreenInfo->bitsPerPixel) - { - case 8: - Inited = cfbScreenInit(pScreen, FBBase, - width, height, - pScreenInfo->xDpi, pScreenInfo->yDpi, - displayWidth); - break; - case 16: - Inited = cfb16ScreenInit(pScreen, FBBase, - width, height, - pScreenInfo->xDpi, pScreenInfo->yDpi, - displayWidth); - break; - case 32: - Inited = cfb32ScreenInit(pScreen, FBBase, - width, height, - pScreenInfo->xDpi, pScreenInfo->yDpi, - displayWidth); - break; - default: - xf86DrvMsg(scrnIndex, X_ERROR, - "Internal error: invalid bpp (%d) in renditionScreenInit\n", - pScreenInfo->bitsPerPixel); - break; - } + Inited = fbScreenInit(pScreen, FBBase, + width, height, + pScreenInfo->xDpi, pScreenInfo->yDpi, + displayWidth, + pScreenInfo->bitsPerPixel); + if (!Inited) return FALSE; +#ifdef RENDER + fbPictureInit (pScreen, 0, 0); +#endif if (pScreenInfo->bitsPerPixel > 8) { /* Fixup RGB ordering */ @@ -1277,10 +1242,10 @@ /*********************************************************/ /* The actual setup of the driver-specific code */ - /* has to be after cfb*ScreenInit and before cursor init */ + /* has to be after fbScreenInit and before cursor init */ /*********************************************************/ #if USE_ACCEL - if (!xf86ReturnOptValBool(renditionOptions, OPTION_NOACCEL,0)) + if (!xf86ReturnOptValBool(pRendition->Options, OPTION_NOACCEL,0)) RENDITIONAccelXAAInit (pScreen); #endif @@ -1288,7 +1253,7 @@ xf86SetSilkenMouse(pScreen); miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - if(!xf86ReturnOptValBool(renditionOptions, OPTION_SW_CURSOR,0)&& + if(!xf86ReturnOptValBool(pRendition->Options, OPTION_SW_CURSOR,0)&& !pRendition->board.rotate){ /* Initialise HW cursor */ if(!RenditionHWCursorInit(scrnIndex, pScreen)){ @@ -1331,16 +1296,11 @@ return FALSE; } - -#ifdef DPMSExtension xf86DPMSInit(pScreen, renditionDPMSSet, 0); -#endif - - if (xf86ReturnOptValBool(renditionOptions, OPTION_OVERCLOCK_MEM,0)) { + if (xf86ReturnOptValBool(pRendition->Options, OPTION_OVERCLOCK_MEM,0)) { RENDITIONPTR(pScreenInfo)->board.overclock_mem=TRUE; } - xf86MarkOptionUsedByName(renditionOptions,"Overclock_Mem"); /* Wrap the screen's CloseScreen vector and set its SaveScreen vector */ prenditionPriv->CloseScreen = pScreen->CloseScreen; @@ -1436,15 +1396,16 @@ { Bool WriteCombine; int mapOption; + renditionPtr pRendition = RENDITIONPTR(pScreenInfo); #ifdef DEBUG ErrorF("Mapping ...\n"); ErrorF("%d %d %d %x %d\n", pScreenInfo->scrnIndex, VIDMEM_FRAMEBUFFER, - RENDITIONPTR(pScreenInfo)->pcitag, - RENDITIONPTR(pScreenInfo)->board.mem_base, pScreenInfo->videoRam); + pRendition->pcitag, + pRendition->board.mem_base, pScreenInfo->videoRam); #endif - if (RENDITIONPTR(pScreenInfo)->board.chip==V1000_DEVICE){ + if (pRendition->board.chip==V1000_DEVICE){ /* Some V1000 boards are known to have problems with Write-Combining */ /* V2x00 also found to have similar problems with memcpy & WC ! */ WriteCombine = 0; @@ -1454,7 +1415,7 @@ WriteCombine = 1; } /* Override on users request */ - WriteCombine=xf86ReturnOptValBool(renditionOptions, OPTION_FBWC, WriteCombine); + WriteCombine=xf86ReturnOptValBool(pRendition->Options, OPTION_FBWC, WriteCombine); if (WriteCombine){ xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, ("Requesting Write-Combined memory access\n")); @@ -1465,13 +1426,11 @@ ("Requesting MMIO-style memory access\n")); mapOption = VIDMEM_MMIO; } - - xf86MarkOptionUsedByName(renditionOptions,"FramebufferWC"); - RENDITIONPTR(pScreenInfo)->board.vmem_base= + pRendition->board.vmem_base= xf86MapPciMem(pScreenInfo->scrnIndex, mapOption, - RENDITIONPTR(pScreenInfo)->pcitag, - (unsigned long)RENDITIONPTR(pScreenInfo)->board.mem_base, + pRendition->pcitag, + (unsigned long)pRendition->board.mem_base, pScreenInfo->videoRam); return TRUE; Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.cpp:1.7 xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.cpp:1.7 Tue Dec 12 13:54:31 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.cpp Mon Jun 4 12:41:02 2001 @@ -1,112 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.cpp,v 1.7 2000/12/12 18:54:31 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH RENDITION __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -rendition \- Rendition video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qrendition\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B rendition -is an XFree86 driver for Rendition/Micron based video cards. The driver -supports following framebuffer depths: 8, 15 (Verite V1000 only), 16 -and 24. Acceleration and multi-head configurations are -not supported yet, but are work in progress. -.SH SUPPORTED HARDWARE -The -.B rendition -driver supports PCI and AGP video cards based on the following Rendition/Micron chips: -.TP 12 -.B V1000 -Verite V1000 based cards. -.TP 12 -.B V2100 -Verite V2100 based cards. Diamond Stealth II S220 is the only known such card. -.TP 12 -.B V2200 -Verite V2200 based cards. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the chipset type, but the following -.B ChipSet -names may optionally be specified in the config file -.B \*qDevice\*q -section, and will override the auto-detection: -.PP -.RS 4 -"v1000", "v2100", "v2200". -.RE -.PP -The driver will auto-detect the amount of video memory present for all -chips. If the amount of memory is detected incorrectly, the actual amount -of video memory should be specified with a -.B VideoRam -entry in the config file -.B \*qDevice\*q -section. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Disables use of the hardware cursor. Default: use HW-cursor. -.TP -.BI "Option \*qOverclockMem\*q \*q" boolean \*q -Increases the Mem/Sys clock to 125MHz/60MHz from standard 110MHz/50MHz. -Default: Not overclocked. -.TP -.BI "Option \*qDacSpeed\*q \*q" MHz \*q -Run the memory at a higher clock. Useful on some cards with display glitches -at higher resolutions. But adds the risk to damage the hardware. Use with -caution. -.TP -.BI "Option \*qFramebufferWC\*q \*q" boolean \*q -If writecombine is disabled in BIOS, and you add this option in configuration -file, then the driver will try to request writecombined access to the -framebuffer. This can drastically increase the performance on unaccelerated -server. Requires that "MTRR"-support is compiled into the OS-kernel. -Default: Disabled for V1000, enabled for V2100/V2200. -.TP -.BI "Option \*qNoDDC\*q \*q" boolean \*q -Disable probing of DDC-information from your monitor. This information is not -used yet and is only there for informational purposes. This might change -before final XFree86 4.0 release. Safe to disable if you experience problems -during startup of X-server. -Default: Probe DDC. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -If this option is enabled, the driver will cause the CPU to do each drawing -operation first into a shadow frame buffer in system virtual memory and then -copy the result into video memory. If this option is not active, the CPU will -draw directly into video memory. Enabling this option is beneficial for those -systems where reading from video memory is, on average, slower than the -corresponding read/modify/write operation in system virtual memory. This is -normally the case for PCI or AGP adapters, and, so, this option is enabled by -default unless acceleration is enabled. -Default: Enabled unless acceleration is used. -.TP -.BI "Option \*qRotate\*q \*qCW\*q" -.TP -.BI "Option \*qRotate\*q \*qCCW\*q" -Rotate the display clockwise or counterclockwise. This mode is unaccelerated. -Default: no rotation. -.TP -.SH "Notes" -For the moment the driver defaults to not request write-combine for any chipset -as there has been indications of problems with it. Use -.B "Option \*qMTRR\*q" -to let the driver request write-combining of memory access on the video board. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Marc Langenbach, Dejan Ilic Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.h diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.h:1.6 Tue Apr 4 15:25:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.h Wed May 16 02:48:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.h,v 1.6 2000/04/04 19:25:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.h,v 1.7 2001/05/16 06:48:10 keithp Exp $ */ #ifndef __RENDITION_H__ #define __RENDITION_H__ @@ -51,21 +51,9 @@ /* Needed for replacement LoadPalette function for Gamma Correction */ #include "xf86cmap.h" -/* Needed for the 1 and 4 bpp framebuffers */ -#include "xf1bpp.h" -#include "xf4bpp.h" +/* Drivers using fb need this */ -/* Drivers using cfb need this */ - -#undef PSZ -#define PSZ 8 -#include "cfb.h" -#undef PSZ - -/* Drivers supporting bpp 16, 24 or 32 with cfb need these */ - -#include "cfb16.h" -#include "cfb32.h" +#include "fb.h" /* Drivers using the XAA interface ... */ #include "xaa.h" Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.man:1.2 --- /dev/null Mon Jun 4 12:41:02 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.man Sat Jan 27 13:20:51 2001 @@ -0,0 +1,112 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition.man,v 1.2 2001/01/27 18:20:51 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH RENDITION __drivermansuffix__ __vendorversion__ +.SH NAME +rendition \- Rendition video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qrendition\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B rendition +is an XFree86 driver for Rendition/Micron based video cards. The driver +supports following framebuffer depths: 8, 15 (Verite V1000 only), 16 +and 24. Acceleration and multi-head configurations are +not supported yet, but are work in progress. +.SH SUPPORTED HARDWARE +The +.B rendition +driver supports PCI and AGP video cards based on the following Rendition/Micron chips: +.TP 12 +.B V1000 +Verite V1000 based cards. +.TP 12 +.B V2100 +Verite V2100 based cards. Diamond Stealth II S220 is the only known such card. +.TP 12 +.B V2200 +Verite V2200 based cards. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto-detects the chipset type, but the following +.B ChipSet +names may optionally be specified in the config file +.B \*qDevice\*q +section, and will override the auto-detection: +.PP +.RS 4 +"v1000", "v2100", "v2200". +.RE +.PP +The driver will auto-detect the amount of video memory present for all +chips. If the amount of memory is detected incorrectly, the actual amount +of video memory should be specified with a +.B VideoRam +entry in the config file +.B \*qDevice\*q +section. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +Disables use of the hardware cursor. Default: use HW-cursor. +.TP +.BI "Option \*qOverclockMem\*q \*q" boolean \*q +Increases the Mem/Sys clock to 125MHz/60MHz from standard 110MHz/50MHz. +Default: Not overclocked. +.TP +.BI "Option \*qDacSpeed\*q \*q" MHz \*q +Run the memory at a higher clock. Useful on some cards with display glitches +at higher resolutions. But adds the risk to damage the hardware. Use with +caution. +.TP +.BI "Option \*qFramebufferWC\*q \*q" boolean \*q +If writecombine is disabled in BIOS, and you add this option in configuration +file, then the driver will try to request writecombined access to the +framebuffer. This can drastically increase the performance on unaccelerated +server. Requires that "MTRR"-support is compiled into the OS-kernel. +Default: Disabled for V1000, enabled for V2100/V2200. +.TP +.BI "Option \*qNoDDC\*q \*q" boolean \*q +Disable probing of DDC-information from your monitor. This information is not +used yet and is only there for informational purposes. This might change +before final XFree86 4.0 release. Safe to disable if you experience problems +during startup of X-server. +Default: Probe DDC. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +If this option is enabled, the driver will cause the CPU to do each drawing +operation first into a shadow frame buffer in system virtual memory and then +copy the result into video memory. If this option is not active, the CPU will +draw directly into video memory. Enabling this option is beneficial for those +systems where reading from video memory is, on average, slower than the +corresponding read/modify/write operation in system virtual memory. This is +normally the case for PCI or AGP adapters, and, so, this option is enabled by +default unless acceleration is enabled. +Default: Enabled unless acceleration is used. +.TP +.BI "Option \*qRotate\*q \*qCW\*q" +.TP +.BI "Option \*qRotate\*q \*qCCW\*q" +Rotate the display clockwise or counterclockwise. This mode is unaccelerated. +Default: no rotation. +.TP +.SH "Notes" +For the moment the driver defaults to not request write-combine for any chipset +as there has been indications of problems with it. Use +.B "Option \*qMTRR\*q" +to let the driver request write-combining of memory access on the video board. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Marc Langenbach, Dejan Ilic Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition_options.h diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition_options.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition_options.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition_options.h:1.4 Tue Feb 29 19:25:24 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition_options.h Fri May 4 15:05:42 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition_options.h,v 1.4 2000/03/01 00:25:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/rendition_options.h,v 1.5 2001/05/04 19:05:42 dawes Exp $ */ #ifndef __RENDITION_OPTION_H__ #define __RENDITION_OPTION_H__ @@ -20,7 +20,7 @@ /*********************************/ For reference only <DI> -static OptionInfoRec renditionOptions[]={ +static const OptionInfoRec renditionOptions[]={ { OPTION_FBWC, "FramebufferWC", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c:1.8 Fri Mar 31 15:13:27 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c Fri May 4 15:05:42 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c,v 1.8 2000/03/31 20:13:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vmodes.c,v 1.10 2001/05/04 19:05:42 dawes Exp $ */ /* * file vmodes.c * @@ -22,11 +22,6 @@ #undef DEBUG -/* Options data */ -#include "rendition_options.h" -extern OptionInfoRec renditionOptions[]; - - /* * defines */ @@ -387,12 +382,13 @@ renditionPtr pRendition = RENDITIONPTR(pScreenInfo); vu32 offset; - + int iob=pRendition->board.io_base; int swidth=pRendition->board.mode.screenwidth; int vwidth=pRendition->board.mode.virtualwidth; int bytespp=pRendition->board.mode.bitsperpixel>>3; int fifo_size=pRendition->board.mode.fifosize; + return; #ifdef DEBUG ErrorF( "Rendition: Debug verite_setframebase w=%d v=%d b=%d f=%d\n", Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c:1.11 xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c:1.11 Mon Jun 12 22:28:33 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c Wed May 16 02:48:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c,v 1.11 2000/06/13 02:28:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vramdac.c,v 1.13 2001/05/16 06:48:10 keithp Exp $ */ /* * includes */ @@ -422,12 +422,11 @@ vu16 iob=pRendition->board.io_base; vu32 crtc_status; int i, index; - int c; #ifdef DEBUG ErrorF ("Rendition: Debug verite_setpalette called\n"); #endif - + return; while (1) { crtc_status=verite_in32(iob+CRTCSTATUS); if (crtc_status & CRTCSTATUS_VERT_SYNC) Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h:1.6 xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h:1.6 Fri Mar 31 15:13:28 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h Fri May 4 15:05:42 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h,v 1.6 2000/03/31 20:13:28 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vtypes.h,v 1.7 2001/05/04 19:05:42 dawes Exp $ */ #ifndef _VTYPES_H_ #define _VTYPES_H_ @@ -166,6 +166,7 @@ CloseScreenProcPtr CloseScreen; /* wrap CloseScreen */ xf86CursorInfoPtr CursorInfoRec; /* Cursor data */ XAAInfoRecPtr AccelInfoRec; /* Needed for XAA */ + OptionInfoPtr Options; } renditionRec, *renditionPtr; #define RENDITIONPTR(p) ((renditionPtr)((p)->driverPrivate)) Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c:1.9 Fri Mar 31 15:13:29 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c Thu Feb 15 12:50:35 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c,v 1.9 2000/03/31 20:13:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.c,v 1.10 2001/02/15 17:50:35 eich Exp $ */ /* * file vvga.c * @@ -9,6 +9,7 @@ * includes */ #include "rendition.h" +#define VVGA_INTERNAL #include "vvga.h" #include "vtypes.h" #include "vos.h" @@ -45,7 +46,7 @@ * functions */ -void +static void verite_resetvga(void) { static struct VIDEO_REGS { @@ -97,7 +98,7 @@ -void +static void verite_loadvgafont(void) { int c; @@ -145,7 +146,6 @@ } xf86UnMapVidMem(0, vbase, 64*1024); - /* restore the standard vga register values */ verite_resetvga(); } @@ -206,7 +206,7 @@ verite_out32(iob+CRTCHORZ, 0x2b0a4f); verite_out32(iob+CRTCVERT, 0x9301df); verite_out32(iob+CRTCOFFSET, 0x40); - +#if 0 #ifdef SAVEVGA verite_loadvgafont(); verite_restoretextmode(board); @@ -217,6 +217,7 @@ verite_restorepalette(); #endif #endif +#endif } @@ -251,7 +252,7 @@ -void +static void verite_restoretextmode(struct verite_board_t *board) { vu8 *vbase; @@ -280,7 +281,7 @@ -void +static void verite_restorepalette(void) { int c; Index: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h:1.4 Fri Mar 31 15:13:29 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h Thu Feb 15 12:50:35 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h,v 1.4 2000/03/31 20:13:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/rendition/vvga.h,v 1.5 2001/02/15 17:50:35 eich Exp $ */ /* * file vvga.h * @@ -22,13 +22,14 @@ * function prototypes */ -void verite_resetvga(void); -void verite_loadvgafont(void); void verite_textmode(struct verite_board_t *board); void verite_savetextmode(struct verite_board_t *board); -void verite_restoretextmode(struct verite_board_t *board); -void verite_restorepalette(void); - +#ifdef VVGA_INTERNAL +static void verite_resetvga(void); +static void verite_loadvgafont(void); +static void verite_restoretextmode(struct verite_board_t *board); +static void verite_restorepalette(void); +#endif #endif /* __VVGA_H__ */ Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile:1.19 xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile:1.19 Mon Oct 23 08:10:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile Tue Jan 23 19:06:26 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile,v 1.19 2000/10/23 12:10:15 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/Imakefile,v 1.20 2001/01/24 00:06:26 dawes Exp $ /* * * Copyright 1995-1998 The XFree86 Project, Inc. @@ -45,7 +45,6 @@ InstallObjectModule(s3virge,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(s3virge,) InstallModuleManPage(s3virge) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES:1.18.2.1 xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES:1.18.2.1 Thu Feb 8 22:29:29 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES Thu Feb 8 22:23:29 2001 @@ -264,4 +264,4 @@ -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES,v 1.18.2.1 2001/02/09 03:29:29 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/TODO_NOTES,v 1.19 2001/02/09 03:23:29 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h:1.26 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h:1.27 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h:1.26 Tue Nov 28 15:59:17 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h Fri May 4 15:05:43 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h,v 1.26 2000/11/28 20:59:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v.h,v 1.27 2001/05/04 19:05:43 dawes Exp $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -257,6 +257,7 @@ /*************************/ /* ViRGE options -start- */ /*************************/ + OptionInfoPtr Options; /* Enable PCI burst mode for reads? */ Bool pci_burst; /* Diasable PCI retries */ Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c:1.70.2.1 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c:1.74.2.2 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c:1.70.2.1 Thu Feb 8 22:29:30 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c Mon May 28 04:40:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.70.2.1 2001/02/09 03:29:30 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_driver.c,v 1.74.2.2 2001/05/28 08:40:10 eich Exp $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -52,11 +52,9 @@ #include "s3v.h" -#ifdef DPMSExtension #include "globals.h" #define DPMS_SERVER #include "extensions/dpms.h" -#endif /* DPMSExtension */ /* * Internals @@ -69,7 +67,7 @@ */ /* Mandatory functions */ -static OptionInfoPtr S3VAvailableOptions(int chipid, int busid); +static const OptionInfoRec * S3VAvailableOptions(int chipid, int busid); static void S3VIdentify(int flags); static Bool S3VProbe(DriverPtr drv, int flags); static Bool S3VPreInit(ScrnInfoPtr pScrn, int flags); @@ -97,11 +95,9 @@ /* s3v.h - static Bool S3VSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); */ static void S3VLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, VisualPtr pVisual); -#ifdef DPMSExtension static void S3VDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif static Bool S3Vddc1(int scrnIndex); static Bool S3Vddc2(int scrnIndex); @@ -214,7 +210,7 @@ OPTION_FB_DRAW } S3VOpts; -static OptionInfoRec S3VOptions[] = +static const OptionInfoRec S3VOptions[] = { { OPTION_SLOW_EDODRAM, "slow_edodram", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SLOW_DRAM, "slow_dram", OPTV_BOOLEAN, {0}, FALSE }, @@ -319,9 +315,7 @@ static const char *fbSymbols[] = { "fbScreenInit", "fbBres", -#ifdef RENDER "fbPictureInit", -#endif NULL }; @@ -475,8 +469,7 @@ pScrn->driverPrivate = NULL; } -static -OptionInfoPtr +static const OptionInfoRec * S3VAvailableOptions(int chipid, int busid) { return S3VOptions; @@ -690,10 +683,13 @@ } /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, S3VOptions); + if (!(ps3v->Options = xalloc(sizeof(S3VOptions)))) + return FALSE; + memcpy(ps3v->Options, S3VOptions, sizeof(S3VOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, ps3v->Options); - if (xf86ReturnOptValBool(S3VOptions, OPTION_PCI_BURST, FALSE)) { + if (xf86ReturnOptValBool(ps3v->Options, OPTION_PCI_BURST, FALSE)) { ps3v->pci_burst = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: pci_burst - PCI burst read enabled\n"); } else @@ -701,8 +697,8 @@ /* default */ ps3v->NoPCIRetry = 1; /* Set option */ - if (xf86ReturnOptValBool(S3VOptions, OPTION_PCI_RETRY, FALSE)) { - if (xf86ReturnOptValBool(S3VOptions, OPTION_PCI_BURST, FALSE)) { + if (xf86ReturnOptValBool(ps3v->Options, OPTION_PCI_RETRY, FALSE)) { + if (xf86ReturnOptValBool(ps3v->Options, OPTION_PCI_BURST, FALSE)) { ps3v->NoPCIRetry = 0; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: pci_retry\n"); } @@ -711,85 +707,85 @@ "\"pci_retry\" option requires \"pci_burst\".\n"); } } - if (xf86IsOptionSet(S3VOptions, OPTION_FIFO_CONSERV)) { + if (xf86IsOptionSet(ps3v->Options, OPTION_FIFO_CONSERV)) { ps3v->fifo_conservative = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_conservative set\n"); } else ps3v->fifo_conservative = FALSE; - if (xf86IsOptionSet(S3VOptions, OPTION_FIFO_MODERATE)) { + if (xf86IsOptionSet(ps3v->Options, OPTION_FIFO_MODERATE)) { ps3v->fifo_moderate = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_moderate set\n"); } else ps3v->fifo_moderate = FALSE; - if (xf86IsOptionSet(S3VOptions, OPTION_FIFO_AGGRESSIVE)) { + if (xf86IsOptionSet(ps3v->Options, OPTION_FIFO_AGGRESSIVE)) { ps3v->fifo_aggressive = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_aggressive set\n"); } else ps3v->fifo_aggressive = FALSE; - if (xf86IsOptionSet(S3VOptions, OPTION_SLOW_EDODRAM)) { + if (xf86IsOptionSet(ps3v->Options, OPTION_SLOW_EDODRAM)) { ps3v->slow_edodram = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: slow_edodram set\n"); } else ps3v->slow_edodram = FALSE; - if (xf86IsOptionSet(S3VOptions, OPTION_SLOW_DRAM)) { + if (xf86IsOptionSet(ps3v->Options, OPTION_SLOW_DRAM)) { ps3v->slow_dram = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: slow_dram set\n"); } else ps3v->slow_dram = FALSE; - if (xf86IsOptionSet(S3VOptions, OPTION_FAST_DRAM)) { + if (xf86IsOptionSet(ps3v->Options, OPTION_FAST_DRAM)) { ps3v->fast_dram = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fast_dram set\n"); } else ps3v->fast_dram = FALSE; - if (xf86IsOptionSet(S3VOptions, OPTION_FPM_VRAM)) { + if (xf86IsOptionSet(ps3v->Options, OPTION_FPM_VRAM)) { ps3v->fpm_vram = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fpm_vram set\n"); } else ps3v->fpm_vram = FALSE; - if (xf86ReturnOptValBool(S3VOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(ps3v->Options, OPTION_NOACCEL, FALSE)) { ps3v->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: NoAccel - Acceleration disabled\n"); } else ps3v->NoAccel = FALSE; - if (xf86ReturnOptValBool(S3VOptions, OPTION_EARLY_RAS_PRECHARGE, FALSE)) { + if (xf86ReturnOptValBool(ps3v->Options, OPTION_EARLY_RAS_PRECHARGE, FALSE)) { ps3v->early_ras_precharge = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: early_ras_precharge set\n"); } else ps3v->early_ras_precharge = FALSE; - if (xf86ReturnOptValBool(S3VOptions, OPTION_LATE_RAS_PRECHARGE, FALSE)) { + if (xf86ReturnOptValBool(ps3v->Options, OPTION_LATE_RAS_PRECHARGE, FALSE)) { ps3v->late_ras_precharge = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: late_ras_precharge set\n"); } else ps3v->late_ras_precharge = FALSE; - if (xf86ReturnOptValBool(S3VOptions, OPTION_LCD_CENTER, FALSE)) { + if (xf86ReturnOptValBool(ps3v->Options, OPTION_LCD_CENTER, FALSE)) { ps3v->lcd_center = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: lcd_center set\n"); } else ps3v->lcd_center = FALSE; - if (xf86ReturnOptValBool(S3VOptions, OPTION_SHOWCACHE, FALSE)) { + if (xf86ReturnOptValBool(ps3v->Options, OPTION_SHOWCACHE, FALSE)) { ps3v->ShowCache = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: show_cache set\n"); } else ps3v->ShowCache = FALSE; - if (xf86GetOptValInteger(S3VOptions, OPTION_LCDCLOCK, &ps3v->LCDClk)) { + if (xf86GetOptValInteger(ps3v->Options, OPTION_LCDCLOCK, &ps3v->LCDClk)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: lcd_setclk set to %1.3f Mhz\n", ps3v->LCDClk / 1000.0 ); } else ps3v->LCDClk = 0; - if (xf86GetOptValFreq(S3VOptions, OPTION_MCLK, OPTUNITS_MHZ, &real)) { + if (xf86GetOptValFreq(ps3v->Options, OPTION_MCLK, OPTUNITS_MHZ, &real)) { ps3v->MCLK = (int)(real * 1000.0); if (ps3v->MCLK <= 100000) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: set_mclk set to %1.3f Mhz\n", @@ -803,7 +799,7 @@ } else ps3v->MCLK = 0; - if (xf86GetOptValFreq(S3VOptions, OPTION_REFCLK, OPTUNITS_MHZ, &real)) { + if (xf86GetOptValFreq(ps3v->Options, OPTION_REFCLK, OPTUNITS_MHZ, &real)) { ps3v->REFCLK = (int)(real * 1000.0); xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: set_refclk set to %1.3f Mhz\n", ps3v->REFCLK / 1000.0 ); @@ -812,20 +808,20 @@ from = X_DEFAULT; ps3v->hwcursor = TRUE; - if (xf86GetOptValBool(S3VOptions, OPTION_HWCURSOR, &ps3v->hwcursor)) + if (xf86GetOptValBool(ps3v->Options, OPTION_HWCURSOR, &ps3v->hwcursor)) from = X_CONFIG; - if (xf86ReturnOptValBool(S3VOptions, OPTION_SWCURSOR, FALSE)) { + if (xf86ReturnOptValBool(ps3v->Options, OPTION_SWCURSOR, FALSE)) { ps3v->hwcursor = FALSE; from = X_CONFIG; } xf86DrvMsg(pScrn->scrnIndex, from, "Using %s Cursor\n", ps3v->hwcursor ? "HW" : "SW"); - if (xf86GetOptValBool(S3VOptions, OPTION_SHADOW_FB,&ps3v->shadowFB)) + if (xf86GetOptValBool(ps3v->Options, OPTION_SHADOW_FB,&ps3v->shadowFB)) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShadowFB %s.\n", ps3v->shadowFB ? "enabled" : "disabled"); - if ((s = xf86GetOptValString(S3VOptions, OPTION_ROTATE))) { + if ((s = xf86GetOptValString(ps3v->Options, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) { /* accel is disabled below for shadowFB */ ps3v->shadowFB = TRUE; @@ -857,9 +853,9 @@ ps3v->hwcursor = FALSE; } - if (xf86IsOptionSet(S3VOptions, OPTION_FB_DRAW)) + if (xf86IsOptionSet(ps3v->Options, OPTION_FB_DRAW)) { - if (xf86GetOptValBool(S3VOptions, OPTION_FB_DRAW ,&ps3v->UseFB)) + if (xf86GetOptValBool(ps3v->Options, OPTION_FB_DRAW ,&ps3v->UseFB)) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using %s.\n", ps3v->UseFB ? "fb (not cfb)" : "cfb (not fb)"); } @@ -944,11 +940,15 @@ if (pScrn->chipset == NULL) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04X is not recognised\n", ps3v->Chipset); + vbeFree(ps3v->pVbe); + ps3v->pVbe = NULL; return FALSE; } if (ps3v->Chipset < 0) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Chipset \"%s\" is not recognised\n", pScrn->chipset); + vbeFree(ps3v->pVbe); + ps3v->pVbe = NULL; return FALSE; } @@ -993,9 +993,10 @@ S3Vddc2(pScrn->scrnIndex); } } - if (ps3v->pVbe) + if (ps3v->pVbe) { vbeFree(ps3v->pVbe); - + ps3v->pVbe = NULL; + } /* * If the driver can do gamma correction, it should call xf86SetGamma() @@ -1302,10 +1303,8 @@ #if 0 -#ifdef XFreeXDGA vga256InfoRec.directMode = XF86DGADirectPresent; #endif -#endif #if 0 @@ -1450,8 +1449,8 @@ { if( xf86LoadSubModule(pScrn, "fb") == NULL ) { - S3VFreeRec(pScrn); - return FALSE; + S3VFreeRec(pScrn); + return FALSE; } xf86LoaderReqSymLists(fbSymbols, NULL); } @@ -1481,8 +1480,8 @@ break; } if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { - S3VFreeRec(pScrn); - return FALSE; + S3VFreeRec(pScrn); + return FALSE; } xf86LoaderReqSymbols(reqSym, NULL); @@ -2544,10 +2543,8 @@ ps3v->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = S3VCloseScreen; -#ifdef DPMSExtension if(xf86DPMSInit(pScreen, S3VDisplayPowerManagementSet, 0) == FALSE) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed!\n"); -#endif #ifndef XvExtension { @@ -2633,10 +2630,8 @@ ret = FALSE; break; } -#ifdef RENDER if (ret) fbPictureInit (pScreen, 0, 0); -#endif } else { @@ -3759,7 +3754,6 @@ * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -#ifdef DPMSExtension static void S3VDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -3808,7 +3802,6 @@ return; } -#endif /* DPMSExtension */ static unsigned int S3Vddc1Read(ScrnInfoPtr pScrn) @@ -3874,6 +3867,7 @@ if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c:1.2.2.1 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c:1.2.2.1 Thu Feb 8 22:29:31 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c Thu Feb 8 22:23:30 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.2.2.1 2001/02/09 03:29:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3v_xv.c,v 1.3 2001/02/09 03:23:30 dawes Exp $ */ /* Copyright (C) 2000 The XFree86 Project, Inc. All Rights Reserved. Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp:1.12 xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp:1.12 Tue Dec 12 13:54:31 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp Mon Jun 4 12:41:03 2001 @@ -1,229 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.cpp,v 1.12 2000/12/12 18:54:31 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH s3virge __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -s3virge \- S3 ViRGE video driver -.SH SYNOPSIS -.B "Section \*qDevice\*q" -.br -.BI " Identifier \*q" devname \*q -.br -.B " Driver \*qs3virge\*q" -.br -\ \ ... -.br -\ \ [ -.B "Option" -"optionname" ["optionvalue"]] -.br -.B EndSection -.SH DESCRIPTION -.B s3virge -is an XFree86 driver for S3 based video cards. The driver is fully -accelerated, and provides support for the following framebuffer depths: -8, 15, 16, and 24. All -visual types are supported for depth 8, and TrueColor -visuals are supported for the other depths. -.SH SUPPORTED HARDWARE -The -.B s3virge -driver supports PCI and AGP video cards based on the following S3 chips: -.TP 12 -.B ViRGE -86C325 -.TP 12 -.B ViRGE VX -86C988 -.TP 12 -.B ViRGE DX -86C375 -.TP 12 -.B ViRGE GX -86C385 -.TP 12 -.B ViRGE GX2 -86C357 -.TP 12 -.B ViRGE MX -86C260 -.TP 12 -.B ViRGE MX+ -86C280 -.TP 12 -.B Trio 3D -86C365 -.TP 12 -.B Trio 3D/2X -86C362, 86C368 -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. All options names are case and white space insensitive when -parsed by the server, for example, "virge vx" and "VIRGEvx" are equivalent. -.PP -The driver auto-detects the chipset type, but the following -.B ChipSet -names may optionally be specified in the config file -.B \*q"Device\*q" -section, and will override the auto-detection: -.PP -.RS 4 -"virge", "86c325", "virge vx", "86c988", "virge dx", "86c375", -"virge gx", "86c385", "virge gx2", "86c357", "virge mx", "86c260", -"virge mx+", "86c280", "trio 3d", "86c365", "trio 3d/2x", "86c362", -"86c368". -.RE - -.PP -The following Cursor -.B Options -are supported: -.TP -.BI "Option \*qHWCursor\*q [\*q" boolean \*q] -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option \*qSWCursor\*q [\*q" boolean \*q] -Inverse of "HWCursor". Default: off. - -.PP -The following display -.B Options -are supported: -.TP -.BI "Option \*qShadowFB\*q [\*q" boolean \*q] -Use shadow framebuffer. Disables HW acceleration. Default: off. -.TP -.BR "Option \*qRotate\*q \*q" cw " | " ccw \*q -Rotate the screen CW - clockwise or CCW - counter clockwise. -Disables HW Acceleration and HW Cursor, uses ShadowFB. -Default: no rotation. - -.PP -The following video memory -.B Options -are supported: -.TP -.BI "Option \*qslow_edodram\*q" -Switch the standard ViRGE to 2-cycle edo mode. Try this -if you encounter pixel corruption on the ViRGE. Using this option will -cause a large decrease in performance. Default: off. -.TP -.BI "Option \*qfpm_vram\*q" -Switch the ViRGE/VX to fast page mode vram mode. Default: off. -.TP -.BR "Option \*qslow_dram " | " fast_dram\*q" -Change Trio 3D and 3D/2X memory options. Default: Use BIOS defaults. -.TP -.BR "Option \*qearly_ras_precharge " | " late_ras_precharge\*q" -adjust memory parameters. One -of these will us the same settings as your video card defaults, and -using neither in the config file does the same. Default: none. -.TP -.BI "Option \*qset_mclk\*q \*q" integer \*q -sets the memory clock, where -.I integer -is in kHz, and -.I integer -<= 100000. Default: probe the memory clock value, -and use it at server start. -.TP -.BI "Option \*qset_refclk\*q \*q" integer \*q -sets the ref clock for ViRGE MX, where -.I integer -is in kHz. Default: probe the memory clock value, -and use it at server start. - - -.PP -The following acceleration and graphics engine -.B Options -are supported: -.TP -.B "Option \*qNoAccel\*q" -Disable acceleration. Very useful for determining if the -driver has problems with drawing and acceleration routines. This is the first -option to try if your server runs but you see graphic corruption on the screen. -Using it decreases performance, as it uses software emulation for drawing -operations the video driver can accelerate with hardware. -Default: acceleration is enabled. -.TP -.B "Option \*qUseFB\*q" -There are two framebuffer rendering methods. fb and cfb. Both are -available in the driver. fb is the newer and default method. To switch -back to cfb use this option with no, off or other negative parameter. -Default: on. -.TP -.BR "Option \*qfifo_aggressive " | " fifo_moderate " | " fifo_conservative\*q" -alter the settings -for the threshold at which the pixel FIFO takes over the internal -memory bus to refill itself. The smaller this threshold, the better -the acceleration performance of the card. You may try the fastest -setting -.RB ( "fifo_aggressive" ) -and move down if you encounter pixel corruption. -The optimal setting will probably depend on dot-clock and on color -depth. Note that specifying any of these options will also alter other -memory settings which may increase performance, so trying -.B "fifo_conservative" -will in most cases be a slight benefit (this uses the chip defaults). -If pixel corruption or transient streaking is observed during drawing -operations then removing any fifo options is recommended. Default: none. - -.PP -The following PCI bus -.B Options -are supported: -.TP -.BI "Option \*qpci_burst\*q [\*q" boolean \*q] -will enable PCI burst mode. This should work on all but a -few broken PCI chipsets, and will increase performance. Default: off. -.TP -.BI "Option \*qpci_retry\*q [\*q" boolean \*q] -will allow the driver to rely on PCI Retry to program the -ViRGE registers. -.B "pci_burst" -must be enabled for this to work. -This will increase performance, especially for small fills/blits, -because the driver does not have to poll the ViRGE before sending it -commands to make sure it is ready. It should work on most -recent PCI chipsets. Default: off. -.PP -The following ViRGE MX LCD -.B Options -are supported: -.TP -.BI "Option \*qlcd_center\*q" -.TP -.BI "Option \*qset_lcdclk\*q \*q" integer \*q -allows setting the clock for a ViRGE MX LCD display. -.I integer -is in Hz. Default: use probed value. - -.PP -The following additional -.B Options -are supported: -.TP -.BI "Option \*qShowCache\*q [\*q" boolean \*q] -Enable or disable viewing offscreen cache memory. A -development debug option. Default: off. - -.SH SEE ALSO -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) - -.SH SUPPORT -For assistance with this driver, or XFree86 in general, check the XFree86 web -site at http://www.xfree86.org. A FAQ is available on the web site at -http://www.xfree86.org/FAQ/. If you find a problem with XFree86 or have a -question not answered in the FAQ please use our bug report form available on -the web site or send mail to XFree86@XFree86.org. When reporting problems -with the driver send as much detail as possible, including chipset type, a -server output log, and operating system specifics. - -.SH AUTHORS -Kevin Brosius, -Matt Grossman, -Harald Koenig, -Sebastien Marineau, -Mark Vojkovich. Index: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man:1.2 --- /dev/null Mon Jun 4 12:41:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man Sat Jan 27 13:20:52 2001 @@ -0,0 +1,229 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/s3virge/s3virge.man,v 1.2 2001/01/27 18:20:52 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH s3virge __drivermansuffix__ __vendorversion__ +.SH NAME +s3virge \- S3 ViRGE video driver +.SH SYNOPSIS +.B "Section \*qDevice\*q" +.br +.BI " Identifier \*q" devname \*q +.br +.B " Driver \*qs3virge\*q" +.br +\ \ ... +.br +\ \ [ +.B "Option" +"optionname" ["optionvalue"]] +.br +.B EndSection +.SH DESCRIPTION +.B s3virge +is an XFree86 driver for S3 based video cards. The driver is fully +accelerated, and provides support for the following framebuffer depths: +8, 15, 16, and 24. All +visual types are supported for depth 8, and TrueColor +visuals are supported for the other depths. +.SH SUPPORTED HARDWARE +The +.B s3virge +driver supports PCI and AGP video cards based on the following S3 chips: +.TP 12 +.B ViRGE +86C325 +.TP 12 +.B ViRGE VX +86C988 +.TP 12 +.B ViRGE DX +86C375 +.TP 12 +.B ViRGE GX +86C385 +.TP 12 +.B ViRGE GX2 +86C357 +.TP 12 +.B ViRGE MX +86C260 +.TP 12 +.B ViRGE MX+ +86C280 +.TP 12 +.B Trio 3D +86C365 +.TP 12 +.B Trio 3D/2X +86C362, 86C368 +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. All options names are case and white space insensitive when +parsed by the server, for example, "virge vx" and "VIRGEvx" are equivalent. +.PP +The driver auto-detects the chipset type, but the following +.B ChipSet +names may optionally be specified in the config file +.B \*q"Device\*q" +section, and will override the auto-detection: +.PP +.RS 4 +"virge", "86c325", "virge vx", "86c988", "virge dx", "86c375", +"virge gx", "86c385", "virge gx2", "86c357", "virge mx", "86c260", +"virge mx+", "86c280", "trio 3d", "86c365", "trio 3d/2x", "86c362", +"86c368". +.RE + +.PP +The following Cursor +.B Options +are supported: +.TP +.BI "Option \*qHWCursor\*q [\*q" boolean \*q] +Enable or disable the HW cursor. Default: on. +.TP +.BI "Option \*qSWCursor\*q [\*q" boolean \*q] +Inverse of "HWCursor". Default: off. + +.PP +The following display +.B Options +are supported: +.TP +.BI "Option \*qShadowFB\*q [\*q" boolean \*q] +Use shadow framebuffer. Disables HW acceleration. Default: off. +.TP +.BR "Option \*qRotate\*q \*q" cw " | " ccw \*q +Rotate the screen CW - clockwise or CCW - counter clockwise. +Disables HW Acceleration and HW Cursor, uses ShadowFB. +Default: no rotation. + +.PP +The following video memory +.B Options +are supported: +.TP +.BI "Option \*qslow_edodram\*q" +Switch the standard ViRGE to 2-cycle edo mode. Try this +if you encounter pixel corruption on the ViRGE. Using this option will +cause a large decrease in performance. Default: off. +.TP +.BI "Option \*qfpm_vram\*q" +Switch the ViRGE/VX to fast page mode vram mode. Default: off. +.TP +.BR "Option \*qslow_dram " | " fast_dram\*q" +Change Trio 3D and 3D/2X memory options. Default: Use BIOS defaults. +.TP +.BR "Option \*qearly_ras_precharge " | " late_ras_precharge\*q" +adjust memory parameters. One +of these will us the same settings as your video card defaults, and +using neither in the config file does the same. Default: none. +.TP +.BI "Option \*qset_mclk\*q \*q" integer \*q +sets the memory clock, where +.I integer +is in kHz, and +.I integer +<= 100000. Default: probe the memory clock value, +and use it at server start. +.TP +.BI "Option \*qset_refclk\*q \*q" integer \*q +sets the ref clock for ViRGE MX, where +.I integer +is in kHz. Default: probe the memory clock value, +and use it at server start. + + +.PP +The following acceleration and graphics engine +.B Options +are supported: +.TP +.B "Option \*qNoAccel\*q" +Disable acceleration. Very useful for determining if the +driver has problems with drawing and acceleration routines. This is the first +option to try if your server runs but you see graphic corruption on the screen. +Using it decreases performance, as it uses software emulation for drawing +operations the video driver can accelerate with hardware. +Default: acceleration is enabled. +.TP +.B "Option \*qUseFB\*q" +There are two framebuffer rendering methods. fb and cfb. Both are +available in the driver. fb is the newer and default method. To switch +back to cfb use this option with no, off or other negative parameter. +Default: on. +.TP +.BR "Option \*qfifo_aggressive " | " fifo_moderate " | " fifo_conservative\*q" +alter the settings +for the threshold at which the pixel FIFO takes over the internal +memory bus to refill itself. The smaller this threshold, the better +the acceleration performance of the card. You may try the fastest +setting +.RB ( "fifo_aggressive" ) +and move down if you encounter pixel corruption. +The optimal setting will probably depend on dot-clock and on color +depth. Note that specifying any of these options will also alter other +memory settings which may increase performance, so trying +.B "fifo_conservative" +will in most cases be a slight benefit (this uses the chip defaults). +If pixel corruption or transient streaking is observed during drawing +operations then removing any fifo options is recommended. Default: none. + +.PP +The following PCI bus +.B Options +are supported: +.TP +.BI "Option \*qpci_burst\*q [\*q" boolean \*q] +will enable PCI burst mode. This should work on all but a +few broken PCI chipsets, and will increase performance. Default: off. +.TP +.BI "Option \*qpci_retry\*q [\*q" boolean \*q] +will allow the driver to rely on PCI Retry to program the +ViRGE registers. +.B "pci_burst" +must be enabled for this to work. +This will increase performance, especially for small fills/blits, +because the driver does not have to poll the ViRGE before sending it +commands to make sure it is ready. It should work on most +recent PCI chipsets. Default: off. +.PP +The following ViRGE MX LCD +.B Options +are supported: +.TP +.BI "Option \*qlcd_center\*q" +.TP +.BI "Option \*qset_lcdclk\*q \*q" integer \*q +allows setting the clock for a ViRGE MX LCD display. +.I integer +is in Hz. Default: use probed value. + +.PP +The following additional +.B Options +are supported: +.TP +.BI "Option \*qShowCache\*q [\*q" boolean \*q] +Enable or disable viewing offscreen cache memory. A +development debug option. Default: off. + +.SH SEE ALSO +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) + +.SH SUPPORT +For assistance with this driver, or XFree86 in general, check the XFree86 web +site at http://www.xfree86.org. A FAQ is available on the web site at +http://www.xfree86.org/FAQ/. If you find a problem with XFree86 or have a +question not answered in the FAQ please use our bug report form available on +the web site or send mail to XFree86@XFree86.org. When reporting problems +with the driver send as much detail as possible, including chipset type, a +server output log, and operating system specifics. + +.SH AUTHORS +Kevin Brosius, +Matt Grossman, +Harald Koenig, +Sebastien Marineau, +Mark Vojkovich. Index: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile:1.2 Sat Dec 2 10:30:48 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile Tue Feb 13 16:15:19 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v 1.2 2000/12/02 15:30:48 tsi Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/Imakefile,v 1.5 2001/02/13 21:15:19 dawes Exp $ /* * * Copyright 1995-1998 The XFree86 Project, Inc. @@ -9,18 +9,24 @@ #include <Server.tmpl> SRCS = savage_driver.c \ - savage_accel.c \ - savage_cursor.c \ - savage_image.c \ - savage_shadow.c \ - savage_vbe.c + savage_accel.c \ + savage_cursor.c \ + savage_dga.c \ + savage_i2c.c \ + savage_image.c \ + savage_shadow.c \ + savage_vbe.c \ + savage_video.c OBJS = savage_driver.o \ - savage_accel.o \ - savage_cursor.o \ - savage_image.o \ - savage_shadow.o \ - savage_vbe.o + savage_accel.o \ + savage_cursor.o \ + savage_dga.o \ + savage_i2c.o \ + savage_image.o \ + savage_shadow.o \ + savage_vbe.o \ + savage_video.o DEFINES = -DPSZ=8 @@ -28,13 +34,13 @@ 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$(SERVERSRC)/mi \ + -I$(XF86SRC)/xaa \ -I$(XF86SRC)/xf1bpp -I$(XF86SRC)/xf4bpp \ -I$(XF86SRC)/xf24_32bpp -I$(SERVERSRC)/Xext \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ - -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ - -I$(XF86SRC)/rac -I$(XF86SRC)/int10 -I$(SERVERSRC)/render \ + -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ + -I$(XF86SRC)/rac -I$(XF86SRC)/int10 -I$(SERVERSRC)/render \ -I$(SERVERSRC)/include -I$(XINCLUDESRC) -I$(FONTINCSRC) \ -I$(EXTINCSRC) -I$(XF86OSSRC)/vbe -I$(XF86SRC)/shadowfb #endif @@ -51,7 +57,6 @@ InstallObjectModule(savage,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(savage,) InstallModuleManPage(savage) #endif @@ -61,13 +66,16 @@ InstallDriverSDKNonExecFile(savage_accel.c,$(DRIVERSDKDIR)/drivers/savage) InstallDriverSDKNonExecFile(savage_bci.h,$(DRIVERSDKDIR)/drivers/savage) InstallDriverSDKNonExecFile(savage_cursor.c,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_dga.c,$(DRIVERSDKDIR)/drivers/savage) InstallDriverSDKNonExecFile(savage_driver.c,$(DRIVERSDKDIR)/drivers/savage) InstallDriverSDKNonExecFile(savage_driver.h,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_i2c.c,$(DRIVERSDKDIR)/drivers/savage) InstallDriverSDKNonExecFile(savage_image.c,$(DRIVERSDKDIR)/drivers/savage) InstallDriverSDKNonExecFile(savage_regs.h,$(DRIVERSDKDIR)/drivers/savage) InstallDriverSDKNonExecFile(savage_shadow.c,$(DRIVERSDKDIR)/drivers/savage) InstallDriverSDKNonExecFile(savage_vbe.c,$(DRIVERSDKDIR)/drivers/savage) InstallDriverSDKNonExecFile(savage_vbe.h,$(DRIVERSDKDIR)/drivers/savage) +InstallDriverSDKNonExecFile(savage_video.c,$(DRIVERSDKDIR)/drivers/savage) InstallDriverSDKNonExecFile(savage.cpp,$(DRIVERSDKDIR)/drivers/savage) InstallDriverSDKObjectModule(savage,$(DRIVERSDKMODULEDIR),drivers) Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp:1.2 xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp:1.2 Mon Dec 11 15:18:25 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp Mon Jun 4 12:41:03 2001 @@ -1,96 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.cpp,v 1.2 2000/12/11 20:18:25 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SAVAGE __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -savage \- S3 Savage video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsavage\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B savage -is an XFree86 driver for the S3 Savage family video accelerator chips. The -.B savage -driver supports PCI and AGP boards with the following chips: -.TP 16 -.BI Savage3D -(8a20 and 8a21) -.TP 16 -.B Savage4 -(8a22) -.TP 16 -.B Savage2000 -(9102) -.TP 16 -.B Savage/MX -(8c10 and 8c11) -.TP 16 -.B Savage/IX -(8c12 and 8c13) -.TP 16 -.B ProSavage PM133 -(8a25) -.TP 16 -.B ProSavage KM133 -(8a26) -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -These two options interact to specify hardware or software cursor. If the -SWCursor option is specified, any HWCursor setting is ignored. Thus, either -\*qHWCursor off\*q or \*qSWCursor on\*q will force the use of the software -cursor. On Savage/MX and Savage/IX chips which are connected to LCDs, a -software cursor will be forced, because the Savage hardware cursor does not -correctly track the automatic panel expansion feature. -Default: hardware cursor. -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qRotate\*q \*qCW\*q" -.TP -.BI "Option \*qRotate\*q \*qCCW\*q" -Rotate the desktop 90 degrees clockwise or counterclockwise. This option -forces the ShadowFB option on, and disables acceleration. -Default: no rotation. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. This option -disables acceleration. Default: off. -.TP -.BI "Option \*qUseBIOS\*q \*q" boolean \*q -Enable or disable use of the video BIOS to change modes. Ordinarily, the -.B savage -driver tries to use the video BIOS to do mode switches. This generally -produces the best results with the mobile chips (/MX and /IX), since the BIOS -knows how to handle the critical but unusual timing requirements of the -various LCD panels supported by the chip. To do this, the driver searches -through the BIOS mode list, looking for the mode which most closely matches -the XF86Config mode line. Some purists find this scheme objectionable. If -you would rather have the -.B savage -driver use your mode line timing exactly, turn off the UseBios option. -Default: on (use the BIOS). -.SH FILES -savage_drv.o -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include Tim Roberts (timr@probo.com) and Ani Joshi (ajoshi@unixbox.com) -for the 4.0 version, and Tim Roberts and S. Marineau for the 3.3 driver from -which this was derived. Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man:1.4 --- /dev/null Mon Jun 4 12:41:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man Fri May 18 19:35:32 2001 @@ -0,0 +1,120 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage.man,v 1.4 2001/05/18 23:35:32 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH SAVAGE __drivermansuffix__ __vendorversion__ +.SH NAME +savage \- S3 Savage video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qsavage\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B savage +is an XFree86 driver for the S3 Savage family video accelerator chips. The +.B savage +driver supports PCI and AGP boards with the following chips: +.TP 16 +.BI Savage3D +(8a20 and 8a21) +.TP 16 +.B Savage4 +(8a22) +.TP 16 +.B Savage2000 +(9102) +.TP 16 +.B Savage/MX +(8c10 and 8c11) +.TP 16 +.B Savage/IX +(8c12 and 8c13) +.TP 16 +.B ProSavage PM133 +(8a25) +.TP 16 +.B ProSavage KM133 +(8a26) +.TP 16 +.B Twister +(8d01) +.TP 16 +.B TwisterK +(8d02) +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +These two options interact to specify hardware or software cursor. If the +SWCursor option is specified, any HWCursor setting is ignored. Thus, either +\*qHWCursor off\*q or \*qSWCursor on\*q will force the use of the software +cursor. On Savage/MX and Savage/IX chips which are connected to LCDs, a +software cursor will be forced, because the Savage hardware cursor does not +correctly track the automatic panel expansion feature. +Default: hardware cursor. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.TP +.BI "Option \*qRotate\*q \*qCW\*q" +.TP +.BI "Option \*qRotate\*q \*qCCW\*q" +Rotate the desktop 90 degrees clockwise or counterclockwise. This option +forces the ShadowFB option on, and disables acceleration. +Default: no rotation. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. See +shadowfb(__drivermansuffix__) for further information. This option +disables acceleration. Default: off. +.TP +.BI "Option \*qLCDClock\*q \*q" frequency \*q +Override the maximum dot clock. Some LCD panels produce incorrect results if +they are driven at too fast of a frequency. If UseBIOS is on, the BIOS will +usually restrict the clock to the correct range. If not, it might be +necessary to override it here. The +.B frequency +parameter may be specified as an integer in Hz (135750000), or with +standard suffixes like "k", "kHz", "M", or "MHz" (as in 135.75MHz). +.TP +.BI "Option \*qUseBIOS\*q \*q" boolean \*q +Enable or disable use of the video BIOS to change modes. Ordinarily, the +.B savage +driver tries to use the video BIOS to do mode switches. This generally +produces the best results with the mobile chips (/MX and /IX), since the BIOS +knows how to handle the critical but unusual timing requirements of the +various LCD panels supported by the chip. To do this, the driver searches +through the BIOS mode list, looking for the mode which most closely matches +the XF86Config mode line. Some purists find this scheme objectionable. If +you would rather have the +.B savage +driver use your mode line timing exactly, turn off the UseBios option. +Default: on (use the BIOS). +.BI "Option \*qShadowStatus\*q \q*" boolean \*q +Enables the use of a shadow status register. There is a chip bug in the +Savage graphics engine that can cause a bus lock when reading the engine +status register under heavy load, such as when scrolling text or dragging +windows. The bug affects about 4% of all Savage users. If your system +hangs regularly while scrolling text or dragging windows, try turning this +option on. This uses an alternate method of reading the engine status +which is slightly more expensive, but avoids the problem. Default: off +(use normal status register). +.SH FILES +savage_drv.o +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include Tim Roberts (timr@probo.com) and Ani Joshi (ajoshi@unixbox.com) +for the 4.0 version, and Tim Roberts and S. Marineau for the 3.3 driver from +which this was derived. Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c:1.4 Thu Dec 7 15:26:22 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c Fri May 18 19:35:32 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.4 2000/12/07 20:26:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_accel.c,v 1.10 2001/05/18 23:35:32 dawes Exp $ */ /* * @@ -16,30 +16,16 @@ */ #include "Xarch.h" -#include "xf86.h" -#include "xf86_ansic.h" -#include "xf86_OSproc.h" -#include "compiler.h" #include "xaalocal.h" #include "xaarop.h" -#include "xf86PciInfo.h" #include "miline.h" #include "savage_driver.h" #include "savage_regs.h" #include "savage_bci.h" - -/* Globals used in driver */ -extern pointer s3savMmioMem; -#ifdef __alpha__ -extern pointer s3savMmioMemSparse; -#endif - /* Forward declaration of functions used in the driver */ -static void SavageAccelSync( ScrnInfoPtr ); - static void SavageSetupForScreenToScreenCopy( ScrnInfoPtr pScrn, int xdir, @@ -212,15 +198,19 @@ unsigned int planemask ); +unsigned long writedw( unsigned long addr, unsigned long value ); +unsigned long readdw( unsigned long addr ); +unsigned long readfb( unsigned long addr ); +unsigned long writefb( unsigned long addr, unsigned long value ); +void writescan( unsigned long scan, unsigned long color ); -void SavageSetGBD( ScrnInfoPtr ); /* * This is used to cache the last known value for routines we want to * call from the debugger. */ -static ScrnInfoPtr gpScrn = 0; +ScrnInfoPtr gpScrn = 0; @@ -244,40 +234,73 @@ OUTREG(0x812C, ~0); /* enable all read planes */ OUTREG16(0x8134, 0x27); OUTREG16(0x8136, 0x07); - + 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); - /* Enabel 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; } @@ -289,10 +312,6 @@ /* 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); } @@ -304,13 +323,11 @@ 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. */ @@ -328,15 +345,15 @@ /* 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(0x81C8, pScrn->displayWidth << 4); - OUTREG(0x81D8, pScrn->displayWidth << 4); + OUTREG(PRI_STREAM_STRIDE, pScrn->displayWidth * pScrn->bitsPerPixel >> 3); + OUTREG(SEC_STREAM_STRIDE, pScrn->displayWidth * pScrn->bitsPerPixel >> 3); } @@ -352,18 +369,18 @@ /* Set-up our GE command primitive */ - if (pScrn->bitsPerPixel == 8) { - psav->PlaneMask = 0xFF; - } - else if (pScrn->bitsPerPixel == 16) { - psav->PlaneMask = 0xFFFF; - } - else if (pScrn->bitsPerPixel == 24) { - psav->PlaneMask = 0xFFFFFF; - } - else if (pScrn->bitsPerPixel == 32) { - psav->PlaneMask = 0xFFFFFFFF; - } + if (pScrn->depth == 8) { + psav->PlaneMask = 0xFF; + } + else if (pScrn->depth == 15) { + psav->PlaneMask = 0x7FFF; + } + else if (pScrn->depth == 16) { + psav->PlaneMask = 0xFFFF; + } + else if (pScrn->depth == 24) { + psav->PlaneMask = 0xFFFFFF; + } /* General acceleration flags */ @@ -420,6 +437,8 @@ | HARDWARE_PATTERN_SCREEN_ORIGIN | BIT_ORDER_IN_BYTE_LSBFIRST ; + if( psav->Chipset == S3_SAVAGE4 ) + xaaptr->Mono8x8PatternFillFlags |= NO_TRANSPARENCY; #endif /* Color 8x8 pattern fills */ @@ -490,6 +509,10 @@ | BIT_ORDER_IN_BYTE_MSBFIRST | LEFT_EDGE_CLIPPING ; + + if( psav->Chipset == S3_SAVAGE4 ) + xaaptr->ScanlineCPUToScreenColorExpandFillFlags |= ROP_NEEDS_SOURCE; + xaaptr->SetupForScanlineCPUToScreenColorExpandFill = SavageSetupForCPUToScreenColorExpandFill; xaaptr->SubsequentScanlineCPUToScreenColorExpandFill = @@ -504,7 +527,7 @@ psav->Bpp = pScrn->bitsPerPixel / 8; psav->Bpl = pScrn->displayWidth * psav->Bpp; - psav->ScissB = psav->CursorKByte / psav->Bpl; + psav->ScissB = (psav->CursorKByte << 10) / psav->Bpl; if (psav->ScissB > 2047) psav->ScissB = 2047; @@ -520,6 +543,9 @@ AvailFBArea.x2 = pScrn->displayWidth; AvailFBArea.y2 = psav->ScissB; xf86InitFBManager(pScreen, &AvailFBArea); + xf86DrvMsg( pScrn->scrnIndex, X_INFO, + "Using %d lines for offscreen memory.\n", + psav->ScissB - pScrn->virtualY ); return XAAInit(pScreen, xaaptr); } @@ -532,7 +558,7 @@ SavageAccelSync(ScrnInfoPtr pScrn) { SavagePtr psav = SAVPTR(pScrn); - WaitIdleEmpty(); + psav->WaitIdleEmpty(psav); } @@ -669,7 +695,7 @@ h ++; } - WaitQueue(6); + psav->WaitQueue(psav,6); BCI_SEND(psav->SavedBciCmd); if (psav->SavedBgColor != -1) BCI_SEND(psav->SavedBgColor); @@ -731,8 +757,11 @@ { SavagePtr psav = SAVPTR(pScrn); BCI_GET_PTR; + + if( !w || !h ) + return; - WaitQueue(5); + psav->WaitQueue(psav,5); BCI_SEND(psav->SavedBciCmd); if( psav->SavedBciCmd & BCI_CMD_SEND_COLOR ) @@ -816,7 +845,7 @@ /* 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)); @@ -846,7 +875,7 @@ 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--; @@ -912,8 +941,17 @@ { SavagePtr psav = SAVPTR(pScrn); BCI_GET_PTR; + + /* + * 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; - WaitQueue(7); + psav->WaitQueue(psav,7); BCI_SEND(psav->SavedBciCmd); if( psav->SavedBciCmd & BCI_CMD_SEND_COLOR ) BCI_SEND(psav->SavedFgColor); @@ -977,7 +1015,10 @@ 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); @@ -1009,7 +1050,7 @@ 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 ); @@ -1074,7 +1115,7 @@ 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 ); @@ -1102,7 +1143,7 @@ #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)); @@ -1116,90 +1157,9 @@ #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. */ Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c:1.1 Fri Dec 1 20:16:11 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c Fri May 18 19:35:32 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 1.1 2000/12/02 01:16:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_cursor.c,v 1.4 2001/05/18 23:35:32 dawes Exp $ */ /* * Hardware cursor support for S3 Savage 4.0 driver. Taken with @@ -12,8 +12,6 @@ #include "savage_driver.h" static void SavageLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src); -static void SavageShowCursor(ScrnInfoPtr pScrn); -static void SavageHideCursor(ScrnInfoPtr pScrn); static void SavageSetCursorPosition(ScrnInfoPtr pScrn, int x, int y); static void SavageSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg); @@ -24,8 +22,19 @@ #define inCRReg(reg) (VGAHWPTR(pScrn))->readCrtc( VGAHWPTR(pScrn), reg ) #define outCRReg(reg, val) (VGAHWPTR(pScrn))->writeCrtc( VGAHWPTR(pScrn), reg, val ) +#define inStatus1() (VGAHWPTR(pScrn))->readST01( VGAHWPTR(pScrn) ) - +/* + * certain HW cursor operations seem + * to require a delay to prevent lockups. + */ +#define waitHSync(n) { \ + int num = n; \ + while (num--) { \ + while ((inStatus1()) & 0x01){};\ + while (!(inStatus1()) & 0x01){};\ + } \ + } #define MAX_CURS 64 @@ -57,11 +66,12 @@ */ if( - ( (inCRReg(0x18) & 0x80) && (inCRReg(0x15) & 0x50) ) + ((psav->Chipset != S3_SAVAGE4) + && (inCRReg(0x18) & 0x80) && (inCRReg(0x15) & 0x50) ) || (psav->Chipset == S3_SAVAGE_MX) - ) - infoPtr->Flags |= HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; + ) + infoPtr->Flags |= HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; infoPtr->SetCursorColors = SavageSetCursorColors; infoPtr->SetCursorPosition = SavageSetCursorPosition; @@ -89,10 +99,14 @@ void SavageHideCursor(ScrnInfoPtr pScrn) { - /* Turn cursor off. */ - outCRReg( 0x45, inCRReg(0x45) & 0xfe ); -} + /* Turn cursor off. */ + if( S3_SAVAGE4_SERIES( SAVPTR(pScrn)->Chipset ) ) + { + waitHSync(5); + } + outCRReg( 0x45, inCRReg(0x45) & 0xfe ); +} static void SavageLoadCursorImage( @@ -117,7 +131,6 @@ } } - static void SavageSetCursorPosition( ScrnInfoPtr pScrn, @@ -126,6 +139,10 @@ { unsigned char xoff, yoff; + if( S3_SAVAGE4_SERIES( SAVPTR(pScrn)->Chipset ) ) + { + waitHSync(5); + } /* adjust for frame buffer base address granularity */ if (pScrn->bitsPerPixel == 8) x += ((pScrn->frameX0) & 3); @@ -175,15 +192,35 @@ Bool bNeedExtra = FALSE; /* Clock doubled modes need an extra cursor stack write. */ + bNeedExtra = (psav->CursorInfoRec->Flags & HARDWARE_CURSOR_TRUECOLOR_AT_8BPP); - - if( psav->Chipset == S3_SAVAGE_MX ) - bNeedExtra = TRUE; - switch (pScrn->bitsPerPixel) { - case 16: - if (pScrn->weight.green == 5) { + if( + (psav->Chipset == S3_SAVAGE_MX) || + (pScrn->depth == 24) || + ((pScrn->depth == 8) && bNeedExtra) + ) + { + /* Do it straight, full 24 bit color. */ + + /* Reset the cursor color stack pointer */ + inCRReg(0x45); + /* Write low, mid, high bytes - foreground */ + outCRReg(0x4a, fg); + outCRReg(0x4a, fg >> 8); + outCRReg(0x4a, fg >> 16); + /* Reset the cursor color stack pointer */ + inCRReg(0x45); + /* Write low, mid, high bytes - background */ + outCRReg(0x4b, bg); + outCRReg(0x4b, bg >> 8); + outCRReg(0x4b, bg >> 16); + return; + } + else if( (pScrn->depth == 15) || (pScrn->depth == 16) ) + { + if (pScrn->depth == 15) { fg = ((fg & 0xf80000) >> 9) | ((fg & 0xf800) >> 6) | ((fg & 0xf8) >> 3); @@ -216,40 +253,18 @@ outCRReg( 0x4b, bg ); outCRReg( 0x4b, bg>>8 ); } - break; - case 8: - if( !bNeedExtra ) - { - /* Reset the cursor color stack pointer */ - inCRReg(0x45); - /* Write foreground */ - outCRReg(0x4a, fg); - outCRReg(0x4a, fg); - /* Reset the cursor color stack pointer */ - inCRReg(0x45); - /* Write background */ - outCRReg(0x4b, bg); - outCRReg(0x4b, bg); - break; - } - /* else */ - /* FALLTHROUGH */ - case 24: - case 32: - /* Do it straight, full 24 bit color. */ - + } + else if( pScrn->depth == 8 ) + { /* Reset the cursor color stack pointer */ inCRReg(0x45); - /* Write low, mid, high bytes - foreground */ + /* Write foreground */ outCRReg(0x4a, fg); - outCRReg(0x4a, fg >> 8); - outCRReg(0x4a, fg >> 16); + outCRReg(0x4a, fg); /* Reset the cursor color stack pointer */ inCRReg(0x45); - /* Write low, mid, high bytes - background */ + /* Write background */ outCRReg(0x4b, bg); - outCRReg(0x4b, bg >> 8); - outCRReg(0x4b, bg >> 16); - break; + outCRReg(0x4b, bg); } } Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c:1.3 --- /dev/null Mon Jun 4 12:41:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c Fri May 18 19:35:32 2001 @@ -0,0 +1,390 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_dga.c,v 1.3 2001/05/18 23:35:32 dawes Exp $ */ + +/* +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, FIT- +NESS 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. +*/ + + +/* + * file: savage_dga.c + * ported from s3v, which was ported from mga + * + */ + + +#include "xaalocal.h" +#include "savage_driver.h" +#include "dgaproc.h" + + +Bool SavageDGAInit(ScreenPtr pScreen); +static Bool Savage_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, + int *, int *, int *); +static Bool Savage_SetMode(ScrnInfoPtr, DGAModePtr); +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); + + +static +DGAFunctionRec Savage_DGAFuncs = { + Savage_OpenFramebuffer, + NULL, /* CloseFrameBuffer */ + Savage_SetMode, + Savage_SetViewport, + Savage_GetViewport, + SavageAccelSync, + Savage_FillRect, + Savage_BlitRect, + NULL /* BlitTransRect */ +}; + +#define DGATRACE 4 + +/* + * I don't understand the thinking here. As near as I can tell, we are + * never asked to change into a depth other than the frame buffer depth. + * So why create modes to do so? + */ + +static DGAModePtr +SavageSetupDGAMode( + ScrnInfoPtr pScrn, + DGAModePtr modes, + int *num, + int bitsPerPixel, + int depth, + Bool pixmap, + int secondPitch, + unsigned long red, + unsigned long green, + unsigned long blue, + short visualClass +) +{ + SavagePtr psav = SAVPTR(pScrn); + DGAModePtr mode, newmodes = NULL; + DisplayModePtr pMode, firstMode; + int otherPitch, Bpp = bitsPerPixel >> 3; + Bool oneMore; + + 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; + + if(pMode->HDisplay != otherPitch) { + newmodes = xrealloc(modes, (*num + 2) * sizeof(DGAModeRec)); + oneMore = TRUE; + } else { + newmodes = xrealloc(modes, (*num + 1) * sizeof(DGAModeRec)); + oneMore = FALSE; + } + + if(!newmodes) { + xfree(modes); + return NULL; + } + modes = newmodes; + +SECOND_PASS: + + mode = modes + *num; + (*num)++; + + mode->mode = pMode; + mode->flags = DGA_CONCURRENT_ACCESS | DGA_PIXMAP_AVAILABLE; + if(!psav->NoAccel) + mode->flags |= DGA_FILL_RECT | DGA_BLIT_RECT; + if(pMode->Flags & V_DBLSCAN) + mode->flags |= DGA_DOUBLESCAN; + if(pMode->Flags & V_INTERLACE) + mode->flags |= DGA_INTERLACED; + mode->byteOrder = pScrn->imageByteOrder; + mode->depth = depth; + mode->bitsPerPixel = bitsPerPixel; + mode->red_mask = red; + mode->green_mask = green; + mode->blue_mask = blue; + mode->visualClass = visualClass; + mode->viewportWidth = pMode->HDisplay; + mode->viewportHeight = pMode->VDisplay; + mode->xViewportStep = 2; + mode->yViewportStep = 1; + mode->viewportFlags = DGA_FLIP_RETRACE; + mode->offset = 0; + mode->address = psav->FBBase; + + xf86ErrorFVerb(DGATRACE, + "SavageDGAInit vpWid=%d, vpHgt=%d, Bpp=%d, mdbitsPP=%d\n", + mode->viewportWidth, + mode->viewportHeight, + Bpp, + mode->bitsPerPixel + ); + + if(oneMore) { /* first one is narrow width */ + mode->bytesPerScanline = ((pMode->HDisplay * Bpp) + 3) & ~3L; + mode->imageWidth = pMode->HDisplay; + mode->imageHeight = pMode->VDisplay; + mode->pixmapWidth = mode->imageWidth; + mode->pixmapHeight = mode->imageHeight; + mode->maxViewportX = mode->imageWidth - mode->viewportWidth; + /* this might need to get clamped to some maximum */ + mode->maxViewportY = mode->imageHeight - mode->viewportHeight; + oneMore = FALSE; + + xf86ErrorFVerb(DGATRACE, + "SavageDGAInit 1 imgHgt=%d, stride=%d\n", + mode->imageHeight, + mode->bytesPerScanline ); + + goto SECOND_PASS; + } else { + mode->bytesPerScanline = ((pScrn->displayWidth * Bpp) + 3) & ~3L; + mode->imageWidth = pScrn->displayWidth; + mode->imageHeight = psav->videoRambytes / mode->bytesPerScanline; + mode->pixmapWidth = mode->imageWidth; + mode->pixmapHeight = mode->imageHeight; + 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; + if(pMode == firstMode) + break; + } + + return modes; +} + + +Bool +SavageDGAInit(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SavagePtr psav = SAVPTR(pScrn); + DGAModePtr modes = NULL; + int num = 0; + + xf86ErrorFVerb(DGATRACE, " SavageDGAInit\n"); + + /* 8 */ + modes = SavageSetupDGAMode (pScrn, modes, &num, 8, 8, + (pScrn->bitsPerPixel == 8), + (pScrn->bitsPerPixel != 8) ? 0 : pScrn->displayWidth, + 0, 0, 0, PseudoColor); + + /* 15 */ + modes = SavageSetupDGAMode (pScrn, modes, &num, 16, 15, + (pScrn->bitsPerPixel == 16), + (pScrn->depth != 15) ? 0 : pScrn->displayWidth, + 0x7c00, 0x03e0, 0x001f, TrueColor); + + modes = SavageSetupDGAMode (pScrn, modes, &num, 16, 15, + (pScrn->bitsPerPixel == 16), + (pScrn->depth != 15) ? 0 : pScrn->displayWidth, + 0x7c00, 0x03e0, 0x001f, DirectColor); + + /* 16 */ + modes = SavageSetupDGAMode (pScrn, modes, &num, 16, 16, + (pScrn->bitsPerPixel == 16), + (pScrn->depth != 16) ? 0 : pScrn->displayWidth, + 0xf800, 0x07e0, 0x001f, TrueColor); + + modes = SavageSetupDGAMode (pScrn, modes, &num, 16, 16, + (pScrn->bitsPerPixel == 16), + (pScrn->depth != 16) ? 0 : pScrn->displayWidth, + 0xf800, 0x07e0, 0x001f, DirectColor); + + /* 24-in-32 */ + modes = SavageSetupDGAMode (pScrn, modes, &num, 32, 24, + (pScrn->bitsPerPixel == 32), + (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth, + 0xff0000, 0x00ff00, 0x0000ff, TrueColor); + + modes = SavageSetupDGAMode (pScrn, modes, &num, 32, 24, + (pScrn->bitsPerPixel == 32), + (pScrn->bitsPerPixel != 32) ? 0 : pScrn->displayWidth, + 0xff0000, 0x00ff00, 0x0000ff, DirectColor); + + psav->numDGAModes = num; + psav->DGAModes = modes; + + return DGAInit(pScreen, &Savage_DGAFuncs, modes, num); +} + + +static Bool +Savage_SetMode( + ScrnInfoPtr pScrn, + DGAModePtr pMode +){ + static int OldDisplayWidth[MAXSCREENS]; + static int OldBitsPerPixel[MAXSCREENS]; + static int OldDepth[MAXSCREENS]; + int index = pScrn->pScreen->myNum; + SavagePtr psav = SAVPTR(pScrn); + + if(!pMode) { /* restore the original mode */ + /* put the ScreenParameters back */ + + pScrn->displayWidth = OldDisplayWidth[index]; + pScrn->bitsPerPixel = OldBitsPerPixel[index]; + pScrn->depth = OldDepth[index]; + + SavageSwitchMode(index, pScrn->currentMode, 0); + if( psav->hwcursor ) + SavageShowCursor(pScrn); + psav->DGAactive = FALSE; + } else { + Bool holdBIOS = psav->UseBIOS; + +#if 0 + ErrorF( + "pScrn->bitsPerPixel %d, pScrn->depth %d\n", + pScrn->bitsPerPixel, pScrn->depth); + ErrorF( + " want bitsPerPixel %d, want depth %d\n", + 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; + + psav->DGAactive = TRUE; + } + + pScrn->bitsPerPixel = pMode->bitsPerPixel; + pScrn->depth = pMode->depth; + pScrn->displayWidth = pMode->bytesPerScanline / + (pMode->bitsPerPixel >> 3); + + psav->UseBIOS = FALSE; + SavageSwitchMode(index, pMode->mode, 0); + psav->UseBIOS = holdBIOS; + } + + return TRUE; +} + + +static int +Savage_GetViewport( + ScrnInfoPtr pScrn +){ + SavagePtr psav = SAVPTR(pScrn); + return psav->DGAViewportStatus; +} + + +static void +Savage_SetViewport( + ScrnInfoPtr pScrn, + int x, int y, + int flags +){ + SavagePtr psav = SAVPTR(pScrn); + + SavageAdjustFrame(pScrn->pScreen->myNum, x, y, flags); + psav->DGAViewportStatus = 0; /* MGAAdjustFrame loops until finished */ +} + +static void +Savage_FillRect ( + ScrnInfoPtr pScrn, + int x, int y, int w, int h, + unsigned long color +){ + SavagePtr psav = SAVPTR(pScrn); + + if(psav->AccelInfoRec) { + (*psav->AccelInfoRec->SetupForSolidFill)(pScrn, color, GXcopy, ~0); + (*psav->AccelInfoRec->SubsequentSolidFillRect)(pScrn, x, y, w, h); + SET_SYNC_FLAG(psav->AccelInfoRec); + } +} + +static void +Savage_BlitRect( + ScrnInfoPtr pScrn, + int srcx, int srcy, + int w, int h, + int dstx, int dsty +){ + SavagePtr psav = SAVPTR(pScrn); + + if(psav->AccelInfoRec) { + int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; + int ydir = (srcy < dsty) ? -1 : 1; + + (*psav->AccelInfoRec->SetupForScreenToScreenCopy)( + pScrn, xdir, ydir, GXcopy, ~0, -1); + (*psav->AccelInfoRec->SubsequentScreenToScreenCopy)( + pScrn, srcx, srcy, dstx, dsty, w, h); + SET_SYNC_FLAG(psav->AccelInfoRec); + } +} + + +static Bool +Savage_OpenFramebuffer( + ScrnInfoPtr pScrn, + char **name, + unsigned char **mem, + int *size, + int *offset, + int *flags +){ + SavagePtr psav = SAVPTR(pScrn); + + *name = NULL; /* no special device */ + *mem = (unsigned char*)psav->FrameBufferBase; + *size = psav->videoRambytes; + *offset = 0; + *flags = DGA_NEED_ROOT; + + return TRUE; +} Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c:1.6.2.1 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c:1.6.2.1 Fri Mar 9 13:03:37 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c Fri May 18 19:35:32 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.6.2.1 2001/03/09 18:03:37 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.c,v 1.19 2001/05/18 23:35:32 dawes Exp $ */ /* * vim: sw=4 ts=8 ai ic: * @@ -15,12 +15,14 @@ #include "xf86RAC.h" #include "shadowfb.h" -#ifdef DPMSExtension #include "globals.h" #define DPMS_SERVER #include "extensions/dpms.h" -#endif /* DPMSExtension */ +#ifdef XvExtension +#include "xf86xv.h" +#endif + #include "savage_driver.h" #include "savage_bci.h" @@ -33,7 +35,7 @@ static void SavageEnableMMIO(ScrnInfoPtr pScrn); static void SavageDisableMMIO(ScrnInfoPtr pScrn); -static OptionInfoPtr SavageAvailableOptions(int chipid, int busid); +static const OptionInfoRec * SavageAvailableOptions(int chipid, int busid); static void SavageIdentify(int flags); static Bool SavageProbe(DriverPtr drv, int flags); static Bool SavagePreInit(ScrnInfoPtr pScrn, int flags); @@ -41,7 +43,7 @@ static Bool SavageEnterVT(int scrnIndex, int flags); static void SavageLeaveVT(int scrnIndex, int flags); static void SavageSave(ScrnInfoPtr pScrn); -static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr, SavageRegPtr); +static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr, SavageRegPtr, Bool); static Bool SavageScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv); @@ -49,39 +51,51 @@ static ModeStatus SavageValidMode(int index, DisplayModePtr mode, Bool verbose, int flags); +void SavageDGAInit(ScreenPtr); static Bool SavageMapMMIO(ScrnInfoPtr pScrn); static Bool SavageMapFB(ScrnInfoPtr pScrn); -static void SavageUnmapMem(ScrnInfoPtr pScrn); +static void SavageUnmapMem(ScrnInfoPtr pScrn, int All); static Bool SavageModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); static Bool SavageCloseScreen(int scrnIndex, ScreenPtr pScreen); static Bool SavageSaveScreen(ScreenPtr pScreen, int mode); static void SavageLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, VisualPtr pVisual); +static void SavageLoadPaletteSavage4(ScrnInfoPtr pScrn, int numColors, + int *indicies, LOCO *colors, + VisualPtr pVisual); static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1, int min_n2, int max_n2, long freq_min, long freq_max, unsigned int *mdiv, unsigned int *ndiv, unsigned int *r); void SavageGEReset(ScrnInfoPtr pScrn, int from_timeout, int line, char *file); void SavagePrintRegs(ScrnInfoPtr pScrn); -#ifdef DPMSExtension static void SavageDPMS(ScrnInfoPtr pScrn, int mode, int flags); -#endif +static Bool SavageDDC1(int scrnIndex); +static unsigned int SavageDDC1Read(ScrnInfoPtr pScrn); +static void SavageProbeDDC(ScrnInfoPtr pScrn, int index); -static int pix24bpp = 0; +extern ScrnInfoPtr gpScrn; #define iabs(a) ((int)(a)>0?(a):(-(a))) #define DRIVER_NAME "savage" -#define DRIVER_VERSION "1.1.0" +#define DRIVER_VERSION "1.1.16" #define VERSION_MAJOR 1 #define VERSION_MINOR 1 -#define PATCHLEVEL 0 +#define PATCHLEVEL 16 #define SAVAGE_VERSION ((VERSION_MAJOR << 24) | \ (VERSION_MINOR << 16) | \ PATCHLEVEL) +/*#define TRACEON*/ +#ifdef TRACEON +#define TRACE(prms) ErrorF prms +#else +#define TRACE(prms) +#endif + DriverRec SAVAGE = { SAVAGE_VERSION, @@ -107,6 +121,9 @@ { PCI_CHIP_SAVAGE_IX, "Savage/IX" }, { PCI_CHIP_PROSAVAGE_PM, "ProSavage PM133" }, { PCI_CHIP_PROSAVAGE_KM, "ProSavage KM133" }, + /* Twister is a code name; hope I get the real name soon. */ + { PCI_CHIP_S3TWISTER_P, "Twister" }, + { PCI_CHIP_S3TWISTER_K, "TwisterK" }, { -1, NULL } }; @@ -114,8 +131,8 @@ { 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 } }; @@ -132,22 +149,15 @@ { 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_S3TWISTER_P, RES_SHARED_VGA }, + { S3_PROSAVAGE, PCI_CHIP_S3TWISTER_K, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; typedef enum { - OPTION_SLOW_EDODRAM, - OPTION_SLOW_DRAM, - OPTION_FAST_DRAM, - OPTION_FPM_VRAM, OPTION_PCI_BURST, - OPTION_FIFO_CONSERV, - OPTION_FIFO_MODERATE, - OPTION_FIFO_AGGRESSIVE, OPTION_PCI_RETRY, OPTION_NOACCEL, - OPTION_EARLY_RAS_PRECHARGE, - OPTION_LATE_RAS_PRECHARGE, OPTION_LCD_CENTER, OPTION_LCDCLOCK, OPTION_MCLK, @@ -157,23 +167,21 @@ OPTION_HWCURSOR, OPTION_SHADOW_FB, OPTION_ROTATE, - OPTION_USEBIOS + OPTION_USEBIOS, + OPTION_SHADOW_STATUS } SavageOpts; -static OptionInfoRec SavageOptions[] = +static const OptionInfoRec SavageOptions[] = { - { OPTION_SLOW_EDODRAM, "slow_edodram", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_SLOW_DRAM, "slow_dram", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_FAST_DRAM, "fast_dram", OPTV_BOOLEAN, {0}, FALSE }, - { OPTION_FPM_VRAM, "fpm_vram", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HWCURSOR, "HWCursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SWCURSOR, "SWCursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE }, - /* finish later... */ + { OPTION_LCDCLOCK, "LCDClock", OPTV_FREQ, {0}, FALSE }, + { OPTION_SHADOW_STATUS, "ShadowStatus", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -211,11 +219,23 @@ NULL }; +static const char *vbeOptSymbols[] = { + "vbeModeInit", + "VBESetVBEMode", + NULL +}; + static const char *ddcSymbols[] = { "xf86InterpretEDID", NULL }; +static const char *i2cSymbols[] = { + "xf86CreateI2CBusRec", + "xf86I2CBusInit", + NULL +}; + static const char *xaaSymbols[] = { "XAACopyROP", "XAACopyROP_PM", @@ -224,6 +244,7 @@ "XAAHelpPatternROP", "XAAHelpSolidROP", "XAAInit", + "XAAFillSolidRects", "XAAScreenIndex", NULL }; @@ -242,14 +263,9 @@ NULL }; -static const char *cfbSymbols[] = { - "cfbScreenInit", - "cfb16ScreenInit", - "cfb24ScreenInit", - "cfb24_32ScreenInit", - "cfb32ScreenInit", - "cfb16BresS", - "cfb24BresS", +static const char *fbSymbols[] = { + "fbScreenInit", + "fbPictureInit", NULL }; @@ -280,9 +296,9 @@ if (!setupDone) { setupDone = TRUE; xf86AddDriver(&SAVAGE, module, 0); - LoaderRefSymLists(vgaHWSymbols, cfbSymbols, ramdacSymbols, + LoaderRefSymLists(vgaHWSymbols, fbSymbols, ramdacSymbols, xaaSymbols, shadowSymbols, vbeSymbols, - ddcSymbols, NULL); + int10Symbols, i2cSymbols, ddcSymbols, NULL); return (pointer) 1; } else { if (errmaj) @@ -322,6 +338,35 @@ } } +static Bool +ShadowWait( SavagePtr psav ) +{ + BCI_GET_PTR; + int loop = 0; + + if( !psav->NoPCIRetry ) + return 0; + + psav->ShadowCounter = (psav->ShadowCounter + 1) & 0x7fff; + BCI_SEND( psav->dwBCIWait2DIdle ); + BCI_SEND( 0x98000000 + psav->ShadowCounter ); + + while( + (psav->ShadowVirtual[1] & 0x7fff) != psav->ShadowCounter && + (loop++ < MAXLOOP) + ) + ; + + return loop >= MAXLOOP; +} + +static Bool +ShadowWait1( SavagePtr psav, int v ) +{ + return ShadowWait( psav ); +} + + /* Wait until "v" queue entries are free */ static int @@ -331,9 +376,17 @@ int slots = MAXFIFO - v; mem_barrier(); - loop &= STATUS_WORD0; - while( ((STATUS_WORD0 & 0x0000ffff) > slots) && (loop++ < MAXLOOP)) - ; + if( psav->ShadowVirtual ) + { + psav->WaitQueue = ShadowWait1; + return ShadowWait(psav); + } + else + { + loop &= STATUS_WORD0; + while( ((STATUS_WORD0 & 0x0000ffff) > slots) && (loop++ < MAXLOOP)) + ; + } return loop >= MAXLOOP; } @@ -346,8 +399,14 @@ if( !psav->NoPCIRetry ) return 0; mem_barrier(); - while( ((ALT_STATUS_WORD0 & 0x001fffff) > slots) && (loop++ < MAXLOOP)) - ; + if( psav->ShadowVirtual ) + { + psav->WaitQueue = ShadowWait1; + return ShadowWait(psav); + } + else + while( ((ALT_STATUS_WORD0 & 0x001fffff) > slots) && (loop++ < MAXLOOP)) + ; return loop >= MAXLOOP; } @@ -360,8 +419,14 @@ if( !psav->NoPCIRetry ) return 0; mem_barrier(); - while( ((ALT_STATUS_WORD0 & 0x000fffff) > slots) && (loop++ < MAXLOOP)) - ; + if( psav->ShadowVirtual ) + { + psav->WaitQueue = ShadowWait1; + return ShadowWait(psav); + } + else + while( ((ALT_STATUS_WORD0 & 0x000fffff) > slots) && (loop++ < MAXLOOP)) + ; if( loop >= MAXLOOP ) ResetBCI2K(psav); return loop >= MAXLOOP; @@ -374,6 +439,11 @@ { int loop = 0; mem_barrier(); + if( psav->ShadowVirtual ) + { + psav->WaitIdleEmpty = ShadowWait; + return ShadowWait(psav); + } loop &= STATUS_WORD0; while( ((STATUS_WORD0 & 0x0008ffff) != 0x80000) && (loop++ < MAXLOOP) ) ; @@ -385,6 +455,11 @@ { 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; @@ -395,8 +470,11 @@ { int loop = 0; mem_barrier(); - /* CAUTION! How do we insure this read isn't optimized away? */ - /* Is the "volatile" enough to do that? */ + if( psav->ShadowVirtual ) + { + psav->WaitIdleEmpty = ShadowWait; + return ShadowWait(psav); + } loop &= ALT_STATUS_WORD0; while( ((ALT_STATUS_WORD0 & 0x009fffff) != 0) && (loop++ < MAXLOOP) ) ; @@ -412,6 +490,11 @@ { int loop = 0; mem_barrier(); + if( psav->ShadowVirtual ) + { + psav->WaitIdle = ShadowWait; + return ShadowWait(psav); + } while( (!(STATUS_WORD0 & 0x00080000)) && (loop++ < MAXLOOP) ) ; return loop >= MAXLOOP; @@ -422,6 +505,11 @@ { int loop = 0; mem_barrier(); + if( psav->ShadowVirtual ) + { + psav->WaitIdle = ShadowWait; + return ShadowWait(psav); + } while( (!(ALT_STATUS_WORD0 & 0x00800000)) && (loop++ < MAXLOOP) ) ; return loop >= MAXLOOP; @@ -432,44 +520,18 @@ { 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) { if (pScrn->driverPrivate) @@ -482,15 +544,16 @@ static void SavageFreeRec(ScrnInfoPtr pScrn) { + TRACE(( "SavageFreeRec(%x)\n", pScrn->driverPrivate )); if (!pScrn->driverPrivate) return; xfree(pScrn->driverPrivate); pScrn->driverPrivate = NULL; - SavageUnmapMem(pScrn); + SavageUnmapMem(pScrn, 1); } -static OptionInfoPtr SavageAvailableOptions(int chipid, int busid) +static const OptionInfoRec * SavageAvailableOptions(int chipid, int busid) { return SavageOptions; } @@ -499,7 +562,7 @@ static void SavageIdentify(int flags) { xf86PrintChipsets("SAVAGE", - "driver (version " DRIVER_VERSION " for S3 Savage chipsets", + "driver (version " DRIVER_VERSION ") for S3 Savage chipsets", SavageChips); } @@ -507,7 +570,7 @@ static Bool SavageProbe(DriverPtr drv, int flags) { int i; - GDevPtr *devSections; + GDevPtr *devSections = NULL; int *usedChips; int numDevSections; int numUsed; @@ -523,7 +586,9 @@ SavageChipsets, SavagePciChipsets, devSections, numDevSections, drv, &usedChips); - xfree(devSections); + if (devSections) + xfree(devSections); + devSections = NULL; if (numUsed <= 0) return FALSE; @@ -574,23 +639,28 @@ MessageType from = X_DEFAULT; int i; ClockRangePtr clockRanges; - char *mod = NULL; char *s = NULL; - const char *reqSym = NULL; unsigned char config1, m, n, n1, n2, sr8, cr66 = 0, tmp; int mclk; vgaHWPtr hwp; int vgaCRIndex, vgaCRReg, vgaIOBase; + pointer ddc; - if (flags & PROBE_DETECT) - return FALSE; + TRACE(("SavagePreInit(%d)\n", flags)); + + gpScrn = pScrn; + + if (flags & PROBE_DETECT) { + SavageProbeDDC( pScrn, xf86GetEntityInfo(pScrn->entityList[0])->index ); + return TRUE; + } if (!xf86LoadSubModule(pScrn, "vgahw")) - return FALSE; + return FALSE; xf86LoaderReqSymLists(vgaHWSymbols, NULL); if (!vgaHWGetHWRec(pScrn)) - return FALSE; + return FALSE; #if 0 /* Here we can alter the number of registers saved and restored by the @@ -609,24 +679,36 @@ if (!xf86SetDepthBpp(pScrn, 8, 8, 8, Support32bppFb)) return FALSE; else { + int requiredBpp; + switch (pScrn->depth) { case 8: - case 15: case 16: + requiredBpp = pScrn->depth; + break; + case 15: + requiredBpp = 16; + break; case 24: - /* OK */ + requiredBpp = 32; break; + default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given depth (%d) is not supported by this driver\n", pScrn->depth); return FALSE; } + + if( pScrn->bitsPerPixel != requiredBpp ) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Depth %d must specify %d bpp; %d was given\n", + pScrn->depth, requiredBpp, pScrn->bitsPerPixel ); + return FALSE; + } } - xf86PrintDepthBpp(pScrn); - if (pScrn->depth == 24 && pix24bpp == 0) - pix24bpp = xf86GetBppFromDepth(pScrn, 24); + xf86PrintDepthBpp(pScrn); if (pScrn->depth > 8) { rgb zeros = {0, 0, 0}; @@ -662,65 +744,33 @@ if (pScrn->depth == 8) pScrn->rgbBits = 6; - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, SavageOptions); + if (!(psav->Options = xalloc(sizeof(SavageOptions)))) + return FALSE; + memcpy(psav->Options, SavageOptions, sizeof(SavageOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, psav->Options); - if (xf86ReturnOptValBool(SavageOptions, OPTION_PCI_BURST, FALSE)) { - psav->pci_burst = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: pci_burst - PCI burst read enabled\n"); - } else - psav->pci_burst = FALSE; + xf86GetOptValBool(psav->Options, OPTION_PCI_BURST, &psav->pci_burst); + + if (psav->pci_burst) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, + "Option: pci_burst - PCI burst read enabled\n"); + } + psav->NoPCIRetry = 1; /* default */ - if (xf86ReturnOptValBool(SavageOptions, OPTION_PCI_RETRY, FALSE)) { - if (xf86ReturnOptValBool(SavageOptions, OPTION_PCI_BURST, FALSE)) { + if (xf86ReturnOptValBool(psav->Options, OPTION_PCI_RETRY, FALSE)) { + if (xf86ReturnOptValBool(psav->Options, OPTION_PCI_BURST, FALSE)) { psav->NoPCIRetry = 0; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: pci_retry\n"); } else xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "\"pci_retry\" option requires \"pci_burst\"\n"); } - if (xf86IsOptionSet(SavageOptions, OPTION_FIFO_CONSERV)) { - psav->fifo_conservative = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo conservative set\n"); - } else - psav->fifo_conservative = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_FIFO_MODERATE)) { - psav->fifo_moderate = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_moderate set\n"); - } else - psav->fifo_moderate = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_FIFO_AGGRESSIVE)) { - psav->fifo_aggressive = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_aggressive set\n"); - } else - psav->fifo_aggressive = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_SLOW_EDODRAM)) { - psav->slow_edodram = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: slow_edodram_set\n"); - } else - psav->slow_edodram = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_SLOW_DRAM)) { - psav->slow_dram = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: slow_dram set\n"); - } else - psav->slow_dram = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_FAST_DRAM)) { - psav->fast_dram = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fast_dram set\n"); - } else - psav->fast_dram = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_FPM_VRAM)) { - psav->fpm_vram = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fpm_vram set\n"); - } else - psav->fpm_vram = FALSE; - if (xf86IsOptionSet(SavageOptions, OPTION_SHADOW_FB)) { - psav->shadowFB = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: ShadowFB %s.\n", - psav->shadowFB ? "enabled" : "disabled"); - } else - psav->shadowFB = FALSE; + xf86GetOptValBool( psav->Options, OPTION_SHADOW_FB, &psav->shadowFB ); + if (psav->shadowFB) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: shadow FB enabled\n"); + } - if ((s = xf86GetOptValString(SavageOptions, OPTION_ROTATE))) { + if ((s = xf86GetOptValString(psav->Options, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) { /* accel is disabled below for shadowFB */ psav->shadowFB = TRUE; @@ -740,11 +790,9 @@ } } - if (xf86ReturnOptValBool(SavageOptions, OPTION_NOACCEL, FALSE)) { - psav->NoAccel = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: NoAccel - Acceleration Disabled\n"); - } else - psav->NoAccel = FALSE; + if (xf86GetOptValBool(psav->Options, OPTION_NOACCEL, &psav->NoAccel)) + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "Option: NoAccel - Acceleration Disabled\n"); if (psav->shadowFB && !psav->NoAccel) { xf86DrvMsg(pScrn->scrnIndex, X_WARNING, @@ -752,22 +800,17 @@ psav->NoAccel = TRUE; } - if (xf86ReturnOptValBool(SavageOptions, OPTION_EARLY_RAS_PRECHARGE, FALSE)) { - psav->early_ras_precharge = TRUE; - xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: early_ras_precharge set\n"); - } else - psav->early_ras_precharge = FALSE; - /* * The SWCursor setting takes priority over HWCursor. The default - * if neither is specified is HW. + * if neither is specified is HW, unless ShadowFB is specified, + * then SW. */ from = X_DEFAULT; - psav->hwcursor = TRUE; - if (xf86GetOptValBool(SavageOptions, OPTION_HWCURSOR, &psav->hwcursor)) + psav->hwcursor = psav->shadowFB ? FALSE : TRUE; + if (xf86GetOptValBool(psav->Options, OPTION_HWCURSOR, &psav->hwcursor)) from = X_CONFIG; - if (xf86ReturnOptValBool(SavageOptions, OPTION_SWCURSOR, FALSE)) { + if (xf86ReturnOptValBool(psav->Options, OPTION_SWCURSOR, FALSE)) { psav->hwcursor = FALSE; from = X_CONFIG; } @@ -776,20 +819,22 @@ from = X_DEFAULT; psav->UseBIOS = TRUE; - if (xf86IsOptionSet(SavageOptions, OPTION_USEBIOS) ) - { + if (xf86GetOptValBool(psav->Options, OPTION_USEBIOS, &psav->UseBIOS) ) from = X_CONFIG; - xf86GetOptValBool(SavageOptions, OPTION_USEBIOS, &psav->UseBIOS); - } xf86DrvMsg(pScrn->scrnIndex, from, "%ssing video BIOS to set modes\n", psav->UseBIOS ? "U" : "Not u" ); - - /* DO OTHERS HERE LATER!!!!!!!!!!!!!! */ + psav->LCDClock = 0.0; + if( xf86GetOptValFreq( psav->Options, OPTION_LCDCLOCK, OPTUNITS_MHZ, &psav->LCDClock ) ) + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "Option: LCDClock %1.2f MHz\n", psav->LCDClock ); - from = X_DEFAULT; + if( xf86GetOptValBool( psav->Options, OPTION_SHADOW_STATUS, &psav->ShadowStatus)) + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "Option: ShadowStatus enabled\n" ); + /* Add more options here. */ if (pScrn->numEntities > 1) { SavageFreeRec(pScrn); @@ -804,23 +849,26 @@ } psav->EntityIndex = pEnt->index; - if (psav->UseBIOS) { - if (xf86LoadSubModule(pScrn, "int10")) { - xf86LoaderReqSymLists(int10Symbols, NULL); - psav->pInt10 = xf86InitInt10(pEnt->index); - } + if (xf86LoadSubModule(pScrn, "int10")) { + xf86LoaderReqSymLists(int10Symbols, NULL); + psav->pInt10 = xf86InitInt10(pEnt->index); + } - if (xf86LoadSubModule(pScrn, "vbe")) { - xf86LoaderReqSymLists(vbeSymbols, NULL); - psav->pVbe = VBEInit(psav->pInt10, pEnt->index); - } + if (xf86LoadSubModule(pScrn, "vbe")) { + xf86LoaderReqSymLists(vbeSymbols, NULL); +#ifdef XFree86LOADER + LoaderRefSymLists(vbeOptSymbols, NULL); +#endif + psav->pVbe = VBEInit(psav->pInt10, pEnt->index); } + psav->PciInfo = xf86GetPciInfoForEntity(pEnt->index); xf86RegisterResources(pEnt->index, NULL, ResNone); xf86SetOperatingState(RES_SHARED_VGA, pEnt->index, ResUnusedOpr); xf86SetOperatingState(resVgaMemShared, pEnt->index, ResDisableOpr); + from = X_DEFAULT; if (pEnt->device->chipset && *pEnt->device->chipset) { pScrn->chipset = pEnt->device->chipset; psav->ChipId = pEnt->device->chipID; @@ -842,6 +890,9 @@ psav->Chipset); } + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Chip: id %04x, \"%s\"\n", + psav->ChipId, xf86TokenToString( SavageChips, psav->ChipId ) ); + if (pEnt->device->chipRev >= 0) { psav->ChipRev = pEnt->device->chipRev; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ChipRev override: %d\n", @@ -853,7 +904,7 @@ /* maybe throw in some more sanity checks here */ - xf86DrvMsg(pScrn->scrnIndex, from, "Chipset: \"%s\"\n", pScrn->chipset); + xf86DrvMsg(pScrn->scrnIndex, from, "Engine: \"%s\"\n", pScrn->chipset); psav->PciTag = pciTag(psav->PciInfo->bus, psav->PciInfo->device, psav->PciInfo->func); @@ -876,7 +927,7 @@ /* unlock extended regs */ VGAOUT16(vgaCRIndex, 0x4838); - VGAOUT16(vgaCRIndex, 0xa539); + VGAOUT16(vgaCRIndex, 0xa039); VGAOUT16(0x3c4, 0x0608); VGAOUT8(vgaCRIndex, 0x40); @@ -907,7 +958,7 @@ 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 }; @@ -917,6 +968,18 @@ break; case S3_SAVAGE4: + /* + * The Savage4 has one ugly special case to consider. On + * systems with 4 banks of 2Mx32 SDRAM, the BIOS says 4MB + * when it really means 8MB. Why do it the same when you + * can do it different... + */ + VGAOUT8(vgaCRIndex, 0x68); /* memory control 1 */ + if( (VGAIN8(vgaCRReg) & 0xC0) == (0x01 << 6) ) + RamSavage4[1] = 8; + + /*FALLTHROUGH*/ + case S3_SAVAGE2000: pScrn->videoRam = RamSavage4[ (config1 & 0xE0) >> 5 ] * 1024; break; @@ -1002,34 +1065,65 @@ VGAOUT8(vgaCRReg, cr66 & ~0x02); /* clear reset flag */ usleep(10000); - /* Set status word positions based on chip type. */ + /* Set status word positions based on chip type. */ switch( psav->Chipset ) { case S3_SAVAGE3D: 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; } - - /* savage ramdac speeds */ + + /* Do the DDC dance. */ + + ddc = xf86LoadSubModule(pScrn, "ddc"); + if (ddc) { +#if 0 + xf86MonPtr pMon = NULL; +#endif + + xf86LoaderReqSymLists(ddcSymbols, NULL); +#if 0 +/* + * On many machines, the attempt to read DDC information via VBE puts the + * BIOS access into a state which prevents me from reading mode information. + * This is a complete mystery to me. + */ + if ((psav->pVbe) + && ((pMon = xf86PrintEDID(vbeDoEDID(psav->pVbe, ddc))) != NULL)) + xf86SetDDCproperties(pScrn,pMon); + else +#endif + if (!SavageDDC1(pScrn->scrnIndex)) { + if ( xf86LoadSubModule(pScrn, "i2c") ) { + xf86LoaderReqSymLists(i2cSymbols,NULL); + if (SavageI2CInit(pScrn)) { + CARD32 tmp = (INREG(DDC_REG)); + OUTREG(DDC_REG,(tmp | 0x13)); + xf86SetDDCproperties(pScrn,xf86PrintEDID( + xf86DoEDID_DDC2(pScrn->scrnIndex,psav->I2C))); + OUTREG(DDC_REG,tmp); + } + } + } + } + + /* Savage ramdac speeds */ pScrn->numClocks = 4; pScrn->clock[0] = 250000; pScrn->clock[1] = 250000; @@ -1047,7 +1141,7 @@ psav->dacSpeedBpp = pScrn->clock[0]; } - /* set ramdac limits */ + /* Set ramdac limits */ psav->maxClock = psav->dacSpeedBpp; /* detect current mclk */ @@ -1067,25 +1161,97 @@ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected current MCLK value of %1.3f MHz\n", mclk / 1000.0); - psav->minClock = 20000; + psav->minClock = 10000; - pScrn->maxHValue = 2048; - pScrn->maxVValue = 2048; + pScrn->maxHValue = 2048 << 3; /* 11 bits of h_total 8-pixel units */ + pScrn->maxVValue = 2048; /* 11 bits of v_total */ pScrn->virtualX = pScrn->display->virtualX; + pScrn->virtualY = pScrn->display->virtualY; + + /* Check LCD panel information */ + + if( psav->Chipset == S3_SAVAGE_MX ) + { + unsigned char cr6b = hwp->readCrtc( hwp, 0x6b ); + + int panelX = (hwp->readSeq(hwp, 0x61) + + ((hwp->readSeq(hwp, 0x66) & 0x02) << 7) + 1) * 8; + int panelY = hwp->readSeq(hwp, 0x69) + + ((hwp->readSeq(hwp, 0x6e) & 0x70) << 4) + 1; + + char * sTechnology = "Unknown"; + + /* OK, I admit it. I don't know how to limit the max dot clock + * for LCD panels of various sizes. I thought I copied the formula + * from the BIOS, but many users have informed me of my folly. + * + * Instead, I'll abandon any attempt to automatically limit the + * clock, and add an LCDClock option to XF86Config. Some day, + * I should come back to this. + */ + + enum ACTIVE_DISPLAYS { /* These are the bits in CR6B */ + ActiveCRT = 0x01, + ActiveLCD = 0x02, + ActiveTV = 0x04, + ActiveCRT2 = 0x20, + ActiveDUO = 0x80 + }; + + if( (hwp->readSeq( hwp, 0x39 ) & 0x03) == 0 ) + { + sTechnology = "TFT"; + } + else if( (hwp->readSeq( hwp, 0x30 ) & 0x01) == 0 ) + { + sTechnology = "DSTN"; + } + else + { + sTechnology = "STN"; + } + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "%dx%d %s LCD panel detected %s\n", + panelX, panelY, sTechnology, + cr6b & ActiveLCD ? "and active" : "but not active"); + if( cr6b & ActiveLCD ) { + /* If the LCD is active and panel expansion is enabled, */ + /* we probably want to kill the HW cursor. */ + + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "- Limiting video mode to %dx%d\n", + panelX, panelY ); + + psav->PanelX = panelX; + psav->PanelY = panelY; + + if( psav->LCDClock > 0.0 ) + { + psav->maxClock = psav->LCDClock * 1000.0; + xf86DrvMsg( pScrn->scrnIndex, X_CONFIG, + "- Limiting dot clock to %1.2f MHz\n", + psav->LCDClock ); + } + } + } + clockRanges = xnfalloc(sizeof(ClockRange)); clockRanges->next = NULL; clockRanges->minClock = psav->minClock; clockRanges->maxClock = psav->maxClock; clockRanges->clockIndex = -1; clockRanges->interlaceAllowed = TRUE; - clockRanges->doubleScanAllowed = FALSE; + clockRanges->doubleScanAllowed = TRUE; + clockRanges->ClockDivFactor = 1.0; + clockRanges->ClockMulFactor = 1.0; i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, NULL, 256, 2048, 16 * pScrn->bitsPerPixel, 128, 2048, - pScrn->virtualX, pScrn->display->virtualY, + pScrn->virtualX, pScrn->virtualY, psav->videoRambytes, LOOKUP_BEST_REFRESH); if (i == -1) { @@ -1111,15 +1277,14 @@ SavageFreeBIOSModeTable( psav, &psav->ModeTable ); } - psav->ModeTable = SavageGetBIOSModeTable( psav, pScrn->depth ); + psav->ModeTable = SavageGetBIOSModeTable( psav, pScrn->bitsPerPixel ); if( !psav->ModeTable || !psav->ModeTable->NumModes ) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Failed to fetch any BIOS modes.\n"); - SavageFreeRec(pScrn); - return FALSE; + "Failed to fetch any BIOS modes. Disabling BIOS.\n"); + psav->UseBIOS = FALSE; } - + else /*if( xf86Verbose )*/ { int i; @@ -1151,28 +1316,12 @@ xf86PrintModes(pScrn); xf86SetDpi(pScrn, 0, 0); - /* load bpp-specific modules */ - switch (pScrn->bitsPerPixel) { - case 8: - mod = "cfb"; - reqSym = "cfbScreenInit"; - break; - case 16: - mod = "cfb16"; - reqSym = "cfb16ScreenInit"; - break; - case 32: - mod = "cfb32"; - reqSym = "cfb32ScreenInit"; - break; - } - - if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { + if (xf86LoadSubModule(pScrn, "fb") == NULL) { SavageFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols(reqSym, NULL); + xf86LoaderReqSymbols("fbScreenInit", NULL); if( !psav->NoAccel ) { if( !xf86LoadSubModule(pScrn, "xaa") ) { @@ -1198,8 +1347,6 @@ xf86LoaderReqSymLists(shadowSymbols, NULL); } - SavageUnmapMem(pScrn); - return TRUE; } @@ -1207,7 +1354,10 @@ static Bool SavageEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + TRACE(("SavageEnterVT(%d)\n", flags)); + gpScrn = pScrn; + SavageEnableMMIO(pScrn); SavageSave(pScrn); return SavageModeInit(pScrn, pScrn->currentMode); } @@ -1221,7 +1371,10 @@ vgaRegPtr vgaSavePtr = &hwp->SavedReg; SavageRegPtr SavageSavePtr = &psav->SavedReg; - SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr); + TRACE(("SavageLeaveVT(%d)\n", flags)); + gpScrn = pScrn; + SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr, FALSE); + SavageDisableMMIO(pScrn); } @@ -1237,9 +1390,10 @@ vgaCRReg = vgaIOBase + 5; vgaCRIndex = vgaIOBase + 4; + TRACE(("SavageSave()\n")); VGAOUT16(vgaCRIndex, 0x4838); - VGAOUT16(vgaCRIndex, 0xa539); + VGAOUT16(vgaCRIndex, 0xa039); VGAOUT16(0x3c4, 0x0608); VGAOUT8(vgaCRIndex, 0x66); @@ -1338,11 +1492,14 @@ 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); @@ -1352,6 +1509,8 @@ VGAOUT8(0x3c4, 0x15); save->SR15 = VGAIN8(0x3c5); + VGAOUT8(0x3c4, 0x30); + save->SR30 = VGAIN8(0x3c5); VGAOUT8(0x3c4, 0x18); save->SR18 = VGAIN8(0x3c5); @@ -1373,10 +1532,12 @@ VGAOUT8(vgaCRReg, cr3a | 0x80); /* now save MIU regs */ - save->MMPR0 = INREG(FIFO_CONTROL_REG); - save->MMPR1 = INREG(MIU_CONTROL_REG); - save->MMPR2 = INREG(STREAMS_TIMEOUT_REG); - save->MMPR3 = INREG(MISC_TIMEOUT_REG); + if( psav->Chipset != S3_SAVAGE_MX ) { + save->MMPR0 = INREG(FIFO_CONTROL_REG); + save->MMPR1 = INREG(MIU_CONTROL_REG); + save->MMPR2 = INREG(STREAMS_TIMEOUT_REG); + save->MMPR3 = INREG(MISC_TIMEOUT_REG); + } VGAOUT8(vgaCRIndex, 0x3a); VGAOUT8(vgaCRReg, cr3a); @@ -1399,18 +1560,22 @@ static void SavageWriteMode(ScrnInfoPtr pScrn, vgaRegPtr vgaSavePtr, - SavageRegPtr restore) + SavageRegPtr restore, Bool Entering) { unsigned char tmp, cr3a, cr66, cr67; vgaHWPtr hwp = VGAHWPTR(pScrn); SavagePtr psav = SAVPTR(pScrn); int vgaCRIndex, vgaCRReg, vgaIOBase; - Bool graphicsMode = FALSE; vgaIOBase = hwp->IOBase; vgaCRIndex = vgaIOBase + 4; vgaCRReg = vgaIOBase + 5; + + TRACE(("SavageWriteMode(%x)\n", restore->mode)); + + if( Entering ) + SavageInitialize2DEngine(pScrn); /* * If we figured out a VESA mode number for this timing, just use @@ -1449,15 +1614,18 @@ /* Disable old MMIO. */ VGAOUT8(vgaCRIndex, 0x53); - tmp = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, tmp & ~0x10); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) & ~0x10); + + /* Set the color mode. */ + VGAOUT8(vgaCRIndex, 0x67); + VGAOUT8(vgaCRReg, restore->CR67); + /* We may need TV/panel fixups here. See s3bios.c line 2904. */ /* Set FIFO fetch delay. */ VGAOUT8(vgaCRIndex, 0x85); - tmp = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, (tmp & 0xf8) | 0x03); + VGAOUT8(vgaCRReg, (VGAIN8(vgaCRReg) & 0xf8) | 0x03); /* Patch CR79. These values are magical. */ @@ -1518,16 +1686,11 @@ /* Enable the graphics engine. */ VGAOUT16(vgaCRIndex, 0x0140); - #if 0 - if( !psav->NoAccel ) - S3SAVInitialize2DEngine(); - #endif /* Handle the pitch. */ VGAOUT8(vgaCRIndex, 0x50); - tmp = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, tmp | 0xC1); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0xC1); width = (pScrn->displayWidth * (pScrn->bitsPerPixel / 8)) >> 3; VGAOUT16(vgaCRIndex, ((width & 0xff) << 8) | 0x13 ); @@ -1535,26 +1698,27 @@ /* Some non-S3 BIOSes enable block write even on non-SGRAM devices. */ - if( psav->Chipset == S3_SAVAGE2000 ) + switch( psav->Chipset ) { - VGAOUT8(vgaCRIndex, 0x73); - tmp = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, tmp & 0xdf ); - } - else if( psav->Chipset != S3_SAVAGE_MX ) - { - VGAOUT8(vgaCRIndex, 0x68); - if( !(VGAIN8(vgaCRReg) & 0x80) ) - { - /* Not SGRAM; disable block write. */ - VGAOUT8(vgaCRIndex, 0x88); - tmp = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, tmp | 0x10); - } + case S3_SAVAGE2000: + VGAOUT8(vgaCRIndex, 0x73); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) & 0xdf ); + break; + + case S3_SAVAGE3D: + case S3_SAVAGE4: + VGAOUT8(vgaCRIndex, 0x68); + if( !(VGAIN8(vgaCRReg) & 0x80) ) + { + /* Not SGRAM; disable block write. */ + VGAOUT8(vgaCRIndex, 0x88); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0x10); + } + break; } - if( !psav->NoAccel ) - SavageInitialize2DEngine(pScrn); + SavageInitialize2DEngine(pScrn); + SavageSetGBD(pScrn); VGAOUT16(vgaCRIndex, 0x0140); @@ -1565,7 +1729,7 @@ VGAOUT8(0x3c2, 0x23); VGAOUT16(vgaCRIndex, 0x4838); - VGAOUT16(vgaCRIndex, 0xa539); + VGAOUT16(vgaCRIndex, 0xa039); VGAOUT16(0x3c4, 0x0608); vgaHWProtect(pScrn, TRUE); @@ -1573,8 +1737,6 @@ /* will we be reenabling STREAMS for the new mode? */ psav->STREAMSRunning = 0; - graphicsMode = (restore->CR31 & 0x0a) ? TRUE : FALSE; - /* reset GE to make sure nothing is going on */ VGAOUT8(vgaCRIndex, 0x66); if(VGAIN8(vgaCRReg) & 0x01) @@ -1587,14 +1749,8 @@ * switch to mode 3 here seems to eliminate the issue. */ -#define CLEAR_X86_REGS(pi) \ - (pi)->ax = (pi)->bx = (pi)->cx = (pi)->dx = (pi)->si = (pi)->di = 0 - - if( !graphicsMode && psav->pInt10 ) { - CLEAR_X86_REGS( psav->pInt10 ); - psav->pInt10->num = 0x10; - psav->pInt10->ax = 0x0083; - xf86ExecX86int10( psav->pInt10 ); + if( ((restore->CR31 & 0x0a) == 0) && psav->pInt10 ) { + SavageSetTextMode( psav ); } VGAOUT8(vgaCRIndex, 0x67); @@ -1615,12 +1771,14 @@ 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); @@ -1721,6 +1879,10 @@ } /* 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); @@ -1739,7 +1901,10 @@ 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); @@ -1760,35 +1925,36 @@ cr3a = VGAIN8(vgaCRReg); VGAOUT8(vgaCRReg, cr3a | 0x80); - if (graphicsMode) + if (Entering) SavageGEReset(pScrn,0,__LINE__,__FILE__); - VerticalRetraceWait(); - OUTREG(FIFO_CONTROL_REG, restore->MMPR0); - WaitIdle(); - OUTREG(MIU_CONTROL_REG, restore->MMPR1); - WaitIdle(); - OUTREG(STREAMS_TIMEOUT_REG, restore->MMPR2); - WaitIdle(); - OUTREG(MISC_TIMEOUT_REG, restore->MMPR3); + if( psav->Chipset != S3_SAVAGE_MX ) + { + VerticalRetraceWait(); + OUTREG(FIFO_CONTROL_REG, restore->MMPR0); + OUTREG(MIU_CONTROL_REG, restore->MMPR1); + OUTREG(STREAMS_TIMEOUT_REG, restore->MMPR2); + OUTREG(MISC_TIMEOUT_REG, restore->MMPR3); + } /* If we're going into graphics mode and acceleration was enabled, */ /* go set up the BCI buffer and the global bitmap descriptor. */ - if( graphicsMode && (!psav->NoAccel) ) +#if 0 + if( Entering && (!psav->NoAccel) ) { VGAOUT8(vgaCRIndex, 0x50); - tmp = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, tmp | 0xC1); + VGAOUT8(vgaCRReg, VGAIN8(vgaCRReg) | 0xC1); SavageInitialize2DEngine(pScrn); } +#endif VGAOUT8(vgaCRIndex, 0x66); VGAOUT8(vgaCRReg, cr66); VGAOUT8(vgaCRIndex, 0x3a); VGAOUT8(vgaCRReg, cr3a); - if( graphicsMode ) + if( Entering ) SavageSetGBD(pScrn); vgaHWProtect(pScrn, FALSE); @@ -1802,6 +1968,8 @@ SavagePtr psav; vgaHWPtr hwp; + TRACE(("SavageMapMMIO()\n")); + psav = SAVPTR(pScrn); if( S3_SAVAGE3D_SERIES(psav->Chipset) ) { @@ -1847,6 +2015,8 @@ { SavagePtr psav = SAVPTR(pScrn); + TRACE(("SavageMapFB()\n")); + xf86DrvMsg( pScrn->scrnIndex, X_PROBED, "mapping framebuffer @ 0x%x with size 0x%x\n", psav->FrameBufferBase, psav->videoRambytes); @@ -1864,30 +2034,38 @@ } pScrn->memPhysBase = psav->PciInfo->memBase[0]; pScrn->fbOffset = 0; -/* psav->FBCursorOffset = psav->videoRambytes - 1024; */ return TRUE; } -static void SavageUnmapMem(ScrnInfoPtr pScrn) +static void SavageUnmapMem(ScrnInfoPtr pScrn, int All) { SavagePtr psav; psav = SAVPTR(pScrn); + TRACE(("SavageUnmapMem(%x,%x)\n", psav->MapBase, psav->FBBase)); + if (psav->PrimaryVidMapped) { vgaHWUnmapMem(pScrn); psav->PrimaryVidMapped = FALSE; } SavageDisableMMIO(pScrn); - if (psav->MapBase) + + if (All && psav->MapBase) { xf86UnMapVidMem(pScrn->scrnIndex, (pointer)psav->MapBase, SAVAGE_NEWMMIO_REGSIZE); - if (psav->FBBase) + psav->MapBase = 0; + } + + if (psav->FBBase) { xf86UnMapVidMem(pScrn->scrnIndex, (pointer)psav->FBBase, psav->videoRambytes); + psav->FBBase = 0; + } + #if 0 xf86UnMapVidMem(pScrn->scrnIndex, (pointer)psav->MapBaseDense, 0x8000); @@ -1904,14 +2082,37 @@ SavagePtr psav; int ret; + TRACE(("SavageScreenInit()\n")); + pScrn = xf86Screens[pScreen->myNum]; psav = SAVPTR(pScrn); - if (!SavageMapMMIO(pScrn)) - return FALSE; + SavageEnableMMIO(pScrn); if (!SavageMapFB(pScrn)) return FALSE; + + if( psav->ShadowStatus ) { + 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 ); + + psav->WaitQueue = ShadowWait1; + psav->WaitIdle = ShadowWait; + psav->WaitIdleEmpty = ShadowWait; + + if( psav->Chipset == S3_SAVAGE2000 ) + psav->dwBCIWait2DIdle = 0xc0040000; + else + psav->dwBCIWait2DIdle = 0xc0020000; + } + psav->ShadowCounter = 0; SavageSave(pScrn); @@ -1926,10 +2127,14 @@ if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; + if (!miSetPixmapDepths ()) + return FALSE; } else { if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; + if (!miSetPixmapDepths ()) + return FALSE; } ret = SavageInternalScreenInit(scrnIndex, pScreen); @@ -1961,9 +2166,8 @@ miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); -#if 0 - SavageDGAInit(pScreen); -#endif + if( !psav->shadowFB ) + SavageDGAInit(pScreen); miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); @@ -1975,7 +2179,6 @@ if (psav->shadowFB) { RefreshAreaFuncPtr refreshArea = SavageRefreshArea; -#if 1 if(psav->rotate) { if (!psav->PointerMoved) { psav->PointerMoved = pScrn->PointerMoved; @@ -1989,7 +2192,6 @@ case 32: refreshArea = SavageRefreshArea32; break; } } -#endif ShadowFBInit(pScreen, refreshArea); } @@ -1997,9 +2199,15 @@ if (!miCreateDefColormap(pScreen)) return FALSE; - if (!xf86HandleColormaps(pScreen, 256, 6, SavageLoadPalette, NULL, - CMAP_RELOAD_ON_MODE_SWITCH)) - return FALSE; + if (psav->Chipset == S3_SAVAGE4) { + if (!xf86HandleColormaps(pScreen, 256, 6, SavageLoadPaletteSavage4, + NULL, CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; + } else { + if (!xf86HandleColormaps(pScreen, 256, 6, SavageLoadPalette, NULL, + CMAP_RELOAD_ON_MODE_SWITCH)) + return FALSE; + } vgaHWBlankScreen(pScrn, FALSE); @@ -2007,9 +2215,12 @@ pScreen->SaveScreen = SavageSaveScreen; pScreen->CloseScreen = SavageCloseScreen; -#ifdef DPMSExtension if (xf86DPMSInit(pScreen, SavageDPMS, 0) == FALSE) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed\n"); + +#ifdef XvExtension + if( !psav->NoAccel ) + SavageInitVideo( pScreen ); #endif if (serverGeneration == 1) @@ -2027,6 +2238,8 @@ int width, height, displayWidth; unsigned char *FBStart; + TRACE(("SavageInternalScreenInit()\n")); + pScrn = xf86Screens[pScreen->myNum]; psav = SAVPTR(pScrn); @@ -2051,38 +2264,37 @@ FBStart = psav->FBStart; } - switch (pScrn->bitsPerPixel) { - case 8: - ret = cfbScreenInit(pScreen, FBStart, width, height, - pScrn->xDpi, pScrn->yDpi, - displayWidth); - break; - case 16: - ret = cfb16ScreenInit(pScreen, FBStart, width, height, - pScrn->xDpi, pScrn->yDpi, - displayWidth); - break; - case 32: - ret = cfb32ScreenInit(pScreen, FBStart, width, height, - pScrn->xDpi, pScrn->yDpi, - displayWidth); - break; - default: - xf86DrvMsg(scrnIndex, X_ERROR, - "Internal error: invalid bpp (%d) in SavageScreenInit\n", - pScrn->bitsPerPixel); - ret = FALSE; - break; - } + ret = fbScreenInit(pScreen, FBStart, width, height, + pScrn->xDpi, pScrn->yDpi, + displayWidth, + pScrn->bitsPerPixel); + if (ret) + fbPictureInit (pScreen, 0, 0); return ret; } -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; } @@ -2101,6 +2313,9 @@ vgaCRIndex = vgaIOBase + 4; vgaCRReg = vgaIOBase + 5; + TRACE(("SavageModeInit(%dx%d, %dHz)\n", + mode->HDisplay, mode->VDisplay, mode->Clock)); + #if 0 ErrorF("Clock = %d, HDisplay = %d, HSStart = %d\n", mode->Clock, mode->HDisplay, mode->HSyncStart); @@ -2144,6 +2359,41 @@ new->mode = 0; + /* We need to set CR67 whether or not we use the BIOS. */ + + dclk = mode->Clock; + new->CR67 = 0x00; + + switch( pScrn->depth ) { + case 8: + if( (psav->Chipset == S3_SAVAGE2000) && (dclk >= 230000) ) + new->CR67 = 0x10; /* 8bpp, 2 pixels/clock */ + else + new->CR67 = 0x00; /* 8bpp, 1 pixel/clock */ + break; + case 15: + if( + (psav->Chipset == S3_SAVAGE_MX) || + ((psav->Chipset == S3_SAVAGE2000) && (dclk >= 230000)) + ) + new->CR67 = 0x30; /* 15bpp, 2 pixel/clock */ + else + new->CR67 = 0x20; /* 15bpp, 1 pixels/clock */ + break; + case 16: + if( + (psav->Chipset == S3_SAVAGE_MX) || + ((psav->Chipset == S3_SAVAGE2000) && (dclk >= 230000)) + ) + new->CR67 = 0x50; /* 16bpp, 2 pixel/clock */ + else + new->CR67 = 0x40; /* 16bpp, 1 pixels/clock */ + break; + case 24: + new->CR67 = 0xd0; + break; + } + if( psav->UseBIOS ) { int refresh; SavageModeEntryPtr pmt; @@ -2192,18 +2442,25 @@ 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); @@ -2227,8 +2484,6 @@ new->CR55 |= 0x10; #endif - dclk = mode->Clock; - new->CR67 = 0x00; new->SR15 = 0x03 | 0x80; new->SR18 = 0x00; new->CR43 = new->CR45 = new->CR65 = 0x00; @@ -2255,31 +2510,6 @@ psav->NeedSTREAMS = FALSE; - /**** - * TODO - * old code uses the "dclk<=110000" path for all non-MX/IX, and the - * >110000 path for MX/IX. What does this mean? - ****/ - - if (pScrn->bitsPerPixel == 8) { - if (dclk <= 110000) - new->CR67 = 0x00; /* 8bpp, 135Mhz */ - else - new->CR67 = 0x10; /* 8bpp, 220Mhz */ - } else if ((pScrn->bitsPerPixel == 16) && (pScrn->weight.green == 5)) { - if (dclk <= 110000) - new->CR67 = 0x20; /* 15bpp, 135Mhz */ - else - new->CR67 = 0x30; /* 15bpp, 220Mhz */ - } else if (pScrn->bitsPerPixel == 16) { - if (dclk <= 110000) - new->CR67 = 0x40; /* 16bpp, 135Mhz */ - else - new->CR67 = 0x50; /* 16bpp, 220Mhz */ - } else if (pScrn->bitsPerPixel == 32) { - new->CR67 = 0xd0; - } - SavageCalcClock(dclk, 1, 1, 127, 0, 4, 180000, 360000, &m, &n, &r); new->SR12 = (r << 6) | (n & 0x3f); @@ -2347,25 +2577,25 @@ else new->CR50 = 0x30; - if (pScrn->displayWidth <= 640) + if (pScrn->displayWidth == 640) new->CR50 |= 0x40; - else if (pScrn->displayWidth <= 800) + else if (pScrn->displayWidth == 800) new->CR50 |= 0x80; - else if (pScrn->displayWidth <= 1024) + else if (pScrn->displayWidth == 1024) new->CR50 |= 0x00; - else if (pScrn->displayWidth <= 1152) + else if (pScrn->displayWidth == 1152) new->CR50 |= 0x01; - else if (pScrn->displayWidth <= 1280) + else if (pScrn->displayWidth == 1280) new->CR50 |= 0xc0; - else if (pScrn->displayWidth <= 1600) + else if (pScrn->displayWidth == 1600) new->CR50 |= 0x81; else new->CR50 |= 0xc1; /* Use GBD */ - if( psav->Chipset == S3_SAVAGE2000 ) - new->CR33 = 0x08; + if( psav->Chipset == S3_SAVAGE_MX ) + new->CR33 = 0x00; else - new->CR33 = 0x20; + new->CR33 = 0x08; vganew->CRTC[0x17] = 0xeb; @@ -2387,7 +2617,7 @@ pScrn->vtSema = TRUE; /* do it! */ - SavageWriteMode(pScrn, vganew, new); + SavageWriteMode(pScrn, vganew, new, TRUE); SavageAdjustFrame(pScrn->scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); return TRUE; @@ -2402,28 +2632,23 @@ vgaRegPtr vgaSavePtr = &hwp->SavedReg; SavageRegPtr SavageSavePtr = &psav->SavedReg; + TRACE(("SavageCloseScreen\n")); + if( psav->AccelInfoRec ) { XAADestroyInfoRec( psav->AccelInfoRec ); psav->AccelInfoRec = NULL; } -#if 0 - if( psav->pInt10 ) { - xf86FreeInt10( psav->pInt10 ); - psav->pInt10 = NULL; + if( psav->DGAModes ) { + xfree( psav->DGAModes ); + psav->DGAModes = NULL; + psav->numDGAModes = 0; } - if (psav->pVbe) - { - vbeFree(psav->pVbe); - psav->pVbe = NULL; - } -#endif - if (pScrn->vtSema) { - SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr); + SavageWriteMode(pScrn, vgaSavePtr, SavageSavePtr, FALSE); vgaHWLock(hwp); - SavageUnmapMem(pScrn); + SavageUnmapMem(pScrn, 0); } pScrn->vtSema = FALSE; @@ -2435,6 +2660,17 @@ static Bool SavageSaveScreen(ScreenPtr pScreen, int mode) { + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + TRACE(("SavageSaveScreen(0x%x)\n", mode)); + + if( pScrn->vtSema && SAVPTR(pScrn)->hwcursor ) + { + if( xf86IsUnblank(mode) ) + SavageShowCursor( pScrn ); + else + SavageHideCursor( pScrn ); + } + return vgaHWSaveScreen(pScreen, mode); } @@ -2450,10 +2686,12 @@ vgaCRIndex = vgaIOBase + 4; vgaCRReg = vgaIOBase + 5; + TRACE(("SavageAdjustFrame(%d,%d,%x)\n", x, y, flags)); + if (psav->ShowCache && y) y += pScrn->virtualY - 1; - Base = ((y * pScrn->displayWidth + x) * + Base = ((y * pScrn->displayWidth + (x&~1)) * (pScrn->bitsPerPixel / 8)) >> 2; /* now program the start address registers */ VGAOUT16(vgaCRIndex, (Base & 0x00ff00) | 0x0c); @@ -2467,6 +2705,7 @@ Bool SavageSwitchMode(int scrnIndex, DisplayModePtr mode, int flags) { + TRACE(("SavageSwitchMode\n")); return SavageModeInit(xf86Screens[scrnIndex], mode); } @@ -2478,6 +2717,9 @@ int vgaCRIndex, vgaCRReg; unsigned char val; + TRACE(("SavageEnableMMIO\n")); + + vgaHWSetStdFuncs(hwp); vgaHWSetMmioFuncs(hwp, psav->MapBase, 0x8000); val = VGAIN8(0x3c3); VGAOUT8(0x3c3, val | 0x01); @@ -2487,9 +2729,12 @@ vgaCRIndex = hwp->IOBase + 4; vgaCRReg = hwp->IOBase + 5; - VGAOUT8(vgaCRIndex, 0x40); - val = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, val | 1); + if( psav->Chipset >= S3_SAVAGE4 ) + { + VGAOUT8(vgaCRIndex, 0x40); + val = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, val | 1); + } return; } @@ -2502,18 +2747,24 @@ int vgaCRIndex, vgaCRReg; unsigned char val; + TRACE(("SavageDisableMMIO\n")); + vgaHWGetIOBase(hwp); vgaCRIndex = hwp->IOBase + 4; vgaCRReg = hwp->IOBase + 5; - VGAOUT8(vgaCRIndex, 0x40); - val = VGAIN8(vgaCRReg); - VGAOUT8(vgaCRReg, val | 1); + if( psav->Chipset >= S3_SAVAGE4 ) + { + VGAOUT8(vgaCRIndex, 0x40); + val = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, val | 1); + } + + vgaHWSetStdFuncs(hwp); return; } - void SavageLoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, VisualPtr pVisual) { @@ -2529,9 +2780,38 @@ } } +#define inStatus1() (hwp->readST01( hwp )) + +void SavageLoadPaletteSavage4(ScrnInfoPtr pScrn, int numColors, int *indicies, + LOCO *colors, VisualPtr pVisual) +{ + SavagePtr psav = SAVPTR(pScrn); + int i, index; + + vgaHWPtr hwp = VGAHWPTR(pScrn); + int vgaCRIndex, vgaCRReg, vgaIOBase; + vgaIOBase = hwp->IOBase; + vgaCRIndex = vgaIOBase + 4; + vgaCRReg = vgaIOBase + 5; + VerticalRetraceWait(); + + for (i=0; i<numColors; i++) { + if (!(inStatus1()) & 0x08) + VerticalRetraceWait(); + index = indicies[i]; + VGAOUT8(0x3c8, index); + VGAOUT8(0x3c9, colors[index].red); + VGAOUT8(0x3c9, colors[index].green); + VGAOUT8(0x3c9, colors[index].blue); + } +} + static void SavageCalcClock(long freq, int min_m, int min_n1, int max_n1, + + /* Make sure linear addressing is enabled after the BIOS call. */ + /* Note that we must use an I/O port to do this. */ int min_n2, int max_n2, long freq_min, long freq_max, unsigned int *mdiv, unsigned int *ndiv, unsigned int *r) @@ -2597,6 +2877,8 @@ SavagePtr psav = SAVPTR(pScrn); int vgaCRIndex, vgaCRReg, vgaIOBase; + TRACE(("SavageGEReset(%d,%s)\n", line, file)); + vgaIOBase = hwp->IOBase; vgaCRIndex = vgaIOBase + 4; vgaCRReg = vgaIOBase + 5; @@ -2606,9 +2888,9 @@ xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "SavageGEReset called from %s line %d\n", file, line); } else - WaitIdleEmpty(); + psav->WaitIdleEmpty(psav); - if (from_timeout) { + if (from_timeout && (psav->Chipset != S3_SAVAGE_MX) ) { fifo_control = INREG(FIFO_CONTROL_REG); miu_control = INREG(MIU_CONTROL_REG); streams_timeout = INREG(STREAMS_TIMEOUT_REG); @@ -2626,7 +2908,7 @@ usleep(10000); if (!from_timeout) - WaitIdleEmpty(); + psav->WaitIdleEmpty(psav); OUTREG(DEST_SRC_STR, psav->Bpl << 16 | psav->Bpl); usleep(10000); @@ -2652,22 +2934,22 @@ break; } - if (from_timeout) { + /* 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); OUTREG(STREAMS_TIMEOUT_REG, streams_timeout); 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); } @@ -2705,12 +2987,13 @@ } -#ifdef DPMSExtension static void SavageDPMS(ScrnInfoPtr pScrn, int mode, int flags) { SavagePtr psav = SAVPTR(pScrn); unsigned char sr8 = 0x00, srd = 0x00; + TRACE(("SavageDPMS(%d,%x)\n", mode, flags)); + VGAOUT8(0x3c4, 0x08); sr8 = VGAIN8(0x3c5); sr8 |= 0x06; @@ -2742,5 +3025,54 @@ VGAOUT8(0x3c5, srd); return; +} + + +static unsigned int +SavageDDC1Read(ScrnInfoPtr pScrn) +{ + register vgaHWPtr hwp = VGAHWPTR(pScrn); + register CARD32 tmp; + SavagePtr psav = SAVPTR(pScrn); + + while (hwp->readST01(hwp)&0x8) {}; + while (!(hwp->readST01(hwp)&0x8)) {}; + + tmp = (INREG(DDC_REG)); + return ((unsigned int) (tmp & 0x08)); } -#endif /* DPMSExtension */ + +static Bool +SavageDDC1(int scrnIndex) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + SavagePtr psav = SAVPTR(pScrn); + CARD32 tmp; + Bool success = FALSE; + xf86MonPtr pMon; + + /* initialize chipset */ + tmp = INREG(DDC_REG); + OUTREG(DDC_REG,(tmp | 0x12)); + + if ((pMon = xf86PrintEDID( + xf86DoEDID_DDC1(scrnIndex,vgaHWddc1SetSpeed,SavageDDC1Read))) != NULL) + success = TRUE; + xf86SetDDCproperties(pScrn,pMon); + + /* undo initialization */ + OUTREG(DDC_REG,(tmp)); + return success; +} + + +static void +SavageProbeDDC(ScrnInfoPtr pScrn, int index) +{ + vbeInfoPtr pVbe; + if (xf86LoadSubModule(pScrn, "vbe")) { + pVbe = VBEInit(NULL,index); + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + } +} + Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h:1.3 Thu Dec 7 15:26:22 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h Fri May 18 19:35:32 2001 @@ -1,32 +1,31 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.3 2000/12/07 20:26:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_driver.h,v 1.10 2001/05/18 23:35:32 dawes Exp $ */ #ifndef SAVAGE_VGAHWMMIO_H #define SAVAGE_VGAHWMMIO_H +#include "xf86_ansic.h" +#include "compiler.h" #include "vgaHW.h" #include "xf86.h" #include "xf86Resources.h" -#include "xf86_ansic.h" #include "xf86Pci.h" #include "xf86PciInfo.h" #include "xf86_OSproc.h" -#include "compiler.h" #include "xf86Cursor.h" #include "mipointer.h" #include "micmap.h" -#include "cfb.h" -#include "cfb16.h" -#include "cfb32.h" +#include "fb.h" #include "xf86cmap.h" #include "vbe.h" #include "xaa.h" +#include "xf86xv.h" #include "savage_regs.h" #define VGAIN8(addr) MMIO_IN8(psav->MapBase+0x8000, addr) #define VGAIN16(addr) MMIO_IN16(psav->MapBase+0x8000, addr) #define VGAIN(addr) MMIO_IN32(psav->MapBase+0x8000, addr) - + #define VGAOUT8(addr,val) MMIO_OUT8(psav->MapBase+0x8000, addr, val) #define VGAOUT16(addr,val) MMIO_OUT16(psav->MapBase+0x8000, addr, val) #define VGAOUT(addr,val) MMIO_OUT32(psav->MapBase+0x8000, addr, val) @@ -54,8 +53,8 @@ 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; @@ -64,7 +63,6 @@ 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; @@ -79,6 +77,7 @@ Bool STREAMSRunning; int Bpp, Bpl, ScissB; unsigned PlaneMask; + I2CBusPtr I2C; int videoRambytes; int videoRamKbytes; @@ -88,6 +87,7 @@ /* These are physical addresses. */ unsigned long FrameBufferBase; unsigned long MmioBase; + unsigned long ShadowPhysical; /* These are linear addresses. */ unsigned char* MapBase; @@ -95,6 +95,7 @@ unsigned char* MapBaseDense; unsigned char* FBBase; unsigned char* FBStart; + unsigned long volatile * ShadowVirtual; Bool PrimaryVidMapped; int dacSpeedBpp; @@ -106,22 +107,22 @@ /* Here are all the Options */ + OptionInfoPtr Options; Bool ShowCache; Bool pci_burst; Bool NoPCIRetry; Bool fifo_conservative; Bool fifo_moderate; Bool fifo_aggressive; - Bool slow_edodram; - Bool slow_dram; - Bool fast_dram; - Bool fpm_vram; - Bool early_ras_precharge; Bool hwcursor; Bool NoAccel; Bool shadowFB; Bool UseBIOS; int rotate; + double LCDClock; + Bool ShadowStatus; + int PanelX; + int PanelY; CloseScreenProcPtr CloseScreen; pciVideoPtr PciInfo; @@ -131,12 +132,12 @@ 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; @@ -149,8 +150,6 @@ unsigned int SavedBciCmd; unsigned int SavedFgColor; unsigned int SavedBgColor; - unsigned int SavedGbdOffset; - unsigned int SavedGbd; unsigned int SavedSbdOffset; unsigned int SavedSbd; @@ -163,14 +162,26 @@ unsigned long cobSize; /* size in bytes */ unsigned long cobOffset; /* offset in frame buffer */ + /* Support for DGA */ + int numDGAModes; + DGAModePtr DGAModes; + Bool DGAactive; + int DGAViewportStatus; + + /* Support for XVideo */ + + unsigned int videoFlags; + unsigned int blendBase; + int videoFourCC; + XF86VideoAdaptorPtr adaptor; + int VideoZoomMax; + int dwBCIWait2DIdle; + } SavageRec, *SavagePtr; -/* Shortcuts. These depend on a local symbol "psav". */ +/* Video flags. */ -#define WaitIdle() psav->myWaitIdle(psav) -#define WaitIdleEmpty() psav->myWaitIdleEmpty(psav) -#define WaitQueue(k) psav->myWaitQueue(psav,k) -#define WaitCommandEmpty() psav->myWaitCommandEmpty(psav) +#define VF_STREAMS_ON 0x0001 #define SAVPTR(p) ((SavagePtr)((p)->driverPrivate)) @@ -186,12 +197,19 @@ /* In savage_cursor.c. */ Bool SavageHWCursorInit(ScreenPtr pScreen); +void SavageShowCursor(ScrnInfoPtr); +void SavageHideCursor(ScrnInfoPtr); /* In savage_accel.c. */ Bool SavageInitAccel(ScreenPtr); void SavageInitialize2DEngine(ScrnInfoPtr); void SavageSetGBD(ScrnInfoPtr); +void SavageAccelSync(ScrnInfoPtr); + +/* In savage_i2c.c. */ + +Bool SavageI2CInit(ScrnInfoPtr pScrn); /* In savage_shadow.c */ @@ -214,6 +232,10 @@ int iDepth, SavageModeEntryPtr s3vModeTable ); + +/* In savage_video.c */ + +void SavageInitVideo( ScreenPtr pScreen ); #endif /* SAVAGE_VGAHWMMIO_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c:1.1 --- /dev/null Mon Jun 4 12:41:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c Tue Feb 13 16:15:19 2001 @@ -0,0 +1,91 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_i2c.c,v 1.1 2001/02/13 21:15:19 dawes Exp $ */ + +/* +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, FIT- +NESS 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. +*/ + + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "compiler.h" + +#include "xf86Pci.h" +#include "xf86PciInfo.h" + +#include "vgaHW.h" + +#include "savage_driver.h" + +static void +SavageI2CPutBits(I2CBusPtr b, int clock, int data) +{ + SavagePtr psav = SAVPTR(xf86Screens[b->scrnIndex]); + unsigned int reg = 0x10; + + if(clock) reg |= 0x1; + if(data) reg |= 0x2; + + OUTREG(DDC_REG,reg); + /*ErrorF("SavageI2CPutBits: %d %d\n", clock, data); */ +} + +static void +SavageI2CGetBits(I2CBusPtr b, int *clock, int *data) +{ + SavagePtr psav = SAVPTR(xf86Screens[b->scrnIndex]); + unsigned int reg; + + reg = (INREG(DDC_REG)); + + *clock = reg & 0x4; + *data = reg & 0x8; + + /*ErrorF("SavageI2CGetBits: %d %d\n", *clock, *data); */ +} + +Bool +SavageI2CInit(ScrnInfoPtr pScrn) +{ + SavagePtr psav = SAVPTR(pScrn); + I2CBusPtr I2CPtr; + + I2CPtr = xf86CreateI2CBusRec(); + if(!I2CPtr) return FALSE; + + psav->I2C = I2CPtr; + + I2CPtr->BusName = "I2C bus"; + I2CPtr->scrnIndex = pScrn->scrnIndex; + I2CPtr->I2CPutBits = SavageI2CPutBits; + I2CPtr->I2CGetBits = SavageI2CGetBits; + + if (!xf86I2CBusInit(I2CPtr)) + return FALSE; + + return TRUE; +} + + + Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c:1.2 Mon Dec 4 13:50:00 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_image.c Fri May 18 19:35:32 2001 @@ -1,9 +1,35 @@ -/* $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.4 2001/05/18 23:35:32 dawes Exp $ */ #include "savage_driver.h" #include "xaarop.h" #include "savage_bci.h" +void SavageSubsequentImageWriteRect ( + ScrnInfoPtr pScrn, + int x, + int y, + int w, + int h, + int skipleft); + +void SavageSetupForImageWrite ( + ScrnInfoPtr pScrn, + int rop, + unsigned planemask, + int transparency_color, + int bpp, + int depth); + +void SavageWriteBitmapCPUToScreenColorExpand ( + ScrnInfoPtr pScrn, + int x, int y, int w, int h, + unsigned char * src, + int srcwidth, + int skipleft, + int fg, int bg, + int rop, + unsigned int planemask); + #if 0 void SavageWriteBitmapScreenToScreenColorExpand( ScrnPtr pScrn, @@ -38,7 +64,7 @@ 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 +184,7 @@ 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 ) Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h:1.4 Thu Dec 7 15:26:22 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h Tue May 15 06:19:39 2001 @@ -1,10 +1,17 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 1.4 2000/12/07 20:26:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_regs.h,v 1.8 2001/05/15 10:19:39 eich Exp $ */ #ifndef _SAVAGE_REGS_H #define _SAVAGE_REGS_H -#include "savage_driver.h" +/* These are here until xf86PciInfo.h is updated. */ +#ifndef PCI_CHIP_S3TWISTER_P +#define PCI_CHIP_S3TWISTER_P 0x8d01 +#endif +#ifndef PCI_CHIP_S3TWISTER_K +#define PCI_CHIP_S3TWISTER_K 0x8d02 +#endif + #define S3_SAVAGE3D_SERIES(chip) ((chip>=S3_SAVAGE3D) && (chip<=S3_SAVAGE_MX)) #define S3_SAVAGE4_SERIES(chip) ((chip==S3_SAVAGE4) || (chip==S3_PROSAVAGE)) @@ -40,29 +47,98 @@ #define MIU_CONTROL_REG 0x8204 #define STREAMS_TIMEOUT_REG 0x8208 #define MISC_TIMEOUT_REG 0x820c + +/* Stream Processor 1 */ + +/* Primary Stream 1 Frame Buffer Address 0 */ +#define PRI_STREAM_FBUF_ADDR0 0x81c0 +/* Primary Stream 1 Frame Buffer Address 0 */ +#define PRI_STREAM_FBUF_ADDR1 0x81c4 +/* Primary Stream 1 Stride */ +#define PRI_STREAM_STRIDE 0x81c8 +/* Primary Stream 1 Frame Buffer Size */ +#define PRI_STREAM_BUFFERSIZE 0x8214 + +/* Secondary stream 1 Color/Chroma Key Control */ +#define SEC_STREAM_CKEY_LOW 0x8184 +/* Secondary stream 1 Chroma Key Upper Bound */ +#define SEC_STREAM_CKEY_UPPER 0x8194 +/* Blend Control of Secondary Stream 1 & 2 */ +#define BLEND_CONTROL 0x8190 +/* Secondary Stream 1 Color conversion/Adjustment 1 */ +#define SEC_STREAM_COLOR_CONVERT1 0x8198 +/* Secondary Stream 1 Color conversion/Adjustment 2 */ +#define SEC_STREAM_COLOR_CONVERT2 0x819c +/* Secondary Stream 1 Color conversion/Adjustment 3 */ +#define SEC_STREAM_COLOR_CONVERT3 0x81e4 +/* Secondary Stream 1 Horizontal Scaling */ +#define SEC_STREAM_HSCALING 0x81a0 +/* Secondary Stream 1 Frame Buffer Size */ +#define SEC_STREAM_BUFFERSIZE 0x81a8 +/* Secondary Stream 1 Horizontal Scaling 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 */ +#define SEC_STREAM_FBUF_ADDR0 0x81d0 +/* Secondary Stream 1 Frame Buffer Address 1 */ +#define SEC_STREAM_FBUF_ADDR1 0x81d4 +/* Secondary Stream 1 Frame Buffer Address 2 */ +#define SEC_STREAM_FBUF_ADDR2 0x81ec +/* Secondary Stream 1 Stride */ +#define SEC_STREAM_STRIDE 0x81d8 +/* Secondary Stream 1 Window Start Coordinates */ +#define SEC_STREAM_WINDOW_START 0x81f8 +/* Secondary Stream 1 Window Size */ +#define SEC_STREAM_WINDOW_SZ 0x81fc +/* Secondary Streams Tile Offset */ +#define SEC_STREAM_TILE_OFF 0x821c +/* Secondary Stream 1 Opaque Overlay Control */ +#define SEC_STREAM_OPAQUE_OVERLAY 0x81dc + + +/* Stream Processor 2 */ + +/* Primary Stream 2 Frame Buffer Address 0 */ +#define PRI_STREAM2_FBUF_ADDR0 0x81b0 +/* Primary Stream 2 Frame Buffer Address 1 */ +#define PRI_STREAM2_FBUF_ADDR1 0x81b4 +/* Primary Stream 2 Stride */ +#define PRI_STREAM2_STRIDE 0x81b8 +/* Primary Stream 2 Frame Buffer Size */ +#define PRI_STREAM2_BUFFERSIZE 0x8218 + +/* Secondary Stream 2 Color/Chroma Key Control */ +#define SEC_STREAM2_CKEY_LOW 0x8188 +/* Secondary Stream 2 Chroma Key Upper Bound */ +#define SEC_STREAM2_CKEY_UPPER 0x818c +/* Secondary Stream 2 Horizontal Scaling */ +#define SEC_STREAM2_HSCALING 0x81a4 +/* Secondary Stream 2 Horizontal Scaling */ +#define SEC_STREAM2_VSCALING 0x8204 +/* Secondary Stream 2 Frame Buffer Size */ +#define SEC_STREAM2_BUFFERSIZE 0x81ac +/* Secondary Stream 2 Frame Buffer Address 0 */ +#define SEC_STREAM2_FBUF_ADDR0 0x81bc +/* Secondary Stream 2 Frame Buffer Address 1 */ +#define SEC_STREAM2_FBUF_ADDR1 0x81e0 +/* Secondary Stream 2 Frame Buffer Address 2 */ +#define SEC_STREAM2_FBUF_ADDR2 0x8208 +/* Multiple Buffer/LPB and Secondary Stream 2 Stride */ +#define SEC_STREAM2_STRIDE_LPB 0x81cc +/* Secondary Stream 2 Color conversion/Adjustment 1 */ +#define SEC_STREAM2_COLOR_CONVERT1 0x81f0 +/* Secondary Stream 2 Color conversion/Adjustment 2 */ +#define SEC_STREAM2_COLOR_CONVERT2 0x81f4 +/* Secondary Stream 2 Color conversion/Adjustment 3 */ +#define SEC_STREAM2_COLOR_CONVERT3 0x8200 +/* Secondary Stream 2 Window Start Coordinates */ +#define SEC_STREAM2_WINDOW_START 0x820c +/* Secondary Stream 2 Window Size */ +#define SEC_STREAM2_WINDOW_SZ 0x8210 +/* Secondary Stream 2 Opaque Overlay Control */ +#define SEC_STREAM2_OPAQUE_OVERLAY 0x8180 -#define PSTREAM_CONTROL_REG 0x8180 -#define COL_CHROMA_KEY_CONTROL_REG 0x8184 -#define SSTREAM_CONTROL_REG 0x8190 -#define CHROMA_KEY_UPPER_BOUND_REG 0x8194 -#define SSTREAM_STRETCH_REG 0x8198 -#define BLEND_CONTROL_REG 0x81a0 -#define PSTREAM_FBADDR0_REG 0x81c0 -#define PSTREAM_FBADDR1_REG 0x81c4 -#define PSTREAM_STRIDE_REG 0x81c8 -#define DOUBLE_BUFFER_REG 0x81cc -#define SSTREAM_FBADDR0_REG 0x81d0 -#define SSTREAM_FBADDR1_REG 0x81d4 -#define SSTREAM_STRIDE_REG 0x81d8 -#define OPAQUE_OVERLAY_CONTROL_REG 0x81dc -#define K1_VSCALE_REG 0x81e0 -#define K2_VSCALE_REG 0x81e4 -#define DDA_VERT_REG 0x81e8 -#define STREAMS_FIFO_REG 0x81ec -#define PSTREAM_START_REG 0x81f0 -#define PSTREAM_WINDOW_SIZE_REG 0x81f4 -#define SSTREAM_START_REG 0x81f8 -#define SSTREAM_WINDOW_SIZE_REG 0x81fC #define SUBSYS_STAT_REG 0x8504 @@ -74,7 +150,9 @@ #define MONO_PAT_0 0xa4e8 #define MONO_PAT_1 0xa4ec +#define DDC_REG 0xff20 + /* Constants for CR69. */ #define CRT_ACTIVE 0x01 @@ -95,11 +173,16 @@ #define MAXFIFO 0x7f00 +/* + * NOTE: don't remove 'VGAIN8(vgaCRIndex);'. + * If not present it will cause lockups on Savage4. + * Ask S3, why. + */ #define VerticalRetraceWait() \ { \ + VGAIN8(vgaCRIndex); \ VGAOUT8(vgaCRIndex, 0x17); \ if (VGAIN8(vgaCRReg) & 0x80) { \ - while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x00) ; \ while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x08) ; \ while ((VGAIN8(vgaIOBase + 0x0a) & 0x08) == 0x00) ; \ } \ Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c diff -u xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c:1.1 Fri Dec 1 20:16:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c Fri May 18 22:05:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.1 2000/12/02 01:16:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_vbe.c,v 1.9 2001/05/19 02:05:55 dawes Exp $ */ #include "savage_driver.h" #include "savage_vbe.h" @@ -13,6 +13,8 @@ #endif #define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00) +Bool vbeModeInit( vbeInfoPtr, int ); + static void SavageClearVM86Regs( xf86Int10InfoPtr pInt ) { @@ -29,45 +31,20 @@ void SavageSetTextMode( SavagePtr psav ) { -#if 0 - ioperm( 0x80, 1, 1 ); - ioperm( 0x61, 1, 1 ); - ioperm( 0x40, 4, 1 ); -#endif - SavageClearVM86Regs( psav->pInt10 ); psav->pInt10->ax = 0x83; xf86ExecX86int10( psav->pInt10 ); - -#if 0 - ioperm( 0x40, 4, 0 ); - ioperm( 0x61, 1, 0 ); - ioperm( 0x80, 1, 1 ); -#endif } void SavageSetVESAMode( SavagePtr psav, int n, int Refresh ) { -#if 0 - /* - * The Savage BIOS writes to a debug card on port 80h and to the - * timer chip at port 61. - */ - ioperm( 0x80, 1, 1 ); - ioperm( 0x61, 1, 1 ); - ioperm( 0x40, 4, 1 ); -#endif - /* First, establish the refresh rate for this mode. */ SavageClearVM86Regs( psav->pInt10 ); - - xf86ExecX86int10( psav->pInt10 ); - psav->pInt10->ax = 0x4f14; /* S3 extensions */ psav->pInt10->bx = 0x0001; /* Set default refresh rate */ psav->pInt10->cx = n; @@ -76,22 +53,22 @@ xf86ExecX86int10( psav->pInt10 ); /* Now, make this mode current. */ - - SavageClearVM86Regs( psav->pInt10 ); - psav->pInt10->ax = 0x4f02; /* Set vesa mode extensions */ - psav->pInt10->bx = n; /* Mode number */ - - xf86ExecX86int10( psav->pInt10 ); - if ( (psav->pInt10->ax & 0xff) != 0x4f) + if( xf86LoaderCheckSymbol( "VBESetVBEMode" ) ) { - ErrorF("Set video mode failed\n"); + if( !VBESetVBEMode( psav->pVbe, n, NULL ) ) + { + ErrorF("Set video mode failed\n"); + } } - -#if 0 - ioperm( 0x40, 4, 0 ); - ioperm( 0x61, 1, 0 ); - ioperm( 0x80, 1, 1 ); +#ifdef XFree86LOADER + else + { + if( !vbeModeInit( psav->pVbe, n ) ) + { + ErrorF("Set video mode failed\n"); + } + } #endif } @@ -140,7 +117,7 @@ SavageModeEntryPtr s3vModeTable ) { unsigned short iModeCount = 0; - short int *mode_list; + unsigned short int *mode_list; pointer vbeLinear = NULL; vbeControllerInfoPtr vbe = NULL; int vbeReal; @@ -150,28 +127,29 @@ return 0; vbe = (vbeControllerInfoPtr) psav->pVbe->memory; - - mode_list = xf86int10Addr( psav->pInt10, L_ADD(vbe->VideoModePtr) ); - vbeLinear = xf86Int10AllocPages( psav->pInt10, 1, &vbeReal ); vmib = (struct vbe_mode_info_block *) vbeLinear; - - while (*mode_list != -1) + + for ( + mode_list = xf86int10Addr( psav->pInt10, L_ADD(vbe->VideoModePtr) ); + *mode_list != 0xffff; + mode_list++ + ) { /* * This is a HACK to work around what I believe is a BUG in the * Toshiba Satellite BIOSes in 08/2000 and 09/2000. The BIOS * table for 1024x600 says it has six refresh rates, when in fact - * it only has 3. This causes the BIOS to go into an infinite - * loop until the user interrupts it, usually by pressing + * it only has 3. When I ask for rate #4, the BIOS goes into an + * infinite loop until the user interrupts it, usually by pressing * Ctrl-Alt-F1. For now, we'll just punt everything with a VESA * number greater than or equal to 0200. + * + * This also prevents some strange and unusual results seen with + * the later ProSavage/PM133 BIOSes directly from S3/VIA. */ if( *mode_list >= 0x0200 ) - { - mode_list++; continue; - } SavageClearVM86Regs( psav->pInt10 ); @@ -247,8 +225,6 @@ s3vModeTable++; } } - - mode_list++; } xf86Int10FreePages( psav->pInt10, vbeLinear, 1 ); Index: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c:1.3 --- /dev/null Mon Jun 4 12:41:03 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c Fri May 18 19:35:33 2001 @@ -0,0 +1,1763 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/savage/savage_video.c,v 1.3 2001/05/18 23:35:33 dawes Exp $ */ + +#include "Xv.h" +#include "dix.h" +#include "dixstruct.h" +#include "fourcc.h" +#include "xaalocal.h" + +#include "savage_driver.h" + +#define OFF_DELAY 200 /* milliseconds */ +#define FREE_DELAY 60000 + +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 + +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + +#ifndef XvExtension +void SavageInitVideo(ScreenPtr pScreen) {} +void SavageResetVideo(ScrnInfoPtr pScrn) {} +#else + +void myOUTREG( SavagePtr psav, unsigned long offset, unsigned long value ); + +static XF86VideoAdaptorPtr SavageSetupImageVideo(ScreenPtr); +static void SavageInitOffscreenImages(ScreenPtr); +static void SavageStopVideo(ScrnInfoPtr, pointer, Bool); +static int SavageSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); +static int SavageGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); +static void SavageQueryBestSize(ScrnInfoPtr, Bool, + short, short, short, short, unsigned int *, unsigned int *, pointer); +static int SavagePutImage( ScrnInfoPtr, + short, short, short, short, short, short, short, short, + int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static int SavageQueryImageAttributes(ScrnInfoPtr, + int, unsigned short *, unsigned short *, int *, int *); + +void SavageStreamsOn(ScrnInfoPtr pScrn, int id); +void SavageStreamsOff(ScrnInfoPtr pScrn); +void SavageResetVideo(ScrnInfoPtr pScrn); + +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 4 + +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +static Atom xvColorKey, xvBrightness, xvContrast, xvSaturation, xvHue; + +/* client libraries expect an encoding */ +static XF86VideoEncodingRec DummyEncoding[1] = +{ + { + 0, + "XV_IMAGE", + 1024, 1024, + {1, 1} + } +}; + +#define NUM_FORMATS 4 + +static XF86VideoFormatRec Formats[NUM_FORMATS] = +{ + {8, PseudoColor}, {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; + +#define NUM_ATTRIBUTES 5 + +static XF86AttributeRec Attributes[NUM_ATTRIBUTES] = +{ + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, -128, 127, "XV_BRIGHTNESS"}, + {XvSettable | XvGettable, 0, 255, "XV_CONTRAST"}, + {XvSettable | XvGettable, 0, 255, "XV_SATURATION"}, + {XvSettable | XvGettable, -180, 180, "XV_HUE"} +}; + +#define NUM_IMAGES 7 + +#define FOURCC_RV16 0x36315652 +#define FOURCC_RV15 0x35315652 +#define FOURCC_Y211 0x31313259 + +/* + * 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 + * 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 + * (I420 is also known as IYUV) + */ + + +static XF86ImageRec Images[NUM_IMAGES] = +{ + XVIMAGE_YUY2, + XVIMAGE_YV12, + XVIMAGE_I420, + { + FOURCC_RV16, + XvRGB, + LSBFirst, + {'R','V','1','5', + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + 16, + XvPacked, + 1, + 15, 0x001F, 0x03E0, 0x7C00, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + {'R','V','B',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 + }, + { + FOURCC_RV15, + XvRGB, + LSBFirst, + {'R','V','1','6', + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}, + 16, + XvPacked, + 1, + 16, 0x001F, 0x07E0, 0xF800, + 0, 0, 0, + 0, 0, 0, + 0, 0, 0, + {'R','V','B',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 + }, + { + FOURCC_Y211, + XvYUV, + LSBFirst, + {'Y','2','1','1', + 0x00,0x00,0x00,0x10,0x80,0x00,0x00,0xAA,0x00,0x38,0x9B,0x71}, + 6, + XvPacked, + 3, + 0, 0, 0, 0 , + 8, 8, 8, + 2, 4, 4, + 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 + } +}; + +typedef struct { + int brightness; /* -128 .. 127 */ + CARD32 contrast; /* 0 .. 255 */ + CARD32 saturation; /* 0 .. 255 */ + int hue; /* -128 .. 127 */ + + FBAreaPtr area; + RegionRec clip; + CARD32 colorKey; + CARD32 videoStatus; + Time offTime; + Time freeTime; + int lastKnownPitch; +} SavagePortPrivRec, *SavagePortPrivPtr; + + +#define GET_PORT_PRIVATE(pScrn) \ + (SavagePortPrivPtr)((SAVPTR(pScrn))->adaptor->pPortPrivates[0].ptr) + +/************************************** + S3 streams processor +**************************************/ + +#define EXT_MISC_CTRL2 0x67 + +/* New streams */ + +/* CR67[2] = 1 : enable stream 1 */ +#define ENABLE_STREAM1 0x04 +/* CR67[1] = 1 : enable stream 2 */ +#define ENABLE_STREAM2 0x02 +/* mask to clear CR67[2,1] */ +#define NO_STREAMS 0xF9 +/* 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_YV12: + case FOURCC_I420: + return 1; + case FOURCC_Y211: + return 4; + case FOURCC_RV15: + return 3; + case FOURCC_RV16: + return 5; + default: + return 0; + } +} + +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; + + /* + * 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 +#if 0 +#define OUTREG(a,v) myOUTREG(psav,a,v) +#else +#define OUTREG(addr,val) MMIO_OUT32(psav->MapBase, addr, val) +#endif + +void SavageInitStreamsNew(ScrnInfoPtr pScrn) +{ + SavagePtr psav = SAVPTR(pScrn); + unsigned long jDelta; + + xf86ErrorFVerb(XVTRACE, "SavageInitStreams\n" ); + + /* Primary stream reflects the frame buffer. */ + + jDelta = pScrn->displayWidth * pScrn->bitsPerPixel / 8; + OUTREG( PRI_STREAM_BUFFERSIZE, jDelta * pScrn->virtualY >> 3 ); + OUTREG( PRI_STREAM_FBUF_ADDR0, pScrn->fbOffset ); + OUTREG( PRI_STREAM_STRIDE, jDelta ); + + OUTREG( SEC_STREAM_CKEY_LOW, 0 ); + OUTREG( SEC_STREAM_CKEY_UPPER, 0 ); + OUTREG( SEC_STREAM_HSCALING, 0 ); + OUTREG( SEC_STREAM_VSCALING, 0 ); + OUTREG( BLEND_CONTROL, 0 ); + OUTREG( SEC_STREAM_FBUF_ADDR0, 0 ); + OUTREG( SEC_STREAM_FBUF_ADDR1, 0 ); + OUTREG( SEC_STREAM_FBUF_ADDR2, 0 ); + OUTREG( SEC_STREAM_WINDOW_START, 0 ); + OUTREG( SEC_STREAM_WINDOW_SZ, 0 ); +/* OUTREG( SEC_STREAM_BUFFERSIZE, 0 ); */ + OUTREG( SEC_STREAM_TILE_OFF, 0 ); + OUTREG( SEC_STREAM_OPAQUE_OVERLAY, 0 ); + OUTREG( SEC_STREAM_STRIDE, 0 ); + + /* 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 ); +} + +void SavageStreamsOn(ScrnInfoPtr pScrn, int id) +{ + SavagePtr psav = SAVPTR(pScrn); + vgaHWPtr hwp; + unsigned char jStreamsControl; + unsigned short vgaIOBase, vgaCRIndex, vgaCRReg; + + xf86ErrorFVerb(XVTRACE, "SavageStreamsOn\n" ); + + /* Sequence stolen from streams.c in M7 NT driver */ + + hwp = VGAHWPTR(pScrn); + + vgaHWGetIOBase(hwp); + vgaIOBase = hwp->IOBase; + vgaCRIndex = vgaIOBase + 4; + vgaCRReg = vgaIOBase + 5; + + xf86EnableIO(); + + /* Unlock extended registers. */ + + VGAOUT16(vgaCRIndex, 0x4838); + VGAOUT16(vgaCRIndex, 0xa039); + VGAOUT16(0x3c4, 0x0608); + + VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 ); + + if( (psav->Chipset == S3_SAVAGE_MX) || + (psav->Chipset == S3_SAVAGE2000) ) + { + jStreamsControl = VGAIN8( vgaCRReg ) | ENABLE_STREAM1; + + /* Wait for VBLANK. */ + + VerticalRetraceWait(); + + /* Fire up streams! */ + + VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 ); + + 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. */ + + VerticalRetraceWait(); + + /* Turn on secondary stream TV flicker filter, once we support TV. */ + + /* SR70 |= 0x10 */ + + psav->videoFlags |= VF_STREAMS_ON; + psav->videoFourCC = id; +} + + +void SavageStreamsOff(ScrnInfoPtr pScrn) +{ + SavagePtr psav = SAVPTR(pScrn); + vgaHWPtr hwp; + unsigned char jStreamsControl; + unsigned short vgaIOBase, vgaCRIndex, vgaCRReg; + + xf86ErrorFVerb(XVTRACE, "SavageStreamsOff\n" ); + + hwp = VGAHWPTR(pScrn); + + vgaHWGetIOBase(hwp); + vgaIOBase = hwp->IOBase; + vgaCRIndex = vgaIOBase + 4; + vgaCRReg = vgaIOBase + 5; + + xf86EnableIO(); + + /* Unlock extended registers. */ + + VGAOUT16(vgaCRIndex, 0x4838); + VGAOUT16(vgaCRIndex, 0xa039); + VGAOUT16(0x3c4, 0x0608); + + VGAOUT8( vgaCRIndex, EXT_MISC_CTRL2 ); + 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. */ + + VerticalRetraceWait(); + + /* Kill streams. */ + + VGAOUT16( vgaCRIndex, (jStreamsControl << 8) | EXT_MISC_CTRL2 ); + + VGAOUT16( vgaCRIndex, 0x0093 ); + VGAOUT8( vgaCRIndex, 0x92 ); + VGAOUT8( vgaCRReg, VGAIN8(vgaCRReg) & 0x40 ); + + psav->videoFlags &= ~VF_STREAMS_ON; +} + + +void SavageInitVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; + XF86VideoAdaptorPtr newAdaptor = NULL; + SavagePtr psav = SAVPTR(pScrn); + int num_adaptors; + + xf86ErrorFVerb(XVTRACE,"SavageInitVideo\n"); +xf86Break1(); + if( + (psav->Chipset == S3_SAVAGE_MX) || + (psav->Chipset == S3_SAVAGE2000) + ) + { + newAdaptor = SavageSetupImageVideo(pScreen); + SavageInitOffscreenImages(pScreen); + + 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); + + if(newAdaptor) { + if(!num_adaptors) { + num_adaptors = 1; + adaptors = &newAdaptor; + } else { + newAdaptors = /* need to free this someplace */ + xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } + } + } + + if(num_adaptors) + xf86XVScreenInit(pScreen, adaptors, num_adaptors); + + if(newAdaptors) + xfree(newAdaptors); + + if( newAdaptor ) + { + if( SavageInitStreams == SavageInitStreamsNew ) + SavageInitStreams(pScrn); + psav->videoFlags = 0; + psav->videoFourCC = 0; + } +} + + +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; + 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( SEC_STREAM_CKEY_LOW, 0 ); + OUTREG( SEC_STREAM_CKEY_UPPER, 0 ); + OUTREG( BLEND_CONTROL, psav->blendBase | 0x08 ); + } + else { + switch (pScrn->depth) { + case 8: + OUTREG( SEC_STREAM_CKEY_LOW, + 0x47000000 | (pPriv->colorKey & 0xFF) ); + OUTREG( SEC_STREAM_CKEY_UPPER, + 0x47000000 | (pPriv->colorKey & 0xFF) ); + break; + case 15: + OUTREG( SEC_STREAM_CKEY_LOW, + 0x45000000 | (red<<19) | (green<<11) | (blue<<3) ); + OUTREG( SEC_STREAM_CKEY_UPPER, + 0x45000000 | (red<<19) | (green<<11) | (blue<<3) ); + break; + case 16: + OUTREG( SEC_STREAM_CKEY_LOW, + 0x46000000 | (red<<19) | (green<<10) | (blue<<3) ); + OUTREG( SEC_STREAM_CKEY_UPPER, + 0x46020002 | (red<<19) | (green<<10) | (blue<<3) ); + break; + case 24: + OUTREG( SEC_STREAM_CKEY_LOW, + 0x47000000 | (red<<16) | (green<<8) | (blue) ); + OUTREG( SEC_STREAM_CKEY_UPPER, + 0x47000000 | (red<<16) | (green<<8) | (blue) ); + break; + } + + /* We assume destination colorkey */ + OUTREG( BLEND_CONTROL, psav->blendBase | 0x08 ); + } +} + + +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; + + /* Brightness/contrast/saturation/hue computations. */ + + double k, dk1, dk2, dk3, dk4, dk5, dk6, dk7, dkb; + int k1, k2, k3, k4, k5, k6, k7, kb; + double s = pPriv->saturation / 128.0; + double h = pPriv->hue * 0.017453292; + unsigned long assembly; + + xf86ErrorFVerb(XVTRACE, "bright %d, contrast %d, saturation %d, hue %d\n", + pPriv->brightness, pPriv->contrast, pPriv->saturation, pPriv->hue ); + + if( psav->videoFourCC == FOURCC_Y211 ) + k = 1.0; /* YUV */ + else + k = 1.14; /* YCrCb */ + + /* + * The S3 documentation must be wrong for k4 and k5. Their default + * values, which they hardcode in their Windows driver, have the + * opposite sign from the results in the register spec. + */ + + dk1 = k * pPriv->contrast; + dk2 = 64.0 * 1.371 * k * s * cos(h); + dk3 = -64.0 * 1.371 * k * s * sin(h); + dk4 = -128.0 * k * s * (0.698 * cos(h) - 0.336 * sin(h)); + dk5 = -128.0 * k * s * (0.698 * sin(h) + 0.336 * cos(h)); + dk6 = 64.0 * 1.732 * k * s * sin(h); /* == k3 / 1.26331, right? */ + dk7 = 64.0 * 1.732 * k * s * cos(h); /* == k2 / -1.26331, right? */ + dkb = 128.0 * pPriv->brightness + 64.0; + if( psav->videoFourCC != FOURCC_Y211 ) + dkb -= dk1 * 14.0; + + k1 = (int)(dk1+0.5) & 0x1ff; + k2 = (int)(dk2+0.5) & 0x1ff; + k3 = (int)(dk3+0.5) & 0x1ff; + assembly = (k3<<18) | (k2<<9) | k1; + 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; + 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; + xf86ErrorFVerb(XVTRACE+1, "CC3 = %08x\n", assembly ); + OUTREG( SEC_STREAM_COLOR_CONVERT3, assembly ); +} + + +void SavageResetVideo(ScrnInfoPtr pScrn) +{ + xf86ErrorFVerb(XVTRACE,"SavageResetVideo\n"); + SavageSetColor( pScrn ); + SavageSetColorKey( pScrn ); +} + + +static XF86VideoAdaptorPtr +SavageSetupImageVideo(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + SavagePtr psav = SAVPTR(pScrn); + XF86VideoAdaptorPtr adapt; + SavagePortPrivPtr pPriv; + + xf86ErrorFVerb(XVTRACE,"SavageSetupImageVideo\n"); + + if(!(adapt = xcalloc(1, sizeof(XF86VideoAdaptorRec) + + sizeof(SavagePortPrivRec) + + sizeof(DevUnion)))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "Savage Streams Engine"; + adapt->nEncodings = 1; + adapt->pEncodings = DummyEncoding; + adapt->nFormats = NUM_FORMATS; + adapt->pFormats = Formats; + adapt->nPorts = 1; + adapt->pPortPrivates = (DevUnion*)(&adapt[1]); + pPriv = (SavagePortPrivPtr)(&adapt->pPortPrivates[1]); + adapt->pPortPrivates[0].ptr = (pointer)(pPriv); + adapt->pAttributes = Attributes; + adapt->nImages = NUM_IMAGES; + adapt->nAttributes = NUM_ATTRIBUTES; + adapt->pImages = Images; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = SavageStopVideo; + adapt->SetPortAttribute = SavageSetPortAttribute; + adapt->GetPortAttribute = SavageGetPortAttribute; + adapt->QueryBestSize = SavageQueryBestSize; + adapt->PutImage = SavagePutImage; + adapt->QueryImageAttributes = SavageQueryImageAttributes; + + xvBrightness = MAKE_ATOM("XV_BRIGHTNESS"); + xvContrast = MAKE_ATOM("XV_CONTRAST"); + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvHue = MAKE_ATOM("XV_HUE"); + xvSaturation = MAKE_ATOM("XV_SATURATION"); + + pPriv->colorKey = + (1 << pScrn->offset.red) | + (1 << pScrn->offset.green) | + (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); + pPriv->videoStatus = 0; + pPriv->brightness = 0; + pPriv->contrast = 128; + pPriv->saturation = 128; + pPriv->hue = 0; + pPriv->lastKnownPitch = 0; + + /* gotta uninit this someplace */ + REGION_INIT(pScreen, &pPriv->clip, NullBox, 0); + + psav->adaptor = adapt; + + #if 0 + psav->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = SavageBlockHandler; + #endif + + return adapt; +} + + +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) +{ + int *dataA, *dataB; + int num; + + num = REGION_NUM_RECTS(A); + if(num != REGION_NUM_RECTS(B)) + return FALSE; + + if((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || + (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int*)REGION_RECTS(A); + dataB = (int*)REGION_RECTS(B); + + while(num--) { + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } + + return TRUE; +} + + +/* SavageClipVideo - + + Takes the dst box in standard X BoxRec form (top and left + edges inclusive, bottom and right exclusive). The new dst + box is returned. The source boundaries are given (x1, y1 + inclusive, x2, y2 exclusive) and returned are the new source + boundaries in 16.16 fixed point. +*/ + +static void +SavageClipVideo( + BoxPtr dst, + INT32 *x1, + INT32 *x2, + INT32 *y1, + INT32 *y2, + BoxPtr extents, /* extents of the clip region */ + INT32 width, + INT32 height +){ + INT32 vscale, hscale, delta; + int diff; + + hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); + vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); + + *x1 <<= 16; *x2 <<= 16; + *y1 <<= 16; *y2 <<= 16; + + diff = extents->x1 - dst->x1; + if(diff > 0) { + dst->x1 = extents->x1; + *x1 += diff * hscale; + } + diff = dst->x2 - extents->x2; + if(diff > 0) { + dst->x2 = extents->x2; + *x2 -= diff * hscale; + } + diff = extents->y1 - dst->y1; + if(diff > 0) { + dst->y1 = extents->y1; + *y1 += diff * vscale; + } + diff = dst->y2 - extents->y2; + if(diff > 0) { + dst->y2 = extents->y2; + *y2 -= diff * vscale; + } + + if(*x1 < 0) { + diff = (- *x1 + hscale - 1)/ hscale; + dst->x1 += diff; + *x1 += diff * hscale; + } + delta = *x2 - (width << 16); + if(delta > 0) { + diff = (delta + hscale - 1)/ hscale; + dst->x2 -= diff; + *x2 -= diff * hscale; + } + if(*y1 < 0) { + diff = (- *y1 + vscale - 1)/ vscale; + dst->y1 += diff; + *y1 += diff * vscale; + } + delta = *y2 - (height << 16); + if(delta > 0) { + diff = (delta + vscale - 1)/ vscale; + dst->y2 -= diff; + *y2 -= diff * vscale; + } +} + +static void +SavageStopVideo(ScrnInfoPtr pScrn, pointer data, Bool exit) +{ + SavagePortPrivPtr pPriv = (SavagePortPrivPtr)data; + /*SavagePtr psav = SAVPTR(pScrn); */ + + xf86ErrorFVerb(XVTRACE,"SavageStopVideo\n"); + + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + SavageStreamsOff( pScrn ); + + if(exit) { + if(pPriv->area) { + xf86FreeOffscreenArea(pPriv->area); + pPriv->area = NULL; + } + pPriv->videoStatus = 0; + } else { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + } + } +} + + +static int +SavageSetPortAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value, + pointer data +){ + SavagePortPrivPtr pPriv = (SavagePortPrivPtr)data; + /*SavagePtr psav = SAVPTR(pScrn);*/ + + if(attribute == xvColorKey) { + pPriv->colorKey = value; + SavageSetColorKey( pScrn ); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } + else if( attribute == xvBrightness) { + if((value < -128) || (value > 127)) + return BadValue; + pPriv->brightness = value; + SavageSetColor( pScrn ); + } + else if( attribute == xvContrast) { + if((value < 0) || (value > 255)) + return BadValue; + pPriv->contrast = value; + SavageSetColor( pScrn ); + } + else if( attribute == xvSaturation) { + if((value < 0) || (value > 255)) + return BadValue; + pPriv->saturation = value; + SavageSetColor( pScrn ); + } + else if( attribute == xvHue) { + if((value < -180) || (value > 180)) + return BadValue; + pPriv->hue = value; + SavageSetColor( pScrn ); + } + else + return BadMatch; + + return Success; +} + + +static int +SavageGetPortAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data +){ + SavagePortPrivPtr pPriv = (SavagePortPrivPtr)data; + + if(attribute == xvColorKey) { + *value = pPriv->colorKey; + } + else if( attribute == xvBrightness ) { + *value = pPriv->brightness; + } + else if( attribute == xvContrast ) { + *value = pPriv->contrast; + } + else if( attribute == xvHue ) { + *value = pPriv->hue; + } + else if( attribute == xvSaturation ) { + *value = pPriv->saturation; + } + else return BadMatch; + + return Success; +} + +static void +SavageQueryBestSize( + ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, + pointer data +){ + /* What are the real limits for the Savage? */ + + *p_w = drw_w; + *p_h = drw_h; + + if(*p_w > 16384) *p_w = 16384; +} + + +static void +SavageCopyData( + unsigned char *src, + unsigned char *dst, + int srcPitch, + int dstPitch, + int h, + int w +){ + w <<= 1; + while(h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +} + +static void +SavageCopyPlanarData( + unsigned char *src1, /* Y */ + unsigned char *src2, /* V */ + unsigned char *src3, /* U */ + unsigned char *dst1, + int srcPitch, + int srcPitch2, + int dstPitch, + int h, + int w +){ + CARD32 *dst = (CARD32*)dst1; + int i, j; + + dstPitch >>= 2; + w >>= 1; + + for(j = 0; j < h; j++) { + for(i = 0; i < w; i++) { +/* Shouldn't this be 'if LITTLEENDIAN'? */ +#if 1 + dst[i] = src1[i << 1] | (src1[(i << 1) + 1] << 16) | + (src3[i] << 8) | (src2[i] << 24); +#else + dst[i] = (src1[i << 1] << 24) | (src1[(i << 1) + 1] << 8) | + (src3[i] << 0) | (src2[i] << 16); +#endif + } + dst += dstPitch; + src1 += srcPitch; + if(j & 1) { + src2 += srcPitch2; + src3 += srcPitch2; + } + } +} + +static FBAreaPtr +SavageAllocateMemory( + ScrnInfoPtr pScrn, + FBAreaPtr area, + int numlines +){ + ScreenPtr pScreen; + FBAreaPtr new_area; + + if(area) { + if((area->box.y2 - area->box.y1) >= numlines) + return area; + + if(xf86ResizeOffscreenArea(area, pScrn->displayWidth, numlines)) + return area; + + xf86FreeOffscreenArea(area); + } + + pScreen = screenInfo.screens[pScrn->scrnIndex]; + + new_area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + numlines, 0, NULL, NULL, NULL); + + if(!new_area) { + int max_w, max_h; + + xf86QueryLargestOffscreenArea(pScreen, &max_w, &max_h, 0, + FAVOR_WIDTH_THEN_AREA, PRIORITY_EXTREME); + + if((max_w < pScrn->displayWidth) || (max_h < numlines)) + return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_area = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + numlines, 0, NULL, NULL, NULL); + } + + return new_area; +} + +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 +){ + SavagePtr psav = SAVPTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); + SavagePortPrivPtr pPriv = psav->adaptor->pPortPrivates[0].ptr; + /*DisplayModePtr mode = pScrn->currentMode;*/ + 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); + } + + /* Set surface format. */ + + OUTREG(SSTREAM_CONTROL_REG, + (GetBlendForFourCC(psav->videoFourCC) << 24) + src_w ); + + /* Calculate horizontal scale factor. */ + + OUTREG(SSTREAM_STRETCH_REG, 32768 * src_w / drw_w ); + + /* Calculate vertical scale factor. */ + + 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+1) << 16) | (dstBox->y1+1) ); + OUTREG(SEC_STREAM_WINDOW_SZ, ((drw_w) << 16) | 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 - 4; + VGAOUT8(vgaCRIndex, 0x92); + cr92 = VGAIN8(vgaCRReg); + VGAOUT8(vgaCRReg, (cr92 & 0x40) | (pitch >> 8) | 0x80); + VGAOUT8(vgaCRIndex, 0x93); + VGAOUT8(vgaCRReg, pitch); + } +} + +static int +SavagePutImage( + ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char* buf, + short width, short height, + Bool sync, + RegionPtr clipBoxes, pointer data +){ + SavagePortPrivPtr pPriv = (SavagePortPrivPtr)data; + SavagePtr psav = SAVPTR(pScrn); + INT32 x1, x2, y1, y2; + unsigned char *dst_start; + int pitch, new_h, offset, offsetV=0, offsetU=0; + int srcPitch, srcPitch2=0, dstPitch; + int top, left, npixels, nlines; + BoxRec dstBox; + CARD32 tmp; + + if(drw_w > 16384) drw_w = 16384; + + /* Clip */ + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + SavageClipVideo(&dstBox, &x1, &x2, &y1, &y2, + REGION_EXTENTS(pScreen, clipBoxes), width, height); + + if((x1 >= x2) || (y1 >= y2)) + return Success; + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + pitch = pScrn->bitsPerPixel * pScrn->displayWidth >> 3; + + dstPitch = ((width << 1) + 15) & ~15; + new_h = ((dstPitch * height) + pitch - 1) / pitch; + + switch(id) { + case FOURCC_Y211: /* Y211 */ + srcPitch = width; + break; + case FOURCC_YV12: /* YV12 */ + srcPitch = (width + 3) & ~3; + offsetV = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + offsetU = (srcPitch2 * (height >> 1)) + offsetV; + break; + case FOURCC_I420: + srcPitch = (width + 3) & ~3; + offsetU = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + offsetV = (srcPitch2 * (height >> 1)) + offsetU; + break; + case FOURCC_RV15: /* RGB15 */ + case FOURCC_RV16: /* RGB16 */ + case FOURCC_YUY2: /* YUY2 */ + default: + srcPitch = (width << 1); + break; + } + + if(!(pPriv->area = SavageAllocateMemory(pScrn, pPriv->area, new_h))) + return BadAlloc; + + /* copy data */ + top = y1 >> 16; + left = (x1 >> 16) & ~1; + npixels = ((((x2 + 0xffff) >> 16) + 1) & ~1) - left; + left <<= 1; + + offset = (pPriv->area->box.y1 * pitch) + (top * dstPitch); + dst_start = psav->FBBase + offset + left; + + switch(id) { + case FOURCC_YV12: /* YV12 */ + case FOURCC_I420: + top &= ~1; + tmp = ((top >> 1) * srcPitch2) + (left >> 2); + offsetU += tmp; + offsetV += tmp; + nlines = ((((y2 + 0xffff) >> 16) + 1) & ~1) - top; + SavageCopyPlanarData( + buf + (top * srcPitch) + (left >> 1), + buf + offsetV, + buf + offsetU, + dst_start, srcPitch, srcPitch2, dstPitch, nlines, npixels); + break; + case FOURCC_Y211: /* Y211 */ + case FOURCC_RV15: /* RGB15 */ + case FOURCC_RV16: /* RGB16 */ + case FOURCC_YUY2: /* YUY2 */ + default: + buf += (top * srcPitch) + left; + nlines = ((y2 + 0xffff) >> 16) - top; + SavageCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels); + break; + } + + /* update cliplist */ + if(!RegionsEqual(&pPriv->clip, clipBoxes)) { + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + /* draw these */ + XAAFillSolidRects(pScrn, pPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + + SavageDisplayVideo(pScrn, id, offset, width, height, dstPitch, + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + + pPriv->videoStatus = CLIENT_VIDEO_ON; + + return Success; +} + +static int +SavageQueryImageAttributes( + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets +){ + int size, tmp; + + if(*w > 1024) *w = 1024; + if(*h > 1024) *h = 1024; + + *w = (*w + 1) & ~1; + if(offsets) offsets[0] = 0; + + switch(id) { + case FOURCC_Y211: + size = *w << 2; + if(pitches) pitches[0] = size; + size *= *h; + break; + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if(pitches) pitches[0] = size; + size *= *h; + if(offsets) offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if(pitches) pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if(offsets) offsets[2] = size; + size += tmp; + break; + case FOURCC_RV15: /* RGB15 */ + case FOURCC_RV16: /* RGB16 */ + case FOURCC_YUY2: + default: + size = *w << 1; + if(pitches) pitches[0] = size; + size *= *h; + break; + } + + return size; +} + +#if 0 + +static void +CHIPSBlockHandler ( + int i, + pointer blockData, + pointer pTimeout, + pointer pReadmask +){ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + CHIPSPtr cPtr = CHIPSPTR(pScrn); + CHIPSPortPrivPtr pPriv = GET_PORT_PRIVATE(pScrn); + unsigned char mr3c; + + pScreen->BlockHandler = cPtr->BlockHandler; + + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + + pScreen->BlockHandler = CHIPSBlockHandler; + + CHIPSHiQVSync(pScrn); + if(pPriv->videoStatus & TIMER_MASK) { + UpdateCurrentTime(); + if(pPriv->videoStatus & OFF_TIMER) { + if(pPriv->offTime < currentTime.milliseconds) { + mr3c = cPtr->readMR(cPtr, 0x3C); + cPtr->writeMR(cPtr, 0x3C, (mr3c & 0xFE)); + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } + } else { /* FREE_TIMER */ + if(pPriv->freeTime < currentTime.milliseconds) { + if(pPriv->area) { + xf86FreeOffscreenArea(pPriv->area); + pPriv->area = NULL; + } + pPriv->videoStatus = 0; + } + } + } +} + +#endif + +/****************** Offscreen stuff ***************/ + +typedef struct { + FBAreaPtr area; + Bool isOn; +} OffscreenPrivRec, * OffscreenPrivPtr; + +static int +SavageAllocateSurface( + ScrnInfoPtr pScrn, + int id, + unsigned short w, + unsigned short h, + XF86SurfacePtr surface +){ + FBAreaPtr area; + int pitch, fbpitch, numlines; + OffscreenPrivPtr pPriv; + + if((w > 1024) || (h > 1024)) + return BadAlloc; + + w = (w + 1) & ~1; + pitch = ((w << 1) + 15) & ~15; + fbpitch = pScrn->bitsPerPixel * pScrn->displayWidth >> 3; + numlines = ((pitch * h) + fbpitch - 1) / fbpitch; + + if(!(area = SavageAllocateMemory(pScrn, NULL, numlines))) + return BadAlloc; + + surface->width = w; + surface->height = h; + + if(!(surface->pitches = xalloc(sizeof(int)))) + return BadAlloc; + if(!(surface->offsets = xalloc(sizeof(int)))) { + xfree(surface->pitches); + return BadAlloc; + } + if(!(pPriv = xalloc(sizeof(OffscreenPrivRec)))) { + xfree(surface->pitches); + xfree(surface->offsets); + return BadAlloc; + } + + pPriv->area = area; + pPriv->isOn = FALSE; + + surface->pScrn = pScrn; + surface->id = id; + surface->pitches[0] = pitch; + surface->offsets[0] = area->box.y1 * fbpitch; + surface->devPrivate.ptr = (pointer)pPriv; + + return Success; +} + +static int +SavageStopSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) { + /*SavagePtr psav = SAVPTR(surface->pScrn);*/ + SavageStreamsOff( surface->pScrn ); + pPriv->isOn = FALSE; + } + + return Success; +} + + +static int +SavageFreeSurface( + XF86SurfacePtr surface +){ + OffscreenPrivPtr pPriv = (OffscreenPrivPtr)surface->devPrivate.ptr; + + if(pPriv->isOn) + SavageStopSurface(surface); + xf86FreeOffscreenArea(pPriv->area); + xfree(surface->pitches); + xfree(surface->offsets); + xfree(surface->devPrivate.ptr); + + return Success; +} + +static int +SavageGetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value +){ + return SavageGetPortAttribute(pScrn, attribute, value, + (pointer)(GET_PORT_PRIVATE(pScrn))); +} + +static int +SavageSetSurfaceAttribute( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value +){ + return SavageSetPortAttribute(pScrn, attribute, value, + (pointer)(GET_PORT_PRIVATE(pScrn))); +} + + +static int +SavageDisplaySurface( + 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; + SavagePortPrivPtr portPriv = GET_PORT_PRIVATE(pScrn); + INT32 x1, y1, x2, y2; + BoxRec dstBox; + + x1 = src_x; + x2 = src_x + src_w; + y1 = src_y; + y2 = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + SavageClipVideo(&dstBox, &x1, &x2, &y1, &y2, + REGION_EXTENTS(pScreen, clipBoxes), + surface->width, surface->height); + + if((x1 >= x2) || (y1 >= y2)) + return Success; + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + XAAFillSolidRects(pScrn, portPriv->colorKey, GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + + SavageDisplayVideo(pScrn, surface->id, surface->offsets[0], + surface->width, surface->height, surface->pitches[0], + x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); + + pPriv->isOn = TRUE; +#if 0 + if(portPriv->videoStatus & CLIENT_VIDEO_ON) { + REGION_EMPTY(pScrn->pScreen, &portPriv->clip); + UpdateCurrentTime(); + portPriv->videoStatus = FREE_TIMER; + portPriv->freeTime = currentTime.milliseconds + FREE_DELAY; + } +#endif + + return Success; +} + + +static void +SavageInitOffscreenImages(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 = SavageAllocateSurface; + offscreenImages[0].free_surface = SavageFreeSurface; + offscreenImages[0].display = SavageDisplaySurface; + offscreenImages[0].stop = SavageStopSurface; + offscreenImages[0].setAttribute = SavageSetSurfaceAttribute; + offscreenImages[0].getAttribute = SavageGetSurfaceAttribute; + offscreenImages[0].max_width = 1024; + offscreenImages[0].max_height = 1024; + offscreenImages[0].num_attributes = NUM_ATTRIBUTES; + offscreenImages[0].attributes = Attributes; + + xf86XVRegisterOffscreenImages(pScreen, offscreenImages, 1); +} + +#endif /* !XvExtension */ Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile:1.1 Tue Nov 28 15:59:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile Tue Jan 23 19:06:27 2001 @@ -1,5 +1,5 @@ XCOMM Header: //Mercury/Projects/archives/XFree86/4.0/Imakefile.-arc 1.4 02 Aug 2000 13:17:16 Frido $ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile,v 1.1 2000/11/28 20:59:18 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Imakefile,v 1.2 2001/01/24 00:06:27 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -38,7 +38,6 @@ InstallObjectModule(siliconmotion,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(siliconmotion,) InstallModuleManPage(siliconmotion) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README:1.2 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README:1.2 Tue Dec 5 16:18:37 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README Thu Feb 15 13:20:33 2001 @@ -21,6 +21,7 @@ - "Rotate" "cw" | "ccw" Rotate the screen CW - clockwise or CCW - counter clockwise. Uses ShadowFB. Default: no rotation. - "UseBIOS" Use BIOS to set modes. Default: on. +- "ZoomOnLCD" Allow changing resolution on panel. Default: off. Overlays: @@ -72,4 +73,4 @@ Header: //Mercury/Projects/archives/XFree86/4.0/README.-arc 1.2 14 Sep 2000 12:28:36 Frido $ -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README,v 1.2 2000/12/05 21:18:37 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/README,v 1.3 2001/02/15 18:20:33 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt:1.3 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt:1.3 Wed Dec 13 20:05:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt Thu Feb 15 13:20:33 2001 @@ -1,5 +1,41 @@ + -------------------------------------------------------------------------------- - Silicon Motion Driver for XFree86 4.0.1 + Silicon Motion Driver for XFree86 4.0.2 + Alpha Release 1.2.2, 02/14/2001 +------------------------------------------------------------------------------- + +Fixed bugs: + +- #920 - Color change/flash at 8bpp when switch back to desktop in rotation + mode. +- #932 - System hangs when enabling rotation in 24-bpp. +- #941 - Overlay disappear in the virtual desktop when move the window. +- #944 - Mouse pointer doesn't work properly in panning modes under rotation. +- #950 - Garbage appears on desktop when click the Basic/Metal for the Theme + Selector. +- #983 - Added ZoomOnLCD option. +- #1058 - Desktop changes color when panning in 24-bpp mode. +- #1069 - CRT is off after exit X on DSTN 800x600. +- #1074 - Screen broken occurs in X when enable Rotation on DSTN 800x600. + +Known problems: + +- When video is playing in panning mode, it is not correctly clipped when you + move the panning window. +- Sound breaks apart in Netscape when moving the window around. + +------------------------------------------------------------------------------- + Silicon Motion Driver for XFree86 4.0.2 + Alpha Release 1.2.1, 01/03/2001 +-------------------------------------------------------------------------------- + +Fixed bugs: + +- Severe corruption in 24-bpp across all chips. +- Disable hardware cursor on older BIOSes. + +-------------------------------------------------------------------------------- + Silicon Motion Driver for XFree86 4.0.2 Alpha Release 1.2.0, 12/13/2000 -------------------------------------------------------------------------------- @@ -148,6 +184,6 @@ mode might still show lock-ups and/or garbage. Please report any problems to frido@siliconmotion.com. -Header: //Mercury/Projects/archives/XFree86/4.0/Release.txt-arc 1.30 30 Nov 2000 17:00:58 Frido $ +Header: //Mercury/Projects/archives/XFree86/4.0/Release.txt-arc 1.33 13 Dec 2000 09:52:48 Frido $ -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt,v 1.3 2000/12/14 01:05:43 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/Release.txt,v 1.5 2001/02/15 18:20:33 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp:1.4 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp:1.4 Tue Dec 12 13:54:31 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp Mon Jun 4 12:41:04 2001 @@ -1,195 +0,0 @@ -.\" Header: //Mercury/Projects/archives/XFree86/4.0/siliconmotion.cpp-arc 1.4 29 Nov 2000 14:12:56 Frido $ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.cpp,v 1.4 2000/12/12 18:54:31 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH siliconmotion __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -siliconmotion \- Silicon Motion video driver -.SH SYNOPSIS -.B "Section \*qDevice\*q" -.br -.BI " Identifier \*q" devname \*q -.br -.B " Driver \*qsiliconmotion\*q" -.br -\ \ ... -.br -\ \ [ -.B "Option" -"optionname" ["optionvalue"]] -.br -.B EndSection -.SH DESCRIPTION -.B siliconmotion -is an XFree86 driver for Silicon Motion based video cards. The driver is fully -accelerated, and provides support for the following framebuffer depths: -8, 16, and 24. All -visual types are supported for depth 8, and TrueColor -visuals are supported for the other depths. -.SH SUPPORTED HARDWARE -The -.B siliconmotion -driver supports PCI and AGP video cards based on the following Silicon Motion chips: -.TP 12 -.B Lynx -SM910 -.TP 12 -.B LynxE -SM810 -.TP 12 -.B Lynx3D -SM820 -.TP 12 -.B LynxEM -SM710 -.TP 12 -.B LynxEM+ -SM712 -.TP 12 -.B Lynx3DM -SM720 -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. All options names are case and white space insensitive when -parsed by the server, for example, "lynxe" and "LynxE" are equivalent. -.PP -The driver auto-detects the chipset type, but the following -.B ChipSet -names may optionally be specified in the config file -.B \*qDevice\*q -section, and will override the auto-detection: -.PP -.RS 4 -"lynx", "lynxe", "lynx3d", "lynxem", "lynxem+", "lynx3dm". -.RE - -.PP -The following Cursor -.B Options -are supported: -.TP -.BI "Option \*qHWCursor\*q \*q" boolean \*q -Enable or disable the HW cursor. Default: on. -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Inverse of "HWCursor". Default: off. - -.PP -The following display -.B Options -are supported: -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Use shadow framebuffer. Default: off. -.TP -.BI "Option \*qRotate\*q \*qCW\*q" -.TP -.BI "Option \*qRotate\*q \*qCCW\*q" -Rotate the screen CW - clockwise or CCW - counter clockwise. -Uses ShadowFB. Default: no rotation. -.TP -.BI "Option \*qVideoKey\*q \*q" integer \*q -Set the video color key. Default: a little off full blue. -.TP -.BI "Option \*qByteSwap\*q \*q" boolean \*q -Turn on byte swapping for capturing using SMI demo board. Default: off. -.TP -.BI "Option \*qUseBIOS\*q \*q" boolean \*q -Use the BIOS to set the modes. This is used for custom panel timings. -Default: on. - -.PP -The following video memory -.B Options -are supported: -.TP -.BI "Option \*qset_mclk\*q \*q" integer \*q -sets the memory clock, where -.I integer -is in kHz, and -.I integer -<= 100000. Default: probe the memory clock value, -and use it at server start. - - -.PP -The following acceleration and graphics engine -.B Options -are supported: -.TP -.B "Option \*qNoAccel\*q" -Disable acceleration. Very useful for determining if the -driver has problems with drawing and acceleration routines. This is the first -option to try if your server runs but you see graphic corruption on the screen. -Using it decreases performance, as it uses software emulation for drawing -operations the video driver can accelerate with hardware. -Default: acceleration is enabled. -.TP -.B "Option \*qfifo_aggressive\*q" -.TP -.B "Option \*qfifo_moderate\*q" -.TP -.B "Option \*qfifo_conservative\*q" -alter the settings -for the threshold at which the pixel FIFO takes over the internal -memory bus to refill itself. The smaller this threshold, the better -the acceleration performance of the card. You may try the fastest -setting -.RB ( "fifo_aggressive" ) -and move down if you encounter pixel corruption. -The optimal setting will probably depend on dot-clock and on color -depth. Note that specifying any of these options will also alter other -memory settings which may increase performance, so trying -.B "fifo_conservative" -will in most cases be a slight benefit (this uses the chip defaults). -If pixel corruption or transient streaking is observed during drawing -operations then removing any fifo options is recommended. Default: none. - -.PP -The following PCI bus -.B Options -are supported: -.TP -.BI "Option \*qpci_burst\*q \*q" boolean \*q -will enable PCI burst mode. This should work on all but a -few broken PCI chipsets, and will increase performance. Default: off. -.TP -.BI "Option \*qpci_retry\*q \*q" boolean \*q -will allow the driver to rely on PCI Retry to program the -ViRGE registers. -.B "pci_burst" -must be enabled for this to work. -This will increase performance, especially for small fills/blits, -because the driver does not have to poll the ViRGE before sending it -commands to make sure it is ready. It should work on most -recent PCI chipsets. Default: off. - -.PP -The following additional -.B Options -are supported: -.TP -.BI "Option \*qShowCache\*q \*q" boolean \*q -Enable or disable viewing offscreen cache memory. A -development debug option. Default: off. - -.SH SEE ALSO -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) - -.SH SUPPORT -For assistance with this driver, or XFree86 in general, check the XFree86 web -site at http://www.xfree86.org. A FAQ is available on the web site at -http://www.xfree86.org/FAQ/. If you find a problem with XFree86 or have a -question not answered in the FAQ please use our bug report form available on -the web site or send mail to XFree86@XFree86.org. When reporting problems -with the driver send as much detail as possible, including chipset type, a -server output log, and operating system specifics. - -.SH AUTHORS -Kevin Brosius, -Matt Grossman, -Harald Koenig, -Sebastien Marineau, -Mark Vojkovich, -Frido Garritsen. Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man:1.3 --- /dev/null Mon Jun 4 12:41:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man Thu Feb 15 13:20:33 2001 @@ -0,0 +1,199 @@ +.\" Header: //Mercury/Projects/archives/XFree86/4.0/siliconmotion.cpp-arc 1.4 29 Nov 2000 14:12:56 Frido $ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/siliconmotion.man,v 1.3 2001/02/15 18:20:33 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH siliconmotion __drivermansuffix__ __vendorversion__ +.SH NAME +siliconmotion \- Silicon Motion video driver +.SH SYNOPSIS +.B "Section \*qDevice\*q" +.br +.BI " Identifier \*q" devname \*q +.br +.B " Driver \*qsiliconmotion\*q" +.br +\ \ ... +.br +\ \ [ +.B "Option" +"optionname" ["optionvalue"]] +.br +.B EndSection +.SH DESCRIPTION +.B siliconmotion +is an XFree86 driver for Silicon Motion based video cards. The driver is fully +accelerated, and provides support for the following framebuffer depths: +8, 16, and 24. All +visual types are supported for depth 8, and TrueColor +visuals are supported for the other depths. +.SH SUPPORTED HARDWARE +The +.B siliconmotion +driver supports PCI and AGP video cards based on the following Silicon Motion chips: +.TP 12 +.B Lynx +SM910 +.TP 12 +.B LynxE +SM810 +.TP 12 +.B Lynx3D +SM820 +.TP 12 +.B LynxEM +SM710 +.TP 12 +.B LynxEM+ +SM712 +.TP 12 +.B Lynx3DM +SM720 +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. All options names are case and white space insensitive when +parsed by the server, for example, "lynxe" and "LynxE" are equivalent. +.PP +The driver auto-detects the chipset type, but the following +.B ChipSet +names may optionally be specified in the config file +.B \*qDevice\*q +section, and will override the auto-detection: +.PP +.RS 4 +"lynx", "lynxe", "lynx3d", "lynxem", "lynxem+", "lynx3dm". +.RE + +.PP +The following Cursor +.B Options +are supported: +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +Enable or disable the HW cursor. Default: on. +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +Inverse of "HWCursor". Default: off. + +.PP +The following display +.B Options +are supported: +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Use shadow framebuffer. Default: off. +.TP +.BI "Option \*qRotate\*q \*qCW\*q" +.TP +.BI "Option \*qRotate\*q \*qCCW\*q" +Rotate the screen CW - clockwise or CCW - counter clockwise. +Uses ShadowFB. Default: no rotation. +.TP +.BI "Option \*qVideoKey\*q \*q" integer \*q +Set the video color key. Default: a little off full blue. +.TP +.BI "Option \*qByteSwap\*q \*q" boolean \*q +Turn on byte swapping for capturing using SMI demo board. Default: off. +.TP +.BI "Option \*qUseBIOS\*q \*q" boolean \*q +Use the BIOS to set the modes. This is used for custom panel timings. +Default: on. +.TP +.BI "Option \*qZoomOnLCD\*q \*q" boolean \*q +Allow changing resolution on LCD (Ctrl-Alt-Plus and Ctrl-Alt-Minus). +Default: off. + +.PP +The following video memory +.B Options +are supported: +.TP +.BI "Option \*qset_mclk\*q \*q" integer \*q +sets the memory clock, where +.I integer +is in kHz, and +.I integer +<= 100000. Default: probe the memory clock value, +and use it at server start. + + +.PP +The following acceleration and graphics engine +.B Options +are supported: +.TP +.B "Option \*qNoAccel\*q" +Disable acceleration. Very useful for determining if the +driver has problems with drawing and acceleration routines. This is the first +option to try if your server runs but you see graphic corruption on the screen. +Using it decreases performance, as it uses software emulation for drawing +operations the video driver can accelerate with hardware. +Default: acceleration is enabled. +.TP +.B "Option \*qfifo_aggressive\*q" +.TP +.B "Option \*qfifo_moderate\*q" +.TP +.B "Option \*qfifo_conservative\*q" +alter the settings +for the threshold at which the pixel FIFO takes over the internal +memory bus to refill itself. The smaller this threshold, the better +the acceleration performance of the card. You may try the fastest +setting +.RB ( "fifo_aggressive" ) +and move down if you encounter pixel corruption. +The optimal setting will probably depend on dot-clock and on color +depth. Note that specifying any of these options will also alter other +memory settings which may increase performance, so trying +.B "fifo_conservative" +will in most cases be a slight benefit (this uses the chip defaults). +If pixel corruption or transient streaking is observed during drawing +operations then removing any fifo options is recommended. Default: none. + +.PP +The following PCI bus +.B Options +are supported: +.TP +.BI "Option \*qpci_burst\*q \*q" boolean \*q +will enable PCI burst mode. This should work on all but a +few broken PCI chipsets, and will increase performance. Default: off. +.TP +.BI "Option \*qpci_retry\*q \*q" boolean \*q +will allow the driver to rely on PCI Retry to program the +ViRGE registers. +.B "pci_burst" +must be enabled for this to work. +This will increase performance, especially for small fills/blits, +because the driver does not have to poll the ViRGE before sending it +commands to make sure it is ready. It should work on most +recent PCI chipsets. Default: off. + +.PP +The following additional +.B Options +are supported: +.TP +.BI "Option \*qShowCache\*q \*q" boolean \*q +Enable or disable viewing offscreen cache memory. A +development debug option. Default: off. + +.SH SEE ALSO +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) + +.SH SUPPORT +For assistance with this driver, or XFree86 in general, check the XFree86 web +site at http://www.xfree86.org. A FAQ is available on the web site at +http://www.xfree86.org/FAQ/. If you find a problem with XFree86 or have a +question not answered in the FAQ please use our bug report form available on +the web site or send mail to XFree86@XFree86.org. When reporting problems +with the driver send as much detail as possible, including chipset type, a +server output log, and operating system specifics. + +.SH AUTHORS +Kevin Brosius, +Matt Grossman, +Harald Koenig, +Sebastien Marineau, +Mark Vojkovich, +Frido Garritsen. Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h:1.2 Tue Dec 5 16:18:37 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h Tue May 15 06:19:40 2001 @@ -26,11 +26,13 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.2 2000/12/05 21:18:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi.h,v 1.6 2001/05/15 10:19:40 eich Exp $ */ #ifndef _SMI_H #define _SMI_H +#define USE_FB + #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -44,11 +46,16 @@ #include "mipointer.h" #include "micmap.h" +#ifdef USE_FB +#include "fb.h" +#else + #define PSZ 8 #include "cfb.h" #undef PSZ #include "cfb16.h" #include "cfb24.h" +#endif #include "xaa.h" #include "xf86cmap.h" @@ -63,19 +70,19 @@ #endif /******************************************************************************/ -/* D E F I N I T O N S */ +/* D E F I N I T I O N S */ /******************************************************************************/ #ifndef SMI_DEBUG - #define SMI_DEBUG 0 + #define SMI_DEBUG 0 #endif #define SMI_USE_IMAGE_WRITES 0 -#define SMI_USE_VIDEO 1 -#define SMI_USE_CAPTURE 1 +#define SMI_USE_VIDEO 1 +#define SMI_USE_CAPTURE 1 /******************************************************************************/ -/* S T R U C T U R E S */ +/* S T R U C T U R E S */ /******************************************************************************/ /* Driver data structure; this should contain all needed info for a mode */ @@ -100,124 +107,153 @@ typedef struct { /* accel additions */ - CARD32 AccelCmd; /* Value for DPR0C */ - CARD32 Stride; /* Stride of frame buffer */ - CARD32 ScissorsLeft; /* Left/top of current scissors */ - CARD32 ScissorsRight; /* Right/bottom of current scissors */ - Bool ClipTurnedOn; /* Clipping was turned on by the - previous command */ - - CARD8 SR18Value; /* PDR#521: original SR18 value */ - CARD8 SR21Value; /* PDR#521: original SR21 value */ - SMIRegRec SavedReg; /* console saved mode registers */ - SMIRegRec ModeReg; /* XServer video state mode registers */ - xf86CursorInfoPtr CursorInfoRec; /* HW Cursor info */ - - Bool ModeStructInit; /* Flag indicating ModeReg has been * - * duped from console state */ - int vgaCRIndex, vgaCRReg; - int width, height; /* Width and height of the screen */ - int Bpp; /* Bytes per pixel */ + CARD32 AccelCmd; /* Value for DPR0C */ + CARD32 Stride; /* Stride of frame buffer */ + CARD32 ScissorsLeft; /* Left/top of current + scissors */ + CARD32 ScissorsRight; /* Right/bottom of current + scissors */ + Bool ClipTurnedOn; /* Clipping was turned on by + the previous command */ + CARD8 SR18Value; /* PDR#521: original SR18 + value */ + CARD8 SR21Value; /* PDR#521: original SR21 + value */ + SMIRegRec SavedReg; /* console saved mode + registers */ + SMIRegRec ModeReg; /* XServer video state mode + registers */ + xf86CursorInfoPtr CursorInfoRec; /* HW Cursor info */ + + Bool ModeStructInit; /* Flag indicating ModeReg has + been duped from console + state */ + int vgaCRIndex, vgaCRReg; + int width, height; /* Width and height of the + screen */ + int Bpp; /* Bytes per pixel */ /* XAA */ - int videoRAMBytes; /* In units as noted, set in PreInit */ - int videoRAMKBytes; /* In units as noted, set in PreInit */ - unsigned char * MapBase; /* Base of mapped memory */ - int MapSize; /* Size of mapped memory */ - CARD8 * DPRBase; /* Base of DPR registers */ - CARD8 * VPRBase; /* Base of VPR registers */ - CARD8 * CPRBase; /* Base of CPR registers */ - CARD8 * DataPortBase; /* Base of data port */ - int DataPortSize; /* Size of data port */ - volatile CARD8 *IOBase; /* Base of MMIO VGA ports */ - unsigned char * FBBase; /* Base of FB */ - CARD32 FBOffset; /* Current visual FB starting * - * location */ - CARD32 FBCursorOffset; /* Cursor storage location */ - CARD32 FBReserved; /* Reserved memory in frame buffer */ + int videoRAMBytes; /* In units as noted, set in + PreInit */ + int videoRAMKBytes; /* In units as noted, set in + PreInit */ + unsigned char * MapBase; /* Base of mapped memory */ + int MapSize; /* Size of mapped memory */ + CARD8 * DPRBase; /* Base of DPR registers */ + CARD8 * VPRBase; /* Base of VPR registers */ + CARD8 * CPRBase; /* Base of CPR registers */ + CARD8 * DataPortBase; /* Base of data port */ + int DataPortSize; /* Size of data port */ + CARD8 * IOBase; /* Base of MMIO VGA ports */ + unsigned char * FBBase; /* Base of FB */ + CARD32 FBOffset; /* Current visual FB starting + location */ + CARD32 FBCursorOffset; /* Cursor storage location */ + CARD32 FBReserved; /* Reserved memory in frame + buffer */ - Bool PrimaryVidMapped; /* Flag indicating if vgaHWMapMem was * - * used successfully for this screen */ - int dacSpeedBpp; /* Clock value */ - int minClock; /* Mimimum clock */ - int maxClock; /* Maximum clock */ - int MCLK; /* Memory Clock */ - int GEResetCnt; /* Limit the number of errors printed * - * using a counter */ - - Bool pci_burst; /* Enable PCI burst mode for reads? */ - Bool NoPCIRetry; /* Diasable PCI retries */ - Bool fifo_conservative; /* Adjust fifo for acceleration? */ - Bool fifo_moderate; /* Adjust fifo for acceleration? */ - Bool fifo_aggressive; /* Adjust fifo for acceleration? */ - Bool NoAccel; /* Disable Acceleration */ - Bool hwcursor; /* hardware cursor enabled */ - Bool ShowCache; /* Debugging option */ - Bool useBIOS; /* USe BIOS for mode sets */ + Bool PrimaryVidMapped; /* Flag indicating if + vgaHWMapMem was used + successfully for + this screen */ + int dacSpeedBpp; /* Clock value */ + int minClock; /* Mimimum clock */ + int maxClock; /* Maximum clock */ + int MCLK; /* Memory Clock */ + int GEResetCnt; /* Limit the number of errors + printed using a counter */ + + Bool pci_burst; /* Enable PCI burst mode for + reads? */ + Bool NoPCIRetry; /* Disable PCI retries */ + Bool fifo_conservative; /* Adjust fifo for + acceleration? */ + Bool fifo_moderate; /* Adjust fifo for + acceleration? */ + Bool fifo_aggressive; /* Adjust fifo for + acceleration? */ + Bool NoAccel; /* Disable Acceleration */ + Bool hwcursor; /* hardware cursor enabled */ + Bool ShowCache; /* Debugging option */ + Bool useBIOS; /* Use BIOS for mode sets */ + Bool zoomOnLCD; /* Zoom on LCD */ - CloseScreenProcPtr CloseScreen; /* Pointer used to save wrapped * - * CloseScreen function. */ - XAAInfoRecPtr AccelInfoRec; /* XAA info Rec */ - pciVideoPtr PciInfo; /* PCI info vars. */ + CloseScreenProcPtr CloseScreen; /* Pointer used to save wrapped + CloseScreen function */ + XAAInfoRecPtr AccelInfoRec; /* XAA info Rec */ + pciVideoPtr PciInfo; /* PCI info vars */ PCITAG PciTag; - int Chipset; /* Chip info, set using PCI above. */ - int ChipRev; + int Chipset; /* Chip info, set using PCI + above */ + int ChipRev; /* DGA */ - DGAModePtr DGAModes; /* Pointer to DGA modes */ - int numDGAModes; /* Number of DGA modes */ - Bool DGAactive; /* Flag if DGA is active */ - int DGAViewportStatus; /* DGA Viewport status */ + DGAModePtr DGAModes; /* Pointer to DGA modes */ + int numDGAModes; /* Number of DGA modes */ + Bool DGAactive; /* Flag if DGA is active */ + int DGAViewportStatus; /* DPMS */ - int CurrentDPMS; /* Current DPMS state */ - unsigned char DPMS_SR20; /* Saved DPMS SR20 register */ - unsigned char DPMS_SR21; /* Saved DPMS SR21 register */ - unsigned char DPMS_SR31; /* Saved DPMS SR31 register */ - unsigned char DPMS_SR34; /* Saved DPMS SR34 register */ + int CurrentDPMS; /* Current DPMS state */ + unsigned char DPMS_SR20; /* Saved DPMS SR20 register */ + unsigned char DPMS_SR21; /* Saved DPMS SR21 register */ + unsigned char DPMS_SR31; /* Saved DPMS SR31 register */ + unsigned char DPMS_SR34; /* Saved DPMS SR34 register */ /* Panel information */ - Bool lcd; /* LCD active, 1=DSTN, 2=TFT */ - int lcdWidth; /* LCD width */ - int lcdHeight; /* LCD height */ - - I2CBusPtr I2C; /* Pointer to I2C module */ - xf86Int10InfoPtr pInt; /* Pointer to INT10 module */ - vbeInfoPtr pVbe; /* Pointer to VBE module */ + Bool lcd; /* LCD active, 1=DSTN, 2=TFT */ + int lcdWidth; /* LCD width */ + int lcdHeight; /* LCD height */ + + I2CBusPtr I2C; /* Pointer into I2C module */ + xf86Int10InfoPtr pInt; /* Pointer to INT10 module */ + vbeInfoPtr pVbe; /* Pointer to VBE module */ /* Shadow frame buffer (rotation) */ - Bool shadowFB; /* Flag if shadow buffer is used */ - int rotate; /* Rotation flags */ - int ShadowPitch; /* Pitch of shadow buffer */ - int ShadowWidthBytes; /* Width of shadow buffer in bytes */ - int ShadowWidth; /* Width of shadow buffer in pixels */ - int ShadowHeight; /* Height of shadow buffer in pixels */ - CARD32 saveBufferSize; /* #670 - FB save buffer size */ - void * pSaveBuffer; /* #670 - FB save buffer */ - CARD32 savedFBOffset; /* #670 - Saved FBOffset value */ - CARD32 savedFBReserved; /* #670 - Saved FBReserved value */ + Bool shadowFB; /* Flag if shadow buffer is + used */ + int rotate; /* Rotation flags */ + int ShadowPitch; /* Pitch of shadow buffer */ + int ShadowWidthBytes; /* Width of shadow + buffer in bytes */ + int ShadowWidth; /* Width of shadow buffer in + pixels */ + int ShadowHeight; /* Height of shadow buffer in + pixels */ + CARD32 saveBufferSize; /* #670 - FB save buffer size */ + void * pSaveBuffer; /* #670 - FB save buffer */ + CARD32 savedFBOffset; /* #670 - Saved FBOffset value */ + CARD32 savedFBReserved; /* #670 - Saved + FBReserved value */ + CARD8 * paletteBuffer; /* #920 - Palette save buffer */ /* Polylines - #671 */ - ValidateGCProcPtr ValidatePolylines;/* Org. ValidatePolylines function */ - Bool polyLines; /* Our polylines patch is active */ + ValidateGCProcPtr ValidatePolylines; /* Org. + ValidatePolylines + function */ + Bool polyLines; /* Our polylines patch is + active */ void (*PointerMoved)(int index, int x, int y); #ifdef XvExtension - int videoKey; /* Video chroma key */ - Bool ByteSwap; /* Byte swap for ZV port */ + int videoKey; /* Video chroma key */ + Bool ByteSwap; /* Byte swap for ZV port */ /* XvExtension */ - XF86VideoAdaptorPtr ptrAdaptor; /* Pointer to VideoAdapter structure */ + XF86VideoAdaptorPtr ptrAdaptor; /* Pointer to VideoAdapter + structure */ void (*BlockHandler)(int i, pointer blockData, pointer pTimeout, pointer pReadMask); #endif - + OptionInfoPtr Options; + CARD8 DACmask; } SMIRec, *SMIPtr; #define SMIPTR(p) ((SMIPtr)((p)->driverPrivate)) /******************************************************************************/ -/* M A C R O S */ +/* M A C R O S */ /******************************************************************************/ #if SMI_DEBUG @@ -241,51 +277,54 @@ #include "regsmi.h" #if !defined (MetroLink) && !defined (VertDebug) -#define VerticalRetraceWait() \ -do \ -{ \ - if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \ - { \ - while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) ; \ - while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08) ; \ - while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) ; \ - } \ +#define VerticalRetraceWait() \ +do \ +{ \ + if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \ + { \ + while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00); \ + while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08); \ + while ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00); \ + } \ } while (0) #else #define SPIN_LIMIT 1000000 -#define VerticalRetraceWait() -do \ -{ \ - if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \ - { \ - volatile unsigned long _spin_me; \ - for (_spin_me = SPIN_LIMIT; \ - ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me; \ - _spin_me--) ; \ - if (!_spin_me) \ - ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \ - for (_spin_me = SPIN_LIMIT; \ - ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08) && _spin_me; \ - _spin_me--) ; \ - if (!_spin_me) \ - ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \ - for (_spin_me = SPIN_LIMIT; \ - ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && _spin_me; \ - _spin_me--) ; \ - if (!_spin_me) \ - ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \ - } \ +#define VerticalRetraceWait() \ +do \ +{ \ + if (VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x17) & 0x80) \ + { \ + volatile unsigned long _spin_me; \ + for (_spin_me = SPIN_LIMIT; \ + ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && \ + _spin_me; \ + _spin_me--); \ + if (!_spin_me) \ + ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \ + for (_spin_me = SPIN_LIMIT; \ + ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x08) && \ + _spin_me; \ + _spin_me--); \ + if (!_spin_me) \ + ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \ + for (_spin_me = SPIN_LIMIT; \ + ((VGAIN8(pSmi, vgaIOBase + 0x0A) & 0x08) == 0x00) && \ + _spin_me; \ + _spin_me--); \ + if (!_spin_me) \ + ErrorF("smi: warning: VerticalRetraceWait timed out.\n"); \ + } \ } while (0) #endif /******************************************************************************/ -/* F U N C T I O N P R O T O T Y P E S */ +/* F U N C T I O N P R O T O T Y P E S */ /******************************************************************************/ /* smi_dac.c */ void SMI_CommonCalcClock(long freq, int min_m, int min_n1, int max_n1, - int min_n2, int max_n2, long freq_min, long freq_max, - unsigned char * mdiv, unsigned char * ndiv); + int min_n2, int max_n2, long freq_min, long freq_max, + unsigned char * mdiv, unsigned char * ndiv); /* smi_i2c */ Bool SMI_I2CInit(ScrnInfoPtr pScrn); Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c:1.2 Tue Dec 5 16:18:37 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c Thu Feb 15 13:20:33 2001 @@ -1,4 +1,4 @@ -/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_accel.c-arc 1.15 29 Nov 2000 12:12:04 Frido $ */ +/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_accel.c-arc 1.16 03 Jan 2001 13:29:06 Frido $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c,v 1.2 2000/12/05 21:18:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_accel.c,v 1.4 2001/02/15 18:20:33 dawes Exp $ */ #include "smi.h" @@ -404,7 +404,7 @@ if (pScrn->bitsPerPixel == 24) { x1 *= 3; - x2 *= 2; + x2 *= 3; w *= 3; if (pSmi->Chipset == SMI_LYNX) @@ -714,10 +714,11 @@ if (pScrn->bitsPerPixel <= 16) { - unsigned char * pattern = pSmi->FBBase + patx * pSmi->Bpp - + paty * pSmi->Stride; + /* PDR#950 */ + CARD8* pattern = pSmi->FBBase + + (patx + paty * pSmi->Stride) * pSmi->Bpp; - WaitQueue(1); + WaitIdleEmpty(); WRITE_DPR(pSmi, 0x0C, SMI_BITBLT | SMI_COLOR_PATTERN); memcpy(pSmi->DataPortBase, pattern, 8 * pSmi->Bpp * 8); } @@ -777,7 +778,7 @@ WaitQueue(3); WRITE_DPR(pSmi, 0x04, (x << 16) | (y & 0xFFFF)); - WRITE_DPR(pSmi, 0x08, (w << 16) | (y & 0xFFFF)); + WRITE_DPR(pSmi, 0x08, (w << 16) | (h & 0xFFFF)); /* PDR#950 */ WRITE_DPR(pSmi, 0x0C, pSmi->AccelCmd); LEAVE_PROC("SMI_SubsequentColor8x8PatternFillRect"); Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c:1.1 Tue Nov 28 15:59:19 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c Thu Feb 15 13:20:33 2001 @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c,v 1.1 2000/11/28 20:59:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_dga.c,v 1.2 2001/02/15 18:20:33 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -132,7 +132,7 @@ currentMode->bytesPerScanline = ((pScrn->displayWidth * Bpp) + 15) & ~15L; currentMode->imageWidth = pScrn->displayWidth; - currentMode->imageHeight = (pSmi->videoRAMBytes - pSmi->FBReserved) + currentMode->imageHeight = pSmi->FBReserved / currentMode->bytesPerScanline; currentMode->pixmapWidth = currentMode->imageWidth; currentMode->pixmapHeight = currentMode->imageHeight; Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c:1.12.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c:1.6 Wed Dec 13 20:05:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c Fri May 25 14:15:46 2001 @@ -1,4 +1,4 @@ -/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_driver.c-arc 1.40 06 Dec 2000 15:35:00 Frido $ */ +/* Header: //Mercury/Projects/archives/XFree86/4.0/smi_driver.c-arc 1.42 03 Jan 2001 13:52:16 Frido $ */ /* Copyright (C) 1994-1999 The XFree86 Project, Inc. All Rights Reserved. @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from The XFree86 Project or Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.6 2000/12/14 01:05:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_driver.c,v 1.12.2.1 2001/05/25 18:15:46 eich Exp $ */ #include "xf86Resources.h" #include "xf86RAC.h" @@ -37,11 +37,9 @@ #include "smi.h" -#ifdef DPMSExtension - #include "globals.h" - #define DPMS_SERVER - #include "extensions/dpms.h" -#endif +#include "globals.h" +#define DPMS_SERVER +#include "extensions/dpms.h" /* * Internals @@ -53,7 +51,7 @@ * Forward definitions for the functions that make up the driver. */ -static OptionInfoPtr SMI_AvailableOptions(int chipid, int busid); +static const OptionInfoRec * SMI_AvailableOptions(int chipid, int busid); static void SMI_Identify(int flags); static Bool SMI_Probe(DriverPtr drv, int flags); static Bool SMI_PreInit(ScrnInfoPtr pScrn, int flags); @@ -67,6 +65,8 @@ static void SMI_PrintRegs(ScrnInfoPtr); static ModeStatus SMI_ValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); +static void SMI_DisableVideo(ScrnInfoPtr pScrn); +static void SMI_EnableVideo(ScrnInfoPtr pScrn); static Bool SMI_MapMem(ScrnInfoPtr pScrn); static void SMI_UnmapMem(ScrnInfoPtr pScrn); static Bool SMI_ModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode); @@ -74,10 +74,8 @@ static Bool SMI_SaveScreen(ScreenPtr pScreen, int mode); static void SMI_LoadPalette(ScrnInfoPtr pScrn, int numColors, int *indicies, LOCO *colors, VisualPtr pVisual); -#ifdef DPMSExtension static void SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif static Bool SMI_ddc1(int scrnIndex); static unsigned int SMI_ddc1Read(ScrnInfoPtr pScrn); static void SMI_FreeScreen(int ScrnIndex, int flags); @@ -86,10 +84,10 @@ #define SILICONMOTION_NAME "Silicon Motion" #define SILICONMOTION_DRIVER_NAME "siliconmotion" -#define SILICONMOTION_VERSION_NAME "1.2.0" +#define SILICONMOTION_VERSION_NAME "1.2.2" #define SILICONMOTION_VERSION_MAJOR 1 #define SILICONMOTION_VERSION_MINOR 2 -#define SILICONMOTION_PATCHLEVEL 0 +#define SILICONMOTION_PATCHLEVEL 2 #define SILICONMOTION_DRIVER_VERSION ( (SILICONMOTION_VERSION_MAJOR << 24) \ | (SILICONMOTION_VERSION_MINOR << 16) \ | (SILICONMOTION_PATCHLEVEL) \ @@ -157,11 +155,12 @@ OPTION_BYTESWAP, #endif OPTION_USEBIOS, + OPTION_ZOOMONLCD, NUMBER_OF_OPTIONS } SMIOpts; -static OptionInfoRec SMIOptions[] = +static const OptionInfoRec SMIOptions[] = { { OPTION_PCI_BURST, "pci_burst", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_FIFO_CONSERV, "fifo_conservative", OPTV_BOOLEAN, {0}, FALSE }, @@ -180,6 +179,7 @@ { OPTION_BYTESWAP, "ByteSwap", OPTV_BOOLEAN, {0}, FALSE }, #endif { OPTION_USEBIOS, "UseBIOS", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_ZOOMONLCD, "ZoomOnLCD", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -190,7 +190,7 @@ * Note that vgahwSymbols and xaaSymbols are referenced outside the * XFree86LOADER define in later code, so are defined outside of that * define here also. - * cfbSymbols and ramdacSymbols are only referenced from within the + * fbSymbols and ramdacSymbols are only referenced from within the * ...LOADER define. */ @@ -268,11 +268,13 @@ "vbeFree", NULL }; - -#ifdef XFree86LOADER -static const char *cfbSymbols[] = +static const char *fbSymbols[] = { +#ifdef USE_FB + "fbScreenInit", + "fbPictureInit", +#else "cfbScreenInit", "cfb16ScreenInit", "cfb24ScreenInit", @@ -280,9 +282,12 @@ "cfb32ScreenInit", "cfb16BresS", "cfb24BresS", +#endif NULL }; +#ifdef XFree86LOADER + static MODULESETUPPROTO(siliconmotionSetup); static XF86ModuleVersionInfo SMIVersRec = @@ -332,7 +337,7 @@ * Tell the loader about symbols from other modules that this module * might refer to. */ - LoaderRefSymLists(vgahwSymbols, cfbSymbols, xaaSymbols, ramdacSymbols, + LoaderRefSymLists(vgahwSymbols, fbSymbols, xaaSymbols, ramdacSymbols, ddcSymbols, i2cSymbols, int10Symbols, vbeSymbols, shadowSymbols, NULL); @@ -387,7 +392,7 @@ LEAVE_PROC("SMI_FreeRec"); } -static OptionInfoPtr +static const OptionInfoRec * SMI_AvailableOptions(int chipid, int busid) { ENTER_PROC("SMI_AvailableOptions"); @@ -491,8 +496,10 @@ int i; double real; ClockRangePtr clockRanges; +#ifndef USE_FB char *mod = NULL; const char *reqSym = NULL; +#endif char *s; unsigned char config, m, n, shift; int mclk; @@ -620,9 +627,12 @@ } /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, SMIOptions); + if (!(pSmi->Options = xalloc(sizeof(SMIOptions)))) + return FALSE; + memcpy(pSmi->Options, SMIOptions, sizeof(SMIOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pSmi->Options); - if (xf86ReturnOptValBool(SMIOptions, OPTION_PCI_BURST, FALSE)) + if (xf86ReturnOptValBool(pSmi->Options, OPTION_PCI_BURST, FALSE)) { pSmi->pci_burst = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: pci_burst - PCI burst " @@ -634,9 +644,9 @@ } pSmi->NoPCIRetry = TRUE; - if (xf86ReturnOptValBool(SMIOptions, OPTION_PCI_RETRY, FALSE)) + if (xf86ReturnOptValBool(pSmi->Options, OPTION_PCI_RETRY, FALSE)) { - if (xf86ReturnOptValBool(SMIOptions, OPTION_PCI_BURST, FALSE)) + if (xf86ReturnOptValBool(pSmi->Options, OPTION_PCI_BURST, FALSE)) { pSmi->NoPCIRetry = FALSE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: pci_retry\n"); @@ -648,7 +658,7 @@ } } - if (xf86IsOptionSet(SMIOptions, OPTION_FIFO_CONSERV)) + if (xf86IsOptionSet(pSmi->Options, OPTION_FIFO_CONSERV)) { pSmi->fifo_conservative = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_conservative " @@ -659,7 +669,7 @@ pSmi->fifo_conservative = FALSE; } - if (xf86IsOptionSet(SMIOptions, OPTION_FIFO_MODERATE)) + if (xf86IsOptionSet(pSmi->Options, OPTION_FIFO_MODERATE)) { pSmi->fifo_moderate = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_moderate set\n"); @@ -669,7 +679,7 @@ pSmi->fifo_moderate = FALSE; } - if (xf86IsOptionSet(SMIOptions, OPTION_FIFO_AGGRESSIVE)) + if (xf86IsOptionSet(pSmi->Options, OPTION_FIFO_AGGRESSIVE)) { pSmi->fifo_aggressive = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: fifo_aggressive set\n"); @@ -679,7 +689,7 @@ pSmi->fifo_aggressive = FALSE; } - if (xf86ReturnOptValBool(SMIOptions, OPTION_NOACCEL, FALSE)) + if (xf86ReturnOptValBool(pSmi->Options, OPTION_NOACCEL, FALSE)) { pSmi->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: NoAccel - Acceleration " @@ -690,7 +700,7 @@ pSmi->NoAccel = FALSE; } - if (xf86ReturnOptValBool(SMIOptions, OPTION_SHOWCACHE, FALSE)) + if (xf86ReturnOptValBool(pSmi->Options, OPTION_SHOWCACHE, FALSE)) { pSmi->ShowCache = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: show_cache set\n"); @@ -700,7 +710,7 @@ pSmi->ShowCache = FALSE; } - if (xf86GetOptValFreq(SMIOptions, OPTION_MCLK, OPTUNITS_MHZ, &real)) + if (xf86GetOptValFreq(pSmi->Options, OPTION_MCLK, OPTUNITS_MHZ, &real)) { pSmi->MCLK = (int)(real * 1000.0); if (pSmi->MCLK <= 120000) @@ -723,11 +733,11 @@ from = X_DEFAULT; pSmi->hwcursor = TRUE; - if (xf86GetOptValBool(SMIOptions, OPTION_HWCURSOR, &pSmi->hwcursor)) + if (xf86GetOptValBool(pSmi->Options, OPTION_HWCURSOR, &pSmi->hwcursor)) { from = X_CONFIG; } - if (xf86ReturnOptValBool(SMIOptions, OPTION_SWCURSOR, FALSE)) + if (xf86ReturnOptValBool(pSmi->Options, OPTION_SWCURSOR, FALSE)) { pSmi->hwcursor = FALSE; from = X_CONFIG; @@ -735,13 +745,16 @@ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s Cursor\n", pSmi->hwcursor ? "Hardware" : "Software"); - if (xf86GetOptValBool(SMIOptions, OPTION_SHADOW_FB, &pSmi->shadowFB)) + if (xf86GetOptValBool(pSmi->Options, OPTION_SHADOW_FB, &pSmi->shadowFB)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShadowFB %s.\n", pSmi->shadowFB ? "enabled" : "disabled"); } - if ((s = xf86GetOptValString(SMIOptions, OPTION_ROTATE))) + #if 1 /* PDR#932 */ + if ((pScrn->depth == 8) || (pScrn->depth == 16)) + #endif /* PDR#932 */ + if ((s = xf86GetOptValString(pSmi->Options, OPTION_ROTATE))) { if(!xf86NameCmp(s, "CW")) { @@ -767,7 +780,7 @@ } #ifdef XvExtension - if (xf86GetOptValInteger(SMIOptions, OPTION_VIDEOKEY, &pSmi->videoKey)) + if (xf86GetOptValInteger(pSmi->Options, OPTION_VIDEOKEY, &pSmi->videoKey)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: Video key set to " "0x%08X\n", pSmi->videoKey); @@ -779,7 +792,7 @@ << pScrn->offset.blue); } - if (xf86ReturnOptValBool(SMIOptions, OPTION_BYTESWAP, FALSE)) + if (xf86ReturnOptValBool(pSmi->Options, OPTION_BYTESWAP, FALSE)) { pSmi->ByteSwap = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: ByteSwap enabled.\n"); @@ -790,7 +803,7 @@ } #endif - if (xf86GetOptValBool(SMIOptions, OPTION_USEBIOS, &pSmi->useBIOS)) + if (xf86GetOptValBool(pSmi->Options, OPTION_USEBIOS, &pSmi->useBIOS)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: UseBIOS %s.\n", pSmi->useBIOS ? "enabled" : "disabled"); @@ -801,6 +814,17 @@ pSmi->useBIOS = TRUE; } + if (xf86GetOptValBool(pSmi->Options, OPTION_ZOOMONLCD, &pSmi->zoomOnLCD)) + { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Option: ZoomOnLCD %s.\n", + pSmi->zoomOnLCD ? "enabled" : "disabled"); + } + else + { + /* Default to ZoomOnLCD enabled. */ + pSmi->zoomOnLCD = TRUE; + } + /* Find the PCI slot for this screen */ pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if ((pEnt->location.type != BUS_PCI) || (pEnt->resources)) @@ -890,6 +914,8 @@ pSmi->PciInfo->func); SMI_MapMem(pScrn); + SMI_DisableVideo(pScrn); + hwp = VGAHWPTR(pScrn); vgaIOBase = hwp->IOBase; vgaCRIndex = vgaIOBase + VGA_CRTC_INDEX_OFFSET; @@ -956,6 +982,7 @@ if (pSmi->pVbe) { vbeFree(pSmi->pVbe); + pSmi->pVbe = NULL; } /* @@ -969,6 +996,8 @@ if (!xf86SetGamma(pScrn, zeros)) { LEAVE_PROC("SMI_PreInit"); + SMI_EnableVideo(pScrn); + SMI_UnmapMem(pScrn); return(FALSE); } } @@ -1072,6 +1101,7 @@ xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Detected current MCLK value of " "%1.3f MHz\n", mclk / 1000.0); + SMI_EnableVideo(pScrn); SMI_UnmapMem(pScrn); pScrn->virtualX = pScrn->display->virtualX; @@ -1135,6 +1165,16 @@ /* Set display resolution */ xf86SetDpi(pScrn, 0, 0); +#ifdef USE_FB + if ((xf86LoadSubModule(pScrn, "fb") == NULL)) + { + SMI_FreeRec(pScrn); + LEAVE_PROC("SMI_PreInit"); + return(FALSE); + } + + xf86LoaderReqSymLists(fbSymbols, NULL); +#else /* Load bpp-specific modules */ switch (pScrn->bitsPerPixel) { @@ -1162,7 +1202,7 @@ } xf86LoaderReqSymbols(reqSym, NULL); - +#endif /* Load XAA if needed */ if (!pSmi->NoAccel || pSmi->hwcursor) { @@ -1234,6 +1274,20 @@ { BoxRec box; + /* #920 */ + if (pSmi->paletteBuffer) + { + int i; + + VGAOUT8(pSmi, VGA_DAC_WRITE_ADDR, 0); + for(i = 0; i < 256 * 3; i++) + { + VGAOUT8(pSmi, VGA_DAC_DATA, pSmi->paletteBuffer[i]); + } + xfree(pSmi->paletteBuffer); + pSmi->paletteBuffer = NULL; + } + if (pSmi->pSaveBuffer) { memcpy(pSmi->FBBase, pSmi->pSaveBuffer, pSmi->saveBufferSize); @@ -1280,6 +1334,22 @@ pSmi->savedFBOffset = pSmi->FBOffset; pSmi->savedFBReserved = pSmi->FBReserved; + + /* #920 */ + if (pSmi->Bpp == 1) + { + pSmi->paletteBuffer = xnfalloc(256 * 3); + if (pSmi->paletteBuffer) + { + int i; + + VGAOUT8(pSmi, VGA_DAC_READ_ADDR, 0); + for (i = 0; i < 256 * 3; i++) + { + pSmi->paletteBuffer[i] = VGAIN8(pSmi, VGA_DAC_DATA); + } + } + } } memset(pSmi->FBBase, 0, 256 * 1024); /* #689 */ @@ -1371,6 +1441,9 @@ { save->CRA0[i] = VGAIN8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0xA0 + i); } + + /* PDR#1069 */ + VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E, save->CR90[14]); } else { @@ -1533,7 +1606,7 @@ VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x9E, restore->CR90[14] & ~0x20); - VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33, restore->CR33_2); + VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x33, restore->CR33); VGAOUT8_INDEX(pSmi, vgaCRIndex, vgaCRData, 0x3A, restore->CR3A); for (i = 0; i < 14; i++) { @@ -1580,6 +1653,8 @@ } } + VGAOUT8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x81, 0x00); + WRITE_DPR(pSmi, 0x10, restore->DPR10); WRITE_DPR(pSmi, 0x1C, restore->DPR1C); WRITE_DPR(pSmi, 0x20, restore->DPR20); @@ -1739,16 +1814,16 @@ * the frame buffer. Also set up the reserved memory space. */ pSmi->FBCursorOffset = pSmi->videoRAMBytes - 1024; - if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_INDEX, 0x30) & 0x01) + if (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x30) & 0x01)/* #1074 */ { - CARD32 fifiOffset = 0; - fifiOffset |= VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x46) + CARD32 fifoOffset = 0; + fifoOffset |= VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x46) << 3; - fifiOffset |= VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x47) + fifoOffset |= VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x47) << 11; - fifiOffset |= (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x49) + fifoOffset |= (VGAIN8_INDEX(pSmi, VGA_SEQ_INDEX, VGA_SEQ_DATA, 0x49) & 0x1C) << 17; - pSmi->FBReserved = pSmi->videoRAMBytes - fifiOffset; + pSmi->FBReserved = fifoOffset; /* PDR#1074 */ } else { @@ -1792,7 +1867,7 @@ pSmi->lcdHeight = 1024; break; } - xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, VERBLEV, "%s Panel Size = %dx%d\n", + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "%s Panel Size = %dx%d\n", (pSmi->lcd == 0) ? "OFF" : (pSmi->lcd == 1) ? "TFT" : "DSTN", pSmi->lcdWidth, pSmi->lcdHeight); @@ -1904,7 +1979,7 @@ * support TrueColor and not DirectColor. To deal with this, call * miSetVisualTypes with the appropriate visual mask. */ - +#ifndef USE_FB if (pScrn->bitsPerPixel > 8) { if (!miSetVisualTypes(pScrn->depth, TrueColorMask, pScrn->rgbBits, @@ -1915,6 +1990,7 @@ } } else +#endif { if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), pScrn->rgbBits, @@ -1924,6 +2000,9 @@ return(FALSE); } } +#ifdef USE_FB + if (!miSetPixmapDepths ()) return FALSE; +#endif if (!SMI_InternalScreenInit(scrnIndex, pScreen)) { @@ -2018,12 +2097,10 @@ pSmi->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = SMI_CloseScreen; -#ifdef DPMSExtension if (!xf86DPMSInit(pScreen, SMI_DisplayPowerManagementSet, 0)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "DPMS initialization failed!\n"); } -#endif SMI_InitVideo(pScreen); @@ -2107,28 +2184,40 @@ pSmi->FBBase, width, height, displayWidth)); switch (pScrn->bitsPerPixel) { - case 8: - ret = cfbScreenInit(pScreen, pSmi->FBBase, width, height, xDpi, - yDpi, displayWidth); - break; - - case 16: - ret = cfb16ScreenInit(pScreen, pSmi->FBBase, width, height, xDpi, - yDpi, displayWidth); - break; +#ifdef USE_FB + case 8: + case 16: + case 24: + ret = fbScreenInit(pScreen, pSmi->FBBase, width, height, xDpi, + yDpi, displayWidth,pScrn->bitsPerPixel); + break; +#else + case 8: + ret = cfbScreenInit(pScreen, pSmi->FBBase, width, height, xDpi, + yDpi, displayWidth); + break; - case 24: - ret = cfb24ScreenInit(pScreen, pSmi->FBBase, width, height, xDpi, + case 16: + ret = cfb16ScreenInit(pScreen, pSmi->FBBase, width, height, xDpi, yDpi, displayWidth); - break; + break; - default: - xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) " - "in SMI_InternalScreenInit\n", pScrn->bitsPerPixel); - LEAVE_PROC("SMI_InternalScreenInit"); - return(FALSE); + case 24: + ret = cfb24ScreenInit(pScreen, pSmi->FBBase, width, height, xDpi, + yDpi, displayWidth); + break; +#endif + default: + xf86DrvMsg(scrnIndex, X_ERROR, "Internal error: invalid bpp (%d) " + "in SMI_InternalScreenInit\n", pScrn->bitsPerPixel); + LEAVE_PROC("SMI_InternalScreenInit"); + return(FALSE); } - + +#ifdef USE_FB + if (ret) + fbPictureInit(pScreen, 0, 0); +#endif LEAVE_PROC("SMI_InternalScreenInit"); return(ret); } @@ -2139,11 +2228,13 @@ { ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; SMIPtr pSmi = SMIPTR(pScrn); + float refresh; ENTER_PROC("SMI_ValidMode"); - + refresh = (mode->VRefresh > 0) ? mode->VRefresh + : mode->Clock * 1000.0 / mode->VTotal / mode->HTotal; xf86DrvMsg(scrnIndex, X_INFO, "Mode: %dx%d %d-bpp, %fHz\n", mode->HDisplay, - mode->VDisplay, pScrn->bitsPerPixel, mode->VRefresh); + mode->VDisplay, pScrn->bitsPerPixel, refresh); if (pSmi->shadowFB) { @@ -2158,7 +2249,7 @@ mem = (pScrn->virtualX * pScrn->bitsPerPixel / 8 + 15) & ~15; mem *= pScrn->virtualY * 2; - if (mem > pSmi->videoRAMBytes - pSmi->FBReserved) + if (mem > pSmi->FBReserved) /* PDR#1074 */ { LEAVE_PROC("SMI_ValidMode"); return(MODE_MEM); @@ -2167,15 +2258,8 @@ if (!pSmi->useBIOS || pSmi->lcd) { - if ( (mode->HDisplay != pSmi->lcdWidth) - || (mode->VDisplay != pSmi->lcdHeight) - ) - { - LEAVE_PROC("SMI_ValidMode"); - return(MODE_PANEL); - } - - if (pSmi->rotate) + #if 1 /* PDR#983 */ + if (pSmi->zoomOnLCD) { if ( (mode->HDisplay > pSmi->lcdWidth) || (mode->VDisplay > pSmi->lcdHeight) @@ -2185,7 +2269,32 @@ return(MODE_PANEL); } } + else + #endif + { + if ( (mode->HDisplay != pSmi->lcdWidth) + || (mode->VDisplay != pSmi->lcdHeight) + ) + { + LEAVE_PROC("SMI_ValidMode"); + return(MODE_PANEL); + } + } + + } + + #if 1 /* PDR#944 */ + if (pSmi->rotate) + { + if ( (mode->HDisplay != pSmi->lcdWidth) + || (mode->VDisplay != pSmi->lcdHeight) + ) + { + LEAVE_PROC("SMI_ValidMode"); + return(MODE_PANEL); + } } + #endif LEAVE_PROC("SMI_ValidMode"); return(MODE_OK); @@ -2589,6 +2698,11 @@ { xfree(pSmi->pSaveBuffer); } + /* #920 */ + if (pSmi->paletteBuffer) + { + xfree(pSmi->paletteBuffer); + } pScrn->vtSema = FALSE; pScreen->CloseScreen = pSmi->CloseScreen; @@ -2635,10 +2749,22 @@ if (SMI_LYNX3D_SERIES(pSmi->Chipset)) { Base = (Base + 15) & ~15; + #if 1 /* PDR#1058 */ + while ((Base % pSmi->Bpp) > 0) + { + Base -= 16; + } + #endif } else { Base = (Base + 7) & ~7; + #if 1 /* PDR#1058 */ + while ((Base % pSmi->Bpp) > 0) + { + Base -= 8; + } + #endif } WRITE_VPR(pSmi, 0x0C, Base >> 3); @@ -2679,6 +2805,27 @@ LEAVE_PROC("SMI_LoadPalette"); } +static void +SMI_DisableVideo(ScrnInfoPtr pScrn) +{ + SMIPtr pSmi = SMIPTR(pScrn); + CARD8 tmp; + + if (!(tmp = VGAIN8(pSmi, VGA_DAC_MASK))) + return; + pSmi->DACmask = tmp; + VGAOUT8(pSmi, VGA_DAC_MASK, 0); +} + +static void +SMI_EnableVideo(ScrnInfoPtr pScrn) +{ + SMIPtr pSmi = SMIPTR(pScrn); + + VGAOUT8(pSmi, VGA_DAC_MASK, pSmi->DACmask); +} + + void SMI_EnableMmio(ScrnInfoPtr pScrn) { @@ -2694,9 +2841,6 @@ */ vgaHWSetStdFuncs(hwp); - /* Disable video output */ - outb(VGA_DAC_MASK, 0x00); - /* Enable linear mode */ outb(VGA_SEQ_INDEX, 0x18); tmp = inb(VGA_SEQ_DATA); @@ -2825,7 +2969,6 @@ * SMI_DisplayPowerManagementSet -- Sets VESA Display Power Management * Signaling (DPMS) Mode. */ -#ifdef DPMSExtension static void SMI_DisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -2980,7 +3123,6 @@ LEAVE_PROC("SMI_DisplayPowerManagementSet"); } -#endif static void SMI_ProbeDDC(ScrnInfoPtr pScrn, int index) Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c:1.1 Tue Nov 28 15:59:20 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c Sat Mar 3 17:26:13 2001 @@ -26,9 +26,9 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and Silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c,v 1.1 2000/11/28 20:59:20 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_hwcurs.c,v 1.2 2001/03/03 22:26:13 tsi Exp $ */ -#include <cursorstr.h> +#include "cursorstr.h" #include "smi.h" #define MAX_CURSOR 32 Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c:1.2 Tue Dec 5 16:18:37 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c Sat Mar 3 17:26:13 2001 @@ -26,7 +26,7 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.2 2000/12/05 21:18:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.c,v 1.4 2001/03/03 22:26:13 tsi Exp $ */ #include "smi.h" #include "smi_video.h" @@ -36,9 +36,9 @@ #if defined(XvExtension) && SMI_USE_VIDEO -#include <dixstruct.h> -#include <xaa.h> -#include <xaalocal.h> +#include "dixstruct.h" +#include "xaa.h" +#include "xaalocal.h" static XF86VideoAdaptorPtr SMI_SetupVideo(ScreenPtr pScreen); static void SMI_ResetVideo(ScrnInfoPtr pScrn); @@ -122,7 +122,6 @@ if ( (psmi->rotate == 0) && !psmi->NoAccel - && (pScrn->bitsPerPixel != 8) ) { newAdaptor = SMI_SetupVideo(pScreen); @@ -189,7 +188,6 @@ static XF86VideoFormatRec SMI_VideoFormats[] = { - { 8, PseudoColor }, /* depth, class */ { 15, TrueColor }, /* depth, class */ { 16, TrueColor }, /* depth, class */ { 24, TrueColor }, /* depth, class */ @@ -213,6 +211,7 @@ { XVIMAGE_YUY2, XVIMAGE_YV12, + XVIMAGE_I420, { FOURCC_RV15, /* id */ XvRGB, /* type */ @@ -912,6 +911,14 @@ dstPitch = ((width << 1) + 15) & ~15; break; + case FOURCC_I420: + srcPitch = (width + 3) & ~3; + offset3 = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + offset2 = offset3 + (srcPitch2 * (height >> 1)); + dstPitch = ((width << 1) + 15) & ~15; + break; + case FOURCC_RV24: bpp = 3; srcPitch = width * bpp; @@ -953,6 +960,7 @@ switch (id) { case FOURCC_YV12: + case FOURCC_I420: top &= ~1; tmp = ((top >> 1) * srcPitch2) + (left >> 2); offset2 += tmp; @@ -1020,6 +1028,7 @@ switch (id) { case FOURCC_YV12: + case FOURCC_I420: *height = (*height + 1) & ~1; size = (*width + 3) & ~3; if (pitches != NULL) @@ -1164,6 +1173,10 @@ ENTER_PROC("SMI_ClipVideo"); + /* PDR#941 */ + extents->x1 = max(extents->x1, pScrn->frameX0); + extents->y1 = max(extents->y1, pScrn->frameY0); + hscale = ((*x2 - *x1) << 16) / (dst->x2 - dst->x1); vscale = ((*y2 - *y1) << 16) / (dst->y2 - dst->y1); @@ -1278,6 +1291,7 @@ switch (id) { case FOURCC_YV12: + case FOURCC_I420: case FOURCC_YUY2: vpr00 |= 0x6; break; @@ -1614,6 +1628,7 @@ switch (id) { case FOURCC_YV12: + case FOURCC_I420: case FOURCC_YUY2: case FOURCC_RV15: case FOURCC_RV16: Index: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h diff -u xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h:1.1 Tue Nov 28 15:59:20 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h Sat Mar 3 17:26:13 2001 @@ -26,12 +26,12 @@ sale, use or other dealings in this Software without prior written authorization from the XFree86 Project and silicon Motion. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h,v 1.1 2000/11/28 20:59:20 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/siliconmotion/smi_video.h,v 1.2 2001/03/03 22:26:13 tsi Exp $ */ #ifndef _SMI_VIDEO_H #define _SMI_VIDEO_H -#include <fourcc.h> +#include "fourcc.h" #define SMI_VIDEO_VIDEO 0 #define SMI_VIDEO_IMAGE 1 Index: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile:1.22 xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile:1.26 --- xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile:1.22 Fri Dec 1 20:16:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile Wed May 16 09:43:17 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.22 2000/12/02 01:16:16 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/Imakefile,v 1.26 2001/05/16 13:43:17 alanh Exp $ XCOMM XCOMM This is an Imakefile for the SIS driver. XCOMM @@ -15,27 +15,30 @@ #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 \ - -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ - -I$(XF86SRC)/rac \ + -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c -I$(XF86OSSRC)/vbe \ + -I$(XF86SRC)/rac -I$(XF86SRC)/int10 \ -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) @@ -51,32 +54,36 @@ InstallObjectModule(sis,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(sis,) InstallModuleManPage(sis) #endif 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) Index: xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c:1.6 Sat Dec 2 10:30:50 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c Mon Jun 4 12:41:04 2001 @@ -1,1119 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init300.c,v 1.6 2000/12/02 15:30:50 tsi Exp $ */ - -#include "xf86.h" -#include "xf86PciInfo.h" - -#include "sis.h" -#include "sis_regs.h" -#include "init300.h" - -VOID SetReg1(USHORT, USHORT, USHORT); -VOID SetReg3(USHORT, USHORT); -VOID SetReg4(USHORT, ULONG); -USHORT GetReg1(USHORT, USHORT); -USHORT GetReg2(USHORT); -ULONG GetReg3(USHORT); -Bool SiSSetMode(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - SISPtr pSiS = SISPTR(pScrn); - ULONG temp; - USHORT cr30flag,cr31flag; - ULONG ROMAddr = (ULONG) SISPTR(pScrn)->BIOS; - USHORT BaseAddr = (USHORT) (SISPTR(pScrn)->RelIO +0x30); - USHORT ModeNo=0; - USHORT Rate; - USHORT tempal,i,Part1Port; - - 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; -} - -BOOLEAN SearchModeID(ULONG ROMAddr, USHORT ModeNo) -{ - UCHAR ModeID; - USHORT usIDLength; - - ModeIDOffset=*((USHORT *)(ROMAddr+0x20A)); /* Get EModeIDTable */ - ModeID=*((UCHAR *)(ROMAddr+ModeIDOffset)); /* Offset 0x20A */ - usIDLength = GetModeIDLength(ROMAddr, ModeNo); - while(ModeID!=0xff && ModeID!=ModeNo) { -/* ModeIDOffset=ModeIDOffset+10; */ /*StructSize */ - ModeIDOffset=ModeIDOffset+usIDLength; - ModeID=*((UCHAR *)(ROMAddr+ModeIDOffset)); - } - if(ModeID==0xff) return(FALSE); - else return(TRUE); -} - -BOOLEAN CheckMemorySize(ULONG ROMAddr) -{ - USHORT memorysize; - USHORT modeflag; - USHORT temp; - - modeflag=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - ModeType=modeflag&ModeInfoFlag; /* Get mode type */ - - memorysize=modeflag&MemoryInfoFlag; - memorysize=memorysize>MemorySizeShift; - memorysize++; /* Get memory size */ - - temp=GetReg1(P3c4,0x14); /* Get DRAM Size */ - temp=temp&0x3F; - temp++; - - if(temp<memorysize) return(FALSE); - else return(TRUE); -} - -VOID GetModePtr(ULONG ROMAddr, USHORT ModeNo) -{ - UCHAR index; - - StandTable=*((USHORT *)(ROMAddr+0x202)); /* Get First 0x202 */ - /* StandTable Offset */ - if(ModeNo<=13) { - index=*((UCHAR *)(ROMAddr+ModeIDOffset+0x03)); /* si+St_ModeFlag */ - } - else { - if(ModeType <= 0x02) index=0x1B; /* 02 -> ModeEGA */ - else index=0x0F; - } - StandTable=StandTable+64*index; -} - -VOID SetSeqRegs(ULONG ROMAddr) -{ - UCHAR SRdata; - USHORT i; - - SetReg1(P3c4,0x00,0x03); /* Set SR0 */ - StandTable=StandTable+0x05; - SRdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get SR01 from file */ - 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 */ - } -} - -VOID SetMiscRegs(ULONG ROMAddr) -{ - UCHAR Miscdata; - - StandTable++; - Miscdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get Misc from file */ - SetReg3(P3c2,Miscdata); /* Set Misc(3c2) */ -} - -VOID SetCRTCRegs(ULONG ROMAddr) -{ - UCHAR CRTCdata; - USHORT i; - - CRTCdata=(UCHAR)GetReg1(P3d4,0x11); - CRTCdata=CRTCdata&0x7f; - SetReg1(P3d4,0x11,CRTCdata); /* Unlock CRTC */ - - for(i=0;i<=0x18;i++) { - StandTable++; - CRTCdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get CRTC from file */ - SetReg1(P3d4,i,CRTCdata); /* Set CRTC(3d4) */ - } -} - -VOID SetATTRegs(ULONG ROMAddr) -{ - UCHAR ARdata; - USHORT i; - - for(i=0;i<=0x13;i++) { - StandTable++; - ARdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get AR for file */ - 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); -} - -VOID SetGRCRegs(ULONG ROMAddr) -{ - UCHAR GRdata; - USHORT i; - - for(i=0;i<=0x08;i++) { - StandTable++; - GRdata=*((UCHAR *)(ROMAddr+StandTable)); /* Get GR from file */ - SetReg1(P3ce,i,GRdata); /* Set GR(3ce) */ - } - if(ModeType>ModeVGA){ - GRdata=(UCHAR)GetReg1(P3ce,0x05); - GRdata=GRdata&0xBF; - SetReg1(P3ce,0x05,GRdata); - } -} - -VOID ClearExt1Regs() -{ - USHORT i; - - for(i=0x0A;i<=0x0E;i++) SetReg1(P3c4,i,0x00); /* Clear SR0A-SR0E */ -} - - -BOOLEAN GetRatePtr(ULONG ROMAddr, USHORT ModeNo) -{ - SHORT index; - USHORT temp; - USHORT ulRefIndexLength; - - if(ModeNo<0x14) return(FALSE); /* Mode No <= 13h then return */ - - index=GetReg1(P3d4,0x33); /* Get 3d4 CRTC33 */ - index=index&0x0F; /* Frame rate index */ - if(index!=0) index--; - REFIndex=*((USHORT *)(ROMAddr+ModeIDOffset+0x04)); /* si+Ext_point */ - - ulRefIndexLength = GetRefindexLength(ROMAddr, ModeNo); - do { - temp=*((USHORT *)(ROMAddr+REFIndex)); /* di => REFIndex */ - if(temp==0xFFFF) break; - temp=temp&ModeInfoFlag; - if(temp<ModeType) break; - - REFIndex=REFIndex+ulRefIndexLength; /* rate size */ - index--; - } while(index>=0); - - REFIndex=REFIndex-ulRefIndexLength; /* rate size */ - return(TRUE); -} - -VOID SetSync(ULONG ROMAddr) -{ - USHORT sync; - USHORT temp; - - sync=*((USHORT *)(ROMAddr+REFIndex)); /* di+0x00 */ - sync=sync&0xC0; - temp=0x2F; - temp=temp|sync; - SetReg3(P3c2,temp); /* Set Misc(3c2) */ -} - -VOID SetCRT1CRTC(ULONG ROMAddr) -{ - UCHAR index; - UCHAR data; - USHORT i; - - index=*((UCHAR *)(ROMAddr+REFIndex+0x02)) & 0x3F; /* Get index */ - CRT1Table=*((USHORT *)(ROMAddr+0x204)); /* Get CRT1Table */ - CRT1Table=CRT1Table+index*CRT1Len; - - data=(UCHAR)GetReg1(P3d4,0x11); - data=data&0x7F; - SetReg1(P3d4,0x11,data); /* Unlock CRTC */ - - CRT1Table--; - for(i=0;i<=0x05;i++) { - CRT1Table++; - data=*((UCHAR *)(ROMAddr+CRT1Table)); - SetReg1(P3d4,i,data); - } - for(i=0x06;i<=0x07;i++) { - CRT1Table++; - data=*((UCHAR *)(ROMAddr+CRT1Table)); - SetReg1(P3d4,i,data); - } - for(i=0x10;i<=0x12;i++) { - CRT1Table++; - data=*((UCHAR *)(ROMAddr+CRT1Table)); - SetReg1(P3d4,i,data); - } - for(i=0x15;i<=0x16;i++) { - CRT1Table++; - data=*((UCHAR *)(ROMAddr+CRT1Table)); - SetReg1(P3d4,i,data); - } - for(i=0x0A;i<=0x0C;i++) { - CRT1Table++; - data=*((UCHAR *)(ROMAddr+CRT1Table)); - SetReg1(P3c4,i,data); - } - - CRT1Table++; - data=*((UCHAR *)(ROMAddr+CRT1Table)); - data=data&0xE0; - SetReg1(P3c4,0x0E,data); - - data=(UCHAR)GetReg1(P3d4,0x09); - data=data&0xDF; - i=*((UCHAR *)(ROMAddr+CRT1Table)); - i=i&0x01; - i=i<<5; - data=data|i; - i=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); - i=i&DoubleScanMode; - if(i) data=data|0x80; - SetReg1(P3d4,0x09,data); - - if(ModeType>0x03) SetReg1(P3d4,0x14,0x4F); -} - -VOID SetCRT1Offset(ULONG ROMAddr) -{ - USHORT temp,ah,al; - USHORT temp2,i; - USHORT DisplayUnit; - - temp=*((UCHAR *)(ROMAddr+ModeIDOffset+0x03)); /* si+Ext_ModeInfo */ - temp=temp>>4; /* index */ - ScreenOffset=*((USHORT *)(ROMAddr+0x206)); /* ScreenOffset */ - temp=*((UCHAR *)(ROMAddr+ScreenOffset+temp)); /* data */ - - temp2=*((USHORT *)(ROMAddr+REFIndex+0x00)); - temp2=temp2&InterlaceMode; - if(temp2) temp=temp<<1; - temp2=ModeType-ModeEGA; - switch (temp2) { - case 0 : temp2=1; break; - case 1 : temp2=2; break; - case 2 : temp2=4; break; - case 3 : temp2=4; break; - case 4 : temp2=6; break; - case 5 : temp2=8; break; - } - temp=temp*temp2; - DisplayUnit=temp; - - temp2=temp; - temp=temp>>8; /* ah */ - temp=temp&0x0F; - i=GetReg1(P3c4,0x0E); - i=i&0xF0; - i=i|temp; - SetReg1(P3c4,0x0E,i); - - temp=(UCHAR)temp2; - temp=temp&0xFF; /* al */ - SetReg1(P3d4,0x13,temp); - - temp2=*((USHORT *)(ROMAddr+REFIndex+0x00)); - temp2=temp2&InterlaceMode; - if(temp2) DisplayUnit>>=1; - - DisplayUnit=DisplayUnit<<5; - ah=(DisplayUnit&0xff00)>>8; - al=DisplayUnit&0x00ff; - if(al==0) ah=ah+1; - else ah=ah+2; - SetReg1(P3c4,0x10,ah); -} - -VOID SetCRT1VCLK(ULONG ROMAddr) -{ - USHORT i; - UCHAR index,data; - - index=*((UCHAR *)(ROMAddr+REFIndex+0x03)) & 0x3F; - CRT1VCLKLen=GetVCLKLen(ROMAddr); - data=index*CRT1VCLKLen; - VCLKData=*((USHORT *)(ROMAddr+0x208)); - VCLKData=VCLKData+data; - - SetReg1(P3c4,0x31,0); - for(i=0x2B;i<=0x2C;i++) { - data=*((UCHAR *)(ROMAddr+VCLKData)); - SetReg1(P3c4,i,data); - VCLKData++; - } - SetReg1(P3c4,0x2D,0x80); -} - - -VOID SetCRT1ModeRegs(ULONG ROMAddr, USHORT ModeNo) -{ - USHORT data,data2,data3; - - if(ModeNo>0x13) data=*((USHORT *)(ROMAddr+REFIndex+0x00)); - else data=0; - data2=0; - if(ModeNo>0x13) - if(ModeType>0x02) { - data2=data2|0x02; - data3=ModeType-ModeVGA; - data3=data3<<2; - data2=data2|data3; - } - - data=data&InterlaceMode; - if(data) data2=data2|0x20; - SetReg1(P3c4,0x06,data2); - - data=GetReg1(P3c4,0x01); - data=data&0xF7; - data2=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); - data2=data2&HalfDCLK; - if(data2) data=data|0x08; - SetReg1(P3c4,0x01,data); - - data=GetReg1(P3c4,0x0F); - data=data&0xF7; - data2=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); - data2=data2&LineCompareOff; - if(data2) data=data|0x08; - SetReg1(P3c4,0x0F,data); - - data=GetReg1(P3c4,0x21); - data=data&0x1F; - if(ModeType==0x00) data=data|0x60; /* Text Mode */ - else if(ModeType<=0x02) data=data|0x00; /* EGA Mode */ - else data=data|0xA0; /* VGA Mode */ - SetReg1(P3c4,0x21,data); -} - -VOID SetVCLKState(ULONG ROMAddr, USHORT ModeNo) -{ - USHORT data,data2; - USHORT VCLK; - UCHAR index; - - index=*((UCHAR *)(ROMAddr+REFIndex+0x03)); - CRT1VCLKLen=GetVCLKLen(ROMAddr); - data=index*CRT1VCLKLen; - VCLKData=*((USHORT *)(ROMAddr+0x208)); - VCLKData=VCLKData+data+(CRT1VCLKLen-2); - VCLK=*((USHORT *)(ROMAddr+VCLKData)); - if(ModeNo<=0x13) VCLK=0; - - data=GetReg1(P3c4,0x07); - data=data&0x7B; - if(VCLK>=150) data=data|0x80; /* VCLK > 150 */ - SetReg1(P3c4,0x07,data); - - data=GetReg1(P3c4,0x32); - data=data&0xD7; - if(VCLK>=150) data=data|0x08; /* VCLK > 150 */ - SetReg1(P3c4,0x32,data); - - data2=0x03; - if(VCLK>135) data2=0x02; - if(VCLK>160) data2=0x01; - if(VCLK>260) data2=0x00; - data=GetReg1(P3c4,0x07); - data=data&0xFC; - data=data|data2; - SetReg1(P3c4,0x07,data); -} - -VOID LoadDAC(ULONG ROMAddr) -{ - USHORT data,data2; - USHORT time,i,j,k; - USHORT m,n,o; - USHORT si,di,bx,dl; - USHORT al,ah,dh; - USHORT *table=0; - - data=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); - data=data&DACInfoFlag; - time=64; - if(data==0x00) table=MDA_DAC; - if(data==0x08) table=CGA_DAC; - if(data==0x10) table=EGA_DAC; - if(data==0x18) { - time=256; - table=VGA_DAC; - } - if(time==256) j=16; - else j=time; - - SetReg3(P3c6,0xFF); - SetReg3(P3c8,0x00); - - for(i=0;i<j;i++) { - data=table[i]; - for(k=0;k<3;k++) { - data2=0; - if(data&0x01) data2=0x2A; - if(data&0x02) data2=data2+0x15; - SetReg3(P3c9,data2); - data=data>>2; - } - } - - if(time==256) { - for(i=16;i<32;i++) { - data=table[i]; - for(k=0;k<3;k++) SetReg3(P3c9,data); - } - si=32; - for(m=0;m<9;m++) { - di=si; - bx=si+0x04; - dl=0; - for(n=0;n<3;n++) { - for(o=0;o<5;o++) { - dh=table[si]; - ah=table[di]; - al=table[bx]; - si++; - WriteDAC(dl,ah,al,dh); - } /* for 5 */ - si=si-2; - for(o=0;o<3;o++) { - dh=table[bx]; - ah=table[di]; - al=table[si]; - si--; - WriteDAC(dl,ah,al,dh); - } /* for 3 */ - dl++; - } /* for 3 */ - si=si+5; - } /* for 9 */ - } -} - -VOID WriteDAC(USHORT dl, USHORT ah, USHORT al, USHORT dh) -{ - USHORT temp; - USHORT bh,bl; - - bh=ah; - bl=al; - if(dl!=0) { - temp=bh; - bh=dh; - dh=temp; - if(dl==1) { - temp=bl; - bl=dh; - dh=temp; - } - else { - temp=bl; - bl=bh; - bh=temp; - } - } - SetReg3(P3c9,(USHORT)dh); - SetReg3(P3c9,(USHORT)bh); - SetReg3(P3c9,(USHORT)bl); -} - -VOID DisplayOn() -{ - USHORT data; - - data=GetReg1(P3c4,0x01); - data=data&0xDF; - SetReg1(P3c4,0x01,data); -} - -VOID DisplayOff() -{ - 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)); -} - -VOID SetReg3(USHORT port, USHORT data) -{ - outb(port, (UCHAR)(data & 0xff)); -} - -USHORT GetReg1(USHORT port, USHORT index) -{ - UCHAR data; - - outb(port, (UCHAR)(index & 0xff)); - port += 1; - data = inb(port); - return(data); -} - -USHORT GetReg2(USHORT port) -{ - UCHAR data; - - data = inb(port); - - return(data); -} - -USHORT GetModeIDLength(ULONG ROMAddr, USHORT ModeNo) -{ - UCHAR ModeID; - USHORT modeidlength; - USHORT usModeIDOffset; - - return(10); - modeidlength=0; - usModeIDOffset=*((USHORT *)(ROMAddr+0x20A)); /* Get EModeIDTable */ - ModeID=*((UCHAR *)(ROMAddr+usModeIDOffset)); /* Offset 0x20A */ - while(ModeID!=0x2E) { - modeidlength++; - usModeIDOffset=usModeIDOffset+1; /* 10 <= ExtStructSize */ - ModeID=*((UCHAR *)(ROMAddr+usModeIDOffset)); - } - return(modeidlength); -} - -USHORT GetRefindexLength(ULONG ROMAddr, USHORT ModeNo) -{ - UCHAR ModeID; - UCHAR temp; - USHORT refindexlength; - USHORT usModeIDOffset; - USHORT usREFIndex; - USHORT usIDLength; - - usModeIDOffset=*((USHORT *)(ROMAddr+0x20A)); /* Get EModeIDTable */ - ModeID=*((UCHAR *)(ROMAddr+usModeIDOffset)); /* Offset 0x20A */ - usIDLength = GetModeIDLength(ROMAddr, ModeNo); - while(ModeID!=0x40) { - usModeIDOffset=usModeIDOffset+usIDLength; /*10 <= ExtStructSize */ - ModeID=*((UCHAR *)(ROMAddr+usModeIDOffset)); - } - - refindexlength=1; - usREFIndex=*((USHORT *)(ROMAddr+usModeIDOffset+0x04)); /* si+Ext_point */ - usREFIndex++; - temp=*((UCHAR *)(ROMAddr+usREFIndex)); /* di => REFIndex */ - while(temp!=0xFF) { - refindexlength++; - usREFIndex++; - temp=*((UCHAR *)(ROMAddr+usREFIndex)); /* di => REFIndex */ - } - return(refindexlength); -} - -VOID SetInterlace(ULONG ROMAddr, USHORT ModeNo) -{ - ULONG Temp; - USHORT data,Temp2; - - Temp = (ULONG)GetReg1(P3d4, 0x01); - Temp++; - Temp=Temp*8; - - if(Temp==1024) data=0x0035; - else if(Temp==1280) data=0x0048; - else data=0x0000; - - Temp2=*((USHORT *)(ROMAddr+REFIndex+0x00)); - Temp2 &= InterlaceMode; - if(Temp2 == 0) data=0x0000; - - SetReg1(P3d4,0x19,data); - - Temp = (ULONG)GetReg1(P3d4, 0x1A); - Temp2= (USHORT)(Temp & 0xFC); - SetReg1(P3d4,0x1A,(USHORT)Temp); - - Temp = (ULONG)GetReg1(P3c4, 0x0f); - Temp2= (USHORT)Temp & 0xBF; - if(ModeNo==0x37) Temp2=Temp2|0x40; - SetReg1(P3d4,0x1A,(USHORT)Temp2); -} - -VOID SetCRT1FIFO(ULONG ROMAddr) -{ - USHORT index,data,VCLK,data2,MCLKOffset,MCLK,colorth=0; - USHORT ah,bl,A,B; - - index=*((UCHAR *)(ROMAddr+REFIndex+0x03)); - CRT1VCLKLen=GetVCLKLen(ROMAddr); - data=index*CRT1VCLKLen; - VCLKData=*((USHORT *)(ROMAddr+0x208)); - VCLKData=VCLKData+data+(CRT1VCLKLen-2); - VCLK=*((USHORT *)(ROMAddr+VCLKData)); /* Get VCLK */ - - MCLKOffset=*((USHORT *)(ROMAddr+0x20C)); - index=GetReg1(P3c4,0x3A); - index=index&07; - MCLKOffset=MCLKOffset+index*5; - MCLK=*((UCHAR *)(ROMAddr+MCLKOffset+0x03)); /* Get MCLK */ - - data2=ModeType-0x02; - switch (data2) { - case 0 : colorth=1; break; - case 1 : colorth=2; break; - case 2 : colorth=4; break; - case 3 : colorth=4; break; - case 4 : colorth=6; break; - case 5 : colorth=8; break; - } - - do{ -/*==============*/ - B=(USHORT)(CalcDelay(ROMAddr,0)*VCLK*colorth); - B=B/(16*MCLK); - B++; - - A=(CalcDelay(ROMAddr,1)*VCLK*colorth); - A=A/(16*MCLK); - A++; - - if(A<4) A=0; - else A=A-4; - - if(A>B) bl=A; - else bl=B; - - bl++; - if(bl>0x13) { - data=GetReg1(P3c4,0x16); - data=data>>6; - if(data!=0) { - data--; - data=data<<6; - data2=GetReg1(P3c4,0x16); - data2=(data2&0x3f)|data; - SetReg1(P3c4,0x16,data2); - } - else bl=0x13; - } -/*==============*/ - } while(bl>0x13); - - ah=bl; - ah=ah<<4; - ah=ah|0x0f; - SetReg1(P3c4,0x08,ah); - - data=bl; - data=data&0x10; - data=data<<1; - data2=GetReg1(P3c4,0x0F); - data2=data2&0x9f; - data2=data2|data; - SetReg1(P3c4,0x0F,data2); - - data=bl+3; - if(data>0x0f) data=0x0f; - SetReg1(P3c4,0x3b,0x00); - data2=GetReg1(P3c4,0x09); - data2=data2&0xF0; - data2=data2|data; - SetReg1(P3c4,0x09,data2); -} - -USHORT CalcDelay(ULONG ROMAddr,USHORT key) -{ - USHORT data,data2,temp0,temp1; - UCHAR ThLowA[]= {61,3,52,5,68,7,100,11, - 43,3,42,5,54,7, 78,11, - 34,3,37,5,47,7, 67,11}; - UCHAR ThLowB[]= {81,4,72,6,88,8,120,12, - 55,4,54,6,66,8, 90,12, - 42,4,45,6,55,8, 75,12}; - UCHAR ThTiming[]= {1,2,2,3,0,1,1,2}; - - data=GetReg1(P3c4,0x16); - data=data>>6; - data2=GetReg1(P3c4,0x14); - data2=(data2>>4)&0x0C; - data=data|data2; - data=data<1; - if(key==0) { - temp0=(USHORT)ThLowA[data]; - temp1=(USHORT)ThLowA[data+1]; - } - else { - temp0=(USHORT)ThLowB[data]; - temp1=(USHORT)ThLowB[data+1]; - } - - data2=0; - data=GetReg1(P3c4,0x18); - if(data&0x02) data2=data2|0x01; - if(data&0x20) data2=data2|0x02; - if(data&0x40) data2=data2|0x04; - - data=temp1*ThTiming[data2]+temp0; - return(data); -} - -VOID SetCRT1FIFO2(ULONG ROMAddr) -{ - USHORT index,data,VCLK,data2,MCLKOffset,MCLK,colorth=0; - USHORT ah,bl,B; - ULONG eax; - - index=*((UCHAR *)(ROMAddr+REFIndex+0x03)); - CRT1VCLKLen=GetVCLKLen(ROMAddr); - data=index*CRT1VCLKLen; - VCLKData=*((USHORT *)(ROMAddr+0x208)); - VCLKData=VCLKData+data+(CRT1VCLKLen-2); - VCLK=*((USHORT *)(ROMAddr+VCLKData)); /* Get VCLK */ - - MCLKOffset=*((USHORT *)(ROMAddr+0x20C)); - index=GetReg1(P3c4,0x1A); - index=index&07; - MCLKOffset=MCLKOffset+index*5; - MCLK=*((USHORT *)(ROMAddr+MCLKOffset+0x03)); /* Get MCLK */ - - data2=ModeType-0x02; - switch (data2) { - case 0 : colorth=1; break; - case 1 : colorth=1; break; - case 2 : colorth=2; break; - case 3 : colorth=2; break; - case 4 : colorth=3; break; - case 5 : colorth=4; break; - } - - do{ -/*==============*/ - B=(CalcDelay2(ROMAddr,0)*VCLK*colorth); - if (B%(16*MCLK) == 0) - { - B=B/(16*MCLK); - bl=B+1; - } - else - { - B=B/(16*MCLK); - bl=B+2; - } - - if(bl>0x13) { - data=GetReg1(P3c4,0x15); - data=data&0xf0; - if(data!=0xb0) { - data=data+0x20; - if(data==0xa0) data=0x30; - - data2=GetReg1(P3c4,0x15); - data2=(data2&0x0f)|data; - SetReg1(P3c4,0x15,data2); - } - else bl=0x13; - } -/*==============*/ - } while(bl>0x13); - - data2=GetReg1(P3c4,0x15); - data2=(data2&0xf0)>>4; - data2=data2<<24; - -/* ========================*/ - SetReg4(0xcf8,0x80000050); - eax=GetReg3(0xcfc); - eax=eax&0x0f0ffffff; - eax=eax|data2; - SetReg4(0xcfc,eax); -/* ========================*/ - - ah=bl; - ah=ah<<4; - ah=ah|0x0f; - SetReg1(P3c4,0x08,ah); - - data=bl; - data=data&0x10; - data=data<<1; - data2=GetReg1(P3c4,0x0F); - data2=data2&0x9f; - data2=data2|data; - SetReg1(P3c4,0x0F,data2); - - data=bl+3; - if(data>0x0f) data=0x0f; - SetReg1(P3c4,0x3b,0x00); - data2=GetReg1(P3c4,0x09); - data2=data2&0xF0; - data2=data2|data; - SetReg1(P3c4,0x09,data2); -} - -USHORT CalcDelay2(ULONG ROMAddr,USHORT key) -{ - USHORT data,index; - UCHAR LatencyFactor[]={88,80,78,72,70,00, - 00,79,77,71,69,49, - 88,80,78,72,70,00, - 00,72,70,64,62,44}; - - index=0; - data=GetReg1(P3c4,0x14); - if(data&0x80) index=index+12; - - data=GetReg1(P3c4,0x15); - data=(data&0xf0)>>4; - if(data&0x01) index=index+6; - - data=data>>1; - index=index+data; - data=LatencyFactor[index]; - - return(data); -} - -VOID SetReg4(USHORT port, ULONG data) -{ - outl(port, (ULONG)(data & 0xffffffff)); -} - -ULONG GetReg3(USHORT port) -{ - ULONG data; - - data = inl(port); - return(data); -} - -VOID SetPitch(ScrnInfoPtr pScrn, USHORT BaseAddr) -{ - SISPtr pSiS = SISPTR(pScrn); - ULONG HDisplay; - ULONG temp; - USHORT Port = BaseAddr + IND_SIS_CRT2_PORT_04; - - HDisplay = pSiS->scrnOffset / 8; - SetReg1(P3d4, 0x13, HDisplay); - temp = (GetReg1(P3c4, 0x0E) & 0xF0) | (HDisplay>>8); - SetReg1(P3c4, 0x0E, temp); - - SetReg1(Port, 0x24, 1); - SetReg1(Port, 0x07, HDisplay); - temp = (GetReg1(Port, 0x09) & 0xF0) | (HDisplay>>8); - SetReg1(Port, 0x09, temp); - - -} -USHORT CalcModeIndex(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - USHORT i = (pScrn->bitsPerPixel+7)/8 - 1; - USHORT ModeIndex = 0; - switch(mode->HDisplay) - { - case 640: - ModeIndex = ModeIndex_640x480[i]; - break; - case 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); -} -USHORT CalcRefreshRate(ScrnInfoPtr pScrn, DisplayModePtr mode) -{ - SISPtr pSiS = SISPTR(pScrn); - USHORT Index=0; - USHORT i=0; - USHORT Rate=1; - USHORT temp = (int)(mode->VRefresh+0.5); - - switch(mode->HDisplay) - { - case 640: - Index = 0; - break; - case 800: - Index = 1; - break; - case 1024: - Index = 2; - Rate = 2; - break; - case 1280: - Index = 3; - Rate = 2; - break; - case 1600: - Index = 4; - break; - 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); -} - -VOID WaitVertical(VOID) -{ - USHORT tempax,tempdx; - -/* tempdx=0x3da; - do { - tempax=GetReg2(tempdx); - } while(!(tempax&01)); - - do { - tempax=GetReg2(tempdx); - } while(!(tempax&01)); -*/ - -} Index: xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h:1.4 Fri Dec 1 20:16:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h Mon Jun 4 12:41:04 2001 @@ -1,120 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init300.h,v 1.4 2000/12/02 01:16:16 dawes Exp $ */ - -#include "initdef.h" - -USHORT DRAMType[17][5]={{0x0C,0x0A,0x02,0x40,0x39},{0x0D,0x0A,0x01,0x40,0x48}, - {0x0C,0x09,0x02,0x20,0x35},{0x0D,0x09,0x01,0x20,0x44}, - {0x0C,0x08,0x02,0x10,0x31},{0x0D,0x08,0x01,0x10,0x40}, - {0x0C,0x0A,0x01,0x20,0x34},{0x0C,0x09,0x01,0x08,0x32}, - {0x0B,0x08,0x02,0x08,0x21},{0x0C,0x08,0x01,0x08,0x30}, - {0x0A,0x08,0x02,0x04,0x11},{0x0B,0x0A,0x01,0x10,0x28}, - {0x09,0x08,0x02,0x02,0x01},{0x0B,0x09,0x01,0x08,0x24}, - {0x0B,0x08,0x01,0x04,0x20},{0x0A,0x08,0x01,0x02,0x10}, - {0x09,0x08,0x01,0x01,0x00}}; - -USHORT MDA_DAC[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, - 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, - 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, - 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F}; - -USHORT CGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, - 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, - 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, - 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, - 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, - 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, - 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, - 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; - -USHORT EGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15, - 0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35, - 0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D, - 0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D, - 0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17, - 0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37, - 0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F, - 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; - -USHORT VGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, - 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, - 0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18, - 0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F, - - 0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F, - 0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00, - 0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18, - 0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04, - 0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10, - 0x0B,0x0C,0x0D,0x0F,0x10}; - -USHORT ModeIndex_640x480[] = {0x2E, 0x44, 0x45, 0x62}; -USHORT ModeIndex_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 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,LCDResInfo,LCDTypeInfo,LCDInfo; - -USHORT CalcRefreshRate(ScrnInfoPtr, DisplayModePtr); -USHORT CalcModeIndex(ScrnInfoPtr, DisplayModePtr); -BOOLEAN SearchModeID(ULONG, USHORT); -BOOLEAN CheckMemorySize(ULONG); -VOID GetModePtr(ULONG, USHORT); -BOOLEAN GetRatePtr(ULONG, USHORT); -VOID SetSeqRegs(ULONG); -VOID SetMiscRegs(ULONG); -VOID SetCRTCRegs(ULONG); -VOID SetATTRegs(ULONG); -VOID SetGRCRegs(ULONG); -VOID ClearExt1Regs(VOID); -VOID SetSync(ULONG); -VOID SetCRT1CRTC(ULONG); -VOID SetCRT1Offset(ULONG); -VOID SetCRT1FIFO(ULONG); -VOID SetCRT1FIFO2(ULONG); -VOID SetCRT1VCLK(ULONG); -VOID LoadDAC(ULONG); -VOID DisplayOn(); -VOID DisplayOff(); -VOID SetPitch(ScrnInfoPtr, USHORT); -VOID SetCRT1ModeRegs(ULONG, USHORT); -VOID SetVCLKState(ULONG, USHORT); -VOID WriteDAC(USHORT, USHORT, USHORT, USHORT); -USHORT GetModeIDLength(ULONG, USHORT); -USHORT GetRefindexLength(ULONG, USHORT); -VOID SetInterlace(ULONG, USHORT); -USHORT CalcDelay2(ULONG ,USHORT); -USHORT CalcDelay(ULONG ,USHORT); -VOID WaitVertical(VOID); - -extern BOOLEAN SetCRT2Group(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn); -extern VOID GetVBInfo(USHORT BaseAddr,ULONG ROMAddr); -extern VOID PresetScratchregister(USHORT P3d4); -extern BOOLEAN GetLCDResInfo(ULONG ROMAddr, USHORT P3d4); -extern VOID SetTVSystem(); -extern BOOLEAN GetLCDDDCInfo(ScrnInfoPtr pScrn); -extern USHORT GetVCLKLen(ULONG ROMAddr); -extern USHORT Part1[]; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c:1.3.2.1 xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c:1.3.2.1 Wed Feb 14 14:14:22 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c Mon Jun 4 12:41:04 2001 @@ -1,3150 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.c,v 1.3.2.1 2001/02/14 19:14:22 dawes Exp $ */ - -#include "xf86.h" -#include "xf86PciInfo.h" - -#include "sis.h" -#include "sis_regs.h" - -#include "init301.h" - -BOOLEAN SetCRT2Group(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo, ScrnInfoPtr pScrn) -{ - USHORT temp; - - SetFlag=SetFlag|ProgrammingCRT2; - SearchModeID(ROMAddr,ModeNo); - temp=GetRatePtrCRT2(ROMAddr,ModeNo); - if(((temp&0x02)==0) && ((VBInfo&CRT2DisplayFlag)==0)) - return(FALSE); - SaveCRT2Info(ModeNo); - DisableBridge(BaseAddr); - UnLockCRT2(BaseAddr); - SetDefCRT2ExtRegs(BaseAddr); - SetCRT2ModeRegs(BaseAddr,ModeNo); - if(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; -} - -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); - } -} - -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)); -} - -BOOLEAN 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); -} - -VOID SaveCRT2Info(USHORT ModeNo) -{ - USHORT temp1,temp2,temp3; - temp1=(VBInfo&SetInSlaveMode)>>8; - temp2=~(SetInSlaveMode>>8); - temp3=(UCHAR)GetReg1(P3d4,0x31); - temp3=((temp3&temp2)|temp1); - SetReg1(P3d4,0x31,(USHORT)temp3); - temp3=(UCHAR)GetReg1(P3d4,0x35); - temp3=temp3&0xF3; - SetReg1(P3d4,0x35,(USHORT)temp3); -} - -VOID DisableLockRegs(){ - UCHAR temp3; - temp3=(UCHAR)GetReg1(P3c4,0x32); - temp3=temp3&0xDF; - SetReg1(P3c4,0x32,(USHORT)temp3); -} - -VOID DisableCRT2(){ - UCHAR temp3; - temp3=(UCHAR)GetReg1(P3c4,0x1E); - temp3=temp3&0xDF; - SetReg1(P3c4,0x1E,(USHORT)temp3); -} - -VOID DisableBridge(USHORT BaseAddr) -{ - UCHAR temp3,part2_02,part2_05; - USHORT Part2Port,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, */ - } -} - -VOID GetCRT2Data(ULONG ROMAddr,USHORT ModeNo) -{ - if(IF_DEF_LVDS==0){ /*301 */ - GetCRT2Data301(ROMAddr,ModeNo); - return; - }else{ /*LVDS */ - GetCRT2DataLVDS(ROMAddr,ModeNo); - return; - } -} - -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; -} - -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; -} - -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; -} - -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; -} - - -VOID GetRAMDAC2DATA(ULONG ROMAddr,USHORT ModeNo) -{ - USHORT tempax,tempbx,tempbh,modeflag1,t1=0,t2; - RVBHCMAX=1;RVBHCFACT=1; - if(ModeNo<=0x13){ - tempax=*((UCHAR *)(ROMAddr+REFIndex+10)); - tempbx=*((USHORT *)(ROMAddr+REFIndex+16)); - }else{ - t1=*((UCHAR *)(ROMAddr+REFIndex+0x2)); /* Ext_CRT1CRTC=2 */ - t1=t1*CRT1Len; - REFIndex=*((USHORT *)(ROMAddr+0x204)); /* Get CRT1Table */ - REFIndex=REFIndex+t1; - t1=*((UCHAR *)(ROMAddr+REFIndex+0)); - t2=*((UCHAR *)(ROMAddr+REFIndex+14)); - tempax=(t1&0xFF)|((t2&0x03)<<8); - tempbx=*((USHORT *)(ROMAddr+REFIndex+6)); - t1=*((UCHAR *)(ROMAddr+REFIndex+13)); - t1=(t1&0x01)<<2; - } - - tempbh=tempbx>>8; - tempbh=((tempbh&0x20)>>4)|(tempbh&0x01); - tempbh=tempbh|t1; - tempbx=(tempbx&0xFF)|(tempbh<<8); - tempax=tempax+5; - modeflag1=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - if(modeflag1&Charx8Dot){ - tempax=tempax*8; - }else{ - tempax=tempax*9; - } - - VGAHT=tempax; - HT=tempax; - tempbx++; - VGAVT=tempbx; - VT=tempbx; - -} - -VOID GetCRT2Ptr(ULONG ROMAddr,USHORT ModeNo) -{ - USHORT tempcl,tempbx,tempal,tempax,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); -} - -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); - } -} - -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); - } -} - -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 */ - SetTPData(); - SetTPData(); - SetTPData(); - SetTPData(); - SetTPData(); - SetTPData(); - SetTPData(); - SetTPData(); - } - - REFIndex=OldREFIndex; /*pop di */ - - return; -} - -VOID SetTPData() -{ - return; -} - - -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 */ -} - -VOID SetCRT2Offset(USHORT Part1Port,ULONG ROMAddr) -{ - USHORT offset; - if(VBInfo&SetInSlaveMode){ - return; - } - offset=GetOffset(ROMAddr); - SetReg1(Part1Port,0x07,(USHORT)(offset&0xFF)); - SetReg1(Part1Port,0x09,(USHORT)((offset&0xFF00)>>8)); - SetReg1(Part1Port,0x03,(USHORT)(((offset>>3)&0xFF)+1)); -} - -USHORT GetOffset(ULONG ROMAddr) -{ - USHORT tempal,temp1,colordepth; - tempal=*((UCHAR *)(ROMAddr+ModeIDOffset+0x03)); /* si+Ext_ModeInfo */ - tempal=(tempal>>4)&0xFF; - ScreenOffset=*((USHORT *)(ROMAddr+0x206)); /* Get ScreeOffset table */ - tempal=*((UCHAR *)(ROMAddr+ScreenOffset+tempal)); /* get ScreenOffset */ - tempal=tempal&0xFF; - temp1=*((UCHAR *)(ROMAddr+REFIndex)); /* di+Ext_InfoFlag */ - if(temp1&InterlaceMode){ - tempal=tempal<<1; - } - colordepth=GetColorDepth(ROMAddr); - return(tempal*colordepth); -} - -USHORT GetColorDepth(ULONG ROMAddr) -{ - USHORT ColorDepth[6]={1,2,4,4,6,8}; - USHORT temp; - int temp1; - temp=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); /* si+St_ModeFlag */ - temp1=(temp&ModeInfoFlag)-ModeEGA; - if(temp1<0) temp1=0; - return(ColorDepth[temp1]); -} - -VOID SetCRT2FIFO(USHORT Part1Port,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn) -{ - SISPtr pSiS = SISPTR(pScrn); - USHORT temp,temp1,temp2,temp3,flag; - USHORT vclk2ptr,latencyindex; - USHORT oldREFIndex,CRT1ModeNo,oldModeIDOffset; - long int longtemp; - - 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); -} - -USHORT GetVCLK(ULONG ROMAddr,USHORT ModeNo) -{ - USHORT tempptr; - USHORT temp1; - tempptr=GetVCLKPtr(ROMAddr,ModeNo); - temp1=*((USHORT *)(ROMAddr+tempptr+(VCLKLen-2))); - return temp1; -} - -USHORT GetQueueConfig() -{ - USHORT tempal,tempbl; - ULONG tempeax; - - SetReg4(0xcf8,0x80000050); - tempeax=GetReg3(0xcfc); - tempeax=(tempeax>>24)&0x0f; - tempbl=(USHORT)tempeax; - tempbl=tempbl<<4; - - SetReg4(0xcf8,0x800000A0); - tempeax=GetReg3(0xcfc); - tempeax=(tempeax>>24)&0x0f; - tempal=(USHORT)tempeax; - tempbl=tempbl|tempal; - - return(tempbl); -} - -USHORT GetVCLKPtr(ULONG ROMAddr,USHORT ModeNo) -{ - USHORT tempal=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); - } -} - -USHORT GetColorTh(ULONG ROMAddr) -{ - USHORT temp; - temp=GetColorDepth(ROMAddr); - temp=temp>>1; - if(temp==0) temp++; - return temp; -} - -USHORT GetMCLK(ULONG ROMAddr) -{ - USHORT tempmclkptr; - USHORT tempmclk; - tempmclkptr=GetMCLKPtr(ROMAddr); - tempmclk=*((USHORT *)(ROMAddr+tempmclkptr+0x03)); /* di+3 */ - return tempmclk; -} - -USHORT GetMCLKPtr(ULONG ROMAddr) -{ - USHORT tempdi; - USHORT tempdramtype,tempax; - - tempdi=*((USHORT *)(ROMAddr+0x20C)); /* MCLKData */ - tempdramtype=GetDRAMType(ROMAddr); - tempax=5*tempdramtype; - tempdi=tempdi+tempax; - return (tempdi); -} - -USHORT GetDRAMType(ULONG ROMAddr) -{ - USHORT tsoftsetting,temp3; - tsoftsetting=*((UCHAR *)(ROMAddr+0x52)); - if(!(tsoftsetting&SoftDramType)){ - temp3=(UCHAR)GetReg1(P3c4,0x3A); - tsoftsetting=temp3; - } - tsoftsetting=tsoftsetting&0x07; - return(tsoftsetting); -} - -USHORT CalcDelayVB() -{ - USHORT tempal,tempah,temp1,tempbx; - USHORT ThTiming[8]={1,2,2,3,0,1,1,2}; - USHORT ThLowB[24]={81,4,72,6,88,8,120,12, - 55,4,54,6,66,8,90,12, - 42,4,45,6,55,8,75,12}; - - tempah=(UCHAR)GetReg1(P3c4,0x18); /* SR_18 */ - tempah=tempah&0x62; - tempah=tempah>>1; - tempal=tempah; - tempah=tempah>>3; - tempal=tempal|tempah; - tempal=tempal&0x07; - - temp1=ThTiming[tempal]; /* temp1->cl */ - - tempbx=(UCHAR)GetReg1(P3c4,0x16); /* SR_16 */ - tempbx=tempbx>>6; - tempah=(UCHAR)GetReg1(P3c4,0x14); /* SR_14 */ - tempah=((tempah>>4)&0x0C); - tempbx=((tempbx|tempah)<<1); - - tempal=ThLowB[tempbx+1]*temp1; - tempbx=ThLowB[tempbx]; - tempbx=tempal+tempbx; - - return(tempbx); -} - -USHORT GetVCLK2Ptr(ULONG ROMAddr,USHORT ModeNo) -{ - USHORT tempal,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); -} - -USHORT GetVCLKLen(ULONG ROMAddr) -{ - USHORT VCLKDataStart,vclklabel,temp; - VCLKDataStart=*((USHORT *)(ROMAddr+0x208)); - for(temp=0;;temp++){ - vclklabel=*((USHORT *)(ROMAddr+VCLKDataStart+temp)); - if(vclklabel==VCLKStartFreq){ - temp=temp+2; - return(temp); - } - } - return(0); -} - - -VOID SetCRT2Sync(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo) -{ - USHORT temp1,tempah=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); -} - -VOID GetCRT1Ptr(ULONG ROMAddr) -{ - USHORT temprefcrt1; - USHORT temp; - temp=*((UCHAR *)(ROMAddr+REFIndex+0x02)); /* di+Ext_CRT1CRTC */ - temp=temp*CRT1Len; - temprefcrt1=*((USHORT *)(ROMAddr+0x204)); /* Get CRT1Table */ - REFIndex=temprefcrt1+temp; /* di->CRT1Table+Ext_CRT1CRTC*CRT1Len */ -} - -VOID SetRegANDOR(USHORT Port,USHORT Index,USHORT DataAND,USHORT DataOR) -{ - USHORT temp1; - temp1=GetReg1(Port,Index); /* part1port index 02 */ - temp1=(temp1&(DataAND))|DataOR; - SetReg1(Port,Index,temp1); -} - -USHORT GetVGAHT2() -{ - long int temp1,temp2; - temp1=(VGAVT-VGAVDE)*RVBHCMAX; - temp1=temp1&0x0FFFF; - temp2=(VT-VDE)*RVBHCFACT; - temp2=temp2&0x0FFFF; - temp2=temp2*HT; - temp2=temp2/temp1; - return((USHORT)temp2); -} - -VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr, USHORT 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; -} - -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; -} - -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); -} - -VOID SetCRT2VCLK(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo) -{ - USHORT vclk2ptr; - USHORT tempah,temp1; - USHORT Part4Port; - - Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; - vclk2ptr=GetVCLK2Ptr(ROMAddr,ModeNo); - SetReg1(Part4Port,0x0A,0x01); - tempah=*((UCHAR *)(ROMAddr+vclk2ptr+0x01)); /* di+1 */ - SetReg1(Part4Port,0x0B,tempah); - tempah=*((UCHAR *)(ROMAddr+vclk2ptr+0x00)); /* di */ - SetReg1(Part4Port,0x0A,tempah); - SetReg1(Part4Port,0x12,0x00); - tempah=0x08; - if(VBInfo&SetCRT2ToRAMDAC){ - tempah=tempah|0x020; - } - temp1=GetReg1(Part4Port,0x12); - tempah=tempah|temp1; - SetReg1(Part4Port,0x12,tempah); -} - -VOID SetGroup5(USHORT BaseAddr,ULONG ROMAddr) -{ - USHORT Part5Port; - USHORT Pindex,Pdata; - Part5Port=BaseAddr+IND_SIS_CRT2_PORT_14+2; - Pindex=Part5Port; - Pdata=Part5Port+1; - if(ModeType==ModeVGA){ - if(!(VBInfo&(SetInSlaveMode|LoadDACFlag|CRT2DisplayFlag))){ - EnableCRT2(); - LoadDAC2(ROMAddr,Part5Port); - } - } - return; -} - -VOID EnableCRT2() -{ - USHORT temp1; - temp1=GetReg1(P3c4,0x1E); - temp1=temp1|0x20; - SetReg1(P3c4,0x1E,temp1); /* SR 1E */ -} - -VOID LoadDAC2(ULONG ROMAddr,USHORT Part5Port) -{ - USHORT data,data2; - USHORT time,i,j,k; - USHORT m,n,o; - USHORT si,di,bx,dl; - USHORT al,ah,dh; - USHORT *table=0; - USHORT Pindex,Pdata; - Pindex=Part5Port; - Pdata=Part5Port+1; - data=*((USHORT *)(ROMAddr+ModeIDOffset+0x01)); - data=data&DACInfoFlag; - time=64; - if(data==0x00) table=MDA_DAC; - if(data==0x08) table=CGA_DAC; - if(data==0x10) table=EGA_DAC; - if(data==0x18) { - time=256; - table=VGA_DAC; - } - if(time==256) j=16; - else j=time; - - SetReg3(Pindex,0x00); - - for(i=0;i<j;i++) { - data=table[i]; - for(k=0;k<3;k++) { - data2=0; - if(data&0x01) data2=0x2A; - if(data&0x02) data2=data2+0x15; - SetReg3(Pdata,data2); - data=data>>2; - } - } - - if(time==256) { - for(i=16;i<32;i++) { - data=table[i]; - for(k=0;k<3;k++) SetReg3(Pdata,data); - } - si=32; - for(m=0;m<9;m++) { - di=si; - bx=si+0x04; - dl=0; - for(n=0;n<3;n++) { - for(o=0;o<5;o++) { - dh=table[si]; - ah=table[di]; - al=table[bx]; - si++; - WriteDAC2(Pdata,dl,ah,al,dh); - } /* for 5 */ - si=si-2; - for(o=0;o<3;o++) { - dh=table[bx]; - ah=table[di]; - al=table[si]; - si--; - WriteDAC2(Pdata,dl,ah,al,dh); - } /* for 3 */ - dl++; - } /* for 3 */ - si=si+5; - } /* for 9 */ - } -} - -VOID WriteDAC2(USHORT Pdata,USHORT dl, USHORT ah, USHORT al, USHORT dh) -{ - USHORT temp; - USHORT bh,bl; - - bh=ah; - bl=al; - if(dl!=0) { - temp=bh; - bh=dh; - dh=temp; - if(dl==1) { - temp=bl; - bl=dh; - dh=temp; - } - else { - temp=bl; - bl=bh; - bh=temp; - } - } - SetReg3(Pdata,(USHORT)dh); - SetReg3(Pdata,(USHORT)bh); - SetReg3(Pdata,(USHORT)bl); -} - -VOID LockCRT2(USHORT BaseAddr) -{ - USHORT Part1Port; - USHORT Part4Port; - USHORT temp1; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - Part4Port=BaseAddr+IND_SIS_CRT2_PORT_14; - temp1=GetReg1(Part1Port,0x24); - temp1=temp1&0xFE; - SetReg1(Part1Port,0x24,temp1); -} - -VOID SetLockRegs() -{ - USHORT temp1; - - if((VBInfo&SetInSlaveMode)&&(!(VBInfo&SetCRT2ToRAMDAC))){ - VBLongWait(); - temp1=GetReg1(P3c4,0x32); - temp1=temp1|0x20; - SetReg1(P3c4,0x32,temp1); - VBLongWait(); - } -} - -VOID EnableBridge(USHORT BaseAddr) -{ - USHORT part2_02,part2_05; - USHORT Part2Port; - Part2Port=BaseAddr+IND_SIS_CRT2_PORT_10; - - 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); */ - } -} - -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; - } -} - -BOOLEAN 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; - } -} - -BOOLEAN BridgeInSlave() -{ - USHORT flag1; - flag1=GetReg1(P3d4,0x31); - if(flag1&(SetInSlaveMode>>8)){ - return 1; - }else{ - return 0; - } -} - -BOOLEAN 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; -} - -VOID PresetScratchregister(USHORT P3d4) -{ - SetReg1(P3d4,0x37,0x00); -} - -BOOLEAN GetLCDDDCInfo(ScrnInfoPtr pScrn) -{ - USHORT tempah; -/*tempah=(HwDeviceExtension->usLCDType);// set in sisv.c */ - tempah=1; - SetReg1(P3d4,0x36,tempah); /* cr 36 0:no LCD 1:1024x768 2:1280x1024 */ - if(tempah>0) return 1; - else return 0; -} - -VOID SetTVSystem() -{ - USHORT tempah; - tempah=GetReg1(P3c4,0x38); /* SR 38 */ - tempah=tempah&0x01; /* get SR 38 D0 TV Type Selection */ - /* 0:NTSC 1:PAL */ - SetRegANDOR(P3d4,0x31,~0x01,tempah); /* set CR 31 D0= SR 38 D0 */ - return; -} - -VOID LongWait() -{ - USHORT i; - for(i=0; i<0xFFFF; i++) { - if(!(inSISREG(P3da) & 0x08)) - break; - } - for(i=0; i<0xFFFF; i++) { - if((inSISREG(P3da) & 0x09) == 9) - break; - } -} - -VOID VBLongWait() -{ - USHORT regsr1f,tempah,temp; - - regsr1f=GetReg1(P3c4,0x1F); - tempah=regsr1f&(~0xC0); - SetReg1(P3c4,0x1F,tempah); - - for(temp=1;temp>0;){ - temp=GetReg2(P3da); - temp=temp&0x08; - } - for(;temp==0;){ - temp=GetReg2(P3da); - temp=temp&0x08; - } - - SetReg1(P3c4,0x1F,regsr1f); - return; -} - -BOOLEAN WaitVBRetrace(USHORT BaseAddr) -{ - USHORT temp; - USHORT Part1Port; - Part1Port=BaseAddr+IND_SIS_CRT2_PORT_04; - temp=GetReg1(Part1Port,0x00); - if(!(temp&0x80)){ - return 0; - } - - for(temp=0;temp==0;){ - temp=GetReg1(Part1Port,0x25); - temp=temp&0x01; - } - for(;temp>0;){ - temp=GetReg1(Part1Port,0x25); - temp=temp&0x01; - } - return 1; -} - - -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; -} - -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; -} - -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); - -} - -BOOLEAN 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; - -} - -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; -} - -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); -} - -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); -} - -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); - } -} - - -VOID SetStart(VOID) -{ - USHORT temp; - - SetSCLKLow(); - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); /* SetSDA(0x01); */ - SetSCLKHigh(); - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); /* SetSDA(0x00); */ - SetSCLKHigh(); -} - -VOID SetStop(VOID) -{ - SetSCLKLow(); - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x00); /* SetSDA(0x00); */ - SetSCLKHigh(); - SetRegANDOR(DDC_Port,DDC_Index,0xFD,0x02); /* SetSDA(0x01); */ - SetSCLKHigh(); -} - -USHORT WriteDDC2Data(USHORT tempax) -{ - USHORT i,flag,temp; - - 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()); -} - -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); -} - -VOID SetSCLKLow(VOID) -{ - SetRegANDOR(DDC_Port,DDC_Index,0xFE,0x00); /* SetSCLKLow() */ - DDC2Delay(); -} - - -VOID SetSCLKHigh(VOID) -{ - USHORT temp; - - SetRegANDOR(DDC_Port,DDC_Index,0xFE,0x01); /* SetSCLKLow() */ - do { - temp=GetReg1(DDC_Port,DDC_Index); - } while(!(temp&0x01)); - DDC2Delay(); -} - -VOID DDC2Delay(VOID) -{ - USHORT i; - - for(i=0;i<DDC2DelayTime;i++) { - GetReg1(P3c4,0x05); - } -} - -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); -} Index: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h:1.4 Fri Dec 1 20:16:17 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h Mon Jun 4 12:41:04 2001 @@ -1,241 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/init301.h,v 1.4 2000/12/02 01:16:17 dawes Exp $ */ - -#include "initdef.h" - -USHORT VBInfo,SetFlag,RVBHCFACT,RVBHCMAX,VGAVT,VGAHT,VT,HT,VGAVDE,VGAHDE; -USHORT VDE,HDE,RVBHRS,NewFlickerMode,RY1COE,RY2COE,RY3COE,RY4COE; -USHORT LCDResInfo,LCDTypeInfo,LCDInfo,VCLKLen; -USHORT LCDHDES,LCDVDES; -USHORT DDC_Port; -USHORT DDC_Index; -USHORT DDC_DataShift; -USHORT DDC_DeviceAddr; -USHORT DDC_Flag; -USHORT DDC_ReadAddr; -USHORT DDC_Buffer; - -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}; - -VOID SetDefCRT2ExtRegs(USHORT BaseAddr); -BOOLEAN SetCRT2Group(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo, ScrnInfoPtr pScrn); -USHORT GetRatePtrCRT2(ULONG ROMAddr, USHORT ModeNo); -BOOLEAN AjustCRT2Rate(ULONG ROMAddr); -VOID SaveCRT2Info(USHORT ModeNo); -VOID DisableLockRegs(VOID); -VOID DisableCRT2(VOID); -VOID DisableBridge(USHORT BaseAddr); -VOID GetCRT2Data(ULONG ROMAddr,USHORT ModeNo); -VOID GetCRT2DataLVDS(ULONG ROMAddr,USHORT ModeNo); -VOID GetCRT2Data301(ULONG ROMAddr,USHORT ModeNo); -VOID GetResInfo(ULONG ROMAddr,USHORT ModeNo); -VOID GetRAMDAC2DATA(ULONG ROMAddr,USHORT ModeNo); -VOID GetCRT2Ptr(ULONG ROMAddr,USHORT ModeNo); -VOID UnLockCRT2(USHORT BaseAddr); -VOID SetCRT2ModeRegs(USHORT BaseAddr,USHORT ModeNo); -VOID SetGroup1(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn); -VOID SetGroup1_LVDS(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn); -VOID SetGroup1301(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn); -VOID GetLVDSDesData(ULONG ROMAddr,USHORT ModeNo); -VOID SetCRT2Offset(USHORT Part1Port,ULONG ROMAddr); -USHORT GetOffset(ULONG ROMAddr); -USHORT GetColorDepth(ULONG ROMAddr); -VOID SetCRT2FIFO(USHORT Part1Port,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn); -USHORT GetVCLK(ULONG ROMAddr,USHORT ModeNo); -USHORT GetVCLKPtr(ULONG ROMAddr,USHORT ModeNo); -USHORT GetColorTh(ULONG ROMAddr); -USHORT GetMCLK(ULONG ROMAddr); -USHORT GetMCLKPtr(ULONG ROMAddr); -USHORT GetDRAMType(ULONG ROMAddr); -USHORT CalcDelayVB(VOID); -USHORT GetVCLK2Ptr(ULONG ROMAddr,USHORT ModeNo); -VOID SetCRT2Sync(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo); -VOID GetCRT1Ptr(ULONG ROMAddr); -VOID SetRegANDOR(USHORT Port,USHORT Index,USHORT DataAND,USHORT DataOR); -USHORT GetVGAHT2(VOID); -VOID SetGroup2(USHORT BaseAddr,ULONG ROMAddr, USHORT ModeNo); -VOID SetGroup3(USHORT BaseAddr,ULONG ROMAddr); -VOID SetGroup4(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo); -VOID SetCRT2VCLK(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo); -VOID SetGroup5(USHORT BaseAddr,ULONG ROMAddr); -VOID EnableCRT2(VOID); -VOID LoadDAC2(ULONG ROMAddr,USHORT Part5Port); -VOID WriteDAC2(USHORT Pdata,USHORT dl, USHORT ah, USHORT al, USHORT dh); -VOID LockCRT2(USHORT BaseAddr); -VOID SetLockRegs(VOID); -VOID EnableBridge(USHORT BaseAddr); -VOID GetVBInfo(USHORT BaseAddr,ULONG ROMAddr); -BOOLEAN BridgeIsEnable(USHORT BaseAddr); -BOOLEAN BridgeInSlave(VOID); -BOOLEAN GetLCDResInfo(ULONG ROMAddr,USHORT P3d4); -VOID PresetScratchregister(USHORT P3d4); -BOOLEAN GetLCDDDCInfo(ScrnInfoPtr pScrn); -VOID SetTVSystem(); -VOID LongWait(); -USHORT GetQueueConfig(); -VOID VBLongWait(); -USHORT GetVCLKLen(ULONG ROMAddr); -BOOLEAN WaitVBRetrace(USHORT BaseAddr); -VOID ModCRT1CRTC(ULONG ROMAddr,USHORT ModeNo); -VOID SetCRT2ECLK(ULONG ROMAddr, USHORT ModeNo); -USHORT GetLVDSDesPtr(ULONG ROMAddr,USHORT ModeNo); -BOOLEAN GetLVDSCRT1Ptr(ULONG ROMAddr,USHORT ModeNo); -VOID SetGroup1_301(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn); -VOID SetGroup1_LVDS(USHORT BaseAddr,ULONG ROMAddr,USHORT ModeNo,ScrnInfoPtr pScrn); -VOID SetTPData(); -BOOLEAN GetPanelID(); -BOOLEAN GetLVDSCRT1Ptr(ULONG ROMAddr,USHORT ModeNo); -VOID SetCHTVReg(ULONG ROMAddr,USHORT ModeNo); -VOID SetCHTVRegANDOR(USHORT tempax,USHORT tempbh); -VOID GetCHTVRegPtr(ULONG ROMAddr,USHORT ModeNo); -VOID SetCH7005(USHORT tempax); -USHORT GetCH7005(USHORT tempax); -VOID SetSwitchDDC2(VOID); -VOID SetStart(VOID); -VOID SetStop(VOID); -VOID DDC2Delay(VOID); -VOID SetSCLKLow(VOID); -VOID SetSCLKHigh(VOID); -USHORT ReadDDC2Data(USHORT tempax); -USHORT WriteDDC2Data(USHORT tempax); -USHORT CheckACK(VOID); - -extern USHORT MDA_DAC[]; -extern USHORT CGA_DAC[]; -extern USHORT EGA_DAC[]; -extern USHORT VGA_DAC[]; - -extern USHORT P3c4,P3d4,P3c0,P3ce,P3c2,P3ca,P3c6,P3c7,P3c8,P3c9,P3da; -extern USHORT flag_clearbuffer; /* 0:no clear frame buffer 1:clear frame buffer */ -extern int RAMType; -extern int ModeIDOffset,StandTable,CRT1Table,ScreenOffset,VCLKData,MCLKData, ECLKData; -extern int REFIndex,ModeType; -extern USHORT VBInfo,LCDResInfo,LCDTypeInfo,LCDInfo; -extern USHORT IF_DEF_LVDS; -extern USHORT IF_DEF_HiVision; -extern USHORT IF_DEF_CH7005; - -extern VOID SetReg1(USHORT, USHORT, USHORT); -extern VOID SetReg3(USHORT, USHORT); -extern USHORT GetReg1(USHORT, USHORT); -extern USHORT GetReg2(USHORT); -extern BOOLEAN SearchModeID(ULONG, USHORT); -extern BOOLEAN GetRatePtr(ULONG, USHORT); -extern VOID SetReg4(USHORT, ULONG); -extern ULONG GetReg3(USHORT); Index: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h:1.4 xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h:1.4 Fri Dec 1 20:16:17 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h Mon Jun 4 12:41:04 2001 @@ -1,202 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/initdef.h,v 1.4 2000/12/02 01:16:17 dawes Exp $ */ - -#define ULONG unsigned long -#define USHORT unsigned short -#define SHORT short -#define UCHAR unsigned char -#define VOID void -#define BOOLEAN 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 - - Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis.cpp:1.5 xc/programs/Xserver/hw/xfree86/drivers/sis/sis.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis.cpp:1.5 Mon Dec 11 15:18:26 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis.cpp Mon Jun 4 12:41:04 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.cpp,v 1.5 2000/12/11 20:18:26 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SIS __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -sis \- SiS video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsis\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B sis -is an XFree86 driver for SiS video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B sis -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h:1.19 xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h:1.22 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h:1.19 Fri Dec 1 20:16:17 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis.h Wed May 16 09:43:17 2001 @@ -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.22 2001/05/16 13:43:17 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 @@ 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,30 +123,32 @@ 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; Bool DGAactive; int DGAViewportStatus; Bool NoAccel; + Bool NoXvideo; Bool HWCursor; Bool UsePCIRetry; Bool TurboQueue; - int ForceCRT2Type; + int ForceCRT2Type; Bool ValidWidth; Bool FastVram; int VBFlags; @@ -174,96 +174,64 @@ 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; -} 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); + XF86VideoAdaptorPtr adaptor; + ScreenBlockHandlerProcPtr BlockHandler; -extern Bool SISSwitchMode(int scrnIndex, DisplayModePtr mode, int flags); -extern void SISAdjustFrame(int scrnIndex, int x, int y, int flags); + OptionInfoPtr Options; -#ifdef XF86DRI -extern void FillPrivateDRI(SISPtr pSIS, SISDRIPtr pSISDRI); -extern Bool SISDRIScreenInit(ScreenPtr pScreen); -extern void SISDRICloseScreen(ScreenPtr pScreen); -Bool SISDRIFinishScreenInit(ScreenPtr pScreen); -#endif +} SISRec, *SISPtr; #endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man:1.3 --- /dev/null Mon Jun 4 12:41:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis.man Thu Apr 19 08:40:33 2001 @@ -0,0 +1,30 @@ +.\" $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__ +.SH NAME +sis \- SiS video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qsis\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B sis +is an XFree86 driver for SiS video cards. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B sis +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c:1.5 Wed Dec 13 21:51:40 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c Thu Apr 19 08:40:33 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.5 2000/12/14 02:51:40 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.c,v 1.7 2001/04/19 12:40:33 alanh Exp $ */ /* * @@ -14,22 +14,14 @@ #define DEBUG #endif -#include <xf86.h> -#include <xf86_OSproc.h> -#include <xf86_ansic.h> -#include <xf86_libc.h> +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86PciInfo.h" +#include "xf86Pci.h" +#include "compiler.h" +#include "xaa.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" @@ -37,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, @@ -85,188 +79,194 @@ 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 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 - if (Avail.y2 < 0) Avail.y2 = 32767; +#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 - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Frame Buffer From (%d,%d) To (%d,%d)\n", - Avail.x1, Avail.y1, Avail.x2, Avail.y2); + /* 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 - xf86InitFBManager(pScreen, &Avail); + /* 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)); + 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[] = @@ -313,199 +313,205 @@ 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; + 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)); + 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 + 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; + 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 + 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; + 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 + 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; + SISPtr pSiS = SISPTR(pScrn); + long dstbase; - PDEBUG(ErrorF("Subsequent SolidHorzVertLine(%d, %d, %d, %d)\n", - x, y, len, dir)); + 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 + 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 @@ -513,20 +519,21 @@ 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 @@ -534,47 +541,47 @@ int x1, int y1, int x2, int y2, int flags, int phase) { - SISPtr pSiS = SISPTR(pScrn); - long dstbase,miny,maxy; + 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)); + 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 + 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); + 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)); + 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) + 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 @@ -582,21 +589,21 @@ int patx, int paty, int x, int y, int w, int h) { - SISPtr pSiS = SISPTR(pScrn); - long dstbase; + 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 + 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 @@ -605,16 +612,16 @@ 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 @@ -622,22 +629,21 @@ int patx, int paty, int x, int y, int w, int h) { - SISPtr pSiS = SISPTR(pScrn); - long dstbase; + 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)); + 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 + dstbase = 0; + if (y >= 2048) { + dstbase = pSiS->scrnOffset * y; + y = 0; + } + SiSSetupDSTBase(dstbase) + SiSSetupDSTXY(x,y) + SiSSetupRect(w,h) + SiSDoCMD } static void @@ -645,48 +651,49 @@ 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 @@ -695,19 +702,20 @@ 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); - SiSSetupDSTBase(0) + PDEBUG(ErrorF("Setup ScreenToScreen ColorExp(0x%x,0x%x, 0x%x)\n", + fg, bg, rop)); + + 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 @@ -715,101 +723,119 @@ 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) -{ - 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 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; } 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; + SISPtr pSiS = SISPTR(pScrn); + int i; - SiSIdle - for (i=0x8200; i<=0x823c; i+=4) { - ErrorF("[%x] %0X \n", i, - MMIO_IN32(pSiS->IOBase,i)); - } - + SiSIdle + for (i=0x8200; i <= 0x823c; i += 4) { + ErrorF("[%x] %0X \n", i, + MMIO_IN32(pSiS->IOBase,i)); + } } +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h:1.2 Fri Dec 1 20:16:17 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis300_accel.h Thu Apr 19 08:40:33 2001 @@ -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 @@ #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 @@ if (CmdQueLen <= 0) SiSIdle;\ MMIO_OUT32(pSiS->IOBase, BR(12), ls);\ CmdQueLen --; - Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c:1.1 Sat Feb 12 15:45:33 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.c Thu Apr 19 08:40:33 2001 @@ -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 @@ /* fill out infoPtr here */ infoPtr->Flags = PIXMAP_CACHE | - OFFSCREEN_PIXMAPS | - LINEAR_FRAMEBUFFER; + OFFSCREEN_PIXMAPS | + LINEAR_FRAMEBUFFER; /* sync */ infoPtr->Sync = SiS2Sync; @@ -95,24 +88,24 @@ /* 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ #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 @@ sisSETCMD(pSiS->CommandReg); } #endif -void + +static void SiS2SubsequentScanlineCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int x, int y, int w, int h, int skipleft) { @@ -440,7 +434,7 @@ } -void +static void SiS2SubsequentColorExpandScanline(ScrnInfoPtr pScrn, int bufno) { @@ -458,13 +452,3 @@ sisBLTWAIT; pSiS->DstY++; } - - - - - - - - - - Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h:1.1 --- /dev/null Mon Jun 4 12:41:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis530_accel.h Thu Apr 19 08:45:22 2001 @@ -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); Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c:1.19 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c:1.19 Fri Dec 1 20:16:17 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_accel.c Thu Apr 19 08:40:33 2001 @@ -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 @@ 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 @@ 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 @@ static void SiSSetupForFillRectSolid(ScrnInfoPtr pScrn, int color, int rop, - unsigned int planemask) + unsigned int planemask) { SISPtr pSiS = SISPTR(pScrn); @@ -168,7 +157,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ */ 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 @@ /* 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 @@ */ 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 @@ 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 @@ 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 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 @@ sisSETLineErrorTerm((short)err); sisSETLineMajorCount((short)major); sisSETCMD(op); -/* SiSSync(pScrn);*/ +/* SiSSync(pScrn);*/ } @@ -462,20 +462,19 @@ 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); } - Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c:1.8 --- /dev/null Mon Jun 4 12:41:04 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.c Thu Apr 19 10:11:37 2001 @@ -0,0 +1,4563 @@ +/* $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" + +#include "sis.h" +#include "sis_regs.h" +#include "sis_bios.h" + + +UShort DRAMType[17][5]={{0x0C,0x0A,0x02,0x40,0x39},{0x0D,0x0A,0x01,0x40,0x48}, + {0x0C,0x09,0x02,0x20,0x35},{0x0D,0x09,0x01,0x20,0x44}, + {0x0C,0x08,0x02,0x10,0x31},{0x0D,0x08,0x01,0x10,0x40}, + {0x0C,0x0A,0x01,0x20,0x34},{0x0C,0x09,0x01,0x08,0x32}, + {0x0B,0x08,0x02,0x08,0x21},{0x0C,0x08,0x01,0x08,0x30}, + {0x0A,0x08,0x02,0x04,0x11},{0x0B,0x0A,0x01,0x10,0x28}, + {0x09,0x08,0x02,0x02,0x01},{0x0B,0x09,0x01,0x08,0x24}, + {0x0B,0x08,0x01,0x04,0x20},{0x0A,0x08,0x01,0x02,0x10}, + {0x09,0x08,0x01,0x01,0x00}}; + +UShort MDA_DAC[]={0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F, + 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x15,0x15,0x15,0x15,0x15,0x15,0x15,0x15, + 0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F,0x3F}; + +UShort CGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; + +UShort EGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x05,0x15, + 0x20,0x30,0x24,0x34,0x21,0x31,0x25,0x35, + 0x08,0x18,0x0C,0x1C,0x09,0x19,0x0D,0x1D, + 0x28,0x38,0x2C,0x3C,0x29,0x39,0x2D,0x3D, + 0x02,0x12,0x06,0x16,0x03,0x13,0x07,0x17, + 0x22,0x32,0x26,0x36,0x23,0x33,0x27,0x37, + 0x0A,0x1A,0x0E,0x1E,0x0B,0x1B,0x0F,0x1F, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F}; + +UShort VGA_DAC[]={0x00,0x10,0x04,0x14,0x01,0x11,0x09,0x15, + 0x2A,0x3A,0x2E,0x3E,0x2B,0x3B,0x2F,0x3F, + 0x00,0x05,0x08,0x0B,0x0E,0x11,0x14,0x18, + 0x1C,0x20,0x24,0x28,0x2D,0x32,0x38,0x3F, + + 0x00,0x10,0x1F,0x2F,0x3F,0x1F,0x27,0x2F, + 0x37,0x3F,0x2D,0x31,0x36,0x3A,0x3F,0x00, + 0x07,0x0E,0x15,0x1C,0x0E,0x11,0x15,0x18, + 0x1C,0x14,0x16,0x18,0x1A,0x1C,0x00,0x04, + 0x08,0x0C,0x10,0x08,0x0A,0x0C,0x0E,0x10, + 0x0B,0x0C,0x0D,0x0F,0x10}; + +UShort ModeIndex_640x480[] = {0x2E, 0x44, 0x45, 0x62}; +UShort ModeIndex_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); +} + +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; +} + +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 */ + } +} + +static void SetMiscRegs(ULong ROMAddr) +{ + UChar Miscdata; + + StandTable++; + Miscdata=*((UChar *)(ROMAddr+StandTable)); /* Get Misc from file */ + SetReg3(P3c2,Miscdata); /* Set Misc(3c2) */ +} + +static void SetCRTCRegs(ULong ROMAddr) +{ + UChar CRTCdata; + UShort i; + + CRTCdata=(UChar)GetReg1(P3d4,0x11); + CRTCdata=CRTCdata&0x7f; + SetReg1(P3d4,0x11,CRTCdata); /* Unlock CRTC */ + + for(i=0;i<=0x18;i++) { + StandTable++; + CRTCdata=*((UChar *)(ROMAddr+StandTable)); /* Get CRTC from file */ + SetReg1(P3d4,i,CRTCdata); /* Set CRTC(3d4) */ + } +} + +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); +} + +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); + } +} + +static void ClearExt1Regs() +{ + 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); + + 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); +} + +static void WaitVertical(void) +{ +#if 0 + UShort tempax,tempdx; + + tempdx=0x3da; + do { + tempax=GetReg2(tempdx); + } while(!(tempax&01)); + + do { + tempax=GetReg2(tempdx); + } while(!(tempax&01)); +#endif +} + +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); +} Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h:1.4 --- /dev/null Mon Jun 4 12:41:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_bios.h Thu Apr 19 10:11:37 2001 @@ -0,0 +1,208 @@ +/* $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); Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c:1.3 Fri Mar 31 15:13:36 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.c Mon May 7 17:59:07 2001 @@ -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.5 2001/05/07 21:59:07 tsi 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 @@ 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 @@ 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); + SISPtr pSiS = SISPTR(pScrn); - unsigned char x_preset = 0; - unsigned char y_preset = 0; + 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) - } + 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; + unsigned char f_red, f_green, f_blue; + unsigned char b_red, b_green, b_blue; - outw(VGA_SEQ_INDEX, 0x8605); + 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); + 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); + SISPtr pSiS = SISPTR(pScrn); - sis300SetCursorBGColor(bg) - sis300SetCursorFGColor(fg) - if (pSiS->VBFlags & CRT2_ENABLE) { - sis301SetCursorBGColor(bg) - sis301SetCursorFGColor(fg) - } + 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; - - outw(VGA_SEQ_INDEX, 0x8605); - - 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)); - - /* if set, store the bit [22] to SR3E */ - if (cursor_addr & 0x1000) { - outb(VGA_SEQ_INDEX, 0x3E); + SISPtr pSiS = SISPTR(pScrn); + int cursor_addr; + unsigned char temp; + + outw(VGA_SEQ_INDEX, 0x8605); + + 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)); + + /* 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,98 @@ static void SiS300LoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { - SISPtr pSiS = SISPTR(pScrn); - int cursor_addr; + 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) - } + 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 -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; -} -#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; - } + 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)); + return(xf86InitCursor(pScreen, infoPtr)); } - Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h:1.1 Sat Feb 12 15:45:34 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_cursor.h Thu Apr 19 08:40:33 2001 @@ -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; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c:1.18 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c:1.18 Sat Dec 2 10:30:50 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.c Thu Apr 19 08:40:33 2001 @@ -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" +#include "sis_bios.h" -static void SiSSave(ScrnInfoPtr pScrn, SISRegPtr sisReg); -static void SiSRestore(ScrnInfoPtr pScrn, SISRegPtr sisReg); +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 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 @@ int *out_sbit, int *out_scale) { - float f,x,y,t, error, min_error; - int n, dn, best_n=0, best_dn=0; + 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; - } + /* + * 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; + } - 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; - } + 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; + *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; - } - } + 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 @@ /*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 @@ 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 @@ 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; + SISPtr pSiS = SISPTR(pScrn); + unsigned char temp, temp1; - DisableBridge(pSiS->RelIO+0x30); - UnLockCRT2(pSiS->RelIO+0x30); + 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]); + /* 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]); - 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 */ + + 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); + EnableBridge(pSiS->RelIO+0x30); + LockCRT2(pSiS->RelIO+0x30); } static void @@ -677,16 +674,16 @@ 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 @@ LockCRT2(pSiS->RelIO+0x30); } + + unsigned int SiSddc1Read(ScrnInfoPtr pScrn) { @@ -737,8 +736,9 @@ /* 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 @@ 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 @@ 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); -} - -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 SiSMemBandWidth(ScrnInfoPtr pScrn) +{ + SISPtr pSiS = SISPTR(pScrn); + SISRegPtr pReg = &pSiS->ModeReg; + int bus = pSiS->BusWidth; int mclk = pSiS->MemClock; int bpp = pScrn->bitsPerPixel; - float magic, total; + 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 }; - if (pSiS->Chipset==PCI_CHIP_SIS300) - magic = magic300[bus/64]; - else - magic = magic630[bus/64]; - - 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 @@ 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 @@ 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; - - int i, j; + 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; - 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 @@ 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; + 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; + 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; + 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; + *High = 0x1F; } -static void +static void SiSThreshold(ScrnInfoPtr pScrn, DisplayModePtr mode, unsigned short *Low, unsigned short *High) { + return; } @@ -1187,65 +1201,66 @@ 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); + } } Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h:1.2 --- /dev/null Mon Jun 4 12:41:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dac.h Thu Apr 19 10:11:37 2001 @@ -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); + Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c:1.1 Mon Jun 26 06:26:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dga.c Thu Apr 19 08:40:33 2001 @@ -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_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 @@ SIS_FillRect, SIS_BlitRect, #if 0 - SIS_BlitTransRect + SIS_BlitTransRect, #else NULL #endif @@ -77,77 +78,79 @@ 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(!newmodes) { - xfree(modes); - return FALSE; - } - modes = newmodes; +#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; SECOND_PASS: - currentMode = modes + num; - num++; + 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->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 @@ 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 @@ ){ 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 @@ 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 @@ SISPtr pSIS = SISPTR(pScrn); if(pSIS->AccelInfoPtr) { - (*pSIS->AccelInfoPtr->Sync)(pScrn); + (*pSIS->AccelInfoPtr->Sync)(pScrn); } } @@ -246,14 +247,14 @@ SISPtr pSIS = SISPTR(pScrn); if(pSIS->AccelInfoPtr) { - int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; - int ydir = (srcy < dsty) ? -1 : 1; + 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); + (*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 @@ ){ SISPtr pSIS = SISPTR(pScrn); - *name = NULL; /* no special device */ + *name = NULL; /* no special device */ *mem = (unsigned char*)pSIS->FbAddress; *size = pSIS->FbMapSize; *offset = 0; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c:1.15.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c:1.8 Fri Dec 1 20:16:17 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c Tue May 22 17:25:44 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.8 2000/12/02 01:16:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.c,v 1.15.2.1 2001/05/22 21:25:44 dawes 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" + +#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); -#include "sis300_accel.h" +extern Bool drmSiSAgpInit(int driSubFD, int offset, int size); extern void GlxSetVisualConfigs( int nconfigs, @@ -37,20 +41,18 @@ 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); - -void SISLostContext(ScreenPtr pScreen); + RegionPtr prgnSrc, CARD32 index); static Bool SISInitVisualConfigs(ScreenPtr pScreen) @@ -76,16 +78,16 @@ case 32: numConfigs = (useZ16)?8:16; - if (!(pConfigs = (__GLXvisualConfig*)xnfcalloc(sizeof(__GLXvisualConfig), + if (!(pConfigs = (__GLXvisualConfig*)xcalloc(sizeof(__GLXvisualConfig), numConfigs))) { return FALSE; } - if (!(pSISConfigs = (SISConfigPrivPtr)xnfcalloc(sizeof(SISConfigPrivRec), + if (!(pSISConfigs = (SISConfigPrivPtr)xcalloc(sizeof(SISConfigPrivRec), numConfigs))) { xfree(pConfigs); return FALSE; } - if (!(pSISConfigPtrs = (SISConfigPrivPtr*)xnfcalloc(sizeof(SISConfigPrivPtr), + if (!(pSISConfigPtrs = (SISConfigPrivPtr*)xcalloc(sizeof(SISConfigPrivPtr), numConfigs))) { xfree(pConfigs); xfree(pSISConfigs); @@ -158,7 +160,7 @@ } if (i != numConfigs) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "[drm] Incorrect initialization of visuals\n"); + "[dri] Incorrect initialization of visuals. Disabling DRI.\n"); return FALSE; } break; @@ -186,7 +188,7 @@ if (!xf86LoaderCheckSymbol("drmAvailable")) return FALSE; if (!xf86LoaderCheckSymbol("DRIQueryVersion")) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "SISDRIScreenInit failed (libdri.a too old)\n"); + "[dri] SISDRIScreenInit failed (libdri.a too old)\n"); return FALSE; } @@ -194,9 +196,11 @@ { int major, minor, patch; DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 0 || patch < 0) { + if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "[drm] SISDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.0.x). Disabling DRI.\n", + "[dri] SISDRIScreenInit failed because of a version mismatch.\n" + "[dri] libDRI version is %d.%d.%d but version 4.0.x is needed.\n" + "[dri] Disabling DRI.\n", major, minor, patch); return FALSE; } @@ -210,9 +214,9 @@ 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,14 +243,15 @@ /* For now the mapping works by using a fixed size defined * in the SAREA header */ - if (sizeof(XF86DRISAREARec)+sizeof(SISSAREAPriv)>SAREA_MAX) { - ErrorF("Data does not fit in SAREA\n"); + if (sizeof(XF86DRISAREARec)+sizeof(SISSAREAPriv) > SAREA_MAX) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Data does not fit in SAREA\n"); return FALSE; } pDRIInfo->SAREASize = SAREA_MAX; #endif - if (!(pSISDRI = (SISDRIPtr)xnfcalloc(sizeof(SISDRIRec),1))) { + if (!(pSISDRI = (SISDRIPtr)xcalloc(sizeof(SISDRIRec),1))) { DRIDestroyInfoRec(pSIS->pDRIInfo); pSIS->pDRIInfo=0; return FALSE; @@ -263,6 +268,8 @@ pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; if (!DRIScreenInit(pScreen, pDRIInfo, &pSIS->drmSubFD)) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] DRIScreenInit failed. Disabling DRI.\n"); xfree(pDRIInfo->devPrivate); pDRIInfo->devPrivate=0; DRIDestroyInfoRec(pSIS->pDRIInfo); @@ -271,18 +278,40 @@ return FALSE; } +#if 000 + /* XXX Check DRM kernel version here */ + version = drmGetVersion(info->drmFD); + if (version) { + if (version->version_major != 1 || + version->version_minor < 0) { + /* incompatible drm version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] SISDRIScreenInit failed because of a version mismatch.\n" + "[dri] sis.o kernel module version is %d.%d.%d but version 1.0.x is needed.\n" + "[dri] Disabling the DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + drmFreeVersion(version); + R128DRICloseScreen(pScreen); + return FALSE; + } + drmFreeVersion(version); + } +#endif + 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{ @@ -300,7 +329,7 @@ xf86DrvMsg(pScreen->myNum, X_ERROR, "[drm] drmAgpEnable failed\n"); break; } - ErrorF("[drm] drmAgpEnabled succeeded\n"); + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] drmAgpEnabled succeeded\n"); if (drmAgpAlloc(pSIS->drmSubFD, AGP_SIZE, 0, NULL, &pSIS->agpHandle) < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, @@ -347,15 +376,15 @@ /* 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 @@ -369,7 +398,7 @@ SISDRICloseScreen(pScreen); return FALSE; } - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "visual configs initialized\n" ); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "[dri] visual configs initialized.\n" ); return TRUE; } @@ -394,9 +423,9 @@ if (pSIS->pVisualConfigsPriv) xfree(pSIS->pVisualConfigsPriv); if(pSIS->agpSize){ - ErrorF("Freeing agp memory\n"); + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Freeing agp memory\n"); drmAgpFree(pSIS->drmSubFD, pSIS->agpHandle); - ErrorF("releasing agp module\n"); + xf86DrvMsg(pScreen->myNum, X_INFO, "[drm] Releasing agp module\n"); drmAgpRelease(pSIS->drmSubFD); } } @@ -406,15 +435,15 @@ */ 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) { } @@ -470,8 +499,8 @@ 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); @@ -509,7 +538,7 @@ 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]; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h:1.2 Thu Aug 3 23:51:46 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h Wed May 16 09:43:17 2001 @@ -1,11 +1,11 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.2 2000/08/04 03:51:46 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_dri.h,v 1.6 2001/05/16 13:43:17 alanh Exp $ */ /* modified from tdfx_dri.h */ #ifndef _SIS_DRI_ #define _SIS_DRI_ -#include <xf86drm.h> +#include "xf86drm.h" #define SIS_MAX_DRAWABLES 256 #define SISIOMAPSIZE (64*1024) @@ -57,4 +57,13 @@ int dummy; } SISDRIContextRec, *SISDRIContextPtr; +#ifdef XFree86Server + +#include "screenint.h" + +Bool SISDRIScreenInit(ScreenPtr pScreen); +void SISDRICloseScreen(ScreenPtr pScreen); +Bool SISDRIFinishScreenInit(ScreenPtr pScreen); + +#endif #endif Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c:1.55.2.2 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c:1.64.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c:1.55.2.2 Tue Mar 13 12:08:24 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c Tue May 22 17:25:44 2001 @@ -25,9 +25,8 @@ * 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.55.2.2 2001/03/13 17:08:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.c,v 1.64.2.1 2001/05/22 21:25:44 dawes Exp $ */ - #include "fb.h" #include "xf1bpp.h" #include "xf4bpp.h" @@ -43,25 +42,26 @@ #include "xf86cmap.h" #include "vgaHW.h" #include "xf86RAC.h" +#include "shadowfb.h" +#include "vbe.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" -#ifdef XFreeXDGA #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" -#endif -#ifdef DPMSExtension #include "globals.h" #define DPMS_SERVER #include "extensions/dpms.h" -#endif #ifdef XvExtension #include "xf86xv.h" @@ -71,35 +71,51 @@ #ifdef XF86DRI #include "dri.h" #endif + -static void SISIdentify(int flags); -static Bool SISProbe(DriverPtr drv, int flags); -static Bool SISPreInit(ScrnInfoPtr pScrn, int flags); -static Bool SISScreenInit(int Index, ScreenPtr pScreen, int argc, - char **argv); -static Bool SISEnterVT(int scrnIndex, int flags); -static void SISLeaveVT(int scrnIndex, int flags); -static Bool SISCloseScreen(int scrnIndex, ScreenPtr pScreen); -static Bool SISSaveScreen(ScreenPtr pScreen, int mode); +/* 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); +const OptionInfoRec * 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. @@ -127,46 +143,45 @@ 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" }, -#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_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 } }; 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 }, -#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_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 } }; - 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", @@ -178,6 +193,7 @@ "XAAScreenIndex", "XAACopyROP", "XAAHelpPatternROP", + "XAAFillSolidRects", NULL }; @@ -203,6 +219,12 @@ NULL }; +static const char *shadowSymbols[] = { + "ShadowFBInit", + NULL +}; + + static const char *ddcSymbols[] = { "xf86PrintEDID", "xf86DoEDID_DDC1", @@ -235,6 +257,7 @@ "drmAgpGetMode", "drmAgpBase", "drmAgpSize", + "drmSiSAgpInit", NULL }; @@ -245,7 +268,7 @@ "DRICloseScreen", "DRIDestroyInfoRec", "DRIScreenInit", - "DRIDestroyInfoRec", + "DRIQueryVersion", "DRICreateInfoRec", "DRILock", "DRIUnlock", @@ -256,22 +279,23 @@ }; #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 }; @@ -285,10 +309,11 @@ 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,22 +349,21 @@ pScrn->driverPrivate = NULL; } -#ifdef DPMSExtension 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 ; @@ -363,48 +387,40 @@ /* 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 */ } -#endif /* 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); } @@ -442,7 +458,7 @@ */ if ((numDevSections = xf86MatchDevice(SIS_DRIVER_NAME, - &devSections)) <= 0) { + &devSections)) <= 0) { /* * There's no matching device section in the config file, so quit * now. @@ -474,8 +490,8 @@ } 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); @@ -491,8 +507,8 @@ 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; @@ -542,8 +558,19 @@ const char *Sym = NULL; int pix24flags; - if (flags & PROBE_DETECT) return FALSE; + vbeInfoPtr pVbe; + if (flags & PROBE_DETECT) { + if (xf86LoadSubModule(pScrn, "vbe")) { + int index = xf86GetEntityInfo(pScrn->entityList[0])->index; + if ((pVbe = VBEInit(NULL,index))) { + ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); + } + } + return TRUE; + } + /* * Note: This function is only called once at server startup, and * not at the start of each server generation. This means that @@ -573,7 +600,7 @@ 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; @@ -595,17 +622,17 @@ /* 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); } @@ -622,31 +649,75 @@ 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); @@ -667,7 +738,7 @@ return FALSE; } else { /* XXX check that weight returned is supported */ - ; + ; } } @@ -677,8 +748,8 @@ /* 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; } } @@ -702,54 +773,10 @@ if (pScrn->depth == 8) { 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 */ @@ -781,7 +808,7 @@ } xf86DrvMsg(pScrn->scrnIndex, from, "Linear framebuffer at 0x%lX\n", - (unsigned long)pSiS->FbAddress); + (unsigned long)pSiS->FbAddress); if (pSiS->pEnt->device->IOBase != 0) { /* @@ -795,75 +822,81 @@ } 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; /* @@ -894,7 +927,7 @@ 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, @@ -921,13 +954,13 @@ * 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); @@ -970,7 +1003,7 @@ case 32: mod = "fb"; Sym = "fbScreenInit"; - break; + break; } if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { @@ -998,6 +1031,15 @@ 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")) { @@ -1006,10 +1048,22 @@ } xf86LoaderReqSymLists(ddcSymbols, NULL); - /* Initialize DDC1 if possible */ -/* if (pSiS->ddc1Read) - xf86PrintEDID(xf86DoEDID_DDC1(pScrn->scrnIndex,vgaHWddc1SetSpeed,pSiS->ddc1Read ) ); */ + { + Bool ret; + if (xf86LoadSubModule(pScrn, "vbe")) { + if ((pVbe = VBEInit(NULL,pSiS->pEnt->index))) { + ret = xf86SetDDCproperties(pScrn, + xf86PrintEDID(vbeDoEDID(pVbe,NULL))); + vbeFree(pVbe); + } + } + } +#if 0 + if (!ret && pSiS->ddc1Read) + xf86SetDDCProperties(xf86PrintEDID(xf86DoEDID_DDC1( + pScrn->scrnIndex,vgaHWddc1SetSpeed,pSiS->ddc1Read ))); +#endif return TRUE; } @@ -1050,16 +1104,16 @@ * 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; @@ -1129,16 +1183,16 @@ 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", @@ -1147,27 +1201,23 @@ /* 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 * @@ -1196,18 +1246,16 @@ 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) { @@ -1218,7 +1266,10 @@ int ret; VisualPtr visual; unsigned long OnScreenSize; + int height, width, displayWidth; + unsigned char *FBStart; + /* * First get the ScrnInfoRec */ @@ -1226,7 +1277,7 @@ hwp = VGAHWPTR(pScrn); - hwp->MapSize = 0x10000; /* Standard 64k VGA window */ + hwp->MapSize = 0x10000; /* Standard 64k VGA window */ pSiS = SISPTR(pScrn); @@ -1242,12 +1293,9 @@ /* 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); @@ -1274,6 +1322,7 @@ */ miClearVisualTypes(); + /* Setup the visuals we support. */ /* @@ -1292,23 +1341,37 @@ 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 */ -#if 0 - SISLostContext(pScreen); -#endif + pSiS->directRenderingEnabled = SISDRIScreenInit(pScreen); + /* Force the initialization of the context */ #endif /* @@ -1318,27 +1381,29 @@ 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; } @@ -1348,10 +1413,7 @@ return FALSE; } - xf86SetBlackWhitePixels(pScreen); - SISDGAInit(pScreen); - if (pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; @@ -1369,8 +1431,12 @@ 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); @@ -1393,35 +1459,61 @@ 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); + } -#ifdef DPMSExtension xf86DPMSInit(pScreen, (DPMSSetProcPtr)SISDisplayPowerManagementSet, 0); -#endif #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" ); - } - } + if (!pSiS->NoXvideo) { + /* HW Xv for SiS630 */ + if (pSiS->Chipset == PCI_CHIP_SIS630) { + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using SiS630 HW Xv\n" ); + SISInitVideo(pScreen); + } + else { /* generic Xv */ + + XF86VideoAdaptorPtr *ptr; + int n; + + n = xf86XVListGenericAdaptors(pScrn, &ptr); + if (n) { + xf86XVScreenInit(pScreen, ptr, n); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Using 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); @@ -1435,17 +1527,13 @@ } #endif - if (pSiS->Chipset == PCI_CHIP_SIS630) { - SISInitVideo(pScreen); - } - pSiS->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = SISCloseScreen; pScreen->SaveScreen = SISSaveScreen; /* Report any unused options (only for the first generation) */ if (serverGeneration == 1) { - xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); } /* Turn on the screen now */ @@ -1461,25 +1549,20 @@ { 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]; @@ -1527,15 +1610,15 @@ 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; @@ -1544,7 +1627,7 @@ 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); } @@ -1566,33 +1649,30 @@ 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; } @@ -1610,23 +1690,22 @@ { 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 - } @@ -1654,7 +1733,7 @@ if (pScrn->vtSema) { if (pCursorInfo) pCursorInfo->HideCursor(pScrn); - SISRestore(pScrn); + SISRestore(pScrn); vgaHWLock(hwp); SISUnmapMem(pScrn); } @@ -1741,29 +1820,29 @@ 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) @@ -1772,35 +1851,35 @@ 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); Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h:1.3 Sun Jan 31 07:22:00 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h Mon Jun 4 12:41:05 2001 @@ -1,101 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_driver.h,v 1.3 1999/01/31 12:22:00 dawes Exp $ */ - -/* - * - * 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 the authors not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. The authors makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THE AUTHORS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE AUTHORS 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. - * - * Modified for Sis by Xavier Ducoin (xavier@rd.lectra.fr) - * - */ - - -/*#define DEBUG*/ - -#include "xf86_ansic.h" - -extern int SISchipset; - -extern Bool sisLinearSupport; /*linear addressing enable */ - -extern Bool sisUseMMIO; -extern unsigned char *sisMMIOBase; -extern unsigned int sisBLTPatternAddress; -extern int sisBLTPatternOffscreenSize; -extern Bool sisAvoidImageBLT; -extern unsigned char *sisBltDataWindow; - -extern Bool sisHWCursor; - -extern int sisAluConv[]; /* Map Alu to SIS ROP source data */ - -/* - * Definitions for IO access to 32 bit ports - */ -extern int sisReg32MMIO[]; -#define BR(x) sisReg32MMIO[x] - - -/* - * Forward definitions for the functions that make up the driver. See - * the definitions of these functions for the real scoop. - */ - -/* in sis_blitter.c */ -extern void sisBitBlt(); -extern void sisMMIOBitBlt(); - -/* in sis_BitBlt.c */ -extern void siscfbDoBitbltCopy(); -extern void siscfbFillBoxSolid(); - -/* in sis_solid.c */ -extern void siscfbFillRectSolid(); -extern void siscfbFillSolidSpansGeneral(); -extern void sisMMIOFillRectSolid(); -extern void sisMMIOFillSolidSpansGeneral(); - -/* in sis_blt16.c */ -extern RegionPtr siscfb16CopyArea(); -extern RegionPtr siscfb24CopyArea(); -extern void siscfbCopyWindow(); - -/* in sis_line.c */ -extern void sisMMIOLineSS(); -extern void sisMMIOSegmentSS(); - -/* in sis_pntwin.c */ -extern void sisPaintWindow(); - -/* in sis_FillRct.c */ -extern void siscfbPolyFillRect(); - -/* in ct_FillSt.c */ -extern void siscfbFillRectOpaqueStippled32(); -extern void siscfbFillRectTransparentStippled32(); -extern void sisMMIOFillRectOpaqueStippled32(); -extern void sisMMIOFillRectTransparentStippled32(); - -/* in sis_teblt8.c */ -extern void sisMMIOImageGlyphBlt(); -extern void sisMMIOPolyGlyphBlt(); - - - - - Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_lcd.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_lcd.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_lcd.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_lcd.h:1.1 Fri Mar 31 17:57:41 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_lcd.h Mon Jun 4 12:41:05 2001 @@ -1,121 +0,0 @@ -/* LCD PANEL 1024x768 1024x768x32bpp regs is not correct */ -/* No LCD PANEL 800x600 & 1280x1024 */ - - - - -static unsigned char Reg301_1_640_480_P1[] = { - 0x90, 0xD6, 0x47, 0x0B, 0x00, 0x00, 0x00, 0x50, - 0x7F, 0x30, 0x8C, 0xCC, 0x22, 0x4C, 0xF3, 0xDF, - 0xEA, 0x1C, 0x09, 0x20, 0x00, 0x00, 0x00, 0x01, - 0x03, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x4A, 0xBD, - 0x82}; -static unsigned char Reg301_1_640_480_P2[] = { - 0x3C, 0x36, 0x13, 0xFF, 0x13, 0x25, 0xFF, 0x0C, - 0x0C, 0x90, 0x40, 0x01, 0x0A, 0x06, 0x0D, 0x04, - 0x0A, 0x06, 0x14, 0x0D, 0x04, 0x0A, 0x00, 0x81, - 0x1B, 0x25, 0x60, 0x3F, 0x57, 0x45, 0xEC, 0x07, - 0x07, 0xA7, 0x70, 0x07, 0xEB, 0x24, 0xE2, 0x82, - 0x52, 0x33, 0xAA, 0x35, 0xFF, 0x58, 0x27, 0xFE, - 0xB4, 0x21, 0xED, 0x8A, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x92, 0x8F, 0x40, 0x60, 0x80, 0x14, 0x90, - 0x8C, 0x60, 0x14, 0x50, 0x00, 0x54}; -static unsigned char Reg301_1_640_480_P3[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x80, 0xF6, 0xBF, 0x20, 0x00, 0x40, - 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, - 0x00, 0x00, 0x00, 0x24, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x22, 0x02, 0x00, 0x00}; -static unsigned char Reg301_1_640_480_P4[] = { - 0x01, 0x01, 0x01, 0x31, 0x00, 0x00, 0x00, 0xFF, - 0x7F, 0x55, 0x5A, 0x64, 0x00, 0x1E, 0x0A, 0x0F, - 0x80, 0x00, 0x08, 0x05, 0x0C, 0x19, 0x7F, 0xEE, - 0x32, 0x20, 0x80, 0x00}; - - -static unsigned char Reg301_1_800_600_P1[] = { - 0x90, 0xD6, 0x47, 0x0D, 0x00, 0x00, 0x00, 0x64, - 0xFF, 0x30, 0x2C, 0x64, 0x33, 0xD4, 0x70, 0x57, - 0x64, 0x26, 0x12, 0x20, 0x00, 0x00, 0x00, 0x01, - 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x5E, 0x7F, - 0x91}; -static unsigned char Reg301_1_800_600_P2[] = { - 0x3C, 0x36, 0x13, 0xFF, 0x13, 0x25, 0xFF, 0x0C, - 0x0C, 0x90, 0x40, 0x01, 0x0A, 0x06, 0x0D, 0x04, - 0x0A, 0x06, 0x14, 0x0D, 0x04, 0x0A, 0x00, 0x81, - 0x1B, 0x25, 0x60, 0x3F, 0x57, 0x45, 0xEC, 0x07, - 0x07, 0xA7, 0x70, 0x07, 0xEB, 0x24, 0xE2, 0x82, - 0x52, 0x33, 0xAA, 0x35, 0xFF, 0x58, 0xBF, 0xFE, - 0xB4, 0x21, 0xED, 0x8A, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x92, 0x8F, 0x40, 0x60, 0x80, 0x14, 0x90, - 0x8C, 0x60, 0x14, 0x50, 0x00, 0x59}; -static unsigned char Reg301_1_800_600_P3[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x80, 0xF6, 0xBF, 0x20, 0x00, 0x40, - 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, - 0x00, 0x00, 0x00, 0x24, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x22, 0x02, 0x00, 0x00}; -static unsigned char Reg301_1_800_600_P4[] = { - 0x01, 0x01, 0x01, 0x31, 0x00, 0x00, 0x00, 0xFF, - 0x7F, 0x55, 0x5A, 0x64, 0x00, 0x1E, 0x0A, 0x0F, - 0x80, 0x00, 0x08, 0x19, 0x2A, 0x1A, 0xFF, 0x6B, - 0x32, 0x30, 0x20, 0x00}; - - -static unsigned char Reg301_1_1024_768_P1[] = { - 0x90, 0xD6, 0x47, 0x11, 0x00, 0x00, 0x00, 0x80, - 0x3F, 0x50, 0x0C, 0x5C, 0x44, 0xFC, 0x25, 0xFF, - 0x13, 0x36, 0x13, 0x20, 0x00, 0x00, 0x00, 0x01, - 0x03, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0xC7, 0x8F, - 0x81}; -static unsigned char Reg301_1_1024_768_P2[] = { - 0x3C, 0x36, 0x13, 0xFF, 0x13, 0x25, 0xFF, 0x0C, - 0x0C, 0x90, 0x40, 0x01, 0x0A, 0x06, 0x0D, 0x04, - 0x0A, 0x06, 0x14, 0x0D, 0x04, 0x0A, 0x00, 0x81, - 0x1B, 0x25, 0x60, 0x3F, 0x57, 0x45, 0xEC, 0x07, - 0x07, 0xA7, 0x70, 0x07, 0xEB, 0x24, 0xE2, 0x82, - 0x52, 0x33, 0xAA, 0x35, 0xFF, 0x58, 0x3F, 0xFE, - 0xB5, 0x21, 0xED, 0x8A, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x92, 0x8F, 0x40, 0x60, 0x80, 0x14, 0x90, - 0x8C, 0x60, 0x14, 0x50, 0x00, 0x60}; -static unsigned char Reg301_1_1024_768_P3[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x40, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x01, 0x80, 0xF6, 0xBF, 0x20, 0x00, 0x40, - 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x50, - 0x00, 0x00, 0x00, 0x24, 0x00, 0x01, 0x00, 0x00, - 0x00, 0x42, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x1A, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x22, 0x02, 0x00, 0x00}; -static unsigned char Reg301_1_1024_768_P4[] = { - 0x01, 0x01, 0x01, 0x31, 0x00, 0x00, 0x00, 0xFF, - 0x7F, 0x55, 0x5A, 0x64, 0x00, 0x1E, 0x6A, 0x0F, - 0x80, 0x00, 0x08, 0x01, 0x01, 0x2B, 0x3F, 0x20, - 0x32, 0x40, 0x00, 0x00}; - - - - -typedef struct _SiS301Reg { - CARD8 *VBPart1; - CARD8 *VBPart2; - CARD8 *VBPart3; - CARD8 *VBPart4; -} SiS301RegRec, SiS301RegPtr; - -SiS301RegRec sis301_PANEL_1024[] = { - {Reg301_1_640_480_P1, Reg301_1_640_480_P2, - Reg301_1_640_480_P3, Reg301_1_640_480_P4}, - {Reg301_1_800_600_P1, Reg301_1_800_600_P2, - Reg301_1_800_600_P3, Reg301_1_800_600_P4}, - {Reg301_1_1024_768_P1, Reg301_1_1024_768_P2, - Reg301_1_1024_768_P3, Reg301_1_1024_768_P4}}; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c:1.4 Fri Dec 1 20:16:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_opt.c Wed May 16 09:43:17 2001 @@ -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.7 2001/05/16 13:43:17 alanh Exp $ */ #include "xf86.h" +#include "xf86PciInfo.h" #include "sis.h" @@ -13,98 +14,188 @@ OPTION_TURBOQUEUE, OPTION_FAST_VRAM, OPTION_SET_MEMCLOCK, - OPTION_FORCE_CRT2TYPE + OPTION_FORCE_CRT2TYPE, + OPTION_SHADOW_FB, + OPTION_ROTATE, + OPTION_NOXVIDEO } 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 } +static const 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 }, + { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_ROTATE, "Rotate", OPTV_ANYSTR, {0}, FALSE }, + { OPTION_NOXVIDEO, "NoXvideo", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } }; +void SiSOptions(ScrnInfoPtr pScrn); +const OptionInfoRec * 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 */ + if (!(pSiS->Options = xalloc(sizeof(SISOptions)))) + return; + memcpy(pSiS->Options, SISOptions, sizeof(SISOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pSiS->Options); + + /* initalize some defaults */ + pSiS->FastVram = TRUE; + pSiS->UsePCIRetry = TRUE; + pSiS->TurboQueue = TRUE; + pSiS->HWCursor = TRUE; + pSiS->Rotate = FALSE; + pSiS->ShadowFB = FALSE; + pSiS->NoXvideo = 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(pSiS->Options, 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(pSiS->Options, OPTION_HW_CURSOR, &pSiS->HWCursor)) { + from = X_CONFIG; + } + if (xf86ReturnOptValBool(pSiS->Options, 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(pSiS->Options, OPTION_NOACCEL, FALSE)) { + pSiS->NoAccel = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); + } + + /* PCI retry */ + from = X_DEFAULT; + if (xf86GetOptValBool(pSiS->Options, OPTION_PCI_RETRY, &pSiS->UsePCIRetry)) { + from = X_CONFIG; + } + xf86DrvMsg(pScrn->scrnIndex, from, "PCI retry %s\n", + pSiS->UsePCIRetry ? "enabled" : "disabled"); + + /* Mem clock */ + if (xf86GetOptValFreq(pSiS->Options, 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(pSiS->Options, 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(pSiS->Options, 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(pSiS->Options, 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(pSiS->Options, 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"); + xf86DrvMsg(pScrn->scrnIndex, from, + "Using \"Shadow Frame Buffer\" - acceleration disabled\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"); - } -/* 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(pSiS->Options, 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"); + } + } + + /* NOXvideo */ + if (xf86ReturnOptValBool(pSiS->Options, OPTION_NOXVIDEO, FALSE)) { + pSiS->NoXvideo = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "XVideo Extension Disabled\n"); + } + } -OptionInfoPtr +const OptionInfoRec * SISAvailableOptions(int chipid, int busid) { return SISOptions; } - Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h:1.14 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h:1.14 Fri Dec 1 20:16:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h Thu Apr 19 08:40:33 2001 @@ -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 $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs.h,v 1.15 2001/04/19 12:40:33 alanh 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) +#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 @@ * Modified for Sis by Xavier Ducoin (xavier@rd.lectra.fr) */ +#define sisLEFT2RIGHT 0x10 +#define sisRIGHT2LEFT 0x00 +#define sisTOP2BOTTOM 0x20 +#define sisBOTTOM2TOP 0x00 + +#define sisSRCSYSTEM 0x03 +#define sisSRCVIDEO 0x02 +#define sisSRCFG 0x01 +#define sisSRCBG 0x00 + +#define sisCMDBLT 0x0000 +#define sisCMDBLTMSK 0x0100 +#define sisCMDCOLEXP 0x0200 +#define sisCMDLINE 0x0300 + +#define sisCMDENHCOLEXP 0x2000 + +#define sisXINCREASE 0x10 +#define sisYINCREASE 0x20 +#define sisCLIPENABL 0x40 +#define sisCLIPINTRN 0x80 +#define sisCLIPEXTRN 0x00 + + +#define sisPATREG 0x08 +#define sisPATFG 0x04 +#define sisPATBG 0x00 -#define sisLEFT2RIGHT 0x10 -#define sisRIGHT2LEFT 0x00 -#define sisTOP2BOTTOM 0x20 -#define sisBOTTOM2TOP 0x00 - -#define sisSRCSYSTEM 0x03 -#define sisSRCVIDEO 0x02 -#define sisSRCFG 0x01 -#define sisSRCBG 0x00 - -#define sisCMDBLT 0x0000 -#define sisCMDBLTMSK 0x0100 -#define sisCMDCOLEXP 0x0200 -#define sisCMDLINE 0x0300 - -#define sisCMDENHCOLEXP 0x2000 - -#define sisXINCREASE 0x10 -#define sisYINCREASE 0x20 -#define sisCLIPENABL 0x40 -#define sisCLIPINTRN 0x80 -#define sisCLIPEXTRN 0x00 - - -#define sisPATREG 0x08 -#define sisPATFG 0x04 -#define sisPATBG 0x00 +#define sisLASTPIX 0x0800 +#define sisXMAJOR 0x0400 -#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 @@ #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 @@ *(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 Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs2.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs2.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs2.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs2.h:1.3 Sat Feb 12 15:45:36 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_regs2.h Mon Jun 4 12:41:05 2001 @@ -1,199 +0,0 @@ -/* - * 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/sis_regs2.h,v 1.3 2000/02/12 20:45:36 dawes 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); - Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c:1.3 Thu Nov 9 06:32:22 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_setup.c Thu Apr 19 08:40:33 2001 @@ -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.3 2000/11/09 11:32:22 alanh 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,133 +39,124 @@ #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" -#ifdef XFreeXDGA #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" -#endif -#ifdef DPMSExtension #include "globals.h" #define DPMS_SERVER #include "extensions/dpms.h" -#endif + +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)->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)->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; + } } Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c:1.2 --- /dev/null Mon Jun 4 12:41:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.c Thu Apr 19 10:11:37 2001 @@ -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++; + } +} Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.h:1.2 --- /dev/null Mon Jun 4 12:41:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_shadow.h Thu Apr 19 10:11:37 2001 @@ -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); Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_tv.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_tv.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_tv.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_tv.h:1.1 Fri Mar 31 17:57:41 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_tv.h Mon Jun 4 12:41:05 2001 @@ -1,158 +0,0 @@ -/* No AVIDEO interface Regs */ -/* No SCART interface Regs */ -/* No Hi-Vision TV Regs */ - -typedef struct _SiS301Reg { - CARD8 *VBPart1; - CARD8 *VBPart2; - CARD8 *VBPart3; - CARD8 *VBPart4; -} SiS301RegRec, SiS301RegPtr; - -/* NTSC 640x480 */ -static unsigned char Reg301_0_640_480_P1[] = { - 0x90, 0xF6, 0x49, 0x0B, 0x00, 0x00, 0x00, 0x50, - 0x43, 0x30, 0x8C, 0xBD, 0x22, 0x1F, 0x0A, 0xDF, - 0xF5, 0x18, 0x0A, 0x08, 0x00, 0x00, 0x00, 0x21, - 0x03, 0xF0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x61, 0x61, - 0x12}; -static unsigned char Reg301_0_640_480_P2[] = { - 0x38, 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, 0xB3, 0x99, 0x06, 0xEC, 0x4A, - 0x17, 0x88, 0x10, 0x4B, 0xA5, 0x30, 0xE2, 0x3C, - 0x62, 0xD3, 0x4A, 0x65, 0x9D, 0xF8, 0x14, 0xDA, - 0x13, 0x21, 0xED, 0x8A, 0x08, 0xF1, 0x05, 0x1F, - 0x16, 0x92, 0x8F, 0x40, 0x60, 0x80, 0x14, 0x90, - 0x8C, 0x60, 0x14, 0x50, 0x21, 0x50}; -static unsigned char Reg301_0_640_480_P3[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0xF6, 0xBF, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static unsigned char Reg301_0_640_480_P4[] = { - 0x01, 0x01, 0x01, 0x07, 0x00, 0x00, 0x00, 0xFF, - 0x7F, 0x55, 0x52, 0x2A, 0x40, 0x1F, 0x8A, 0x0F, - 0x80, 0x00, 0x08, 0x4C, 0x8F, 0x1A, 0x43, 0x0A, - 0xE0, 0x40, 0x5D, 0x18}; - - -/* NTSC 800x600 */ -static unsigned char Reg301_0_800_600_P1[] = { - 0x90, 0xF6, 0x49, 0x0D, 0x00, 0x00, 0x00, 0x64, - 0x1F, 0x40, 0x2C, 0x6C, 0x33, 0xEC, 0x82, 0x57, - 0x6D, 0x20, 0x12, 0x08, 0x00, 0x00, 0x00, 0x21, - 0x03, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0xB5, 0x65, - 0x92}; -static unsigned char Reg301_0_800_600_P2[] = { - 0x38, 0x17, 0x1D, 0x03, 0x09, 0x05, 0x06, 0x0C, - 0x0C, 0x94, 0xC9, 0x01, 0x0A, 0x06, 0x0D, 0x04, - 0x0A, 0x06, 0x14, 0x0D, 0x04, 0x0A, 0x00, 0x85, - 0x1B, 0x0C, 0x50, 0xB3, 0x99, 0x06, 0xEC, 0x4A, - 0x17, 0x88, 0x10, 0x4B, 0xA5, 0x30, 0xE2, 0x3C, - 0x62, 0xD3, 0x4A, 0x65, 0x9D, 0xF8, 0x14, 0xDA, - 0x13, 0x21, 0xED, 0x8A, 0x08, 0xF4, 0x10, 0x1C, - 0x00, 0x92, 0x8F, 0x40, 0x60, 0x80, 0x14, 0x90, - 0x8C, 0x60, 0x14, 0x50, 0x29, 0x54}; -static unsigned char Reg301_0_800_600_P3[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0xF6, 0xBF, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; -static unsigned char Reg301_0_800_600_P4[] = { - 0x01, 0x01, 0x01, 0x07, 0x00, 0x00, 0x00, 0xFF, - 0x7F, 0x55, 0x52, 0x2A, 0x40, 0x1F, 0x8A, 0x0F, - 0x80, 0x00, 0x08, 0x78, 0x8F, 0x22, 0x1F, 0x82, - 0x20, 0x52, 0x74, 0x5E}; - - -/* PAL 640x480 */ -static unsigned char Reg301_1_640_480_P1[] = { - 0x90, 0xF6, 0x49, 0x0B, 0x00, 0x00, 0x00, 0x50, - 0x4F, 0x30, 0x8C, 0xC0, 0x22, 0x28, 0x0F, 0xDF, - 0xF8, 0x1C, 0x0A, 0x08, 0x00, 0x00, 0x00, 0x21, - 0x03, 0xF0, 0x00, 0x00, 0x20, 0x00, 0x02, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x33, 0x2D, - 0x91}; -static unsigned char Reg301_1_640_480_P2[] = { - 0x28, 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, 0xBF, 0x97, 0x06, 0xD7, 0x5D, - 0x17, 0x88, 0x70, 0x45, 0xA5, 0x30, 0xE8, 0x48, - 0x62, 0xDD, 0x00, 0x68, 0xB0, 0x8B, 0x2D, 0x07, - 0x53, 0x2A, 0x05, 0xD3, 0x00, 0xF5, 0xFB, 0x1B, - 0x2A, 0x92, 0x8F, 0x40, 0x60, 0x80, 0x14, 0x90, - 0x8C, 0x60, 0x14, 0x63, 0x21, 0x50}; -static unsigned char Reg301_1_640_480_P3[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xFA, 0xC8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00}; -static unsigned char Reg301_1_640_480_P4[] = { - 0x01, 0x01, 0x01, 0x07, 0x00, 0x00, 0x00, 0xFF, - 0x7F, 0x55, 0x52, 0x2A, 0x40, 0x1F, 0x8A, 0x0F, - 0x80, 0x00, 0x08, 0x04, 0x09, 0x1A, 0x4F, 0x0F, - 0x32, 0x30, 0x9F, 0x66}; - - -/* PAL 800x600 */ -static unsigned char Reg301_1_800_600_P1[] = { - 0x90, 0xF6, 0x49, 0x0D, 0x00, 0x00, 0x00, 0x64, - 0x23, 0x40, 0x2C, 0x6D, 0x33, 0xEF, 0x87, 0x57, - 0x70, 0x24, 0x12, 0x08, 0x00, 0x00, 0x00, 0x21, - 0x03, 0x30, 0x00, 0x00, 0x20, 0x00, 0x02, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x27, 0x75, - 0x82}; -static unsigned char Reg301_1_800_600_P2[] = { - 0x28, 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, 0xBF, 0x97, 0x06, 0xD7, 0x5D, - 0x17, 0x88, 0x70, 0x45, 0xA5, 0x30, 0xE8, 0x48, - 0x62, 0xDD, 0x00, 0x68, 0xB0, 0x8B, 0x2D, 0x07, - 0x53, 0x2A, 0x05, 0xD3, 0x00, 0xEB, 0x05, 0x25, - 0x16, 0x92, 0x8F, 0x40, 0x60, 0x80, 0x14, 0x90, - 0x8C, 0x60, 0x14, 0x63, 0x29, 0x54}; -static unsigned char Reg301_1_800_600_P3[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xFA, 0xC8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00}; -static unsigned char Reg301_1_800_600_P4[] = { - 0x01, 0x01, 0x01, 0x07, 0x00, 0x00, 0x00, 0xFF, - 0x7F, 0x55, 0x52, 0x2A, 0x40, 0x1F, 0x8A, 0x0F, - 0x80, 0x00, 0x08, 0x19, 0x24, 0x22, 0x23, 0x87, - 0xD6, 0x41, 0x87, 0x3F}; - - -SiS301RegRec sis301_NTSC[] = { - {Reg301_0_640_480_P1, Reg301_0_640_480_P2, - Reg301_0_640_480_P3, Reg301_0_640_480_P4}, - {Reg301_0_800_600_P1, Reg301_0_800_600_P2, - Reg301_0_800_600_P3, Reg301_0_800_600_P4}}; - -SiS301RegRec sis301_PAL[] = { - {Reg301_1_640_480_P1, Reg301_1_640_480_P2, - Reg301_1_640_480_P3, Reg301_1_640_480_P4}, - {Reg301_1_800_600_P1, Reg301_1_800_600_P2, - Reg301_1_800_600_P3, Reg301_1_800_600_P4}}; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c:1.2 Fri Dec 1 20:16:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.c Thu Apr 19 08:40:33 2001 @@ -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, 0x31, temp); - if (temp & 0x01) - pSiS->VBFlags |= TV_PAL; - else - pSiS->VBFlags |= TV_NTSC; + 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; } 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; Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h:1.3 Fri Dec 1 20:16:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vb.h Thu Apr 19 08:40:33 2001 @@ -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); Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c:1.6 Fri Dec 1 20:16:18 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vga.c Thu Apr 19 08:40:33 2001 @@ -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 @@ 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; + /* 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 */ + /* Set vclk */ if (compute_vclk(clock, &num, &denum, &div, &sbit, &scale)) { switch (pSiS->Chipset) { case PCI_CHIP_SIS5597: @@ -218,7 +215,7 @@ pReg->sisRegs3C4[ClockBase] |= 0x40; else pReg->sisRegs3C4[ClockBase] &= 0xBF; - + break; } } @@ -249,10 +246,10 @@ } } /* 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 @@ 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 @@ 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 @@ /* 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; + 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_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 @@ 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; - outw(VGA_SEQ_INDEX, 0x8605); + (*pSiS->SiSSave)(pScrn, pReg); - pReg->sisRegs3C4[6] &= ~GENMASK(4:2); + outw(VGA_SEQ_INDEX, 0x8605); - switch (pScrn->bitsPerPixel) { + pReg->sisRegs3C4[6] &= ~GENMASK(4:2); + + 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; + 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[0x10] = - ((mode->CrtcHDisplay *((pScrn->bitsPerPixel+7)/8) + 63) >> 6)+1; + 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; - /* Enable Linear */ - pReg->sisRegs3C4[0x20] |= 0x81; + pReg->sisRegs3C4[0x10] = + ((mode->CrtcHDisplay *((pScrn->bitsPerPixel+7)/8) + 63) >> 6)+1; + /* Enable Linear */ + pReg->sisRegs3C4[0x20] |= 0x81; - /* Set vclk */ + /* 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; + } } Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c:1.1 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c:1.1 Fri Dec 1 20:16:19 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_video.c Wed May 16 09:43:17 2001 @@ -24,7 +24,7 @@ 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.3 2001/05/16 13:43:17 alanh Exp $ */ /* * sis_video.c: SIS Xv driver. Based on the mga Xv driver by Mark Vojkovich @@ -54,44 +54,43 @@ #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 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; + 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); + 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,35 @@ XF86VideoAdaptorPtr *adaptors, *newAdaptors = NULL; XF86VideoAdaptorPtr newAdaptor = NULL; int num_adaptors; - - if (pScrn->bitsPerPixel != 8) - { - newAdaptor = SISSetupImageVideo(pScreen); + + if (pScrn->bitsPerPixel != 8) { + 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 { + /* need to free this someplace */ + newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + memcpy(newAdaptors, adaptors, num_adaptors * + sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } } + } if(num_adaptors) xf86XVScreenInit(pScreen, adaptors, num_adaptors); if(newAdaptors) - xfree(newAdaptors); + xfree(newAdaptors); } @@ -279,94 +277,94 @@ 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]; - - 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; - - RegionRec clip; - CARD32 colorKey; - - CARD32 videoStatus; - Time offTime; - Time freeTime; + FBAreaPtr fbAreaPtr; + int fbSize; + CARD32 bufAddr[2]; + + 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; + + RegionRec clip; + CARD32 colorKey; + + CARD32 videoStatus; + Time offTime; + Time freeTime; - CARD32 displayMode; + CARD32 displayMode; } SISPortPrivRec, *SISPortPrivPtr; #define GET_PORT_PRIVATE(pScrn) \ @@ -378,59 +376,59 @@ { 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 +442,9 @@ 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 +523,22 @@ 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 +556,18 @@ 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 +583,13 @@ 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 +623,139 @@ 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 +787,132 @@ static void set_format(SISPtr pSIS, SISOverlayPtr pOverlay) { - CARD8 fmt; + 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); + 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); - - /* 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_Max ,(CARD8)b); - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Green_Max ,(CARD8)g); - setvideoreg(pSIS, Index_VI_Overlay_ColorKey_Red_Max ,(CARD8)r); + 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_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; + 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)); - 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 */ + 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 +1072,10 @@ 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 +1133,14 @@ /* 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 +1160,17 @@ /* 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 +1199,28 @@ *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 +1245,24 @@ 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; + } } } } Index: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vidregs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vidregs.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vidregs.h:removed --- xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vidregs.h:1.2 Mon Dec 4 13:50:01 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vidregs.h Mon Jun 4 12:41:05 2001 @@ -1,156 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sis/sis_vidregs.h,v 1.2 2000/12/04 18:50:01 dawes Exp $ */ - -#ifndef SISREG_H -#define SISREG_H - -/* 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 - -#endif /* SISREG_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/sunbw2/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/drivers/sunbw2/Imakefile:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/sunbw2/Imakefile:1.1 Fri Jun 30 13:15:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunbw2/Imakefile Tue Jan 23 19:06:28 2001 @@ -1,7 +1,7 @@ XCOMM XCOMM This is an Imakefile for the bw2 driver. XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/Imakefile,v 1.1 2000/06/30 17:15:13 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/Imakefile,v 1.2 2001/01/24 00:06:28 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -31,7 +31,6 @@ InstallObjectModule(sunbw2,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(sunbw2,) InstallModuleManPage(sunbw2) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c:1.2 Sat Dec 2 10:30:52 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c Fri May 4 15:05:45 2001 @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c,v 1.2 2000/12/02 15:30:52 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/bw2_driver.c,v 1.3 2001/05/04 19:05:45 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -34,7 +34,7 @@ #include "xf86cmap.h" #include "bw2.h" -static OptionInfoPtr BW2AvailableOptions(int chipid, int busid); +static const OptionInfoRec * BW2AvailableOptions(int chipid, int busid); static void BW2Identify(int flags); static Bool BW2Probe(DriverPtr drv, int flags); static Bool BW2PreInit(ScrnInfoPtr pScrn, int flags); @@ -82,7 +82,7 @@ 0 }; -static OptionInfoRec BW2Options[] = { +static const OptionInfoRec BW2Options[] = { { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -164,8 +164,7 @@ return; } -static -OptionInfoPtr +static const OptionInfoRec * BW2AvailableOptions(int chipid, int busid) { return BW2Options; Index: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.cpp:1.2 xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.cpp:1.2 Mon Dec 11 15:18:27 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.cpp Mon Jun 4 12:41:05 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.cpp,v 1.2 2000/12/11 20:18:27 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SUNBW2 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -sunbw2 \- BW2 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsunbw2\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B sunbw2 -is an XFree86 driver for Sun BW2 video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B sunbw2 -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com> Index: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.man:1.2 --- /dev/null Mon Jun 4 12:41:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.man Sat Jan 27 13:20:53 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunbw2/sunbw2.man,v 1.2 2001/01/27 18:20:53 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH SUNBW2 __drivermansuffix__ __vendorversion__ +.SH NAME +sunbw2 \- BW2 video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qsunbw2\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B sunbw2 +is an XFree86 driver for Sun BW2 video cards. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B sunbw2 +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Jakub Jelinek <jakub@redhat.com> Index: xc/programs/Xserver/hw/xfree86/drivers/suncg14/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg14/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/drivers/suncg14/Imakefile:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/suncg14/Imakefile:1.1 Fri Jun 30 13:15:14 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg14/Imakefile Wed May 16 02:48:10 2001 @@ -1,7 +1,7 @@ XCOMM XCOMM This is an Imakefile for the cg14 driver. XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/Imakefile,v 1.1 2000/06/30 17:15:14 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/Imakefile,v 1.3 2001/05/16 06:48:10 keithp Exp $ #define IHaveModules #include <Server.tmpl> @@ -13,8 +13,8 @@ INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ - -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ - -I$(SERVERSRC)/Xext -I$(SERVERSRC)/cfb \ + -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/Xext -I$(SERVERSRC)/render \ -I$(XF86SRC)/ramdac \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(EXTINCSRC) @@ -31,7 +31,6 @@ InstallObjectModule(suncg14,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(suncg14,) InstallModuleManPage(suncg14) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h:1.1 Fri Jun 30 13:15:14 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h Fri May 4 15:05:45 2001 @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h,v 1.1 2000/06/30 17:15:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14.h,v 1.3 2001/05/04 19:05:45 dawes Exp $ */ #ifndef CG14_H #define CG14_H @@ -60,12 +60,15 @@ int height; sbusDevicePtr psdp; CloseScreenProcPtr CloseScreen; + OptionInfoPtr Options; } Cg14Rec, *Cg14Ptr; #define GET_CG14_FROM_SCRN(p) ((Cg14Ptr)((p)->driverPrivate)) -#ifdef linux +/* + * This should match corresponding definition in Solaris's + * '/usr/include/sys/cg14io.h'. + */ #define CG14_SET_PIXELMODE (('M' << 8) | 3) -#endif #endif /* CG14_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c:1.2 Sat Dec 2 10:30:53 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c Wed May 16 02:48:10 2001 @@ -20,9 +20,8 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c,v 1.2 2000/12/02 15:30:53 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/cg14_driver.c,v 1.4 2001/05/16 06:48:10 keithp Exp $ */ -#define PSZ 8 #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -31,13 +30,11 @@ #include "mibstore.h" #include "micmap.h" -#include "cfb.h" -#undef PSZ -#include "cfb32.h" +#include "fb.h" #include "xf86cmap.h" #include "cg14.h" -static OptionInfoPtr CG14AvailableOptions(int chipid, int busid); +static const OptionInfoRec * CG14AvailableOptions(int chipid, int busid); static void CG14Identify(int flags); static Bool CG14Probe(DriverPtr drv, int flags); static Bool CG14PreInit(ScrnInfoPtr pScrn, int flags); @@ -87,7 +84,7 @@ 0 }; -static OptionInfoRec CG14Options[] = { +static const OptionInfoRec CG14Options[] = { { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -169,8 +166,7 @@ return; } -static -OptionInfoPtr +static const OptionInfoRec * CG14AvailableOptions(int chipid, int busid) { return CG14Options; @@ -346,7 +342,10 @@ /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, CG14Options); + if (!(pCg14->Options = xalloc(sizeof(CG14Options)))) + return FALSE; + memcpy(pCg14->Options, CG14Options, sizeof(CG14Options)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pCg14->Options); /* * This must happen after pScrn->display has been set because @@ -385,7 +384,7 @@ } } - if (xf86LoadSubModule(pScrn, "cfb32") == NULL) { + if (xf86LoadSubModule(pScrn, "fb") == NULL) { CG14FreeRec(pScrn); return FALSE; } @@ -465,18 +464,24 @@ pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; + miSetPixmapDepths (); + /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. */ CG14InitCplane24(pScrn); - ret = cfb32ScreenInit(pScreen, pCg14->fb, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->virtualX); + ret = fbScreenInit(pScreen, pCg14->fb, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->virtualX, pScrn->bitsPerPixel); if (!ret) return FALSE; + +#ifdef RENDER + fbPictureInit (pScreen, 0, 0); +#endif miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.cpp:1.2 xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.cpp:1.2 Mon Dec 11 15:18:29 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.cpp Mon Jun 4 12:41:05 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.cpp,v 1.2 2000/12/11 20:18:29 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SUNCG14 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -suncg14 \- CG14 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsuncg14\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B suncg14 -is an XFree86 driver for Sun CG14 video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B suncg14 -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com> Index: xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.man:1.2 --- /dev/null Mon Jun 4 12:41:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.man Sat Jan 27 13:20:53 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg14/suncg14.man,v 1.2 2001/01/27 18:20:53 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH SUNCG14 __drivermansuffix__ __vendorversion__ +.SH NAME +suncg14 \- CG14 video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qsuncg14\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B suncg14 +is an XFree86 driver for Sun CG14 video cards. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B suncg14 +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Jakub Jelinek <jakub@redhat.com> Index: xc/programs/Xserver/hw/xfree86/drivers/suncg3/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg3/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/drivers/suncg3/Imakefile:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/suncg3/Imakefile:1.1 Fri Jun 30 13:15:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg3/Imakefile Wed May 16 02:48:10 2001 @@ -1,7 +1,7 @@ XCOMM XCOMM This is an Imakefile for the cg3 driver. XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg3/Imakefile,v 1.1 2000/06/30 17:15:15 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg3/Imakefile,v 1.3 2001/05/16 06:48:10 keithp Exp $ #define IHaveModules #include <Server.tmpl> @@ -13,8 +13,8 @@ INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ - -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ - -I$(SERVERSRC)/Xext -I$(SERVERSRC)/cfb \ + -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/Xext -I$(SERVERSRC)/render \ -I$(XF86SRC)/ramdac \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(EXTINCSRC) @@ -31,7 +31,6 @@ InstallObjectModule(suncg3,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(suncg3,) InstallModuleManPage(suncg3) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c:1.2 Sat Dec 2 10:30:54 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c Wed May 16 02:48:10 2001 @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c,v 1.2 2000/12/02 15:30:54 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg3/cg3_driver.c,v 1.4 2001/05/16 06:48:10 keithp Exp $ */ #define PSZ 8 #include "xf86.h" @@ -31,11 +31,11 @@ #include "mibstore.h" #include "micmap.h" -#include "cfb.h" +#include "fb.h" #include "xf86cmap.h" #include "cg3.h" -static OptionInfoPtr CG3AvailableOptions(int chipid, int busid); +static const OptionInfoRec * CG3AvailableOptions(int chipid, int busid); static void CG3Identify(int flags); static Bool CG3Probe(DriverPtr drv, int flags); static Bool CG3PreInit(ScrnInfoPtr pScrn, int flags); @@ -83,7 +83,7 @@ 0 }; -static OptionInfoRec CG3Options[] = { +static const OptionInfoRec CG3Options[] = { { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -165,8 +165,7 @@ return; } -static -OptionInfoPtr +static const OptionInfoRec * CG3AvailableOptions(int chipid, int busid) { return CG3Options; @@ -356,7 +355,7 @@ /* Set the bits per RGB for 8bpp mode */ from = X_DEFAULT; - if (xf86LoadSubModule(pScrn, "cfb") == NULL) { + if (xf86LoadSubModule(pScrn, "fb") == NULL) { CG3FreeRec(pScrn); return FALSE; } @@ -436,16 +435,22 @@ pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; + miSetPixmapDepths (); + /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. */ - ret = cfbScreenInit(pScreen, pCg3->fb, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->virtualX); + ret = fbScreenInit(pScreen, pCg3->fb, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->virtualX, 8); if (!ret) return FALSE; + +#ifdef RENDER + fbPictureInit (pScreen, 0, 0); +#endif miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.cpp:1.2 xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.cpp:1.2 Mon Dec 11 15:18:31 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.cpp Mon Jun 4 12:41:05 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.cpp,v 1.2 2000/12/11 20:18:31 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SUNCG3 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -suncg3 \- CG3 video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsuncg3\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B suncg3 -is an XFree86 driver for Sun CG3 video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B suncg3 -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com> Index: xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.man:1.2 --- /dev/null Mon Jun 4 12:41:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.man Sat Jan 27 13:20:54 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg3/suncg3.man,v 1.2 2001/01/27 18:20:54 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH SUNCG3 __drivermansuffix__ __vendorversion__ +.SH NAME +suncg3 \- CG3 video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qsuncg3\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B suncg3 +is an XFree86 driver for Sun CG3 video cards. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B suncg3 +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Jakub Jelinek <jakub@redhat.com> Index: xc/programs/Xserver/hw/xfree86/drivers/suncg6/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg6/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/drivers/suncg6/Imakefile:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/suncg6/Imakefile:1.2 Fri Jun 30 13:15:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg6/Imakefile Wed May 16 02:48:11 2001 @@ -1,7 +1,7 @@ XCOMM XCOMM This is an Imakefile for the cg6 driver. XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/Imakefile,v 1.2 2000/06/30 17:15:15 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/Imakefile,v 1.4 2001/05/16 06:48:11 keithp Exp $ #define IHaveModules #include <Server.tmpl> @@ -13,8 +13,8 @@ INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ - -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ - -I$(SERVERSRC)/Xext -I$(SERVERSRC)/cfb \ + -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/Xext -I$(SERVERSRC)/render \ -I$(XF86SRC)/ramdac \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(EXTINCSRC) @@ -31,7 +31,6 @@ InstallObjectModule(suncg6,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(suncg6,) InstallModuleManPage(suncg6) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6.h diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6.h:1.2 xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6.h:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6.h:1.2 Fri Jun 30 13:15:15 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6.h Fri May 4 15:05:45 2001 @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6.h,v 1.2 2000/06/30 17:15:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6.h,v 1.3 2001/05/04 19:05:45 dawes Exp $ */ #ifndef CG6_H #define CG6_H @@ -72,6 +72,7 @@ unsigned int CursorXY; int CursorBg, CursorFg; Bool CursorEnabled; + OptionInfoPtr Options; } Cg6Rec, *Cg6Ptr; extern int Cg6ScreenPrivateIndex; Index: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c:1.4 Sat Dec 2 10:30:54 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c Wed May 16 02:48:11 2001 @@ -20,9 +20,8 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c,v 1.4 2000/12/02 15:30:54 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/cg6_driver.c,v 1.6 2001/05/16 06:48:11 keithp Exp $ */ -#define PSZ 8 #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -31,11 +30,11 @@ #include "mibstore.h" #include "micmap.h" -#include "cfb.h" +#include "fb.h" #include "xf86cmap.h" #include "cg6.h" -static OptionInfoPtr CG6AvailableOptions(int chipid, int busid); +static const OptionInfoRec * CG6AvailableOptions(int chipid, int busid); static void CG6Identify(int flags); static Bool CG6Probe(DriverPtr drv, int flags); static Bool CG6PreInit(ScrnInfoPtr pScrn, int flags); @@ -89,7 +88,7 @@ OPTION_NOACCEL } CG6Opts; -static OptionInfoRec CG6Options[] = { +static const OptionInfoRec CG6Options[] = { { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, @@ -174,8 +173,7 @@ return; } -static -OptionInfoPtr +static const OptionInfoRec * CG6AvailableOptions(int chipid, int busid) { return CG6Options; @@ -350,7 +348,10 @@ /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, CG6Options); + if (!(pCg6->Options = xalloc(sizeof(CG6Options)))) + return FALSE; + memcpy(pCg6->Options, CG6Options, sizeof(CG6Options)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pCg6->Options); if (!xf86SetDefaultVisual(pScrn, -1)) return FALSE; @@ -373,9 +374,9 @@ /* determine whether we use hardware or software cursor */ pCg6->HWCursor = TRUE; - if (xf86GetOptValBool(CG6Options, OPTION_HW_CURSOR, &pCg6->HWCursor)) + if (xf86GetOptValBool(pCg6->Options, OPTION_HW_CURSOR, &pCg6->HWCursor)) from = X_CONFIG; - if (xf86ReturnOptValBool(CG6Options, OPTION_SW_CURSOR, FALSE)) { + if (xf86ReturnOptValBool(pCg6->Options, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pCg6->HWCursor = FALSE; } @@ -383,12 +384,12 @@ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pCg6->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(CG6Options, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pCg6->Options, OPTION_NOACCEL, FALSE)) { pCg6->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } - if (xf86LoadSubModule(pScrn, "cfb") == NULL) { + if (xf86LoadSubModule(pScrn, "fb") == NULL) { CG6FreeRec(pScrn); return FALSE; } @@ -477,16 +478,22 @@ pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; + miSetPixmapDepths (); + /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. */ - ret = cfbScreenInit(pScreen, pCg6->fb, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->virtualX); + ret = fbScreenInit(pScreen, pCg6->fb, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->virtualX, 8); if (!ret) return FALSE; + +#ifdef RENDER + fbPictureInit (pScreen, 0, 0); +#endif miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.cpp:1.3 xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.cpp:1.3 Mon Dec 11 15:18:32 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.cpp Mon Jun 4 12:41:05 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.cpp,v 1.3 2000/12/11 20:18:32 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SUNCG6 __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -suncg6 \- GX/Turbo GX video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsuncg6\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B suncg6 -is an XFree86 driver for Sun GX and Turbo GX (also known as cgsix) video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B suncg6 -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com> Index: xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.man:1.2 --- /dev/null Mon Jun 4 12:41:05 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.man Sat Jan 27 13:20:54 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suncg6/suncg6.man,v 1.2 2001/01/27 18:20:54 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH SUNCG6 __drivermansuffix__ __vendorversion__ +.SH NAME +suncg6 \- GX/Turbo GX video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qsuncg6\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B suncg6 +is an XFree86 driver for Sun GX and Turbo GX (also known as cgsix) video cards. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B suncg6 +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Jakub Jelinek <jakub@redhat.com> Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile:1.4 xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile:1.4 Mon Jun 26 19:46:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile Sat Mar 3 17:41:34 2001 @@ -1,7 +1,7 @@ XCOMM XCOMM This is an Imakefile for the ffb driver. XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile,v 1.4 2000/06/26 23:46:13 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/Imakefile,v 1.6 2001/03/03 22:41:34 tsi Exp $ #define IHaveModules #include <Server.tmpl> @@ -19,27 +19,36 @@ ASVISOPTION = AsVISOption GCCVISOPTION = -Wa,$(ASVISOPTION) #if AsOutputArchSize == 32 -#define FFBCObjectRule(name) @@\ -name.o: name.c @@\ - ObjectCompile(-mv8 -mtune=ultrasparc $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) @@\ - dd if=/dev/zero bs=1 count=3 | dd of=$@ bs=1 count=3 seek=36 conv=notrunc @@\ - echo -e '\002' | dd of=$@ bs=1 count=1 seek=19 conv=notrunc @@\ - @@\ -name.i: name.c @@\ - CPPOnlyCompile(name.c,-mv8 $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) @@\ - @@\ -CenterLoadTarget(debug_src,name.c,NullParameter,$(ALLDEFINES) -mv8 $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) -#define FFBsObjectRule(name) @@\ -name.o: name.s @@\ - $(RM) $@ @@\ - $(CPP) $*.s | $(AS) $(ASVISOPTION) -o $@ - @@\ - dd if=/dev/zero bs=1 count=3 | dd of=$@ bs=1 count=3 seek=36 conv=notrunc @@\ - echo -e '\002' | dd of=$@ bs=1 count=1 seek=19 conv=notrunc +#define FFBCObjectRule(name) @@\ +name.o: name.c @@\ + ObjectCompile(-mv8 -mtune=ultrasparc \ + $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) @@\ + dd if=/dev/zero bs=1 count=3 2>/dev/null | \ + dd of=$@ bs=1 count=3 seek=36 conv=notrunc 2>/dev/null @@\ + dd if=/dev/zero bs=1 count=1 2>/dev/null | \ + tr '\000' '\002' | \ + dd of=$@ bs=1 count=1 seek=19 conv=notrunc 2>/dev/null @@\ + @@\ +name.i: name.c @@\ + CPPOnlyCompile(name.c,-mv8 \ + $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) @@\ + @@\ +CenterLoadTarget(debug_src,name.c,NullParameter,$(ALLDEFINES) -mv8 \ + $(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) +#define FFBsObjectRule(name) @@\ +name.o: name.s @@\ + $(RM) $@ @@\ + $(CPP) $*.s | $(AS) $(ASVISOPTION) -o $@ - @@\ + dd if=/dev/zero bs=1 count=3 2>/dev/null | \ + dd of=$@ bs=1 count=3 seek=36 conv=notrunc 2>/dev/null @@\ + dd if=/dev/zero bs=1 count=1 2>/dev/null | \ + tr '\000' '\002' | \ + dd of=$@ bs=1 count=1 seek=19 conv=notrunc 2>/dev/null #else #define FFBCObjectRule(name) SpecialCObjectRule(name,,$(GCCVISOPTION) $(VISOPTIONS) $(DRIDEFINES)) -#define FFBsObjectRule(name) @@\ -name.o: name.s @@\ - $(RM) $@ @@\ +#define FFBsObjectRule(name) @@\ +name.o: name.s @@\ + $(RM) $@ @@\ $(CPP) $*.s | $(AS) $(ASVISOPTION) -o $@ - #endif #else @@ -50,16 +59,17 @@ #define FFBsObjectRule(name) #endif -SRCS = ffb_driver.c ffb_accel.c ffb_attr.c ffb_stip.c ffb_bcopy.c ffb_cplane.c \ - ffb_fspans.c ffb_point.c ffb_seg.c ffb_plygon.c ffb_line.c ffb_glyph.c \ - ffb_frect.c ffb_circle.c ffb_checks.c ffb_stubs.c ffb_gc.c \ - ffb_gspans.c ffb_sspans.c ffb_zeroarc.c ffb_cursor.c ffb_dga.c ffb_dac.c \ - ffb_wid.c ffb_dbe.c $(DRISRCS) -OBJS = ffb_driver.o ffb_accel.o ffb_attr.o ffb_stip.o ffb_bcopy.o ffb_cplane.o \ - ffb_fspans.o ffb_point.o ffb_seg.o ffb_plygon.o ffb_line.o ffb_glyph.o \ - ffb_frect.o ffb_circle.o ffb_checks.o ffb_stubs.o ffb_gc.o \ - ffb_gspans.o ffb_sspans.o ffb_zeroarc.o ffb_cursor.o ffb_dga.o ffb_dac.o \ - ffb_wid.o ffb_dbe.o $(VISOBJS) $(DRIOBJS) +SRCS = ffb_driver.c ffb_accel.c ffb_attr.c ffb_stip.c ffb_bcopy.c \ + ffb_cplane.c ffb_fspans.c ffb_point.c ffb_seg.c ffb_plygon.c \ + ffb_line.c ffb_glyph.c ffb_frect.c ffb_circle.c ffb_checks.c \ + ffb_stubs.c ffb_gc.c ffb_gspans.c ffb_sspans.c ffb_zeroarc.c \ + ffb_cursor.c ffb_dga.c ffb_dac.c ffb_wid.c ffb_dbe.c $(DRISRCS) +OBJS = ffb_driver.o ffb_accel.o ffb_attr.o ffb_stip.o ffb_bcopy.o \ + ffb_cplane.o ffb_fspans.o ffb_point.o ffb_seg.o ffb_plygon.o \ + ffb_line.o ffb_glyph.o ffb_frect.o ffb_circle.o ffb_checks.o \ + ffb_stubs.o ffb_gc.o ffb_gspans.o ffb_sspans.o ffb_zeroarc.o \ + ffb_cursor.o ffb_dga.o ffb_dac.o ffb_wid.o ffb_dbe.o $(VISOBJS) \ + $(DRIOBJS) #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -88,7 +98,6 @@ InstallObjectModule(sunffb,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(sunffb,) InstallModuleManPage(sunffb) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h:1.5 Thu Nov 30 19:24:34 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h Fri May 4 15:05:46 2001 @@ -24,7 +24,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h,v 1.5 2000/12/01 00:24:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb.h,v 1.7 2001/05/04 19:05:46 dawes Exp $ */ #ifndef FFB_H #define FFB_H @@ -212,6 +212,8 @@ Bool dri_enabled; ffb_dri_state_t *pFfbSarea; #endif + + OptionInfoPtr Options; } FFBRec, *FFBPtr; /* Acceleration */ @@ -289,8 +291,6 @@ #undef DEBUG_FFB #ifdef DEBUG_FFB - -#include <stdio.h> extern FILE *FDEBUG_FD; Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c:1.4 Thu Nov 30 19:24:34 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c Sat Mar 3 17:41:34 2001 @@ -24,10 +24,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c,v 1.4 2000/12/01 00:24:34 dawes Exp $ */ - -#include <asm/types.h> -#include <math.h> +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_accel.c,v 1.5 2001/03/03 22:41:34 tsi Exp $ */ #include "scrnintstr.h" #include "pixmapstr.h" Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c:1.2 Fri Jun 30 13:15:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c Thu Apr 5 13:42:33 2001 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c,v 1.2 2000/06/30 17:15:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.c,v 1.3 2001/04/05 17:42:33 dawes Exp $ */ #include "ffb.h" #include "ffb_rcache.h" @@ -348,6 +348,9 @@ unsigned int did, manuf_rev, partnum; char *device; + /* Fetch kernel WID. */ + p->kernel_wid = *((volatile unsigned char *)pFfb->dfb8x); + /* For AFB, assume it is PAC2 which also implies not having * the inverted cursor control attribute. */ @@ -425,7 +428,9 @@ restore_kernel_xchannel(FFBPtr pFfb) { ffb_fbcPtr ffb = pFfb->regs; - unsigned int fbc, ppc, ppc_mask, drawop; + unsigned int fbc, ppc, ppc_mask, drawop, wid; + + wid = pFfb->dac_info.kernel_wid; if (pFfb->has_double_buffer) fbc = FFB_FBC_WB_AB; @@ -443,7 +448,7 @@ FFB_ATTR_RAW(pFfb, ppc, ppc_mask, ~0, (FFB_ROP_EDIT_BIT | GXcopy)|(FFB_ROP_NEW<<8), - drawop, 0x0, fbc, 0xff); + drawop, 0x0, fbc, wid); FFBFifo(pFfb, 4); FFB_WRITE64(&ffb->by, 0, 0); Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h:1.1 Tue May 23 00:47:44 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h Thu Apr 5 13:42:33 2001 @@ -21,7 +21,7 @@ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h,v 1.1 2000/05/23 04:47:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dac.h,v 1.2 2001/04/05 17:42:33 dawes Exp $ */ #ifndef _FFB_DAC_H #define _FFB_DAC_H @@ -346,6 +346,8 @@ #define FFB_DAC_PAC1 0x00000001 /* Pacifica1 DAC, BT9068 */ #define FFB_DAC_PAC2 0x00000002 /* Pacifica2 DAC, BT498 */ #define FFB_DAC_ICURCTL 0x00000004 /* Inverted CUR_CTRL bits */ + + unsigned int kernel_wid; /* These registers need to be modified when changing DAC * timing state, so at init time we capture their values. Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c:1.4 Fri Jun 23 19:43:44 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c Wed May 2 11:06:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c,v 1.4 2000/06/23 23:43:44 alanh Exp $ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_dri.c,v 1.9 2001/05/02 15:06:10 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 @@ 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); @@ -215,6 +215,20 @@ return FALSE; } + /* Check the DRI version */ + { + int major, minor, patch; + DRIQueryVersion(&major, &minor, &patch); + if (major != 4 || minor < 0) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] FFBDRIScreenInit failed because of a version mismatch.\n" + "[dri] libDRI version is %d.%d.%d but version, 4.0.x is needed.\n" + "[dri] Disabling DRI.\n", + major, minor, patch); + return FALSE; + } + } + pDRIInfo = DRICreateInfoRec(); if (pDRIInfo == NULL) return FALSE; @@ -241,7 +255,7 @@ 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; @@ -260,11 +274,38 @@ /* Our InitBuffers depends heavily on this setting. */ pDRIInfo->bufferRequests = DRI_3D_WINDOWS_ONLY; + pDRIInfo->createDummyCtx = TRUE; + pDRIInfo->createDummyCtxPriv = FALSE; + if (!DRIScreenInit(pScreen, pDRIInfo, &(pFfb->drmSubFD))) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] DRIScreenInit failed. Disabling DRI.\n"); DRIDestroyInfoRec(pFfb->pDRIInfo); xfree(pFfbDRI); return FALSE; } + +#if 000 /* XXX this should be cleaned up and used */ + /* Check the ffb DRM version */ + version = drmGetVersion(info->drmFD); + if (version) { + if (version->version_major != 1 || + version->version_minor < 0) { + /* incompatible drm version */ + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] FFBDRIScreenInit failed because of a version mismatch.\n" + "[dri] ffb.o kernel module version is %d.%d.%d but version 1.0.x is needed.\n" + "[dri] Disabling the DRI.\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + drmFreeVersion(version); + R128DRICloseScreen(pScreen); + return FALSE; + } + drmFreeVersion(version); + } +#endif pFfb->pFfbSarea = DRIGetSAREAPrivate(pScreen); init_ffb_sarea(pFfb, pFfb->pFfbSarea); Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c:1.7 xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c:1.7 Sat Dec 2 10:30:54 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c Fri May 4 15:05:46 2001 @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c,v 1.7 2000/12/02 15:30:54 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_driver.c,v 1.9 2001/05/04 19:05:46 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -40,7 +40,7 @@ #include "ffb.h" -static OptionInfoPtr FFBAvailableOptions(int chipid, int busid); +static const OptionInfoRec * FFBAvailableOptions(int chipid, int busid); static void FFBIdentify(int flags); static Bool FFBProbe(DriverPtr drv, int flags); static Bool FFBPreInit(ScrnInfoPtr pScrn, int flags); @@ -97,7 +97,7 @@ OPTION_NOACCEL } FFBOpts; -static OptionInfoRec FFBOptions[] = { +static const OptionInfoRec FFBOptions[] = { { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, @@ -182,8 +182,7 @@ return; } -static -OptionInfoPtr +static const OptionInfoRec * FFBAvailableOptions(int chipid, int busid) { return FFBOptions; @@ -358,7 +357,10 @@ /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, FFBOptions); + if (!(pFfb->Options = xalloc(sizeof(FFBOptions)))) + return FALSE; + memcpy(pFfb->Options, FFBOptions, sizeof(FFBOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pFfb->Options); /* * This must happen after pScrn->display has been set because @@ -394,9 +396,9 @@ /* determine whether we use hardware or software cursor */ pFfb->HWCursor = TRUE; - if (xf86GetOptValBool(FFBOptions, OPTION_HW_CURSOR, &pFfb->HWCursor)) + if (xf86GetOptValBool(pFfb->Options, OPTION_HW_CURSOR, &pFfb->HWCursor)) from = X_CONFIG; - if (xf86ReturnOptValBool(FFBOptions, OPTION_SW_CURSOR, FALSE)) { + if (xf86ReturnOptValBool(pFfb->Options, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pFfb->HWCursor = FALSE; } @@ -404,7 +406,7 @@ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pFfb->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(FFBOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pFfb->Options, OPTION_NOACCEL, FALSE)) { pFfb->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } @@ -818,7 +820,8 @@ return FALSE; #ifdef XF86DRI - if (pFfb->ffb_type != afb_m3 && pFfb->ffb_type != afb_m6) { + if (pFfb->ffb_type != afb_m3 && pFfb->ffb_type != afb_m6 && + pFfb->NoAccel == FALSE) { pFfb->dri_enabled = FFBDRIScreenInit(pScreen); if (pFfb->dri_enabled == TRUE) xf86Msg(X_INFO, "%s: DRM initialized\n", @@ -912,7 +915,8 @@ return FALSE; /* Setup DGA support. */ - FFB_InitDGA(pScreen); + if (!pFfb->NoAccel) + FFB_InitDGA(pScreen); #ifdef XF86DRI if (pFfb->dri_enabled) { Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c:1.2 Tue May 23 00:47:44 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c Thu Apr 5 13:42:33 2001 @@ -24,7 +24,7 @@ * USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c,v 1.2 2000/05/23 04:47:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_frect.c,v 1.3 2001/04/05 17:42:33 dawes Exp $ */ #include "ffb.h" #include "ffb_regs.h" @@ -451,7 +451,7 @@ CreatorBoxFillPage(pFfb, nBox, pBox); pFfb->rp_active = 1; - FFBSync(pFfb, ffb); + FFBSync(pFfb, pFfb->regs); } static void Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c:1.2 Tue May 23 00:47:45 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c Sat Mar 3 17:41:34 2001 @@ -23,11 +23,10 @@ * IN THE SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c,v 1.2 2000/05/23 04:47:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/ffb_wline.c,v 1.3 2001/03/03 22:41:34 tsi Exp $ */ #define PSZ 32 -#include <math.h> #include "ffb.h" #include "ffb_regs.h" #include "ffb_rcache.h" Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.cpp:1.3 xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.cpp:1.3 Mon Dec 11 15:18:33 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.cpp Mon Jun 4 12:41:06 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.cpp,v 1.3 2000/12/11 20:18:33 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH FFB __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -ffb \- SUNFFB video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsunffb\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B ffb -is an XFree86 driver for Sun Creator, Creator 3D and Elite 3D video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B ffb -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com>, David S. Miller <davem@redhat.com>, Michal Rehacek <majkl@iname.com> Index: xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.man:1.2 --- /dev/null Mon Jun 4 12:41:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.man Sat Jan 27 13:20:54 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunffb/sunffb.man,v 1.2 2001/01/27 18:20:54 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH FFB __drivermansuffix__ __vendorversion__ +.SH NAME +ffb \- SUNFFB video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qsunffb\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B ffb +is an XFree86 driver for Sun Creator, Creator 3D and Elite 3D video cards. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B ffb +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Jakub Jelinek <jakub@redhat.com>, David S. Miller <davem@redhat.com>, Michal Rehacek <majkl@iname.com> Index: xc/programs/Xserver/hw/xfree86/drivers/sunleo/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/sunleo/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/drivers/sunleo/Imakefile:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/sunleo/Imakefile:1.1 Thu May 18 19:21:38 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/Imakefile Fri May 18 12:03:13 2001 @@ -1,7 +1,7 @@ XCOMM XCOMM This is an Imakefile for the leo driver. XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/Imakefile,v 1.1 2000/05/18 23:21:38 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/Imakefile,v 1.4 2001/05/18 16:03:13 tsi Exp $ #define IHaveModules #include <Server.tmpl> @@ -35,7 +35,6 @@ InstallObjectModule(sunleo,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(sunleo,) InstallModuleManPage(sunleo) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h diff -u xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h:1.3 Thu Nov 30 19:24:35 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h Fri May 4 15:05:46 2001 @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h,v 1.3 2000/12/01 00:24:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo.h,v 1.4 2001/05/04 19:05:46 dawes Exp $ */ #ifndef LEO_H #define LEO_H @@ -82,6 +82,7 @@ xf86CursorInfoPtr CursorInfoRec; unsigned char CursorShiftX, CursorShiftY; unsigned char *CursorData; + OptionInfoPtr Options; } LeoRec, *LeoPtr; extern int LeoScreenPrivateIndex; Index: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c:1.2 Thu Nov 30 19:24:35 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c Sat Mar 3 17:41:34 2001 @@ -20,11 +20,9 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c,v 1.2 2000/12/01 00:24:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_accel.c,v 1.3 2001/03/03 22:41:34 tsi Exp $ */ #define PSZ 32 -#include <asm/types.h> -#include <math.h> #include "scrnintstr.h" #include "pixmapstr.h" Index: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c:1.4 xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c:1.4 Sat Dec 2 10:30:56 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c Fri May 18 12:03:13 2001 @@ -21,7 +21,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c,v 1.4 2000/12/02 15:30:56 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/leo_driver.c,v 1.7 2001/05/18 16:03:13 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -37,7 +37,7 @@ #include "xf86cmap.h" #include "leo.h" -static OptionInfoPtr LeoAvailableOptions(int chipid, int busid); +static const OptionInfoRec * LeoAvailableOptions(int chipid, int busid); static void LeoIdentify(int flags); static Bool LeoProbe(DriverPtr drv, int flags); static Bool LeoPreInit(ScrnInfoPtr pScrn, int flags); @@ -91,7 +91,7 @@ OPTION_NOACCEL } LeoOpts; -static OptionInfoRec LeoOptions[] = { +static const OptionInfoRec LeoOptions[] = { { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, @@ -176,8 +176,7 @@ return; } -static -OptionInfoPtr +static const OptionInfoRec * LeoAvailableOptions(int chipid, int busid) { return LeoOptions; @@ -352,7 +351,10 @@ /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, LeoOptions); + if (!(pLeo->Options = xalloc(sizeof(LeoOptions)))) + return FALSE; + memcpy(pLeo->Options, LeoOptions, sizeof(LeoOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pLeo->Options); /* * This must happen after pScrn->display has been set because @@ -397,9 +399,9 @@ /* determine whether we use hardware or software cursor */ pLeo->HWCursor = TRUE; - if (xf86GetOptValBool(LeoOptions, OPTION_HW_CURSOR, &pLeo->HWCursor)) + if (xf86GetOptValBool(pLeo->Options, OPTION_HW_CURSOR, &pLeo->HWCursor)) from = X_CONFIG; - if (xf86ReturnOptValBool(LeoOptions, OPTION_SW_CURSOR, FALSE)) { + if (xf86ReturnOptValBool(pLeo->Options, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pLeo->HWCursor = FALSE; } @@ -407,7 +409,7 @@ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pLeo->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(LeoOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pLeo->Options, OPTION_NOACCEL, FALSE)) { pLeo->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } Index: xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.cpp:1.4 xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.cpp:1.4 Mon Dec 11 15:18:34 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.cpp Mon Jun 4 12:41:06 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.cpp,v 1.4 2000/12/11 20:18:34 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SUNLEO __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -sunleo \- Leo video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsunleo\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B leo -is an XFree86 driver for Sun Leo (ZX) video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B leo -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com> Index: xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.man:1.2 --- /dev/null Mon Jun 4 12:41:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.man Sat Jan 27 13:20:54 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/sunleo/sunleo.man,v 1.2 2001/01/27 18:20:54 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH SUNLEO __drivermansuffix__ __vendorversion__ +.SH NAME +sunleo \- Leo video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qsunleo\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B leo +is an XFree86 driver for Sun Leo (ZX) video cards. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B leo +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Jakub Jelinek <jakub@redhat.com> Index: xc/programs/Xserver/hw/xfree86/drivers/suntcx/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/suntcx/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/drivers/suntcx/Imakefile:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/suntcx/Imakefile:1.1 Fri Jun 30 13:15:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suntcx/Imakefile Wed May 16 08:38:10 2001 @@ -1,7 +1,7 @@ XCOMM XCOMM This is an Imakefile for the tcx driver. XCOMM -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/Imakefile,v 1.1 2000/06/30 17:15:16 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/Imakefile,v 1.4 2001/05/16 12:38:10 alanh Exp $ #define IHaveModules #include <Server.tmpl> @@ -13,8 +13,8 @@ INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ - -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ - -I$(SERVERSRC)/Xext -I$(SERVERSRC)/cfb \ + -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/Xext -I$(SERVERSRC)/render \ -I$(XF86SRC)/ramdac \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ -I$(EXTINCSRC) @@ -31,7 +31,6 @@ InstallObjectModule(suntcx,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(suntcx,) InstallModuleManPage(suntcx) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.cpp:1.2 xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.cpp:1.2 Mon Dec 11 15:18:35 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.cpp Mon Jun 4 12:41:06 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.cpp,v 1.2 2000/12/11 20:18:35 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH SUNTCX __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -suntcx \- TCX video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qsuntcx\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B suntcx -is an XFree86 driver for Sun TCX video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B suntcx -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Jakub Jelinek <jakub@redhat.com> Index: xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.man:1.2 --- /dev/null Mon Jun 4 12:41:06 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.man Sat Jan 27 13:20:54 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/suntcx.man,v 1.2 2001/01/27 18:20:54 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH SUNTCX __drivermansuffix__ __vendorversion__ +.SH NAME +suntcx \- TCX video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qsuntcx\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B suntcx +is an XFree86 driver for Sun TCX video cards. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B suntcx +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Jakub Jelinek <jakub@redhat.com> Index: xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx.h diff -u xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx.h:1.1 xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx.h:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx.h:1.1 Fri Jun 30 13:15:16 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx.h Fri May 4 15:05:46 2001 @@ -20,7 +20,7 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx.h,v 1.1 2000/06/30 17:15:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx.h,v 1.2 2001/05/04 19:05:46 dawes Exp $ */ #ifndef TCX_H #define TCX_H @@ -60,6 +60,7 @@ Bool CursorEnabled; unsigned char CursorShiftX, CursorShiftY; unsigned char *CursorData; + OptionInfoPtr Options; } TcxRec, *TcxPtr; #define TCX_CPLANE_MODE 0x03000000 Index: xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c:1.3 Sat Dec 2 10:30:57 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c Wed May 16 02:48:11 2001 @@ -20,9 +20,8 @@ * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c,v 1.3 2000/12/02 15:30:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/suntcx/tcx_driver.c,v 1.5 2001/05/16 06:48:11 keithp Exp $ */ -#define PSZ 8 #include "xf86.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" @@ -31,13 +30,11 @@ #include "mibstore.h" #include "micmap.h" -#include "cfb.h" -#undef PSZ -#include "cfb32.h" +#include "fb.h" #include "xf86cmap.h" #include "tcx.h" -static OptionInfoPtr TCXAvailableOptions(int chipid, int busid); +static const OptionInfoRec * TCXAvailableOptions(int chipid, int busid); static void TCXIdentify(int flags); static Bool TCXProbe(DriverPtr drv, int flags); static Bool TCXPreInit(ScrnInfoPtr pScrn, int flags); @@ -91,7 +88,7 @@ OPTION_HW_CURSOR } TCXOpts; -static OptionInfoRec TCXOptions[] = { +static const OptionInfoRec TCXOptions[] = { { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } @@ -175,8 +172,7 @@ return; } -static -OptionInfoPtr +static const OptionInfoRec * TCXAvailableOptions(int chipid, int busid) { return TCXOptions; @@ -374,7 +370,10 @@ /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, TCXOptions); + if (!(pTcx->Options = xalloc(sizeof(TCXOptions)))) + return FALSE; + memcpy(pTcx->Options, TCXOptions, sizeof(TCXOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pTcx->Options); /* * This must happen after pScrn->display has been set because @@ -420,9 +419,9 @@ if (hwCursor) { from = X_DEFAULT; pTcx->HWCursor = TRUE; - if (xf86GetOptValBool(TCXOptions, OPTION_HW_CURSOR, &pTcx->HWCursor)) + if (xf86GetOptValBool(pTcx->Options, OPTION_HW_CURSOR, &pTcx->HWCursor)) from = X_CONFIG; - if (xf86ReturnOptValBool(TCXOptions, OPTION_SW_CURSOR, FALSE)) { + if (xf86ReturnOptValBool(pTcx->Options, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pTcx->HWCursor = FALSE; } @@ -431,8 +430,7 @@ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pTcx->HWCursor ? "HW" : "SW"); - if (xf86LoadSubModule(pScrn, pScrn->depth > 8 ? "cfb32" : "cfb") == - NULL) { + if (xf86LoadSubModule(pScrn, "fb") == NULL) { TCXFreeRec(pScrn); return FALSE; } @@ -537,24 +535,25 @@ pScrn->rgbBits, pScrn->defaultVisual)) return FALSE; + miSetPixmapDepths (); + /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. */ - if (pScrn->depth == 8) - ret = cfbScreenInit(pScreen, pTcx->fb, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->virtualX); - else { + if (pScrn->bitsPerPixel != 8) TCXInitCplane24(pScrn); - ret = cfb32ScreenInit(pScreen, pTcx->fb, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->virtualX); - } + ret = fbScreenInit(pScreen, pTcx->fb, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->virtualX, pScrn->bitsPerPixel); if (!ret) return FALSE; + +#ifdef RENDER + fbPictureInit (pScreen, 0, 0); +#endif miInitializeBackingStore(pScreen); xf86SetBackingStore(pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile:1.19 xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile:1.20.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile:1.19 Fri Dec 15 10:19:35 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile Tue May 22 17:25:45 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile,v 1.19 2000/12/15 15:19:35 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/Imakefile,v 1.20.2.1 2001/05/22 21:25:45 dawes Exp $ XCOMM XCOMM This is the Imakefile for the TDFX driver. XCOMM @@ -17,11 +17,16 @@ DRIDEFINES = $(GLX_DEFINES) #endif +#if BuildXvExt +XVSRCS = tdfx_video.c +XVOBJS = tdfx_video.o +#endif + SRCS = tdfx_driver.c tdfx_io.c tdfx_hwcurs.c tdfx_accel.c \ - tdfx_dga.c tdfx_priv.c tdfx_sli.c tdfx_video.c $(DRISRCS) + tdfx_dga.c tdfx_priv.c tdfx_sli.c $(XVSRCS) $(DRISRCS) OBJS = tdfx_driver.o tdfx_io.o tdfx_hwcurs.o tdfx_accel.o \ - tdfx_dga.o tdfx_priv.o tdfx_sli.o tdfx_video.o $(DRIOBJS) + tdfx_dga.o tdfx_priv.o tdfx_sli.o $(XVOBJS) $(DRIOBJS) #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include @@ -50,7 +55,6 @@ InstallObjectModule(tdfx,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(tdfx,) InstallModuleManPage(tdfx) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp:1.6 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp:1.6 Mon Dec 11 15:18:36 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp Mon Jun 4 12:41:07 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.cpp,v 1.6 2000/12/11 20:18:36 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH TDFX __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -tdfx \- 3Dfx video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qtdfx\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B tdfx -is an XFree86 driver for 3Dfx video cards. -It supports the Voodoo Banshee, Voodoo3, Voodoo4 and Voodoo5 cards. -.SH SUPPORTED HARDWARE -The -.B tdfx -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h:1.17 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h:1.23.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h:1.17 Fri Dec 15 10:19:35 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h Tue May 22 17:25:45 2001 @@ -5,13 +5,14 @@ Copyright: 1998,1999 */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.17 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.h,v 1.23.2.1 2001/05/22 21:25:45 dawes Exp $ */ #ifndef _TDFX_H_ #define _TDFX_H_ #include "xf86PciInfo.h" #include "xf86Pci.h" +#include "xf86xv.h" #include "tdfxdefs.h" #ifdef XF86DRI @@ -35,15 +36,11 @@ struct _TDFXRec; typedef struct _TDFXRec *TDFXPtr; -#ifdef XF86DRI -#define PIXMAP_CACHE_LINES 128 -#else -#define PIXMAP_CACHE_LINES 512 -#endif - #include "tdfx_priv.h" extern void TDFXSwapContextFifo(ScreenPtr pScreen); extern void TDFXLostContext(ScreenPtr pScreen); +extern Bool TDFXSetupSLI(ScrnInfoPtr pScrn, Bool sliEnable, int aaSamples); +extern Bool TDFXDisableSLI(TDFXPtr pTDFX); #ifdef XF86DRI extern void FillPrivateDRI(TDFXPtr pTDFX, TDFXDRIPtr pTDFXDRI); @@ -74,7 +71,7 @@ #ifdef TRACECURS #define TDFXTRACECURS ErrorF #else -#define TDFXTRACECURS if(0) (unsigned long) +#define TDFXTRACECURS if(0) ErrorF #endif #ifdef TRACEREG @@ -83,8 +80,8 @@ #define TDFXTRACEREG if(0) ErrorF #endif -#include <xaa.h> -#include <xf86Cursor.h> +#include "xaa.h" +#include "xf86Cursor.h" typedef void (*TDFXWriteIndexedByteFunc)(TDFXPtr pTDFX, int addr, char index, char value); @@ -102,12 +99,17 @@ int addr); typedef void (*TDFXSyncFunc)(ScrnInfoPtr pScrn); typedef void (*TDFXBufferFunc)(TDFXPtr pTDFX, int which); +#if X_BYTE_ORDER == X_BIG_ENDIAN +typedef void (*TDFXWriteFifoFunc)(TDFXPtr pTDFX, int val); +#endif + typedef struct { unsigned int vidcfg; unsigned int vidpll; unsigned int dacmode; unsigned int vgainit0; + unsigned int miscinit0; unsigned int screensize; unsigned int stride; unsigned int cursloc; @@ -179,6 +181,9 @@ TDFXWriteChipWordFunc writeChipLong; TDFXReadChipWordFunc readChipLong; TDFXSyncFunc sync; +#if X_BYTE_ORDER == X_BIG_ENDIAN + TDFXWriteFifoFunc writeFifo; +#endif int syncDone; int scanlineWidth; unsigned char *scanlineColorExpandBuffers[2]; @@ -204,10 +209,31 @@ * shadow everything and make it happen automatically for every write. */ INT32 sst2DSrcFmtShadow; INT32 sst2DDstFmtShadow; - int pixmapCacheLines; + int pixmapCacheLinesMin; + int pixmapCacheLinesMax; + FBAreaPtr reservedArea; + Bool ShowCache; + int videoKey; + void (*VideoTimerCallback)(ScrnInfoPtr, Time); + FBLinearPtr overlayBuffer; + FBAreaPtr textureBuffer; + Bool TextureXvideo; + XF86VideoAdaptorPtr overlayAdaptor; + XF86VideoAdaptorPtr textureAdaptor; + ScreenBlockHandlerProcPtr BlockHandler; + OptionInfoPtr Options; } TDFXRec; typedef struct { + RegionRec clip; + CARD32 colorKey; + int filterQuality; + CARD32 videoStatus; + Time offTime; + Time freeTime; +} TDFXPortPrivRec, *TDFXPortPrivPtr; + +typedef struct { PROPSAREADATA int fifoOwner; int CtxOwner; @@ -226,10 +252,6 @@ #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); @@ -248,9 +270,11 @@ extern void TDFXSetMMIOAccess(TDFXPtr pTDFX); extern void TDFXWriteLongMMIO(TDFXPtr pTDFX, int addr, int val); extern int TDFXReadLongMMIO(TDFXPtr pTDFX, int addr); +extern void TDFXWriteChipLongMMIO(TDFXPtr pTDFX, int chip, int addr, int val); extern void TDFXNeedSync(ScrnInfoPtr pScrn); extern void TDFXCheckSync(ScrnInfoPtr pScrn); +extern void TDFXFirstSync(ScrnInfoPtr pScrn); extern void TDFXSetupForScreenToScreenCopy(ScrnInfoPtr pScrn, int xdir, int ydir, int rop, @@ -266,7 +290,7 @@ extern void TDFXSelectBuffer(TDFXPtr pTDFX, int which); +extern void TDFXInitVideo(ScreenPtr pScreen); +extern void TDFXCloseVideo(ScreenPtr pScreen); #endif - - Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.man:1.2 --- /dev/null Mon Jun 4 12:41:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.man Sat Jan 27 13:20:55 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx.man,v 1.2 2001/01/27 18:20:55 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH TDFX __drivermansuffix__ __vendorversion__ +.SH NAME +tdfx \- 3Dfx video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qtdfx\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B tdfx +is an XFree86 driver for 3Dfx video cards. +It supports the Voodoo Banshee, Voodoo3, Voodoo4 and Voodoo5 cards. +.SH SUPPORTED HARDWARE +The +.B tdfx +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c:1.17 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c:1.17 Fri Dec 15 10:19:35 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c Thu Apr 5 17:29:17 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.17 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_accel.c,v 1.19 2001/04/05 21:29:17 dawes Exp $ */ /* All drivers should typically include these */ #include "xf86.h" @@ -57,6 +57,7 @@ static void TDFXSubsequentDashedTwoPointLine(ScrnInfoPtr pScrn, int x1, int y1, int x2, int y2, int flags, int phase); +#ifdef ENABLE_SS_COLOR_EXPAND_FILL static void TDFXSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); @@ -64,6 +65,7 @@ int x, int y, int w, int h, int srcx, int srcy, int offset); +#endif static void TDFXSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask); @@ -105,7 +107,6 @@ pTDFX->syncDone=FALSE; #ifdef XF86DRI if (pTDFX->directRenderingEnabled) { - TDFXLostContext(screenInfo.screens[pScrn->scrnIndex]); DRIUnlock(screenInfo.screens[pScrn->scrnIndex]); } #endif @@ -124,8 +125,10 @@ else fmt=pTDFX->stride|((pTDFX->cpp+1)<<16); TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->fbOffset); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->fbOffset); TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt); + pTDFX->sst2DSrcFmtShadow = fmt; break; case TDFX_BACK: if (pTDFX->cpp==2) @@ -134,8 +137,10 @@ fmt=((pTDFX->stride+127)/128)|(5<<16); /* Tiled 32bpp */ TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->backOffset|BIT(31)); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->backOffset|BIT(31)); TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt); + pTDFX->sst2DSrcFmtShadow = fmt; break; case TDFX_DEPTH: if (pTDFX->cpp==2) @@ -144,8 +149,10 @@ fmt=((pTDFX->stride+127)/128)|(5<<16); /* Tiled 32bpp */ TDFXWriteLong(pTDFX, SST_2D_DSTBASEADDR, pTDFX->depthOffset|BIT(31)); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_SRCBASEADDR, pTDFX->depthOffset|BIT(31)); TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt); + pTDFX->sst2DSrcFmtShadow = fmt; break; default: ; @@ -155,6 +162,17 @@ void TDFXSetLFBConfig(TDFXPtr pTDFX) { if (pTDFX->ChipType<=PCI_CHIP_VOODOO3) { +#if X_BYTE_ORDER == X_BIG_ENDIAN + unsigned int lfbmode; + lfbmode=TDFXReadLongMMIO(pTDFX, SST_3D_LFBMODE); + + lfbmode&=~BIT(12); /* 0 bit 12 is byte swizzle */ + lfbmode|=BIT(11); /* 1 bit 11 is word swizzle */ + lfbmode&=~BIT(10); /* 0 bit 10 ARGB or ABGR */ + lfbmode&=~BIT(9); /* 0 bit 9 if bit10 = 0: ARGB else ABGR */ + + TDFXWriteLongMMIO(pTDFX, SST_3D_LFBMODE, lfbmode); +#endif TDFXWriteLongMMIO(pTDFX, LFBMEMORYCONFIG, (pTDFX->backOffset>>12) | SST_RAW_LFB_ADDR_STRIDE_4K | ((pTDFX->stride+127)/128)<<SST_RAW_LFB_TILE_STRIDE_SHIFT); @@ -233,7 +251,7 @@ infoPtr->SubsequentScreenToScreenCopy = TDFXSubsequentScreenToScreenCopy; infoPtr->ScreenToScreenCopyFlags = commonFlags; - /* When we're using the fifo interface we have to use indirect */ + /* When we're using the fifo we have to use indirect expansion */ pTDFX->scanlineColorExpandBuffers[0] = xalloc((pScrn->virtualX+62)/32*4); pTDFX->scanlineColorExpandBuffers[1] = xalloc((pScrn->virtualX+62)/32*4); infoPtr->NumScanlineColorExpandBuffers=2; @@ -244,7 +262,10 @@ TDFXSubsequentCPUToScreenColorExpandFill; infoPtr->SubsequentColorExpandScanline = TDFXSubsequentColorExpandScanline; - infoPtr->ScanlineCPUToScreenColorExpandFillFlags = commonFlags | + infoPtr->ScanlineCPUToScreenColorExpandFillFlags = NO_PLANEMASK | +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + BIT_ORDER_IN_BYTE_MSBFIRST | +#endif CPU_TRANSFER_PAD_DWORD | SCANLINE_PAD_DWORD | LEFT_EDGE_CLIPPING; /* | LEFT_EDGE_CLIPPING_NEGATIVE_X; */ @@ -256,7 +277,7 @@ HARDWARE_PATTERN_PROGRAMMED_ORIGIN | HARDWARE_PATTERN_SCREEN_ORIGIN; -#if 0 +#ifdef ENABLE_SS_COLOR_EXPAND_FILL /* This causes us to fail compliance */ /* I suspect 1bpp pixmaps are getting written to cache incorrectly */ infoPtr->SetupForScreenToScreenColorExpandFill = @@ -274,6 +295,9 @@ pTDFX->ModeReg.dstbaseaddr=pTDFX->fbOffset; TDFXWriteLongMMIO(pTDFX, SST_2D_DSTBASEADDR, pTDFX->ModeReg.dstbaseaddr); + pTDFX->sst2DSrcFmtShadow = TDFXReadLongMMIO(pTDFX, SST_2D_SRCFORMAT); + pTDFX->sst2DDstFmtShadow = TDFXReadLongMMIO(pTDFX, SST_2D_DSTFORMAT); + /* Fill in acceleration functions */ return XAAInit(pScreen, infoPtr); } @@ -418,7 +442,9 @@ TDFXMakeRoom(pTDFX, 2); DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, fmt); + pTDFX->sst2DSrcFmtShadow = fmt; } void @@ -476,6 +502,7 @@ DECLARE(SSTCP_DSTFORMAT|SSTCP_COLORFORE| SSTCP_COLORBACK); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_COLORBACK, color); TDFXWriteLong(pTDFX, SST_2D_COLORFORE, color); } @@ -525,6 +552,7 @@ |SSTCP_PATTERN1ALIAS|SSTCP_COLORFORE| SSTCP_COLORBACK); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_PATTERN0, patx); TDFXWriteLong(pTDFX, SST_2D_PATTERN1, paty); TDFXWriteLong(pTDFX, SST_2D_COLORBACK, bg); @@ -638,8 +666,14 @@ (pbox->x1&0x1FFF)); TDFXWriteLong(pTDFX, SST_2D_CLIP1MAX, ((pbox->y2&0x1FFF)<<16) | (pbox->x2&0x1FFF)); +#if X_BYTE_ORDER == X_BIG_ENDIAN + TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, SST_2D_PIXFMT_1BPP | + SST_2D_SOURCE_PACKING_DWORD | BIT(20)); +#else TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, SST_2D_PIXFMT_1BPP | SST_2D_SOURCE_PACKING_DWORD); +#endif + pTDFX->sst2DSrcFmtShadow = SST_2D_PIXFMT_1BPP | SST_2D_SOURCE_PACKING_DWORD; TDFXWriteLong(pTDFX, SST_2D_SRCXY, 0); TDFXWriteLong(pTDFX, SST_2D_COLORFORE, fg); TDFXWriteLong(pTDFX, SST_2D_COMMAND, pTDFX->Cmd); @@ -668,7 +702,11 @@ TDFXMakeRoom(pTDFX, i); DECLARE_LAUNCH(i, 0); for (j=0; j<i; j++) { +#if X_BYTE_ORDER == X_BIG_ENDIAN + TDFXWriteLong(pTDFX, SST_2D_LAUNCH, *glyph_data); +#else TDFXWriteLong(pTDFX, SST_2D_LAUNCH, XAAReverseBitOrder(*glyph_data)); +#endif glyph_data++; } ndwords -= i; @@ -682,9 +720,21 @@ unsigned char *pattern) { TDFXPtr pTDFX; +#if X_BYTE_ORDER == X_BIG_ENDIAN + unsigned int pat = *(unsigned int *)pattern; +#endif TDFXTRACEACCEL("TDFXSetupForDashedLine\n"); pTDFX=TDFXPTR(pScrn); + +#if X_BYTE_ORDER == X_BIG_ENDIAN + pat=((pat & 0xAAAAAAAA) >> 1) | ((pat & 0x55555555) << 1); + pat=((pat & 0xCCCCCCCC) >> 2) | ((pat & 0x33333333) << 2); + pat=((pat & 0xF0F0F0F0) >> 4) | ((pat & 0x0F0F0F0F) << 4); + pat=((pat & 0xFF00FF00) >> 8) | ((pat & 0x00FF00FF) << 8); + pat=((pat & 0xFFFF0000) >> 16) | ((pat & 0x0000FFFF) << 16); +#endif + TDFXClearState(pScrn); pTDFX->Cmd = (TDFXROPCvt[rop]<<24) | SST_2D_STIPPLE_LINE; @@ -695,7 +745,11 @@ TDFXMakeRoom(pTDFX, 3); DECLARE(SSTCP_COLORFORE|SSTCP_COLORBACK|SSTCP_LINESTIPPLE); +#if X_BYTE_ORDER == X_BIG_ENDIAN + TDFXWriteLong(pTDFX, SST_2D_LINESTIPPLE, pat); +#else TDFXWriteLong(pTDFX, SST_2D_LINESTIPPLE, *(int *)pattern); +#endif TDFXWriteLong(pTDFX, SST_2D_COLORBACK, bg); TDFXWriteLong(pTDFX, SST_2D_COLORFORE, fg); } @@ -720,6 +774,7 @@ TDFXSubsequentSolidTwoPointLine(pScrn, x1, y1, x2, y2, flags); } +#ifdef ENABLE_SS_COLOR_EXPAND_FILL static void TDFXSetupForScreenToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, int rop, unsigned int planemask) @@ -773,9 +828,11 @@ SSTCP_DSTSIZE|SSTCP_DSTXY|SSTCP_COMMAND | SSTCP_CLIP1MIN|SSTCP_CLIP1MAX); TDFXWriteLong(pTDFX,SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX,SST_2D_CLIP1MIN, (x&0x1FFF) | ((y&0x1FFF)<<16)); TDFXWriteLong(pTDFX,SST_2D_CLIP1MAX, ((x+w)&0x1FFF) | (((y+h)&0x1FFF)<<16)); TDFXWriteLong(pTDFX,SST_2D_SRCFORMAT, pTDFX->stride); + pTDFX->sst2DSrcFmtShadow = pTDFX->stride; TDFXWriteLong(pTDFX,SST_2D_SRCXY, (srcx&0x1FFF) | ((srcy&0x1FFF)<<16)); TDFXWriteLong(pTDFX,SST_2D_DSTSIZE, ((w+offset)&0x1FFF) | ((h&0x1FFF)<<16)); TDFXWriteLong(pTDFX,SST_2D_DSTXY, ((x-offset)&0x1FFF) | ((y&0x1FFF)<<16)); @@ -783,6 +840,7 @@ pTDFX->prevBlitDest.y1=y; } +#endif static void TDFXSetupForCPUToScreenColorExpandFill(ScrnInfoPtr pScrn, int fg, int bg, @@ -834,9 +892,16 @@ SSTCP_DSTFORMAT|SSTCP_DSTSIZE|SSTCP_SRCXY| SSTCP_DSTXY|SSTCP_COMMAND); TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, fmt); + pTDFX->sst2DDstFmtShadow = fmt; TDFXWriteLong(pTDFX, SST_2D_CLIP1MIN, ((y&0x1FFF)<<16)|(x&0x1FFF)); TDFXWriteLong(pTDFX, SST_2D_CLIP1MAX, (((y+h)&0x1FFF)<<16)|((x+w)&0x1FFF)); +#if X_BYTE_ORDER == X_BIG_ENDIAN + /* bit 20 byte swizzle */ + TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, (((w+31)/32)*4) & 0x3FFF | BIT(20)); +#else TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, (((w+31)/32)*4) & 0x3FFF); +#endif + pTDFX->sst2DSrcFmtShadow = (((w+31)/32)*4) & 0x3FFF; TDFXWriteLong(pTDFX, SST_2D_SRCXY, skipleft&0x1F); TDFXWriteLong(pTDFX, SST_2D_DSTSIZE, ((w-skipleft)&0x1FFF)|((h&0x1FFF)<<16)); TDFXWriteLong(pTDFX, SST_2D_DSTXY, ((x+skipleft)&0x1FFF) | ((y&0x1FFF)<<16)); Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c:1.6 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c:1.3 Fri Jun 16 20:03:25 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c Wed Mar 21 12:02:26 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c,v 1.3 2000/06/17 00:03:25 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dga.c,v 1.6 2001/03/21 17:02:26 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -6,6 +6,7 @@ #include "dgaproc.h" #include "tdfx.h" +#include "vgaHW.h" static Bool TDFX_OpenFramebuffer(ScrnInfoPtr, char **, unsigned char **, int *, int *, int *); @@ -31,13 +32,7 @@ TDFX_BlitTransRect }; -/* -We should allow you to change the depth, but the accel driver isn't -ready to handle that yet. Also, we are currently taking the default -visual and using it for the visual reported by DGA. It would be -relatively easy to at least give DirectColor and TrueColor visuals -instead of just the default -*/ + Bool TDFXDGAInit(ScreenPtr pScreen) { @@ -46,22 +41,19 @@ DisplayModePtr pMode, firstMode; DGAModePtr modes=0, newmodes=0, currentMode; int num=0; - Bool oneMore; pTDFX = TDFXPTR(pScrn); pMode = firstMode = pScrn->modes; while (pMode) { newmodes = xrealloc(modes, (num+1)*sizeof(DGAModeRec)); - oneMore = FALSE; + if (!newmodes) { xfree(modes); return FALSE; } modes = newmodes; -SECOND_PASS: - currentMode = modes+num; num++; currentMode->mode = pMode; @@ -81,37 +73,21 @@ currentMode->visualClass = pScrn->defaultVisual; currentMode->viewportWidth = pMode->HDisplay; currentMode->viewportHeight = pMode->VDisplay; - currentMode->xViewportStep = (3 - pTDFX->cpp); + currentMode->xViewportStep = 1; currentMode->yViewportStep = 1; currentMode->viewportFlags = DGA_FLIP_RETRACE; - currentMode->offset = pTDFX->fbOffset; + currentMode->offset = 0; currentMode->address = pTDFX->FbBase; - - if (oneMore) { /* first one is narrow width */ - currentMode->bytesPerScanline = ((pMode->HDisplay * pTDFX->cpp) + 3) & ~3L; - currentMode->imageWidth = pMode->HDisplay; - currentMode->imageHeight = pScrn->virtualY; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - - currentMode->viewportHeight; - oneMore = FALSE; - goto SECOND_PASS; - } else { - currentMode->bytesPerScanline = ((pScrn->displayWidth * pTDFX->cpp) + 3) & ~3L; - currentMode->imageWidth = pScrn->displayWidth; - currentMode->imageHeight = pScrn->virtualY; - currentMode->pixmapWidth = currentMode->imageWidth; - currentMode->pixmapHeight = currentMode->imageHeight; - currentMode->maxViewportX = currentMode->imageWidth - - currentMode->viewportWidth; - /* this might need to get clamped to some maximum */ - currentMode->maxViewportY = currentMode->imageHeight - - currentMode->viewportHeight; - } + currentMode->bytesPerScanline = ((pScrn->displayWidth*pTDFX->cpp)+3) & ~3L; + currentMode->imageWidth = pScrn->displayWidth; + currentMode->imageHeight = pTDFX->pixmapCacheLinesMax; + currentMode->pixmapWidth = currentMode->imageWidth; + currentMode->pixmapHeight = currentMode->imageHeight; + currentMode->maxViewportX = currentMode->imageWidth - + currentMode->viewportWidth; + /* this might need to get clamped to some maximum */ + currentMode->maxViewportY = currentMode->imageHeight - + currentMode->viewportHeight; pMode = pMode->next; if (pMode == firstMode) break; @@ -125,25 +101,24 @@ static Bool TDFX_SetMode(ScrnInfoPtr pScrn, DGAModePtr pMode) { - static int OldDisplayWidth[MAXSCREENS]; + static DisplayModePtr OldModes[MAXSCREENS]; int index = pScrn->pScreen->myNum; TDFXPtr pTDFX = TDFXPTR(pScrn); if (!pMode) { /* restore the original mode */ /* put the ScreenParameters back */ - pScrn->displayWidth = OldDisplayWidth[index]; - TDFXSwitchMode(index, pScrn->currentMode, 0); - pTDFX->DGAactive = FALSE; + if(pTDFX->DGAactive) { + TDFXSwitchMode(index, OldModes[index], 0); + TDFXAdjustFrame(pScrn->pScreen->myNum, 0, 0, 0); + pTDFX->DGAactive = FALSE; + } } else { if (!pTDFX->DGAactive) { /* save the old parameters */ - OldDisplayWidth[index] = pScrn->displayWidth; - - pTDFX->DGAactive = TRUE; + OldModes[index] = pScrn->currentMode; + pTDFX->DGAactive = TRUE; } - pScrn->displayWidth = pMode->bytesPerScanline / pTDFX->cpp; - TDFXSwitchMode(index, pMode->mode, 0); } @@ -162,9 +137,15 @@ TDFX_SetViewport(ScrnInfoPtr pScrn, int x, int y, int flags) { TDFXPtr pTDFX = TDFXPTR(pScrn); + vgaHWPtr hwp = VGAHWPTR(pScrn); TDFXAdjustFrame(pScrn->pScreen->myNum, x, y, flags); - pTDFX->DGAViewportStatus = 0; /* TDFXAdjustFrame loops until finished */ + + /* fixme */ + while(hwp->readST01(hwp) & 0x08); + while(!(hwp->readST01(hwp) & 0x08)); + + pTDFX->DGAViewportStatus = 0; } static void @@ -189,10 +170,8 @@ int xdir = ((srcx < dstx) && (srcy == dsty)) ? -1 : 1; int ydir = (srcy < dsty) ? -1 : 1; - (*pTDFX->AccelInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, - GXcopy, ~0, -1); - (*pTDFX->AccelInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, - dstx, dsty, w, h); + (*pTDFX->AccelInfoRec->SetupForScreenToScreenCopy)(pScrn, xdir, ydir, GXcopy, ~0, -1); + (*pTDFX->AccelInfoRec->SubsequentScreenToScreenCopy)(pScrn, srcx, srcy, dstx, dsty, w, h); } } @@ -222,9 +201,9 @@ TDFXPtr pTDFX = TDFXPTR(pScrn); *name = NULL; /* no special device */ - *mem = (unsigned char*)pTDFX->LinearAddr[0]; + *mem = (unsigned char*)pTDFX->LinearAddr[0] + pTDFX->fbOffset; *size = pTDFX->FbMapSize; - *offset = 0; + *offset = /* pTDFX->fbOffset */ 0 ; /* DGA is broken */ *flags = DGA_NEED_ROOT; return TRUE; Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c:1.22.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c:1.14 Thu Dec 7 15:26:23 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c Tue May 22 17:25:45 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.14 2000/12/07 20:26:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.c,v 1.22.2.1 2001/05/22 21:25:45 dawes Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -16,21 +16,23 @@ static char TDFXKernelDriverName[] = "tdfx"; static char TDFXClientDriverName[] = "tdfx"; -static Bool TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual, +static Bool TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual, drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore); static void TDFXDestroyContext(ScreenPtr pScreen, drmContext hwContext, DRIContextType contextStore); -static void TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, - DRIContextType readContextType, +static void TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, + DRIContextType readContextType, void *readContextStore, - DRIContextType writeContextType, + DRIContextType writeContextType, void *writeContextStore); static Bool TDFXDRIOpenFullScreen(ScreenPtr pScreen); static Bool TDFXDRICloseFullScreen(ScreenPtr pScreen); static void TDFXDRIInitBuffers(WindowPtr pWin, RegionPtr prgn, CARD32 index); -static void TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, +static void TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index); +static void TDFXDRITransitionTo2d(ScreenPtr pScreen); +static void TDFXDRITransitionTo3d(ScreenPtr pScreen); static Bool TDFXInitVisualConfigs(ScreenPtr pScreen) @@ -48,22 +50,22 @@ 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); return FALSE; } - for (i=0; i<numConfigs; i++) + for (i=0; i<numConfigs; i++) pTDFXConfigPtrs[i] = &pTDFXConfigs[i]; i=0; @@ -102,7 +104,7 @@ if (depth) { if (pTDFX->cpp>2) pConfigs[i].depthSize = 24; - else + else pConfigs[i].depthSize = 16; } else { pConfigs[i].depthSize = 0; @@ -130,7 +132,7 @@ } if (i!=numConfigs) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "Incorrect initialization of visuals\n"); + "[dri] TDFXInitVisualConfigs: wrong number of visuals\n"); return FALSE; } break; /* 16bpp */ @@ -139,24 +141,24 @@ 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); return FALSE; } - for (i = 0; i < numConfigs; i++) + for (i = 0; i < numConfigs; i++) pTDFXConfigPtrs[i] = &pTDFXConfigs[i]; i=0; @@ -197,7 +199,7 @@ if (depth) { if (pTDFX->cpp > 2) pConfigs[i].depthSize = 24; - else + else pConfigs[i].depthSize = 16; } else { pConfigs[i].depthSize = 0; @@ -225,7 +227,7 @@ } if (i!=numConfigs) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "Incorrect initialization of visuals\n"); + "[dri] TDFXInitVisualConfigs: wrong number of visuals\n"); return FALSE; } break; @@ -247,7 +249,7 @@ TDFXNeedSync(pScrn); } -static void +static void TDFXDoBlockHandler(int screenNum, pointer blockData, pointer pTimeout, pointer pReadmask) { @@ -263,24 +265,32 @@ 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] tdfx DRI not supported in %d bpp mode, disabling DRI.\n", + (pScrn->bitsPerPixel)); + if (pTDFX->ChipType <= PCI_CHIP_VOODOO3) { + xf86DrvMsg(pScreen->myNum, X_INFO, + "[dri] To use DRI, invoke the server using 16 bpp\n" + "\t(-depth 15 or -depth 16).\n"); + } else { + xf86DrvMsg(pScreen->myNum, X_INFO, + "[dri] To use DRI, invoke the server using 16 bpp\n" + "\t(-depth 15 or -depth 16) or 32 bpp (-depth 24 -fbbpp 32).\n"); + } return FALSE; - case 32: - if (pTDFX->ChipType<=PCI_CHIP_VOODOO3) { - xf86DrvMsg(pScreen->myNum, X_ERROR, - "DRI requires Voodoo3 or later, disabling DRI.\n"); - return FALSE; - } } /* Check that the GLX, DRI, and DRM modules have been loaded by testing @@ -298,9 +308,11 @@ { int major, minor, patch; DRIQueryVersion(&major, &minor, &patch); - if (major != 3 || minor != 0 || patch < 0) { + if (major != 4 || minor < 0) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "TDFXDRIScreenInit failed (DRI version = %d.%d.%d, expected 3.0.x). Disabling DRI.\n", + "[dri] TDFXDRIScreenInit failed because of a version mismatch.\n" + "[dri] libDRI version is %d.%d.%d but version 4.0.x is needed.\n" + "[dri] Disabling the DRI.\n", major, minor, patch); return FALSE; } @@ -309,7 +321,7 @@ pDRIInfo = DRICreateInfoRec(); if (!pDRIInfo) { xf86DrvMsg(pScreen->myNum, X_ERROR, - "DRICreateInfoRect() failed, disabling DRI.\n"); + "[dri] DRICreateInfoRect() failed, disabling DRI.\n"); return FALSE; } @@ -341,10 +353,10 @@ pDRIInfo->maxDrawableTableEntry = TDFX_MAX_DRAWABLES; #ifdef NOT_DONE - /* FIXME need to extend DRI protocol to pass this size back to client + /* FIXME need to extend DRI protocol to pass this size back to client * for SAREA mapping that includes a device private record */ - pDRIInfo->SAREASize = + pDRIInfo->SAREASize = ((sizeof(XF86DRISAREARec) + 0xfff) & 0x1000); /* round to page */ /* + shared memory device private rec */ #else @@ -358,8 +370,9 @@ pDRIInfo->SAREASize = SAREA_MAX; #endif - if (!(pTDFXDRI = (TDFXDRIPtr)xnfcalloc(sizeof(TDFXDRIRec),1))) { - xf86DrvMsg(pScreen->myNum, X_ERROR, "DRI memory allocation failed, disabling DRI.\n"); + if (!(pTDFXDRI = (TDFXDRIPtr)xcalloc(sizeof(TDFXDRIRec),1))) { + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] DRI memory allocation failed, disabling DRI.\n"); DRIDestroyInfoRec(pTDFX->pDRIInfo); pTDFX->pDRIInfo=0; return FALSE; @@ -375,14 +388,20 @@ pDRIInfo->MoveBuffers = TDFXDRIMoveBuffers; pDRIInfo->OpenFullScreen = TDFXDRIOpenFullScreen; pDRIInfo->CloseFullScreen = TDFXDRICloseFullScreen; + pDRIInfo->TransitionTo2d = TDFXDRITransitionTo2d; + pDRIInfo->TransitionTo3d = TDFXDRITransitionTo3d; pDRIInfo->bufferRequests = DRI_ALL_WINDOWS; + pDRIInfo->createDummyCtx = FALSE; + pDRIInfo->createDummyCtxPriv = FALSE; + if (!DRIScreenInit(pScreen, pDRIInfo, &pTDFX->drmSubFD)) { xfree(pDRIInfo->devPrivate); pDRIInfo->devPrivate=0; DRIDestroyInfoRec(pTDFX->pDRIInfo); pTDFX->pDRIInfo=0; - xf86DrvMsg(pScreen->myNum, X_ERROR, "DRIScreenInit failed, disabling DRI.\n"); + xf86DrvMsg(pScreen->myNum, X_ERROR, + "[dri] DRIScreenInit failed, disabling DRI.\n"); return FALSE; } @@ -392,11 +411,12 @@ drmVersionPtr version = drmGetVersion(pTDFX->drmSubFD); if (version) { if (version->version_major != 1 || - version->version_minor != 0 || - version->version_patchlevel < 0) { + version->version_minor < 0) { /* incompatible drm version */ xf86DrvMsg(pScreen->myNum, X_ERROR, - "TDFXDRIScreenInit failed (DRM version = %d.%d.%d, expected 1.0.x). Disabling DRI.\n", + "[dri] TDFXDRIScreenInit failed because of a version mismatch.\n" + "[dri] tdfx.o kernel module version is %d.%d.%d but version 1.0.x is needed.\n" + "[dri] Disabling the DRI.\n", version->version_major, version->version_minor, version->version_patchlevel); @@ -409,7 +429,7 @@ } pTDFXDRI->regsSize=TDFXIOMAPSIZE; - if (drmAddMap(pTDFX->drmSubFD, (drmHandle)pTDFX->MMIOAddr[0], + if (drmAddMap(pTDFX->drmSubFD, (drmHandle)pTDFX->MMIOAddr[0], pTDFXDRI->regsSize, DRM_REGISTERS, 0, &pTDFXDRI->regs)<0) { TDFXDRICloseScreen(pScreen); xf86DrvMsg(pScreen->myNum, X_ERROR, "drmAddMap failed, disabling DRI.\n"); @@ -449,7 +469,7 @@ } static Bool -TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual, +TDFXCreateContext(ScreenPtr pScreen, VisualPtr visual, drmContext hwContext, void *pVisualConfigPriv, DRIContextType contextStore) { @@ -457,7 +477,7 @@ } static void -TDFXDestroyContext(ScreenPtr pScreen, drmContext hwContext, +TDFXDestroyContext(ScreenPtr pScreen, drmContext hwContext, DRIContextType contextStore) { } @@ -485,11 +505,12 @@ pTDFXDRI->fbOffset=pTDFX->fbOffset; pTDFXDRI->backOffset=pTDFX->backOffset; pTDFXDRI->depthOffset=pTDFX->depthOffset; + pTDFXDRI->sarea_priv_offset = sizeof(XF86DRISAREARec); return DRIFinishScreenInit(pScreen); } static void -TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, +TDFXDRISwapContext(ScreenPtr pScreen, DRISyncType syncType, DRIContextType oldContextType, void *oldContext, DRIContextType newContextType, void *newContext) { @@ -511,10 +532,10 @@ TDFXSetupForSolidFill(pScrn, 0, GXcopy, -1); while (nbox--) { TDFXSelectBuffer(pTDFX, TDFX_BACK); - TDFXSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + TDFXSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, pbox->x2-pbox->x1, pbox->y2-pbox->y1); TDFXSelectBuffer(pTDFX, TDFX_DEPTH); - TDFXSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, + TDFXSubsequentSolidFillRect(pScrn, pbox->x1, pbox->y1, pbox->x2-pbox->x1, pbox->y2-pbox->y1); pbox++; } @@ -523,153 +544,43 @@ pTDFX->AccelInfoRec->NeedToSync = TRUE; } -/* - This routine is a modified form of XAADoBitBlt with the calls to - ScreenToScreenBitBlt built in. My routine has the prgnSrc as source - instead of destination. My origin is upside down so the ydir cases - are reversed. -*/ static void -TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, +TDFXDRIMoveBuffers(WindowPtr pParent, DDXPointRec ptOldOrg, RegionPtr prgnSrc, CARD32 index) { ScreenPtr pScreen = pParent->drawable.pScreen; ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; TDFXPtr pTDFX = TDFXPTR(pScrn); - int nbox; - BoxPtr pbox, pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; - DDXPointPtr pptTmp, pptNew1, pptNew2; - int xdir, ydir; - int dx, dy, x, y, w, h; - DDXPointPtr pptSrc; - - pbox = REGION_RECTS(prgnSrc); - nbox = REGION_NUM_RECTS(prgnSrc); - pboxNew1 = 0; - pptNew1 = 0; - pboxNew2 = 0; - pboxNew2 = 0; - pptSrc = &ptOldOrg; + int dx, dy, xdir, ydir, i, x, y, nbox; + BoxPtr pbox; dx = pParent->drawable.x - ptOldOrg.x; dy = pParent->drawable.y - ptOldOrg.y; - /* If the copy will overlap in Y, reverse the order */ - if (dy>0) { - ydir = -1; - - if (nbox>1) { - /* Keep ordering in each band, reverse order of bands */ - pboxNew1 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); - if (!pboxNew1) return; - pptNew1 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); - if (!pptNew1) { - DEALLOCATE_LOCAL(pboxNew1); - return; - } - pboxBase = pboxNext = pbox+nbox-1; - while (pboxBase >= pbox) { - while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) - pboxNext--; - pboxTmp = pboxNext+1; - pptTmp = pptSrc + (pboxTmp - pbox); - while (pboxTmp <= pboxBase) { - *pboxNew1++ = *pboxTmp++; - *pptNew1++ = *pptTmp++; - } - pboxBase = pboxNext; - } - pboxNew1 -= nbox; - pbox = pboxNew1; - pptNew1 -= nbox; - pptSrc = pptNew1; - } - } else { - /* No changes required */ - ydir = 1; - } - - /* If the regions will overlap in X, reverse the order */ - if (dx>0) { - xdir = -1; - - if (nbox > 1) { - /*reverse orderof rects in each band */ - pboxNew2 = (BoxPtr)ALLOCATE_LOCAL(sizeof(BoxRec)*nbox); - pptNew2 = (DDXPointPtr)ALLOCATE_LOCAL(sizeof(DDXPointRec)*nbox); - if (!pboxNew2 || !pptNew2) { - if (pptNew2) DEALLOCATE_LOCAL(pptNew2); - if (pboxNew2) DEALLOCATE_LOCAL(pboxNew2); - if (pboxNew1) { - DEALLOCATE_LOCAL(pptNew1); - DEALLOCATE_LOCAL(pboxNew1); - } - return; - } - pboxBase = pboxNext = pbox; - while (pboxBase < pbox+nbox) { - while ((pboxNext < pbox+nbox) && (pboxNext->y1 == pboxBase->y1)) - pboxNext++; - pboxTmp = pboxNext; - pptTmp = pptSrc + (pboxTmp - pbox); - while (pboxTmp != pboxBase) { - *pboxNew2++ = *--pboxTmp; - *pptNew2++ = *--pptTmp; - } - pboxBase = pboxNext; - } - pboxNew2 -= nbox; - pbox = pboxNew2; - pptNew2 -= nbox; - pptSrc = pptNew2; - } - } else { - /* No changes are needed */ - xdir = 1; - } + DRIMoveBuffersHelper(pScreen, dx, dy, &xdir, &ydir, prgnSrc); - TDFXSetupForScreenToScreenCopy(pScrn, xdir, ydir, GXcopy, -1, -1); - while (nbox--) { - w=pbox->x2-pbox->x1+1; - h=pbox->y2-pbox->y1+1; + pbox = REGION_RECTS(prgnSrc); + nbox = REGION_NUM_RECTS(prgnSrc); - /* Unlike XAA, we don't get handed clipped values */ - if (pbox->x1+dx<0) { - x=-dx; - w-=x-pbox->x1; - } else { - if (pbox->x1+dx+w>pScrn->virtualX) { - x=pScrn->virtualX-dx-w-1; - w-=pbox->x1-x; - } else x=pbox->x1; - } - if (pbox->y1+dy<0) { - y=-dy; - h-=y-pbox->y1; - } else { - if (pbox->y1+dy+h>pScrn->virtualY) { - y=pScrn->virtualY-dy-h-1; - h-=pbox->y1-y; - } else y=pbox->y1; - } - if (w<0 || h<0 || x>pScrn->virtualX || y>pScrn->virtualY) continue; + TDFXSetupForScreenToScreenCopy(pScrn, xdir, ydir, GXcopy, ~0, -1); - TDFXSelectBuffer(pTDFX, TDFX_BACK); - TDFXSubsequentScreenToScreenCopy(pScrn, x, y, x+dx, y+dy, w, h); - TDFXSelectBuffer(pTDFX, TDFX_DEPTH); - TDFXSubsequentScreenToScreenCopy(pScrn, x, y, x+dx, y+dy, w, h); - pbox++; + TDFXSelectBuffer(pTDFX, TDFX_BACK); + for(i = 0; i < nbox; i++) { + x = pbox[i].x1; + y = pbox[i].y1; + TDFXSubsequentScreenToScreenCopy(pScrn, x, y, x+dx, y+dy, + pbox[i].x2 - x, pbox[i].y2 - y); + } + + TDFXSelectBuffer(pTDFX, TDFX_DEPTH); + for(i = 0; i < nbox; i++) { + x = pbox[i].x1; + y = pbox[i].y1; + TDFXSubsequentScreenToScreenCopy(pScrn, x, y, x+dx, y+dy, + pbox[i].x2 - x, pbox[i].y2 - y); } - TDFXSelectBuffer(pTDFX, TDFX_FRONT); - if (pboxNew2) { - DEALLOCATE_LOCAL(pptNew2); - DEALLOCATE_LOCAL(pboxNew2); - } - if (pboxNew1) { - DEALLOCATE_LOCAL(pptNew1); - DEALLOCATE_LOCAL(pboxNew1); - } + TDFXSelectBuffer(pTDFX, TDFX_FRONT); pTDFX->AccelInfoRec->NeedToSync = TRUE; } @@ -677,11 +588,11 @@ static Bool TDFXDRIOpenFullScreen(ScreenPtr pScreen) { +#if 0 ScrnInfoPtr pScrn; TDFXPtr pTDFX; xf86DrvMsg(pScreen->myNum, X_INFO, "OpenFullScreen\n"); -#if 0 pScrn = xf86Screens[pScreen->myNum]; pTDFX=TDFXPTR(pScrn); if (pTDFX->numChips>1) { @@ -694,13 +605,49 @@ static Bool TDFXDRICloseFullScreen(ScreenPtr pScreen) { +#if 0 ScrnInfoPtr pScrn; xf86DrvMsg(pScreen->myNum, X_INFO, "CloseFullScreen\n"); -#if 0 pScrn = xf86Screens[pScreen->myNum]; TDFXDisableSLI(pScrn); #endif return TRUE; } +static void +TDFXDRITransitionTo2d(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + TDFXPtr pTDFX = TDFXPTR(pScrn); + + xf86FreeOffscreenArea(pTDFX->reservedArea); +} + +static void +TDFXDRITransitionTo3d(ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + TDFXPtr pTDFX = TDFXPTR(pScrn); + FBAreaPtr pArea; + + if(pTDFX->overlayBuffer) { + xf86FreeOffscreenLinear(pTDFX->overlayBuffer); + pTDFX->overlayBuffer = NULL; + } + + if(pTDFX->textureBuffer) { + xf86FreeOffscreenArea(pTDFX->textureBuffer); + pTDFX->textureBuffer = NULL; + } + + xf86PurgeUnlockedOffscreenAreas(pScreen); + + pArea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + pTDFX->pixmapCacheLinesMin, + pScrn->displayWidth, NULL, NULL, NULL); + pTDFX->reservedArea = xf86AllocateOffscreenArea(pScreen, pScrn->displayWidth, + pTDFX->pixmapCacheLinesMax - pTDFX->pixmapCacheLinesMin, + pScrn->displayWidth, NULL, NULL, NULL); + xf86FreeOffscreenArea(pArea); +} Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h:1.3 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h:1.3 Tue Feb 15 02:13:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h Wed Mar 21 12:02:26 2001 @@ -1,9 +1,9 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h,v 1.3 2000/02/15 07:13:43 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_dri.h,v 1.5 2001/03/21 17:02:26 dawes Exp $ */ #ifndef _TDFX_DRI_ #define _TDFX_DRI_ -#include <xf86drm.h> +#include "xf86drm.h" typedef struct { drmHandle regs; @@ -22,6 +22,7 @@ int depthOffset; int textureOffset; int textureSize; + unsigned int sarea_priv_offset; } TDFXDRIRec, *TDFXDRIPtr; #endif Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c:1.59.2.1 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c:1.75.2.2 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c:1.59.2.1 Fri Mar 9 13:03:38 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c Wed May 23 09:29:28 2001 @@ -25,7 +25,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.59.2.1 2001/03/09 18:03:38 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_driver.c,v 1.75.2.2 2001/05/23 13:29:28 alanh Exp $ */ /* * Authors: @@ -78,17 +78,16 @@ /* !!! These need to be checked !!! */ #if 0 -#ifdef XFreeXDGA #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" #endif -#endif /* The driver's own header file: */ #include "tdfx.h" #include "miscstruct.h" +#include "dixstruct.h" #include "xf86xv.h" #include "Xv.h" @@ -97,13 +96,9 @@ #include "dri.h" #endif -#ifdef RENDER -#include "picturestr.h" -#endif - /* Required Functions: */ -static OptionInfoPtr TDFXAvailableOptions(int chipid, int busid); +static const OptionInfoRec * TDFXAvailableOptions(int chipid, int busid); /* Print a driver identifying message. */ static void TDFXIdentify(int flags); @@ -135,21 +130,15 @@ static int TDFXValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags); -#ifdef DPMSExtension +static void TDFXBlockHandler(int, pointer, pointer, pointer); + /* Switch to various Display Power Management System levels */ static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagermentMode, int flags); -#endif -#define PCI_SUBDEVICE_ID_VOODOO3_2000 0x0036 -#define PCI_SUBDEVICE_ID_VOODOO3_3000 0x003a - DriverRec TDFX = { TDFX_VERSION, TDFX_DRIVER_NAME, -#if 0 - "Accelerated driver for 3dfx cards", -#endif TDFXIdentify, TDFXProbe, TDFXAvailableOptions, @@ -172,21 +161,28 @@ { -1, -1, RES_UNDEFINED } }; -/* !!! Do we want an option for PIO address space? !!! */ /* !!! Do we want an option for alternate clocking? !!! */ typedef enum { OPTION_NOACCEL, OPTION_SW_CURSOR, OPTION_USE_PIO, - OPTION_NO_SLI + OPTION_SHOWCACHE, + OPTION_VIDEO_KEY, + OPTION_NO_SLI, + OPTION_TEXTURED_VIDEO, + OPTION_DRI } TDFXOpts; -static OptionInfoRec TDFXOptions[] = { +static const OptionInfoRec TDFXOptions[] = { { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_USE_PIO, "UsePIO", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_SHOWCACHE, "ShowCache", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_VIDEO_KEY, "VideoKey", OPTV_INTEGER, {0}, FALSE}, { OPTION_NO_SLI, "NoSLI", OPTV_BOOLEAN, {0}, FALSE}, + { OPTION_TEXTURED_VIDEO, "TexturedVideo", OPTV_BOOLEAN, {1}, FALSE}, + { OPTION_DRI, "DRI", OPTV_BOOLEAN, {0}, FALSE}, { -1, NULL, OPTV_NONE, {0}, FALSE} }; @@ -223,9 +219,7 @@ #ifdef XFree86LOADER static const char *fbSymbols[] = { "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif NULL }; @@ -384,8 +378,7 @@ xf86PrintChipsets(TDFX_NAME, "Driver for 3dfx Banshee/Voodoo3 chipsets", TDFXChipsets); } -static -OptionInfoPtr +static const OptionInfoRec * TDFXAvailableOptions(int chipid, int busid) { return TDFXOptions; @@ -401,6 +394,7 @@ { pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } @@ -473,12 +467,12 @@ static int TDFXCountRam(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; - int memSize; - int memType=-1; /* SDRAM or SGRAM */ + int vmemSize; + int vmemType=-1; /* SDRAM or SGRAM */ pTDFX = TDFXPTR(pScrn); TDFXTRACE("TDFXCountRam start\n"); - memSize=0; + vmemSize=0; if (pTDFX->PIOBase[0]) { CARD32 partSize, /* size of SGRAM chips in Mbits */ @@ -490,15 +484,18 @@ miscInit1; /* determine memory type: SDRAM or SGRAM */ - memType = MEM_TYPE_SGRAM; + vmemType = MEM_TYPE_SGRAM; dramInit1_strap = pTDFX->readLong(pTDFX, DRAMINIT1); dramInit1_strap &= SST_MCTL_TYPE_SDRAM; - if (dramInit1_strap) memType = MEM_TYPE_SDRAM; + if (dramInit1_strap) vmemType = MEM_TYPE_SDRAM; /* set memory interface delay values and enable refresh */ /* these apply to all RAM vendors */ dramInit1 = 0x0; - dramInit1 |= 2<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT; + if (pTDFX->ChipType==PCI_CHIP_BANSHEE) + dramInit1 |= 7<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT; + else + dramInit1 |= 2<<SST_SGRAM_OFLOP_DEL_ADJ_SHIFT; dramInit1 |= SST_SGRAM_CLK_NODELAY; dramInit1 |= SST_DRAM_REFRESH_EN; dramInit1 |= (0x18 << SST_DRAM_REFRESH_VALUE_SHIFT) & SST_DRAM_REFRESH_VALUE; @@ -510,8 +507,8 @@ dramInit0_strap = pTDFX->readLong(pTDFX, DRAMINIT0); if (pTDFX->ChipType<=PCI_CHIP_VOODOO3) { /* Banshee/V3 */ - if (memType == MEM_TYPE_SDRAM) { - memSize = 16; + if (vmemType == MEM_TYPE_SDRAM) { + vmemSize = 16; } else { nChips = ((dramInit0_strap & SST_SGRAM_NUM_CHIPSETS) == 0) ? 4 : 8; @@ -524,22 +521,22 @@ (dramInit0_strap & SST_SGRAM_TYPE) << SST_SGRAM_TYPE_SHIFT ); return 0; } - memSize = (nChips * partSize) / 8; /* in MBytes */ + vmemSize = (nChips * partSize) / 8; /* in MBytes */ } } else { /* V4, V5 */ nChips = ((dramInit0_strap & SST_SGRAM_NUM_CHIPSETS)==0) ? 4 : 8; partSize=1<<((dramInit0_strap&0x38000000)>>28); banks=((dramInit0_strap&BIT(30))==0) ? 2 : 4; - memSize=nChips*partSize*banks; + vmemSize=nChips*partSize*banks; } TDFXTRACEREG("dramInit0 = %x dramInit1 = %x\n", dramInit0_strap, dramInit1_strap); - TDFXTRACEREG("MemConfig %d chips %d size %d total\n", nChips, partSize, memSize); + TDFXTRACEREG("MemConfig %d chips %d size %d total\n", nChips, partSize, vmemSize); /* disable block writes for SDRAM */ miscInit1 = pTDFX->readLong(pTDFX, MISCINIT1); - if ( memType == MEM_TYPE_SDRAM ) { + if ( vmemType == MEM_TYPE_SDRAM ) { miscInit1 |= SST_DISABLE_2D_BLOCK_WRITE; } miscInit1|=1; @@ -547,14 +544,16 @@ } /* return # of KBytes of board memory */ - return memSize*1024; + return vmemSize*1024; } +#if 0 static int TDFXCfgToSize(int cfg) { if (cfg<4) return 0x8000000<<cfg; return 0x4000000>>(cfg-4); } +#endif static int TDFXSizeToCfg(int size) { @@ -600,28 +599,31 @@ TDFXInitChips(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; - int i, cfgbits, initbits; + int i, v, cfgbits, initbits; int mem0base, mem1base, mem0size, mem0bits, mem1size, mem1bits; pTDFX=TDFXPTR(pScrn); cfgbits=pciReadLong(pTDFX->PciTag[0], CFG_PCI_DECODE); mem0base=pciReadLong(pTDFX->PciTag[0], CFG_MEM0BASE); mem1base=pciReadLong(pTDFX->PciTag[0], CFG_MEM1BASE); + initbits=pciReadLong(pTDFX->PciTag[0], CFG_INIT_ENABLE); mem0size=32*1024*1024; /* Registers are always 32MB */ mem1size=pScrn->videoRam*1024*2; /* Linear mapping is 2x memory */ mem0bits=TDFXSizeToCfg(mem0size); mem1bits=TDFXSizeToCfg(mem1size)<<4; cfgbits=(cfgbits&~(0xFF))|mem0bits|mem1bits; for (i=0; i<pTDFX->numChips; i++) { - initbits=pciReadLong(pTDFX->PciTag[i], CFG_INIT_ENABLE); initbits|=BIT(10); pciWriteLong(pTDFX->PciTag[i], CFG_INIT_ENABLE, initbits); + v=pciReadWord(pTDFX->PciTag[i], CFG_PCI_COMMAND); + if (!i) + pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x3); + else + pciWriteWord(pTDFX->PciTag[i], CFG_PCI_COMMAND, v|0x2); pTDFX->MMIOAddr[i]=mem0base+i*mem0size; - pciWriteLong(pTDFX->PciTag[i], CFG_MEM0BASE, 0xFFFFFFFF); pciWriteLong(pTDFX->PciTag[i], CFG_MEM0BASE, pTDFX->MMIOAddr[i]); pTDFX->MMIOAddr[i]&=0xFFFFFF00; pTDFX->LinearAddr[i]=mem1base+i*mem1size; - pciWriteLong(pTDFX->PciTag[i], CFG_MEM1BASE, 0xFFFFFFFF); pciWriteLong(pTDFX->PciTag[i], CFG_MEM1BASE, pTDFX->LinearAddr[i]); pTDFX->LinearAddr[i]&=0xFFFFFF00; pciWriteLong(pTDFX->PciTag[i], CFG_PCI_DECODE, cfgbits); @@ -647,6 +649,7 @@ int flags24; rgb defaultWeight = {0, 0, 0}; pciVideoPtr match; + int availableMem; TDFXTRACE("TDFXPreInit start\n"); if (pScrn->numEntities != 1) return FALSE; @@ -662,8 +665,12 @@ pTDFX->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); if (flags & PROBE_DETECT) { +#if !defined(__powerpc__) TDFXProbeDDC(pScrn, pTDFX->pEnt->index); return TRUE; +#else + return FALSE; +#endif } if (pTDFX->pEnt->location.type != BUS_PCI) return FALSE; @@ -676,6 +683,7 @@ /* Allocate a vgaHWRec */ if (!vgaHWGetHWRec(pScrn)) return FALSE; +#if !defined(__powerpc__) if (xf86LoadSubModule(pScrn, "int10")) { xf86Int10InfoPtr pInt; xf86DrvMsg(pScrn->scrnIndex, X_INFO, @@ -693,11 +701,12 @@ xf86FreeInt10(pInt); } } +#endif match=pTDFX->PciInfo=xf86GetPciInfoForEntity(pTDFX->pEnt->index); TDFXFindChips(pScrn, match); - if (xf86RegisterResources(pTDFX->pEnt->index, 0, ResExclusive)) { + if (xf86RegisterResources(pTDFX->pEnt->index, NULL, ResExclusive)) { TDFXFreeRec(pScrn); return FALSE; } @@ -753,9 +762,17 @@ return FALSE; } - if (!xf86SetDefaultVisual (pScrn, -1)) { + if (!xf86SetDefaultVisual(pScrn, -1)) { return FALSE; - } + } else { + /* We don't currently support DirectColor at > 8bpp */ + if (pScrn->depth > 8 && pScrn->defaultVisual != TrueColor) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Given default visual" + " (%s) is not supported at depth %d\n", + xf86GetVisualName(pScrn->defaultVisual), pScrn->depth); + return FALSE; + } + } /* We use a programamble clock */ pScrn->progClock = TRUE; @@ -764,7 +781,10 @@ /* Process the options */ xf86CollectOptions(pScrn, NULL); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, TDFXOptions); + if (!(pTDFX->Options = xalloc(sizeof(TDFXOptions)))) + return FALSE; + memcpy(pTDFX->Options, TDFXOptions, sizeof(TDFXOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pTDFX->Options); /* * Set the Chipset and ChipRev, allowing config file entries to @@ -887,10 +907,10 @@ 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: @@ -911,12 +931,19 @@ clockRanges->interlaceAllowed = FALSE; clockRanges->doubleScanAllowed = TRUE; + /* + * Max memory available for the framebuffer is the total less the + * HW cursor space and FIFO space. + */ + availableMem = pScrn->videoRam - 4096 - + (((255 <= CMDFIFO_PAGES) ? 255 : CMDFIFO_PAGES) << 12); + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, clockRanges, 0, 320, 2048, 16*pScrn->bitsPerPixel, - 200, 1536, - pScrn->virtualX, pScrn->virtualY, - pTDFX->FbMapSize, LOOKUP_BEST_REFRESH); + 200, 2047, + pScrn->display->virtualX, pScrn->display->virtualY, + availableMem, LOOKUP_BEST_REFRESH); if (i==-1) { TDFXFreeRec(pScrn); @@ -943,20 +970,34 @@ TDFXFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", NULL); -#ifdef RENDER - xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif + xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); - pTDFX->NoAccel=xf86ReturnOptValBool(TDFXOptions, OPTION_NOACCEL, FALSE); - if (!pTDFX->NoAccel) { + if (!xf86ReturnOptValBool(pTDFX->Options, OPTION_NOACCEL, FALSE)) { if (!xf86LoadSubModule(pScrn, "xaa")) { TDFXFreeRec(pScrn); return FALSE; } } - if (!xf86ReturnOptValBool(TDFXOptions, OPTION_SW_CURSOR, FALSE)) { + if (!xf86GetOptValBool(pTDFX->Options, OPTION_SHOWCACHE, &(pTDFX->ShowCache))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "ShowCache %s\n", pTDFX->ShowCache ? "Enabled" : "Disabled"); + } else { + pTDFX->ShowCache = FALSE; + } + + if (xf86GetOptValBool(pTDFX->Options, OPTION_TEXTURED_VIDEO, &(pTDFX->TextureXvideo))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Texture Xvideo Adaptor %s\n", pTDFX->TextureXvideo ? "Enabled" : "Disabled"); + } else { + pTDFX->TextureXvideo = FALSE; + } + + if (xf86GetOptValInteger(pTDFX->Options, OPTION_VIDEO_KEY, &(pTDFX->videoKey))) { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", pTDFX->videoKey); + } else { + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key default 0x%x\n", pTDFX->videoKey = 0x1E); + } + + if (!xf86ReturnOptValBool(pTDFX->Options, OPTION_SW_CURSOR, FALSE)) { if (!xf86LoadSubModule(pScrn, "ramdac")) { TDFXFreeRec(pScrn); return FALSE; @@ -964,6 +1005,7 @@ xf86LoaderReqSymLists(ramdacSymbols, NULL); } +#if !defined(__powerpc__) /* Load DDC if needed */ /* This gives us DDC1 - we should be able to get DDC2B using i2c */ if (!xf86LoadSubModule(pScrn, "ddc")) { @@ -975,14 +1017,47 @@ /* Initialize DDC1 if possible */ if (xf86LoadSubModule(pScrn, "vbe")) { xf86MonPtr pMon; - pMon = vbeDoEDID(VBEInit(NULL,pTDFX->pEnt->index), NULL); + vbeInfoPtr pVbe = VBEInit(NULL,pTDFX->pEnt->index); + pMon = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); xf86SetDDCproperties(pScrn,xf86PrintEDID(pMon)); } +#endif - if (xf86ReturnOptValBool(TDFXOptions, OPTION_USE_PIO, FALSE)) { + if (xf86ReturnOptValBool(pTDFX->Options, OPTION_USE_PIO, FALSE)) { pTDFX->usePIO=TRUE; } +#if X_BYTE_ORDER == X_BIG_ENDIAN + pTDFX->ModeReg.miscinit0 = pTDFX->readLong(pTDFX, MISCINIT0); + pTDFX->SavedReg.miscinit0 = pTDFX->ModeReg.miscinit0; + + switch (pScrn->bitsPerPixel) { + case 8: + pTDFX->writeFifo = TDFXWriteFifo_8; + pTDFX->ModeReg.miscinit0 &= ~BIT(30); /* LFB byte swizzle */ + pTDFX->ModeReg.miscinit0 &= ~BIT(31); /* LFB word swizzle */ + break; + case 15: + case 16: + pTDFX->writeFifo = TDFXWriteFifo_16; + pTDFX->ModeReg.miscinit0 |= BIT(30); /* LFB byte swizzle */ + pTDFX->ModeReg.miscinit0 |= BIT(31); /* LFB word swizzle */ + break; + case 24: + case 32: + pTDFX->writeFifo = TDFXWriteFifo_24; + pTDFX->ModeReg.miscinit0 |= BIT(30); /* LFB byte swizzle */ + pTDFX->ModeReg.miscinit0 &= ~BIT(31); /* LFB word swizzle */ + break; + default: + return FALSE; + break; + } + pTDFX->writeLong(pTDFX, MISCINIT0, pTDFX->ModeReg.miscinit0); +#endif + + return TRUE; } @@ -1035,6 +1110,7 @@ return TRUE; } +#ifdef DEBUG static void PrintRegisters(ScrnInfoPtr pScrn, TDFXRegPtr regs) { @@ -1090,6 +1166,7 @@ #endif #endif } +#endif /* * TDFXSave -- @@ -1103,6 +1180,7 @@ { TDFXPtr pTDFX; vgaHWPtr hwp; + int i, dummy, count; TDFXTRACE("TDFXDoSave start\n"); pTDFX = TDFXPTR(pScrn); @@ -1133,6 +1211,14 @@ tdfxReg->clip1max=TDFXReadLongMMIO(pTDFX, SST_2D_CLIP1MAX); tdfxReg->srcbaseaddr=TDFXReadLongMMIO(pTDFX, SST_2D_SRCBASEADDR); tdfxReg->dstbaseaddr=TDFXReadLongMMIO(pTDFX, SST_2D_DSTBASEADDR); + for (i=0; i<512; i++) { + count=0; + do { + TDFXWriteLongMMIO(pTDFX, DACADDR, i); + dummy=TDFXReadLongMMIO(pTDFX, DACADDR); + } while (count++<100 && dummy!=i); + tdfxReg->dactable[i]=TDFXReadLongMMIO(pTDFX, DACDATA); + } } static void @@ -1152,6 +1238,7 @@ Bool restoreFonts) { TDFXPtr pTDFX; vgaHWPtr hwp; + int i, dummy, count; TDFXTRACE("TDFXDoRestore start\n"); pTDFX = TDFXPTR(pScrn); @@ -1179,11 +1266,25 @@ TDFXWriteLongMMIO(pTDFX, SST_2D_CLIP1MIN, tdfxReg->clip1min); TDFXWriteLongMMIO(pTDFX, SST_2D_CLIP1MAX, tdfxReg->clip1max); pTDFX->writeLong(pTDFX, VGAINIT0, tdfxReg->vgainit0); +#if X_BYTE_ORDER == X_BIG_ENDIAN + pTDFX->writeLong(pTDFX, MISCINIT0, tdfxReg->miscinit0); +#endif pTDFX->writeLong(pTDFX, VIDPROCCFG, tdfxReg->vidcfg); TDFXWriteLongMMIO(pTDFX, SST_2D_SRCBASEADDR, tdfxReg->srcbaseaddr); TDFXWriteLongMMIO(pTDFX, SST_2D_DSTBASEADDR, tdfxReg->dstbaseaddr); - vgaHWProtect(pScrn, FALSE); + for (i=0; i<512; i++) { + count=0; + do { + TDFXWriteLongMMIO(pTDFX, DACADDR, i); + dummy=TDFXReadLongMMIO(pTDFX, DACADDR); + } while (count++<100 && dummy!=i); + count=0; + do { + TDFXWriteLongMMIO(pTDFX, DACDATA, tdfxReg->dactable[i]); + dummy=TDFXReadLongMMIO(pTDFX, DACDATA); + } while (count++<100 && dummy!=tdfxReg->dactable[i]); + } pTDFX->sync(pScrn); } @@ -1426,6 +1527,7 @@ int hd, hbs, hss, hse, hbe, ht, hskew; Bool dbl; + hd = hbs = hss = hse = hbe = ht = hskew = 0; hwp = VGAHWPTR(pScrn); pTDFX = TDFXPTR(pScrn); @@ -1486,35 +1588,35 @@ static void TDFXLoadPalette16(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, - short visualClass) { + VisualPtr pVisual) { TDFXPtr pTDFX; int i, j, index, v, repeat, max; TDFXTRACE("TDFXLoadPalette16 start\n"); pTDFX = TDFXPTR(pScrn); + for (i=0; i<numColors; i++) { index=indices[i]; v=(colors[index/2].red<<16)|(colors[index].green<<8)|colors[index/2].blue; - if (i<numColors-1) max=indices[i+1]<<2; - else max=256; - for (j=index<<2; j<max; j++) { + max=min((index+1)<<2, 256); + for (j = index<<2; j < max; j++) + { repeat=100; do { - pTDFX->writeLong(pTDFX, DACADDR, j); - } while (--repeat && pTDFX->readLong(pTDFX, DACADDR)!=j); + TDFXWriteLongMMIO(pTDFX, DACADDR, j); + } while (--repeat && TDFXReadLongMMIO(pTDFX, DACADDR)!=j); if (!repeat) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, " - "bypassing CLUT\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, bypassing CLUT\n"); pTDFX->ModeReg.vidcfg |= SST_DESKTOP_CLUT_BYPASS; return; } + repeat=100; do { - pTDFX->writeLong(pTDFX, DACDATA, v); - } while (--repeat && pTDFX->readLong(pTDFX, DACDATA)!=v); + TDFXWriteLongMMIO(pTDFX, DACDATA, v); + } while (--repeat && TDFXReadLongMMIO(pTDFX, DACDATA)!=v); if (!repeat) { - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, " - "bypassing CLUT\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, bypassing CLUT\n"); pTDFX->ModeReg.vidcfg |= SST_DESKTOP_CLUT_BYPASS; return; } @@ -1524,7 +1626,7 @@ static void TDFXLoadPalette24(ScrnInfoPtr pScrn, int numColors, int *indices, LOCO *colors, - short visualClass) { + VisualPtr pVisual) { TDFXPtr pTDFX; int i, index, v, repeat; @@ -1535,8 +1637,8 @@ v=(colors[index].red<<16)|(colors[index].green<<8)|colors[index].blue; repeat=100; do { - pTDFX->writeLong(pTDFX, DACADDR, index); - } while (--repeat && pTDFX->readLong(pTDFX, DACADDR)!=index); + TDFXWriteLongMMIO(pTDFX, DACADDR, index); + } while (--repeat && TDFXReadLongMMIO(pTDFX, DACADDR)!=index); if (!repeat) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac index, " "bypassing CLUT\n"); @@ -1545,8 +1647,8 @@ } repeat=100; do { - pTDFX->writeLong(pTDFX, DACDATA, v); - } while (--repeat && pTDFX->readLong(pTDFX, DACDATA)!=v); + TDFXWriteLongMMIO(pTDFX, DACDATA, v); + } while (--repeat && TDFXReadLongMMIO(pTDFX, DACDATA)!=v); if (!repeat) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Failed to set dac value, " "bypassing CLUT\n"); @@ -1590,6 +1692,7 @@ } /* calcBufferHeightInTiles */ +#if 0 static int calcBufferSizeInTiles(int xres, int yres, int cpp) { int bufSizeInTiles; /* Size of buffer in tiles */ @@ -1600,6 +1703,7 @@ return bufSizeInTiles; } /* calcBufferSizeInTiles */ +#endif static int calcBufferSize(int xres, int yres, Bool tiled, int cpp) @@ -1622,10 +1726,12 @@ static void allocateMemory(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; - int memRemaining, texSize, fifoSize, screenSizeInTiles; + int memRemaining, fifoSize, screenSizeInTiles, cursorSize; + int fbSize; + int verb; + char *str; pTDFX = TDFXPTR(pScrn); - pTDFX->stride = pScrn->displayWidth*pTDFX->cpp; if (pTDFX->cpp!=3) { screenSizeInTiles=calcBufferSize(pScrn->virtualX, pScrn->virtualY, @@ -1636,6 +1742,14 @@ screenSizeInTiles=calcBufferSize(pScrn->virtualX, pScrn->virtualY, TRUE, 4); } + + /* + * Layout is: + * cursor, fifo, fb, tex, bb, db + */ + + fbSize = (pScrn->virtualY + pTDFX->pixmapCacheLinesMin) * pTDFX->stride; + memRemaining=((pScrn->videoRam<<10) - 1) &~ 0xFFF; /* Note that a page is 4096 bytes, and a */ /* tile is 32 x 128 = 4096 bytes. So, */ @@ -1644,11 +1758,13 @@ /* it to be on an *odd* page boundary. */ pTDFX->depthOffset = (memRemaining - screenSizeInTiles) &~ 0xFFF; if ((pTDFX->depthOffset & (0x1 << 12)) == 0) { -#if 0 +#if 1 + if (pTDFX->depthOffset > 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Changing depth offset from 0x%08x to 0x%08x\n", pTDFX->depthOffset, pTDFX->depthOffset - (0x1 << 12)); + } #endif pTDFX->depthOffset -= (0x1 << 12); } @@ -1656,68 +1772,84 @@ /* to be on an *even* page boundary. */ pTDFX->backOffset = (pTDFX->depthOffset - screenSizeInTiles) &~ 0xFFF; if (pTDFX->backOffset & (0x1 << 12)) { -#if 0 +#if 1 + if (pTDFX->backOffset > 0) { xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Changing back offset from 0x%08x to 0x%08x\n", pTDFX->backOffset, pTDFX->backOffset - (0x1 << 12)); + } #endif pTDFX->backOffset -= (0x1 << 12); } - /* Now, place the front buffer, forcing */ - /* it to be on a page boundary too, just */ - /* for giggles. */ - pTDFX->fbOffset - = (pTDFX->backOffset - - (pScrn->virtualY+PIXMAP_CACHE_LINES)*pTDFX->stride) &~ 0xFFF; /* Give the cmd fifo at least */ /* CMDFIFO_PAGES pages, but no more than */ - /* 255. */ + /* 255. We give 4096 bytes to the cursor */ fifoSize = ((255 <= CMDFIFO_PAGES) ? 255 : CMDFIFO_PAGES) << 12; - /* We give 4096 bytes to the cursor, fifoSize to the */ - /* FIFO, and everything to textures. */ - texSize = (pTDFX->fbOffset - fifoSize - 4096); - pTDFX->texOffset = pTDFX->fbOffset - texSize; - pTDFX->texSize = texSize; - pTDFX->fifoOffset = 4096; - pTDFX->fifoSize = fifoSize; + cursorSize = 4096; pTDFX->cursorOffset = 0; - if (texSize < 0) { - pTDFX->backOffset = -1; + pTDFX->fifoOffset = pTDFX->cursorOffset + cursorSize; + pTDFX->fifoSize = fifoSize; + /* Now, place the front buffer, forcing */ + /* it to be on a page boundary too, just */ + /* for giggles. */ + pTDFX->fbOffset = pTDFX->fifoOffset + pTDFX->fifoSize; + pTDFX->texOffset = pTDFX->fbOffset + fbSize; + if (pTDFX->depthOffset <= pTDFX->texOffset || + pTDFX->backOffset <= pTDFX->texOffset) { + /* + * pTDFX->texSize < 0 means that the DRI is disabled. pTDFX->backOffset + * is used to calculate the maximum amount of memory available for + * 2D offscreen use. With DRI disabled, set this to the top of memory. + */ + + pTDFX->texSize = -1; + pTDFX->backOffset = pScrn->videoRam * 1024; pTDFX->depthOffset = -1; - xf86DrvMsg(pScrn->scrnIndex, X_INFO, "No Texture Memory available." - " Disabling direct rendering.\n"); + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "Not enough video memory available for textures and depth buffer\n" + "\tand/or back buffer. Disabling DRI. To use DRI try lower\n" + "\tresolution modes and/or a smaller virtual screen size\n"); } else { + pTDFX->texSize = pTDFX->backOffset - pTDFX->texOffset; xf86DrvMsg(pScrn->scrnIndex, X_INFO, "Textures Memory %0.02f MB\n", - (float)texSize/1024.0/1024.0); + (float)pTDFX->texSize/1024.0/1024.0); } -#if 0 - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + +/* This could be set to 2 or 3 */ +#define OFFSET_VERB 1 + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, OFFSET_VERB, "Cursor Offset: [0x%08X,0x%08X)\n", pTDFX->cursorOffset, - pTDFX->cursorOffset+1024); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + pTDFX->cursorOffset + cursorSize); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, OFFSET_VERB, "Fifo Offset: [0x%08X, 0x%08X)\n", pTDFX->fifoOffset, - pTDFX->fifoOffset+fifoSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "Texture Offset: [0x%08X, 0x%08X)\n", - pTDFX->texOffset, - pTDFX->texOffset + texSize); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, + pTDFX->fifoOffset + pTDFX->fifoSize); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, OFFSET_VERB, "Front Buffer Offset: [0x%08X, 0x%08X)\n", pTDFX->fbOffset, pTDFX->fbOffset + - (pScrn->virtualY+PIXMAP_CACHE_LINES)*pTDFX->stride); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "BackOffset: [0x%08X, 0x%08X)\n", + (pScrn->virtualY+pTDFX->pixmapCacheLinesMin)*pTDFX->stride); + if (pTDFX->texSize > 0) { + verb = OFFSET_VERB; + str = ""; + } else { + verb = 3; + str = "(NOT USED) "; + } + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verb, + "%sTexture Offset: [0x%08X, 0x%08X)\n", str, + pTDFX->texOffset, + pTDFX->texOffset + pTDFX->texSize); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verb, + "%sBackOffset: [0x%08X, 0x%08X)\n", str, pTDFX->backOffset, - pTDFX->backOffset+screenSizeInTiles); - xf86DrvMsg(pScrn->scrnIndex, X_INFO, - "DepthOffset: [0x%08X, 0x%08X)\n", + pTDFX->backOffset + screenSizeInTiles); + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, verb, + "%sDepthOffset: [0x%08X, 0x%08X)\n", str, pTDFX->depthOffset, - pTDFX->depthOffset+screenSizeInTiles); -#endif /* 0/1 */ + pTDFX->depthOffset + screenSizeInTiles); } static Bool @@ -1726,9 +1858,9 @@ vgaHWPtr hwp; TDFXPtr pTDFX; VisualPtr visual; - int maxy; BoxRec MemBox; - RegionRec MemRegion; + MessageType driFrom = X_DEFAULT; + int scanlines; TDFXTRACE("TDFXScreenInit start\n"); pScrn = xf86Screens[pScreen->myNum]; @@ -1742,36 +1874,66 @@ vgaHWGetIOBase(hwp); if (!vgaHWMapMem(pScrn)) return FALSE; + pTDFX->stride = pScrn->displayWidth*pTDFX->cpp; + + /* enough to do DVD */ + pTDFX->pixmapCacheLinesMin = ((720*480*pTDFX->cpp) + + pTDFX->stride - 1)/pTDFX->stride; + allocateMemory(pScrn); +#if 0 if (pTDFX->numChips>1) { - if (xf86ReturnOptValBool(TDFXOptions, OPTION_NO_SLI, FALSE)) { + if (xf86ReturnOptValBool(pTDFX->Options, OPTION_NO_SLI, FALSE)) { TDFXSetupSLI(pScrn, FALSE, 0); } else { TDFXSetupSLI(pScrn, TRUE, 0); } } +#endif TDFXSetLFBConfig(pTDFX); /* We initialize in the state that our FIFO is up to date */ pTDFX->syncDone=TRUE; if (!TDFXInitFifo(pScreen)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize fifo\n"); + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to initialize private\n"); return FALSE; } - maxy=pScrn->virtualY+PIXMAP_CACHE_LINES; - MemBox.y1 = pScrn->virtualY; + scanlines = (pTDFX->backOffset - pTDFX->fbOffset) / pTDFX->stride; + if(pTDFX->ChipType < PCI_CHIP_VOODOO5) { + if (scanlines > 2047) + scanlines = 2047; + } else { + /* MaxClip seems to have only 12 bits => 0->4095 */ + if (scanlines > 4095) + scanlines = 4095; + } + + pTDFX->pixmapCacheLinesMax = scanlines - pScrn->virtualY; + + /* + * Note, pTDFX->pixmapCacheLinesMax may be smaller than + * pTDFX->pixmapCacheLinesMin when pTDFX->texSize < 0. DRI is disabled + * in that case, so pTDFX->pixmapCacheLinesMin isn't used when that's true. + */ + xf86DrvMsg(pScrn->scrnIndex, X_INFO, + "%i lines of offscreen memory available for 2D and video\n", + pTDFX->pixmapCacheLinesMax); + + MemBox.y1 = 0; MemBox.x1 = 0; MemBox.x2 = pScrn->displayWidth; - MemBox.y2 = maxy; + MemBox.y2 = scanlines; - pTDFX->maxClip=((pScrn->virtualX+1)&0xFFF) | (((maxy+1)&0xFFF)<<16); + pTDFX->maxClip = MemBox.x2 | (MemBox.y2 << 16); TDFXSave(pScrn); if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE; + TDFXSetLFBConfig(pTDFX); + miClearVisualTypes(); if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), @@ -1780,19 +1942,21 @@ miSetPixmapDepths (); + pTDFX->NoAccel=xf86ReturnOptValBool(pTDFX->Options, OPTION_NOACCEL, FALSE); #ifdef XF86DRI /* * Setup DRI after visuals have been established, but before fbScreenInit * is called. fbScreenInit will eventually call into the drivers * InitGLXVisuals call back. */ - if (!pTDFX->NoAccel) { - if ( !((pTDFX->backOffset == -1) && (pTDFX->depthOffset == -1))) { + if (!xf86ReturnOptValBool(pTDFX->Options, OPTION_DRI, TRUE) || pTDFX->NoAccel) { + pTDFX->directRenderingEnabled = FALSE; + driFrom = X_CONFIG; + } else if (pTDFX->texSize < 0) { + pTDFX->directRenderingEnabled = FALSE; + driFrom = X_PROBED; + } else { pTDFX->directRenderingEnabled = TDFXDRIScreenInit(pScreen); - } - /* Force the initialization of the context */ - if (pTDFX->directRenderingEnabled) - TDFXLostContext(pScreen); } #endif @@ -1806,9 +1970,7 @@ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return FALSE; -#ifdef RENDER fbPictureInit (pScreen, 0, 0); -#endif break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -1835,13 +1997,7 @@ TDFXDGAInit(pScreen); - REGION_INIT(pScreen, &MemRegion, &MemBox, 1); - if (!xf86InitFBManagerRegion(pScreen, &MemRegion)) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Failed to init memory manager\n"); - REGION_UNINIT(pScreen, &MemRegion); - return FALSE; - } - REGION_UNINIT(pScreen, &MemRegion); + xf86InitFBManager(pScreen, &MemBox); if (!pTDFX->NoAccel) { if (!TDFXAccelInit(pScreen)) { @@ -1856,7 +2012,7 @@ miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); - if (!xf86ReturnOptValBool(TDFXOptions, OPTION_SW_CURSOR, FALSE)) { + if (!xf86ReturnOptValBool(pTDFX->Options, OPTION_SW_CURSOR, FALSE)) { if (!TDFXCursorInit(pScreen)) { xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "Hardware cursor initialization failed\n"); @@ -1866,37 +2022,34 @@ 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; } TDFXAdjustFrame(scrnIndex, 0, 0, 0); -#ifdef DPMSExtension xf86DPMSInit(pScreen, TDFXDisplayPowerManagementSet, 0); -#endif #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 + #ifdef XvExtension /* Initialize Xv support */ TDFXInitVideo (pScreen); @@ -1906,6 +2059,9 @@ pTDFX->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = TDFXCloseScreen; + pTDFX->BlockHandler = pScreen->BlockHandler; + pScreen->BlockHandler = TDFXBlockHandler; + if (serverGeneration == 1) xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); @@ -1930,7 +2086,13 @@ TDFXTRACE("TDFXAdjustFrame start\n"); pScrn = xf86Screens[scrnIndex]; pTDFX = TDFXPTR(pScrn); + + if (pTDFX->ShowCache && y && pScrn->vtSema) + y += pScrn->virtualY - 1; + tdfxReg = &pTDFX->ModeReg; + if(pTDFX->ShowCache && y && pScrn->vtSema) + y += pScrn->virtualY - 1; tdfxReg->startaddr = pTDFX->fbOffset+y*pTDFX->stride+(x*pTDFX->cpp); TDFXTRACE("TDFXAdjustFrame to x=%d y=%d offset=%d\n", x, y, tdfxReg->startaddr); pTDFX->writeLong(pTDFX, VIDDESKTOPSTARTADDR, tdfxReg->startaddr); @@ -1939,19 +2101,19 @@ static Bool TDFXEnterVT(int scrnIndex, int flags) { ScrnInfoPtr pScrn; -#ifdef XF86DRI ScreenPtr pScreen; +#ifdef XF86DRI TDFXPtr pTDFX; #endif TDFXTRACE("TDFXEnterVT start\n"); pScrn = xf86Screens[scrnIndex]; + pScreen = screenInfo.screens[scrnIndex]; + TDFXInitFifo(pScreen); #ifdef XF86DRI pTDFX = TDFXPTR(pScrn); if (pTDFX->directRenderingEnabled) { - pScreen = screenInfo.screens[scrnIndex]; DRIUnlock(pScreen); - TDFXLostContext(pScreen); } #endif if (!TDFXModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -1964,9 +2126,7 @@ ScrnInfoPtr pScrn; vgaHWPtr hwp; ScreenPtr pScreen; -#ifdef XF86DRI TDFXPtr pTDFX; -#endif TDFXTRACE("TDFXLeaveVT start\n"); pScrn = xf86Screens[scrnIndex]; @@ -1974,11 +2134,12 @@ TDFXRestore(pScrn); vgaHWLock(hwp); pScreen = screenInfo.screens[scrnIndex]; -#ifdef XF86DRI pTDFX = TDFXPTR(pScrn); + pTDFX->sync(pScrn); + TDFXShutdownFifo(pScreen); +#ifdef XF86DRI if (pTDFX->directRenderingEnabled) { DRILock(pScreen, 0); - TDFXSwapContextFifo(pScreen); } #endif } @@ -2021,9 +2182,16 @@ if (pTDFX->scanlineColorExpandBuffers[1]) xfree(pTDFX->scanlineColorExpandBuffers[1]); pTDFX->scanlineColorExpandBuffers[1]=0; - + if (pTDFX->overlayAdaptor) + xfree(pTDFX->overlayAdaptor); + pTDFX->overlayAdaptor=0; + if (pTDFX->textureAdaptor) + xfree(pTDFX->textureAdaptor); + pTDFX->textureAdaptor=0; + pScrn->vtSema=FALSE; + pScreen->BlockHandler = pTDFX->BlockHandler; pScreen->CloseScreen = pTDFX->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } @@ -2093,8 +2261,23 @@ return TRUE; } -#ifdef DPMSExtension static void +TDFXBlockHandler(int i, pointer blockData, pointer pTimeout, pointer pReadmask) +{ + ScreenPtr pScreen = screenInfo.screens[i]; + ScrnInfoPtr pScrn = xf86Screens[i]; + TDFXPtr pTDFX = TDFXPTR(pScrn); + + pScreen->BlockHandler = pTDFX->BlockHandler; + (*pScreen->BlockHandler) (i, blockData, pTimeout, pReadmask); + pScreen->BlockHandler = TDFXBlockHandler; + + if(pTDFX->VideoTimerCallback) { + (*pTDFX->VideoTimerCallback)(pScrn, currentTime.milliseconds); + } +} + +static void TDFXDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { TDFXPtr pTDFX; @@ -2125,5 +2308,3 @@ dacmode|=state; pTDFX->writeLong(pTDFX, DACMODE, dacmode); } -#endif - Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c:1.3 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c:1.3 Tue Feb 15 02:13:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c Thu Apr 5 17:29:17 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c,v 1.3 2000/02/15 07:13:43 martin Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_hwcurs.c,v 1.4 2001/04/05 21:29:17 dawes Exp $ */ /* Voodoo Banshee driver version 1.0.2 @@ -14,7 +14,6 @@ #include "tdfx.h" -void TDFXCursorGrabMemory(ScreenPtr pScreen); static void TDFXLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src); static void TDFXShowCursor(ScrnInfoPtr pScrn); static void TDFXHideCursor(ScrnInfoPtr pScrn); @@ -37,7 +36,11 @@ infoPtr->MaxWidth = 64; infoPtr->MaxHeight = 64; - infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST| + + infoPtr->Flags = +#if X_BYTE_ORDER == X_LITTLE_ENDIAN +HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | +#endif HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK| HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_64 | HARDWARE_CURSOR_TRUECOLOR_AT_8BPP; @@ -54,6 +57,21 @@ return xf86InitCursor(pScreen, infoPtr); } +#if X_BYTE_ORDER == X_BIG_ENDIAN +static unsigned int TDFXSwap(TDFXPtr pTDFX, unsigned int val) { + switch (pTDFX->cpp) { + case 1: + return val; + case 2: + return ((val & 0x00ff00ff) << 8) | + ((val & 0xff00ff00) >> 8); + case 3: + case 4: + return BE_BSWAP32(val); + } +} +#endif + static void TDFXLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *src) { @@ -61,7 +79,19 @@ TDFXTRACECURS("TDFXLoadCursorImage start\n"); pTDFX = TDFXPTR(pScrn); +#if X_BYTE_ORDER == X_BIG_ENDIAN + { + int i; + unsigned int *ptr=(unsigned int *)(pTDFX->FbBase+pTDFX->cursorOffset); + + for (i=0; i<256; i++) { + unsigned int val = ((unsigned int *)src)[i]; + *ptr++ = TDFXSwap(pTDFX, val); + } + } +#else memcpy(pTDFX->FbBase+pTDFX->cursorOffset, src, 1024); +#endif } static void Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c:1.6 Fri Aug 25 12:25:36 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c Thu Apr 5 17:29:17 2001 @@ -24,7 +24,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. **************************************************************************/ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c,v 1.6 2000/08/25 16:25:36 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_io.c,v 1.7 2001/04/05 21:29:17 dawes Exp $ */ /* * Authors: @@ -54,11 +54,11 @@ return inb(pTDFX->PIOBase[0]+addr+1); } -void TDFXWriteChipLongPIO(TDFXPtr pTDFX, int chip, int addr, int val) { +static void TDFXWriteChipLongPIO(TDFXPtr pTDFX, int chip, int addr, int val) { outl(pTDFX->PIOBase[chip]+addr, val); } -int TDFXReadChipLongPIO(TDFXPtr pTDFX, int chip, int addr) { +static int TDFXReadChipLongPIO(TDFXPtr pTDFX, int chip, int addr) { return inl(pTDFX->PIOBase[chip]+addr); } Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c:1.13 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c:1.15.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c:1.13 Fri Dec 15 10:19:35 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c Tue May 22 17:25:45 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.13 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.c,v 1.15.2.1 2001/05/22 21:25:45 dawes Exp $ */ #include "xf86.h" @@ -11,16 +11,37 @@ /* Memory layout of card is as follows: - 000000-003fff: Cursor - 001000-xxxxxx: Fifo (Min of CMDFIFO pages) - xxxxxx-420fff: Texture maps - 421000- A-1 : Framebuffer - A - B-1 : Offscreen pixmaps - B - C-1 : Back buffer - C - D-1 : Z buffer + 000000-00ffff: VGA memory + 010000-013fff: Cursor + 011000-xxxxxx: Fifo (Min of CMDFIFO pages) + xxxxxx- A-1 : Front Buffer (framebuffer) + A - B-1 : Pixmap Cache (framebuffer) + B - C-1 : Texture Memory + C - D-1 : Back Buffer + D - E-1 : Depth Buffer + + NB: pixmap cache usually butts right up against texture memory. when + 3d is disabled (via Transition2D) then the pixmap cache is increased + to overlap the texture memory. maximum pixmap cache of 4095 lines on + voodoo5 and 2048 on voodoo3/4 applies. */ -void TDFXSendNOPFifo3D(ScrnInfoPtr pScrn) +#if X_BYTE_ORDER == X_BIG_ENDIAN +void TDFXWriteFifo_24(TDFXPtr pTDFX, int val) { + *pTDFX->fifoPtr++ = val; +} + +void TDFXWriteFifo_16(TDFXPtr pTDFX, int val) { + *pTDFX->fifoPtr++ = BE_WSWAP32(val); +} + +void TDFXWriteFifo_8(TDFXPtr pTDFX, int val) { + *pTDFX->fifoPtr++ = BE_BSWAP32(val); +} +#endif + + +static void TDFXSendNOPFifo3D(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; @@ -50,7 +71,7 @@ TDFXSendNOPFifo3D(pScrn); } -void InstallFifo(ScrnInfoPtr pScrn) +static void InstallFifo(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; @@ -78,7 +99,7 @@ TDFXSendNOPFifo(pScrn); } -void TDFXResetFifo(ScrnInfoPtr pScrn) +static void TDFXResetFifo(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; int oldValue; @@ -117,9 +138,9 @@ static void TDFXSyncFifo(ScrnInfoPtr pScrn) { TDFXPtr pTDFX; - int i, cnt; + int i, cnt, resets=0; int stat; - long start_sec, end_sec, dummy; + long start_sec, end_sec, dummy, readptr; TDFXTRACEACCEL("TDFXSyncFifo start\n"); pTDFX=TDFXPTR(pScrn); @@ -127,7 +148,9 @@ i=0; cnt=0; start_sec=0; + readptr=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); do { + readptr=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); stat=TDFXReadLongMMIO(pTDFX, 0); if (stat&SST_BUSY) i=0; else i++; cnt++; @@ -137,7 +160,17 @@ } else { getsecs(&end_sec, &dummy); if (end_sec-start_sec>3) { - TDFXResetFifo(pScrn); + dummy=TDFXReadLongMMIO(pTDFX, SST_FIFO_RDPTRL0); + if (dummy==readptr) { + TDFXResetFifo(pScrn); + readptr=dummy; + resets++; + if (resets==3) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Board is not responding.\n"); + return; + } + } start_sec=0; } } @@ -237,24 +270,6 @@ pTDFX->fifoSlots = pTDFX->fifoEnd-pTDFX->fifoPtr-8; } -void TDFXLostContext(ScreenPtr pScreen) -{ - ScrnInfoPtr pScrn; - TDFXPtr pTDFX; - TDFXSAREAPriv *sPriv; - - pScrn = xf86Screens[pScreen->myNum]; - pTDFX=TDFXPTR(pScrn); - sPriv=(TDFXSAREAPriv*)DRIGetSAREAPrivate(pScreen); - if (!sPriv) return; - if (sPriv->fifoPtr!=(((unsigned char*)pTDFX->fifoPtr)-pTDFX->FbBase) || - sPriv->fifoRead!=(((unsigned char*)pTDFX->fifoRead)-pTDFX->FbBase)) { - sPriv->fifoPtr=(((unsigned char*)pTDFX->fifoPtr)-pTDFX->FbBase); - sPriv->fifoRead=(((unsigned char*)pTDFX->fifoRead)-pTDFX->FbBase); - sPriv->fifoOwner=DRIGetContext(pScreen); - /* ErrorF("Out FifoPtr=%d FifoRead=%d\n", sPriv->fifoPtr, sPriv->fifoRead); */ - } -} #endif static void @@ -285,8 +300,13 @@ /* ** Put a jump command in command fifo to wrap to the beginning. */ +#if X_BYTE_ORDER == X_BIG_ENDIAN + WRITE_FIFO(pTDFX, 0, (pTDFX->fifoOffset >> 2) << SSTCP_PKT0_ADDR_SHIFT | + SSTCP_PKT0_JMP_LOCAL); +#else *pTDFX->fifoPtr = (pTDFX->fifoOffset >> 2) << SSTCP_PKT0_ADDR_SHIFT | SSTCP_PKT0_JMP_LOCAL; +#endif FLUSH_WCB(); /* Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h:1.9.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h:1.7 Fri Dec 15 10:19:35 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h Tue May 22 17:25:45 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h,v 1.7 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_priv.h,v 1.9.2.1 2001/05/22 21:25:45 dawes Exp $ */ #ifndef _TDFX_FIFO_H_ @@ -11,7 +11,7 @@ typedef short int16; typedef char int8; -#define CMDFIFO_PAGES 64 +#define CMDFIFO_PAGES 255 #define PROPSAREADATA \ volatile int fifoPtr; \ @@ -82,11 +82,30 @@ Bool TDFXInitFifo(ScreenPtr pScreen); void TDFXShutdownFifo(ScreenPtr pScreen); void TDFXAllocateSlots(TDFXPtr pTDFX, int slots); +void TDFXSendNOPFifo2D(ScrnInfoPtr pScreen); #define CHECK_FOR_ROOM(_n) \ if ((pTDFX->fifoSlots -= (_n)) < 0) \ cmdfifo_make_room(adapter, fifo_ptr, _n); \ +#if X_BYTE_ORDER == X_BIG_ENDIAN +#define BE_BSWAP32(val) ((((val) & 0x000000ff) << 24) | \ + (((val) & 0x0000ff00) << 8) | \ + (((val) & 0x00ff0000) >> 8) | \ + (((val) & 0xff000000) >> 24)) + +#define BE_WSWAP32(val) ((((val) & 0x0000ffff) << 16) | \ + (((val) & 0xffff0000) >> 16)) + void TDFXWriteFifo_24(TDFXPtr pTDFX, int val); + void TDFXWriteFifo_16(TDFXPtr pTDFX, int val); + void TDFXWriteFifo_8(TDFXPtr pTDFX, int val); +#else +/* Don't swap on little-endian platforms */ +#define BE_BSWAP32(val) val +#define BE_WSWAP32(val) val +#endif + + #ifdef DEBUG_FIFO #define WRITE_FIFO(ptr, loc, _val) \ do { \ @@ -94,19 +113,30 @@ *pTDFX->fifoPtr++ = _val; \ } while(0) #else +#if X_BYTE_ORDER == X_BIG_ENDIAN +#define WRITE_FIFO(ptr, loc, _val) \ + do { \ + pTDFX->writeFifo(ptr, _val); \ + } while (0) +#else #define WRITE_FIFO(ptr, loc, _val) \ do { \ *pTDFX->fifoPtr++ = _val; \ } while(0) -#endif +#endif /* X_BYTE_ORDER == X_BIG_ENDIAN */ +#endif /* DEBUG_FIFO */ +#if X_BYTE_ORDER == X_BIG_ENDIAN +#define FLUSH_WCB() +#else #define FLUSH_WCB() inb(0x80) +#endif /* ** Send a packet header type 1 (2D) to the cmdfifo */ #define SET_2DPK1_HEADER(_ndwords, _inc, _reg) \ - WRITE_FIFO ( 0, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \ + WRITE_FIFO ( pTDFX, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \ ((_inc) ? SSTCP_PKT1_INC : SSTCP_PKT1_NOINC) | \ SSTCP_PKT1_2D | \ FIELD_OFFSET(H3_2D_REGISTERS, _reg)/4 << SSTCP_REGBASE_SHIFT | \ @@ -117,7 +147,7 @@ ** Send a packet header type 1 to begin at launchArea[0] to the cmdfifo */ #define SET_PK1_HEADER_LAUNCH(_ndwords, _inc) \ - WRITE_FIFO ( 0, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \ + WRITE_FIFO ( pTDFX, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \ ((_inc) ? SSTCP_PKT1_INC : SSTCP_PKT1_NOINC) | \ SSTCP_PKT1_LAUNCH | SSTCP_PKT1 \ ) @@ -126,7 +156,7 @@ ** Send a packet header type 1 to begin at colorPattern[0] to the cmdfifo */ #define SET_PK1_HEADER_COLORPATTERN(_ndwords, _inc) \ - WRITE_FIFO ( 0, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \ + WRITE_FIFO ( pTDFX, 0, (_ndwords) << SSTCP_PKT1_NWORDS_SHIFT | \ ((_inc) ? SSTCP_PKT1_INC : SSTCP_PKT1_NOINC) | \ SSTCP_PKT1_COLORPATTERN | SSTCP_PKT1 \ ) @@ -135,7 +165,7 @@ ** Send a packet header type 2 to the cmdfifo */ #define SET_PKT2_HEADER(_mask) \ - WRITE_FIFO (0, 0, ((_mask) << SSTCP_PKT2_MASK_SHIFT) | SSTCP_PKT2) + WRITE_FIFO (pTDFX, 0, ((_mask) << SSTCP_PKT2_MASK_SHIFT) | SSTCP_PKT2) /* ** These are used to select a register mask for use with @@ -159,14 +189,14 @@ #define R13 (1 << 13) #define SET_2DPK4_HEADER(_mask, _reg0) \ - WRITE_FIFO ( 0, 0, ((_mask) << SSTCP_PKT4_MASK_SHIFT) | \ + WRITE_FIFO ( pTDFX, 0, ((_mask) << SSTCP_PKT4_MASK_SHIFT) | \ SSTCP_PKT4_2D | \ (_reg0) | \ SSTCP_PKT4 \ ) #define SET_3DPK4_HEADER(_mask, _reg0) \ - WRITE_FIFO ( 0, 0, ((_mask) << SSTCP_PKT4_MASK_SHIFT) | \ + WRITE_FIFO ( pTDFX, 0, ((_mask) << SSTCP_PKT4_MASK_SHIFT) | \ (_reg0) | \ SSTCP_PKT4 \ ) Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c:1.6 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c:1.7 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c:1.6 Fri Dec 15 10:19:35 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c Wed Mar 21 12:02:26 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c,v 1.6 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_sli.c,v 1.7 2001/03/21 17:02:26 dawes Exp $ */ #include "xf86.h" #include "xf86_ansic.h" @@ -12,7 +12,7 @@ /* #define RD_ABORT_ERROR */ #define H3VDD -static Bool TDFXDisableSLI(TDFXPtr pTDFX) +Bool TDFXDisableSLI(TDFXPtr pTDFX) { int i; int v; Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c:1.5 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c:1.10.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c:1.5 Fri Dec 8 16:53:37 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c Tue May 22 17:25:45 2001 @@ -1,80 +1,120 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.5 2000/12/08 21:53:37 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfx_video.c,v 1.10.2.1 2001/05/22 21:25:45 dawes Exp $ */ -/* Adapted from ../mga/mga_video.c */ - #include "xf86.h" -#include "xf86_OSproc.h" -#include "xf86Resources.h" -#include "xf86_ansic.h" -#include "compiler.h" -#include "xf86PciInfo.h" -#include "xf86Pci.h" -#include "xf86fbman.h" -#include "regionstr.h" - #include "tdfx.h" +#include "dixstruct.h" -#include "xf86xv.h" #include "Xv.h" -#include "xaa.h" -#include "xaalocal.h" -#include "dixstruct.h" #include "fourcc.h" +static Atom xvColorKey, xvFilterQuality; + /* These should move into tdfxdefs.h with better names */ -#define YUV_Y_BASE 0xC00000 -#define YUV_U_BASE 0xD00000 -#define YUV_V_BASE 0xE00000 +#define YUV_Y_BASE 0xC00000 +#define YUV_U_BASE 0xD00000 +#define YUV_V_BASE 0xE00000 -#define SST_2D_FORMAT_YUYV 0x8 -#define SST_2D_FORMAT_UYVY 0x9 +#define SST_2D_FORMAT_YUYV 0x8 +#define SST_2D_FORMAT_UYVY 0x9 #define YUVBASEADDR 0x80100 -/* This should move to tdfx.h - * Only one port for now due to need for better memory allocation. */ -#define TDFX_MAX_PORTS 1 - #define YUVSTRIDE 0x80104 +#define VIDPROCCFGMASK 0xa2e3eb6c -#ifndef XvExtension -void TDFXInitVideo(ScreenPtr pScreen) {} -#else +#define OFF_DELAY 250 /* milliseconds */ +#define FREE_DELAY 15000 +#define OFF_TIMER 0x01 +#define FREE_TIMER 0x02 +#define CLIENT_VIDEO_ON 0x04 +#define TIMER_MASK (OFF_TIMER | FREE_TIMER) + +#define TDFX_MAX_OVERLAY_PORTS 1 +#define TDFX_MAX_TEXTURE_PORTS 32 + +/* Doesn't matter what screen we use */ +#define DummyScreen screenInfo.screens[0] + +/* Needed for attribute atoms */ +#define MAKE_ATOM(a) MakeAtom(a, sizeof(a) - 1, TRUE) + +/* + * PROTOTYPES + */ + +static FBAreaPtr TDFXAllocateMemoryArea (ScrnInfoPtr pScrn, FBAreaPtr area, int width, int height); +static FBLinearPtr TDFXAllocateMemoryLinear (ScrnInfoPtr pScrn, FBLinearPtr linear, int size); +static void TDFXVideoTimerCallback(ScrnInfoPtr pScrn, Time time); + +static XF86VideoAdaptorPtr TDFXSetupImageVideoTexture(ScreenPtr); +static int TDFXSetPortAttributeTexture(ScrnInfoPtr, Atom, INT32, pointer); +static int TDFXGetPortAttributeTexture(ScrnInfoPtr, Atom ,INT32 *, pointer); +static int TDFXPutImageTexture(ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static void TDFXStopVideoTexture(ScrnInfoPtr, pointer, Bool); + +static XF86VideoAdaptorPtr TDFXSetupImageVideoOverlay(ScreenPtr); +static int TDFXSetPortAttributeOverlay(ScrnInfoPtr, Atom, INT32, pointer); +static int TDFXGetPortAttributeOverlay(ScrnInfoPtr, Atom ,INT32 *, pointer); +static int TDFXPutImageOverlay(ScrnInfoPtr, short, short, short, short, short, short, short, short, int, unsigned char*, short, short, Bool, RegionPtr, pointer); +static void TDFXStopVideoOverlay(ScrnInfoPtr, pointer, Bool); +static void TDFXResetVideoOverlay(ScrnInfoPtr); + +static void TDFXQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, unsigned int *, unsigned int *, pointer); +static int TDFXQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, unsigned short *, int *, int *); + +/* + * ADAPTOR INFORMATION + */ -void TDFXInitVideo(ScreenPtr pScreen); -void TDFXCloseVideo (ScreenPtr pScreen); +static XF86VideoEncodingRec OverlayEncoding[] = +{ + { 0, "XV_IMAGE", 2048, 2048, {1, 1} } +}; -static XF86VideoAdaptorPtr TDFXSetupImageVideo(ScreenPtr); -static int TDFXSetPortAttribute(ScrnInfoPtr, Atom, INT32, pointer); -static int TDFXGetPortAttribute(ScrnInfoPtr, Atom ,INT32 *, pointer); - -static void TDFXStopVideo(ScrnInfoPtr, pointer, Bool); -static void TDFXQueryBestSize(ScrnInfoPtr, Bool, short, short, short, short, - unsigned int *, unsigned int *, pointer); -static int TDFXPutImage(ScrnInfoPtr, short, short, short, short, short, - short, short, short, int, unsigned char*, short, - short, Bool, RegionPtr, pointer); -#if 0 -/* This isn't done yet, but eventually it will put images to the - * video overlay. */ -static int TDFXPutImageOverlay(ScrnInfoPtr pScrn, short, short, - short, short, short, short, - short, short, int, unsigned char*, - short, short, Bool, RegionPtr , pointer); -#endif +static XF86VideoEncodingRec TextureEncoding[] = +{ + { 0, "XV_IMAGE", 1024, 1024, {1, 1} } +}; -static int TDFXQueryImageAttributes(ScrnInfoPtr, int, unsigned short *, - unsigned short *, int *, int *); +static XF86VideoFormatRec OverlayFormats[] = +{ + {8, TrueColor}, {8, DirectColor}, {8, PseudoColor}, + {8, GrayScale}, {8, StaticGray}, {8, StaticColor}, + {15, TrueColor}, {16, TrueColor}, {24, TrueColor}, + {15, DirectColor}, {16, DirectColor}, {24, DirectColor} +}; -/* These function is from tdfx_accel.c */ -extern void TDFXFirstSync(ScrnInfoPtr pScrn); +static XF86VideoFormatRec TextureFormats[] = +{ + {15, TrueColor}, {16, TrueColor}, {24, TrueColor} +}; -static FBAreaPtr -TDFXAllocateOffscreenBuffer (ScrnInfoPtr pScrn, int id, int width, int height); +static XF86AttributeRec OverlayAttributes[] = +{ + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_FILTER_QUALITY"} +}; -static void -TDFXDeallocateOffscreenBuffer (ScrnInfoPtr pScrn, int id); +static XF86AttributeRec TextureAttributes[] = +{ + {XvSettable | XvGettable, 0, (1 << 24) - 1, "XV_COLORKEY"}, + {XvSettable | XvGettable, 0, 1, "XV_FILTER_QUALITY"} +}; +static XF86ImageRec OverlayImages[] = +{ + XVIMAGE_YUY2, XVIMAGE_UYVY, XVIMAGE_YV12, XVIMAGE_I420 +}; + +static XF86ImageRec TextureImages[] = +{ + XVIMAGE_YV12, XVIMAGE_I420 +}; + +/* + * COMMON SETUP FUNCTIONS + */ + void TDFXInitVideo(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; @@ -87,685 +127,1000 @@ if(pTDFX->cpp == 1) return; - newAdaptor = TDFXSetupImageVideo(pScreen); + /* Start with the generic adaptors */ + num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); - /* Initialize the offscreen buffer */ - pTDFX->offscreenYUVBuf = 0; + if(!pTDFX->AccelInfoRec || !pTDFX->AccelInfoRec->FillSolidRects) + return; - num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); + if (!pTDFX->TextureXvideo) { + /* Overlay adaptor */ + newAdaptor = TDFXSetupImageVideoOverlay(pScreen); + } else { + /* Texture adaptor */ + newAdaptor = TDFXSetupImageVideoTexture(pScreen); + } + /* Add the adaptor to the list */ 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++; - } - } + newAdaptors = xalloc((num_adaptors + 1) * sizeof(XF86VideoAdaptorPtr*)); + if(newAdaptors) { + if (num_adaptors) memcpy(newAdaptors, adaptors, num_adaptors * sizeof(XF86VideoAdaptorPtr)); + newAdaptors[num_adaptors] = newAdaptor; + adaptors = newAdaptors; + num_adaptors++; + } } if(num_adaptors) - { - xf86XVScreenInit(pScreen, adaptors, num_adaptors); - } + xf86XVScreenInit(pScreen, adaptors, num_adaptors); if(newAdaptors) - xfree(newAdaptors); + xfree(newAdaptors); } + void TDFXCloseVideo (ScreenPtr pScreen) { - } + -/* client libraries expect an encoding */ -static XF86VideoEncodingRec DummyEncoding[1] = +static XF86VideoAdaptorPtr +TDFXAllocAdaptor(ScrnInfoPtr pScrn, int numberPorts) { - { /* blit limit */ - 0, - "XV_IMAGE", - 1024, 0, /* Height is a limitation of pixmap space, and filled in later. */ - {1, 1} - } -}; + XF86VideoAdaptorPtr adapt; + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv; -#define NUM_FORMATS_OVERLAY 3 + if(!(adapt = xf86XVAllocateVideoAdaptorRec(pScrn))) + return NULL; -static XF86VideoFormatRec Formats[NUM_FORMATS_OVERLAY] = -{ - {15, TrueColor}, {16, TrueColor}, {24, TrueColor}, -}; + if(!(pPriv = xcalloc(1, sizeof(TDFXPortPrivRec) + (numberPorts * sizeof(DevUnion))))) + { + xfree(adapt); + return NULL; + } -/* #define NUM_IMAGES 4*/ -#define NUM_IMAGES 2 + adapt->pPortPrivates = (DevUnion*)(&pPriv[1]); + adapt->pPortPrivates[0].ptr = (pointer)pPriv; -static XF86ImageRec Images[NUM_IMAGES] = -{ - XVIMAGE_YV12, /* YVU planar */ - XVIMAGE_I420 /* YUV planar */ -#if 0 - /* These could be supported (without a temp bufer) using the - * host-to-screen-stretch */ - XVIMAGE_YUY2, /* YUYV packed */ - XVIMAGE_UYVY /* UYVY packed */ -#endif -}; + xvColorKey = MAKE_ATOM("XV_COLORKEY"); + xvFilterQuality = MAKE_ATOM("XV_FILTER_QUALITY"); + pPriv->colorKey = pTDFX->videoKey; + pPriv->videoStatus = 0; + pPriv->filterQuality = 1; + + return adapt; +} + static XF86VideoAdaptorPtr -TDFXAllocAdaptor(ScrnInfoPtr pScrn) +TDFXSetupImageVideoOverlay(ScreenPtr pScreen) { - DevUnion *devUnions; - int i; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv; XF86VideoAdaptorPtr adapt; - if(!(adapt = xf86XVAllocateVideoAdaptorRec(pScrn))) - return NULL; - /* Allocate a TDFX private structure */ - /* There is no need for a TDFX private structure at this time. But a - * DevUnion has to be provided to the core Xv code. */ - if (!(devUnions = xcalloc (1, sizeof (DevUnion) * TDFX_MAX_PORTS))) - { - xfree (adapt); - return NULL; - } - adapt->pPortPrivates = &devUnions[0]; - - /* Fill in some of the DevUnion */ - for (i = 0; i < TDFX_MAX_PORTS; i++) - { - adapt->pPortPrivates[i].val = i; - adapt->pPortPrivates[i].ptr = NULL; /* No private data */ - } - - return adapt; -} + if(!(adapt = TDFXAllocAdaptor(pScrn, TDFX_MAX_OVERLAY_PORTS))) + return NULL; + + adapt->type = XvWindowMask | XvInputMask | XvImageMask; + adapt->flags = VIDEO_OVERLAID_IMAGES | VIDEO_CLIP_TO_VIEWPORT; + adapt->name = "3dfx Video Overlay"; + adapt->nPorts = TDFX_MAX_OVERLAY_PORTS; + adapt->nEncodings = sizeof(OverlayEncoding) / sizeof(XF86VideoEncodingRec); + adapt->pEncodings = OverlayEncoding; + adapt->nFormats = sizeof(OverlayFormats) / sizeof(XF86VideoFormatRec); + adapt->pFormats = OverlayFormats; + adapt->nAttributes = sizeof(OverlayAttributes) / sizeof(XF86AttributeRec); + adapt->pAttributes = OverlayAttributes; + adapt->nImages = sizeof(OverlayImages) / sizeof(XF86ImageRec); + adapt->pImages = OverlayImages; + adapt->PutVideo = NULL; + adapt->PutStill = NULL; + adapt->GetVideo = NULL; + adapt->GetStill = NULL; + adapt->StopVideo = TDFXStopVideoOverlay; + adapt->SetPortAttribute = TDFXSetPortAttributeOverlay; + adapt->GetPortAttribute = TDFXGetPortAttributeOverlay; + adapt->QueryBestSize = TDFXQueryBestSize; + adapt->PutImage = TDFXPutImageOverlay; + adapt->QueryImageAttributes = TDFXQueryImageAttributes; + + pTDFX->overlayAdaptor = adapt; + + pPriv = (TDFXPortPrivPtr)(adapt->pPortPrivates[0].ptr); + REGION_INIT(pScreen, &(pPriv->clip), NullBox, 0); + TDFXResetVideoOverlay(pScrn); + return adapt; +} -static XF86VideoAdaptorPtr -TDFXSetupImageVideo(ScreenPtr pScreen) +static XF86VideoAdaptorPtr +TDFXSetupImageVideoTexture(ScreenPtr pScreen) { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - XF86VideoAdaptorPtr adapt; TDFXPtr pTDFX = TDFXPTR(pScrn); - - DummyEncoding[0].height = pTDFX->pixmapCacheLines; + XF86VideoAdaptorPtr adapt; + int i; - adapt = TDFXAllocAdaptor(pScrn); + if(!(adapt = TDFXAllocAdaptor(pScrn, TDFX_MAX_TEXTURE_PORTS))) + return NULL; adapt->type = XvWindowMask | XvInputMask | XvImageMask; - /* Add VIDEO_OVERLAID_IMAGES if using the overlay */ adapt->flags = 0; - adapt->name = "3dfx Accelerated Video Engine"; - adapt->nEncodings = 1; - adapt->pEncodings = &DummyEncoding[0]; - adapt->nFormats = NUM_FORMATS_OVERLAY; - adapt->pFormats = Formats; - adapt->nPorts = TDFX_MAX_PORTS; - adapt->nAttributes = 0; - adapt->pAttributes = NULL; - adapt->nImages = NUM_IMAGES; - adapt->pImages = Images; - - /* XXX For now all I'm implementing is PutImage so that programs like OMS - * will work. More will follow as I have time and need. */ + adapt->name = "3dfx Video Texture"; + adapt->nPorts = TDFX_MAX_TEXTURE_PORTS; + adapt->nEncodings = sizeof(TextureEncoding) / sizeof(XF86VideoEncodingRec); + adapt->pEncodings = TextureEncoding; + adapt->nFormats = sizeof(TextureFormats) / sizeof(XF86VideoFormatRec); + adapt->pFormats = TextureFormats; + adapt->nAttributes = sizeof(TextureAttributes) / sizeof(XF86AttributeRec); + adapt->pAttributes = TextureAttributes; + adapt->nImages = sizeof(TextureImages) / sizeof(XF86ImageRec); + adapt->pImages = TextureImages; adapt->PutVideo = NULL; adapt->PutStill = NULL; adapt->GetVideo = NULL; adapt->GetStill = NULL; - adapt->StopVideo = TDFXStopVideo; - adapt->SetPortAttribute = TDFXSetPortAttribute; - adapt->GetPortAttribute = TDFXGetPortAttribute; + adapt->StopVideo = TDFXStopVideoTexture; + adapt->SetPortAttribute = TDFXSetPortAttributeTexture; + adapt->GetPortAttribute = TDFXGetPortAttributeTexture; adapt->QueryBestSize = TDFXQueryBestSize; - adapt->PutImage = TDFXPutImage; - /*adapt->PutImage = TDFXPutImageOverlay; */ + adapt->PutImage = TDFXPutImageTexture; adapt->QueryImageAttributes = TDFXQueryImageAttributes; + for(i = 0; i < TDFX_MAX_TEXTURE_PORTS; i++) + adapt->pPortPrivates[i].val = i; + + pTDFX->textureAdaptor = adapt; + return adapt; } -static void -TDFXStopVideo(ScrnInfoPtr pScrn, pointer data, Bool cleanup) -{ - if (cleanup) - { - /* Deallocate the offscreen temporary buffer. */ - TDFXDeallocateOffscreenBuffer (pScrn, 0); - } +/* + * MISCELLANEOUS ROUTINES + */ + +static Bool +TDFXClipVideo( + BoxPtr dst, + INT32 *xa, + INT32 *xb, + INT32 *ya, + INT32 *yb, + RegionPtr reg, + INT32 width, + INT32 height +){ + INT32 vscale, hscale, delta; + BoxPtr extents = REGION_EXTENTS(DummyScreen, reg); + int diff; + + hscale = ((*xb - *xa) << 16) / (dst->x2 - dst->x1); + vscale = ((*yb - *ya) << 16) / (dst->y2 - dst->y1); + + *xa <<= 16; *xb <<= 16; + *ya <<= 16; *yb <<= 16; + + diff = extents->x1 - dst->x1; + if(diff > 0) { + dst->x1 = extents->x1; + *xa += diff * hscale; + } + diff = dst->x2 - extents->x2; + if(diff > 0) { + dst->x2 = extents->x2; + *xb -= diff * hscale; + } + diff = extents->y1 - dst->y1; + if(diff > 0) { + dst->y1 = extents->y1; + *ya += diff * vscale; + } + diff = dst->y2 - extents->y2; + if(diff > 0) { + dst->y2 = extents->y2; + *yb -= diff * vscale; + } + + if(*xa < 0) { + diff = (- *xa + hscale - 1)/ hscale; + dst->x1 += diff; + *xa += diff * hscale; + } + delta = *xb - (width << 16); + if(delta > 0) { + diff = (delta + hscale - 1)/ hscale; + dst->x2 -= diff; + *xb -= diff * hscale; + } + if(*xa >= *xb) return FALSE; + + if(*ya < 0) { + diff = (- *ya + vscale - 1)/ vscale; + dst->y1 += diff; + *ya += diff * vscale; + } + delta = *yb - (height << 16); + if(delta > 0) { + diff = (delta + vscale - 1)/ vscale; + dst->y2 -= diff; + *yb -= diff * vscale; + } + if(*ya >= *yb) return FALSE; + + if((dst->x1 != extents->x1) || (dst->x2 != extents->x2) || + (dst->y1 != extents->y1) || (dst->y2 != extents->y2)) + { + RegionRec clipReg; + REGION_INIT(DummyScreen, &clipReg, dst, 1); + REGION_INTERSECT(DummyScreen, reg, reg, &clipReg); + REGION_UNINIT(DummyScreen, &clipReg); + } + return TRUE; +} + +static int +TDFXQueryImageAttributes( + ScrnInfoPtr pScrn, + int id, + unsigned short *w, unsigned short *h, + int *pitches, int *offsets +){ + int size, tmp; + + if(*w > 1024) *w = 1024; + if(*h > 1024) *h = 1024; + + *w = (*w + 1) & ~1; + if(offsets) offsets[0] = 0; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + *h = (*h + 1) & ~1; + size = (*w + 3) & ~3; + if(pitches) pitches[0] = size; + size *= *h; + if(offsets) offsets[1] = size; + tmp = ((*w >> 1) + 3) & ~3; + if(pitches) pitches[1] = pitches[2] = tmp; + tmp *= (*h >> 1); + size += tmp; + if(offsets) offsets[2] = size; + size += tmp; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + size = *w << 1; + if(pitches) pitches[0] = size; + size *= *h; + break; + } + + return size; } -static int -TDFXSetPortAttribute (ScrnInfoPtr pScrn, - Atom attribute, - INT32 value, - pointer data) -{ - return BadMatch; +static int +TDFXSetPortAttributeOverlay( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value, + pointer data +){ + + TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; + TDFXPtr pTDFX = TDFXPTR(pScrn); + + if(attribute == xvColorKey) { + pPriv->colorKey = value; + pTDFX->writeLong(pTDFX, VIDCHROMAMIN, pPriv->colorKey); + pTDFX->writeLong(pTDFX, VIDCHROMAMAX, pPriv->colorKey); + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + } else if(attribute == xvFilterQuality) { + if((value < 0) || (value > 1)) + return BadValue; + pPriv->filterQuality = value; + } else return BadMatch; + + return Success; } +static int +TDFXGetPortAttributeOverlay( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data +){ + TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; + + if(attribute == xvColorKey) { + *value = pPriv->colorKey; + } else if(attribute == xvFilterQuality) { + *value = pPriv->filterQuality; + } else return BadMatch; + + return Success; +} + static int -TDFXGetPortAttribute(ScrnInfoPtr pScrn, - Atom attribute, - INT32 *value, - pointer data) -{ - return BadMatch; +TDFXSetPortAttributeTexture( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 value, + pointer data +) { + return Success; } +static int +TDFXGetPortAttributeTexture( + ScrnInfoPtr pScrn, + Atom attribute, + INT32 *value, + pointer data +){ + return Success; +} -static void -TDFXQueryBestSize(ScrnInfoPtr pScrn, - Bool motion, - short vid_w, short vid_h, - short drw_w, short drw_h, - unsigned int *p_w, unsigned int *p_h, - pointer data) -{ - /* No alignment restrictions */ + +static void +TDFXQueryBestSize( + ScrnInfoPtr pScrn, + Bool motion, + short vid_w, short vid_h, + short drw_w, short drw_h, + unsigned int *p_w, unsigned int *p_h, + pointer data +){ + if(vid_w > drw_w) drw_w = vid_w; + if(vid_h > drw_h) drw_h = vid_h; + *p_w = drw_w; - *p_h = drw_h; + *p_h = drw_h; } - -/* This performs a screen to screen stretch blit. All coordinates are - * in screen memory. This function assumes that the src and dst format - * registers have been setup already. This function does not save - * the registers it trashes. */ static void -TDFXScreenToScreenYUVStretchBlit (ScrnInfoPtr pScrn, - short src_x1, short src_y1, - short src_x2, short src_y2, - short dst_x1, short dst_y1, - short dst_x2, short dst_y2) -{ - TDFXPtr pTDFX = TDFXPTR(pScrn); +TDFXCopyData( + unsigned char *src, + unsigned char *dst, + int srcPitch, + int dstPitch, + int h, + int w +){ +#if X_BYTE_ORDER == X_BIG_ENDIAN + w >>= 1; + while(h--) { + int i; + for (i=0; i<w; i++) + ((unsigned long *)dst)[i]=BE_WSWAP32(((unsigned long *)src)[i]); + src += srcPitch; + dst += dstPitch; + } +#else + w <<= 1; + while(h--) { + memcpy(dst, src, w); + src += srcPitch; + dst += dstPitch; + } +#endif +} - /* reformulate the paramaters the way the hardware wants them */ - INT32 - src_x = src_x1 & 0x1FFF, - src_y = src_y1 & 0x1FFF, - dst_x = dst_x1 & 0x1FFF, - dst_y = dst_y1 & 0x1FFF, - src_w = (src_x2 - src_x) & 0x1FFF, - src_h = (src_y2 - src_y) & 0x1FFF, - dst_w = (dst_x2 - dst_x) & 0x1FFF, - dst_h = (dst_y2 - dst_y) & 0x1FFF; - - /* Setup for blit src and dest */ - TDFXMakeRoom(pTDFX, 5); - DECLARE(SSTCP_DSTSIZE|SSTCP_SRCSIZE|SSTCP_DSTXY| - SSTCP_COMMAND|SSTCP_COMMANDEXTRA); - /* We want the blit to wait for vsync. */ - TDFXWriteLong(pTDFX, SST_2D_COMMANDEXTRA, 4); - TDFXWriteLong(pTDFX, SST_2D_SRCSIZE, src_w | (src_h<<16)); - TDFXWriteLong(pTDFX, SST_2D_DSTSIZE, dst_w | (dst_h<<16)); - TDFXWriteLong(pTDFX, SST_2D_DSTXY, dst_x | (dst_y<<16)); - /* XXX find the ROP table and figure out why CC is the right choice. */ - TDFXWriteLong(pTDFX, SST_2D_COMMAND, - (0xCC<<24)|SST_2D_SCRNTOSCRNSTRETCH); - /* Write to the launch area to start the blit */ - TDFXMakeRoom(pTDFX, 1); - DECLARE_LAUNCH (1, 0); - TDFXWriteLong(pTDFX, SST_2D_LAUNCH, src_x | (src_y<<16)); +static void +TDFXCopyMungedData( + unsigned char *src1, + unsigned char *src2, + unsigned char *src3, + unsigned char *dst1, + int srcPitch, + int srcPitch2, + int dstPitch, + int h, + int w +){ + CARD32 *dst; + CARD8 *s1, *s2, *s3; + int i, j; + + w >>= 1; + + for(j = 0; j < h; j++) { + dst = (CARD32*)dst1; + s1 = src1; s2 = src2; s3 = src3; + i = w; + while(i > 4) { + dst[0] = BE_WSWAP32(s1[0] | (s1[1] << 16) | (s3[0] << 8) | + (s2[0] << 24)); + dst[1] = BE_WSWAP32(s1[2] | (s1[3] << 16) | (s3[1] << 8) | + (s2[1] << 24)); + dst[2] = BE_WSWAP32(s1[4] | (s1[5] << 16) | (s3[2] << 8) | + (s2[2] << 24)); + dst[3] = BE_WSWAP32(s1[6] | (s1[7] << 16) | (s3[3] << 8) | + (s2[3] << 24)); + dst += 4; s2 += 4; s3 += 4; s1 += 8; + i -= 4; + } + while(i--) { + dst[0] = BE_WSWAP32(s1[0] | (s1[1] << 16) | (s3[0] << 8) | + (s2[0] << 24)); + dst++; s2++; s3++; + s1 += 2; + } + + dst1 += dstPitch; + src1 += srcPitch; + if(j & 1) { + src2 += srcPitch2; + src3 += srcPitch2; + } + } } + +/* + * TEXTURE DRAWING FUNCTIONS + */ + + static void -YUVPlanarToPacked (ScrnInfoPtr pScrn, - short src_x, short src_y, - short src_h, short src_w, - int id, char *buf, - short width, short height, - FBAreaPtr fbarea) +TDFXStopVideoTexture(ScrnInfoPtr pScrn, pointer data, Bool cleanup) { TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; - INT32 y; - void *dst; - char *psrc = buf, - *pdst = 0; - int count = 0; - - /* Register saves */ - INT32 - yuvBaseAddr, - yuvStride; - - /* Save these registers so I can restore them when we are done. */ - yuvBaseAddr = TDFXReadLongMMIO(pTDFX, YUVBASEADDR); - yuvStride = TDFXReadLongMMIO(pTDFX, YUVSTRIDE); - - - dst = 0; - - /* Set yuvBaseAddress register to point to the buffer. */ - TDFXWriteLongMMIO (pTDFX, YUVBASEADDR, pTDFX->fbOffset + - pTDFX->stride * (fbarea->box.y1 + pScrn->virtualY) - + fbarea->box.x1); - /* Set yuvStride register to reflect stride of U and V planes */ - /* There is a subtle issue involved with copying the Y plane. Y is - * sampled at twice the rate of the U and V data, in both - * directions. But when packing their needs to be two Y values for - * each U,V pair. So if src_x is odd we will end up missing on - * of the Y values. To correct for this we will always adjust the src - * x value. This adjust is done both in computing the address of the - * pixels to copy and when determining the amount of pixels to copy. - * Note that care needs to be taken to insure that the offscreen - * temporary buffer is allocated with enough space to hold the possible - * extra column of data. - */ - TDFXWriteLongMMIO (pTDFX, YUVSTRIDE, pTDFX->stride); - psrc = (char*)buf; - - /* psrc points to the base of the Y plane, move out to src_x, src_y */ - psrc += (src_x & ~0x1) + src_y * width; - pdst = (char *)pTDFX->MMIOBase[0] + YUV_Y_BASE; - for (y = 0; y < src_h; y++) - { - memcpy (pdst, psrc, src_w + (src_x & 0x1)); - psrc += width; - /* YUV planar region is always 1024 bytes wide */ - pdst += 1024; - } + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); - /* The difference between FOURCC_YV12 and FOURCC_I420 is the order - * that the U and V planes appear in the buffer. But at this point - * I just send the second buffer as V and the third buffer as U. - * Depending on the format, the packing will be different and we - * handle it in the the way we pick the source format for the blit - * later on. */ - - pdst = (char *)pTDFX->MMIOBase[0] + YUV_V_BASE; - psrc = (char*)buf + width * height; - /* psrc now points to the base of the V plane, move out to src_x/2, - * src_y/2 */ - psrc += (src_x >> 1) + (src_y >> 1) * (width >> 1); - for (y = 0; y < src_h >> 1; y++) - { - /* YUV planar region is always 1024 bytes wide */ - memcpy (pdst, psrc, src_w >> 1); - psrc += width >> 1; - pdst += 1024; - } - pdst = (char *)pTDFX->MMIOBase[0] + YUV_U_BASE; - psrc = (char*)buf + width * height + (width >> 1) * (height >> 1); - /* psrc now points to the base of the U plane, move out to src_x/2, - * src_y/2 */ - psrc += (src_x >> 1) + (src_y >> 1) * (width >> 1); - for (y = 0; y < src_h >> 1; y++) - { - /* YUV planar region is always 1024 bytes wide */ - memcpy (pdst, psrc, src_w >> 1); - psrc += width >> 1; - pdst += 1024; + if (cleanup) { + if(pTDFX->textureBuffer) { + xf86FreeOffscreenArea(pTDFX->textureBuffer); + pTDFX->textureBuffer = NULL; + } } - - /* Before restoring trashed registers we have to wait for the conversion - * to finish. We aren't using the FIFO for this but the hardware can - * take a little extra time even after we finish all the writes. If we - * restore the registers before it finishes it can store some of the YUV - * data to the wrong place. One particular wrong place is often on top - * of the hardware cursor data. So we wait for the status register - * to go idle. */ - /* XXX Right now wait for the whole chip to go idle. This is more than - * is required. Find out which subsystem is handles the YUV packing and - * wait only on that status bit. */ - count = 0; - do - { - count++; - } while ((TDFXReadLongMMIO(pTDFX, 0) & SST_BUSY) && count < 1000); - - /* Restore trashed registers */ - TDFXWriteLongMMIO(pTDFX, YUVBASEADDR, yuvBaseAddr); - TDFXWriteLongMMIO(pTDFX, YUVSTRIDE, yuvStride); } -static int -TDFXPutImage( - ScrnInfoPtr pScrn, - short src_x, short src_y, - short drw_x, short drw_y, - short src_w, short src_h, - short drw_w, short drw_h, - int id, unsigned char* buf, - short width, short height, - Bool sync, - RegionPtr clipBoxes, pointer data - ) + +static void +TDFXScreenToScreenYUVStretchBlit (ScrnInfoPtr pScrn, + short src_x1, short src_y1, + short src_x2, short src_y2, + short dst_x1, short dst_y1, + short dst_x2, short dst_y2) { TDFXPtr pTDFX = TDFXPTR(pScrn); + /* reformulate the paramaters the way the hardware wants them */ + INT32 src_x = src_x1 & 0x1FFF; + INT32 src_y = src_y1 & 0x1FFF; + INT32 dst_x = dst_x1 & 0x1FFF; + INT32 dst_y = dst_y1 & 0x1FFF; + INT32 src_w = (src_x2 - src_x1) & 0x1FFF; + INT32 src_h = (src_y2 - src_y1) & 0x1FFF; + INT32 dst_w = (dst_x2 - dst_x1) & 0x1FFF; + INT32 dst_h = (dst_y2 - dst_y1) & 0x1FFF; + /* Setup for blit src and dest */ + TDFXMakeRoom(pTDFX, 4); + DECLARE(SSTCP_DSTSIZE|SSTCP_SRCSIZE|SSTCP_DSTXY|SSTCP_COMMAND/*|SSTCP_COMMANDEXTRA*/); + /* TDFXWriteLong(pTDFX, SST_2D_COMMANDEXTRA, SST_COMMANDEXTRA_VSYNC);*/ + TDFXWriteLong(pTDFX, SST_2D_SRCSIZE, src_w | (src_h<<16)); + TDFXWriteLong(pTDFX, SST_2D_DSTSIZE, dst_w | (dst_h<<16)); + TDFXWriteLong(pTDFX, SST_2D_DSTXY, dst_x | (dst_y<<16)); + TDFXWriteLong(pTDFX, SST_2D_COMMAND, SST_2D_SCRNTOSCRNSTRETCH | 0xCC000000); + /* Write to the launch area to start the blit */ + TDFXMakeRoom(pTDFX, 1); + DECLARE_LAUNCH(1, 0); + TDFXWriteLong(pTDFX, SST_2D_LAUNCH, (src_x<<1) | (src_y<<16)); + /* Wait for it to happen */ + TDFXSendNOPFifo2D(pScrn); +} - BoxPtr pbox; - int nbox; - FBAreaPtr fbarea; +static void +YUVPlanarToPacked (ScrnInfoPtr pScrn, + short src_x, short src_y, + short src_h, short src_w, + int id, unsigned char *buf, + short width, short height, + FBAreaPtr fbarea) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + unsigned char *psrc, *pdst; + int count; + int baseaddr; + INT32 yuvBaseAddr, yuvStride; + + /* Save these registers so I can restore them when we are done. */ + yuvBaseAddr = TDFXReadLongMMIO(pTDFX, YUVBASEADDR); + yuvStride = TDFXReadLongMMIO(pTDFX, YUVSTRIDE); + + /* Set yuvBaseAddress and yuvStride. */ + baseaddr = pTDFX->fbOffset + pTDFX->cpp * fbarea->box.x1 + pTDFX->stride * fbarea->box.y1; + TDFXWriteLongMMIO(pTDFX, YUVSTRIDE, pTDFX->stride); + TDFXWriteLongMMIO(pTDFX, YUVBASEADDR, baseaddr); + + /* Copy Y plane (twice as much Y as U or V) */ + psrc = buf; + psrc += (src_x & ~0x1) + src_y * width; + pdst = pTDFX->MMIOBase[0] + YUV_Y_BASE; + TDFXCopyData(psrc, pdst, width, 1024, src_h, src_w + (src_x & 0x1)); + + /* Copy V plane */ + psrc = buf + width * height; + psrc += (src_x >> 1) + (src_y >> 1) * (width >> 1); + pdst = pTDFX->MMIOBase[0] + YUV_V_BASE; + TDFXCopyData(psrc, pdst, width >> 1, 1024, src_h >> 1, src_w >> 1); + + /* Copy U plane */ + psrc = buf + width * height + (width >> 1) * (height >> 1); + psrc += (src_x >> 1) + (src_y >> 1) * (width >> 1); + pdst = pTDFX->MMIOBase[0] + YUV_U_BASE; + TDFXCopyData(psrc, pdst, width >> 1, 1024, src_h >> 1, src_w >> 1); + + /* IDLE until the copy finished, timeout for safety */ + for (count = 0; count < 1000; count++) + if (!((TDFXReadLongMMIO(pTDFX, STATUS) & SST_BUSY))) + break; + + /* Restore trashed registers */ + TDFXWriteLongMMIO(pTDFX, YUVBASEADDR, yuvBaseAddr); + TDFXWriteLongMMIO(pTDFX, YUVSTRIDE, yuvStride); - /* Make sure we are synced up (this really means, lock and find the - * fifo pointer. */ - TDFXFirstSync (pScrn); + /* Wait for it to happen */ + TDFXSendNOPFifo2D(pScrn); +} - /* Do the right thing for the given format */ - switch (id) - { - case FOURCC_YV12: - case FOURCC_I420: - /* Get a buffer to use to store the packed YUV data */ - fbarea = TDFXAllocateOffscreenBuffer (pScrn, id, src_w, src_h); - - if (!fbarea) - { - return Success; - } - YUVPlanarToPacked (pScrn, src_x, src_y, src_h, src_w, - id, (char *)buf, width, height, - fbarea); - /* Don't know what executed last so we need to send a NOP */ - TDFXSendNOP(pScrn); - - /* Setup the dst and src format once, they don't change for all the - * blits. */ - TDFXMakeRoom(pTDFX, 2); - DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); - TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, - pTDFX->stride|((pTDFX->cpp+1)<<16)); - if (id == FOURCC_YV12) - { - /* Packed format is YUYV */ - TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, - pTDFX->stride|((SST_2D_FORMAT_YUYV)<<16)); - } - else - { - /* Packed format is UYVY */ - TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, - pTDFX->stride|((SST_2D_FORMAT_UYVY)<<16)); - } +static int +TDFXPutImageTexture( + ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char* buf, + short width, short height, + Bool sync, + RegionPtr clipBoxes, pointer data + ) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + BoxPtr pbox; + int nbox; + int format; - /* Traverse the clip boxes */ - nbox = REGION_NUM_RECTS(clipBoxes); - pbox = REGION_RECTS(clipBoxes); - - while (nbox--) - { - /* The destination clip regions come with the clip boxes, but - * the src coordinates have to be computed because we are doing - * a stretch blit. These macros perform that compuation, but - * they could use some work. When testing with still images these - * computations caused some jitter in the resulting output, but - * with actual video playback I haven't noticed any problems. */ -#define SRC_X1 (fbarea->box.x1) -#define SRC_Y1 (fbarea->box.y1 + pScrn->virtualY) -#define SCALEX(dx) ((int)(((dx) * src_w + (drw_w>>1)) / drw_w)) -#define SCALEY(dy) ((int)(((dy) * src_h + (drw_h>>1)) / drw_h)) - - /* Do the screen-to-screen blit clipped to the clip boxes. */ - TDFXScreenToScreenYUVStretchBlit - (pScrn, - SRC_X1 + SCALEX(pbox->x1 - drw_x), - SRC_Y1 + SCALEY(pbox->y1 - drw_y), - SRC_X1 + SCALEX(pbox->x2 - drw_x), - SRC_Y1 + SCALEY(pbox->y2 - drw_y), - /* these destination coordinates come - * right from the clip box. */ - pbox->x1, pbox->y1, - pbox->x2, pbox->y2); - pbox++; - } + /* Check the source format */ + if (id == FOURCC_YV12) format = SST_2D_FORMAT_YUYV; + else if (id == FOURCC_UYVY) format = SST_2D_FORMAT_UYVY; + else return BadAlloc; + + /* Get a buffer to store the packed YUV data */ + if (!(pTDFX->textureBuffer = TDFXAllocateMemoryArea(pScrn, pTDFX->textureBuffer, src_w, src_h))) + return BadAlloc; + + /* Pack the YUV data in offscreen memory using YUV framebuffer (0x[CDE]0000) */ + YUVPlanarToPacked (pScrn, src_x, src_y, src_h, src_w, + id, buf, width, height, + pTDFX->textureBuffer); + + /* Setup source and destination pixel formats (yuv -> rgb) */ + TDFXMakeRoom(pTDFX, 2); + DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); + TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, pTDFX->stride|((pTDFX->cpp+1)<<16)); + TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, pTDFX->stride|((format)<<16)); + + /* Blit packed YUV data from offscreen memory, respecting clips */ +#define SRC_X1 (pTDFX->textureBuffer->box.x1) +#define SRC_Y1 (pTDFX->textureBuffer->box.y1) +#define SCALEX(dx) ((int)(((dx) * src_w) / drw_w)) +#define SCALEY(dy) ((int)(((dy) * src_h) / drw_h)) + for (nbox = REGION_NUM_RECTS(clipBoxes), + pbox = REGION_RECTS(clipBoxes); nbox > 0; nbox--, pbox++) + { + TDFXScreenToScreenYUVStretchBlit (pScrn, + SRC_X1 + SCALEX(pbox->x1 - drw_x), + SRC_Y1 + SCALEY(pbox->y1 - drw_y), + SRC_X1 + SCALEX(pbox->x2 - drw_x), + SRC_Y1 + SCALEY(pbox->y2 - drw_y), + pbox->x1, pbox->y1, + pbox->x2, pbox->y2); + } - /* Restore the WAX registers we trashed */ - TDFXMakeRoom(pTDFX, 2); - DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); - TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, pTDFX->sst2DDstFmtShadow); - TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, pTDFX->sst2DSrcFmtShadow); - - /* The rest of the driver won't know what I have done so I do a stall to - * make sure the next command sent will work. */ - TDFXSendNOP(pScrn); - break; - /* XXX What am I supposed to do about the sync flag? */ + /* Restore the WAX registers we trashed */ + TDFXMakeRoom(pTDFX, 2); + DECLARE(SSTCP_SRCFORMAT|SSTCP_DSTFORMAT); + TDFXWriteLong(pTDFX, SST_2D_DSTFORMAT, pTDFX->sst2DDstFmtShadow); + TDFXWriteLong(pTDFX, SST_2D_SRCFORMAT, pTDFX->sst2DSrcFmtShadow); - } + /* Wait for it to happen */ + TDFXSendNOPFifo2D(pScrn); return Success; } -/* This code doesn't work yet. Eventually this should use the video overlay - * instead of the YUV-stretch-blit. The overlay is better because it uses - * bilinear filtering when scaling. */ -#if 0 -static int -TDFXPutImageOverlay( - ScrnInfoPtr pScrn, - short src_x, short src_y, - short drw_x, short drw_y, - short src_w, short src_h, - short drw_w, short drw_h, - int id, unsigned char* buf, - short width, short height, - Bool sync, - RegionPtr clipBoxes, pointer data - ) + +/* + * COMMON DRAWING FUNCTIONS + */ + +static Bool +RegionsEqual(RegionPtr A, RegionPtr B) { - TDFXPtr pTDFX = TDFXPTR(pScrn); + int *dataA, *dataB; + int num; - BoxPtr pbox; - int nbox; + num = REGION_NUM_RECTS(A); + if(num != REGION_NUM_RECTS(B)) + return FALSE; + + if((A->extents.x1 != B->extents.x1) || + (A->extents.x2 != B->extents.x2) || + (A->extents.y1 != B->extents.y1) || + (A->extents.y2 != B->extents.y2)) + return FALSE; + + dataA = (int*)REGION_RECTS(A); + dataB = (int*)REGION_RECTS(B); + + while(num--) { + if((dataA[0] != dataB[0]) || (dataA[1] != dataB[1])) + return FALSE; + dataA += 2; + dataB += 2; + } - /* Computed Register values */ - INT32 - vidInFormat; + return TRUE; +} - static FBAreaPtr fbarea; +/* + * OVERLAY DRAWING FUNCTIONS + */ - /* Do the right thing for the given format */ - switch (id) - { - case FOURCC_YV12: - case FOURCC_I420: - - /* Get a buffer to use to store the packed YUV data */ - fbarea = TDFXAllocateOffscreenBuffer (pScrn, id, src_w, src_h); - - if (!fbarea) - return Success; +static void +TDFXResetVideoOverlay(ScrnInfoPtr pScrn) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = pTDFX->overlayAdaptor->pPortPrivates[0].ptr; - YUVPlanarToPacked (pScrn, - src_x, src_y, src_h, src_w, - id, buf, width, height, - fbarea); - - /* Setup the overlay */ - TDFXWriteLongMMIO(pTDFX, VIDOVERLAYSTARTCOORDS, - (drw_x&0x7FF) | ((drw_y & 0x7FF) << 12) - /* XXX Lower 2 bits of X and Y? */); - TDFXWriteLongMMIO(pTDFX, VIDOVERLAYENDSCREENCOORDS, - ((drw_x+drw_w)&0x7FF) | (((drw_y+drw_h)&0x7FF) << 12)); - - /* Set the Video in format */ - vidInFormat = 0; - /* These magic numbers come from the spec on page 151 */ - if (id == FOURCC_YV12) - { - /* Packed format is YUYV */ - vidInFormat = 0x9 << 1; - } - else - { - /* Packed format is UYVY */ - vidInFormat = 0xA << 1; - } + /* reset the video */ + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); + pTDFX->writeLong(pTDFX, RGBMAXDELTA, 0x0080808); + pTDFX->writeLong(pTDFX, VIDCHROMAMIN, pPriv->colorKey); + pTDFX->writeLong(pTDFX, VIDCHROMAMAX, pPriv->colorKey); +} - TDFXWriteLongMMIO (pTDFX, VIDINFORMAT, vidInFormat); - TDFXWriteLongMMIO (pTDFX, VIDINSTRIDE, src_w); - /* Use magenta as the chroma color */ - if (pTDFX->cpp == 2) - { - TDFXWriteLongMMIO(pTDFX, VIDCHROMAMIN, - 0x0000F71F); - TDFXWriteLongMMIO(pTDFX, VIDCHROMAMAX, - 0x0000F71F); +static void +TDFXStopVideoOverlay(ScrnInfoPtr pScrn, pointer data, Bool cleanup) +{ + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; + + REGION_EMPTY(pScrn->pScreen, &pPriv->clip); + + if(cleanup) { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); } - else /* (pTDFX->cpp == 3) */ - { - TDFXWriteLongMMIO(pTDFX, VIDCHROMAMIN, - 0x00FF00FF); - TDFXWriteLongMMIO(pTDFX, VIDCHROMAMAX, - 0x00FF00FF); + if(pTDFX->overlayBuffer) { + xf86FreeOffscreenLinear(pTDFX->overlayBuffer); + pTDFX->overlayBuffer = NULL; } - - /* Set the src address */ - TDFXWriteLongMMIO (pTDFX, VIDINADDR0, - pTDFX->fbOffset - + pTDFX->stride * (fbarea->box.y1 + pScrn->virtualY) - + fbarea->box.x1); - - /* Traverse the clip boxes */ - nbox = REGION_NUM_RECTS(clipBoxes); - pbox = REGION_RECTS(clipBoxes); - - while (nbox--) - { - pbox++; + pPriv->videoStatus = 0; + } else { + if(pPriv->videoStatus & CLIENT_VIDEO_ON) { + pPriv->videoStatus |= OFF_TIMER; + pPriv->offTime = currentTime.milliseconds + OFF_DELAY; } - break; + } +} + + +static void +TDFXDisplayVideoOverlay( + ScrnInfoPtr pScrn, + int id, + int offset, + short width, short height, + int pitch, + int left, int right, int top, + BoxPtr dstBox, + short src_w, short src_h, + short drw_w, short drw_h +){ + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = pTDFX->overlayAdaptor->pPortPrivates[0].ptr; + int dudx, dvdy; + + dudx = (src_w << 20) / drw_w; + dvdy = (src_h << 20) / drw_h; + + offset += ((left >> 16) & ~1) << 1; + left = (left & 0x0001ffff) << 3; + + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->ModeReg.vidcfg |= 0x00000320; + + if(drw_w != src_w) pTDFX->ModeReg.vidcfg |= (1 << 14); + if(drw_h != src_h) pTDFX->ModeReg.vidcfg |= (1 << 15); + if(id == FOURCC_UYVY) pTDFX->ModeReg.vidcfg |= (6 << 21); + else pTDFX->ModeReg.vidcfg |= (5 << 21); + if(pScrn->depth == 8) pTDFX->ModeReg.vidcfg |= (1 << 11); + /* can't do bilinear filtering when in 2X mode */ + if(pPriv->filterQuality && !(pTDFX->ModeReg.vidcfg & SST_VIDEO_2X_MODE_EN)) + pTDFX->ModeReg.vidcfg |= (3 << 16); + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); + + pTDFX->writeLong(pTDFX, VIDOVERLAYSTARTCOORDS, dstBox->x1 | (dstBox->y1 << 12)); + pTDFX->writeLong(pTDFX, VIDOVERLAYENDSCREENCOORDS, (dstBox->x2 - 1) | ((dstBox->y2 - 1) << 12)); + pTDFX->writeLong(pTDFX, VIDOVERLAYDUDX, dudx); + pTDFX->writeLong(pTDFX, VIDOVERLAYDUDXOFFSETSRCWIDTH, left | (src_w << 20)); + pTDFX->writeLong(pTDFX, VIDOVERLAYDVDY, dvdy); + pTDFX->writeLong(pTDFX, VIDOVERLAYDVDYOFFSET, (top & 0x0000ffff) << 3); + + pTDFX->ModeReg.stride &= 0x0000ffff; + pTDFX->ModeReg.stride |= pitch << 16; + pTDFX->writeLong(pTDFX, VIDDESKTOPOVERLAYSTRIDE, pTDFX->ModeReg.stride); + pTDFX->writeLong(pTDFX, SST_3D_LEFTOVERLAYBUF, offset & ~3); + pTDFX->writeLong(pTDFX, VIDINADDR0, offset & ~3); +} + + +static int +TDFXPutImageOverlay( + ScrnInfoPtr pScrn, + short src_x, short src_y, + short drw_x, short drw_y, + short src_w, short src_h, + short drw_w, short drw_h, + int id, unsigned char* buf, + short width, short height, + Bool Sync, + RegionPtr clipBoxes, pointer data +){ + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = (TDFXPortPrivPtr)data; + INT32 xa, xb, ya, yb; + unsigned char *dst_start; + int pitch, new_size, offset; + int s2offset = 0, s3offset = 0; + int srcPitch = 0, srcPitch2 = 0; + int dstPitch; + int top, left, npixels, nlines, bpp; + BoxRec dstBox; + CARD32 tmp; + + /* + * s2offset, s3offset - byte offsets into U and V plane of the + * source where copying starts. Y plane is + * done by editing "buf". + * + * offset - byte offset to the first line of the destination. + * + * dst_start - byte address to the first displayed pel. + * + */ + + if(src_w > drw_w) drw_w = src_w; + if(src_h > drw_h) drw_h = src_h; + + /* Clip */ + xa = src_x; + xb = src_x + src_w; + ya = src_y; + yb = src_y + src_h; + + dstBox.x1 = drw_x; + dstBox.x2 = drw_x + drw_w; + dstBox.y1 = drw_y; + dstBox.y2 = drw_y + drw_h; + + if(!TDFXClipVideo(&dstBox, &xa, &xb, &ya, &yb, clipBoxes, width, height)) + return Success; + + dstBox.x1 -= pScrn->frameX0; + dstBox.x2 -= pScrn->frameX0; + dstBox.y1 -= pScrn->frameY0; + dstBox.y2 -= pScrn->frameY0; + + bpp = pScrn->bitsPerPixel >> 3; + pitch = bpp * pScrn->displayWidth; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + dstPitch = ((width << 1) + 3) & ~3; + new_size = ((dstPitch * height) + bpp - 1) / bpp; + srcPitch = (width + 3) & ~3; + s2offset = srcPitch * height; + srcPitch2 = ((width >> 1) + 3) & ~3; + s3offset = (srcPitch2 * (height >> 1)) + s2offset; + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + dstPitch = ((width << 1) + 3) & ~3; + new_size = ((dstPitch * height) + bpp - 1) / bpp; + srcPitch = (width << 1); + break; } - return Success; + + if(!(pTDFX->overlayBuffer = TDFXAllocateMemoryLinear(pScrn, pTDFX->overlayBuffer, new_size))) + return BadAlloc; + + /* copy data */ + top = ya >> 16; + left = (xa >> 16) & ~1; + npixels = ((((xb + 0xffff) >> 16) + 1) & ~1) - left; + + offset = (pTDFX->overlayBuffer->offset * bpp) + (top * dstPitch) + pTDFX->fbOffset; + dst_start = pTDFX->FbBase + offset; + + switch(id) { + case FOURCC_YV12: + case FOURCC_I420: + top &= ~1; + dst_start += left << 1; + tmp = ((top >> 1) * srcPitch2) + (left >> 1); + s2offset += tmp; + s3offset += tmp; + if(id == FOURCC_I420) { + tmp = s2offset; + s2offset = s3offset; + s3offset = tmp; + } + nlines = ((((yb + 0xffff) >> 16) + 1) & ~1) - top; + TDFXCopyMungedData(buf + (top * srcPitch) + left, buf + s2offset, + buf + s3offset, dst_start, srcPitch, srcPitch2, + dstPitch, nlines, npixels); + break; + case FOURCC_UYVY: + case FOURCC_YUY2: + default: + left <<= 1; + buf += (top * srcPitch) + left; + nlines = ((yb + 0xffff) >> 16) - top; + dst_start += left; + TDFXCopyData(buf, dst_start, srcPitch, dstPitch, nlines, npixels << 1); + break; + } + + if(!RegionsEqual(&pPriv->clip, clipBoxes)) { + REGION_COPY(pScreen, &pPriv->clip, clipBoxes); + (*pTDFX->AccelInfoRec->FillSolidRects)(pScrn, pPriv->colorKey, + GXcopy, ~0, + REGION_NUM_RECTS(clipBoxes), + REGION_RECTS(clipBoxes)); + } + + TDFXDisplayVideoOverlay(pScrn, id, offset, width, height, dstPitch, xa, xb, ya, &dstBox, src_w, src_h, drw_w, drw_h); + + pPriv->videoStatus = CLIENT_VIDEO_ON; + + pTDFX->VideoTimerCallback = TDFXVideoTimerCallback; + + return Success; } -#endif static void -TDFXDeallocateOffscreenBuffer (ScrnInfoPtr pScrn, int id) +TDFXVideoTimerCallback(ScrnInfoPtr pScrn, Time time) { - TDFXPtr pTDFX = TDFXPTR(pScrn); - - /* There is only one buffer so just deallocate it */ - if (pTDFX->offscreenYUVBuf) - xf86FreeOffscreenArea (pTDFX->offscreenYUVBuf); + TDFXPtr pTDFX = TDFXPTR(pScrn); + TDFXPortPrivPtr pPriv = pTDFX->overlayAdaptor->pPortPrivates[0].ptr; + + if(pPriv->videoStatus & TIMER_MASK) { + if(pPriv->videoStatus & OFF_TIMER) { + if(pPriv->offTime < time) { + pTDFX->ModeReg.vidcfg &= ~VIDPROCCFGMASK; + pTDFX->writeLong(pTDFX, VIDPROCCFG, pTDFX->ModeReg.vidcfg); + pPriv->videoStatus = FREE_TIMER; + pPriv->freeTime = time + FREE_DELAY; + } + } else + if(pPriv->videoStatus & FREE_TIMER) { + if(pPriv->freeTime < time) { + if(pTDFX->overlayBuffer) { + xf86FreeOffscreenLinear(pTDFX->overlayBuffer); + pTDFX->overlayBuffer = NULL; + } + pPriv->videoStatus = 0; + pTDFX->VideoTimerCallback = NULL; + } + } + } else /* shouldn't get here */ + pTDFX->VideoTimerCallback = NULL; } + +/* + * MEMORY MANAGEMENT + */ + + static FBAreaPtr -TDFXAllocateOffscreenBuffer (ScrnInfoPtr pScrn, int id, int width, int height) +TDFXAllocateMemoryArea (ScrnInfoPtr pScrn, FBAreaPtr area, int width, int height) { - int myWidth; TDFXPtr pTDFX = TDFXPTR(pScrn); + ScreenPtr pScreen; + FBAreaPtr new_area; - if (!pTDFX) - return NULL; + if (area) { + if ((area->box.x2 - area->box.x1 >= width) && + (area->box.y2 - area->box.y1 >= height)) + return area; - /* We tweak the width slightly */ - myWidth = width; - /* We tweak the width slightly */ - myWidth = width; - - /* width is measured in pixels. The pixels in the YUV image are alway - * 8 bit YUV data. But, the xf86 offscreen manager allocates in terms of - * desktop pixels, so we adjust. */ - myWidth = myWidth / pTDFX->cpp; - if (width % pTDFX->cpp) - myWidth++; - - /* If we are putting up a subimage then we need an extra column of data - * if the source width is odd, instead of checkin the width just always - * allocate an extra column. */ - /* XXX is this really necessary? */ - myWidth++; - - if (pTDFX->offscreenYUVBuf != NULL && - myWidth == pTDFX->offscreenYUVBufWidth && - height == pTDFX->offscreenYUVBufHeight) - { - /* we already have a buffer, don't do anything. */ - return pTDFX->offscreenYUVBuf; - } - - /* We have a buffer, but its not the right size so resize it */ - if (pTDFX->offscreenYUVBuf != NULL) - { - if (!xf86ResizeOffscreenArea (pTDFX->offscreenYUVBuf, - myWidth, - height)) - { - return (NULL); - } + if (xf86ResizeOffscreenArea(area, width, height)) + return area; + + xf86FreeOffscreenArea(area); } - else - { - /* Allocate a brand new buffer */ - pTDFX->offscreenYUVBuf = - xf86AllocateOffscreenArea (pScrn->pScreen, - myWidth, - height, - 0, - NULL, NULL, NULL); + + pScreen = screenInfo.screens[pScrn->scrnIndex]; + + new_area = xf86AllocateOffscreenArea(pScreen, width, height, pTDFX->cpp, NULL, NULL, NULL); + + if (!new_area) { + int max_width, max_height; + + xf86QueryLargestOffscreenArea(pScreen, &max_width, &max_height, pTDFX->cpp, 0, PRIORITY_EXTREME); + + if (max_width < width || max_height < height) + return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_area = xf86AllocateOffscreenArea(pScreen, width, height, pTDFX->cpp, NULL, NULL, NULL); } - /* Return the buffer */ - pTDFX->offscreenYUVBufWidth = myWidth; - pTDFX->offscreenYUVBufHeight = height; - return (pTDFX->offscreenYUVBuf); + return new_area; } -static int -TDFXQueryImageAttributes( - ScrnInfoPtr pScrn, - int id, - unsigned short *w, unsigned short *h, - int *pitches, int *offsets) +static FBLinearPtr +TDFXAllocateMemoryLinear (ScrnInfoPtr pScrn, FBLinearPtr linear, int size) { + ScreenPtr pScreen; + FBLinearPtr new_linear; - int size; - TDFXPtr pTDFX = TDFXPTR(pScrn); + if(linear) { + if(linear->size >= size) + return linear; - /* The Maximum size for 3dfx YUV planar space - * but our temporary buffer has to fit in the pixmap region which - * is the same width as the desktop and pTDFX->pixmapCacheLines - * pixels high. - */ - if(*w > 1024) *w = 1024; - if (*w > pTDFX->stride) *w = pTDFX->stride; - if(*h > pTDFX->pixmapCacheLines) *h = pTDFX->pixmapCacheLines; + if(xf86ResizeOffscreenLinear(linear, size)) + return linear; + xf86FreeOffscreenLinear(linear); + } + pScreen = screenInfo.screens[pScrn->scrnIndex]; - if (offsets) offsets[0] = 0; - switch(id) { - case FOURCC_YV12: - case FOURCC_I420: - if (pitches) pitches[0] = *w; - /* Size of Y plane plus the size of U and V planes */ - size = *w * *h; - if (offsets) offsets[1] = size; - size += ((*w >> 1) * (*h >> 1)); - if (offsets) offsets[2] = size; - size += ((*w >> 1) * (*h >> 1)); - break; - case FOURCC_UYVY: - case FOURCC_YUY2: - default: - size = *w << 1; - if(pitches) pitches[0] = size; - size *= *h; - break; - } - return size; + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, NULL, NULL, NULL); + + if(!new_linear) { + int max_size; + + xf86QueryLargestOffscreenLinear(pScreen, &max_size, 4, PRIORITY_EXTREME); + + if(max_size < size) + return NULL; + + xf86PurgeUnlockedOffscreenAreas(pScreen); + new_linear = xf86AllocateOffscreenLinear(pScreen, size, 4, NULL, NULL, NULL); + } + + return new_linear; } -#endif /* !XvExtension */ Index: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h:1.9 xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h:1.9 Fri Dec 15 10:19:35 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h Thu Apr 5 17:29:17 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.9 2000/12/15 15:19:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tdfx/tdfxdefs.h,v 1.12 2001/04/05 21:29:17 dawes Exp $ */ /* Voodoo Banshee driver version 1.0.1 @@ -47,8 +47,10 @@ #define SST_DESKTOP_CLUT_BYPASS BIT(10) #define SST_HALF_MODE BIT(4) #define SST_CURSOR_EN BIT(27) +#define SST_FBI_BUSY BIT(7) #define SST_BUSY BIT(9) #define SST_RETRACE BIT(6) +#define SST_COMMANDEXTRA_VSYNC BIT(2) #define MEM_TYPE_SGRAM 0 #define MEM_TYPE_SDRAM 1 @@ -195,12 +197,15 @@ /* 3D Registers */ #define SST_3D_OFFSET 0x200000 +#define SST_3D_LFBMODE SST_3D_OFFSET+0x114 #define SST_3D_COMMAND SST_3D_OFFSET+0x120 #define SST_3D_SLICTRL SST_3D_OFFSET+0x20C #define SST_3D_AACTRL SST_3D_OFFSET+0x210 -#define SST_3D_CHIPMASK SST_3D_OFFSET+0x214 +#define SST_3D_LEFTOVERLAYBUF SST_3D_OFFSET+0x250 +#define SST_3D_RIGHTOVERLAYBUF SST_3D_OFFSET+0x254 /* NAPALM REGISTERS */ +#define CFG_PCI_COMMAND 4 #define CFG_MEM0BASE 16 #define CFG_MEM1BASE 20 #define CFG_INIT_ENABLE 64 Index: xc/programs/Xserver/hw/xfree86/drivers/tga/IBM561ramdac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tga/IBM561ramdac.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/tga/IBM561ramdac.c:1.3 --- xc/programs/Xserver/hw/xfree86/drivers/tga/IBM561ramdac.c:1.2 Mon Oct 23 17:16:50 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tga/IBM561ramdac.c Thu Feb 15 06:03:58 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/IBM561ramdac.c,v 1.2 2000/10/23 21:16:50 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/IBM561ramdac.c,v 1.3 2001/02/15 11:03:58 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -533,7 +533,6 @@ TGAPtr pTga = TGAPTR(pScrn); unsigned int temp1[6] = {0,0,0,0,0,0}; - struct monitor_data * c_table = &crystal_table; /* * Set-up av9110 to 14.3 Mhz as reference for 561's PLL @@ -555,10 +554,10 @@ IBM561WriteReg(pScrn, IBM561_CONFIG_REG_4, 0x20 ); /* IBM561WriteReg(pScrn, IBM561_PLL_VCO_DIV_REG, 0xc8 ); */ - IBM561WriteReg(pScrn, IBM561_PLL_VCO_DIV_REG, c_table->ibm561_vco_div); + IBM561WriteReg(pScrn, IBM561_PLL_VCO_DIV_REG, tga_c_table->ibm561_vco_div); /* IBM561WriteReg(pScrn, IBM561_PLL_REF_REG, 0x08 ); */ - IBM561WriteReg(pScrn, IBM561_PLL_REF_REG, c_table->ibm561_ref ); + IBM561WriteReg(pScrn, IBM561_PLL_REF_REG, tga_c_table->ibm561_ref ); IBM561WriteReg(pScrn, IBM561_DIV_DOT_CLK_REG, 0xb0 ); Index: xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile:1.15 xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile:1.16 --- xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile:1.15 Sat Oct 21 14:40:13 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile Mon Mar 19 06:00:54 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile,v 1.15 2000/10/21 18:40:13 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/Imakefile,v 1.16 2001/03/19 11:00:54 alanh Exp $ XCOMM XCOMM This is an Imakefile for the TGA driver. XCOMM @@ -14,7 +14,7 @@ #else INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) -I$(SERVERSRC)/Xext \ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ - -I$(SERVERSRC)/cfb -I$(XF86SRC)/xaa \ + -I$(SERVERSRC)/fb -I$(XF86SRC)/xaa \ -I$(XF86SRC)/vgahw -I$(XF86SRC)/ramdac \ -I$(XF86SRC)/rac -I$(EXTINCSRC) \ -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ Index: xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h diff -u xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h:1.15 xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h:1.15 Fri Oct 20 08:57:26 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h Fri May 4 15:05:47 2001 @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h,v 1.15 2000/10/20 12:57:26 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga.h,v 1.17 2001/05/04 19:05:47 dawes Exp $ */ #ifndef _TGA_H_ #define _TGA_H_ @@ -90,6 +90,7 @@ CARD16 line_pattern; /* for dashed lines */ int Bpp; /* bytes per pixel */ int depthflag; /* either BPP8PACKED or BPP24 */ + OptionInfoPtr Options; } TGARec, *TGAPtr; /* ?? this is a hack for initial TGA2 support */ @@ -120,7 +121,9 @@ unsigned int ibm561_ref; }; -extern struct monitor_data crystal_table; +extern struct monitor_data tga_crystal_table[]; +extern int tga_crystal_table_entries; +extern struct monitor_data *tga_c_table; /* Prototypes */ @@ -131,6 +134,7 @@ Bool saveFonts*/); Bool DEC21030Init(ScrnInfoPtr pScrn, DisplayModePtr mode); void write_av9110(ScrnInfoPtr pScrn, unsigned int *); +void TGA2SetupMode(ScrnInfoPtr pScrn); /* tga_accel.c */ Bool DEC21030AccelInit(ScreenPtr pScreen); Index: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c:1.11 xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c:1.11 Fri Oct 20 08:57:26 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c Mon Mar 19 06:00:54 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c,v 1.11 2000/10/20 12:57:26 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_accel.c,v 1.12 2001/03/19 11:00:54 alanh Exp $ */ /* * Copyright 1996,1997 by Alan Hourihane, Wigan, England. @@ -26,11 +26,7 @@ * DEC TGA accelerated options. */ -#define PSZ 8 -#include "cfb.h" -#undef PSZ -#include "cfb32.h" - +#include "fb.h" #include "micmap.h" #include "xf86.h" #include "xf86_OSproc.h" Index: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c:1.11 xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c:1.13 --- xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c:1.11 Fri Oct 20 08:57:26 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c Sat Feb 17 09:18:30 2001 @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c,v 1.11 2000/10/20 12:57:26 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_dac.c,v 1.13 2001/02/17 14:18:30 tsi Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -49,46 +49,115 @@ /* There lies an ICS1562 Clock Generator. */ ICS1562_CalcClockBits(freq, pll_bits); - switch (pTga->Chipset) { - case PCI_CHIP_DEC21030: - /* - * For the DEC 21030 TGA: - * This requires the 55 clock bits be written in a serial manner to - * bit 0 of the CLOCK register and on the 56th bit set the hold flag. - */ - for (i = 0;i <= 6; i++) { - for (j = 0; j <= 7; j++) { - temp = (pll_bits[i] >> (7-j)) & 1; - if (i == 6 && j == 7) - temp |= 2; - TGA_WRITE_REG(temp, TGA_CLOCK_REG); - } + /* + * For the DEC 21030 TGA: + * This requires the 55 clock bits be written in a serial manner to + * bit 0 of the CLOCK register and on the 56th bit set the hold flag. + */ + for (i = 0;i <= 6; i++) { + for (j = 0; j <= 7; j++) { + temp = (pll_bits[i] >> (7-j)) & 1; + if (i == 6 && j == 7) + temp |= 2; + TGA_WRITE_REG(temp, TGA_CLOCK_REG); } - break; - - case PCI_CHIP_TGA2: - /* - * For the DEC TGA2: - * This requires the 55 clock bits be written in a serial manner to - * bit 0 of the CLOCK register and on the 56th bit set the hold flag. - */ -#if 0 - /* ?? FIXME FIXME FIXME ?? */ - for (i = 0;i <= 6; i++) { - for (j = 0; j <= 7; j++) { - temp = (pll_bits[i] >> (7-j)) & 1; - if (i == 6 && j == 7) - temp |= 2; - TGA_WRITE_REG(temp, TGA_CLOCK_REG); - } - } -#endif - break; } } -struct monitor_data crystal_table = +struct monitor_data tga_crystal_table[] = { +{ +/* Option 0 Monitor Info 130.8 */ +1024, /* rows */ +1280, /* columns */ +130, /* 130.8 Mhz */ +72, /* refresh rate */ +1024, /* v scanlines */ +3, /* v front porch */ +3, /* v sync */ +33, /* v back porch */ +1280, /* h pixels */ +32, /* h front porch */ +160, /* h sync */ +232, /* h back porch */ +/* AV9110 clock serial load information 130.808 */ +0x40, /* 0:6 VCO frequency divider N */ +0x7, /* 7:13 Reference frequency divide M */ +0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) +*/ +0x1, /* 15:16 CLK/X output divide X */ +0x1, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* IBM561 PLL setup data 130.808 */ +0xC8, /* VCO Div: PFR=0x3, M-65=49 */ +0x8 /* REF: N=0x8 */ +}, +{ +/* Option 3 Monitor Info 104.00 Mhz */ +900, /* rows */ +1152, /* columns */ +104, /* 104 Mhz */ +72, /* refresh rate */ +900, /* v scanlines */ +6, /* v front porch */ +10, /* v sync */ +44, /* v back porch */ +1152, /* h pixels */ +64, /* h front porch */ +112, /* h sync */ +176, /* h back porch */ +/* 103.994 MHz av9110 clock serial load information */ +0x6d, /* 0:6 VCO frequency divider N */ +0xf, /* 7:13 Reference frequency divide M */ +0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) +*/ +0x1, /* 15:16 CLK/X output divide X */ +0x1, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 104.00 MHz IBM561 PLL setup data */ +0x96, /* VCO Div: PFR=2, M=57 */ +0x6 /* REF: N=6 */ +}, +#if 1 { +/* Option 6 Monitor Info 74.00 Mhz */ +768, /* rows */ +1024, /* columns */ +74, /* 74 Mhz */ +72, /* refresh rate */ +768, /* v scanlines */ +1, /* v front porch */ +6, /* v sync */ +22, /* v back porch */ +1024, /* h pixels */ +16, /* h front porch */ +128, /* h sync */ +128, /* h back porch */ +/* 74.00 MHz AV9110 clock serial load information */ +0x2a, /* 0:6 VCO frequency divider N */ +0x41, /* 7:13 Reference frequency divide M */ +0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) +*/ +0x1, /* 15:16 CLK/X output divide X */ +0x1, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 74.00 MHz IBM561 PLL setup data */ +0x9C, /* VCO Div: PFR=2, M=0x5D*/ +0x9 /* REF: N=0x9 */ +}, +#else +{ /* Option 5 Monitor Info 75.00 Mhz */ 768, /* rows */ 1024, /* columns */ @@ -117,8 +186,406 @@ /* 75.00 MHz IBM561 PLL setup data */ 0x93, /* VCO Div: PFR=2, M=0x54 */ 0x8 /* REF: N=0x8 */ +}, +#endif +{ +/* Option 9 Monitor Info 50 Mhz ergo SVGA */ +600, /* rows */ +800, /* columns */ +50, /* 50 Mhz */ +72, /* refresh rate */ +600, /* v scanlines */ +37, /*(31 tga)v front porch */ +6, /* v sync */ +23, /*(29 tga)v back porch */ +800, /* h pixels */ +56, /* h front porch */ +120, /* h sync */ +64, /* h back porch */ +/*50.00 Mhz AV9110 clock serial load information */ +0x37, /* 0:6 VCO frequency divider N */ +0x3f, /* 7:13 Reference frequency divide M */ +0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) +*/ +0x1, /* 15:16 CLK/X output divide X */ +0x2, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 50.00 MHz IBM561 PLL setup data */ +0x45, /* VCO Div: PFR=1, M=46*/ +0x5 /* REF: N=5 */ +}, +{ +/* Option B Monitor Info 31.5 Mhz ergo VGA */ +480, /* rows */ +640, /* columns */ +32, /* 32 Mhz */ +72, /* refresh rate */ +480, /* v scanlines */ +9, /* v front porch */ +3, /* v sync */ +28, /* v back porch */ +640, /* h pixels */ +24, /* h front porch */ +40, /* h sync */ +128, /* h back porch */ +/* 31.50 MHz AV9110 clock serial load information */ +0x16, /* 0:6 VCO frequency divider N */ +0x05, /* 7:13 Reference frequency divide M */ +0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) +*/ +0x1, /* 15:16 CLK/X output divide X */ +0x2, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 31.50 MHz IBM561 PLL setup data */ +0x17, /* VCO Div: PFR=0, M=0x58 */ +0x5 /* REF: N=0x5 */ +}, +#ifdef ALLOW_LT_72_HZ +{ +/* Option 1 Monitor Info 119.84 Mhz */ +1024, /* rows */ +1280, /* columns */ +119, /* 119 Mhz */ +66, /* refresh rate */ +1024, /* v scanlines */ +3, /* v front porch */ +3, /* v sync */ +33, /* v back porch */ +1280, /* h pixels */ +32, /* h front porch */ +160, /* h sync */ +232, /* h back porch */ +/* 119.84MHz AV9110 clock serial load information */ +0x2d, /* 0:6 VCO frequency divider N */ +0x2b, /* 7:13 Reference frequency divide M */ +0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) */ +0x1, /* 15:16 CLK/X output divide X */ +0x1, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* IBM561 PLL setup data 119.84 */ +0x82, /* VCO Div: PFR=0x2, M=0x43 */ +0x4 /* REF: N=0x4 */ +}, +{ +/* Option 2 Monitor Info 108.18 Mhz */ +1024, /* rows */ +1280, /* columns */ +108, /* 108 Mhz */ +60, /* refresh rate */ +1024, /* v scanlines */ +3, /* v front porch */ +3, /* v sync */ +26, /* v back porch */ +1280, /* h pixels */ +44, /* h front porch */ +184, /* h sync */ +200, /* h back porch */ +/* 108.18 MHz av9110 Clk serial load information */ +0x11, /* 0:6 VCO frequency divider N */ +0x9, /* 7:13 Reference frequency divide M */ +0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) +*/ +0x1, /* 15:16 CLK/X output divide X */ +0x2, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 108.18 MHz IBM561 PLL setup data */ +0xB8, /* VCO Div: PFR=2, M=79 */ +0x8 /* REF: N=0x8 */ +}, +{ +/* Option 5 Monitor Info 75.00 Mhz */ +768, /* rows */ +1024, /* columns */ +75, /* 74 Mhz */ +70, /* refresh rate */ +768, /* v scanlines */ +3, /* v front porch */ +6, /* v sync */ +29, /* v back porch */ +1024, /* h pixels */ +24, /* h front porch */ +136, /* h sync */ +144, /* h back porch */ +/* 75.00 MHz AV9110 clock serial load information */ +0x6e, /* 0:6 VCO frequency divider N */ +0x15, /* 7:13 Reference frequency divide M */ +0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) +*/ +0x1, /* 15:16 CLK/X output divide X */ +0x1, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 75.00 MHz IBM561 PLL setup data */ +0x93, /* VCO Div: PFR=2, M=0x54 */ +0x8 /* REF: N=0x8 */ +}, +{ +/* Option 7 Monitor Info 69 Mhz DEC 72 Hz */ +864, /* rows */ +1024, /* columns */ +69, /* 69.x Mhz */ +60, /* refresh rate */ +864, /* v scanlines */ +0, /* v front porch */ +3, /* v sync */ +34, /* v back porch */ +1024, /* h pixels */ +12, /* h front porch */ +128, /* h sync */ +116, /* h back porch */ +/* 69.00 Mhz AV9110 clock serial load information */ +0x35, /* 0:6 VCO frequency divider N */ +0xb, /* 7:13 Reference frequency divide M */ +0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) +*/ +0x1, /* 15:16 CLK/X output divide X */ +0x1, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 69.00 MHz IBM561 PLL setup data */ +0xA9, /* VCO Div: PFR=2, M=0x6A */ +0xB /* REF: N=0xB */ +}, +{ +/* Option 8 Monitor Info 65 Mhz */ +768, /* rows */ +1024, /* columns */ +65, /* 65 Mhz */ +60, /* refresh rate */ +768, /* v scanlines */ +7, /* v front porch */ +9, /* v sync */ +26, /* v back porch */ +1024, /* h pixels */ +56, /* h front porch */ +64, /* h sync */ +200, /* h back porch */ +/* 65.00 MHz AV9110 clock serial load information */ +0x6d, /* 0:6 VCO frequency divider N */ +0x0c, /* 7:13 Reference frequency divide M */ +0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) +*/ +0x1, /* 15:16 CLK/X output divide X */ +0x2, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 65.00 MHz IBM561 PLL setup data */ +0xAC, /* VCO Div: PFR=2, M=0x6D */ +0xC /* REF: N=0xC */ +}, +{ +/* Option A Monitor Info 40 Mhz SVGA */ +600, /* rows */ +800, /* columns */ +40, /* 40 Mhz */ +60, /* refresh rate */ +600, /* v scanlines */ +1, /* v front porch */ +4, /* v sync */ +23, /* v back porch */ +800, /* h pixels */ +40, /* h front porch */ +128, /* h sync */ +88, /* h back porch */ +/* 40.00 MHz AV9110 clock serial load information */ +0x5f, /* 0:6 VCO frequency divider N */ +0x11, /* 7:13 Reference frequency divide M */ +0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) +*/ +0x1, /* 15:16 CLK/X output divide X */ +0x2, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 40.00 MHz IBM561 PLL setup data */ +0x42, /* VCO Div: PFR=1, M=43 */ +0x6 /* REF: N=0x6 */ +}, +{ +/* Option C Monitor Info 25.175 Mhz VGA */ +480, /* rows */ +640, /* columns */ +25, /* 25.175 Mhz */ +60, /* refresh rate */ +480, /* v scanlines */ +10, /* v front porch */ +2, /* v sync */ +33, /* v back porch */ +640, /* h pixels */ +16, /* h front porch */ +96, /* h sync */ +48, /* h back porch */ +/* 25.175 MHz AV9110 clock serial load information */ +0x66, /* 0:6 VCO frequency divider N */ +0x1d, /* 7:13 Reference frequency divide M */ +0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) +*/ +0x1, /* 15:16 CLK/X output divide X */ +0x2, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 25.175 MHz IBM561 PLL setup data */ +0x3E, /* VCO Div: PFR=0, M=0x7F */ +0x9 /* REF: N=0x9 */ +}, +{ +/* Option E Monitor Info 110 Mhz */ +1024, /* rows */ +1280, /* columns */ +110, +60, /* refresh rate */ +1024, /* v scanlines */ +6, /* v front porch */ +7, /* v sync */ +44, /* v back porch */ +1280, /* h pixels */ +19, /* h front porch */ +163, /* h sync */ +234, /* h back porch */ +/* 110.0 MHz AV9110 clock serial load information */ +0x60, /* 0:6 VCO frequency divider N */ +0x32, /* 7:13 Reference frequency divide M */ +0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) */ +0x1, /* 15:16 CLK/X output divide X */ +0x2, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 110.0 MHz IBM561 PLL setup data */ +0xBA, /* VCO Div: PFR=0x2, M=0x7B */ +0x8 /* REF: N=0x8 */ +}, +#endif /* ALLOW_LT_72_HZ */ +#ifdef ALLOW_GT_72_HZ +{ +/* Option D Monitor Info 135 Mhz */ +1024, /* rows */ +1280, /* columns */ +135, /* 135 Mhz */ +75, /* refresh rate */ +1024, /* v scanlines */ +1, /* v front porch */ +3, /* v sync */ +38, /* v back porch */ +1280, /* h pixels */ +16, /* h front porch */ +144, /* h sync */ +248, /* h back porch */ +/* 135.0 MHz AV9110 clock serial load information */ +0x42, /* 0:6 VCO frequency divider N */ +0x07, /* 7:13 Reference frequency divide M */ +0x0, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) */ +0x1, /* 15:16 CLK/X output divide X */ +0x1, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 135.0 MHz IBM561 PLL setup data */ +0xC1, /* VCO Div: PFR=0x3, M=0x42 */ +0x7 /* REF: N=0x7 */ +}, +#ifdef ALLOW_GT_1280x1024 +{ +/* Option 4 Monitor Info 175.5 Mhz (8-plane) */ +1200, /* rows */ +1600, /* columns */ +175, /* clock */ +65, /* refresh rate */ +1200, /* v scanlines */ +1, /* v front porch */ +3, /* v sync */ +46, /* v back porch */ +1600, /* h pixels */ +32, /* h front porch */ +192, /* h sync */ +336, /* h back porch */ +/* 110.0 MHz AV9110 clock serial load information */ +0x5F, /* 0:6 VCO frequency divider N */ +0x3E, /* 7:13 Reference frequency divide M */ +0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) +*/ +0x1, /* 15:16 CLK/X output divide X */ +0x1, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 110.0 MHz IBM561 PLL setup data */ +0xE1, /* VCO Div: PFR=0x3, M-65=0x21 */ +0x8 /* REF: N=0x8 */ +}, +{ +/* Option F Monitor Info (24-plane) */ +1200, /* rows */ +1600, /* columns */ +202.5, /* 130.8 Mhz */ +75, /* refresh rate */ +1200, /* v scanlines */ +1, /* v front porch */ +3, /* v sync */ +46, /* v back porch */ +1600, /* h pixels */ +32, /* h front porch */ +192, /* h sync */ +336, /* h back porch */ +/* AV9110 clock serial load information 130.808 */ +0x60, /* 0:6 VCO frequency divider N */ +0x32, /* 7:13 Reference frequency divide M */ +0x1, /* 14 VCO pre-scale divide V (0=div.by 1,1=by 8) */ +0x1, /* 15:16 CLK/X output divide X */ +0x2, /* 17:18 VCO output divide R */ +1, /* 19 CLK Output enable. */ +1, /* 20 CLK/X Output enable */ +0, /* reserved, should be set to 0 */ +0, /* Reference clock select on CLK 1=ref */ +1, /* reserved, should be set to 1 */ +/* 110.0 MHz IBM561 PLL setup data */ +0xE2, /* bogus VCO Div: PFR=0x2, M=0x7B */ +0x7 /* bogus REF: N=0x8 */ +} +#endif /* ALLOW_GT_1280x1024 */ +#endif /* ALLOW_GT_72_HZ */ }; +int tga_crystal_table_entries = sizeof(tga_crystal_table)/sizeof(struct monitor_data); + +struct monitor_data *tga_c_table; + /* ICS av9110 is only used on TGA2 */ void @@ -142,30 +609,58 @@ TGA2_WRITE_CLOCK_REG(0x0, 0xf800); } +void TGA2SetupMode(ScrnInfoPtr pScrn) +{ + int i; + + /* + * HACK HACK HACK + * + * We do not know how to generate arbitrary clocks, so we search + * the crystal_table above for a match. Sigh... + */ + tga_c_table = tga_crystal_table; + for (i = 0; i < tga_crystal_table_entries; i++, tga_c_table++) { + if ((tga_c_table->max_rows == pScrn->currentMode->VDisplay) && + (tga_c_table->max_cols == pScrn->currentMode->HDisplay)) { + ErrorF("Found a matching mode (%d)!\n", i); + break; + } + } + if (i == tga_crystal_table_entries) { +#ifdef FOR_NOW + FatalError("Unable to find a workable mode"); +#else + ErrorF("Unable to find a matching mode!\n"); + /* tga_c_table = &tga_crystal_table[4]; *//* 640x480 @ 72 */ + tga_c_table = &tga_crystal_table[2]; /* 1024x768 @ 72 */ +#endif + } + return; +} + static void ICS9110ClockSelect(ScrnInfoPtr pScrn, int freq) { unsigned int temp, temp1[6]; - struct monitor_data *c_table; + int i; /* There lies an ICS9110 Clock Generator. */ /* ICS9110_CalcClockBits(freq, pll_bits); */ - c_table = &crystal_table; - /* the following is based on munge_ics() from the TRU64 kernel TGA driver */ - temp = (unsigned int)(c_table->vco_div | - (c_table->ref_div << 7) | - (c_table->vco_pre << 14) | - (c_table->clk_div << 15) | - (c_table->vco_out_div << 17) | - (c_table->clk_out_en << 19) | - (c_table->clk_out_enX << 20) | - (c_table->res0 << 21) | - (c_table->clk_sel << 22) | - (c_table->res1 << 23)); + temp = (unsigned int)(tga_c_table->vco_div | + (tga_c_table->ref_div << 7) | + (tga_c_table->vco_pre << 14) | + (tga_c_table->clk_div << 15) | + (tga_c_table->vco_out_div << 17) | + (tga_c_table->clk_out_en << 19) | + (tga_c_table->clk_out_enX << 20) | + (tga_c_table->res0 << 21) | + (tga_c_table->clk_sel << 22) | + (tga_c_table->res1 << 23)); temp1[0] = (temp & 0x00000001) | ((temp & 0x00000002) << 7) | ((temp & 0x00000004) << 14) | ((temp & 0x00000008) << 21); Index: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c:1.49 xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c:1.54 --- xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c:1.49 Sat Dec 2 10:30:57 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c Fri May 4 15:05:47 2001 @@ -22,7 +22,7 @@ * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> * Matthew Grossman, <mattg@oz.net> - acceleration and misc fixes */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c,v 1.49 2000/12/02 15:30:57 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tga/tga_driver.c,v 1.54 2001/05/04 19:05:47 dawes Exp $ */ /* everybody includes these */ #include "xf86.h" @@ -50,13 +50,8 @@ /* colormap manipulation */ #include "micmap.h" -/* TGA only does 8 and 32 bpp */ -#define PSZ 8 -#include "cfb.h" -#undef PSZ +#include "fb.h" -#include "cfb32.h" - /* more RAC stuff */ #include "xf86RAC.h" @@ -67,23 +62,19 @@ #include "BT.h" #include "tga.h" -#ifdef XFreeXDGA #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" -#endif -#ifdef DPMSExtension #include "globals.h" #define DPMS_SERVER #include "extensions/dpms.h" -#endif #ifdef XvExtension #include "xf86xv.h" #include "Xv.h" #endif -static OptionInfoPtr TGAAvailableOptions(int chipid, int busid); +static const OptionInfoRec * TGAAvailableOptions(int chipid, int busid); static void TGAIdentify(int flags); static Bool TGAProbe(DriverPtr drv, int flags); static Bool TGAPreInit(ScrnInfoPtr pScrn, int flags); @@ -113,11 +104,9 @@ static void TGARestoreHWCursor(ScrnInfoPtr pScrn); -#ifdef DPMSExtension static void TGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif void TGASync(ScrnInfoPtr pScrn); @@ -139,9 +128,6 @@ DriverRec TGA = { VERSION, TGA_DRIVER_NAME, -#if 0 - "accelerated driver for Digital chipsets", -#endif TGAIdentify, TGAProbe, TGAAvailableOptions, @@ -172,7 +158,7 @@ OPTION_NOXAAPOLYSEGMENT } TGAOpts; -static OptionInfoRec TGAOptions[] = { +static const OptionInfoRec TGAOptions[] = { { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, @@ -287,8 +273,7 @@ return; } -static -OptionInfoPtr +static const OptionInfoRec * TGAAvailableOptions(int chipid, int busid) { return TGAOptions; @@ -549,23 +534,26 @@ /* Collect all of the relevant option flags (fill in pScrn->options) */ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, TGAOptions); - if (xf86ReturnOptValBool(TGAOptions, OPTION_PCI_RETRY, FALSE)) { + if (!(pTga->Options = xalloc(sizeof(TGAOptions)))) + return FALSE; + memcpy(pTga->Options, TGAOptions, sizeof(TGAOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pTga->Options); + if (xf86ReturnOptValBool(pTga->Options, OPTION_PCI_RETRY, FALSE)) { pTga->UsePCIRetry = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry enabled\n"); } - if(xf86ReturnOptValBool(TGAOptions, OPTION_SYNC_ON_GREEN, FALSE)) { + if(xf86ReturnOptValBool(pTga->Options, OPTION_SYNC_ON_GREEN, FALSE)) { pTga->SyncOnGreen = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Sync-on-Green enabled\n"); } - if(xf86ReturnOptValBool(TGAOptions, OPTION_DAC_6_BIT, FALSE)) { + if(xf86ReturnOptValBool(pTga->Options, OPTION_DAC_6_BIT, FALSE)) { pTga->Dac6Bit = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "6 bit DAC enabled\n"); } - if(xf86ReturnOptValBool(TGAOptions, OPTION_NOXAAPOLYSEGMENT, FALSE)) { + if(xf86ReturnOptValBool(pTga->Options, OPTION_NOXAAPOLYSEGMENT, FALSE)) { pTga->NoXaaPolySegment = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "XAA PolySegment() disabled\n"); } @@ -624,9 +612,9 @@ /* determine whether we use hardware or software cursor */ pTga->HWCursor = TRUE; - if (xf86GetOptValBool(TGAOptions, OPTION_HW_CURSOR, &pTga->HWCursor)) + if (xf86GetOptValBool(pTga->Options, OPTION_HW_CURSOR, &pTga->HWCursor)) from = X_CONFIG; - if (xf86ReturnOptValBool(TGAOptions, OPTION_SW_CURSOR, FALSE)) { + if (xf86ReturnOptValBool(pTga->Options, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pTga->HWCursor = FALSE; } @@ -640,7 +628,7 @@ xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", pTga->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(TGAOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pTga->Options, OPTION_NOACCEL, FALSE)) { pTga->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } @@ -770,16 +758,7 @@ pTga->FbMapSize = pScrn->videoRam * 1024; - /* Load bpp-specific modules */ - switch (pScrn->bitsPerPixel) { - case 8: - mod = "cfb"; - break; - case 32: - mod = "cfb32"; - break; - } - if (mod && xf86LoadSubModule(pScrn, mod) == NULL) { + if (mod && xf86LoadSubModule(pScrn, "fb") == NULL) { TGAFreeRec(pScrn); return FALSE; } @@ -954,6 +933,15 @@ /* Set the current mode to the first in the list */ pScrn->currentMode = pScrn->modes; + /* + This is a bit of a hack; we seem to have to init + the TGA2 chipset knowing what the mode is, so we + do this now as soon as we know it... + */ + if (pTga->Chipset == PCI_CHIP_TGA2) { + TGA2SetupMode(pScrn); + } + /* Print the list of modes being used */ xf86PrintModes(pScrn); @@ -1236,7 +1224,7 @@ * function. If not, the visuals will need to be setup before calling * a fb ScreenInit() function and fixed up after. * - * For most PC hardware at depths >= 8, the defaults that cfb uses + * For most PC hardware at depths >= 8, the defaults that fb uses * are not appropriate. In this driver, we fixup the visuals after. */ @@ -1264,6 +1252,8 @@ return FALSE; } + miSetPixmapDepths (); + /* * Call the framebuffer layer's ScreenInit function, and fill in other * pScreen fields. @@ -1271,14 +1261,12 @@ switch (pScrn->bitsPerPixel) { case 8: - ret = cfbScreenInit(pScreen, pTga->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); - break; case 32: - ret = cfb32ScreenInit(pScreen, pTga->FbBase, pScrn->virtualX, - pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth); + ret = fbScreenInit(pScreen, pTga->FbBase, pScrn->virtualX, + pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, pScrn->bitsPerPixel); + if (ret) + fbPictureInit (pScreen, 0, 0); break; default: xf86DrvMsg(scrnIndex, X_ERROR, @@ -1367,10 +1355,8 @@ pScreen->CloseScreen = TGACloseScreen; pScreen->SaveScreen = TGASaveScreen; -#ifdef DPMSExtension if(xf86DPMSInit(pScreen, TGADisplayPowerManagementSet, 0) == FALSE) ErrorF("DPMS initialization failed!\n"); -#endif /* DPMSExtension */ #ifdef XvExtension { @@ -1556,7 +1542,6 @@ * * Sets VESA Display Power Management Signaling (DPMS) Mode. */ -#ifdef DPMSExtension static void TGADisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) @@ -1590,8 +1575,6 @@ TGA_WRITE_REG(valid_reg, TGA_VALID_REG); return; } - -#endif /* DPMSExtension */ static void TGARestoreHWCursor(ScrnInfoPtr pScrn) Index: xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile:1.27 xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile:1.28 --- xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile:1.27 Thu Dec 7 11:48:04 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile Tue Jan 23 19:06:31 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile,v 1.27 2000/12/07 16:48:04 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/Imakefile,v 1.28 2001/01/24 00:06:31 dawes Exp $ XCOMM XCOMM This is an Imakefile for the TRIDENT driver. XCOMM @@ -41,7 +41,6 @@ InstallObjectModule(trident,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(trident,) InstallModuleManPage(trident) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c:1.14 xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c:1.15 --- xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c:1.14 Wed Dec 6 09:33:59 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c Thu Feb 15 12:59:07 2001 @@ -23,7 +23,7 @@ * * Trident Blade3D accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.14 2000/12/06 14:33:59 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/blade_accel.c,v 1.15 2001/02/15 17:59:07 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -574,6 +574,7 @@ { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + BladeSync(pScrn); BLADE_OUT(0x2148, XAAPatternROP[rop]); if (bg == -1) { Index: xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c:1.21 xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c:1.21.4.1 --- xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c:1.21 Tue Dec 12 04:07:45 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c Thu May 24 05:37:41 2001 @@ -23,7 +23,7 @@ * * Trident 3DImage' accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c,v 1.21 2000/12/12 09:07:45 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/image_accel.c,v 1.21.4.1 2001/05/24 09:37:41 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -144,11 +144,13 @@ infoPtr->Sync = ImageSync; +#if 0 infoPtr->SetClippingRectangle = ImageSetClippingRectangle; infoPtr->DisableClipping = ImageDisableClipping; infoPtr->ClippingFlags = HARDWARE_CLIP_SOLID_FILL | HARDWARE_CLIP_SCREEN_TO_SCREEN_COPY | HARDWARE_CLIP_MONO_8x8_FILL; +#endif #if 0 infoPtr->SolidLineFlags = NO_PLANEMASK; Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident.cpp:1.8 xc/programs/Xserver/hw/xfree86/drivers/trident/trident.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident.cpp:1.8 Mon Dec 11 15:18:37 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident.cpp Mon Jun 4 12:41:07 2001 @@ -1,81 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.cpp,v 1.8 2000/12/11 20:18:37 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH TRIDENT __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -trident \- Trident video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qtrident\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B trident -is an XFree86 driver for Trident video cards. The driver is fully -accelerated, and provides support for the following framebuffer depths: -1, 4, 8, 15, 16, and 24. Multi-head configurations -are supported. The XvImage extension is supported on all Blade and Image -series cards. Currently the ZOOM feature doesn't work properly on the Image -series. -.SH SUPPORTED HARDWARE -The -.B trident -driver supports PCI,AGP and ISA video cards based on the following -Trident chips: -.TP 12 -.B Blade -Blade3D, CyberBlade series i1, i7 (DSTN), i1, i1 (DSTN), Ai1, Ai1 (DSTN), -CyberBlade/e4 -.TP 12 -.B Image -3DImage975, 3DImage985, Cyber9520, Cyber9525, Cyber9397, Cyber9397DVD -.TP 12 -.B ProVidia -9682, 9685, Cyber9382, Cyber9385, Cyber9388 -.TP 12 -.B TGUI -9440AGi, 9660, 9680 -.TP 12 -.B 8900 -8900D (ISA) -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qSWCursor\*q \*q" boolean \*q -Enable or disable the SW cursor. Default: off. -.TP -.BI "Option \*qNoAccel\*q \*q" boolean \*q -Disable or enable acceleration. Default: acceleration is enabled. -.TP -.BI "Option \*qPciRetry\*q \*q" boolean \*q -Enable or disable PCI retries. Default: off. -.TP -.BI "Option \*qCyberShadow\*q \*q" boolean \*q -For Cyber chipsets only, turn off shadow registers. If you only see -a partial display - this may be the option for you. Default: on. -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: off. -.TP -.BI "Option \*qVideoKey\*q \*q" integer \*q -This sets the default pixel value for the YUV video overlay key. -NOTE: Default is 0 for depth 15 and 24. This needs fixing. -Default: undefined. -.TP -.BI "Option \*qNoPciBurst\*q \*q" boolean \*q -Turn off PCI burst mode, PCI Bursting is on by default. -Default: off. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHOR -Author: Alan Hourihane Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h:1.33.2.1 xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h:1.40 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h:1.33.2.1 Sat Feb 10 06:22:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h Tue May 15 06:19:41 2001 @@ -21,7 +21,7 @@ * * Authors: Alan Hourihane, <alanh@fairlite.demon.co.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.33.2.1 2001/02/10 11:22:10 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.h,v 1.40 2001/05/15 10:19:41 eich Exp $ */ #ifndef _TRIDENT_H_ #define _TRIDENT_H_ @@ -61,9 +61,6 @@ CARD32 IOAddress; unsigned long FbAddress; unsigned char * IOBase; -#ifdef __alpha__ - unsigned char * IOBaseDense; -#endif unsigned char * FbBase; long FbMapSize; Bool NoAccel; @@ -78,6 +75,7 @@ Bool MUX; Bool IsCyber; Bool CyberShadow; + Bool CyberStretch; Bool NoMMIO; Bool MMIOonly; Bool ShadowFB; @@ -108,6 +106,8 @@ int w; int y; int lcdMode; + Bool lcdActive; + Bool doInit; #ifdef READOUT Bool DontSetClock; #endif @@ -138,11 +138,13 @@ int hsync; int vsync; #endif + OptionInfoPtr Options; } TRIDENTRec, *TRIDENTPtr; typedef struct { CARD8 mode; - char* display; + int display_x; + int display_y; int clock; int shadow_0; int shadow_3; @@ -185,6 +187,7 @@ int TridentFindMode(int xres, int yres, int depth); void TGUISetClock(ScrnInfoPtr pScrn, int clock, unsigned char *a, unsigned char *b); void TGUISetMCLK(ScrnInfoPtr pScrn, int clock, unsigned char *a, unsigned char *b); +void tridentSetModeBIOS(ScrnInfoPtr pScrn, DisplayModePtr mode); void TridentOutIndReg(ScrnInfoPtr pScrn, CARD32 reg, unsigned char mask, unsigned char data); unsigned char TridentInIndReg(ScrnInfoPtr pScrn, CARD32 reg); @@ -253,7 +256,9 @@ CYBERBLADEI1D, CYBERBLADEAI1, CYBERBLADEAI1D, - CYBERBLADEE4 + CYBERBLADEE4, + CYBERBLADEXP, + CYBERBLADEXPm } TRIDENTType; #define UseMMIO (pTrident->NoMMIO == FALSE) @@ -279,7 +284,9 @@ (pTrident->Chipset == CYBERBLADEI1D) || \ (pTrident->Chipset == CYBERBLADEAI1) || \ (pTrident->Chipset == CYBERBLADEAI1D) || \ - (pTrident->Chipset == BLADE3D)) + (pTrident->Chipset == BLADE3D) || \ + (pTrident->Chipset == CYBERBLADEXP) || \ + (pTrident->Chipset == CYBERBLADEXPm)) /* * Trident DAC's Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man:1.2 --- /dev/null Mon Jun 4 12:41:07 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man Sat Jan 27 13:20:55 2001 @@ -0,0 +1,86 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident.man,v 1.2 2001/01/27 18:20:55 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH TRIDENT __drivermansuffix__ __vendorversion__ +.SH NAME +trident \- Trident video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qtrident\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B trident +is an XFree86 driver for Trident video cards. The driver is fully +accelerated, and provides support for the following framebuffer depths: +1, 4, 8, 15, 16, and 24. Multi-head configurations +are supported. The XvImage extension is supported on all Blade and Image +series cards. Currently the ZOOM feature doesn't work properly on the Image +series. +.SH SUPPORTED HARDWARE +The +.B trident +driver supports PCI,AGP and ISA video cards based on the following +Trident chips: +.TP 12 +.B Blade +Blade3D, CyberBlade series i1, i7 (DSTN), i1, i1 (DSTN), Ai1, Ai1 (DSTN), +CyberBlade/e4 +.TP 12 +.B Image +3DImage975, 3DImage985, Cyber9520, Cyber9525, Cyber9397, Cyber9397DVD +.TP 12 +.B ProVidia +9682, 9685, Cyber9382, Cyber9385, Cyber9388 +.TP 12 +.B TGUI +9440AGi, 9660, 9680 +.TP 12 +.B 8900 +8900D (ISA) +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qSWCursor\*q \*q" boolean \*q +Enable or disable the SW cursor. Default: off. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.TP +.BI "Option \*qPciRetry\*q \*q" boolean \*q +Enable or disable PCI retries. Default: off. +.TP +.BI "Option \*qCyberShadow\*q \*q" boolean \*q +For Cyber chipsets only, turn off shadow registers. If you only see +a partial display - this may be the option for you. Default: on. +.TP +.BI "Option \*qCyberStretch\*q \*q" boolean \*q +For Cyber chipsets only, turn on stretching. When the resolution is lower +than the LCD's screen, this option will stretch the graphics mode to +fill the entire LCD. Default: off. +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. See +shadowfb(__drivermansuffix__) for further information. Default: off. +.TP +.BI "Option \*qVideoKey\*q \*q" integer \*q +This sets the default pixel value for the YUV video overlay key. +NOTE: Default is 0 for depth 15 and 24. This needs fixing. +Default: undefined. +.TP +.BI "Option \*qNoPciBurst\*q \*q" boolean \*q +Turn off PCI burst mode, PCI Bursting is on by default. +Default: off. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHOR +Author: Alan Hourihane Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c:1.19.2.1 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c:1.20 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c:1.19.2.1 Sat Feb 10 06:22:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c Sun Jan 14 16:36:21 2001 @@ -23,7 +23,7 @@ * * Trident accelerated options. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c,v 1.19.2.1 2001/02/10 11:22:10 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_accel.c,v 1.20 2001/01/14 21:36:21 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c:1.37.2.1 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c:1.45.2.1 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c:1.37.2.1 Sat Feb 10 06:22:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c Wed May 23 16:33:41 2001 @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.37.2.1 2001/02/10 11:22:10 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_dac.c,v 1.45.2.1 2001/05/23 20:33:41 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -147,12 +147,16 @@ { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); TRIDENTRegPtr pReg = &pTrident->ModeReg; + int vgaIOBase; int offset = 0; int clock = pTrident->currentClock; CARD8 protect; + Bool fullSize = FALSE; + Bool isShadow = FALSE; vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr regp = &hwp->ModeReg; vgaRegPtr vgaReg = &hwp->ModeReg; vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; @@ -210,11 +214,12 @@ pReg->tridentRegs3CE[HorStretch] = INB(0x3CF); OUTB(0x3CE,VertStretch); pReg->tridentRegs3CE[VertStretch] = INB(0x3CF); - + #ifdef READOUT if ((!((pReg->tridentRegs3CE[VertStretch] & 1) || - (pReg->tridentRegs3CE[HorStretch] & 1))) - && (!LCDActive || ShadowModeActive)) { + (pReg->tridentRegs3CE[HorStretch] & 1))) + && (!LCDActive || ShadowModeActive)) + { unsigned char tmp; SHADOW_ENABLE(tmp); @@ -250,42 +255,93 @@ pReg->tridentRegs3x4[0x16] = LCD[i].shadow_16; if (LCDActive) pReg->tridentRegs3x4[CRTHiOrd] = LCD[i].shadow_HiOrd; + + fullSize = (pScrn->currentMode->HDisplay == LCD[i].display_x) + && (pScrn->currentMode->VDisplay == LCD[i].display_y); } - xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Timing shadow registers:" - "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x " - "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n", + /* copy over common bits from normal VGA */ + + pReg->tridentRegs3x4[0x7] &= ~0x4A; + pReg->tridentRegs3x4[0x7] |= (vgaReg->CRTC[0x7] & 0x4A); + + if (LCDActive && fullSize) { + regp->CRTC[0] = pReg->tridentRegs3x4[0]; + regp->CRTC[3] = pReg->tridentRegs3x4[3]; + regp->CRTC[4] = pReg->tridentRegs3x4[4]; + regp->CRTC[5] = pReg->tridentRegs3x4[5]; + regp->CRTC[6] = pReg->tridentRegs3x4[6]; + regp->CRTC[7] = pReg->tridentRegs3x4[7]; + regp->CRTC[0x10] = pReg->tridentRegs3x4[0x10]; + regp->CRTC[0x11] = pReg->tridentRegs3x4[0x11]; + regp->CRTC[0x16] = pReg->tridentRegs3x4[0x16]; + } + if (LCDActive && !fullSize) { + /* + * If the LCD is active and we don't fill the entire screen + * and the previous mode was stretched we may need help from + * the BIOS to set all registers for the unstreched mode. + */ + pTrident->doInit = ((pReg->tridentRegs3CE[HorStretch] & 1) + || (pReg->tridentRegs3CE[VertStretch] & 1)); + pReg->tridentRegs3CE[CyberControl] |= 0x81; + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow on\n"); + isShadow = TRUE; + } else { + pReg->tridentRegs3CE[CyberControl] &= 0x7E; + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow off\n"); + } + + + if (pTrident->CyberShadow) { + pReg->tridentRegs3CE[CyberControl] &= 0x7E; + isShadow = FALSE; + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Forcing Shadow off\n"); + } + + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"H-timing shadow registers:" + " 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n", pReg->tridentRegs3x4[0], pReg->tridentRegs3x4[3], - pReg->tridentRegs3x4[4], pReg->tridentRegs3x4[5], - pReg->tridentRegs3x4[6], pReg->tridentRegs3x4[7], + pReg->tridentRegs3x4[4], pReg->tridentRegs3x4[5]); + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"H-timing registers: " + " 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x\n", + regp->CRTC[0], regp->CRTC[1], regp->CRTC[2], + regp->CRTC[3], regp->CRTC[4], regp->CRTC[5]); + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"V-timing shadow registers: " + "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x" + " 0x%2.2x (0x%2.2x)\n", + pReg->tridentRegs3x4[6], pReg->tridentRegs3x4[7], pReg->tridentRegs3x4[0x10],pReg->tridentRegs3x4[0x11], pReg->tridentRegs3x4[0x16], pReg->tridentRegs3x4[CRTHiOrd]); + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"V-timing registers: " + "0x%2.2x 0x%2.2x 0x%2.2x 0x%2.2x " + "0x%2.2x 0x%2.2x 0x%2.2x\n", + regp->CRTC[6], regp->CRTC[7], regp->CRTC[0x10], + regp->CRTC[0x11],regp->CRTC[0x12], + regp->CRTC[0x14],regp->CRTC[0x16]); - /* copy over common bits from normal VGA */ - - pReg->tridentRegs3x4[0x7] &= ~0x52; - pReg->tridentRegs3x4[0x7] |= (vgaReg->CRTC[0x7] & 0x52); /* disable stretching, enable centering */ - pReg->tridentRegs3CE[VertStretch] &= 0xFE; + pReg->tridentRegs3CE[VertStretch] &= 0xFC; pReg->tridentRegs3CE[VertStretch] |= 0x80; - pReg->tridentRegs3CE[HorStretch] &= 0xFE; + pReg->tridentRegs3CE[HorStretch] &= 0xFC; pReg->tridentRegs3CE[HorStretch] |= 0x80; - +#if 1 { - int mul = pScrn->bitsPerPixel >> 3; + int mul = pScrn->bitsPerPixel >> 3; int val; if (!mul) mul = 1; /* this is what my BIOS does */ val = (pScrn->currentMode->HDisplay * mul / 8) + 16; - - pReg->tridentRegs3x4[PreEndControl] = 2 | ((val >> 8) & 1); + + pReg->tridentRegs3x4[PreEndControl] = ((val >> 8) < 2 ? 2 :0) + | ((val >> 8) & 0x01); pReg->tridentRegs3x4[PreEndFetch] = val & 0xff; } -#if 0 +#else OUTB(vgaIOBase + 4,PreEndControl); pReg->tridentRegs3x4[PreEndControl] = INB(vgaIOBase + 5); OUTB(vgaIOBase + 4,PreEndFetch); @@ -301,23 +357,56 @@ /* no stretch */ pReg->tridentRegs3CE[BiosReg] = 0; - - if (LCDActive) { - pReg->tridentRegs3CE[CyberControl] |= 0x81; - xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow on\n"); - } else { - pReg->tridentRegs3CE[CyberControl] &= 0x7E; - xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Shadow off\n"); - } - if (pTrident->CyberShadow) { - pReg->tridentRegs3CE[CyberControl] &= 0x7E; - xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Forcing Shadow off\n"); + if (pTrident->CyberStretch) { + pReg->tridentRegs3CE[VertStretch] |= 0x01; + pReg->tridentRegs3CE[HorStretch] |= 0x01; + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,1,"Enabling StretchMode\n"); } } + /* Calculate skew offsets for video overlay */ + { + int HTotal, HSyncStart; + int VTotal, VSyncStart; + int h_off = 0; + int v_off = 0; + + if (isShadow) { + HTotal = pReg->tridentRegs3x4[0] << 3; + VTotal = pReg->tridentRegs3x4[6] + | ((pReg->tridentRegs3x4[7] & (1<<0)) << 8) + | ((pReg->tridentRegs3x4[7] & (1<<5)) << 4); + HSyncStart = pReg->tridentRegs3x4[4] << 3; + VSyncStart = pReg->tridentRegs3x4[0x10] + | ((pReg->tridentRegs3x4[7] & (1<<2)) << 6) + | ((pReg->tridentRegs3x4[7] & (1<<7)) << 2); + if (pTrident->lcdMode != 0xff) { + h_off = (LCD[pTrident->lcdMode].display_x + - pScrn->currentMode->HDisplay) >> 1; + v_off = (LCD[pTrident->lcdMode].display_y + - pScrn->currentMode->VDisplay) >> 1; + } + } else { + HTotal = regp->CRTC[0] << 3; + VTotal = regp->CRTC[6] + | ((regp->CRTC[7] & (1<<0)) << 8) + | ((regp->CRTC[7] & (1<<5)) << 4); + HSyncStart = regp->CRTC[4] << 3;; + VSyncStart = regp->CRTC[0x10] + | ((regp->CRTC[7] & (1<<2)) << 6) + | ((regp->CRTC[7] & (1<<7)) << 2); + } + pTrident->hsync = (HTotal - HSyncStart) + 23 + h_off; + pTrident->vsync = (VTotal - VSyncStart) - 2 + v_off; + /* a little more skew for the Blade series */ + if (pTrident->Chipset >= BLADE3D) pTrident->hsync -= 6; + } + /* Enable Chipset specific options */ switch (pTrident->Chipset) { + case CYBERBLADEXP: + case CYBERBLADEXPm: case CYBERBLADEI7: case CYBERBLADEI7D: case CYBERBLADEI1: @@ -335,6 +424,7 @@ case CYBER9397: case IMAGE975: case IMAGE985: + case CYBER9388: if (pScrn->bitsPerPixel >= 8) pReg->tridentRegs3CE[MiscExtFunc] |= 0x10; if (!pReg->tridentRegs3x4[PreEndControl]) @@ -343,7 +433,6 @@ pReg->tridentRegs3x4[PreEndFetch] = 0xFF; /* Fall Through */ case PROVIDIA9685: - case CYBER9388: case CYBER9385: pReg->tridentRegs3x4[Enhancement0] = 0x40; /* Fall Through */ @@ -402,8 +491,11 @@ break; case 32: pReg->tridentRegs3CE[MiscExtFunc] |= 0x02; - pReg->tridentRegs3CE[MiscExtFunc] |= 0x08; /* Clock Division by 2*/ - clock *= 2; /* Double the clock */ + if (pTrident->Chipset != CYBERBLADEE4) { + /* Clock Division by 2*/ + pReg->tridentRegs3CE[MiscExtFunc] |= 0x08; + clock *= 2; /* Double the clock */ + } offset = pScrn->displayWidth >> 1; pReg->tridentRegs3x4[PixelBusReg] = 0x09; pReg->tridentRegsDAC[0x00] = 0xD0; @@ -494,6 +586,12 @@ pReg->tridentRegs3x4[PCIReg] &= 0xF9; } } + + /* Video */ + pReg->tridentRegs3C4[SSetup] = 0x00; + pReg->tridentRegs3C4[SKey] = 0x00; + pReg->tridentRegs3C4[SPKey] = 0x00; + /* restore */ OUTB(0x3C4, 0x11); OUTB(0x3C5, protect); @@ -514,7 +612,11 @@ OUTB(0x3C4, Protection); OUTB(0x3C5, 0x92); } - +#if 0 + if (pTrident->doInit && pTrident->Int10) { + OUTW_3CE(BiosReg); + } +#endif /* Goto New Mode */ OUTB(0x3C4, 0x0B); temp = INB(0x3C5); @@ -546,6 +648,9 @@ OUTW_3CE(MiscIntContReg); OUTW_3CE(MiscExtFunc); OUTW_3x4(Offset); + OUTW_3C4(SSetup); + OUTW_3C4(SKey); + OUTW_3C4(SPKey); OUTW_3x4(PreEndControl); OUTW_3x4(PreEndFetch); if (pTrident->Chipset >= PROVIDIA9685) OUTW_3x4(Enhancement0); @@ -646,6 +751,9 @@ INB_3x4(GraphEngReg); INB_3x4(PCIReg); INB_3x4(PCIRetry); + INB_3C4(SSetup); + INB_3C4(SKey); + INB_3C4(SPKey); INB_3x4(PreEndControl); INB_3x4(PreEndFetch); if (pTrident->Chipset >= PROVIDIA9685) INB_3x4(Enhancement0); @@ -767,7 +875,6 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); vgaHWGetIOBase(VGAHWPTR(pScrn)); vgaIOBase = VGAHWPTR(pScrn)->IOBase; - OUTW(vgaIOBase + 4, (fg & 0x000000FF)<<8 | 0x48); OUTW(vgaIOBase + 4, (fg & 0x0000FF00) | 0x49); OUTW(vgaIOBase + 4, (fg & 0x00FF0000)>>8 | 0x4A); @@ -828,7 +935,9 @@ infoPtr->MaxHeight = 64; infoPtr->Flags = HARDWARE_CURSOR_BIT_ORDER_MSBFIRST | HARDWARE_CURSOR_SWAP_SOURCE_AND_MASK | - HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32; + HARDWARE_CURSOR_SOURCE_MASK_INTERLEAVE_32 | + ((pTrident->Chipset == CYBERBLADEE4) ? + HARDWARE_CURSOR_TRUECOLOR_AT_8BPP : 0); infoPtr->SetCursorColors = TridentSetCursorColors; infoPtr->SetCursorPosition = TridentSetCursorPosition; infoPtr->LoadCursorImage = TridentLoadCursorImage; @@ -892,9 +1001,6 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int i, index; int sig; -#if 0 - sig = xf86BlockSIGIO (); -#endif for(i = 0; i < numColors; i++) { index = indicies[i]; OUTB(0x3C6, 0xFF); @@ -908,8 +1014,5 @@ OUTB(0x3c9, colors[index].blue); DACDelay(hwp); } -#if 0 - xf86UnblockSIGIO (sig); -#endif } Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c:1.119.2.2 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c:1.136 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c:1.119.2.2 Mon Mar 5 04:01:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c Tue May 15 06:19:41 2001 @@ -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.119.2.2 2001/03/05 09:01:41 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_driver.c,v 1.136 2001/05/15 10:19:41 eich Exp $ */ #include "xf1bpp.h" #include "xf4bpp.h" @@ -57,22 +57,18 @@ #include "trident.h" #include "trident_regs.h" -#ifdef XFreeXDGA #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" -#endif -#ifdef DPMSExtension #include "globals.h" #define DPMS_SERVER #include "extensions/dpms.h" -#endif #ifdef XvExtension #include "xf86xv.h" #endif -static OptionInfoPtr TRIDENTAvailableOptions(int chipid, int busid); +static const OptionInfoRec * TRIDENTAvailableOptions(int chipid, int busid); static void TRIDENTIdentify(int flags); static Bool TRIDENTProbe(DriverPtr drv, int flags); static Bool TRIDENTPreInit(ScrnInfoPtr pScrn, int flags); @@ -101,6 +97,12 @@ 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 @@ -159,6 +161,8 @@ { CYBERBLADEI1D, "cyberbladei1d" }, { CYBERBLADEAI1, "cyberbladeAi1" }, { CYBERBLADEAI1D, "cyberbladeAi1d" }, + { CYBERBLADEXP, "cyberbladeXP" }, + { CYBERBLADEXPm, "cyberbladeXPm" }, { -1, NULL } }; @@ -192,6 +196,8 @@ { CYBERBLADEI1D, PCI_CHIP_8520, RES_SHARED_VGA }, { CYBERBLADEAI1, PCI_CHIP_8600, RES_SHARED_VGA }, { CYBERBLADEAI1D, PCI_CHIP_8620, RES_SHARED_VGA }, + { CYBERBLADEXP, PCI_CHIP_9910, RES_SHARED_VGA }, + { CYBERBLADEXPm, PCI_CHIP_9930, RES_SHARED_VGA }, { -1, -1, RES_UNDEFINED } }; @@ -208,10 +214,11 @@ OPTION_VIDEO_KEY, OPTION_NOMMIO, OPTION_NOPCIBURST, - OPTION_CYBER_SHADOW + OPTION_CYBER_SHADOW, + OPTION_CYBER_STRETCH } TRIDENTOpts; -static OptionInfoRec TRIDENTOptions[] = { +static const OptionInfoRec TRIDENTOptions[] = { { OPTION_SW_CURSOR, "SWcursor", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_PCI_RETRY, "PciRetry", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, @@ -224,6 +231,7 @@ { OPTION_NOPCIBURST, "NoPciBurst", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_MMIO_ONLY, "MMIOonly", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_CYBER_SHADOW, "CyberShadow", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CYBER_STRETCH, "CyberStretch", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -266,6 +274,8 @@ 230000, 230000, 230000, + 230000, + 230000, }; static int ClockLimit16bpp[] = { @@ -306,6 +316,8 @@ 230000, 230000, 230000, + 230000, + 230000, }; static int ClockLimit24bpp[] = { @@ -346,6 +358,8 @@ 115000, 115000, 115000, + 115000, + 115000, }; static int ClockLimit32bpp[] = { @@ -387,6 +401,8 @@ 115000, 115000, 115000, + 115000, + 115000, }; /* @@ -404,13 +420,23 @@ { 0xff,"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; #else +#if 0 tridentLCD LCD[] = { - { 1,"640x480",25200,0x5f,0x82,0x54,0x80,0xb,0x3e,0xea,0x8c,0xb,0x08}, - { 3,"800x600",40000,0x7f,0x82,0x6b,0x1b,0x72,0xf8,0x58,0x8c,0x72,0x08}, - { 2,"1024x768",65000,0xa3,/*0x6*/0x98,0x8f,0xa0,0x24,0xf5,0x0f,0x24,0x0a,0x08}, - { 0,"1280x1024",108000,0xce,0x81,0xa6,0x9a,0x27,0x50,0x00,0x03,0x26,0xa8}, - { 0xff,"", 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } + { 1,640,480,25200,0x5f,0x82,0x54,0x80,0xb,0x3e,0xea,0x8c,0xb,0x08}, + { 3,800,600,40000,0x7f,0x82,0x6b,0x1b,0x72,0xf8,0x58,0x8c,0x72,0x08}, + { 2,1024,768,65000,0xa3,/*0x6*/0x98,0x8f,0xa0,0x24,0xf5,0x0f,0x24,0x0a,0x08}, + { 0,1280,1024,108000,0xce,0x81,0xa6,0x9a,0x27,0x50,0x00,0x03,0x26,0xa8}, + { 0xff,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; +#else +tridentLCD LCD[] = { + { 1,640,480,25200,0x5f,0x80,0x52,0x1e,0xb,0x3e,0xea,0x0c,0xb,0x08}, + { 3,800,600,40000,0x7f,0x00,0x69,0x7f,0x72,0xf0,0x59,0x0d,0x00,0x08}, + { 2,1024,768,65000,0xa3,0x00,0x84,0x94,0x24,0xf5,0x03,0x09,0x24,0x08}, + { 0,1280,1024,108000,0xce,0x91,0xa6,0x14,0x28,0x5a,0x01,0x04,0x28,0xa8}, + { 0xff,0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } +}; +#endif #endif static const char *xaaSymbols[] = { @@ -439,14 +465,15 @@ "vgaHWLock", "vgaHWFreeHWRec", "vgaHWSaveScreen", + "vgaHWSave", + "vgaHWRestore", + "vgaHWSetMmioFuncs", NULL }; static const char *fbSymbols[] = { "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif "xf1bppScreenInit", "xf4bppScreenInit", NULL @@ -472,6 +499,7 @@ static const char *vbeSymbols[] = { "VBEInit", "vbeDoEDID", + "vbeFree", NULL }; @@ -540,7 +568,6 @@ pScrn->driverPrivate = NULL; } -#ifdef DPMSExtension static void TRIDENTDisplayPowerManagementSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { @@ -585,7 +612,6 @@ OUTB(0x83C6, PMCont); OUTW(0x3C4, (temp<<8) | 0x0E); } -#endif static void TRIDENTBlockHandler ( @@ -608,8 +634,7 @@ } } -static -OptionInfoPtr +static const OptionInfoRec * TRIDENTAvailableOptions(int chipid, int busid) { return TRIDENTOptions; @@ -971,6 +996,7 @@ if (xf86LoadSubModule(pScrn, "vbe")) { pVbe = VBEInit(NULL,index); ConfiguredMonitor = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); } } @@ -1021,7 +1047,7 @@ pTrident->Linear = FALSE; } } - + if (flags & PROBE_DETECT) { TRIDENTProbeDDC(pScrn, pTrident->pEnt->index); return TRUE; @@ -1098,11 +1124,6 @@ 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); - } - xf86SetOperatingState(RES_SHARED_VGA, pTrident->pEnt->index, ResUnusedOpr); /* The ramdac module should be loaded here when needed */ @@ -1153,7 +1174,10 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, TRIDENTOptions); + if (!(pTrident->Options = xalloc(sizeof(TRIDENTOptions)))) + return FALSE; + memcpy(pTrident->Options, TRIDENTOptions, sizeof(TRIDENTOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pTrident->Options); /* Set the bits per RGB for 8bpp mode */ if (pScrn->depth <= 8) { @@ -1161,7 +1185,7 @@ /* Default to 8 */ pScrn->rgbBits = 6; #if 0 - if (xf86GetOptValInteger(TRIDENTOptions, OPTION_RGB_BITS, + if (xf86GetOptValInteger(pTrident->Options, OPTION_RGB_BITS, &pScrn->rgbBits)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Bits per RGB set to %d\n", pScrn->rgbBits); @@ -1170,26 +1194,24 @@ } from = X_DEFAULT; pTrident->HWCursor = TRUE; - if (xf86ReturnOptValBool(TRIDENTOptions, OPTION_SW_CURSOR, FALSE)) { + if (xf86ReturnOptValBool(pTrident->Options, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pTrident->HWCursor = FALSE; } - xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", - pTrident->HWCursor ? "HW" : "SW"); - if (xf86ReturnOptValBool(TRIDENTOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pTrident->Options, OPTION_NOACCEL, FALSE)) { pTrident->NoAccel = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } - if (xf86ReturnOptValBool(TRIDENTOptions, OPTION_PCI_RETRY, FALSE)) { + if (xf86ReturnOptValBool(pTrident->Options, OPTION_PCI_RETRY, FALSE)) { pTrident->UsePCIRetry = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry enabled\n"); } pTrident->UsePCIBurst = TRUE; - if (xf86ReturnOptValBool(TRIDENTOptions, OPTION_NOPCIBURST, FALSE)) { + if (xf86ReturnOptValBool(pTrident->Options, OPTION_NOPCIBURST, FALSE)) { pTrident->UsePCIBurst = FALSE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI Burst disbled\n"); } - if(xf86GetOptValInteger(TRIDENTOptions, OPTION_VIDEO_KEY, + if(xf86GetOptValInteger(pTrident->Options, OPTION_VIDEO_KEY, &(pTrident->videoKey))) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "video key set to 0x%x\n", pTrident->videoKey); @@ -1199,11 +1221,11 @@ (((pScrn->mask.blue >> pScrn->offset.blue) - 1) << pScrn->offset.blue); } - if (xf86ReturnOptValBool(TRIDENTOptions, OPTION_NOMMIO, FALSE)) { + if (xf86ReturnOptValBool(pTrident->Options, OPTION_NOMMIO, FALSE)) { pTrident->NoMMIO = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "MMIO Disabled\n"); } - if (xf86ReturnOptValBool(TRIDENTOptions, OPTION_MMIO_ONLY, FALSE)) { + if (xf86ReturnOptValBool(pTrident->Options, OPTION_MMIO_ONLY, FALSE)) { if (pTrident->NoMMIO) xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "MMIO only cannot be set" " with NoMMIO\n"); @@ -1212,18 +1234,22 @@ xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "MMIO Disabled\n"); } } - if (xf86ReturnOptValBool(TRIDENTOptions, OPTION_CYBER_SHADOW, FALSE)) { + if (xf86ReturnOptValBool(pTrident->Options, OPTION_CYBER_SHADOW, FALSE)) { pTrident->CyberShadow = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Cyber Shadow enabled\n"); } + if (xf86ReturnOptValBool(pTrident->Options, OPTION_CYBER_STRETCH, FALSE)) { + pTrident->CyberStretch = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Cyber Stretch enabled\n"); + } pTrident->MUXThreshold = 160000; /* 160MHz */ - if (xf86GetOptValInteger(TRIDENTOptions, OPTION_MUX_THRESHOLD, + if (xf86GetOptValInteger(pTrident->Options, OPTION_MUX_THRESHOLD, &pTrident->MUXThreshold)) { xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "MUX Threshold set to %d\n", pTrident->MUXThreshold); } - if (xf86ReturnOptValBool(TRIDENTOptions, OPTION_SHADOW_FB, FALSE)) { + if (xf86ReturnOptValBool(pTrident->Options, OPTION_SHADOW_FB, FALSE)) { if (!pTrident->Linear) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Ignoring Option SHADOW_FB" " in non-Linear Mode\n"); @@ -1238,7 +1264,7 @@ } } pTrident->Rotate = 0; - if ((s = xf86GetOptValString(TRIDENTOptions, OPTION_ROTATE))) { + if ((s = xf86GetOptValString(pTrident->Options, OPTION_ROTATE))) { if (!pTrident->Linear) xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "Ignoring Option ROTATE " "in non-Linear Mode\n"); @@ -1324,10 +1350,13 @@ * PIO access will be blocked * when MMIO is turned on! */ + if (xf86LoadSubModule(pScrn, "vbe")) { xf86MonPtr pMon; - pMon = vbeDoEDID(VBEInit(pTrident->Int10, - pTrident->pEnt->index), NULL); + vbeInfoPtr pVbe; + pVbe = VBEInit(NULL,pTrident->pEnt->index); + pMon = vbeDoEDID(pVbe, NULL); + vbeFree(pVbe); if (pMon) { if (!xf86LoadSubModule(pScrn, "ddc")) { TRIDENTFreeRec(pScrn); @@ -1346,12 +1375,6 @@ return FALSE; TRIDENTEnableMMIO(pScrn); - /* - * PC-9821 PCI Trident Card Magic Setup!! - */ - if (IsPciCard && xf86IsPc98()) { - PC98TRIDENTInit(pScrn); - } } OUTB(0x3C4, RevisionID); revision = INB(0x3C5); @@ -1687,7 +1710,33 @@ pTrident->NewClockCode = TRUE; pTrident->frequency = NTSC; break; + case CYBERBLADEXP: + pTrident->ddc1Read = Tridentddc1Read; + ramtype = "SGRAM"; + pTrident->HasSGRAM = TRUE; + pTrident->NoAccel = TRUE; /* Disable acceleration */ + pTrident->HWCursor = FALSE; + /* pTrident->IsCyber = TRUE; */ + Support24bpp = TRUE; + chipset = "Cyber/BladeXP"; + pTrident->NewClockCode = TRUE; + pTrident->frequency = NTSC; + break; + case CYBERBLADEXPm: + pTrident->ddc1Read = Tridentddc1Read; + ramtype = "SGRAM"; + pTrident->HasSGRAM = TRUE; + pTrident->NoAccel = TRUE; /* Disable acceleration */ + pTrident->HWCursor = FALSE; + pTrident->IsCyber = TRUE; + Support24bpp = TRUE; + chipset = "CyberBlade/XPm"; + pTrident->NewClockCode = TRUE; + pTrident->frequency = NTSC; + break; } + xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", + pTrident->HWCursor ? "HW" : "SW"); if (!pScrn->progClock) { pScrn->numClocks = NoClocks; @@ -1741,8 +1790,10 @@ case 0x04: /* 8MB, but - hw cursor can't store above 4MB */ /* So, we force to 4MB for now */ /* pScrn->videoRam = 8192; */ - - if (pTrident->HWCursor) { + /* Appearantly this isn't true for the CYBER9397DVD */ + /* maybe some other chipsets aren't affected either */ + /* XXX this needs to be investigated further */ + if (pTrident->HWCursor && (pTrident->Chipset != CYBER9397DVD)) { xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Found 8MB board, using 4MB\n"); pScrn->videoRam = 4096; @@ -1783,17 +1834,20 @@ for (i = 0; LCD[i].mode != 0xff; i++) { if (LCD[i].mode == ((mod >> 4) & 3)) { pTrident->lcdMode = i; - xf86DrvMsg(pScrn->scrnIndex, X_PROBED,"%s Panel %s found\n", + xf86DrvMsg(pScrn->scrnIndex, X_PROBED,"%s Panel %ix%i found\n", (dsp & 0x80) ? "TFT" : - ((dsp1 & 0x20) ? "DSTN" : "STN"), LCD[i].display); + ((dsp1 & 0x20) ? "DSTN" : "STN"), + LCD[i].display_x,LCD[i].display_y); } } + OUTB(0x3CE, FPConfig); + pTrident->lcdActive = (INB(0x3CF) & 0x10); } - + pTrident->MCLK = 0; mclk = CalculateMCLK(pScrn); xf86DrvMsg(pScrn->scrnIndex, X_PROBED, "Memory Clock is %3.2f MHz\n", mclk); - if (xf86GetOptValFreq(TRIDENTOptions, OPTION_SETMCLK, OPTUNITS_MHZ, + if (xf86GetOptValFreq(pTrident->Options, OPTION_SETMCLK, OPTUNITS_MHZ, &real)) { pTrident->MCLK = (int)(real * 1000.0); xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Setting new Memory Clock to %3.2f MHz\n", @@ -1985,10 +2039,8 @@ } xf86LoaderReqSymbols(Sym, NULL); -#ifdef RENDER if (pScrn->depth > 8) xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif if (!xf86LoadSubModule(pScrn, "i2c")) { if (IsPciCard && UseMMIO) { @@ -2059,6 +2111,7 @@ TRIDENTUnmapMem(pScrn); } + pTrident->FbMapSize = pScrn->videoRam * 1024; pScrn->racMemFlags = RAC_FB | RAC_COLORMAP | RAC_CURSOR | RAC_VIEWPORT; @@ -2209,6 +2262,8 @@ case CYBERBLADEE4: case CYBER9397: case CYBER9397DVD: + case CYBERBLADEXP: + case CYBERBLADEXPm: /* Get ready for MUX mode */ if (pTrident->MUX && pScrn->bitsPerPixel == 8 && @@ -2224,26 +2279,17 @@ break; } - /* Calculate skew offsets for video overlay */ - pTrident->hsync = (mode->CrtcHTotal - mode->CrtcHSyncStart) - 23; - pTrident->vsync = (mode->CrtcVTotal - mode->CrtcVSyncStart) - 4; - vgaHWUnlock(hwp); - /* Initialise the ModeReg values */ if (!vgaHWInit(pScrn, mode)) return FALSE; pScrn->vtSema = TRUE; - - /* Program the registers */ - vgaHWProtect(pScrn, TRUE); - vgaReg = &hwp->ModeReg; - tridentReg = &pTrident->ModeReg; - - vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); - /* - * TridentInit() has to modified registers + * We used to do this at a later time. + * Now since READOUT isn't defined any more + * we do it here. + * The original NOTE read: + * TridentInit() has to modify registers * that have already been set by vgaHWRestore(). * So we call it _after_ vgaHWRestore() has * programmed these registers. @@ -2256,6 +2302,13 @@ return FALSE; } + /* Program the registers */ + vgaHWProtect(pScrn, TRUE); + vgaReg = &hwp->ModeReg; + tridentReg = &pTrident->ModeReg; + + vgaHWRestore(pScrn, vgaReg, VGA_SR_MODE); + if (pScrn->progClock) TridentRestore(pScrn, tridentReg); else @@ -2342,6 +2395,13 @@ if (!TRIDENTMapMem(pScrn)) return FALSE; + if (!xf86IsPc98()) { + if (xf86LoadSubModule(pScrn, "int10")) { + xf86DrvMsg(pScrn->scrnIndex,X_INFO,"Initializing int10\n"); + pTrident->Int10 = xf86InitInt10(pTrident->pEnt->index); + } + } + hwp = VGAHWPTR(pScrn); if (IsPciCard && UseMMIO) { @@ -2357,6 +2417,14 @@ /* 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); + } else tridentSetModeBIOS(pScrn,pScrn->currentMode); + /* Initialise the first mode */ if (!TRIDENTModeInit(pScrn, pScrn->currentMode)) return FALSE; @@ -2386,8 +2454,10 @@ if (!miSetVisualTypes(pScrn->depth, miGetDefaultVisualMask(pScrn->depth), - pScrn->rgbBits, pScrn->defaultVisual)) + pScrn->rgbBits, pScrn->defaultVisual)) { + xf86FreeInt10(pTrident->Int10); return FALSE; + } miSetPixmapDepths (); @@ -2435,10 +2505,8 @@ ret = fbScreenInit(pScreen, FBStart, width, height, pScrn->xDpi, pScrn->yDpi, displayWidth, pScrn->bitsPerPixel); -#ifdef RENDER if (ret) fbPictureInit (pScreen, 0, 0); -#endif break; default: @@ -2448,9 +2516,10 @@ ret = FALSE; break; } - if (!ret) + if (!ret) { + xf86FreeInt10(pTrident->Int10); return FALSE; - + } if (pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ visual = pScreen->visuals + pScreen->numVisuals; @@ -2483,9 +2552,10 @@ /* Setup the vga banking variables */ pBankInfo = xnfcalloc(sizeof(miBankInfoRec),1); - if (pBankInfo == NULL) + if (pBankInfo == NULL) { + xf86FreeInt10(pTrident->Int10); return FALSE; - + } pBankInfo->pBankA = pTrident->FbBase; pBankInfo->pBankB = pTrident->FbBase; pBankInfo->BankSize = 0x10000; @@ -2501,6 +2571,7 @@ pScrn->displayWidth, pBankInfo)) { xfree(pBankInfo); pBankInfo = NULL; + xf86FreeInt10(pTrident->Int10); return FALSE; } } @@ -2533,18 +2604,20 @@ pTrident->HWCursor = FALSE; if (pTrident->HWCursor) { - xf86SetSilkenMouse(pScreen); + xf86SetSilkenMouse(pScreen); TridentHWCursorInit(pScreen); } /* Initialise default colourmap */ - if (!miCreateDefColormap(pScreen)) + if (!miCreateDefColormap(pScreen)) { + xf86FreeInt10(pTrident->Int10); return FALSE; - + } if(!xf86HandleColormaps(pScreen, 256, 6, TridentLoadPalette, - TridentSetOverscan, CMAP_RELOAD_ON_MODE_SWITCH|CMAP_PALETTED_TRUECOLOR)) + TridentSetOverscan, CMAP_RELOAD_ON_MODE_SWITCH|CMAP_PALETTED_TRUECOLOR)) { + xf86FreeInt10(pTrident->Int10); return FALSE; - + } if(pTrident->ShadowFB) { if(pTrident->Rotate) { if (!pTrident->PointerMoved) { @@ -2578,9 +2651,7 @@ #endif } -#ifdef DPMSExtension xf86DPMSInit(pScreen, (DPMSSetProcPtr)TRIDENTDisplayPowerManagementSet, 0); -#endif pScrn->memPhysBase = pTrident->FbAddress; pScrn->fbOffset = 0; @@ -2752,6 +2823,7 @@ if(pTrident->BlockHandler) pScreen->BlockHandler = pTrident->BlockHandler; + xf86FreeInt10(pTrident->Int10); pScreen->CloseScreen = pTrident->CloseScreen; return (*pScreen->CloseScreen)(scrnIndex, pScreen); } @@ -2775,6 +2847,21 @@ static int TRIDENTValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + + if (pTrident->lcdActive && (pTrident->lcdMode != 0xff) + && ((mode->HDisplay > LCD[pTrident->lcdMode].display_x) + || (mode->VDisplay > LCD[pTrident->lcdMode].display_y))) { + xf86DrvMsg(scrnIndex,X_INFO, "Removing mode (%dx%d) " + "larger than the LCD panel (%dx%d)\n", + mode->HDisplay, + mode->VDisplay, + LCD[pTrident->lcdMode].display_x, + LCD[pTrident->lcdMode].display_y); + return(MODE_BAD); + } + return(MODE_OK); } @@ -2847,11 +2934,91 @@ 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; @@ -2927,7 +3094,7 @@ } static void -PC98TRIDENTEnable(ScrnInfoPtr pScrn) +PC98TRIDENT96xxEnable(ScrnInfoPtr pScrn) { TRIDENTPtr pTrident = TRIDENTPTR(pScrn); CARD8 temp = 0; @@ -2966,7 +3133,8 @@ } static void -PC98TRIDENTDisable(ScrnInfoPtr pScrn){ +PC98TRIDENT96xxDisable(ScrnInfoPtr pScrn) +{ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); CARD8 temp = 0; @@ -3007,4 +3175,39 @@ outb(0x6A, 0x8E); outb(0x6A, 0x06); outb(0x68, 0x0F); +} + + +/* + * This is a terrible hack! If we are on a notebook in a stretched + * mode and don't want full screen we use the BIOS to set an unstreched + * mode. + */ +void +tridentSetModeBIOS(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + TRIDENTPtr pTrident = TRIDENTPTR(pScrn); + if (pTrident->IsCyber && pTrident->lcdMode) { + int i = pTrident->lcdMode; + if ((pScrn->currentMode->HDisplay != LCD[i].display_x) /* !fullsize? */ + || (pScrn->currentMode->VDisplay != LCD[i].display_y)) { + if (pTrident->lcdActive) { /* LCD Active ?*/ + int h_str, v_str; + + OUTB(0x3CE,HorStretch); h_str = INB(0x3CF) & 0x01; + OUTB(0x3CE,VertStretch); v_str = INB(0x3CF) & 0x01; + if (h_str || v_str) { + OUTB(0x3C4, 0x11); OUTB(0x3C5, 0x92); + OUTW(0x3CE, BiosReg ); + pTrident->Int10->ax = 0x3; + pTrident->Int10->num = 0x10; + if (IsPciCard && UseMMIO) + TRIDENTDisableMMIO(pScrn); + xf86ExecX86int10(pTrident->Int10); + if (IsPciCard && UseMMIO) + TRIDENTEnableMMIO(pScrn); + } + } + } + } } Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h:1.18 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h:1.19 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h:1.18 Thu Dec 7 14:03:40 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h Tue May 15 07:08:40 2001 @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.18 2000/12/07 19:03:40 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_regs.h,v 1.19 2001/05/15 11:08:40 alanh Exp $ */ #define DEBUG 1 @@ -44,6 +44,9 @@ #define MCLKHigh 0x17 #define ClockLow 0x18 #define ClockHigh 0x19 +#define SSetup 0x20 +#define SKey 0x37 +#define SPKey 0x57 /* 3x4 */ #define Offset 0x13 Index: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c:1.2 xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c:1.4.2.2 --- xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c:1.2 Thu Dec 14 14:29:44 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c Thu May 24 05:37:41 2001 @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c,v 1.2 2000/12/14 19:29:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/trident_video.c,v 1.4.2.2 2001/05/24 09:37:41 alanh Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -81,10 +81,11 @@ TRIDENTPtr pTrident = TRIDENTPTR(pScrn); int num_adaptors; - if (!pTrident->NoAccel) { - newAdaptor = TRIDENTSetupImageVideo(pScreen); - TRIDENTInitOffscreenImages(pScreen); - } + if (pTrident->NoAccel || !pTrident->AccelInfoRec->SetupForSolidFill) + return; + + newAdaptor = TRIDENTSetupImageVideo(pScreen); + TRIDENTInitOffscreenImages(pScreen); num_adaptors = xf86XVListGenericAdaptors(pScrn, &adaptors); @@ -224,7 +225,7 @@ blue = (pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue; switch (pScrn->depth) { case 15: - tmp = (red << 11) | (green << 6) | (blue); + tmp = (red << 10) | (green << 5) | (blue); OUTW(0x3C4, (tmp & 0xff) << 8 | 0x50); OUTW(0x3C4, (tmp & 0xff00) | 0x51); OUTW(0x3C4, 0x0052); @@ -242,9 +243,9 @@ OUTW(0x3C4, 0x0056); break; case 24: - OUTW(0x3C4, (red<<8) | 0x50); + OUTW(0x3C4, (blue<<8) | 0x50); OUTW(0x3C4, (green<<8) | 0x51); - OUTW(0x3C4, (blue<<8) | 0x52); + OUTW(0x3C4, (red<<8) | 0x52); OUTW(0x3C4, 0xFF54); OUTW(0x3C4, 0xFF55); OUTW(0x3C4, 0xFF56); @@ -293,10 +294,7 @@ adapt->PutImage = TRIDENTPutImage; adapt->QueryImageAttributes = TRIDENTQueryImageAttributes; - if ((pScrn->depth == 15) || (pScrn->depth == 24)) - pPriv->colorKey = 0; /* FIXME */ - else - pPriv->colorKey = pTrident->videoKey; + pPriv->colorKey = pTrident->videoKey & ((1 << pScrn->depth) - 1); pPriv->videoStatus = 0; /* gotta uninit this someplace */ @@ -455,6 +453,7 @@ if(pPriv->videoStatus & CLIENT_VIDEO_ON) { pPriv->videoStatus |= OFF_TIMER; pPriv->offTime = currentTime.milliseconds + OFF_DELAY; + pTrident->VideoTimerCallback = TRIDENTVideoTimerCallback; } } } @@ -485,7 +484,7 @@ blue = (pPriv->colorKey & pScrn->mask.blue) >> pScrn->offset.blue; switch (pScrn->depth) { case 15: - tmp = (red << 11) | (green << 6) | (blue); + tmp = (red << 10) | (green << 5) | (blue); OUTW(0x3C4, (tmp&0xff)<<8 | 0x50); OUTW(0x3C4, (tmp&0xff00) | 0x51); OUTW(0x3C4, 0x0052); @@ -497,9 +496,9 @@ OUTW(0x3C4, 0x0052); break; case 24: - OUTW(0x3C4, (red<<8) | 0x50); + OUTW(0x3C4, (blue<<8) | 0x50); OUTW(0x3C4, (green<<8) | 0x51); - OUTW(0x3C4, (blue<<8) | 0x52); + OUTW(0x3C4, (red<<8) | 0x52); break; } } @@ -660,15 +659,11 @@ OUTW(vgaIOBase + 4, 0x00BF); break; } - tx1 = dstBox->x1 + pTrident->hsync; tx2 = dstBox->x2 + pTrident->hsync; ty1 = dstBox->y1 + pTrident->vsync - 2; ty2 = dstBox->y2 + pTrident->vsync + 2; - /* Crude way to deal with off the left edge - FIXME - doesn't work well */ - tx1 -= (x1 >> 16); - OUTW(vgaIOBase + 4, (tx1 & 0xff) <<8 | 0x86); OUTW(vgaIOBase + 4, (tx1 & 0xff00) | 0x87); OUTW(vgaIOBase + 4, (ty1 & 0xff) <<8 | 0x88); @@ -678,6 +673,8 @@ OUTW(vgaIOBase + 4, (ty2 & 0xff) <<8 | 0x8C); OUTW(vgaIOBase + 4, (ty2 & 0xff00) | 0x8D); + offset += (x1 >> 15) & ~0x01; + OUTW(vgaIOBase + 4, (((width<<1) & 0xff)<<8) | 0x90); OUTW(vgaIOBase + 4, ((width<<1) & 0xff00) | 0x91); OUTW(vgaIOBase + 4, ((offset>>3) & 0xff) << 8 | 0x92); @@ -690,8 +687,13 @@ OUTW(vgaIOBase + 4, 0x0081); } else if (drw_w > src_w) { - zoomx1 = ((float)src_w/(float)drw_w); - zoomx2 = ( ((float)src_w/(float)drw_w) - (int)zoomx1 ) * 1024; + float z; + if (pTrident->Chipset >= BLADE3D) + z = (float)src_w/(float)drw_w; + else + z = (float)drw_w/(float)src_w - 1; + zoomx1 = z; + zoomx2 = (z - (int)zoomx1 ) * 1024; OUTW(vgaIOBase + 4, (zoomx2&0xff)<<8 | 0x80); OUTW(vgaIOBase + 4, (zoomx1&0x0f)<<10 | (zoomx2&0x0300) | 0x81); } else { @@ -708,8 +710,13 @@ OUTW(vgaIOBase + 4, 0x0083); } else if (drw_h > src_h) { - zoomy1 = ((float)src_h/(float)drw_h); - zoomy2 = ( ((float)src_h/(float)drw_h) - (int)zoomy1 ) * 1024; + float z; + if (pTrident->Chipset >= BLADE3D) + z = (float)src_h/(float)drw_h; + else + z = (float)drw_h/(float)src_h - 1; + zoomy1 = z; + zoomy2 = (z - (int)zoomy1 ) * 1024; OUTW(vgaIOBase + 4, (zoomy2&0xff)<<8 | 0x82); OUTW(vgaIOBase + 4, (zoomy1&0x0f)<<10 | (zoomy2&0x0300) | 0x83); } else { @@ -780,7 +787,6 @@ dstPitch = ((width << 1) + 15) & ~15; new_size = ((dstPitch * height) + bpp - 1) / bpp; - switch(id) { case FOURCC_YV12: case FOURCC_I420: @@ -848,8 +854,6 @@ x1, y1, x2, y2, &dstBox, src_w, src_h, drw_w, drw_h); pPriv->videoStatus = CLIENT_VIDEO_ON; - - pTrident->VideoTimerCallback = TRIDENTVideoTimerCallback; return Success; } Index: xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c diff -u xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c:1.15.2.1 xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c:1.18 --- xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c:1.15.2.1 Sat Feb 10 06:22:11 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c Tue May 15 06:19:41 2001 @@ -21,7 +21,7 @@ * * Author: Alan Hourihane, alanh@fairlite.demon.co.uk */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c,v 1.15.2.1 2001/02/10 11:22:11 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/trident/tridenthelper.c,v 1.18 2001/05/15 10:19:41 eich Exp $ */ #include "xf86.h" #include "xf86_OSproc.h" @@ -116,6 +116,8 @@ /* first 4bits are rest of M, 1bit for K value */ *b = (((q & 0xFE) >> 1) | (r << 4)); } + xf86DrvMsgVerb(pScrn->scrnIndex,X_INFO,3,"Found Clock %6.2f n=%i m=%i" + " k=%i\n",clock/1000.,p,q,r); } static void @@ -332,3 +334,7 @@ } } } + + + + Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile:1.20 xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile:1.21 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile:1.20 Wed Dec 6 10:35:24 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile Tue Jan 23 19:06:32 2001 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile,v 1.20 2000/12/06 15:35:24 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/Imakefile,v 1.21 2001/01/24 00:06:32 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -46,7 +46,6 @@ InstallObjectModule(tseng,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(tseng,) InstallModuleManPage(tseng) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp:1.6 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp:1.6 Mon Dec 11 15:18:39 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp Mon Jun 4 12:41:08 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.cpp,v 1.6 2000/12/11 20:18:39 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH TSENG __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -tseng \- Tseng Labs video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qtseng\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B tseng -is an XFree86 driver for Tseng Labs video cards. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B tseng -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h:1.33.2.1 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h:1.36 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h:1.33.2.1 Fri Mar 9 13:03:40 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h Fri May 4 15:05:48 2001 @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h,v 1.33.2.1 2001/03/09 18:03:40 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.h,v 1.36 2001/05/04 19:05:48 dawes Exp $ */ @@ -262,6 +262,7 @@ Bool DGAactive; DGAModePtr DGAModes; int DGAViewportStatus; + OptionInfoPtr Options; } TsengRec, *TsengPtr; #define TsengPTR(p) ((TsengPtr)((p)->driverPrivate)) @@ -371,10 +372,8 @@ * From tseng_dpms.c */ -#ifdef DPMSExtension void TsengHVSyncDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); void TsengCrtcDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); -#endif /* * For debugging Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.man:1.2 --- /dev/null Mon Jun 4 12:41:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.man Sat Jan 27 13:20:55 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng.man,v 1.2 2001/01/27 18:20:55 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH TSENG __drivermansuffix__ __vendorversion__ +.SH NAME +tseng \- Tseng Labs video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qtseng\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B tseng +is an XFree86 driver for Tseng Labs video cards. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +The +.B tseng +driver supports... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c:1.32.2.1 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c:1.33 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c:1.32.2.1 Fri Mar 9 13:03:40 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c Thu Feb 15 12:54:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c,v 1.32.2.1 2001/03/09 18:03:40 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_accel.c,v 1.33 2001/02/15 17:54:55 eich Exp $ */ /* * ET4/6K acceleration interface. Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c:1.16.2.1 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c:1.16.2.1 Fri Mar 9 13:03:41 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c Thu Feb 15 12:54:55 2001 @@ -1,5 +1,5 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c,v 1.16.2.1 2001/03/09 18:03:41 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_clock.c,v 1.17 2001/02/15 17:54:55 eich Exp $ */ Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c:1.13.2.1 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c:1.14 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c:1.13.2.1 Fri Mar 9 13:03:42 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c Thu Feb 15 12:54:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c,v 1.13.2.1 2001/03/09 18:03:42 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_colexp.c,v 1.14 2001/02/15 17:54:55 eich Exp $ */ Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c:1.16 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c:1.17 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c:1.16 Tue Sep 19 08:46:19 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c Mon May 7 17:59:07 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c,v 1.16 2000/09/19 12:46:19 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_cursor.c,v 1.17 2001/05/07 21:59:07 tsi Exp $ */ @@ -12,7 +12,6 @@ static Bool TsengUseHWCursor(ScreenPtr pScreen, CursorPtr pCurs); static void TsengSetCursorColors(ScrnInfoPtr pScrn, int bg, int fg); static void TsengLoadCursorImage(ScrnInfoPtr pScrn, unsigned char *bits); -unsigned char *TsengRealizeCursor(xf86CursorInfoPtr infoPtr, CursorPtr pCurs); Bool TsengHWCursorInit(ScreenPtr pScreen) Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c:1.9 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c:1.10 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c:1.9 Tue Aug 8 04:58:06 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c Sun Jan 21 16:19:35 2001 @@ -1,11 +1,10 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c,v 1.9 2000/08/08 08:58:06 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_dpms.c,v 1.10 2001/01/21 21:19:35 tsi Exp $ */ -#ifdef DPMSExtension #include "tseng.h" @@ -248,4 +247,3 @@ outb(iobase + 5, tmpb); } } -#endif Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c:1.79.2.1 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c:1.84 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c:1.79.2.1 Fri Mar 9 13:03:43 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c Fri May 4 15:05:48 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.79.2.1 2001/03/09 18:03:43 eich Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_driver.c,v 1.84 2001/05/04 19:05:48 dawes Exp $ * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -44,9 +44,6 @@ #include "mibstore.h" #include "fb.h" -#ifdef RENDER -#include "picturestr.h" -#endif #include "xf86RAC.h" #include "xf86Resources.h" @@ -66,7 +63,7 @@ */ /* Mandatory functions */ -static OptionInfoPtr TsengAvailableOptions(int chipid, int busid); +static const OptionInfoRec * TsengAvailableOptions(int chipid, int busid); static void TsengIdentify(int flags); static Bool TsengProbe(DriverPtr drv, int flags); static Bool TsengPreInit(ScrnInfoPtr pScrn, int flags); @@ -111,6 +108,10 @@ #define TSENG_MINOR_VERSION 0 #define TSENG_PATCHLEVEL 0 +/* CRTC timing limits */ +#define Tseng_HMAX (4096-8) +#define Tseng_VMAX (2048-1) + /* * This contains the functions needed by the server after loading the * driver module. It must be supplied, and gets added the driver list by @@ -123,9 +124,6 @@ { VERSION, TSENG_DRIVER_NAME, -#if 0 - "unaccelerated driver for Tseng Labs ET4000, accelerated driver for Tseng Labs ET4000W32, W32i, W32p, ET6000 and ET6100 cards", -#endif TsengIdentify, TsengProbe, TsengAvailableOptions, @@ -183,7 +181,7 @@ OPTION_SET_MCLK } TsengOpts; -static OptionInfoRec TsengOptions[] = +static const OptionInfoRec TsengOptions[] = { {OPTION_HIBIT_HIGH, "hibit_high", OPTV_BOOLEAN, {0}, FALSE}, @@ -389,8 +387,7 @@ return TRUE; } -static -OptionInfoPtr +static const OptionInfoRec * TsengAvailableOptions(int chipid, int busid) { return TsengOptions; @@ -1208,14 +1205,14 @@ TsengPtr pTseng = TsengPTR(pScrn); PDEBUG(" TsengProcessHibit\n"); - if (xf86IsOptionSet(TsengOptions, OPTION_HIBIT_HIGH)) { - if (xf86IsOptionSet(TsengOptions, OPTION_HIBIT_LOW)) { + if (xf86IsOptionSet(pTseng->Options, OPTION_HIBIT_HIGH)) { + if (xf86IsOptionSet(pTseng->Options, OPTION_HIBIT_LOW)) { xf86Msg(X_ERROR, "\nOptions \"hibit_high\" and \"hibit_low\" are incompatible;\n"); xf86Msg(X_ERROR, " specify only one (not both) in XFree86 configuration file\n"); return FALSE; } pTseng->save_divide = 0x40; - } else if (xf86IsOptionSet(TsengOptions, OPTION_HIBIT_HIGH)) { + } else if (xf86IsOptionSet(pTseng->Options, OPTION_HIBIT_HIGH)) { pTseng->save_divide = 0; } else { from = X_PROBED; @@ -1251,13 +1248,16 @@ xf86CollectOptions(pScrn, NULL); /* Process the options */ - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, TsengOptions); + if (!(pTseng->Options = xalloc(sizeof(TsengOptions)))) + return FALSE; + memcpy(pTseng->Options, TsengOptions, sizeof(TsengOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pTseng->Options); from = X_DEFAULT; pTseng->HWCursor = FALSE; /* default */ - if (xf86GetOptValBool(TsengOptions, OPTION_HW_CURSOR, &pTseng->HWCursor)) + if (xf86GetOptValBool(pTseng->Options, OPTION_HW_CURSOR, &pTseng->HWCursor)) from = X_CONFIG; - if (xf86ReturnOptValBool(TsengOptions, OPTION_SW_CURSOR, FALSE)) { + if (xf86ReturnOptValBool(pTseng->Options, OPTION_SW_CURSOR, FALSE)) { from = X_CONFIG; pTseng->HWCursor = FALSE; } @@ -1273,7 +1273,7 @@ if (pScrn->bitsPerPixel >= 8) { if (pTseng->ChipType != TYPE_ET4000) pTseng->UseAccel = TRUE; - if (xf86ReturnOptValBool(TsengOptions, OPTION_NOACCEL, FALSE)) { + if (xf86ReturnOptValBool(pTseng->Options, OPTION_NOACCEL, FALSE)) { pTseng->UseAccel = FALSE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); } @@ -1281,30 +1281,30 @@ pTseng->UseAccel = FALSE; /* 1bpp and 4bpp are always non-accelerated */ pTseng->SlowDram = FALSE; - if (xf86IsOptionSet(TsengOptions, OPTION_SLOW_DRAM)) { + if (xf86IsOptionSet(pTseng->Options, OPTION_SLOW_DRAM)) { pTseng->SlowDram = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using slow DRAM access\n"); } pTseng->MedDram = FALSE; - if (xf86IsOptionSet(TsengOptions, OPTION_MED_DRAM)) { + if (xf86IsOptionSet(pTseng->Options, OPTION_MED_DRAM)) { pTseng->MedDram = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using Medium-speed DRAM access\n"); } pTseng->FastDram = FALSE; - if (xf86IsOptionSet(TsengOptions, OPTION_FAST_DRAM)) { + if (xf86IsOptionSet(pTseng->Options, OPTION_FAST_DRAM)) { pTseng->FastDram = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using fast DRAM access\n"); } if ((pTseng->SetW32Interleave = - xf86GetOptValBool(TsengOptions, OPTION_W32_INTERLEAVE, &pTseng->W32Interleave)) ) + xf86GetOptValBool(pTseng->Options, OPTION_W32_INTERLEAVE, &pTseng->W32Interleave)) ) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing W32p memory interleave %s.\n", pTseng->W32Interleave ? "ON" : "OFF"); if ((pTseng->SetPCIBurst = - xf86GetOptValBool(TsengOptions, OPTION_PCI_BURST, &pTseng->PCIBurst)) ) + xf86GetOptValBool(pTseng->Options, OPTION_PCI_BURST, &pTseng->PCIBurst)) ) xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Forcing PCI burst mode %s.\n", pTseng->PCIBurst ? "ON" : "OFF"); from = X_CONFIG; - if (xf86GetOptValBool(TsengOptions, OPTION_LINEAR, &pTseng->UseLinMem)) { + if (xf86GetOptValBool(pTseng->Options, OPTION_LINEAR, &pTseng->UseLinMem)) { /* check if linear mode is allowed */ if (pTseng->UseLinMem) { if (!CHIP_SUPPORTS_LINEAR) { @@ -1329,17 +1329,17 @@ (pTseng->UseLinMem) ? "linear" : "banked"); pTseng->ShowCache = FALSE; - if (xf86ReturnOptValBool(TsengOptions, OPTION_SHOWCACHE, FALSE)) { + if (xf86ReturnOptValBool(pTseng->Options, OPTION_SHOWCACHE, FALSE)) { pTseng->ShowCache = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "(for debugging only:) Visible off-screen memory\n"); } pTseng->Legend = FALSE; - if (xf86ReturnOptValBool(TsengOptions, OPTION_LEGEND, FALSE)) { + if (xf86ReturnOptValBool(pTseng->Options, OPTION_LEGEND, FALSE)) { pTseng->Legend = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Using Legend pixel clock selection.\n"); } pTseng->NoClockchip = FALSE; - if (xf86ReturnOptValBool(TsengOptions, OPTION_NOCLOCKCHIP, FALSE)) { + if (xf86ReturnOptValBool(pTseng->Options, OPTION_NOCLOCKCHIP, FALSE)) { pTseng->NoClockchip = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Disabling clockchip programming.\n"); } @@ -1351,12 +1351,12 @@ pScrn->progClock = FALSE; pTseng->UsePCIRetry = FALSE; - if (xf86ReturnOptValBool(TsengOptions, OPTION_PCI_RETRY, FALSE)) { + if (xf86ReturnOptValBool(pTseng->Options, OPTION_PCI_RETRY, FALSE)) { pTseng->UsePCIRetry = TRUE; xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "PCI retry enabled\n"); } pTseng->MemClk = 0; - if (xf86GetOptValFreq(TsengOptions, OPTION_SET_MCLK, OPTUNITS_MHZ, &real)) + if (xf86GetOptValFreq(pTseng->Options, OPTION_SET_MCLK, OPTUNITS_MHZ, &real)) pTseng->MemClk = (int)(real * 1000.0); return TRUE; } @@ -1683,8 +1683,8 @@ pTseng->Bytesperpixel = 1; /* this is fake for < 8bpp, but simplifies other code */ /* hardware limits */ - pScrn->maxHValue = 4096 / pTseng->Bytesperpixel; - pScrn->maxVValue = 2048; + pScrn->maxHValue = Tseng_HMAX; + pScrn->maxVValue = Tseng_VMAX; /* * This must happen after pScrn->display has been set because @@ -1847,11 +1847,8 @@ TsengFreeRec(pScrn); return FALSE; } - xf86LoaderReqSymbols("fbScreenInit", NULL); -#ifdef RENDER - xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif - break; + xf86LoaderReqSymbols("fbScreenInit", "fbPictureInit", NULL); + break; } /* Load XAA if needed */ @@ -2071,10 +2068,8 @@ pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel); -#ifdef RENDER if (ret) fbPictureInit(pScreen, 0, 0); -#endif break; } @@ -2163,7 +2158,6 @@ /* Wrap the current CloseScreen and SaveScreen functions */ pScreen->SaveScreen = TsengSaveScreen; -#ifdef DPMSExtension /* Support for DPMS, the ET4000W32Pc and newer uses a different and * simpler method than the older cards. */ @@ -2172,7 +2166,6 @@ } else { xf86DPMSInit(pScreen, (DPMSSetProcPtr)TsengHVSyncDPMSSet, 0); } -#endif pTseng->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = TsengCloseScreen; @@ -2210,7 +2203,6 @@ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; TsengPtr pTseng = TsengPTR(pScrn); - PDEBUG(" TsengLeaveVT\n"); TsengRestore(pScrn, &(VGAHWPTR(pScrn)->SavedReg), &pTseng->SavedReg,VGA_SR_ALL); @@ -2749,8 +2741,6 @@ ModeStatus TsengValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) { -#define Tseng_HMAX (4096-8) -#define Tseng_VMAX (2048-1) PDEBUG(" TsengValidMode\n"); @@ -2758,7 +2748,7 @@ is this needed? xf86ValidMode gets HMAX and VMAX variables, so it could deal with this. need to recheck hsize with mode->Htotal*mulFactor/divFactor /* Check for CRTC timing bits overflow. */ - if (mode->HTotal * pTseng->Bytesperpixel > Tseng_HMAX) { + if (mode->HTotal > Tseng_HMAX) { return MODE_BAD_HVALUE; } if (mode->VTotal > Tseng_VMAX) { Index: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c diff -u xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c:1.24.2.1 xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c:1.24.2.1 Fri Mar 9 13:03:45 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c Thu Feb 15 12:54:56 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c,v 1.24.2.1 2001/03/09 18:03:45 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/tseng/tseng_ramdac.c,v 1.25 2001/02/15 17:54:56 eich Exp $ */ Index: xc/programs/Xserver/hw/xfree86/drivers/v4l/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/v4l/Imakefile:1.4 xc/programs/Xserver/hw/xfree86/drivers/v4l/Imakefile:1.5 --- xc/programs/Xserver/hw/xfree86/drivers/v4l/Imakefile:1.4 Thu Mar 2 20:05:45 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/v4l/Imakefile Tue Jan 23 19:06:32 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/Imakefile,v 1.4 2000/03/03 01:05:45 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/Imakefile,v 1.5 2001/01/24 00:06:32 dawes Exp $ XCOMM XCOMM This is an Imakefile for the v4l Xv driver. XCOMM @@ -33,7 +33,6 @@ InstallObjectModule(v4l,$(MODULEDIR),drivers/linux) #if !defined(XF86DriverSDK) -CppManTarget(v4l,) InstallModuleManPage(v4l) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/v4l/README diff -u xc/programs/Xserver/hw/xfree86/drivers/v4l/README:1.1 xc/programs/Xserver/hw/xfree86/drivers/v4l/README:1.2 --- xc/programs/Xserver/hw/xfree86/drivers/v4l/README:1.1 Sun Mar 28 10:32:50 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/v4l/README Mon May 7 17:59:07 2001 @@ -22,18 +22,16 @@ adaptors which are usable with any target device, and initialise them on its screens with xf86XVScreenInit() as follows... - #ifdef XvExtension - { - XF86VideoAdaptorPtr *ptr; + { + XF86VideoAdaptorPtr *ptr; - int xvexts = xf86XVListGenericAdaptors(&ptr); + int xvexts = xf86XVListGenericAdaptors(&ptr); - if (xvexts) { - xf86XVScreenInit(pScreen,ptr,v4l); - } - } - #endif + if (xvexts) { + xf86XVScreenInit(pScreen, ptr, xvexts); + } + } -$XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/README,v 1.1 1999/03/28 15:32:50 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/README,v 1.2 2001/05/07 21:59:07 tsi Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c diff -u xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c:1.19.2.1 xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c:1.25 --- xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c:1.19.2.1 Thu Feb 8 14:31:10 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c Fri May 4 15:05:49 2001 @@ -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.19.2.1 2001/02/08 19:31:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.c,v 1.25 2001/05/04 19:05:49 dawes Exp $ */ #include "videodev.h" #include "xf86.h" @@ -17,14 +17,8 @@ #include "dgaproc.h" #include "xf86str.h" - #include <asm/ioctl.h> /* _IORW(xxx) #defines are here */ -#if 0 -typedef unsigned long ulong; -#endif -/* XXX Lots of xalloc() calls don't check for failure. */ - #if 0 # define DEBUG(x) (x) #else @@ -33,7 +27,7 @@ static void V4LIdentify(int flags); static Bool V4LProbe(DriverPtr drv, int flags); -static OptionInfoPtr V4LAvailableOptions(int chipid, int busid); +static const OptionInfoRec * V4LAvailableOptions(int chipid, int busid); DriverRec V4L = { 40000, @@ -116,21 +110,22 @@ Bool StreamOn; /* file handle */ - int fd; - char devname[16]; - int useCount; + int nr; struct video_capability cap; /* RGB overlay */ struct video_buffer rgb_fbuf; struct video_window rgb_win; int rgbpalette; + int rgbdepth; /* attributes */ struct video_picture pict; struct video_audio audio; XF86VideoEncodingPtr enc; + int *input; + int *norm; int nenc,cenc; /* yuv to offscreen */ @@ -170,18 +165,36 @@ #define V4L_ATTR (sizeof(Attributes) / sizeof(XF86AttributeRec)) -static XF86AttributeRec Attributes[] = { - {XvSettable | XvGettable, -1000, 1000, XV_ENCODING}, - {XvSettable | XvGettable, -1000, 1000, XV_BRIGHTNESS}, - {XvSettable | XvGettable, -1000, 1000, XV_CONTRAST}, - {XvSettable | XvGettable, -1000, 1000, XV_SATURATION}, - {XvSettable | XvGettable, -1000, 1000, XV_HUE}, - {XvSettable | XvGettable, 0, 1, XV_MUTE}, - {XvSettable | XvGettable, 0, 16*1000, XV_FREQ}, +static const XF86AttributeRec Attributes[] = { + {XvSettable | XvGettable, -1000, 1000, XV_ENCODING}, + {XvSettable | XvGettable, -1000, 1000, XV_BRIGHTNESS}, + {XvSettable | XvGettable, -1000, 1000, XV_CONTRAST}, + {XvSettable | XvGettable, -1000, 1000, XV_SATURATION}, + {XvSettable | XvGettable, -1000, 1000, XV_HUE}, }; -static XF86AttributeRec VolumeAttr = - {XvSettable | XvGettable, -1000, 1000, XV_VOLUME}; - +static const XF86AttributeRec VolumeAttr = + {XvSettable | XvGettable, -1000, 1000, XV_VOLUME}; +static const XF86AttributeRec MuteAttr = + {XvSettable | XvGettable, 0, 1, XV_MUTE}; +static const XF86AttributeRec FreqAttr = + {XvSettable | XvGettable, 0, 16*1000, XV_FREQ}; + + +#define MAX_V4L_DEVICES 4 +#define V4L_FD (v4l_devices[pPPriv->nr].fd) +#define V4L_REF (v4l_devices[pPPriv->nr].useCount) +#define V4L_NAME (v4l_devices[pPPriv->nr].devName) + +static struct V4L_DEVICE { + int fd; + int useCount; + char devName[16]; +} v4l_devices[MAX_V4L_DEVICES] = { + { -1 }, + { -1 }, + { -1 }, + { -1 }, +}; /* ---------------------------------------------------------------------- */ /* forward decl */ @@ -194,21 +207,8 @@ static int V4lOpenDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn) { - -#if 0 - /* I don't know if this is needed or not. Alan Cox says no. EE */ - if (!xf86NoSharedMem(pScrn->scrnIndex)) { - xf86Msg(X_ERROR,"Screen %i cannot grant access to fb\n", - pScrn->scrnIndex); - return 1; - } -#endif - pPPriv->useCount++; - DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, - "Xv/open: refcount=%d\n",pPPriv->useCount)); - - if (pPPriv->fd == -1) { - pPPriv->fd = open(pPPriv->devname, O_RDWR, 0); + if (-1 == V4L_FD) { + V4L_FD = open(V4L_NAME, O_RDWR, 0); pPPriv->rgb_fbuf.width = pScrn->virtualX; pPPriv->rgb_fbuf.height = pScrn->virtualY; @@ -218,35 +218,43 @@ switch (pScrn->bitsPerPixel) { case 16: - if (pScrn->weight.green == 5) + if (pScrn->weight.green == 5) { pPPriv->rgbpalette = VIDEO_PALETTE_RGB555; - else + pPPriv->rgbdepth = 16; + } else { pPPriv->rgbpalette = VIDEO_PALETTE_RGB565; + pPPriv->rgbdepth = 16; + } break; case 24: pPPriv->rgbpalette = VIDEO_PALETTE_RGB24; + pPPriv->rgbdepth = 24; break; case 32: pPPriv->rgbpalette = VIDEO_PALETTE_RGB32; + pPPriv->rgbdepth = 32; break; } } - if (pPPriv->fd == -1) + if (-1 == V4L_FD) return errno; - + + V4L_REF++; + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, + "Xv/open: refcount=%d\n",V4L_REF)); + return 0; } -static void V4lCloseDevice(PortPrivPtr pPPriv) +static void V4lCloseDevice(PortPrivPtr pPPriv, ScrnInfoPtr pScrn) { - pPPriv->useCount--; - - DEBUG(xf86DrvMsgVerb(0, X_INFO, 2, - "Xv/close: refcount=%d\n",pPPriv->useCount)); - if(pPPriv->useCount == 0 && pPPriv->fd != -1) { - close(pPPriv->fd); - pPPriv->fd = -1; + V4L_REF--; + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, + "Xv/close: refcount=%d\n",V4L_REF)); + if (0 == V4L_REF && -1 != V4L_FD) { + close(V4L_FD); + V4L_FD = -1; } } @@ -268,7 +276,7 @@ /* Open a file handle to the device */ if (VIDEO_OFF == pPPriv->VideoOn) { if (V4lOpenDevice(pPPriv, pScrn)) - return BadAccess; + return Success; } if (pPPriv->have_yuv) { @@ -319,19 +327,18 @@ } /* program driver */ - if (VIDEO_YUV != pPPriv->VideoOn) { - if (-1 == ioctl(pPPriv->fd,VIDIOCSFBUF,&(pPPriv->yuv_fbuf))) - perror("ioctl VIDIOCSFBUF"); - if (-1 == ioctl(pPPriv->fd,VIDIOCGPICT,&pPPriv->pict)) - perror("ioctl VIDIOCGPICT"); - pPPriv->pict.palette = VIDEO_PALETTE_YUV422; - if (-1 == ioctl(pPPriv->fd,VIDIOCSPICT,&pPPriv->pict)) - perror("ioctl VIDIOCSPICT"); - if (-1 == ioctl(pPPriv->fd,VIDIOCSWIN,&(pPPriv->yuv_win))) - perror("ioctl VIDIOCSWIN"); - if (-1 == ioctl(pPPriv->fd, VIDIOCCAPTURE, &one)) - perror("ioctl VIDIOCCAPTURE(1)"); - } + if (-1 == ioctl(V4L_FD,VIDIOCSFBUF,&(pPPriv->yuv_fbuf))) + perror("ioctl VIDIOCSFBUF"); + if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict)) + perror("ioctl VIDIOCGPICT"); + pPPriv->pict.palette = VIDEO_PALETTE_YUV422; + pPPriv->pict.depth = 16; + if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict)) + perror("ioctl VIDIOCSPICT"); + if (-1 == ioctl(V4L_FD,VIDIOCSWIN,&(pPPriv->yuv_win))) + perror("ioctl VIDIOCSWIN"); + if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &one)) + perror("ioctl VIDIOCCAPTURE(1)"); if (0 == (pPPriv->myfmt->flags & VIDEO_INVERT_CLIPLIST)) { /* invert cliplist */ @@ -415,30 +422,31 @@ pPPriv->rgb_win.clipcount)); if (0 != pPPriv->rgb_win.clipcount) { pPPriv->rgb_win.clips = xalloc(pPPriv->rgb_win.clipcount*sizeof(struct video_clip)); - memset(pPPriv->rgb_win.clips,0,pPPriv->rgb_win.clipcount*sizeof(struct video_clip)); - pBox = REGION_RECTS(clipBoxes); - clip = pPPriv->rgb_win.clips; - for (i = 0; i < REGION_NUM_RECTS(clipBoxes); i++, pBox++, clip++) { - clip->x = pBox->x1 - dx; - clip->y = pBox->y1 - dy; - clip->width = pBox->x2 - pBox->x1; - clip->height = pBox->y2 - pBox->y1; + if (NULL != pPPriv->rgb_win.clips) { + memset(pPPriv->rgb_win.clips,0,pPPriv->rgb_win.clipcount*sizeof(struct video_clip)); + pBox = REGION_RECTS(clipBoxes); + clip = pPPriv->rgb_win.clips; + for (i = 0; i < REGION_NUM_RECTS(clipBoxes); i++, pBox++, clip++) { + clip->x = pBox->x1 - dx; + clip->y = pBox->y1 - dy; + clip->width = pBox->x2 - pBox->x1; + clip->height = pBox->y2 - pBox->y1; + } } } /* start */ - if (VIDEO_RGB != pPPriv->VideoOn) { - if (-1 == ioctl(pPPriv->fd,VIDIOCSFBUF,&(pPPriv->rgb_fbuf))) - perror("ioctl VIDIOCSFBUF"); - if (-1 == ioctl(pPPriv->fd,VIDIOCGPICT,&pPPriv->pict)) - perror("ioctl VIDIOCGPICT"); - pPPriv->pict.palette = pPPriv->rgbpalette; - if (-1 == ioctl(pPPriv->fd,VIDIOCSPICT,&pPPriv->pict)) - perror("ioctl VIDIOCSPICT"); - } - if (-1 == ioctl(pPPriv->fd,VIDIOCSWIN,&(pPPriv->rgb_win))) + if (-1 == ioctl(V4L_FD,VIDIOCSFBUF,&(pPPriv->rgb_fbuf))) + perror("ioctl VIDIOCSFBUF"); + if (-1 == ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict)) + perror("ioctl VIDIOCGPICT"); + pPPriv->pict.palette = pPPriv->rgbpalette; + pPPriv->pict.depth = pPPriv->rgbdepth; + if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict)) + perror("ioctl VIDIOCSPICT"); + if (-1 == ioctl(V4L_FD,VIDIOCSWIN,&(pPPriv->rgb_win))) perror("ioctl VIDIOCSWIN"); - if (-1 == ioctl(pPPriv->fd, VIDIOCCAPTURE, &one)) + if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &one)) perror("ioctl VIDIOCCAPTURE(1)"); pPPriv->VideoOn = VIDEO_RGB; @@ -475,7 +483,7 @@ if (!exit) { /* just reclipping, we have to stop DMA transfers to the visible screen */ if (VIDEO_RGB == pPPriv->VideoOn) { - if (-1 == ioctl(pPPriv->fd, VIDIOCCAPTURE, &zero)) + if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero)) perror("ioctl VIDIOCCAPTURE(0)"); pPPriv->VideoOn = VIDEO_RECLIP; } @@ -487,10 +495,10 @@ xfree(pPPriv->surface); pPPriv->surface = NULL; } - if (-1 == ioctl(pPPriv->fd, VIDIOCCAPTURE, &zero)) + if (-1 == ioctl(V4L_FD, VIDIOCCAPTURE, &zero)) perror("ioctl VIDIOCCAPTURE(0)"); - V4lCloseDevice(pPPriv); + V4lCloseDevice(pPPriv,pScrn); pPPriv->VideoOn = VIDEO_OFF; } } @@ -520,19 +528,19 @@ int ret = Success; if (V4lOpenDevice(pPPriv, pScrn)) - return BadAccess; + return Success; DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/SPA %d, %d\n", - attribute, value)); + attribute, value)); - if (-1 == pPPriv->fd) { - ret = Success /* FIXME: EBUSY/ENODEV ?? */; + if (-1 == V4L_FD) { + ret = Success; } else if (attribute == xvEncoding) { if (value >= 0 && value < pPPriv->nenc) { pPPriv->cenc = value; - chan.channel = value/3; - chan.norm = value%3; - if (-1 == ioctl(pPPriv->fd,VIDIOCSCHAN,&chan)) + chan.channel = pPPriv->input[value]; + chan.norm = pPPriv->norm[value]; + if (-1 == ioctl(V4L_FD,VIDIOCSCHAN,&chan)) perror("ioctl VIDIOCSCHAN"); } else { ret = BadValue; @@ -541,16 +549,16 @@ attribute == xvContrast || attribute == xvSaturation || attribute == xvHue) { - ioctl(pPPriv->fd,VIDIOCGPICT,&pPPriv->pict); + ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict); if (attribute == xvBrightness) pPPriv->pict.brightness = xv_to_v4l(value); if (attribute == xvContrast) pPPriv->pict.contrast = xv_to_v4l(value); if (attribute == xvSaturation) pPPriv->pict.colour = xv_to_v4l(value); if (attribute == xvHue) pPPriv->pict.hue = xv_to_v4l(value); - if (-1 == ioctl(pPPriv->fd,VIDIOCSPICT,&pPPriv->pict)) + if (-1 == ioctl(V4L_FD,VIDIOCSPICT,&pPPriv->pict)) perror("ioctl VIDIOCSPICT"); } else if (attribute == xvMute || attribute == xvVolume) { - ioctl(pPPriv->fd,VIDIOCGAUDIO,&pPPriv->audio); + ioctl(V4L_FD,VIDIOCGAUDIO,&pPPriv->audio); if (attribute == xvMute) { if (value) pPPriv->audio.flags |= VIDEO_AUDIO_MUTE; @@ -563,10 +571,10 @@ ret = BadValue; } if (ret != BadValue) - if (-1 == ioctl(pPPriv->fd,VIDIOCSAUDIO,&pPPriv->audio)) + if (-1 == ioctl(V4L_FD,VIDIOCSAUDIO,&pPPriv->audio)) perror("ioctl VIDIOCSAUDIO"); } else if (attribute == xvFreq) { - if (-1 == ioctl(pPPriv->fd,VIDIOCSFREQ,&value)) + if (-1 == ioctl(V4L_FD,VIDIOCSFREQ,&value)) perror("ioctl VIDIOCSFREQ"); } else if (pPPriv->have_yuv && pPPriv->myfmt->setAttribute) { @@ -576,7 +584,7 @@ ret = BadValue; } - V4lCloseDevice(pPPriv); + V4lCloseDevice(pPPriv,pScrn); return ret; } @@ -588,24 +596,27 @@ int ret = Success; if (V4lOpenDevice(pPPriv, pScrn)) - return BadAccess; + return Success; + + DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d\n", + attribute)); - if (-1 == pPPriv->fd) { - ret = Success /* FIXME: EBUSY/ENODEV ?? */; + if (-1 == V4L_FD) { + ret = Success; } else if (attribute == xvEncoding) { *value = pPPriv->cenc; } else if (attribute == xvBrightness || attribute == xvContrast || attribute == xvSaturation || attribute == xvHue) { - ioctl(pPPriv->fd,VIDIOCGPICT,&pPPriv->pict); + ioctl(V4L_FD,VIDIOCGPICT,&pPPriv->pict); if (attribute == xvBrightness) *value = v4l_to_xv(pPPriv->pict.brightness); if (attribute == xvContrast) *value = v4l_to_xv(pPPriv->pict.contrast); if (attribute == xvSaturation) *value = v4l_to_xv(pPPriv->pict.colour); if (attribute == xvHue) *value = v4l_to_xv(pPPriv->pict.hue); } else if (attribute == xvMute || attribute == xvVolume) { - ioctl(pPPriv->fd,VIDIOCGAUDIO,&pPPriv->audio); + ioctl(V4L_FD,VIDIOCGAUDIO,&pPPriv->audio); if (attribute == xvMute) { *value = (pPPriv->audio.flags & VIDEO_AUDIO_MUTE) ? 1 : 0; } else if (attribute == xvVolume) { @@ -615,7 +626,7 @@ ret = BadValue; } } else if (attribute == xvFreq) { - ioctl(pPPriv->fd,VIDIOCGFREQ,value); + ioctl(V4L_FD,VIDIOCGFREQ,value); } else if (pPPriv->have_yuv && pPPriv->myfmt->getAttribute) { /* not mine -> pass to yuv scaler driver */ @@ -627,7 +638,7 @@ DEBUG(xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, 2, "Xv/GPA %d, %d\n", attribute, *value)); - V4lCloseDevice(pPPriv); + V4lCloseDevice(pPPriv,pScrn); return ret; } @@ -652,8 +663,7 @@ pPPriv->cenc,drw_w,drw_h,*p_w,*p_h)); } -static -OptionInfoPtr +static const OptionInfoRec * V4LAvailableOptions(int chipid, int busid) { return NULL; @@ -679,55 +689,144 @@ return str; } -static XF86VideoEncodingPtr -V4LBuildEncodings(int fd, int *count, int channels) +static int +v4l_add_enc(XF86VideoEncodingPtr enc, int i, + char *norm, char *input, int width, int height, int n, int d) { - static struct video_channel channel; - XF86VideoEncodingPtr enc; - int i; + enc[i].id = i; + enc[i].name = xalloc(strlen(norm)+strlen(input)+2); + if (NULL == enc[i].name) + return -1; + enc[i].width = width; + enc[i].height = height; + enc[i].rate.numerator = n; + enc[i].rate.denominator = d; + sprintf(enc[i].name,"%s-%s",norm,fixname(input)); + return 0; +} - enc = xalloc(sizeof(XF86VideoEncodingRec)*3*channels); - memset(enc,0,sizeof(XF86VideoEncodingRec)*3*channels); +static void +V4LBuildEncodings(PortPrivPtr p, int fd, int channels) +{ + static struct video_channel channel; + int i,entries,have_bttv; - for (i = 0; i < 3*channels; ) { - channel.channel = i/3; +#define BTTV_VERSION _IOR('v' , BASE_VIDIOCPRIVATE+6, int) + have_bttv = 0; + if (-1 != ioctl(fd,BTTV_VERSION,NULL)) + have_bttv = 1; + + entries = (have_bttv ? 7 : 3) * channels; + p->enc = xalloc(sizeof(XF86VideoEncodingRec) * entries); + if (NULL == p->enc) + goto fail; + memset(p->enc,0,sizeof(XF86VideoEncodingRec) * entries); + p->norm = xalloc(sizeof(int) * entries); + if (NULL == p->norm) + goto fail; + memset(p->norm,0,sizeof(int) * entries); + p->input = xalloc(sizeof(int) * entries); + if (NULL == p->input) + goto fail; + memset(p->input,0,sizeof(int) * entries); + + p->nenc = 0; + for (i = 0; i < channels; i++) { + channel.channel = i; if (-1 == ioctl(fd,VIDIOCGCHAN,&channel)) { perror("ioctl VIDIOCGCHAN"); - return NULL; + continue; } - - /* one for PAL ... */ - enc[i].id = i; - enc[i].name = malloc(strlen(channel.name)+8); - enc[i].width = 768; - enc[i].height = 576; - enc[i].rate.numerator = 1; - enc[i].rate.denominator = 50; - sprintf(enc[i].name,"pal-%s",fixname(channel.name)); - i++; + + v4l_add_enc(p->enc, p->nenc,"pal", channel.name, 768,576, 1,50); + p->norm[p->nenc] = VIDEO_MODE_PAL; + p->input[p->nenc] = i; + p->nenc++; + + v4l_add_enc(p->enc,p->nenc,"ntsc", channel.name, 640,480, 1001,60000); + p->norm[p->nenc] = VIDEO_MODE_NTSC; + p->input[p->nenc] = i; + p->nenc++; + + v4l_add_enc(p->enc,p->nenc,"secam",channel.name, 768,576, 1,50); + p->norm[p->nenc] = VIDEO_MODE_SECAM; + p->input[p->nenc] = i; + p->nenc++; + + if (have_bttv) { + /* workaround for a v4l design flaw: The v4l API knows just pal, + ntsc and secam. But there are a few more norms (pal versions + with a different timings used in south america for example). + The bttv driver can handle these too. */ + if (0 != v4l_add_enc(p->enc,p->nenc,"palnc",channel.name, + 640, 576, 1,50)) + goto fail; + p->norm[p->nenc] = 3; + p->input[p->nenc] = i; + p->nenc++; + + if (0 != v4l_add_enc(p->enc,p->nenc,"palm",channel.name, + 640, 576, 1,50)) + goto fail; + p->norm[p->nenc] = 4; + p->input[p->nenc] = i; + p->nenc++; + + if (0 != v4l_add_enc(p->enc, p->nenc,"paln", channel.name, + 768,576, 1,50)) + goto fail; + p->norm[p->nenc] = 5; + p->input[p->nenc] = i; + p->nenc++; + + if (0 != v4l_add_enc(p->enc,p->nenc,"ntscjp", channel.name, + 640,480, 1001,60000)) + goto fail; + p->norm[p->nenc] = 6; + p->input[p->nenc] = i; + p->nenc++; + } + } + return; + + fail: + if (p->input) + xfree(p->input); + p->input = NULL; + if (p->norm) + xfree(p->norm); + p->norm = NULL; + if (p->enc) + xfree(p->enc); + p->enc = NULL; + p->nenc = 0; +} - /* NTSC */ - enc[i].id = i; - enc[i].name = malloc(strlen(channel.name)+8); - enc[i].width = 640; - enc[i].height = 480; - enc[i].rate.numerator = 1001; - enc[i].rate.denominator = 60000; - sprintf(enc[i].name,"ntsc-%s",fixname(channel.name)); - i++; +/* add a attribute a list */ +static void +v4l_add_attr(XF86AttributeRec **list, int *count, + const XF86AttributeRec *attr) +{ + XF86AttributeRec *oldlist = *list; + int i; - /* SECAM */ - enc[i].id = i; - enc[i].name = malloc(strlen(channel.name)+8); - enc[i].width = 768; - enc[i].height = 576; - enc[i].rate.numerator = 1; - enc[i].rate.denominator = 50; - sprintf(enc[i].name,"secam-%s",fixname(channel.name)); - i++; + for (i = 0; i < *count; i++) { + if (0 == strcmp((*list)[i].name,attr->name)) { + DEBUG(xf86Msg(X_INFO, "v4l: skip dup attr %s\n",attr->name)); + return; + } + } + + DEBUG(xf86Msg(X_INFO, "v4l: add attr %s\n",attr->name)); + *list = xalloc((*count + 1) * sizeof(XF86AttributeRec)); + if (NULL == *list) { + *count = 0; + return; } - *count = i; - return enc; + if (*count) + memcpy(*list, oldlist, *count * sizeof(XF86AttributeRec)); + memcpy(*list + *count, attr, sizeof(XF86AttributeRec)); + (*count)++; } static int @@ -737,47 +836,47 @@ PortPrivPtr pPPriv; DevUnion *Private; XF86VideoAdaptorPtr *VAR = NULL; - XF86VideoEncodingPtr enc; char dev[18]; - int fd,i,j,nenc; + int fd,i,j,d; DEBUG(xf86Msg(X_INFO, "v4l: init start\n")); - for (i = 0; i < 4; 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; } - - DEBUG(xf86Msg(X_INFO, "v4l: %s ok\n",dev)); + DEBUG(xf86Msg(X_INFO, "v4l: %s open ok\n",dev)); /* our private data */ pPPriv = xalloc(sizeof(PortPrivRec)); if (!pPPriv) return FALSE; memset(pPPriv,0,sizeof(PortPrivRec)); - pPPriv->fd = -1; - strncpy(pPPriv->devname, dev, 16); - pPPriv->useCount=0; /* check device */ - if (-1 == ioctl(fd,VIDIOCGCAP,&pPPriv->cap) || - NULL == (enc = V4LBuildEncodings - (fd,&nenc,pPPriv->cap.channels))) { + if (-1 == ioctl(fd,VIDIOCGCAP,&pPPriv->cap) || + 0 == (pPPriv->cap.type & VID_TYPE_OVERLAY)) { + DEBUG(xf86Msg(X_INFO, "v4l: %s: no overlay support\n",dev)); xfree(pPPriv); - break; + close(fd); + continue; } - pPPriv->enc = enc; - pPPriv->nenc = nenc; + strncpy(V4L_NAME, dev, 16); + V4LBuildEncodings(pPPriv,fd,pPPriv->cap.channels); + if (NULL == pPPriv->enc) + return FALSE; #if 1 - /* check for yuv (see if the driver accepts VIDEO_PALETTE_YUV422) */ + /* test v4l device for yuv support: check if the driver + accepts VIDEO_PALETTE_YUV422 */ ioctl(fd,VIDIOCGPICT,&pPPriv->pict); pPPriv->pict.palette = VIDEO_PALETTE_YUV422; + pPPriv->pict.depth = 16; if (0 == ioctl(fd,VIDIOCSPICT,&pPPriv->pict)) { ioctl(fd,VIDIOCGPICT,&pPPriv->pict); if (VIDEO_PALETTE_YUV422 == pPPriv->pict.palette) { @@ -808,20 +907,36 @@ return FALSE; memset(VAR[i],0,sizeof(XF86VideoAdaptorRec)); - /* add attribute lists */ + + /* build attribute list */ + for (j = 0; j < V4L_ATTR; j++) { + /* video attributes */ + v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes, + &Attributes[j]); + } + if (0 == ioctl(fd,VIDIOCGAUDIO,&pPPriv->audio)) { + /* audio attributes */ + if (pPPriv->audio.flags & VIDEO_AUDIO_VOLUME) + v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes, + &VolumeAttr); + if (pPPriv->audio.flags & VIDEO_AUDIO_MUTABLE) + v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes, + &MuteAttr); + } + if (pPPriv->cap.type & VID_TYPE_TUNER) { + /* tuner attributes */ + v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes, + &FreqAttr); + } if (pPPriv->have_yuv) { - VAR[i]->nAttributes = V4L_ATTR + pPPriv->myfmt->num_attributes; - VAR[i]->pAttributes = xalloc(VAR[i]->nAttributes * - sizeof(XF86AttributeRec)); - memcpy(VAR[i]->pAttributes, Attributes, - sizeof(XF86AttributeRec) * V4L_ATTR); - memcpy(VAR[i]->pAttributes+V4L_ATTR, pPPriv->myfmt->attributes, - sizeof(XF86AttributeRec) * pPPriv->myfmt->num_attributes); - } else { - VAR[i]->nAttributes = V4L_ATTR; - VAR[i]->pAttributes = Attributes; + /* pass throuth scaler attributes */ + for (j = 0; j < pPPriv->myfmt->num_attributes; j++) { + v4l_add_attr(&VAR[i]->pAttributes, &VAR[i]->nAttributes, + pPPriv->myfmt->attributes+j); + } } - + + /* hook in private data */ Private = xalloc(sizeof(DevUnion)); if (!Private) @@ -843,34 +958,15 @@ VAR[i]->GetPortAttribute = V4lGetPortAttribute; VAR[i]->QueryBestSize = V4lQueryBestSize; - VAR[i]->nEncodings = nenc; - VAR[i]->pEncodings = enc; + VAR[i]->nEncodings = pPPriv->nenc; + VAR[i]->pEncodings = pPPriv->enc; VAR[i]->nFormats = sizeof(InputVideoFormats) / sizeof(InputVideoFormats[0]); VAR[i]->pFormats = InputVideoFormats; - /* Check whether we have VIDEO_AUDIO_VOLUME */ - if (!ioctl(pPPriv->fd,VIDIOCGAUDIO,&pPPriv->audio) && - pPPriv->audio.flags & VIDEO_AUDIO_VOLUME) { - XF86AttributeRec *oldattrs = VAR[i]->pAttributes; - int nattrs = VAR[i]->nAttributes; - - DEBUG(xf86Msg(X_INFO, "v4l: Volume supported, adding XV_VOLUME to attribute list\n")); - - VAR[i]->pAttributes = xalloc((nattrs + 1) * - sizeof(XF86AttributeRec)); - memcpy(VAR[i]->pAttributes, oldattrs, - sizeof(XF86AttributeRec) * nattrs); - memcpy(VAR[i]->pAttributes+nattrs, &VolumeAttr, - sizeof(XF86AttributeRec)); - VAR[i]->nAttributes++; - } else { - DEBUG(xf86Msg(X_INFO, "v4l: Volume not supported\n")); - } - - if (fd != -1) close(fd); + i++; } xvEncoding = MAKE_ATOM(XV_ENCODING); @@ -883,7 +979,7 @@ 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; Index: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.cpp:1.5 xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.cpp:1.5 Mon Dec 11 15:18:40 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.cpp Mon Jun 4 12:41:08 2001 @@ -1,30 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.cpp,v 1.5 2000/12/11 20:18:40 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH V4L __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -v4l \- Video 4 Linux driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qv4l\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B v4l -is an XFree86 driver for Video 4 Linux. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -The -.B v4l -driver supports... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: ... Index: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.man:1.2.2.1 --- /dev/null Mon Jun 4 12:41:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.man Tue May 29 18:28:23 2001 @@ -0,0 +1,39 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/v4l.man,v 1.2.2.1 2001/05/29 22:28:23 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH V4L __drivermansuffix__ __vendorversion__ +.SH NAME +v4l \- video4linux driver +.SH SYNOPSIS +.nf +.B "Section \*qModule\*q" +\ \ ... +.B " Load \*qv4l\*q" +.B EndSection +.fi +.SH DESCRIPTION +.B v4l +is an XFree86 driver for video4linux cards. It provides a Xvideo +extention port for video overlay. Just add the driver to the module +list within the module section of your XF86Config file if you want +to use it. There are no config options. +.P +Note that the the extmod module is also required for the Xvideo +support (and lots of other extentions too). +.SH SUPPORTED HARDWARE +The +.B v4l +driver works with every piece of hardware which is supported by a +video4linux (kernel-) device driver and is able to handle video +overlay. +.P +bt848/bt878-based TV cards are the most popular hardware these +days. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Gerd Knorr <kraxel@bytesex.org> Index: xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h diff -u xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h:1.7 xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h:1.8 --- xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h:1.7 Sat May 15 11:31:57 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h Sat Mar 3 17:46:31 2001 @@ -7,9 +7,9 @@ * Used here with the explicit permission of the original author, Alan Cox. * <alan@lxorguk.ukuu.org.uk> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h,v 1.7 1999/05/15 15:31:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/v4l/videodev.h,v 1.8 2001/03/03 22:46:31 tsi Exp $ */ -#include <Xmd.h> +#include "Xmd.h" #define VID_TYPE_CAPTURE 1 /* Can capture */ #define VID_TYPE_TUNER 2 /* Can tune */ Index: xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile:1.4 --- xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile:1.2 Fri Oct 27 14:31:04 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile Thu Feb 15 20:44:50 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile,v 1.2 2000/10/27 18:31:04 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/Imakefile,v 1.4 2001/02/16 01:44:50 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -11,6 +11,7 @@ INCLUDES = -I. -I../../include #else INCLUDES = -I. -I$(SERVERSRC)/fb -I$(XF86SRC)/xf4bpp -I$(XF86SRC)/xf1bpp \ + -I$(XF86SRC)/xf24_32bpp \ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/afb -I$(SERVERSRC)/mi \ -I$(SERVERSRC)/miext/shadow -I$(SERVERSRC)/render \ -I$(XF86SRC)/vgahw \ @@ -32,7 +33,6 @@ InstallObjectModule(vesa,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(vesa,) InstallModuleManPage(vesa) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c:1.8 xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c:1.16.2.2 --- xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c:1.8 Sat Dec 2 10:31:00 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c Mon May 28 17:36:43 2001 @@ -1,3 +1,4 @@ +#define DEBUG_VERB 2 /* * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) * @@ -26,7 +27,7 @@ * * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.8 2000/12/02 15:31:00 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.c,v 1.16.2.2 2001/05/28 21:36:43 paulo Exp $ */ #include "vesa.h" @@ -42,7 +43,7 @@ #include "xf86cmap.h" /* Mandatory functions */ -static OptionInfoPtr VESAAvailableOptions(int chipid, int busid); +static const OptionInfoRec * VESAAvailableOptions(int chipid, int busid); static void VESAIdentify(int flags); static Bool VESAProbe(DriverPtr drv, int flags); static Bool VESAPreInit(ScrnInfoPtr pScrn, int flags); @@ -59,6 +60,10 @@ static void VESAFreeScreen(int scrnIndex, int flags); static void VESAFreeRec(ScrnInfoPtr pScrn); +static void +VESADisplayPowerManagementSet(ScrnInfoPtr pScrn, int mode, + int flags); + /* locally used functions */ static int VESAFindIsaDevice(GDevPtr dev); static Bool VESAMapVidMem(ScrnInfoPtr pScrn); @@ -68,6 +73,8 @@ LOCO *colors, VisualPtr pVisual); static void SaveFonts(ScrnInfoPtr pScrn); static void RestoreFonts(ScrnInfoPtr pScrn); +static Bool +VESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function); static void *VESAWindowPlanar(ScreenPtr pScrn, CARD32 row, CARD32 offset, int mode, CARD32 *size); @@ -121,7 +128,7 @@ OPTION_SHADOW_FB } VESAOpts; -static OptionInfoRec VESAOptions[] = { +static const OptionInfoRec VESAOptions[] = { { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; @@ -139,19 +146,33 @@ "xf4bppScreenInit", "afbScreenInit", "fbScreenInit", -#ifdef RENDER "fbPictureInit", -#endif "cfbScreenInit", "mfbScreenInit", + "cfb24_32ScreenInit", NULL }; static const char *shadowSymbols[] = { - "ShadowInit", + "shadowAlloc", + "shadowInit", + "shadowUpdatePacked", + "shadowUpdatePlanar4", + "shadowUpdatePlanar4x8", NULL }; +static const char *vbeSymbols[] = { + "VBEInit", + "vbeDoEDID", + NULL +}; + +static const char *ddcSymbols[] = { + "xf86PrintEDID", + "xf86SetDDCproperties", + NULL}; + #ifdef XFree86LOADER /* Module loader interface */ @@ -173,7 +194,7 @@ /* * This data is accessed by the loader. The name must be the module name - * followed by "ModuleInit". + * followed by "ModuleData". */ XF86ModuleData vesaModuleData = { &vesaVersionRec, vesaSetup, NULL }; @@ -186,7 +207,11 @@ { Initialised = TRUE; xf86AddDriver(&VESA, Module, 0); - LoaderRefSymLists(fbSymbols, shadowSymbols, NULL); + LoaderRefSymLists(fbSymbols, + shadowSymbols, + vbeSymbols, + ddcSymbols, + NULL); return (pointer)TRUE; } @@ -197,8 +222,7 @@ #endif -static -OptionInfoPtr +static const OptionInfoRec * VESAAvailableOptions(int chipid, int busid) { return (VESAOptions); @@ -342,7 +366,7 @@ { VESAPtr pVesa = VESAGetRec(pScrn); DisplayModePtr mode = pScrn->modes; - +#if 0 /* I am not sure if the modes will ever get freed. * Anyway, the data unknown to other modules is being freed here. */ @@ -361,6 +385,7 @@ mode = mode->next; } while (mode && mode != pScrn->modes); } +#endif xfree(pVesa->monitor); xfree(pVesa->vbeInfo); xfree(pVesa->pal); @@ -378,29 +403,35 @@ VESAPreInit(ScrnInfoPtr pScrn, int flags) { VESAPtr pVesa; - VBEInfoBlock *vbe; + VbeInfoBlock *vbe; DisplayModePtr pMode, tmp; - ModeInfoBlock *mode; + VbeModeInfoBlock *mode; ModeInfoData *data = NULL; char *mod = NULL; const char *reqSym = NULL; Gamma gzeros = {0.0, 0.0, 0.0}; rgb rzeros = {0, 0, 0}; - vbeInfoPtr pVbe; pointer pVbeModule, pDDCModule; int i; if (flags & PROBE_DETECT) return (FALSE); - /* Load int10 module */ - if (!xf86LoadSubModule(pScrn, "int10")) - return (FALSE); - pVesa = VESAGetRec(pScrn); pVesa->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); pVesa->device = xf86GetDevFromEntity(pScrn->entityList[0], pScrn->entityInstanceList[0]); + + /* Load vgahw module */ + if (!xf86LoadSubModule(pScrn, "vgahw")) + return (FALSE); + + /* Load vbe module */ + if ((pVbeModule = xf86LoadSubModule(pScrn, "vbe")) == NULL) + return (FALSE); + if ((pVesa->pVbe = VBEInit(NULL, pVesa->pEnt->index)) == NULL) + return (FALSE); + if (pVesa->pEnt->location.type == BUS_PCI) { pVesa->pciInfo = xf86GetPciInfoForEntity(pVesa->pEnt->index); pVesa->pciTag = pciTag(pVesa->pciInfo->bus, pVesa->pciInfo->device, @@ -432,192 +463,128 @@ return (FALSE); xf86SetGamma(pScrn, gzeros); - - if ((pVesa->pInt = xf86InitInt10(pVesa->pEnt->index)) == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Int10 initialization failed.\n"); - return (FALSE); - } - - if ((pVesa->block = xf86Int10AllocPages(pVesa->pInt, 1, &pVesa->page)) == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Cannot allocate one scratch page in real mode memory.\n"); - return (FALSE); - } - vbe = VESAGetVBEInfo(pScrn); + vbe = VBEGetVBEInfo(pVesa->pVbe); pVesa->major = (unsigned)(vbe->VESAVersion >> 8); pVesa->minor = vbe->VESAVersion & 0xff; pVesa->vbeInfo = vbe; pScrn->videoRam = vbe->TotalMemory * 64 * 1024; if (pVesa->major >= 2) { - /* Load vbe module */ - if ((pVbeModule = xf86LoadSubModule(pScrn, "vbe")) == NULL) - return (FALSE); - if ((pVbe = VBEInit(pVesa->pInt, pVesa->pEnt->index)) == NULL) - return (FALSE); - /* Load ddc module */ if ((pDDCModule = xf86LoadSubModule(pScrn, "ddc")) == NULL) return (FALSE); - if ((pVesa->monitor = vbeDoEDID(pVbe, pDDCModule)) != NULL) { + if ((pVesa->monitor = vbeDoEDID(pVesa->pVbe, pDDCModule)) != NULL) { xf86PrintEDID(pVesa->monitor); -#ifdef DEBUG - ErrorF("Monitor data blocks:\n"); - ErrorF("VENDOR: name %s - id %d - serial %d - week %d - year %d\n", - pVesa->monitor->vendor.name, pVesa->monitor->vendor.prod_id, - pVesa->monitor->vendor.serial, pVesa->monitor->vendor.week, - pVesa->monitor->vendor.year); - ErrorF("EDID: Version %d - Revision %d\n", - pVesa->monitor->ver.version, - pVesa->monitor->ver.revision); - ErrorF("FEATURES:\n input: type %d - voltage %d - setup %d - sync %d\n" - " size: %d x %d\n gamma: %f\n dpms: %d\n type: %d\n" - " misc: %d\n redx %d - redy %d\n greenx %d - greeny %d\n" - " bluex: %d - bluey %d\n whitex %d - whitey\n" - "ESTABLISHED TIMES: %d %d %d\n" - "STD TIMINGS:\n", - pVesa->monitor->features.input_type, - pVesa->monitor->features.input_voltage, - pVesa->monitor->features.input_setup, - pVesa->monitor->features.input_sync, - pVesa->monitor->features.hsize, pVesa->monitor->features.vsize, - pVesa->monitor->features.gamma, - pVesa->monitor->features.dpms, - pVesa->monitor->features.display_type, - pVesa->monitor->features.msc, pVesa->monitor->features.redx, - pVesa->monitor->features.redy, - pVesa->monitor->features.greenx, pVesa->monitor->features.greeny, - pVesa->monitor->features.bluex, pVesa->monitor->features.bluey, - pVesa->monitor->features.whitex, pVesa->monitor->features.whitey, - pVesa->monitor->timings1.t1, - pVesa->monitor->timings1.t2, - pVesa->monitor->timings1.t_manu); - for (i = 0; i < 8; i++) { - ErrorF(" %d %d %d %d\n", - pVesa->monitor->timings2[i].hsize, - pVesa->monitor->timings2[i].vsize, - pVesa->monitor->timings2[i].refresh, - pVesa->monitor->timings2[i].id); - } - ErrorF("DETAILED MONITOR SECTION:\n"); - for (i = 0; i < 4; i++) { - int j; - - ErrorF(" type "); - switch (pVesa->monitor->det_mon[i].type) { - case DT: - ErrorF("DT\n"); - ErrorF(" clock: %d\n" - " hactive: %d\n hblanking: %d\n" - " vactive: %d\n vblanking: %d\n" - " hsyncoff: %d\n hsyncwidth: %d\n" - " vsyncoff: %d\n vsyncwidth: %d\n" - " hsize: %d\n vsize: %d\n" - " hborder: %d\n vborder: %d\n" - " interlaced: %d\n stereo: %d\n" - " sync: %d\n misc: %d\n", - pVesa->monitor->det_mon[i].section.d_timings.clock, - pVesa->monitor->det_mon[i].section.d_timings.h_active, - pVesa->monitor->det_mon[i].section.d_timings.h_blanking, - pVesa->monitor->det_mon[i].section.d_timings.v_active, - pVesa->monitor->det_mon[i].section.d_timings.v_blanking, - pVesa->monitor->det_mon[i].section.d_timings.h_sync_off, - pVesa->monitor->det_mon[i].section.d_timings.h_sync_width, - pVesa->monitor->det_mon[i].section.d_timings.v_sync_off, - pVesa->monitor->det_mon[i].section.d_timings.v_sync_width, - pVesa->monitor->det_mon[i].section.d_timings.h_size, - pVesa->monitor->det_mon[i].section.d_timings.v_size, - pVesa->monitor->det_mon[i].section.d_timings.h_border, - pVesa->monitor->det_mon[i].section.d_timings.v_border, - pVesa->monitor->det_mon[i].section.d_timings.interlaced, - pVesa->monitor->det_mon[i].section.d_timings.stereo, - pVesa->monitor->det_mon[i].section.d_timings.sync, - pVesa->monitor->det_mon[i].section.d_timings.misc); - break; - case DS_SERIAL: - ErrorF("SERIAL\n"); - ErrorF(" serial: %s\n", pVesa->monitor->det_mon[i].section.serial); - break; - case DS_ASCII_STR: - ErrorF("ASCII_STR\n"); - ErrorF(" ascii_str: %s\n", pVesa->monitor->det_mon[i].section.ascii_data); - break; - case DS_NAME: - ErrorF("NAME\n"); - ErrorF(" name: %s\n", pVesa->monitor->det_mon[i].section.name); - break; - case DS_RANGES: - ErrorF("RANGES\n"); - ErrorF(" ranges: minv %d - maxv %d - minh %d - maxh %d - maxclock %d\n", - pVesa->monitor->det_mon[i].section.ranges.min_v, - pVesa->monitor->det_mon[i].section.ranges.max_v, - pVesa->monitor->det_mon[i].section.ranges.min_h, - pVesa->monitor->det_mon[i].section.ranges.min_h, - pVesa->monitor->det_mon[i].section.ranges.max_clock); - break; - case DS_WHITE_P: - ErrorF("WHITE_P\n"); - for (j = 0; j < 2; j++) - ErrorF(" index %d - whitex %d - whitey %d - whitegamma %d\n", - pVesa->monitor->det_mon[i].section.wp[j].index, - pVesa->monitor->det_mon[i].section.wp[j].white_x, - pVesa->monitor->det_mon[i].section.wp[j].white_y, - pVesa->monitor->det_mon[i].section.wp[j].white_gamma); - break; - case DS_STD_TIMINGS: - ErrorF("STD_TIMINGS\n"); - for (j = 0; j < 5; j++) - ErrorF(" %d %d %d %d\n", - pVesa->monitor->det_mon[i].section.std_t[j].hsize, - pVesa->monitor->det_mon[i].section.std_t[j].vsize, - pVesa->monitor->det_mon[i].section.std_t[j].refresh, - pVesa->monitor->det_mon[i].section.std_t[j].id); - break; - default: - ErrorF(" UNKNOWN\n"); - break; - } - } -#endif } - /* unload modules */ - xf86UnloadSubModule(pVbeModule); xf86UnloadSubModule(pDDCModule); } -#ifdef DEBUG - ErrorF("%c%c%c%c %d.%d - %s\n", - vbe->VESASignature[0], vbe->VESASignature[1], - vbe->VESASignature[2], vbe->VESASignature[3], - pVesa->major, pVesa->minor, vbe->OEMStringPtr); - - if (pVesa->major >= 2) - ErrorF("Vendor: %s\nProduct: %s\nProductRev: %s\nSoftware Rev: %d.%d\n", - vbe->OemVendorNamePtr, vbe->OemProductNamePtr, - vbe->OemProductRevPtr, (unsigned)vbe->OemSoftwareRev >> 8, - vbe->OemSoftwareRev & 0xff); -#endif - /* Set display resolution */ xf86SetDpi(pScrn, 0, 0); if ((pScrn->monitor->DDC = pVesa->monitor) != NULL) xf86SetDDCproperties(pScrn, pVesa->monitor); -#ifdef DEBUG - ErrorF("Searching for matching VESA mode(s):\n"); -#endif + xf86DrvMsgVerb(pScrn->scrnIndex, X_INFO, DEBUG_VERB, + "Searching for matching VESA mode(s):\n"); i = 0; while (vbe->VideoModePtr[i] != 0xffff) { int id = vbe->VideoModePtr[i++]; - if ((mode = VESAGetModeInfo(pScrn, id)) == NULL) + if ((mode = VBEGetModeInfo(pVesa->pVbe, id)) == NULL) continue; + xf86ErrorFVerb(DEBUG_VERB, + "Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution); + xf86ErrorFVerb(DEBUG_VERB, + " ModeAttributes: 0x%x\n", mode->ModeAttributes); + xf86ErrorFVerb(DEBUG_VERB, + " WinAAttributes: 0x%x\n", mode->WinAAttributes); + xf86ErrorFVerb(DEBUG_VERB, + " WinBAttributes: 0x%x\n", mode->WinBAttributes); + xf86ErrorFVerb(DEBUG_VERB, + " WinGranularity: %d\n", mode->WinGranularity); + xf86ErrorFVerb(DEBUG_VERB, + " WinSize: %d\n", mode->WinSize); + xf86ErrorFVerb(DEBUG_VERB, + " WinASegment: 0x%x\n", mode->WinASegment); + xf86ErrorFVerb(DEBUG_VERB, + " WinBSegment: 0x%x\n", mode->WinBSegment); + xf86ErrorFVerb(DEBUG_VERB, + " WinFuncPtr: 0x%x\n", mode->WinFuncPtr); + xf86ErrorFVerb(DEBUG_VERB, + " BytesPerScanline: %d\n", mode->BytesPerScanline); + xf86ErrorFVerb(DEBUG_VERB, + " XResolution: %d\n", mode->XResolution); + xf86ErrorFVerb(DEBUG_VERB, + " YResolution: %d\n", mode->YResolution); + xf86ErrorFVerb(DEBUG_VERB, + " XCharSize: %d\n", mode->XCharSize); + xf86ErrorFVerb(DEBUG_VERB, + " YCharSize: %d\n", mode->YCharSize); + xf86ErrorFVerb(DEBUG_VERB, + " NumberOfPlanes: %d\n", mode->NumberOfPlanes); + xf86ErrorFVerb(DEBUG_VERB, + " BitsPerPixel: %d\n", mode->BitsPerPixel); + xf86ErrorFVerb(DEBUG_VERB, + " NumberOfBanks: %d\n", mode->NumberOfBanks); + xf86ErrorFVerb(DEBUG_VERB, + " MemoryModel: %d\n", mode->MemoryModel); + xf86ErrorFVerb(DEBUG_VERB, + " BankSize: %d\n", mode->BankSize); + xf86ErrorFVerb(DEBUG_VERB, + " NumberOfImages: %d\n", mode->NumberOfImages); + xf86ErrorFVerb(DEBUG_VERB, + " RedMaskSize: %d\n", mode->RedMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " RedFieldPosition: %d\n", mode->RedFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " GreenMaskSize: %d\n", mode->GreenMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " GreenFieldPosition: %d\n", mode->GreenFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " BlueMaskSize: %d\n", mode->BlueMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " BlueFieldPosition: %d\n", mode->BlueFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " RsvdMaskSize: %d\n", mode->RsvdMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " RsvdFieldPosition: %d\n", mode->RsvdFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " DirectColorModeInfo: %d\n", mode->DirectColorModeInfo); + if (pVesa->major >= 2) { + xf86ErrorFVerb(DEBUG_VERB, + " PhysBasePtr: 0x%x\n", mode->PhysBasePtr); + if (pVesa->major >= 3) { + xf86ErrorFVerb(DEBUG_VERB, + " LinBytesPerScanLine: %d\n", mode->LinBytesPerScanLine); + xf86ErrorFVerb(DEBUG_VERB, + " BnkNumberOfImagePages: %d\n", mode->BnkNumberOfImagePages); + xf86ErrorFVerb(DEBUG_VERB, + " LinNumberOfImagePages: %d\n", mode->LinNumberOfImagePages); + xf86ErrorFVerb(DEBUG_VERB, + " LinRedMaskSize: %d\n", mode->LinRedMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " LinRedFieldPosition: %d\n", mode->LinRedFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " LinGreenMaskSize: %d\n", mode->LinGreenMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " LinGreenFieldPosition: %d\n", mode->LinGreenFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " LinBlueMaskSize: %d\n", mode->LinBlueMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " LinBlueFieldPosition: %d\n", mode->LinBlueFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " LinRsvdMaskSize: %d\n", mode->LinRsvdMaskSize); + xf86ErrorFVerb(DEBUG_VERB, + " LinRsvdFieldPosition: %d\n", mode->LinRsvdFieldPosition); + xf86ErrorFVerb(DEBUG_VERB, + " MaxPixelClock: %d\n", mode->MaxPixelClock); + } + } if (!(mode->ModeAttributes & (1 << 0)) || /* supported in the configured hardware */ !(mode->ModeAttributes & (1 << 4)) || /* text mode */ @@ -631,7 +598,7 @@ ((mode->ModeAttributes & (1 << 6)) && !(mode->ModeAttributes & (1 << 7))) || mode->BitsPerPixel != pScrn->bitsPerPixel) { - VESAFreeModeInfo(mode); + VBEFreeModeInfo(mode); continue; } @@ -666,65 +633,18 @@ pMode->next = pScrn->modePool; } -#ifdef DEBUG - ErrorF("Mode: %x (%dx%d)\n", id, mode->XResolution, mode->YResolution); - ErrorF(" ModeAttributes: 0x%x\n", mode->ModeAttributes); - ErrorF(" WinAAttributes: 0x%x\n", mode->WinAAttributes); - ErrorF(" WinBAttributes: 0x%x\n", mode->WinBAttributes); - ErrorF(" WinGranularity: %d\n", mode->WinGranularity); - ErrorF(" WinSize: %d\n", mode->WinSize); - ErrorF(" WinASegment: 0x%x\n", mode->WinASegment); - ErrorF(" WinBSegment: 0x%x\n", mode->WinBSegment); - ErrorF(" WinFuncPtr: 0x%x\n", mode->WinFuncPtr); - ErrorF(" BytesPerScanline: %d\n", mode->BytesPerScanline); - ErrorF(" XResolution: %d\n", mode->XResolution); - ErrorF(" YResolution: %d\n", mode->YResolution); - ErrorF(" XCharSize: %d\n", mode->XCharSize); - ErrorF(" YCharSize: %d\n", mode->YCharSize); - ErrorF(" NumberOfPlanes: %d\n", mode->NumberOfPlanes); - ErrorF(" BitsPerPixel: %d\n", mode->BitsPerPixel); - ErrorF(" NumberOfBanks: %d\n", mode->NumberOfBanks); - ErrorF(" MemoryModel: %d\n", mode->MemoryModel); - ErrorF(" BankSize: %d\n", mode->BankSize); - ErrorF(" NumberOfImages: %d\n", mode->NumberOfImages); - ErrorF(" RedMaskSize: %d\n", mode->RedMaskSize); - ErrorF(" RedFieldPosition: %d\n", mode->RedFieldPosition); - ErrorF(" GreenMaskSize: %d\n", mode->GreenMaskSize); - ErrorF(" GreenFieldPosition: %d\n", mode->GreenFieldPosition); - ErrorF(" BlueMaskSize: %d\n", mode->BlueMaskSize); - ErrorF(" BlueFieldPosition: %d\n", mode->BlueFieldPosition); - ErrorF(" RsvdMaskSize: %d\n", mode->RsvdMaskSize); - ErrorF(" RsvdFieldPosition: %d\n", mode->RsvdFieldPosition); - ErrorF(" DirectColorModeInfo: %d\n", mode->DirectColorModeInfo); - if (pVesa->major >= 2) { - ErrorF(" PhysBasePtr: 0x%x\n", mode->PhysBasePtr); - if (pVesa->major >= 3) { - ErrorF(" LinBytesPerScanLine: %d\n", mode->LinBytesPerScanLine); - ErrorF(" BnkNumberOfImagePages: %d\n", mode->BnkNumberOfImagePages); - ErrorF(" LinNumberOfImagePages: %d\n", mode->LinNumberOfImagePages); - ErrorF(" LinRedMaskSize: %d\n", mode->LinRedMaskSize); - ErrorF(" LinRedFieldPosition: %d\n", mode->LinRedFieldPosition); - ErrorF(" LinGreenMaskSize: %d\n", mode->LinGreenMaskSize); - ErrorF(" LinGreenFieldPosition: %d\n", mode->LinGreenFieldPosition); - ErrorF(" LinBlueMaskSize: %d\n", mode->LinBlueMaskSize); - ErrorF(" LinBlueFieldPosition: %d\n", mode->LinBlueFieldPosition); - ErrorF(" LinRsvdMaskSize: %d\n", mode->LinRsvdMaskSize); - ErrorF(" LinRsvdFieldPosition: %d\n", mode->LinRsvdFieldPosition); - ErrorF(" MaxPixelClock: %d\n", mode->MaxPixelClock); - } - } -#endif } -#ifdef DEBUG - ErrorF("\n"); - ErrorF("Total Memory: %d 64Kb banks (%dM)\n", vbe->TotalMemory, + xf86ErrorFVerb(DEBUG_VERB, "\n"); + xf86ErrorFVerb(DEBUG_VERB, + "Total Memory: %d 64Kb banks (%dM)\n", vbe->TotalMemory, (vbe->TotalMemory * 65536) / (1024 * 1024)); -#endif pVesa->mapSize = vbe->TotalMemory * 65536; - if (pScrn->modePool == NULL) + if (pScrn->modePool == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No matching modes\n"); return (FALSE); + } for (i = 0; pScrn->modePool != NULL && pScrn->display->modes[i] != NULL; i++) { pMode = pScrn->modePool; @@ -813,7 +733,7 @@ /* copy the "interesting" information */ memcpy((char*)pMode + from, (char*)tmp + from, to - from); data = (ModeInfoData*)pMode->Private; - data->block = xcalloc(sizeof(CRTCInfoBlock), 1); + data->block = xcalloc(sizeof(VbeCRTCInfoBlock), 1); data->block->HorizontalTotal = pMode->HTotal; data->block->HorizontalSyncStart = pMode->HSyncStart; data->block->HorizontalSyncEnd = pMode->HSyncEnd; @@ -833,15 +753,22 @@ pScrn->currentMode = pScrn->modes; pScrn->displayWidth = pScrn->virtualX; - if (pScrn->modes == NULL) + xf86PrintModes(pScrn); + + if (pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No modes\n"); return (FALSE); + } /* options */ xf86CollectOptions(pScrn, NULL); - xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, VESAOptions); + if (!(pVesa->Options = xalloc(sizeof(VESAOptions)))) + return FALSE; + memcpy(pVesa->Options, VESAOptions, sizeof(VESAOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, pVesa->Options); /* Use shadow by default */ - if (xf86ReturnOptValBool(VESAOptions, OPTION_SHADOW_FB, TRUE)) + if (xf86ReturnOptValBool(pVesa->Options, OPTION_SHADOW_FB, TRUE)) pVesa->shadowFB = TRUE; mode = ((ModeInfoData*)pScrn->modes->Private)->data; @@ -858,6 +785,9 @@ if (pVesa->shadowFB) { mod = "fb"; reqSym = "fbScreenInit"; + pScrn->bitmapBitOrder = BITMAP_BIT_ORDER; + + xf86LoaderReqSymbols("fbPictureInit", NULL); } else { switch (pScrn->bitsPerPixel) { @@ -877,29 +807,11 @@ } break; case 0x4: /* Packed pixel */ - mod = "fb"; - reqSym = "fbScreenInit"; - - switch (pScrn->bitsPerPixel) { - case 8: - case 16: - case 32: - break; - case 24: - if (pVesa->pix24bpp == 32) { - mod = "xf24_32bpp"; - reqSym = "cfb24_32ScreenInit"; - } - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unsupported bpp: %d", pScrn->bitsPerPixel); - return FALSE; - } - break; case 0x6: /* Direct Color */ mod = "fb"; reqSym = "fbScreenInit"; + pScrn->bitmapBitOrder = BITMAP_BIT_ORDER; + xf86LoaderReqSymbols("fbPictureInit", NULL); switch (pScrn->bitsPerPixel) { case 8: @@ -907,7 +819,7 @@ case 32: break; case 24: - if (pVesa->pix24bpp == 32) { + if (pVesa->pix24bpp == 32) { mod = "xf24_32bpp"; reqSym = "cfb24_32ScreenInit"; } @@ -936,9 +848,6 @@ return (FALSE); } xf86LoaderReqSymbols(reqSym, NULL); -#ifdef RENDER - xf86LoaderReqSymbols("fbPictureInit", NULL); -#endif return (TRUE); } @@ -949,7 +858,7 @@ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; VESAPtr pVesa = VESAGetRec(pScrn); VisualPtr visual; - ModeInfoBlock *mode; + VbeModeInfoBlock *mode; int flags; if (pVesa->mapPhys == 0) { @@ -959,7 +868,7 @@ pVesa->mapOff = 0; } - if ((void*)pVesa->mapPhys == NULL) { + if (pVesa->mapPhys == 0) { pVesa->mapPhys = 0xa0000; pVesa->mapSize = 0x10000; } @@ -982,7 +891,7 @@ /* save current video state */ VESASaveRestore(pScrn, MODE_SAVE); - pVesa->savedPal = VESASetGetPaletteData(pScrn, FALSE, 0, 256, + pVesa->savedPal = VBESetGetPaletteData(pVesa->pVbe, FALSE, 0, 256, NULL, FALSE, FALSE); /* set first video mode */ @@ -1019,14 +928,23 @@ return (FALSE); case 0x3: /* Planar */ if (pVesa->shadowFB) { - if (!fbScreenInit(pScreen, - pVesa->shadowPtr, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, pScrn->bitsPerPixel)) + if (pScrn->depth == 1) { + if (!mfbScreenInit(pScreen, + pVesa->shadowPtr, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth)) + return FALSE; + } else { + if (!fbScreenInit(pScreen, + pVesa->shadowPtr, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, pScrn->bitsPerPixel)) return (FALSE); - } - else { + fbPictureInit(pScreen, 0, 0); + } + } else { switch (pScrn->bitsPerPixel) { case 1: if (!xf1bppScreenInit(pScreen, pVesa->base, @@ -1052,38 +970,11 @@ } break; case 0x4: /* Packed pixel */ - switch (pScrn->bitsPerPixel) { - case 24: - if (pVesa->pix24bpp == 32) { - if (!cfb24_32ScreenInit(pScreen, - pVesa->shadowFB ? pVesa->shadowPtr : pVesa->base, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth)) - return (FALSE); - break; - } - case 8: - case 16: - case 32: - if (!fbScreenInit(pScreen, - pVesa->shadowFB ? pVesa->shadowPtr : pVesa->base, - pScrn->virtualX, pScrn->virtualY, - pScrn->xDpi, pScrn->yDpi, - pScrn->displayWidth, pScrn->bitsPerPixel)) - return (FALSE); - break; - default: - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Unsupported bpp: %d", pScrn->bitsPerPixel); - return FALSE; - } - break; case 0x6: /* Direct Color */ switch (pScrn->bitsPerPixel) { case 24: if (pVesa->pix24bpp == 32) { - if (!cfb24_32ScreenInit(pScreen, + if (!cfb24_32ScreenInit(pScreen, pVesa->shadowFB ? pVesa->shadowPtr : pVesa->base, pScrn->virtualX, pScrn->virtualY, pScrn->xDpi, pScrn->yDpi, @@ -1100,6 +991,7 @@ pScrn->xDpi, pScrn->yDpi, pScrn->displayWidth, pScrn->bitsPerPixel)) return (FALSE); + fbPictureInit(pScreen, 0, 0); break; default: xf86DrvMsg(pScrn->scrnIndex, X_ERROR, @@ -1109,9 +1001,6 @@ break; } -#ifdef RENDER - fbPictureInit(pScreen, 0, 0); -#endif if (pScrn->bitsPerPixel > 8) { /* Fixup RGB ordering */ @@ -1133,7 +1022,7 @@ ShadowWindowProc window; if (mode->MemoryModel == 3) { /* Planar */ - if (pScrn->bitsPerPixel == 8) + if (pScrn->bitsPerPixel == 8) update = shadowUpdatePlanar4x8; else update = shadowUpdatePlanar4; @@ -1190,9 +1079,16 @@ VESALoadPalette, NULL, flags)) return (FALSE); + pVesa->CloseScreen = pScreen->CloseScreen; pScreen->CloseScreen = VESACloseScreen; pScreen->SaveScreen = VESASaveScreen; + xf86DPMSInit(pScreen, VESADisplayPowerManagementSet, 0); + + /* Report any unused options (only for the first generation) */ + if (serverGeneration == 1) + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + return (TRUE); } @@ -1215,20 +1111,24 @@ ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; VESAPtr pVesa = VESAGetRec(pScrn); - VESASaveRestore(xf86Screens[scrnIndex], MODE_RESTORE); - VESASetGetPaletteData(pScrn, TRUE, 0, 256, - pVesa->savedPal, FALSE, TRUE); - - VESAUnmapVidMem(pScrn); + if (pScrn->vtSema) { + VESASaveRestore(xf86Screens[scrnIndex], MODE_RESTORE); + VBESetGetPaletteData(pVesa->pVbe, TRUE, 0, 256, + pVesa->savedPal, FALSE, TRUE); + VESAUnmapVidMem(pScrn); + } if (pVesa->shadowPtr) { xfree(pVesa->shadowPtr); pVesa->shadowPtr = NULL; } - if (pVesa->pDGAMode) + if (pVesa->pDGAMode) { xfree(pVesa->pDGAMode); + pVesa->pDGAMode = NULL; + } pScrn->vtSema = FALSE; - return (TRUE); + pScreen->CloseScreen = pVesa->CloseScreen; + return pScreen->CloseScreen(scrnIndex, pScreen); } static Bool @@ -1255,9 +1155,9 @@ if (pVesa->mapPhys != 0xa0000) mode |= 1 << 14; - if (VESASetVBEMode(pScrn, mode, data->block) == FALSE) { + if (VBESetVBEMode(pVesa->pVbe, mode, data->block) == FALSE) { if ((data->block || (data->mode & (1 << 11))) && - VESASetVBEMode(pScrn, (mode & ~(1 << 11)), NULL) == TRUE) { + VBESetVBEMode(pVesa->pVbe, (mode & ~(1 << 11)), NULL) == TRUE) { /* Some cards do not like setting the clock. * Free it as it will not be any longer useful */ @@ -1275,10 +1175,10 @@ !((data->data->WinBSegment == 0) && (data->data->WinBAttributes == 0)); if (data->data->XResolution != pScrn->virtualX) - VESASetLogicalScanline(pScrn, pScrn->virtualX); + VBESetLogicalScanline(pVesa->pVbe, pScrn->virtualX); if (pScrn->bitsPerPixel >= 8 && pVesa->vbeInfo->Capabilities[0] & 0x01) - VESASetGetDACPaletteFormat(pScrn, 8); + VBESetGetDACPaletteFormat(pVesa->pVbe, 8); pScrn->vtSema = TRUE; @@ -1288,10 +1188,9 @@ static void VESAAdjustFrame(int scrnIndex, int x, int y, int flags) { - ScrnInfoPtr pScrn; + VESAPtr pVesa = VESAGetRec(xf86Screens[scrnIndex]); - pScrn = xf86Screens[scrnIndex]; - VESASetDisplayStart(pScrn, x, y, TRUE); + VBESetDisplayStart(pVesa->pVbe, x, y, TRUE); } static void @@ -1320,10 +1219,9 @@ else pVesa->VGAbase = pVesa->base; } -#ifdef DEBUG - ErrorF("virtual address = %p - physical address = %p - size = %d\n", + xf86ErrorFVerb(DEBUG_VERB, + "virtual address = %p - physical address = %p - size = %d\n", pVesa->base, pScrn->memPhysBase, pVesa->mapSize); -#endif return (pVesa->base != NULL); } @@ -1348,13 +1246,12 @@ { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VESAPtr pVesa = VESAGetRec(pScrn); - ModeInfoBlock *data = ((ModeInfoData*)(pScrn->currentMode->Private))->data; + VbeModeInfoBlock *data = ((ModeInfoData*)(pScrn->currentMode->Private))->data; int window; int mask = 1 << (offset & 3); outb(0x3c4, 2); outb(0x3c5, mask); - offset = (offset >> 2) + pVesa->maxBytesPerScanline * row; window = offset / (data->WinGranularity * 1024); pVesa->windowAoffset = window * data->WinGranularity * 1024; @@ -1382,7 +1279,7 @@ { ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; VESAPtr pVesa = VESAGetRec(pScrn); - ModeInfoBlock *data = ((ModeInfoData*)(pScrn->currentMode->Private))->data; + VbeModeInfoBlock *data = ((ModeInfoData*)(pScrn->currentMode->Private))->data; int window; offset += pVesa->maxBytesPerScanline * row; @@ -1416,14 +1313,14 @@ (colors[j].green << 8) | (colors[j].red << 16); if (j != idx) { - VESASetGetPaletteData(pScrn, TRUE, base, idx - base, + VBESetGetPaletteData(pVesa->pVbe, TRUE, base, idx - base, pVesa->pal + base, FALSE, TRUE); idx = base = j; } } if (idx - 1 == indices[i - 1]) - VESASetGetPaletteData(pScrn, TRUE, base, idx - base, + VBESetGetPaletteData(pVesa->pVbe, TRUE, base, idx - base, pVesa->pal + base, FALSE, TRUE); #else #define WriteDacWriteAddr(value) outb(VGA_DAC_WRITE_ADDR, value) @@ -1456,7 +1353,9 @@ static void WriteAttr(int index, int value) { - CARD8 tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); + CARD8 tmp; + + tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); index |= 0x20; outb(VGA_ATTR_INDEX, index); @@ -1466,7 +1365,9 @@ static int ReadAttr(int index) { - CARD8 tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); + CARD8 tmp; + + tmp = inb(VGA_IOBASE_COLOR + VGA_IN_STAT_1_OFFSET); index |= 0x20; outb(VGA_ATTR_INDEX, index); @@ -1667,282 +1568,29 @@ return (TRUE); } - -VBEInfoBlock * -VESAGetVBEInfo(ScrnInfoPtr pScrn) -{ - VESAPtr pVesa; - VBEInfoBlock *block = NULL; - int i, pStr, pModes; - char *str; - CARD16 major, minor, *modes; - - pVesa = VESAGetRec(pScrn); - bzero(pVesa->block, sizeof(VBEInfoBlock)); - - /* - Input: - AH := 4Fh Super VGA support - AL := 00h Return Super VGA information - ES:DI := Pointer to buffer - - Output: - AX := status - (All other registers are preserved) - */ - - pVesa->block[0] = 'V'; - pVesa->block[1] = 'B'; - pVesa->block[2] = 'E'; - pVesa->block[3] = '2'; - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f00; - pVesa->pInt->es = SEG_ADDR(pVesa->page); - pVesa->pInt->di = SEG_OFF(pVesa->page); - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (NULL); - - block = xcalloc(sizeof(VBEInfoBlock), 1); - block->VESASignature[0] = pVesa->block[0]; - block->VESASignature[1] = pVesa->block[1]; - block->VESASignature[2] = pVesa->block[2]; - block->VESASignature[3] = pVesa->block[3]; - - block->VESAVersion = *(CARD16*)(pVesa->block + 4); - major = (unsigned)block->VESAVersion >> 8; - minor = block->VESAVersion & 0xff; - - pStr = *(CARD32*)(pVesa->block + 6); - str = xf86int10Addr(pVesa->pInt, FARP(pStr)); - block->OEMStringPtr = strdup(str); - - block->Capabilities[0] = pVesa->block[10]; - block->Capabilities[1] = pVesa->block[11]; - block->Capabilities[2] = pVesa->block[12]; - block->Capabilities[3] = pVesa->block[13]; - - pModes = *(CARD32*)(pVesa->block + 14); - modes = xf86int10Addr(pVesa->pInt, FARP(pModes)); - i = 0; - while (modes[i] != 0xffff) - i++; - block->VideoModePtr = xalloc(sizeof(CARD16) * i + 1); - memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i); - block->VideoModePtr[i] = 0xffff; - - block->TotalMemory = *(CARD16*)(pVesa->block + 18); - - if (major < 2) - memcpy(&block->OemSoftwareRev, pVesa->block + 20, 236); - else { - block->OemSoftwareRev = *(CARD16*)(pVesa->block + 20); - pStr = *(CARD32*)(pVesa->block + 22); - str = xf86int10Addr(pVesa->pInt, FARP(pStr)); - block->OemVendorNamePtr = strdup(str); - pStr = *(CARD32*)(pVesa->block + 26); - str = xf86int10Addr(pVesa->pInt, FARP(pStr)); - block->OemProductNamePtr = strdup(str); - pStr = *(CARD32*)(pVesa->block + 30); - str = xf86int10Addr(pVesa->pInt, FARP(pStr)); - block->OemProductRevPtr = strdup(str); - memcpy(&block->Reserved, pVesa->block + 34, 222); - memcpy(&block->OemData, pVesa->block + 256, 256); - } - - return (block); -} - -void -VESAFreeVBEInfo(VBEInfoBlock *block) -{ - xfree(block->OEMStringPtr); - xfree(block->VideoModePtr); - if (((unsigned)block->VESAVersion >> 8) >= 2) { - xfree(block->OemVendorNamePtr); - xfree(block->OemProductNamePtr); - xfree(block->OemProductRevPtr); - } - xfree(block); -} - -Bool -VESASetVBEMode(ScrnInfoPtr pScrn, int mode, CRTCInfoBlock *block) -{ - VESAPtr pVesa; - - pVesa = VESAGetRec(pScrn); - /* - Input: - AH := 4Fh Super VGA support - AL := 02h Set Super VGA video mode - BX := Video mode - D0-D8 := Mode number - D9-D10 := Reserved (must be 0) - D11 := 0 Use current default refresh rate - := 1 Use user specified CRTC values for refresh rate - D12-13 Reserved for VBE/AF (must be 0) - D14 := 0 Use windowed frame buffer model - := 1 Use linear/flat frame buffer model - D15 := 0 Clear video memory - := 1 Don't clear video memory - ES:DI := Pointer to CRTCInfoBlock structure - - Output: AX = Status - (All other registers are preserved) - */ - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f02; - pVesa->pInt->bx = mode; - if (block) { - pVesa->pInt->bx |= 1 << 11; - memcpy(pVesa->block, block, sizeof(CRTCInfoBlock)); - pVesa->pInt->es = SEG_ADDR(pVesa->page); - pVesa->pInt->di = SEG_OFF(pVesa->page); - } - xf86ExecX86int10(pVesa->pInt); - - return (pVesa->pInt->ax == 0x4f); -} - -Bool -VESAGetVBEMode(ScrnInfoPtr pScrn, int *mode) -{ - VESAPtr pVesa; - - pVesa = VESAGetRec(pScrn); - /* - Input: - AH := 4Fh Super VGA support - AL := 03h Return current video mode - - Output: - AX := Status - BX := Current video mode - (All other registers are preserved) - */ - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f03; - - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax == 0x4f) { - *mode = pVesa->pInt->bx; - - return (TRUE); - } - - return (FALSE); -} - -ModeInfoBlock * -VESAGetModeInfo(ScrnInfoPtr pScrn, int mode) +static int +VESABankSwitch(ScreenPtr pScreen, unsigned int iBank) { VESAPtr pVesa; - ModeInfoBlock *block = NULL; + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; pVesa = VESAGetRec(pScrn); - bzero(pVesa->block, sizeof(ModeInfoBlock)); - - /* - Input: - AH := 4Fh Super VGA support - AL := 01h Return Super VGA mode information - CX := Super VGA video mode - (mode number must be one of those returned by Function 0) - ES:DI := Pointer to buffer - - Output: - AX := status - (All other registers are preserved) - */ - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f01; - pVesa->pInt->cx = mode; - pVesa->pInt->es = SEG_ADDR(pVesa->page); - pVesa->pInt->di = SEG_OFF(pVesa->page); - xf86ExecX86int10(pVesa->pInt); - if (pVesa->pInt->ax != 0x4f) - return (NULL); - - block = xcalloc(sizeof(ModeInfoBlock), 1); - - block->ModeAttributes = *(CARD16*)pVesa->block; - block->WinAAttributes = pVesa->block[2]; - block->WinBAttributes = pVesa->block[3]; - block->WinGranularity = *(CARD16*)(pVesa->block + 4); - block->WinSize = *(CARD16*)(pVesa->block + 6); - block->WinASegment = *(CARD16*)(pVesa->block + 8); - block->WinBSegment = *(CARD16*)(pVesa->block + 10); - block->WinFuncPtr = *(CARD32*)(pVesa->block + 12); - block->BytesPerScanline = *(CARD16*)(pVesa->block + 16); - - /* mandatory information for VBE 1.2 and above */ - block->XResolution = *(CARD16*)(pVesa->block + 18); - block->YResolution = *(CARD16*)(pVesa->block + 20); - block->XCharSize = pVesa->block[22]; - block->YCharSize = pVesa->block[23]; - block->NumberOfPlanes = pVesa->block[24]; - block->BitsPerPixel = pVesa->block[25]; - block->NumberOfBanks = pVesa->block[26]; - block->MemoryModel = pVesa->block[27]; - block->BankSize = pVesa->block[28]; - block->NumberOfImages = pVesa->block[29]; - block->Reserved = pVesa->block[30]; - - /* Direct color fields (required for direct/6 and YUV/7 memory models) */ - block->RedMaskSize = pVesa->block[31]; - block->RedFieldPosition = pVesa->block[32]; - block->GreenMaskSize = pVesa->block[33]; - block->GreenFieldPosition = pVesa->block[34]; - block->BlueMaskSize = pVesa->block[35]; - block->BlueFieldPosition = pVesa->block[36]; - block->RsvdMaskSize = pVesa->block[37]; - block->RsvdFieldPosition = pVesa->block[38]; - block->DirectColorModeInfo = pVesa->block[39]; - - /* Mandatory information for VBE 2.0 and above */ - if (pVesa->major >= 2) { - block->PhysBasePtr = *(CARD32*)(pVesa->block + 40); - block->Reserved32 = *(CARD32*)(pVesa->block + 44); - block->Reserved16 = *(CARD16*)(pVesa->block + 48); - - /* Mandatory information for VBE 3.0 and above */ - if (pVesa->major >= 3) { - block->LinBytesPerScanLine = *(CARD16*)(pVesa->block + 50); - block->BnkNumberOfImagePages = pVesa->block[52]; - block->LinNumberOfImagePages = pVesa->block[53]; - block->LinRedMaskSize = pVesa->block[54]; - block->LinRedFieldPosition = pVesa->block[55]; - block->LinGreenMaskSize = pVesa->block[56]; - block->LinGreenFieldPosition = pVesa->block[57]; - block->LinBlueMaskSize = pVesa->block[58]; - block->LinBlueFieldPosition = pVesa->block[59]; - block->LinRsvdMaskSize = pVesa->block[60]; - block->LinRsvdFieldPosition = pVesa->block[61]; - block->MaxPixelClock = *(CARD32*)(pVesa->block + 62); - memcpy(&block->Reserved2, pVesa->block + 66, 188); - } - else - memcpy(&block->LinBytesPerScanLine, pVesa->block + 50, 206); + if (pVesa->curBank == iBank) + return (0); + if (!VBEBankSwitch(pVesa->pVbe, iBank, 0)) + return (1); + if (pVesa->bankSwitchWindowB) { + if (!VBEBankSwitch(pVesa->pVbe, iBank, 1)) + return (1); } - else - memcpy(&block->PhysBasePtr, pVesa->block + 40, 216); - - return (block); -} + pVesa->curBank = iBank; -void -VESAFreeModeInfo(ModeInfoBlock *block) -{ - xfree(block); + return (0); } Bool -VESASaveRestore(ScrnInfoPtr pScrn, int function) +VESASaveRestore(ScrnInfoPtr pScrn, vbeSaveRestoreFunction function) { VESAPtr pVesa; @@ -1951,376 +1599,64 @@ pVesa = VESAGetRec(pScrn); - /* - Input: - AH := 4Fh Super VGA support - AL := 04h Save/restore Super VGA video state - DL := 00h Return save/restore state buffer size - CX := Requested states - D0 = Save/restore video hardware state - D1 = Save/restore video BIOS data state - D2 = Save/restore video DAC state - D3 = Save/restore Super VGA state - - Output: - AX = Status - BX = Number of 64-byte blocks to hold the state buffer - (All other registers are preserved) - - - Input: - AH := 4Fh Super VGA support - AL := 04h Save/restore Super VGA video state - DL := 01h Save Super VGA video state - CX := Requested states (see above) - ES:BX := Pointer to buffer - - Output: - AX := Status - (All other registers are preserved) - - - Input: - AH := 4Fh Super VGA support - AL := 04h Save/restore Super VGA video state - DL := 02h Restore Super VGA video state - CX := Requested states (see above) - ES:BX := Pointer to buffer - - Output: - AX := Status - (All other registers are preserved) - */ /* Query amount of memory to save state */ if (function == MODE_QUERY || (function == MODE_SAVE && pVesa->state == NULL)) { - int npages; /* Make sure we save at least this information in case of failure */ - (void)VESAGetVBEMode(pScrn, &pVesa->stateMode); + (void)VBEGetVBEMode(pVesa->pVbe, &pVesa->stateMode); SaveFonts(pScrn); if (pVesa->major > 1) { - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f04; - pVesa->pInt->dx = 0; - pVesa->pInt->cx = 0x000f; - xf86ExecX86int10(pVesa->pInt); - if (pVesa->pInt->ax != 0x4f) - return (FALSE); + if (!VBESaveRestore(pVesa->pVbe,function,(pointer)&pVesa->state, + &pVesa->stateSize,&pVesa->statePage)) + return FALSE; - npages = (pVesa->pInt->bx * 64) / 4096 + 1; - if ((pVesa->state = xf86Int10AllocPages(pVesa->pInt, npages, - &pVesa->statePage)) == NULL) { - xf86DrvMsg(pScrn->scrnIndex, X_ERROR, - "Cannot allocate memory to save SVGA state.\n"); - return (FALSE); - } } } /* Save/Restore Super VGA state */ if (function != MODE_QUERY) { - int ax_reg = 0; + Bool retval = TRUE; if (pVesa->major > 1) { - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f04; - pVesa->pInt->dx = function; - pVesa->pInt->cx = 0x000f; - if (function == MODE_RESTORE) memcpy(pVesa->state, pVesa->pstate, pVesa->stateSize); - pVesa->pInt->es = SEG_ADDR(pVesa->statePage); - pVesa->pInt->bx = SEG_OFF(pVesa->statePage); - xf86ExecX86int10(pVesa->pInt); - ax_reg = pVesa->pInt->ax; + if ((retval = VBESaveRestore(pVesa->pVbe,function, + (pointer)&pVesa->state, + &pVesa->stateSize,&pVesa->statePage)) + && function == MODE_SAVE) { + /* don't rely on the memory not being touched */ + if (pVesa->pstate == NULL) + pVesa->pstate = xalloc(pVesa->stateSize); + memcpy(pVesa->pstate, pVesa->state, pVesa->stateSize); + } } if (function == MODE_RESTORE) { - VESASetVBEMode(pScrn, pVesa->stateMode, NULL); + VBESetVBEMode(pVesa->pVbe, pVesa->stateMode, NULL); RestoreFonts(pScrn); } - - if (pVesa->major > 1) { - if (ax_reg != 0x4f) - return (FALSE); - - if (function == MODE_SAVE && pVesa->pstate == NULL) { - /* don't rely on the memory not being touched */ - pVesa->stateSize = pVesa->pInt->bx * 64; - pVesa->pstate = xalloc(pVesa->stateSize); - memcpy(pVesa->pstate, pVesa->state, pVesa->stateSize); - } - } - } - - return (TRUE); -} -int -VESABankSwitch(ScreenPtr pScreen, unsigned int iBank) -{ - VESAPtr pVesa; - ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; - - pVesa = VESAGetRec(pScrn); - if (pVesa->curBank == iBank) - return (0); - pVesa->curBank = iBank; - - /* - Input: - AH := 4Fh Super VGA support - AL := 05h - - Output: - */ - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f05; - pVesa->pInt->bx = 0; - pVesa->pInt->dx = iBank; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (1); - - if (pVesa->bankSwitchWindowB) { - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f05; - pVesa->pInt->bx = 1; - pVesa->pInt->dx = iBank; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (1); - } - - return (0); -} - -Bool -VESASetGetLogicalScanlineLength(ScrnInfoPtr pScrn, int command, int width, - int *pixels, int *bytes, int *max) -{ - VESAPtr pVesa; - - if (command < SCANWID_SET || command > SCANWID_GET_MAX) - return (FALSE); - - pVesa = VESAGetRec(pScrn); - /* - Input: - AX := 4F06h VBE Set/Get Logical Scan Line Length - BL := 00h Set Scan Line Length in Pixels - := 01h Get Scan Line Length - := 02h Set Scan Line Length in Bytes - := 03h Get Maximum Scan Line Length - CX := If BL=00h Desired Width in Pixels - If BL=02h Desired Width in Bytes - (Ignored for Get Functions) - - Output: - AX := VBE Return Status - BX := Bytes Per Scan Line - CX := Actual Pixels Per Scan Line - (truncated to nearest complete pixel) - DX := Maximum Number of Scan Lines - */ - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f06; - pVesa->pInt->bx = command; - if (command == SCANWID_SET || command == SCANWID_SET_BYTES) - pVesa->pInt->cx = width; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (FALSE); + if (!retval) + return (FALSE); - if (command == SCANWID_GET || command == SCANWID_GET_MAX) { - if (pixels) - *pixels = pVesa->pInt->cx; - if (bytes) - *bytes = pVesa->pInt->bx; - if (max) - *max = pVesa->pInt->dx; } return (TRUE); } - -Bool -VESASetDisplayStart(ScrnInfoPtr pScrn, int x, int y, Bool wait_retrace) -{ - VESAPtr pVesa; - - pVesa = VESAGetRec(pScrn); - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f07; - pVesa->pInt->bx = wait_retrace ? 0x80 : 0x00; - pVesa->pInt->cx = x; - pVesa->pInt->dx = y; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (FALSE); - - return (TRUE); -} - -Bool -VESAGetDisplayStart(ScrnInfoPtr pScrn, int *x, int *y) -{ - VESAPtr pVesa; - - pVesa = VESAGetRec(pScrn); - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f07; - pVesa->pInt->bx = 0x01; - xf86ExecX86int10(pVesa->pInt); - if (pVesa->pInt->ax != 0x4f) - return (FALSE); - - *x = pVesa->pInt->cx; - *y = pVesa->pInt->dx; - - return (TRUE); -} - -int -VESASetGetDACPaletteFormat(ScrnInfoPtr pScrn, int bits) +static void +VESADisplayPowerManagementSet(ScrnInfoPtr pScrn, int mode, + int flags) { - VESAPtr pVesa = VESAGetRec(pScrn); - - /* - Input: - AX := 4F08h VBE Set/Get Palette Format - BL := 00h Set DAC Palette Format - := 01h Get DAC Palette Format - BH := Desired bits of color per primary - (Set DAC Palette Format only) - - Output: - AX := VBE Return Status - BH := Current number of bits of color per primary - */ - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f08; - if (!bits) - pVesa->pInt->bx = 0x01; - else - pVesa->pInt->bx = (bits & 0x00ff) << 8; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (0); - - return (bits != 0 ? bits : (pVesa->pInt->bx >> 8) & 0x00ff); + vgaHWDPMSSet(pScrn, mode, flags); } -CARD32 * -VESASetGetPaletteData(ScrnInfoPtr pScrn, Bool set, int first, int num, - CARD32 *data, Bool secondary, Bool wait_retrace) -{ - VESAPtr pVesa = VESAGetRec(pScrn); - /* - Input: - (16-bit) - AX := 4F09h VBE Load/Unload Palette Data - BL := 00h Set Palette Data - := 01h Get Palette Data - := 02h Set Secondary Palette Data - := 03h Get Secondary Palette Data - := 80h Set Palette Data during Vertical Retrace - CX := Number of palette registers to update (to a maximum of 256) - DX := First of the palette registers to update (start) - ES:DI := Table of palette values (see below for format) - - Output: - AX := VBE Return Status - - - Input: - (32-bit) - BL := 00h Set Palette Data - := 80h Set Palette Data during Vertical Retrace - CX := Number of palette registers to update (to a maximum of 256) - DX := First of the palette registers to update (start) - ES:EDI := Table of palette values (see below for format) - DS := Selector for memory mapped registers - */ - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f09; - if (!secondary) - pVesa->pInt->bx = set && wait_retrace ? 0x80 : set ? 0 : 1; - else - pVesa->pInt->bx = set ? 2 : 3; - pVesa->pInt->cx = num; - pVesa->pInt->dx = first; - pVesa->pInt->es = SEG_ADDR(pVesa->page); - pVesa->pInt->di = SEG_OFF(pVesa->page); - if (set) - memcpy(pVesa->block, data, num * sizeof(CARD32)); - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (NULL); - - if (set) - return (data); - data = xalloc(num * sizeof(CARD32)); - memcpy(data, pVesa->block, num * sizeof(CARD32)); - - return (data); -} - -VESApmi * -VESAGetVBEpmi(ScrnInfoPtr pScrn) -{ - VESAPtr pVesa; - VESApmi *pmi; - - pVesa = VESAGetRec(pScrn); - /* - Input: - AH := 4Fh Super VGA support - AL := 0Ah Protected Mode Interface - BL := 00h Return Protected Mode Table - - Output: - AX := Status - ES := Real Mode Segment of Table - DI := Offset of Table - CX := Lenght of Table including protected mode code in bytes (for copying purposes) - (All other registers are preserved) - */ - - pVesa->pInt->num = 0x10; - pVesa->pInt->ax = 0x4f0a; - pVesa->pInt->bx = 0; - pVesa->pInt->di = 0; - xf86ExecX86int10(pVesa->pInt); - - if (pVesa->pInt->ax != 0x4f) - return (NULL); - - pmi = xalloc(sizeof(VESApmi)); - pmi->seg_tbl = pVesa->pInt->es; - pmi->tbl_off = pVesa->pInt->di; - pmi->tbl_len = pVesa->pInt->cx; - - return (pmi); -} /*********************************************************************** * DGA stuff @@ -2340,7 +1676,7 @@ VESAPtr pVesa = VESAGetRec(pScrn); *DeviceName = NULL; /* No special device */ - *ApertureBase = (unsigned char *)(pVesa->mapPhys); + *ApertureBase = (unsigned char *)(long)(pVesa->mapPhys); *ApertureSize = pVesa->mapSize; *ApertureOffset = pVesa->mapOff; *flags = DGA_NEED_ROOT; Index: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.cpp:1.2 xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.cpp:1.2 Mon Dec 11 15:18:42 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.cpp Mon Jun 4 12:41:08 2001 @@ -1,53 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.cpp,v 1.2 2000/12/11 20:18:42 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH VESA __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -vesa \- Generic VESA video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qvesa\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B vesa -is an XFree86 driver for generic VESA video cards. It can drive most -VESA-compatible video cards, but only makes use of the basic standard -VESA core that is common to these cards. The driver supports depths 8, 15 -16 and 24. -.SH SUPPORTED HARDWARE -The -.B vesa -driver supports most VESA-compatible video cards. There are some known -exceptions, and those should be listed here. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the presence of VESA-compatible hardware. The -.B ChipSet -name may optionally be specified in the config file -.B \*qDevice\*q -section, and will override the auto-detection: -.PP -.RS 4 -"vesa" -.RE -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: on. - -This option is recommended for performance reasons. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86cfg(1), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Paulo César Pereira de Andrade. Index: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h diff -u xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h:1.5 xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h:1.9 --- xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h:1.5 Fri Dec 1 14:56:01 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h Fri May 4 15:05:49 2001 @@ -26,7 +26,7 @@ * * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.5 2000/12/01 19:56:01 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.h,v 1.9 2001/05/04 19:05:49 dawes Exp $ */ #ifndef _VESA_H_ @@ -66,10 +66,6 @@ /* Dga definitions */ #include "dgaproc.h" -#ifdef RENDER -#include "picturestr.h" -#endif - #include "xf86Resources.h" #include "xf86RAC.h" @@ -77,6 +73,8 @@ #include "xf4bpp.h" #include "fb.h" #include "afb.h" +#include "mfb.h" +#include "cfb24_32.h" #define VESA_VERSION 4000 #define VESA_NAME "VESA" @@ -85,16 +83,14 @@ #define VESA_MINOR_VERSION 0 #define VESA_PATCHLEVEL 0 -typedef struct _VBEInfoBlock VBEInfoBlock; -typedef struct _ModeInfoBlock ModeInfoBlock; -typedef struct _CRTCInfoBlock CRTCInfoBlock; +/*XXX*/ typedef struct _VESARec { - xf86Int10InfoPtr pInt; + vbeInfoPtr pVbe; EntityInfoPtr pEnt; CARD16 major, minor; - VBEInfoBlock *vbeInfo; + VbeInfoBlock *vbeInfo; GDevPtr device; pciVideoPtr pciInfo; PCITAG pciTag; @@ -106,7 +102,6 @@ CARD8 *state, *pstate; /* SVGA state */ int statePage, stateSize, stateMode; int page; - CARD8 *block; int pix24bpp; CARD32 *pal, *savedPal; CARD8 *fonts; @@ -117,215 +112,15 @@ /* DGA info */ DGAModePtr pDGAMode; int nDGAMode; + CloseScreenProcPtr CloseScreen; + OptionInfoPtr Options; } VESARec, *VESAPtr; -#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff)) - -#ifndef __GNUC__ -#define __attribute__(a) -#endif - typedef struct _ModeInfoData { int mode; - ModeInfoBlock *data; - CRTCInfoBlock *block; + VbeModeInfoBlock *data; + VbeCRTCInfoBlock *block; } ModeInfoData; -/* - * INT 0 - */ -struct _VBEInfoBlock { - /* VESA 1.2 fields */ - CARD8 VESASignature[4]; /* VESA */ - CARD16 VESAVersion; /* Higher byte major, lower byte minor */ - /*CARD32*/char *OEMStringPtr; /* Pointer to OEM string */ - CARD8 Capabilities[4]; /* Capabilities of the video environment */ - - /*CARD32*/CARD16 *VideoModePtr; /* pointer to supported Super VGA modes */ - - CARD16 TotalMemory; /* Number of 64kb memory blocks on board */ - /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */ - - /* VESA 2 fields */ - CARD16 OemSoftwareRev; /* VBE implementation Software revision */ - /*CARD32*/char *OemVendorNamePtr; /* Pointer to Vendor Name String */ - /*CARD32*/char *OemProductNamePtr; /* Pointer to Product Name String */ - /*CARD32*/char *OemProductRevPtr; /* Pointer to Product Revision String */ - CARD8 Reserved[222]; /* Reserved for VBE implementation */ - CARD8 OemData[256]; /* Data Area for OEM Strings */ -} __attribute__((packed)); - -/* Return Super VGA Information */ -VBEInfoBlock *VESAGetVBEInfo(ScrnInfoPtr pScrn); -void VESAFreeVBEInfo(VBEInfoBlock *block); - -/* - * INT 1 - */ -struct _ModeInfoBlock { - CARD16 ModeAttributes; /* mode attributes */ - CARD8 WinAAttributes; /* window A attributes */ - CARD8 WinBAttributes; /* window B attributes */ - CARD16 WinGranularity; /* window granularity */ - CARD16 WinSize; /* window size */ - CARD16 WinASegment; /* window A start segment */ - CARD16 WinBSegment; /* window B start segment */ - CARD32 WinFuncPtr; /* real mode pointer to window function */ - CARD16 BytesPerScanline; /* bytes per scanline */ - - /* Mandatory information for VBE 1.2 and above */ - CARD16 XResolution; /* horizontal resolution in pixels or characters */ - CARD16 YResolution; /* vertical resolution in pixels or characters */ - CARD8 XCharSize; /* character cell width in pixels */ - CARD8 YCharSize; /* character cell height in pixels */ - CARD8 NumberOfPlanes; /* number of memory planes */ - CARD8 BitsPerPixel; /* bits per pixel */ - CARD8 NumberOfBanks; /* number of banks */ - CARD8 MemoryModel; /* memory model type */ - CARD8 BankSize; /* bank size in KB */ - CARD8 NumberOfImages; /* number of images */ - CARD8 Reserved; /* 1 */ /* reserved for page function */ - - /* Direct color fields (required for direct/6 and YUV/7 memory models) */ - CARD8 RedMaskSize; /* size of direct color red mask in bits */ - CARD8 RedFieldPosition; /* bit position of lsb of red mask */ - CARD8 GreenMaskSize; /* size of direct color green mask in bits */ - CARD8 GreenFieldPosition; /* bit position of lsb of green mask */ - CARD8 BlueMaskSize; /* size of direct color blue mask in bits */ - CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */ - CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */ - CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */ - CARD8 DirectColorModeInfo; /* direct color mode attributes */ - - /* Mandatory information for VBE 2.0 and above */ - CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */ - CARD32 Reserved32; /* 0 */ /* Reserved - always set to 0 */ - CARD16 Reserved16; /* 0 */ /* Reserved - always set to 0 */ - - /* Mandatory information for VBE 3.0 and above */ - CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */ - CARD8 BnkNumberOfImagePages; /* number of images for banked modes */ - CARD8 LinNumberOfImagePages; /* number of images for linear modes */ - CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */ - CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */ - CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */ - CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */ - CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */ - CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */ - CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */ - CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */ - CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */ - CARD8 Reserved2[189]; /* remainder of ModeInfoBlock */ -} __attribute__((packed)); - -/* Return VBE Mode Information */ -ModeInfoBlock *VESAGetModeInfo(ScrnInfoPtr pScrn, int mode); -void VESAFreeModeInfo(ModeInfoBlock *block); - -/* - * INT2 - */ -#define CRTC_DBLSCAN (1<<0) -#define CRTC_INTERLACE (1<<1) -#define CRTC_NHSYNC (1<<2) -#define CRTC_NVSYNC (1<<3) - -struct _CRTCInfoBlock { - CARD16 HorizontalTotal; /* Horizontal total in pixels */ - CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */ - CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */ - CARD16 VerticalTotal; /* Vertical total in lines */ - CARD16 VerticalSyncStart; /* Vertical sync start in lines */ - CARD16 VerticalSyncEnd; /* Vertical sync end in lines */ - CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */ - CARD32 PixelClock; /* Pixel clock in units of Hz */ - CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */ - CARD8 Reserved[40]; /* remainder of ModeInfoBlock */ -} __attribute__((packed)); -/* CRTCInfoBlock is in the VESA 3.0 specs */ - -Bool VESASetVBEMode(ScrnInfoPtr pScrn, int mode, CRTCInfoBlock *crtc); - -/* - * INT 3 - */ -Bool VESAGetVBEMode(ScrnInfoPtr pScrn, int *mode); - -/* - * INT 4 - */ -/* Save/Restore Super VGA video state */ -/* function values are (values stored in VESAPtr): - * 0 := query & allocate amount of memory to save state - * 1 := save state - * 2 := restore state - * - * function 0 called automatically if function 1 called without - * a previous call to function 0. - */ -#define MODE_QUERY 0 -#define MODE_SAVE 1 -#define MODE_RESTORE 2 -Bool VESASaveRestore(ScrnInfoPtr pScrn, int function); - -/* - * INT 6 - */ -#define SCANWID_SET 0 -#define SCANWID_GET 1 -#define SCANWID_SET_BYTES 2 -#define SCANWID_GET_MAX 3 -#define VESASetLogicalScanline(pScrn, width) \ - VESASetGetLogicalScanlineLength(pScrn, SCANWID_SET, \ - width, NULL, NULL, NULL) -#define VESASetLogicalScanlineBytes(pScrn, width) \ - VESASetGetLogicalScanlineLength(pScrn, width, SCANWID_SET_BYTES, \ - NULL, NULL, NULL) -#define VESAGetLogicalScanline(pScrn, pixels, bytes, max) \ - VESASetGetLogicalScanlineLength(pScrn, SCANWID_GET, NULL, \ - pixels, bytes, max) -#define VESAGetMaxLogicalScanline(pScrn, pixels, bytes, max) \ - VESASetGetLogicalScanlineLength(pScrn, SCANWID_GET_MAX, \ - NULL, pixels, bytes, max) -Bool VESASetGetLogicalScanlineLength(ScrnInfoPtr pScrn, int command, int width, - int *pixels, int *bytes, int *max); - -/* - * INT 7 - */ -/* 16 bit code */ -Bool VESASetDisplayStart(ScrnInfoPtr pScrn, int x, int y, Bool wait_retrace); -Bool VESAGetDisplayStart(ScrnInfoPtr pScrn, int *x, int *y); - -/* - * INT 8 - */ -/* if bits is 0, then it is a GET */ -int VESASetGetDACPaletteFormat(ScrnInfoPtr pScrn, int bits); - -/* - * INT 9 - */ -/* - * If getting a palette, the data argument is not used. It will return - * the data. - * If setting a palette, it will return the pointer received on success, - * NULL on failure. - */ -CARD32 *VESASetGetPaletteData(ScrnInfoPtr pScrn, Bool set, int first, int num, - CARD32 *data, Bool secondary, Bool wait_retrace); -#define VESAFreePaletteData(data) xfree(data) - -/* - * INT A - */ -typedef struct _VESApmi { - int seg_tbl; - int tbl_off; - int tbl_len; -} VESApmi; - -VESApmi *VESAGetVBEpmi(ScrnInfoPtr pScrn); -#define VESAFreeVBEpmi(pmi) xfree(pmi) #endif /* _VESA_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man:1.2 --- /dev/null Mon Jun 4 12:41:08 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man Sat Jan 27 13:20:56 2001 @@ -0,0 +1,53 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vesa/vesa.man,v 1.2 2001/01/27 18:20:56 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH VESA __drivermansuffix__ __vendorversion__ +.SH NAME +vesa \- Generic VESA video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qvesa\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B vesa +is an XFree86 driver for generic VESA video cards. It can drive most +VESA-compatible video cards, but only makes use of the basic standard +VESA core that is common to these cards. The driver supports depths 8, 15 +16 and 24. +.SH SUPPORTED HARDWARE +The +.B vesa +driver supports most VESA-compatible video cards. There are some known +exceptions, and those should be listed here. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto-detects the presence of VESA-compatible hardware. The +.B ChipSet +name may optionally be specified in the config file +.B \*qDevice\*q +section, and will override the auto-detection: +.PP +.RS 4 +"vesa" +.RE +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. See +shadowfb(__drivermansuffix__) for further information. Default: on. + +This option is recommended for performance reasons. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86cfg(1), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Paulo César Pereira de Andrade. Index: xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile diff -u xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile:1.10 xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile:1.12 --- xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile:1.10 Thu Aug 26 04:16:18 1999 +++ xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile Wed May 16 02:48:11 2001 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile,v 1.10 1999/08/26 08:16:18 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/Imakefile,v 1.12 2001/05/16 06:48:11 keithp Exp $ @@ -19,8 +19,9 @@ #if defined(XF86DriverSDK) INCLUDES = -I. -I../../include #else -INCLUDES = -I. -I$(SERVERSRC)/cfb -I$(XF86SRC)/xf4bpp -I$(XF86SRC)/xf1bpp \ +INCLUDES = -I. -I$(SERVERSRC)/fb -I$(XF86SRC)/xf4bpp -I$(XF86SRC)/xf1bpp \ -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi -I$(XF86SRC)/vgahw \ + -I$(SERVERSRC)/Xext -I$(SERVERSRC)/render -I$(EXTINCSRC)\ -I$(XF86COMSRC) -I$(XF86OSSRC) \ -I$(SERVERSRC)/include -I$(FONTINCSRC) -I$(XINCLUDESRC)\ -I$(XF86SRC)/rac -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ @@ -38,7 +39,6 @@ InstallObjectModule(vga,$(MODULEDIR),drivers) #if !defined(XF86DriverSDK) -CppManTarget(vga,) InstallModuleManPage(vga) #endif Index: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c diff -u xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c:1.48.2.1 xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c:1.54 --- xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c:1.48.2.1 Fri Mar 9 13:03:47 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c Wed May 16 02:48:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c,v 1.48.2.1 2001/03/09 18:03:47 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/generic.c,v 1.54 2001/05/16 06:48:11 keithp Exp $ */ /* * Copyright (C) 1998 The XFree86 Project, Inc. All Rights Reserved. * @@ -33,7 +33,7 @@ * The port of this driver to XFree86 4.0 was done by: * David Dawes <dawes@xfree86.org> * Dirk H. Hohndel <hohndel@xfree86.org> - * Marc Aurele La France <tsi@ualberta.ca> + * Marc Aurele La France <tsi@xfree86.org> */ #define DEBUG(x) @@ -43,10 +43,7 @@ #include "vgaHW.h" #include "xf86PciInfo.h" -#undef PSZ -#define PSZ 8 -#include "cfb.h" -#undef PSZ +#include "fb.h" #include "xf4bpp.h" #include "xf1bpp.h" @@ -74,7 +71,7 @@ /* Forward definitions */ -static OptionInfoPtr GenericAvailableOptions(int chipid, int busid); +static const OptionInfoRec * GenericAvailableOptions(int chipid, int busid); static void GenericIdentify(int); static Bool GenericProbe(DriverPtr, int); static Bool GenericPreInit(ScrnInfoPtr, int); @@ -108,7 +105,7 @@ OPTION_VGA_CLOCKS } GenericOpts; -static OptionInfoRec GenericOptions[] = { +static const OptionInfoRec GenericOptions[] = { { OPTION_SHADOW_FB, "ShadowFB", OPTV_BOOLEAN, {0}, FALSE }, { OPTION_VGA_CLOCKS, "VGAClocks", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } @@ -130,8 +127,10 @@ static const char *fbSymbols[] = { "xf1bppScreenInit", "xf4bppScreenInit", - "cfbScreenInit", - "mfbScreenInit", + "fbScreenInit", +#ifdef RENDER + "fbPictureInit", +#endif NULL }; @@ -162,7 +161,7 @@ /* * This data is accessed by the loader. The name must be the module name - * followed by "ModuleInit". + * followed by "ModuleData". */ XF86ModuleData vgaModuleData = { &GenericVersionRec, GenericSetup, NULL }; @@ -218,8 +217,7 @@ GenericChipsets); } -static -OptionInfoPtr +static const OptionInfoRec * GenericAvailableOptions(int chipid, int busid) { return GenericOptions; @@ -380,6 +378,7 @@ CARD8 * ShadowPtr; CARD32 ShadowPitch; CloseScreenProcPtr CloseScreen; + OptionInfoPtr Options; } GenericRec, *GenericPtr; @@ -493,13 +492,7 @@ { case 1: Module = "xf1bpp"; Sym = "xf1bppScreenInit"; break; case 4: Module = "xf4bpp"; Sym = "xf4bppScreenInit"; break; - case 8: Module = "cfb"; Sym = "cfbScreenInit"; break; - - default: - xf86DrvMsg(pScreenInfo->scrnIndex, X_ERROR, - "Given depth (%d) is not supported by this driver.\n", - pScreenInfo->depth); - return FALSE; + default: Module = "fb"; Sym = "fbScreenInit"; break; } xf86PrintDepthBpp(pScreenInfo); @@ -579,6 +572,15 @@ pvgaHW->MapSize = 0x00010000; /* Standard 64kB VGA window */ vgaHWGetIOBase(pvgaHW); /* Get VGA I/O base */ + /* Deal with options */ + xf86CollectOptions(pScreenInfo, NULL); + + if (!(pGenericPriv->Options = xalloc(sizeof(GenericOptions)))) + return FALSE; + memcpy(pGenericPriv->Options, GenericOptions, sizeof(GenericOptions)); + xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options, + pGenericPriv->Options); + #ifndef __NOT_YET__ if (pScreenInfo->depth == 8) { @@ -588,11 +590,6 @@ } #endif - /* Deal with options */ - xf86CollectOptions(pScreenInfo, NULL); - xf86ProcessOptions(pScreenInfo->scrnIndex, pScreenInfo->options, - GenericOptions); - /* * Determine clocks. Limit them to the first four because that's all that * can be addressed. @@ -604,7 +601,7 @@ for (i = 0; i < pScreenInfo->numClocks; i++) pScreenInfo->clock[i] = pEnt->device->clock[i]; From = X_CONFIG; - } else if (xf86ReturnOptValBool(GenericOptions,OPTION_VGA_CLOCKS,FALSE)) { + } else if (xf86ReturnOptValBool(pGenericPriv->Options,OPTION_VGA_CLOCKS,FALSE)) { pScreenInfo->numClocks = 2; pScreenInfo->clock[0] = 25175; pScreenInfo->clock[1] = 28322; @@ -673,17 +670,14 @@ /* Set display resolution */ xf86SetDpi(pScreenInfo, 0, 0); - if (xf86ReturnOptValBool(GenericOptions,OPTION_SHADOW_FB,FALSE)) { + if (xf86ReturnOptValBool(pGenericPriv->Options,OPTION_SHADOW_FB,FALSE)) { pScreenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; pScreenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; pGenericPriv->ShadowFB = TRUE; xf86DrvMsg(pScreenInfo->scrnIndex, X_CONFIG, "Using \"Shadow Framebuffer\"\n"); - switch (pScreenInfo->depth) - { - case 1: Module = "mfb"; Sym = "mfbScreenInit"; break; - case 4: Module = "cfb"; Sym = "cfbScreenInit"; break; - } + Module = "fb"; + Sym = "fbScreenInit"; if (!xf86LoadSubModule(pScreenInfo, "shadowfb")) return FALSE; xf86LoaderReqSymLists(shadowfbSymbols, NULL); @@ -829,13 +823,11 @@ } -#ifdef DPMSExtension static void GenericDPMSSet(ScrnInfoPtr pScreen, int mode, int flags) { vgaHWDPMSSet(pScreen, mode, flags); } -#endif static void @@ -1079,6 +1071,8 @@ pScreenInfo->rgbBits, pScreenInfo->defaultVisual)) return FALSE; + miSetPixmapDepths (); + /* Initialise the framebuffer */ switch (pScreenInfo->depth) { @@ -1090,11 +1084,15 @@ pScreenInfo->virtualY); if(pGenericPriv->ShadowPtr == NULL) return FALSE; - Inited = mfbScreenInit(pScreen, pGenericPriv->ShadowPtr, - pScreenInfo->virtualX, - pScreenInfo->virtualY, - pScreenInfo->xDpi, pScreenInfo->yDpi, - pScreenInfo->displayWidth); + Inited = fbScreenInit(pScreen, pGenericPriv->ShadowPtr, + pScreenInfo->virtualX, + pScreenInfo->virtualY, + pScreenInfo->xDpi, pScreenInfo->yDpi, + pScreenInfo->displayWidth, + pScreenInfo->bitsPerPixel); +#ifdef RENDER + fbPictureInit (pScreen, 0, 0); +#endif ShadowFBInit(pScreen, GenericRefreshArea1bpp); } else { Inited = xf1bppScreenInit(pScreen, pvgaHW->Base, @@ -1113,11 +1111,15 @@ pScreenInfo->virtualY); if(pGenericPriv->ShadowPtr == NULL) return FALSE; - Inited = cfbScreenInit(pScreen, pGenericPriv->ShadowPtr, - pScreenInfo->virtualX, - pScreenInfo->virtualY, - pScreenInfo->xDpi, pScreenInfo->yDpi, - pScreenInfo->displayWidth); + Inited = fbScreenInit(pScreen, pGenericPriv->ShadowPtr, + pScreenInfo->virtualX, + pScreenInfo->virtualY, + pScreenInfo->xDpi, pScreenInfo->yDpi, + pScreenInfo->displayWidth, + pScreenInfo->bitsPerPixel); +#ifdef RENDER + fbPictureInit (pScreen, 0, 0); +#endif ShadowFBInit(pScreen, GenericRefreshArea4bpp); } else { Inited = xf4bppScreenInit(pScreen, pvgaHW->Base, @@ -1128,10 +1130,14 @@ } break; case 8: - Inited = cfbScreenInit(pScreen, pvgaHW->Base, - pScreenInfo->virtualX, pScreenInfo->virtualY, - pScreenInfo->xDpi, pScreenInfo->yDpi, - pScreenInfo->displayWidth); + Inited = fbScreenInit(pScreen, pvgaHW->Base, + pScreenInfo->virtualX, pScreenInfo->virtualY, + pScreenInfo->xDpi, pScreenInfo->yDpi, + pScreenInfo->displayWidth, + pScreenInfo->bitsPerPixel); +#ifdef RENDER + fbPictureInit (pScreen, 0, 0); +#endif break; } @@ -1152,9 +1158,7 @@ if (pScreenInfo->depth > 1) vgaHWHandleColormaps(pScreen); -#ifdef DPMSExtension xf86DPMSInit(pScreen, GenericDPMSSet, 0); -#endif /* Wrap the screen's CloseScreen vector and set its SaveScreen vector */ pGenericPriv->CloseScreen = pScreen->CloseScreen; Index: xc/programs/Xserver/hw/xfree86/drivers/vga/vga.cpp diff -u xc/programs/Xserver/hw/xfree86/drivers/vga/vga.cpp:1.7 xc/programs/Xserver/hw/xfree86/drivers/vga/vga.cpp:removed --- xc/programs/Xserver/hw/xfree86/drivers/vga/vga.cpp:1.7 Mon Dec 11 15:18:43 2000 +++ xc/programs/Xserver/hw/xfree86/drivers/vga/vga.cpp Mon Jun 4 12:41:09 2001 @@ -1,66 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/vga.cpp,v 1.7 2000/12/11 20:18:43 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH VGA __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -vga \- Generic VGA video driver -.SH SYNOPSIS -.nf -.B "Section \*qDevice\*q" -.BI " Identifier \*q" devname \*q -.B " Driver \*qvga\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B vga -is an XFree86 driver for generic VGA video cards. It can drive most -VGA-compatible video cards, but only makes use of the basic standard -VGA core that is common to these cards. The driver supports depths 1, 4 -and 8. All relevant visual types are supported at each depth. -Multi-head configurations -are supported in combination with some other drivers, but only when the -.B vga -driver is driving the primary head. -.SH SUPPORTED HARDWARE -The -.B vga -driver supports most VGA-compatible video cards. There are some known -exceptions, and those should be listed here. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details. This section only covers configuration details specific to this -driver. -.PP -The driver auto-detects the presence of VGA-compatible hardware. The -.B ChipSet -name may optionally be specified in the config file -.B \*qDevice\*q -section, and will override the auto-detection: -.PP -.RS 4 -"generic" -.RE -.PP -The driver will only use 64k of video memory for depth 1 and depth 8 operation, -and 256k of video memory for depth 4 (this is the standard VGA limit). -.PP -When operating at depth 8, only a single built-in 320x200 video mode is -available. At other depths there is more flexibility regarding mode choice. -.PP -The following driver -.B Options -are supported: -.TP -.BI "Option \*qShadowFB\*q \*q" boolean \*q -Enable or disable use of the shadow framebuffer layer. See -shadowfb(__drivermansuffix__) for further information. Default: off. - -This option is recommended for performance reasons when running at depths -1 and 4, especially when using modern PCI-based hardware. It is required -when using those depths in a multi-head configuration where one or more -of the other screens is operating at a different depth. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) -.SH AUTHORS -Authors include: Marc La France, David Dawes, and Dirk Hohndel. Index: xc/programs/Xserver/hw/xfree86/drivers/vga/vga.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vga/vga.man:1.2 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vga/vga.man Sat Jan 27 13:20:56 2001 @@ -0,0 +1,66 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vga/vga.man,v 1.2 2001/01/27 18:20:56 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH VGA __drivermansuffix__ __vendorversion__ +.SH NAME +vga \- Generic VGA video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qvga\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B vga +is an XFree86 driver for generic VGA video cards. It can drive most +VGA-compatible video cards, but only makes use of the basic standard +VGA core that is common to these cards. The driver supports depths 1, 4 +and 8. All relevant visual types are supported at each depth. +Multi-head configurations +are supported in combination with some other drivers, but only when the +.B vga +driver is driving the primary head. +.SH SUPPORTED HARDWARE +The +.B vga +driver supports most VGA-compatible video cards. There are some known +exceptions, and those should be listed here. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto-detects the presence of VGA-compatible hardware. The +.B ChipSet +name may optionally be specified in the config file +.B \*qDevice\*q +section, and will override the auto-detection: +.PP +.RS 4 +"generic" +.RE +.PP +The driver will only use 64k of video memory for depth 1 and depth 8 operation, +and 256k of video memory for depth 4 (this is the standard VGA limit). +.PP +When operating at depth 8, only a single built-in 320x200 video mode is +available. At other depths there is more flexibility regarding mode choice. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qShadowFB\*q \*q" boolean \*q +Enable or disable use of the shadow framebuffer layer. See +shadowfb(__drivermansuffix__) for further information. Default: off. + +This option is recommended for performance reasons when running at depths +1 and 4, especially when using modern PCI-based hardware. It is required +when using those depths in a multi-head configuration where one or more +of the other screens is operating at a different depth. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Authors include: Marc La France, David Dawes, and Dirk Hohndel. Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile:1.2 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile Wed May 16 02:48:12 2001 @@ -0,0 +1,53 @@ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/Imakefile,v 1.2 2001/05/16 06:48:12 keithp Exp $ +XCOMM +XCOMM This is an Imakefile for the VMware virtual SVGA driver. +XCOMM + +#define IHaveModules +#include <Server.tmpl> + +SRCS = vmware.c vmwaregc.c vmwarefs.c vmwarepolypnt.c vmwarepush.c \ + vmwareglblt.c vmwaretext.c vmwarerect.c vmwarefillarc.c \ + vmwareply1rct.c vmwarezerarc.c vmwareline.c vmwareblt.c vmwareimage.c \ + vmwarewindow.c vmwarecurs.c vmwarebstor.c bits2pixels.c + +OBJS = vmware.o vmwaregc.o vmwarefs.o vmwarepolypnt.o vmwarepush.o \ + vmwareglblt.o vmwaretext.o vmwarerect.o vmwarefillarc.o \ + vmwareply1rct.o vmwarezerarc.o vmwareline.o vmwareblt.o vmwareimage.o \ + vmwarewindow.o vmwarecurs.o vmwarebstor.o bits2pixels.o + +#if defined(XF86DriverSDK) +INCLUDES = -I. -I../../include +#else +INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86OSSRC) \ + -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi -I$(XF86SRC)/int10 \ + -I$(XF86SRC)/xaa -I$(XF86SRC)/rac \ + -I$(XF86SRC)/vgahw -I$(XF86SRC)/fbdevhw \ + -I$(XF86SRC)/ramdac -I$(XF86SRC)/ddc -I$(XF86SRC)/i2c \ + -I$(SERVERSRC)/Xext -I$(SERVERSRC)/render \ + -I$(FONTINCSRC) -I$(SERVERSRC)/include -I$(XINCLUDESRC) \ + -I$(XF86SRC)/shadowfb -I$(EXTINCSRC) \ + -I$(XF86OSSRC)/vbe $(DRIINCLUDES) +#endif + +DEFINES = $(DRIDEFINES) + +#if MakeHasPosixVariableSubstitutions +SubdirLibraryRule($(OBJS)) +#endif + +ModuleObjectRule() + +ObjectModuleTarget(vmware,$(OBJS)) + +InstallObjectModule(vmware,$(MODULEDIR),drivers) + +#if !defined(XF86DriverSDK) +InstallModuleManPage(vmware) +#endif + +DependTarget() + +InstallDriverSDKNonExecFile(Imakefile,$(DRIVERSDKDIR)/drivers/vmware) + +InstallDriverSDKObjectModule(vmware,$(DRIVERSDKMODULEDIR),drivers) Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/README diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/README:1.2 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/README Thu Apr 5 17:09:37 2001 @@ -0,0 +1,346 @@ + +Copyright (C) 1999-2001 VMware, Inc. +All Rights Reserved + +The code here may be used/distributed under the terms of the standard +XFree86 license. + + + + VMware SVGA Device Interface and Programming Model + -------------------------------------------------- + + +Include Files +------------- + +svga_reg.h + SVGA register definitions, SVGA capabilities, and FIFO command definitions. + +svga_limits.h + Included by svga_reg.h, defines maximum frame buffer and memory region + sizes. + +guest_os.h + Values for the GUEST_ID register. + +vm_basic_types.h + Common type definitions. + +vm_device_version.h + PCI vendor ID's and related information. + + +Programming the VMware SVGA Device +---------------------------------- + +1. Reading/writing a register: + To read a register: + Set the index port to the index of the register, using a dword OUT + Do a dword IN from the value port + + To write a register: + Set the index port to the index of the register, using a dword OUT + Do a dword OUT to the value port + +2. Initialization + Check the version number + loop: + Write into SVGA_REG_ID the maximum SVGA_ID_* the driver supports. + Read from SVGA_REG_ID. + Check if it is the value you wrote. + If yes, VMware SVGA device supports it + If no, decrement SVGA_ID_* and goto loop + This algorithm converges. + + Map the frame buffer and the command FIFO + Read SVGA_REG_FB_START, SVGA_REG_FB_SIZE, SVGA_REG_MEM_START, + SVGA_REG_MEM_SIZE. + Map the frame buffer (FB) and the FIFO memory (MEM) + + Get the frame buffer dimensions + Read SVGA_REG_MAX_WIDTH, SVGA_REG_MAX_HEIGHT, SVGA_REG_BITS_PER_PIXEL + + SetMode + Set SVGA_REG_WIDTH, SVGA_REG_HEIGHT + Read SVGA_REG_FB_OFFSET + (SVGA_REG_FB_OFFSET is the offset from SVGA_REG_FB_START of the + visible portion of the frame buffer) + Read SVGA_REG_BYTES_PER_LINE, SVGA_REG_PSEUDOCOLOR, SVGA_REG_GREEN_MASK, + SVGA_REG_RED_MASK + + Enable SVGA + Set SVGA_REG_ENABLE to 1 + (to disable SVGA, set SVGA_REG_ENABLE to 0) + + Initialize the command FIFO + The FIFO is exclusively dword (32-bit) aligned. The first four + dwords define the portion of the MEM area that is used for the + command FIFO. These are values are all in byte offsets from the + start of the MEM area. + + A minimum sized FIFO would have these values: + mem[SVGA_FIFO_MIN] = 16; + mem[SVGA_FIFO_MAX] = 16 + (10 * 1024); + mem[SVGA_FIFO_NEXT_CMD] = 16; + mem[SVGA_FIFO_STOP] = 16; + + Write SVGA_REG_CONFIG_DONE after these values have been set. + +3. SVGA command FIFO protocol + The FIFO is empty when SVGA_FIFO_NEXT_CMD == SVGA_FIFO_STOP. The + driver writes commands to the FIFO starting at the offset specified + by SVGA_FIFO_NEXT_CMD, and then increments SVGA_FIFO_NEXT_CMD. + + The FIFO is full when SVGA_FIFO_NEXT_CMD is one word before SVGA_FIFO_STOP. + + When the FIFO becomes full, the FIFO should be sync'd + + To sync the FIFO + Write SVGA_REG_SYNC + Read SVGA_REG_BUSY + Wait for the value in SVGA_REG_BUSY to be 0 + + The FIFO should be sync'd before the driver touches the frame buffer, to + guarantee that any outstanding BLT's are completed. + +4. Capabilities + The capabilities of the SVGA device can be queried by reading + SVGA_REG_CAPABILITIES. + + +Drawing to the Screen +--------------------- + +After initialization, the driver can write directly to the frame buffer. +The updated frame buffer is not displayed immediately, but only when +an update command is sent. The update command (SVGA_CMD_UPDATE) defines +the rectangle in the frame buffer that has been modified by the driver, +and causes that rectangle to be updated on the screen. + +A complete driver can be developed this way. For increased performance, +additional commands are available to accelerate common operations. The +two most useful are SVGA_CMD_RECT_FILL and SVGA_CMD_RECT_COPY. + +After issuing an accelerated command, the FIFO should be sync'd, as +described above, before writing to the frame buffer. + + +Addendum on 7/11/2000 +--------------------- + +SVGA_REG_FB_OFFSET and SVGA_REG_BYTES_PER_LINE may change after +SVGA_REG_WIDTH or SVGA_REG_HEIGHT is set. Also the VGA registers must +be written to after setting SVGA_REG_ENABLE to 0 to change the display +to a VGA mode. + + +Capabilities +------------ + +The capabilities register (SVGA_REG_CAPABILITIES) is an array of +bits that indicates the capabilities of the SVGA emulation. +This table shows what commands are available, depending on the +capabilities: + + Command Capability + ------- ---------- + + SVGA_CMD_RECT_FILL SVGA_CAP_RECT_FILL + SVGA_CMD_RECT_COPY SVGA_CAP_RECT_COPY + SVGA_CMD_DEFINE_BITMAP SVGA_CAP_OFFSCREEN + SVGA_CMD_DEFINE_BITMAP_SCANLINE SVGA_CAP_OFFSCREEN + SVGA_CMD_DEFINE_PIXMAP SVGA_CAP_OFFSCREEN + SVGA_CMD_DEFINE_PIXMAP_SCANLINE SVGA_CAP_OFFSCREEN + SVGA_CMD_RECT_BITMAP_FILL SVGA_CAP_RECT_PAT_FILL + SVGA_CMD_RECT_PIXMAP_FILL SVGA_CAP_RECT_PAT_FILL + SVGA_CMD_RECT_BITMAP_COPY SVGA_CAP_RECT_PAT_FILL + SVGA_CMD_RECT_PIXMAP_COPY SVGA_CAP_RECT_PAT_FILL + SVGA_CMD_FREE_OBJECT SVGA_CAP_OFFSCREEN + SVGA_CMD_RECT_ROP_FILL SVGA_CAP_RECT_FILL + + SVGA_CAP_RASTER_OP + SVGA_CMD_RECT_ROP_COPY SVGA_CAP_RECT_COPY + + SVGA_CAP_RASTER_OP + SVGA_CMD_RECT_ROP_BITMAP_FILL SVGA_CAP_RECT_PAT_FILL + + SVGA_CAP_RASTER_OP + SVGA_CMD_RECT_ROP_PIXMAP_FILL SVGA_CAP_RECT_PAT_FILL + + SVGA_CAP_RASTER_OP + SVGA_CMD_RECT_ROP_BITMAP_COPY SVGA_CAP_RECT_PAT_FILL + + SVGA_CAP_RASTER_OP + SVGA_CMD_RECT_ROP_PIXMAP_COPY SVGA_CAP_RECT_PAT_FILL + + SVGA_CAP_RASTER_OP + SVGA_CMD_DEFINE_CURSOR SVGA_CAP_CURSOR + SVGA_CMD_DISPLAY_CURSOR SVGA_CAP_CURSOR + SVGA_CMD_MOVE_CURSOR SVGA_CAP_CURSOR + +The ability to program the cursor directly through the registers +(described in the next section) is indicated by the capability +SVGA_CAP_CURSOR_BYPASS. + + +Cursor Handling +--------------- + +Starting with GSX Server Beta 3 (after 11/15/2000), a new cursor interface +was added that bypasses the FIFO. This is programmed using the +registers SVGA_REG_CURSOR_ID, SVGA_REG_CURSOR_X, SVGA_REG_CURSOR_Y, +and SVGA_REG_CURSOR_ON. + +First, the cursor must be defined using the FIFO command +SVGA_CMD_DEFINE_CURSOR. This command allocates a cursor ID and +associates two pixmaps with the cursor, the AND mask and the XOR mask. + +To display the cursor, the ID must be written to SVGA_REG_CURSOR_ID, +the coordinates written to SVGA_REG_CURSOR_X and SVGA_REG_CURSOR_Y, +then the value 1 must be written to SVGA_REG_CURSOR_ON. No display +occurs until SVGA_REG_CURSOR_ON is written. The same sequence is used +to move the cursor. + +To turn the cursor off, the ID must be written to SVGA_REG_CURSOR_ID, +and the value 0 must be written to SVGA_REG_CURSOR_ON. + +NOTE: The cursor must be turned off before touching the frame buffer, +because it is actually drawn into the frame buffer memory in the case +of direct graphics mode (e.g. full screen mode on Linux). The cursor +does not have to be turned off before issuing an accelerated command +via the command FIFO, this case is handled by the SVGA device. + + +Driver Version Numbers +---------------------- + +The SVGA drivers use the following convention for their version numbers: + +Version 10.0 - The first version that uses the FIFO +Version 10.1 - The version that uses the hardware cursor emulation via the FIFO +Version 10.2 - The version that uses the cursor that bypasses the FIFO + + +Frequently Asked Questions +-------------------------- + +1. My driver doesn't display anything, what's going on? + +First check if you are issuing an SVGA_CMD_UPDATE after drawing to +the screen. Another check you can do is to run your driver in full +screen mode on a Linux host. In this case you are drawing directly +on the frame buffer, so what you draw to the screen will be immediately +visible. If nothing is visible in this case, then most likely your +driver hasn't mapped the frame buffer correctly. + +A discrepancy between what you get in full screen mode and what you +get in window mode indicates that you have a missing or incorrect +update command. + + +2. What's the difference between bitmaps and pixmaps? + +Pixmaps have the same depth as the screen, while bitmaps have depth one. +When a bitmap is drawn, the command also takes two colors, foreground and +background. The set bits in the bitmap are replaced with the foreground +color, and the unset bits are replaced with the background color. + +Pixmaps, on the other hand, can be directly copied to the screen. + + +3. What's the significance of the ROP in the commands SVGA_CMD_RECT_ROP_FILL, +SVGA_CMD_RECT_ROP_BITMAP_COPY, etc. ? + +The ROP in the ...ROP... commands is a raster operation. It has the same +significance (and encoding) as it does in X Windows. The ROP value +SVGA_ROP_COPY means the source is copied to the destination, which makes +these commands the same as their non-ROP counterparts. The most commonly +used raster operation other than copy is probably SVGA_ROP_XOR, which +combines the source and destination using exclusive-or. + + +4. Tell me more about bitmaps and pixmaps. For example, the macro +SVGA_CMD_DEFINE_BITMAP has a field <scanlines>. What should this be +set to? Likewise with SVGA_CMD_DEFINE_PIXMAP. And when should the +SCANLINE macros be used? + +OK, I'll use pixmaps as an example. First you have to define the pixmap: + +#define SVGA_CMD_DEFINE_PIXMAP 6 + /* FIFO layout: + Pixmap ID, Width, Height, Depth, <scanlines> */ + +The ID is something you choose, which you subsequently use to refer to +this pixmap. It must be an integer between 0 and SVGA_MAX_ID. + +The width and height and depth are the dimensions of the pixmap. For now, +the depth of the pixmap has to match the depth of the screen. + +The scanlines are the pixels that make up the pixmap, arranged one row +at a time. Each row is required to be 32-bit aligned. The macros +SVGA_PIXMAP_SCANLINE_SIZE and SVGA_PIXMAP_SIZE give the size of a +single scanline, and the size of the entire pixmap, respectively, in +32-bit words. + +The second step is to use it: + +#define SVGA_CMD_RECT_PIXMAP_FILL 9 + /* FIFO layout: + Pixmap ID, X, Y, Width, Height */ + +The ID here is the one you chose when defining the pixmap. X, Y, +Width, and Height define a rectangle on the screen that is to be filled +with the pixmap. The pixmap is screen aligned, which means that the +coordinates in the pixmap are defined by the screen coordinates modulo +the pixmap dimensions. + +If you want a different alignment between the screen and the pixmap, +then you can use this command, which allows the pixmap coordinates to +be defined: + +#define SVGA_CMD_RECT_PIXMAP_COPY 11 + /* FIFO layout: + Pixmap ID, Source X, Source Y, Dest X, Dest Y, Width, + Height */ + +The Source X and Source Y are pixmap coordinates, and the Dest X and +Dest Y are screen coordinates. + + +5. OK, now it works briefly, then stops displaying anything. Also, +my log file is filled with lines like: + Unknown Command 0xff in SVGA command FIFO +What's happening? + +The most common problem at this point is that the FIFO gets out +of sync. This can happen if the amount of data in the FIFO doesn't +match what the VMware SVGA device expects. To track this down, try +to isolate the particular command which causes the problem. + +Another way this can happen is if the wraparound in the FIFO isn't +done correctly. Here is some example code for writing to the FIFO +(mem is an array of 32-bit integers that points to the FIFO memory +region): + +while (TRUE) { + fifo_min = mem[SVGA_FIFO_MIN] / 4; + fifo_max = mem[SVGA_FIFO_MAX] / 4; + fifo_next = mem[SVGA_FIFO_NEXT_CMD] / 4; + fifo_stop = mem[SVGA_FIFO_STOP] / 4; + + tmp_next = fifo_next+1; + if (tmp_next == fifo_max) + tmp_next = fifo_min; // Wraparound + + if (tmp_next == fifo_stop) { + sync_fifo(); // FIFO full + continue; // retry + } + + mem[fifo_next] = item; + mem[SVGA_FIFO_NEXT_CMD] = tmp_next * 4; + break; +} + +This isn't the most efficient code, but it should work. It's important +to do the increment with wraparound before the FIFO full check, and to +check FIFO full before updating the next command pointer. + + + +$XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/README,v 1.2 2001/04/05 21:09:37 dawes Exp $ Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c Thu Apr 5 15:29:43 2001 @@ -0,0 +1,1415 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.c,v 1.1 2001/04/05 19:29:43 dawes Exp $ */ +/* ********************************************************** + * Copyright (C) 1999-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_bits2pixels[] = "Id: bits2pixels.c,v 1.6 2001/01/26 23:32:15 yoel Exp $"; +#else +#define FILECODE "F(814)" +#endif + +/* + * bits2pixels.c -- + * + * Emulation routines to convert bitmaps to pixmaps + */ + +#include "vm_basic_types.h" +#include "bits2pixels.h" + + +/* + * Local functions + */ + +void RasterBitsToPixels8(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg); + +void RasterBitsToPixels16(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg); + +void RasterBitsToPixels24(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg); + +void RasterBitsToPixels32(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg); + + +/* + *---------------------------------------------------------------------- + * + * Raster_BitsToPixels -- + * + * Convert a bitmap to a pixmap, converting 1 bits to the foreground + * color (fg) and 0 bits to the background color (bg). + * + * Results: + * Pixmap filled with pixels + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +void +Raster_BitsToPixels(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, int bytes_per_pixel, + uint32 width, uint32 height, uint32 fg, uint32 bg) +{ + switch (bytes_per_pixel) { + case 1: + RasterBitsToPixels8(bits, bits_increment, pix, pix_increment, + width, height, fg, bg); + break; + + case 2: + RasterBitsToPixels16(bits, bits_increment, pix, pix_increment, + width, height, fg, bg); + break; + + case 3: + RasterBitsToPixels24(bits, bits_increment, pix, pix_increment, + width, height, fg, bg); + break; + + case 4: + RasterBitsToPixels32(bits, bits_increment, pix, pix_increment, + width, height, fg, bg); + break; + } +} + + +/* + *---------------------------------------------------------------------- + * + * RasterBitsToPixels8 -- + * + * Convert a bitmap to a pixmap, converting 1 bits to the foreground + * color (fg) and 0 bits to the background color (bg), for an 8-bit + * pixmap + * + * Results: + * Pixmap filled with pixels + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +void +RasterBitsToPixels8(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg) +{ + uint8 *lpix, *lbits; + int i, j; + uint32 expbits = 0; /* Bits to be expanded */ + + for (i=0; i<height; i++) { + lpix = pix; + lbits = bits; + for (j = width ; j > 0; j -= 4) { + expbits = (*lbits >> 4) & 0x0f; + + if (j < 4) + break; + + switch (expbits) { + case 0: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 1: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 2: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 3: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 4: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 5: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 6: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 7: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 8: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 9: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 10: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 11: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 12: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 13: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 14: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 15: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + } + + expbits = *lbits & 0x0f; + + j -= 4; + if (j < 4) { + break; + } + + switch (expbits) { + case 0: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 1: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 2: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 3: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 4: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 5: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 6: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 7: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 8: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 9: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 10: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 11: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 12: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 13: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 14: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 15: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + } + lbits++; + } + + if (j > 0) { + *lpix++ = (expbits & 0x08) ? fg : bg; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x04) ? fg : bg; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x02) ? fg : bg; + j--; + } + } + } + + pix += pix_increment; + bits += bits_increment; + } + return; +} + + +/* + *---------------------------------------------------------------------- + * + * RasterBitsToPixels16 -- + * + * Convert a bitmap to a pixmap, converting 1 bits to the foreground + * color (fg) and 0 bits to the background color (bg), for a 16-bit + * pixmap + * + * Results: + * Pixmap filled with pixels + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +void +RasterBitsToPixels16(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg) +{ + uint16 *lpix; + uint8 *lbits; + int i, j; + uint32 expbits = 0; /* Bits to be expanded */ + + for (i=0; i<height; i++) { + lpix = (uint16 *)pix; + lbits = bits; + for (j = width; j > 0; j -= 4) { + expbits = (*lbits >> 4) & 0x0f; + + if (j < 4) + break; + + switch (expbits) { + case 0: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 1: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 2: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 3: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 4: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 5: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 6: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 7: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 8: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 9: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 10: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 11: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 12: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 13: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 14: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 15: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + } + + expbits = *lbits & 0x0f; + + j -= 4; + if (j < 4) { + break; + } + + switch (expbits) { + case 0: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 1: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 2: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 3: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 4: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 5: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 6: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 7: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 8: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 9: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 10: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 11: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 12: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 13: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 14: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 15: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + } + lbits++; + } + + if (j > 0) { + *lpix++ = (expbits & 0x08) ? fg : bg; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x04) ? fg : bg; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x02) ? fg : bg; + j--; + } + } + } + + pix += pix_increment; + bits += bits_increment; + } + return; +} + + + +/* + *---------------------------------------------------------------------- + * + * RasterBitsToPixels24 -- + * + * Convert a bitmap to a pixmap, converting 1 bits to the foreground + * color (fg) and 0 bits to the background color (bg), for a 24-bit + * pixmap + * + * Results: + * Pixmap filled with pixels + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +void +RasterBitsToPixels24(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg) +{ + uint8 *lpix, *lbits; + uint32 fgColor1, fgColor2, fgColor3; + uint32 bgColor1, bgColor2, bgColor3; + + int i, j; + uint32 expbits = 0; /* Bits to be expanded */ + + fgColor1 = fg & 0x000000ff; + fgColor2 = (fg >> 8) & 0x000000ff; + fgColor3 = (fg >> 16) & 0x000000ff; + + bgColor1 = bg & 0x000000ff; + bgColor2 = (bg >> 8) & 0x000000ff; + bgColor3 = (bg >> 16) & 0x000000ff; + + for (i=0; i<height; i++) { + lpix = pix; + lbits = bits; + for (j = width; j > 0; j -= 4) { + expbits = (*lbits >> 4) & 0x0f; + + if (j < 4) + break; + + switch (expbits) { + case 0: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 1: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 2: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 3: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 4: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 5: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 6: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 7: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 8: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 9: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 10: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 11: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 12: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 13: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 14: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 15: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + } + + expbits = *lbits & 0x0f; + + j -= 4; + if (j < 4) { + break; + } + + switch (expbits) { + case 0: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 1: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 2: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 3: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 4: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 5: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 6: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 7: + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 8: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 9: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 10: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 11: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 12: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 13: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + case 14: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = bgColor1; + *lpix++ = bgColor2; + *lpix++ = bgColor3; + break; + case 15: + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + *lpix++ = fgColor1; + *lpix++ = fgColor2; + *lpix++ = fgColor3; + break; + } + lbits++; + } + + if (j > 0) { + *lpix++ = (expbits & 0x08) ? fgColor1 : bgColor1; + *lpix++ = (expbits & 0x08) ? fgColor2 : bgColor2; + *lpix++ = (expbits & 0x08) ? fgColor3 : bgColor3; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x04) ? fgColor1 : bgColor1; + *lpix++ = (expbits & 0x04) ? fgColor2 : bgColor2; + *lpix++ = (expbits & 0x04) ? fgColor3 : bgColor3; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x02) ? fgColor1 : bgColor1; + *lpix++ = (expbits & 0x02) ? fgColor2 : bgColor2; + *lpix++ = (expbits & 0x02) ? fgColor3 : bgColor3; + j--; + } + } + } + + pix += pix_increment; + bits += bits_increment; + } + return; +} + + + +/* + *---------------------------------------------------------------------- + * + * RasterBitsToPixels32 -- + * + * Convert a bitmap to a pixmap, converting 1 bits to the foreground + * color (fg) and 0 bits to the background color (bg), for a 32-bit + * pixmap + * + * Results: + * Pixmap filled with pixels + * + * Side effects: + * None + * + *---------------------------------------------------------------------- + */ + +void +RasterBitsToPixels32(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, + uint32 width, uint32 height, uint32 fg, uint32 bg) +{ + uint32 *lpix; + uint8 *lbits; + int i, j; + uint32 expbits = 0; /* Bits to be expanded */ + + for (i=0; i<height; i++) { + lpix = (uint32 *)pix; + lbits = bits; + for (j = width; j > 0; j -= 4) { + expbits = (*lbits >> 4) & 0x0f; + + if (j < 4) + break; + + switch (expbits) { + case 0: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 1: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 2: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 3: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 4: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 5: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 6: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 7: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 8: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 9: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 10: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 11: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 12: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 13: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 14: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 15: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + } + + expbits = *lbits & 0x0f; + + j -= 4; + if (j < 4) { + break; + } + + switch (expbits) { + case 0: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 1: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 2: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 3: + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 4: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 5: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 6: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 7: + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 8: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 9: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 10: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 11: + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + *lpix++ = fg; + break; + case 12: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = bg; + break; + case 13: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + *lpix++ = fg; + break; + case 14: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = bg; + break; + case 15: + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + *lpix++ = fg; + break; + } + lbits++; + } + + if (j > 0) { + *lpix++ = (expbits & 0x08) ? fg : bg; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x04) ? fg : bg; + j--; + if (j > 0) { + *lpix++ = (expbits & 0x02) ? fg : bg; + j--; + } + } + } + + pix += pix_increment; + bits += bits_increment; + } + return; +} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h Thu Apr 5 15:29:44 2001 @@ -0,0 +1,25 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/bits2pixels.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* ********************************************************** + * Copyright (C) 1999-2001 VMware, Inc. + * All Rights Reserved + * Id: bits2pixels.h,v 1.4 2001/01/26 23:32:15 yoel Exp $ + * **********************************************************/ + +/* + * bits2pixels.h -- + * + * Drawing emulation routines + */ + +#ifndef _BITS2PIXELS_H_ +#define _BITS2PIXELS_H_ + +#define INCLUDE_ALLOW_USERLEVEL +#include "includeCheck.h" + +void +Raster_BitsToPixels(uint8 *bits, uint32 bits_increment, + uint8 *pix, uint32 pix_increment, int bytes_per_pixel, + uint32 width, uint32 height, uint32 fg, uint32 bg); + +#endif /* _BITS4PIXELS_H_ */ Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h Thu Apr 5 15:29:44 2001 @@ -0,0 +1,30 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/guest_os.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* ********************************************************* + * Copyright (C) 1999-2001 VMware, Inc. + * All Rights Reserved + * Id: guest_os.h,v 1.5 2001/01/26 23:32:15 yoel Exp $ + * **********************************************************/ + +#ifndef _GUEST_OS_H_ +#define _GUEST_OS_H_ + +#define INCLUDE_ALLOW_USERLEVEL +#include "includeCheck.h" + +#define GUEST_OS_BASE 0x5000 + +#define GUEST_OS_DOS (GUEST_OS_BASE+1) +#define GUEST_OS_WIN31 (GUEST_OS_BASE+2) +#define GUEST_OS_WINDOWS95 (GUEST_OS_BASE+3) +#define GUEST_OS_WINDOWS98 (GUEST_OS_BASE+4) +#define GUEST_OS_WINDOWSME (GUEST_OS_BASE+5) +#define GUEST_OS_NT (GUEST_OS_BASE+6) +#define GUEST_OS_WIN2000 (GUEST_OS_BASE+7) +#define GUEST_OS_LINUX (GUEST_OS_BASE+8) +#define GUEST_OS_OS2 (GUEST_OS_BASE+9) +#define GUEST_OS_OTHER (GUEST_OS_BASE+10) +#define GUEST_OS_FREEBSD (GUEST_OS_BASE+11) +#define GUEST_OS_WHISTLER (GUEST_OS_BASE+12) + + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h:1.2 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h Fri Apr 6 13:44:58 2001 @@ -0,0 +1,2 @@ +/* This space intentionally left blank. */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/includeCheck.h,v 1.2 2001/04/06 17:44:58 dawes Exp $ */ Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h Thu Apr 5 15:29:44 2001 @@ -0,0 +1,57 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_limits.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * Id: svga_limits.h,v 1.8 2001/01/26 23:32:15 yoel Exp $ + * **********************************************************/ + +/* + * svga_reg.h -- + * + * SVGA limits + */ + +#ifndef _SVGA_LIMITS_H_ +#define _SVGA_LIMITS_H_ + +#define INCLUDE_ALLOW_USERLEVEL +#define INCLUDE_ALLOW_MONITOR +#include "includeCheck.h" + +/* + * Location and size of SVGA frame buffer. + */ +#define SVGA_FB_MAX_SIZE (16*1024*1024) +#define SVGA_MEM_SIZE (256*1024) + +/* + * SVGA_FB_START is the default starting address of the SVGA frame + * buffer in the guest's physical address space. + * SVGA_FB_START_BIGMEM is the starting address of the SVGA frame + * buffer for VMs that have a large amount of physical memory. + * + * The address of SVGA_FB_START is set to 2GB - (SVGA_FB_MAX_SIZE + SVGA_MEM_SIZE), + * thus the SVGA frame buffer sits at [SVGA_FB_START .. 2GB-1] in the + * physical address space. Our older SVGA drivers for NT treat the + * address of the frame buffer as a signed integer. For backwards + * compatibility, we keep the default location of the frame buffer + * at under 2GB in the address space. This restricts VMs to have "only" + * up to ~2031MB (i.e., up to SVGA_FB_START) of physical memory. + * + * For VMs that want more memory than the ~2031MB, we place the SVGA + * frame buffer at SVGA_FB_START_BIGMEM. This allows VMs to have up + * to 3584MB, at least as far as the SVGA frame buffer is concerned + * (note that there may be other issues that limit the VM memory + * size). PCI devices use high memory addresses, so we have to put + * SVGA_FB_START_BIGMEM low enough so that it doesn't overlap with any + * of these devices. Placing SVGA_FB_START_BIGMEM at 0xE0000000 + * should leave plenty of room for the PCI devices. + * + * NOTE: All of that is only true for the 0710 chipset. As of the 0405 + * chipset, the framebuffer start is determined solely based on the value + * the guest BIOS or OS programs into the PCI base address registers. + */ +#define SVGA_FB_LEGACY_START 0x7EFC0000 +#define SVGA_FB_LEGACY_START_BIGMEM 0xE0000000 + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h:1.3 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/svga_reg.h Wed Apr 25 12:44:58 2001 @@ -0,0 +1,284 @@ +/* $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 + * Id: svga_reg.h,v 1.9 2001/03/02 02:06:47 bhlim Exp $ + * **********************************************************/ + +/* + * svga_reg.h -- + * + * SVGA hardware definitions + */ + +#ifndef _SVGA_REG_H_ +#define _SVGA_REG_H_ + +#define INCLUDE_ALLOW_USERLEVEL +#define INCLUDE_ALLOW_MONITOR +#include "includeCheck.h" + +#include "svga_limits.h" + +/* + * Memory and port addresses and fundamental constants + */ + +#define SVGA_MAX_WIDTH 2364 +#define SVGA_MAX_HEIGHT 1773 + +#ifdef VMX86_SERVER +#define SVGA_DEFAULT_MAX_WIDTH 1600 +#define SVGA_DEFAULT_MAX_HEIGHT 1200 +#else +#define SVGA_DEFAULT_MAX_WIDTH SVGA_MAX_WIDTH +#define SVGA_DEFAULT_MAX_HEIGHT SVGA_MAX_HEIGHT +#endif + +#define SVGA_MAX_BITS_PER_PIXEL 32 +#if SVGA_MAX_WIDTH * SVGA_MAX_HEIGHT * SVGA_MAX_BITS_PER_PIXEL / 8 > \ + SVGA_FB_MAX_SIZE +#error "Bad SVGA maximum sizes" +#endif +#define SVGA_MAX_PSEUDOCOLOR_DEPTH 8 +#define SVGA_MAX_PSEUDOCOLORS (1 << SVGA_MAX_PSEUDOCOLOR_DEPTH) + +#define SVGA_MAGIC 0x900000 +#define SVGA_MAKE_ID(ver) (SVGA_MAGIC << 8 | (ver)) + +/* Version 2 let the address of the frame buffer be unsigned on Win32 */ +#define SVGA_VERSION_2 2 +#define SVGA_ID_2 SVGA_MAKE_ID(SVGA_VERSION_2) + +/* Version 1 has new registers starting with SVGA_REG_CAPABILITIES so + PALETTE_BASE has moved */ +#define SVGA_VERSION_1 1 +#define SVGA_ID_1 SVGA_MAKE_ID(SVGA_VERSION_1) + +/* Version 0 is the initial version */ +#define SVGA_VERSION_0 0 +#define SVGA_ID_0 SVGA_MAKE_ID(SVGA_VERSION_0) + +/* Invalid SVGA_ID_ */ +#define SVGA_ID_INVALID 0xFFFFFFFF + +/* More backwards compatibility, old location of color map: */ +#define SVGA_OLD_PALETTE_BASE 17 + +/* Base and Offset gets us headed the right way for PCI Base Addr Registers */ +#define SVGA_LEGACY_BASE_PORT 0x4560 +#define SVGA_INDEX_PORT 0x0 +#define SVGA_VALUE_PORT 0x1 +#define SVGA_BIOS_PORT 0x2 +#define SVGA_NUM_PORTS 0x3 + +/* This port is deprecated, but retained because of old drivers. */ +#define SVGA_LEGACY_ACCEL_PORT 0x3 + +/* + * Registers + */ + +enum { + SVGA_REG_ID = 0, + SVGA_REG_ENABLE = 1, + SVGA_REG_WIDTH = 2, + SVGA_REG_HEIGHT = 3, + SVGA_REG_MAX_WIDTH = 4, + SVGA_REG_MAX_HEIGHT = 5, + SVGA_REG_DEPTH = 6, + SVGA_REG_BITS_PER_PIXEL = 7, + SVGA_REG_PSEUDOCOLOR = 8, + SVGA_REG_RED_MASK = 9, + SVGA_REG_GREEN_MASK = 10, + SVGA_REG_BLUE_MASK = 11, + SVGA_REG_BYTES_PER_LINE = 12, + SVGA_REG_FB_START = 13, + SVGA_REG_FB_OFFSET = 14, + SVGA_REG_FB_MAX_SIZE = 15, + SVGA_REG_FB_SIZE = 16, + + SVGA_REG_CAPABILITIES = 17, + SVGA_REG_MEM_START = 18, /* Memory for command FIFO and bitmaps */ + SVGA_REG_MEM_SIZE = 19, + SVGA_REG_CONFIG_DONE = 20, /* Set when memory area configured */ + SVGA_REG_SYNC = 21, /* Write to force synchronization */ + SVGA_REG_BUSY = 22, /* Read to check if sync is done */ + SVGA_REG_GUEST_ID = 23, /* Set guest OS identifier */ + SVGA_REG_CURSOR_ID = 24, /* ID of cursor */ + SVGA_REG_CURSOR_X = 25, /* Set cursor X position */ + SVGA_REG_CURSOR_Y = 26, /* Set cursor Y position */ + SVGA_REG_CURSOR_ON = 27, /* Turn cursor on/off */ + + SVGA_REG_TOP = 28, /* Must be 1 greater than the last register */ + + SVGA_PALETTE_BASE = 1024 /* Base of SVGA color map */ +}; + + +/* + * Capabilities + */ + +#define SVGA_CAP_RECT_FILL 0x0001 +#define SVGA_CAP_RECT_COPY 0x0002 +#define SVGA_CAP_RECT_PAT_FILL 0x0004 +#define SVGA_CAP_OFFSCREEN 0x0008 +#define SVGA_CAP_RASTER_OP 0x0010 +#define SVGA_CAP_CURSOR 0x0020 +#define SVGA_CAP_CURSOR_BYPASS 0x0040 + + +/* + * Raster op codes (same encoding as X) + */ + +#define SVGA_ROP_CLEAR 0x00 +#define SVGA_ROP_AND 0x01 +#define SVGA_ROP_AND_REVERSE 0x02 +#define SVGA_ROP_COPY 0x03 +#define SVGA_ROP_AND_INVERTED 0x04 +#define SVGA_ROP_NOOP 0x05 +#define SVGA_ROP_XOR 0x06 +#define SVGA_ROP_OR 0x07 +#define SVGA_ROP_NOR 0x08 +#define SVGA_ROP_EQUIV 0x09 +#define SVGA_ROP_INVERT 0x0a +#define SVGA_ROP_OR_REVERSE 0x0b +#define SVGA_ROP_COPY_INVERTED 0x0c +#define SVGA_ROP_OR_INVERTED 0x0d +#define SVGA_ROP_NAND 0x0e +#define SVGA_ROP_SET 0x0f + + +/* + * Memory area offsets (viewed as an array of 32-bit words) + */ + +/* + * The distance from MIN to MAX must be at least 10K + */ + +#define SVGA_FIFO_MIN 0 +#define SVGA_FIFO_MAX 1 +#define SVGA_FIFO_NEXT_CMD 2 +#define SVGA_FIFO_STOP 3 + +#define SVGA_FIFO_USER_DEFINED 4 + +/* + * Drawing object ID's, in the range 0 to SVGA_MAX_ID + */ + +#define SVGA_MAX_ID 499 + +/* + * Macros to compute variable length items (sizes in 32-bit words) + */ + +#define SVGA_BITMAP_SIZE(w,h) ((((w)+31) >> 5) * (h)) +#define SVGA_BITMAP_SCANLINE_SIZE(w) (( (w)+31 ) >> 5) +#define SVGA_PIXMAP_SIZE(w,h,d) ((( ((w)*(d))+31 ) >> 5) * (h)) +#define SVGA_PIXMAP_SCANLINE_SIZE(w,d) (( ((w)*(d))+31 ) >> 5) + +/* + * Increment from one scanline to the next of a bitmap or pixmap + */ +#define SVGA_BITMAP_INCREMENT(w) ((( (w)+31 ) >> 5) * sizeof (uint32)) +#define SVGA_PIXMAP_INCREMENT(w,d) ((( ((w)*(d))+31 ) >> 5) * sizeof (uint32)) + +/* + * Commands in the command FIFO + */ + +#define SVGA_CMD_UPDATE 1 + /* FIFO layout: + X, Y, Width, Height */ + +#define SVGA_CMD_RECT_FILL 2 + /* FIFO layout: + Color, X, Y, Width, Height */ + +#define SVGA_CMD_RECT_COPY 3 + /* FIFO layout: + Source X, Source Y, Dest X, Dest Y, Width, Height */ + +#define SVGA_CMD_DEFINE_BITMAP 4 + /* FIFO layout: + Pixmap ID, Width, Height, <scanlines> */ + +#define SVGA_CMD_DEFINE_BITMAP_SCANLINE 5 + /* FIFO layout: + Pixmap ID, Width, Height, Line #, scanline */ + +#define SVGA_CMD_DEFINE_PIXMAP 6 + /* FIFO layout: + Pixmap ID, Width, Height, Depth, <scanlines> */ + +#define SVGA_CMD_DEFINE_PIXMAP_SCANLINE 7 + /* FIFO layout: + Pixmap ID, Width, Height, Depth, Line #, scanline */ + +#define SVGA_CMD_RECT_BITMAP_FILL 8 + /* FIFO layout: + Bitmap ID, X, Y, Width, Height, Foreground, Background */ + +#define SVGA_CMD_RECT_PIXMAP_FILL 9 + /* FIFO layout: + Pixmap ID, X, Y, Width, Height */ + +#define SVGA_CMD_RECT_BITMAP_COPY 10 + /* FIFO layout: + Bitmap ID, Source X, Source Y, Dest X, Dest Y, + Width, Height, Foreground, Background */ + +#define SVGA_CMD_RECT_PIXMAP_COPY 11 + /* FIFO layout: + Pixmap ID, Source X, Source Y, Dest X, Dest Y, Width, Height */ + +#define SVGA_CMD_FREE_OBJECT 12 + /* FIFO layout: + Object (pixmap, bitmap, ...) ID */ + +#define SVGA_CMD_RECT_ROP_FILL 13 + /* FIFO layout: + Color, X, Y, Width, Height, ROP */ + +#define SVGA_CMD_RECT_ROP_COPY 14 + /* FIFO layout: + Source X, Source Y, Dest X, Dest Y, Width, Height, ROP */ + +#define SVGA_CMD_RECT_ROP_BITMAP_FILL 15 + /* FIFO layout: + ID, X, Y, Width, Height, Foreground, Background, ROP */ + +#define SVGA_CMD_RECT_ROP_PIXMAP_FILL 16 + /* FIFO layout: + ID, X, Y, Width, Height, ROP */ + +#define SVGA_CMD_RECT_ROP_BITMAP_COPY 17 + /* FIFO layout: + ID, Source X, Source Y, + Dest X, Dest Y, Width, Height, Foreground, Background, ROP */ + +#define SVGA_CMD_RECT_ROP_PIXMAP_COPY 18 + /* FIFO layout: + ID, Source X, Source Y, Dest X, Dest Y, Width, Height, ROP */ + +#define SVGA_CMD_DEFINE_CURSOR 19 + /* FIFO layout: + ID, Hotspot X, Hotspot Y, Width, Height, + Depth for AND mask, Depth for XOR mask, + <scanlines for AND mask>, <scanlines for XOR mask> */ + +#define SVGA_CMD_DISPLAY_CURSOR 20 + /* FIFO layout: + ID, On/Off (1 or 0) */ + +#define SVGA_CMD_MOVE_CURSOR 21 + /* FIFO layout: + X, Y */ + +#define SVGA_CMD_MAX 22 + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h:1.4 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_basic_types.h Wed Apr 25 12:44:58 2001 @@ -0,0 +1,167 @@ +/* $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 + * Id: vm_basic_types.h,v 1.9 2001/02/14 22:22:53 bennett Exp $ + * **********************************************************/ + +/* + * + * vm_basic_types.h -- + * + * basic data types. + */ + + +#ifndef _VM_BASIC_TYPES_H_ +#define _VM_BASIC_TYPES_H_ + +#define INCLUDE_ALLOW_USERLEVEL +#define INCLUDE_ALLOW_MONITOR +#define INCLUDE_ALLOW_MODULE +#define INCLUDE_ALLOW_VMKERNEL +#include "includeCheck.h" + +/* STRICT ANSI means the Xserver build and X defines Bool differently. */ +#if 0 +typedef char Bool; +#endif + +#ifndef FALSE +#define FALSE 0 +#endif + +#ifndef TRUE +#define TRUE 1 +#endif + +#ifdef _MSC_VER +typedef unsigned __int64 uint64; +typedef signed __int64 int64; + +#pragma warning (disable :4018) // signed/unsigned mismatch +#pragma warning (disable :4761) // integral size mismatch in argument; conversion supplied +#pragma warning (disable :4305) // truncation from 'const int' to 'short' +#pragma warning (disable :4244) // conversion from 'unsigned short' to 'unsigned char' +//#pragma warning (disable :4101) // unreferenced local variable +#pragma warning (disable :4133) // incompatible types - from 'struct VM *' to 'int *' +#pragma warning (disable :4047) // differs in levels of indirection +#pragma warning (disable :4146) // unary minus operator applied to unsigned type, result still unsigned +#pragma warning (disable :4142) // benign redefinition of type + +#elif defined(__GNUC__) +/* The Xserver source compiles with -ansi -pendantic */ +#ifndef __STRICT_ANSI__ +typedef unsigned long long uint64; +typedef long long int64; +#endif +#else +#error - Need compiler define for int64/uint64 +#endif + +typedef unsigned int uint32; +typedef unsigned short uint16; +typedef unsigned char uint8; + +typedef int int32; +typedef short int16; +typedef char int8; + + +/* + * Printf format for 64-bit number. Use it like this: + * printf("%"FMT64"d\n", big); + */ + +#ifdef _MSC_VER +#define FMT64 "I64" +#elif defined(__GNUC__) +#define FMT64 "L" +#else +#error - Need compiler define for FMT64 +#endif + +typedef uint32 VA; +typedef uint32 VPN; + +typedef uint32 PA; +typedef uint32 PPN; + +typedef uint32 MA; +typedef uint32 MPN; + +#define INVALID_MPN ((MPN)-1) + +#define EXTERN extern +/* + * Right now our use of CONST is broken enough that it only works + * with GCC. XXX Need to fix this. + */ +#ifdef __GNUC__ +#define CONST const +#else +#ifndef CONST +#define CONST +#endif +#endif + +#ifdef _MSC_VER +#ifndef INLINE +#define INLINE __inline +#endif +#else +#ifndef INLINE +#define INLINE inline +#endif +#endif + + +#if defined(WIN32) && !defined(VMX86_NO_THREADS) +#define THREADSPECIFIC _declspec(thread) +#else +#define THREADSPECIFIC +#endif + +/* + * Like "INLINE" but use this token to mark functions that are inline + * because they have only a single call site. In other words, if a second + * call site is introduced, the "INLINE_SINGLE_CALLER" token should be + * removed. + */ +#define INLINE_SINGLE_CALLER INLINE + +/* + * Attributes placed on function declarations to tell the compiler + * that the function never returns. + */ +#ifdef _MSC_VER +#define NORETURN_DECL(_fndecl) __declspec(noreturn) _fndecl +#elif defined(__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 5 +#define NORETURN_DECL(_fndecl) _fndecl __attribute__((__noreturn__)) +#else +#define NORETURN_DECL(_fndecl) _fndecl +#endif + + +/* + * GCC's argument checking for printf-like functions + * This is conditional until we have replaced all `"%x", void *' + * with `"0x%08x", (uint32) void *'. Note that %p prints different things + * on different platforms. + * + * fmtPos is the position of the format string argument, beginning at 1 + * varPos is the position of the variable argument, beginning at 1 + */ +#if defined(__GNUC__) && defined(notdef) +# define PRINTF_DECL(fmtPos, varPos) __attribute__((__format__(__printf__, fmtPos, varPos))) +#else +# define PRINTF_DECL(fmtPos, varPos) +#endif + +/* + * Used to silence compiler warnings that get generated when the + * compiler thinks that a function returns when it is marked noreturn. + */ +#define INFINITE_LOOP() do { } while (1) + +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h Thu Apr 5 15:29:44 2001 @@ -0,0 +1,64 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vm_device_version.h,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * Id: vm_device_version.h,v 1.2 2001/01/26 21:53:27 yoel Exp $ + * **********************************************************/ + + +#ifndef VM_DEVICE_VERSION_H +#define VM_DEVICE_VERSION_H + +#define INCLUDE_ALLOW_USERLEVEL +#define INCLUDE_ALLOW_MONITOR +#define INCLUDE_ALLOW_MODULE +#define INCLUDE_ALLOW_VMKERNEL +#include "includeCheck.h" + +#define PCI_VENDOR_ID_VMWARE 0x15AD +#define PCI_DEVICE_ID_VMWARE_SVGA2 0x0405 +#define PCI_DEVICE_ID_VMWARE_SVGA 0x0710 +#define PCI_DEVICE_ID_VMWARE_NET 0x0720 +#define PCI_DEVICE_ID_VMWARE_SCSI 0x0730 +#define PCI_DEVICE_ID_VMWARE_IDE 0x1729 + +/* From linux/pci.h. We emulate an AMD ethernet controller */ +#define PCI_VENDOR_ID_AMD 0x1022 +#define PCI_DEVICE_ID_AMD_VLANCE 0x2000 +#define PCI_VENDOR_ID_BUSLOGIC 0x104B +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER_NC 0x0140 +#define PCI_DEVICE_ID_BUSLOGIC_MULTIMASTER 0x1040 + +/* Intel Values for the chipset */ +#define PCI_VENDOR_ID_INTEL 0x8086 +#define PCI_DEVICE_ID_INTEL_82439TX 0x7100 +#define PCI_DEVICE_ID_INTEL_82371AB_0 0x7110 +#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113 +#define PCI_DEVICE_ID_INTEL_82371AB 0x7111 +#define PCI_DEVICE_ID_INTEL_82443BX 0x7192 + + +/************* Strings for IDE Identity Fields **************************/ +#define VIDE_ID_SERIAL_STR "00000000000000000001" /* Must be 20 Bytes */ +#define VIDE_ID_FIRMWARE_STR "00000001" /* Must be 8 Bytes */ + +/* No longer than 40 Bytes and must be an even length. */ +#define VIDE_ATA_MODEL_STR PRODUCT_GENERIC_NAME " Virtual IDE Hard Drive " +#define VIDE_ATAPI_MODEL_STR PRODUCT_GENERIC_NAME " Virtual IDE CDROM Drive " + +#define ATAPI_VENDOR_ID "NECVMWar" /* Must be 8 Bytes */ +#define ATAPI_PRODUCT_ID PRODUCT_GENERIC_NAME " IDE CDROM" /* Must be 16 Bytes */ +#define ATAPI_REV_LEVEL "1.00" /* Must be 4 Bytes */ + + +/************* Strings for SCSI Identity Fields **************************/ +#define SCSI_DISK_MODEL_STR PRODUCT_GENERIC_NAME " Virtual SCSI Hard Drive" +#define SCSI_CDROM_MODEL_STR PRODUCT_GENERIC_NAME " Virtual SCSI CDROM Drive" + +/************* Strings for the VESA BIOS Identity Fields *****************/ +#define VBE_OEM_STRING COMPANY_NAME " SVGA" +#define VBE_VENDOR_NAME COMPANY_NAME +#define VBE_PRODUCT_NAME PRODUCT_GENERIC_NAME + + +#endif /* VM_DEVICE_VERSION_H */ Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c:1.4 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c Wed May 16 02:48:12 2001 @@ -0,0 +1,1358 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmware[] = + + "Id: vmware.c,v 1.11 2001/02/23 02:10:39 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.c,v 1.4 2001/05/16 06:48:12 keithp Exp $ */ + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Resources.h" + +#include "compiler.h" /* inb/outb */ + +#include "xf86PciInfo.h" /* pci vendor id */ +#include "xf86Pci.h" /* pci */ + +#include "mipointer.h" /* sw cursor */ +#include "mibstore.h" /* backing store */ +#include "micmap.h" /* mi color map */ +#include "vgaHW.h" /* VGA hardware */ +#include "fb.h" + +#include "xf86cmap.h" /* xf86HandleColormaps */ + +#include "vmware.h" +#include "guest_os.h" +#include "vm_device_version.h" + +/* + * Sanity check that xf86PciInfo.h has the correct values (which come from + * the VMware source tree in vm_device_version.h. + */ +#if PCI_CHIP_VMWARE0405 != PCI_DEVICE_ID_VMWARE_SVGA2 +#error "PCI_CHIP_VMWARE0405 is wrong, update it from vm_device_version.h" +#endif +#if PCI_CHIP_VMWARE0710 != PCI_DEVICE_ID_VMWARE_SVGA +#error "PCI_CHIP_VMWARE0710 is wrong, update it from vm_device_version.h" +#endif +#if PCI_VENDOR_VMWARE != PCI_VENDOR_ID_VMWARE +#error "PCI_VENDOR_VMWARE is wrong, update it from vm_device_version.h" +#endif + +/* + * This is the only way I know to turn a #define of an integer constant into + * a constant string. + */ +#define VMW_INNERSTRINGIFY(s) #s +#define VMW_STRING(str) VMW_INNERSTRINGIFY(str) + +#define VMWARE_NAME "VMWARE" +#define VMWARE_DRIVER_NAME "vmware" +#define VMWARE_MAJOR_VERSION 10 +#define VMWARE_MINOR_VERSION 4 +#define VMWARE_PATCHLEVEL 0 +#define VERSION (VMWARE_MAJOR_VERSION * 65536 + VMWARE_MINOR_VERSION * 256 + VMWARE_PATCHLEVEL) + +static const char VMWAREBuildStr[] = + "VMware Guest X Server " VMW_STRING(VMWARE_MAJOR_VERSION) + "." VMW_STRING(VMWARE_MINOR_VERSION) + "." VMW_STRING(VMWARE_PATCHLEVEL) " - build=$Name: $\n"; + +static SymTabRec VMWAREChipsets[] = { + { PCI_CHIP_VMWARE0405, "vmware0405" }, + { PCI_CHIP_VMWARE0710, "vmware0710" }, + { -1, NULL } +}; + +static resRange vmwareLegacyRes[] = { + { ResExcIoBlock, SVGA_LEGACY_BASE_PORT, SVGA_LEGACY_BASE_PORT + SVGA_NUM_PORTS*sizeof(uint32)}, + _VGA_EXCLUSIVE, _END +}; + +/* + * Currently, even the PCI obedient 0405 chip still only obeys IOSE and + * MEMSE for the SVGA resources. Thus, RES_EXCLUSIVE_VGA is required. + * + * The 0710 chip also uses hardcoded IO ports that aren't disablable. + */ + +static PciChipsets VMWAREPciChipsets[] = { + { PCI_CHIP_VMWARE0405, PCI_CHIP_VMWARE0405, RES_EXCLUSIVE_VGA }, + { PCI_CHIP_VMWARE0710, PCI_CHIP_VMWARE0710, vmwareLegacyRes }, + { -1, -1, RES_UNDEFINED } +}; + +#ifdef XFree86LOADER +static XF86ModuleVersionInfo vmwareVersRec = { + "vmware", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + VMWARE_MAJOR_VERSION, VMWARE_MINOR_VERSION, VMWARE_PATCHLEVEL, + ABI_CLASS_VIDEODRV, + ABI_VIDEODRV_VERSION, + MOD_CLASS_VIDEODRV, + { 0, 0, 0, 0} +}; +#endif /* XFree86LOADER */ + +typedef enum { + OPTION_HW_CURSOR, + OPTION_NOACCEL +} VMWAREOpts; + +static const OptionInfoRec VMWAREOptions[] = { + { OPTION_HW_CURSOR, "HWcursor", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_NOACCEL, "NoAccel", OPTV_BOOLEAN, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } +}; + +static Bool +VMWAREGetRec(ScrnInfoPtr pScrn) +{ + if (pScrn->driverPrivate != NULL) { + return TRUE; + } + pScrn->driverPrivate = xnfcalloc(sizeof(VMWARERec), 1); + /* FIXME: Initialize driverPrivate... */ + return TRUE; +} + +static void +VMWAREFreeRec(ScrnInfoPtr pScrn) +{ + if (pScrn->driverPrivate) { + xfree(pScrn->driverPrivate); + pScrn->driverPrivate = NULL; + } +} + +static void ScreenToPrivate(ScreenPtr, ScrnInfoPtr); +static void ScreenFromPrivate(ScreenPtr, ScrnInfoPtr); + +/* VMware specific functions */ + +static CARD32 +vmwareReadReg(VMWAREPtr pVMWARE, int index) +{ + outl(pVMWARE->indexReg, index); + return inl(pVMWARE->valueReg); +} + +void +vmwareWriteReg(VMWAREPtr pVMWARE, int index, CARD32 value) +{ + outl(pVMWARE->indexReg, index); + outl(pVMWARE->valueReg, value); +} + +void +vmwareWriteWordToFIFO(VMWAREPtr pVMWARE, CARD32 value) +{ + CARD32* vmwareFIFO = pVMWARE->vmwareFIFO; + + /* Need to sync? */ + if ((vmwareFIFO[SVGA_FIFO_NEXT_CMD] + sizeof(CARD32) == vmwareFIFO[SVGA_FIFO_STOP]) + || (vmwareFIFO[SVGA_FIFO_NEXT_CMD] == vmwareFIFO[SVGA_FIFO_MAX] - sizeof(CARD32) && + vmwareFIFO[SVGA_FIFO_STOP] == vmwareFIFO[SVGA_FIFO_MIN])) { + vmwareWriteReg(pVMWARE, SVGA_REG_SYNC, 1); + while (vmwareReadReg(pVMWARE, SVGA_REG_BUSY)) ; + } + vmwareFIFO[vmwareFIFO[SVGA_FIFO_NEXT_CMD] / sizeof(CARD32)] = value; + vmwareFIFO[SVGA_FIFO_NEXT_CMD] += sizeof(CARD32); + if (vmwareFIFO[SVGA_FIFO_NEXT_CMD] == vmwareFIFO[SVGA_FIFO_MAX]) { + vmwareFIFO[SVGA_FIFO_NEXT_CMD] = vmwareFIFO[SVGA_FIFO_MIN]; + } +} + +void +vmwareWaitForFB(VMWAREPtr pVMWARE) +{ + if (pVMWARE->vmwareFIFOMarkSet) { + vmwareWriteReg(pVMWARE, SVGA_REG_SYNC, 1); + while (vmwareReadReg(pVMWARE, SVGA_REG_BUSY)) ; + pVMWARE->vmwareFIFOMarkSet = FALSE; + } +} + +void +vmwareSendSVGACmdUpdate(VMWAREPtr pVMWARE, BoxPtr pBB) +{ + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_UPDATE); + vmwareWriteWordToFIFO(pVMWARE, pBB->x1); + vmwareWriteWordToFIFO(pVMWARE, pBB->y1); + vmwareWriteWordToFIFO(pVMWARE, pBB->x2 - pBB->x1); + vmwareWriteWordToFIFO(pVMWARE, pBB->y2 - pBB->y1); +} + +static void +vmwareSendSVGACmdUpdateFullScreen(VMWAREPtr pVMWARE) +{ + BoxRec BB; + + BB.x1 = 0; + BB.y1 = 0; + BB.x2 = pVMWARE->ModeReg.svga_reg_width; + BB.y2 = pVMWARE->ModeReg.svga_reg_height; + vmwareSendSVGACmdUpdate(pVMWARE, &BB); +} + +static CARD32 +vmwareCalculateWeight(CARD32 mask) +{ + CARD32 weight; + + for (weight = 0; mask; mask >>= 1) { + if (mask & 1) { + weight++; + } + } + return weight; +} + +/* + *----------------------------------------------------------------------------- + * + * VMXGetVMwareSvgaId -- + * + * Retrieve the SVGA_ID of the VMware SVGA adapter. + * This function should hide any backward compatibility mess. + * + * Results: + * The SVGA_ID_* of the present VMware adapter. + * + * Side effects: + * ins/outs + * + *----------------------------------------------------------------------------- + */ + +static uint32 +VMXGetVMwareSvgaId(VMWAREPtr pVMWARE) +{ + uint32 vmware_svga_id; + + /* Any version with any SVGA_ID_* support will initialize SVGA_REG_ID + * to SVGA_ID_0 to support versions of this driver with SVGA_ID_0. + * + * Versions of SVGA_ID_0 ignore writes to the SVGA_REG_ID register. + * + * Versions of SVGA_ID_1 will allow us to overwrite the content + * of the SVGA_REG_ID register only with the values SVGA_ID_0 or SVGA_ID_1. + * + * Versions of SVGA_ID_2 will allow us to overwrite the content + * of the SVGA_REG_ID register only with the values SVGA_ID_0 or SVGA_ID_1 + * or SVGA_ID_2. + */ + + vmwareWriteReg(pVMWARE, SVGA_REG_ID, SVGA_ID_2); + vmware_svga_id = vmwareReadReg(pVMWARE, SVGA_REG_ID); + if (vmware_svga_id == SVGA_ID_2) { + return SVGA_ID_2; + } + + vmwareWriteReg(pVMWARE, SVGA_REG_ID, SVGA_ID_1); + vmware_svga_id = vmwareReadReg(pVMWARE, SVGA_REG_ID); + if (vmware_svga_id == SVGA_ID_1) { + return SVGA_ID_1; + } + + if (vmware_svga_id == SVGA_ID_0) { + return SVGA_ID_0; + } + + /* No supported VMware SVGA devices found */ + return SVGA_ID_INVALID; +} + + +/* + *---------------------------------------------------------------------- + * + * RewriteTagString -- + * + * Rewrites the given string, removing the $Name: $, and + * replacing it with the contents. The output string must + * have enough room, or else. + * + * Results: + * + * Output string updated. + * + * Side effects: + * None. + * + *---------------------------------------------------------------------- + */ + +static void +RewriteTagString(const char *istr, char *ostr, int osize) +{ + int chr; + Bool inTag = FALSE; + char *op = ostr; + + do { + chr = *istr++; + if (chr == '$') { + if (inTag) { + inTag = FALSE; + for (; op > ostr && op[-1] == ' '; op--) { + } + continue; + } + if (strncmp(istr, "Name:", 5) == 0) { + istr += 5; + istr += strspn(istr, " "); + inTag = TRUE; + continue; + } + } + *op++ = chr; + } while (chr); +} + +static void +VMWAREIdentify(int flags) +{ + xf86PrintChipsets(VMWARE_NAME, "driver for VMware SVGA", VMWAREChipsets); +} + +static const OptionInfoRec * +VMWAREAvailableOptions(int chipid, int busid) +{ + return VMWAREOptions; +} + +static Bool +VMWAREPreInit(ScrnInfoPtr pScrn, int flags) +{ + MessageType from; + VMWAREPtr pVMWARE; + OptionInfoPtr options; + int bpp24flags; + uint32 id; + int i; + ClockRange* clockRanges; + + if (flags & PROBE_DETECT) { + return FALSE; + } + + if (pScrn->numEntities != 1) { + return FALSE; + } + + if (!VMWAREGetRec(pScrn)) { + return FALSE; + } + pVMWARE = VMWAREPTR(pScrn); + + pVMWARE->pEnt = xf86GetEntityInfo(pScrn->entityList[0]); + if (pVMWARE->pEnt->location.type != BUS_PCI) { + return FALSE; + } + pVMWARE->PciInfo = xf86GetPciInfoForEntity(pVMWARE->pEnt->index); + if (pVMWARE->PciInfo == NULL) { + return FALSE; + } + + if (pVMWARE->PciInfo->chipType == PCI_CHIP_VMWARE0710) { + pVMWARE->indexReg = + SVGA_LEGACY_BASE_PORT + SVGA_INDEX_PORT*sizeof(uint32); + pVMWARE->valueReg = + SVGA_LEGACY_BASE_PORT + SVGA_VALUE_PORT*sizeof(uint32); + } else { + pVMWARE->indexReg = + pVMWARE->PciInfo->ioBase[0] + SVGA_INDEX_PORT; + pVMWARE->valueReg = + pVMWARE->PciInfo->ioBase[0] + SVGA_VALUE_PORT; + } + xf86DrvMsg(pScrn->scrnIndex, X_PROBED, + "VMware SVGA regs at (0x%04x, 0x%04x)\n", + pVMWARE->indexReg, pVMWARE->valueReg); + + id = VMXGetVMwareSvgaId(pVMWARE); + if (id == SVGA_ID_0 || id == SVGA_ID_INVALID) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "No supported VMware SVGA found (read ID 0x%08x).\n", id); + return FALSE; + } + + if (!xf86LoadSubModule(pScrn, "vgahw")) { + return FALSE; + } + +/* xf86LoaderReqSymLists(vgahwSymbols, NULL); */ /* FIXME */ + + if (!vgaHWGetHWRec(pScrn)) { + return FALSE; + } + + pVMWARE->PciTag = pciTag(pVMWARE->PciInfo->bus, pVMWARE->PciInfo->device, + pVMWARE->PciInfo->func); + pVMWARE->Primary = xf86IsPrimaryPci(pVMWARE->PciInfo); + + pScrn->monitor = pScrn->confScreen->monitor; + + pVMWARE->depth = vmwareReadReg(pVMWARE, SVGA_REG_DEPTH); + pVMWARE->weight.red = vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_RED_MASK)); + pVMWARE->weight.green = vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_GREEN_MASK)); + pVMWARE->weight.blue = vmwareCalculateWeight(vmwareReadReg(pVMWARE, SVGA_REG_BLUE_MASK)); + pVMWARE->offset.blue = 0; + pVMWARE->offset.green = pVMWARE->weight.blue; + pVMWARE->offset.red = pVMWARE->weight.green + pVMWARE->offset.green; + pVMWARE->bitsPerPixel = vmwareReadReg(pVMWARE, SVGA_REG_BITS_PER_PIXEL); + pVMWARE->defaultVisual = vmwareReadReg(pVMWARE, SVGA_REG_PSEUDOCOLOR) ? PseudoColor : TrueColor; + pVMWARE->videoRam = vmwareReadReg(pVMWARE, SVGA_REG_FB_MAX_SIZE); + pVMWARE->memPhysBase = vmwareReadReg(pVMWARE, SVGA_REG_FB_START); + pVMWARE->maxWidth = vmwareReadReg(pVMWARE, SVGA_REG_MAX_WIDTH); + pVMWARE->maxHeight = vmwareReadReg(pVMWARE, SVGA_REG_MAX_HEIGHT); +#define ACCELERATE_OPS +#ifdef ACCELERATE_OPS + pVMWARE->vmwareCapability = vmwareReadReg(pVMWARE, SVGA_REG_CAPABILITIES); +#else + pVMWARE->vmwareCapability = 0; +#endif + pVMWARE->cursorDefined = FALSE; + pVMWARE->mouseHidden = FALSE; + + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "depth: %d\n", pVMWARE->depth); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "w.red: %d\n", pVMWARE->weight.red); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "w.grn: %d\n", pVMWARE->weight.green); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "w.blu: %d\n", pVMWARE->weight.blue); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "bpp: %d\n", pVMWARE->bitsPerPixel); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "vis: %d\n", pVMWARE->defaultVisual); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "vram: %d\n", pVMWARE->videoRam); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "pbase: %p\n", pVMWARE->memPhysBase); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "mwidt: %d\n", pVMWARE->maxWidth); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "mheig: %d\n", pVMWARE->maxHeight); + xf86DrvMsgVerb(pScrn->scrnIndex, X_PROBED, 2, "caps: 0x%08X\n", pVMWARE->vmwareCapability); + + switch (pVMWARE->depth) { + case 16: + /* + * In certain cases, the Windows host appears to + * report 16 bpp and 16 depth but 555 weight. Just + * silently convert it to depth of 15. + */ + if (pVMWARE->bitsPerPixel == 16 && + pVMWARE->weight.green == 5) + pVMWARE->depth = 15; + case 8: + case 15: + bpp24flags = NoDepth24Support; + break; + + case 32: + /* + * There is no 32 bit depth, apparently it can get + * reported this way sometimes on the Windows host. + */ + if (pVMWARE->bitsPerPixel == 32) + pVMWARE->depth = 24; + case 24: + if (pVMWARE->bitsPerPixel == 24) + bpp24flags = Support24bppFb; + else + bpp24flags = Support32bppFb; + break; + default: + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Adapter is using an unsupported depth (%d).\n", + pVMWARE->depth); + return FALSE; + } + + if (!xf86SetDepthBpp(pScrn, pVMWARE->depth, pVMWARE->bitsPerPixel, pVMWARE->bitsPerPixel, bpp24flags)) { + return FALSE; + } + if (pScrn->depth != pVMWARE->depth) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Currently unavailable depth of %d requested.\n" + "\tThe guest X server must run at the same depth as the host (which\n" + "\tis currently %d). This is automatically detected. Please do not\n" + "\tspecify a depth on the command line or via the config file.\n", + pScrn->depth, pVMWARE->depth); + return FALSE; + } + if (pScrn->bitsPerPixel != pVMWARE->bitsPerPixel) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given bpp (%d) is not supported by this driver (%d is required)\n", + pScrn->bitsPerPixel, pVMWARE->bitsPerPixel); + return FALSE; + } + xf86PrintDepthBpp(pScrn); + +#if 0 + if (pScrn->depth == 24 && pix24bpp == 0) { + pix24bpp = xf86GetBppFromDepth(pScrn, 24); + } +#endif + + if (pScrn->depth > 8) { + rgb zeros = { 0, 0, 0 }; + + if (!xf86SetWeight(pScrn, pVMWARE->weight, zeros)) { + return FALSE; + } + /* FIXME check returned weight */ + } + if (!xf86SetDefaultVisual(pScrn, pVMWARE->defaultVisual)) { + return FALSE; + } + if (pScrn->defaultVisual != pVMWARE->defaultVisual) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, + "Given visual (%d) is not supported by this driver (%d is required)\n", + pScrn->defaultVisual, pVMWARE->defaultVisual); + return FALSE; + } +#if 0 + bytesPerPixel = pScrn->bitsPerPixel / 8; +#endif + pScrn->progClock = TRUE; + +#if 0 /* MGA does not do this */ + if (pScrn->visual != 0) { /* FIXME */ + /* print error message */ + return FALSE; + } +#endif + + xf86CollectOptions(pScrn, NULL); + if (!(options = xalloc(sizeof(VMWAREOptions)))) + return FALSE; + memcpy(options, VMWAREOptions, sizeof(VMWAREOptions)); + xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); + + if (pScrn->depth <= 8) { + pScrn->rgbBits = 8; + } + + from = X_PROBED; + pScrn->chipset = (char*)xf86TokenToString(VMWAREChipsets, pVMWARE->PciInfo->chipType); + + if (!pScrn->chipset) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "ChipID 0x%04 is not recognised\n", pVMWARE->PciInfo->chipType); + return FALSE; + } + + from = X_DEFAULT; + pVMWARE->hwCursor = TRUE; + if (xf86GetOptValBool(options, OPTION_HW_CURSOR, &pVMWARE->hwCursor)) { + from = X_CONFIG; + } + if (pVMWARE->hwCursor && !(pVMWARE->vmwareCapability & SVGA_CAP_CURSOR)) { + xf86DrvMsg(pScrn->scrnIndex, X_WARNING, "HW cursor is not supported in this configuration\n"); + from = X_PROBED; + pVMWARE->hwCursor = FALSE; + } + xf86DrvMsg(pScrn->scrnIndex, from, "Using %s cursor\n", + pVMWARE->hwCursor ? "HW" : "SW"); + if (xf86IsOptionSet(options, OPTION_NOACCEL)) { + pVMWARE->noAccel = TRUE; + xf86DrvMsg(pScrn->scrnIndex, X_CONFIG, "Acceleration disabled\n"); + pVMWARE->vmwareCapability = 0; + } else { + pVMWARE->noAccel = FALSE; + } + pScrn->videoRam = pVMWARE->videoRam / 1024; + pScrn->memPhysBase = pVMWARE->memPhysBase; + xfree(options); + + { + Gamma zeros = { 0.0, 0.0, 0.0 }; + if (!xf86SetGamma(pScrn, zeros)) { + return FALSE; + } + } +#if 0 + if ((i = xf86GetPciInfoForScreen(pScrn->scrnIndex, &pciList, NULL)) != 1) { + /* print error message */ + VMWAREFreeRec(pScrn); + if (i > 0) { + xfree(pciList); + } + return FALSE; + } +#endif + clockRanges = xnfcalloc(sizeof(ClockRange), 1); + clockRanges->next = NULL; + clockRanges->minClock = 1; + clockRanges->maxClock = 400000000; + clockRanges->clockIndex = -1; + clockRanges->interlaceAllowed = FALSE; + clockRanges->doubleScanAllowed = FALSE; + clockRanges->ClockMulFactor = 1; + clockRanges->ClockDivFactor = 1; + + i = xf86ValidateModes(pScrn, pScrn->monitor->Modes, pScrn->display->modes, + clockRanges, NULL, 256, pVMWARE->maxWidth, 32 * 32, + 128, pVMWARE->maxHeight, + pScrn->display->virtualX, pScrn->display->virtualY, + pVMWARE->videoRam, + LOOKUP_BEST_REFRESH); + if (i == -1) { + VMWAREFreeRec(pScrn); + return FALSE; + } + xf86PruneDriverModes(pScrn); + if (i == 0 || pScrn->modes == NULL) { + xf86DrvMsg(pScrn->scrnIndex, X_ERROR, "No valid modes found\n"); + VMWAREFreeRec(pScrn); + return FALSE; + } + xf86SetCrtcForModes(pScrn, INTERLACE_HALVE_V); + pScrn->currentMode = pScrn->modes; + xf86PrintModes(pScrn); + xf86SetDpi(pScrn, 0, 0); + if (!xf86LoadSubModule(pScrn, "fb")) { + VMWAREFreeRec(pScrn); + return FALSE; + } + if (!pVMWARE->noAccel || pVMWARE->hwCursor) { + if (!xf86LoadSubModule(pScrn, "xaa")) { + VMWAREFreeRec(pScrn); + return FALSE; + } + } + return TRUE; +} + +static Bool +VMWAREMapMem(ScrnInfoPtr pScrn) +{ + VMWAREPtr pVMWARE; + + pVMWARE = VMWAREPTR(pScrn); + + pVMWARE->FbBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_FRAMEBUFFER, pVMWARE->PciTag, pVMWARE->memPhysBase, pVMWARE->videoRam); + if (!pVMWARE->FbBase) + return FALSE; + pVMWARE->FbSize = pVMWARE->videoRam; + + VmwareLog(("FB Mapped: %p/%u -> %p/%u\n", + pVMWARE->memPhysBase, pVMWARE->videoRam, + pVMWARE->FbBase, pVMWARE->FbSize)); + return TRUE; +} + +static Bool +VMWAREUnmapMem(ScrnInfoPtr pScrn) +{ + VMWAREPtr pVMWARE; + + pVMWARE = VMWAREPTR(pScrn); + + VmwareLog(("Unmapped: %p/%u\n", pVMWARE->FbBase, pVMWARE->FbSize)); + + xf86UnMapVidMem(pScrn->scrnIndex, pVMWARE->FbBase, pVMWARE->FbSize); + pVMWARE->FbBase = NULL; + return TRUE; +} + +static void +VMWARESave(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->SavedReg; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + VMWARERegPtr vmwareReg = &pVMWARE->SavedReg; + + vgaHWSave(pScrn, vgaReg, VGA_SR_ALL); + + vmwareReg->svga_reg_enable = 0; + /* FIXME: Save VMWARE state */ +} + +static void +VMWARERestoreRegs(ScrnInfoPtr pScrn, VMWARERegPtr vmwareReg) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + if (vmwareReg->svga_reg_enable) { + vmwareWriteReg(pVMWARE, SVGA_REG_WIDTH, vmwareReg->svga_reg_width); + vmwareWriteReg(pVMWARE, SVGA_REG_HEIGHT, vmwareReg->svga_reg_height); + vmwareWriteReg(pVMWARE, SVGA_REG_ENABLE, vmwareReg->svga_reg_enable); + vmwareWriteReg(pVMWARE, SVGA_REG_GUEST_ID, GUEST_OS_LINUX); + } else { + vmwareWriteReg(pVMWARE, SVGA_REG_ENABLE, vmwareReg->svga_reg_enable); + } +} + +static void +VMWARERestore(ScrnInfoPtr pScrn) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->SavedReg; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + VMWARERegPtr vmwareReg = &pVMWARE->SavedReg; + + /* FIXME: Sync */ + vgaHWProtect(pScrn, TRUE); + VMWARERestoreRegs(pScrn, vmwareReg); + vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); + vgaHWProtect(pScrn, FALSE); +} + +static Bool +VMWAREModeInit(ScrnInfoPtr pScrn, DisplayModePtr mode) +{ + vgaHWPtr hwp = VGAHWPTR(pScrn); + vgaRegPtr vgaReg = &hwp->ModeReg; + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + VMWARERegPtr vmwareReg = &pVMWARE->ModeReg; + + vgaHWUnlock(hwp); + if (!vgaHWInit(pScrn, mode)) + return FALSE; + pScrn->vtSema = TRUE; + + if (!vgaHWInit(pScrn, mode)) + return FALSE; + + vmwareReg->svga_reg_enable = 1; + vmwareReg->svga_reg_width = max(mode->HDisplay, pScrn->virtualX); + vmwareReg->svga_reg_height = max(mode->VDisplay, pScrn->virtualY); + + vgaHWProtect(pScrn, TRUE); + + vgaHWRestore(pScrn, vgaReg, VGA_SR_ALL); + VMWARERestoreRegs(pScrn, vmwareReg); + + VmwareLog(("Required mode: %ux%u\n", mode->HDisplay, mode->VDisplay)); + VmwareLog(("Virtual: %ux%u\n", pScrn->virtualX, pScrn->virtualY)); + VmwareLog(("dispWidth: %u\n", pScrn->displayWidth)); + pVMWARE->fbOffset = vmwareReadReg(pVMWARE, SVGA_REG_FB_OFFSET); + pVMWARE->fbPitch = vmwareReadReg(pVMWARE, SVGA_REG_BYTES_PER_LINE); + + pScrn->displayWidth = (pVMWARE->fbPitch * 8) / ((pScrn->bitsPerPixel + 7) & ~7); + VmwareLog(("fbOffset: %u\n", pVMWARE->fbOffset)); + VmwareLog(("fbPitch: %u\n", pVMWARE->fbPitch)); + VmwareLog(("New dispWidth: %u\n", pScrn->displayWidth)); + + vgaHWProtect(pScrn, FALSE); + pVMWARE->CurrentLayout.mode = mode; + return TRUE; +} + +static void +VMWAREAdjustFrame(int scrnIndex, int x, int y, int flags) +{ + /* FIXME */ +} + +static void +VMWAREInitFIFO(ScrnInfoPtr pScrn) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + CARD32* vmwareFIFO; + + pVMWARE->mmioPhysBase = vmwareReadReg(pVMWARE, SVGA_REG_MEM_START); + pVMWARE->mmioSize = vmwareReadReg(pVMWARE, SVGA_REG_MEM_SIZE) & ~3; + pVMWARE->mmioVirtBase = xf86MapPciMem(pScrn->scrnIndex, VIDMEM_MMIO, pVMWARE->PciTag, pVMWARE->mmioPhysBase, pVMWARE->mmioSize); + vmwareFIFO = pVMWARE->vmwareFIFO = (CARD32*)pVMWARE->mmioVirtBase; + vmwareFIFO[SVGA_FIFO_MIN] = 4 * sizeof(CARD32); + vmwareFIFO[SVGA_FIFO_MAX] = pVMWARE->mmioSize; + vmwareFIFO[SVGA_FIFO_NEXT_CMD] = 4 * sizeof(CARD32); + vmwareFIFO[SVGA_FIFO_STOP] = 4 * sizeof(CARD32); + pVMWARE->vmwareFIFOMarkSet = FALSE; + vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 1); +} + +static void +VMWAREStopFIFO(ScrnInfoPtr pScrn) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + /* ??? */ + vmwareWriteReg(pVMWARE, SVGA_REG_CONFIG_DONE, 0); +} + +static Bool +VMWARECloseScreen(int scrnIndex, ScreenPtr pScreen) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + VMWARERestore(pScrn); + VMWAREStopFIFO(pScrn); + VMWAREUnmapMem(pScrn); + pScrn->vtSema = FALSE; + ScreenFromPrivate(pScreen, pScrn); + return (*pScreen->CloseScreen)(scrnIndex, pScreen); +} + +static Bool +VMWARESaveScreen(ScreenPtr pScreen, int mode) +{ + return vgaHWSaveScreen(pScreen, mode); +} + +static void +VMWARELoadPalette(ScrnInfoPtr pScrn, int numColors, int* indices, + LOCO* colors, VisualPtr pVisual) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + int i; + + for (i = 0; i < numColors; i++) { + vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 0, colors[*indices].red); + vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 1, colors[*indices].green); + vmwareWriteReg(pVMWARE, SVGA_PALETTE_BASE + *indices * 3 + 2, colors[*indices].blue); + indices++; + } + + pVMWARE->checkCursorColor = TRUE; + VmwareLog(("Palette loading done\n")); +} + +static Bool +VMWAREScreenInit(int scrnIndex, ScreenPtr pScreen, int argc, char **argv) +{ + ScrnInfoPtr pScrn; + vgaHWPtr hwp; + VMWAREPtr pVMWARE; + Bool ret; + + /* Get the ScrnInfoRec */ + pScrn = xf86Screens[pScreen->myNum]; + pVMWARE = VMWAREPTR(pScrn); + + /* + * If using the vgahw module, its data structures and related + * things are typically initialised/mapped here. + */ + + hwp = VGAHWPTR(pScrn); + vgaHWGetIOBase(hwp); + + /* Save the current video state */ + VMWARESave(pScrn); + + VMWAREInitFIFO(pScrn); + + /* Initialise the first mode */ + VMWAREModeInit(pScrn, pScrn->currentMode); + + /* Set the viewport if supported */ + VMWAREAdjustFrame(scrnIndex, pScrn->frameX0, pScrn->frameY0, 0); + + /* + * Setup the screen's visuals, and initialise the framebuffer + * code. + */ + VMWAREMapMem(pScrn); + + /* Reset the visual list */ + miClearVisualTypes(); + + /* + * Setup the visuals supported. This driver only supports + * TrueColor for bpp > 8, so the default set of visuals isn't + * acceptable. To deal with this, call miSetVisualTypes with + * the appropriate visual mask. + */ + + if (pScrn->bitsPerPixel > 8) { + if (!miSetVisualTypes(pScrn->depth, TrueColorMask, + pScrn->rgbBits, pScrn->defaultVisual)) { + return FALSE; + } + } else { + if (!miSetVisualTypes(pScrn->depth, + miGetDefaultVisualMask(pScrn->depth), + pScrn->rgbBits, pScrn->defaultVisual)) { + return FALSE; + } + } + + miSetPixmapDepths (); + + /* + * Initialise the framebuffer. + */ + + ret = fbScreenInit (pScreen, pVMWARE->FbBase, + pScrn->virtualX, pScrn->virtualY, + pScrn->xDpi, pScrn->yDpi, + pScrn->displayWidth, + pScrn->bitsPerPixel); + + if (!ret) + return FALSE; + +#ifdef RENDER + fbPictureInit (pScreen, 0, 0); +#endif + + /* Override the default mask/offset settings */ + if (pScrn->bitsPerPixel > 8) { + int i; + VisualPtr visual; + + for (i = 0, visual = pScreen->visuals; + i < pScreen->numVisuals; i++, visual++) { + if ((visual->class | DynamicClass) == DirectColor) { + visual->offsetRed = pScrn->offset.red; + visual->offsetGreen = pScrn->offset.green; + visual->offsetBlue = pScrn->offset.blue; + visual->redMask = pScrn->mask.red; + visual->greenMask = pScrn->mask.green; + visual->blueMask = pScrn->mask.blue; + } + } + } + + /* + * Wrap the CloseScreen vector and set SaveScreen. + */ + ScreenToPrivate(pScreen, pScrn); + /* + * If backing store is to be supported (as is usually the case), + * initialise it. + */ + miInitializeBackingStore(pScreen); + + /* + * Set initial black & white colourmap indices. + */ + xf86SetBlackWhitePixels(pScreen); + + /* + * Install colourmap functions. If using the vgahw module, + * vgaHandleColormaps would usually be called here. + */ + + /* + * Initialise cursor functions. This example is for the mi + * software cursor. + */ + if (pVMWARE->hwCursor) { + vmwareCursorInit(0, pScreen); + } else { + miDCInitialize(pScreen, xf86GetPointerScreenFuncs()); + } + + if (!fbCreateDefColormap(pScreen)) + return FALSE; + + if (!xf86HandleColormaps(pScreen, 256, 8, + VMWARELoadPalette, NULL, + CMAP_PALETTED_TRUECOLOR | CMAP_RELOAD_ON_MODE_SWITCH)) { + return FALSE; + } + + + /* Report any unused options (only for the first generation) */ + if (serverGeneration == 1) { + xf86ShowUnusedOptions(pScrn->scrnIndex, pScrn->options); + } + + vmwareSendSVGACmdUpdateFullScreen(pVMWARE); + if (pVMWARE->hwCursor) { + vmwareRestoreCursor(pScreen); + } + /* Done */ + return TRUE; +} + +static Bool +VMWARESwitchMode(int scrnIndex, DisplayModePtr mode, int flags) +{ + return VMWAREModeInit(xf86Screens[scrnIndex], mode); +} + +static Bool +VMWAREEnterVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + return VMWAREModeInit(pScrn, pScrn->currentMode); +} + +static void +VMWARELeaveVT(int scrnIndex, int flags) +{ + ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; + VMWARERestore(pScrn); +} + +static void +VMWAREFreeScreen(int scrnIndex, int flags) +{ + /* + * If the vgahw module is used vgaHWFreeHWRec() would be called + * here. + */ + VMWAREFreeRec(xf86Screens[scrnIndex]); +} + +static Bool +VMWAREValidMode(int scrnIndex, DisplayModePtr mode, Bool verbose, int flags) +{ + /* FIXME... possible */ + return MODE_OK; +} + +static Bool +VMWAREProbe(DriverPtr drv, int flags) +{ + int numDevSections, numUsed; + GDevPtr *devSections; + int *usedChips; + int i; + Bool foundScreen = FALSE; + char buildString[sizeof(VMWAREBuildStr)]; + + RewriteTagString(VMWAREBuildStr, buildString, sizeof(VMWAREBuildStr)); + xf86DrvMsg(0, X_PROBED, "%s", buildString); + + numDevSections = xf86MatchDevice(VMWARE_DRIVER_NAME, &devSections); + if (numDevSections <= 0) { + xf86DrvMsg(0, X_ERROR, "No vmware driver section\n"); + return FALSE; + } + if (xf86GetPciVideoInfo()) { + VmwareLog(("Some PCI Video Info Exists\n")); + numUsed = xf86MatchPciInstances(VMWARE_NAME, PCI_VENDOR_VMWARE, + VMWAREChipsets, VMWAREPciChipsets, devSections, + numDevSections, drv, &usedChips); + xfree(devSections); + if (numUsed <= 0) + return FALSE; + if (flags & PROBE_DETECT) + foundScreen = TRUE; + else for (i = 0; i < numUsed; i++) { + ScrnInfoPtr pScrn = NULL; + + VmwareLog(("Even some VMware SVGA PCI instances exists\n")); + pScrn = xf86ConfigPciEntity(pScrn, flags, usedChips[i], + VMWAREPciChipsets, NULL, NULL, NULL, + NULL, NULL); + if (pScrn) { + VmwareLog(("And even configuration suceeded\n")); + pScrn->driverVersion = VERSION; + pScrn->driverName = VMWARE_DRIVER_NAME; + pScrn->name = VMWARE_NAME; + pScrn->Probe = VMWAREProbe; + pScrn->PreInit = VMWAREPreInit; + pScrn->ScreenInit = VMWAREScreenInit; + pScrn->SwitchMode = VMWARESwitchMode; + pScrn->AdjustFrame = VMWAREAdjustFrame; + pScrn->EnterVT = VMWAREEnterVT; + pScrn->LeaveVT = VMWARELeaveVT; + pScrn->FreeScreen = VMWAREFreeScreen; + pScrn->ValidMode = VMWAREValidMode; + foundScreen = TRUE; + } + } + xfree(usedChips); + } + return foundScreen; +} + +DriverRec VMWARE = { + VERSION, + VMWARE_DRIVER_NAME, + VMWAREIdentify, + VMWAREProbe, + VMWAREAvailableOptions, + NULL, + 0 +}; + +#ifdef XFree86LOADER +static MODULESETUPPROTO(vmwareSetup); + +XF86ModuleData vmwareModuleData = { &vmwareVersRec, vmwareSetup, NULL }; + +static pointer +vmwareSetup(pointer module, pointer opts, int *errmaj, int *errmin) +{ + static Bool setupDone = FALSE; + + if (!setupDone) { + setupDone = TRUE; + xf86AddDriver(&VMWARE, module, 0); + return (pointer)1; + } + if (errmaj) { + *errmaj = LDR_ONCEONLY; + } + return NULL; +} +#endif /* XFree86LOADER */ + +ScreenPtr funcglob; +ScrnInfoPtr scrnglob; +int vmwareGCPrivateIndex; + +static void +ScreenToPrivate(ScreenPtr pScreen, ScrnInfoPtr pScrn) +{ + VMWAREPtr pVMWARE = VMWAREPTR(pScrn); + + pVMWARE->ScrnFuncs = *pScreen; + funcglob = &pVMWARE->ScrnFuncs; + scrnglob = pScrn; + + pScreen->CloseScreen = VMWARECloseScreen; + pScreen->SaveScreen = VMWARESaveScreen; + +#if 0 + pScreen->QueryBestSize = vmwareQueryBestSize; + pScreen->GetImage = vmwareGetImage; + pScreen->GetSpans = vmwareGetSpans; + pScreen->PointerNonInterestBox = vmwarePointerNonInterestBox; + pScreen->SourceValidate = vmwareSourceValidate; + + pScreen->CreateWindow = vmwareCreateWindow; + pScreen->DestroyWindow = vmwareDestroyWindow; + pScreen->PositionWindow = vmwarePositionWindow; + pScreen->ChangeWindowAttributes = vmwareChangeWindowAttributes; + pScreen->RealizeWindow = vmwareRealizeWindow; + pScreen->UnrealizeWindow = vmwareUnrealizeWindow; + pScreen->ValidateTree = vmwareValidateTree; +// pScreen->PostValidateTree = vmwarePostValidateTree; + pScreen->WindowExposures = vmwareWindowExposures; + pScreen->PaintWindowBackground = vmwarePaintWindowBackground; + pScreen->PaintWindowBorder = vmwarePaintWindowBorder; + pScreen->CopyWindow = vmwareCopyWindow; + pScreen->ClearToBackground = vmwareClearToBackground; + pScreen->ClipNotify = vmwareClipNotify; + pScreen->RestackWindow = vmwareRestackWindow; + + /* Pixmap procedures */ + + pScreen->CreatePixmap = vmwareCreatePixmap; + pScreen->DestroyPixmap = vmwareDestroyPixmap; + + /* Backing store procedures */ + + pScreen->SaveDoomedAreas = vmwareSaveDoomedAreas; + pScreen->RestoreAreas = vmwareRestoreAreas; + pScreen->ExposeCopy = vmwareExposeCopy; + pScreen->TranslateBackingStore = vmwareTranslateBackingStore; + pScreen->ClearBackingStore = vmwareClearBackingStore; + pScreen->DrawGuarantee = vmwareDrawGuarantee; + /* + * A read/write copy of the lower level backing store vector is needed now + * that the functions can be wrapped. + */ +// pScreen->BackingStoreFuncs = vmwareBackingStoreFuncs; + + /* Font procedures */ + + pScreen->RealizeFont = vmwareRealizeFont; + pScreen->UnrealizeFont = vmwareUnrealizeFont; + + /* Cursor Procedures */ + + pScreen->ConstrainCursor = vmwareConstrainCursor; + pScreen->CursorLimits = vmwareCursorLimits; + pScreen->DisplayCursor = vmwareDisplayCursor; + pScreen->RealizeCursor = vmwareRealizeCursor; + pScreen->UnrealizeCursor = vmwareUnrealizeCursor; + pScreen->RecolorCursor = vmwareRecolorCursor; + pScreen->SetCursorPosition = vmwareSetCursorPosition; + + /* GC procedures */ + + pScreen->CreateGC = vmwareCreateGC; + + /* Colormap procedures */ + + pScreen->CreateColormap = vmwareCreateColormap; + pScreen->DestroyColormap = vmwareDestroyColormap; + pScreen->InstallColormap = vmwareInstallColormap; + pScreen->UninstallColormap = vmwareUninstallColormap; + pScreen->ListInstalledColormaps = vmwareListInstalledColormaps; + pScreen->StoreColors = vmwareStoreColors; + pScreen->ResolveColor = vmwareResolveColor; + + + pScreen->GetWindowPixmap = vmwareGetWindowPixmap; + pScreen->SetWindowPixmap = vmwareSetWindowPixmap; + pScreen->GetScreenPixmap = vmwareGetScreenPixmap; + pScreen->SetScreenPixmap = vmwareSetScreenPixmap; + +#endif + + pScreen->PaintWindowBackground = vmwarePaintWindow; + pScreen->PaintWindowBorder = vmwarePaintWindow; + pScreen->CopyWindow = vmwareCopyWindow; + pScreen->CreateGC = vmwareCreateGC; + pScreen->GetSpans = vmwareGetSpans; + pScreen->GetImage = vmwareGetImage; + pScreen->BlockHandler = vmwareBlockHandler; + pScreen->SaveDoomedAreas = vmwareSaveDoomedAreas; + pScreen->RestoreAreas = vmwareRestoreAreas; + + vmwareGCPrivateIndex = AllocateGCPrivateIndex(); + if (!AllocateGCPrivate(pScreen, vmwareGCPrivateIndex, + sizeof(vmwarePrivGC))) return; + + + switch (pScrn->bitsPerPixel) { + case 8: + pVMWARE->Pmsk = 0x000000FF; + break; + case 16: + pVMWARE->Pmsk = 0x0000FFFF; + break; + case 24: + pVMWARE->Pmsk = 0x00FFFFFF; + break; + case 32: + pVMWARE->Pmsk = 0xFFFFFFFF; + break; + } +} + +static void ScreenFromPrivate(ScreenPtr pScreen, ScrnInfoPtr p) +{ + VMWAREPtr pVMWARE = VMWAREPTR(p); + ScreenPtr save = &pVMWARE->ScrnFuncs; + + /* Random screen procedures */ + + pScreen->CloseScreen = save->CloseScreen; + pScreen->QueryBestSize = save->QueryBestSize; + pScreen->SaveScreen = save->SaveScreen; + pScreen->GetImage = save->GetImage; + pScreen->GetSpans = save->GetSpans; + pScreen->PointerNonInterestBox = save->PointerNonInterestBox; + pScreen->SourceValidate = save->SourceValidate; + + /* Window Procedures */ + + pScreen->CreateWindow = save->CreateWindow; + pScreen->DestroyWindow = save->DestroyWindow; + pScreen->PositionWindow = save->PositionWindow; + pScreen->ChangeWindowAttributes = save->ChangeWindowAttributes; + pScreen->RealizeWindow = save->RealizeWindow; + pScreen->UnrealizeWindow = save->UnrealizeWindow; + pScreen->ValidateTree = save->ValidateTree; + pScreen->PostValidateTree = save->PostValidateTree; + pScreen->WindowExposures = save->WindowExposures; + pScreen->PaintWindowBackground = save->PaintWindowBackground; + pScreen->PaintWindowBorder = save->PaintWindowBorder; + pScreen->CopyWindow = save->CopyWindow; + pScreen->ClearToBackground = save->ClearToBackground; + pScreen->ClipNotify = save->ClipNotify; + pScreen->RestackWindow = save->RestackWindow; + + /* Pixmap procedures */ + + pScreen->CreatePixmap = save->CreatePixmap; + pScreen->DestroyPixmap = save->DestroyPixmap; + + /* Backing store procedures */ + + pScreen->SaveDoomedAreas = save->SaveDoomedAreas; + pScreen->RestoreAreas = save->RestoreAreas; + pScreen->ExposeCopy = save->ExposeCopy; + pScreen->TranslateBackingStore = save->TranslateBackingStore; + pScreen->ClearBackingStore = save->ClearBackingStore; + pScreen->DrawGuarantee = save->DrawGuarantee; + /* + * A read/write copy of the lower level backing store vector is needed now + * that the functions can be wrapped. + */ + pScreen->BackingStoreFuncs = save->BackingStoreFuncs; + + /* Font procedures */ + + pScreen->RealizeFont = save->RealizeFont; + pScreen->UnrealizeFont = save->UnrealizeFont; + + /* Cursor Procedures */ + + pScreen->ConstrainCursor = save->ConstrainCursor; + pScreen->CursorLimits = save->CursorLimits; + pScreen->DisplayCursor = save->DisplayCursor; + pScreen->RealizeCursor = save->RealizeCursor; + pScreen->UnrealizeCursor = save->UnrealizeCursor; + pScreen->RecolorCursor = save->RecolorCursor; + pScreen->SetCursorPosition = save->SetCursorPosition; + + /* GC procedures */ + + pScreen->CreateGC = save->CreateGC; + + /* Colormap procedures */ + + pScreen->CreateColormap = save->CreateColormap; + pScreen->DestroyColormap = save->DestroyColormap; + pScreen->InstallColormap = save->InstallColormap; + pScreen->UninstallColormap = save->UninstallColormap; + pScreen->ListInstalledColormaps = save->ListInstalledColormaps; + pScreen->StoreColors = save->StoreColors; + pScreen->ResolveColor = save->ResolveColor; + + /* Region procedures */ + +#ifdef NEED_SCREEN_REGIONS + pScreen->RegionCreate = save->RegionCreate; + pScreen->RegionInit = save->RegionInit; + pScreen->RegionCopy = save->RegionCopy; + pScreen->RegionDestroy = save->RegionDestroy; + pScreen->RegionUninit = save->RegionUninit; + pScreen->Intersect = save->Intersect; + pScreen->Union = save->Union; + pScreen->Subtract = save->Subtract; + pScreen->Inverse = save->Inverse; + pScreen->RegionReset = save->RegionReset; + pScreen->TranslateRegion = save->TranslateRegion; + pScreen->RectIn = save->RectIn; + pScreen->PointInRegion = save->PointInRegion; + pScreen->RegionNotEmpty = save->RegionNotEmpty; + pScreen->RegionBroken = save->RegionBroken; + pScreen->RegionBreak = save->RegionBreak; + pScreen->RegionEmpty = save->RegionEmpty; + pScreen->RegionExtents = save->RegionExtents; + pScreen->RegionAppend = save->RegionAppend; + pScreen->RegionValidate = save->RegionValidate; +#endif /* NEED_SCREEN_REGIONS */ + pScreen->BitmapToRegion = save->BitmapToRegion; +#ifdef NEED_SCREEN_REGIONS + pScreen->RectsToRegion = save->RectsToRegion; +#endif /* NEED_SCREEN_REGIONS */ + pScreen->SendGraphicsExpose = save->SendGraphicsExpose; + + /* os layer procedures */ + + pScreen->BlockHandler = save->BlockHandler; + pScreen->WakeupHandler = save->WakeupHandler; + + pScreen->CreateScreenResources = save->CreateScreenResources; + pScreen->ModifyPixmapHeader = save->ModifyPixmapHeader; + + pScreen->GetWindowPixmap = save->GetWindowPixmap; + pScreen->SetWindowPixmap = save->SetWindowPixmap; + pScreen->GetScreenPixmap = save->GetScreenPixmap; + pScreen->SetScreenPixmap = save->SetScreenPixmap; + + pScreen->MarkWindow = save->MarkWindow; + pScreen->MarkOverlappedWindows = save->MarkOverlappedWindows; + pScreen->ChangeSaveUnder = save->ChangeSaveUnder; + pScreen->PostChangeSaveUnder = save->PostChangeSaveUnder; + pScreen->MoveWindow = save->MoveWindow; + pScreen->ResizeWindow = save->ResizeWindow; + pScreen->GetLayerWindow = save->GetLayerWindow; + pScreen->HandleExposures = save->HandleExposures; + pScreen->ReparentWindow = save->ReparentWindow; + +#ifdef SHAPE + pScreen->SetShape = save->SetShape; +#endif /* SHAPE */ + + pScreen->ChangeBorderWidth = save->ChangeBorderWidth; + pScreen->MarkUnrealizedWindow = save->MarkUnrealizedWindow; +} + Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h:1.2 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h Wed May 16 02:48:12 2001 @@ -0,0 +1,756 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * Id: vmware.h,v 1.6 2001/01/30 18:13:47 bennett Exp $ + * **********************************************************/ +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.h,v 1.2 2001/05/16 06:48:12 keithp Exp $ */ + +#ifndef VMWARE_H +#define VMWARE_H + +#include "xf86.h" +#include "xf86_OSproc.h" +#include "xf86_ansic.h" +#include "xf86Resources.h" + +#include "compiler.h" /* inb/outb */ + +#include "xf86PciInfo.h" /* pci vendor id */ +#include "xf86Pci.h" /* pci */ + +#include "mipointer.h" /* sw cursor */ +#include "mibstore.h" /* backing store */ +#include "micmap.h" /* mi color map */ +#include "vgaHW.h" /* VGA hardware */ +#include "fb.h" + +#include "xf86cmap.h" /* xf86HandleColormaps */ + +#include "vm_basic_types.h" +#include "svga_reg.h" + +typedef struct { + CARD32 svga_reg_enable; + CARD32 svga_reg_width; + CARD32 svga_reg_height; +} VMWARERegRec, *VMWARERegPtr; + +typedef struct { + DisplayModePtr mode; +} VMWAREFBLayout; + +typedef struct { + EntityInfoPtr pEnt; + pciVideoPtr PciInfo; + PCITAG PciTag; + Bool Primary; + int depth; + int bitsPerPixel; + rgb weight; + rgb offset; + int defaultVisual; + int videoRam; + unsigned long memPhysBase; + unsigned long fbOffset; + unsigned long fbPitch; + unsigned long ioBase; + int maxWidth; + int maxHeight; + unsigned int vmwareCapability; + + unsigned char* FbBase; + unsigned long FbSize; + + VMWARERegRec SavedReg; + VMWARERegRec ModeReg; + + VMWAREFBLayout CurrentLayout; + Bool noAccel; + Bool hwCursor; + Bool cursorDefined; + Bool mouseHidden; + + unsigned long mmioPhysBase; + unsigned long mmioSize; + + unsigned char* mmioVirtBase; + CARD32* vmwareFIFO; + Bool vmwareFIFOMarkSet; + BoxRec vmwareAccelArea; + struct { + BoxRec Box; + unsigned int Width; + unsigned int Height; + unsigned int XHot; + unsigned int YHot; + } Mouse; + Bool checkCursorColor; + unsigned int vmwareBBLevel; + unsigned long Pmsk; + + uint16 indexReg, valueReg; + + ScreenRec ScrnFuncs; + /* ... */ +} VMWARERec, *VMWAREPtr; + +#define VMWAREPTR(p) ((VMWAREPtr)((p)->driverPrivate)) + +static __inline ScrnInfoPtr infoFromScreen(ScreenPtr s) { + return xf86Screens[s->myNum]; +} + +#include "gcstruct.h" + +#define MIN(a,b) ((a)<(b)?(a):(b)) +#define MAX(a,b) ((a)>(b)?(a):(b)) + +#define GC_FUNC_PROLOGUE(pGC) \ +{ \ + vmwarePrivGCPtr pGCPriv = (vmwarePrivGCPtr) (pGC)->devPrivates[vmwareGCPrivateIndex].ptr; \ + (pGC)->funcs = pGCPriv->wrapFuncs; \ + (pGC)->ops = pGCPriv->wrapOps; \ +} + +#define GC_FUNC_EPILOGUE(pGC) \ +{ \ + vmwarePrivGCPtr pGCPriv = (vmwarePrivGCPtr) (pGC)->devPrivates[vmwareGCPrivateIndex].ptr; \ + pGCPriv->wrapFuncs = (pGC)->funcs; \ + (pGC)->funcs = &vmwareGCFuncs; \ + pGCPriv->wrapOps = (pGC)->ops; \ + (pGC)->ops = &vmwareGCOps; \ +} + +#define GC_OPS(pGC) ((vmwarePrivGCPtr) (pGC)->devPrivates[vmwareGCPrivateIndex].ptr)->wrapOps + +#define MOUSE_ID 1 + +#define UPDATE_ACCEL_AREA(pVMWARE,box) \ +{ \ + if (!(pVMWARE)->vmwareFIFOMarkSet) { \ + (pVMWARE)->vmwareFIFOMarkSet = TRUE; \ + (pVMWARE)->vmwareAccelArea.x1 = (box).x1; \ + (pVMWARE)->vmwareAccelArea.y1 = (box).y1; \ + (pVMWARE)->vmwareAccelArea.x2 = (box).x2; \ + (pVMWARE)->vmwareAccelArea.y2 = (box).y2; \ + } else { \ + if ((box).x1 < (pVMWARE)->vmwareAccelArea.x1) \ + (pVMWARE)->vmwareAccelArea.x1 = (box).x1; \ + if ((box).y1 < (pVMWARE)->vmwareAccelArea.y1) \ + (pVMWARE)->vmwareAccelArea.y1 = (box).y1; \ + if ((box).x2 > (pVMWARE)->vmwareAccelArea.x2) \ + (pVMWARE)->vmwareAccelArea.x2 = (box).x2; \ + if ((box).y2 > (pVMWARE)->vmwareAccelArea.y2) \ + (pVMWARE)->vmwareAccelArea.y2 = (box).y2; \ + } \ +} + +#define ABS(x) (((x) >= 0) ? (x) : -(x)) +#define BOX_INTERSECT(a, b) \ + (ABS(((a).x1 + (a).x2) - ((b).x1 + (b).x2)) <= \ + ((a).x2 - (a).x1) + ((b).x2 - (b).x1) && \ + ABS(((a).y1 + (a).y2) - ((b).y1 + (b).y2)) <= \ + ((a).y2 - (a).y1) + ((b).y2 - (b).y1)) + +#define HIDE_CURSOR(vmPtr,box) \ +{ \ + if (!(vmPtr)->mouseHidden) { \ + if ((vmPtr)->hwCursor && (vmPtr)->cursorDefined && \ + BOX_INTERSECT((vmPtr)->Mouse.Box, box)) { \ + (vmPtr)->mouseHidden = TRUE; \ + if ((vmPtr)->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { \ + vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ID, MOUSE_ID); \ + vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ON, 0); \ + } else { \ + vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ + vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ + vmwareWriteWordToFIFO(vmPtr, 0); \ + UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \ + } \ + } \ + } \ +} + +#define HIDE_CURSOR_ACCEL(vmPtr,box) \ +{ \ + if (!(vmPtr)->mouseHidden) { \ + if ((vmPtr)->hwCursor && (vmPtr)->cursorDefined && \ + !((vmPtr)->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) && \ + BOX_INTERSECT((vmPtr)->Mouse.Box, box)) { \ + (vmPtr)->mouseHidden = TRUE; \ + vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ + vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ + vmwareWriteWordToFIFO(vmPtr, 0); \ + UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \ + } \ + } \ +} + + +#define SHOW_CURSOR(vmPtr,box) \ +{ \ + if ((vmPtr)->mouseHidden) { \ + if ((vmPtr)->hwCursor && (vmPtr)->cursorDefined && \ + BOX_INTERSECT((vmPtr)->Mouse.Box, box)) { \ + (vmPtr)->mouseHidden = FALSE; \ + if ((vmPtr)->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { \ + vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ID, MOUSE_ID); \ + vmwareWriteReg(vmPtr, SVGA_REG_CURSOR_ON, 1); \ + } else { \ + vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ + vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ + vmwareWriteWordToFIFO(vmPtr, 1); \ + UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \ + } \ + } \ + } \ +} + +/* Only use this for debugging */ + +#define HIDE_CURSOR_ALWAYS(vmPtr,box) \ +{ \ + vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ + vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ + vmwareWriteWordToFIFO(vmPtr, 0); \ + (vmPtr)->mouseHidden = TRUE; \ + vmwareFIFOMarkSet = TRUE; \ + UPDATE_ACCEL_AREA(vmPtr,(vmPtr)->Mouse.Box); \ +} + +#define SHOW_CURSOR_ALWAYS(vmPtr,box) \ +{ \ + vmwareWriteWordToFIFO(vmPtr, SVGA_CMD_DISPLAY_CURSOR); \ + vmwareWriteWordToFIFO(vmPtr, MOUSE_ID); \ + vmwareWriteWordToFIFO(vmPtr, 1); \ + (vmPtr)->mouseHidden = FALSE; \ + vmwareFIFOMarkSet = TRUE; \ +} + +/*#define DEBUG_LOGGING*/ +#undef DEBUG_LOGGING +#ifdef DEBUG_LOGGING +#define VmwareLog(args) ErrorF args +#define TRACEPOINT VmwareLog((__FUNCTION__ ":" __FILE__ "\n")); +#else +#define VmwareLog(args) +#define TRACEPOINT +#endif + +/* Undefine this to kill all acceleration */ +#define ACCELERATE_OPS + +typedef struct vmwarePrivGC +{ + GCFuncs *wrapFuncs; + GCOps *wrapOps; +} +vmwarePrivGC, *vmwarePrivGCPtr; + + +extern int vmwareGCPrivateIndex; + +#define GEN_FUNC_WRAPPER(cond,init,setBB,op) \ + if ((cond)) { \ + init; \ + \ + if (pVMWARE->vmwareBBLevel == 0) { \ + BoxRec BB; \ + \ + setBB; \ + HIDE_CURSOR(pVMWARE, BB); \ + vmwareWaitForFB(pVMWARE); \ + pVMWARE->vmwareBBLevel++; \ + op; \ + pVMWARE->vmwareBBLevel--; \ + vmwareSendSVGACmdUpdate(pVMWARE, &BB); \ + SHOW_CURSOR(pVMWARE, BB); \ + } else { \ + vmwareWaitForFB(pVMWARE); \ + op; \ + } \ + } else { \ + op; \ + } +#define VM_FUNC_WRAPPER(cond,setBB,op) \ + GEN_FUNC_WRAPPER(cond,,setBB,op) + +#define GC_FUNC_WRAPPER(cond,screen,setBB,op) \ + GEN_FUNC_WRAPPER(cond, VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(screen)), setBB, op) + +#define GC_FUNC_ACCEL_WRAPPER(cond,screen,setBB,accelcond,accel,op) \ + GEN_FUNC_WRAPPER(cond, \ + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(screen)); \ + if (accelcond) { \ + BoxRec BB; \ + Bool hidden = pVMWARE->mouseHidden; \ + \ + setBB; \ + if (!hidden) { \ + HIDE_CURSOR_ACCEL(pVMWARE, BB); \ + } \ + accel; \ + if (!hidden) { \ + SHOW_CURSOR(pVMWARE, BB); \ + } \ + UPDATE_ACCEL_AREA(pVMWARE, BB); \ + return; \ + }, \ + setBB, op) + +void vmwareWriteReg( +#if NeedFunctionPrototypes + VMWAREPtr pVMWARE, int index, CARD32 value +#endif + ); + +void vmwareWriteWordToFIFO( +#if NeedFunctionPrototypes + VMWAREPtr pVMWARE, CARD32 value +#endif + ); + +void vmwareWaitForFB( +#ifdef NeedFunctionPrototypes + VMWAREPtr pVMWARE +#endif + ); + +void vmwareSendSVGACmdUpdate( +#if NeedFunctionPrototypes + VMWAREPtr pVMWARE, BoxPtr pBB +#endif + ); + +/* vmwaregc.c */ + +void vmwareInitGC( +#if NeedFunctionPrototypes + void +#endif + ); + +Bool vmwareCreateGC( +#if NeedFunctionPrototypes + GCPtr pGC +#endif + ); + +void vmwareValidateGC( +#if NeedFunctionPrototypes + GCPtr pGC, unsigned long changes, DrawablePtr pDrawable +#endif + ); + +void vmwareChangeGC( +#if NeedFunctionPrototypes + GCPtr pGC, unsigned long changes +#endif + ); + +void vmwareCopyGC( +#if NeedFunctionPrototypes + GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst +#endif + ); + +void vmwareDestroyGC( +#if NeedFunctionPrototypes + GCPtr pGC +#endif + ); + +void vmwareChangeClip( +#if NeedFunctionPrototypes + GCPtr pGC, int type, pointer pValue, int nrects +#endif + ); + +void vmwareDestroyClip( +#if NeedFunctionPrototypes + GCPtr pGC +#endif + ); + +void vmwareCopyClip( +#if NeedFunctionPrototypes + GCPtr pGCDst, GCPtr pGCSrc +#endif + ); + +/* vmwareinit.c */ + +void vmwareInitEnvironment( +#if NeedFunctionPrototypes + void +#endif + ); + +void vmwareInitDisplay( +#if NeedFunctionPrototypes + int screen_idx +#endif + ); + +void vmwareCleanUp( +#if NeedFunctionPrototypes + void +#endif + ); + +/* vmwarescrin.c */ +CARD32 vmwareCalculateOffset(CARD32 mask); + +Bool vmwareScreenInit( +#if NeedFunctionPrototypes + ScreenPtr pScreen, + pointer pbits, int xsize, int ysize, int dpix, int dpiy, int width +#endif + ); + +/* vmwarevga.c */ + +void vmwareSaveVGAInfo( +#if NeedFunctionPrototypes + int screen_idx +#endif + ); + +void vmwareRestoreVGAInfo( +#if NeedFunctionPrototypes + void +#endif + ); + +/* vmwarecmap.c */ + +void vmwareSetPaletteBase( +#if NeedFunctionPrototypes + int pal +#endif + ); + +int vmwareListInstalledColormaps( +#if NeedFunctionPrototypes + ScreenPtr pScreen, Colormap * pmaps +#endif + ); + +int vmwareGetInstalledColormaps( +#if NeedFunctionPrototypes + ScreenPtr pScreen, ColormapPtr * pmap +#endif + ); + +void vmwareStoreColors( +#if NeedFunctionPrototypes + ColormapPtr pmap, int ndef, xColorItem * pdefs +#endif + ); + +void vmwareInstallColormap( +#if NeedFunctionPrototypes + ColormapPtr pmap +#endif + ); + +void vmwareUninstallColormap( +#if NeedFunctionPrototypes + ColormapPtr pmap +#endif + ); + +void vmwareRestoreColor0( +#if NeedFunctionPrototypes + ScreenPtr pScreen +#endif + ); + +/* vmwarecurs.c */ +Bool vmwareCursorInit( +#if NeedFunctionPrototypes + char *pm, ScreenPtr pScr +#endif + ); + +Bool vmwareRealizeCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr, CursorPtr pCurs +#endif + ); + +Bool vmwareUnrealizeCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr, CursorPtr pCurs +#endif + ); + +void vmwareSetCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr, CursorPtr pCurs, int x, int y +#endif + ); + +void vmwareRepositionCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr +#endif + ); + +void vmwareRestoreCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr +#endif + ); + +void vmwareMoveCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr, int x, int y +#endif + ); + +void vmwareRenewCursorColor( +#if NeedFunctionPrototypes + ScreenPtr pScr +#endif + ); + +void vmwareRecolorCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr, CursorPtr pCurs, Bool displayed +#endif + ); + +void vmwareWarpCursor( +#if NeedFunctionPrototypes + ScreenPtr pScr, int x, int y +#endif + ); + +void vmwareQueryBestSize( +#if NeedFunctionPrototypes + int class, unsigned short *pwidth, unsigned short *pheight, ScreenPtr pScr +#endif + ); + +void vmwareCursorOff( +#if NeedFunctionPrototypes + VMWAREPtr pVMWARE +#endif + ); + +void vmwareClearSavedCursor( +#if NeedFunctionPrototypes + int scr_index +#endif + ); + +void vmwareBlockHandler( +#if NeedFunctionPrototypes + int i, pointer blockData, pointer pTimeout, pointer pReadmask +#endif + ); + +/* BEGIN Screen functions that draw */ + +void vmwareCopyWindow( +#if NeedFunctionPrototypes + WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc +#endif + ); + +void vmwarePaintWindow( +#if NeedFunctionPrototypes + WindowPtr pWindow, RegionPtr pRegion, int what +#endif + ); + +void vmwareGetSpans( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + int wMax, DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst +#endif + ); + +void vmwareGetImage( +#if NeedFunctionPrototypes + DrawablePtr src, + int x, + int y, + int w, + int h, unsigned int format, unsigned long planeMask, char *pBinImage +#endif + ); + +void vmwareSaveDoomedAreas( +#if NeedFunctionPrototypes + WindowPtr pWin, RegionPtr prgnSave, int xorg, int yorg +#endif + ); + +RegionPtr vmwareRestoreAreas( +#if NeedFunctionPrototypes + WindowPtr pWin, + RegionPtr prgnRestore +#endif + ); + +/* END Screen functions that draw */ + +/* BEGIN GCOps */ + +void vmwareFillSpans( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted +#endif + ); + +void vmwareSetSpans( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, + char *psrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted +#endif + ); + +void vmwarePutImage( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, + int depth, + int x, int y, int w, int h, int leftPad, int format, char *pBits +#endif + ); + +void +vmwareDoBitblt(DrawablePtr pSrc, + DrawablePtr pDst, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure); + +RegionPtr vmwareCopyArea( +#if NeedFunctionPrototypes + DrawablePtr pSrc, + DrawablePtr pDst, + GCPtr pGC, int srcx, int srcy, int w, int h, int dstx, int dsty +#endif + ); + +RegionPtr vmwareCopyPlane( +#if NeedFunctionPrototypes + DrawablePtr pSrcDrawable, + DrawablePtr pDstDrawable, + GCPtr pGC, + int srcx, + int srcy, + int width, int height, int dstx, int dsty, unsigned long bitPlane +#endif + ); + +void vmwarePolyPoint( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit +#endif + ); + +void vmwarePolylines( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, DDXPointPtr pptInit +#endif + ); + +void vmwarePolySegment( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int nseg, xSegment * pSegs +#endif + ); + +void vmwarePolyRectangle( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int nrects, xRectangle * pRects +#endif + ); + +void vmwarePolyArc( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs +#endif + ); + +void vmwareFillPolygon( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts +#endif + ); + +void vmwarePolyFillRect( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int nrectFill, xRectangle * prectInit +#endif + ); + +void vmwarePolyFillArc( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs +#endif + ); + +int vmwarePolyText8( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars +#endif + ); + +int vmwarePolyText16( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, unsigned short *chars +#endif + ); + +void vmwareImageText8( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, GCPtr pGC, int x, int y, int count, char *chars +#endif + ); + +void vmwareImageText16( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, unsigned short *chars +#endif + ); + +void vmwareImageGlyphBlt( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase +#endif + ); + +void vmwarePolyGlyphBlt( +#if NeedFunctionPrototypes + DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase +#endif + ); + +void vmwarePushPixels( +#if NeedFunctionPrototypes + GCPtr pGC, PixmapPtr pBitMap, DrawablePtr pDst, int w, int h, int x, int y +#endif + ); + +/* END GCOps */ +#endif Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man:1.2 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man Fri Apr 6 13:44:58 2001 @@ -0,0 +1,37 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmware.man,v 1.2 2001/04/06 17:44:58 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH VMWARE __drivermansuffix__ __vendorversion__ +.SH NAME +vmware \- VMware SVGA video driver +.SH SYNOPSIS +.nf +.B "Section \*qDevice\*q" +.BI " Identifier \*q" devname \*q +.B " Driver \*qvmware\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B vmware +is an XFree86 driver for VMware virtual video cards. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details. This section only covers configuration details specific to this +driver. +.PP +The driver auto-detects the version of any virtual VMware SVGA adapter. +.PP +The following driver +.B Options +are supported: +.TP +.BI "Option \*qHWCursor\*q \*q" boolean \*q +Enable or disable the HW cursor. Default: off. +.TP +.BI "Option \*qNoAccel\*q \*q" boolean \*q +Disable or enable acceleration. Default: acceleration is enabled. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__) +.SH AUTHORS +Copyright (c) 1999-2001 VMware, Inc. Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c:1.2 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c Wed May 16 02:48:12 2001 @@ -0,0 +1,262 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwareblt[] = + + "Id: vmwareblt.c,v 1.4 2001/01/27 00:28:15 bennett Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareblt.c,v 1.2 2001/05/16 06:48:12 keithp Exp $ */ + +#include "X.h" +#include "fb.h" +#include "vmware.h" + +void +vmwareDoBitblt(DrawablePtr pSrc, + DrawablePtr pDst, + GCPtr pGC, + BoxPtr pbox, + int nbox, + int dx, + int dy, + Bool reverse, + Bool upsidedown, + Pixel bitplane, + void *closure) +{ + BoxPtr pboxTmp, pboxNext, pboxBase, pboxNew1, pboxNew2; + VMWAREPtr pVMWARE; + CARD8 alu; + + pVMWARE = VMWAREPTR(infoFromScreen(pSrc->pScreen)); + if (pGC) + alu = pGC->alu; + else + alu = GXcopy; + + pboxNew1 = NULL; + pboxNew2 = NULL; + if (upsidedown) { + if (nbox > 1) { + /* keep ordering in each band, reverse order of bands */ + pboxNew1 = (BoxPtr) ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); + if (!pboxNew1) + return; + pboxBase = pboxNext = pbox + nbox - 1; + while (pboxBase >= pbox) { + while ((pboxNext >= pbox) && (pboxBase->y1 == pboxNext->y1)) + pboxNext--; + pboxTmp = pboxNext + 1; + while (pboxTmp <= pboxBase) { + *pboxNew1++ = *pboxTmp++; + } + pboxBase = pboxNext; + } + pboxNew1 -= nbox; + pbox = pboxNew1; + } + } + if (reverse) { + if (nbox > 1) { + /* reverse order of rects in each band */ + pboxNew2 = (BoxPtr) ALLOCATE_LOCAL(sizeof(BoxRec) * nbox); + if (!pboxNew2) { + if (pboxNew2) + DEALLOCATE_LOCAL(pboxNew2); + if (pboxNew1) + DEALLOCATE_LOCAL(pboxNew1); + return; + } + pboxBase = pboxNext = pbox; + while (pboxBase < pbox + nbox) { + while ((pboxNext < pbox + nbox) && + (pboxNext->y1 == pboxBase->y1)) pboxNext++; + pboxTmp = pboxNext; + while (pboxTmp != pboxBase) { + *pboxNew2++ = *--pboxTmp; + } + pboxBase = pboxNext; + } + pboxNew2 -= nbox; + pbox = pboxNew2; + } + } + /* Send the commands */ + while (nbox--) { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_ROP_COPY); + vmwareWriteWordToFIFO(pVMWARE, pbox->x1 + dx); + vmwareWriteWordToFIFO(pVMWARE, pbox->y1 + dy); + vmwareWriteWordToFIFO(pVMWARE, pbox->x1); + vmwareWriteWordToFIFO(pVMWARE, pbox->y1); + vmwareWriteWordToFIFO(pVMWARE, pbox->x2 - pbox->x1); + vmwareWriteWordToFIFO(pVMWARE, pbox->y2 - pbox->y1); + vmwareWriteWordToFIFO(pVMWARE, pGC->alu); + pbox++; + } + if (pboxNew2) { + DEALLOCATE_LOCAL(pboxNew2); + } + if (pboxNew1) { + DEALLOCATE_LOCAL(pboxNew1); + } +} + +RegionPtr +vmwareCopyArea(DrawablePtr pSrcDrawable, +DrawablePtr pDstDrawable, +GCPtr pGC, int srcx, int srcy, int width, int height, int dstx, int dsty) +{ + RegionPtr prgn; + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pGC->pScreen)); + + TRACEPOINT + if ((pVMWARE->vmwareCapability & SVGA_CAP_RECT_COPY) && + (pGC->alu == GXcopy || (pVMWARE->vmwareCapability & SVGA_CAP_RASTER_OP)) && + pSrcDrawable->type == DRAWABLE_WINDOW && + pDstDrawable->type == DRAWABLE_WINDOW && + (pGC->planemask & pVMWARE->Pmsk) == pVMWARE->Pmsk) { + fbCopyProc doBitBlt; + BoxRec updateBB; + BoxRec mouseBB; + Bool hidden = pVMWARE->mouseHidden; + + updateBB.x1 = pDstDrawable->x + dstx; + updateBB.y1 = pDstDrawable->y + dsty; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB.x1 = MIN(pSrcDrawable->x + srcx, pDstDrawable->x + dstx); + mouseBB.y1 = MIN(pSrcDrawable->y + srcy, pDstDrawable->y + dsty); + mouseBB.x2 = MAX(pSrcDrawable->x + srcx, pDstDrawable->x + dstx) + width; + mouseBB.y2 = MAX(pSrcDrawable->y + srcy, pDstDrawable->y + dsty) + height; + doBitBlt = vmwareDoBitblt; + if (!hidden) { + HIDE_CURSOR_ACCEL(pVMWARE, mouseBB); + } + prgn = fbDoCopy (pSrcDrawable, pDstDrawable, pGC, srcx, srcy, width, + height, dstx, dsty, doBitBlt, 0, 0); + if (!hidden) { + SHOW_CURSOR(pVMWARE, mouseBB); + } + UPDATE_ACCEL_AREA(pVMWARE, updateBB); + } else if (pDstDrawable->type == DRAWABLE_WINDOW || + pSrcDrawable->type == DRAWABLE_WINDOW) { + if (pVMWARE->vmwareBBLevel == 0) { + BoxRec updateBB; + BoxRec mouseBB; + + if (pDstDrawable->type == DRAWABLE_WINDOW && + pSrcDrawable->type != DRAWABLE_WINDOW) { + updateBB.x1 = pDstDrawable->x + dstx; + updateBB.y1 = pDstDrawable->y + dsty; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB = updateBB; + } else if (pDstDrawable->type != DRAWABLE_WINDOW && + pSrcDrawable->type == DRAWABLE_WINDOW) { + updateBB.x1 = pSrcDrawable->x + srcx; + updateBB.y1 = pSrcDrawable->y + srcy; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB = updateBB; + } else { + updateBB.x1 = pDstDrawable->x + dstx; + updateBB.y1 = pDstDrawable->y + dsty; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB.x1 = MIN(pSrcDrawable->x + srcx, pDstDrawable->x + dstx); + mouseBB.y1 = MIN(pSrcDrawable->y + srcy, pDstDrawable->y + dsty); + mouseBB.x2 = MAX(pSrcDrawable->x + srcx, pDstDrawable->x + dstx) + width; + mouseBB.y2 = MAX(pSrcDrawable->y + srcy, pDstDrawable->y + dsty) + height; + } + HIDE_CURSOR(pVMWARE, mouseBB); + vmwareWaitForFB(pVMWARE); + pVMWARE->vmwareBBLevel++; + prgn = + GC_OPS(pGC)->CopyArea(pSrcDrawable, + pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); + pVMWARE->vmwareBBLevel--; + if (pDstDrawable->type == DRAWABLE_WINDOW) { + vmwareSendSVGACmdUpdate(pVMWARE, &updateBB); + } + SHOW_CURSOR(pVMWARE, mouseBB); + } else { + vmwareWaitForFB(pVMWARE); + prgn = + GC_OPS(pGC)->CopyArea(pSrcDrawable, + pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty); + } + } else { + prgn = + GC_OPS(pGC)->CopyArea(pSrcDrawable, pDstDrawable, + pGC, srcx, srcy, width, height, dstx, dsty); + } + return prgn; +} + +RegionPtr +vmwareCopyPlane(DrawablePtr pSrcDrawable, +DrawablePtr pDstDrawable, +GCPtr pGC, +int srcx, int srcy, int width, int height, int dstx, int dsty, unsigned long bitPlane) +{ + RegionPtr prgn; + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pGC->pScreen)); + + TRACEPOINT + + if (pDstDrawable->type == DRAWABLE_WINDOW || + pSrcDrawable->type == DRAWABLE_WINDOW) { + if (pVMWARE->vmwareBBLevel == 0) { + BoxRec updateBB; + BoxRec mouseBB; + + if (pDstDrawable->type == DRAWABLE_WINDOW && + pSrcDrawable->type != DRAWABLE_WINDOW) { + updateBB.x1 = pDstDrawable->x + dstx; + updateBB.y1 = pDstDrawable->y + dsty; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB = updateBB; + } else if (pDstDrawable->type != DRAWABLE_WINDOW && + pSrcDrawable->type == DRAWABLE_WINDOW) { + updateBB.x1 = pSrcDrawable->x + srcx; + updateBB.y1 = pSrcDrawable->y + srcy; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB = updateBB; + } else { + updateBB.x1 = pDstDrawable->x + dstx; + updateBB.y1 = pDstDrawable->y + dsty; + updateBB.x2 = updateBB.x1 + width; + updateBB.y2 = updateBB.y1 + height; + mouseBB.x1 = MIN(pSrcDrawable->x + srcx, pDstDrawable->x + dstx); + mouseBB.y1 = MIN(pSrcDrawable->y + srcy, pDstDrawable->y + dsty); + mouseBB.x2 = MAX(pSrcDrawable->x + srcx, pDstDrawable->x + dstx) + width; + mouseBB.y2 = MAX(pSrcDrawable->y + srcy, pDstDrawable->y + dsty) + height; + } + HIDE_CURSOR(pVMWARE, mouseBB); + vmwareWaitForFB(pVMWARE); + pVMWARE->vmwareBBLevel++; + prgn = fbCopyPlane(pSrcDrawable, + pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, + bitPlane); + pVMWARE->vmwareBBLevel--; + if (pDstDrawable->type == DRAWABLE_WINDOW) { + vmwareSendSVGACmdUpdate(pVMWARE, &updateBB); + } + SHOW_CURSOR(pVMWARE, mouseBB); + } else { + vmwareWaitForFB(pVMWARE); + prgn = fbCopyPlane(pSrcDrawable, + pDstDrawable, pGC, srcx, srcy, width, height, dstx, dsty, + bitPlane); + } + } else { + prgn = fbCopyPlane(pSrcDrawable, pDstDrawable, + pGC, srcx, srcy, width, height, dstx, dsty, bitPlane); + } + return prgn; +} + Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c Thu Apr 5 15:29:44 2001 @@ -0,0 +1,65 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarebstor[] = + + "Id: vmwarebstor.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarebstor.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +void +vmwareSaveDoomedAreas(WindowPtr pWin, + RegionPtr prgnSave, int xorg, int yorg) +{ + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); + + TRACEPOINT + + if (pVMWARE->vmwareBBLevel == 0) { + BoxRec BB; + + BB = *REGION_EXTENTS(pWin->drawable.pScreen, prgnSave); + BB.x1 += xorg; + BB.x2 += xorg; + BB.y1 += yorg; + BB.y2 += yorg; + HIDE_CURSOR(pVMWARE, BB); + vmwareWaitForFB(pVMWARE); + pVMWARE->vmwareBBLevel++; + pVMWARE->ScrnFuncs.SaveDoomedAreas(pWin, prgnSave, xorg, yorg); + pVMWARE->vmwareBBLevel--; + SHOW_CURSOR(pVMWARE, BB); + } else { + pVMWARE->ScrnFuncs.SaveDoomedAreas(pWin, prgnSave, xorg, yorg); + } +} + +RegionPtr +vmwareRestoreAreas(WindowPtr pWin, + RegionPtr prgnRestore) +{ + RegionPtr res; + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); + + TRACEPOINT + + if (pVMWARE->vmwareBBLevel == 0) { + BoxPtr pBB; + + pBB = REGION_EXTENTS(pWin->drawable.pScreen, prgnRestore); + HIDE_CURSOR(pVMWARE, *pBB); + vmwareWaitForFB(pVMWARE); + pVMWARE->vmwareBBLevel++; + res = pVMWARE->ScrnFuncs.RestoreAreas(pWin, prgnRestore); + pVMWARE->vmwareBBLevel--; + vmwareSendSVGACmdUpdate(pVMWARE, pBB); + SHOW_CURSOR(pVMWARE, *pBB); + } else { + res = pVMWARE->ScrnFuncs.RestoreAreas(pWin, prgnRestore); + } + return res; +} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c Thu Apr 5 15:29:44 2001 @@ -0,0 +1,439 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarecurs[] = + + "Id: vmwarecurs.c,v 1.5 2001/01/30 23:33:02 bennett Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarecurs.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" +#include "cursorstr.h" +#include "bits2pixels.h" + +typedef struct _VMwareCursPriv { + uint8 *bSource; + uint8 *bMask; + uint8 *pSource; + uint8 *pMask; +} VMwareCursPriv; + +static int vmwareCursGeneration = -1; +static CursorPtr vmwareSaveCursors[MAXSCREENS]; + +static miPointerSpriteFuncRec vmwarePointerSpriteFuncs = { + vmwareRealizeCursor, + vmwareUnrealizeCursor, + vmwareSetCursor, + vmwareMoveCursor, +}; + +Bool +vmwareCursorInit(char *pm, + ScreenPtr pScr) +{ + TRACEPOINT + if (vmwareCursGeneration != serverGeneration) { + miPointerScreenFuncPtr xf86scrn = xf86GetPointerScreenFuncs(); + + pScr->QueryBestSize = vmwareQueryBestSize; + if (!(miPointerInitialize(pScr, &vmwarePointerSpriteFuncs, + xf86scrn, FALSE))) + return FALSE; + + pScr->RecolorCursor = vmwareRecolorCursor; + vmwareCursGeneration = serverGeneration; + } + return TRUE; +} + +static void ZeroBits(uint8 *buf, int preserveBits, int totalBits) { + while (preserveBits > 8) { + buf++; + preserveBits -= 8; + totalBits -= 8; + } + *buf &= ~(~0 << preserveBits); + buf++; + preserveBits -= 8; + totalBits -= 8; + while (totalBits > 0) { + *buf++ = 0; + totalBits -= 8; + } +} + +Bool +vmwareRealizeCursor(ScreenPtr pScr, + CursorPtr pCurs) +{ + pointer *pPriv = &pCurs->bits->devPriv[pScr->myNum]; + VMwareCursPriv *cursPriv; + int i; + uint8 *bits; + VMWAREPtr pVMWARE; + + TRACEPOINT + if (pCurs->bits->refcnt > 1) + return TRUE; + cursPriv = (VMwareCursPriv *) xcalloc(1, sizeof(VMwareCursPriv)); + if (!cursPriv) + return FALSE; + cursPriv->bSource = (uint8 *) xcalloc(1, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height); + if (!cursPriv->bSource) { + xfree(cursPriv); + return FALSE; + } + pVMWARE = VMWAREPTR(infoFromScreen(pScr)); + + memcpy(cursPriv->bSource, pCurs->bits->source, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height); + bits = cursPriv->bSource; + /* Handle cursors that do not have zero bits beyond the right edge of each scanline */ + for (i = 0; i < pCurs->bits->height; i++) { + ZeroBits(bits, pCurs->bits->width, PixmapBytePad(pCurs->bits->width, 1) * 8); + bits += PixmapBytePad(pCurs->bits->width, 1); + } + /* Raster_BitsToPixels expects most significant bit first */ + for (i = 0; i < PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height; i++) { + cursPriv->bSource[i] = + (cursPriv->bSource[i] & 0x01) << 7 | + (cursPriv->bSource[i] & 0x02) << 5 | + (cursPriv->bSource[i] & 0x04) << 3 | + (cursPriv->bSource[i] & 0x08) << 1 | + (cursPriv->bSource[i] & 0x10) >> 1 | + (cursPriv->bSource[i] & 0x20) >> 3 | + (cursPriv->bSource[i] & 0x40) >> 5 | + (cursPriv->bSource[i] & 0x80) >> 7; + } + cursPriv->bMask = (uint8 *) xcalloc(1, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height); + if (!cursPriv->bMask) { + xfree(cursPriv->bSource); + xfree(cursPriv); + return FALSE; + } + memcpy(cursPriv->bMask, pCurs->bits->mask, PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height); + bits = cursPriv->bMask; + /* Handle cursors that do not have zero bits beyond the right edge of each scanline */ + for (i = 0; i < pCurs->bits->height; i++) { + ZeroBits(bits, pCurs->bits->width, PixmapBytePad(pCurs->bits->width, 1) * 8); + bits += PixmapBytePad(pCurs->bits->width, 1); + } + for (i = 0; i < PixmapBytePad(pCurs->bits->width, 1) * pCurs->bits->height; i++) { + cursPriv->bMask[i] = + (cursPriv->bMask[i] & 0x01) << 7 | + (cursPriv->bMask[i] & 0x02) << 5 | + (cursPriv->bMask[i] & 0x04) << 3 | + (cursPriv->bMask[i] & 0x08) << 1 | + (cursPriv->bMask[i] & 0x10) >> 1 | + (cursPriv->bMask[i] & 0x20) >> 3 | + (cursPriv->bMask[i] & 0x40) >> 5 | + (cursPriv->bMask[i] & 0x80) >> 7; + } + cursPriv->pSource = (uint8 *) xcalloc(4, SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel)); + if (!cursPriv->pSource) { + xfree(cursPriv->bMask); + xfree(cursPriv->bSource); + xfree(cursPriv); + return FALSE; + } + cursPriv->pMask = (uint8 *) xcalloc(4, SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel)); + if (!cursPriv->pMask) { + xfree(cursPriv->pSource); + xfree(cursPriv->bMask); + xfree(cursPriv->bSource); + xfree(cursPriv); + return FALSE; + } + Raster_BitsToPixels(cursPriv->bMask, PixmapBytePad(pCurs->bits->width, 1), + cursPriv->pMask, 4 * SVGA_PIXMAP_SCANLINE_SIZE(pCurs->bits->width, pVMWARE->bitsPerPixel), + pVMWARE->bitsPerPixel / 8, + pCurs->bits->width, pCurs->bits->height, 0, ~0); + *pPriv = (pointer) cursPriv; + return TRUE; +} + +Bool +vmwareUnrealizeCursor(ScreenPtr pScr, + CursorPtr pCurs) +{ + VMwareCursPriv *cursPriv; + + TRACEPOINT + if (pCurs->bits->refcnt <= 1 && + (cursPriv = pCurs->bits->devPriv[pScr->myNum])) { + xfree(cursPriv->pMask); + xfree(cursPriv->pSource); + xfree(cursPriv->bMask); + xfree(cursPriv->bSource); + xfree(cursPriv); + } + return TRUE; +} + +static void +vmwareLoadCursor(ScreenPtr pScr, + CursorPtr pCurs, + int x, + int y) +{ + VMWAREPtr pVMWARE; + + TRACEPOINT + + if (!pCurs) + return; + + pVMWARE = VMWAREPTR(infoFromScreen(pScr)); + + pVMWARE->Mouse.Width = pCurs->bits->width; + pVMWARE->Mouse.Height = pCurs->bits->height; + pVMWARE->Mouse.XHot = pCurs->bits->xhot; + pVMWARE->Mouse.YHot = pCurs->bits->yhot; + vmwareRecolorCursor(pScr, pCurs, TRUE); + vmwareMoveCursor(pScr, x, y); + + if (!(pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS)) { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DISPLAY_CURSOR); + vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); + vmwareWriteWordToFIFO(pVMWARE, 1); + } +} + +void +vmwareSetCursor(ScreenPtr pScr, + CursorPtr pCurs, + int x, + int y) +{ + int index = pScr->myNum; + + TRACEPOINT + + if (!pCurs) + return; + + vmwareSaveCursors[index] = pCurs; + vmwareLoadCursor(pScr, pCurs, x, y); +} + +void +vmwareRestoreCursor(ScreenPtr pScr) +{ + int index = pScr->myNum; + int x, y; + + TRACEPOINT + + miPointerPosition(&x, &y); + vmwareLoadCursor(pScr, vmwareSaveCursors[index], x, y); +} + +void +vmwareMoveCursor(ScreenPtr pScr, + int x, + int y) +{ + VMWAREPtr pVMWARE; + + TRACEPOINT + + pVMWARE = VMWAREPTR(infoFromScreen(pScr)); + + pVMWARE->Mouse.Box.x1 = x - pVMWARE->Mouse.XHot; + if (pVMWARE->Mouse.Box.x1 < 0) pVMWARE->Mouse.Box.x1 = 0; + pVMWARE->Mouse.Box.y1 = y - pVMWARE->Mouse.YHot; + if (pVMWARE->Mouse.Box.y1 < 0) pVMWARE->Mouse.Box.y1 = 0; + + pVMWARE->Mouse.Box.x2 = pVMWARE->Mouse.Box.x1 + pVMWARE->Mouse.Width; + pVMWARE->Mouse.Box.y2 = pVMWARE->Mouse.Box.y1 + pVMWARE->Mouse.Height; + + if (pVMWARE->cursorDefined && !pVMWARE->mouseHidden) { + if (pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ID, MOUSE_ID); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_X, x); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_Y, y); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, 1); + } else { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_MOVE_CURSOR); + vmwareWriteWordToFIFO(pVMWARE, x); + vmwareWriteWordToFIFO(pVMWARE, y); + UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box); + } + } +} + +void +vmwareRecolorCursor(ScreenPtr pScr, + CursorPtr pCurs, + Bool displayed) +{ + xColorItem sourceColor; + xColorItem maskColor; + VMwareCursPriv *cursPriv = pCurs->bits->devPriv[pScr->myNum]; + uint32 *b1, *b2; + int i; + VMWAREPtr pVMWARE; + + TRACEPOINT + + if (!displayed) + return; + + pVMWARE = VMWAREPTR(infoFromScreen(pScr)); + + sourceColor.red = pCurs->foreRed; + sourceColor.green = pCurs->foreGreen; + sourceColor.blue = pCurs->foreBlue; + + maskColor.red = pCurs->backRed; + maskColor.green = pCurs->backGreen; + maskColor.blue = pCurs->backBlue; + + if (pScr->rootDepth > 8) + { + sourceColor.pixel = (sourceColor.red >> (16 - pVMWARE->weight.red)) << pVMWARE->offset.red | + (sourceColor.green >> (16 - pVMWARE->weight.green)) << pVMWARE->offset.green | + (sourceColor.blue >> (16 - pVMWARE->weight.blue)) << pVMWARE->offset.blue; + maskColor.pixel = (maskColor.red >> (16 - pVMWARE->weight.red)) << pVMWARE->offset.red | + (maskColor.green >> (16 - pVMWARE->weight.green)) << pVMWARE->offset.green | + (maskColor.blue >> (16 - pVMWARE->weight.blue)) << pVMWARE->offset.blue; + } + else + { + ColormapPtr pmap; + + pmap = miInstalledMaps[pScr->myNum]; + + FakeAllocColor(pmap, &sourceColor); + FakeAllocColor(pmap, &maskColor); + + FakeFreeColor(pmap, sourceColor.pixel); + FakeFreeColor(pmap, maskColor.pixel); + + maskColor.red = maskColor.red >> 8; + maskColor.green = maskColor.green >> 8; + maskColor.blue = maskColor.blue >> 8; + + sourceColor.red = sourceColor.red >> 8; + sourceColor.green = sourceColor.green >> 8; + sourceColor.blue = sourceColor.blue >> 8; + } + + /* Calculate XOR mask */ + Raster_BitsToPixels(cursPriv->bSource, PixmapBytePad(pCurs->bits->width, 1), + cursPriv->pSource, + 4 * SVGA_PIXMAP_SCANLINE_SIZE(pCurs->bits->width, pVMWARE->bitsPerPixel), + pVMWARE->bitsPerPixel / 8, + pCurs->bits->width, pCurs->bits->height, sourceColor.pixel, maskColor.pixel); + b1 = (uint32 *) cursPriv->pSource; + b2 = (uint32 *) cursPriv->pMask; + for (i = 0; i < SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel); i++) { + *b1++ &= ~*b2++; + } + + /* Define cursor */ + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DEFINE_CURSOR); + vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); + vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->xhot); + vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->yhot); + vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->width); + vmwareWriteWordToFIFO(pVMWARE, pCurs->bits->height); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->bitsPerPixel); + vmwareWriteWordToFIFO(pVMWARE, pVMWARE->bitsPerPixel); + b1 = (uint32 *) cursPriv->pSource; + b2 = (uint32 *) cursPriv->pMask; + for (i = 0; i < SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel); i++) { + vmwareWriteWordToFIFO(pVMWARE, *b2++); + } + for (i = 0; i < SVGA_PIXMAP_SIZE(pCurs->bits->width, pCurs->bits->height, pVMWARE->bitsPerPixel); i++) { + vmwareWriteWordToFIFO(pVMWARE, *b1++); + /* vmwareWriteWordToFIFO(~0); */ + } + pVMWARE->checkCursorColor = FALSE; + + /* Sync the FIFO, so that the definition preceeds any use of the cursor */ + UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box); + vmwareWaitForFB(pVMWARE); + pVMWARE->cursorDefined = TRUE; +} + +void +vmwareRenewCursorColor(ScreenPtr pScr) +{ + TRACEPOINT + + if (vmwareSaveCursors[pScr->myNum]) + vmwareRecolorCursor(pScr, vmwareSaveCursors[pScr->myNum], TRUE); +} + +void +vmwareBlockHandler(i, blockData, pTimeout, pReadmask) + int i; + pointer blockData; + pointer pTimeout; + pointer pReadmask; +{ + VMWAREPtr pVMWARE; + + TRACEPOINT + + pVMWARE = VMWAREPTR(xf86Screens[i]); + if (pVMWARE->checkCursorColor) + vmwareRenewCursorColor(screenInfo.screens[i]); +} + +void +vmwareQueryBestSize(class, pwidth, pheight, pScr) + int class; + unsigned short *pwidth; + unsigned short *pheight; + ScreenPtr pScr; +{ + TRACEPOINT + + if (*pwidth > 0) { + + switch (class) { + + case CursorShape: + if (*pwidth > 64) + *pwidth = 64; + if (*pheight > 64) + *pheight = 64; + break; + default: + mfbQueryBestSize(class, pwidth, pheight, pScr); + break; + } + } +} + +void +vmwareCursorOff(VMWAREPtr pVMWARE) +{ + TRACEPOINT + + if (pVMWARE->cursorDefined) { + if (pVMWARE->vmwareCapability & SVGA_CAP_CURSOR_BYPASS) { + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ID, MOUSE_ID); + vmwareWriteReg(pVMWARE, SVGA_REG_CURSOR_ON, 0); + } else { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_DISPLAY_CURSOR); + vmwareWriteWordToFIFO(pVMWARE, MOUSE_ID); + vmwareWriteWordToFIFO(pVMWARE, 0); + UPDATE_ACCEL_AREA(pVMWARE, pVMWARE->Mouse.Box); + } + } +} + +void +vmwareClearSavedCursor(int scr_index) +{ + TRACEPOINT + + vmwareSaveCursors[scr_index] = NULL; +} + + Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c Thu Apr 5 15:29:44 2001 @@ -0,0 +1,62 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarefillarc[] = + + "Id: vmwarefillarc.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefillarc.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static void +computeBBarc(DrawablePtr pDrawable, + GCPtr pGC, int narcs, xArc * parcs, BoxPtr pBB) +{ + if (narcs <= 0) + return; + pBB->x1 = parcs->x; + pBB->y1 = parcs->y; + pBB->x2 = parcs->x + parcs->width; + pBB->y2 = parcs->y + parcs->height; + while (--narcs) { + parcs++; + if (parcs->x < pBB->x1) + pBB->x1 = parcs->x; + if (parcs->y < pBB->y1) + pBB->y1 = parcs->y; + if ((parcs->x + parcs->width) > pBB->x2) + pBB->x2 = parcs->x + parcs->width; + if ((parcs->y + parcs->height) > pBB->y2) + pBB->y2 = parcs->y + parcs->height; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolyFillArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBarc(pDrawable, pGC, narcs, parcs, &BB), + GC_OPS(pGC)->PolyFillArc(pDrawable, pGC, narcs, parcs)); +} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c Thu Apr 5 15:29:44 2001 @@ -0,0 +1,63 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarefs[] = + + "Id: vmwarefs.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarefs.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static __inline void +vmwareDrawableToBox(BoxPtr BB, const DrawablePtr pDrawable) +{ + BB->x2 = (BB->x1 = pDrawable->x) + pDrawable->width; + BB->y2 = (BB->y1 = pDrawable->y) + pDrawable->height; +} + +void +vmwareFillSpans(DrawablePtr pDrawable, + GCPtr pGC, int nInit, DDXPointPtr pptInit, int *pwidthInit, int fSorted) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pDrawable->pScreen, + vmwareDrawableToBox(&BB, pDrawable), + GC_OPS(pGC)->FillSpans(pDrawable, pGC, nInit, pptInit, pwidthInit, fSorted)); +} + +void +vmwareSetSpans(DrawablePtr pDrawable, + GCPtr pGC, + char *pcharsrc, DDXPointPtr ppt, int *pwidth, int nspans, int fSorted) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pDrawable->pScreen, + vmwareDrawableToBox(&BB, pDrawable), + GC_OPS(pGC)->SetSpans(pDrawable, pGC, pcharsrc, ppt, pwidth, nspans, fSorted)); +} + +void +vmwareGetSpans(DrawablePtr pDrawable, + int wMax, DDXPointPtr pPoints, int *pWidths, int nSpans, char *pDst) +{ + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pDrawable->pScreen)); + + TRACEPOINT + + VM_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + (BB.x1 = 0, BB.y1 = 0, + BB.x2 = pDrawable->pScreen->width, + BB.y2 = pDrawable->pScreen->height), + pVMWARE->ScrnFuncs.GetSpans(pDrawable, wMax, pPoints, pWidths, nSpans, pDst)); +} + + + + Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c:1.2 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c Wed May 16 02:48:12 2001 @@ -0,0 +1,129 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwaregc[] = + + "Id: vmwaregc.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaregc.c,v 1.2 2001/05/16 06:48:12 keithp Exp $ */ + +#include "X.h" +#include "fb.h" +#include "mi.h" +#include "migc.h" +#include "vmware.h" + +GCFuncs vmwareGCFuncs = { + vmwareValidateGC, + vmwareChangeGC, + vmwareCopyGC, + vmwareDestroyGC, + vmwareChangeClip, + vmwareDestroyClip, + vmwareCopyClip +}; + +GCOps vmwareGCOps = { + vmwareFillSpans, + vmwareSetSpans, + vmwarePutImage, + vmwareCopyArea, + vmwareCopyPlane, + vmwarePolyPoint, + vmwarePolylines, + vmwarePolySegment, + vmwarePolyRectangle, + vmwarePolyArc, + vmwareFillPolygon, + vmwarePolyFillRect, + vmwarePolyFillArc, + vmwarePolyText8, + vmwarePolyText16, + vmwareImageText8, + vmwareImageText16, + vmwareImageGlyphBlt, + vmwarePolyGlyphBlt, + vmwarePushPixels, +#ifdef NEED_LINEHELPER + , NULL +#endif +}; + +unsigned long Pmsk; + +Bool +vmwareCreateGC(GCPtr pGC) +{ + Bool ret; + + TRACEPOINT + GC_FUNC_PROLOGUE(pGC); + ret = VMWAREPTR(infoFromScreen(pGC->pScreen))->ScrnFuncs.CreateGC(pGC); + GC_FUNC_EPILOGUE(pGC); + return ret; +} + +void +vmwareValidateGC(GCPtr pGC, unsigned long changes, DrawablePtr pDrawable) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->ValidateGC(pGC, changes, pDrawable); + GC_FUNC_EPILOGUE(pGC); +} + +void +vmwareChangeGC(GCPtr pGC, unsigned long changes) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->ChangeGC(pGC, changes); + GC_FUNC_EPILOGUE(pGC); +} + +void +vmwareCopyGC(GCPtr pGCSrc, unsigned long mask, GCPtr pGCDst) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGCDst); + pGCDst->funcs->CopyGC(pGCSrc, mask, pGCDst); + GC_FUNC_EPILOGUE(pGCDst); +} + +void +vmwareDestroyGC(GCPtr pGC) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->DestroyGC(pGC); + GC_FUNC_EPILOGUE(pGC); +} + +void +vmwareChangeClip(GCPtr pGC, int type, pointer pValue, int nrects) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->ChangeClip(pGC, type, pValue, nrects); + GC_FUNC_EPILOGUE(pGC); +} + +void +vmwareDestroyClip(GCPtr pGC) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGC); + pGC->funcs->DestroyClip(pGC); + GC_FUNC_EPILOGUE(pGC); +} + +void +vmwareCopyClip(GCPtr pGCDst, GCPtr pGCSrc) +{ + TRACEPOINT + GC_FUNC_PROLOGUE(pGCDst); + pGCDst->funcs->CopyClip(pGCDst, pGCSrc); + GC_FUNC_EPILOGUE(pGCDst); +} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c Thu Apr 5 15:29:44 2001 @@ -0,0 +1,47 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwareglblt[] = + + "Id: vmwareglblt.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareglblt.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static __inline void +vmwareDrawableToBox(BoxPtr BB, const DrawablePtr pDrawable) +{ + BB->x2 = (BB->x1 = pDrawable->x) + pDrawable->width; + BB->y2 = (BB->y1 = pDrawable->y) + pDrawable->height; +} + +void +vmwareImageGlyphBlt(DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareDrawableToBox(&BB, pDrawable), + GC_OPS(pGC)->ImageGlyphBlt(pDrawable, pGC, x, y, + nglyph, ppci, pglyphBase)); +} + +void +vmwarePolyGlyphBlt(DrawablePtr pDrawable, + GCPtr pGC, + int x, int y, unsigned int nglyph, CharInfoPtr * ppci, pointer pglyphBase) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareDrawableToBox(&BB, pDrawable), + GC_OPS(pGC)->PolyGlyphBlt(pDrawable, pGC, x, y, + nglyph, ppci, pglyphBase)); +} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c Thu Apr 5 15:29:44 2001 @@ -0,0 +1,59 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwareimage[] = + + "Id: vmwareimage.c,v 1.3 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareimage.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +/* + * vmwarePutImage does not optimize ops because a downstream call is made + * to CopyArea. + */ + +static __inline void +vmwareImageToBox(BoxPtr BB, DrawablePtr pDrawable, int x, int y, int w, int h) +{ + BB->x2 = (BB->x1 = pDrawable->x + x) + w; + BB->y2 = (BB->y1 = pDrawable->y + y) + h; +} + +void +vmwarePutImage(DrawablePtr pDrawable, + GCPtr pGC, + int depth, + int x, int y, int w, int h, int leftPad, int format, char *pImage) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareImageToBox(&BB, pDrawable, x, y, w, h), + GC_OPS(pGC)->PutImage(pDrawable, pGC, depth, x, y, + w, h, leftPad, format, pImage)); +} + +void +vmwareGetImage(DrawablePtr pDrawable, + int x, + int y, + int w, + int h, unsigned int format, unsigned long planeMask, char *pBinImage) +{ + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pDrawable->pScreen)); + + TRACEPOINT + + VM_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + vmwareImageToBox(&BB, pDrawable, x, y, w, h), + pVMWARE->ScrnFuncs.GetImage(pDrawable, x, y, w, h, format, planeMask, pBinImage)); +} + + + + Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c Thu Apr 5 15:29:44 2001 @@ -0,0 +1,141 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwareline[] = + + "Id: vmwareline.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareline.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static void +computeBBpoints(DrawablePtr pDrawable, + GCPtr pGC, int mode, int npt, DDXPointPtr pptInit, BoxPtr pBB) +{ + int x, y; + + if (npt <= 0) + return; + x = pptInit->x; + y = pptInit->y; + pBB->x1 = x; + pBB->y1 = y; + pBB->x2 = x + 1; + pBB->y2 = y + 1; + while (--npt) { + pptInit++; + if (mode == CoordModeOrigin) { + x = pptInit->x; + y = pptInit->y; + } else { + x += pptInit->x; + y += pptInit->y; + } + if (x < pBB->x1) + pBB->x1 = x; + if (y < pBB->y1) + pBB->y1 = y; + if (x + 1 > pBB->x2) + pBB->x2 = x + 1; + if (y + 1 > pBB->y2) + pBB->y2 = y + 1; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolylines(DrawablePtr pDrawable, + GCPtr pGC, int mode, int npt, DDXPointPtr pPts) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBpoints(pDrawable, pGC, mode, npt, pPts, &BB), + GC_OPS(pGC)->Polylines(pDrawable, pGC, mode, npt, pPts)); +} + +static void +computeBBsegments(DrawablePtr pDrawable, + GCPtr pGC, int nseg, xSegment * pSegs, BoxPtr pBB) +{ + if (nseg <= 0) + return; + pBB->x1 = pSegs->x1; + pBB->y1 = pSegs->y1; + pBB->x2 = pSegs->x1 + 1; + pBB->y2 = pSegs->y1 + 1; + if (pSegs->x2 < pBB->x1) + pBB->x1 = pSegs->x2; + if (pSegs->y2 < pBB->y1) + pBB->y1 = pSegs->y2; + if (pSegs->x2 + 1 > pBB->x2) + pBB->x2 = pSegs->x2 + 1; + if (pSegs->y2 + 1 > pBB->y2) + pBB->y2 = pSegs->y2 + 1; + while (--nseg) { + pSegs++; + if (pSegs->x1 < pBB->x1) + pBB->x1 = pSegs->x1; + if (pSegs->y1 < pBB->y1) + pBB->y1 = pSegs->y1; + if (pSegs->x1 + 1 > pBB->x2) + pBB->x2 = pSegs->x1 + 1; + if (pSegs->y1 + 1 > pBB->y2) + pBB->y2 = pSegs->y1 + 1; + if (pSegs->x2 < pBB->x1) + pBB->x1 = pSegs->x2; + if (pSegs->y2 < pBB->y1) + pBB->y1 = pSegs->y2; + if (pSegs->x2 + 1 > pBB->x2) + pBB->x2 = pSegs->x2 + 1; + if (pSegs->y2 + 1 > pBB->y2) + pBB->y2 = pSegs->y2 + 1; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolySegment(DrawablePtr pDrawable, + GCPtr pGC, int nseg, xSegment * pSegs) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBsegments(pDrawable, pGC, nseg, pSegs, &BB), + GC_OPS(pGC)->PolySegment(pDrawable, pGC, nseg, pSegs)); +} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c Thu Apr 5 15:29:44 2001 @@ -0,0 +1,80 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwareply1rct[] = + + "Id: vmwareply1rct.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwareply1rct.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static void +computeBBpoly(DrawablePtr pDrawable, + GCPtr pGC, int mode, int count, DDXPointPtr pptInit, BoxPtr pBB) +{ + int x, y; + + if (count <= 0) + return; + x = pptInit->x; + y = pptInit->y; + pBB->x1 = x; + pBB->y1 = y; + pBB->x2 = x + 1; + pBB->y2 = y + 1; + while (--count) { + pptInit++; + if (mode == CoordModeOrigin) { + x = pptInit->x; + y = pptInit->y; + } else { + x += pptInit->x; + y += pptInit->y; + } + if (x < pBB->x1) + pBB->x1 = x; + if (y < pBB->y1) + pBB->y1 = y; + if (x + 1 > pBB->x2) + pBB->x2 = x + 1; + if (y + 1 > pBB->y2) + pBB->y2 = y + 1; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwareFillPolygon(DrawablePtr pDrawable, + GCPtr pGC, int shape, int mode, int count, DDXPointPtr pPts) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBpoly(pDrawable, pGC, mode, count, pPts, &BB), + GC_OPS(pGC)->FillPolygon(pDrawable, pGC, shape, mode, + count, pPts)); +} + + + + + Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c Thu Apr 5 15:29:44 2001 @@ -0,0 +1,74 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarepolypnt[] = + + "Id: vmwarepolypnt.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepolypnt.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static void +computeBBpoints(DrawablePtr pDrawable, + GCPtr pGC, int mode, int npt, DDXPointPtr pptInit, BoxPtr pBB) +{ + int x, y; + + if (npt <= 0) + return; + x = pptInit->x; + y = pptInit->y; + pBB->x1 = x; + pBB->y1 = y; + pBB->x2 = x + 1; + pBB->y2 = y + 1; + while (--npt) { + pptInit++; + if (mode == CoordModeOrigin) { + x = pptInit->x; + y = pptInit->y; + } else { + x += pptInit->x; + y += pptInit->y; + } + if (x < pBB->x1) + pBB->x1 = x; + if (y < pBB->y1) + pBB->y1 = y; + if (x + 1 > pBB->x2) + pBB->x2 = x + 1; + if (y + 1 > pBB->y2) + pBB->y2 = y + 1; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolyPoint(DrawablePtr pDrawable, GCPtr pGC, int mode, int npt, + xPoint * pptInit) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBpoints(pDrawable, pGC, mode, npt, pptInit, &BB), + GC_OPS(pGC)->PolyPoint(pDrawable, pGC, mode, npt, pptInit)); +} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c Thu Apr 5 15:29:44 2001 @@ -0,0 +1,43 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarepush[] = + + "Id: vmwarepush.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarepush.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static __inline void +vmwarePushToBox(BoxPtr BB, const GCPtr pGC, PixmapPtr pBitmap, + DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg) +{ + BB->x1 = + MAX(pDrawable->x + xOrg, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + BB->y1 = + MAX(pDrawable->y + yOrg, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + BB->x2 = + MIN(pDrawable->x + xOrg + dx, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + BB->y2 = + MIN(pDrawable->y + yOrg + dy, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePushPixels(GCPtr pGC, + PixmapPtr pBitmap, + DrawablePtr pDrawable, int dx, int dy, int xOrg, int yOrg) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwarePushToBox(&BB, pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg), + GC_OPS(pGC)->PushPixels(pGC, pBitmap, pDrawable, dx, dy, xOrg, yOrg)); +} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c:1.2 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c Wed May 16 02:48:12 2001 @@ -0,0 +1,272 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarerect[] = + + "Id: vmwarerect.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarerect.c,v 1.2 2001/05/16 06:48:12 keithp Exp $ */ + +#include "X.h" +#include "fb.h" +#include "vmware.h" + +static void +computeBBrect(DrawablePtr pDrawable, + GCPtr pGC, int nrectFill, xRectangle * prectInit, BoxPtr pBB) +{ + if (nrectFill <= 0) + return; + pBB->x1 = prectInit->x; + pBB->y1 = prectInit->y; + pBB->x2 = prectInit->x + prectInit->width + 1; + pBB->y2 = prectInit->y + prectInit->height + 1; + while (--nrectFill) { + prectInit++; + if (prectInit->x < pBB->x1) + pBB->x1 = prectInit->x; + if (prectInit->y < pBB->y1) + pBB->y1 = prectInit->y; + if ((prectInit->x + prectInit->width + 1) > pBB->x2) + pBB->x2 = prectInit->x + prectInit->width + 1; + if ((prectInit->y + prectInit->height + 1) > pBB->y2) + pBB->y2 = prectInit->y + prectInit->height + 1; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolyRectangle(DrawablePtr pDrawable, + GCPtr pGC, int nrectFill, xRectangle * prectInit) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBrect(pDrawable, pGC, nrectFill, prectInit, &BB), + GC_OPS(pGC)->PolyRectangle(pDrawable, pGC, nrectFill, prectInit)); +} + +static void +accelFillRectSolid(VMWAREPtr pVMWARE, DrawablePtr pDrawable, GCPtr pGC, int nBox, BoxPtr pBox) +{ + while (nBox) { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_ROP_FILL); + vmwareWriteWordToFIFO(pVMWARE, pGC->fgPixel); + vmwareWriteWordToFIFO(pVMWARE, pBox->x1); + vmwareWriteWordToFIFO(pVMWARE, pBox->y1); + vmwareWriteWordToFIFO(pVMWARE, pBox->x2 - pBox->x1); + vmwareWriteWordToFIFO(pVMWARE, pBox->y2 - pBox->y1); + vmwareWriteWordToFIFO(pVMWARE, pGC->alu); + pBox++; + nBox--; + } +} + +#define NUM_STACK_RECTS 1024 + +static void +accelPolyFillRect(VMWAREPtr pVMWARE, DrawablePtr pDrawable, + GCPtr pGC, int nrectFill, xRectangle * prectInit) +{ + xRectangle *prect; + RegionPtr prgnClip; + BoxPtr pbox; + BoxPtr pboxClipped; + BoxPtr pboxClippedBase; + BoxPtr pextent; + BoxRec stackRects[NUM_STACK_RECTS]; + int numRects; + int n; + int xorg, yorg; + + prgnClip = fbGetCompositeClip(pGC); + + prect = prectInit; + xorg = pDrawable->x; + yorg = pDrawable->y; + if (xorg || yorg) { + prect = prectInit; + n = nrectFill; + while (n--) { + prect->x += xorg; + prect->y += yorg; + prect++; + } + } + + prect = prectInit; + + numRects = REGION_NUM_RECTS(prgnClip) * nrectFill; + if (numRects > NUM_STACK_RECTS) { + pboxClippedBase = (BoxPtr) ALLOCATE_LOCAL(numRects * sizeof(BoxRec)); + if (!pboxClippedBase) + return; + } else + pboxClippedBase = stackRects; + + pboxClipped = pboxClippedBase; + + if (REGION_NUM_RECTS(prgnClip) == 1) { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_RECTS(prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) { + if ((pboxClipped->x1 = prect->x) < x1) + pboxClipped->x1 = x1; + + if ((pboxClipped->y1 = prect->y) < y1) + pboxClipped->y1 = y1; + + bx2 = (int)prect->x + (int)prect->width; + if (bx2 > x2) + bx2 = x2; + pboxClipped->x2 = bx2; + + by2 = (int)prect->y + (int)prect->height; + if (by2 > y2) + by2 = y2; + pboxClipped->y2 = by2; + + prect++; + if ((pboxClipped->x1 < pboxClipped->x2) && + (pboxClipped->y1 < pboxClipped->y2)) { + pboxClipped++; + } + } + } else { + int x1, y1, x2, y2, bx2, by2; + + pextent = REGION_EXTENTS(pGC->pScreen, prgnClip); + x1 = pextent->x1; + y1 = pextent->y1; + x2 = pextent->x2; + y2 = pextent->y2; + while (nrectFill--) { + BoxRec box; + + if ((box.x1 = prect->x) < x1) + box.x1 = x1; + + if ((box.y1 = prect->y) < y1) + box.y1 = y1; + + bx2 = (int)prect->x + (int)prect->width; + if (bx2 > x2) + bx2 = x2; + box.x2 = bx2; + + by2 = (int)prect->y + (int)prect->height; + if (by2 > y2) + by2 = y2; + box.y2 = by2; + + prect++; + + if ((box.x1 >= box.x2) || (box.y1 >= box.y2)) + continue; + + n = REGION_NUM_RECTS(prgnClip); + pbox = REGION_RECTS(prgnClip); + + /* clip the rectangle to each box in the clip region + * this is logically equivalent to calling Intersect() + */ + while (n--) { + pboxClipped->x1 = max(box.x1, pbox->x1); + pboxClipped->y1 = max(box.y1, pbox->y1); + pboxClipped->x2 = min(box.x2, pbox->x2); + pboxClipped->y2 = min(box.y2, pbox->y2); + pbox++; + + /* see if clipping left anything */ + if (pboxClipped->x1 < pboxClipped->x2 && + pboxClipped->y1 < pboxClipped->y2) { + pboxClipped++; + } + } + } + } + if (pboxClipped != pboxClippedBase) + accelFillRectSolid(pVMWARE, pDrawable, pGC, + pboxClipped - pboxClippedBase, pboxClippedBase); + if (pboxClippedBase != stackRects) + DEALLOCATE_LOCAL(pboxClippedBase); +} + +static void +computeBBfillrect(DrawablePtr pDrawable, + GCPtr pGC, int nrectFill, xRectangle * prectInit, BoxPtr pBB) +{ + if (nrectFill <= 0) + return; + pBB->x1 = prectInit->x; + pBB->y1 = prectInit->y; + pBB->x2 = prectInit->x + prectInit->width; + pBB->y2 = prectInit->y + prectInit->height; + while (--nrectFill) { + prectInit++; + if (prectInit->x < pBB->x1) + pBB->x1 = prectInit->x; + if (prectInit->y < pBB->y1) + pBB->y1 = prectInit->y; + if ((prectInit->x + prectInit->width) > pBB->x2) + pBB->x2 = prectInit->x + prectInit->width; + if ((prectInit->y + prectInit->height) > pBB->y2) + pBB->y2 = prectInit->y + prectInit->height; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolyFillRect(DrawablePtr pDrawable, + GCPtr pGC, int nrectFill, xRectangle * prectInit) +{ + TRACEPOINT + + GC_FUNC_ACCEL_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBfillrect(pDrawable, pGC, nrectFill, prectInit, &BB), + (pVMWARE->vmwareCapability & SVGA_CAP_RECT_FILL) && + (pGC->alu == GXcopy || (pVMWARE->vmwareCapability & SVGA_CAP_RASTER_OP)) && + pGC->fillStyle == FillSolid && ((pGC->planemask & pVMWARE->Pmsk) == pVMWARE->Pmsk), + accelPolyFillRect(pVMWARE, pDrawable, pGC, nrectFill, prectInit), + GC_OPS(pGC)->PolyFillRect(pDrawable, pGC, nrectFill, prectInit)); +} + Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c Thu Apr 5 15:29:44 2001 @@ -0,0 +1,180 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwaretext[] = + + "Id: vmwaretext.c,v 1.3 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwaretext.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" +#include "dixfontstr.h" + +static void +vmwareTextExtent(FontPtr pFont, int count, char* chars, FontEncoding fontEncoding, BoxPtr box) +{ + unsigned long n, i; + int w; + CharInfoPtr charinfo[255]; /* encoding only has 1 byte for count */ + + GetGlyphs(pFont, (unsigned long)count, (unsigned char *)chars, + fontEncoding, &n, charinfo); + w = 0; + for (i=0; i < n; i++) { + w += charinfo[i]->metrics.characterWidth; + } + if (i) { + w += charinfo[i - 1]->metrics.rightSideBearing; + } + + box->x1 = 0; + if (n) { + if (charinfo[0]->metrics.leftSideBearing < 0) { + box->x1 = charinfo[0]->metrics.leftSideBearing; + } + } + box->x2 = w; + box->y1 = -FONTMAXBOUNDS(pFont,ascent); + box->y2 = FONTMAXBOUNDS(pFont,descent); +} + +static __inline void +vmwareFontToBox(BoxPtr BB, DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, char *chars, + int wide) +{ + FontPtr pFont; + + pFont = pGC->font; + if (pFont->info.constantWidth) { + int ascent, descent, left, right = 0; + + ascent = + MAX(pFont->info.fontAscent, pFont->info.maxbounds.ascent); + descent = + MAX(pFont->info.fontDescent, + pFont->info.maxbounds.descent); + left = pFont->info.maxbounds.leftSideBearing; + if (count > 0) { + right = + (count - 1) * pFont->info.maxbounds.characterWidth; + } + right += pFont->info.maxbounds.rightSideBearing; + BB->x1 = + MAX(pDrawable->x + x - left, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + BB->y1 = + MAX(pDrawable->y + y - ascent, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + BB->x2 = + MIN(pDrawable->x + x + right, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + BB->y2 = + MIN(pDrawable->y + y + descent, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); + } else { + vmwareTextExtent(pFont, count, chars, wide ? (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit : Linear8Bit, BB); + BB->x1 = + MAX(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + BB->y1 = + MAX(pDrawable->y + y + BB->y1, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + BB->x2 = + MIN(pDrawable->x + x + BB->x2, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + BB->y2 = + MIN(pDrawable->y + y + BB->y2, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); + } +} + +static __inline void +vmwareImageFontToBox(BoxPtr BB, DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, char *chars, + int wide) +{ + FontPtr pFont; + + pFont = pGC->font; + vmwareTextExtent(pFont, count, chars, + wide ? (FONTLASTROW(pFont) == 0) ? Linear16Bit : TwoD16Bit : Linear8Bit, + BB); + BB->x1 = + MAX(pDrawable->x + x + BB->x1, (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x1); + BB->y1 = + MAX(pDrawable->y + y + BB->y1, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y1); + BB->x2 = + MIN(pDrawable->x + x + BB->x2, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->x2); + BB->y2 = + MIN(pDrawable->y + y + BB->y2, + (REGION_EXTENTS(pGC->pScreen, + &((WindowPtr) pDrawable)->winSize))->y2); +} + +int +vmwarePolyText8(DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, char *chars) +{ + int n; + + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareFontToBox(&BB, pDrawable, pGC, x, y, count, chars, 0), + n = GC_OPS(pGC)->PolyText8(pDrawable, pGC, x, y, count, chars)); + return n; +} + +int +vmwarePolyText16(DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, unsigned short *chars) +{ + int n; + + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareFontToBox(&BB, pDrawable, pGC, x, y, count, (char*)chars, 1), + n = GC_OPS(pGC)->PolyText16(pDrawable, pGC, x, y, count, chars)); + return n; +} + +void +vmwareImageText8(DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, char *chars) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareImageFontToBox(&BB, pDrawable, pGC, x, y, count, chars, 0), + GC_OPS(pGC)->ImageText8(pDrawable, pGC, x, y, count, chars)); +} + +void +vmwareImageText16(DrawablePtr pDrawable, + GCPtr pGC, int x, int y, int count, unsigned short *chars) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + vmwareImageFontToBox(&BB, pDrawable, pGC, x, y, count, (char*)chars, 1), + GC_OPS(pGC)->ImageText16(pDrawable, pGC, x, y, count, chars)); +} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c:1.2 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c Wed May 16 02:48:12 2001 @@ -0,0 +1,130 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarewindow[] = + + "Id: vmwarewindow.c,v 1.4 2001/01/27 00:28:15 bennett Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarewindow.c,v 1.2 2001/05/16 06:48:12 keithp Exp $ */ + +#include "vmware.h" + +void +vmwareCopyWindow(WindowPtr pWin, DDXPointRec ptOldOrg, RegionPtr prgnSrc) +{ + RegionRec rgnDst; + int dx, dy; + WindowPtr pwinRoot; + BoxPtr pBB; + + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); + + TRACEPOINT + if (!(pVMWARE->vmwareCapability & SVGA_CAP_RECT_COPY)) { + pVMWARE->ScrnFuncs.CopyWindow(pWin, ptOldOrg, prgnSrc); + return; + } + pwinRoot = WindowTable[pWin->drawable.pScreen->myNum]; + REGION_INIT(pWin->drawable.pScreen, &rgnDst, NullBox, 0); + dx = ptOldOrg.x - pWin->drawable.x; + dy = ptOldOrg.y - pWin->drawable.y; + REGION_TRANSLATE(pWin->drawable.pScreen, prgnSrc, -dx, -dy); + REGION_INTERSECT(pWin->drawable.pScreen, &rgnDst, &pWin->borderClip, + prgnSrc); + pBB = REGION_EXTENTS(pWin->drawable.pScreen, &rgnDst); + HIDE_CURSOR_ACCEL(pVMWARE, *pBB); + + fbCopyRegion ((DrawablePtr) pwinRoot, (DrawablePtr) pwinRoot, + 0, + &rgnDst, dx, dy, vmwareDoBitblt, 0, 0); + + SHOW_CURSOR(pVMWARE, *pBB); + UPDATE_ACCEL_AREA(pVMWARE, *pBB); + REGION_UNINIT(pWin->drawable.pScreen, &rgnDst); +} + +static void +accelPaintWindow(VMWAREPtr pVMWARE, WindowPtr pWin, RegionPtr pRegion, int what, BoxPtr pBB) +{ + Pixel pixel; + RegionRec drawRegion; + RegionRec BBRegion; + BoxPtr pbox; + int nbox; + + if (what == PW_BACKGROUND && pWin->backgroundState == BackgroundPixel) { + pixel = pWin->background.pixel; + } else if (what == PW_BORDER && pWin->borderIsPixel) { + pixel = pWin->border.pixel; + } else { + /* + * The caller has guaranteed that this case has been excluded, + * but the compiler doesn't know that. So this line is just to + * eliminate the compiler warning. + */ + pixel = 0; + } + + REGION_INIT(pWin->drawable.pScreen, &drawRegion, NullBox, 0); + REGION_INIT(pWin->drawable.pScreen, &BBRegion, pBB, 1); + REGION_INTERSECT(pWin->drawable.pScreen, &drawRegion, pRegion, &BBRegion); + pbox = REGION_RECTS(&drawRegion); + nbox = REGION_NUM_RECTS(&drawRegion); + while (nbox) { + vmwareWriteWordToFIFO(pVMWARE, SVGA_CMD_RECT_FILL); + vmwareWriteWordToFIFO(pVMWARE, pixel); + vmwareWriteWordToFIFO(pVMWARE, pbox->x1); + vmwareWriteWordToFIFO(pVMWARE, pbox->y1); + vmwareWriteWordToFIFO(pVMWARE, pbox->x2 - pbox->x1); + vmwareWriteWordToFIFO(pVMWARE, pbox->y2 - pbox->y1); + pbox++; + nbox--; + } + REGION_UNINIT(pWin->drawable.pScreen, &BBRegion); + REGION_UNINIT(pWin->drawable.pScreen, &drawRegion); +} + +void +vmwarePaintWindow(WindowPtr pWin, RegionPtr pRegion, int what) +{ + VMWAREPtr pVMWARE = VMWAREPTR(infoFromScreen(pWin->drawable.pScreen)); + + TRACEPOINT + /* Accelerate solid fills */ + if ((pVMWARE->vmwareCapability & SVGA_CAP_RECT_FILL) && + ((what == PW_BACKGROUND && pWin->backgroundState == BackgroundPixel) + || (what == PW_BORDER && pWin->borderIsPixel))) { + BoxPtr pBB; + Bool hidden = pVMWARE->mouseHidden; + + pBB = REGION_EXTENTS(pWin->drawable.pScreen, pRegion); + if (!hidden) { + HIDE_CURSOR(pVMWARE, *pBB); + } + accelPaintWindow(pVMWARE, pWin, pRegion, what, pBB); + if (!hidden) { + SHOW_CURSOR(pVMWARE, *pBB); + } + UPDATE_ACCEL_AREA(pVMWARE, *pBB); + /* vmwareWaitForFB(); */ /* XXX */ + return; + } + if (pVMWARE->vmwareBBLevel == 0) { + BoxPtr pBB; + + pBB = REGION_EXTENTS(pWin->drawable.pScreen, pRegion); + HIDE_CURSOR(pVMWARE, *pBB); + vmwareWaitForFB(pVMWARE); + pVMWARE->vmwareBBLevel++; + pVMWARE->ScrnFuncs.PaintWindowBackground(pWin, pRegion, what); + pVMWARE->vmwareBBLevel--; + vmwareSendSVGACmdUpdate(pVMWARE, pBB); + SHOW_CURSOR(pVMWARE, *pBB); + } else { + VmwareLog(("vmwarePaintWindow not called at top level\n")); + vmwareWaitForFB(pVMWARE); + pVMWARE->ScrnFuncs.PaintWindowBackground(pWin, pRegion, what); + } +} Index: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c:1.1 --- /dev/null Mon Jun 4 12:41:09 2001 +++ xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c Thu Apr 5 15:29:44 2001 @@ -0,0 +1,62 @@ +/* ********************************************************** + * Copyright (C) 1998-2001 VMware, Inc. + * All Rights Reserved + * **********************************************************/ +#ifdef VMX86_DEVEL +char rcsId_vmwarezerarc[] = + + "Id: vmwarezerarc.c,v 1.2 2001/01/26 23:32:16 yoel Exp $"; +#endif +/* $XFree86: xc/programs/Xserver/hw/xfree86/drivers/vmware/vmwarezerarc.c,v 1.1 2001/04/05 19:29:44 dawes Exp $ */ + +#include "vmware.h" + +static void +computeBBarc(DrawablePtr pDrawable, + GCPtr pGC, int narcs, xArc * parcs, BoxPtr pBB) +{ + if (narcs <= 0) + return; + pBB->x1 = parcs->x; + pBB->y1 = parcs->y; + pBB->x2 = parcs->x + parcs->width + 1; + pBB->y2 = parcs->y + parcs->height + 1; + while (--narcs) { + parcs++; + if (parcs->x < pBB->x1) + pBB->x1 = parcs->x; + if (parcs->y < pBB->y1) + pBB->y1 = parcs->y; + if ((parcs->x + parcs->width + 1) > pBB->x2) + pBB->x2 = parcs->x + parcs->width + 1; + if ((parcs->y + parcs->height + 1) > pBB->y2) + pBB->y2 = parcs->y + parcs->height + 1; + } + pBB->x1 = + MAX(pDrawable->x + pBB->x1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x1); + pBB->y1 = + MAX(pDrawable->y + pBB->y1 - pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y1); + pBB->x2 = + MIN(pDrawable->x + pBB->x2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->x2); + pBB->y2 = + MIN(pDrawable->y + pBB->y2 + pGC->lineWidth, + (REGION_EXTENTS(pGC->pScreen, +&((WindowPtr) pDrawable)->winSize))->y2); +} + +void +vmwarePolyArc(DrawablePtr pDrawable, GCPtr pGC, int narcs, xArc * parcs) +{ + TRACEPOINT + + GC_FUNC_WRAPPER(pDrawable->type == DRAWABLE_WINDOW, + pGC->pScreen, + computeBBarc(pDrawable, pGC, narcs, parcs, &BB), + GC_OPS(pGC)->PolyArc(pDrawable, pGC, narcs, parcs)); +} Index: xc/programs/Xserver/hw/xfree86/dummylib/getvalidbios.c diff -u xc/programs/Xserver/hw/xfree86/dummylib/getvalidbios.c:1.2 xc/programs/Xserver/hw/xfree86/dummylib/getvalidbios.c:1.3 --- xc/programs/Xserver/hw/xfree86/dummylib/getvalidbios.c:1.2 Thu Dec 7 10:43:45 2000 +++ xc/programs/Xserver/hw/xfree86/dummylib/getvalidbios.c Tue May 15 06:19:41 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/getvalidbios.c,v 1.2 2000/12/07 15:43:45 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/getvalidbios.c,v 1.3 2001/05/15 10:19:41 eich Exp $ */ #include "X.h" #include "os.h" @@ -10,7 +10,7 @@ */ memType -getValidBIOSBase(PCITAG tag, int *num) +getValidBIOSBase(PCITAG tag, int num) { return 0; } Index: xc/programs/Xserver/hw/xfree86/dummylib/xf86opt.c diff -u xc/programs/Xserver/hw/xfree86/dummylib/xf86opt.c:1.1 xc/programs/Xserver/hw/xfree86/dummylib/xf86opt.c:1.2 --- xc/programs/Xserver/hw/xfree86/dummylib/xf86opt.c:1.1 Sat Feb 12 22:06:42 2000 +++ xc/programs/Xserver/hw/xfree86/dummylib/xf86opt.c Fri May 4 15:05:50 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/xf86opt.c,v 1.1 2000/02/13 03:06:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/dummylib/xf86opt.c,v 1.2 2001/05/04 19:05:50 dawes Exp $ */ #include "X.h" #include "os.h" @@ -15,7 +15,7 @@ } Bool -xf86GetOptValBool(OptionInfoPtr o, int i, Bool *b) +xf86GetOptValBool(const OptionInfoRec *o, int i, Bool *b) { return FALSE; } Index: xc/programs/Xserver/hw/xfree86/etc/Imakefile diff -u xc/programs/Xserver/hw/xfree86/etc/Imakefile:3.37 xc/programs/Xserver/hw/xfree86/etc/Imakefile:3.38.2.1 --- xc/programs/Xserver/hw/xfree86/etc/Imakefile:3.37 Sun Jul 30 13:12:21 2000 +++ xc/programs/Xserver/hw/xfree86/etc/Imakefile Tue May 29 10:41:54 2001 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.37 2000/07/30 17:12:21 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/etc/Imakefile,v 3.38.2.1 2001/05/29 14:41:54 dawes Exp $ #include <Server.tmpl> #if SystemV @@ -43,11 +43,9 @@ # endif #endif -#if !BuildServersOnly -#ifdef SunArchitecture - TERMFILES = xterm.termcap xterm.terminfo -#else - TERMFILES = sun.termcap sun.terminfo xterm.termcap xterm.terminfo +#if !BuildServersOnly && BuildClients +#ifndef SunArchitecture + TERMFILES = sun.termcap sun.terminfo #endif #endif @@ -126,11 +124,6 @@ #if SystemV4 && !defined(SunArchitecture) InstallNamedProg(svr4_patch,svr4_patch,$(LIBDIR)/etc) InstallNamedProg(svr4_rem_pch,svr4_patch_rem,$(LIBDIR)/etc) -#endif - -#if !BuildServersOnly -LinkFile(xterm.termcap,$(PROGRAMSRC)/xterm/termcap) -LinkFile(xterm.terminfo,$(PROGRAMSRC)/xterm/terminfo) #endif LinkFile(sun.termcap,sun.tcap) Index: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh diff -u xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh:1.18.2.4 xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh:1.20.2.4 --- xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh:1.18.2.4 Wed Mar 14 13:21:43 2001 +++ xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh Fri Jun 1 13:16:57 2001 @@ -1,13 +1,13 @@ #!/bin/sh # -# $XFree86: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh,v 1.18.2.4 2001/03/14 18:21:43 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/Xinstall.sh,v 1.20.2.4 2001/06/01 17:16:57 dawes Exp $ # # Copyright © 2000 by Precision Insight, Inc. -# Copyright © 2000,2001 by VA Linux Systems, Inc. +# Copyright © 2000, 2001 by VA Linux Systems, Inc. # Portions Copyright © 1996-2000 by The XFree86 Project, Inc. # -# This script should be used to install XFree86 4.0.2. +# This script should be used to install XFree86 4.1.0. # # Parts of this script are based on the old preinst.sh and postinst.sh # scripts. @@ -17,24 +17,47 @@ # Authors: David Dawes <dawes@xfree86.org> # -VERSION=4.0.3 -FULLVERSION=4.0.2 +# Fallbacks for when the bindist version can't be auto-detected. +# These should be updated for each release. -RUNDIR=/usr/X11R6 -ETCDIR=/etc/X11 -VARDIR=/var +FULLPREFIX=4.1 +PATCHLEVEL=0 +VERSION=$FULLPREFIX.$PATCHLEVEL +FULLVERSION=$FULLPREFIX.0 +SCRIPTVERSION=$VERSION + +BINDISTFULLPREFIX= +BINDISTPATCHLEVEL= +BINDISTVERSION= +BINDISTFULLVERSION= +ROOTDIR= + +TESTROOT=/home1/test + if [ X"$1" = "X-test" -o X"$XINST_TEST" != X ]; then - RUNDIR=/home1/test/X11R6 - ETCDIR=/home1/test/etcX11 - VARDIR=/home1/test/var + ROOTDIR=$TESTROOT if [ X"$1" = "X-test" ]; then shift fi + if [ ! -d $TESTROOT ]; then + echo "$TESTROOT doesn't exist (for test mode)" + exit 1 + fi + for i in usr etc var; do + if [ ! -d $TESTROOT/$i ]; then + echo "$TESTROOT/$i doesn't exist, creating it" + mkdir $TESTROOT/$i + fi + done echo "" echo "Running in test mode" fi +RUNDIR=$ROOTDIR/usr/X11R6 +ETCDIR=$ROOTDIR/etc/X11 +VARDIR=$ROOTDIR/var + OLDFILES="" OLDDIRS=" \ @@ -86,7 +109,7 @@ Xps.tgz \ " -ETCLINKS=" \ +ETCDLINKS=" \ app-defaults \ fs \ lbxproxy \ @@ -99,8 +122,14 @@ xserver \ " -XKBDIR="/etc/X11/xkb" +ETCFLINKS=" \ + XftConfig \ + " + +XKBDIR="$ETCDIR/xkb" +XKBDBDIR= + FONTDIRS=" \ local \ misc @@ -108,6 +137,8 @@ XSERVERCMD="$RUNDIR/bin/XFree86" +VERSIONFILE=".XFree86_Version" + WDIR=`pwd` DOUPDATE= @@ -194,6 +225,10 @@ echo "Docs in Japanese";; Xps*) echo "Docs in PostScript";; + Xaout*) + echo "a.out compatibility libraries";; + Xquartz*) + echo "Mac OS X Quartz compatible X server";; *) echo "unknown";; esac @@ -362,17 +397,27 @@ Darwin) case "$OsArch" in Power*) + case "$OsVersion" in + 1.[2-9]*) + DistName="Darwin-ppc" + ;; + *) + Message="No Darwin/ppc binaries available for this OS version" + ;; + esac + ;; + x86*) case "$OsVersion" in - 1.[2-9]) - DistName="Darwin" + 1.[3-9]*) + DistName="Darwin-ix86" ;; *) - Message="No Darwin binaries available for this OS version" + Message="No Darwin/ix86 binaries available for this OS version" ;; esac ;; *) - Message="Darwin binaries are only available for Power Mac platforms" + Message="Darwin binaries are not available for this architecture" ;; esac ;; @@ -594,6 +639,36 @@ fi } +GetBindistVersion() +{ + VERSTARBALL= + if [ X$DOBASE = XYES ]; then + if [ -f Xbin.tgz ]; then + VERSTARBALL=Xbin.tgz + fi + else + if [ X$DOUPDATE = XYES ]; then + if [ -f Xupdate.tgz ]; then + VERSTARBALL=Xupdate.tgz + fi + fi + fi + rm -f $VERSIONFILE + if [ X$VERSTARBALL != X ]; then + $TAR xzf $VERSTARBALL $VERSIONFILE + fi + if [ -f $VERSIONFILE ]; then + BINDISTVERSION=`cat $VERSIONFILE` + echo "Bindist version is $BINDISTVERSION" + BINDISTFULLPREFIX=`expr $BINDISTVERSION : '\([0-9]*\.[0-9]*\)\.'` + BINDISTPATCHLEVEL=`expr $BINDISTVERSION : '[0-9]*\.[0-9]*\.\([0-9]*\)'` + BINDISTFULLVERSION=$BINDISTFULLPREFIX.0 + else + echo "Warning: can't detect the bindist version" + fi + +} + CheckInstallType() { # Check for explicit options @@ -643,6 +718,7 @@ exit 1 fi fi + GetBindistVersion } InstallUpdate() @@ -670,7 +746,7 @@ existingVer=`$XSERVERCMD -version 2>&1 | grep "XFree86 Version" | \ awk '{print $3}'` case $existingVer in - ${FULLVERSION}*) + ${FULLPREFIX}.*) ;; *) echo "" @@ -690,6 +766,9 @@ (cd $RUNDIR; $EXTRACT $WDIR/$i) done + # Make sure that $RUNDIR/lib isn't group/other writable + chmod og-w $RUNDIR/lib + # Need to run ldconfig on some OSs case "$OsName" in FreeBSD|NetBSD|OpenBSD) @@ -727,14 +806,17 @@ fi echo "" -echo " Welcome to the XFree86 $VERSION installer" +echo " Welcome to the XFree86 $SCRIPTVERSION installer" echo "" echo "You are strongly advised to backup your existing XFree86 installation" -echo "before proceeding. This includes the /usr/X11R6 and /etc/X11" +echo "before proceeding. This includes the $ROOTDIR/usr/X11R6 and $ROOTDIR/etc/X11" echo "directories. The installation process will overwrite existing files" echo "in those directories, and this may include some configuration files" echo "that may have been customised." echo "" +echo "If you are installing a version different from $SCRIPTVERSION, you" +echo "may need an updated version of this installer script." +echo "" ContinueNo # Should check if uid is zero @@ -758,11 +840,12 @@ case "$OsName" in Darwin) SERVDIST="Xxserv.tgz" + EXTRAOPTDIST="Xquartz.tgz" UPDATEDIST="Xupdate.tgz Xdocupd.tgz" ;; FreeBSD|NetBSD|OpenBSD) VARDIST="Xvar.tgz" - XKBDIR="/var/db/xkb" + XKBDBDIR="$VARDIR/db/xkb" ;; Interactive) # Need the correct name for this EXTRADIST="Xbin1.tgz" @@ -770,32 +853,10 @@ ;; Linux) VARDIST="Xvar.tgz" - XKBDIR="/var/lib/xkb" + XKBDBDIR="$VARDIR/lib/xkb" ;; esac -CheckInstallType "$@" - -if [ X"$DOUPDATE" = XYES ]; then - REQUIREDFILES=" \ - extract \ - $UPDATEDIST \ - $EXTRAUPDATE - " -else - REQUIREDFILES=" \ - extract \ - $BASEDIST \ - $ETCDIST \ - $VARDIST \ - $SERVDIST \ - $EXTRADIST \ - " -fi - -echo "Checking for required files ..." -Needed="" - # Check for extract and extract.exe, and check that they are usable. # # This test may not be fool-proof. A FreeBSD/ELF binary downloaded in @@ -861,6 +922,35 @@ exit 1 fi +# Link extract to gnu-tar so it can also be used as a regular tar +rm -f gnu-tar +ln extract gnu-tar + +EXTRACT=$WDIR/extract +TAR=$WDIR/gnu-tar + +CheckInstallType "$@" + +if [ X"$DOUPDATE" = XYES ]; then + REQUIREDFILES=" \ + extract \ + $UPDATEDIST \ + $EXTRAUPDATE + " +else + REQUIREDFILES=" \ + extract \ + $BASEDIST \ + $ETCDIST \ + $VARDIST \ + $SERVDIST \ + $EXTRADIST \ + " +fi + +echo "Checking for required files ..." +Needed="" + for i in $REQUIREDFILES; do if [ ! -f $i ]; then Needed="$Needed $i" @@ -893,12 +983,20 @@ echo "" -# Link extract to gnu-tar so it can also be used as a regular tar -rm -f gnu-tar -ln extract gnu-tar +# Set version variables if the bindist version was successfully auto-detected. -EXTRACT=$WDIR/extract -TAR=$WDIR/gnu-tar +if [ X$BINDISTVERSION != X ]; then + VERSION=$BINDISTVERSION +fi +if [ X$BINDISTFULLVERSION != X ]; then + FULLVERSION=$BINDISTFULLVERSION +fi +if [ X$BINDISTPATCHLEVEL != X ]; then + PATCHLEVEL=$BINDISTPATCHLEVEL +fi +if [ X$BINDISTFULLPREFIX != X ]; then + FULLPREFIX=$BINDISTFULLPREFIX +fi if [ X"$DOUPDATE" = XYES ]; then InstallUpdate @@ -964,22 +1062,28 @@ 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] " @@ -994,7 +1098,7 @@ 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 @@ -1004,6 +1108,12 @@ 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 @@ -1016,7 +1126,7 @@ 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] " @@ -1048,13 +1158,38 @@ $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 XKBDIR=$RUNDIR/lib/X11/xkb/compiled fi if [ -d .etctmp/xkb ]; then - mkdir $XKBDIR + if [ ! -d $XKBDIR ]; then + mkdir $XKBDIR + fi $TAR -C .etctmp/xkb -c -f - . | \ $TAR -C $XKBDIR -v -x -p -U -f - fi @@ -1071,9 +1206,10 @@ (cd $VARDIR; $EXTRACT $WDIR/$VARDIST) fi -if [ X"$XKBDIR" != X -a X"$XKBDIR" != X"$RUNDIR/lib/X11/xkb/compiled" ]; then +if [ X"$XKBDIR" != X -a X"$XKBDIR" != X"$RUNDIR/lib/X11/xkb/compiled" -a \ + X"$XKBDBDIR" != X ]; then rm -fr $RUNDIR/lib/X11/xkb/compiled - ln -s $XKBDIR $RUNDIR/lib/X11/xkb/compiled + ln -s $XKBDBDIR $RUNDIR/lib/X11/xkb/compiled fi echo "Checking for optional components to install ..." @@ -1118,8 +1254,8 @@ done # Check if the system has a termcap file -TERMCAP1DIR=/usr/share -TERMCAP2=/etc/termcap +TERMCAP1DIR=$ROOTDIR/usr/share +TERMCAP2=$ROOTDIR/etc/termcap if [ -d $TERMCAP1DIR ]; then TERMCAP1=`find $TERMCAP1DIR -type f -name termcap -print 2> /dev/null` if [ x"$TERMCAP1" != x ]; then @@ -1153,7 +1289,7 @@ fi # Check for terminfo, and update the xterm entry -TINFODIR=/usr/lib/terminfo +TINFODIR=$ROOTDIR/usr/lib/terminfo # Does this list need to be updated? OLDTINFO=" \ x/xterm \ @@ -1213,20 +1349,20 @@ if [ -f $RUNDIR/lib/libGL.so ]; then existing="" - if [ -f /usr/lib/libGL.so ]; then + if [ -f $ROOTDIR/usr/lib/libGL.so ]; then existing="$existing /usr/lib/libGL.so" fi - if [ -f /usr/lib/libGL.so.1 ]; then + if [ -f $ROOTDIR/usr/lib/libGL.so.1 ]; then existing="$existing /usr/lib/libGL.so.1" fi - if [ -d /usr/include/GL ]; then + if [ -d $ROOTDIR/usr/include/GL ]; then existing="$existing /usr/include/GL" fi echo "" echo "On some platforms (e.g., Linux), the OpenGL standard requires" echo "that the GL shared library and header files be visible from the" - echo "standard system lib and include directories (/usr/lib and" - echo "/usr/include). This can be done by installing links in those" + echo "standard system lib and include directories ($ROOTDIR/usr/lib and" + echo "$ROOTDIR/usr/include). This can be done by installing links in those" echo "directories to the files that have been installed under $RUNDIR." echo "" echo "NOTE: installing these links will overwrite existing files or" @@ -1242,29 +1378,37 @@ read response case "$response" in [yY]*) - rm -f /usr/lib/libGL.so - if [ ! -f /usr/lib/libGL.so ]; then - echo "Creating link from $RUNDIR/lib/libGL.so to /usr/lib/libGL.so" - ln -s $RUNDIR/lib/libGL.so /usr/lib/libGL.so + if [ ! -d $ROOTDIR/usr/lib ]; then + echo "Creating $ROOTDIR/usr/lib" + mkdir $ROOTDIR/usr/lib + fi + if [ ! -d $ROOTDIR/usr/include ]; then + echo "Creating $ROOTDIR/usr/include" + mkdir $ROOTDIR/usr/include + fi + rm -f $ROOTDIR/usr/lib/libGL.so + if [ ! -f $ROOTDIR/usr/lib/libGL.so ]; then + echo "Creating link from $RUNDIR/lib/libGL.so to $ROOTDIR/usr/lib/libGL.so" + ln -s $RUNDIR/lib/libGL.so $ROOTDIR/usr/lib/libGL.so else - echo "Could not remove existing /usr/lib/libGL.so, so the new" + echo "Could not remove existing $ROOTDIR/usr/lib/libGL.so, so the new" echo "link has not been created." fi - rm -f /usr/lib/libGL.so.1 - if [ ! -f /usr/lib/libGL.so.1 ]; then - echo "Creating link from $RUNDIR/lib/libGL.so.1 to /usr/lib/libGL.so.1" - ln -s $RUNDIR/lib/libGL.so.1 /usr/lib/libGL.so.1 + rm -f $ROOTDIR/usr/lib/libGL.so.1 + if [ ! -f $ROOTDIR/usr/lib/libGL.so.1 ]; then + echo "Creating link from $RUNDIR/lib/libGL.so.1 to $ROOTDIR/usr/lib/libGL.so.1" + ln -s $RUNDIR/lib/libGL.so.1 $ROOTDIR/usr/lib/libGL.so.1 else - echo "Could not remove existing /usr/lib/libGL.so.1, so the new" + echo "Could not remove existing $ROOTDIR/usr/lib/libGL.so.1, so the new" echo "link has not been created." fi if [ -d $RUNDIR/include/GL ]; then - rm -f /usr/include/GL - if [ ! -d /usr/include/GL ]; then - echo "Creating link from $RUNDIR/include/GL to /usr/include/GL" - ln -s $RUNDIR/include/GL /usr/include/GL + rm -f $ROOTDIR/usr/include/GL + if [ ! -d $ROOTDIR/usr/include/GL ]; then + echo "Creating link from $RUNDIR/include/GL to $ROOTDIR/usr/include/GL" + ln -s $RUNDIR/include/GL $ROOTDIR/usr/include/GL else - echo "Could not remove existing /usr/include/GL, so the new" + echo "Could not remove existing $ROOTDIR/usr/include/GL, so the new" echo "link has not been created." fi fi @@ -1276,15 +1420,19 @@ echo "" echo "If you are going to use rstart and $RUNDIR/bin isn't in the" echo "default path for commands run remotely via rsh, you will need" - echo "a link to rstartd installed in /usr/bin." + echo "a link to rstartd installed in $ROOTDIR/usr/bin." echo "" Echo "Do you wish to have this link installed (y/n)? [n] " read response case "$response" in [yY]*) - echo "Creating link from $RUNDIR/bin/rstartd to /usr/bin/rstartd" - rm -f /usr/bin/rstartd - ln -s $RUNDIR/bin/rstartd /usr/bin/rstartd + if [ ! -d $ROOTDIR/usr/bin ]; then + echo "Creating $ROOTDIR/usr/bin" + mkdir $ROOTDIR/usr/bin + fi + echo "Creating link from $RUNDIR/bin/rstartd to $ROOTDIR/usr/bin/rstartd" + rm -f $ROOTDIR/usr/bin/rstartd + ln -s $RUNDIR/bin/rstartd $ROOTDIR/usr/bin/rstartd ;; esac fi Index: xc/programs/Xserver/hw/xfree86/etc/extramodes diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/extramodes:1.1 --- /dev/null Mon Jun 4 12:41:10 2001 +++ xc/programs/Xserver/hw/xfree86/etc/extramodes Thu Feb 15 13:20:34 2001 @@ -0,0 +1,12 @@ +// +// Extra modes to include as default modes in the X server. +// +// $XFree86: xc/programs/Xserver/hw/xfree86/etc/extramodes,v 1.1 2001/02/15 18:20:34 dawes Exp $ +// + +# 1400x1050 @ 60Hz (VESA GFT) hsync: 65.5kHz +ModeLine "1400x1050" 122.0 1400 1488 1640 1880 1050 1052 1064 1082 +hsync +vsync + +# 1400x1050 @ 75Hz (VESA GFT) hsync: 82.2kHz +ModeLine "1400x1050" 155.8 1400 1464 1784 1912 1050 1052 1064 1090 +hsync +vsync + Index: xc/programs/Xserver/hw/xfree86/etc/kbd_mode.man diff -u xc/programs/Xserver/hw/xfree86/etc/kbd_mode.man:3.4 xc/programs/Xserver/hw/xfree86/etc/kbd_mode.man:3.5 --- xc/programs/Xserver/hw/xfree86/etc/kbd_mode.man:3.4 Sat Apr 4 21:28:42 1998 +++ xc/programs/Xserver/hw/xfree86/etc/kbd_mode.man Sat Jan 27 13:20:56 2001 @@ -1,5 +1,5 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/kbd_mode.man,v 3.4 1998/04/05 02:28:42 dawes Exp $ -.TH KBD_MODE 1 "Release 6.3 (XFree86 3.2)" "X Version 11" +.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/kbd_mode.man,v 3.5 2001/01/27 18:20:56 dawes Exp $ +.TH KBD_MODE 1 __vendorversion__ .SH NAME kbd_mode \- recover the PC console keyboard .SH SYNOPSIS Index: xc/programs/Xserver/hw/xfree86/etc/pcitweak.c diff -u xc/programs/Xserver/hw/xfree86/etc/pcitweak.c:1.14 xc/programs/Xserver/hw/xfree86/etc/pcitweak.c:1.15 --- xc/programs/Xserver/hw/xfree86/etc/pcitweak.c:1.14 Thu Aug 10 13:40:34 2000 +++ xc/programs/Xserver/hw/xfree86/etc/pcitweak.c Sat Jan 6 15:19:12 2001 @@ -5,7 +5,7 @@ * * Author: David Dawes <dawes@xfree86.org> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.c,v 1.14 2000/08/10 17:40:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.c,v 1.15 2001/01/06 20:19:12 tsi Exp $ */ #include "X.h" #include "os.h" @@ -31,6 +31,8 @@ extern char *optarg; extern int optind, opterr; #endif + +pciVideoPtr *xf86PciVideoInfo = NULL; static void usage(void); static Bool parsePciBusString(const char *id, int *bus, int *device, int *func); Index: xc/programs/Xserver/hw/xfree86/etc/pcitweak.man diff -u xc/programs/Xserver/hw/xfree86/etc/pcitweak.man:3.2 xc/programs/Xserver/hw/xfree86/etc/pcitweak.man:3.3 --- xc/programs/Xserver/hw/xfree86/etc/pcitweak.man:3.2 Mon Dec 11 15:18:44 2000 +++ xc/programs/Xserver/hw/xfree86/etc/pcitweak.man Sat Jan 27 13:20:56 2001 @@ -1,5 +1,5 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.man,v 3.2 2000/12/11 20:18:44 dawes Exp $ -.TH PCITWEAK 1 "Version 4.0.2" "XFree86" +.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/pcitweak.man,v 3.3 2001/01/27 18:20:56 dawes Exp $ +.TH PCITWEAK 1 __vendorversion__ .SH NAME pcitweak - read/write PCI config space .SH SYNOPSIS Index: xc/programs/Xserver/hw/xfree86/etc/scanpci.c diff -u xc/programs/Xserver/hw/xfree86/etc/scanpci.c:3.80 xc/programs/Xserver/hw/xfree86/etc/scanpci.c:3.81 --- xc/programs/Xserver/hw/xfree86/etc/scanpci.c:3.80 Tue Jun 20 15:38:04 2000 +++ xc/programs/Xserver/hw/xfree86/etc/scanpci.c Sat Jan 6 15:19:12 2001 @@ -21,7 +21,7 @@ * OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.80 2000/06/20 19:38:04 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.c,v 3.81 2001/01/06 20:19:12 tsi Exp $ */ #include "X.h" #include "os.h" @@ -47,6 +47,8 @@ extern char *optarg; extern int optind, opterr; #endif + +pciVideoPtr *xf86PciVideoInfo = NULL; void usage(void); void identify_card(pciConfigPtr pcr, int verbose); Index: xc/programs/Xserver/hw/xfree86/etc/scanpci.man diff -u xc/programs/Xserver/hw/xfree86/etc/scanpci.man:3.2 xc/programs/Xserver/hw/xfree86/etc/scanpci.man:3.3 --- xc/programs/Xserver/hw/xfree86/etc/scanpci.man:3.2 Mon Dec 11 15:18:45 2000 +++ xc/programs/Xserver/hw/xfree86/etc/scanpci.man Sat Jan 27 13:20:56 2001 @@ -1,5 +1,5 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.man,v 3.2 2000/12/11 20:18:45 dawes Exp $ -.TH SCANPCI 1 "Version 4.0.2" "XFree86" +.\" $XFree86: xc/programs/Xserver/hw/xfree86/etc/scanpci.man,v 3.3 2001/01/27 18:20:56 dawes Exp $ +.TH SCANPCI 1 __vendorversion__ .SH NAME scanpci - scan/probe PCI buses .SH SYNOPSIS Index: xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist:1.4.2.2 xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist:1.4.4.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist:1.4.2.2 Mon Mar 12 18:22:46 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist Thu May 31 18:20:25 2001 @@ -1,6 +1,6 @@ #!/bin/sh # -# $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist,v 1.4.2.2 2001/03/12 23:22:46 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/build-bindist,v 1.4.4.1 2001/05/31 22:20:25 dawes Exp $ # Usage() Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/bin-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/bin-excl:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/bin-excl:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/bin-excl:1.1 Sat Dec 9 19:06:17 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/bin-excl Mon Jun 4 12:41:10 2001 @@ -1,6 +0,0 @@ -bin/Xnest -bin/Xprt -bin/Xvfb -bin/X -bin/xfs -bin/Xdarwin Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/bin-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/bin-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/bin-list:1.1 Sat Dec 9 19:06:18 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/bin-list Mon Jun 4 12:41:10 2001 @@ -1 +0,0 @@ -bin Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/dir:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/dir:1.1 Sat Dec 9 19:06:18 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/dir Mon Jun 4 12:41:10 2001 @@ -1 +0,0 @@ -usr/X11R6 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/etc-dir diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/etc-dir:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/etc-dir:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/etc-dir:1.1 Sat Dec 9 19:06:19 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/etc-dir Mon Jun 4 12:41:10 2001 @@ -1 +0,0 @@ -etc/X11 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/etc-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/etc-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/etc-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/etc-list:1.1 Sat Dec 9 19:06:20 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/etc-list Mon Jun 4 12:41:10 2001 @@ -1 +0,0 @@ -. Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/fsrv-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/fsrv-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/fsrv-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/fsrv-list:1.1 Sat Dec 9 19:06:20 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/fsrv-list Mon Jun 4 12:41:10 2001 @@ -1,2 +0,0 @@ -bin/xfs -man/cat1/xfs.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/host.def:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/host.def:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/host.def:1.1 Sat Dec 9 19:06:21 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/host.def Mon Jun 4 12:41:10 2001 @@ -1,8 +0,0 @@ -/* - * Host.def for building Darwin bindists - * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/host.def,v 1.1 2000/12/10 00:06:21 herrb Exp $ - */ - -#define InstallEmptyHostDef - Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/lib-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/lib-excl:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/lib-excl:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/lib-excl:1.1 Sat Dec 9 19:06:21 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/lib-excl Mon Jun 4 12:41:10 2001 @@ -1,14 +0,0 @@ -lib/X11/XF86Setup -lib/X11/app-defaults -lib/X11/config -lib/X11/doc -lib/X11/fonts -lib/X11/fs -lib/X11/lbxproxy -lib/X11/proxymngr -lib/X11/rstart -lib/X11/twm -lib/X11/xdm -lib/X11/xinit -lib/X11/xsm -lib/X11/xserver Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/lib-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/lib-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/lib-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/lib-list:1.1 Sat Dec 9 19:06:22 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/lib-list Mon Jun 4 12:41:10 2001 @@ -1,2 +0,0 @@ -lib/X11 -include/X11/bitmaps Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/man-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/man-excl:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/man-excl:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/man-excl:1.1 Sat Dec 9 19:06:23 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/man-excl Mon Jun 4 12:41:10 2001 @@ -1,3 +0,0 @@ -man/cat1/XF86Setup.0 -man/cat1/xfs.0 -man/cat1/xmseconfig.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/man-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/man-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/man-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/man-list:1.1 Sat Dec 9 19:06:23 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/man-list Mon Jun 4 12:41:10 2001 @@ -1 +0,0 @@ -man Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/nest-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/nest-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/nest-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/nest-list:1.1 Sat Dec 9 19:06:24 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/nest-list Mon Jun 4 12:41:10 2001 @@ -1 +0,0 @@ -bin/Xnest Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prog-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prog-excl:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prog-excl:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prog-excl:1.1 Sat Dec 9 19:06:25 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prog-excl Mon Jun 4 12:41:10 2001 @@ -1,5 +0,0 @@ -lib/Server -lib/X11 -lib/lib*.so* -lib/modules -include/X11/bitmaps Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prog-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prog-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prog-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prog-list:1.1 Sat Dec 9 19:06:25 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prog-list Mon Jun 4 12:41:10 2001 @@ -1,3 +0,0 @@ -lib -include -lib/X11/config Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prt-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prt-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prt-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prt-list:1.1 Sat Dec 9 19:06:26 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/prt-list Mon Jun 4 12:41:10 2001 @@ -1 +0,0 @@ -bin/Xprt Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/update-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/update-upd:1.1.2.3 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/update-upd:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/update-upd:1.1.2.3 Thu Mar 15 14:14:22 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/update-upd Mon Jun 4 12:41:10 2001 @@ -1,30 +0,0 @@ -bin/Xdarwin -bin/gccmakedep -bin/mkhtmlindex -bin/rman -bin/pswrap -bin/twm -bin/xedit -bin/xfs -bin/xman -bin/xterm -include/X11/Xos.h -include/X11/Xosdefs.h -include/X11/Xos_r.h -lib/X11/config/FreeBSD.cf -lib/X11/config/Imake.rules -lib/X11/config/Imake.tmpl -lib/X11/config/NetBSD.cf -lib/X11/config/OpenBSD.cf -lib/X11/config/X11.tmpl -lib/X11/config/gnu.cf -lib/X11/config/linux.cf -lib/X11/config/osf1.cf -lib/X11/config/xfree86.cf -lib/X11/xkb/rules/xfree86.lst -lib/X11/xkb/symbols/us -lib/libX11.a -lib/libXaw.a -lib/libXfont.a -lib/libXft.a -lib/libfreetype.a Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/vfb-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/vfb-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/vfb-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/vfb-list:1.1 Sat Dec 9 19:06:28 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/vfb-list Mon Jun 4 12:41:11 2001 @@ -1 +0,0 @@ -bin/Xvfb Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/xserv-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/xserv-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/xserv-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/xserv-list:1.1 Sat Dec 9 19:06:28 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin/xserv-list Mon Jun 4 12:41:11 2001 @@ -1,2 +0,0 @@ -bin/Xdarwin -bin/X Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-excl diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-excl:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-excl Mon May 28 02:59:41 2001 @@ -0,0 +1,6 @@ +bin/Xnest +bin/Xprt +bin/Xvfb +bin/X +bin/xfs +bin/XDarwin Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list:1.1.2.2 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/bin-list Thu May 31 18:20:25 2001 @@ -0,0 +1,2 @@ +.XFree86_Version +bin Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/dir diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/dir:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/dir Mon May 28 02:59:41 2001 @@ -0,0 +1 @@ +usr/X11R6 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-dir diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-dir:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-dir Mon May 28 02:59:41 2001 @@ -0,0 +1 @@ +etc/X11 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/etc-list Mon May 28 02:59:41 2001 @@ -0,0 +1 @@ +. Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/fsrv-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/fsrv-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/fsrv-list Mon May 28 02:59:41 2001 @@ -0,0 +1,2 @@ +bin/xfs +man/cat1/xfs.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/host.def diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/host.def:1.1.2.2 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/host.def Thu May 31 18:20:25 2001 @@ -0,0 +1,10 @@ +/* + * Host.def for building Darwin/ix86 bindists + * + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/host.def,v 1.1.2.2 2001/05/31 22:20:25 dawes Exp $ + */ + +#define InstallEmptyHostDef +#define BuildBindist + +#define DarwinQuartzSupport NO Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/lib-excl diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/lib-excl:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/lib-excl Mon May 28 02:59:41 2001 @@ -0,0 +1,14 @@ +lib/X11/XF86Setup +lib/X11/app-defaults +lib/X11/config +lib/X11/doc +lib/X11/fonts +lib/X11/fs +lib/X11/lbxproxy +lib/X11/proxymngr +lib/X11/rstart +lib/X11/twm +lib/X11/xdm +lib/X11/xinit +lib/X11/xsm +lib/X11/xserver Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/lib-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/lib-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/lib-list Mon May 28 02:59:41 2001 @@ -0,0 +1,2 @@ +lib/X11 +include/X11/bitmaps Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/man-excl diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/man-excl:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/man-excl Mon May 28 02:59:41 2001 @@ -0,0 +1,3 @@ +man/cat1/XF86Setup.0 +man/cat1/xfs.0 +man/cat1/xmseconfig.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/man-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/man-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/man-list Mon May 28 02:59:41 2001 @@ -0,0 +1 @@ +man Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/nest-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/nest-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/nest-list Mon May 28 02:59:41 2001 @@ -0,0 +1 @@ +bin/Xnest Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prog-excl diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prog-excl:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prog-excl Mon May 28 02:59:41 2001 @@ -0,0 +1,5 @@ +lib/Server +lib/X11 +lib/lib*.so* +lib/modules +include/X11/bitmaps Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prog-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prog-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prog-list Mon May 28 02:59:41 2001 @@ -0,0 +1,3 @@ +lib +include +lib/X11/config Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prt-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prt-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/prt-list Mon May 28 02:59:41 2001 @@ -0,0 +1 @@ +bin/Xprt Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/update-upd diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/update-upd:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/update-upd Thu May 31 18:20:25 2001 @@ -0,0 +1,30 @@ +bin/Xdarwin +bin/gccmakedep +bin/mkhtmlindex +bin/rman +bin/pswrap +bin/twm +bin/xedit +bin/xfs +bin/xman +bin/xterm +include/X11/Xos.h +include/X11/Xosdefs.h +include/X11/Xos_r.h +lib/X11/config/FreeBSD.cf +lib/X11/config/Imake.rules +lib/X11/config/Imake.tmpl +lib/X11/config/NetBSD.cf +lib/X11/config/OpenBSD.cf +lib/X11/config/X11.tmpl +lib/X11/config/darwin.cf +lib/X11/config/gnu.cf +lib/X11/config/linux.cf +lib/X11/config/osf1.cf +lib/X11/config/xfree86.cf +lib/X11/xkb/rules/xfree86.lst +lib/X11/xkb/symbols/us +lib/libX11.a +lib/libXaw.a +lib/libXfont.a +lib/libXft.a Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/vfb-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/vfb-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/vfb-list Mon May 28 02:59:41 2001 @@ -0,0 +1 @@ +bin/Xvfb Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/xserv-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/xserv-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ix86/xserv-list Mon May 28 02:59:41 2001 @@ -0,0 +1,2 @@ +bin/XDarwin +bin/X Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-excl diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-excl:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-excl Mon May 28 02:59:41 2001 @@ -0,0 +1,8 @@ +bin/Xnest +bin/Xprt +bin/Xvfb +bin/X +bin/xfs +bin/XDarwin +bin/XDarwinStartup +bin/XDarwinQuartz Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list:1.1.2.2 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/bin-list Thu May 31 18:20:25 2001 @@ -0,0 +1,2 @@ +.XFree86_Version +bin Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/dir diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/dir:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/dir Mon May 28 02:59:42 2001 @@ -0,0 +1 @@ +usr/X11R6 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-dir diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-dir:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-dir Mon May 28 02:59:42 2001 @@ -0,0 +1 @@ +etc/X11 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/etc-list Mon May 28 02:59:42 2001 @@ -0,0 +1 @@ +. Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/fsrv-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/fsrv-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/fsrv-list Mon May 28 02:59:42 2001 @@ -0,0 +1,2 @@ +bin/xfs +man/cat1/xfs.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/host.def diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/host.def:1.1.2.2 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/host.def Thu May 31 18:20:25 2001 @@ -0,0 +1,9 @@ +/* + * Host.def for building Darwin/ppc bindists + * + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/host.def,v 1.1.2.2 2001/05/31 22:20:25 dawes Exp $ + */ + +#define InstallEmptyHostDef +#define BuildBindist + Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/lib-excl diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/lib-excl:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/lib-excl Mon May 28 02:59:42 2001 @@ -0,0 +1,14 @@ +lib/X11/XF86Setup +lib/X11/app-defaults +lib/X11/config +lib/X11/doc +lib/X11/fonts +lib/X11/fs +lib/X11/lbxproxy +lib/X11/proxymngr +lib/X11/rstart +lib/X11/twm +lib/X11/xdm +lib/X11/xinit +lib/X11/xsm +lib/X11/xserver Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/lib-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/lib-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/lib-list Mon May 28 02:59:42 2001 @@ -0,0 +1,2 @@ +lib/X11 +include/X11/bitmaps Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/man-excl diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/man-excl:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/man-excl Mon May 28 02:59:42 2001 @@ -0,0 +1,3 @@ +man/cat1/XF86Setup.0 +man/cat1/xfs.0 +man/cat1/xmseconfig.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/man-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/man-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/man-list Mon May 28 02:59:42 2001 @@ -0,0 +1 @@ +man Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/nest-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/nest-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/nest-list Mon May 28 02:59:42 2001 @@ -0,0 +1 @@ +bin/Xnest Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prog-excl diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prog-excl:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prog-excl Mon May 28 02:59:42 2001 @@ -0,0 +1,5 @@ +lib/Server +lib/X11 +lib/lib*.so* +lib/modules +include/X11/bitmaps Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prog-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prog-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prog-list Mon May 28 02:59:42 2001 @@ -0,0 +1,3 @@ +lib +include +lib/X11/config Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prt-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prt-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/prt-list Mon May 28 02:59:42 2001 @@ -0,0 +1 @@ +bin/Xprt Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/quartz-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/quartz-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/quartz-list Mon May 28 02:59:42 2001 @@ -0,0 +1,4 @@ +bin/X +bin/XDarwinStartup +bin/XDarwinQuartz +../../Applications/XDarwin.app Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/update-upd diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/update-upd:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/update-upd Thu May 31 18:20:25 2001 @@ -0,0 +1,30 @@ +bin/Xdarwin +bin/gccmakedep +bin/mkhtmlindex +bin/rman +bin/pswrap +bin/twm +bin/xedit +bin/xfs +bin/xman +bin/xterm +include/X11/Xos.h +include/X11/Xosdefs.h +include/X11/Xos_r.h +lib/X11/config/FreeBSD.cf +lib/X11/config/Imake.rules +lib/X11/config/Imake.tmpl +lib/X11/config/NetBSD.cf +lib/X11/config/OpenBSD.cf +lib/X11/config/X11.tmpl +lib/X11/config/darwin.cf +lib/X11/config/gnu.cf +lib/X11/config/linux.cf +lib/X11/config/osf1.cf +lib/X11/config/xfree86.cf +lib/X11/xkb/rules/xfree86.lst +lib/X11/xkb/symbols/us +lib/libX11.a +lib/libXaw.a +lib/libXfont.a +lib/libXft.a Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/vfb-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/vfb-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/vfb-list Mon May 28 02:59:42 2001 @@ -0,0 +1 @@ +bin/Xvfb Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/xserv-list diff -u /dev/null xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/xserv-list:1.1.2.1 --- /dev/null Mon Jun 4 12:41:11 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Darwin-ppc/xserv-list Mon May 28 02:59:42 2001 @@ -0,0 +1,2 @@ +bin/XDarwin +bin/X Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list:1.9 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list:1.9.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list:1.9 Thu Dec 14 17:06:34 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/bin-list Fri Jun 1 12:57:39 2001 @@ -1,7 +1,10 @@ +.XFree86_Version bin lib/aout lib/libGL.so.1 lib/libGL.so +lib/libGLU.so.1 +lib/libGLU.so lib/libICE.so.6 lib/libICE.so lib/libOSMesa.so.3 @@ -29,6 +32,8 @@ lib/libXi.so lib/libXmu.so.6 lib/libXmu.so +lib/libXmuu.so.1 +lib/libXmuu.so lib/libXp.so.6 lib/libXp.so lib/libXpm.so.4 @@ -43,6 +48,8 @@ lib/libdps.so lib/libdpstk.so.1 lib/libdpstk.so +lib/libfreetype.so.6 +lib/libfreetype.so lib/liboldX.so.6 lib/liboldX.so lib/libpsres.so.1 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def:1.3.4.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def:1.3 Tue Mar 7 09:47:31 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def Thu May 31 18:20:27 2001 @@ -1,8 +1,9 @@ /* * Host.def for building FreeBSD bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def,v 1.3 2000/03/07 14:47:31 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD/host.def,v 1.3.4.1 2001/05/31 22:20:27 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list:1.7 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list:1.7.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list:1.7 Thu Dec 14 21:06:06 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/bin-list Fri Jun 1 12:57:39 2001 @@ -1,5 +1,7 @@ +.XFree86_Version bin lib/libGL.so.1.2 +lib/libGLU.so.1.3 lib/libICE.so.6.3 lib/libPEX5.so.6.0 lib/libSM.so.6.0 @@ -13,6 +15,7 @@ lib/libXft.so.1.0 lib/libXi.so.6.0 lib/libXmu.so.6.2 +lib/libXmuu.so.1.0 lib/libXp.so.6.2 lib/libXpm.so.4.11 lib/libXrender.so.1.0 @@ -20,6 +23,7 @@ lib/libXtst.so.6.1 lib/libdps.so.1.0 lib/libdpstk.so.1.0 +lib/libfreetype.so.6.0 lib/liboldX.so.6.0 lib/libpsres.so.1.0 lib/libxrx.so.6.3 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def:1.3.4.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def:1.3 Tue Mar 7 09:47:32 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def Thu May 31 18:20:28 2001 @@ -1,8 +1,9 @@ /* * Host.def for building FreeBSD/a.out bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def,v 1.3 2000/03/07 14:47:32 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/host.def,v 1.3.4.1 2001/05/31 22:20:28 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist Index: xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/update-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/update-upd:1.1.2.4 xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/update-upd:1.2.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/update-upd:1.1.2.4 Thu Mar 15 18:09:42 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/FreeBSD-aout/update-upd Thu May 31 18:20:28 2001 @@ -27,26 +27,15 @@ lib/X11/xkb/rules/xfree86.lst lib/X11/xkb/symbols/us lib/libX11.a -lib/libX11.so -lib/libX11.so.6 lib/libX11.so.6.2 lib/libXaw.a -lib/libXaw.so -lib/libXaw.so.6 lib/libXaw.so.6.1 -lib/libXaw.so.7 lib/libXaw.so.7.0 lib/libXfont.a -lib/libXfont.so -lib/libXfont.so.1 lib/libXfont.so.1.3 lib/libXft.a -lib/libXft.so -lib/libXft.so.1 lib/libXft.so.1.0 lib/libfreetype.a -lib/libfreetype.so -lib/libfreetype.so.6 lib/libfreetype.so.6.0 man/man1/XFree86.1.gz man/man4/nv.4.gz Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/bin-list:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/bin-list:1.1.12.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/bin-list:1.1 Tue May 27 00:00:31 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Interactive/bin-list Thu May 31 18:20:28 2001 @@ -1 +1,2 @@ +.XFree86_Version bin Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list:1.8 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list:1.8.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list:1.8 Thu Dec 14 17:06:35 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/bin-list Fri Jun 1 12:57:39 2001 @@ -1,7 +1,11 @@ +.XFree86_Version bin lib/libGL.so.1.2 lib/libGL.so.1 lib/libGL.so +lib/libGLU.so.1.3 +lib/libGLU.so.1 +lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so.6 lib/libICE.so @@ -40,6 +44,9 @@ lib/libXmu.so.6.2 lib/libXmu.so.6 lib/libXmu.so +lib/libXmuu.so.1.0 +lib/libXmuu.so.1 +lib/libXmuu.so lib/libXp.so.6.2 lib/libXp.so.6 lib/libXp.so @@ -61,6 +68,9 @@ lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so +lib/libfreetype.so.6.0 +lib/libfreetype.so.6 +lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so.1 lib/libpsres.so Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def:1.5 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def:1.6.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def:1.5 Mon Dec 18 09:34:58 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def Thu May 31 18:20:28 2001 @@ -1,10 +1,11 @@ /* * Host.def for building Linux/alpha bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def,v 1.5 2000/12/18 14:34:58 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/host.def,v 1.6.2.1 2001/05/31 22:20:28 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist /* Need to have glide 3 installed, where available */ @@ -13,4 +14,6 @@ #endif #define BuildXF86DRI YES + +#define ForceNormalLib YES Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/update-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/update-upd:1.1.2.4 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/update-upd:1.2.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/update-upd:1.1.2.4 Thu Mar 15 18:09:42 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-axp/update-upd Thu May 31 18:20:28 2001 @@ -29,19 +29,25 @@ lib/libX11.a lib/libX11.so lib/libX11.so.6 +lib/libX11.so.6.2 lib/libXaw.a lib/libXaw.so lib/libXaw.so.6 +lib/libXaw.so.6.1 lib/libXaw.so.7 +lib/libXaw.so.7.0 lib/libXfont.a lib/libXfont.so lib/libXfont.so.1 +lib/libXfont.so.1.3 lib/libXft.a lib/libXft.so lib/libXft.so.1 +lib/libXft.so.1.0 lib/libfreetype.a lib/libfreetype.so lib/libfreetype.so.6 -man/man1/XFree86.1.gz -man/man4/nv.4.gz -man/man5/XF86Config.5.gz +lib/libfreetype.so.6.0 +man/man1/XFree86.1x +man/man4/nv.4 +man/man5/XF86Config.5x Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list:1.8 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list:1.8.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list:1.8 Thu Dec 14 17:06:35 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/bin-list Fri Jun 1 12:57:39 2001 @@ -1,7 +1,11 @@ +.XFree86_Version bin lib/libGL.so.1.2 lib/libGL.so.1 lib/libGL.so +lib/libGLU.so.1.3 +lib/libGLU.so.1 +lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so.6 lib/libICE.so @@ -40,6 +44,9 @@ lib/libXmu.so.6.2 lib/libXmu.so.6 lib/libXmu.so +lib/libXmuu.so.1.0 +lib/libXmuu.so.1 +lib/libXmuu.so lib/libXp.so.6.2 lib/libXp.so.6 lib/libXp.so @@ -61,6 +68,9 @@ lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so +lib/libfreetype.so.6.0 +lib/libfreetype.so.6 +lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so.1 lib/libpsres.so Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def:1.6 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def:1.7.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def:1.6 Fri Mar 17 10:59:46 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def Thu May 31 18:20:29 2001 @@ -1,10 +1,11 @@ /* * Host.def for building Linux/ix86 bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def,v 1.6 2000/03/17 15:59:46 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/host.def,v 1.7.2.1 2001/05/31 22:20:29 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist /* Need to have glide 2 and glide 3 installed, where available */ @@ -15,4 +16,6 @@ #endif #define BuildXF86DRI YES + +#define ForceNormalLib YES Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/update-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/update-upd:1.1.2.4 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/update-upd:1.2.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/update-upd:1.1.2.4 Thu Mar 15 18:09:43 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ix86/update-upd Thu May 31 18:20:29 2001 @@ -29,19 +29,25 @@ lib/libX11.a lib/libX11.so lib/libX11.so.6 +lib/libX11.so.6.2 lib/libXaw.a lib/libXaw.so lib/libXaw.so.6 +lib/libXaw.so.6.1 lib/libXaw.so.7 +lib/libXaw.so.7.0 lib/libXfont.a lib/libXfont.so lib/libXfont.so.1 +lib/libXfont.so.1.3 lib/libXft.a lib/libXft.so lib/libXft.so.1 +lib/libXft.so.1.0 lib/libfreetype.a lib/libfreetype.so lib/libfreetype.so.6 -man/man1/XFree86.1.gz -man/man4/nv.4.gz -man/man5/XF86Config.5.gz +lib/libfreetype.so.6.0 +man/man1/XFree86.1x +man/man4/nv.4 +man/man5/XF86Config.5x Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list:1.7 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list:1.7.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list:1.7 Thu Dec 14 17:06:35 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/bin-list Fri Jun 1 12:57:39 2001 @@ -1,7 +1,11 @@ +.XFree86_Version bin lib/libGL.so.1.2 lib/libGL.so.1 lib/libGL.so +lib/libGLU.so.1.3 +lib/libGLU.so.1 +lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so.6 lib/libICE.so @@ -40,6 +44,9 @@ lib/libXmu.so.6.2 lib/libXmu.so.6 lib/libXmu.so +lib/libXmuu.so.1.0 +lib/libXmuu.so.1 +lib/libXmuu.so lib/libXp.so.6.2 lib/libXp.so.6 lib/libXp.so @@ -61,6 +68,9 @@ lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so +lib/libfreetype.so.6.0 +lib/libfreetype.so.6 +lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so.1 lib/libpsres.so Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def:1.4 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def:1.5.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def:1.4 Tue Mar 7 09:47:34 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def Thu May 31 18:20:31 2001 @@ -1,8 +1,11 @@ /* * Host.def for building Linux/m68k bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def,v 1.4 2000/03/07 14:47:34 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-m68k/host.def,v 1.5.2.1 2001/05/31 22:20:31 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist + +#define ForceNormalLib YES Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list:1.4 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list:1.4.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list:1.4 Thu Dec 14 17:06:36 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-mips/bin-list Fri Jun 1 12:57:40 2001 @@ -1,7 +1,11 @@ +.XFree86_Version bin lib/libGL.so.1.2 lib/libGL.so.1 lib/libGL.so +lib/libGLU.so.1.3 +lib/libGLU.so.1 +lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so.6 lib/libICE.so @@ -40,6 +44,9 @@ lib/libXmu.so.6.2 lib/libXmu.so.6 lib/libXmu.so +lib/libXmuu.so.1.0 +lib/libXmuu.so.1 +lib/libXmuu.so lib/libXp.so.6.2 lib/libXp.so.6 lib/libXp.so @@ -61,6 +68,9 @@ lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so +lib/libfreetype.so.6.0 +lib/libfreetype.so.6 +lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so.1 lib/libpsres.so Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list:1.4 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list:1.4.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list:1.4 Thu Dec 14 17:06:37 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/bin-list Fri Jun 1 12:57:40 2001 @@ -1,7 +1,11 @@ +.XFree86_Version bin lib/libGL.so.1.2 lib/libGL.so.1 lib/libGL.so +lib/libGLU.so.1.3 +lib/libGLU.so.1 +lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so.6 lib/libICE.so @@ -40,6 +44,9 @@ lib/libXmu.so.6.2 lib/libXmu.so.6 lib/libXmu.so +lib/libXmuu.so.1.0 +lib/libXmuu.so.1 +lib/libXmuu.so lib/libXp.so.6.2 lib/libXp.so.6 lib/libXp.so @@ -61,6 +68,9 @@ lib/libdpstk.so.1.0 lib/libdpstk.so.1 lib/libdpstk.so +lib/libfreetype.so.6.0 +lib/libfreetype.so.6 +lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so.1 lib/libpsres.so Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def:1.4.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def:1.3 Tue Mar 7 09:47:36 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def Thu May 31 18:20:31 2001 @@ -1,8 +1,11 @@ /* * Host.def for building Linux/ppc bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def,v 1.3 2000/03/07 14:47:36 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Linux-ppc/host.def,v 1.4.2.1 2001/05/31 22:20:31 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist + +#define ForceNormalLib YES Index: xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/bin-list:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/bin-list:1.3.4.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/bin-list:1.3 Sat Feb 26 20:24:24 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/bin-list Thu May 31 18:20:31 2001 @@ -1 +1,2 @@ +.XFree86_Version bin Index: xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/host.def:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/host.def:1.3.4.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/host.def:1.3 Fri Mar 3 15:02:16 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/host.def Thu May 31 18:20:31 2001 @@ -1,8 +1,11 @@ /* * host.def for building LynxOS binary dists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/host.def,v 1.3 2000/03/03 20:02:16 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/LynxOS/host.def,v 1.3.4.1 2001/05/31 22:20:31 dawes Exp $ */ +#define BuildBindist + #define HasLibCrypt YES #define HasMTRRSupport YES + Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list:1.4 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list:1.4.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list:1.4 Thu Dec 14 21:06:11 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/bin-list Fri Jun 1 12:57:40 2001 @@ -1,5 +1,7 @@ +.XFree86_Version bin lib/libGL.so.1.2 +lib/libGLU.so.1.3 lib/libICE.so.6.3 lib/libPEX5.so.6.0 lib/libSM.so.6.0 @@ -12,6 +14,7 @@ lib/libXft.so.1.0 lib/libXi.so.6.0 lib/libXmu.so.6.2 +lib/libXmuu.so.1.0 lib/libXp.so.6.2 lib/libXpm.so.4.11 lib/libXrender.so.1.0 @@ -19,5 +22,6 @@ lib/libXtst.so.6.1 lib/libdps.so.1.0 lib/libdpstk.so.1.0 +lib/libfreetype.so.6.0 lib/liboldX.so.6.0 lib/libpsres.so.1.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/drivers-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/drivers-upd:1.1.2.2 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/drivers-upd:1.2.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/drivers-upd:1.1.2.2 Fri Mar 16 11:22:39 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/drivers-upd Thu May 31 18:20:32 2001 @@ -1,7 +1,6 @@ lib/modules/drivers/chips_drv.o lib/modules/drivers/cyrix_drv.o lib/modules/drivers/glint_drv.o -lib/modules/drivers/i810_drv.o lib/modules/drivers/mga_drv.o lib/modules/drivers/neomagic_drv.o lib/modules/drivers/nv_drv.o Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def:1.1.4.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def:1.1 Sat Dec 9 16:46:27 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def Thu May 31 18:20:32 2001 @@ -1,8 +1,9 @@ /* * Host.def for building NetBSD bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def,v 1.1 2000/12/09 21:46:27 herrb Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-aout-ix86/host.def,v 1.1.4.1 2001/05/31 22:20:32 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list:1.9 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list:1.9.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list:1.9 Thu Dec 14 21:06:12 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/bin-list Fri Jun 1 12:57:40 2001 @@ -1,7 +1,11 @@ +.XFree86_Version bin lib/libGL.so lib/libGL.so.1 lib/libGL.so.1.2 +lib/libGLU.so +lib/libGLU.so.1 +lib/libGLU.so.1.3 lib/libICE.so lib/libICE.so.6 lib/libICE.so.6.3 @@ -37,6 +41,9 @@ lib/libXmu.so lib/libXmu.so.6 lib/libXmu.so.6.2 +lib/libXmuu.so +lib/libXmuu.so.1 +lib/libXmuu.so.1.0 lib/libXp.so lib/libXp.so.6 lib/libXp.so.6.2 @@ -58,6 +65,9 @@ lib/libdpstk.so lib/libdpstk.so.1 lib/libdpstk.so.1.0 +lib/libfreetype.so +lib/libfreetype.so.6 +lib/libfreetype.so.6.0 lib/liboldX.so lib/liboldX.so.6 lib/liboldX.so.6.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/drivers-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/drivers-upd:1.1.2.2 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/drivers-upd:1.2.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/drivers-upd:1.1.2.2 Fri Mar 16 11:22:39 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/drivers-upd Thu May 31 18:20:32 2001 @@ -1,7 +1,6 @@ lib/modules/drivers/chips_drv.o lib/modules/drivers/cyrix_drv.o lib/modules/drivers/glint_drv.o -lib/modules/drivers/i810_drv.o lib/modules/drivers/mga_drv.o lib/modules/drivers/neomagic_drv.o lib/modules/drivers/nv_drv.o Index: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def:1.3.4.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def:1.3 Tue Mar 7 09:47:36 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def Thu May 31 18:20:32 2001 @@ -1,8 +1,9 @@ /* * Host.def for building NetBSD bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def,v 1.3 2000/03/07 14:47:36 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/NetBSD-ix86/host.def,v 1.3.4.1 2001/05/31 22:20:32 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list:1.11 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list:1.11.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list:1.11 Thu Dec 14 21:06:14 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/bin-list Fri Jun 1 12:57:40 2001 @@ -1,5 +1,7 @@ +.XFree86_Version bin lib/libGL.so.1.2 +lib/libGLU.so.1.3 lib/libICE.so.6.3 lib/libPEX5.so.6.0 lib/libSM.so.6.0 @@ -13,6 +15,7 @@ lib/libXft.so.1.0 lib/libXi.so.6.0 lib/libXmu.so.6.2 +lib/libXmuu.so.1.0 lib/libXp.so.6.2 lib/libXpm.so.4.11 lib/libXrender.so.1.0 @@ -20,5 +23,6 @@ lib/libXtst.so.6.1 lib/libdps.so.1.0 lib/libdpstk.so.1.0 +lib/libfreetype.so.6.0 lib/liboldX.so.6.0 lib/libpsres.so.1.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/drivers-upd diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/drivers-upd:1.1.2.2 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/drivers-upd:1.2.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/drivers-upd:1.1.2.2 Fri Mar 16 11:22:40 2001 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/drivers-upd Thu May 31 18:20:33 2001 @@ -1,7 +1,6 @@ lib/modules/drivers/chips_drv.o lib/modules/drivers/cyrix_drv.o lib/modules/drivers/glint_drv.o -lib/modules/drivers/i810_drv.o lib/modules/drivers/mga_drv.o lib/modules/drivers/neomagic_drv.o lib/modules/drivers/nv_drv.o Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def:1.3.4.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def:1.3 Sat Feb 26 20:29:03 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def Thu May 31 18:20:33 2001 @@ -1,10 +1,11 @@ /* * Host.def for building OpenBSD/ix86 bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def,v 1.3 2000/02/27 01:29:03 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-ix86/host.def,v 1.3.4.1 2001/05/31 22:20:33 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist #define ForceNormalLib YES Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list:1.3.8.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list:1.3 Sun Jul 5 14:47:29 1998 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/bin-list Fri Jun 1 12:57:40 2001 @@ -1,3 +1,4 @@ +.XFree86_Version bin lib/libICE.so.6.3 lib/libPEX5.so.6.0 @@ -8,6 +9,7 @@ lib/libXext.so.6.3 lib/libXi.so.6.0 lib/libXmu.so.6.0 +lib/libXmuu.so.1.0 lib/libXp.so.6.2 lib/libXt.so.6.0 lib/libXtst.so.6.1 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def:1.2 xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def:1.2.4.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def:1.2 Sat Feb 26 20:39:18 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def Thu May 31 18:20:34 2001 @@ -1,10 +1,11 @@ /* * Host.def for building OpenBSD/sparc bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def,v 1.2 2000/02/27 01:39:18 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/OpenBSD-sparc/host.def,v 1.2.4.1 2001/05/31 22:20:34 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist #define ForceNormalLib YES Index: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list:1.8 xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list:1.8.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list:1.8 Thu Dec 14 21:06:15 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/bin-list Fri Jun 1 12:57:41 2001 @@ -1,6 +1,9 @@ +.XFree86_Version bin lib/libGL.so.1.2 lib/libGL.so +lib/libGLU.so.1.3 +lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so lib/libPEX5.so.6.0 @@ -24,6 +27,8 @@ lib/libXi.so lib/libXmu.so.6.2 lib/libXmu.so +lib/libXmuu.so.1.0 +lib/libXmuu.so lib/libXp.so.6.2 lib/libXp.so lib/libXpm.so.4.11 @@ -38,6 +43,8 @@ lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so +lib/libfreetype.so.6.0 +lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so lib/liboldX.so.6.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def:1.4.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def:1.3 Tue Mar 7 09:47:37 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def Thu May 31 18:20:35 2001 @@ -1,8 +1,11 @@ /* * Host.def for building SVR4.0 bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def,v 1.3 2000/03/07 14:47:37 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/SVR4.0/host.def,v 1.4.2.1 2001/05/31 22:20:35 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist + +#define ForceNormalLib YES Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list:1.8 xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list:1.8.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list:1.8 Thu Dec 14 21:06:16 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/bin-list Fri Jun 1 12:57:41 2001 @@ -1,6 +1,9 @@ +.XFree86_Version bin lib/libGL.so.1.2 lib/libGL.so +lib/libGLU.so.1.3 +lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so lib/libPEX5.so.6.0 @@ -24,6 +27,8 @@ lib/libXi.so lib/libXmu.so.6.2 lib/libXmu.so +lib/libXmuu.so.1.0 +lib/libXmuu.so lib/libXp.so.6.2 lib/libXp.so lib/libXpm.so.4.11 @@ -38,6 +43,8 @@ lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so +lib/libfreetype.so.6.0 +lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so lib/liboldX.so.6.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def:1.4.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def:1.3 Tue Mar 7 09:47:38 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def Thu May 31 18:20:35 2001 @@ -1,8 +1,11 @@ /* * Host.def for building Solaris bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def,v 1.3 2000/03/07 14:47:38 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/Solaris/host.def,v 1.4.2.1 2001/05/31 22:20:35 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist + +#define ForceNormalLib YES Index: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list:1.8 xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list:1.8.4.2 --- xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list:1.8 Thu Dec 14 21:06:17 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/bin-list Fri Jun 1 12:57:41 2001 @@ -1,6 +1,9 @@ +.XFree86_Version bin lib/libGL.so.1.2 lib/libGL.so +lib/libGLU.so.1.3 +lib/libGLU.so lib/libICE.so.6.3 lib/libICE.so lib/libPEX5.so.6.0 @@ -24,6 +27,8 @@ lib/libXi.so lib/libXmu.so.6.2 lib/libXmu.so +lib/libXmuu.so.1.0 +lib/libXmuu.so lib/libXp.so.6.2 lib/libXp.so lib/libXpm.so.4.11 @@ -38,6 +43,8 @@ lib/libdps.so lib/libdpstk.so.1.0 lib/libdpstk.so +lib/libfreetype.so.6.0 +lib/libfreetype.so lib/libpsres.so.1.0 lib/libpsres.so lib/liboldX.so.6.0 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def:1.4.2.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def:1.3 Tue Mar 7 09:47:39 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def Thu May 31 18:20:36 2001 @@ -1,8 +1,11 @@ /* * Host.def for building UnixWare bindists * - * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def,v 1.3 2000/03/07 14:47:39 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/etc/bindist/UnixWare/host.def,v 1.4.2.1 2001/05/31 22:20:36 dawes Exp $ */ #define InstallEmptyHostDef +#define BuildBindist + +#define ForceNormalLib YES Index: xc/programs/Xserver/hw/xfree86/etc/bindist/common/extras diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/common/extras:1.4 xc/programs/Xserver/hw/xfree86/etc/bindist/common/extras:1.4.4.1 --- xc/programs/Xserver/hw/xfree86/etc/bindist/common/extras:1.4 Sat Feb 26 20:01:56 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/common/extras Fri Jun 1 14:34:49 2001 @@ -1,5 +1,4 @@ lib/X11/doc/BugReport -lib/X11/doc/RELNOTES lib/X11/doc/README lib/X11/doc/Install lib/X11/etc/Xinstall.sh Index: xc/programs/Xserver/hw/xfree86/etc/bindist/common/flat2-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/common/flat2-list:1.3 xc/programs/Xserver/hw/xfree86/etc/bindist/common/flat2-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/common/flat2-list:1.3 Tue Feb 22 13:14:10 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/common/flat2-list Mon Jun 4 12:41:17 2001 @@ -1 +0,0 @@ -lib/X11/fonts/latin2 Index: xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnon-list diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnon-list:1.2 xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnon-list:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnon-list:1.2 Tue Feb 22 13:05:07 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnon-list Mon Jun 4 12:41:17 2001 @@ -1,9 +0,0 @@ -lib/X11/fonts/misc/gb16fs.pcf.gz -lib/X11/fonts/misc/gb16st.pcf.gz -lib/X11/fonts/misc/gb24st.pcf.gz -lib/X11/fonts/misc/hanglg16.pcf.gz -lib/X11/fonts/misc/hanglm16.pcf.gz -lib/X11/fonts/misc/hanglm24.pcf.gz -lib/X11/fonts/misc/jiskan16.pcf.gz -lib/X11/fonts/misc/jiskan24.pcf.gz -lib/X11/fonts/misc/k14.pcf.gz Index: xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnts-excl diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnts-excl:1.1 xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnts-excl:removed --- xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnts-excl:1.1 Tue May 27 00:01:19 1997 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/common/fnts-excl Mon Jun 4 12:41:17 2001 @@ -1,5 +0,0 @@ -lib/X11/fonts/misc/gb* -lib/X11/fonts/misc/hang* -lib/X11/fonts/misc/heb* -lib/X11/fonts/misc/jiskan* -lib/X11/fonts/misc/k14* Index: xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def diff -u xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def:1.8.2.1 xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def:1.9 --- xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def:1.8.2.1 Tue Dec 19 13:13:36 2000 +++ xc/programs/Xserver/hw/xfree86/etc/bindist/common/host.def Mon Apr 23 11:54:04 2001 @@ -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.2.1 2000/12/19 18:13:36 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 \ @@ -21,5 +22,5 @@ #define InstallHardcopyDocs YES #define HardcopyDocDirs RX XIE XKB XPRINT -#define InstallMiscManPages YES + Index: xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile diff -u xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile:1.9 xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile:1.10 --- xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile:1.9 Sun Dec 17 17:23:37 2000 +++ xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile Tue Jan 23 19:06:34 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile,v 1.9 2000/12/17 22:23:37 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/Imakefile,v 1.10 2001/01/24 00:06:34 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -26,7 +26,6 @@ #ifdef LinuxArchitecture InstallLibraryModule(fbdevhw,$(MODULEDIR),linux) #endif -CppManTarget(fbdevhw,) InstallModuleManPage(fbdevhw) #ifndef OS2Architecture Index: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c diff -u xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c:1.21 xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c:1.24 --- xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c:1.21 Tue Oct 24 18:45:09 2000 +++ xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c Fri Apr 6 14:16:31 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c,v 1.21 2000/10/24 22:45:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.c,v 1.24 2001/04/06 18:16:31 dawes Exp $ */ /* all driver need this */ #include "xf86.h" @@ -16,11 +16,9 @@ #include "asm/page.h" /* #define for PAGE_* */ -#ifdef DPMSExtension #include "globals.h" #define DPMS_SERVER #include "extensions/dpms.h" -#endif #define DEBUG 0 @@ -529,7 +527,7 @@ void calculateFbmem_len(fbdevHWPtr fPtr) { - fPtr->fboff = (unsigned int) fPtr->fix.smem_start & ~PAGE_MASK; + fPtr->fboff = (unsigned long) fPtr->fix.smem_start & ~PAGE_MASK; fPtr->fbmem_len = (fPtr->fboff+fPtr->fix.smem_len+~PAGE_MASK) & PAGE_MASK; } @@ -598,7 +596,7 @@ perror("FBIOPUT_VSCREENINFO"); return FALSE; } - mmio_off = (unsigned int) fPtr->fix.mmio_start & ~PAGE_MASK; + mmio_off = (unsigned long) fPtr->fix.mmio_start & ~PAGE_MASK; fPtr->mmio_len = (mmio_off+fPtr->fix.mmio_len+~PAGE_MASK) & PAGE_MASK; if (NULL == fPtr->fbmem) @@ -790,7 +788,6 @@ void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) { -#ifdef DPMSExtension fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); unsigned long fbmode; @@ -814,5 +811,22 @@ if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)fbmode)) perror("ioctl FBIOBLANK"); -#endif /* DPMSExtension */ +} + +Bool +fbdevHWSaveScreen(ScreenPtr pScreen, int mode) +{ + ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum]; + fbdevHWPtr fPtr = FBDEVHWPTR(pScrn); + unsigned long unblank; + + if (!pScrn->vtSema) + return; + + unblank = xf86IsUnblank(mode); + + if (-1 == ioctl(fPtr->fd, FBIOBLANK, (void *)(1-unblank))) + return FALSE; + + return TRUE; } Index: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.cpp diff -u xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.cpp:1.4 xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.cpp:removed --- xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.cpp:1.4 Mon Dec 11 15:29:50 2000 +++ xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.cpp Mon Jun 4 12:41:18 2001 @@ -1,21 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.cpp,v 1.4 2000/12/11 20:29:50 dawes Exp $ -.TH FBDEVHW __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -fbdevhw \- os-specific submodule for framebuffer device access -.SH DESCRIPTION -.B fbdevhw -provides functions for talking to a framebuffer device. It is -os-specific. It is a submodule used by other video drivers. -A -.B fbdevhw -module is currently available for linux framebuffer devices. -.PP -fbdev(__drivermansuffix__) is a non-accelerated driver which runs on top of the -fbdevhw module. fbdevhw can be used by other drivers too, this -is usually activated with `Option "UseFBDev"' in the device section. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__), -fbdev(__drivermansuffix__) -.SH AUTHORS -Authors include: Gerd Knorr, based on the XF68_FBDev Server code -(Martin Schaller, Geert Uytterhoeven). Index: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h diff -u xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h:1.9 xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h:1.10 --- xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h:1.9 Sat Nov 18 14:37:14 2000 +++ xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h Fri Apr 6 14:16:31 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h,v 1.9 2000/11/18 19:37:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.h,v 1.10 2001/04/06 18:16:31 dawes Exp $ */ #ifndef _FBDEVHW_H_ #define _FBDEVHW_H_ @@ -46,5 +46,7 @@ Bool fbdevHWEnterVT(int scrnIndex, int flags); void fbdevHWLeaveVT(int scrnIndex, int flags); void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags); + +Bool fbdevHWSaveScreen(ScreenPtr pScreen, int mode); #endif Index: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.man:1.2 --- /dev/null Mon Jun 4 12:41:18 2001 +++ xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.man Sat Jan 27 13:20:56 2001 @@ -0,0 +1,21 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhw.man,v 1.2 2001/01/27 18:20:56 dawes Exp $ +.TH FBDEVHW __drivermansuffix__ __vendorversion__ +.SH NAME +fbdevhw \- os-specific submodule for framebuffer device access +.SH DESCRIPTION +.B fbdevhw +provides functions for talking to a framebuffer device. It is +os-specific. It is a submodule used by other video drivers. +A +.B fbdevhw +module is currently available for linux framebuffer devices. +.PP +fbdev(__drivermansuffix__) is a non-accelerated driver which runs on top of the +fbdevhw module. fbdevhw can be used by other drivers too, this +is usually activated with `Option "UseFBDev"' in the device section. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__), +fbdev(__drivermansuffix__) +.SH AUTHORS +Authors include: Gerd Knorr, based on the XF68_FBDev Server code +(Martin Schaller, Geert Uytterhoeven). Index: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c diff -u xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c:1.9 xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c:1.10 --- xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c:1.9 Fri Oct 20 10:59:01 2000 +++ xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c Fri Apr 6 14:16:31 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c,v 1.9 2000/10/20 14:59:01 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/fbdevhw/fbdevhwstub.c,v 1.10 2001/04/06 18:16:31 dawes Exp $ */ #include "xf86.h" #include "xf86cmap.h" @@ -159,5 +159,10 @@ void fbdevHWDPMSSet(ScrnInfoPtr pScrn, int mode, int flags) +{ +} + +Bool +fbdevHWSaveScreen(ScreenPtr pScreen, int mode) { } Index: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c diff -u xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c:1.8 xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c:1.9 --- xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c:1.8 Fri Nov 3 13:46:15 2000 +++ xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c Mon Jan 22 16:09:37 2001 @@ -6,7 +6,7 @@ * (c) 1998 Gerd Knorr <kraxel@cs.tu-berlin.de> */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c,v 1.8 2000/11/03 18:46:15 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.c,v 1.9 2001/01/22 21:09:37 dawes Exp $ */ #if 1 #include "misc.h" @@ -444,8 +444,8 @@ * be executed anyway to leave the bus in clean idle state. */ -Bool -xf86I2CWriteRead(I2CDevPtr d, +static Bool +I2CWriteRead(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite, I2CByte *ReadBuffer, int nRead) { @@ -478,6 +478,17 @@ return r; } +/* wrapper - for compatibility and convinience */ + +Bool +xf86I2CWriteRead(I2CDevPtr d, + I2CByte *WriteBuffer, int nWrite, + I2CByte *ReadBuffer, int nRead) +{ + I2CBusPtr b = d->pI2CBus; + return b->I2CWriteRead(d,WriteBuffer,nWrite,ReadBuffer,nRead); +} + /* Read a byte, the only readable register of a device. */ @@ -818,21 +829,25 @@ * In this case we need the low-level * function. */ - - if (b->I2CPutBits == NULL || - b->I2CGetBits == NULL) + if (b->I2CWriteRead == NULL) { - if (b->I2CPutByte == NULL || - b->I2CGetByte == NULL || - b->I2CAddress == NULL || - b->I2CStop == NULL) - return FALSE; - } else { - b->I2CPutByte = I2CPutByte; - b->I2CGetByte = I2CGetByte; - b->I2CAddress = I2CAddress; - b->I2CStop = I2CStop; - } + b->I2CWriteRead=I2CWriteRead; + + if (b->I2CPutBits == NULL || + b->I2CGetBits == NULL) + { + if (b->I2CPutByte == NULL || + b->I2CGetByte == NULL || + b->I2CAddress == NULL || + b->I2CStop == NULL) + return FALSE; + } else { + b->I2CPutByte = I2CPutByte; + b->I2CGetByte = I2CGetByte; + b->I2CAddress = I2CAddress; + b->I2CStop = I2CStop; + } + } if (b->I2CUDelay == NULL) b->I2CUDelay = I2CUDelay; Index: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h diff -u xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h:1.6 xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h:1.7 --- xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h:1.6 Fri Nov 3 13:46:16 2000 +++ xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h Mon Jan 22 16:09:40 2001 @@ -2,7 +2,7 @@ * Copyright (C) 1998 Itai Nahshon, Michael Schimek */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h,v 1.6 2000/11/03 18:46:16 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/i2c/xf86i2c.h,v 1.7 2001/01/22 21:09:40 dawes Exp $ */ #ifndef _XF86I2C_H #define _XF86I2C_H @@ -44,6 +44,8 @@ I2CDevPtr FirstDev; I2CBusPtr NextBus; + Bool (*I2CWriteRead)(I2CDevPtr d, I2CByte *WriteBuffer, int nWrite, + I2CByte *ReadBuffer, int nRead); } I2CBusRec; I2CBusPtr xf86CreateI2CBusRec(void); Index: xc/programs/Xserver/hw/xfree86/input/citron/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/citron/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/input/citron/Imakefile:1.2 --- xc/programs/Xserver/hw/xfree86/input/citron/Imakefile:1.1 Wed Nov 1 21:51:20 2000 +++ xc/programs/Xserver/hw/xfree86/input/citron/Imakefile Tue Jan 23 19:06:34 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/Imakefile,v 1.1 2000/11/02 02:51:20 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/Imakefile,v 1.2 2001/01/24 00:06:34 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -22,7 +22,6 @@ InstallObjectModule($(DRIVER),$(MODULEDIR),input) #if !defined(XF86DriverSDK) -CppManTarget($(DRIVER),) InstallModuleManPage($(DRIVER)) #endif Index: xc/programs/Xserver/hw/xfree86/input/citron/citron.c diff -u xc/programs/Xserver/hw/xfree86/input/citron/citron.c:1.5 xc/programs/Xserver/hw/xfree86/input/citron/citron.c:1.6 --- xc/programs/Xserver/hw/xfree86/input/citron/citron.c:1.5 Tue Nov 21 18:10:37 2000 +++ xc/programs/Xserver/hw/xfree86/input/citron/citron.c Thu Apr 5 13:42:34 2001 @@ -1,4 +1,4 @@ -/* +/* Id: citron.c,v 1.8 2001/03/28 08:24:38 pk Exp $ * Copyright (c) 1998 Metro Link Incorporated * * Permission is hereby granted, free of charge, to any person obtaining a @@ -25,13 +25,13 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.c,v 1.5 2000/11/21 23:10:37 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.c,v 1.6 2001/04/05 17:42:34 dawes Exp $ */ /* * Based, in part, on code with the following copyright notice: * - * Copyright 1999-2000 by Thomas Thanner, Citron GmbH, Germany. <support@citron.de> - * Copyright 1999-2000 by Peter Kunzmann, Citron GmbH, Germany. <support@citron.de> + * Copyright 1999-2001 by Thomas Thanner, Citron GmbH, Germany. <support@citron.de> + * Copyright 1999-2001 by Peter Kunzmann, Citron GmbH, Germany. <kunzmann@citron.de> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -95,6 +95,21 @@ "cit_ParseCommand" to set the variables not only on the touch side but also in the priv rec pk 2.04 19.10.00 reconnect enhanced pk + 2.05 27.02.01 QueryHardware enhanced, connection faster pk + 2.06 15.03.01 cit_SetBlockDuration added, cit_Flush modified pk + 2.07 16.03.01 The problem that the touch didn't connect to the + X-server was a hardware problem + with the winbond chip (interrupt was dead after + receiving spurious characters when the touch screen + is switched on). The SIO has to be reinitialized to + get rid of that problem. pk + 2.08 20.03.01 if cit_GetPacket has an overrun + cit_ReinitSerial has to be called, Vmin set to "1" + cit_SuperVisionTimer, cit_SetEnterCount added + debuglevel, entercount(z) from external now poss. + enter_touched not reset by coord_exit pk + 2.09 25.03.01 enter_touched also reset by press_exit, a new + command (SetPWMFreq) for backlight dimming added pk ============================================================================ */ @@ -104,30 +119,31 @@ #define PK 0 #define INITT 0 /* Initialisation of touch in first loop */ -/* ODD version number enables the debug macros */ -/* EVEN version number is for release */ -#define CITOUCH_VERSION 0x204 -char version[]="Touch Driver V2.04 (c) 1999-2000 Citron GmbH"; +#define CITOUCH_VERSION 0x209 +char version[]="Touch Driver V2.09 (c) 1999-2001 Citron GmbH"; +#define CITOUCH_VERSION_MAJOR ((CITOUCH_VERSION >> 8) & 0xf) +#define CITOUCH_VERSION_MINOR ((CITOUCH_VERSION >> 4) & 0xf) +#define CITOUCH_VERSION_PATCH ((CITOUCH_VERSION >> 0) & 0xf) + /***************************************************************************** * Standard Headers ****************************************************************************/ -#include <misc.h> -#include <xf86.h> +#include "misc.h" +#include "xf86.h" #define NEED_XF86_TYPES -/*#include <xf86Version.h>*/ -#include <xf86_ansic.h> -#include <xf86_OSproc.h> -#include <xf86Optrec.h> -#include <xf86Xinput.h> -#include <xisb.h> -#include <exevents.h> /* Needed for InitValuator/Proximity stuff*/ +#include "xf86_ansic.h" +#include "xf86_OSproc.h" +#include "xf86Optrec.h" +#include "xf86Xinput.h" +#include "xisb.h" +#include "exevents.h" /* Needed for InitValuator/Proximity stuff*/ -/* #define CI_TIM */ /* Enable timer */ +/* #define CIT_TIM */ /* Enable timer */ #define CIT_BEEP /* enable beep feature */ /***************************************************************************** @@ -162,9 +178,13 @@ #endif static int debug_level = 0; -#if CITOUCH_VERSION & 0x0001 + +/* + debug is always on, because we can set the debug-level + in XF86Config (Option DebugLevel) +*/ #define DEBUG -#endif + #ifdef DEBUG #define DBG(lvl, f) {if ((lvl) <= debug_level) f;} #else @@ -237,10 +257,10 @@ MODULEVENDORSTRING, /* vendor specific string */ MODINFOSTRING1, MODINFOSTRING2, - XF86_VERSION_CURRENT, /* Module-specific current version */ - 0, /* Module-specific major version */ - 1, /* Module-specific minor version */ - 1, /* Module-specific patch level */ + XF86_VERSION_CURRENT, /* Current XFree version */ + CITOUCH_VERSION_MAJOR, /* Module-specific major version */ + CITOUCH_VERSION_MINOR, /* Module-specific minor version */ + CITOUCH_VERSION_PATCH, /* Module-specific patch level */ ABI_CLASS_XINPUT, ABI_XINPUT_VERSION, MOD_CLASS_XINPUT, @@ -297,7 +317,45 @@ "StopBits", "1", "DataBits", "8", "Parity", "None", - "Vmin", "3", +/* + In non-canonical input processing mode, input is not assembled into + lines and input processing (erase, kill, delete, etc.) does not occur. + Two parameters control the behavior of this mode: c_cc[VTIME] sets the + character timer, and c_cc[VMIN] sets the minimum number of characters + to receive before satisfying the read. + + If MIN > 0 and TIME = 0, MIN sets the number of characters to receive + before the read is satisfied. As TIME is zero, the timer is not used. + + If MIN = 0 and TIME > 0, TIME serves as a timeout value. The read will + be satisfied if a single character is read, or TIME is exceeded (t = + TIME *0.1 s). If TIME is exceeded, no character will be returned. + + + If MIN > 0 and TIME > 0, TIME serves as an inter-character timer. The + read will be satisfied if MIN characters are received, or the time + between two characters exceeds TIME. The timer is restarted every time + a character is received and only becomes active after the first + character has been received. + + If MIN = 0 and TIME = 0, read will be satisfied immediately. The + number of characters currently available, or the number of characters + requested will be returned. According to Antonino (see contributions), + you could issue a fcntl(fd, F_SETFL, FNDELAY); before reading to get + the same result. + + By modifying newtio.c_cc[VTIME] and newtio.c_cc[VMIN] all modes + described above can be tested. + (Copied from serial-programming-howto) +*/ + + +/* Vmin was set to 3 (Three characters have to arrive until Read_Input is called). + I set it to 1 because of the winbond SIO (maybe the interrupt disappears after 1 character + and X waits for another two. +*/ + + "Vmin", "1", /* blocking read until 1 chars received */ "Vtime", "1", "FlowControl", "None", "ClearDTR", "" @@ -325,7 +383,7 @@ unsigned char buf[MAX_BYTES_TO_TRANSFER*2+2]; DBG(DDS, ErrorF("%scit_SendtoTouch(numbytes=0x%02X, data[0]=%02x, data[1]=%02x, data[2]=%02x, data[3]=%02x, ...)\n", CI_INFO, priv->dds.numbytes, - priv->dds.data[0], priv->dds.data[1], priv->dds.data[2], priv->dds.data[3],)); + priv->dds.data[0], priv->dds.data[1], priv->dds.data[2], priv->dds.data[3])); j=0; buf[j++] = CTS_STX; /* transmit start of packet */ @@ -377,12 +435,17 @@ DBG(DDS, ErrorF("%scit_ParseCommand(PWM Active:%d PWM Sleep:%d \n", CI_INFO, priv->pwm_active, priv->pwm_sleep)); break; + case C_SETPWMFREQ: + priv->pwm_freq = (int)priv->dds.data[1] | (int)(priv->dds.data[2] << 8); + DBG(DDS, ErrorF("%scit_ParseCommand: PWM Freq:%d\n", CI_INFO, priv->pwm_freq)); + break; + case C_SETSLEEPMODE: if(priv->dds.data[1] == 0) { priv->sleep_time_act = priv->dds.data[2] | (priv->dds.data[3] << 8); } - DBG(DDS, ErrorF("%scit_ParseCommand(Sleep Time act:%d \n", CI_INFO, priv->sleep_time_act)); + DBG(DDS, ErrorF("%scit_ParseCommand: Sleep Time act:%d \n", CI_INFO, priv->sleep_time_act)); break; case C_SETDOZEMODE: @@ -390,13 +453,18 @@ { priv->doze_time_act = priv->dds.data[2] | (priv->dds.data[3] << 8); } - DBG(DDS, ErrorF("%scit_ParseCommand(Doze Time act:%d \n", CI_INFO, priv->doze_time_act)); + DBG(DDS, ErrorF("%scit_ParseCommand: Doze Time act:%d \n", CI_INFO, priv->doze_time_act)); break; case C_SETAREAPRESSURE: priv->button_threshold = priv->dds.data[1]; - DBG(DDS, ErrorF("%scit_ParseCommand(Button Threshold:%d \n", CI_INFO, priv->button_threshold)); + DBG(DDS, ErrorF("%scit_ParseCommand: Button Threshold:%d \n", CI_INFO, priv->button_threshold)); + break; + + default: + DBG(DDS, ErrorF("%scit_ParseCommand: Command %d not found\n", CI_INFO, priv->dds.data[0])); break; + } } @@ -418,6 +486,7 @@ case D_SETCLICKMODE: priv->click_mode = priv->dds.data[i++]; ErrorF("%sClick Mode: %d\n", CI_INFO, priv->click_mode); + cit_SetEnterCount(priv); /* set enter_count according to click_mode */ break; case D_BEEP: @@ -444,9 +513,26 @@ ErrorF("%sBeep Release Duration: %d\n", CI_INFO, priv->rel_dur); break; - default: - ErrorF("%sNot known command: %d\n", CI_WARNING, priv->dds.data[1]); + case D_DEBUG: + debug_level = priv->dds.data[i++]; + ErrorF("%sDebug level set to %d \n", CI_INFO, debug_level); + break; + + case D_ENTERCOUNT: + priv->enter_count_no_Z = priv->dds.data[i++]; + cit_SetEnterCount(priv); /* set enter_count according click_mode */ + ErrorF("%sEnterCount set to %d \n", CI_INFO, priv->enter_count_no_Z); + break; + + case D_ZENTERCOUNT: + priv->enter_count_Z = priv->dds.data[i++]; + cit_SetEnterCount(priv); /* set enter_count according click_mode */ + ErrorF("%sZEnterCount set to %d \n", CI_INFO, priv->enter_count_Z); + break; + default: + ErrorF("%sNot known command: %d - Get a recent driver\n", CI_WARNING, priv->dds.data[1]); + break; } } @@ -563,17 +649,17 @@ } #endif -#ifdef CIT_TIM + /***************************************************************************** * [cit_StartTimer] ****************************************************************************/ static void -cit_StartTimer(cit_PrivatePtr priv) +cit_StartTimer(cit_PrivatePtr priv, int nr) { - priv->timer_ptr = TimerSet(priv->timer_ptr, 0, priv->timer_val1, - priv->timer_callback, (pointer)priv); - DBG(5, ErrorF ("%scit_StartTimer called PTR=%08x\n", CI_INFO, priv->timer_ptr)); + priv->timer_ptr[nr] = TimerSet(priv->timer_ptr[nr], 0, priv->timer_val1[nr], + priv->timer_callback[nr], (pointer)priv); + DBG(5, ErrorF ("%scit_StartTimer[%d] called PTR=%08x\n", CI_INFO, nr, priv->timer_ptr)); } @@ -581,22 +667,45 @@ * [cit_CloseTimer] ****************************************************************************/ static void -cit_CloseTimer(cit_PrivatePtr priv) +cit_CloseTimer(cit_PrivatePtr priv, int nr) { - DBG(5, ErrorF ("%scit_CloseTimer called PTR=%08x\n", CI_INFO, priv->timer_ptr)); - if(priv->timer_ptr) + DBG(5, ErrorF ("%scit_CloseTimer[%d] called PTR=%08x\n", CI_INFO, nr, priv->timer_ptr)); + if(priv->timer_ptr[nr]) { - TimerFree(priv->timer_ptr); - priv->timer_ptr = NULL; + TimerFree(priv->timer_ptr[nr]); + priv->timer_ptr[nr] = NULL; } else - DBG(5, ErrorF ("%scit_CloseTimer: Nothing to close\n", CI_WARNING)); + DBG(5, ErrorF ("%scit_CloseTimer[%d]: Nothing to close\n", CI_WARNING, nr)); } /***************************************************************************** + * [cit_SuperVisionTimer] If called reset Serial device + ****************************************************************************/ +static CARD32 +cit_SuperVisionTimer(OsTimerPtr timer, CARD32 now, pointer arg) +{ + cit_PrivatePtr priv = (cit_PrivatePtr) arg; + int sigstate; + + DBG(5, ErrorF ("%scit_SuperVisionTimer called %d\n", CI_INFO, GetTimeInMillis())); + + sigstate = xf86BlockSIGIO (); + + cit_ReinitSerial(priv); + + xf86UnblockSIGIO (sigstate); + + return (0); /* stop timer */ +} + + +#ifdef CIT_TIM + +/***************************************************************************** * [cit_DualTouchTimer] ****************************************************************************/ static CARD32 @@ -648,7 +757,9 @@ goto SetupProc_fail; } + priv->local = local; /* save local device pointer */ + /* this results in an xf86strdup that must be freed later */ local->name = xf86SetStrOption(local->options, "DeviceName", "CiTouch"); ErrorF("%sDevice name: %s\n", CI_INFO, local->name); @@ -762,10 +873,16 @@ ErrorF("%sBeam Timeout: %d\n", CI_CONFIG, priv->beam_timeout); priv->touch_time = xf86SetIntOption(local->options, "TouchTime", 0) & 0xff; ErrorF("%sTouch Time: %d\n", CI_CONFIG, priv->touch_time); - priv->enter_count = xf86SetIntOption(local->options, "EnterCount", 3); - ErrorF("%sEnter Count: %d\n", CI_CONFIG, priv->enter_count); priv->max_dual_count = xf86SetIntOption(local->options, "DualCount", MAX_DUAL_TOUCH_COUNT); ErrorF("%sDual Count: %d\n", CI_CONFIG, priv->max_dual_count); + priv->enter_count_no_Z = xf86SetIntOption(priv->local->options, "EnterCount", 3); + ErrorF("%sEnterCount: %d\n", CI_CONFIG, priv->enter_count_no_Z); + priv->enter_count_Z = xf86SetIntOption(priv->local->options, "ZEnterCount", 2); + ErrorF("%sZEnterCount: %d\n", CI_CONFIG, priv->enter_count_Z); + priv->pwm_freq = xf86SetIntOption(priv->local->options, "PWMFreq", -1); + ErrorF("%sPWMFreq: %d\n", CI_CONFIG, priv->pwm_freq); + + cit_SetEnterCount(priv); /* set enter_count according click_mode */ /* trace the min and max values */ priv->raw_min_x = CIT_DEF_MAX_X; @@ -775,15 +892,18 @@ #ifdef CIT_TIM /* preset timer values */ - priv->timer_ptr = NULL; - priv->timer_val1 = 0; - priv->timer_val2 = 0; - priv->timer_callback = NULL; -#endif + priv->timer_ptr[FAKE_TIMER] = NULL; + priv->timer_val1[FAKE_TIMER] = 0; + priv->timer_val2[FAKE_TIMER] = 0; + priv->timer_callback[FAKE_TIMER] = NULL; +#endif + priv->timer_ptr[SV_TIMER] = NULL; + priv->timer_val1[SV_TIMER] = 0; + priv->timer_val2[SV_TIMER] = 0; + priv->timer_callback[SV_TIMER] = NULL; priv->fake_exit = FALSE; priv->enter_touched = 0; /* preset */ - priv->local = local; /* save local device pointer */ DBG(6, ErrorF("%s\t+ options read\n", CI_INFO)); s = xf86FindOptionValue (local->options, "ReportingMode"); @@ -845,6 +965,8 @@ priv->buffer = NULL; } xf86CloseSerial(local->fd); + local->fd = 0; + #endif } @@ -860,7 +982,10 @@ SetupProc_fail: #if(INITT) if ((local) && (local->fd)) + { xf86CloseSerial (local->fd); + local->fd = 0; + } #endif if ((local) && (local->name)) xfree (local->name); @@ -910,6 +1035,7 @@ ErrorF ("%sDeviceControl Mode (%d) not found\n", CI_ERROR, mode); RetVal = BadValue; } + DBG(2, ErrorF ("%sDeviceControl: RetVal = %d\n", CI_INFO, RetVal)); return(RetVal); } @@ -928,7 +1054,7 @@ local->fd = xf86OpenSerial(local->options); if (local->fd == -1) { - xf86Msg(X_WARNING, "%s%s: cannot open input device\n", CI_ERROR, local->name); + DBG(5, ErrorF("%s%s: cannot open input device\n", CI_ERROR, local->name)); goto DeviceOn_fail; } priv->buffer = XisbNew (local->fd, CIT_BUFFER_SIZE); @@ -937,22 +1063,29 @@ xf86FlushInput(local->fd); + cit_SendCommand(priv->buffer, C_SOFTRESET, 0); /* Make a Reset in case of a connected touch */ + if (QueryHardware (local, &errmaj, &errmin) != Success) { - ErrorF ("%s\t- Unable to query/initialize Citron hardware.\n", CI_ERROR); + ErrorF ("%s\t- DeviceOn: Unable to query/initialize hardware.\n", CI_ERROR); goto DeviceOn_fail; } - AddEnabledDevice (local->fd); + AddEnabledDevice(local->fd); dev->public.on = TRUE; + DBG(5, ErrorF ("%sDeviceOn Success\n", CI_INFO)); return (Success); /* * If something went wrong, cleanup */ DeviceOn_fail: + if ((local) && (local->fd)) + { xf86CloseSerial (local->fd); + local->fd = 0; + } if ((local) && (local->name)) xfree (local->name); @@ -970,9 +1103,6 @@ } ErrorF ("%sDeviceOn failed\n", CI_ERROR); return (!Success); - - - } /***************************************************************************** @@ -997,14 +1127,16 @@ DBG(5, ErrorF ("%sDeviceClose called\n",CI_INFO)); - cit_Flush(priv->buffer); + cit_Flush(priv); cit_SendCommand(priv->buffer, C_SOFTRESET, 0); #ifdef CIT_TIM - cit_CloseTimer(priv); /* Close timer if started */ + cit_CloseTimer(priv, FAKE_TIMER); /* Close timer if started */ #endif + cit_CloseTimer(priv, SV_TIMER); /* Do not know if it is running, close anyway */ + XisbTrace(priv->buffer, 1); /* trace on */ - XisbBlockDuration (priv->buffer, 500000); + cit_SetBlockDuration (priv, 500000); c = XisbRead (priv->buffer); if(c == CTS_NAK) { @@ -1154,8 +1286,7 @@ */ if(!priv->fake_exit) { - XisbBlockDuration (priv->buffer, -1); - DBG(RI, ErrorF("%sXisbBlockDuration = -1\n", CI_INFO)); + cit_SetBlockDuration (priv, -1); } while ( #ifdef CIT_TIM @@ -1243,7 +1374,6 @@ xf86PostButtonEvent (local->dev, TRUE, priv->button_number, 0, 0, 2, x, y); cit_Beep(priv, 0); - priv->enter_touched = 0; /* reset coordinate report counter */ DBG(RI, ErrorF("%s\tPostButtonEvent(UP, x=%d, y=%d)\n", CI_INFO, x, y)); priv->button_down = FALSE; } @@ -1396,142 +1526,107 @@ unsigned char x; int i, cnt; int err; /* for WAIT */ - int init = FALSE; + /* Reset the IRT from any mode and wait for end of warmstart */ DBG(5, ErrorF("%sQueryHardware called\n", CI_INFO)); -/* Will not work with XFree86 4.0 */ -/* xf86SerialSendBreak (local->fd, 2); */ - cit_Flush(priv->buffer); -/* Test if touch is already initialized */ - cit_SendCommand(priv->buffer, C_GETORIGIN, 0); - /* wait max. 0.5 seconds for acknowledge */ - DBG(6, ErrorF("%s\t* waiting for acknowledge\n", CI_INFO)); -/* WAIT(50); */ - XisbBlockDuration (priv->buffer, 500000); - cnt = 0; - err = FALSE; +/* Will not work with XFree86 4.0.1 */ +/* xf86SerialSendBreak (local->fd, 2); */ + cit_Flush(priv); - while ((i=XisbRead(priv->buffer)) != -1) - { - DBG(7, ErrorF("%s\t* 0x%02X received - cnt %d\n",CI_INFO, i, cnt)); - { - switch (cnt) - { - - case 0: - if ((unsigned char)i != CTS_STX) - init = TRUE; - break; - case 1: - if ((unsigned char)i != (CMD_REP_CONV & C_GETORIGIN)) - init = TRUE; - break; - case 2: - if ((unsigned char)i > 3) - init = TRUE; - break; + /* + * IRT signals end of startup by sending BREAKS with 100 ms length. + * wait a maximum of 2 seconds for at least 2 consecutive breaks + * to be sure the IRT is really initialized + */ + cit_Flush(priv); /* clear the buffer and wait for break */ + DBG(6, ErrorF("%s\t* waiting for BREAKS...\n", CI_INFO)); + + cit_SetBlockDuration (priv, 1); - case 3: - if ((unsigned char)i != CTS_ETX) - init = TRUE; - break; - } - } - cnt++; - if(init) - break; - } - /* Touch is physically not connected or sio problem or break */ - cit_Flush(priv->buffer); /* flush the buffer and wait for break */ - if(cnt < 3) + for (i=0, cnt=0; (i<20) && (cnt<3); i++) { - WAIT(150); - /* if we have 0 in the buffer I assume we got a break */ + cit_Flush(priv); /* clear the buffer and wait for break */ + WAIT(150); /* wait a little bit longer than 100 ms */ + DBG(7, ErrorF("%s\t (loop %d)\n", CI_INFO, i)); if (XisbRead(priv->buffer) == 0) { - - DBG(6, ErrorF("%s+ BREAK detected - cnt=%d\n", CI_INFO, cnt)); - init = TRUE; + cnt++; + DBG(6, ErrorF("%s\t+ BREAK %d detected\n", CI_INFO, cnt)); } - else /* if nothing is in the buffer I assume the touch is not connected */ + else { - ErrorF("%sTouch not connected - please connect - cnt=%d\n", CI_ERROR, cnt); - return(Success); /* If success is returned we can later connect */ - } /* the touch again when it was reconnected without */ - } /* restarting X */ - - /* if init is true, we have to (re)initialize the touch */ - if (init) - { - ErrorF("%sTouch not initialized yet\n",CI_INFO); - - /* - * IRT signals end of startup by sending BREAKS with 100 ms length. - * wait a maximum of 2 seconds for at least 2 consecutive breaks - * to be sure the IRT is really initialized - */ - cit_Flush(priv->buffer); /* clear the buffer and wait for break */ - DBG(6, ErrorF("%s\t* waiting for BREAKS...\n", CI_INFO)); - for (i=0, cnt=0; (i<20) && (cnt<2); i++) - { -/* millisleep (105); */ - WAIT(120); /* wait a little bit longer than 100 ms */ - DBG(7, ErrorF("%s\t (loop %d)\n", CI_INFO, i)); - if (XisbRead(priv->buffer) == 0) - { - cnt++; - DBG(6, ErrorF("%s\t+ BREAK %d detected\n", CI_INFO, cnt)); - } - else - { - cnt = 0; - } + cnt = 0; } - if (cnt < 2) + if ( i == 12) { - ErrorF("%sCannot reset Citron Infrared Touch!\n", CI_ERROR); -/* *errmaj = LDR_NOHARDWARE; */ - return (!Success); + cit_SendCommand(priv->buffer, C_SOFTRESET, 0); + DBG(6, ErrorF("%s\t+ SOFTRESET sent\n", CI_INFO)); } - /* Now initialize IRT to CTS Protocol */ - DBG(6, ErrorF("%s\t* initializing to CTS mode\n", CI_INFO)); - x = 0x0d; - for (i=0; i<2; i++) +#if(0) + /* maybe we are in Debug Mode and have to sent a soft reset */ + if(i == 15) { + XisbWrite(priv->buffer, (unsigned char *)"r2", 2); + x = 0x0d; XisbWrite(priv->buffer, &x, 1); -/* millisleep (50); */ - WAIT(50); + DBG(6, ErrorF("%s\t+ DEBUG-MODE SOFTRESET sent\n", CI_INFO)); } - x = MODE_D; +#endif + } + if (cnt < 2) + { + ErrorF("%sCannot reset Citron Infrared Touch!\n", CI_ERROR); + +/* Workaround - bugfix + Normally when the touch is connected and the driver thinks it didn't sent + breaks we have the problem, that spurious characters, which are sent at + the startup of the touch screen make the winbond SIO chip not to sent + any further interrupts. To overcome this problem we reinitialize the + winbond chip with a close and open of the serial line. + Thanks a lot winbond team. Without it I wouldn't have + written these wonderful lines of source code ;-). +*/ + cit_ReinitSerial(priv); + return (!Success); + } + /* Now initialize IRT to CTS Protocol */ + DBG(6, ErrorF("%s\t* initializing to CTS mode\n", CI_INFO)); + x = 0x0d; + for (i=0; i<2; i++) + { XisbWrite(priv->buffer, &x, 1); + WAIT(50); + } + x = MODE_D; + XisbWrite(priv->buffer, &x, 1); - /* wait max. 0.5 seconds for acknowledge */ - DBG(6, ErrorF("%s\t* waiting for acknowledge\n", CI_INFO)); - XisbBlockDuration (priv->buffer, 500000); - cnt = 0; - while ((i=XisbRead(priv->buffer)) != -1) - { - DBG(7, ErrorF("%s\t* 0x%02X received - waiting for CTS_XON\n",CI_INFO, i)); - if ((unsigned char)i == CTS_XON) - break; - if(cnt++ > 100) return (Success); /* emergency stop */ - } - if ((unsigned char)i != CTS_XON) - { - ErrorF("%sNo acknowledge from Citron Infrared Touch!\n", CI_ERROR); -/* *errmaj = LDR_NOHARDWARE; */ - return (!Success); - } + /* wait max. 0.5 seconds for acknowledge */ + DBG(6, ErrorF("%s\t* waiting for acknowledge\n", CI_INFO)); + cit_SetBlockDuration (priv, 500000); + cnt = 0; + while ((i=XisbRead(priv->buffer)) != -1) + { + DBG(7, ErrorF("%s\t* 0x%02X received - waiting for CTS_XON\n",CI_INFO, i)); + if ((unsigned char)i == CTS_XON) + break; + if(cnt++ > 50) return (Success); /* emergency stop */ + } + if ((unsigned char)i != CTS_XON) + { + ErrorF("%sNo acknowledge from Citron Infrared Touch!\n", CI_ERROR); + cit_ReinitSerial(priv); + return (!Success); } + /* now we have the touch connected, do the initialization stuff */ DBG(6, ErrorF("%s\t+ Touch connected!\n",CI_INFO)); - cit_Flush(priv->buffer); + cit_Flush(priv); DBG(6, ErrorF("%s\t+ requesting pressure sensors report\n",CI_INFO)); if (cit_GetPressureSensors(priv)!=Success) @@ -1540,10 +1635,11 @@ } DBG(5, ErrorF("%s ClickMode is %d\n",CI_INFO, priv->click_mode)); - if(priv->click_mode == NO_CLICK_MODE) /* no click mode set in XF86Config */ + if(priv->click_mode == NO_CLICK_MODE) /* if no click mode set in XF86Config set it automatically */ { priv->click_mode = (priv->pressure_sensors > 0) ? CM_ZPRESS : CM_ENTER; DBG(5, ErrorF("%sClickMode set to %d\n",CI_INFO, priv->click_mode)); + cit_SetEnterCount(priv); } cit_SendCommand(priv->buffer, C_SETAREAFLAGS, 1, AOF_ADDEXIT @@ -1593,6 +1689,7 @@ cit_SendCommand(priv->buffer, C_SETTRANSMISSION, 1, TM_TRANSMIT); cit_SendCommand(priv->buffer, C_SETSCANNING, 1, 1); + cit_SendPWMFreq(priv); /* Set PWM Frequency */ if(priv->query_state == 0) /* do error reporting only 1 time */ { @@ -1665,7 +1762,7 @@ { int c; int errmaj, errmin; - + int loop = 0; DBG(GP, ErrorF("%scit_GetPacket called\n", CI_INFO)); DBG(GP, ErrorF("%s\t* initial lex_mode =%d (%s)\n", CI_INFO, priv->lex_mode, priv->lex_mode==cit_idle ?"idle": @@ -1677,7 +1774,8 @@ { #if(0) DBG(GP, ErrorF("%s c=%d\n",CI_INFO, c)); -#endif +#endif + loop++; if (c == CTS_STX) { DBG(GP, ErrorF("%s\t+ STX detected\n", CI_INFO)); @@ -1686,6 +1784,11 @@ DBG(7, ErrorF("%s\t- no ETX received before this STX!\n", CI_WARNING)); priv->lex_mode = cit_getID; DBG(GP, ErrorF("%s\t+ new lex_mode == getID\n", CI_INFO)); + /* Start supervision timer at the beginning of a command */ + priv->timer_val1[SV_TIMER] = 2000; /* Timer delay [ms] 2s */ + priv->timer_callback[SV_TIMER] = (OsTimerCallback)cit_SuperVisionTimer; /* timer callback routine */ + cit_StartTimer(priv, SV_TIMER); + } else if (c == CTS_ETX) { @@ -1697,6 +1800,7 @@ { DBG(GP, ErrorF("%s\t+ Good report received\n", CI_INFO)); priv->lex_mode = cit_idle; + cit_CloseTimer(priv, SV_TIMER); /* stop supervision */ return (Success); } DBG(GP, ErrorF("%s\t- unexpected ETX received!\n", CI_WARNING)); @@ -1741,45 +1845,81 @@ } else { - DBG(GP, ErrorF("%s\t- command buffer overrun\n", CI_ERROR)); + DBG(GP, ErrorF("%s\t- command buffer overrun, loop[%d]\n", CI_ERROR, loop)); /* let's reinitialize the touch - maybe it sends breaks */ - cit_Flush(priv->buffer); + /* The touch assembles breaks until the buffer has an overrun */ + /* 100ms x 256 -> 26 seconds */ + + priv->lex_mode = cit_idle; + cit_ReinitSerial(priv); } } else { /* this happens e.g. when the touch sends breaks, so we try to reconnect */ - DBG(GP, ErrorF("%s\t- unexpected non control received!\n", CI_WARNING)); + DBG(GP, ErrorF("%s\t- unexpected non control received! [%d, 0x%02x, loop[%d]]\n", CI_WARNING, c, c, loop)); DBG(GP, ErrorF("%s\t- Device not connected - trying to reconnect ...\n", CI_WARNING)); if (QueryHardware (priv->local, &errmaj, &errmin) != Success) ErrorF ("%s\t- Unable to query/initialize Citron Touch hardware.\n", CI_ERROR); else ErrorF ("%s\t- Citron Touch reconnected\n", CI_INFO); + return(!Success); } } else if (c != CTS_XON && c != CTS_XOFF) { - DBG(GP, ErrorF("%s\t- unhandled control character received!\n", CI_WARNING)); + DBG(GP, ErrorF("%s\t- unhandled control character received! loop[%d]\n", CI_WARNING, loop)); } - } - DBG(GP, ErrorF("%scit_GetPacket exit !Success\n", CI_INFO)); + } /* end while */ + DBG(GP, ErrorF("%scit_GetPacket exit !Success - loop[%d]\n", CI_INFO, loop)); + return (!Success); } /***************************************************************************** + * [cit_ReinitSerial] Reinitialize serial port + ****************************************************************************/ +static void +cit_ReinitSerial(cit_PrivatePtr priv) +{ + if(priv->local->fd) + { + xf86CloseSerial(priv->local->fd); + priv->local->fd = 0; + priv->local->fd = xf86OpenSerial (priv->local->options); + DBG(6, ErrorF("%s\t* cit_ReinitSerial: Serial connection reinitialized\n", CI_INFO)); + } + else + DBG(6, ErrorF("%s\t* cit_ReinitSerial: Serial connection not opened\n", CI_ERROR)); +} + +/***************************************************************************** * [cit_Flush] ****************************************************************************/ static void -cit_Flush (XISBuffer *b) +cit_Flush (cit_PrivatePtr priv) { + int old_block_duration; + DBG(7, ErrorF("%scit_Flush called\n", CI_INFO)); - XisbBlockDuration(b, 0); - while (XisbRead(b) > 0); + old_block_duration = priv->buffer->block_duration; + XisbBlockDuration(priv->buffer, 1000); /* wait for at least 10ms for the next character */ + while (XisbRead(priv->buffer) >= 0); + cit_SetBlockDuration(priv, old_block_duration); /* Restore the last set block duration (cit_SetBlockDuration) */ } +/***************************************************************************** + * [cit_SetBlockDuration] + ****************************************************************************/ +static void +cit_SetBlockDuration (cit_PrivatePtr priv, int block_duration) +{ + DBG(7, ErrorF("%scit_SetBlockDuration called [%d]\n", CI_INFO, block_duration)); + XisbBlockDuration(priv->buffer, block_duration); +} /***************************************************************************** @@ -1852,7 +1992,7 @@ int i; Bool res; - cit_Flush(priv->buffer); + cit_Flush(priv); cit_SendCommand(priv->buffer, C_GETERRORS, 1, GE_INITIAL); /* touch responds within 1 millisecond, @@ -1860,7 +2000,7 @@ */ for (i=0; i<5; i++) { - XisbBlockDuration(priv->buffer, 500000); + cit_SetBlockDuration(priv, 500000); res = cit_GetPacket(priv); if ((res == Success) || (priv->lex_mode == cit_idle)); break; @@ -1979,7 +2119,7 @@ int i; Bool res; - cit_Flush(priv->buffer); + cit_Flush(priv); cit_SendCommand(priv->buffer, C_GETERRORS, 1, GE_DEFECTBEAMS); /* touch responds within 1 millisecond, @@ -1987,7 +2127,7 @@ */ for (i=0; i<5; i++) { - XisbBlockDuration(priv->buffer, 500000); + cit_SetBlockDuration(priv, 500000); res = cit_GetPacket(priv); if ((res == Success) || (priv->lex_mode == cit_idle)); break; @@ -2060,7 +2200,7 @@ int i,n; Bool res; - cit_Flush(priv->buffer); + cit_Flush(priv); cit_SendCommand(priv->buffer, C_GETREVISIONS, 1, GR_DESIGNATOR); /* touch responds within 1 millisecond, @@ -2068,7 +2208,7 @@ */ for (i=0; i<5; i++) { - XisbBlockDuration(priv->buffer, 500000); + cit_SetBlockDuration(priv, 500000); res = cit_GetPacket(priv); if ((res == Success) || (priv->lex_mode == cit_idle)); break; @@ -2126,13 +2266,13 @@ int i,n; Bool res; - cit_Flush(priv->buffer); + cit_Flush(priv); cit_SendCommand(priv->buffer, C_GETREVISIONS, 1, (unsigned char)selection); /* touch responds within 1 millisecond, but it takes some time, until the command is sent and received! */ - XisbBlockDuration(priv->buffer, 500000); + cit_SetBlockDuration(priv, 500000); while (((res = cit_GetPacket(priv)) != Success) && (priv->lex_mode != cit_idle)); if (res != Success) { @@ -2192,9 +2332,9 @@ priv->dual_flg = TRUE; /* Dual Touch Error occurred */ #ifdef CIT_TIM - priv->timer_val1 = 1000; /* Timer delay [ms]*/ - priv->timer_callback = (OsTimerCallback)cit_DualTouchTimer; /* timer callback routine */ - cit_StartTimer(priv); + priv->timer_val1[FAKE_TIMER] = 1000; /* Timer delay [ms]*/ + priv->timer_callback[FAKE_TIMER] = (OsTimerCallback)cit_DualTouchTimer; /* timer callback routine */ + cit_StartTimer(priv, FAKE_TIMER); #endif switch (priv->packet[0]) @@ -2234,12 +2374,13 @@ priv->state &= ~(CIT_TOUCHED | CIT_PRESSED); priv->dual_touch_count = 0; + priv->enter_touched = 0; /* reset coordinate report counter */ priv->raw_x = 0x0001U * priv->packet[1] + 0x0100U * priv->packet[2]; priv->raw_y = 0x0001U * priv->packet[3] + 0x0100U * priv->packet[4]; #ifdef CIT_TIM - cit_CloseTimer(priv); /* close timer if exit message was received */ + cit_CloseTimer(priv, FAKE_TIMER); /* close timer if exit message was received */ #endif DBG(PP, ErrorF("%s\t+ EXIT message (%d,%d)\n", CI_INFO, priv->raw_x, priv->raw_y)); break; @@ -2261,6 +2402,7 @@ priv->state |= CIT_PRESSED; else if(priv->packet[1] == PRESS_BELOW) { + priv->enter_touched = 0; /* reset coordinate report counter */ priv->state &= ~CIT_PRESSED; } else @@ -2368,7 +2510,7 @@ int i; Bool res; - cit_Flush(priv->buffer); + cit_Flush(priv); cit_SendCommand(priv->buffer, C_GETHARDWARE, 1, GH_SENSORCOUNT); /* touch responds within 1 millisecond, @@ -2376,7 +2518,7 @@ */ for (i=0; i<5; i++) { - XisbBlockDuration(priv->buffer, 500000); + cit_SetBlockDuration(priv, 500000); res = cit_GetPacket(priv); if ((res == Success) || (priv->lex_mode == cit_idle)); break; @@ -2411,5 +2553,47 @@ priv->pressure_sensors = priv->packet[2]; return (Success); } + + +/***************************************************************************** + * [cit_ZPress] tell if click mode is ZPress (True if ZPress) + ****************************************************************************/ +static int cit_ZPress(cit_PrivatePtr priv) +{ + if((priv->click_mode == CM_ZPRESS) || (priv->click_mode == CM_ZPRESSEXIT)) + return (TRUE); + else + return (FALSE); +} + + +/***************************************************************************** + * [cit_SetEnterCount] set enter_count according click_mode + ****************************************************************************/ +static void cit_SetEnterCount(cit_PrivatePtr priv) +{ + if(cit_ZPress(priv)) /* Test if 3D Mode is active and set Options according */ + priv->enter_count = priv->enter_count_Z; + else priv->enter_count = priv->enter_count_no_Z; + ErrorF("%scit_SetEnterCount: Count=%d\n", CI_CONFIG, priv->enter_count); +} + + +/***************************************************************************** + * [cit_SendPWMFreq] send pwm frequency of PWM signal to the touch + ****************************************************************************/ +static void cit_SendPWMFreq(cit_PrivatePtr priv) +{ + if(priv->pwm_freq >= 0) /* -1 is switched off (no SetPWMFreq set in XF86Config */ + { + cit_SendCommand(priv->buffer, C_SETPWMFREQ, 2, + LOBYTE(priv->pwm_freq), + HIBYTE(priv->pwm_freq)); + DBG(3,ErrorF("%scit_SendPWMFreq: Freq=%d\n", CI_CONFIG, priv->pwm_freq)); + } + else + DBG(3,ErrorF("%scit_SendPWMFreq: Frequency not set\n", CI_CONFIG)); +} + Index: xc/programs/Xserver/hw/xfree86/input/citron/citron.cpp diff -u xc/programs/Xserver/hw/xfree86/input/citron/citron.cpp:1.4 xc/programs/Xserver/hw/xfree86/input/citron/citron.cpp:removed --- xc/programs/Xserver/hw/xfree86/input/citron/citron.cpp:1.4 Sun Dec 17 17:27:40 2000 +++ xc/programs/Xserver/hw/xfree86/input/citron/citron.cpp Mon Jun 4 12:41:18 2001 @@ -1,629 +0,0 @@ -.\" Copyright (c) 2000 Peter Kunzmann <support@@citron.de> -.\" -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.cpp,v 1.4 2000/12/17 22:27:40 dawes Exp $ -.\" -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH CITRON __drivermansuffix__ "Version 4.0.2" "XFREE86" -.SH NAME -citron \- Citron Infrared Touch Driver (CiTouch) -.SH SYNOPSIS -.nf -.B "Section \*qInputDevice\*q" -.BI " Identifier \*q" idevname \*q -.B " Driver \*qcitron\*q" -.BI " Option \*qDevice\*q \*q" devpath \*q -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B citron -is a XFree86 input driver for -.I Citron Infrared Touch -devices. -.PP -The -.B citron -driver acts as a pointer input device, and may be used as the -X server's core pointer. It is connected via a "RS232" with the host. -.SH SUPPORTED HARDWARE -At the moment the following touches are supported. They are also -available as -.I ZPress -touches. - -.B IRT6I5-V2.x - 6.5 inch Infrared Touch - -.B IRT10I4-V4.x - 10.4 inch Infrared Touch - -.B IRT12I1-V2.x - 12.1 inch Infrared Touch - -.B IRT15I1-V1.x - 15.1 inch Infrared Touch - -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details and for options that can be used with all input drivers. This -section only covers configuration details specific to this driver. -For better understanding please read also the -.B CTS -and various -.B IRT -manuals which are available in "pdf" format from Citron web page -.B www.citron.de -or directly from Citron. - -.PP -.PP -The following driver -.B Options -are supported: -.TP 7 -.BI "Option \*qDevice\*q \*q" devpath \*q -Specify the device path for the citron touch. Valid devices are: -.PP -.RS 12 -/dev/ttyS0, /dev/ttyS1, ... -.RE -.RS 7 -This option is mandatory. -.PP -It's important to specify the right device Note: com1 -> /dev/ttyS0, com2 -> /dev/ttyS1, ... - -.RE -.TP 7 -.BI "Option \*qScreenNumber\*q \*q" screennumber \*q -sets the -.I screennumber -for the -.B citron -InputDevice. -.PP -.RS 7 -.I Default: -ScreenNumber: "0" - -.RE -.TP 7 -.BI "Option \*qMinX\*q \*q" value \*q -.TP 7 -.BI "Option \*qMinY\*q \*q" value \*q -These are the minimum X and Y values for the -.B citron -input device. -.PP -.RS 7 -Note: MinX, MinY must be less than MaxX, MaxY. -.PP -.I Range: -"0" - "65535" -.PP -.I Default: -MinX: "0" MinY: "0" - - -.RE -.TP 7 -.BI "Option \*qMaxX\*q \*q" value \*q -.TP 7 -.BI "Option \*qMaxY\*q \*q" value \*q -These are the maximum X and Y values for the -.B citron -input device. -.PP -.RS 7 -Note: MaxX, MaxY must be greater than MinX, MinY. -.PP -.I Range: -"0" - "65535" -.PP -.I Default: -MaxX: "65535" MaxY: "65535" - - -.RE -.TP 7 -.BI "Option \*qButtonNumber\*q \*q" value \*q -This value is responsible for the -.I button number -that is returned within the xf86PostButton event message -.PP -.RS 7 -.I Range: -"0" - "255" -.PP -.I Default: -"1" - -.RE -.TP 7 -.BI "Option \*qButtonThreshold\*q \*q" value \*q -This value is responsible for the -.I button threshold. -It changes the pressure sensitivity of the touch. A higher number -corresponds to a higher pressure. -.PP -.RS 7 -Note: This feature is only available with pressure sensitive hardware. -.PP -.I Range: -"0" - "255" -.PP -.I Default: -"20" - -.RE -.TP 7 -.B Sleep-Mode -If the IRT is in -.I Doze-Mode -and Touch Zone is not interrupted for another -certain span of time, the so-called -.I Sleep-Mode -is activated. The -.I Sleep-Mode -decreases the scan rate of the beams even further than -the -.I Doze-Mode -does (see below). This way the life expectancy of the beams is -prolonged and the power consumption of the IRT is reduced. -As soon as an interruption of the Touch Zone is detected, the -.I Sleep-Mode -is deactivated and the Touch Zone will again be scanned with -the maximum speed. With the Sleep-Mode activated, -depending on the set scan rate the IRT's response time can be -considerably longer as in normal operation. If, for example, -a scan rate of 500 ms / scan is set, it may last up to a half -of a second until the IRT detects the interruption and deactivates -the -.I Sleep-Mode. - -.PP -.RE -.TP 7 -.BI "Option \*qSleepMode\*q \*q" mode \*q -This value is responsible for the -.I sleep-mode -of the touch. -.RS 7 -Determines the behaviour of the Sleep-Mode. - -.B 0x00 - No message at either activation or deactivation - -.B 0x01 - Message at activation - -.B 0x02 - Message at deactivation - -.B 0x03 - Message at activation and deactivation - -.B 0x10 -GP_OUT output set according to the Sleep-Mode status - -.I Values: -"0" "1" "2" "3" "16" - -.I Default: -"0" - -.RE -.TP 7 -.BI "Option \*qSleepTime\*q \*q" time \*q -This value is responsible for the -.I sleep-time -of the touch. It is the activation time in seconds -("0" = immediately activated, "65535" = always deactivated). -.RS 7 -.PP -.I Range: -"0" - "65535" [s] -.PP -.I Default: -"65535" => deactivated - -.RE -.TP 7 -.BI "Option \*qSleepScan\*q \*q" scan \*q -This value is responsible for the -.I scan-time -of the touch. This is the time interval between two scan operations -while in Sleep-Mode. The time interval is set in steps -of milliseconds. -.RS 7 -.PP -.I Range: -"0" - "65535" [ms] -.PP -.I Default: -"500" - -.RE -.TP 7 -.BI "Option \*qPWMActive\*q \*q" value \*q -This value determines the mark-to-space ratio of the -.I PWM -output while in normal operation (sleep-mode not active). -Higher values result in longer pulse widths. This output -signal can be used in conjunction with the -.I Citron AWBI -to do backlight-dimming via the touch. -.RS 7 -.PP -.I Range: -"0" - "255" -.PP -.I Default: -"255" (max. brightness) - - -.RE -.TP 7 -.BI "Option \*qPWMSleep\*q \*q" value \*q -This value determines the mark-to-space ratio of the -.I PWM -output while in sleep-mode (-> -.I SleepMode, SleepScan, SleepTime -) operation (sleep-mode active). -Higher values result in longer pulse widths. -.RS 7 -.PP -.I Range: -"0" - "255" -.PP -.I Default: -"255" (max. brightness) - -.RE -.TP 7 -.BI "Option \*qClickMode\*q \*q" mode \*q -With mode one can select between 5 -.I ClickModes - -.B \*q1\*q -= ClickMode Enter - -With this mode every interruption of the infrared beams will -activate a ButtonPress event and after the interruption a -ButtonRelease event will be sent. - -.B \*q2\*q -= ClickMode Dual - -With this mode every interruption will sent a Proximity event and -every second interruption a ButtonPress event. With the release of -the interruption (while one interruption is still active) a -ButtonRelease event will be sent. - -.B \*q3\*q -= ClickMode Dual Exit - -With this mode every interruption will sent a ProximityIn event and -every second interruption a ButtonPress event. With the release of -the interruption (while one interruption is still active) no -ButtonRelease event will be sent. Only if all interruptions are released -a ButtonRelease followed by a ProximityOut event will be sent. - -.B \*q4\*q -= ClickMode ZPress - -With this mode every interruption will sent a ProximityIn event. Only if -a certain pressure is exceeded a ButtonPress event will occur. If the -pressure falls below a certain limit a ButtonRelease event will be sent. -After also the interruption is released a ProximityOut event is generated. - -.B \*q5\*q -= ClickMode ZPress Exit - -This mode is similar to "Clickmode Dual Exit". -The first interruption of the beams will sent a ProximityIn event. Only if -a certain pressure is exceeded a ButtonPress event will occur. If the -pressure falls below a certain limit no ButtonRelease event will be sent. -After the interruption is also released a ButtonRelease followed by -a ProximityOut event is generated. -.RS 7 -.PP -.I Range: -"1" - "5" -.PP -.I Default: -"1" (ClickMode Enter) - -.RE -.TP 7 -.BI "Option \*qOrigin\*q \*q" value \*q -This value sets the coordinates origin to one of the four corners of -the screen. -The following values are accepted: -"0" TOPLEFT: Origin set to the left-hand side top corner. -"1" TOPRIGHT: Origin set to the right-hand side top corner. -"2" BOTTOMRIGHT: Origin set to the right-hand side bottom corner. -"3" BOTTOMLEFT: Origin set to the left-hand side bottom corner. -.RS 7 -.PP -.I Range: -"0" - "3" -.PP -.I Default: -"0" (TOPLEFT) - -.RE -.TP 7 -.B "Doze-Mode" -If for a certain span of time the Touch Zone is not interrupted, -the so-called Doze-Mode is automatically activated. The activated -Doze-Mode slightly decreases the scan rate of the beams. This way -the power consumption of the IRT is reduced. As soon as an -interruption of the Touch Zone is detected, the Doze-Mode -is deactivated and the Touch Zone will again be scanned with -the maximum speed. - -.RE -.TP 7 -.BI "Option \*qDozeMode\*q \*q" mode \*q -This value is responsible for the -.I doze-mode -of the touch. -.RS 7 -.PP -Determines the behaviour of the Doze-Mode. -.PP -.B 0x00 -No message at either activation or deactivation - -.B 0x01 -Message at activation - -.B 0x02 -Message at deactivation - -.B 0x03 -Message at activation and deactivation - -.B 0x10 -GP_OUT output set according to the Doze-Mode status - -If the GP_OUT output is already controlled by the -.I Sleep-Mode -it is no longer available as an output port anymore. -.PP -.I Values: -"0" "1" "2" "3" "16" -.PP -.I Default: -"0" - - - -.RE -.TP 7 -.BI "Option \*qDozeTime\*q \*q" time \*q -This value is responsible for the -.I doze-time -of the touch. It is the activation time in seconds -("0" = immediately activated, "65535" = always deactivated). -.RS 7 -.PP -.I Range: -"0" - "65535" [s] -.PP -.I Default: -"65535" => deactivated - - -.RE -.TP 7 -.BI "Option \*qDozeScan\*q \*q" scan \*q -This value is responsible for the -.I scan-time -of the touch. This is the time interval between two scan operations -while in Doze-Mode. The time interval is set in steps -of milliseconds. -.RS 7 -.PP -.I Range: -"0" - "65535" [ms] -.PP -.I Default: -"500" - -.RE -.TP 7 -.BI "Option \*qDeltaX\*q \*q" value \*q -This value determines a virtual area at the left and right -side of the current cursor position where the cursor didn't move. -Within this area no "MotionNotify" event will be sent. -.RS 7 -.PP -.I Range: -"0" - "255" -.PP -.I Default: -"0" (no deltaX) - - -.RE -.TP 7 -.BI "Option \*qDeltaY\*q \*q" value \*q -This value determines a virtual area at the top and bottom -of the current cursor position where the cursor didn't move. -Within this area no "MotionNotify" event will be sent. -.RS 7 -.PP -.I Range: -"0" - "255" -.PP -.I Default: -"0" (no deltaY) - -.RE -.TP 7 -.BI "Option \*qBeep\*q \*q" value \*q -This value determines if a "ButtonPress" and/or a "ButtonRelease" -event should sound the buzzer. "0" deactivates the buzzer while -every other value will activate it. -.RS 7 -.PP -.I Range: -"0" - "1" -.PP -.I Default: -"0" (deactivated) - -.RE -.TP 7 -.BI "Option \*qPressVol\*q \*q" value \*q -This value determines the volume of the buzzer (0-100%) -when a "ButtonPress" event is sent. -.RS 7 -.PP -.I Range: -"0" - "100" -.PP -.I Default: -"100" - - -.RE -.TP 7 -.BI "Option \*qPressPitch\*q \*q" value \*q -This value determines the pitch of the tone -when a "ButtonPress" event is sent. -.RS 7 -.PP -.I Range: -"0" - "3000" -.PP -.I Default: -"880" - - - -.RE -.TP 7 -.BI "Option \*qPressDur\*q \*q" value \*q -This value determines the duration of the tone in ms -when a "ButtonPress" event is sent. -.RS 7 -.PP -.I Range: -"0" - "255" -.PP -.I Default: -"15" - -.RE -.TP 7 -.BI "Option \*qReleaseVol\*q \*q" value \*q -This value determines the volume of the buzzer (0-100%) -when a "ButtonRelease" event is sent. -.RS 7 -.PP -.I Range: -"0" - "100" -.PP -.I Default: -"100" - - -.RE -.TP 7 -.BI "Option \*qReleasePitch\*q \*q" value \*q -This value determines the pitch of the tone when -when a "ButtonRelease" event is sent. -.RS 7 -.PP -.I Range: -"0" - "3000" -.PP -.I Default: -"1200" - - - -.RE -.TP 7 -.BI "Option \*qReleseDur\*q \*q" value \*q -This value determines the duration of the tone in ms when -when a "ButtonRelease" event is sent. -.RS 7 -.PP -.I Range: -"0" - "255" -.PP -.I Default: -"10" - - - -.RE -.TP 7 -.BI "Option \*qBeamTimeout\*q \*q" value \*q -Determines the time span in seconds, that has to elapse before a beam is -considered defective, blanked-out and excluded from the coordinates -evaluation. -.RS 7 -.PP -.I Range: -"0" - "65535" -.PP -.I Default: -"30" (30 seconds) - - - - -.RE -.TP 7 -.BI "Option \*qTouchTime\*q \*q" value \*q -Determines the minimum time span in steps of 10ms for a valid -interruption. In order for an interruption to be -reported to the host computer as valid, it needs to remain at -the same spot for at least the time span declared here. -.RS 7 -.PP -.I Range: -"0" - "255" -.PP -.I Default: -"0" (=6,5 ms) - - -.RE -.TP 7 -.BI "Option \*qEnterCount\*q \*q" count \*q -Number of skipped "enter reports". Reports are sent approx. -every 20ms. -.RS 7 -.PP -.I Range: -"0" - "31" -.PP -.I Default: -"3" (3 skipped messages = 60ms) - - -.RE -.TP 7 -.BI "Option \*qDualCount\*q \*q" count \*q -Number of skipped "dual touch error". Reports are sent approx. -every 20ms. This option is only available for "ZPress" and -"ZPress Exit" modes. -.RS 7 -.PP -.I Range: -"0" - "31" -.PP -.I Default: -"2" (2 skipped messages = 40ms) - - -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). -.SH AUTHORS -2000 - written by Citron GmbH (support@citron.de) Index: xc/programs/Xserver/hw/xfree86/input/citron/citron.h diff -u xc/programs/Xserver/hw/xfree86/input/citron/citron.h:1.1 xc/programs/Xserver/hw/xfree86/input/citron/citron.h:1.2 --- xc/programs/Xserver/hw/xfree86/input/citron/citron.h:1.1 Wed Nov 1 21:51:21 2000 +++ xc/programs/Xserver/hw/xfree86/input/citron/citron.h Thu Apr 5 13:42:34 2001 @@ -1,4 +1,4 @@ -/* +/* Id: citron.h,v 1.3 2001/03/28 08:24:38 pk Exp $ * Copyright (c) 1998 Metro Link Incorporated * * Permission is hereby granted, free of charge, to any person obtaining a @@ -25,12 +25,12 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.h,v 1.1 2000/11/02 02:51:21 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.h,v 1.2 2001/04/05 17:42:34 dawes Exp $ */ /* * Based, in part, on code with the following copyright notice: * - * Copyright 1999-2000 by Thomas Thanner, Citron GmbH, Germany. <support@citron.de> + * Copyright 1999-2001 by Thomas Thanner, Citron GmbH, Germany. <support@citron.de> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -247,8 +247,10 @@ #define D_SETCLICKMODE 0x00 #define D_BEEP 0x01 #define D_SETBEEP 0x02 +#define D_DEBUG 0x03 +#define D_ENTERCOUNT 0x04 +#define D_ZENTERCOUNT 0x05 - /* Message identifiers */ #define R_DUALTOUCHERROR 0x18 /* Invalid multiple touches are detected */ #define R_COORD 0x19 /* Regular coordinate report */ @@ -337,6 +339,8 @@ #define C_SETSLEEPMODE 0xf7 #define C_GETDOZEMODE 0xf8 #define C_SETDOZEMODE 0xf9 +#define C_SETPWMFREQ 0xfa +#define C_GETPWMFREQ 0xfb /* touch states */ #define CIT_TOUCHED 0x01 @@ -434,6 +438,7 @@ int sleep_time_scan; /* time interval between two scans */ int pwm_sleep; /* PWM duty cycle during touch saver mode */ int pwm_active; /* PWM duty cycle during regular operation */ + int pwm_freq; /* PWM base frequency */ int state; /* additional parameters */ int last_x; /* last cooked data */ @@ -456,6 +461,8 @@ int touch_time; /* minimum time span for a valid interruption */ int enter_touched; /* button is down due to an enter event */ int enter_count; /* number of jumed coord reports before a ButtonPress event is sent */ + int enter_count_no_Z; /* number of jumped over coords before ButtonPress event in not pressure sensitive mode */ + int enter_count_Z; /* number of jumped over coords before ButtonPress event in pressure sensitive mode */ int max_dual_count; /* number of jumed dualtouch error reports before a ButtonPress event is sent */ int dual_flg; /* Flag set if dualtouch error report is received , reset by counter */ int raw_min_x; /* min x,y max x,y value accumulated over the whole session */ @@ -464,12 +471,17 @@ int raw_min_y; int raw_max_y; int pressure_sensors; /* number of pressure sensors */ - OsTimerPtr timer_ptr; /* Timer for general purposes */ - CARD32 timer_val1; /* Timer 1st delay */ - CARD32 timer_val2; /* Timer second delay */ - OsTimerCallback timer_callback; /* timer callback routine */ + +#define MAX_TIMER 2 /* Max. concurrent timers */ +#define FAKE_TIMER 0 /* Timer for faked exit message */ +#define SV_TIMER 1 /* Supervision timer for command timeout suopervision */ + OsTimerPtr timer_ptr[MAX_TIMER]; /* Timer for general purposes */ + CARD32 timer_val1[MAX_TIMER]; /* Timer 1st delay */ + CARD32 timer_val2[MAX_TIMER]; /* Timer second delay */ + OsTimerCallback timer_callback[MAX_TIMER]; /* timer callback routine */ int fake_exit; /* tell the ReadInput function there is a exit message (from timer) */ /* end additional parameters */ + LocalDevicePtr local; /* Pointer to local device */ Bool button_down; /* is the "button" currently down */ Bool proximity; @@ -499,7 +511,7 @@ static Bool ConvertProc (LocalDevicePtr, int, int, int, int, int, int, int, int, int *, int *); static Bool QueryHardware (LocalDevicePtr, int *, int *); static Bool cit_GetPacket (cit_PrivatePtr); -static void cit_Flush(XISBuffer *); +static void cit_Flush(cit_PrivatePtr); static void cit_SendCommand(XISBuffer *, unsigned char, int, ...); static Bool cit_GetInitialErrors(cit_PrivatePtr); static Bool cit_GetDefectiveBeams(cit_PrivatePtr); @@ -508,9 +520,16 @@ static Bool cit_GetRevision(cit_PrivatePtr, int); static void cit_ProcessPacket(cit_PrivatePtr); static void cit_Beep(cit_PrivatePtr priv, int press); +static void cit_SetBlockDuration (cit_PrivatePtr priv, int block_duration); +static void cit_ReinitSerial(cit_PrivatePtr priv); +static int cit_ZPress(cit_PrivatePtr priv); +static void cit_SetEnterCount(cit_PrivatePtr priv); +static void cit_SendPWMFreq(cit_PrivatePtr priv); + #ifdef CIT_TIM -static void cit_StartTimer(cit_PrivatePtr priv); -static void cit_CloseTimer(cit_PrivatePtr priv); +static void cit_StartTimer(cit_PrivatePtr priv, int nr); +static void cit_CloseTimer(cit_PrivatePtr priv, int nr); +static CARD32 cit_SuperVisionTimer(OsTimerPtr timer, CARD32 now, pointer arg); static CARD32 cit_DualTouchTimer(OsTimerPtr timer, CARD32 now, pointer arg); #endif Index: xc/programs/Xserver/hw/xfree86/input/citron/citron.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/citron/citron.man:1.3 --- /dev/null Mon Jun 4 12:41:18 2001 +++ xc/programs/Xserver/hw/xfree86/input/citron/citron.man Thu Apr 5 13:42:34 2001 @@ -0,0 +1,657 @@ +.\" Copyright (c) 2000-2001 Peter Kunzmann <support@@citron.de> +.\" +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/citron/citron.man,v 1.3 2001/04/05 17:42:34 dawes Exp $ +.\" +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH CITRON __drivermansuffix__ __vendorversion__ +.SH NAME +citron \- Citron Infrared Touch Driver (CiTouch) +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" idevname \*q +.B " Driver \*qcitron\*q" +.BI " Option \*qDevice\*q \*q" devpath \*q +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B citron +is a XFree86 input driver for +.I Citron Infrared Touch +devices. +.PP +The +.B citron +driver acts as a pointer input device, and may be used as the +X server's core pointer. It is connected via a "RS232" with the host. +.SH SUPPORTED HARDWARE +At the moment the following touches are supported. They are also +available as +.I ZPress +touches. + +.B IRT6I5-V2.x + 6.5 inch Infrared Touch + +.B IRT10I4-V4.x + 10.4 inch Infrared Touch + +.B IRT12I1-V2.x + 12.1 inch Infrared Touch + +.B IRT15I1-V1.x + 15.1 inch Infrared Touch + +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +For better understanding please read also the +.B CTS +and various +.B IRT +manuals which are available in "pdf" format from Citron web page +.B www.citron.de +or directly from Citron. + +.PP +.PP +The following driver +.B Options +are supported: +.TP 7 +.BI "Option \*qDevice\*q \*q" devpath \*q +Specify the device path for the citron touch. Valid devices are: +.PP +.RS 12 +/dev/ttyS0, /dev/ttyS1, ... +.RE +.RS 7 +This option is mandatory. +.PP +It's important to specify the right device Note: com1 -> /dev/ttyS0, com2 -> /dev/ttyS1, ... + +.RE +.TP 7 +.BI "Option \*qScreenNumber\*q \*q" screennumber \*q +sets the +.I screennumber +for the +.B citron +InputDevice. +.PP +.RS 7 +.I Default: +ScreenNumber: "0" + +.RE +.TP 7 +.BI "Option \*qMinX\*q \*q" value \*q +.TP 7 +.BI "Option \*qMinY\*q \*q" value \*q +These are the minimum X and Y values for the +.B citron +input device. +.PP +.RS 7 +Note: MinX, MinY must be less than MaxX, MaxY. +.PP +.I Range: +"0" - "65535" +.PP +.I Default: +MinX: "0" MinY: "0" + + +.RE +.TP 7 +.BI "Option \*qMaxX\*q \*q" value \*q +.TP 7 +.BI "Option \*qMaxY\*q \*q" value \*q +These are the maximum X and Y values for the +.B citron +input device. +.PP +.RS 7 +Note: MaxX, MaxY must be greater than MinX, MinY. +.PP +.I Range: +"0" - "65535" +.PP +.I Default: +MaxX: "65535" MaxY: "65535" + + +.RE +.TP 7 +.BI "Option \*qButtonNumber\*q \*q" value \*q +This value is responsible for the +.I button number +that is returned within the xf86PostButton event message +.PP +.RS 7 +.I Range: +"0" - "255" +.PP +.I Default: +"1" + +.RE +.TP 7 +.BI "Option \*qButtonThreshold\*q \*q" value \*q +This value is responsible for the +.I button threshold. +It changes the pressure sensitivity of the touch. A higher number +corresponds to a higher pressure. +.PP +.RS 7 +Note: This feature is only available with pressure sensitive hardware. +.PP +.I Range: +"0" - "255" +.PP +.I Default: +"20" + +.RE +.TP 7 +.B Sleep-Mode +If the IRT is in +.I Doze-Mode +and Touch Zone is not interrupted for another +certain span of time, the so-called +.I Sleep-Mode +is activated. The +.I Sleep-Mode +decreases the scan rate of the beams even further than +the +.I Doze-Mode +does (see below). This way the life expectancy of the beams is +prolonged and the power consumption of the IRT is reduced. +As soon as an interruption of the Touch Zone is detected, the +.I Sleep-Mode +is deactivated and the Touch Zone will again be scanned with +the maximum speed. With the Sleep-Mode activated, +depending on the set scan rate the IRT's response time can be +considerably longer as in normal operation. If, for example, +a scan rate of 500 ms / scan is set, it may last up to a half +of a second until the IRT detects the interruption and deactivates +the +.I Sleep-Mode. + +.PP +.RE +.TP 7 +.BI "Option \*qSleepMode\*q \*q" mode \*q +This value is responsible for the +.I sleep-mode +of the touch. +.RS 7 +Determines the behaviour of the Sleep-Mode. + +.B 0x00 + No message at either activation or deactivation + +.B 0x01 + Message at activation + +.B 0x02 + Message at deactivation + +.B 0x03 + Message at activation and deactivation + +.B 0x10 +GP_OUT output set according to the Sleep-Mode status + +.I Values: +"0" "1" "2" "3" "16" + +.I Default: +"0" + +.RE +.TP 7 +.BI "Option \*qSleepTime\*q \*q" time \*q +This value is responsible for the +.I sleep-time +of the touch. It is the activation time in seconds +("0" = immediately activated, "65535" = always deactivated). +.RS 7 +.PP +.I Range: +"0" - "65535" [s] +.PP +.I Default: +"65535" => deactivated + +.RE +.TP 7 +.BI "Option \*qSleepScan\*q \*q" scan \*q +This value is responsible for the +.I scan-time +of the touch. This is the time interval between two scan operations +while in Sleep-Mode. The time interval is set in steps +of milliseconds. +.RS 7 +.PP +.I Range: +"0" - "65535" [ms] +.PP +.I Default: +"500" + +.RE +.TP 7 +.BI "Option \*qPWMActive\*q \*q" value \*q +This value determines the mark-to-space ratio of the +.I PWM +output while in normal operation (sleep-mode not active). +Higher values result in longer pulse widths. This output +signal can be used in conjunction with the +.I Citron AWBI +to do backlight-dimming via the touch. +.RS 7 +.PP +.I Range: +"0" - "255" +.PP +.I Default: +"255" (max. brightness) + + +.RE +.TP 7 +.BI "Option \*qPWMSleep\*q \*q" value \*q +This value determines the mark-to-space ratio of the +.I PWM +output while in sleep-mode (-> +.I SleepMode, SleepScan, SleepTime +) operation (sleep-mode active). +Higher values result in longer pulse widths. +.RS 7 +.PP +.I Range: +"0" - "255" +.PP +.I Default: +"255" (max. brightness) + +.RE +.TP 7 +.BI "Option \*qPWMFreq\*q \*q" value \*q +This value determines the +.I PWM +frequency in Hertz. +.RS 7 +.PP +.I Range: +"39" - "9803" +.PP +.I Default: +"9803" (max. frequency) + +.RE +.TP 7 +.BI "Option \*qClickMode\*q \*q" mode \*q +With mode one can select between 5 +.I ClickModes + +.B \*q1\*q += ClickMode Enter + +With this mode every interruption of the infrared beams will +activate a ButtonPress event and after the interruption a +ButtonRelease event will be sent. + +.B \*q2\*q += ClickMode Dual + +With this mode every interruption will sent a Proximity event and +every second interruption a ButtonPress event. With the release of +the interruption (while one interruption is still active) a +ButtonRelease event will be sent. + +.B \*q3\*q += ClickMode Dual Exit + +With this mode every interruption will sent a ProximityIn event and +every second interruption a ButtonPress event. With the release of +the interruption (while one interruption is still active) no +ButtonRelease event will be sent. Only if all interruptions are released +a ButtonRelease followed by a ProximityOut event will be sent. + +.B \*q4\*q += ClickMode ZPress + +With this mode every interruption will sent a ProximityIn event. Only if +a certain pressure is exceeded a ButtonPress event will occur. If the +pressure falls below a certain limit a ButtonRelease event will be sent. +After also the interruption is released a ProximityOut event is generated. + +.B \*q5\*q += ClickMode ZPress Exit + +This mode is similar to "Clickmode Dual Exit". +The first interruption of the beams will sent a ProximityIn event. Only if +a certain pressure is exceeded a ButtonPress event will occur. If the +pressure falls below a certain limit no ButtonRelease event will be sent. +After the interruption is also released a ButtonRelease followed by +a ProximityOut event is generated. +.RS 7 +.PP +.I Range: +"1" - "5" +.PP +.I Default: +"1" (ClickMode Enter) + +.RE +.TP 7 +.BI "Option \*qOrigin\*q \*q" value \*q +This value sets the coordinates origin to one of the four corners of +the screen. +The following values are accepted: +"0" TOPLEFT: Origin set to the left-hand side top corner. +"1" TOPRIGHT: Origin set to the right-hand side top corner. +"2" BOTTOMRIGHT: Origin set to the right-hand side bottom corner. +"3" BOTTOMLEFT: Origin set to the left-hand side bottom corner. +.RS 7 +.PP +.I Range: +"0" - "3" +.PP +.I Default: +"0" (TOPLEFT) + +.RE +.TP 7 +.B "Doze-Mode" +If for a certain span of time the Touch Zone is not interrupted, +the so-called Doze-Mode is automatically activated. The activated +Doze-Mode slightly decreases the scan rate of the beams. This way +the power consumption of the IRT is reduced. As soon as an +interruption of the Touch Zone is detected, the Doze-Mode +is deactivated and the Touch Zone will again be scanned with +the maximum speed. + +.RE +.TP 7 +.BI "Option \*qDozeMode\*q \*q" mode \*q +This value is responsible for the +.I doze-mode +of the touch. +.RS 7 +.PP +Determines the behaviour of the Doze-Mode. +.PP +.B 0x00 +No message at either activation or deactivation + +.B 0x01 +Message at activation + +.B 0x02 +Message at deactivation + +.B 0x03 +Message at activation and deactivation + +.B 0x10 +GP_OUT output set according to the Doze-Mode status + +If the GP_OUT output is already controlled by the +.I Sleep-Mode +it is no longer available as an output port anymore. +.PP +.I Values: +"0" "1" "2" "3" "16" +.PP +.I Default: +"0" + + + +.RE +.TP 7 +.BI "Option \*qDozeTime\*q \*q" time \*q +This value is responsible for the +.I doze-time +of the touch. It is the activation time in seconds +("0" = immediately activated, "65535" = always deactivated). +.RS 7 +.PP +.I Range: +"0" - "65535" [s] +.PP +.I Default: +"65535" => deactivated + + +.RE +.TP 7 +.BI "Option \*qDozeScan\*q \*q" scan \*q +This value is responsible for the +.I scan-time +of the touch. This is the time interval between two scan operations +while in Doze-Mode. The time interval is set in steps +of milliseconds. +.RS 7 +.PP +.I Range: +"0" - "65535" [ms] +.PP +.I Default: +"500" + +.RE +.TP 7 +.BI "Option \*qDeltaX\*q \*q" value \*q +This value determines a virtual area at the left and right +side of the current cursor position where the cursor didn't move. +Within this area no "MotionNotify" event will be sent. +.RS 7 +.PP +.I Range: +"0" - "255" +.PP +.I Default: +"0" (no deltaX) + + +.RE +.TP 7 +.BI "Option \*qDeltaY\*q \*q" value \*q +This value determines a virtual area at the top and bottom +of the current cursor position where the cursor didn't move. +Within this area no "MotionNotify" event will be sent. +.RS 7 +.PP +.I Range: +"0" - "255" +.PP +.I Default: +"0" (no deltaY) + +.RE +.TP 7 +.BI "Option \*qBeep\*q \*q" value \*q +This value determines if a "ButtonPress" and/or a "ButtonRelease" +event should sound the buzzer. "0" deactivates the buzzer while +every other value will activate it. +.RS 7 +.PP +.I Range: +"0" - "1" +.PP +.I Default: +"0" (deactivated) + +.RE +.TP 7 +.BI "Option \*qPressVol\*q \*q" value \*q +This value determines the volume of the buzzer (0-100%) +when a "ButtonPress" event is sent. +.RS 7 +.PP +.I Range: +"0" - "100" +.PP +.I Default: +"100" + + +.RE +.TP 7 +.BI "Option \*qPressPitch\*q \*q" value \*q +This value determines the pitch of the tone +when a "ButtonPress" event is sent. +.RS 7 +.PP +.I Range: +"0" - "3000" +.PP +.I Default: +"880" + + + +.RE +.TP 7 +.BI "Option \*qPressDur\*q \*q" value \*q +This value determines the duration of the tone in ms +when a "ButtonPress" event is sent. +.RS 7 +.PP +.I Range: +"0" - "255" +.PP +.I Default: +"15" + +.RE +.TP 7 +.BI "Option \*qReleaseVol\*q \*q" value \*q +This value determines the volume of the buzzer (0-100%) +when a "ButtonRelease" event is sent. +.RS 7 +.PP +.I Range: +"0" - "100" +.PP +.I Default: +"100" + + +.RE +.TP 7 +.BI "Option \*qReleasePitch\*q \*q" value \*q +This value determines the pitch of the tone when +when a "ButtonRelease" event is sent. +.RS 7 +.PP +.I Range: +"0" - "3000" +.PP +.I Default: +"1200" + + + +.RE +.TP 7 +.BI "Option \*qReleseDur\*q \*q" value \*q +This value determines the duration of the tone in ms when +when a "ButtonRelease" event is sent. +.RS 7 +.PP +.I Range: +"0" - "255" +.PP +.I Default: +"10" + + + +.RE +.TP 7 +.BI "Option \*qBeamTimeout\*q \*q" value \*q +Determines the time span in seconds, that has to elapse before a beam is +considered defective, blanked-out and excluded from the coordinates +evaluation. +.RS 7 +.PP +.I Range: +"0" - "65535" +.PP +.I Default: +"30" (30 seconds) + + + + +.RE +.TP 7 +.BI "Option \*qTouchTime\*q \*q" value \*q +Determines the minimum time span in steps of 10ms for a valid +interruption. In order for an interruption to be +reported to the host computer as valid, it needs to remain at +the same spot for at least the time span declared here. +.RS 7 +.PP +.I Range: +"0" - "255" +.PP +.I Default: +"0" (=6,5 ms) + + +.RE +.TP 7 +.BI "Option \*qEnterCount\*q \*q" count \*q +Number of skipped "enter reports". Reports are sent approx. +every 20ms. +.RS 7 +.PP +.I Range: +"0" - "31" +.PP +.I Default: +"3" (3 skipped messages = 60ms) + + +.RE +.TP 7 +.BI "Option \*qZEnterCount\*q \*q" count \*q +Number of skipped "enter reports" while in pressure +sensitive mode. Reports are sent approx. every 20ms. +.RS 7 +.PP +.I Range: +"0" - "31" +.PP +.I Default: +"1" (1 skipped messages = 20ms) + + +.RE +.TP 7 +.BI "Option \*qDualCount\*q \*q" count \*q +Number of skipped "dual touch error". Reports are sent approx. +every 20ms. This option is only available for "ZPress" and +"ZPress Exit" modes. +.RS 7 +.PP +.I Range: +"0" - "31" +.PP +.I Default: +"2" (2 skipped messages = 40ms) + + +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +2000-2001 \- written by Citron GmbH (support@citron.de) Index: xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c diff -u xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c:1.1 xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c:1.4 --- xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c:1.1 Fri Aug 11 15:10:41 2000 +++ xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c Tue May 15 14:22:22 2001 @@ -30,9 +30,9 @@ * Probably buggy as hell, no idea what the initialisation strings are, * no idea how to ack it. If the tablet stops responding power cycle it. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c,v 1.1 2000/08/11 19:10:41 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/digitaledge/DigitalEdge.c,v 1.4 2001/05/15 18:22:22 paulo Exp $ */ -#include <xf86Version.h> +#include "xf86Version.h" #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) #define XFREE86_V4 1 @@ -46,25 +46,23 @@ #include <errno.h> #endif -#include <misc.h> -#include <xf86.h> +#include "misc.h" +#include "xf86.h" #define NEED_XF86_TYPES #if !defined(DGUX) -#include <xf86_ansic.h> -#include <xisb.h> +#include "xf86_ansic.h" +#include "xisb.h" #endif -#include <xf86_OSproc.h> -#include <xf86Xinput.h> -#include <exevents.h> /* Needed for InitValuator/Proximity stuff */ -#include <keysym.h> -#include <mipointer.h> +#include "xf86_OSproc.h" +#include "xf86Xinput.h" +#include "exevents.h" /* Needed for InitValuator/Proximity stuff */ +#include "keysym.h" +#include "mipointer.h" #ifdef XFree86LOADER -#include <xf86Module.h> +#include "xf86Module.h" #endif -#undef memset -#define memset xf86memset #undef sleep #define sleep(t) xf86WaitForInput(-1, 1000 * (t)) #define wait_for_fd(fd) xf86WaitForInput((fd), 1000) @@ -135,7 +133,6 @@ #include "xf86_Config.h" #include "xf86Xinput.h" #include "atKeynames.h" -#include "xf86Version.h" #endif #if !defined(sun) || defined(i386) @@ -1191,9 +1188,9 @@ local->history_size = 0; #if defined(sun) && !defined(i386) - if (def_name) { + if (dev_name) { priv->dedgeDevice = (char *) xalloc(strlen(dev_name) + 1); - strcpy(priv->dedgeDevice, device_name); + strcpy(priv->dedgeDevice, dev_name); ErrorF("xf86SumOpen port changed to '%s'\n", priv->dedgeDevice); } else { priv->dedgeDevice = ""; @@ -1443,7 +1440,6 @@ static void xf86SumUnplug(pointer p) { - DBG(1, ErrorF("xf86SumUnplug\n")); } /* @@ -1457,8 +1453,6 @@ int *errmaj, int *errmin) { - DBG(1, ErrorF("xf86SumPlug\n")); - xf86AddInputDriver(&DIGITALEDGE, module, 0); return module; Index: xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile:1.3 xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile:1.4 --- xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile:1.3 Thu Mar 2 20:05:48 2000 +++ xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile Tue Jan 23 19:06:35 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile,v 1.3 2000/03/03 01:05:48 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/dynapro/Imakefile,v 1.4 2001/01/24 00:06:35 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -22,7 +22,6 @@ InstallObjectModule($(DRIVER),$(MODULEDIR),input) #if !defined(XF86DriverSDK) -CppManTarget($(DRIVER),) InstallModuleManPage($(DRIVER)) #endif Index: xc/programs/Xserver/hw/xfree86/input/dynapro/dynapro.cpp diff -u xc/programs/Xserver/hw/xfree86/input/dynapro/dynapro.cpp:1.5 xc/programs/Xserver/hw/xfree86/input/dynapro/dynapro.cpp:removed --- xc/programs/Xserver/hw/xfree86/input/dynapro/dynapro.cpp:1.5 Mon Dec 11 15:18:48 2000 +++ xc/programs/Xserver/hw/xfree86/input/dynapro/dynapro.cpp Mon Jun 4 12:41:18 2001 @@ -1,36 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/dynapro/dynapro.cpp,v 1.5 2000/12/11 20:18:48 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH DYNAPRO __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -dynapro \- Dynapro input driver -.SH SYNOPSIS -.nf -.B "Section \*qInputDevice\*q" -.BI " Identifier \*q" idevname \*q -.B " Driver \*qdynapro\*q" -.BI " Option \*qDevice\*q \*q" devpath \*q -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B dynapro -is an XFree86 input driver for Dynapro devices... -.PP -The -.B dynapro -driver functions as a pointer input device, and may be used as the -X server's core pointer. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -What is supported... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details and for options that can be used with all input drivers. This -section only covers configuration details specific to this driver. -.PP -Config details... -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). -.SH AUTHORS -Authors include... Index: xc/programs/Xserver/hw/xfree86/input/dynapro/dynapro.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/dynapro/dynapro.man:1.2 --- /dev/null Mon Jun 4 12:41:18 2001 +++ xc/programs/Xserver/hw/xfree86/input/dynapro/dynapro.man Sat Jan 27 13:20:57 2001 @@ -0,0 +1,36 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/dynapro/dynapro.man,v 1.2 2001/01/27 18:20:57 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH DYNAPRO __drivermansuffix__ __vendorversion__ +.SH NAME +dynapro \- Dynapro input driver +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" idevname \*q +.B " Driver \*qdynapro\*q" +.BI " Option \*qDevice\*q \*q" devpath \*q +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B dynapro +is an XFree86 input driver for Dynapro devices... +.PP +The +.B dynapro +driver functions as a pointer input device, and may be used as the +X server's core pointer. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +What is supported... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +Config details... +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Authors include... Index: xc/programs/Xserver/hw/xfree86/input/elographics/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/elographics/Imakefile:1.3 xc/programs/Xserver/hw/xfree86/input/elographics/Imakefile:1.4 --- xc/programs/Xserver/hw/xfree86/input/elographics/Imakefile:1.3 Tue May 23 00:47:47 2000 +++ xc/programs/Xserver/hw/xfree86/input/elographics/Imakefile Tue Jan 23 19:06:35 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/Imakefile,v 1.3 2000/05/23 04:47:47 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/Imakefile,v 1.4 2001/01/24 00:06:35 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -22,7 +22,6 @@ InstallObjectModule($(DRIVER),$(MODULEDIR),input) #if !defined(XF86DriverSDK) -CppManTarget($(DRIVER),) InstallModuleManPage($(DRIVER)) #endif Index: xc/programs/Xserver/hw/xfree86/input/elographics/elographics.cpp diff -u xc/programs/Xserver/hw/xfree86/input/elographics/elographics.cpp:1.3 xc/programs/Xserver/hw/xfree86/input/elographics/elographics.cpp:removed --- xc/programs/Xserver/hw/xfree86/input/elographics/elographics.cpp:1.3 Mon Dec 11 15:18:49 2000 +++ xc/programs/Xserver/hw/xfree86/input/elographics/elographics.cpp Mon Jun 4 12:41:18 2001 @@ -1,40 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/elographics.cpp,v 1.3 2000/12/11 20:18:49 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH ELOGRAPHICS __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -elographics \- Elographics input driver -.SH SYNOPSIS -.B "Section \*qInputDevice\*q" -.br -.BI " Identifier \*q" idevname \*q -.br -.B " Driver \*qelographics\*q" -.br -.BI " Option \*qDevice\*q \*q" devpath \*q -.br -\ \ ... -.br -.B EndSection -.SH DESCRIPTION -.B elographics -is an XFree86 input driver for Elographics devices... -.PP -The -.B elographics -driver functions as a pointer input device, and may be used as the -X server's core pointer. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -What is supported... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details and for options that can be used with all input drivers. This -section only covers configuration details specific to this driver. -.PP -Config details... -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). -.SH AUTHORS -Authors include... - Patrick Lecoanet Index: xc/programs/Xserver/hw/xfree86/input/elographics/elographics.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/elographics/elographics.man:1.2 --- /dev/null Mon Jun 4 12:41:18 2001 +++ xc/programs/Xserver/hw/xfree86/input/elographics/elographics.man Sat Jan 27 13:20:57 2001 @@ -0,0 +1,40 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/elographics.man,v 1.2 2001/01/27 18:20:57 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH ELOGRAPHICS __drivermansuffix__ __vendorversion__ +.SH NAME +elographics \- Elographics input driver +.SH SYNOPSIS +.B "Section \*qInputDevice\*q" +.br +.BI " Identifier \*q" idevname \*q +.br +.B " Driver \*qelographics\*q" +.br +.BI " Option \*qDevice\*q \*q" devpath \*q +.br +\ \ ... +.br +.B EndSection +.SH DESCRIPTION +.B elographics +is an XFree86 input driver for Elographics devices... +.PP +The +.B elographics +driver functions as a pointer input device, and may be used as the +X server's core pointer. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +What is supported... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +Config details... +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Authors include... + Patrick Lecoanet Index: xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c diff -u xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c:1.11 xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c:1.13 --- xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c:1.11 Fri Aug 11 15:10:45 2000 +++ xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c Sun Apr 1 10:00:13 2001 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c,v 1.11 2000/08/11 19:10:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/elographics/xf86Elo.c,v 1.13 2001/04/01 14:00:13 tsi Exp $ */ /* ******************************************************************************* @@ -46,7 +46,7 @@ ******************************************************************************* */ -#include <xf86Version.h> +#include "xf86Version.h" #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) #define XFREE86_V4 #endif @@ -58,17 +58,17 @@ #include <errno.h> #endif -#include <misc.h> -#include <xf86.h> +#include "misc.h" +#include "xf86.h" #if !defined(DGUX) -#include <xf86_ansic.h> +#include "xf86_ansic.h" #endif -#include <xf86_OSproc.h> -#include <xf86Xinput.h> -#include <exevents.h> +#include "xf86_OSproc.h" +#include "xf86Xinput.h" +#include "exevents.h" #ifdef XFree86LOADER -#include <xf86Module.h> +#include "xf86Module.h" #endif #else /* XFREE86_V4 */ @@ -100,7 +100,6 @@ #include "xf86_OSlib.h" #include "xf86_Config.h" #include "xf86Xinput.h" -#include "xf86Version.h" #endif /* defined(sun) && !defined(i386) */ #if !defined(sun) || defined(i386) @@ -1196,7 +1195,7 @@ case DEVICE_INIT: { -#if defined(sun) && !defined(i386) +#if defined(sun) && !defined(i386) && !defined(XFREE86_V4) char *name = (char *) getenv("ELO_DEV"); char *calib = (char *) getenv("ELO_CALIB"); char *speed = (char *) getenv("ELO_SPEED"); @@ -1205,7 +1204,7 @@ DBG(2, ErrorF("Elographics touchscreen init...\n")); -#if defined(sun) && !defined(i386) +#if defined(sun) && !defined(i386) && !defined(XFREE86_V4) if (name) { priv->input_dev = strdup(name); ErrorF("Elographics touchscreen port changed to '%s'\n", Index: xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile:1.2 --- xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile:1.1 Thu Mar 2 20:05:48 2000 +++ xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile Tue Jan 23 19:06:36 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile,v 1.1 2000/03/03 01:05:48 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/keyboard/Imakefile,v 1.2 2001/01/24 00:06:36 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -6,7 +6,6 @@ DRIVER = keyboard #if !defined(XF86DriverSDK) -CppManTarget($(DRIVER),) InstallModuleManPage($(DRIVER)) #endif Index: xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.cpp diff -u xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.cpp:1.5 xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.cpp:removed --- xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.cpp:1.5 Mon Dec 11 15:18:50 2000 +++ xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.cpp Mon Jun 4 12:41:18 2001 @@ -1,97 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.cpp,v 1.5 2000/12/11 20:18:50 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH KEYBOARD __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -keyboard \- Keyboard input driver -.SH SYNOPSIS -.nf -.B "Section \*qInputDevice\*q" -.BI " Identifier \*q" idevname \*q -.B " Driver \*qkeyboard\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B keyboard -is an XFree86 input driver for keyboards. The driver supports the standard -OS-provided keyboard interface. This driver is currently built-in to -the core X server. -.PP -The -.B keyboard -driver functions as a keyboard input device, and may be used as the -X server's core keyboard. This driver is currently built-in to the core -X server, and multiple instances are not yet supported. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details and for options that can be used with all input drivers. This -section only covers configuration details specific to this driver. -.PP -The following driver -.B Options -are supported: -.TP 7 -.BI "Option \*qProtocol\*q \*q" string \*q -Specify the mouse protocol. Valid protocol types include: -.PP -.RS 12 -Standard, Xqueue. -.RE -.PP -.RS 7 -Not all protocols are supported on all platforms. Default: "Standard". -.RE -.TP 7 -.BI "Option \*qAutoRepeat\*q \*q" "delay rate" \*q -sets the auto repeat behaviour for the keyboard. This is not implemented -on all platforms. -.I delay -is the time in milliseconds before a key starts repeating. -.I rate -is the number of times a key repeats per second. Default: "500 30". -.TP 7 -.BI "Option \*qXLeds\*q \*q" ledlist \*q -makes the keyboard LEDs specified in -.I ledlist -available for client use instead of their traditional function -(Scroll Lock, Caps Lock and Num Lock). The numbers in the list are -in the range 1 to 3. Default: empty list. -.TP 7 -.BI "Option \*qXkbDisable\*q \*q" boolean \*q -disable/enable the XKEYBOARD extension. The \-kb command line -option overrides this config file option. Default: XKB is enabled. -.TP 7 -.BI "Option \*qXkbRules\*q \*q" rules \*q -specifies which XKB rules file to use for interpreting the -.BR XkbModel , -.BR XkbLayout , -.BR XkbVariant , -and -.B XkbOptions -settings. Default: "xfree86" for most platforms, but "xfree98" for the -Japanese PC-98 platforms. -.TP 7 -.BI "Option \*qXkbModel\*q \*q" modelname \*q -specifies the XKB keyboard model name. Default: "pc101" for most platforms, -but "pc98" for the Japanese PC-98 platforms, and "pc101_sol8x86" for -Solaris 8 on x86. -.TP 7 -.BI "Option \*qXkbLayout\*q \*q" layoutname \*q -specifies the XKB keyboard layout name. This is usually the country or -language type of the keyboard. Default: "us" for most platforms, but -"nec/jp" for the Japanese PC-98 platforms. -.TP 7 -.BI "Option \*qXkbVariant\*q \*q" variants \*q -specifies the XKB keyboard variant components. These can be used to -enhance the keyboard layout details. Default: not set. -.TP 7 -.BI "Option \*qXkbOptions\*q \*q" options \*q -specifies the XKB keyboard option components. These can be used to -enhance the keyboard behaviour. Default: not set. -.PP -Some other XKB-related options are available, but they are incompatible -with the ones listed above and are not recommended, so they are not -documented here. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). Index: xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.man:1.2 --- /dev/null Mon Jun 4 12:41:18 2001 +++ xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.man Sat Jan 27 13:20:57 2001 @@ -0,0 +1,97 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/keyboard/keyboard.man,v 1.2 2001/01/27 18:20:57 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH KEYBOARD __drivermansuffix__ __vendorversion__ +.SH NAME +keyboard \- Keyboard input driver +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" idevname \*q +.B " Driver \*qkeyboard\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B keyboard +is an XFree86 input driver for keyboards. The driver supports the standard +OS-provided keyboard interface. This driver is currently built-in to +the core X server. +.PP +The +.B keyboard +driver functions as a keyboard input device, and may be used as the +X server's core keyboard. This driver is currently built-in to the core +X server, and multiple instances are not yet supported. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +The following driver +.B Options +are supported: +.TP 7 +.BI "Option \*qProtocol\*q \*q" string \*q +Specify the mouse protocol. Valid protocol types include: +.PP +.RS 12 +Standard, Xqueue. +.RE +.PP +.RS 7 +Not all protocols are supported on all platforms. Default: "Standard". +.RE +.TP 7 +.BI "Option \*qAutoRepeat\*q \*q" "delay rate" \*q +sets the auto repeat behaviour for the keyboard. This is not implemented +on all platforms. +.I delay +is the time in milliseconds before a key starts repeating. +.I rate +is the number of times a key repeats per second. Default: "500 30". +.TP 7 +.BI "Option \*qXLeds\*q \*q" ledlist \*q +makes the keyboard LEDs specified in +.I ledlist +available for client use instead of their traditional function +(Scroll Lock, Caps Lock and Num Lock). The numbers in the list are +in the range 1 to 3. Default: empty list. +.TP 7 +.BI "Option \*qXkbDisable\*q \*q" boolean \*q +disable/enable the XKEYBOARD extension. The \-kb command line +option overrides this config file option. Default: XKB is enabled. +.TP 7 +.BI "Option \*qXkbRules\*q \*q" rules \*q +specifies which XKB rules file to use for interpreting the +.BR XkbModel , +.BR XkbLayout , +.BR XkbVariant , +and +.B XkbOptions +settings. Default: "xfree86" for most platforms, but "xfree98" for the +Japanese PC-98 platforms. +.TP 7 +.BI "Option \*qXkbModel\*q \*q" modelname \*q +specifies the XKB keyboard model name. Default: "pc101" for most platforms, +but "pc98" for the Japanese PC-98 platforms, and "pc101_sol8x86" for +Solaris 8 on x86. +.TP 7 +.BI "Option \*qXkbLayout\*q \*q" layoutname \*q +specifies the XKB keyboard layout name. This is usually the country or +language type of the keyboard. Default: "us" for most platforms, but +"nec/jp" for the Japanese PC-98 platforms. +.TP 7 +.BI "Option \*qXkbVariant\*q \*q" variants \*q +specifies the XKB keyboard variant components. These can be used to +enhance the keyboard layout details. Default: not set. +.TP 7 +.BI "Option \*qXkbOptions\*q \*q" options \*q +specifies the XKB keyboard option components. These can be used to +enhance the keyboard behaviour. Default: not set. +.PP +Some other XKB-related options are available, but they are incompatible +with the ones listed above and are not recommended, so they are not +documented here. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). Index: xc/programs/Xserver/hw/xfree86/input/microtouch/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/microtouch/Imakefile:1.5 xc/programs/Xserver/hw/xfree86/input/microtouch/Imakefile:1.6 --- xc/programs/Xserver/hw/xfree86/input/microtouch/Imakefile:1.5 Thu Mar 2 20:05:49 2000 +++ xc/programs/Xserver/hw/xfree86/input/microtouch/Imakefile Tue Jan 23 19:06:36 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/microtouch/Imakefile,v 1.5 2000/03/03 01:05:49 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/microtouch/Imakefile,v 1.6 2001/01/24 00:06:36 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -22,7 +22,6 @@ InstallObjectModule($(DRIVER),$(MODULEDIR),input) #if !defined(XF86DriverSDK) -CppManTarget($(DRIVER),) InstallModuleManPage($(DRIVER)) #endif Index: xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.cpp diff -u xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.cpp:1.5 xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.cpp:removed --- xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.cpp:1.5 Mon Dec 11 15:18:51 2000 +++ xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.cpp Mon Jun 4 12:41:19 2001 @@ -1,36 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.cpp,v 1.5 2000/12/11 20:18:51 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH MICROTOUCH __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -microtouch \- MicroTouch input driver -.SH SYNOPSIS -.nf -.B "Section \*qInputDevice\*q" -.BI " Identifier \*q" idevname \*q -.B " Driver \*qmicrotouch\*q" -.BI " Option \*qDevice\*q \*q" devpath \*q -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B microtouch -is an XFree86 input driver for MicroTouch devices... -.PP -The -.B microtouch -driver functions as a pointer input device, and may be used as the -X server's core pointer. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -What is supported... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details and for options that can be used with all input drivers. This -section only covers configuration details specific to this driver. -.PP -Config details... -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). -.SH AUTHORS -Authors include... Index: xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.man:1.2 --- /dev/null Mon Jun 4 12:41:19 2001 +++ xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.man Sat Jan 27 13:20:58 2001 @@ -0,0 +1,36 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/microtouch/microtouch.man,v 1.2 2001/01/27 18:20:58 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH MICROTOUCH __drivermansuffix__ __vendorversion__ +.SH NAME +microtouch \- MicroTouch input driver +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" idevname \*q +.B " Driver \*qmicrotouch\*q" +.BI " Option \*qDevice\*q \*q" devpath \*q +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B microtouch +is an XFree86 input driver for MicroTouch devices... +.PP +The +.B microtouch +driver functions as a pointer input device, and may be used as the +X server's core pointer. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +What is supported... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +Config details... +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Authors include... Index: xc/programs/Xserver/hw/xfree86/input/mouse/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/mouse/Imakefile:1.4 xc/programs/Xserver/hw/xfree86/input/mouse/Imakefile:1.5 --- xc/programs/Xserver/hw/xfree86/input/mouse/Imakefile:1.4 Thu Mar 2 20:05:50 2000 +++ xc/programs/Xserver/hw/xfree86/input/mouse/Imakefile Tue Jan 23 19:06:37 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/Imakefile,v 1.4 2000/03/03 01:05:50 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/Imakefile,v 1.5 2001/01/24 00:06:37 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -25,7 +25,6 @@ InstallObjectModule($(DRIVER),$(MODULEDIR),input) #if !defined(XF86DriverSDK) -CppManTarget($(DRIVER),) InstallModuleManPage($(DRIVER)) #endif Index: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c diff -u xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c:1.38.2.1 xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c:1.43 --- xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c:1.38.2.1 Tue Mar 6 13:31:47 2001 +++ xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c Fri May 18 16:22:30 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.38.2.1 2001/03/06 18:31:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.c,v 1.43 2001/05/18 20:22:30 tsi Exp $ */ /* * * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. @@ -63,6 +63,7 @@ #include "mousePriv.h" #include "mipointer.h" +static const OptionInfoRec *MouseAvailableOptions(void *unused); static InputInfoPtr MousePreInit(InputDriverPtr drv, IDevPtr dev, int flags); #if 0 static void MouseUnInit(InputDriverPtr drv, InputInfoPtr pInfo, int flags); @@ -89,6 +90,65 @@ 0 }; +typedef enum { + OPTION_ALWAYS_CORE, + OPTION_SEND_CORE_EVENTS, + OPTION_CORE_POINTER, + OPTION_SEND_DRAG_EVENTS, + OPTION_HISTORY_SIZE, + OPTION_DEVICE, + OPTION_PROTOCOL, + OPTION_BUTTONS, + OPTION_EMULATE_3_BUTTONS, + OPTION_EMULATE_3_TIMEOUT, + OPTION_CHORD_MIDDLE, + OPTION_FLIP_XY, + OPTION_INV_X, + OPTION_INV_Y, + OPTION_Z_AXIS_MAPPING, + OPTION_SAMPLE_RATE, + OPTION_RESOLUTION, + OPTION_CLEAR_DTR, + OPTION_CLEAR_RTS, + OPTION_BAUD_RATE, + OPTION_DATA_BITS, + OPTION_STOP_BITS, + OPTION_PARITY, + OPTION_FLOW_CONTROL, + OPTION_VTIME, + OPTION_VMIN +} MouseOpts; + +static const OptionInfoRec MouseOptions[] = { + { OPTION_ALWAYS_CORE, "AlwaysCore", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SEND_CORE_EVENTS, "SendCoreEvents", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CORE_POINTER, "CorePointer", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_SEND_DRAG_EVENTS, "SendDragEvents", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_HISTORY_SIZE, "HistorySize", OPTV_INTEGER, {0}, FALSE }, + { OPTION_DEVICE, "Device", OPTV_STRING, {0}, FALSE }, + { OPTION_PROTOCOL, "Protocol", OPTV_STRING, {0}, FALSE }, + { OPTION_BUTTONS, "Buttons", OPTV_INTEGER, {0}, FALSE }, + { OPTION_EMULATE_3_BUTTONS, "Emulate3Buttons",OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_EMULATE_3_TIMEOUT, "Emulate3Timeout",OPTV_INTEGER, {0}, FALSE }, + { OPTION_CHORD_MIDDLE, "ChordMiddle", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_FLIP_XY, "FlipXY", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_INV_X, "InvX", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_INV_Y, "InvY", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_Z_AXIS_MAPPING, "ZAxisMapping", OPTV_STRING, {0}, FALSE }, + { OPTION_SAMPLE_RATE, "SampleRate", OPTV_INTEGER, {0}, FALSE }, + { OPTION_RESOLUTION, "Resolution", OPTV_INTEGER, {0}, FALSE }, + { OPTION_CLEAR_DTR, "ClearDTR", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_CLEAR_RTS, "ClearRTS", OPTV_BOOLEAN, {0}, FALSE }, + { OPTION_BAUD_RATE, "BaudRate", OPTV_INTEGER, {0}, FALSE }, + { OPTION_DATA_BITS, "DataBits", OPTV_INTEGER, {0}, FALSE }, + { OPTION_STOP_BITS, "StopBits", OPTV_INTEGER, {0}, FALSE }, + { OPTION_PARITY, "Parity", OPTV_STRING, {0}, FALSE }, + { OPTION_FLOW_CONTROL, "FlowControl", OPTV_STRING, {0}, FALSE }, + { OPTION_VTIME, "VTime", OPTV_INTEGER, {0}, FALSE }, + { OPTION_VMIN, "VMin", OPTV_INTEGER, {0}, FALSE }, + { -1, NULL, OPTV_NONE, {0}, FALSE } +}; + /* * Microsoft (all serial models), Logitech MouseMan, First Mouse, etc, * ALPS GlidePoint, Thinking Mouse. @@ -198,6 +258,13 @@ { NULL, MSE_NONE, NULL, PROT_UNKNOWN } }; +/*ARGSUSED*/ +static const OptionInfoRec * +MouseAvailableOptions(void *unused) +{ + return (MouseOptions); +} + static MouseProtocolID ProtocolNameToID(const char *name) { @@ -898,7 +965,7 @@ case PROT_IMPS2: /* IntelliMouse */ { - static unsigned char s[] = { 243, 200, 243, 100, 243, 80, }; + static unsigned char s[] = { 243, 200, 243, 100, 243, 80, 242 }; param = s; paramlen = sizeof(s); @@ -907,7 +974,7 @@ case PROT_EXPPS2: /* IntelliMouse Explorer */ { - static unsigned char s[] = { 243, 200, 243, 200, 243, 80, }; + static unsigned char s[] = { 243, 200, 243, 200, 243, 80, 242 }; param = s; paramlen = sizeof(s); @@ -1594,101 +1661,140 @@ return TRUE; } -static CARD32 -buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg) -{ - InputInfoPtr pInfo; - MouseDevPtr pMse; - int sigstate; - - pInfo = arg; - pMse = pInfo->private; - - sigstate = xf86BlockSIGIO (); - pMse->PostEvent(pInfo, pMse->truebuttons, 0, 0, 0, 0); - xf86UnblockSIGIO (sigstate); - return 0; -} - /* - * Lets create a simple finite-state machine: + * Lets create a simple finite-state machine for 3 button emulation: + * + * We track buttons 1 and 3 (left and right). There are 11 states: + * 0 ground - initial state + * 1 delayed left - left pressed, waiting for right + * 2 delayed right - right pressed, waiting for left + * 3 pressed middle - right and left pressed, emulated middle sent + * 4 pressed left - left pressed and sent + * 5 pressed right - right pressed and sent + * 6 released left - left released after emulated middle + * 7 released right - right released after emulated middle + * 8 repressed left - left pressed after released left + * 9 repressed right - right pressed after released right + * 10 pressed both - both pressed, not emulating middle * - * state[?][0]: action1 - * state[?][1]: action2 - * state[?][2]: next state + * At each state, we need handlers for the following events + * 0: no buttons down + * 1: left button down + * 2: right button down + * 3: both buttons down + * 4: emulate3Timeout passed without a button change + * Note that button events are not deltas, they are the set of buttons being + * pressed now. It's possible (ie, mouse hardware does it) to go from (eg) + * left down to right down without anything in between, so all cases must be + * handled. * - * action > 0: ButtonPress - * action = 0: nothing - * action < 0: ButtonRelease + * a handler consists of three values: + * 0: action1 + * 1: action2 + * 2: new emulation state * - * Why this stuff ??? Normally you cannot press both mousebuttons together, so - * the mouse reports both pressed at the same time ... + * action > 0: ButtonPress + * action = 0: nothing + * action < 0: ButtonRelease + * + * The comment preceeding each section is the current emulation state. + * The comments to the right are of the form + * <button state> (<events>) -> <new emulation state> + * which should be read as + * If the buttons are in <button state>, generate <events> then go to + * <new emulation state>. */ - -static signed char stateTab[48][3] = { - -/* nothing pressed */ - { 0, 0, 0 }, - { 0, 0, 8 }, /* 1 right -> delayed right */ - { 0, 0, 0 }, /* 2 nothing */ - { 0, 0, 8 }, /* 3 right -> delayed right */ - { 0, 0, 16 }, /* 4 left -> delayed left */ - { 2, 0, 24 }, /* 5 left & right (middle press) -> middle pressed */ - { 0, 0, 16 }, /* 6 left -> delayed left */ - { 2, 0, 24 }, /* 7 left & right (middle press) -> middle pressed */ - -/* delayed right */ - { 1, -1, 0 }, /* 8 nothing (right event) -> init */ - { 1, 0, 32 }, /* 9 right (right press) -> right pressed */ - { 1, -1, 0 }, /* 10 nothing (right event) -> init */ - { 1, 0, 32 }, /* 11 right (right press) -> right pressed */ - { 1, -1, 16 }, /* 12 left (right event) -> delayed left */ - { 2, 0, 24 }, /* 13 left & right (middle press) -> middle pressed */ - { 1, -1, 16 }, /* 14 left (right event) -> delayed left */ - { 2, 0, 24 }, /* 15 left & right (middle press) -> middle pressed */ - -/* delayed left */ - { 3, -3, 0 }, /* 16 nothing (left event) -> init */ - { 3, -3, 8 }, /* 17 right (left event) -> delayed right */ - { 3, -3, 0 }, /* 18 nothing (left event) -> init */ - { 3, -3, 8 }, /* 19 right (left event) -> delayed right */ - { 3, 0, 40 }, /* 20 left (left press) -> pressed left */ - { 2, 0, 24 }, /* 21 left & right (middle press) -> pressed middle */ - { 3, 0, 40 }, /* 22 left (left press) -> pressed left */ - { 2, 0, 24 }, /* 23 left & right (middle press) -> pressed middle */ - -/* pressed middle */ - { -2, 0, 0 }, /* 24 nothing (middle release) -> init */ - { -2, 0, 0 }, /* 25 right (middle release) -> init */ - { -2, 0, 0 }, /* 26 nothing (middle release) -> init */ - { -2, 0, 0 }, /* 27 right (middle release) -> init */ - { -2, 0, 0 }, /* 28 left (middle release) -> init */ - { 0, 0, 24 }, /* 29 left & right -> pressed middle */ - { -2, 0, 0 }, /* 30 left (middle release) -> init */ - { 0, 0, 24 }, /* 31 left & right -> pressed middle */ - -/* pressed right */ - { -1, 0, 0 }, /* 32 nothing (right release) -> init */ - { 0, 0, 32 }, /* 33 right -> pressed right */ - { -1, 0, 0 }, /* 34 nothing (right release) -> init */ - { 0, 0, 32 }, /* 35 right -> pressed right */ - { -1, 0, 16 }, /* 36 left (right release) -> delayed left */ - { -1, 2, 24 }, /* 37 left & right (r rel, m prs) -> middle pressed */ - { -1, 0, 16 }, /* 38 left (right release) -> delayed left */ - { -1, 2, 24 }, /* 39 left & right (r rel, m prs) -> middle pressed */ - -/* pressed left */ - { -3, 0, 0 }, /* 40 nothing (left release) -> init */ - { -3, 0, 8 }, /* 41 right (left release) -> delayed right */ - { -3, 0, 0 }, /* 42 nothing (left release) -> init */ - { -3, 0, 8 }, /* 43 right (left release) -> delayed right */ - { 0, 0, 40 }, /* 44 left -> left pressed */ - { -3, 2, 24 }, /* 45 left & right (l rel, mprs) -> middle pressed */ - { 0, 0, 40 }, /* 46 left -> left pressed */ - { -3, 2, 24 }, /* 47 left & right (l rel, mprs) -> middle pressed */ +static signed char stateTab[11][5][3] = { +/* 0 ground */ + { + { 0, 0, 0 }, /* nothing -> ground (no change) */ + { 0, 0, 1 }, /* left -> delayed left */ + { 0, 0, 2 }, /* right -> delayed right */ + { 2, 0, 3 }, /* left & right (middle press) -> pressed middle */ + { 0, 0, -1 } /* timeout N/A */ + }, +/* 1 delayed left */ + { + { 1, -1, 0 }, /* nothing (left event) -> ground */ + { 0, 0, 1 }, /* left -> delayed left (no change) */ + { 1, -1, 2 }, /* right (left event) -> delayed right */ + { 2, 0, 3 }, /* left & right (middle press) -> pressed middle */ + { 1, 0, 4 }, /* timeout (left press) -> pressed left */ + }, +/* 2 delayed right */ + { + { 3, -3, 0 }, /* nothing (right event) -> ground */ + { 3, -3, 1 }, /* left (right event) -> delayed left (no change) */ + { 0, 0, 2 }, /* right -> delayed right (no change) */ + { 2, 0, 3 }, /* left & right (middle press) -> pressed middle */ + { 3, 0, 5 }, /* timeout (right press) -> pressed right */ + }, +/* 3 pressed middle */ + { + { -2, 0, 0 }, /* nothing (middle release) -> ground */ + { 0, 0, 7 }, /* left -> released right */ + { 0, 0, 6 }, /* right -> released left */ + { 0, 0, 3 }, /* left & right -> pressed middle (no change) */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 4 pressed left */ + { + { -1, 0, 0 }, /* nothing (left release) -> ground */ + { 0, 0, 4 }, /* left -> pressed left (no change) */ + { -1, 0, 2 }, /* right (left release) -> delayed right */ + { 3, 0, 10 }, /* left & right (right press) -> pressed both */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 5 pressed right */ + { + { -3, 0, 0 }, /* nothing (right release) -> ground */ + { -3, 0, 1 }, /* left (right release) -> delayed left */ + { 0, 0, 5 }, /* right -> pressed right (no change) */ + { 1, 0, 10 }, /* left & right (left press) -> pressed both */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 6 released left */ + { + { -2, 0, 0 }, /* nothing (middle release) -> ground */ + { -2, 0, 1 }, /* left (middle release) -> delayed left */ + { 0, 0, 6 }, /* right -> released left (no change) */ + { 1, 0, 8 }, /* left & right (left press) -> repressed left */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 7 released right */ + { + { -2, 0, 0 }, /* nothing (middle release) -> ground */ + { 0, 0, 7 }, /* left -> released right (no change) */ + { -2, 0, 2 }, /* right (middle release) -> delayed right */ + { 3, 0, 9 }, /* left & right (right press) -> repressed right */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 8 repressed left */ + { + { -2, -1, 0 }, /* nothing (middle release, left release) -> ground */ + { -2, 0, 4 }, /* left (middle release) -> pressed left */ + { -1, 0, 6 }, /* right (left release) -> released left */ + { 0, 0, 8 }, /* left & right -> repressed left (no change) */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 9 repressed right */ + { + { -2, -3, 0 }, /* nothing (middle release, right release) -> ground */ + { -3, 0, 7 }, /* left (right release) -> released right */ + { -2, 0, 5 }, /* right (middle release) -> pressed right */ + { 0, 0, 9 }, /* left & right -> repressed right (no change) */ + { 0, 0, -1 }, /* timeout N/A */ + }, +/* 10 pressed both */ + { + { -1, -3, 0 }, /* nothing (left release, right release) -> ground */ + { -3, 0, 4 }, /* left (right release) -> pressed left */ + { -1, 0, 5 }, /* right (left release) -> pressed right */ + { 0, 0, 10 }, /* left & right -> pressed both (no change) */ + { 0, 0, -1 }, /* timeout N/A */ + }, }; - /* * Table to allow quick reversal of natural button mapping to correct mapping */ @@ -1715,12 +1821,36 @@ #define reverseBits(map, b) (((b) & ~0x0f) | map[(b) & 0x0f]) +static CARD32 +buttonTimer(OsTimerPtr timer, CARD32 now, pointer arg) +{ + InputInfoPtr pInfo; + MouseDevPtr pMse; + int sigstate; + int id; + + pInfo = arg; + pMse = pInfo->private; + + sigstate = xf86BlockSIGIO (); + + if ((id = stateTab[pMse->emulateState][4][0]) != 0) { + xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); + pMse->emulateState = stateTab[pMse->emulateState][4][2]; + } else { + ErrorF("Got unexpected buttonTimer in state %d\n", pMse->emulateState); + } + + xf86UnblockSIGIO (sigstate); + return 0; +} + static void MouseDoPostEvent(InputInfoPtr pInfo, int buttons, int dx, int dy) { static OsTimerPtr timer = NULL; MouseDevPtr pMse; - int truebuttons; + int truebuttons, emulateButtons; int id, change; pMse = pInfo->private; @@ -1734,69 +1864,51 @@ if (dx || dy) xf86PostMotionEvent(pInfo->dev, 0, 0, 2, dx, dy); - if (pMse->emulate3Buttons) { - /* - * Hack to operate the middle button even with Emulate3Buttons set. - * Modifying the state table to keep track of the middle button state - * would nearly double its size, so I'll stick with this fix. - TJW - */ + if (truebuttons != pMse->lastButtons) { + if (pMse->protocolID == PROT_MMHIT) change = buttons ^ reverseBits(hitachMap, pMse->lastButtons); else change = buttons ^ reverseBits(reverseMap, pMse->lastButtons); - /* - * process button 2, 4 and above - */ - change &= ~0x05; - while (change) { - id = ffs(change); - change &= ~(1 << (id - 1)); - xf86PostButtonEvent(pInfo->dev, 0, id, - (buttons & (1 << (id - 1))), 0, 0); - } + if (pMse->emulate3Buttons) { - /* - * emulate the third button by the other two - */ - buttons &= 0x07; - if ((id = stateTab[buttons + pMse->emulateState][0]) != 0) - xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); - - if ((id = stateTab[buttons + pMse->emulateState][1]) != 0) - xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); - - pMse->emulateState = stateTab[buttons + pMse->emulateState][2]; - if (stateTab[buttons + pMse->emulateState][0] || - stateTab[buttons + pMse->emulateState][1]) { - pMse->truebuttons = truebuttons; - timer = TimerSet(timer, 0, pMse->emulate3Timeout, buttonTimer, + /* handle all but buttons 1 & 3 normally */ + + change &= ~05; + + /* emulate the third button by the other two */ + + emulateButtons = (buttons & 01) | ((buttons &04) >> 1); + + if ((id = stateTab[pMse->emulateState][emulateButtons][0]) != 0) + xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); + if ((id = stateTab[pMse->emulateState][emulateButtons][1]) != 0) + xf86PostButtonEvent(pInfo->dev, 0, abs(id), (id >= 0), 0, 0); + + pMse->emulateState = + stateTab[pMse->emulateState][emulateButtons][2]; + + if (stateTab[pMse->emulateState][4][0] != 0) { + timer = TimerSet(timer, 0, pMse->emulate3Timeout, buttonTimer, pInfo); - } else { - if (timer) { - TimerFree(timer); - timer = NULL; - } - } - } else { - /* - * real three button event - * Note that pMse.lastButtons has the hardware button mapping which - * is the reverse of the button mapping reported to the server. - */ - if (pMse->protocolID == PROT_MMHIT) - change = buttons ^ reverseBits(hitachMap, pMse->lastButtons); - else - change = buttons ^ reverseBits(reverseMap, pMse->lastButtons); + } else { + if (timer) { + TimerFree(timer); + timer = NULL; + } + } + } + while (change) { id = ffs(change); change &= ~(1 << (id - 1)); xf86PostButtonEvent(pInfo->dev, 0, id, (buttons & (1 << (id - 1))), 0, 0); } - } - pMse->lastButtons = truebuttons; + pMse->lastButtons = truebuttons; + } } static void @@ -1860,6 +1972,14 @@ } #ifdef XFree86LOADER +ModuleInfoRec MouseInfo = { + 1, + "MOUSE", + NULL, + 0, + MouseAvailableOptions, +}; + static void xf86MouseUnplug(pointer p) { @@ -1870,6 +1990,16 @@ int *errmaj, int *errmin) { + static Bool Initialised = FALSE; + + if (!Initialised) { + Initialised = TRUE; +#ifndef REMOVE_LOADER_CHECK_MODULE_INFO + if (xf86LoaderCheckSymbol("xf86AddModuleInfo")) +#endif + xf86AddModuleInfo(&MouseInfo, module); + } + xf86AddInputDriver(&MOUSE, module, 0); return module; Index: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.cpp diff -u xc/programs/Xserver/hw/xfree86/input/mouse/mouse.cpp:1.6 xc/programs/Xserver/hw/xfree86/input/mouse/mouse.cpp:removed --- xc/programs/Xserver/hw/xfree86/input/mouse/mouse.cpp:1.6 Tue Dec 12 13:54:32 2000 +++ xc/programs/Xserver/hw/xfree86/input/mouse/mouse.cpp Mon Jun 4 12:41:19 2001 @@ -1,151 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.cpp,v 1.6 2000/12/12 18:54:32 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH MOUSE __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -mouse \- Mouse input driver -.SH SYNOPSIS -.nf -.B "Section \*qInputDevice\*q" -.BI " Identifier \*q" idevname \*q -.B " Driver \*qmouse\*q" -.BI " Option \*qProtocol\*q \*q" protoname \*q -.BI " Option \*qDevice\*q \*q" devpath \*q -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B mouse -is an XFree86 input driver for mice. The driver supports most available -mouse types and interfaces. USB mice are only supported on some OSs, -and the level of support for PS/2 mice depends on the OS. -.PP -The -.B mouse -driver functions as a pointer input device, and may be used as the -X server's core pointer. Multiple mice are supported by multiple -instances of this driver. -.SH SUPPORTED HARDWARE -There is a detailed list of hardware that the -.B mouse -driver supports in the -.I README.mouse -document. This can be found -in __projectroot__/lib/X11/doc/, or online at -http://www.xfree86.org/current/mouse.html. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details and for options that can be used with all input drivers. This -section only covers configuration details specific to this driver. -.PP -The driver can auto-detect the mouse type on some platforms On some -platforms this is limited to plug and play serial mice, and on some the -auto-detection works for any mouse that the OS's kernel driver supports. -On others, it is always necessary to specify the mouse protocol in the -config file. The -.I README.mouse -document contains some detailed information about this. -.PP -The following driver -.B Options -are supported: -.TP 7 -.BI "Option \*qProtocol\*q \*q" string \*q -Specify the mouse protocol. Valid protocol types include: -.PP -.RS 12 -Auto, Microsoft, MouseSystems, MMSeries, Logitech, MouseMan, MMHitTab, -GlidePoint, IntelliMouse, ThinkingMouse, AceCad, PS/2, ImPS/2, -ExplorerPS/2, ThinkingMousePS/2, MouseManPlusPS/2, GlidePointPS/2, -NetMousePS/2, NetScrollPS/2, BusMouse, SysMouse, WSMouse, USB, Xqueue. -.RE -.PP -.RS 7 -Not all protocols are supported on all platforms. The "Auto" platform -specifies that protocol auto-detection should be attempted. There is no -default protocol setting, and specifying this option is mandatory. -.RE -.TP 7 -.BI "Option \*qDevice\*q \*q" string \*q -Specifies the device through which the mouse can be accessed. A common -setting is "/dev/mouse", which is often a symbolic link to the real -device. This option is mandatory, and there is no default setting. -.TP 7 -.BI "Option \*qButtons\*q \*q" integer \*q -Specifies the number of mouse buttons. In cases where the number of buttons -cannot be auto-detected, the default value is 3. -.TP 7 -.BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q -Enable/disable the emulation of the third (middle) mouse button for mice -which only have two physical buttons. The third button is emulated by -pressing both buttons simultaneously. Default: off -.TP 7 -.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q -Sets the timeout (in milliseconds) that the driver waits before deciding -if two buttons where pressed "simultaneously" when 3 button emulation is -enabled. Default: 50. -.TP 7 -.BI "Option \*qChordMiddle\*q \*q" boolean \*q -Enable/disable handling of mice that send left+right events when the middle -button is used. Default: off. -.TP 7 -.BI "Option \*qZAxisMapping\*q \*qX\*q" -.TP 7 -.BI "Option \*qZAxisMapping\*q \*qY\*q" -.TP 7 -.BI "Option \*qZAxisMapping\*q \*q" "N1 N2" \*q -.TP 7 -.BI "Option \*qZAxisMapping\*q \*q" "N1 N2 N3 N4" \*q -Set the mapping for the Z axis (wheel) motion to buttons or another axis -.RB ( X -or -.BR Y ). -Button number -.I N1 -is mapped to the negative Z axis motion and button number -.I N2 -is mapped to the positive Z axis motion. For mice with two wheels, -four button numbers can be specified, with the negative and positive motion -of the second wheel mapped respectively to buttons number -.I N3 -and -.IR N4 . -.TP 7 -.BI "Option \*qFlipXY\*q \*q" boolean \*q -Enable/disable swapping the X and Y axes. Default: off. -.TP 7 -.BI "Option \*qSampleRate\*q \*q" integer \*q -Sets the number of motion/button events the mouse sends per second. Setting -this is only supported for some mice, including some Logitech mice and -some PS/2 mice on some platforms. Default: whatever the mouse is -already set to. -.TP 7 -.BI "Option \*qResolution\*q \*q" integer \*q -Sets the resolution of the device in counts per inch. Setting this is -only supported for some mice, including some PS/2 mice on some platforms. -Default: whatever the mouse is already set to. -.TP 7 -.BI "Option \*qClearDTR\*q \*q" boolean \*q -Enable/disable clearing the DTR line on the serial port used by the mouse. -Some dual-protocol mice require the DTR line to be cleared to operate -in the non-default protocol. This option is for serial mice only. -Default: off. -.TP 7 -.BI "Option \*qClearRTS\*q \*q" boolean \*q -Enable/disable clearing the RTS line on the serial port used by the mouse. -Some dual-protocol mice require the RTS line to be cleared to operate -in the non-default protocol. This option is for serial mice only. -Default: off. -.TP 7 -.BI "Option \*qBaudRate\*q \*q" integer \*q -Set the baud rate to use for communicating with a serial mouse. This -option should rarely be required because the default is correct for almost -all situations. Valid values include: 300, 1200, 2400, 4800, 9600, 19200. -Default: 1200. -.PP -There are some other options that may be used to control various parameters -for serial port communication, but they are not documented here because -the driver sets them correctly for each mouse protocol type. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__), -README.mouse. Index: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man:1.2 --- /dev/null Mon Jun 4 12:41:19 2001 +++ xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man Sat Jan 27 13:20:58 2001 @@ -0,0 +1,151 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/mouse/mouse.man,v 1.2 2001/01/27 18:20:58 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH MOUSE __drivermansuffix__ __vendorversion__ +.SH NAME +mouse \- Mouse input driver +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" idevname \*q +.B " Driver \*qmouse\*q" +.BI " Option \*qProtocol\*q \*q" protoname \*q +.BI " Option \*qDevice\*q \*q" devpath \*q +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B mouse +is an XFree86 input driver for mice. The driver supports most available +mouse types and interfaces. USB mice are only supported on some OSs, +and the level of support for PS/2 mice depends on the OS. +.PP +The +.B mouse +driver functions as a pointer input device, and may be used as the +X server's core pointer. Multiple mice are supported by multiple +instances of this driver. +.SH SUPPORTED HARDWARE +There is a detailed list of hardware that the +.B mouse +driver supports in the +.I README.mouse +document. This can be found +in __projectroot__/lib/X11/doc/, or online at +http://www.xfree86.org/current/mouse.html. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +The driver can auto-detect the mouse type on some platforms On some +platforms this is limited to plug and play serial mice, and on some the +auto-detection works for any mouse that the OS's kernel driver supports. +On others, it is always necessary to specify the mouse protocol in the +config file. The +.I README.mouse +document contains some detailed information about this. +.PP +The following driver +.B Options +are supported: +.TP 7 +.BI "Option \*qProtocol\*q \*q" string \*q +Specify the mouse protocol. Valid protocol types include: +.PP +.RS 12 +Auto, Microsoft, MouseSystems, MMSeries, Logitech, MouseMan, MMHitTab, +GlidePoint, IntelliMouse, ThinkingMouse, AceCad, PS/2, ImPS/2, +ExplorerPS/2, ThinkingMousePS/2, MouseManPlusPS/2, GlidePointPS/2, +NetMousePS/2, NetScrollPS/2, BusMouse, SysMouse, WSMouse, USB, Xqueue. +.RE +.PP +.RS 7 +Not all protocols are supported on all platforms. The "Auto" platform +specifies that protocol auto-detection should be attempted. There is no +default protocol setting, and specifying this option is mandatory. +.RE +.TP 7 +.BI "Option \*qDevice\*q \*q" string \*q +Specifies the device through which the mouse can be accessed. A common +setting is "/dev/mouse", which is often a symbolic link to the real +device. This option is mandatory, and there is no default setting. +.TP 7 +.BI "Option \*qButtons\*q \*q" integer \*q +Specifies the number of mouse buttons. In cases where the number of buttons +cannot be auto-detected, the default value is 3. +.TP 7 +.BI "Option \*qEmulate3Buttons\*q \*q" boolean \*q +Enable/disable the emulation of the third (middle) mouse button for mice +which only have two physical buttons. The third button is emulated by +pressing both buttons simultaneously. Default: off +.TP 7 +.BI "Option \*qEmulate3Timeout\*q \*q" integer \*q +Sets the timeout (in milliseconds) that the driver waits before deciding +if two buttons where pressed "simultaneously" when 3 button emulation is +enabled. Default: 50. +.TP 7 +.BI "Option \*qChordMiddle\*q \*q" boolean \*q +Enable/disable handling of mice that send left+right events when the middle +button is used. Default: off. +.TP 7 +.BI "Option \*qZAxisMapping\*q \*qX\*q" +.TP 7 +.BI "Option \*qZAxisMapping\*q \*qY\*q" +.TP 7 +.BI "Option \*qZAxisMapping\*q \*q" "N1 N2" \*q +.TP 7 +.BI "Option \*qZAxisMapping\*q \*q" "N1 N2 N3 N4" \*q +Set the mapping for the Z axis (wheel) motion to buttons or another axis +.RB ( X +or +.BR Y ). +Button number +.I N1 +is mapped to the negative Z axis motion and button number +.I N2 +is mapped to the positive Z axis motion. For mice with two wheels, +four button numbers can be specified, with the negative and positive motion +of the second wheel mapped respectively to buttons number +.I N3 +and +.IR N4 . +.TP 7 +.BI "Option \*qFlipXY\*q \*q" boolean \*q +Enable/disable swapping the X and Y axes. Default: off. +.TP 7 +.BI "Option \*qSampleRate\*q \*q" integer \*q +Sets the number of motion/button events the mouse sends per second. Setting +this is only supported for some mice, including some Logitech mice and +some PS/2 mice on some platforms. Default: whatever the mouse is +already set to. +.TP 7 +.BI "Option \*qResolution\*q \*q" integer \*q +Sets the resolution of the device in counts per inch. Setting this is +only supported for some mice, including some PS/2 mice on some platforms. +Default: whatever the mouse is already set to. +.TP 7 +.BI "Option \*qClearDTR\*q \*q" boolean \*q +Enable/disable clearing the DTR line on the serial port used by the mouse. +Some dual-protocol mice require the DTR line to be cleared to operate +in the non-default protocol. This option is for serial mice only. +Default: off. +.TP 7 +.BI "Option \*qClearRTS\*q \*q" boolean \*q +Enable/disable clearing the RTS line on the serial port used by the mouse. +Some dual-protocol mice require the RTS line to be cleared to operate +in the non-default protocol. This option is for serial mice only. +Default: off. +.TP 7 +.BI "Option \*qBaudRate\*q \*q" integer \*q +Set the baud rate to use for communicating with a serial mouse. This +option should rarely be required because the default is correct for almost +all situations. Valid values include: 300, 1200, 2400, 4800, 9600, 19200. +Default: 1200. +.PP +There are some other options that may be used to control various parameters +for serial port communication, but they are not documented here because +the driver sets them correctly for each mouse protocol type. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__), +README.mouse. Index: xc/programs/Xserver/hw/xfree86/input/mutouch/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/mutouch/Imakefile:1.3 xc/programs/Xserver/hw/xfree86/input/mutouch/Imakefile:1.4 --- xc/programs/Xserver/hw/xfree86/input/mutouch/Imakefile:1.3 Tue May 23 00:47:47 2000 +++ xc/programs/Xserver/hw/xfree86/input/mutouch/Imakefile Tue Jan 23 19:06:37 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/mutouch/Imakefile,v 1.3 2000/05/23 04:47:47 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/mutouch/Imakefile,v 1.4 2001/01/24 00:06:37 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -22,7 +22,6 @@ InstallObjectModule($(DRIVER),$(MODULEDIR),input) #if !defined(XF86DriverSDK) -CppManTarget($(DRIVER),) InstallModuleManPage($(DRIVER)) #endif Index: xc/programs/Xserver/hw/xfree86/input/mutouch/mutouch.cpp diff -u xc/programs/Xserver/hw/xfree86/input/mutouch/mutouch.cpp:1.3 xc/programs/Xserver/hw/xfree86/input/mutouch/mutouch.cpp:removed --- xc/programs/Xserver/hw/xfree86/input/mutouch/mutouch.cpp:1.3 Mon Dec 11 15:18:54 2000 +++ xc/programs/Xserver/hw/xfree86/input/mutouch/mutouch.cpp Mon Jun 4 12:41:19 2001 @@ -1,40 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/mutouch/mutouch.cpp,v 1.3 2000/12/11 20:18:54 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH MUTOUCH __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -mutouch \- Microtouch input driver -.SH SYNOPSIS -.B "Section \*qInputDevice\*q" -.br -.BI " Identifier \*q" idevname \*q -.br -.B " Driver \*qmutouch\*q" -.br -.BI " Option \*qDevice\*q \*q" devpath \*q -.br -\ \ ... -.br -.B EndSection -.SH DESCRIPTION -.B mutouch -is an XFree86 input driver for Microtouch devices... -.PP -The -.B mutouch -driver functions as a pointer input device, and may be used as the -X server's core pointer. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -What is supported... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details and for options that can be used with all input drivers. This -section only covers configuration details specific to this driver. -.PP -Config details... -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). -.SH AUTHORS -Authors include... - Patrick Lecoanet Index: xc/programs/Xserver/hw/xfree86/input/mutouch/mutouch.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/mutouch/mutouch.man:1.2 --- /dev/null Mon Jun 4 12:41:19 2001 +++ xc/programs/Xserver/hw/xfree86/input/mutouch/mutouch.man Sat Jan 27 13:20:58 2001 @@ -0,0 +1,40 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/mutouch/mutouch.man,v 1.2 2001/01/27 18:20:58 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH MUTOUCH __drivermansuffix__ __vendorversion__ +.SH NAME +mutouch \- Microtouch input driver +.SH SYNOPSIS +.B "Section \*qInputDevice\*q" +.br +.BI " Identifier \*q" idevname \*q +.br +.B " Driver \*qmutouch\*q" +.br +.BI " Option \*qDevice\*q \*q" devpath \*q +.br +\ \ ... +.br +.B EndSection +.SH DESCRIPTION +.B mutouch +is an XFree86 input driver for Microtouch devices... +.PP +The +.B mutouch +driver functions as a pointer input device, and may be used as the +X server's core pointer. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +What is supported... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +Config details... +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Authors include... + Patrick Lecoanet Index: xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c diff -u xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c:1.12 xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c:1.13 --- xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c:1.12 Wed Jun 7 18:03:10 2000 +++ xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c Sun Apr 1 10:00:13 2001 @@ -21,7 +21,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c,v 1.12 2000/06/07 22:03:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/mutouch/xf86MuTouch.c,v 1.13 2001/04/01 14:00:13 tsi Exp $ */ /* ******************************************************************************* @@ -42,23 +42,23 @@ ******************************************************************************* */ -#include <xf86Version.h> +#include "xf86Version.h" #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) #define XFREE86_V4 #endif #ifdef XFREE86_V4 -#include <misc.h> -#include <xf86.h> +#include "misc.h" +#include "xf86.h" #if !defined(DGUX) -#include <xf86_ansic.h> +#include "xf86_ansic.h" #endif -#include <xf86_OSproc.h> -#include <xf86Xinput.h> -#include <exevents.h> +#include "xf86_OSproc.h" +#include "xf86Xinput.h" +#include "exevents.h" #ifdef XFree86LOADER -#include <xf86Module.h> +#include "xf86Module.h" #endif #else /* XFREE86_V4 */ @@ -82,7 +82,6 @@ #include "xf86_OSlib.h" #include "xf86_Config.h" #include "xf86Xinput.h" -#include "xf86Version.h" #include "os.h" #include "osdep.h" Index: xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile:1.2 --- xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile:1.1 Tue Aug 1 14:59:58 2000 +++ xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile Tue Jan 23 19:06:38 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile,v 1.1 2000/08/01 18:59:58 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/Imakefile,v 1.2 2001/01/24 00:06:38 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -22,7 +22,6 @@ InstallObjectModule($(DRIVER),$(MODULEDIR),input) #if !defined(XF86DriverSDK) -CppManTarget($(DRIVER),) InstallModuleManPage($(DRIVER)) #endif Index: xc/programs/Xserver/hw/xfree86/input/penmount/penmount.cpp diff -u xc/programs/Xserver/hw/xfree86/input/penmount/penmount.cpp:1.2 xc/programs/Xserver/hw/xfree86/input/penmount/penmount.cpp:removed --- xc/programs/Xserver/hw/xfree86/input/penmount/penmount.cpp:1.2 Mon Dec 11 15:18:55 2000 +++ xc/programs/Xserver/hw/xfree86/input/penmount/penmount.cpp Mon Jun 4 12:41:19 2001 @@ -1,37 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/penmount.cpp,v 1.2 2000/12/11 20:18:55 dawes Exp $ -.TH PENNMOUNT __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -penmount \- PenMount input driver -.SH SYNOPSIS -.B "Section ""InputDevice""" -.br -.BI " Identifier """ idevname """" -.br -.B " Driver ""penmount""" -.br -.BI " Option ""Device"" """ devpath """" -.br -\ \ ... -.br -.B EndSection -.SH DESCRIPTION -.B penmount -is an XFree86 input driver for PenMount devices... -.PP -The -.B penmount -driver functions as a pointer input device, and may be used as the -X server's core pointer. -THIS MAN PAGE NEEDS TO BE FILLED IN. -.SH SUPPORTED HARDWARE -What is supported... -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details and for options that can be used with all input drivers. This -section only covers configuration details specific to this driver. -.PP -Config details... -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). -.SH AUTHORS -Authors include... Index: xc/programs/Xserver/hw/xfree86/input/penmount/penmount.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/penmount/penmount.man:1.2 --- /dev/null Mon Jun 4 12:41:19 2001 +++ xc/programs/Xserver/hw/xfree86/input/penmount/penmount.man Sat Jan 27 13:20:58 2001 @@ -0,0 +1,37 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/penmount/penmount.man,v 1.2 2001/01/27 18:20:58 dawes Exp $ +.TH PENNMOUNT __drivermansuffix__ __vendorversion__ +.SH NAME +penmount \- PenMount input driver +.SH SYNOPSIS +.B "Section ""InputDevice""" +.br +.BI " Identifier """ idevname """" +.br +.B " Driver ""penmount""" +.br +.BI " Option ""Device"" """ devpath """" +.br +\ \ ... +.br +.B EndSection +.SH DESCRIPTION +.B penmount +is an XFree86 input driver for PenMount devices... +.PP +The +.B penmount +driver functions as a pointer input device, and may be used as the +X server's core pointer. +THIS MAN PAGE NEEDS TO BE FILLED IN. +.SH SUPPORTED HARDWARE +What is supported... +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +Config details... +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Authors include... Index: xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c diff -u xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c:1.10 xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c:1.11 --- xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c:1.10 Fri Aug 11 15:10:47 2000 +++ xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c Tue May 15 14:22:22 2001 @@ -24,7 +24,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c,v 1.10 2000/08/11 19:10:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/spaceorb/spaceorb.c,v 1.11 2001/05/15 18:22:22 paulo Exp $ */ #define _SPACEORB_C_ /***************************************************************************** @@ -247,16 +247,19 @@ static void TearDownProc( pointer p ) { - InputInfoPtr pInfo = (InputInfoPtr) p; - SPACEORBPrivatePtr priv = (SPACEORBPrivatePtr) pInfo->private; - - DeviceOff (pInfo->dev); + if (!xf86ServerIsOnlyDetecting()) { + + InputInfoPtr pInfo = (InputInfoPtr) p; + SPACEORBPrivatePtr priv = (SPACEORBPrivatePtr) pInfo->private; + + DeviceOff (pInfo->dev); - xf86CloseSerial (pInfo->fd); - XisbFree (priv->buffer); - xfree (priv); - xfree (pInfo->name); - xfree (pInfo); + xf86CloseSerial (pInfo->fd); + XisbFree (priv->buffer); + xfree (priv); + xfree (pInfo->name); + xfree (pInfo); + } } static Bool Index: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c diff -u xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c:1.4 xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c:1.10 --- xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c:1.4 Fri Aug 11 15:10:48 2000 +++ xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c Tue May 15 14:22:22 2001 @@ -1,6 +1,10 @@ /* * Copyright 1996 by Steven Lang <tiger@tyger.org> * + * AceCad tablet support ported by Arpad Gereoffy <arpi@esp-team.scene.hu> + * originally written by Shane Watts <shane@bofh.asn.au> + * and Fredrik Chabot <fhc@f6.nl> + * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that * the above copyright notice appear in all copies and that both that @@ -20,11 +24,11 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.4 2000/08/11 19:10:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/summa/xf86Summa.c,v 1.10 2001/05/15 18:22:22 paulo Exp $ */ static const char identification[] = "$Identification: 18 $"; -#include <xf86Version.h> +#include "xf86Version.h" #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) #define XFREE86_V4 1 @@ -38,25 +42,23 @@ #include <errno.h> #endif -#include <misc.h> -#include <xf86.h> +#include "misc.h" +#include "xf86.h" #define NEED_XF86_TYPES #if !defined(DGUX) -#include <xf86_ansic.h> -#include <xisb.h> +#include "xf86_ansic.h" +#include "xisb.h" #endif -#include <xf86_OSproc.h> -#include <xf86Xinput.h> -#include <exevents.h> /* Needed for InitValuator/Proximity stuff */ -#include <keysym.h> -#include <mipointer.h> +#include "xf86_OSproc.h" +#include "xf86Xinput.h" +#include "exevents.h" /* Needed for InitValuator/Proximity stuff */ +#include "keysym.h" +#include "mipointer.h" #ifdef XFree86LOADER -#include <xf86Module.h> +#include "xf86Module.h" #endif -#undef memset -#define memset xf86memset #undef sleep #define sleep(t) xf86WaitForInput(-1, 1000 * (t)) #define wait_for_fd(fd) xf86WaitForInput((fd), 1000) @@ -123,7 +125,6 @@ #include "xf86Config.h" #include "xf86Xinput.h" #include "atKeynames.h" -#include "xf86Version.h" #endif #if !defined(sun) || defined(i386) @@ -154,10 +155,14 @@ #endif /* -** Device records +** Device records (flag bits) */ -#define ABSOLUTE_FLAG 1 -#define STYLUS_FLAG 2 +#define ABSOLUTE_FLAG 1 /* default */ +#define STYLUS_FLAG 2 /* not default */ +#define COMPATIBLE_FLAG 4 /* not default */ +#define H1217D_FLAG 8 /* not default */ +#define Z_AXIS_FLAG 16 /* not default */ +#define INITIALIZED 32 typedef struct { @@ -166,6 +171,7 @@ int sumButTrans; /* button translation flags */ int sumOldX; /* previous X position */ int sumOldY; /* previous Y position */ + int sumOldZ; /* previous Z position */ int sumOldProximity; /* previous proximity */ int sumOldButtons; /* previous buttons state */ int sumMaxX; /* max X value */ @@ -177,7 +183,7 @@ int sumRes; /* resolution in lines per inch */ int flags; /* various flags */ int sumIndex; /* number of bytes read */ - unsigned char sumData[5]; /* data read on the device */ + unsigned char sumData[7]; /* data read on the device */ } SummaDeviceRec, *SummaDevicePtr; /* @@ -198,6 +204,9 @@ #define ALWAYS_CORE 9 #define ACTIVE_AREA 10 #define ACTIVE_OFFSET 11 +#define COMPATIBLE 12 +#define RESOLUTION 13 +#define HITACHI_1217D 14 #if !defined(sun) || defined(i386) static SymTabRec SumTab[] = { @@ -213,6 +222,9 @@ {ALWAYS_CORE, "alwayscore"}, {ACTIVE_AREA, "activearea"}, {ACTIVE_OFFSET, "activeoffset"}, + {COMPATIBLE, "compatible"}, + {RESOLUTION, "resolution"}, + {HITACHI_1217D, "hitachi_1217d"}, {-1, ""} }; @@ -254,7 +266,6 @@ #define SS_RELATIVE 'E' /* Relative mode */ #define SS_UPPER_ORIGIN "b" /* Origin upper left */ -#define SS_500LPI "h" /* 500 lines per inch */ #define SS_PROMPT_MODE "B" /* Prompt mode */ #define SS_STREAM_MODE "@" /* Stream mode */ @@ -273,6 +284,9 @@ #define BUTTON_BITS 0x07 #define COORD_BITS 0x7f +/* macro from counts/inch to counts/meter */ +#define LPI2CPM(res) (res * 1000 / 25.4) + /* ** External declarations */ @@ -316,7 +330,7 @@ int token; int mtoken; - DBG(1, ErrorF("xf86SumConfig\n")); + DBG(2, ErrorF("xf86SumConfig\n")); while ((token = xf86GetToken(SumTab)) != ENDSUBSECTION) { switch(token) { @@ -414,6 +428,18 @@ dev->history_size); break; + case HITACHI_1217D: + priv->flags |= H1217D_FLAG; + priv->sumInc = 0; + if(xf86Verbose) + ErrorF("%s Hitach_1217D, compatible enforced.\n", XCONFIG_GIVEN); + + case COMPATIBLE: + priv->flags |= COMPATIBLE_FLAG; + if(xf86Verbose) + ErrorF("%s SummaSketch compatible - will not query firmware ID\n", XCONFIG_GIVEN); + break; + case ALWAYS_CORE: xf86AlwaysCore(dev, TRUE); if (xf86Verbose) @@ -424,29 +450,38 @@ case ACTIVE_AREA: if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Option number expected"); - priv->sumXSize = val->num; + priv->sumXSize = val->realnum * 100; if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Option number expected"); - priv->sumYSize = val->num; + priv->sumYSize = val->realnum * 100; if (xf86Verbose) - ErrorF("%s SummaSketch active area set to %d.%1dx%d.%1d" - " inches\n", XCONFIG_GIVEN, priv->sumXSize / 10, - priv->sumXSize % 10, priv->sumYSize / 10, - priv->sumYSize % 10); + ErrorF("%s SummaSketch active area: %d.%02dx%d.%02d" + " inches\n", XCONFIG_GIVEN, priv->sumXSize / 100, + priv->sumXSize % 100, priv->sumYSize / 100, + priv->sumYSize % 100); break; case ACTIVE_OFFSET: if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->sumXOffset = val->realnum * 100; + if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Option number expected"); - priv->sumXOffset = val->num; + priv->sumYOffset = val->realnum * 100; + if (xf86Verbose) + ErrorF("%s SummaSketch active offsets: %d.%02d %d.%02d" + " inches\n", XCONFIG_GIVEN, priv->sumXOffset / 100, + priv->sumXOffset % 100, priv->sumYOffset / 100, + priv->sumYOffset % 100); + break; + + case RESOLUTION: if (xf86GetToken(NULL) != NUMBER) xf86ConfigError("Option number expected"); - priv->sumYOffset = val->num; + priv->sumRes = val->num; if (xf86Verbose) - ErrorF("%s SummaSketch active area offset set to %d.%1dx%d.%1d" - " inches\n", XCONFIG_GIVEN, priv->sumXOffset / 10, - priv->sumXOffset % 10, priv->sumYOffset / 10, - priv->sumYOffset % 10); + ErrorF("%s SummaSketch resolution set to %d\n", XCONFIG_GIVEN, + priv->sumRes); break; case EOF: @@ -459,7 +494,7 @@ } } - DBG(1, ErrorF("xf86SumConfig name=%s\n", priv->sumDevice)); + DBG(2, ErrorF("xf86SumConfig name=%s\n", priv->sumDevice)); return Success; } @@ -468,7 +503,7 @@ /* ** xf86SumConvert -** Convert valuators to X and Y. +** Convert device valuator values to screen X and Y. */ static Bool xf86SumConvert(LocalDevicePtr local, @@ -488,12 +523,10 @@ if (first != 0 || num == 1) return FALSE; - *x = (v0 - priv->sumXOffset) * screenInfo.screens[0]->width / priv->sumXSize; - *y = (v1 - priv->sumYOffset) * screenInfo.screens[0]->height / priv->sumYSize; - if (*x < 0) - *x = 0; - if (*y < 0) - *y = 0; + *x = (v0 * screenInfo.screens[0]->width) / priv->sumXSize; + *y = (v1 * screenInfo.screens[0]->height) / priv->sumYSize; + if (*x < 0) *x = 0; + if (*y < 0) *y = 0; if (*x > screenInfo.screens[0]->width) *x = screenInfo.screens[0]->width; if (*y > screenInfo.screens[0]->height) @@ -513,8 +546,8 @@ { SummaDevicePtr priv = (SummaDevicePtr) local->private; int len, loop; - int is_absolute; - int x, y, buttons, prox; + int is_absolute, num_ax; + int x, y, z, buttons, prox; DeviceIntPtr device; unsigned char buffer[BUFFER_SIZE]; @@ -554,6 +587,23 @@ Byte 5 (Absolute mode only) bit 7 Always 0 bits 6-0 = Y13 - Y7 + --------------------------------- + Flair extends this with + --------------------------------- + Byte 6 + bit 7 Always 0 + bits 6-0 = Z8-2 + + Byte 7 + bit 7-5 Always 0 + bit 4 = Z0 + bit 3-2 = Cr1-0 + Controler 00 = 4 button puck + 01 = 3 button stylus (default) + 10 = 16 button puck (how? only 4bits) + 11 = reserved + bit 1 = Button status + bit 0 = Z1 */ if ((priv->sumIndex == 0) && !(buffer[loop] & PHASING_BIT)) { /* magic bit is not OK */ @@ -563,38 +613,54 @@ priv->sumData[priv->sumIndex++] = buffer[loop]; - if (priv->sumIndex == (priv->flags & ABSOLUTE_FLAG? 5: 3)) { + if (priv->sumIndex == ( (priv->flags & ABSOLUTE_FLAG) ? + ((priv->flags & Z_AXIS_FLAG)?7:5) : 3)) { /* the packet is OK */ /* reset char count for next read */ priv->sumIndex = 0; + prox = (priv->sumData[0] & PROXIMITY_BIT)? 0: 1; + buttons = (priv->sumData[0] & BUTTON_BITS); if (priv->flags & ABSOLUTE_FLAG) { x = (int)priv->sumData[1] + ((int)priv->sumData[2] << 7); y = (int)priv->sumData[3] + ((int)priv->sumData[4] << 7); + if(priv->flags & Z_AXIS_FLAG){ + z = ((int)priv->sumData[5] << 2) | + ((int)priv->sumData[6] & 0x01 << 1) | + ((int)priv->sumData[6] & 0x10); + buttons |= ((int)priv->sumData[6] & 0x02 << 2); + } else z = 0; } else { x = priv->sumData[0] & XSIGN_BIT? priv->sumData[1]: -priv->sumData[1]; y = priv->sumData[0] & YSIGN_BIT? priv->sumData[2]: -priv->sumData[2]; + z = 0; } - prox = (priv->sumData[0] & PROXIMITY_BIT)? 0: 1; - buttons = (priv->sumData[0] & BUTTON_BITS); + /* adj x/y by user given offsets; z untouched */ + x -= priv->sumXOffset; + y -= priv->sumYOffset; + if (x < 0) x = 0; + if (y < 0) y = 0; + if (x > priv->sumXSize) x = priv->sumXSize; + if (y > priv->sumYSize) y = priv->sumYSize; device = local->dev; - DBG(6, ErrorF("prox=%s\tx=%d\ty=%d\tbuttons=%d\n", - prox ? "true" : "false", x, y, buttons)); + DBG(6, ErrorF("prox=%s\tx=%d\ty=%d\tz=%d\tbuttons=%d\n", + prox ? "true" : "false", x, y, z, buttons)); is_absolute = (priv->flags & ABSOLUTE_FLAG); + num_ax = (priv->flags & Z_AXIS_FLAG)? 3 : 2; -/* coordonates are ready we can send events */ +/* coordinates are ready we can send events */ if (prox) { if (!(priv->sumOldProximity)) - xf86PostProximityEvent(device, 1, 0, 2, x, y); + xf86PostProximityEvent(device, 1, 0, num_ax, x, y, z); - if ((is_absolute && ((priv->sumOldX != x) || (priv->sumOldY != y))) + if ((is_absolute && ((priv->sumOldX != x) || (priv->sumOldY != y) || (priv->sumOldZ != z))) || (!is_absolute && (x || y))) { if (is_absolute || priv->sumOldProximity) { - xf86PostMotionEvent(device, is_absolute, 0, 2, x, y); + xf86PostMotionEvent(device, is_absolute, 0, num_ax, x, y, z); } } if (priv->sumOldButtons != buttons) { @@ -610,17 +676,18 @@ delta)); xf86PostButtonEvent(device, is_absolute, button, - (delta > 0), 0, 2, x, y); + (delta > 0), 0, num_ax, x, y, z); } } priv->sumOldButtons = buttons; priv->sumOldX = x; priv->sumOldY = y; + priv->sumOldZ = z; priv->sumOldProximity = prox; } else { /* !PROXIMITY */ /* Any changes in buttons are ignored when !proximity */ if (priv->sumOldProximity) - xf86PostProximityEvent(device, 0, 0, 2, x, y); + xf86PostProximityEvent(device, 0, 0, num_ax, x, y, z); priv->sumOldProximity = 0; } } @@ -669,7 +736,7 @@ SYSCALL(err = select(FD_SETSIZE, &readfds, NULL, NULL, &timeout)); #else - err = xf86WaitForInput(fd, 1000); + err = xf86WaitForInput(fd, 200000); #endif if (err == -1) { Error("SummaSketch select"); @@ -699,6 +766,47 @@ return buffer; } +/* xf86SumSetResCode + * Set Summa MM mode resolution code letter. +*/ +static void +xf86SumSetResCode (int *res, char *buffer, int index) +{ + switch (*res) { + case 1: buffer[index] = 'l'; break; + case 2: buffer[index] = 'n'; break; + case 4: buffer[index] = 'p'; break; + case 100: buffer[index] = 'd'; break; + case 200: buffer[index] = 'e'; break; + case 10: /* 10 lpmm */ + *res = 254; + case 254: + buffer[index] = 'f'; break; + case 400: + buffer[index] = 'g'; break; + case 20: /* 20 lpmm */ + *res = 508; + case 508: + buffer[index] = 'i'; break; + case 1000: + buffer[index] = 'j'; break; + case 40: /* 40 lpmm */ + *res = 1016; + case 1016: + buffer[index] = 'q'; break; + case 2000: + buffer[index] = 's'; break; + case 2032: + buffer[index] = 'u'; break; + case 2540: /* note: for 12x12 tablet only */ + buffer[index] = 'v'; break; + + default: /* default to 500 lpi */ + *res = 500; + buffer[index] = 'h'; break; + } + buffer[index+1] = 0; +} /* ** xf86SumOpen @@ -711,11 +819,13 @@ struct termios termios_tty; struct timeval timeout; #endif - char buffer[256]; + char buffer[256], dbuffer[4]; int err, idx; + int res100; + double sratio, tratio; SummaDevicePtr priv = (SummaDevicePtr)local->private; - DBG(1, ErrorF("opening %s\n", priv->sumDevice)); + DBG(2, ErrorF("opening %s\n", priv->sumDevice)); #ifdef XFREE86_V4 local->fd = xf86OpenSerial(local->options); #else @@ -738,7 +848,7 @@ termios_tty.c_cflag = B9600|CS8|CREAD|CLOCAL|HUPCL|PARENB|PARODD; termios_tty.c_lflag = 0; -/* I wonder what these all do, anyway */ + /* prevent tty term discipline processing */ termios_tty.c_cc[VINTR] = 0; termios_tty.c_cc[VQUIT] = 0; termios_tty.c_cc[VERASE] = 0; @@ -773,21 +883,20 @@ #else #error Code for someone else to write to handle OSs without POSIX tty functions #endif -#else -/* if (xf86SetSerialSpeed(local->fd, 9600) < 0) { - return !Success; - } -*/ -#endif + +#endif /* xf_v4 */ - DBG(1, ErrorF("initializing SummaSketch tablet\n")); + DBG(2, ErrorF("initializing SummaSketch tablet\n")); -/* Send reset (NULL) to the tablet */ - SYSCALL(err = write(local->fd, "", 1)); + /* send ASCII spaces in case tablet can auto-baud */ + for (idx = 0; idx < 10; idx++) buffer[idx] = ' '; + SYSCALL(err = write(local->fd, buffer, 10)); if (err == -1) { Error("SummaSketch write"); return !Success; } + buffer[0] = 0; + SYSCALL(err = write(local->fd, buffer, 1)); /* wait 200 mSecs, just in case */ #ifndef XFREE86_V4 @@ -814,63 +923,88 @@ #else xf86FlushInput(local->fd); #endif - DBG(2, ErrorF("reading firmware ID\n")); - if (!xf86SumWriteAndRead(local->fd, SS_FIRMID, buffer, 255, 1)) - return !Success; - DBG(2, ErrorF("%s\n", buffer)); + if ((priv->flags & COMPATIBLE_FLAG) == 0) { + DBG(2, ErrorF("reading firmware ID\n")); + if (!xf86SumWriteAndRead(local->fd, SS_FIRMID, buffer, 255, 1)) + return !Success; + DBG(2, ErrorF("%s\n", buffer)); + if (xf86Verbose) + ErrorF("%s %s firmware ID : %s\n", XCONFIG_PROBED, local->name, buffer); + } - if (xf86Verbose) - ErrorF("%s SummaSketch firmware ID : %s\n", XCONFIG_PROBED, buffer); + DBG(2, ErrorF("setting up resolution\n")); + xf86SumSetResCode (&priv->sumRes, dbuffer, 0); + dbuffer[1] = 'a'; /* config cmd */ + dbuffer[2] = 0; DBG(2, ErrorF("reading max coordinates\n")); - if (!xf86SumWriteAndRead(local->fd, SS_500LPI SS_CONFIG, buffer, 5, 0)) + if (!xf86SumWriteAndRead(local->fd, dbuffer, buffer, + (priv->flags&Z_AXIS_FLAG)?7:5, 0)) return !Success; - priv->sumMaxX = (int)buffer[1] + ((int)buffer[2] << 7); - priv->sumMaxY = (int)buffer[3] + ((int)buffer[4] << 7); + priv->sumMaxX = (buffer[1] & 0x7f) | (buffer[2] << 7); + priv->sumMaxY = (buffer[3] & 0x7f) | (buffer[4] << 7); + + if (priv->flags & H1217D_FLAG) { + /* the numbers below are from Hitachi 1217D spec sheet */ + priv->sumMaxX = (432.4 / 25.4) * priv->sumRes; + priv->sumMaxY = (297.6 / 25.4) * priv->sumRes; + } + if (xf86Verbose) - ErrorF("%s SummaSketch tablet size is %d.%1dinx%d.%1din, %dx%d " - "lines of resolution\n", XCONFIG_PROBED, - priv->sumMaxX / 500, (priv->sumMaxX / 50) % 10, - priv->sumMaxY / 500, (priv->sumMaxY / 50) % 10, + ErrorF("%s %s: tablet size is %d.%02din. x %d.%02din., %dx%d " + "lines of resolution\n", XCONFIG_PROBED, local->name, + priv->sumMaxX / priv->sumRes, + (priv->sumMaxX * 100 / priv->sumRes) % 100, + priv->sumMaxY / priv->sumRes, + (priv->sumMaxY * 100 / priv->sumRes) % 100, priv->sumMaxX, priv->sumMaxY); + res100 = priv->sumRes / 100; + if (priv->sumXOffset >= 0 && priv->sumYOffset >= 0) { + priv->sumXOffset *= res100; + priv->sumYOffset *= res100; + priv->sumMaxX -= priv->sumXOffset; + priv->sumMaxY -= priv->sumYOffset; + } + if (priv->sumXSize > 0 && priv->sumYSize > 0) { - if (priv->sumXSize * 50 < priv->sumMaxX && - priv->sumYSize * 50 < priv->sumMaxY) { - priv->sumXSize *= 50; - priv->sumYSize *= 50; + if ((priv->sumXSize * res100) <= priv->sumMaxX && + (priv->sumYSize * res100) <= priv->sumMaxY) { + priv->sumXSize *= res100; + priv->sumYSize *= res100; } else { - ErrorF("%s SummaSketch active area bigger than tablet, " - "assuming maximum\n", XCONFIG_PROBED); + ErrorF("%s %s: active area bigger than tablet, " + "assuming maximum\n", XCONFIG_PROBED, local->name); priv->sumXSize = priv->sumMaxX; - priv->sumYSize = priv->sumMaxX; + priv->sumYSize = priv->sumMaxY; } } else { priv->sumXSize = priv->sumMaxX; priv->sumYSize = priv->sumMaxY; } - if (priv->sumXOffset > 0 && priv->sumYOffset > 0) { - if (priv->sumXSize * 50 < priv->sumMaxX - priv->sumXOffset && - priv->sumYSize * 50 < priv->sumMaxY - priv->sumYOffset) { - priv->sumXOffset *= 50; - priv->sumYOffset *= 50; - } else { - ErrorF("%s SummaSketch offset sets active area off tablet, " - "centering\n", XCONFIG_PROBED); - priv->sumXOffset = (priv->sumMaxX - priv->sumXSize) / 2; - priv->sumYOffset = (priv->sumMaxY - priv->sumYSize) / 2; - } - } else { - priv->sumXOffset = (priv->sumMaxX - priv->sumXSize) / 2; - priv->sumYOffset = (priv->sumMaxY - priv->sumYSize) / 2; - } + /* map tablet area by screen aspect ratio */ + sratio = (double)screenInfo.screens[0]->height / + (double)screenInfo.screens[0]->width; + tratio = (double)priv->sumMaxY / (double)priv->sumMaxX; + + if (tratio <= 1.0) { /* tablet horizontal > vertical */ + priv->sumXSize = (double)priv->sumYSize / sratio; + if (priv->sumXSize > priv->sumMaxX) priv->sumXSize = priv->sumMaxX; + } + else { + priv->sumYSize = (double)priv->sumXSize / sratio; + if (priv->sumYSize > priv->sumMaxY) priv->sumYSize = priv->sumMaxY; + } + ErrorF("%s %s: using tablet area %d by %d, at res %d lpi\n", + XCONFIG_PROBED, local->name, priv->sumXSize, priv->sumYSize, + priv->sumRes); if (priv->sumInc > 95) priv->sumInc = 95; - if (priv->sumInc < 1) { + if (priv->sumInc < 0) { /* increment not given by user */ /* Make a guess as to the best increment value given video mode */ if (priv->sumXSize / screenInfo.screens[0]->width < priv->sumYSize / screenInfo.screens[0]->height) @@ -880,8 +1014,8 @@ if (priv->sumInc < 1) priv->sumInc = 1; if (xf86Verbose) - ErrorF("%s Using increment value of %d\n", XCONFIG_PROBED, - priv->sumInc); + ErrorF("%s %s: Using increment value of %d\n", XCONFIG_PROBED, + local->name, priv->sumInc); } /* Sets up the tablet mode to increment, stream, and such */ @@ -928,21 +1062,67 @@ /* Set the real values */ InitValuatorAxisStruct(pSum, 0, - 0, /* min val */ - priv->sumMaxX, /* max val */ - 500000, /* resolution */ - 0, /* min_res */ - 500000); /* max_res */ + 0, /* min val */ + priv->sumXSize, /* max val in use */ + LPI2CPM(priv->sumRes), /* resolution */ + 0, /* min_res */ + LPI2CPM(priv->sumRes)); /* max_res */ InitValuatorAxisStruct(pSum, 1, - 0, /* min val */ - priv->sumMaxY, /* max val */ - 500000, /* resolution */ - 0, /* min_res */ - 500000); /* max_res */ + 0, /* min val */ + priv->sumYSize, /* max val in use */ + LPI2CPM(priv->sumRes), /* resolution */ + 0, /* min_res */ + LPI2CPM(priv->sumRes)); /* max_res */ + if(priv->flags&Z_AXIS_FLAG) + InitValuatorAxisStruct(pSum, + 2, + 0, /* min val */ + 512, /* max val */ + LPI2CPM(priv->sumRes), /* resolution */ + 0, /* min_res */ + LPI2CPM(priv->sumRes)); /* max_res */ + return (local->fd != -1); } +/* initialize start-up values */ +static void +xf86SumInitPrivate (SummaDevicePtr priv) +{ +#if defined (sun) && !defined(i386) + char *dev_name; +#endif + + if (priv == NULL) return; + +#if defined(sun) && !defined(i386) + 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); + } else { + priv->sumDevice = ""; + } +#else + priv->sumDevice = ""; /* device file name */ +#endif + priv->sumRes = 500; /* default 500 lpi */ + priv->sumInc = -1; /* event trigger delta moves thrshold */ + priv->sumOldX = -1; /* previous X position */ + priv->sumOldY = -1; /* previous Y position */ + priv->sumOldProximity = 0; /* previous proximity */ + priv->sumOldButtons = 0; /* previous buttons state */ + priv->sumMaxX = -1; /* max X value */ + priv->sumMaxY = -1; /* max Y value */ + priv->sumXSize = 0; /* active area X size */ + priv->sumXOffset = 0; /* active area X offset */ + priv->sumYSize = 0; /* active area Y size */ + priv->sumYOffset = 0; /* active area Y offset */ + priv->sumIndex = 0; /* number of bytes read */ + priv->flags = ABSOLUTE_FLAG; /* various flags -- default absolute */ +} + /* ** xf86SumProc ** Handle requests to do stuff to the driver. @@ -961,10 +1141,12 @@ switch (what) { case DEVICE_INIT: - DBG(1, ErrorF("xf86SumProc pSum=0x%x what=INIT\n", pSum)); + DBG(2, ErrorF("xf86SumProc pSum=0x%x fd = %d, what=INIT\n", pSum, + local->fd)); + if (priv->flags & INITIALIZED) break; /* already done */ - nbaxes = 2; /* X, Y */ - nbbuttons = (priv->flags & STYLUS_FLAG)? 2: 4; + nbaxes = (priv->flags & Z_AXIS_FLAG)?3:2; /* X, Y [,Z] */ + nbbuttons = (priv->flags & STYLUS_FLAG)? ((priv->flags & Z_AXIS_FLAG)?3:2): 4; for(loop=1; loop<=nbbuttons; loop++) map[loop] = loop; @@ -1000,24 +1182,39 @@ ErrorF("unable to allocate Valuator class device\n"); return !Success; } -/* allocate the motion history buffer if needed */ + /* allocate the motion history buffer if needed */ xf86MotionHistoryAllocate(local); #ifndef XFREE86_V4 AssignTypeAndName(pSum, local->atom, local->name); #endif -/* open the device to gather informations */ + /* open the device to gather informations */ xf86SumOpenDevice(pSum); + priv->flags |= INITIALIZED; break; case DEVICE_ON: - DBG(1, ErrorF("xf86SumProc pSum=0x%x what=ON\n", pSum)); + DBG(2, ErrorF("xf86SumProc pSum=0x%x fd = %d, what=ON\n", pSum, + local->fd)); + if (pSum->public.on) break; /* already on */ if ((local->fd < 0) && (!xf86SumOpenDevice(pSum))) { return !Success; } + + /* send prompt character to start the reports */ SYSCALL(write(local->fd, SS_PROMPT, strlen(SS_PROMPT))); -#ifdef XFREE86_V4 + +/* note: using xf86Add/Remove EnabledDevice() somehow causes the tablet + * to stop responding after a VT switch, and cannot be restored w/o + * cycling tablet power. until we figure out what's going on, do not + * enagae signal handlers yet. -huver@amgraf.com mar/12/2001. +*/ +#if 0 + #ifdef XFREE86_V4 xf86AddEnabledDevice(local); + #else + AddEnabledDevice(local->fd); + #endif #else AddEnabledDevice(local->fd); #endif @@ -1025,11 +1222,16 @@ break; case DEVICE_OFF: - DBG(1, ErrorF("xf86SumProc pSum=0x%x what=%s\n", pSum, - (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); + DBG(2, ErrorF("xf86SumProc pSum=0x%x fd = %d, what=OFF\n", pSum, + local->fd)); + if (! pSum->public.on) break; /* already off */ if (local->fd >= 0) -#ifdef XFREE86_V4 +#if 0 + #ifdef XFREE86_V4 xf86RemoveEnabledDevice(local); + #else + RemoveEnabledDevice(local->fd); + #endif #else RemoveEnabledDevice(local->fd); #endif @@ -1037,10 +1239,12 @@ break; case DEVICE_CLOSE: - DBG(1, ErrorF("xf86SumProc pSum=0x%x what=%s\n", pSum, - (what == DEVICE_CLOSE) ? "CLOSE" : "OFF")); - SYSCALL(close(local->fd)); - local->fd = -1; + DBG(2, ErrorF("xf86SumProc pSum=0x%x fd = %d, what=CLOSE\n", pSum, + local->fd)); + if (local->fd != -1) { + SYSCALL(close(local->fd)); + local->fd = -1; + } break; default: @@ -1060,10 +1264,16 @@ static void xf86SumClose(LocalDevicePtr local) { + DBG(2, ErrorF("xf86SumClose local = %lx, ->fd = %d\n", local, local->fd)); if (local->fd >= 0) { +#ifdef XFREE86_V4 + xf86CloseSerial(local->fd); +#else SYSCALL(close(local->fd)); +#endif } local->fd = -1; + xf86SumInitPrivate (local->private); } /* @@ -1110,7 +1320,7 @@ break; default: - DBG(1, ErrorF("xf86SumSwitchMode dev=0x%x invalid mode=%d\n", + DBG(2, ErrorF("xf86SumSwitchMode dev=0x%x invalid mode=%d\n", dev, mode)); return BadMatch; } @@ -1123,13 +1333,10 @@ ** Allocates the device structures for the SummaSketch. */ static LocalDevicePtr -xf86SumAllocate() +xf86SumAllocate(void) { LocalDevicePtr local; SummaDevicePtr priv; -#if defined (sun) && !defined(i386) - char *dev_name = getenv("SUMMASKETCH_DEV"); -#endif priv = xalloc(sizeof(SummaDeviceRec)); if (!priv) @@ -1167,32 +1374,7 @@ local->history_size = 0; local->old_x = -1; local->old_y = -1; - -#if defined(sun) && !defined(i386) - if (def_name) { - priv->sumDevice = xalloc(strlen(dev_name) + 1); - strcpy(priv->sumDevice, device_name); - ErrorF("xf86SumOpen port changed to '%s'\n", priv->sumDevice); - } else { - priv->sumDevice = ""; - } -#else - priv->sumDevice = ""; /* device file name */ -#endif - priv->sumInc = -1; /* re-transmit position on increment */ - priv->sumOldX = -1; /* previous X position */ - priv->sumOldY = -1; /* previous Y position */ - priv->sumOldProximity = 0; /* previous proximity */ - priv->sumOldButtons = 0; /* previous buttons state */ - priv->sumMaxX = -1; /* max X value */ - priv->sumMaxY = -1; /* max Y value */ - priv->sumXSize = -1; /* active area X */ - priv->sumXOffset = -1; /* active area X offset */ - priv->sumYSize = -1; /* active area Y */ - priv->sumYOffset = -1; /* active area U offset */ - priv->flags = 0; /* various flags */ - priv->sumIndex = 0; /* number of bytes read */ - + xf86SumInitPrivate (priv); return local; } @@ -1229,9 +1411,9 @@ return 1; } } -#endif +#endif /* dynamic_module */ -#else +#else /* below for xfree86_v4 */ /* * xf86SumUninit -- @@ -1245,7 +1427,7 @@ { SummaDevicePtr priv = (SummaDevicePtr) local->private; - DBG(1, ErrorF("xf86SumUninit\n")); + DBG(2, ErrorF("xf86SumUninit\n")); xf86SumProc(local->dev, DEVICE_OFF); @@ -1269,7 +1451,7 @@ sumDrv = drv; - DBG(1, ErrorF("xf86SumInit allocating...\n")); + DBG(2, ErrorF("xf86SumInit allocating...\n")); local = xf86SumAllocate(); if (!local) @@ -1277,17 +1459,16 @@ local->conf_idev = dev; - DBG(1, ErrorF("xf86SumInit CollectInputOptions...\n")); + DBG(2, ErrorF("xf86SumInit CollectInputOptions... ")); xf86CollectInputOptions(local, default_options, NULL); - DBG(1, ErrorF("done.\n")); + DBG(2, ErrorF("done.\n")); xf86OptionListReport( local->options ); - priv = (SummaDevicePtr) local->private; local->name = dev->identifier; - /* Serial Device is mandatory */ + /* Serial Device name is mandatory */ priv->sumDevice = xf86FindOptionValue(local->options, "Device"); if (!priv->sumDevice) { @@ -1300,7 +1481,7 @@ /* Optional configuration */ - xf86Msg(X_CONFIG, "%s serial device is %s\n", dev->identifier, + xf86Msg(X_CONFIG, "%s: serial device is %s\n", dev->identifier, priv->sumDevice); debug_level = xf86SetIntOption(local->options, "DebugLevel", 0); @@ -1308,7 +1489,11 @@ xf86Msg(X_CONFIG, "Summa: debug level set to %d\n", debug_level); } - + s = xf86FindOptionValue(local->options, "Resolution"); + if (s) { + priv->sumRes=atoi(s); + xf86Msg(X_CONFIG, "%s: resolution given %d\n", local->name, priv->sumRes); + } s = xf86FindOptionValue(local->options, "Mode"); @@ -1322,10 +1507,30 @@ xf86Msg(X_ERROR, "%s: invalid Mode (should be absolute or relative). " "Using default.\n", dev->identifier); } - xf86Msg(X_CONFIG, "%s is in %s mode\n", local->name, + xf86Msg(X_CONFIG, "%s: set for %s mode\n", local->name, (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative"); + s = xf86FindOption(local->options, "Compatible"); + if (s) { + priv->flags|=COMPATIBLE_FLAG; + } + + if (xf86FindOption(local->options, "Hitachi_1217D") != NULL) { + priv->flags |= H1217D_FLAG | COMPATIBLE_FLAG; + priv->sumInc = 0; /* this must be zero for Hitachi 1217D */ + xf86Msg(X_CONFIG, "%s: Hitachi 1217D, Compatible mode and Increment 0 implied\n", + local->name); + } + if (priv->flags & COMPATIBLE_FLAG) { + xf86Msg(X_CONFIG, "%s: will not query firmware ID.\n", local->name); + } + s = xf86FindOptionValue(local->options, "ZAxis"); + if(s){ + priv->flags|=Z_AXIS_FLAG; + xf86Msg(X_CONFIG, "Tablet has Z axis (AceCad Flair or compatible)\n"); + } + s = xf86FindOptionValue(local->options, "Cursor"); if (s && (xf86NameCmp(s, "stylus") == 0)) { @@ -1338,31 +1543,33 @@ xf86Msg(X_ERROR, "%s: invalid Cursor (should be stylus or puck). " "Using default.\n", dev->identifier); } - xf86Msg(X_CONFIG, "%s is in cursor-mode %s\n", local->name, + xf86Msg(X_CONFIG, "%s: cursor mode is %s\n", local->name, (priv->flags & STYLUS_FLAG) ? "cursor" : "puck"); - priv->sumXSize = xf86SetIntOption(local->options, "XSize", 0); + priv->sumXSize = xf86SetRealOption(local->options, "XSize", 0.0) * 100; if (priv->sumXSize != 0) { - xf86Msg(X_CONFIG, "%s: XSize = %d\n", - dev->identifier, priv->sumXSize); + xf86Msg(X_CONFIG, "%s: XSize = %d.%02din.\n", + dev->identifier, priv->sumXSize/100, priv->sumXSize%100); } - priv->sumYSize = xf86SetIntOption(local->options, "YSize", 0); + priv->sumYSize = xf86SetRealOption(local->options, "YSize", 0.0) * 100; if (priv->sumYSize != 0) { - xf86Msg(X_CONFIG, "%s: YSize = %d\n", - dev->identifier, priv->sumYSize); + xf86Msg(X_CONFIG, "%s: YSize = %d.%02din.\n", + dev->identifier, priv->sumYSize/100, priv->sumYSize%100); } - priv->sumXOffset = xf86SetIntOption(local->options, "XOffset", 0); + priv->sumXOffset = xf86SetRealOption(local->options, "XOffset", 0.0) * 100; if (priv->sumXOffset != 0) { - xf86Msg(X_CONFIG, "%s: XOffset = %d\n", - dev->identifier, priv->sumXOffset); + xf86Msg(X_CONFIG, "%s: XOffset = %d.%02din.\n", + dev->identifier, priv->sumXOffset / 100, + priv->sumXOffset % 100); } - priv->sumYOffset = xf86SetIntOption(local->options, "YOffset", 0); + priv->sumYOffset = xf86SetRealOption(local->options, "YOffset", 0.0) * 100; if (priv->sumYOffset != 0) { - xf86Msg(X_CONFIG, "%s: YOffset = %d\n", - dev->identifier, priv->sumYOffset); + xf86Msg(X_CONFIG, "%s: YOffset = %d.%02din.\n", + dev->identifier, priv->sumYOffset / 100, + priv->sumYOffset % 100); } /* mark the device configured */ @@ -1407,7 +1614,6 @@ static void xf86SumUnplug(pointer p) { - DBG(1, ErrorF("xf86SumUnplug\n")); } /* @@ -1421,8 +1627,6 @@ int *errmaj, int *errmin) { - DBG(1, ErrorF("xf86SumPlug\n")); - xf86AddInputDriver(&SUMMA, module, 0); return module; @@ -1452,3 +1656,4 @@ /* end of xf86Summa.c */ + Index: xc/programs/Xserver/hw/xfree86/input/void/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/void/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/input/void/Imakefile:1.3 --- xc/programs/Xserver/hw/xfree86/input/void/Imakefile:1.2 Thu Mar 2 20:05:50 2000 +++ xc/programs/Xserver/hw/xfree86/input/void/Imakefile Tue Jan 23 19:06:38 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/void/Imakefile,v 1.2 2000/03/03 01:05:50 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/void/Imakefile,v 1.3 2001/01/24 00:06:38 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -22,7 +22,6 @@ InstallObjectModule($(DRIVER),$(MODULEDIR),input) #if !defined(XF86DriverSDK) -CppManTarget($(DRIVER),) InstallModuleManPage($(DRIVER)) #endif Index: xc/programs/Xserver/hw/xfree86/input/void/void.cpp diff -u xc/programs/Xserver/hw/xfree86/input/void/void.cpp:1.5 xc/programs/Xserver/hw/xfree86/input/void/void.cpp:removed --- xc/programs/Xserver/hw/xfree86/input/void/void.cpp:1.5 Mon Dec 11 15:18:56 2000 +++ xc/programs/Xserver/hw/xfree86/input/void/void.cpp Mon Jun 4 12:41:20 2001 @@ -1,29 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/void/void.cpp,v 1.5 2000/12/11 20:18:56 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH VOID __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -void \- null input driver -.SH SYNOPSIS -.nf -.B "Section \*qInputDevice\*q" -.BI " Identifier \*q" idevname \*q -.B " Driver \*qvoid\*q" -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B void -is an dummy/null XFree86 input driver. It doesn't connect to any -physical device, and it never delivers any events. It functions as -both a pointer and keyboard device, and may be used as X server's core -pointer and/or core keyboard. It's purpose is to allow the X server -to operate without a core pointer and/or core keyboard. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details and for options that can be used with all input drivers. This -driver doesn't have any configuration options in addition to those. -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). -.SH AUTHORS -Authors include... Index: xc/programs/Xserver/hw/xfree86/input/void/void.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/void/void.man:1.2 --- /dev/null Mon Jun 4 12:41:20 2001 +++ xc/programs/Xserver/hw/xfree86/input/void/void.man Sat Jan 27 13:20:58 2001 @@ -0,0 +1,29 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/void/void.man,v 1.2 2001/01/27 18:20:58 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH VOID __drivermansuffix__ __vendorversion__ +.SH NAME +void \- null input driver +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" idevname \*q +.B " Driver \*qvoid\*q" +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B void +is an dummy/null XFree86 input driver. It doesn't connect to any +physical device, and it never delivers any events. It functions as +both a pointer and keyboard device, and may be used as X server's core +pointer and/or core keyboard. It's purpose is to allow the X server +to operate without a core pointer and/or core keyboard. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +driver doesn't have any configuration options in addition to those. +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Authors include... Index: xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile diff -u xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile:1.7 xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile:1.8 --- xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile:1.7 Fri Dec 1 12:43:06 2000 +++ xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile Tue Jan 23 19:06:39 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile,v 1.7 2000/12/01 17:43:06 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/Imakefile,v 1.8 2001/01/24 00:06:39 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -26,7 +26,6 @@ InstallObjectModule($(DRIVER),$(MODULEDIR),input) #if !defined(XF86DriverSDK) -CppManTarget($(DRIVER),) InstallModuleManPage($(DRIVER)) #endif Index: xc/programs/Xserver/hw/xfree86/input/wacom/wacom.cpp diff -u xc/programs/Xserver/hw/xfree86/input/wacom/wacom.cpp:1.9 xc/programs/Xserver/hw/xfree86/input/wacom/wacom.cpp:removed --- xc/programs/Xserver/hw/xfree86/input/wacom/wacom.cpp:1.9 Sun Dec 17 19:17:18 2000 +++ xc/programs/Xserver/hw/xfree86/input/wacom/wacom.cpp Mon Jun 4 12:41:20 2001 @@ -1,116 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/wacom.cpp,v 1.9 2000/12/18 00:17:18 dawes Exp $ -.\" shorthand for double quote that works everywhere. -.ds q \N'34' -.TH WACOM __drivermansuffix__ "Version 4.0.2" "XFree86" -.SH NAME -wacom \- Wacom input driver -.SH SYNOPSIS -.nf -.B "Section \*qInputDevice\*q" -.BI " Identifier \*q" idevname \*q -.B " Driver \*qwacom\*q" -.BI " Option \*qDevice\*q \*q" devpath \*q -\ \ ... -.B EndSection -.fi -.SH DESCRIPTION -.B wacom -is an XFree86 input driver for Wacom devices. -.PP -The -.B wacom -driver functions as a pointer input device, and may be used as the -X server's core pointer. -.SH SUPPORTED HARDWARE -This driver supports the Wacom IV and Wacom V protocols. -Preliminary support is available for USB devices on some Linux platforms. -.SH CONFIGURATION DETAILS -Please refer to XF86Config(__filemansuffix__) for general configuration -details and for options that can be used with all input drivers. This -section only covers configuration details specific to this driver. -.PP -Multiple instances of the Wacom devices can cohabit. It can be useful -to define multiple devices with different active zones. Each device -supports the following entries: -.RS 8 -.TP 4 -.B Option \fI"Type"\fP \fI"stylus"|"eraser"|"cursor"\fP -sets the type of tool the device represent. This option is mandatory. -.TP 4 -.B Option \fI"Device"\fP \fI"path"\fP -sets the path to the special file which represents serial line where -the tablet is plugged. You have to specify it for each subsection with -the same value if you want to have multiple devices with the same tablet. -This option is mandatory. -.TP 4 -.B Option \fI"USB"\fP \fI"on"\fP -tells the driver to dialog with the tablet the USB way. This option is -only available on some Linux platforms. -.TP 4 -.B Option \fI"DeviceName"\fP \fI"name"\fP -sets the name of the X device. -.TP 4 -.B Option \fI"Suppress"\fP \fI"Inumber"\fP -sets the position increment under which not to transmit coordinates. -This entry must be specified only in the first Wacom subsection if you have -multiple devices for one tablet. If you don't specify this entry, the default value -is computed to -.TP 4 -.B Option \fI"Mode"\fP \fI"Relative"|"Absolute"\fP -sets the mode of the device. -.TP 4 -.B Option \fI"Tilt"\fP \fI"on"\fP -enables tilt report if your tablet supports it (ROM version 1.4 and above). -If this is enabled, multiple devices at the same time will not be reported. -.TP 4 -.B Option \fI"HistorySize"\fP \fI"number"\fP -sets the motion history size. By default the value is zero. -.TP 4 -.B Option \fI"AlwaysCore"\fP \fI"on"\fP -enables the sharing of the core pointer. When this feature is enabled, the -device will take control of the core pointer (and thus will emit core events) -and at the same time will be able, when asked so, to report extended events. -You can use the last available integer feedback to control this feature. When -the value of the feedback is zero, the feature is disabled. The feature is -enabled for any other value. -.TP 4 -.B Option \fI"TopX"\fP \fI"number"\fP -X coordinate of the top corner of the active zone. -.TP 4 -.B Option \fI"TopY"\fP \fI"number"\fP -Y coordinate of the top corner of the active zone. -.TP 4 -.B Option \fI"BottomX"\fP \fI"Inumber"\fP -X coordinate of the bottom corner of the active zone. -.TP 4 -.B Option \fI"BottomY"\fP \fI"number"\fP -Y coordinate of the bottom corner of the active zone. -.TP 4 -.B Option \fI"KeepShape"\fP \fI"on"\fP -When this option is enabled, the active zone begins according to TopX -and TopY. The bottom corner is adjusted to keep the ratio width/height -of the active zone the same as the screen while maximizing the area -described by TopX, TopY, BottomX, BottomY. -.TP 4 -.B Option \fI"DebugLevel"\fP \fInumber \fP -sets the level of debugging info reported. -.TP 4 -.B Option \fI"BaudRate"\fP \fI"38400"\fP, \fI"19200"\fP or \fI"9600"\fP (default) -changes the serial link speed. This option is only available for -wacom V models (Intuos). -.TP 4 -.B Option \fI"Serial"\fP \fI"number"\fP -sets the serial number associated with the physical device. This allows -to have multiple devices of the same type (i.e. multiple pens). This -option is only available on wacom V devices (Intuos). To see which -serial number belongs to a device, you have to set the DebugLevel to 6 and -watch the output of the X server. -.TP 4 -.B Option \fI"Threshold"\fP \fI"number"\fP -sets the pressure threshold used to generate a button 1 events of stylus -devices for some models of tablets (Intuos and Graphire). -.RE -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). -.SH AUTHORS -Frederic Lepied <lepied@xfree86.org> Index: xc/programs/Xserver/hw/xfree86/input/wacom/wacom.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/input/wacom/wacom.man:1.2 --- /dev/null Mon Jun 4 12:41:20 2001 +++ xc/programs/Xserver/hw/xfree86/input/wacom/wacom.man Sat Jan 27 13:20:59 2001 @@ -0,0 +1,116 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/wacom.man,v 1.2 2001/01/27 18:20:59 dawes Exp $ +.\" shorthand for double quote that works everywhere. +.ds q \N'34' +.TH WACOM __drivermansuffix__ __vendorversion__ +.SH NAME +wacom \- Wacom input driver +.SH SYNOPSIS +.nf +.B "Section \*qInputDevice\*q" +.BI " Identifier \*q" idevname \*q +.B " Driver \*qwacom\*q" +.BI " Option \*qDevice\*q \*q" devpath \*q +\ \ ... +.B EndSection +.fi +.SH DESCRIPTION +.B wacom +is an XFree86 input driver for Wacom devices. +.PP +The +.B wacom +driver functions as a pointer input device, and may be used as the +X server's core pointer. +.SH SUPPORTED HARDWARE +This driver supports the Wacom IV and Wacom V protocols. +Preliminary support is available for USB devices on some Linux platforms. +.SH CONFIGURATION DETAILS +Please refer to XF86Config(__filemansuffix__) for general configuration +details and for options that can be used with all input drivers. This +section only covers configuration details specific to this driver. +.PP +Multiple instances of the Wacom devices can cohabit. It can be useful +to define multiple devices with different active zones. Each device +supports the following entries: +.RS 8 +.TP 4 +.B Option \fI"Type"\fP \fI"stylus"|"eraser"|"cursor"\fP +sets the type of tool the device represent. This option is mandatory. +.TP 4 +.B Option \fI"Device"\fP \fI"path"\fP +sets the path to the special file which represents serial line where +the tablet is plugged. You have to specify it for each subsection with +the same value if you want to have multiple devices with the same tablet. +This option is mandatory. +.TP 4 +.B Option \fI"USB"\fP \fI"on"\fP +tells the driver to dialog with the tablet the USB way. This option is +only available on some Linux platforms. +.TP 4 +.B Option \fI"DeviceName"\fP \fI"name"\fP +sets the name of the X device. +.TP 4 +.B Option \fI"Suppress"\fP \fI"Inumber"\fP +sets the position increment under which not to transmit coordinates. +This entry must be specified only in the first Wacom subsection if you have +multiple devices for one tablet. If you don't specify this entry, the default value +is computed to +.TP 4 +.B Option \fI"Mode"\fP \fI"Relative"|"Absolute"\fP +sets the mode of the device. +.TP 4 +.B Option \fI"Tilt"\fP \fI"on"\fP +enables tilt report if your tablet supports it (ROM version 1.4 and above). +If this is enabled, multiple devices at the same time will not be reported. +.TP 4 +.B Option \fI"HistorySize"\fP \fI"number"\fP +sets the motion history size. By default the value is zero. +.TP 4 +.B Option \fI"AlwaysCore"\fP \fI"on"\fP +enables the sharing of the core pointer. When this feature is enabled, the +device will take control of the core pointer (and thus will emit core events) +and at the same time will be able, when asked so, to report extended events. +You can use the last available integer feedback to control this feature. When +the value of the feedback is zero, the feature is disabled. The feature is +enabled for any other value. +.TP 4 +.B Option \fI"TopX"\fP \fI"number"\fP +X coordinate of the top corner of the active zone. +.TP 4 +.B Option \fI"TopY"\fP \fI"number"\fP +Y coordinate of the top corner of the active zone. +.TP 4 +.B Option \fI"BottomX"\fP \fI"Inumber"\fP +X coordinate of the bottom corner of the active zone. +.TP 4 +.B Option \fI"BottomY"\fP \fI"number"\fP +Y coordinate of the bottom corner of the active zone. +.TP 4 +.B Option \fI"KeepShape"\fP \fI"on"\fP +When this option is enabled, the active zone begins according to TopX +and TopY. The bottom corner is adjusted to keep the ratio width/height +of the active zone the same as the screen while maximizing the area +described by TopX, TopY, BottomX, BottomY. +.TP 4 +.B Option \fI"DebugLevel"\fP \fInumber \fP +sets the level of debugging info reported. +.TP 4 +.B Option \fI"BaudRate"\fP \fI"38400"\fP, \fI"19200"\fP or \fI"9600"\fP (default) +changes the serial link speed. This option is only available for +wacom V models (Intuos). +.TP 4 +.B Option \fI"Serial"\fP \fI"number"\fP +sets the serial number associated with the physical device. This allows +to have multiple devices of the same type (i.e. multiple pens). This +option is only available on wacom V devices (Intuos). To see which +serial number belongs to a device, you have to set the DebugLevel to 6 and +watch the output of the X server. +.TP 4 +.B Option \fI"Threshold"\fP \fI"number"\fP +sets the pressure threshold used to generate a button 1 events of stylus +devices for some models of tablets (Intuos and Graphire). +.RE +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), xf86config(1), Xserver(1), X(__miscmansuffix__). +.SH AUTHORS +Frederic Lepied <lepied@xfree86.org> Index: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c diff -u xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c:1.24 xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c:1.27 --- xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c:1.24 Thu Dec 7 15:26:24 2000 +++ xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c Fri May 18 19:35:33 2001 @@ -1,6 +1,6 @@ /* $XConsortium: xf86Wacom.c /main/20 1996/10/27 11:05:20 kaleb $ */ /* - * Copyright 1995-2000 by Frederic Lepied, France. <Lepied@XFree86.org> + * Copyright 1995-2001 by Frederic Lepied, France. <Lepied@XFree86.org> * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.24 2000/12/07 20:26:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/input/wacom/xf86Wacom.c,v 1.27 2001/05/18 23:35:33 dawes Exp $ */ /* * This driver is only able to handle the Wacom IV and Wacom V protocols. @@ -33,32 +33,18 @@ * Many thanks to Dave Fleck from Wacom for the help provided to * build this driver. * - * Modified for Linux USB by MATSUMURA Namihiko. + * Modified for Linux USB by MATSUMURA Namihiko, * Daniel Egger, Germany. <egger@suse.de>, - * Frederic Lepied <lepied@xfree86.org>. + * Frederic Lepied <lepied@xfree86.org>, * Brion Vibber <brion@pobox.com>, - * Aaron Optimizer Digulla <digulla@hepe.com> + * Aaron Optimizer Digulla <digulla@hepe.com>, + * Jonathan Layes <jonathan@layes.com>. * */ -/* - * Bugs fixed by Steve Day (Updated: Apr 5 1999) - * - * MaxX and MaxY values that the Wacom returns are now converted from - * 1270lpi to the actual X and Y resolutions that the tablet is using. - * - * Buffer bug fixed when reading X and Y resolutions from config - * string, now receives the true X and Y resolutions. This has the - * side effect of being more compatible with other models of Wacom - * that have varying lengths of headers. - * - * <steve@lineardesigns.co.uk> - * - */ - -static const char identification[] = "$Identification: 20 $"; +static const char identification[] = "$Identification: 23 $"; -#include <xf86Version.h> +#include "xf86Version.h" #if XF86_VERSION_CURRENT >= XF86_VERSION_NUMERIC(3,9,0,0,0) #define XFREE86_V4 1 @@ -68,6 +54,9 @@ #include <asm/types.h> #include <linux/input.h> +/* max number of input events to read in one read call */ +#define MAX_EVENTS 50 + /* keithp - a hack to avoid redefinitions of these in xf86str.h */ #ifdef BUS_PCI #undef BUS_PCI @@ -85,21 +74,21 @@ #include <errno.h> #endif -#include <misc.h> -#include <xf86.h> +#include "misc.h" +#include "xf86.h" #define NEED_XF86_TYPES #if !defined(DGUX) -#include <xf86_ansic.h> -#include <xisb.h> +#include "xf86_ansic.h" +#include "xisb.h" #endif -#include <xf86_OSproc.h> -#include <xf86Xinput.h> -#include <exevents.h> /* Needed for InitValuator/Proximity stuff */ -#include <keysym.h> -#include <mipointer.h> +#include "xf86_OSproc.h" +#include "xf86Xinput.h" +#include "exevents.h" /* Needed for InitValuator/Proximity stuff */ +#include "keysym.h" +#include "mipointer.h" #ifdef XFree86LOADER -#include <xf86Module.h> +#include "xf86Module.h" #endif #undef sleep @@ -271,7 +260,8 @@ double factorY; /* Y factor */ unsigned int serial; /* device serial number */ int initNumber; /* magic number for the init phasis */ - + int screen_no; /* associated screen */ + struct _WacomCommonRec *common; /* common info pointer */ /* state fields */ @@ -345,6 +335,7 @@ #define RESOLUTION_Y 21 #define RESOLUTION_Z 22 #define USB 23 +#define SCREEN_NO 24 #if !defined(sun) || defined(i386) static SymTabRec WcmTab[] = { @@ -372,6 +363,7 @@ { RESOLUTION_Y, "resolutiony" }, { RESOLUTION_Z, "resolutionz" }, { USB, "usb" }, + { SCREEN_NO, "screenno" }, { -1, "" } }; @@ -524,6 +516,13 @@ /****************************************************************************** * external declarations *****************************************************************************/ + +#ifdef LINUX_INPUT +static void xf86WcmReadUSBInput(LocalDevicePtr); +static Bool xf86WcmUSBOpen(LocalDevicePtr); +#endif + + #ifndef XFREE86_V4 #if defined(sun) && !defined(i386) @@ -820,7 +819,7 @@ case USB: #ifdef LINUX_INPUT - local->read_input=xf86WcmReadUSBInput; + dev->read_input=xf86WcmReadUSBInput; common->wcmOpen=xf86WcmUSBOpen; ErrorF("%s Wacom reading USB link\n", XCONFIG_GIVEN); #else @@ -828,6 +827,15 @@ #endif break; + case SCREEN_NO: + if (xf86GetToken(NULL) != NUMBER) + xf86ConfigError("Option number expected"); + priv->screen_no = val->num; + if (xf86Verbose) + ErrorF("%s Wacom attached screen = %d\n", XCONFIG_GIVEN, + priv->screen_no); + break; + case EOF: FatalError("Unexpected EOF (missing EndSubSection)"); break; @@ -1164,25 +1172,38 @@ int* y) { WacomDevicePtr priv = (WacomDevicePtr) local->private; - + int width, height; + DBG(6, ErrorF("xf86WcmConvert\n")); if (first != 0 || num == 1) return FALSE; #ifdef XFREE86_V4 - priv->factorX = ((double) miPointerCurrentScreen()->width) + if (priv->screen_no != -1) { + width = screenInfo.screens[priv->screen_no]->width; + height = screenInfo.screens[priv->screen_no]->height; + } else { + width = miPointerCurrentScreen()->width; + height = miPointerCurrentScreen()->height; + } + + priv->factorX = ((double) width) / (priv->bottomX - priv->topX); - priv->factorY = ((double) miPointerCurrentScreen()->height) + priv->factorY = ((double) height) / (priv->bottomY - priv->topY); #endif - *x = v0 * priv->factorX; - *y = v1 * priv->factorY; + *x = v0 * priv->factorX + 0.5; + *y = v1 * priv->factorY + 0.5; DBG(6, ErrorF("Wacom converted v0=%d v1=%d to x=%d y=%d\n", v0, v1, *x, *y)); - +#ifdef XFREE86_V4 + if (priv->screen_no != -1) { + xf86XInputSetScreen(local, priv->screen_no, *x, *y); + } +#endif return TRUE; } @@ -1209,8 +1230,8 @@ / (priv->bottomY - priv->topY); #endif - valuators[0] = x / priv->factorX; - valuators[1] = y / priv->factorY; + valuators[0] = x / priv->factorX + 0.5; + valuators[1] = y / priv->factorY + 0.5; DBG(6, ErrorF("Wacom converted x=%d y=%d to v0=%d v1=%d\n", x, y, valuators[0], valuators[1])); @@ -2084,6 +2105,31 @@ /* *************************************************************************** * + * xf86WcmIsUSBLine -- + * Test if the attached device is a USB one. + * + *************************************************************************** + */ +static int +xf86WcmIsUSBLine(int fd) +{ + int version; + int err; + + SYSCALL(err = ioctl(fd, EVIOCGVERSION, &version)); + + if (!err) { + ErrorF("%s Wacom Kernel Input driver version is %d.%d.%d\n", XCONFIG_PROBED, + version >> 16, (version >> 8) & 0xff, version & 0xff); + return 1; + } else { + return 0; + } +} + +/* + *************************************************************************** + * * xf86WcmReadUSBInput -- * Read the new events from the device, and enqueue them. * @@ -2107,11 +2153,11 @@ ssize_t len; int idx; struct input_event * event; - char eventbuf[BUFFER_SIZE]; + char eventbuf[sizeof(struct input_event) * MAX_EVENTS]; #define MOD_BUTTONS(bit, value) \ { int _b=bit, _v=value; buttons = (((_v) != 0) ? (buttons | _b) : (buttons & ~ _b)); } - SYSCALL(len = read(local->fd, eventbuf, BUFFER_SIZE)); + SYSCALL(len = read(local->fd, eventbuf, sizeof(eventbuf))); if (len <= 0) { ErrorF("Error reading wacom device : %s\n", strerror(errno)); @@ -2120,11 +2166,11 @@ for (event=(struct input_event *)eventbuf; event<(struct input_event *)(eventbuf+len); event++) { - DBG(10, ErrorF("event->type=%d\n", event->type)); + DBG(10, ErrorF("xf86WcmReadUSBInput event->type=%d\n", event->type)); switch (event->type) { case EV_ABS: - DBG(10, ErrorF("event->code=%d\n", event->code)); + DBG(10, ErrorF("xf86WcmReadUSBInput event->code=%d\n", event->code)); switch (event->code) { case ABS_X: x = event->value; @@ -2135,6 +2181,7 @@ break; case ABS_TILT_X: + case ABS_RZ: tilt_x = event->value; break; @@ -2144,11 +2191,23 @@ case ABS_PRESSURE: pressure = event->value; + MOD_BUTTONS (1, event->value > common->wcmThreshold ? 1 : 0); break; case ABS_DISTANCE: /* This is not sent by the driver */ break; + + case ABS_MISC: + serial = event->value; + DBG(10, ErrorF("wacom tool serial id=%d\n", serial)); + break; + + case ABS_WHEEL: + case ABS_THROTTLE: + wheel = event->value; + break; + } break; /* EV_ABS */ @@ -2166,22 +2225,29 @@ case EV_KEY: switch (event->code) { case BTN_TOOL_PEN: + case BTN_TOOL_PENCIL: + case BTN_TOOL_BRUSH: + case BTN_TOOL_AIRBRUSH: + DBG(10, ErrorF("USB Stylus detected %x\n", event->code)); common->wcmIndex = STYLUS_ID; is_proximity = (event->value != 0); break; case BTN_TOOL_RUBBER: + DBG(10, ErrorF("USB eraser detected %x\n", event->code)); common->wcmIndex = ERASER_ID; is_proximity = (event->value != 0); break; case BTN_TOOL_MOUSE: + case BTN_TOOL_LENS: + DBG(10, ErrorF("USB mouse detected %x\n", event->code)); common->wcmIndex = CURSOR_ID; is_proximity = (event->value != 0); break; case BTN_TOUCH: - MOD_BUTTONS (1, event->value); + /* we use the pressure to determine the button 1 */ break; case BTN_STYLUS: @@ -2196,17 +2262,30 @@ MOD_BUTTONS (1, event->value); break; - case BTN_RIGHT: + case BTN_MIDDLE: MOD_BUTTONS (2, event->value); break; - case BTN_MIDDLE: + case BTN_RIGHT: MOD_BUTTONS (4, event->value); break; + + case BTN_SIDE: + MOD_BUTTONS (8, event->value); + break; + + case BTN_EXTRA: + MOD_BUTTONS (16, event->value); + break; } break; /* EV_KEY */ - } + } /* switch event->type */ + /* ABS_MISC is the event terminator */ + if (event->type != EV_ABS || event->code != ABS_MISC) { + continue; + } + if ((is_proximity == priv->oldProximity) && (buttons == priv->oldButtons) && (ABS(x - priv->oldX) <= common->wcmSuppress) && @@ -2256,12 +2335,23 @@ * *************************************************************************** */ + +#define BITS_PER_LONG (sizeof(long) * 8) +#define NBITS(x) ((((x)-1)/BITS_PER_LONG)+1) +#define test_bit(bit, array) ((array[LONG(bit)] >> OFF(bit)) & 1) +#define OFF(x) ((x)%BITS_PER_LONG) +#define LONG(x) ((x)/BITS_PER_LONG) + static Bool xf86WcmUSBOpen(LocalDevicePtr local) { int err = 0; WacomDevicePtr priv = (WacomDevicePtr)local->private; WacomCommonPtr common = priv->common; + char name[256] = "Unknown"; + int abs[5]; + unsigned long bit[EV_MAX][NBITS(KEY_MAX)]; + int i, j; #ifdef XFREE86_V4 local->fd = xf86OpenSerial(local->options); @@ -2273,6 +2363,42 @@ return !Success; } + ioctl(local->fd, EVIOCGNAME(sizeof(name)), name); + ErrorF("%s Wacom Kernel Input device name: \"%s\"\n", XCONFIG_PROBED, name); + + memset(bit, 0, sizeof(bit)); + ioctl(local->fd, EVIOCGBIT(0, EV_MAX), bit[0]); + + for (i = 0; i < EV_MAX; i++) + if (test_bit(i, bit[0])) { + ioctl(local->fd, EVIOCGBIT(i, KEY_MAX), bit[i]); + for (j = 0; j < KEY_MAX; j++) + if (test_bit(j, bit[i])) { + if (i == EV_ABS) { + ioctl(local->fd, EVIOCGABS(j), abs); + switch (j) { + case ABS_X: + if (common->wcmMaxX == 0) { + common->wcmMaxX = abs[2]; + } + break; + + case ABS_Y: + if (common->wcmMaxY == 0) { + common->wcmMaxY = abs[2]; + } + break; + + case ABS_Z: + if (common->wcmMaxZ == DEFAULT_MAXZ) { + common->wcmMaxZ = abs[2]; + } + break; + } + } + } + } + DBG(2, ErrorF("setup is max X=%d max Y=%d resol X=%d resol Y=%d\n", common->wcmMaxX, common->wcmMaxY, common->wcmResolX, common->wcmResolY)); @@ -2315,6 +2441,9 @@ return !Success; } + /* to have the button field handled as a bit field */ + common->wcmProtocolLevel = 5; + return Success; } @@ -2387,6 +2516,23 @@ return !Success; } +#ifdef LINUX_INPUT + DBG(1, ErrorF("testing USB\n")); + + if (xf86WcmIsUSBLine(local->fd)) { + int loop; + + SYSCALL(close(local->fd)); + + for(loop=0; loop<common->wcmNumDevices; loop++) { + common->wcmDevices[loop]->read_input=xf86WcmReadUSBInput; + } + common->wcmOpen=xf86WcmUSBOpen; + + return xf86WcmUSBOpen(local); + } +#endif + DBG(1, ErrorF("initializing tablet\n")); /* Set the speed of the serial link to 38400 */ @@ -2783,6 +2929,7 @@ double screenRatio, tabletRatio; int gap; int loop; + int screen_idx = 0; if (local->fd < 0) { if (common->wcmInitNumber > 2 || @@ -2841,12 +2988,24 @@ priv->bottomY, common->wcmMaxY); priv->bottomY = common->wcmMaxY; } - + + if (priv->screen_no != -1 && + (priv->screen_no >= screenInfo.numScreens || + priv->screen_no < 0)) { + ErrorF("%s: invalid screen number %d, resetting to 0\n", + local->name, priv->screen_no); + priv->screen_no = 0; + } + /* Calculate the ratio according to KeepShape, TopX and TopY */ + if (priv->screen_no != -1) { + screen_idx = priv->screen_no; + } + if (priv->flags & KEEP_SHAPE_FLAG) { - screenRatio = ((double) screenInfo.screens[0]->width) - / screenInfo.screens[0]->height; + screenRatio = ((double) screenInfo.screens[screen_idx]->width) + / screenInfo.screens[screen_idx]->height; tabletRatio = ((double) (common->wcmMaxX - priv->topX)) / (common->wcmMaxY - priv->topY); @@ -3214,6 +3373,9 @@ local->name = name; local->flags = 0; +#ifndef XFREE86_V4 + local->device_config = xf86WcmConfig; +#endif local->device_control = xf86WcmProc; local->read_input = xf86WcmReadInput; local->control_proc = xf86WcmChangeControl; @@ -3248,6 +3410,7 @@ priv->oldProximity = 0; /* previous proximity */ priv->serial = 0; /* serial number */ priv->initNumber = 0; /* magic number for the init phasis */ + priv->screen_no = -1; /* associated screen */ common->wcmDevice = ""; /* device file name */ common->wcmSuppress = -1; /* transmit position if increment is superior */ @@ -3493,7 +3656,7 @@ while(localDevices) { if ((local != localDevices) && - (localDevices->read_input == xf86WcmReadInput) && + (localDevices->device_control == xf86WcmProc) && (strcmp(((WacomDevicePtr)localDevices->private)->common->wcmDevice, common->wcmDevice) == 0)) { DBG(2, ErrorF("xf86WcmConfig wacom port share between" @@ -3508,7 +3671,7 @@ sizeof(LocalDevicePtr) * common->wcmNumDevices); common->wcmDevices[common->wcmNumDevices - 1] = local; break; - } + } localDevices = localDevices->next; } @@ -3520,7 +3683,7 @@ xf86Msg(X_CONFIG, "%s serial device is %s\n", dev->identifier, common->wcmDevice); - debug_level = xf86SetIntOption(local->options, "DebugLevel", 0); + debug_level = xf86SetIntOption(local->options, "DebugLevel", debug_level); if (debug_level > 0) { xf86Msg(X_CONFIG, "WACOM: debug level set to %d\n", debug_level); } @@ -3540,26 +3703,33 @@ xf86Msg(X_CONFIG, "%s is in %s mode\n", local->name, (priv->flags & ABSOLUTE_FLAG) ? "absolute" : "relative"); - common->wcmSuppress = xf86SetIntOption(local->options, "Suppress", -1); + common->wcmSuppress = xf86SetIntOption(local->options, "Suppress", common->wcmSuppress); if (common->wcmSuppress != -1) { xf86Msg(X_CONFIG, "WACOM: suppress value is %d\n", XCONFIG_GIVEN, common->wcmSuppress); } - if (xf86SetBoolOption(local->options, "Tilt", 0)) { + if (xf86SetBoolOption(local->options, "Tilt", (common->wcmFlags & TILT_FLAG))) { common->wcmFlags |= TILT_FLAG; } - if (xf86SetBoolOption(local->options, "USB", 0)) { #ifdef LINUX_INPUT + if (xf86SetBoolOption(local->options, "USB", (common->wcmOpen == xf86WcmUSBOpen))) { local->read_input=xf86WcmReadUSBInput; common->wcmOpen=xf86WcmUSBOpen; xf86Msg(X_CONFIG, "%s: reading USB link\n", dev->identifier); #else + if (xf86SetBoolOption(local->options, "USB", 0)) { ErrorF("The USB version of the driver isn't available for your platform\n"); #endif } + priv->screen_no = xf86SetIntOption(local->options, "ScreenNo", -1); + if (priv->screen_no != -1) { + xf86Msg(X_CONFIG, "%s: attached screen number %d\n", dev->identifier, + priv->screen_no); + } + if (xf86SetBoolOption(local->options, "KeepShape", 0)) { priv->flags |= KEEP_SHAPE_FLAG; xf86Msg(X_CONFIG, "%s: keeps shape\n", dev->identifier); @@ -3588,37 +3758,37 @@ xf86Msg(X_CONFIG, "%s: serial number = %u\n", dev->identifier, priv->serial); } - common->wcmThreshold = xf86SetIntOption(local->options, "Threshold", INVALID_THRESHOLD); + common->wcmThreshold = xf86SetIntOption(local->options, "Threshold", common->wcmThreshold); if (common->wcmThreshold != INVALID_THRESHOLD) { xf86Msg(X_CONFIG, "%s: threshold = %d\n", dev->identifier, common->wcmThreshold); } - common->wcmMaxX = xf86SetIntOption(local->options, "MaxX", 0); + common->wcmMaxX = xf86SetIntOption(local->options, "MaxX", common->wcmMaxX); if (common->wcmMaxX != 0) { xf86Msg(X_CONFIG, "%s: max x = %d\n", dev->identifier, common->wcmMaxX); } - common->wcmMaxY = xf86SetIntOption(local->options, "MaxY", 0); + common->wcmMaxY = xf86SetIntOption(local->options, "MaxY", common->wcmMaxY); if (common->wcmMaxY != 0) { xf86Msg(X_CONFIG, "%s: max x = %d\n", dev->identifier, common->wcmMaxY); } - common->wcmMaxZ = xf86SetIntOption(local->options, "MaxZ", DEFAULT_MAXZ); + common->wcmMaxZ = xf86SetIntOption(local->options, "MaxZ", common->wcmMaxZ); if (common->wcmMaxZ != DEFAULT_MAXZ) { xf86Msg(X_CONFIG, "%s: max x = %d\n", dev->identifier, common->wcmMaxZ); } - common->wcmResolX = xf86SetIntOption(local->options, "ResolutionX", 0); + common->wcmResolX = xf86SetIntOption(local->options, "ResolutionX", common->wcmResolX); if (common->wcmResolX != 0) { xf86Msg(X_CONFIG, "%s: resol x = %d\n", dev->identifier, common->wcmResolX); } - common->wcmResolY = xf86SetIntOption(local->options, "ResolutionY", 0); + common->wcmResolY = xf86SetIntOption(local->options, "ResolutionY", common->wcmResolY); if (common->wcmResolY != 0) { xf86Msg(X_CONFIG, "%s: resol x = %d\n", dev->identifier, common->wcmResolY); } - common->wcmResolZ = xf86SetIntOption(local->options, "ResolutionZ", 0); + common->wcmResolZ = xf86SetIntOption(local->options, "ResolutionZ", common->wcmResolZ); if (common->wcmResolZ != 0) { xf86Msg(X_CONFIG, "%s: resol x = %d\n", dev->identifier, common->wcmResolZ); @@ -3705,8 +3875,8 @@ int *errmaj, int *errmin) { - DBG(1, ErrorF("xf86WcmPlug\n")); - + xf86Msg(X_INFO, "Wacom driver level: %s\n", identification+strlen("$Identification: ")); + xf86AddInputDriver(&WACOM, module, 0); return module; Index: xc/programs/Xserver/hw/xfree86/int10/INT10.HOWTO diff -u xc/programs/Xserver/hw/xfree86/int10/INT10.HOWTO:1.2 xc/programs/Xserver/hw/xfree86/int10/INT10.HOWTO:1.3 --- xc/programs/Xserver/hw/xfree86/int10/INT10.HOWTO:1.2 Tue Feb 8 08:13:22 2000 +++ xc/programs/Xserver/hw/xfree86/int10/INT10.HOWTO Mon Apr 30 10:34:57 2001 @@ -216,13 +216,13 @@ registers if a legacy VGA device exists. xf86InitInt10() should return a pointer to the xf86Int10InfoRec allocated. -2. void MapCurrentInt10(xf86Int10InfoPtr pInt); +2. Bool MapCurrentInt10(xf86Int10InfoPtr pInt); In case a platform specific mapping has to be performed to map the memory allocated for the real mode memory environment into a specific location prior to executing the x86 real mode code a function - void MapCurrentInt10(xf86Int10InfoPtr pInt); + Bool MapCurrentInt10(xf86Int10InfoPtr pInt); has to be provided. It will be called by a helper function whenever the active entity changes. If the vm86 mode is used it is most likely @@ -341,4 +341,4 @@ AX,BX,CX and DX register. -$XFree86: xc/programs/Xserver/hw/xfree86/int10/INT10.HOWTO,v 1.2 2000/02/08 13:13:22 eich Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/int10/INT10.HOWTO,v 1.3 2001/04/30 14:34:57 tsi Exp $ Index: xc/programs/Xserver/hw/xfree86/int10/generic.c diff -u xc/programs/Xserver/hw/xfree86/int10/generic.c:1.13 xc/programs/Xserver/hw/xfree86/int10/generic.c:1.22.2.1 --- xc/programs/Xserver/hw/xfree86/int10/generic.c:1.13 Tue Nov 21 18:10:38 2000 +++ xc/programs/Xserver/hw/xfree86/int10/generic.c Mon May 28 10:23:39 2001 @@ -1,11 +1,10 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.13 2000/11/21 23:10:38 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/generic.c,v 1.22.2.1 2001/05/28 14:23:39 eich Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich */ #include "xf86.h" -#include "xf86str.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" #include "xf86Pci.h" @@ -57,24 +56,32 @@ xf86InitInt10(int entityIndex) { xf86Int10InfoPtr pInt; - int screen, cs; + int screen; void* base = 0; void* vbiosMem = 0; + void* options = NULL; legacyVGARec vga; + xf86int10BiosLocation bios; +#ifdef _PC + CARD32 cs; +#endif screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; + + options = xf86HandleInt10Options(xf86Screens[screen],entityIndex); - if (int10skip(xf86Screens[screen],entityIndex)) + if (int10skip(options)) { + xfree(options); return NULL; - - pInt = (xf86Int10InfoPtr)xnfcalloc(1,sizeof(xf86Int10InfoRec)); + } + + pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec)); pInt->entityIndex = entityIndex; if (!xf86Int10ExecSetup(pInt)) goto error0; pInt->mem = &genericMem; - pInt->private = (pointer)xnfcalloc(1,sizeof(genericInt10Priv)); - INTPriv(pInt)->alloc = - (pointer)xnfcalloc(1,ALLOC_ENTRIES(getpagesize())); + pInt->private = (pointer)xnfcalloc(1, sizeof(genericInt10Priv)); + INTPriv(pInt)->alloc = (pointer)xnfcalloc(1, ALLOC_ENTRIES(getpagesize())); pInt->scrnIndex = screen; base = INTPriv(pInt)->base = xnfalloc(SYS_BIOS); @@ -85,11 +92,11 @@ MapVRam(pInt); #ifdef _PC if (!sysMem) - sysMem = xf86MapVidMem(screen,VIDMEM_FRAMEBUFFER,SYS_BIOS,BIOS_SIZE); + sysMem = xf86MapVidMem(screen, VIDMEM_FRAMEBUFFER, SYS_BIOS, BIOS_SIZE); INTPriv(pInt)->sysMem = sysMem; - - if (xf86ReadBIOS(0,0,(unsigned char *)base,LOW_PAGE_SIZE) < 0) { - xf86DrvMsg(screen,X_ERROR,"Cannot read int vect\n"); + + if (xf86ReadBIOS(0, 0, base, LOW_PAGE_SIZE) < 0) { + xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n"); goto error1; } @@ -104,79 +111,201 @@ V_BIOS_SIZE) xf86DrvMsg(screen, X_WARNING, "Unable to retrieve all of segment 0x%06X.\n", cs); + + xf86int10ParseBiosLocation(options,&bios); + + if (xf86IsEntityPrimary(entityIndex) + && !(initPrimary(options))) { - if (xf86IsEntityPrimary(entityIndex)) { - cs = MEM_RW(pInt,((0x10<<2)+2)); + if (bios.bus == BUS_ISA && bios.location.legacy) { + xf86DrvMsg(screen, X_CONFIG, + "Overriding BIOS location: 0x%lx\n", + bios.location.legacy); + cs = bios.location.legacy >> 4; + vbiosMem = (unsigned char *)base + (cs << 4); + if (!int10_check_bios(screen, cs, vbiosMem)) { + xf86DrvMsg(screen, X_ERROR, + "No V_BIOS at specified address 0x%x\n",cs << 4); + goto error1; + } + } else { + if (bios.bus == BUS_PCI) { + xf86DrvMsg(screen, X_WARNING, + "Option BiosLocation for primary device ignored: " + "It points to PCI.\n"); + xf86DrvMsg(screen, X_WARNING, + "You must set Option InitPrimary also\n"); + } + + cs = MEM_RW(pInt,((0x10<<2)+2)); - vbiosMem = (unsigned char *)base + (cs << 4); - if (!int10_check_bios(screen, cs, vbiosMem)) { - cs = MEM_RW(pInt,((0x42<<2)+2)); vbiosMem = (unsigned char *)base + (cs << 4); if (!int10_check_bios(screen, cs, vbiosMem)) { - cs = V_BIOS >> 4; + cs = MEM_RW(pInt, (0x42 << 2) + 2); vbiosMem = (unsigned char *)base + (cs << 4); if (!int10_check_bios(screen, cs, vbiosMem)) { - xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n"); - goto error1; + cs = V_BIOS >> 4; + vbiosMem = (unsigned char *)base + (cs << 4); + if (!int10_check_bios(screen, cs, vbiosMem)) { + xf86DrvMsg(screen, X_ERROR, "No V_BIOS found\n"); + goto error1; + } } } } - xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%x\n",cs); + xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%x\n", cs); + set_return_trap(pInt); pInt->BIOSseg = cs; } else { + BusType location_type; + int bios_location = V_BIOS; + int pci_entity; + + EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex); reset_int_vect(pInt); set_return_trap(pInt); - vbiosMem = (unsigned char *)base + V_BIOS; - if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3)\n"); + + if (bios.bus != BUS_NONE) { + switch (location_type = bios.bus) { + case BUS_PCI: + xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: " + "PCI:%i:%i%i\n",bios.location.pci.bus, + bios.location.pci.dev,bios.location.pci.func); + break; + case BUS_ISA: + bios_location = bios.location.legacy; + if (bios.location.legacy) + xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: " + "Legacy:0x%x\n",bios.location.legacy); + else + xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: " + "Legacy\n"); + break; + default: + break; + } + } else + location_type = pEnt->location.type; + + vbiosMem = (unsigned char *)base + bios_location; + + switch (location_type) { + case BUS_PCI: + if (bios.bus == BUS_PCI) + pci_entity = xf86GetPciEntity(bios.location.pci.bus, + bios.location.pci.dev, + bios.location.pci.func); + else + pci_entity = pInt->entityIndex; + if (!mapPciRom(pci_entity,(unsigned char *)(vbiosMem))) { + xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3)\n"); + goto error1; + } + break; + case BUS_ISA: +#if 0 + (void)memset(vbiosMem, 0, V_BIOS_SIZE); + if (xf86ReadBIOS(bios_location, 0, vbiosMem, V_BIOS_SIZE) + < V_BIOS_SIZE) + xf86DrvMsg(screen, X_WARNING, + "Unable to retrieve all of segment 0x%x.\n",bios_location); +#endif + if (!int10_check_bios(screen, bios_location >> 4, vbiosMem)) { + xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (4)\n"); + goto error1; + } + default: goto error1; } + xfree(pEnt); pInt->BIOSseg = V_BIOS >> 4; pInt->num = 0xe6; - LockLegacyVGA(screen, &vga); + LockLegacyVGA(screen, &vga); xf86ExecX86int10(pInt); UnlockLegacyVGA(screen, &vga); } #else if (!sysMem) { sysMem = xnfalloc(BIOS_SIZE); - setup_system_bios((memType)sysMem); + setup_system_bios(sysMem); } INTPriv(pInt)->sysMem = sysMem; setup_int_vect(pInt); set_return_trap(pInt); - vbiosMem = (unsigned char *)base + V_BIOS; + + /* + * Retrieve two segments: one at V_BIOS, the other 64kB beyond the first. + * This'll catch any BIOS that might have been initialised before server + * entry. + */ + vbiosMem = (char *)base + V_BIOS; + (void)memset(vbiosMem, 0, 2 * V_BIOS_SIZE); + if (xf86ReadBIOS(V_BIOS, 0, vbiosMem, V_BIOS_SIZE) < V_BIOS_SIZE) + xf86DrvMsg(screen, X_WARNING, + "Unable to retrieve all of segment 0x0C0000.\n"); + else if (((unsigned char *)vbiosMem)[2] > 0x80) + if (xf86ReadBIOS(V_BIOS + V_BIOS_SIZE, 0, + (unsigned char *)vbiosMem + V_BIOS_SIZE, V_BIOS_SIZE) < V_BIOS_SIZE) + xf86DrvMsg(screen, X_WARNING, + "Unable to retrieve all of segment 0x0D0000.\n"); + + /* + * If this adapter is the primary, use its post-init BIOS (if we can find + * it). + */ + xf86int10ParseBiosLocation(options,&bios); + { - EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex); - switch (pEnt->location.type) { - case BUS_PCI: - if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (4)\n"); - goto error1; - } - break; - case BUS_ISA: - (void)memset(vbiosMem, 0, V_BIOS_SIZE); - if (xf86ReadBIOS(V_BIOS, 0, vbiosMem, V_BIOS_SIZE) < V_BIOS_SIZE) - xf86DrvMsg(screen, X_WARNING, - "Unable to retrieve all of segment 0x0C0000.\n"); - if (!int10_check_bios(screen, V_BIOS >> 4, vbiosMem)) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (5)\n"); - goto error1; + int bios_location = V_BIOS; + Bool done = FALSE; + vbiosMem = (unsigned char *)base + bios_location; + + if ((bios.bus == BUS_ISA) + || (bios.bus != BUS_PCI && xf86IsEntityPrimary(entityIndex))) { + if (bios.bus == BUS_ISA && bios.location.legacy) { + xf86DrvMsg(screen, X_CONFIG,"Looking for legacy V_BIOS " + "at 0x%x for %sprimary device\n", + bios.location.legacy, + xf86IsEntityPrimary(entityIndex) ? "" : "non-"); + bios_location = bios.location.legacy; + vbiosMem = (unsigned char *)base + bios_location; + } + if (int10_check_bios(screen, bios_location >> 4, vbiosMem)) + done = TRUE; + else + xf86DrvMsg(screen,X_INFO, + "No legacy BIOS found -- trying PCI\n"); + } + if (!done) { + int pci_entity; + + if (bios.bus == BUS_PCI) { + xf86DrvMsg(screen,X_CONFIG,"Looking for BIOS at PCI:%i%i%i\n", + bios.location.pci.bus,bios.location.pci.dev, + bios.location.pci.func); + pci_entity = xf86GetPciEntity(bios.location.pci.bus, + bios.location.pci.dev, + bios.location.pci.func); + } else + pci_entity = pInt->entityIndex; + + if (!mapPciRom(pci_entity, vbiosMem)) { + xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS (5)\n"); + goto error1; } - break; - default: - goto error1; - } + } + } + pInt->BIOSseg = V_BIOS >> 4; pInt->num = 0xe6; - LockLegacyVGA(screen, &vga); + LockLegacyVGA(screen, &vga); xf86ExecX86int10(pInt); UnlockLegacyVGA(screen, &vga); #endif + xfree(options); return pInt; error1: @@ -186,7 +315,8 @@ xfree(pInt->private); error0: xfree(pInt); - + xfree(options); + return NULL; } @@ -197,23 +327,24 @@ int pagesize = getpagesize(); int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize; - INTPriv(pInt)->vRam = xf86MapVidMem(screen,VIDMEM_MMIO,V_RAM,size); + INTPriv(pInt)->vRam = xf86MapVidMem(screen, VIDMEM_MMIO, V_RAM, size); } -static void +static void UnmapVRam(xf86Int10InfoPtr pInt) { int screen = pInt->scrnIndex; int pagesize = getpagesize(); int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize; - xf86UnMapVidMem(screen,INTPriv(pInt)->vRam,size); + xf86UnMapVidMem(screen, INTPriv(pInt)->vRam, size); } -void +Bool MapCurrentInt10(xf86Int10InfoPtr pInt) { - /* nothing to do here */ + /* nothing to do here */ + return TRUE; } void @@ -221,7 +352,7 @@ { if (!pInt) return; - if (Int10Current == pInt) + if (Int10Current == pInt) Int10Current = NULL; xfree(INTPriv(pInt)->base); UnmapVRam(pInt); @@ -231,83 +362,79 @@ } void * -xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off) +xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off) { int pagesize = getpagesize(); int num_pages = ALLOC_ENTRIES(pagesize); int i,j; - for (i=0;i<num_pages - num;i++) { + for (i = 0; i < (num_pages - num); i++) { if (INTPriv(pInt)->alloc[i] == 0) { - for (j=i;j < num + i;j++) + for (j = i; j < (num + i); j++) if (INTPriv(pInt)->alloc[j] != 0) break; - if (j == num + i) + if (j == (num + i)) break; - else - i = i + num; + i += num; } } - if (i == num_pages - num) + if (i == (num_pages - num)) return NULL; - - for (j = i; j < i + num; j++) + + for (j = i; j < (i + num); j++) INTPriv(pInt)->alloc[j] = 1; *off = (i + 1) * pagesize; - - return (void *) - ((char*)INTPriv(pInt)->base + (i + 1) * pagesize); + + return (char *)INTPriv(pInt)->base + *off; } void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) { int pagesize = getpagesize(); - int first = ((unsigned long)pbase - - (unsigned long)INTPriv(pInt)->base) - / pagesize - 1; + int first = (((char *)pbase - (char *)INTPriv(pInt)->base) / pagesize) - 1; int i; - for (i = first; i < first + num; i++) + for (i = first; i < (first + num); i++) INTPriv(pInt)->alloc[i] = 0; } #define OFF(addr) ((addr) & 0xffff) #define SYS(addr) ((addr) >= SYS_BIOS) #define V_ADDR(addr) \ - (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - SYS_BIOS) \ - : ((char*)(INTPriv(pInt)->base) + addr)) + (SYS(addr) ? ((char*)INTPriv(pInt)->sysMem) + (addr - SYS_BIOS) \ + : ((char*)(INTPriv(pInt)->base) + addr)) #define VRAM_ADDR(addr) (addr - V_RAM) #define VRAM_BASE (INTPriv(pInt)->vRam) #define VRAM(addr) ((addr >= V_RAM) && (addr < (V_RAM + VRAM_SIZE))) #define V_ADDR_RB(addr) \ - (VRAM(addr)) ? MMIO_IN8((CARD8*)VRAM_BASE,VRAM_ADDR(addr)) \ - : *(CARD8*) V_ADDR(addr) + (VRAM(addr)) ? MMIO_IN8((CARD8*)VRAM_BASE,VRAM_ADDR(addr)) \ + : *(CARD8*) V_ADDR(addr) #define V_ADDR_RW(addr) \ - (VRAM(addr)) ? MMIO_IN16((CARD16*)VRAM_BASE,VRAM_ADDR(addr)) \ - : ldw_u((pointer)V_ADDR(addr)) + (VRAM(addr)) ? MMIO_IN16((CARD16*)VRAM_BASE,VRAM_ADDR(addr)) \ + : ldw_u((pointer)V_ADDR(addr)) #define V_ADDR_RL(addr) \ - (VRAM(addr)) ? MMIO_IN32((CARD32*)VRAM_BASE,VRAM_ADDR(addr)) \ - : ldl_u((pointer)V_ADDR(addr)) + (VRAM(addr)) ? MMIO_IN32((CARD32*)VRAM_BASE,VRAM_ADDR(addr)) \ + : ldl_u((pointer)V_ADDR(addr)) #define V_ADDR_WB(addr,val) \ - if(VRAM(addr)) \ - MMIO_OUT8((CARD8*)VRAM_BASE,VRAM_ADDR(addr),val); \ - else \ - *(CARD8*) V_ADDR(addr) = val; + if(VRAM(addr)) \ + MMIO_OUT8((CARD8*)VRAM_BASE,VRAM_ADDR(addr),val); \ + else \ + *(CARD8*) V_ADDR(addr) = val; #define V_ADDR_WW(addr,val) \ - if(VRAM(addr)) \ - MMIO_OUT16((CARD16*)VRAM_BASE,VRAM_ADDR(addr),val); \ - else \ - stw_u((val),(pointer)(V_ADDR(addr))); + if(VRAM(addr)) \ + MMIO_OUT16((CARD16*)VRAM_BASE,VRAM_ADDR(addr),val); \ + else \ + stw_u((val),(pointer)(V_ADDR(addr))); #define V_ADDR_WL(addr,val) \ - if (VRAM(addr)) \ - MMIO_OUT32((CARD32*)VRAM_BASE,VRAM_ADDR(addr),val); \ - else \ - stl_u(val,(pointer)(V_ADDR(addr))); + if (VRAM(addr)) \ + MMIO_OUT32((CARD32*)VRAM_BASE,VRAM_ADDR(addr),val); \ + else \ + stl_u(val,(pointer)(V_ADDR(addr))); static CARD8 read_b(xf86Int10InfoPtr pInt, int addr) @@ -318,37 +445,24 @@ static CARD16 read_w(xf86Int10InfoPtr pInt, int addr) { -#if X_BYTE_ORDER == X_BIG_ENDIAN - return ((V_ADDR_RB(addr)) - || ((V_ADDR_RB(addr + 1)) << 8)); -#else - if (OFF(addr + 1) > 0) { +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + if (OFF(addr + 1) > 0) return V_ADDR_RW(addr); - } else - return ((V_ADDR_RB(addr + 1)) - || ((V_ADDR_RB(addr)) << 8)); - #endif + return V_ADDR_RB(addr) | (V_ADDR_RB(addr + 1) << 8); } static CARD32 read_l(xf86Int10InfoPtr pInt, int addr) { -#if X_BYTE_ORDER == X_BIG_ENDIAN - return ((V_ADDR_RB(addr)) - || ((V_ADDR_RB(addr + 1)) << 8) - || ((V_ADDR_RB(addr + 2)) << 16) - || ((V_ADDR_RB(addr + 3)) << 24)); -#else - if (OFF(addr + 3) > 2) { +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + if (OFF(addr + 3) > 2) return V_ADDR_RL(addr); - } else { - return ((V_ADDR_RB(addr + 3)) - || ((V_ADDR_RB(addr + 2)) << 8) - || ((V_ADDR_RB(addr + 1)) << 16) - || ((V_ADDR_RB(addr)) << 24)); - } #endif + return V_ADDR_RB(addr) | + (V_ADDR_RB(addr + 1) << 8) | + (V_ADDR_RB(addr + 2) << 16) | + (V_ADDR_RB(addr + 3) << 24); } static void @@ -360,49 +474,29 @@ static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val) { -#if X_BYTE_ORDER == X_BIG_ENDIAN - V_ADDR_WB(addr,val); - V_ADDR_WB(addr + 1,val >> 8); -#else - if (OFF(addr + 1) > 0) { - V_ADDR_WW(addr,val); - } else { - V_ADDR_WB(addr + 1,val); - V_ADDR_WB(addr,val >> 8); - } +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + if (OFF(addr + 1) > 0) + { V_ADDR_WW(addr, val); } #endif + V_ADDR_WB(addr, val); + V_ADDR_WB(addr + 1, val >> 8); } static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) { -#if X_BYTE_ORDER == X_BIG_ENDIAN - V_ADDR_WB(addr,val); +#if X_BYTE_ORDER == X_LITTLE_ENDIAN + if (OFF(addr + 3) > 2) + { V_ADDR_WL(addr, val); } +#endif + V_ADDR_WB(addr, val); V_ADDR_WB(addr + 1, val >> 8); V_ADDR_WB(addr + 2, val >> 16); V_ADDR_WB(addr + 3, val >> 24); -#else - if (OFF(addr + 3) > 2) { - V_ADDR_WL(addr,val); - } else { - V_ADDR_WB(addr + 3, val); - V_ADDR_WB(addr + 2, val >> 8); - V_ADDR_WB(addr + 1, val >> 16); - V_ADDR_WB(addr, val >> 24); - } -#endif } pointer xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr) { - return (pointer) V_ADDR(addr); + return V_ADDR(addr); } - - - - - - - - Index: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c diff -u xc/programs/Xserver/hw/xfree86/int10/helper_exec.c:1.11 xc/programs/Xserver/hw/xfree86/int10/helper_exec.c:1.16 --- xc/programs/Xserver/hw/xfree86/int10/helper_exec.c:1.11 Wed Dec 6 10:35:26 2000 +++ xc/programs/Xserver/hw/xfree86/int10/helper_exec.c Mon Apr 30 10:34:57 2001 @@ -1,12 +1,12 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.11 2000/12/06 15:35:26 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_exec.c,v 1.16 2001/04/30 14:34:57 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich * - * Part of this is based on code taken form DOSEMU + * Part of this is based on code taken from DOSEMU * (C) Copyright 1992, ..., 1999 the "DOSEMU-Development-Team" - */ + */ /* * To debug port accesses define PRINT_PORT. @@ -15,7 +15,6 @@ * on PIO. */ #include "xf86.h" -#include "xf86str.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" #include "compiler.h" @@ -35,7 +34,8 @@ setup_int(xf86Int10InfoPtr pInt) { if (pInt != Int10Current) { - MapCurrentInt10(pInt); + if (!MapCurrentInt10(pInt)) + return -1; Int10Current = pInt; } X86_EAX = (CARD32) pInt->ax; @@ -44,17 +44,15 @@ X86_EDX = (CARD32) pInt->dx; X86_ESI = (CARD32) pInt->si; X86_EDI = (CARD32) pInt->di; - X86_ES = (CARD32) pInt->es; X86_EBP = (CARD32) pInt->bp; - X86_EIP = 0; - X86_CS = 0x60; /* address of 'hlt' */ - X86_ESP = 0x100; - X86_SS = 0x30; /* This is the standard pc bios stack */ - X86_DS = 0x40; /* standard pc ds */ + X86_ESP = 0x1000; X86_SS = pInt->stackseg >> 4; + X86_EIP = 0x0600; X86_CS = 0x0; /* address of 'hlt' */ + X86_DS = 0x40; /* standard pc ds */ + X86_ES = pInt->es; X86_FS = 0; X86_GS = 0; - X86_EFLAGS = (X86_IF_MASK | X86_IOPL_MASK); - + X86_EFLAGS = X86_IF_MASK | X86_IOPL_MASK; + return xf86BlockSIGIO(); } @@ -68,188 +66,23 @@ pInt->dx = (CARD16) X86_EDX; pInt->si = (CARD16) X86_ESI; pInt->di = (CARD16) X86_EDI; + pInt->es = (CARD16) X86_ES; pInt->bp = (CARD16) X86_EBP; pInt->flags = (CARD16) X86_FLAGS; } -#define SEG_ADR(type, seg, reg) type((seg << 4) \ - + (X86_##reg)) -#define SEG_EADR(type, seg, reg) type((seg << 4) \ - + (X86_E##reg)) -#ifndef _X86EMU -/* get the linear address */ -#define LIN_PREF_SI ((pref_seg << 4) + X86_SI) -#define LWECX (prefix66 ^ prefix67 ? X86_ECX : X86_CX) -#define LWECX_ZERO {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;} -#define DF (1 << 10) - - -/* vm86 fault handling */ -Bool -vm86_GP_fault(xf86Int10InfoPtr pInt) -{ - unsigned char *csp, *lina; - CARD32 org_eip; - int pref_seg; - int done,is_rep,prefix66,prefix67; - - - csp = lina = SEG_ADR((unsigned char *), X86_CS, IP); - - is_rep = 0; - prefix66 = prefix67 = 0; - pref_seg = -1; - - /* eat up prefixes */ - done = 0; - do { - switch (MEM_RB(pInt,(int)csp++)) { - case 0x66: /* operand prefix */ prefix66=1; break; - case 0x67: /* address prefix */ prefix67=1; break; - case 0x2e: /* CS */ pref_seg=X86_CS; break; - case 0x3e: /* DS */ pref_seg=X86_DS; break; - case 0x26: /* ES */ pref_seg=X86_ES; break; - case 0x36: /* SS */ pref_seg=X86_SS; break; - case 0x65: /* GS */ pref_seg=X86_GS; break; - case 0x64: /* FS */ pref_seg=X86_FS; break; - case 0xf2: /* repnz */ - case 0xf3: /* rep */ is_rep=1; break; - default: done=1; - } - } while (!done); - csp--; /* oops one too many */ - org_eip = X86_EIP; - X86_IP += (csp - lina); - - switch (MEM_RB(pInt,(int)csp)) { - case 0x6c: /* insb */ - /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx - * but is anyone using extended regs in real mode? */ - /* WARNING: no test for DI wrapping! */ - X86_EDI += port_rep_inb(pInt,X86_DX,SEG_EADR((CARD32),X86_ES,DI), - X86_FLAGS & DF, (is_rep? LWECX:1)); - if (is_rep) LWECX_ZERO; - X86_IP++; - break; - - case 0x6d: /* (rep) insw / insd */ - /* NOTE: ES can't be overwritten */ - /* WARNING: no test for _DI wrapping! */ - if (prefix66) { - X86_DI += port_rep_inl(pInt,X86_DX,SEG_ADR((CARD32),X86_ES,DI), - X86_EFLAGS & DF, (is_rep? LWECX:1)); - } - else { - X86_DI += port_rep_inw(pInt,X86_DX,SEG_ADR((CARD32),X86_ES,DI), - X86_FLAGS & DF, (is_rep? LWECX:1)); - } - if (is_rep) LWECX_ZERO; - X86_IP++; - break; - - case 0x6e: /* (rep) outsb */ - if (pref_seg < 0) pref_seg = X86_DS; - /* WARNING: no test for _SI wrapping! */ - X86_SI += port_rep_outb(pInt,X86_DX,(CARD32)LIN_PREF_SI, X86_FLAGS&DF, - (is_rep? LWECX:1)); - if (is_rep) LWECX_ZERO; - X86_IP++; - break; - - case 0x6f: /* (rep) outsw / outsd */ - if (pref_seg < 0) pref_seg = X86_DS; - /* WARNING: no test for _SI wrapping! */ - if (prefix66) { - X86_SI += port_rep_outl(pInt,X86_DX,(CARD32)LIN_PREF_SI, - X86_EFLAGS&DF, (is_rep? LWECX:1)); - } - else { - X86_SI += port_rep_outw(pInt,X86_DX,(CARD32)LIN_PREF_SI, - X86_FLAGS & DF, (is_rep? LWECX:1)); - } - if (is_rep) LWECX_ZERO; - X86_IP++; - break; - - case 0xe5: /* inw xx, inl xx */ - if (prefix66) X86_EAX = p_inl((int) MEM_RB(pInt,(int)(csp+1))); - else X86_AX = p_inw((int) (int)(csp[1])); - X86_IP += 2; - break; - case 0xe4: /* inb xx */ - X86_AX &= ~(CARD32)0xff; - X86_AL |= p_inb((int) MEM_RB(pInt,(int)(csp+1))); - X86_IP += 2; - break; - case 0xed: /* inw dx, inl dx */ - if (prefix66) X86_EAX = p_inl(X86_EDX); - else X86_AX = p_inw(X86_DX); - X86_IP += 1; - break; - case 0xec: /* inb dx */ - X86_AX &= ~(CARD32)0xff; - X86_AL |= p_inb(X86_DX); - X86_IP += 1; - break; - - case 0xe7: /* outw xx */ - if (prefix66) p_outl((int)MEM_RB(pInt,(int)(csp+1)), X86_EAX); - else p_outw((int)MEM_RB(pInt,(int)(csp+1)), X86_AX); - X86_IP += 2; - break; - case 0xe6: /* outb xx */ - p_outb((int) MEM_RB(pInt,(int)(csp+1)), X86_AL); - X86_IP += 2; - break; - case 0xef: /* outw dx */ - if (prefix66) p_outl(X86_DX, X86_EAX); - else p_outw(X86_DX, X86_AX); - X86_IP += 1; - break; - case 0xee: /* outb dx */ - p_outb(X86_DX, X86_AL); - X86_IP += 1; - break; - - case 0xf4: -#ifdef DEBUG - ErrorF("hlt at %p\n", lina); -#endif - return FALSE; - - case 0x0f: - xf86DrvMsg(pInt->scrnIndex, - X_ERROR,"CPU 0x0f Trap at eip=0x%lx\n",X86_EIP); - goto op0ferr; - break; - - case 0xf0: /* lock */ - default: - xf86DrvMsg(pInt->scrnIndex,X_ERROR,"unknown reason for exception\n"); - dump_registers(pInt); - stack_trace(pInt); - - op0ferr: - dump_code(pInt); - xf86DrvMsg(pInt->scrnIndex,X_ERROR,"cannot continue\n"); - return FALSE; - } /* end of switch() */ - return TRUE; -} -#endif - /* general software interrupt handler */ CARD32 getIntVect(xf86Int10InfoPtr pInt,int num) { - return (MEM_RW(pInt,(num << 2)) + (MEM_RW(pInt,((num << 2) + 2)) << 4)); + return MEM_RW(pInt, num << 2) + (MEM_RW(pInt, (num << 2) + 2) << 4); } void pushw(xf86Int10InfoPtr pInt, CARD16 val) { X86_ESP -= 2; - MEM_WW(pInt,((CARD32) X86_SS << 4) + X86_SP,val); + MEM_WW(pInt, ((CARD32) X86_SS << 4) + X86_SP, val); } int @@ -258,11 +91,9 @@ CARD32 eflags; #ifndef _PC /* check if bios vector is initialized */ - if (MEM_RW(pInt,(num<<2)+2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ?*/ -#ifdef PRINT_INT - ErrorF("card BIOS not loaded\n"); -#endif - return 0; + if (MEM_RW(pInt, (num << 2) + 2) == (SYS_BIOS >> 4)) { /* SYS_BIOS_SEG ?*/ + ErrorF("Card BIOS on non-PC like platform not loaded\n"); + return 0; } #endif #ifdef PRINT_INT @@ -275,11 +106,11 @@ #endif pushw(pInt, eflags); pushw(pInt, X86_CS); - pushw(pInt, (CARD16)X86_EIP); - X86_CS = MEM_RW(pInt,((num << 2) + 2)); - X86_EIP = (X86_EIP & 0xFFFF0000) | MEM_RW(pInt,(num << 2)); + pushw(pInt, X86_IP); + X86_CS = MEM_RW(pInt, (num << 2) + 2); + X86_IP = MEM_RW(pInt, num << 2); #ifdef PRINT_INT - ErrorF("0x%x:%lx\n",X86_CS,X86_EIP); + ErrorF("0x%x:%lx\n", X86_CS, X86_EIP); #endif return 1; } @@ -291,52 +122,50 @@ int i; CARD32 lina = SEG_ADR((CARD32), X86_CS, IP); - ErrorF("code at 0x%8.8lx: ",lina); - for (i=0; i<0x10; i++) - ErrorF("%2.2x ",MEM_RB(pInt,lina + i)); - ErrorF("\n "); - for (; i<0x20; i++) - ErrorF("%2.2x ",MEM_RB(pInt,lina + i)); - ErrorF("\n"); + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, "code at 0x%8.8lx:\n", lina); + for (i=0; i<0x10; i++) + xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i)); + xf86ErrorFVerb(3, "\n"); + for (; i<0x20; i++) + xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, lina + i)); + xf86ErrorFVerb(3, "\n"); } -#define PRINT(x) ErrorF(#x":%4.4x ",x) -#define PRINT_FLAGS(x) ErrorF(#x":%8.8x ",x) void dump_registers(xf86Int10InfoPtr pInt) { - PRINT(X86_AX); - PRINT(X86_BX); - PRINT(X86_CX); - PRINT(X86_DX); - ErrorF("\n"); - PRINT(X86_IP); - PRINT(X86_SI); - PRINT(X86_DI); - PRINT(X86_BP); - PRINT(X86_SP); - ErrorF("\n"); - PRINT(X86_CS); - PRINT(X86_SS); - PRINT(X86_ES); - PRINT(X86_DS); - PRINT(X86_FS); - PRINT(X86_GS); - ErrorF("\n"); - PRINT_FLAGS(X86_EFLAGS); - ErrorF("\n"); + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + "EAX=0x%8.8x, EBX=0x%8.8x, ECX=0x%8.8x, EDX=0x%8.8x\n", + X86_EAX, X86_EBX, X86_ECX, X86_EDX); + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + "ESP=0x%8.8x, EBP=0x%8.8x, ESI=0x%8.8x, EDI=0x%8.8x\n", + X86_ESP, X86_EBP, X86_ESI, X86_EDI); + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + "CS=0x%4.4x, SS=0x%4.4x," + " DS=0x%4.4x, ES=0x%4.4x, FS=0x%4.4x, GS=0x%4.4x\n", + X86_CS, X86_SS, X86_DS, X86_ES, X86_FS, X86_GS); + xf86DrvMsgVerb(pInt->scrnIndex, X_INFO, 3, + "EIP=0x%8.8x, EFLAGS=0x%8.8x\n", X86_EIP, X86_EFLAGS); } void stack_trace(xf86Int10InfoPtr pInt) { - int i; - CARD32 stack = SEG_ADR((CARD32), X86_SS, SP); - - ErrorF("stack at 0x%8.8lx:\n",stack); - for (i=0; i < 0x10; i++) - ErrorF("%2.2x ",MEM_RB(pInt,stack + i)); - ErrorF("\n"); + int i = 0; + CARD32 stack = SEG_ADR((CARD32), X86_SS, SP); + CARD32 tail = (CARD32)((X86_SS << 4) + 0x1000); + + if (stack >= tail) return; + + xf86MsgVerb(X_INFO, 3, "stack at 0x%8.8lx:\n", stack); + for (; stack < tail; stack++) { + xf86ErrorFVerb(3, " %2.2x", MEM_RB(pInt, stack)); + i = (i + 1) % 0x10; + if (!i) + xf86ErrorFVerb(3, "\n"); + } + if (i) + xf86ErrorFVerb(3, "\n"); } int @@ -347,13 +176,13 @@ CARD32 dst = base; #ifdef PRINT_PORT ErrorF(" rep_insb(%#x) %d bytes at %p %s\n", - port, count, base, d_f?"up":"down"); + port, count, base, d_f ? "up" : "down"); #endif while (count--) { - MEM_WB(pInt,dst,inb(port)); + MEM_WB(pInt, dst, x_inb(port)); dst += inc; } - return (dst-base); + return dst - base; } int @@ -362,15 +191,15 @@ { register int inc = d_f ? -2 : 2; CARD32 dst = base; -#ifdef PRINT_PORT +#ifdef PRINT_PORT ErrorF(" rep_insw(%#x) %d bytes at %p %s\n", - port, count, base, d_f?"up":"down"); + port, count, base, d_f ? "up" : "down"); #endif while (count--) { - MEM_WW(pInt,dst,inw(port)); + MEM_WW(pInt, dst, x_inw(port)); dst += inc; } - return (dst-base); + return dst - base; } int @@ -379,15 +208,15 @@ { register int inc = d_f ? -4 : 4; CARD32 dst = base; -#ifdef PRINT_PORT +#ifdef PRINT_PORT ErrorF(" rep_insl(%#x) %d bytes at %p %s\n", - port, count, base, d_f?"up":"down"); + port, count, base, d_f ? "up" : "down"); #endif while (count--) { - MEM_WL(pInt,dst,inl(port)); + MEM_WL(pInt, dst, x_inl(port)); dst += inc; } - return (dst-base); + return dst - base; } int @@ -396,15 +225,15 @@ { register int inc = d_f ? -1 : 1; CARD32 dst = base; -#ifdef PRINT_PORT +#ifdef PRINT_PORT ErrorF(" rep_outb(%#x) %d bytes at %p %s\n", - port, count, base, d_f?"up":"down"); + port, count, base, d_f ? "up" : "down"); #endif while (count--) { - outb(port,MEM_RB(pInt,dst)); + x_outb(port, MEM_RB(pInt, dst)); dst += inc; } - return (dst-base); + return dst - base; } int @@ -413,15 +242,15 @@ { register int inc = d_f ? -2 : 2; CARD32 dst = base; -#ifdef PRINT_PORT +#ifdef PRINT_PORT ErrorF(" rep_outw(%#x) %d bytes at %p %s\n", - port, count, base, d_f?"up":"down"); + port, count, base, d_f ? "up" : "down"); #endif while (count--) { - outw(port,MEM_RW(pInt,dst)); + x_outw(port, MEM_RW(pInt, dst)); dst += inc; } - return (dst-base); + return dst - base; } int @@ -430,27 +259,45 @@ { register int inc = d_f ? -4 : 4; CARD32 dst = base; -#ifdef PRINT_PORT +#ifdef PRINT_PORT ErrorF(" rep_outl(%#x) %d bytes at %p %s\n", - port, count, base, d_f?"up":"down"); + port, count, base, d_f ? "up" : "down"); #endif while (count--) { - outl(port,MEM_RL(pInt,dst)); + x_outl(port, MEM_RL(pInt, dst)); dst += inc; } - return (dst-base); + return dst - base; } -#if defined(PRINT_PORT) || (!defined(_PC) && !defined(_PC_IO)) CARD8 x_inb(CARD16 port) { CARD8 val; - val = inb(port); -#ifdef PRINT_PORT - ErrorF(" inb(%#x) = %2.2x\n",port,val); + if (port == 0x40) { + Int10Current->inb40time++; + val = (CARD8)(Int10Current->inb40time >> + ((Int10Current->inb40time & 1) << 3)); +#ifdef PRINT_PORT + ErrorF(" inb(%#x) = %2.2x\n", port, val); +#endif +#ifdef __NOT_YET__ + } else if (port < 0x0100) { /* Don't interfere with mainboard */ + val = 0; + xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, + "inb 0x%4.4x\n", port); + if (xf86GetVerbosity() > 3) { + dump_registers(Int10Current); + stack_trace(Int10Current); + } +#endif /* __NOT_YET__ */ + } else { + val = inb(port); +#ifdef PRINT_PORT + ErrorF(" inb(%#x) = %2.2x\n", port, val); #endif + } return val; } @@ -459,9 +306,19 @@ { CARD16 val; - val = inw(port); -#ifdef PRINT_PORT - ErrorF(" inw(%#x) = %4.4x\n",port,val); + if (port == 0x5c) { + /* + * Emulate a PC98's timer. Typical resolution is 3.26 usec. + * Approximate this by dividing by 3. + */ + long sec, usec; + (void)getsecs(&sec, &usec); + val = (CARD16)(usec / 3); + } else { + val = inw(port); + } +#ifdef PRINT_PORT + ErrorF(" inw(%#x) = %4.4x\n", port, val); #endif return val; } @@ -469,19 +326,44 @@ void x_outb(CARD16 port, CARD8 val) { -#ifdef PRINT_PORT - ErrorF(" outb(%#x, %2.2x)\n",port,val); + if ((port == 0x43) && (val == 0)) { + /* + * Emulate a PC's timer 0. Such timers typically have a resolution of + * some .838 usec per tick, but this can only provide 1 usec per tick. + * (Not that this matters much, given inherent emulation delays.) Use + * the bottom bit as a byte select. See inb(0x40) above. + */ + long sec, usec; + (void) getsecs(&sec, &usec); + Int10Current->inb40time = (CARD16)(usec | 1); +#ifdef PRINT_PORT + ErrorF(" outb(%#x, %2.2x)\n", port, val); #endif - outb(port,val); +#ifdef __NOT_YET__ + } else if (port < 0x0100) { /* Don't interfere with mainboard */ + xf86DrvMsgVerb(Int10Current->scrnIndex, X_NOT_IMPLEMENTED, 2, + "outb 0x%4.4x,0x%2.2x\n", port, val); + if (xf86GetVerbosity() > 3) { + dump_registers(Int10Current); + stack_trace(Int10Current); + } +#endif /* __NOT_YET__ */ + } else { +#ifdef PRINT_PORT + ErrorF(" outb(%#x, %2.2x)\n", port, val); +#endif + outb(port, val); + } } void x_outw(CARD16 port, CARD16 val) { -#ifdef PRINT_PORT - ErrorF(" outw(%#x, %4.4x)\n",port,val); +#ifdef PRINT_PORT + ErrorF(" outw(%#x, %4.4x)\n", port, val); #endif - outw(port,val); + + outw(port, val); } CARD32 @@ -489,13 +371,13 @@ { CARD32 val; -#if !defined (_PC) && !defined (_PC_PCI) - if (!pciCfg1in(port,&val)) +#if !defined(_PC) && !defined(_PC_PCI) + if (!pciCfg1in(port, &val)) #endif val = inl(port); #ifdef PRINT_PORT - ErrorF(" inl(%#x) = %8.8x\n",port,val); + ErrorF(" inl(%#x) = %8.8x\n", port, val); #endif return val; } @@ -504,52 +386,52 @@ x_outl(CARD16 port, CARD32 val) { #ifdef PRINT_PORT - ErrorF(" outl(%#x, %8.8x)\n",port,val); + ErrorF(" outl(%#x, %8.8x)\n", port, val); #endif -#if !defined (_PC) && !defined (_PC_PCI) - if (!pciCfg1out(port,val)) + +#if !defined(_PC) && !defined(_PC_PCI) + if (!pciCfg1out(port, val)) #endif - outl(port,val); + outl(port, val); } -#endif CARD8 Mem_rb(int addr) { - return Int10Current->mem->rb(Int10Current,addr); + return (*Int10Current->mem->rb)(Int10Current, addr); } CARD16 Mem_rw(int addr) { - return Int10Current->mem->rw(Int10Current,addr); + return (*Int10Current->mem->rw)(Int10Current, addr); } CARD32 Mem_rl(int addr) { - return Int10Current->mem->rl(Int10Current,addr); + return (*Int10Current->mem->rl)(Int10Current, addr); } void -Mem_wb(int addr,CARD8 val) +Mem_wb(int addr, CARD8 val) { - Int10Current->mem->wb(Int10Current,addr,val); + (*Int10Current->mem->wb)(Int10Current, addr, val); } void -Mem_ww(int addr,CARD16 val) +Mem_ww(int addr, CARD16 val) { - Int10Current->mem->ww(Int10Current,addr,val); + (*Int10Current->mem->ww)(Int10Current, addr, val); } void -Mem_wl(int addr,CARD32 val) +Mem_wl(int addr, CARD32 val) { - Int10Current->mem->wl(Int10Current,addr,val); + (*Int10Current->mem->wl)(Int10Current, addr, val); } -#if !defined (_PC) && !defined (_PC_PCI) +#if !defined(_PC) && !defined(_PC_PCI) static CARD32 PciCfg1Addr = 0; #define TAG(Cfg1Addr) (Cfg1Addr & 0xffff00) @@ -562,7 +444,7 @@ *val = PciCfg1Addr; return 1; } - else if (addr == 0xCFC) { + if (addr == 0xCFC) { *val = pciReadLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr)); return 1; } @@ -576,7 +458,7 @@ PciCfg1Addr = val; return 1; } - else if (addr == 0xCFC) { + if (addr == 0xCFC) { pciWriteLong(TAG(PciCfg1Addr), OFFSET(PciCfg1Addr),val); return 1; } @@ -603,7 +485,7 @@ * disable registers before we call the BIOS initialization and * restore the original values afterwards. In beween we hold our * breath. To get to a (possibly exising) ISA card need to disable - * our current PCI card. + * our current PCI card. */ /* * This is just for booting: we just want to catch pure @@ -615,25 +497,25 @@ void LockLegacyVGA(int screenIndex,legacyVGAPtr vga) { - xf86SetCurrentAccess(FALSE,xf86Screens[screenIndex]); + xf86SetCurrentAccess(FALSE, xf86Screens[screenIndex]); vga->save_msr = inb(0x3CC); vga->save_vse = inb(0x3C3); vga->save_46e8 = inb(0x46e8); vga->save_pos102 = inb(0x102); - outb(0x3C2,~(CARD8)0x03 & vga->save_msr); - outb(0x3C3,~(CARD8)0x01 & vga->save_vse); + outb(0x3C2, ~(CARD8)0x03 & vga->save_msr); + outb(0x3C3, ~(CARD8)0x01 & vga->save_vse); outb(0x46e8, ~(CARD8)0x08 & vga->save_46e8); outb(0x102, ~(CARD8)0x01 & vga->save_pos102); - xf86SetCurrentAccess(TRUE,xf86Screens[screenIndex]); + xf86SetCurrentAccess(TRUE, xf86Screens[screenIndex]); } void UnlockLegacyVGA(int screenIndex, legacyVGAPtr vga) { - xf86SetCurrentAccess(FALSE,xf86Screens[screenIndex]); + xf86SetCurrentAccess(FALSE, xf86Screens[screenIndex]); outb(0x102, vga->save_pos102); outb(0x46e8, vga->save_46e8); outb(0x3C3, vga->save_vse); outb(0x3C2, vga->save_msr); - xf86SetCurrentAccess(TRUE,xf86Screens[screenIndex]); + xf86SetCurrentAccess(TRUE, xf86Screens[screenIndex]); } Index: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c diff -u xc/programs/Xserver/hw/xfree86/int10/helper_mem.c:1.14 xc/programs/Xserver/hw/xfree86/int10/helper_mem.c:1.20.2.1 --- xc/programs/Xserver/hw/xfree86/int10/helper_mem.c:1.14 Sat Dec 2 10:31:01 2000 +++ xc/programs/Xserver/hw/xfree86/int10/helper_mem.c Tue May 22 12:26:46 2001 @@ -1,11 +1,10 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.14 2000/12/02 15:31:01 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/helper_mem.c,v 1.20.2.1 2001/05/22 16:26:46 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment * Copyright 1999 Egbert Eich */ #include "xf86.h" -#include "xf86str.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" #include "compiler.h" @@ -17,18 +16,20 @@ #define REG pInt typedef enum { - OPT_NOINT10 + OPT_NOINT10, + OPT_INIT_PRIMARY, + OPT_BIOS_LOCATION } INT10Opts; -static OptionInfoRec INT10Options[] = { +static const OptionInfoRec INT10Options[] = { {OPT_NOINT10, "NoINT10", OPTV_BOOLEAN, {0}, FALSE }, + {OPT_INIT_PRIMARY, "InitPrimary", OPTV_BOOLEAN, {0}, FALSE }, + {OPT_BIOS_LOCATION, "BiosLocation", OPTV_STRING, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; -#define nINT10Options (sizeof(INT10Options) / sizeof(INT10Options[0])) - #ifdef DEBUG -void +void dprint(unsigned long start, unsigned long size) { int i,j; @@ -37,7 +38,7 @@ for (j = 0; j < (size >> 4); j++) { char *d = c; ErrorF("\n0x%lx: ",(unsigned long)c); - for (i = 0; i<16; i++) + for (i = 0; i<16; i++) ErrorF("%2.2x ",(unsigned char) (*(c++))); c = d; for (i = 0; i<16; i++) { @@ -50,7 +51,7 @@ } #endif - +#ifndef _PC /* * here we are really paranoid about faking a "real" * BIOS. Most of this information was pulled from @@ -59,66 +60,64 @@ void setup_int_vect(xf86Int10InfoPtr pInt) { - const CARD16 cs = (SYS_BIOS >> 4); - const CARD16 ip = 0x0; int i; - + /* let the int vects point to the SYS_BIOS seg */ - for (i=0; i<0x80; i++) { - MEM_WW(pInt,(i<<2),ip); - MEM_WW(pInt,((i<<2)+2),cs); + for (i = 0; i < 0x80; i++) { + MEM_WW(pInt, i << 2, 0); + MEM_WW(pInt, (i << 2) + 2, SYS_BIOS >> 4); } - /* video interrupts default location */ - MEM_WW(pInt,(0x42<<2),0xf065); - MEM_WW(pInt,(0x10<<2),0xf065); - MEM_WW(pInt,(0x6D<<2),0xf065); - /* video param table default location (int 1d) */ - MEM_WW(pInt,(0x1d<<2),0xf0A4); + + reset_int_vect(pInt); /* font tables default location (int 1F) */ - MEM_WW(pInt,(0x1f<<2),0xfa6e); + MEM_WW(pInt,0x1f<<2,0xfa6e); - /* int 11 default location */ - MEM_WW(pInt,(0x11<<2),0xf84d); - /* int 12 default location */ - MEM_WW(pInt,(0x12<<2),0xf841); - /* int 15 default location */ - MEM_WW(pInt,(0x15<<2),0xf859); - /* int 1A default location */ - MEM_WW(pInt,(0x1a<<2),0xff6e); - /* int 05 default location */ - MEM_WW(pInt,(0x05<<2),0xff54); - /* int 08 default location */ - MEM_WW(pInt,(0x08<<2),0xfea5); - /* int 13 default location (fdd) */ - MEM_WW(pInt,(0x13<<2),0xec59); - /* int 0E default location */ - MEM_WW(pInt,(0x0e<<2),0xef57); - /* int 17 default location */ - MEM_WW(pInt,(0x17<<2),0xefd2); + /* int 11 default location (Get Equipment Configuration) */ + MEM_WW(pInt, 0x11 << 2, 0xf84d); + /* int 12 default location (Get Conventional Memory Size) */ + MEM_WW(pInt, 0x12 << 2, 0xf841); + /* int 15 default location (I/O System Extensions) */ + MEM_WW(pInt, 0x15 << 2, 0xf859); + /* int 1A default location (RTC, PCI and others) */ + MEM_WW(pInt, 0x1a << 2, 0xff6e); + /* int 05 default location (Bound Exceeded) */ + MEM_WW(pInt, 0x05 << 2, 0xff54); + /* int 08 default location (Double Fault) */ + MEM_WW(pInt, 0x08 << 2, 0xfea5); + /* int 13 default location (Disk) */ + MEM_WW(pInt, 0x13 << 2, 0xec59); + /* int 0E default location (Page Fault) */ + MEM_WW(pInt, 0x0e << 2, 0xef57); + /* int 17 default location (Parallel Port) */ + MEM_WW(pInt, 0x17 << 2, 0xefd2); /* fdd table default location (int 1e) */ - MEM_WW(pInt,(0x1e<<2),0xefc7); + MEM_WW(pInt, 0x1e << 2, 0xefc7); + + /* Set Equipment flag to VGA */ + i = MEM_RB(pInt, 0x0410) & 0xCF; + MEM_WB(pInt, 0x0410, i); + /* XXX Perhaps setup more of the BDA here. See also int42(0x00). */ } +#endif int -setup_system_bios(memType base_addr) +setup_system_bios(void *base_addr) { - char *date = "06/01/99"; - char *eisa_ident = "PCI/ISA"; - CARD16 *base = (CARD16*) base_addr; - + char *base = (char *) base_addr; + /* * we trap the "industry standard entry points" to the BIOS * and all other locations by filling them with "hlt" * TODO: implement hlt-handler for these */ - memset((void *)(base),0xf4,0x10000); + memset(base, 0xf4, 0x10000); /* set bios date */ - strcpy((((char *)base) + 0xFFF5),date); + strcpy(base + 0x0FFF5, "06/11/99"); /* set up eisa ident string */ - strcpy((((char *)base) + 0xFFD9),eisa_ident); + strcpy(base + 0x0FFD9, "PCI_ISA"); /* write system model id for IBM-AT */ - *(((unsigned char *)base) + 0xFFFE) = 0xfc; + *((unsigned char *)(base + 0x0FFFE)) = 0xfc; return 1; } @@ -126,56 +125,119 @@ void reset_int_vect(xf86Int10InfoPtr pInt) { - MEM_WW(pInt,(0x10<<2),0xf065); - MEM_WW(pInt,((0x10<<2)+2),(SYS_BIOS >> 4)); - MEM_WW(pInt,(0x42<<2),0xf065); - MEM_WW(pInt,((0x42<<2)+2),(SYS_BIOS >> 4)); - MEM_WW(pInt,(0x6D<<2),0xf065); - MEM_WW(pInt,((0x6D<<2)+2),(SYS_BIOS >> 4)); - } + /* + * This table is normally located at 0xF000:0xF0A4. However, int 0x42, + * function 0 (Mode Set) expects it (or a copy) somewhere in the bottom + * 64kB. Note that because this data doesn't survive POST, int 0x42 should + * only be used during EGA/VGA BIOS initialisation. + */ + static const CARD8 VideoParms[] = { + /* Timing for modes 0x00 & 0x01 */ + 0x38, 0x28, 0x2d, 0x0a, 0x1f, 0x06, 0x19, 0x1c, + 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, + /* Timing for modes 0x02 & 0x03 */ + 0x71, 0x50, 0x5a, 0x0a, 0x1f, 0x06, 0x19, 0x1c, + 0x02, 0x07, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, + /* Timing for modes 0x04, 0x05 & 0x06 */ + 0x38, 0x28, 0x2d, 0x0a, 0x7f, 0x06, 0x64, 0x70, + 0x02, 0x01, 0x06, 0x07, 0x00, 0x00, 0x00, 0x00, + /* Timing for mode 0x07 */ + 0x61, 0x50, 0x52, 0x0f, 0x19, 0x06, 0x19, 0x19, + 0x02, 0x0d, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, + /* Display page lengths in little endian order */ + 0x00, 0x08, /* Modes 0x00 and 0x01 */ + 0x00, 0x10, /* Modes 0x02 and 0x03 */ + 0x00, 0x40, /* Modes 0x04 and 0x05 */ + 0x00, 0x40, /* Modes 0x06 and 0x07 */ + /* Number of columns for each mode */ + 40, 40, 80, 80, 40, 40, 80, 80, + /* CGA Mode register value for each mode */ + 0x2c, 0x28, 0x2d, 0x29, 0x2a, 0x2e, 0x1e, 0x29, + /* Padding */ + 0x00, 0x00, 0x00, 0x00 + }; + int i; + for (i = 0; i < sizeof(VideoParms); i++) + MEM_WB(pInt, i + (0x1000 - sizeof(VideoParms)), VideoParms[i]); + MEM_WW(pInt, 0x1d << 2, 0x1000 - sizeof(VideoParms)); + MEM_WW(pInt, (0x1d << 2) + 2, 0); + + MEM_WW(pInt, 0x10 << 2, 0xf065); + MEM_WW(pInt, (0x10 << 2) + 2, SYS_BIOS >> 4); + MEM_WW(pInt, 0x42 << 2, 0xf065); + MEM_WW(pInt, (0x42 << 2) + 2, SYS_BIOS >> 4); + MEM_WW(pInt, 0x6D << 2, 0xf065); + MEM_WW(pInt, (0x6D << 2) + 2, SYS_BIOS >> 4); +} + void set_return_trap(xf86Int10InfoPtr pInt) -{ +{ /* - * here we also set the exit condition: - * we return when we encounter 'hlt' (^=0xf4) this - * will be located at address 0x600 in x86 memory. + * Here we set the exit condition: We return when we encounter + * 'hlt' (=0xf4), which we locate at address 0x600 in x86 memory. */ - MEM_WB(pInt,0x600,0xf4); + MEM_WB(pInt, 0x0600, 0xf4); + + /* + * Allocate a segment for the stack + */ + xf86Int10AllocPages(pInt, 1, &pInt->stackseg); } -Bool -int10skip(ScrnInfoPtr pScrn, int entityIndex) +void * +xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex) { - Bool noint10 = FALSE; EntityInfoPtr pEnt = xf86GetEntityInfo(entityIndex); + OptionInfoPtr options = NULL; - if (pEnt->device && pEnt->device->options) { - OptionInfoRec options[nINT10Options]; + if (pEnt->device) { + pointer configOptions = NULL; - (void)memcpy(options, INT10Options, sizeof(INT10Options)); - xf86ProcessOptions(pScrn->scrnIndex, pEnt->device->options, options); - xf86GetOptValBool(options, OPT_NOINT10, &noint10); + /* Check if xf86CollectOptions() has already been called */ + if (((pEnt->index < 0) || + !xf86Screens[pEnt->index] || + !(configOptions = xf86Screens[pEnt->index]->options)) && + pEnt->device) + configOptions = pEnt->device->options; + + if (configOptions) { + if (!(options = (OptionInfoPtr) xalloc(sizeof(INT10Options)))) + return NULL; + + (void)memcpy(options, INT10Options, sizeof(INT10Options)); + xf86ProcessOptions(pScrn->scrnIndex, configOptions, options); + } } xfree(pEnt); - return noint10; + return options; } +Bool +int10skip(void* options) +{ + Bool noint10 = FALSE; + if (!options) return FALSE; + + xf86GetOptValBool(options, OPT_NOINT10, &noint10); + return noint10; +} + Bool int10_check_bios(int scrnIndex, int codeSeg, unsigned char* vbiosMem) { int size; if ((codeSeg & 0x1f) || /* Not 512-byte aligned otherwise */ - ((codeSeg << 4) < V_BIOS) || + ((codeSeg << 4) < V_BIOS) || ((codeSeg << 4) >= SYS_SIZE)) - return FALSE; + return FALSE; if (xf86IsPc98()) - return FALSE; + return FALSE; if ((*vbiosMem != 0x55) || (*(vbiosMem+1) != 0xAA) || !*(vbiosMem+2)) return FALSE; @@ -190,3 +252,72 @@ return TRUE; } + +Bool +initPrimary(void* options) +{ + Bool initPrimary = FALSE; + + if (!options) return FALSE; + + xf86GetOptValBool(options, OPT_INIT_PRIMARY, &initPrimary); + return initPrimary; +} + +void +xf86int10ParseBiosLocation(void* options, + xf86int10BiosLocationPtr bios) +{ + char *s; + char *p; + char *str = NULL; + + if (options) + str = xf86GetOptValString(options,OPT_BIOS_LOCATION); + + bios->bus = BUS_NONE; + if (!str) + return; + + s = xstrdup(str); + p = strtok(s,":"); + if (xf86NameCmp(p,"pci")) bios->bus = BUS_PCI; + else + if (xf86NameCmp(p,"primary")) bios->bus = BUS_ISA; + + xfree(s); + + if (bios->bus == BUS_NONE) return; + + s = xstrdup(str); + p = strchr(s, ':'); + + switch (bios->bus) { + case BUS_ISA: + if (p) + bios->location.legacy = atoi(++p); + else + bios->location.legacy = 0; + break; + case BUS_PCI: + if (p) { + bios->location.pci.bus = atoi(++p); + if ((p = strchr(p, ':'))) { + bios->location.pci.dev = atoi(++p); + if ((p = strchr(p, ':'))) { + bios->location.pci.func = atoi(++p); + break; + } + } + } + /* fall through */ + bios->bus = BUS_NONE; + break; + default: + break; + } + xfree(s); +} + + + Index: xc/programs/Xserver/hw/xfree86/int10/pci.c diff -u xc/programs/Xserver/hw/xfree86/int10/pci.c:1.5 xc/programs/Xserver/hw/xfree86/int10/pci.c:1.8.2.2 --- xc/programs/Xserver/hw/xfree86/int10/pci.c:1.5 Sat Dec 2 10:31:01 2000 +++ xc/programs/Xserver/hw/xfree86/int10/pci.c Fri May 25 14:15:46 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.5 2000/12/02 15:31:01 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/pci.c,v 1.8.2.2 2001/05/25 18:15:46 eich Exp $ */ /* * XFree86 int10 module @@ -7,21 +7,19 @@ */ #include "xf86Pci.h" #include "xf86.h" -#include "xf86str.h" #include "xf86_ansic.h" #define _INT10_PRIVATE #include "xf86int10.h" int -mapPciRom(xf86Int10InfoPtr pInt, unsigned char * address) +mapPciRom(int pciEntity, unsigned char * address) { PCITAG tag; - unsigned long offset = 0; unsigned char *mem, *ptr; - int length, rlength, blength; + int length; + + pciVideoPtr pvp = xf86GetPciInfoForEntity(pciEntity); - pciVideoPtr pvp = xf86GetPciInfoForEntity(pInt->entityIndex); - if (pvp == NULL) { #ifdef DEBUG ErrorF("mapPciRom: no PCI info\n"); @@ -30,25 +28,19 @@ } tag = pciTag(pvp->bus,pvp->device,pvp->func); - rlength = blength = 1 << pvp->biosSize; + length = 1 << pvp->biosSize; - /* Read in entire PCI ROM in 64kB chunks */ - mem = ptr = xnfcalloc(blength, 1); - while ((length = rlength) > 0) { - if (length > 0x10000) length = 0x10000; - if (xf86ReadPciBIOS(offset, tag, -1, ptr, length) < length) { - xfree(mem); + /* Read in entire PCI ROM */ + mem = ptr = xnfcalloc(length, 1); + if (xf86ReadPciBIOS(0, tag, -1, ptr, length) == 0) { + xfree(mem); #ifdef DEBUG - ErrorF("mapPciRom: cannot read BIOS\n"); + ErrorF("mapPciRom: cannot read BIOS\n"); #endif - return 0; - } - offset += length; - rlength -= length; - ptr += length; + return 0; } - ptr = mem; + length = 0; while ((ptr[0] == 0x55) && (ptr[1] == 0xAA)) { unsigned short data_off = ptr[0x18] | (ptr[0x19] << 8); unsigned char *data = ptr + data_off; @@ -63,10 +55,10 @@ #ifdef PRINT_PCI ErrorF("data segment in BIOS: 0x%x, type: 0x%x\n", data_off, type); #endif - if (type) { /* not PC-AT image: find next one */ + if (type) { /* not PC-AT image: find next one */ unsigned int image_length; unsigned char indicator = data[0x15]; - if (indicator & 0x80) /* last image */ + if (indicator & 0x80) /* last image */ break; image_length = (data[0x10] | (data[0x11] << 8)) << 9; #ifdef PRINT_PCI Index: xc/programs/Xserver/hw/xfree86/int10/stub.c diff -u xc/programs/Xserver/hw/xfree86/int10/stub.c:1.2 xc/programs/Xserver/hw/xfree86/int10/stub.c:1.3 --- xc/programs/Xserver/hw/xfree86/int10/stub.c:1.2 Fri Feb 11 22:39:57 2000 +++ xc/programs/Xserver/hw/xfree86/int10/stub.c Mon Apr 30 10:34:57 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/stub.c,v 1.2 2000/02/12 03:39:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/stub.c,v 1.3 2001/04/30 14:34:57 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -16,10 +16,10 @@ return NULL; } -void +Bool MapCurrentInt10(xf86Int10InfoPtr pInt) { - return; + return FALSE; } void Index: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c diff -u xc/programs/Xserver/hw/xfree86/int10/xf86int10.c:1.5 xc/programs/Xserver/hw/xfree86/int10/xf86int10.c:1.7 --- xc/programs/Xserver/hw/xfree86/int10/xf86int10.c:1.5 Tue Apr 4 15:25:18 2000 +++ xc/programs/Xserver/hw/xfree86/int10/xf86int10.c Sun Mar 25 00:32:13 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.5 2000/04/04 19:25:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.c,v 1.7 2001/03/25 05:32:13 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -6,7 +6,6 @@ */ #include "xf86.h" -#include "xf86str.h" #include "xf86_ansic.h" #include "compiler.h" #include "xf86Pci.h" @@ -14,10 +13,14 @@ #include "xf86int10.h" #include "int10Defines.h" +#define REG pInt + xf86Int10InfoPtr Int10Current = NULL; static int int1A_handler(xf86Int10InfoPtr pInt); +#ifndef _PC static int int42_handler(xf86Int10InfoPtr pInt); +#endif static int intE6_handler(xf86Int10InfoPtr pInt); static PCITAG findPci(unsigned short bx); static CARD32 pciSlotBX(pciVideoPtr pvp); @@ -26,88 +29,557 @@ int_handler(xf86Int10InfoPtr pInt) { int num = pInt->num; + int ret = 0; switch (num) { +#ifndef _PC case 0x10: case 0x42: - if (!(int42_handler(pInt))) - goto bios_handler; - else return 1; + case 0x6D: + if (getIntVect(pInt, num) == I_S_DEFAULT_INT_VECT) + ret = int42_handler(pInt); + break; +#endif case 0x1A: - if(!(int1A_handler(pInt))) - goto bios_handler; - else return 1; + ret = int1A_handler(pInt); + break; case 0xe6: - if (!(intE6_handler(pInt))) - goto bios_handler; - else return 1; + ret = intE6_handler(pInt); + break; default: - goto bios_handler; + break; } - bios_handler: - return run_bios_int(num,pInt); + + if (!ret) + ret = run_bios_int(num, pInt); + + if (!ret) { + xf86DrvMsg(pInt->scrnIndex, X_ERROR, + "Halting on int 0x%2.2x!\n", num); + dump_registers(pInt); + stack_trace(pInt); + } + + return ret; } +#ifndef _PC /* - * The system-BIOS provides int10 ax=1200 and ax=1201 functions - * before the video bios is installed. The int10_handler below - * provides these functions, too. However there have been cases - * in which disabling generic video has caused problems. Therefore - * it has been disabled by default. To reenable it do: - * #define DO_GENERIC_INT10 + * This is derived from a number of PC system BIOS'es. The intent here is to + * provide very primitive video support, before an EGA/VGA BIOS installs its + * own interrupt vector. Here, "Ignored" calls should remain so. "Not + * Implemented" denotes functionality that can be implemented should the need + * arise. What are "Not Implemented" throughout are video memory accesses. + * Also, very little input validity checking is done here. */ static int int42_handler(xf86Int10InfoPtr pInt) { -#define REG pInt -#ifdef DO_GENERIC_INT10 - unsigned char c; -#endif - int num = pInt->num; -#ifdef PRINT_INT - ErrorF("int 0x%x: ax:0x%x bx:0x%x cx:0x%x dx:0x%x\n",num, - X86_EAX,X86_EBX,X86_ECX,X86_EDX); -#endif - /* - * video bios has modified these - - * leave it to the video bios to do this - */ + switch (X86_AH) { + case 0x00: + /* Set Video Mode */ + /* Enter: AL = video mode number */ + /* Leave: Nothing */ + /* Implemented (except for clearing the screen) */ + { /* Localise */ + int i; + CARD16 ioport, int1d, regvals, tmp; + CARD8 mode, cgamode, cgacolour; + + /* + * Ignore all mode numbers but 0x00-0x13. Some systems also ignore + * 0x0B and 0x0C, but don't do that here. + */ + if (X86_AL > 0x13) + break; + + /* + * You didn't think that was really the mode set, did you? There + * are only so many slots in the video parameter table... + */ + mode = X86_AL; + ioport = 0x03D4; + switch (MEM_RB(pInt, 0x0410) & 0x30) { + case 0x30: /* MDA */ + mode = 0x07; /* Force mode to 0x07 */ + ioport = 0x03B4; + break; + case 0x10: /* CGA 40x25 */ + if (mode >= 0x07) + mode = 0x01; + break; + case 0x20: /* CGA 80x25 (MCGA?) */ + if (mode >= 0x07) + mode = 0x03; + break; + case 0x00: /* EGA/VGA */ + if (mode >= 0x07) /* Don't try MDA timings */ + mode = 0x01; /* !?!?! */ + break; + } + + /* Locate data in video parameter table */ + int1d = MEM_RW(pInt, 0x1d << 2); + regvals = ((mode >> 1) << 4) + int1d; + cgacolour = 0x30; + if (mode == 0x06) { + regvals -= 0x10; + cgacolour = 0x3F; + } + + /** Update BIOS Data Area **/ + + /* Video mode */ + MEM_WB(pInt, 0x0449, mode); + + /* Columns */ + tmp = MEM_RB(pInt, mode + int1d + 0x48); + MEM_WW(pInt, 0x044A, tmp); + + /* Page length */ + tmp = MEM_RW(pInt, (mode & 0x06) + int1d + 0x40); + MEM_WW(pInt, 0x044C, tmp); + + /* Start Address */ + MEM_WW(pInt, 0x044E, 0); + + /* Cursor positions, one for each display page */ + for (i = 0x0450; i < 0x0460; i += 2) + MEM_WW(pInt, i, 0); + + /* Cursor start & end scanlines */ + tmp = MEM_RB(pInt, regvals + 0x0B); + MEM_WB(pInt, 0x0460, tmp); + tmp = MEM_RB(pInt, regvals + 0x0A); + MEM_WB(pInt, 0x0461, tmp); + + /* Current display page number */ + MEM_WB(pInt, 0x0462, 0); + + /* CRTC I/O address */ + MEM_WW(pInt, 0x0463, ioport); + + /* CGA Mode register value */ + cgamode = MEM_RB(pInt, mode + int1d + 0x50); + MEM_WB(pInt, 0x0465, cgamode); + + /* CGA Colour register value */ + MEM_WB(pInt, 0x0466, cgacolour); + + /* Rows */ + MEM_WB(pInt, 0x0484, (25 - 1)); + + /* Programme the mode */ + outb(ioport + 4, cgamode & 0x37); /* Turn off screen */ + for (i = 0; i < 0x10; i++) { + tmp = MEM_RB(pInt, regvals + i); + outb(ioport, i); + outb(ioport + 1, tmp); + } + outb(ioport + 5, cgacolour); /* Select colour mode */ + outb(ioport + 4, cgamode); /* Turn on screen */ + } + break; + + case 0x01: + /* Set Cursor Type */ + /* Enter: CH = starting line for cursor */ + /* CL = ending line for cursor */ + /* Leave: Nothing */ + /* Implemented */ + { /* Localise */ + CARD16 ioport = MEM_RW(pInt, 0x0463); + + MEM_WB(pInt, 0x0460, X86_CL); + MEM_WB(pInt, 0x0461, X86_CH); + + outb(ioport, 0x0A); + outb(ioport + 1, X86_CH); + outb(ioport, 0x0B); + outb(ioport + 1, X86_CL); + } + break; + + case 0x02: + /* Set Cursor Position */ + /* Enter: BH = display page number */ + /* DH = row */ + /* DL = column */ + /* Leave: Nothing */ + /* Implemented */ + { /* Localise */ + CARD16 offset, ioport; + + MEM_WB(pInt, (X86_BH << 1) + 0x0450, X86_DL); + MEM_WB(pInt, (X86_BH << 1) + 0x0451, X86_DH); + + if (X86_BH != MEM_RB(pInt, 0x0462)) + break; + + offset = (X86_DH * MEM_RW(pInt, 0x044A)) + X86_DL; + offset += MEM_RW(pInt, 0x044E) << 1; + + ioport = MEM_RW(pInt, 0x0463); + outb(ioport, 0x0E); + outb(ioport + 1, offset >> 8); + outb(ioport, 0x0F); + outb(ioport + 1, offset & 0xFF); + } + break; + + case 0x03: + /* Get Cursor Position */ + /* Enter: BH = display page number */ + /* Leave: CH = starting line for cursor */ + /* CL = ending line for cursor */ + /* DH = row */ + /* DL = column */ + /* Implemented */ + { /* Localise */ + X86_CL = MEM_RB(pInt, 0x0460); + X86_CH = MEM_RB(pInt, 0x0461); + X86_DL = MEM_RB(pInt, (X86_BH << 1) + 0x0450); + X86_DH = MEM_RB(pInt, (X86_BH << 1) + 0x0451); + } + break; + + case 0x04: + /* Get Light Pen Position */ + /* Enter: Nothing */ + /* Leave: AH = 0x01 (down/triggered) or 0x00 (not) */ + /* BX = pixel column */ + /* CX = pixel row */ + /* DH = character row */ + /* DL = character column */ + /* Not Implemented */ + { /* Localise */ + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "int 0x%2.2x(AH=0x04) -- Get Light Pen Position\n", pInt->num); + if (xf86GetVerbosity() > 3) { + dump_registers(pInt); + stack_trace(pInt); + } + X86_AH = X86_BX = X86_CX = X86_DX = 0; + } + break; + + case 0x05: + /* Set Display Page */ + /* Enter: AL = display page number */ + /* Leave: Nothing */ + /* Implemented */ + { /* Localise */ + CARD16 start, ioport = MEM_RW(pInt, 0x0463); + CARD8 x, y; + + /* Calculate new start address */ + MEM_WB(pInt, 0x0462, X86_AL); + start = X86_AL * MEM_RW(pInt, 0x044C); + MEM_WW(pInt, 0x044E, start); + start <<= 1; + + /* Update start address */ + outb(ioport, 0x0C); + outb(ioport + 1, start >> 8); + outb(ioport, 0x0D); + outb(ioport + 1, start & 0xFF); + + /* Switch cursor position */ + y = MEM_RB(pInt, (X86_AL << 1) + 0x0450); + x = MEM_RB(pInt, (X86_AL << 1) + 0x0451); + start += (y * MEM_RW(pInt, 0x044A)) + x; + + /* Update cursor position */ + outb(ioport, 0x0E); + outb(ioport + 1, start >> 8); + outb(ioport, 0x0F); + outb(ioport + 1, start & 0xFF); + } + break; + + case 0x06: + /* Initialise or Scroll Window Up */ + /* Enter: AL = lines to scroll up */ + /* BH = attribute for blank */ + /* CH = upper y of window */ + /* CL = left x of window */ + /* DH = lower y of window */ + /* DL = right x of window */ + /* Leave: Nothing */ + /* Not Implemented */ + { /* Localise */ + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "int 0x%2.2x(AH=0x06) -- Initialise or Scroll Window Up\n", + pInt->num); + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + " AL=0x%2.2x, BH=0x%2.2x," + " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n", + X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL); + if (xf86GetVerbosity() > 3) { + dump_registers(pInt); + stack_trace(pInt); + } + } + break; + + case 0x07: + /* Initialise or Scroll Window Down */ + /* Enter: AL = lines to scroll down */ + /* BH = attribute for blank */ + /* CH = upper y of window */ + /* CL = left x of window */ + /* DH = lower y of window */ + /* DL = right x of window */ + /* Leave: Nothing */ + /* Not Implemented */ + { /* Localise */ + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "int 0x%2.2x(AH=0x07) -- Initialise or Scroll Window Down\n", + pInt->num); + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + " AL=0x%2.2x, BH=0x%2.2x," + " CH=0x%2.2x, CL=0x%2.2x, DH=0x%2.2x, DL=0x%2.2x\n", + X86_AL, X86_BH, X86_CH, X86_CL, X86_DH, X86_DL); + if (xf86GetVerbosity() > 3) { + dump_registers(pInt); + stack_trace(pInt); + } + } + break; + + case 0x08: + /* Read Character and Attribute at Cursor */ + /* Enter: BH = display page number */ + /* Leave: AH = attribute */ + /* AL = character */ + /* Not Implemented */ + { /* Localise */ + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "int 0x%2.2x(AH=0x08) -- Read Character and Attribute at" + " Cursor\n", pInt->num); + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + "BH=0x%2.2x\n", X86_BH); + if (xf86GetVerbosity() > 3) { + dump_registers(pInt); + stack_trace(pInt); + } + X86_AX = 0; + } + break; + + case 0x09: + /* Write Character and Attribute at Cursor */ + /* Enter: AL = character */ + /* BH = display page number */ + /* BL = attribute (text) or colour (graphics) */ + /* CX = replication count */ + /* Leave: Nothing */ + /* Not Implemented */ + { /* Localise */ + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "int 0x%2.2x(AH=0x09) -- Write Character and Attribute at" + " Cursor\n", pInt->num); + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n", + X86_AL, X86_BH, X86_BL, X86_CX); + if (xf86GetVerbosity() > 3) { + dump_registers(pInt); + stack_trace(pInt); + } + } + break; + + case 0x0a: + /* Write Character at Cursor */ + /* Enter: AL = character */ + /* BH = display page number */ + /* BL = colour */ + /* CX = replication count */ + /* Leave: Nothing */ + /* Not Implemented */ + { /* Localise */ + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "int 0x%2.2x(AH=0x0A) -- Write Character at Cursor\n", + pInt->num); + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x\n", + X86_AL, X86_BH, X86_BL, X86_CX); + if (xf86GetVerbosity() > 3) { + dump_registers(pInt); + stack_trace(pInt); + } + } + break; + + case 0x0b: + /* Set Palette, Background or Border */ + /* Enter: BH = 0x00 or 0x01 */ + /* BL = colour or palette (respectively) */ + /* Leave: Nothing */ + /* Implemented */ + { /* Localise */ + CARD16 ioport = MEM_RW(pInt, 0x0463) + 5; + CARD8 cgacolour = MEM_RB(pInt, 0x0466); + + if (X86_BH) { + cgacolour &= 0xDF; + cgacolour |= (X86_BL & 0x01) << 5; + } else { + cgacolour &= 0xE0; + cgacolour |= X86_BL & 0x1F; + } + + MEM_WB(pInt, 0x0466, cgacolour); + outb(ioport, cgacolour); + } + break; + + case 0x0c: + /* Write Graphics Pixel */ + /* Enter: AL = pixel value */ + /* BH = display page number */ + /* CX = column */ + /* DX = row */ + /* Leave: Nothing */ + /* Not Implemented */ + { /* Localise */ + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "int 0x%2.2x(AH=0x0C) -- Write Graphics Pixel\n", pInt->num); + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + "AL=0x%2.2x, BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", + X86_AL, X86_BH, X86_CX, X86_DX); + if (xf86GetVerbosity() > 3) { + dump_registers(pInt); + stack_trace(pInt); + } + } + break; + + case 0x0d: + /* Read Graphics Pixel */ + /* Enter: BH = display page number */ + /* CX = column */ + /* DX = row */ + /* Leave: AL = pixel value */ + /* Not Implemented */ + { /* Localise */ + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "int 0x%2.2x(AH=0x0D) -- Read Graphics Pixel\n", pInt->num); + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + "BH=0x%2.2x, CX=0x%4.4x, DX=0x%4.4x\n", + X86_BH, X86_CX, X86_DX); + if (xf86GetVerbosity() > 3) { + dump_registers(pInt); + stack_trace(pInt); + } + X86_AL = 0; + } + break; + + case 0x0e: + /* Write Character in Teletype Mode */ + /* Enter: AL = character */ + /* BH = display page number */ + /* BL = foreground colour */ + /* Leave: Nothing */ + /* Not Implemented */ + /* WARNING: Emulation of BEL characters will require */ + /* emulation of RTC and PC speaker I/O. */ + /* Also, this recurses through int 0x10 */ + /* which might or might not have been */ + /* installed yet. */ + { /* Localise */ + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "int 0x%2.2x(AH=0x0E) -- Write Character in Teletype Mode\n", + pInt->num); + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + "AL=0x%2.2x, BH=0x%2.2x, BL=0x%2.2x\n", + X86_AL, X86_BH, X86_BL); + if (xf86GetVerbosity() > 3) { + dump_registers(pInt); + stack_trace(pInt); + } + } + break; + + case 0x0f: + /* Get Video Mode */ + /* Enter: Nothing */ + /* Leave: AH = number of columns */ + /* AL = video mode number */ + /* BH = display page number */ + /* Implemented */ + { /* Localise */ + X86_AH = MEM_RW(pInt, 0x044A); + X86_AL = MEM_RB(pInt, 0x0449); + X86_BH = MEM_RB(pInt, 0x0462); + } + break; - if (getIntVect(pInt,num) != I_S_DEFAULT_INT_VECT) { - return 0; - } - - if ((X86_EBX & 0xff) == 0x32) { - switch (X86_EAX & 0xFFFF) { - case 0x1200: -#ifdef PRINT_INT - ErrorF("enabling video\n"); -#endif -#ifdef DO_GENERIC_INT10 - c = inb(0x3cc); - c |= 0x02; - outb(0x3c2,c); -#endif - return 1; - case 0x1201: -#ifdef PRINT_INT - ErrorF("disabling video\n"); -#endif -#ifdef DO_GENERIC_INT10 - c = inb(0x3cc); - c &= ~0x02; - outb(0x3c2,c); -#endif - return 1; - default: - break; + case 0x10: + /* Colour Control (subfunction in AL) */ + /* Enter: Various */ + /* Leave: Various */ + /* Ignored */ + break; + + case 0x11: + /* Font Control (subfunction in AL) */ + /* Enter: Various */ + /* Leave: Various */ + /* Ignored */ + break; + + case 0x12: + /* Miscellaneous (subfunction in BL) */ + /* Enter: Various */ + /* Leave: Various */ + /* Ignored. Previous code here optionally allowed */ + /* the enabling and disabling of VGA, but no system */ + /* BIOS I've come across actually implements it. */ + break; + + case 0x13: + /* Write String in Teletype Mode */ + /* Enter: AL = write mode */ + /* BL = attribute (if (AL & 0x02) == 0) */ + /* CX = string length */ + /* DH = row */ + /* DL = column */ + /* ES:BP = string segment:offset */ + /* Leave: Nothing */ + /* Not Implemented */ + /* WARNING: Emulation of BEL characters will require */ + /* emulation of RTC and PC speaker I/O. */ + /* Also, this recurses through int 0x10 */ + /* which might or might not have been */ + /* installed yet. */ + { /* Localise */ + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "int 0x%2.2x(AH=0x13) -- Write String in Teletype Mode\n", + pInt->num); + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 3, + "AL=0x%2.2x, BL=0x%2.2x, CX=0x%4.4x," + " DH=0x%2.2x, DL=0x%2.2x, ES:BP=0x%4.4x:0x%4.4x\n", + X86_AL, X86_BL, X86_CX, X86_DH, X86_DL, X86_ES, X86_BP); + if (xf86GetVerbosity() > 3) { + dump_registers(pInt); + stack_trace(pInt); + } } + break; + + default: + /* Various extensions */ + /* Enter: Various */ + /* Leave: Various */ + /* Ignored */ + break; } - if (num == 0x42) - return 1; - else - return 0; + + return 1; } +#endif #define SUCCESSFUL 0x00 #define DEVICE_NOT_FOUND 0x86 @@ -118,164 +590,159 @@ { PCITAG tag; pciVideoPtr pvp; - - if (! (pvp = xf86GetPciInfoForEntity(pInt->entityIndex))) + + if (!(pvp = xf86GetPciInfoForEntity(pInt->entityIndex))) return 0; /* oops */ #ifdef PRINT_INT ErrorF("int 0x1a: ax=0x%x bx=0x%x cx=0x%x dx=0x%x di=0x%x es=0x%x\n", - X86_EAX,X86_EBX,X86_ECX,X86_EDX,X86_EDI,X86_ESI); + X86_EAX, X86_EBX, X86_ECX, X86_EDX, X86_EDI, X86_ESI); #endif - switch (X86_EAX & 0xFFFF) { + switch (X86_AX) { case 0xb101: - X86_EAX &= 0xFF00; /* no config space/special cycle support */ + X86_EAX &= 0xFF00; /* no config space/special cycle support */ X86_EDX = 0x20494350; /* " ICP" */ - X86_EBX = 0x0210; /* Version 2.10 */ - X86_ECX &= 0xFF00; + X86_EBX = 0x0210; /* Version 2.10 */ + X86_ECX &= 0xFF00; X86_ECX |= (pciNumBuses & 0xFF); /* Max bus number in system */ X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ #ifdef PRINT_INT ErrorF("ax=0x%x dx=0x%x bx=0x%x cx=0x%x flags=0x%x\n", - X86_EAX,X86_EDX,X86_EBX,X86_ECX,X86_EFLAGS); + X86_EAX, X86_EDX, X86_EBX, X86_ECX, X86_EFLAGS); #endif return 1; case 0xb102: - if ((X86_EDX & 0xFFFF) == pvp->vendor && - (X86_ECX & 0xFFFF) ==pvp->chipType && - X86_ESI == 0) { - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); + if (X86_DX == pvp->vendor && X86_CX == pvp->chipType && X86_ESI == 0) { + X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ - X86_EBX = pciSlotBX(pvp); + X86_EBX = pciSlotBX(pvp); } #ifdef SHOW_ALL_DEVICES - else if ((pvp = xf86FindPciDeviceVendor(X86_EDX,X86_ECX,X86_ESI,pvp)) - != NULL) { - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); + else + if ((pvp = xf86FindPciDeviceVendor(X86_EDX, X86_ECX, X86_ESI, pvp))) { + X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ X86_EBX = pciSlotBX(pvp); } #endif else { - X86_EAX = (X86_EAX & 0x00FF) | (DEVICE_NOT_FOUND << 8); + X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8); X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ } #ifdef PRINT_INT - ErrorF("ax=0x%x bx=0x%x flags=0x%x\n", - X86_EAX,X86_EBX,X86_EFLAGS); + ErrorF("ax=0x%x bx=0x%x flags=0x%x\n", X86_EAX, X86_EBX, X86_EFLAGS); #endif return 1; case 0xb103: - if ((X86_ECX & 0xFF) == pvp->interface && - ((X86_ECX & 0xFF00) >> 8) == pvp->subclass && + if (X86_CL == pvp->interface && + X86_CH == pvp->subclass && ((X86_ECX & 0xFFFF0000) >> 16) == pvp->class) { - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); + X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EBX = pciSlotBX(pvp); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } #ifdef SHOW_ALL_DEVICES - else if ((pvp = xf86FindPciClass(X86_ECX & 0xFF, - (X86_ECX & 0xff00) >> 8, + else if ((pvp = xf86FindPciClass(X86_CL, X86_CH, (X86_ECX & 0xffff0000) >> 16, - X86_ESI,pvp))!= NULL) { - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); + X86_ESI, pvp))) { + X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ X86_EBX = pciSlotBX(pvp); } #endif else { - X86_EAX = (X86_EAX & 0x00FF) | (DEVICE_NOT_FOUND << 8); + X86_EAX = X86_AL | (DEVICE_NOT_FOUND << 8); X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ } #ifdef PRINT_INT - ErrorF("ax=0x%x flags=0x%x\n",X86_EAX,X86_EFLAGS); + ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS); #endif return 1; case 0xb108: if ((tag = findPci(X86_EBX))) { - X86_ECX &= 0xFFFFFF00; - X86_ECX |= pciReadByte(tag,X86_EDI); - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); + X86_CL = pciReadByte(tag, X86_EDI); + X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } else { - X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8); + X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ } #ifdef PRINT_INT - ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", - X86_EAX,X86_ECX,X86_EFLAGS); + ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS); #endif return 1; case 0xb109: if ((tag = findPci(X86_EBX))) { - X86_ECX &= 0xFFFF0000; - X86_ECX |= pciReadWord(tag,X86_EDI); - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); + X86_CX = pciReadWord(tag, X86_EDI); + X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } else { - X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8); + X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ } #ifdef PRINT_INT - ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", - X86_EAX,X86_ECX,X86_EFLAGS); + ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS); #endif return 1; case 0xb10a: if ((tag = findPci(X86_EBX))) { - X86_ECX &= 0; - X86_ECX |= pciReadLong(tag, X86_EDI); - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); + X86_ECX = pciReadLong(tag, X86_EDI); + X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } else { - X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8); + X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ } #ifdef PRINT_INT - ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", - X86_EAX,X86_ECX,X86_EFLAGS); + ErrorF("ax=0x%x cx=0x%x flags=0x%x\n", X86_EAX, X86_ECX, X86_EFLAGS); #endif return 1; case 0xb10b: if ((tag = findPci(X86_EBX))) { - pciWriteByte(tag,X86_EDI,(CARD8)X86_ECX); - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); + pciWriteByte(tag, X86_EDI, X86_CL); + X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } else { - X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8); + X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ } #ifdef PRINT_INT - ErrorF("ax=0x%x flags=0x%x\n", X86_EAX,X86_EFLAGS); + ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS); #endif return 1; case 0xb10c: if ((tag = findPci(X86_EBX))) { - pciWriteWord(tag,X86_EDI,(CARD16)X86_ECX); - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); + pciWriteWord(tag, X86_EDI, X86_CX); + X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } else { - X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8); + X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ } #ifdef PRINT_INT - ErrorF("ax=0x%x flags=0x%x\n", X86_EAX,X86_EFLAGS); + ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS); #endif return 1; case 0xb10d: if ((tag = findPci(X86_EBX))) { - pciWriteLong(tag,X86_EDI,(CARD32)X86_ECX); - X86_EAX = (X86_EAX & 0x00FF) | (SUCCESSFUL << 8); + pciWriteLong(tag, X86_EDI, X86_ECX); + X86_EAX = X86_AL | (SUCCESSFUL << 8); X86_EFLAGS &= ~((unsigned long)0x01); /* clear carry flag */ } else { - X86_EAX = (X86_EAX & 0x00FF) | (BAD_REGISTER_NUMBER << 8); + X86_EAX = X86_AL | (BAD_REGISTER_NUMBER << 8); X86_EFLAGS |= ((unsigned long)0x01); /* set carry flag */ } #ifdef PRINT_INT - ErrorF("ax=0x%x flags=0x%x\n", X86_EAX,X86_EFLAGS); + ErrorF("ax=0x%x flags=0x%x\n", X86_EAX, X86_EFLAGS); #endif return 1; default: - return 0; + xf86DrvMsgVerb(pInt->scrnIndex, X_NOT_IMPLEMENTED, 2, + "int 0x1a subfunction\n"); + dump_registers(pInt); + if (xf86GetVerbosity() > 3) + stack_trace(pInt); + return 1; } } @@ -285,15 +752,15 @@ int bus = (bx >> 8) & 0xFF; int dev = (bx >> 3) & 0x1F; int func = bx & 0x7; - if (xf86IsPciDevPresent(bus,dev,func)) - return pciTag(bus,dev,func); + if (xf86IsPciDevPresent(bus, dev, func)) + return pciTag(bus, dev, func); return 0; } static CARD32 pciSlotBX(pciVideoPtr pvp) { - return ((pvp->bus << 8) | (pvp->device << 3) | (pvp->func)); + return (pvp->bus << 8) | (pvp->device << 3) | (pvp->func); } /* @@ -304,12 +771,10 @@ { pciVideoPtr pvp; - if ((pvp = xf86GetPciInfoForEntity(pInt->entityIndex))) { - X86_AX = (CARD16)(((pvp->bus) << 8) - | (pvp->device << 3) | (pvp->func & 0x7)); - } - pushw(pInt,X86_CS); - pushw(pInt,(CARD16)X86_EIP); + if ((pvp = xf86GetPciInfoForEntity(pInt->entityIndex))) + X86_AX = (pvp->bus << 8) | (pvp->device << 3) | (pvp->func & 0x7); + pushw(pInt, X86_CS); + pushw(pInt, X86_IP); X86_CS = pInt->BIOSseg; X86_EIP = 0x0003; X86_ES = 0; /* standard pc es */ Index: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h diff -u xc/programs/Xserver/hw/xfree86/int10/xf86int10.h:1.15 xc/programs/Xserver/hw/xfree86/int10/xf86int10.h:1.21 --- xc/programs/Xserver/hw/xfree86/int10/xf86int10.h:1.15 Wed Dec 6 13:08:55 2000 +++ xc/programs/Xserver/hw/xfree86/int10/xf86int10.h Tue May 15 06:19:41 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.15 2000/12/06 18:08:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86int10.h,v 1.21 2001/05/15 10:19:41 eich Exp $ */ /* * XFree86 int10 module @@ -12,15 +12,16 @@ #include "Xmd.h" #include "Xdefs.h" -#define SEG_ADDR(x) ((x>>4) & 0xF000) -#define SEG_OFF(x) (x & 0xFFFF) +#define SEG_ADDR(x) (((x) >> 4) & 0x00F000) +#define SEG_OFF(x) ((x) & 0x0FFFF) /* int10 info structure */ -typedef struct { +typedef struct { int entityIndex; int scrnIndex; pointer cpuRegs; CARD16 BIOSseg; + CARD16 inb40time; pointer private; struct _int10Mem* mem; int num; @@ -33,15 +34,16 @@ int es; int bp; int flags; - } xf86Int10InfoRec, *xf86Int10InfoPtr; + int stackseg; +} xf86Int10InfoRec, *xf86Int10InfoPtr; typedef struct _int10Mem { - CARD8(*rb)(xf86Int10InfoPtr,int); - CARD16(*rw)(xf86Int10InfoPtr,int); - CARD32(*rl)(xf86Int10InfoPtr,int); - void(*wb)(xf86Int10InfoPtr,int,CARD8); - void(*ww)(xf86Int10InfoPtr,int,CARD16); - void(*wl)(xf86Int10InfoPtr,int,CARD32); + CARD8(*rb)(xf86Int10InfoPtr, int); + CARD16(*rw)(xf86Int10InfoPtr, int); + CARD32(*rl)(xf86Int10InfoPtr, int); + void(*wb)(xf86Int10InfoPtr, int, CARD8); + void(*ww)(xf86Int10InfoPtr, int, CARD16); + void(*wl)(xf86Int10InfoPtr, int, CARD32); } int10MemRec, *int10MemPtr; typedef struct { @@ -51,10 +53,22 @@ CARD8 save_46e8; } legacyVGARec, *legacyVGAPtr; +typedef struct { + BusType bus; + union { + struct { + int bus; + int dev; + int func; + } pci; + int legacy; + } location; +} xf86int10BiosLocation, *xf86int10BiosLocationPtr; + /* OS dependent functions */ xf86Int10InfoPtr xf86InitInt10(int entityIndex); void xf86FreeInt10(xf86Int10InfoPtr pInt); -void * xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off); +void *xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off); void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num); pointer xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr); @@ -78,26 +92,28 @@ #define V_BIOS 0xC0000 #define HIGH_MEM V_BIOS #define HIGH_MEM_SIZE (SYS_BIOS - HIGH_MEM) +#define SEG_ADR(type, seg, reg) type((seg << 4) + (X86_##reg)) +#define SEG_EADR(type, seg, reg) type((seg << 4) + (X86_E##reg)) #define X86_TF_MASK 0x00000100 #define X86_IF_MASK 0x00000200 -#define X86_IOPL_MASK 0x00003000 +#define X86_IOPL_MASK 0x00003000 #define X86_NT_MASK 0x00004000 #define X86_VM_MASK 0x00020000 #define X86_AC_MASK 0x00040000 -#define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */ -#define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */ +#define X86_VIF_MASK 0x00080000 /* virtual interrupt flag */ +#define X86_VIP_MASK 0x00100000 /* virtual interrupt pending */ #define X86_ID_MASK 0x00200000 -#define MEM_RB(name,addr) name->mem->rb(name,addr) -#define MEM_RW(name,addr) name->mem->rw(name,addr) -#define MEM_RL(name,addr) name->mem->rl(name,addr) -#define MEM_WB(name,addr,val) name->mem->wb(name,addr,val) -#define MEM_WW(name,addr,val) name->mem->ww(name,addr,val) -#define MEM_WL(name,addr,val) name->mem->wl(name,addr,val) +#define MEM_RB(name, addr) (*name->mem->rb)(name, addr) +#define MEM_RW(name, addr) (*name->mem->rw)(name, addr) +#define MEM_RL(name, addr) (*name->mem->rl)(name, addr) +#define MEM_WB(name, addr, val) (*name->mem->wb)(name, addr, val) +#define MEM_WW(name, addr, val) (*name->mem->ww)(name, addr, val) +#define MEM_WL(name, addr, val) (*name->mem->wl)(name, addr, val) /* OS dependent functions */ -void MapCurrentInt10(xf86Int10InfoPtr pInt); +Bool MapCurrentInt10(xf86Int10InfoPtr pInt); /* x86 executor related functions */ Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt); @@ -108,8 +124,7 @@ /* helper_exec.c */ int setup_int(xf86Int10InfoPtr pInt); void finish_int(xf86Int10InfoPtr, int sig); -CARD32 getIntVect(xf86Int10InfoPtr pInt,int num); -int vm86_GP_fault(xf86Int10InfoPtr pInt); +CARD32 getIntVect(xf86Int10InfoPtr pInt, int num); void pushw(xf86Int10InfoPtr pInt, CARD16 val); int run_bios_int(int num, xf86Int10InfoPtr pInt); void dump_code(xf86Int10InfoPtr pInt); @@ -117,7 +132,7 @@ void stack_trace(xf86Int10InfoPtr pInt); xf86Int10InfoPtr getInt10Rec(int entityIndex); CARD8 bios_checksum(CARD8 *start, int size); -void LockLegacyVGA(int screenIndex,legacyVGAPtr vga); +void LockLegacyVGA(int screenIndex, legacyVGAPtr vga); void UnlockLegacyVGA(int screenIndex, legacyVGAPtr vga); int port_rep_inb(xf86Int10InfoPtr pInt, CARD16 port, CARD32 base, int d_f, CARD32 count); @@ -139,47 +154,30 @@ CARD32 x_inl(CARD16 port); void x_outl(CARD16 port, CARD32 val); -#ifndef _INT10_NO_INOUT_MACROS -#if defined(PRINT_PORT) || (!defined(_PC) && !defined(_PC_IO)) -# define p_inb x_inb -# define p_inw x_inw -# define p_outb x_outb -# define p_outw x_outw -# define p_inl x_inl -# define p_outl x_outl -#else -# define p_inb inb -# define p_inw inw -# define p_outb outb -# define p_outw outw -# define p_inl inl -# define p_outl outl -#endif -#endif - CARD8 Mem_rb(int addr); CARD16 Mem_rw(int addr); CARD32 Mem_rl(int addr); -void Mem_wb(int addr,CARD8 val); -void Mem_ww(int addr,CARD16 val); -void Mem_wl(int addr,CARD32 val); +void Mem_wb(int addr, CARD8 val); +void Mem_ww(int addr, CARD16 val); +void Mem_wl(int addr, CARD32 val); /* helper_mem.c */ void setup_int_vect(xf86Int10InfoPtr pInt); -int setup_system_bios(unsigned long base_addr); +int setup_system_bios(void *base_addr); void reset_int_vect(xf86Int10InfoPtr pInt); void set_return_trap(xf86Int10InfoPtr pInt); -Bool int10skip(ScrnInfoPtr pScrn, int entityIndex); +void * xf86HandleInt10Options(ScrnInfoPtr pScrn, int entityIndex); +Bool int10skip(void* options); Bool int10_check_bios(int scrnIndex, int codeSeg, unsigned char* vbiosMem); - +Bool initPrimary(void* options); +void xf86int10ParseBiosLocation(void* options, + xf86int10BiosLocationPtr bios); #ifdef DEBUG void dprint(unsigned long start, unsigned long size); #endif /* pci.c */ -int mapPciRom(xf86Int10InfoPtr pInt, unsigned char * address); +int mapPciRom(int pciEntity, unsigned char *address); #endif /* _INT10_PRIVATE */ #endif /* _XF86INT10_H */ - - Index: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c diff -u xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c:1.9 xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c:1.11 --- xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c:1.9 Wed Dec 6 10:35:26 2000 +++ xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c Mon Apr 30 10:34:58 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c,v 1.9 2000/12/06 15:35:26 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.c,v 1.11 2001/04/30 14:34:58 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -6,128 +6,68 @@ */ #include <x86emu.h> #include "xf86.h" -#include "xf86str.h" #include "xf86_ansic.h" #include "compiler.h" #include "xf86_OSproc.h" #include "xf86Pci.h" #include "xf86_libc.h" #define _INT10_PRIVATE -#define _INT10_NO_INOUT_MACROS #include "xf86int10.h" #include "int10Defines.h" -#define M _X86EMU_env +#define M _X86EMU_env -#if defined(PRINT_PORT) || (!defined(_PC) && !defined(_PC_IO)) -# define p_inb x_inb -# define p_inw x_inw -# define p_outb x_outb -# define p_outw x_outw -# define p_inl x_inl -# define p_outl x_outl -#else -# define p_inb f_inb -# define p_inw f_inw -# define p_outb f_outb -# define p_outw f_outw -# define p_inl f_inl -# define p_outl f_outl -#endif - -/* - * inb/outb, etc are not available as functions (compler.h) on all - * platforms (eg SVR4.0 with cc). This provides versions that are guaranteed - * to be functions. - */ - -static CARD8 -f_inb(CARD16 port) -{ - return inb(port); -} - -static CARD16 -f_inw(CARD16 port) -{ - return inw(port); -} - -static CARD32 -f_inl(CARD16 port) -{ - return inl(port); -} - -static void -f_outb(CARD16 port, CARD8 val) -{ - outb(port, val); -} - static void -f_outw(CARD16 port, CARD16 val) -{ - outw(port,val); -} - -static void -f_outl(CARD16 port, CARD32 val) -{ - outl(port,val); -} - -static void x86emu_do_int(int num) { Int10Current->num = num; if (!int_handler(Int10Current)) { - xf86DrvMsg(Int10Current->scrnIndex, - X_ERROR,"\nUnknown vm86_int: %X\n\n",num); X86EMU_halt_sys(); } - return; } - + void xf86ExecX86int10(xf86Int10InfoPtr pInt) { int sig = setup_int(pInt); + if (sig < 0) + return; + if (int_handler(pInt)) { - X86EMU_exec(); + X86EMU_exec(); } - + finish_int(pInt, sig); } - + Bool xf86Int10ExecSetup(xf86Int10InfoPtr pInt) { int i; X86EMU_intrFuncs intFuncs[256]; X86EMU_pioFuncs pioFuncs = { - (u8(*)(u16))p_inb, - (u16(*)(u16))p_inw, - (u32(*)(u16))p_inl, - (void(*)(u16,u8))p_outb, - (void(*)(u16,u16))p_outw, - (void(*)(u16,u32))p_outl + (u8(*)(u16))x_inb, + (u16(*)(u16))x_inw, + (u32(*)(u16))x_inl, + (void(*)(u16, u8))x_outb, + (void(*)(u16, u16))x_outw, + (void(*)(u16, u32))x_outl }; - + X86EMU_memFuncs memFuncs = { (u8(*)(u32))Mem_rb, (u16(*)(u32))Mem_rw, (u32(*)(u32))Mem_rl, - (void(*)(u32,u8))Mem_wb, - (void(*)(u32,u16))Mem_ww, - (void(*)(u32,u32))Mem_wl + (void(*)(u32, u8))Mem_wb, + (void(*)(u32, u16))Mem_ww, + (void(*)(u32, u32))Mem_wl }; X86EMU_setupMemFuncs(&memFuncs); - - pInt->cpuRegs = &M; + + pInt->cpuRegs = &M; M.mem_base = 0; M.mem_size = 1024*1024 + 1024; X86EMU_setupPioFuncs(&pioFuncs); @@ -146,5 +86,3 @@ VErrorF(fmt, argptr); va_end(argptr); } - - Index: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h diff -u xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h:1.1 xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h:1.2 --- xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h:1.1 Sat Jan 22 23:44:35 2000 +++ xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h Sat Jan 6 15:19:13 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h,v 1.1 2000/01/23 04:44:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/int10/xf86x86emu.h,v 1.2 2001/01/06 20:19:13 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -8,7 +8,7 @@ #define XF86X86EMU_H_ #include <x86emu.h> -#define M _X86EMU_env +#define M _X86EMU_env #define X86_EAX M.x86.R_EAX #define X86_EBX M.x86.R_EBX @@ -37,10 +37,15 @@ #define X86_SS M.x86.R_SS #define X86_FS M.x86.R_FS #define X86_GS M.x86.R_GS - + #define X86_AL M.x86.R_AL #define X86_BL M.x86.R_BL #define X86_CL M.x86.R_CL #define X86_DL M.x86.R_DL + +#define X86_AH M.x86.R_AH +#define X86_BH M.x86.R_BH +#define X86_CH M.x86.R_CH +#define X86_DH M.x86.R_DH #endif Index: xc/programs/Xserver/hw/xfree86/loader/Imakefile diff -u xc/programs/Xserver/hw/xfree86/loader/Imakefile:1.26 xc/programs/Xserver/hw/xfree86/loader/Imakefile:1.27 --- xc/programs/Xserver/hw/xfree86/loader/Imakefile:1.26 Thu Nov 2 14:10:53 2000 +++ xc/programs/Xserver/hw/xfree86/loader/Imakefile Sat Apr 21 16:14:39 2001 @@ -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 @@ DLOBJ=dlloader.o #endif -DEFINES = $(DBMALLOCDEFINE) $(DLOPENDEFINES) $(OSDEFINES) +DEFINES = $(DBMALLOCDEFINE) $(DLOPENDEFINES) $(OS_DEFINES) MODULEDEFINES = -DDEFAULT_MODULE_PATH=\"$(MODULEDIR)\" Index: xc/programs/Xserver/hw/xfree86/loader/coffloader.c diff -u xc/programs/Xserver/hw/xfree86/loader/coffloader.c:1.14 xc/programs/Xserver/hw/xfree86/loader/coffloader.c:1.15 --- xc/programs/Xserver/hw/xfree86/loader/coffloader.c:1.14 Wed Dec 13 11:52:00 2000 +++ xc/programs/Xserver/hw/xfree86/loader/coffloader.c Sat Jan 6 16:29:16 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/coffloader.c,v 1.14 2000/12/13 16:52:00 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/coffloader.c,v 1.15 2001/01/06 21:29:16 tsi Exp $ */ /* * @@ -47,7 +47,6 @@ #include "loader.h" #include "coffloader.h" -#define NO_COMPILER_H_EXTRAS #include "compiler.h" /* #ifndef LDTEST Index: xc/programs/Xserver/hw/xfree86/loader/dixsym.c diff -u xc/programs/Xserver/hw/xfree86/loader/dixsym.c:1.35 xc/programs/Xserver/hw/xfree86/loader/dixsym.c:1.38 --- xc/programs/Xserver/hw/xfree86/loader/dixsym.c:1.35 Wed Nov 22 02:19:44 2000 +++ xc/programs/Xserver/hw/xfree86/loader/dixsym.c Thu Apr 5 13:42:34 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/dixsym.c,v 1.35 2000/11/22 07:19:44 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/dixsym.c,v 1.38 2001/04/05 17:42:34 dawes Exp $ */ /* @@ -39,6 +39,8 @@ #include "scrnintstr.h" #include "windowstr.h" #include "extension.h" +#define EVENT_SWAP_PTR +#define EXTENSION_PROC_ARGS void * #include "extnsionst.h" #include "swaprep.h" #include "swapreq.h" @@ -49,11 +51,8 @@ #ifdef XV #include "xvmodproc.h" #endif -#ifdef XFreeXDGA #include "dgaproc.h" -#endif #ifdef RENDER -#include "picturestr.h" #include "mipict.h" #endif @@ -158,7 +157,6 @@ SYMFUNC(VerifyRectOrder) SYMFUNC(SetDashes) /* globals.c */ -#ifdef DPMSExtension SYMVAR(DPMSEnabled) SYMVAR(DPMSCapableFlag) SYMVAR(DPMSOffTime) @@ -168,11 +166,11 @@ SYMVAR(DPMSEnabledSwitch) SYMVAR(DPMSDisabledSwitch) SYMVAR(defaultDPMSEnabled) -#endif #ifdef XV SYMVAR(XvScreenInitProc) SYMVAR(XvGetScreenIndexProc) SYMVAR(XvGetRTPortProc) + SYMVAR(XvMCScreenInitProc) #endif SYMVAR(ScreenSaverBlanking) SYMVAR(WindowTable) @@ -303,10 +301,8 @@ SYMFUNC(AssignTypeAndName) #endif -#ifdef XFreeXDGA /* xf86DGA.c */ SYMVAR(XDGAEventBase) -#endif /* libfont.a */ SYMFUNC(GetGlyphs) Index: xc/programs/Xserver/hw/xfree86/loader/elf.h diff -u xc/programs/Xserver/hw/xfree86/loader/elf.h:1.9 xc/programs/Xserver/hw/xfree86/loader/elf.h:1.11 --- xc/programs/Xserver/hw/xfree86/loader/elf.h:1.9 Thu Sep 7 15:06:52 2000 +++ xc/programs/Xserver/hw/xfree86/loader/elf.h Fri Apr 27 15:34:00 2001 @@ -1,11 +1,11 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elf.h,v 1.9 2000/09/07 19:06:52 anderson Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elf.h,v 1.11 2001/04/27 19:34:00 tsi Exp $ */ -typedef unsigned long Elf32_Addr; +typedef unsigned int Elf32_Addr; typedef unsigned short Elf32_Half; -typedef unsigned long Elf32_Off; +typedef unsigned int Elf32_Off; typedef long Elf32_Sword; -typedef unsigned long Elf32_Word; +typedef unsigned int Elf32_Word; typedef unsigned long Elf64_Addr; typedef unsigned short Elf64_Half; @@ -166,19 +166,39 @@ #define R_SPARC_JMP_SLOT 21 #define R_SPARC_RELATIVE 22 #define R_SPARC_UA32 23 -#define R_SPARC_PLT32 24 -#define R_SPARC_HIPLT22 25 -#define R_SPARC_LOPLT10 26 -#define R_SPARC_PCPLT32 27 -#define R_SPARC_PCPLT22 28 -#define R_SPARC_PCPLT10 29 -#define R_SPARC_10 30 -#define R_SPARC_11 31 -#define R_SPARC_WDISP16 40 -#define R_SPARC_WDISP19 41 -#define R_SPARC_7 43 -#define R_SPARC_5 44 -#define R_SPARC_6 45 +#define R_SPARC_PLT32 24 +#define R_SPARC_HIPLT22 25 +#define R_SPARC_LOPLT10 26 +#define R_SPARC_PCPLT32 27 +#define R_SPARC_PCPLT22 28 +#define R_SPARC_PCPLT10 29 +#define R_SPARC_10 30 +#define R_SPARC_11 31 +#define R_SPARC_64 32 +#define R_SPARC_OLO10 33 +#define R_SPARC_HH22 34 +#define R_SPARC_HM10 35 +#define R_SPARC_LM22 36 +#define R_SPARC_PC_HH22 37 +#define R_SPARC_PC_HM10 38 +#define R_SPARC_PC_LM22 39 +#define R_SPARC_WDISP16 40 +#define R_SPARC_WDISP19 41 +#define R_SPARC_GLOB_JMP 42 +#define R_SPARC_7 43 +#define R_SPARC_5 44 +#define R_SPARC_6 45 +#define R_SPARC_DISP64 46 +#define R_SPARC_PLT64 47 +#define R_SPARC_HIX22 48 +#define R_SPARC_LOX10 49 +#define R_SPARC_H44 50 +#define R_SPARC_M44 51 +#define R_SPARC_L44 52 +#define R_SPARC_REGISTER 53 +#define R_SPARC_UA64 54 +#define R_SPARC_UA16 55 +#define R_SPARC_NUM 56 /* m68k Relocation Types */ #define R_68K_NONE 0 /* No reloc */ Index: xc/programs/Xserver/hw/xfree86/loader/elfloader.c diff -u xc/programs/Xserver/hw/xfree86/loader/elfloader.c:1.31 xc/programs/Xserver/hw/xfree86/loader/elfloader.c:1.37 --- xc/programs/Xserver/hw/xfree86/loader/elfloader.c:1.31 Wed Dec 13 11:52:01 2000 +++ xc/programs/Xserver/hw/xfree86/loader/elfloader.c Fri Apr 27 15:34:00 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.31 2000/12/13 16:52:01 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/elfloader.c,v 1.37 2001/04/27 19:34:00 tsi Exp $ */ /* * @@ -46,7 +46,6 @@ #include "sym.h" #include "loader.h" -#define NO_COMPILER_H_EXTRAS #include "compiler.h" /* @@ -61,13 +60,21 @@ #endif #endif -#if defined (__alpha__) || defined (__ia64__) || (defined (__sparc__) && (defined (__arch64__) || defined (__sparcv9))) +#if defined (__alpha__) || \ + defined (__ia64__) || \ + (defined (__sparc__) && \ + (defined (__arch64__) || \ + defined (__sparcv9))) typedef Elf64_Ehdr Elf_Ehdr; typedef Elf64_Shdr Elf_Shdr; typedef Elf64_Sym Elf_Sym; typedef Elf64_Rel Elf_Rel; typedef Elf64_Rela Elf_Rela; typedef Elf64_Addr Elf_Addr; +typedef Elf64_Half Elf_Half; +typedef Elf64_Off Elf_Off; +typedef Elf64_Sword Elf_Sword; +typedef Elf64_Word Elf_Word; #define ELF_ST_BIND ELF64_ST_BIND #define ELF_ST_TYPE ELF64_ST_TYPE #define ELF_R_SYM ELF64_R_SYM @@ -129,12 +136,26 @@ typedef Elf32_Rel Elf_Rel; typedef Elf32_Rela Elf_Rela; typedef Elf32_Addr Elf_Addr; +typedef Elf32_Half Elf_Half; +typedef Elf32_Off Elf_Off; +typedef Elf32_Sword Elf_Sword; +typedef Elf32_Word Elf_Word; #define ELF_ST_BIND ELF32_ST_BIND #define ELF_ST_TYPE ELF32_ST_TYPE #define ELF_R_SYM ELF32_R_SYM #define ELF_R_TYPE ELF32_R_TYPE #endif +#if defined(__powerpc__) || \ + defined(__mc68000__) || \ + defined(__alpha__) || \ + defined(__sparc__) || \ + defined(__ia64__) +typedef Elf_Rela Elf_Rel_t; +#else +typedef Elf_Rel Elf_Rel_t; +#endif + /* * This structure contains all of the information about a module * that has been loaded. @@ -222,14 +243,9 @@ * to try later after more modules have been loaded. */ typedef struct _elf_reloc { -#if defined(i386) - Elf_Rel *rel; -#endif -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) - Elf_Rela *rel; -#endif + Elf_Rel_t *rel; ELFModulePtr file; - unsigned char *secp; + Elf_Word secn; struct _elf_reloc *next; } ELFRelocRec; @@ -251,33 +267,25 @@ static char *ElfGetStringIndex(ELFModulePtr, int, int); static char *ElfGetString(ELFModulePtr, int); static char *ElfGetSectionName(ELFModulePtr, int); -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) -static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, unsigned char *, Elf_Rela *); -#else -static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, unsigned char *, Elf_Rel *); -#endif +static ELFRelocPtr ElfDelayRelocation(ELFModulePtr, Elf_Word, Elf_Rel_t *); static ELFCommonPtr ElfAddCOMMON(Elf_Sym *); static int ElfCOMMONSize(void); static int ElfCreateCOMMON(ELFModulePtr,LOOKUP *); static char *ElfGetSymbolNameIndex(ELFModulePtr, int, int); static char *ElfGetSymbolName(ELFModulePtr, int); static Elf_Addr ElfGetSymbolValue(ELFModulePtr, int); -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) -static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, unsigned char *, Elf_Rela *, int); -#else -static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, unsigned char *, Elf_Rel *, int); -#endif +static ELFRelocPtr Elf_RelocateEntry(ELFModulePtr, Elf_Word, Elf_Rel_t *, int); static ELFRelocPtr ELFCollectRelocations(ELFModulePtr, int); static LOOKUP *ELF_GetSymbols(ELFModulePtr, unsigned short **); static void ELFCollectSections(ELFModulePtr, int, int *, int *); #if defined(__alpha__) || defined(__ia64__) -static void ElfAddGOT(ELFModulePtr, Elf_Rela *); +static void ElfAddGOT(ELFModulePtr, Elf_Rel_t *); static int ELFCreateGOT(ELFModulePtr, int); #endif #if defined(__ia64__) static void ElfAddOPD(ELFModulePtr, int, LOOKUP *); static void ELFCreateOPD(ELFModulePtr); -static void ElfAddPLT(ELFModulePtr, Elf_Rela *); +static void ElfAddPLT(ELFModulePtr, Elf_Rel_t *); static void ELFCreatePLT(ELFModulePtr); enum ia64_operand { IA64_OPND_IMM22, @@ -340,15 +348,10 @@ * Manage listResolv */ static ELFRelocPtr -ElfDelayRelocation(elffile,secp,rel) +ElfDelayRelocation(elffile, secn, rel) ELFModulePtr elffile; -unsigned char *secp; -#if defined(i386) -Elf_Rel *rel; -#endif -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) -Elf_Rela *rel; -#endif +Elf_Word secn; +Elf_Rel_t *rel; { ELFRelocPtr reloc; @@ -357,15 +360,21 @@ return 0; } reloc->file=elffile; - reloc->secp=secp; + reloc->secn=secn; reloc->rel=rel; reloc->next=0; #ifdef ELFDEBUG - ELFDEBUG("ElfDelayRelocation %lx: file %lx, sec %lx, r_offset 0x%x, r_info 0x%x", reloc, elffile, secp, rel->r_offset, rel->r_info); -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) - ELFDEBUG(", r_addend 0x%x", rel->r_addend); + ELFDEBUG("ElfDelayRelocation %lx: file %lx, sec %d," + " r_offset 0x%lx, r_info 0x%x", + reloc, elffile, secn, rel->r_offset, rel->r_info); +#if defined(__powerpc__) || \ + defined(__mc68000__) || \ + defined(__alpha__) || \ + defined(__sparc__) || \ + defined(__ia64__) + ELFDEBUG(", r_addend 0x%lx", rel->r_addend); #endif - ELFDEBUG("\n" ); + ELFDEBUG("\n"); #endif return reloc; } @@ -396,7 +405,11 @@ for (common = listCOMMON; common; common = common->next) { size+=common->sym->st_size; -#if defined(__alpha__) || defined(__ia64__) || (defined(__sparc__) && (defined(__arch64__) || defined(__sparcv9))) +#if defined(__alpha__) || \ + defined(__ia64__) || \ + (defined(__sparc__) && \ + (defined(__arch64__) || \ + defined(__sparcv9))) size = (size+7)&~0x7; #endif } @@ -417,7 +430,11 @@ for (common = listCOMMON; common; common = common->next) { size+=common->sym->st_size; -#if defined(__alpha__) || defined(__ia64__) || (defined(__sparc__) && (defined(__arch64__) || defined(__sparcv9))) +#if defined(__alpha__) || \ + defined(__ia64__) || \ + (defined(__sparc__) && \ + (defined(__arch64__) || \ + defined(__sparcv9))) size = (size+7)&~0x7; #endif numsyms++; @@ -453,10 +470,12 @@ /* this is xstrdup because is should be more efficient. it is freed * with xf86loaderfree */ - pLookup[l].symName = xf86loaderstrdup(ElfGetString(elffile,common->sym->st_name)); + pLookup[l].symName = + xf86loaderstrdup(ElfGetString(elffile,common->sym->st_name)); pLookup[l].offset = (funcptr)(elffile->common + offset); #ifdef ELFDEBUG - ELFDEBUG("Adding common %lx %s\n", pLookup[l].offset, pLookup[l].symName ); + ELFDEBUG("Adding common %lx %s\n", + pLookup[l].offset, pLookup[l].symName); #endif /* Record the symbol address for gdb */ @@ -468,7 +487,11 @@ } listCOMMON=common->next; offset+=common->sym->st_size; -#if defined(__alpha__) || defined(__ia64__) || (defined(__sparc__) && (defined(__arch64__) || defined(__sparcv9))) +#if defined(__alpha__) || \ + defined(__ia64__) || \ + (defined(__sparc__) && \ + (defined(__arch64__) || \ + defined(__sparcv9))) offset = (offset+7)&~0x7; #endif xf86loaderfree(common); @@ -549,18 +572,7 @@ ELFModulePtr elffile; int index; { - char *name,*symname; - symname=ElfGetSymbolNameIndex( elffile, index, elffile->symndx ); - if( symname == NULL ) - return NULL; - - name=xf86loadermalloc(strlen(symname)+1); - if (!name) - FatalError("ELFGetSymbolName: Out of memory\n"); - - strcpy(name,symname); - - return name; + return ElfGetSymbolNameIndex(elffile, index, elffile->symndx); } static Elf_Addr @@ -619,7 +631,7 @@ break; } #ifdef ELFDEBUG - ELFDEBUG( "%x\t", symbol ); + ELFDEBUG( "%lx\t", symbol ); ELFDEBUG( "%lx\t", symval ); ELFDEBUG( "%s\n", symname ? symname : "NULL"); #endif @@ -711,8 +723,8 @@ break; } #ifdef ELFDEBUG - ELFDEBUG( "ElfGetPlt: symbol=%x\t", symbol ); - ELFDEBUG( "newval=%x\t", symval ); + ELFDEBUG( "ElfGetPlt: symbol=%lx\t", symbol ); + ELFDEBUG( "newval=%lx\t", symval ); ELFDEBUG( "name=\"%s\"\n", symname ? symname : "NULL"); #endif break; @@ -738,20 +750,18 @@ static void ElfAddGOT(elffile,rel) ELFModulePtr elffile; -Elf_Rela *rel; +Elf_Rel_t *rel; { ELFGotEntryPtr gotent; #ifdef ELFDEBUG { Elf_Sym *sym; - char *namestr; sym=(Elf_Sym *)&(elffile->symtab[ELF_R_SYM(rel->r_info)]); if( sym->st_name) { ELFDEBUG("ElfAddGOT: Adding GOT entry for %s\n", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); } else ELFDEBUG("ElfAddGOT: Adding GOT entry for %s\n", @@ -797,11 +807,13 @@ ELFGotPtr gots; #endif int gotsize; + + /* + * XXX: Is it REALLY needed to ensure GOT's are non-null? + */ #ifdef ELFDEBUG ELFDEBUG( "ELFCreateGOT: %x entries in the GOT\n", elffile->gotsize/8 ); -#endif -#ifdef ELFDEBUG /* * Hmmm. Someone is getting here without any got entries, but they * may still have R_ALPHA_GPDISP relocations against the got. @@ -836,7 +848,8 @@ gots->freeptr = gots->freeptr + elffile->gotsize; gots->nuses++; #ifdef ELFDEBUG - ELFDEBUG( "ELFCreateGOT: GOT address %lx in shared GOT, nuses %d\n", elffile->got, gots->nuses ); + ELFDEBUG( "ELFCreateGOT: GOT address %lx in shared GOT, nuses %d\n", + elffile->got, gots->nuses ); #endif return TRUE; } @@ -930,22 +943,18 @@ ELFCreateOPD(elffile) ELFModulePtr elffile; { - ELFOpdPtr opdent, last = NULL; + ELFOpdPtr opdent; if (elffile->got == NULL) ErrorF( "ELFCreateOPD() Unallocated GOT!!!!\n" ); - for (opdent = elffile->opd_entries; opdent; last = opdent, opdent = opdent->next) { - if (last && last->index == -1) - xf86loaderfree(last); + for (opdent = elffile->opd_entries; opdent; opdent = opdent->next) { if (opdent->index != -1) continue; ((unsigned long *)(elffile->got+opdent->offset))[0] = (long)opdent->l->offset; ((unsigned long *)(elffile->got+opdent->offset))[1] = (long)elffile->got; opdent->l->offset = (funcptr)(elffile->got+opdent->offset); } - if (last && last->index == -1) - xf86loaderfree(last); } /* @@ -954,20 +963,18 @@ static void ElfAddPLT(elffile,rel) ELFModulePtr elffile; -Elf_Rela *rel; +Elf_Rel_t *rel; { ELFPltEntryPtr pltent; #ifdef ELFDEBUG { Elf_Sym *sym; - char *namestr; sym=(Elf_Sym *)&(elffile->symtab[ELF_R_SYM(rel->r_info)]); if( sym->st_name) { ELFDEBUG("ElfAddPLT: Adding PLT entry for %s\n", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); } else ErrorF("ElfAddPLT: Add PLT entry for section??\n"); @@ -1046,7 +1053,7 @@ case 0: data = *data128; break; case 1: memcpy(&data, (char *)data128 + 5, 8); break; case 2: memcpy(&data, (char *)data128 + 10, 6); break; - default: FatalError("Unexpected slot in nIA64InstallReloc()\n"); + default: FatalError("Unexpected slot in IA64InstallReloc()\n"); } switch (opnd) { case IA64_OPND_IMM22: @@ -1072,8 +1079,9 @@ case 0: *data128 = data; break; case 1: memcpy((char *)data128 + 5, &data, 8); break; case 2: memcpy((char *)data128 + 10, &data, 6); break; - default: FatalError("Unexpected slot in nIA64InstallReloc()\n"); + default: FatalError("Unexpected slot in IA64InstallReloc()\n"); } + ia64_flush_cache(data128); #ifdef ELFDEBUG ELFDEBUG( "After [%016lx%016lx]\n", data128[1], data128[0]); #endif @@ -1088,17 +1096,13 @@ * LoaderDefaultFunc) otherwise, the relocation will be deferred. */ static ELFRelocPtr -Elf_RelocateEntry(elffile, secp, rel, force) +Elf_RelocateEntry(elffile, secn, rel, force) ELFModulePtr elffile; -unsigned char *secp; /* Begining of the target section */ -#if defined(i386) -Elf_Rel *rel; -#endif -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) -Elf_Rela *rel; -#endif +Elf_Word secn; +Elf_Rel_t *rel; int force; { + unsigned char *secp = elffile->saddr[secn]; unsigned int *dest32; /* address of the 32 bit place being modified */ #if defined(__powerpc__) || defined(__mc68000__) || defined(__sparc__) unsigned short *dest16; /* address of the 16 bit place being modified */ @@ -1109,10 +1113,6 @@ #if defined(__alpha__) unsigned int *dest32h; /* address of the high 32 bit place being modified */ unsigned long *dest64; -#if 0 /* XXX unused */ - unsigned long *gp=(unsigned long *)elffile->got+0x8000; /* - * location of the got table */ -#endif #endif #if defined(__ia64__) unsigned long *dest64; @@ -1121,15 +1121,16 @@ Elf_Addr symval = 0; /* value of the indicated symbol */ #ifdef ELFDEBUG -#if defined(i386) ELFDEBUG( "%lx %d %d\n", rel->r_offset, - ELF_R_SYM(rel->r_info),ELF_R_TYPE(rel->r_info) ); -#endif -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__ia64__) - ELFDEBUG( "%x %d %d %x\n", rel->r_offset, - ELF_R_SYM(rel->r_info),ELF_R_TYPE(rel->r_info), - rel->r_addend ); + ELF_R_SYM(rel->r_info), ELF_R_TYPE(rel->r_info) ); +#if defined(__powerpc__) || \ + defined(__mc68000__) || \ + defined(__alpha__) || \ + defined(__sparc__) || \ + defined(__ia64__) + ELFDEBUG( "%lx", rel->r_addend ); #endif + ELFDEBUG("\n"); #endif #if defined(__alpha__) if (ELF_R_SYM(rel->r_info) && ELF_R_TYPE(rel->r_info) != R_ALPHA_GPDISP) { @@ -1142,12 +1143,10 @@ symval = (Elf_Addr) &LoaderDefaultFunc; } else { #ifdef ELFDEBUG - char *namestr; - namestr = ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)); - ELFDEBUG("***Unable to resolve symbol %s\n", namestr); - xf86loaderfree(namestr); + ELFDEBUG("***Unable to resolve symbol %s\n", + ElfGetSymbolName(elffile, ELF_R_SYM(rel->r_info))); #endif - return ElfDelayRelocation(elffile,secp,rel); + return ElfDelayRelocation(elffile, secn, rel); } } } @@ -1170,16 +1169,12 @@ case R_386_PC32: dest32=(unsigned int *)(secp+rel->r_offset); #ifdef ELFDEBUG - { - char *namestr; ELFDEBUG( "R_386_PC32 %s\t", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%x\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest32=%x\t", dest32 ); ELFDEBUG( "*dest32=%8.8lx\t", *dest32 ); - } #endif *dest32=symval+(*dest32)-(Elf_Addr)dest32; /* S + A - P */ @@ -1188,7 +1183,7 @@ ELFDEBUG( "*dest32=%8.8lx\n", *dest32 ); #endif - break; + break; #endif /* i386 */ #if defined(__alpha__) case R_ALPHA_NONE: @@ -1216,16 +1211,12 @@ dest32=(unsigned int *)dest64; #ifdef ELFDEBUG - { - char *namestr; ELFDEBUG( "R_ALPHA_GPREL32 %s\t", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest32=%lx\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); - } #endif symval += rel->r_addend; symval = ((unsigned char *)symval)-((unsigned char *)elffile->got); @@ -1249,16 +1240,12 @@ ELFGotEntryPtr gotent; dest32=(unsigned int *)(secp+rel->r_offset); #ifdef ELFDEBUG - { - char *namestr; ELFDEBUG( "R_ALPHA_LITERAL %s\t", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest32=%lx\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); - } #endif for (gotent=elffile->got_entries;gotent;gotent=gotent->next) { @@ -1311,11 +1298,8 @@ dest32=(unsigned int *)((secp+rel->r_offset)+rel->r_addend); #ifdef ELFDEBUG - { - char *namestr; ELFDEBUG( "R_ALPHA_GPDISP %s\t", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "got=%lx\t", elffile->got ); ELFDEBUG( "gp=%lx\t", gp ); @@ -1323,13 +1307,10 @@ ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); ELFDEBUG( "dest32h=%lx\t", dest32h ); ELFDEBUG( "*dest32h=%8.8x\t", *dest32h ); - } #endif if ((*dest32h >> 26) != 9 || (*dest32 >> 26) != 8) { - char *namestr; ErrorF( "***Bad instructions in relocating %s\n", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); } symval = (*dest32h & 0xffff) << 16 | (*dest32 & 0xffff); @@ -1362,16 +1343,12 @@ case R_ALPHA_HINT: dest32=(unsigned int *)((secp+rel->r_offset)+rel->r_addend); #ifdef ELFDEBUG - { - char *namestr; ELFDEBUG( "R_ALPHA_HINT %s\t", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest32=%lx\t", dest32 ); ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); - } #endif #ifdef ELFDEBUG @@ -1405,32 +1382,30 @@ case R_68K_32: dest32=(unsigned long *)(secp+rel->r_offset); #ifdef ELFDEBUG -ELFDEBUG( "R_68K_32\t", dest32 ); -ELFDEBUG( "dest32=%x\t", dest32 ); -ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); + ELFDEBUG( "R_68K_32\t", dest32 ); + ELFDEBUG( "dest32=%x\t", dest32 ); + ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); #endif *dest32=symval+(*dest32); /* S + A */ #ifdef ELFDEBUG -ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); + ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); #endif break; case R_68K_PC32: dest32=(unsigned long *)(secp+rel->r_offset); #ifdef ELFDEBUG -char *namestr; -ELFDEBUG( "R_68K_PC32 %s\t", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); -xf86loaderfree(namestr); -ELFDEBUG( "secp=%x\t", secp ); -ELFDEBUG( "symval=%x\t", symval ); -ELFDEBUG( "dest32=%x\t", dest32 ); -ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); + ELFDEBUG( "R_68K_PC32 %s\t", + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); + ELFDEBUG( "secp=%x\t", secp ); + ELFDEBUG( "symval=%x\t", symval ); + ELFDEBUG( "dest32=%x\t", dest32 ); + ELFDEBUG( "*dest32=%8.8x\t", *dest32 ); #endif *dest32=symval+(*dest32)-(Elf_Addr)dest32; /* S + A - P */ #ifdef ELFDEBUG -ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); + ELFDEBUG( "*dest32=%8.8x\n", *dest32 ); #endif break; @@ -1799,97 +1774,102 @@ #endif /* PowerMAX_OS */ #endif /* __powerpc__ */ #ifdef __sparc__ - case R_SPARC_RELATIVE: - dest32 = (unsigned int *)(secp + rel->r_offset); - *dest32 += (unsigned int)secp + rel->r_addend; - break; - - case R_SPARC_GLOB_DAT: - case R_SPARC_32: - dest32 = (unsigned int *)(secp + rel->r_offset); - symval += rel->r_addend; - *dest32 = symval; - break; - - case R_SPARC_JMP_SLOT: - dest32 = (unsigned int *)(secp + rel->r_offset); - /* Before we change it the PLT entry looks like: - * - * pltent: sethi %hi(rela_plt_offset), %g1 - * b,a PLT0 - * nop - * - * We change it into: - * - * pltent: sethi %hi(rela_plt_offset), %g1 - * sethi %hi(symval), %g1 - * jmp %g1 + %lo(symval), %g0 - */ - symval += rel->r_addend; - dest32[2] = 0x81c06000 | (symval & 0x3ff); - __asm __volatile("flush %0 + 0x8" : : "r" (dest32)); - dest32[1] = 0x03000000 | (symval >> 10); - __asm __volatile("flush %0 + 0x4" : : "r" (dest32)); + case R_SPARC_NONE: /* 0 */ break; - case R_SPARC_8: + case R_SPARC_8: /* 1 */ dest8 = (unsigned char *)(secp + rel->r_offset); symval += rel->r_addend; *dest8 = symval; break; - case R_SPARC_16: + case R_SPARC_16: /* 2 */ dest16 = (unsigned short *)(secp + rel->r_offset); symval += rel->r_addend; *dest16 = symval; break; + + case R_SPARC_32: /* 3 */ + case R_SPARC_GLOB_DAT: /* 20 */ + case R_SPARC_UA32: /* 23 */ + dest32 = (unsigned int *)(secp + rel->r_offset); + symval += rel->r_addend; + ((unsigned char *)dest32)[0] = (unsigned char)(symval >> 24); + ((unsigned char *)dest32)[1] = (unsigned char)(symval >> 16); + ((unsigned char *)dest32)[2] = (unsigned char)(symval >> 8); + ((unsigned char *)dest32)[3] = (unsigned char)(symval ); + break; - case R_SPARC_DISP8: + case R_SPARC_DISP8: /* 4 */ dest8 = (unsigned char *)(secp + rel->r_offset); symval += rel->r_addend; *dest8 = (symval - (Elf32_Addr) dest8); break; - case R_SPARC_DISP16: + case R_SPARC_DISP16: /* 5 */ dest16 = (unsigned short *)(secp + rel->r_offset); symval += rel->r_addend; *dest16 = (symval - (Elf32_Addr) dest16); break; - case R_SPARC_DISP32: + case R_SPARC_DISP32: /* 6 */ dest32 = (unsigned int *)(secp + rel->r_offset); symval += rel->r_addend; *dest32 = (symval - (Elf32_Addr) dest32); break; - - case R_SPARC_LO10: - dest32 = (unsigned int *)(secp + rel->r_offset); - symval += rel->r_addend; - *dest32 = (*dest32 & ~0x3ff) | (symval & 0x3ff); - break; - case R_SPARC_WDISP30: + case R_SPARC_WDISP30: /* 7 */ dest32 = (unsigned int *)(secp + rel->r_offset); symval += rel->r_addend; *dest32 = ((*dest32 & 0xc0000000) | ((symval - (Elf32_Addr) dest32) >> 2)); break; - case R_SPARC_HI22: + case R_SPARC_HI22: /* 9 */ dest32 = (unsigned int *)(secp + rel->r_offset); symval += rel->r_addend; *dest32 = (*dest32 & 0xffc00000) | (symval >> 10); break; - case R_SPARC_NONE: + case R_SPARC_LO10: /* 12 */ + dest32 = (unsigned int *)(secp + rel->r_offset); + symval += rel->r_addend; + *dest32 = (*dest32 & ~0x3ff) | (symval & 0x3ff); break; - case R_SPARC_COPY: + case R_SPARC_COPY: /* 19 */ /* Fix your code... I'd rather dish out an error here * so people will not link together PIC and non-PIC * code into a final driver object file. + */ + ErrorF("Elf_RelocateEntry():" + " Copy relocs not supported on Sparc.\n"); + break; + + case R_SPARC_JMP_SLOT: /* 21 */ + dest32 = (unsigned int *)(secp + rel->r_offset); + /* Before we change it the PLT entry looks like: + * + * pltent: sethi %hi(rela_plt_offset), %g1 + * b,a PLT0 + * nop + * + * We change it into: + * + * pltent: sethi %hi(rela_plt_offset), %g1 + * sethi %hi(symval), %g1 + * jmp %g1 + %lo(symval), %g0 */ - ErrorF("Elf_RelocateEntry() Copy relocs not supported on Sparc.\n"); + symval += rel->r_addend; + dest32[2] = 0x81c06000 | (symval & 0x3ff); + __asm __volatile("flush %0 + 0x8" : : "r" (dest32)); + dest32[1] = 0x03000000 | (symval >> 10); + __asm __volatile("flush %0 + 0x4" : : "r" (dest32)); + break; + + case R_SPARC_RELATIVE: /* 22 */ + dest32 = (unsigned int *)(secp + rel->r_offset); + *dest32 += (unsigned int)secp + rel->r_addend; break; #endif #ifdef __ia64__ @@ -1900,7 +1880,8 @@ if (rel->r_addend) FatalError("\nAddend for R_IA64_LTOFF_FPTR22 not supported\n"); #ifdef ELFDEBUG - ELFDEBUG( "opd=%016lx.%016lx\n", ((long *)symval)[0], ((long *)symval)[1] ); + ELFDEBUG( "opd=%016lx.%016lx\n", + ((long *)symval)[0], ((long *)symval)[1] ); #endif /* FALLTHROUGH */ case R_IA64_LTOFF22: @@ -1908,18 +1889,14 @@ ELFGotEntryPtr gotent; dest128=(unsigned long *)(secp+(rel->r_offset&~3)); #ifdef ELFDEBUG - { - char *namestr; ELFDEBUG( "%s %s\t", ELF_R_TYPE(rel->r_info) == R_IA64_LTOFF22 ? "R_IA64_LTOFF22" : "R_IA64_LTOFF_FPTR22", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest128=%lx\t", dest128 ); - ELFDEBUG( "slot=%ld\t", rel->r_offset & 3); - ELFDEBUG( "*dest128=[%016lx%016lx]\t", dest128[1], dest128[0]); - } + ELFDEBUG( "slot=%d\n", rel->r_offset & 3); + ELFDEBUG( "*dest128=[%016lx%016lx]\n", dest128[1], dest128[0]); #endif for (gotent=elffile->got_entries;gotent;gotent=gotent->next) { @@ -1933,7 +1910,7 @@ *(unsigned long *)(elffile->got+gotent->offset) = symval+rel->r_addend; #ifdef ELFDEBUG - ELFDEBUG("Setting gotent[%x]=%lx\t", + ELFDEBUG("Setting gotent[%x]=%lx\n", gotent->offset, symval+rel->r_addend); #endif if ((gotent->offset & 0xffe00000) != 0) @@ -1951,18 +1928,14 @@ ELFPltEntryPtr pltent; dest128=(unsigned long *)(secp+(rel->r_offset&~3)); #ifdef ELFDEBUG - { - char *namestr; ELFDEBUG( "R_IA64_PCREL21B %s\t", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "opd=%lx.%lx\t", ((long *)symval)[0], ((long *)symval)[1]); ELFDEBUG( "dest128=%lx\t", dest128 ); - ELFDEBUG( "slot=%ld\t", rel->r_offset & 3); - ELFDEBUG( "*dest128=[%016lx%016lx]\t", dest128[1], dest128[0]); - } + ELFDEBUG( "slot=%d\n", rel->r_offset & 3); + ELFDEBUG( "*dest128=[%016lx%016lx]\n", dest128[1], dest128[0]); #endif if (rel->r_addend) FatalError("\nAddend for PCREL21B not supported\n"); @@ -2010,62 +1983,52 @@ case R_IA64_FPTR64LSB: dest64=(unsigned long *)(secp+rel->r_offset); #ifdef ELFDEBUG - { - char *namestr; ELFDEBUG( "R_IA64_FPTR64LSB %s\t", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest64=%lx\t", dest64 ); ELFDEBUG( "opd=%016lx.%016lx\n", ((long *)symval)[0], ((long *)symval)[1] ); - } #endif if (rel->r_addend) FatalError("\nAddend not supported for R_IA64_FPTR64LSB\n"); *dest64 = symval; + ia64_flush_cache(dest64); break; case R_IA64_DIR64LSB: dest64=(unsigned long *)(secp+rel->r_offset); #ifdef ELFDEBUG - { - char *namestr; ELFDEBUG( "R_IA64_DIR64LSB %s\t", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); - ELFDEBUG( "dest64=%lx\t", dest64 ); - } + ELFDEBUG( "dest64=%lx\n", dest64 ); #endif *dest64 = symval + rel->r_addend; + ia64_flush_cache(dest64); break; case R_IA64_GPREL22: dest128=(unsigned long *)(secp+(rel->r_offset&~3)); #ifdef ELFDEBUG - { - char *namestr; ELFDEBUG( "R_IA64_GPREL22 %s\t", - namestr=ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); - xf86loaderfree(namestr); + ElfGetSymbolName(elffile,ELF_R_SYM(rel->r_info)) ); ELFDEBUG( "secp=%lx\t", secp ); ELFDEBUG( "symval=%lx\t", symval ); ELFDEBUG( "dest128=%lx\t", dest128 ); - ELFDEBUG( "slot=%ld\t", rel->r_offset & 3); - ELFDEBUG( "*dest128=[%016lx%016lx]\t", dest128[1], dest128[0]); - } + ELFDEBUG( "slot=%d\n", rel->r_offset & 3); + ELFDEBUG( "*dest128=[%016lx%016lx]\n", dest128[1], dest128[0]); #endif - IA64InstallReloc(dest128, rel->r_offset & 3, IA64_OPND_IMM22, symval + rel->r_addend - (long)elffile->got); + IA64InstallReloc(dest128, rel->r_offset & 3, IA64_OPND_IMM22, + symval + rel->r_addend - (long)elffile->got); break; #endif default: - ErrorF( - "Elf_RelocateEntry() Unsupported relocation type %d\n", - ELF_R_TYPE(rel->r_info) ); + ErrorF("Elf_RelocateEntry() Unsupported relocation type %d\n", + ELF_R_TYPE(rel->r_info)); break; } return 0; @@ -2078,21 +2041,11 @@ { int i, numrel; Elf_Shdr *sect=&(elffile->sections[index]); -#if defined(i386) - Elf_Rel *rel=(Elf_Rel *)elffile->saddr[index]; -#endif -#if defined(__powerpc__) || defined(__mc68000__) || defined(__alpha__) || defined(__sparc__) || defined(__sparc__) || defined(__ia64__) - Elf_Rela *rel=(Elf_Rela *)elffile->saddr[index]; -#endif + Elf_Rel_t *rel=(Elf_Rel_t *)elffile->saddr[index]; Elf_Sym *syms; - unsigned char *secp; /* Begining of the target section */ ELFRelocPtr reloc_head = NULL; ELFRelocPtr tmp; - secp=(unsigned char *)elffile->saddr[sect->sh_info]; - if (secp == NULL) { - secp=(unsigned char *)(long)sect->sh_info; - } syms = (Elf_Sym *) elffile->saddr[elffile->symndx]; numrel=sect->sh_size/sect->sh_entsize; @@ -2101,7 +2054,7 @@ #if defined(__alpha__) if( ELF_R_TYPE(rel[i].r_info) == R_ALPHA_LITERAL) { ElfAddGOT(elffile,&rel[i]); - } + } #endif #if defined(__ia64__) if (ELF_R_TYPE(rel[i].r_info) == R_IA64_LTOFF22 @@ -2118,7 +2071,7 @@ } } #endif - tmp = ElfDelayRelocation(elffile,secp,&(rel[i])); + tmp = ElfDelayRelocation(elffile, sect->sh_info, &(rel[i])); tmp->next = reloc_head; reloc_head = tmp; } @@ -2500,7 +2453,7 @@ elffile->reltxtndx=i; elffile->reltxtsize=SecSize(i); #ifdef ELFDEBUG - ELFDEBUG(".rela.text starts at %x\n", elffile->reltext ); + ELFDEBUG(".rela.text starts at %lx\n", elffile->reltext ); #endif continue; } @@ -2514,7 +2467,7 @@ elffile->reldatndx=i; elffile->reldatsize=SecSize(i); #ifdef ELFDEBUG - ELFDEBUG(".rela.data starts at %x\n", elffile->reldata ); + ELFDEBUG(".rela.data starts at %lx\n", elffile->reldata ); #endif continue; } @@ -2528,7 +2481,7 @@ elffile->relsdatndx=i; elffile->relsdatsize=SecSize(i); #ifdef ELFDEBUG - ELFDEBUG(".rela.sdata starts at %x\n", elffile->relsdata ); + ELFDEBUG(".rela.sdata starts at %lx\n", elffile->relsdata ); #endif continue; } @@ -2542,7 +2495,7 @@ elffile->relrodatndx=i; elffile->relrodatsize=SecSize(i); #ifdef ELFDEBUG - ELFDEBUG(".rela.rodata starts at %x\n", elffile->relrodata ); + ELFDEBUG(".rela.rodata starts at %lx\n", elffile->relrodata ); #endif continue; } @@ -2724,7 +2677,8 @@ /* * Get the ELF header */ - elffile->header=(Elf_Ehdr*)_LoaderFileToMem(elffd,0,sizeof(Elf_Ehdr),"header"); + elffile->header= + (Elf_Ehdr*)_LoaderFileToMem(elffd, 0, sizeof(Elf_Ehdr), "header"); header=(Elf_Ehdr *)elffile->header; /* @@ -2732,8 +2686,9 @@ */ elffile->numsh=header->e_shnum; elffile->secsize=(header->e_shentsize*header->e_shnum); - elffile->sections=(Elf_Shdr *)_LoaderFileToMem(elffd,header->e_shoff, - elffile->secsize, "sections"); + elffile->sections= + (Elf_Shdr *)_LoaderFileToMem(elffd, header->e_shoff, elffile->secsize, + "sections"); #if defined(__alpha__) || defined(__ia64__) /* * Need to allocate space for the .got section which will be @@ -2782,8 +2737,9 @@ * Get the section header string table */ elffile->shstrsize = SecSize(header->e_shstrndx); - elffile->shstraddr = _LoaderFileToMem(elffd,SecOffset(header->e_shstrndx), - SecSize(header->e_shstrndx),".shstrtab"); + elffile->shstraddr = + _LoaderFileToMem(elffd, SecOffset(header->e_shstrndx), + SecSize(header->e_shstrndx), ".shstrtab"); elffile->shstrndx = header->e_shstrndx; #if defined(__alpha__) || defined(__ia64__) /* @@ -2900,11 +2856,6 @@ } xf86loaderfree(secttable); - for (elf_reloc = _LoaderGetRelocations(v)->elf_reloc; - elf_reloc; elf_reloc = elf_reloc->next) - if ((unsigned long)elf_reloc->secp < elffile->numsh) - elf_reloc->secp = (unsigned char *)elffile->saddr[(unsigned long)elf_reloc->secp]; - #if defined(__ia64__) ELFCreateOPD(elffile); #endif @@ -2946,10 +2897,10 @@ newlist = 0; for (p = _LoaderGetRelocations(mod)->elf_reloc; p; ) { #ifdef ELFDEBUG - ErrorF("ResolveSymbols: file %lx, sec %lx, r_offset 0x%x, r_info 0x%lx\n", - p->file, p->secp, p->rel->r_offset, p->rel->r_info); + ErrorF("ResolveSymbols: file %lx, sec %d, r_offset 0x%x, r_info 0x%lx\n", + p->file, p->secn, p->rel->r_offset, p->rel->r_info); #endif - tmp = Elf_RelocateEntry(p->file, p->secp, p->rel, FALSE); + tmp = Elf_RelocateEntry(p->file, p->secn, p->rel, FALSE); if (tmp) { /* Failed to relocate. Keep it in the list. */ tmp->next = newlist; @@ -2974,12 +2925,11 @@ return 0; while( erel ) { - Elf_RelocateEntry(erel->file, erel->secp, erel->rel, TRUE); + Elf_RelocateEntry(erel->file, erel->secn, erel->rel, TRUE); name = ElfGetSymbolName(erel->file, ELF_R_SYM(erel->rel->r_info)); flag = _LoaderHandleUnresolved( name, _LoaderHandleToName(erel->file->handle)); if(flag) fatalsym = 1; - xf86loaderfree(name); erel=erel->next; } return fatalsym; @@ -3031,8 +2981,14 @@ #if defined(__alpha__) || defined(__ia64__) if (elffile->shared_got) { elffile->shared_got->nuses--; - if (!elffile->shared_got->nuses) + if (!elffile->shared_got->nuses) { + ELFGotPtr *pgot = &ELFSharedGOTs; + while (*pgot && *pgot != elffile->shared_got) + pgot = &(*pgot)->next; + if (*pgot) + *pgot = elffile->shared_got->next; xf86loaderfree(elffile->shared_got); + } } #endif #else @@ -3045,12 +3001,37 @@ CheckandFreeFile(elffile->rodata,elffile->rodatsize); CheckandFreeFile(elffile->rodata1,elffile->rodat1size); CheckandFree(elffile->common,elffile->comsize); +#if defined(__alpha__) || defined(__ia64__) + CheckandFree(elffile->got,elffile->gotsize); +#endif #if defined(__ia64__) CheckandFree(elffile->plt,elffile->pltsize); #endif +#endif #if defined(__alpha__) || defined(__ia64__) - CheckandFree(elffile->got,elffile->gotsize); + { + ELFGotEntryPtr gotent; + while((gotent = elffile->got_entries)) { + elffile->got_entries = gotent->next; + xf86loaderfree(gotent); + } + } #endif +#if defined(__ia64__) + { + ELFPltEntryPtr pltent; + while ((pltent = elffile->plt_entries)) { + elffile->plt_entries = pltent->next; + xf86loaderfree(pltent); + } + } + { + ELFOpdPtr opdent; + while ((opdent = elffile->opd_entries)) { + elffile->opd_entries = opdent->next; + xf86loaderfree(opdent); + } + } #endif CheckandFreeFile(elffile->reltext,elffile->reltxtsize); CheckandFreeFile(elffile->reldata,elffile->reldatsize); @@ -3086,4 +3067,3 @@ } return NULL; } - Index: xc/programs/Xserver/hw/xfree86/loader/hash.c diff -u xc/programs/Xserver/hw/xfree86/loader/hash.c:1.13 xc/programs/Xserver/hw/xfree86/loader/hash.c:1.18 --- xc/programs/Xserver/hw/xfree86/loader/hash.c:1.13 Tue Sep 26 11:57:18 2000 +++ xc/programs/Xserver/hw/xfree86/loader/hash.c Thu Feb 22 18:17:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/hash.c,v 1.13 2000/09/26 15:57:18 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/hash.c,v 1.18 2001/02/22 23:17:09 dawes Exp $ */ /* * @@ -135,48 +135,66 @@ int module; LOOKUP *list ; { - LOOKUP *l = list; - itemPtr i; - char *modname; + LOOKUP *l = list, *exports = NULL; + itemPtr i, exportsItem = NULL; + char *modname; if (!list) return; - /* Visit every symbol in the lookup table, - * and add it to the given namespace. + + /* + * First look for a symbol called <name>ExportedSymbols. If it exists, + * only export the symbols that are listed in that array. Otherwise + * export all of the external symbols. */ - while ( l->symName ) { - i = xf86loadermalloc( sizeof( itemRec )) ; - i->name = l->symName ; - if( strcmp(i->name,"ModuleInit") == 0 -#if defined(__powerpc__) && defined(Lynx) - || strcmp(i->name,".ModuleInit") == 0 -#endif - ) - { - char *origname=i->name; - /* - * special handling for symbol name "ModuleInit" - */ - modname = _LoaderHandleToCanonicalName(handle); - if (modname) - { - i->name = xf86loadermalloc(strlen(modname) + - strlen(origname) + 1); - if( i->name ) - { - /* XXX Is this right for PPC? */ - strcpy(i->name,modname); - strcat(i->name,origname); - } + modname = _LoaderHandleToCanonicalName(handle); + if (modname) { + char *exportname; + + exportname = xf86loadermalloc(strlen("ExportedSymbols") + + strlen(modname) + 1); + if (exportname) { + sprintf(exportname, "%sExportedSymbols", modname); + while (l->symName) { + if (strcmp(l->symName, exportname) == 0) { + exports = l; + ErrorF("LoaderAddSymbols: %s: %s found\n", modname, + exportname); + break; } -#ifdef DEBUG - ErrorF("Add module init function %s at %lx\n",i->name, l->offset); -#endif + l++; + } + } + } + + /* + * Allocate the exports list item first. + */ + if (exports) { + exportsItem = xf86loadermalloc( sizeof( itemRec )) ; + exportsItem->name = exports->symName ; + exportsItem->address = (char *) exports->offset ; + exportsItem->handle = handle ; + exportsItem->module = module ; + exportsItem->exports = NULL; + LoaderHashAdd( exportsItem ); + } + + /* + * Visit every symbol in the lookup table, tagging it with the + * reference to the export list, if present. + */ + l = list; + while ( l->symName ) { + if (l != exports) { + i = xf86loadermalloc( sizeof( itemRec )) ; + i->name = l->symName ; + i->address = (char *) l->offset ; + i->handle = handle ; + i->module = module ; + i->exports = exportsItem; + LoaderHashAdd( i ); } - i->address = (char *) l->offset ; - i->handle = handle ; - i->module = module ; - LoaderHashAdd( i ); l ++ ; } } Index: xc/programs/Xserver/hw/xfree86/loader/loader.c diff -u xc/programs/Xserver/hw/xfree86/loader/loader.c:1.49 xc/programs/Xserver/hw/xfree86/loader/loader.c:1.53 --- xc/programs/Xserver/hw/xfree86/loader/loader.c:1.49 Wed Dec 13 11:52:01 2000 +++ xc/programs/Xserver/hw/xfree86/loader/loader.c Thu Apr 5 11:55:28 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.49 2000/12/13 16:52:01 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.c,v 1.53 2001/04/05 15:55:28 dawes Exp $ */ /* * @@ -49,7 +49,6 @@ #include "xf86.h" #include "xf86Priv.h" -#define NO_COMPILER_H_EXTRAS #include "compiler.h" extern LOOKUP miLookupTab[]; @@ -366,7 +365,7 @@ #endif if (strncmp((char *) buf, ELFMAG, SELFMAG) == 0) { - if( buf[ELFDLOFF] == ELFDLMAG ) { + if( *((Elf32_Half *)(buf + ELFDLOFF)) == ELFDLMAG ) { return LD_ELFDLOBJECT; } else { return LD_ELFOBJECT; @@ -1098,6 +1097,7 @@ * Check to see if the module is already loaded. * Only if we are loading it into an existing namespace. * If it is to be loaded into a new namespace, don't check. + * Note: We only have one namespace. */ if (handle >= 0) { tmp = listHead; @@ -1196,20 +1196,20 @@ void * LoaderSymbol(const char *sym) { - int i; - itemPtr item = NULL; - for (i = 0; i < numloaders; i++) + int i; + itemPtr item = NULL; + for (i = 0; i < numloaders; i++) funcs[i].ResolveSymbols(&funcs[i]); - item = (itemPtr) LoaderHashFind(sym); + item = (itemPtr) LoaderHashFind(sym); - if ( item ) - return item->address ; - else + if ( item ) + return item->address ; + else #ifdef DLOPEN_SUPPORT - return(DLFindSymbol(sym)); + return(DLFindSymbol(sym)); #else - return NULL; + return NULL; #endif } @@ -1249,8 +1249,10 @@ return ret; } +void xf86LoaderTrap(void); + void -xf86LoaderTrap() +xf86LoaderTrap(void) { } Index: xc/programs/Xserver/hw/xfree86/loader/loader.h diff -u xc/programs/Xserver/hw/xfree86/loader/loader.h:1.23 xc/programs/Xserver/hw/xfree86/loader/loader.h:1.25 --- xc/programs/Xserver/hw/xfree86/loader/loader.h:1.23 Mon Nov 13 18:09:56 2000 +++ xc/programs/Xserver/hw/xfree86/loader/loader.h Thu Feb 22 18:17:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.h,v 1.23 2000/11/13 23:09:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loader.h,v 1.25 2001/02/22 23:17:09 dawes Exp $ */ /* * @@ -84,12 +84,14 @@ AOUTRelocPtr aout_reloc; } LoaderRelocRec, *LoaderRelocPtr; +typedef struct _loader_item *itemPtr; typedef struct _loader_item { char *name ; void *address ; - struct _loader_item *next ; + itemPtr next ; int handle ; int module ; + itemPtr exports; #if defined(__powerpc__) /* * PowerPC file formats require special routines in some circumstances @@ -101,7 +103,7 @@ unsigned short glink[14]; /* XCOFF */ } code ; #endif - } itemRec, *itemPtr ; + } itemRec ; /* The following structures provide an interface to GDB (note that GDB has copies of the definitions - if you change anything here make @@ -215,7 +217,9 @@ void LoaderAddSymbols(int, int, LOOKUP *); void LoaderDefaultFunc(void); void LoaderDuplicateSymbol(const char *, const int); +#if 0 void LoaderFixups(void); +#endif void LoaderResolve(void); int LoaderResolveSymbols(void); int _LoaderHandleUnresolved(char *, char *); Index: xc/programs/Xserver/hw/xfree86/loader/loadmod.c diff -u xc/programs/Xserver/hw/xfree86/loader/loadmod.c:1.58 xc/programs/Xserver/hw/xfree86/loader/loadmod.c:1.64 --- xc/programs/Xserver/hw/xfree86/loader/loadmod.c:1.58 Wed Dec 13 11:52:01 2000 +++ xc/programs/Xserver/hw/xfree86/loader/loadmod.c Tue Mar 27 18:42:17 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadmod.c,v 1.58 2000/12/13 16:52:01 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/loadmod.c,v 1.64 2001/03/27 23:42:17 dawes Exp $ */ /* * @@ -28,7 +28,6 @@ #include "os.h" /* For stat() and related stuff */ #define NO_OSLIB_PROTOTYPES -#define NO_COMPILER_H_EXTRAS #include "xf86_OSlib.h" #if defined(SVR4) #include <sys/stat.h> @@ -73,6 +72,7 @@ ABI_FONT_VERSION }; +#if 0 void LoaderFixups (void) { @@ -81,6 +81,7 @@ LoaderResolveSymbols (); } +#endif static void FreeStringList(char **paths) @@ -184,6 +185,7 @@ { "drivers/", "input/", + "multimedia/", "extensions/", "fonts/", "internal/", @@ -542,7 +544,7 @@ CheckVersion (const char *module, XF86ModuleVersionInfo *data, const XF86ModReqInfo *req) { - int vercode[3]; + int vercode[4]; char verstr[4]; long ver = data->xf86version; int errtype = 0; @@ -551,21 +553,35 @@ data->modname ? data->modname : "UNKNOWN!", data->vendor ? data->vendor : "UNKNOWN!"); - verstr[1] = verstr[3] = 0; - verstr[2] = (ver & 0x1f) ? (ver & 0x1f) + 'a' - 1 : 0; - ver >>= 5; - verstr[0] = (ver & 0x1f) ? (ver & 0x1f) + 'A' - 1 : 0; - ver >>= 5; - vercode[2] = ver & 0x7f; - ver >>= 7; - vercode[1] = ver & 0x7f; - ver >>= 7; - vercode[0] = ver; - xf86ErrorF("\tcompiled for %d.%d", vercode[0], vercode[1]); - if (vercode[2] != 0) - xf86ErrorF(".%d", vercode[2]); - xf86ErrorF("%s%s, module version = %d.%d.%d\n", verstr, verstr + 2, - data->majorversion, data->minorversion, data->patchlevel); + if (ver > (4 << 24)) { + /* 4.0.x and earlier */ + verstr[1] = verstr[3] = 0; + verstr[2] = (ver & 0x1f) ? (ver & 0x1f) + 'a' - 1 : 0; + ver >>= 5; + verstr[0] = (ver & 0x1f) ? (ver & 0x1f) + 'A' - 1 : 0; + ver >>= 5; + vercode[2] = ver & 0x7f; + ver >>= 7; + vercode[1] = ver & 0x7f; + ver >>= 7; + vercode[0] = ver; + xf86ErrorF("\tcompiled for %d.%d", vercode[0], vercode[1]); + if (vercode[2] != 0) + xf86ErrorF(".%d", vercode[2]); + xf86ErrorF("%s%s, module version = %d.%d.%d\n", verstr, verstr + 2, + data->majorversion, data->minorversion, data->patchlevel); + } else { + vercode[0] = ver / 10000000; + vercode[1] = (ver / 100000) % 100; + vercode[2] = (ver / 1000) % 100; + vercode[3] = ver % 1000; + xf86ErrorF("\tcompiled for %d.%d.%d", vercode[0], vercode[1], + vercode[2]); + if (vercode[3] != 0) + xf86ErrorF(".%d", vercode[3]); + xf86ErrorF(", module version = %d.%d.%d\n", data->majorversion, + data->minorversion, data->patchlevel); + } if (data->moduleclass) xf86ErrorFVerb(2, "\tModule class: %s\n", data->moduleclass); Index: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c diff -u xc/programs/Xserver/hw/xfree86/loader/xf86sym.c:1.178.2.1 xc/programs/Xserver/hw/xfree86/loader/xf86sym.c:1.193 --- xc/programs/Xserver/hw/xfree86/loader/xf86sym.c:1.178.2.1 Thu Mar 15 17:45:57 2001 +++ xc/programs/Xserver/hw/xfree86/loader/xf86sym.c Fri May 18 20:26:45 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.178.2.1 2001/03/15 22:45:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/loader/xf86sym.c,v 1.193 2001/05/19 00:26:45 dawes Exp $ */ /* * @@ -22,6 +22,7 @@ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR * PERFORMANCE OF THIS SOFTWARE. */ +#define COMPILER_H_EXTRAS #include <fcntl.h> #include "sym.h" #include "misc.h" @@ -42,6 +43,7 @@ #endif #include "xf86OSmouse.h" #include "xf86xv.h" +#include "xf86xvmc.h" #include "xf86cmap.h" #include "xf86fbman.h" #include "dgaproc.h" @@ -51,13 +53,9 @@ #define DONT_DEFINE_WRAPPERS #include "xf86_ansic.h" #include "xisb.h" -#include "xf86Priv.h" #include "vbe.h" #include "xf86sbusBus.h" -#ifdef __alpha__ -/* MMIO function prototypes */ #include "compiler.h" -#endif #ifdef __FreeBSD__ /* XXX used in drmOpen(). This should change to use a less os-specific @@ -65,23 +63,6 @@ int sysctlbyname(const char*, void *, size_t *, void *, size_t); #endif -/* XXX Should get all of these from elsewhere */ -#if defined(PowerMAX_OS) || (defined(sun) && defined(SVR4)) -# undef inb -# undef inw -# undef inl -# undef outb -# undef outw -# undef outl - -extern void outb(unsigned int a, unsigned char b); -extern void outw(unsigned int a, unsigned short w); -extern void outl(unsigned int a, unsigned long l); -extern unsigned char inb(unsigned int a); -extern unsigned short inw(unsigned int a); -extern unsigned long inl(unsigned int a); -#endif - #if defined(__alpha__) # ifdef linux extern unsigned long _bus_base(void); @@ -120,16 +101,9 @@ extern long __moddi3(long, long); extern long __udivdi3(long, long); extern long __umoddi3(long, long); -extern void _outb(char val, unsigned short port); -extern void _outw(short val, unsigned short port); -extern void _outl(int val, unsigned short port); -extern unsigned int _inb(unsigned short port); -extern unsigned int _inw(unsigned short port); -extern unsigned int _inl(unsigned short port); #endif #if defined(__powerpc__) && (defined(Lynx) || defined(linux)) -void eieio(); void _restf14(); void _restf17(); void _restf18(); @@ -171,14 +145,6 @@ extern unsigned int inb(unsigned short); extern unsigned int inw(unsigned short); extern unsigned int inl(unsigned short); -extern unsigned long ldq_u(void *); -extern unsigned long ldl_u(void *); -extern unsigned short ldw_u(void *); -extern void stl_u(unsigned long, void *); -extern void stq_u(unsigned long, void *); -extern void stw_u(unsigned short, void *); -extern void mem_barrier(void); -extern void write_mem_barrier(void); extern void stl_brx(unsigned long, volatile unsigned char *, int); extern void stw_brx(unsigned short, volatile unsigned char *, int); extern unsigned long ldl_brx(volatile unsigned char *, int); @@ -191,11 +157,7 @@ extern int testinx(unsigned short, unsigned char); #endif -/* XXX This needs to be cleaned up for the new design */ - -#ifdef DPMSExtension extern void DPMSSet(CARD16); -#endif /* XFree86 things */ @@ -246,7 +208,7 @@ SYMFUNC(xf86UnbindGARTMemory) SYMFUNC(xf86EnableAGP) SYMFUNC(xf86SoundKbdBell) - + SYMFUNC(xf86GARTCloseScreen) #ifdef XINPUT /* XISB routines (Merged from Metrolink tree) */ SYMFUNC(XisbNew) @@ -304,6 +266,7 @@ SYMFUNC(xf86FindScreenForEntity) SYMFUNC(xf86FindPciDeviceVendor) SYMFUNC(xf86FindPciClass) + SYMFUNC(xf86EnablePciBusMaster) SYMFUNC(xf86RegisterStateChangeNotificationCallback) SYMFUNC(xf86DeregisterStateChangeNotificationCallback) SYMFUNC(xf86NoSharedResources) @@ -446,6 +409,8 @@ SYMFUNC(xf86IsScreenPrimary) SYMFUNC(xf86RegisterRootWindowProperty) SYMFUNC(xf86IsUnblank) + SYMFUNC(xf86AddModuleInfo) + SYMFUNC(xf86DeleteModuleInfo) #ifdef __sparc__ /* xf86sbusBus.c */ @@ -497,6 +462,7 @@ SYMFUNC(xf86OptionValue) SYMFUNC(xf86OptionListReport) SYMFUNC(xf86SetIntOption) + SYMFUNC(xf86SetRealOption) SYMFUNC(xf86SetStrOption) SYMFUNC(xf86ReplaceIntOption) SYMFUNC(xf86ReplaceStrOption) @@ -554,6 +520,9 @@ SYMFUNC(xf86XVAllocateVideoAdaptorRec) SYMFUNC(xf86XVFreeVideoAdaptorRec) + /* xf86xvmc.c */ + SYMFUNC(xf86XvMCScreenInit) + /* xf86VidMode.c */ SYMFUNC(VidModeExtensionInit) #ifdef XF86VIDMODE @@ -582,6 +551,9 @@ SYMFUNC(VidModeGetModeValue) SYMFUNC(VidModeSetModeValue) SYMFUNC(VidModeGetMonitorValue) + SYMFUNC(VidModeSetGammaRamp) + SYMFUNC(VidModeGetGammaRamp) + SYMFUNC(VidModeGetGammaRampSize) #endif /* xf86MiscExt.c */ @@ -601,8 +573,8 @@ SYMFUNC(GetTimeInMillis) /* xf86Xinput.c */ - SYMFUNC(xf86ProcessCommonOptions) #ifdef XINPUT + SYMFUNC(xf86ProcessCommonOptions) SYMFUNC(xf86IsCorePointer) SYMFUNC(xf86PostMotionEvent) SYMFUNC(xf86PostProximityEvent) @@ -617,9 +589,7 @@ SYMFUNC(xf86XInputSetSendCoreEvents) /* End merged segment */ #endif -#ifdef DPMSExtension SYMFUNC(DPMSSet) -#endif /* xf86Debug.c */ #ifdef BUILDDEBUG SYMFUNC(xf86Break1) Index: xc/programs/Xserver/hw/xfree86/os-support/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/Imakefile:3.43 xc/programs/Xserver/hw/xfree86/os-support/Imakefile:3.44 --- xc/programs/Xserver/hw/xfree86/os-support/Imakefile:3.43 Mon Nov 6 14:24:08 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/Imakefile Mon Apr 23 08:08:14 2001 @@ -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 $ @@ -32,10 +32,6 @@ # else OS_SUBDIR = sysv # endif -#endif - -#if defined(cygwinArchitecture) -OS_SUBDIR = cygwin #endif #if defined(SVR4Architecture) Index: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h diff -u xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h:1.1 Sat Jan 22 23:44:35 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h Sat Jan 6 15:19:14 2001 @@ -1,46 +1,55 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v 1.1 2000/01/23 04:44:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/int10Defines.h,v 1.2 2001/01/06 20:19:14 tsi Exp $ */ + +#ifndef _INT10DEFINES_H_ +#define _INT10DEFINES_H_ 1 + #ifdef _VM86_LINUX #include <asm/vm86.h> -#define CPU_R(type,name) \ - (*((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.##name))) -#define CPU_RD(name) CPU_R(CARD32,name) -#define CPU_RW(name) CPU_R(CARD16,name) -#define CPU_RB(name) CPU_R(CARD8,name) - -#define X86_EAX CPU_RD(eax) -#define X86_EBX CPU_RD(ebx) -#define X86_ECX CPU_RD(ecx) -#define X86_EDX CPU_RD(edx) -#define X86_ESI CPU_RD(esi) -#define X86_EDI CPU_RD(edi) -#define X86_EBP CPU_RD(ebp) -#define X86_EIP CPU_RD(eip) -#define X86_ESP CPU_RD(esp) -#define X86_EFLAGS CPU_RD(eflags) - -#define X86_FLAGS CPU_RW(eflags) -#define X86_AX CPU_RW(eax) -#define X86_BX CPU_RW(ebx) -#define X86_CX CPU_RW(ecx) -#define X86_DX CPU_RW(edx) -#define X86_SI CPU_RW(esi) -#define X86_DI CPU_RW(edi) -#define X86_BP CPU_RW(ebp) -#define X86_IP CPU_RW(eip) -#define X86_SP CPU_RW(esp) -#define X86_CS CPU_RW(cs) -#define X86_DS CPU_RW(ds) -#define X86_ES CPU_RW(es) -#define X86_SS CPU_RW(ss) -#define X86_FS CPU_RW(fs) -#define X86_GS CPU_RW(gs) - -#define X86_AL CPU_RB(eax) -#define X86_BL CPU_RB(ebx) -#define X86_CL CPU_RB(ecx) -#define X86_DL CPU_RB(edx) +#define CPU_R(type,name,num) \ + (((type *)&(((struct vm86_struct *)REG->cpuRegs)->regs.##name))[num]) +#define CPU_RD(name,num) CPU_R(CARD32,name,num) +#define CPU_RW(name,num) CPU_R(CARD16,name,num) +#define CPU_RB(name,num) CPU_R(CARD8,name,num) + +#define X86_EAX CPU_RD(eax,0) +#define X86_EBX CPU_RD(ebx,0) +#define X86_ECX CPU_RD(ecx,0) +#define X86_EDX CPU_RD(edx,0) +#define X86_ESI CPU_RD(esi,0) +#define X86_EDI CPU_RD(edi,0) +#define X86_EBP CPU_RD(ebp,0) +#define X86_EIP CPU_RD(eip,0) +#define X86_ESP CPU_RD(esp,0) +#define X86_EFLAGS CPU_RD(eflags,0) + +#define X86_FLAGS CPU_RW(eflags,0) +#define X86_AX CPU_RW(eax,0) +#define X86_BX CPU_RW(ebx,0) +#define X86_CX CPU_RW(ecx,0) +#define X86_DX CPU_RW(edx,0) +#define X86_SI CPU_RW(esi,0) +#define X86_DI CPU_RW(edi,0) +#define X86_BP CPU_RW(ebp,0) +#define X86_IP CPU_RW(eip,0) +#define X86_SP CPU_RW(esp,0) +#define X86_CS CPU_RW(cs,0) +#define X86_DS CPU_RW(ds,0) +#define X86_ES CPU_RW(es,0) +#define X86_SS CPU_RW(ss,0) +#define X86_FS CPU_RW(fs,0) +#define X86_GS CPU_RW(gs,0) + +#define X86_AL CPU_RB(eax,0) +#define X86_BL CPU_RB(ebx,0) +#define X86_CL CPU_RB(ecx,0) +#define X86_DL CPU_RB(edx,0) + +#define X86_AH CPU_RB(eax,1) +#define X86_BH CPU_RB(ebx,1) +#define X86_CH CPU_RB(ecx,1) +#define X86_DH CPU_RB(edx,1) #elif defined(_X86EMU) @@ -48,3 +57,4 @@ #endif +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h:1.12 xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h:1.14 --- xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h:1.12 Mon Dec 18 10:52:25 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h Wed Mar 7 11:21:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.12 2000/12/18 15:52:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86OSmouse.h,v 1.14 2001/03/07 16:21:04 paulo Exp $ */ /* * Copyright (c) 1997-1999 by The XFree86 Project, Inc. @@ -9,6 +9,8 @@ #ifndef _XF86OSMOUSE_H_ #define _XF86OSMOUSE_H_ +#include "xf86Xinput.h" + /* Mouse interface classes */ #define MSE_NONE 0x00 #define MSE_SERIAL 0x01 /* serial port */ @@ -121,7 +123,8 @@ int invY; int mouseFlags; /* Flags to Clear after opening * mouse dev */ - int truebuttons; /* Arg to maintain before + int truebuttons; /* (not used) + * Arg to maintain before * emulate3buttons timer callback */ int resolution; int negativeZ; Index: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h:3.76.2.2 xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h:3.81.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h:3.76.2.2 Fri Mar 2 17:55:24 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h Tue May 29 12:38:00 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.76.2.2 2001/03/02 22:55:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSlib.h,v 3.81.2.1 2001/05/29 16:38:00 tsi Exp $ */ /* * Copyright 1990, 1991 by Thomas Roell, Dinkelscherben, Germany * Copyright 1992 by David Dawes <dawes@XFree86.org> @@ -98,10 +98,6 @@ #endif #endif -#ifndef NO_COMPILER_H -#include "compiler.h" -#endif - #if defined(MACH386) || defined(__OSF__) # undef NULL #endif /* MACH386 || __OSF__ */ @@ -112,7 +108,10 @@ /**************************************************************************/ /* SYSV386 (SVR3, SVR4) - But not Solaris8 */ /**************************************************************************/ -#if (defined(SYSV) || defined(SVR4)) && !defined(DGUX) && !defined(__SOL8__) +#if (defined(SYSV) || defined(SVR4)) && \ + !defined(DGUX) && \ + !defined(__SOL8__) && \ + (!defined(sun) || defined(i386)) # ifdef SCO325 # ifndef _SVID3 # define _SVID3 @@ -130,12 +129,12 @@ # 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> @@ -157,8 +156,6 @@ # 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 */ @@ -168,16 +165,18 @@ # 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 @@ -189,7 +188,7 @@ # 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> @@ -230,35 +229,25 @@ # 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 */ @@ -266,21 +255,23 @@ * Good ol' Solaris8, and its lack of VT support ***********/ -#ifdef __SOL8__ -#include <sys/mman.h> -#include <errno.h> -#include <sys/sysi86.h> -#include <sys/psw.h> +#if defined(__SOL8__) || (defined(sun) && !defined(i386)) +# 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__ */ @@ -386,10 +377,6 @@ # define POSIX_TTY -# ifdef __sparc__ -# define DEV_MEM "/dev/fb" -# endif - #endif /* linux */ /**************************************************************************/ @@ -911,5 +898,9 @@ #define XF86_OS_PRIVS #include "xf86_OSproc.h" + +#ifndef NO_COMPILER_H +#include "compiler.h" +#endif #endif /* _XF86_OSLIB_H */ Index: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h:3.49 xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h:3.52 --- xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h:3.49 Thu Dec 7 10:43:45 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h Fri May 18 20:26:45 2001 @@ -64,7 +64,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.49 2000/12/07 15:43:45 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_OSproc.h,v 3.52 2001/05/19 00:26:45 dawes Exp $ */ #ifndef _XF86_OSPROC_H #define _XF86_OSPROC_H @@ -193,14 +193,8 @@ extern Bool xf86BindGARTMemory(int screenNum, int key, unsigned long offset); extern Bool xf86UnbindGARTMemory(int screenNum, int key); extern Bool xf86EnableAGP(int screenNum, CARD32 mode); +extern Bool xf86GARTCloseScreen(int screenNum); -#if defined(__alpha__) -extern void xf86JensenMemToBus(char *, long, long, int); -extern void xf86JensenBusToMem(char *, char *, unsigned long, int); -extern void xf86SlowBCopyFromBus(unsigned char *, unsigned char *, int); -extern void xf86SlowBCopyToBus(unsigned char *, unsigned char *, int); -#endif /* __alpha__ */ - /* These routines are in shared/sigio.c and are not loaded as part of the module. These routines are small, and the code if very POSIX-signal (or OS-signal) specific, so it seemed better to provide more complex @@ -252,7 +246,7 @@ 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 */ Index: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h:3.44 xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h:3.47 --- xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h:3.44 Wed Dec 6 15:39:53 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h Fri May 18 16:22:30 2001 @@ -22,7 +22,7 @@ * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.44 2000/12/06 20:39:53 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86_ansic.h,v 3.47 2001/05/18 20:22:30 tsi Exp $ */ #ifndef _XF86_ANSIC_H #define _XF86_ANSIC_H @@ -179,7 +179,7 @@ extern xf86size_t xf86fread(void*,xf86size_t,xf86size_t,XF86FILE*); extern void xf86free(void*); extern XF86FILE* xf86freopen(const char*,const char*,XF86FILE*); -#ifdef HAVE_VFSCANF +#if defined(HAVE_VFSCANF) || !defined(NEED_XF86_PROTOTYPES) extern int xf86fscanf(XF86FILE*,const char*,...); #else extern int xf86fscanf(/*XF86FILE*,const char*,char *,char *,char *,char *, @@ -226,7 +226,7 @@ extern int xf86sprintf(char*,const char*,...); extern int xf86snprintf(char*,xf86size_t,const char*,...); extern double xf86sqrt(double); -#ifdef HAVE_VSSCANF +#if defined(HAVE_VSSCANF) || !defined(NEED_XF86_PROTOTYPES) extern int xf86sscanf(char*,const char*,...); #else extern int xf86sscanf(/*char*,const char*,char *,char *,char *,char *, @@ -303,7 +303,7 @@ extern int xf86shmget(xf86key_t key, int size, int xf86shmflg); extern char * xf86shmat(int id, char *addr, int xf86shmflg); extern int xf86shmdt(char *addr); -extern int xf86shmctl(int id, int xf86cmd, pointer *buf); +extern int xf86shmctl(int id, int xf86cmd, pointer buf); extern int xf86setjmp(xf86jmp_buf env); extern void xf86longjmp(xf86jmp_buf env, int val); @@ -318,6 +318,8 @@ #include <sys/ipc.h> #include <sys/shm.h> #endif +#include <sys/stat.h> +#define stat_t struct stat #endif /* XFree86LOADER || NEED_XF86_PROTOTYPES */ /* Index: xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h:3.49 xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h:3.50 --- xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h:3.49 Tue Sep 19 08:46:21 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86_libc.h Tue Apr 10 12:08:03 2001 @@ -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 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 @@ #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 Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h:1.12 xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h:1.14.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h:1.12 Sun Sep 24 09:51:32 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h Thu May 31 22:24:18 2001 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -23,16 +23,26 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * * Author: Rickard E. (Rik) Faith <faith@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.12 2000/09/24 13:51:32 alanh Exp $ - * + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drm.h,v 1.14.2.1 2001/06/01 02:24:18 dawes Exp $ + * */ #ifndef _XF86DRM_H_ #define _XF86DRM_H_ + /* Defaults, if nothing set in xf86config */ +#define DRM_DEV_UID 0 +#define DRM_DEV_GID 0 +#define DRM_DEV_DIRMODE (S_IRUSR|S_IWUSR|S_IXUSR|S_IRGRP|S_IWGRP|S_IXGRP) +#define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) + +#define DRM_DIR_NAME "/dev/dri" +#define DRM_DEV_NAME "%s/card%d" +#define DRM_PROC_NAME "/proc/dri/" /* For backware Linux compatibility */ + #define DRM_ERR_NO_DEVICE (-1001) #define DRM_ERR_NO_ACCESS (-1002) #define DRM_ERR_NOT_ROOT (-1003) @@ -58,7 +68,22 @@ char *desc; /* User-space buffer to hold desc */ } drmVersion, *drmVersionPtr; +typedef struct _drmStats { + unsigned long count; /* Number of data */ + struct { + unsigned long value; /* Value from kernel */ + const char *long_format; /* Suggested format for long_name */ + const char *long_name; /* Long name for value */ + const char *rate_format; /* Suggested format for rate_name */ + const char *rate_name; /* Short name for value per second */ + int isvalue; /* True if value (vs. counter) */ + const char *mult_names; /* Multiplier names (e.g., "KGM") */ + int mult; /* Multiplier value (e.g., 1024) */ + int verbose; /* Suggest only in verbose output */ + } data[15]; +} drmStatsT; + /* All of these enums *MUST* match with the kernel implementation -- so do *NOT* change them! (The drmlib implementation @@ -68,7 +93,8 @@ 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 { @@ -77,7 +103,8 @@ DRM_LOCKED = 0x0004, /* Physical pages locked */ DRM_KERNEL = 0x0008, /* Kernel requires access */ DRM_WRITE_COMBINING = 0x0010, /* Use write-combining, if available */ - DRM_CONTAINS_LOCK = 0x0020 /* SHM page that contains lock */ + DRM_CONTAINS_LOCK = 0x0020, /* SHM page that contains lock */ + DRM_REMOVABLE = 0x0040 /* Removable mapping */ } drmMapFlags; typedef enum { /* These values *MUST* match drm.h */ @@ -99,7 +126,8 @@ typedef enum { DRM_PAGE_ALIGN = 0x01, - DRM_AGP_BUFFER = 0x02 + DRM_AGP_BUFFER = 0x02, + DRM_SG_BUFFER = 0x04 } drmBufDescFlags; typedef enum { @@ -147,7 +175,7 @@ typedef struct _drmLock { volatile unsigned int lock; char padding[60]; - /* This is big enough for most current (and future?) architectures: + /* This is big enough for most current (and future?) architectures: DEC Alpha: 32 bytes Intel Merced: ? Intel P5/PPro/PII/PIII: 32 bytes @@ -175,14 +203,22 @@ int granted_count; /* Number of buffers granted at this size */ } drmDMAReq, *drmDMAReqPtr; -#if 0 - /* The kernel does this, but it doesn't - seem necessary with recent gcc's. */ -typedef struct { unsigned int a[100]; } __drm_dummy_lock_t; -#define __drm_dummy_lock(lock) (*(__volatile__ __drm_dummy_lock_t *)lock) -#else +typedef struct _drmRegion { + drmHandle handle; + unsigned int offset; + drmSize size; + drmAddress map; +} drmRegion, *drmRegionPtr; + +typedef struct _drmTextureRegion { + unsigned char next; + unsigned char prev; + unsigned char in_use; + unsigned char padding; /* Explicitly pad this out */ + unsigned int age; +} drmTextureRegion, *drmTextureRegionPtr; + #define __drm_dummy_lock(lock) (*(__volatile__ unsigned int *)lock) -#endif #define DRM_LOCK_HELD 0x80000000 /* Hardware lock is held */ #define DRM_LOCK_CONT 0x40000000 /* Hardware lock is contended */ @@ -227,7 +263,7 @@ : "r" (old), \ "r" (new)); \ } while(0) - + #elif defined(__sparc__) #define DRM_CAS(lock,old,new,__ret) \ @@ -279,6 +315,25 @@ } 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 */ @@ -286,7 +341,7 @@ #define DRM_CAS(lock,old,new,ret) do { ret=1; } while (0) /* FAST LOCK FAILS */ #endif -#ifdef __alpha__ +#if defined(__alpha__) || defined(__powerpc__) #define DRM_CAS_RESULT(_result) int _result #else #define DRM_CAS_RESULT(_result) char _result @@ -314,7 +369,7 @@ if (flags) drmGetLock(fd,context,flags); \ else DRM_LIGHT_LOCK(fd,lock,context); \ } while(0) - + #define DRM_UNLOCK(fd,lock,context) \ do { \ DRM_CAS_RESULT(__ret); \ @@ -372,6 +427,14 @@ extern char *drmGetBusid(int fd); extern int drmGetInterruptFromBusID(int fd, int busnum, int devnum, int funcnum); +extern int drmGetMap(int fd, int idx, drmHandle *offset, + drmSize *size, drmMapType *type, + drmMapFlags *flags, drmHandle *handle, + int *mtrr); +extern int drmGetClient(int fd, int idx, int *auth, int *pid, + int *uid, unsigned long *magic, + unsigned long *iocs); +extern int drmGetStats(int fd, drmStatsT *stats); /* General user-level programmer's API: X server (root) only */ @@ -384,7 +447,11 @@ drmMapType type, drmMapFlags flags, drmHandlePtr handle); -extern int drmAddBufs(int fd, int count, int size, +extern int drmRmMap(int fd, drmHandle handle); +extern int drmAddContextPrivateMapping(int fd, drmContext ctx_id, + drmHandle handle); + +extern int drmAddBufs(int fd, int count, int size, drmBufDescFlags flags, int agp_offset); extern int drmMarkBufs(int fd, double low, double high); @@ -426,12 +493,14 @@ drmLockFlags flags); extern int drmUnlock(int fd, drmContext context); extern int drmFinish(int fd, int context, drmLockFlags flags); +extern int drmGetContextPrivateMapping(int fd, drmContext ctx_id, + drmHandlePtr handle); /* AGP/GART support: X server (root) only */ extern int drmAgpAcquire(int fd); extern int drmAgpRelease(int fd); extern int drmAgpEnable(int fd, unsigned long mode); -extern int drmAgpAlloc(int fd, unsigned long size, +extern int drmAgpAlloc(int fd, unsigned long size, unsigned long type, unsigned long *address, unsigned long *handle); extern int drmAgpFree(int fd, unsigned long handle); @@ -449,6 +518,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); Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h:3.1 xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h:3.3 --- xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h:3.1 Fri Jun 16 20:03:26 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h Sun Apr 1 10:00:14 2001 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmI810.h,v 3.3 2001/04/01 14:00:14 tsi Exp $ */ /* WARNING: If you change any of these defines, make sure to change * the kernel include file as well (i810_drm.h) @@ -25,9 +26,9 @@ typedef struct _drmI810Init { unsigned int start; unsigned int end; - unsigned int size; - int ring_map_idx; - int buffer_map_idx; + unsigned int size; + unsigned int mmio_offset; + unsigned int buffers_offset; int sarea_off; unsigned int front_offset; Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h:3.3 xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h:3.6 --- xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h:3.3 Tue Sep 26 11:57:19 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h Mon Apr 16 11:02:13 2001 @@ -1,151 +1,71 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h,v 3.3 2000/09/26 15:57:19 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmMga.h,v 3.6 2001/04/16 15:02:13 tsi Exp $ */ +#ifndef __XF86DRI_MGA_H__ +#define __XF86DRI_MGA_H__ + /* * WARNING: If you change any of these defines, make sure to change * the kernel include file as well (mga_drm.h) */ -#ifndef _XF86DRI_MGA_H_ -#define _XF86DRI_MGA_H_ -#ifndef _MGA_DEFINES_ -#define _MGA_DEFINES_ -#define MGA_F 0x1 /* fog */ -#define MGA_A 0x2 /* alpha */ -#define MGA_S 0x4 /* specular */ -#define MGA_T2 0x8 /* multitexture */ - -#define MGA_WARP_TGZ 0 -#define MGA_WARP_TGZF (MGA_F) -#define MGA_WARP_TGZA (MGA_A) -#define MGA_WARP_TGZAF (MGA_F|MGA_A) -#define MGA_WARP_TGZS (MGA_S) -#define MGA_WARP_TGZSF (MGA_S|MGA_F) -#define MGA_WARP_TGZSA (MGA_S|MGA_A) -#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) -#define MGA_WARP_T2GZ (MGA_T2) -#define MGA_WARP_T2GZF (MGA_T2|MGA_F) -#define MGA_WARP_T2GZA (MGA_T2|MGA_A) -#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) -#define MGA_WARP_T2GZS (MGA_T2|MGA_S) -#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) -#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) -#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) - -#define MGA_MAX_G400_PIPES 16 -#define MGA_MAX_G200_PIPES 8 /* no multitex */ - -#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES - -#define MGA_CARD_TYPE_G200 1 -#define MGA_CARD_TYPE_G400 2 -#define MGA_FRONT 0x1 -#define MGA_BACK 0x2 -#define MGA_DEPTH 0x4 +typedef struct { + int installed; + unsigned long phys_addr; + int size; +} drmMGAWarpIndex; -/* 3d state excluding texture units: - */ -#define MGA_CTXREG_DSTORG 0 /* validated */ -#define MGA_CTXREG_MACCESS 1 -#define MGA_CTXREG_PLNWT 2 -#define MGA_CTXREG_DWGCTL 3 -#define MGA_CTXREG_ALPHACTRL 4 -#define MGA_CTXREG_FOGCOLOR 5 -#define MGA_CTXREG_WFLAG 6 -#define MGA_CTXREG_TDUAL0 7 -#define MGA_CTXREG_TDUAL1 8 -#define MGA_CTXREG_FCOL 9 -#define MGA_CTXREG_STENCIL 10 -#define MGA_CTXREG_STENCILCTL 11 -#define MGA_CTX_SETUP_SIZE 12 +typedef struct { + unsigned long sarea_priv_offset; -/* 2d state - */ -#define MGA_2DREG_PITCH 0 -#define MGA_2D_SETUP_SIZE 1 + int chipset; + int sgram; -/* Each texture unit has a state: - */ -#define MGA_TEXREG_CTL 0 -#define MGA_TEXREG_CTL2 1 -#define MGA_TEXREG_FILTER 2 -#define MGA_TEXREG_BORDERCOL 3 -#define MGA_TEXREG_ORG 4 /* validated */ -#define MGA_TEXREG_ORG1 5 -#define MGA_TEXREG_ORG2 6 -#define MGA_TEXREG_ORG3 7 -#define MGA_TEXREG_ORG4 8 -#define MGA_TEXREG_WIDTH 9 -#define MGA_TEXREG_HEIGHT 10 -#define MGA_TEX_SETUP_SIZE 11 + unsigned int maccess; -/* What needs to be changed for the current vertex dma buffer? - */ -#define MGA_UPLOAD_CTX 0x1 -#define MGA_UPLOAD_TEX0 0x2 -#define MGA_UPLOAD_TEX1 0x4 -#define MGA_UPLOAD_PIPE 0x8 -#define MGA_UPLOAD_TEX0IMAGE 0x10 -#define MGA_UPLOAD_TEX1IMAGE 0x20 -#define MGA_UPLOAD_2D 0x40 -#define MGA_WAIT_AGE 0x80 /* handled client-side */ -#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ -#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock - quiescent */ + unsigned int fb_cpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; -/* 32 buffers of 64k each, total 1 meg. - */ -#define MGA_DMA_BUF_ORDER 16 -#define MGA_DMA_BUF_SZ (1<<MGA_DMA_BUF_ORDER) -#define MGA_DMA_BUF_NR 31 + unsigned int depth_cpp; + unsigned int depth_offset, depth_pitch; -/* Keep these small for testing. - */ -#define MGA_NR_SAREA_CLIPRECTS 8 + unsigned int texture_offset[2]; + unsigned int texture_size[2]; -/* 2 heaps (1 for card, 1 for agp), each divided into upto 128 - * regions, subject to a minimum region size of (1<<16) == 64k. - * - * Clients may subdivide regions internally, but when sharing between - * clients, the region size is the minimum granularity. - */ + 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; -#define MGA_CARD_HEAP 0 -#define MGA_AGP_HEAP 1 -#define MGA_NR_TEX_HEAPS 2 -#define MGA_NR_TEX_REGIONS 16 -#define MGA_LOG_MIN_TEX_REGION_SIZE 16 -#endif +extern int drmMGAInitDMA( int fd, drmMGAInit *info ); +extern int drmMGACleanupDMA( int fd ); -typedef struct _drmMgaWarpIndex { - int installed; - unsigned long phys_addr; - int size; -} drmMgaWarpIndex; +extern int drmMGAFlushDMA( int fd, drmLockFlags flags ); -typedef struct _drmMgaInit { - int reserved_map_agpstart; - int reserved_map_idx; - int buffer_map_idx; - int sarea_priv_offset; - int primary_size; - int warp_ucode_size; - unsigned int frontOffset; - unsigned int backOffset; - unsigned int depthOffset; - unsigned int textureOffset; - unsigned int textureSize; - unsigned int agpTextureSize; - unsigned int agpTextureOffset; - unsigned int cpp; - unsigned int stride; - int sgram; - int chipset; - drmMgaWarpIndex WarpIndex[MGA_MAX_WARP_PIPES]; - unsigned int mAccess; -} drmMgaInit; +extern int drmMGAEngineReset( int fd ); + +extern int drmMGAFullScreen( int fd, int enable ); + +extern int drmMGASwapBuffers( int fd ); +extern int drmMGAClear( int fd, unsigned int flags, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ); + +extern int drmMGAFlushVertexBuffer( int fd, int indx, int used, int discard ); +extern int drmMGAFlushIndices( int fd, int indx, + int start, int end, int discard ); + +extern int drmMGATextureLoad( int fd, int indx, + unsigned int dstorg, unsigned int length ); +extern int drmMGAAgpBlit( int fd, unsigned int planemask, + unsigned int src, int src_pitch, + unsigned int dst, int dst_pitch, + int delta_sx, int delta_sy, + int delta_dx, int delta_dy, + int height, int ydir ); -Bool drmMgaCleanupDma(int driSubFD); -Bool drmMgaLockUpdate(int driSubFD, drmLockFlags flags); -Bool drmMgaInitDma(int driSubFD, drmMgaInit *info); #endif Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h diff -u xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h:3.5 xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h:3.11 --- xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h:3.5 Tue Dec 12 12:17:13 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h Mon Apr 16 11:02:13 2001 @@ -23,9 +23,11 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Author: Kevin E. Martin <kevin@precisioninsight.com> + * Author: + * Gareth Hughes <gareth@valinux.com> + * Kevin E. Martin <martin@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.5 2000/12/12 17:17:13 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmR128.h,v 3.11 2001/04/16 15:02:13 tsi Exp $ * */ @@ -44,10 +46,10 @@ #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; + int cce_secure; /* FIXME: Deprecated, we should remove this */ int ring_size; int usec_timeout; @@ -58,12 +60,12 @@ 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 ); @@ -76,11 +78,12 @@ extern int drmR128EngineReset( int fd ); +extern int drmR128FullScreen( int fd, int enable ); + extern int drmR128SwapBuffers( int fd ); extern int drmR128Clear( int fd, unsigned int flags, - int x, int y, int w, int h, - unsigned int clear_color, - unsigned int clear_depth ); + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ); extern int drmR128FlushVertexBuffer( int fd, int prim, int indx, int count, int discard ); @@ -104,7 +107,7 @@ extern int drmR128PolygonStipple( int fd, unsigned int *mask ); -extern int drmR128SubmitPacket( int fd, void *buffer, - int *count, int flags ); +extern int drmR128FlushIndirectBuffer( int fd, int indx, + int start, int end, int discard ); #endif Index: xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h:1.6 --- /dev/null Mon Jun 4 12:41:22 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h Mon Apr 16 11:02:13 2001 @@ -0,0 +1,107 @@ +/* xf86drmRadeon.h -- OS-independent header for Radeon DRM user-level + * library interface + * + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: + * Gareth Hughes <gareth@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/xf86drmRadeon.h,v 1.6 2001/04/16 15:02:13 tsi Exp $ + * + */ + +#ifndef _XF86DRI_RADEON_H_ +#define _XF86DRI_RADEON_H_ + +/* WARNING: If you change any of these defines, make sure to change + * the kernel include file as well (radeon_drm.h) + */ + +#define DRM_RADEON_FRONT 0x1 +#define DRM_RADEON_BACK 0x2 +#define DRM_RADEON_DEPTH 0x4 + +typedef struct { + unsigned long sarea_priv_offset; + int is_pci; + int cp_mode; + int agp_size; + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + + unsigned 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 { + unsigned int x; + unsigned int y; + unsigned int width; + unsigned int height; + void *data; +} drmRadeonTexImage; + +extern int drmRadeonInitCP( int fd, drmRadeonInit *info ); +extern int drmRadeonCleanupCP( int fd ); + +extern int drmRadeonStartCP( int fd ); +extern int drmRadeonStopCP( int fd ); +extern int drmRadeonResetCP( int fd ); +extern int drmRadeonWaitForIdleCP( int fd ); + +extern int drmRadeonEngineReset( int fd ); + +extern int drmRadeonFullScreen( int fd, int enable ); + +extern int drmRadeonSwapBuffers( int fd ); +extern int drmRadeonClear( int fd, unsigned int flags, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask, + void *boxes, int nbox ); + +extern int drmRadeonFlushVertexBuffer( int fd, int prim, int indx, + int count, int discard ); +extern int drmRadeonFlushIndices( int fd, int prim, int indx, + int start, int end, int discard ); + +extern int drmRadeonLoadTexture( int fd, int offset, int pitch, int format, + int width, int height, + drmRadeonTexImage *image ); + +extern int drmRadeonPolygonStipple( int fd, unsigned int *mask ); + +extern int drmRadeonFlushIndirectBuffer( int fd, int indx, + int start, int end, int discard ); + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile:3.46.2.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile:3.47 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile:3.46.2.1 Fri Mar 9 13:03:48 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile Thu Feb 15 14:34:20 2001 @@ -4,7 +4,7 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.46.2.1 2001/03/09 18:03:48 eich Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/Imakefile,v 3.47 2001/02/15 19:34:20 eich Exp $ #include <Server.tmpl> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c:1.2 Mon Nov 6 14:24:08 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c Fri Feb 16 09:45:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.2 2000/11/06 19:24:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsdResource.c,v 1.6 2001/02/16 14:45:10 tsi Exp $ */ /* Resource information code */ @@ -23,10 +23,10 @@ resPtr ret = NULL; resRange range; - RANGE(range,0,0xffffffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0,0xffffffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock); ret = xf86AddResToList(ret, &range, -1); return ret; } @@ -44,10 +44,10 @@ * region 0x40000000-0xbfffffff for DMA but this only matters if * the bios screws up the pci region mappings. */ - RANGE(range,0x80000000,0xffffffff,ResExcMemBlock); + RANGE(range, 0x80000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0,0xffffffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock); ret = xf86AddResToList(ret, &range, -1); return ret; } @@ -58,10 +58,10 @@ resPtr ret = NULL; resRange range; - RANGE(range,0,0xffffffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0,0xffffffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock); ret = xf86AddResToList(ret, &range, -1); return ret; } @@ -74,17 +74,33 @@ /* * Fallback is to claim the following areas: * - * 0x000C0000 - 0x000EFFFF location of VGA and other extensions ROMS + * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS */ - RANGE(range,0xc0000,0xeffff,ResExcMemBlock); + RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - /* Fallback is to claim well known ports in the 0x0 - 0x3ff range */ - /* Possibly should claim some of them as sparse ranges */ + /* + * Fallback would be to claim well known ports in the 0x0 - 0x3ff range + * along with their sparse I/O aliases, but that's too imprecise. Instead + * claim a bare minimum here. + */ + RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */ + ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0,0x1ff,ResExcIoBlock | ResEstimated); + /* + * At minimum, the top and bottom resources must be claimed, so that + * resources that are (or appear to be) unallocated can be relocated. + */ + RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); + ret = xf86AddResToList(ret, &range, -1); + RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); +/* RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); + ret = xf86AddResToList(ret, &range, -1); */ + RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock); + ret = xf86AddResToList(ret, &range, -1); + /* XXX add others */ return ret; } @@ -99,10 +115,10 @@ resPtr ret = NULL; resRange range; - RANGE(range, 0, 0xffffffff, ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0, 0x0000ffff, ResExcIoBlock); + RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); ret = xf86AddResToList(ret, &range, -1); return ret; } @@ -113,17 +129,46 @@ resPtr ret = NULL; resRange range; - RANGE(range, 0, 0xffffffff, ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range, 0, 0x0000ffff, ResExcIoBlock); + RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); ret = xf86AddResToList(ret, &range, -1); return ret; } resPtr +xf86IsaBusAccWindowsFromOS(void) +{ + resPtr ret = NULL; + resRange range; + + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); + ret = xf86AddResToList(ret, &range, -1); + + RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); + ret = xf86AddResToList(ret, &range, -1); + return ret; +} + +resPtr xf86AccResFromOS(resPtr ret) { + resRange range; + + /* + * At minimum, the top and bottom resources must be claimed, so that + * resources that are (or appear to be) unallocated can be relocated. + */ + RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); + ret = xf86AddResToList(ret, &range, -1); + RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); + ret = xf86AddResToList(ret, &range, -1); + RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); + ret = xf86AddResToList(ret, &range, -1); + RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock); + ret = xf86AddResToList(ret, &range, -1); + return ret; } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c:1.1.2.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c:1.1 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c:1.1.2.1 Fri Mar 9 13:03:49 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c Thu Feb 15 14:34:18 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c,v 1.1.2.1 2001/03/09 18:03:49 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_axp.c,v 1.1 2001/02/15 19:34:18 eich Exp $ */ #include "X.h" #include "os.h" Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c:1.1 Sun Mar 5 11:59:17 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c Tue Feb 27 18:05:00 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c,v 1.1 2000/03/05 16:59:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_ev56.c,v 1.2 2001/02/27 23:05:00 alanh Exp $ */ #include "X.h" #include "input.h" @@ -29,18 +29,21 @@ int readDense8(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(volatile CARD8*) ((unsigned long)Base+(Offset)); } int readDense16(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(volatile CARD16*) ((unsigned long)Base+(Offset)); } int readDense32(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(volatile CARD32*)((unsigned long)Base+(Offset)); } @@ -65,20 +68,20 @@ void writeDense8(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(volatile CARD8 *)((unsigned long)Base+(Offset)) = Value; - mem_barrier(); } void writeDense16(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(volatile CARD16 *)((unsigned long)Base+(Offset)) = Value; - mem_barrier(); } void writeDense32(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value; - mem_barrier(); } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c:3.15.2.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c:3.16 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c:3.15.2.1 Sun Feb 11 13:03:48 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c Sat Feb 3 14:33:05 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.15.2.1 2001/02/11 18:03:48 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_init.c,v 3.16 2001/02/03 19:33:05 herrb Exp $ */ /* * Copyright 1992 by Rich Murphey <Rich@Rice.edu> * Copyright 1993 by David Wexelblat <dwex@goblin.org> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c:1.17.2.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c:1.18 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c:1.17.2.1 Sun Feb 11 13:03:48 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c Sat Feb 3 14:33:05 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.17.2.1 2001/02/11 18:03:48 herrb Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_mouse.c,v 1.18 2001/02/03 19:33:05 herrb Exp $ */ /* * Copyright 1999 by The XFree86 Project, Inc. Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c:3.40.2.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c:3.43 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c:3.40.2.1 Fri Mar 9 13:03:50 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c Sun Apr 22 04:48:51 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/bsd_video.c,v 3.40.2.1 2001/03/09 18:03:50 eich 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 @@ #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 @@ 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); @@ -1511,6 +1511,7 @@ register unsigned long result, shift; register unsigned long msb; + mem_barrier(); Offset += (unsigned long)Base - (unsigned long)memBase; shift = (Offset & 0x3) << 3; if (Offset >= (hae_thresh)) { @@ -1533,6 +1534,7 @@ register unsigned long result, shift; register unsigned long msb; + mem_barrier(); Offset += (unsigned long)Base - (unsigned long)memBase; shift = (Offset & 0x2) << 3; if (Offset >= (hae_thresh)) { @@ -1551,6 +1553,7 @@ static int readSparse32(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(vuip)((unsigned long)Base+(Offset)); } @@ -1560,6 +1563,7 @@ register unsigned long msb; register unsigned int b = Value & 0xffU; + write_mem_barrier(); Offset += (unsigned long)Base - (unsigned long)memBase; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; @@ -1570,7 +1574,6 @@ } } *(vuip) ((unsigned long)memSBase + (Offset << 5)) = b * 0x01010101; - mem_barrier(); } static void @@ -1579,6 +1582,7 @@ register unsigned long msb; register unsigned int w = Value & 0xffffU; + write_mem_barrier(); Offset += (unsigned long)Base - (unsigned long)memBase; if (Offset >= (hae_thresh)) { msb = Offset & hae_mask; @@ -1590,15 +1594,14 @@ } *(vuip)((unsigned long)memSBase+(Offset<<5)+(1<<(5-2))) = w * 0x00010001; - mem_barrier(); } static void writeSparse32(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(vuip)((unsigned long)Base + (Offset)) = Value; - mem_barrier(); return; } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile:1.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile:1.3 Fri Oct 27 17:14:55 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile Tue Apr 10 14:42:58 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/Imakefile,v 1.3 2000/10/27 21:14:55 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 @@ -14,10 +14,28 @@ MTRR_DEFINES = -DHAS_MTRR_SUPPORT #endif -SRCS = xf86drm.c xf86drmHash.c xf86drmRandom.c xf86drmSL.c xf86drmI810.c xf86drmMga.c xf86drmR128.c xf86drmSiS.c $(MSRC) -OBJS = xf86drm.o xf86drmHash.o xf86drmRandom.o xf86drmSL.o xf86drmI810.o xf86drmMga.o xf86drmR128.o xf86drmSiS.o $(MOBJ) + SRCS = xf86drm.c \ + xf86drmHash.c \ + xf86drmRandom.c \ + xf86drmSL.c \ + xf86drmI810.c \ + xf86drmMga.c \ + xf86drmR128.c \ + xf86drmRadeon.c \ + xf86drmSiS.c \ + $(MSRC) + + OBJS = xf86drm.o \ + xf86drmHash.o \ + xf86drmRandom.o \ + xf86drmSL.o \ + xf86drmI810.o \ + xf86drmMga.o \ + xf86drmR128.o \ + xf86drmRadeon.o \ + xf86drmSiS.o \ + $(MOBJ) - INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I../.. -Ikernel @@ -40,11 +58,13 @@ #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) LinkSourceFile(xf86drmR128.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmRandom.c,$(XF86OSSRC)/linux/drm) +LinkSourceFile(xf86drmRadeon.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmSL.c,$(XF86OSSRC)/linux/drm) LinkSourceFile(xf86drmSiS.c,$(XF86OSSRC)/linux/drm) Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/xf86drm.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/xf86drm.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/xf86drm.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/xf86drm.c:1.1 Fri Jun 16 20:03:27 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/xf86drm.c Mon Jun 4 12:41:23 2001 @@ -1,1108 +0,0 @@ -/* xf86drm.c -- User-level interface to DRM device - * Created: Tue Jan 5 08:16:21 1999 by faith@precisioninsight.com - * Revised: Wed Aug 4 07:54:23 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.43 1999/08/04 18:14:43 faith Exp $ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/xf86drm.c,v 1.1 2000/06/17 00:03:27 martin 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 -# include <stdio.h> -# include <stdlib.h> -# include <unistd.h> -# include <string.h> -# include <ctype.h> -# include <fcntl.h> -# 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> -# include <sys/types.h> -# ifdef DRM_USE_MALLOC -# define _DRM_MALLOC malloc -# define _DRM_FREE free -extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void*), void*); -extern int xf86RemoveSIGIOHandler(int fd); -# else -# include <Xlibint.h> -# define _DRM_MALLOC Xmalloc -# define _DRM_FREE Xfree -# endif -#endif - -int sysctlbyname(const char *, void *, size_t *, void *, size_t); - -/* Not all systems have MAP_FAILED defined */ -#ifndef MAP_FAILED -#define MAP_FAILED ((void *)-1) -#endif - -#include "xf86drm.h" -#include "drm.h" - -#define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */ - -static int drmOpenByBusid(const char *busid); -static int drmOpenDevice(const char *path, long dev, - mode_t mode, uid_t user, gid_t group); - -static void *drmHashTable = NULL; /* Context switch callbacks */ - -typedef struct drmHashEntry { - int fd; - void (*f)(int, void *, void *); - void *tagTable; -} drmHashEntry; - -void *drmMalloc(int size) -{ - void *pt; - if ((pt = _DRM_MALLOC(size))) memset(pt, 0, size); - return pt; -} - -void drmFree(void *pt) -{ - if (pt) _DRM_FREE(pt); -} - -static char *drmStrdup(const char *s) -{ - return s ? strdup(s) : NULL; -} - - -static unsigned long drmGetKeyFromFd(int fd) -{ -#ifdef XFree86LOADER - struct xf86stat st; -#else - struct stat st; -#endif - - st.st_rdev = 0; - fstat(fd, &st); - return st.st_rdev; -} - -static drmHashEntry *drmGetEntry(int fd) -{ - unsigned long key = drmGetKeyFromFd(fd); - void *value; - drmHashEntry *entry; - - if (!drmHashTable) drmHashTable = drmHashCreate(); - - if (drmHashLookup(drmHashTable, key, &value)) { - entry = drmMalloc(sizeof(*entry)); - entry->fd = fd; - entry->f = NULL; - entry->tagTable = drmHashCreate(); - drmHashInsert(drmHashTable, key, entry); - } else { - entry = value; - } - return entry; -} - -/* drm_open is used to open the /dev/drm device */ - -static int drm_open(const char *file) -{ - int fd = open(file, O_RDWR, 0); - - if (fd >= 0) return fd; - return -errno; -} - -/* drmAvailable looks for a usable device node in /dev/dri. */ - -int drmAvailable(void) -{ - int i, fd; - char dev_name[64]; - mode_t mode = DRM_DEV_MODE; - mode_t dirmode; - gid_t group = DRM_DEV_GID; - uid_t user = DRM_DEV_UID; - long dev = 0; - - if (!geteuid()) { - dirmode = mode; - if (dirmode & S_IRUSR) dirmode |= S_IXUSR; - if (dirmode & S_IRGRP) dirmode |= S_IXGRP; - if (dirmode & S_IROTH) dirmode |= S_IXOTH; - dirmode &= ~(S_IWGRP | S_IWOTH); - mkdir("/dev/dri", 0); - chown("/dev/dri", user, group); - chmod("/dev/dri", dirmode); - } - - for (i = 0; i < 8; i++) { - sprintf(dev_name, "/dev/dri/card%d", i); - dev = makedev(145, i); - fd = drmOpenDevice(dev_name, dev, mode, user, group); - if (fd < 0) { - remove(dev_name); - continue; - } - close(fd); - return 1; - } - return 0; -} - -static int drmOpenDevice(const char *path, long dev, - mode_t mode, uid_t user, gid_t group) -{ -#ifdef XFree86LOADER - struct xf86stat st; -#else - struct stat st; -#endif - - if (!stat(path, &st) && st.st_rdev == dev) return drm_open(path); - - if (geteuid()) return DRM_ERR_NOT_ROOT; - remove(path); - if (mknod(path, S_IFCHR, dev)) { - remove(path); - return DRM_ERR_NOT_ROOT; - } - chown(path, user, group); - chmod(path, mode); - return drm_open(path); -} - -static int drmOpenByName(const char *name) -{ - int i; - char dev_name[64]; - mode_t mode = DRM_DEV_MODE; - mode_t dirmode; - gid_t group = DRM_DEV_GID; - uid_t user = DRM_DEV_UID; - long dev = 0; - drmVersionPtr version; - int fd; - -#if defined(XFree86Server) - mode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE; - group = xf86ConfigDRI.group ? xf86ConfigDRI.group : DRM_DEV_GID; -#endif - -#if defined(XFree86Server) - if (!drmAvailable()) { - /* try to load the kernel module now */ - if (!xf86LoadKernelModule(name)) { - ErrorF("[drm] failed to load kernel module \"%s\"\n", - name); - return -1; - } - } -#else - if (!drmAvailable()) - return -1; -#endif - - if (!geteuid()) { - dirmode = mode; - if (dirmode & S_IRUSR) dirmode |= S_IXUSR; - if (dirmode & S_IRGRP) dirmode |= S_IXGRP; - if (dirmode & S_IROTH) dirmode |= S_IXOTH; - dirmode &= ~(S_IWGRP | S_IWOTH); - mkdir("/dev/dri", 0); - chown("/dev/dri", user, group); - chmod("/dev/dri", dirmode); - } - - for (i = 0; i < 8; i++) { - sprintf(dev_name, "/dev/dri/card%d", i); - dev = makedev(145, i); - fd = drmOpenDevice(dev_name, dev, mode, user, group); - if (fd < 0) { - remove(dev_name); - continue; - } - version = drmGetVersion(fd); - if (!version) { - continue; - } - if (!strcmp(version->name, name)) { - drmFreeVersion(version); - return fd; - } - drmFreeVersion(version); - } - -#if 0 - for (i = 0; i < 8; i++) { - sprintf(sysctl_name, "hw.dri.%d.name", i); - sprintf(dev_name, "/dev/dri/card%d", i); - len = sizeof(buf); - if (sysctlbyname(sysctl_name, buf, &len, 0, 0) == 0) { - buf[len-1] = '\0'; - for (driver = pt = buf; *pt && *pt != ' '; ++pt) - ; - if (*pt) { /* Device is next */ - *pt = '\0'; - if (!strcmp(driver, name)) { /* Match */ - for (devstring = ++pt; *pt && *pt != ' '; ++pt) - ; - if (*pt) { /* Found busid */ - return drmOpenByBusid(++pt); - } else { /* No busid */ - dev = strtol(devstring, NULL, 0); - return drmOpenDevice(dev_name, dev, - mode, user, group); - } - } - } - } else remove(dev_name); - } -#endif - - return -1; -} - -static int drmOpenByBusid(const char *busid) -{ - int i; - char dev_name[64]; - char *buf; - int fd; - - for (i = 0; i < 8; i++) { - sprintf(dev_name, "/dev/dri/card%d", i); - if ((fd = drm_open(dev_name)) >= 0) { - buf = drmGetBusid(fd); - if (buf && !strcmp(buf, busid)) { - drmFreeBusid(buf); - return fd; - } - if (buf) drmFreeBusid(buf); - close(fd); - } - } - return -1; -} - - -/* drmOpen looks up the specified name and busid, and opens the device - found. The entry in /dev/dri is created if necessary (and if root). - A file descriptor is returned. On error, the return value is - negative. */ - -int drmOpen(const char *name, const char *busid) -{ - if (busid) return drmOpenByBusid(busid); - return drmOpenByName(name); -} - -void drmFreeVersion(drmVersionPtr v) -{ - if (!v) return; - if (v->name) drmFree(v->name); - if (v->date) drmFree(v->date); - if (v->desc) drmFree(v->desc); - drmFree(v); -} - -static void drmFreeKernelVersion(drm_version_t *v) -{ - if (!v) return; - if (v->name) drmFree(v->name); - if (v->date) drmFree(v->date); - if (v->desc) drmFree(v->desc); - drmFree(v); -} - -static void drmCopyVersion(drmVersionPtr d, drm_version_t *s) -{ - d->version_major = s->version_major; - d->version_minor = s->version_minor; - d->version_patchlevel = s->version_patchlevel; - d->name_len = s->name_len; - d->name = drmStrdup(s->name); - d->date_len = s->date_len; - d->date = drmStrdup(s->date); - d->desc_len = s->desc_len; - d->desc = drmStrdup(s->desc); -} - -/* drmVersion obtains the version information via an ioctl. Similar - * information is available via /proc/drm. */ - -drmVersionPtr drmGetVersion(int fd) -{ - drmVersionPtr retval; - drm_version_t *version = drmMalloc(sizeof(*version)); - - /* First, get the lengths */ - version->name_len = 0; - version->name = NULL; - version->date_len = 0; - version->date = NULL; - version->desc_len = 0; - version->desc = NULL; - - if (ioctl(fd, DRM_IOCTL_VERSION, version)) { - drmFreeKernelVersion(version); - return NULL; - } - - /* Now, allocate space and get the data */ - if (version->name_len) - version->name = drmMalloc(version->name_len + 1); - if (version->date_len) - version->date = drmMalloc(version->date_len + 1); - if (version->desc_len) - version->desc = drmMalloc(version->desc_len + 1); - - if (ioctl(fd, DRM_IOCTL_VERSION, version)) { - drmFreeKernelVersion(version); - return NULL; - } - - /* The results might not be null-terminated - strings, so terminate them. */ - - if (version->name_len) version->name[version->name_len] = '\0'; - if (version->date_len) version->date[version->date_len] = '\0'; - if (version->desc_len) version->desc[version->desc_len] = '\0'; - - /* Now, copy it all back into the - client-visible data structure... */ - retval = drmMalloc(sizeof(*retval)); - drmCopyVersion(retval, version); - drmFreeKernelVersion(version); - return retval; -} - -void drmFreeBusid(const char *busid) -{ - drmFree((void *)busid); -} - -char *drmGetBusid(int fd) -{ - drm_unique_t u; - - u.unique_len = 0; - u.unique = NULL; - - if (ioctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) return NULL; - u.unique = drmMalloc(u.unique_len + 1); - if (ioctl(fd, DRM_IOCTL_GET_UNIQUE, &u)) return NULL; - u.unique[u.unique_len] = '\0'; - return u.unique; -} - -int drmSetBusid(int fd, const char *busid) -{ - drm_unique_t u; - - u.unique = (char *)busid; - u.unique_len = strlen(busid); - - if (ioctl(fd, DRM_IOCTL_SET_UNIQUE, &u)) return -errno; - return 0; -} - -int drmGetMagic(int fd, drmMagicPtr magic) -{ - drm_auth_t auth; - - *magic = 0; - if (ioctl(fd, DRM_IOCTL_GET_MAGIC, &auth)) return -errno; - *magic = auth.magic; - return 0; -} - -int drmAuthMagic(int fd, drmMagic magic) -{ - drm_auth_t auth; - - auth.magic = magic; - if (ioctl(fd, DRM_IOCTL_AUTH_MAGIC, &auth)) return -errno; - return 0; -} - -int drmAddMap(int fd, - drmHandle offset, - drmSize size, - drmMapType type, - drmMapFlags flags, - drmHandlePtr handle) -{ - drm_map_t map; - - map.offset = offset; - map.size = size; - map.handle = 0; - map.type = type; - map.flags = flags; - if (ioctl(fd, DRM_IOCTL_ADD_MAP, &map)) return -errno; - if (handle) *handle = (drmHandle)map.handle; - return 0; -} - -int drmAddBufs(int fd, int count, int size, drmBufDescFlags flags, - int agp_offset) -{ - drm_buf_desc_t request; - - request.count = count; - request.size = size; - request.low_mark = 0; - request.high_mark = 0; - request.flags = flags; - request.agp_start = agp_offset; - - if (ioctl(fd, DRM_IOCTL_ADD_BUFS, &request)) return -errno; - return request.count; -} - -int drmMarkBufs(int fd, double low, double high) -{ - drm_buf_info_t info; - int i; - - info.count = 0; - info.list = NULL; - - if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) return -EINVAL; - - if (!info.count) return -EINVAL; - - if (!(info.list = drmMalloc(info.count * sizeof(*info.list)))) - return -ENOMEM; - - if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) { - int retval = -errno; - drmFree(info.list); - return retval; - } - - for (i = 0; i < info.count; i++) { - info.list[i].low_mark = low * info.list[i].count; - info.list[i].high_mark = high * info.list[i].count; - if (ioctl(fd, DRM_IOCTL_MARK_BUFS, &info.list[i])) { - int retval = -errno; - drmFree(info.list); - return retval; - } - } - drmFree(info.list); - - return 0; -} - -int drmFreeBufs(int fd, int count, int *list) -{ - drm_buf_free_t request; - - request.count = count; - request.list = list; - if (ioctl(fd, DRM_IOCTL_FREE_BUFS, &request)) return -errno; - return 0; -} - -int drmClose(int fd) -{ - unsigned long key = drmGetKeyFromFd(fd); - drmHashEntry *entry = drmGetEntry(fd); - - drmHashDestroy(entry->tagTable); - entry->fd = 0; - entry->f = NULL; - entry->tagTable = NULL; - - drmHashDelete(drmHashTable, key); - drmFree(entry); - - return close(fd); -} - -int drmMap(int fd, - drmHandle handle, - drmSize size, - drmAddressPtr address) -{ - if (fd < 0) return -EINVAL; - *address = mmap(0, size, PROT_READ|PROT_WRITE, MAP_SHARED, fd, handle); - if (*address == MAP_FAILED) return -errno; - return 0; -} - -int drmUnmap(drmAddress address, drmSize size) -{ - return munmap(address, size); -} - -drmBufInfoPtr drmGetBufInfo(int fd) -{ - drm_buf_info_t info; - drmBufInfoPtr retval; - int i; - - info.count = 0; - info.list = NULL; - - if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) return NULL; - - if (info.count) { - if (!(info.list = drmMalloc(info.count * sizeof(*info.list)))) - return NULL; - - if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) { - drmFree(info.list); - return NULL; - } - /* Now, copy it all back into the - client-visible data structure... */ - retval = drmMalloc(sizeof(*retval)); - retval->count = info.count; - retval->list = drmMalloc(info.count * sizeof(*retval->list)); - for (i = 0; i < info.count; i++) { - retval->list[i].count = info.list[i].count; - retval->list[i].size = info.list[i].size; - retval->list[i].low_mark = info.list[i].low_mark; - retval->list[i].high_mark = info.list[i].high_mark; - } - drmFree(info.list); - return retval; - } - return NULL; -} - -drmBufMapPtr drmMapBufs(int fd) -{ - drm_buf_map_t bufs; - drmBufMapPtr retval; - int i; - - bufs.count = 0; - bufs.list = NULL; - if (ioctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) return NULL; - - if (bufs.count) { - if (!(bufs.list = drmMalloc(bufs.count * sizeof(*bufs.list)))) - return NULL; - - if (ioctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) { - drmFree(bufs.list); - return NULL; - } - /* Now, copy it all back into the - client-visible data structure... */ - retval = drmMalloc(sizeof(*retval)); - retval->count = bufs.count; - retval->list = drmMalloc(bufs.count * sizeof(*retval->list)); - for (i = 0; i < bufs.count; i++) { - retval->list[i].idx = bufs.list[i].idx; - retval->list[i].total = bufs.list[i].total; - retval->list[i].used = 0; - retval->list[i].address = bufs.list[i].address; - } - return retval; - } - return NULL; -} - -int drmUnmapBufs(drmBufMapPtr bufs) -{ - int i; - - for (i = 0; i < bufs->count; i++) { - munmap(bufs->list[i].address, bufs->list[i].total); - } - return 0; -} - -int drmDMA(int fd, drmDMAReqPtr request) -{ - drm_dma_t dma; - - /* Copy to hidden structure */ - dma.context = request->context; - dma.send_count = request->send_count; - dma.send_indices = request->send_list; - dma.send_sizes = request->send_sizes; - dma.flags = request->flags; - dma.request_count = request->request_count; - dma.request_size = request->request_size; - dma.request_indices = request->request_list; - dma.request_sizes = request->request_sizes; - if (ioctl(fd, DRM_IOCTL_DMA, &dma)) return -errno; - request->granted_count = dma.granted_count; - - return 0; -} - -int drmGetLock(int fd, drmContext context, drmLockFlags flags) -{ - drm_lock_t lock; - - lock.context = context; - lock.flags = 0; - if (flags & DRM_LOCK_READY) lock.flags |= _DRM_LOCK_READY; - if (flags & DRM_LOCK_QUIESCENT) lock.flags |= _DRM_LOCK_QUIESCENT; - if (flags & DRM_LOCK_FLUSH) lock.flags |= _DRM_LOCK_FLUSH; - if (flags & DRM_LOCK_FLUSH_ALL) lock.flags |= _DRM_LOCK_FLUSH_ALL; - if (flags & DRM_HALT_ALL_QUEUES) lock.flags |= _DRM_HALT_ALL_QUEUES; - if (flags & DRM_HALT_CUR_QUEUES) lock.flags |= _DRM_HALT_CUR_QUEUES; - - while (ioctl(fd, DRM_IOCTL_LOCK, &lock)) - ; - return 0; -} - -int drmUnlock(int fd, drmContext context) -{ - drm_lock_t lock; - - lock.context = context; - lock.flags = 0; - return ioctl(fd, DRM_IOCTL_UNLOCK, &lock); -} - -drmContextPtr drmGetReservedContextList(int fd, int *count) -{ - drm_ctx_res_t res; - drm_ctx_t *list; - drmContextPtr retval; - int i; - - res.count = 0; - res.contexts = NULL; - if (ioctl(fd, DRM_IOCTL_RES_CTX, &res)) return NULL; - - if (!res.count) return NULL; - - if (!(list = drmMalloc(res.count * sizeof(*list)))) return NULL; - if (!(retval = drmMalloc(res.count * sizeof(*retval)))) { - drmFree(list); - return NULL; - } - - res.contexts = list; - if (ioctl(fd, DRM_IOCTL_RES_CTX, &res)) return NULL; - - for (i = 0; i < res.count; i++) retval[i] = list[i].handle; - drmFree(list); - - *count = res.count; - return retval; -} - -void drmFreeReservedContextList(drmContextPtr pt) -{ - drmFree(pt); -} - -int drmCreateContext(int fd, drmContextPtr handle) -{ - drm_ctx_t ctx; - - ctx.flags = 0; /* Modified with functions below */ - if (ioctl(fd, DRM_IOCTL_ADD_CTX, &ctx)) return -errno; - *handle = ctx.handle; - return 0; -} - -int drmSwitchToContext(int fd, drmContext context) -{ - drm_ctx_t ctx; - - ctx.handle = context; - if (ioctl(fd, DRM_IOCTL_SWITCH_CTX, &ctx)) return -errno; - return 0; -} - -int drmSetContextFlags(int fd, drmContext context, drmContextFlags flags) -{ - drm_ctx_t ctx; - - /* Context preserving means that no context - switched are done between DMA buffers - from one context and the next. This is - suitable for use in the X server (which - promises to maintain hardware context, - or in the client-side library when - buffers are swapped on behalf of two - threads. */ - ctx.handle = context; - ctx.flags = 0; - if (flags & DRM_CONTEXT_PRESERVED) ctx.flags |= _DRM_CONTEXT_PRESERVED; - if (flags & DRM_CONTEXT_2DONLY) ctx.flags |= _DRM_CONTEXT_2DONLY; - if (ioctl(fd, DRM_IOCTL_MOD_CTX, &ctx)) return -errno; - return 0; -} - -int drmGetContextFlags(int fd, drmContext context, drmContextFlagsPtr flags) -{ - drm_ctx_t ctx; - - ctx.handle = context; - if (ioctl(fd, DRM_IOCTL_GET_CTX, &ctx)) return -errno; - *flags = 0; - if (ctx.flags & _DRM_CONTEXT_PRESERVED) *flags |= DRM_CONTEXT_PRESERVED; - if (ctx.flags & _DRM_CONTEXT_2DONLY) *flags |= DRM_CONTEXT_2DONLY; - return 0; -} - -int drmDestroyContext(int fd, drmContext handle) -{ - drm_ctx_t ctx; - ctx.handle = handle; - if (ioctl(fd, DRM_IOCTL_RM_CTX, &ctx)) return -errno; - return 0; -} - -int drmCreateDrawable(int fd, drmDrawablePtr handle) -{ - drm_draw_t draw; - if (ioctl(fd, DRM_IOCTL_ADD_DRAW, &draw)) return -errno; - *handle = draw.handle; - return 0; -} - -int drmDestroyDrawable(int fd, drmDrawable handle) -{ - drm_draw_t draw; - draw.handle = handle; - if (ioctl(fd, DRM_IOCTL_RM_DRAW, &draw)) return -errno; - return 0; -} - -int drmAgpAcquire(int fd) -{ - if (ioctl(fd, DRM_IOCTL_AGP_ACQUIRE, NULL)) return -errno; - return 0; -} - -int drmAgpRelease(int fd) -{ - if (ioctl(fd, DRM_IOCTL_AGP_RELEASE, NULL)) return -errno; - return 0; -} - -int drmAgpEnable(int fd, unsigned long mode) -{ - drm_agp_mode_t m; - - m.mode = mode; - if (ioctl(fd, DRM_IOCTL_AGP_ENABLE, &m)) return -errno; - return 0; -} - -int drmAgpAlloc(int fd, unsigned long size, unsigned long type, - unsigned long *address, unsigned long *handle) -{ - drm_agp_buffer_t b; - *handle = 0; - b.size = size; - b.handle = 0; - b.type = type; - if (ioctl(fd, DRM_IOCTL_AGP_ALLOC, &b)) return -errno; - if (address != 0UL) *address = b.physical; - *handle = b.handle; - return 0; -} - -int drmAgpFree(int fd, unsigned long handle) -{ - drm_agp_buffer_t b; - - b.size = 0; - b.handle = handle; - if (ioctl(fd, DRM_IOCTL_AGP_FREE, &b)) return -errno; - return 0; -} - -int drmAgpBind(int fd, unsigned long handle, unsigned long offset) -{ - drm_agp_binding_t b; - - b.handle = handle; - b.offset = offset; - if (ioctl(fd, DRM_IOCTL_AGP_BIND, &b)) return -errno; - return 0; -} - -int drmAgpUnbind(int fd, unsigned long handle) -{ - drm_agp_binding_t b; - - b.handle = handle; - b.offset = 0; - if (ioctl(fd, DRM_IOCTL_AGP_UNBIND, &b)) return -errno; - return 0; -} - -int drmAgpVersionMajor(int fd) -{ - drm_agp_info_t i; - - if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return -errno; - return i.agp_version_major; -} - -int drmAgpVersionMinor(int fd) -{ - drm_agp_info_t i; - - if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return -errno; - return i.agp_version_minor; -} - -unsigned long drmAgpGetMode(int fd) -{ - drm_agp_info_t i; - - if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0; - return i.mode; -} - -unsigned long drmAgpBase(int fd) -{ - drm_agp_info_t i; - - if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0; - return i.aperture_base; -} - -unsigned long drmAgpSize(int fd) -{ - drm_agp_info_t i; - - if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0; - return i.aperture_size; -} - -unsigned long drmAgpMemoryUsed(int fd) -{ - drm_agp_info_t i; - - if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0; - return i.memory_used; -} - -unsigned long drmAgpMemoryAvail(int fd) -{ - drm_agp_info_t i; - - if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0; - return i.memory_allowed; -} - -unsigned int drmAgpVendorId(int fd) -{ - drm_agp_info_t i; - - if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0; - return i.id_vendor; -} - -unsigned int drmAgpDeviceId(int fd) -{ - drm_agp_info_t i; - - if (ioctl(fd, DRM_IOCTL_AGP_INFO, &i)) return 0; - return i.id_device; -} - -int drmError(int err, const char *label) -{ - switch (err) { - case DRM_ERR_NO_DEVICE: fprintf(stderr, "%s: no device\n", label); break; - case DRM_ERR_NO_ACCESS: fprintf(stderr, "%s: no access\n", label); break; - case DRM_ERR_NOT_ROOT: fprintf(stderr, "%s: not root\n", label); break; - case DRM_ERR_INVALID: fprintf(stderr, "%s: invalid args\n", label);break; - default: - if (err < 0) err = -err; - fprintf( stderr, "%s: error %d (%s)\n", label, err, strerror(err) ); - break; - } - - return 1; -} - -int drmCtlInstHandler(int fd, int irq) -{ - drm_control_t ctl; - - ctl.func = DRM_INST_HANDLER; - ctl.irq = irq; - if (ioctl(fd, DRM_IOCTL_CONTROL, &ctl)) return -errno; - return 0; -} - -int drmCtlUninstHandler(int fd) -{ - drm_control_t ctl; - - ctl.func = DRM_UNINST_HANDLER; - ctl.irq = 0; - if (ioctl(fd, DRM_IOCTL_CONTROL, &ctl)) return -errno; - return 0; -} - -int drmFinish(int fd, int context, drmLockFlags flags) -{ - drm_lock_t lock; - - lock.context = context; - lock.flags = 0; - if (flags & DRM_LOCK_READY) lock.flags |= _DRM_LOCK_READY; - if (flags & DRM_LOCK_QUIESCENT) lock.flags |= _DRM_LOCK_QUIESCENT; - if (flags & DRM_LOCK_FLUSH) lock.flags |= _DRM_LOCK_FLUSH; - if (flags & DRM_LOCK_FLUSH_ALL) lock.flags |= _DRM_LOCK_FLUSH_ALL; - if (flags & DRM_HALT_ALL_QUEUES) lock.flags |= _DRM_HALT_ALL_QUEUES; - if (flags & DRM_HALT_CUR_QUEUES) lock.flags |= _DRM_HALT_CUR_QUEUES; - if (ioctl(fd, DRM_IOCTL_FINISH, &lock)) return -errno; - return 0; -} - -int drmGetInterruptFromBusID(int fd, int busnum, int devnum, int funcnum) -{ - drm_irq_busid_t p; - - p.busnum = busnum; - p.devnum = devnum; - p.funcnum = funcnum; - if (ioctl(fd, DRM_IOCTL_IRQ_BUSID, &p)) return -errno; - return p.irq; -} - -int drmAddContextTag(int fd, drmContext context, void *tag) -{ - drmHashEntry *entry = drmGetEntry(fd); - - if (drmHashInsert(entry->tagTable, context, tag)) { - drmHashDelete(entry->tagTable, context); - drmHashInsert(entry->tagTable, context, tag); - } - return 0; -} - -int drmDelContextTag(int fd, drmContext context) -{ - drmHashEntry *entry = drmGetEntry(fd); - - return drmHashDelete(entry->tagTable, context); -} - -void *drmGetContextTag(int fd, drmContext context) -{ - drmHashEntry *entry = drmGetEntry(fd); - void *value; - - if (drmHashLookup(entry->tagTable, context, &value)) return NULL; - - return value; -} - -#if defined(XFree86Server) || defined(DRM_USE_MALLOC) -static void drmSIGIOHandler(int interrupt, void *arg) -{ - unsigned long key; - void *value; - ssize_t count; - drm_ctx_t ctx; - typedef void (*_drmCallback)(int, void *, void *); - char buf[256]; - drmContext old; - drmContext new; - void *oldctx; - void *newctx; - char *pt; - drmHashEntry *entry; - - if (!drmHashTable) return; - if (drmHashFirst(drmHashTable, &key, &value)) { - entry = value; - do { -#if 1 - fprintf(stderr, "Trying %d\n", entry->fd); -#endif - if ((count = read(entry->fd, buf, sizeof(buf)))) { - buf[count] = '\0'; -#if 1 - fprintf(stderr, "Got %s\n", buf); -#endif - - for (pt = buf; *pt != ' '; ++pt); /* Find first space */ - ++pt; - old = strtol(pt, &pt, 0); - new = strtol(pt, NULL, 0); - oldctx = drmGetContextTag(entry->fd, old); - newctx = drmGetContextTag(entry->fd, new); -#if 1 - fprintf(stderr, "%d %d %p %p\n", old, new, oldctx, newctx); -#endif - ((_drmCallback)entry->f)(entry->fd, oldctx, newctx); - ctx.handle = new; - ioctl(entry->fd, DRM_IOCTL_NEW_CTX, &ctx); - } - } while (drmHashNext(drmHashTable, &key, &value)); - } -} - -int drmInstallSIGIOHandler(int fd, void (*f)(int, void *, void *)) -{ - drmHashEntry *entry; - - entry = drmGetEntry(fd); - entry->f = f; - - return xf86InstallSIGIOHandler(fd, drmSIGIOHandler, 0); -} - -int drmRemoveSIGIOHandler(int fd) -{ - drmHashEntry *entry = drmGetEntry(fd); - - entry->f = NULL; - - return xf86RemoveSIGIOHandler(fd); -} -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile:1.3 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile:1.3 Fri Oct 27 12:59:40 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile Wed Apr 18 10:52:43 2001 @@ -1,7 +1,8 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Imakefile,v 1.3 2000/10/27 16:59:40 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(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 @@ -18,6 +20,7 @@ LinkSourceFile(i810_drm.h,$(XF86OSSRC)/linux/drm/kernel) LinkSourceFile(mga_drm.h,$(XF86OSSRC)/linux/drm/kernel) LinkSourceFile(r128_drm.h,$(XF86OSSRC)/linux/drm/kernel) +LinkSourceFile(radeon_drm.h,$(XF86OSSRC)/linux/drm/kernel) LinkSourceFile(sis_drm.h,$(XF86OSSRC)/linux/drm/kernel) @@ -34,7 +37,7 @@ $(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:: Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd:1.1 Fri Jun 16 20:03:28 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/Makefile.bsd Tue Mar 6 11:45:25 2001 @@ -1,5 +1,5 @@ # $FreeBSD$ -SUBDIR = drm tdfx gamma +SUBDIR = drm tdfx mga gamma .include <bsd.subdir.mk> Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h:1.1 Fri Jun 16 20:03:28 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h Tue Mar 6 11:45:26 2001 @@ -25,7 +25,7 @@ * DEALINGS IN THE SOFTWARE. * * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h,v 1.58 1999/08/30 13:05:00 faith Exp $ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h,v 1.1 2000/06/17 00:03:28 martin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drmP.h,v 1.3 2001/03/06 16:45:26 dawes Exp $ * */ @@ -49,11 +49,11 @@ #include <sys/sysctl.h> #include <sys/select.h> #include <sys/bus.h> -#if __FreeBSD_version >= 500005 +#if __FreeBSD_version >= 400005 #include <sys/taskqueue.h> #endif -#if __FreeBSD_version >= 500006 +#if __FreeBSD_version >= 400006 #define DRM_AGP #endif @@ -73,6 +73,11 @@ #define atomic_add(n, p) atomic_add_int(p, n) #define atomic_sub(n, p) atomic_subtract_int(p, n) +/* The version number here is a guess */ +#if __FreeBSD_version >= 500010 +#define callout_init(a) callout_init(a, 0) +#endif + /* Fake this */ static __inline u_int32_t test_and_set_bit(int b, volatile u_int32_t *p) @@ -128,14 +133,14 @@ * Fake out the module macros for versions of FreeBSD where they don't * exist. */ -#if __FreeBSD_version < 500002 +#if __FreeBSD_version < 400002 #define MODULE_VERSION(a,b) struct __hack #define MODULE_DEPEND(a,b,c,d,e) struct __hack #endif -#define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then +#define DRM_DEBUG_CODE 0 /* Include debugging code (if > 1, then also include looping detection. */ #define DRM_DMA_HISTOGRAM 1 /* Make histogram of DMA latency. */ @@ -340,6 +345,7 @@ int low_mark; /* Low water mark */ int high_mark; /* High water mark */ atomic_t wfh; /* If waiting for high mark */ + struct simplelock lock; /* hope this doesn't need to be linux compatible */ } drm_freelist_t; typedef struct drm_buf_entry { @@ -509,15 +515,15 @@ /* Context support */ struct resource *irq; /* Interrupt used by board */ void *irqh; /* Handle from bus_setup_intr */ - __volatile__ int context_flag; /* Context swapping flag */ - __volatile__ int interrupt_flag;/* Interruption handler flag */ - __volatile__ int dma_flag; /* DMA dispatch flag */ + __volatile__ long context_flag; /* Context swapping flag */ + __volatile__ long interrupt_flag;/* Interruption handler flag */ + __volatile__ long dma_flag; /* DMA dispatch flag */ struct callout timer; /* Timer for delaying ctx switch */ int context_wait; /* Processes waiting on ctx switch */ int last_checked; /* Last context checked for DMA */ int last_context; /* Last current context */ int last_switch; /* Time at last context switch */ -#if __FreeBSD_version >= 500005 +#if __FreeBSD_version >= 400005 struct task task; #endif struct timespec ctx_start; @@ -594,7 +600,13 @@ /* Memory management support (memory.c) */ extern void drm_mem_init(void); -extern int drm_mem_info SYSCTL_HANDLER_ARGS; + +#if __FreeBSD_version < 411000 +#define DRM_SYSCTL_HANDLER_ARGS SYSCTL_HANDLER_ARGS +#else +#define DRM_SYSCTL_HANDLER_ARGS (SYSCTL_HANDLER_ARGS) +#endif +extern int drm_mem_info DRM_SYSCTL_HANDLER_ARGS; extern void *drm_alloc(size_t size, int area); extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c:1.1 Fri Jun 16 20:03:29 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/auth.c Thu Mar 1 21:45:38 2001 @@ -135,12 +135,12 @@ if (priv->magic) { auth.magic = priv->magic; } else { - simple_lock(&lock); do { + simple_lock(&lock); if (!sequence) ++sequence; /* reserve 0 */ auth.magic = sequence++; - } while (drm_find_file(dev, auth.magic)); simple_unlock(&lock); + } while (drm_find_file(dev, auth.magic)); priv->magic = auth.magic; drm_add_magic(dev, priv, auth.magic); } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c:1.1 Fri Jun 16 20:03:30 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lists.c Thu Mar 1 21:45:38 2001 @@ -121,6 +121,7 @@ bl->low_mark = 0; bl->high_mark = 0; atomic_set(&bl->wfh, 0); +/* bl->lock = SPIN_LOCK_UNLOCKED; */ ++bl->initialized; return 0; } @@ -159,6 +160,7 @@ drm_histogram_compute(dev, buf); #endif buf->list = DRM_LIST_FREE; +/* do { old = (unsigned long)bl->next; buf->next = (void *)old; @@ -169,6 +171,13 @@ return 1; } } while (failed); +*/ + + simple_lock(&bl->lock); + buf->next = bl->next; + bl->next = buf; + simple_unlock(&bl->lock); + atomic_inc(&bl->count); if (atomic_read(&bl->count) > dma->buf_count) { DRM_ERROR("%d of %d buffers free after addition of %d\n", @@ -195,6 +204,7 @@ if (!bl) return NULL; /* Get buffer */ +/* do { old = (unsigned int)bl->next; if (!old) { @@ -210,6 +220,16 @@ atomic_dec(&bl->count); buf = (drm_buf_t *)old; +*/ + simple_lock(&bl->lock); + if(!bl->next){ + simple_unlock(&bl->lock); + return NULL; + } + buf = bl->next; + bl->next = bl->next->next; + simple_unlock(&bl->lock); + atomic_dec(&bl->count); buf->next = NULL; buf->list = DRM_LIST_NONE; DRM_DEBUG("%d, count = %d, wfh = %d, w%d, p%d\n", Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c:1.1 Fri Jun 16 20:03:30 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/lock.c Thu Mar 1 21:45:38 2001 @@ -135,9 +135,12 @@ if (atomic_read(&q->use_count) > 1) { atomic_inc(&q->block_write); atomic_inc(&q->block_count); - error = tsleep(&q->flush_queue, PCATCH|PZERO, "drmfq", 0); - if (error) - return error; + for (;;) { + if (!DRM_BUFCOUNT(&q->waitlist)) break; + error = tsleep(&q->flush_queue, PCATCH|PZERO, "drmfq", 0); + if (error) + return error; + } atomic_dec(&q->block_count); } atomic_dec(&q->use_count); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c:1.1 Fri Jun 16 20:03:30 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/memory.c Thu Mar 1 21:45:38 2001 @@ -95,7 +95,7 @@ /* drm_mem_info is called whenever a process reads /dev/drm/mem. */ -static int _drm_mem_info SYSCTL_HANDLER_ARGS +static int _drm_mem_info DRM_SYSCTL_HANDLER_ARGS { drm_mem_stats_t *pt; char buf[128]; @@ -127,7 +127,7 @@ return 0; } -int drm_mem_info SYSCTL_HANDLER_ARGS +int drm_mem_info DRM_SYSCTL_HANDLER_ARGS { int ret; Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c:1.1 Fri Jun 16 20:03:30 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c Thu Mar 1 21:45:38 2001 @@ -25,7 +25,7 @@ * DEALINGS IN THE SOFTWARE. * * $PI: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c,v 1.4 1999/08/20 15:36:46 faith Exp $ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c,v 1.1 2000/06/17 00:03:30 martin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/proc.c,v 1.2 2001/03/02 02:45:38 dawes Exp $ * */ @@ -165,7 +165,7 @@ { drm_device_t *dev = (drm_device_t *)data; drm_map_t *map; - const char *types[] = { "FB", "REG", "SHM" }; + const char *types[] = { "FB", "REG", "SHM", "AGP" }; const char *type; int i; @@ -176,7 +176,7 @@ "address mtrr\n\n"); for (i = 0; i < dev->map_count; i++) { map = dev->maplist[i]; - if (map->type < 0 || map->type > 2) type = "??"; + if (map->type < 0 || map->type > 3) type = "??"; else type = types[map->type]; DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", i, @@ -226,7 +226,7 @@ atomic_inc(&q->use_count); DRM_PROC_PRINT_RET(atomic_dec(&q->use_count), "%5d/0x%03x %5d %5d" - " %5d/%c%c/%c%c%c %5d %10d %10d %10d\n", + " %5d/%c%c/%c%c%c %5Zd %10d %10d %10d\n", i, q->flags, atomic_read(&q->use_count), Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c:1.1 Fri Jun 16 20:03:31 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c Thu Mar 1 21:45:38 2001 @@ -25,7 +25,7 @@ * DEALINGS IN THE SOFTWARE. * * $PI$ - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c,v 1.1 2000/06/17 00:03:31 martin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/drm/sysctl.c,v 1.2 2001/03/02 02:45:38 dawes Exp $ * */ @@ -35,21 +35,21 @@ SYSCTL_NODE(_hw, OID_AUTO, dri, CTLFLAG_RW, 0, "DRI Graphics"); -static int drm_name_info SYSCTL_HANDLER_ARGS; -static int drm_vm_info SYSCTL_HANDLER_ARGS; -static int drm_clients_info SYSCTL_HANDLER_ARGS; -static int drm_queues_info SYSCTL_HANDLER_ARGS; -static int drm_bufs_info SYSCTL_HANDLER_ARGS; +static int drm_name_info DRM_SYSCTL_HANDLER_ARGS; +static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS; +static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS; +static int drm_queues_info DRM_SYSCTL_HANDLER_ARGS; +static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS; #if DRM_DEBUG_CODExx -static int drm_vma_info SYSCTL_HANDLER_ARGS; +static int drm_vma_info DRM_SYSCTL_HANDLER_ARGS; #endif #if DRM_DMA_HISTOGRAM -static int drm_histo_info SYSCTL_HANDLER_ARGS; +static int drm_histo_info DRM_SYSCTL_HANDLER_ARGS; #endif struct drm_sysctl_list { const char *name; - int (*f) SYSCTL_HANDLER_ARGS; + int (*f) DRM_SYSCTL_HANDLER_ARGS; } drm_sysctl_list[] = { { "name", drm_name_info }, { "mem", drm_mem_info }, @@ -137,7 +137,7 @@ return 0; } -static int drm_name_info SYSCTL_HANDLER_ARGS +static int drm_name_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; char buf[128]; @@ -155,11 +155,11 @@ return 0; } -static int _drm_vm_info SYSCTL_HANDLER_ARGS +static int _drm_vm_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; drm_map_t *map; - const char *types[] = { "FB", "REG", "SHM" }; + const char *types[] = { "FB", "REG", "SHM", "AGP" }; const char *type; int i; char buf[128]; @@ -172,7 +172,7 @@ for (i = 0; i < dev->map_count; i++) { map = dev->maplist[i]; - if (map->type < 0 || map->type > 2) type = "??"; + if (map->type < 0 || map->type > 3) type = "??"; else type = types[map->type]; DRM_SYSCTL_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", i, @@ -192,7 +192,7 @@ return 0; } -static int drm_vm_info SYSCTL_HANDLER_ARGS +static int drm_vm_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int ret; @@ -205,7 +205,7 @@ } -static int _drm_queues_info SYSCTL_HANDLER_ARGS +static int _drm_queues_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int i; @@ -221,7 +221,7 @@ atomic_inc(&q->use_count); DRM_SYSCTL_PRINT_RET(atomic_dec(&q->use_count), "%5d/0x%03x %5d %5d" - " %5d/%c%c/%c%c%c %5d %10d %10d %10d\n", + " %5d/%c%c/%c%c%c %5Zd %10d %10d %10d\n", i, q->flags, atomic_read(&q->use_count), @@ -243,7 +243,7 @@ return 0; } -static int drm_queues_info SYSCTL_HANDLER_ARGS +static int drm_queues_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int ret; @@ -257,7 +257,7 @@ /* drm_bufs_info is called whenever a process reads hw.dri.0.bufs. */ -static int _drm_bufs_info SYSCTL_HANDLER_ARGS +static int _drm_bufs_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; drm_device_dma_t *dma = dev->dma; @@ -293,7 +293,7 @@ return 0; } -static int drm_bufs_info SYSCTL_HANDLER_ARGS +static int drm_bufs_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int ret; @@ -305,7 +305,7 @@ } -static int _drm_clients_info SYSCTL_HANDLER_ARGS +static int _drm_clients_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; drm_file_t *priv; @@ -327,7 +327,7 @@ return 0; } -static int drm_clients_info SYSCTL_HANDLER_ARGS +static int drm_clients_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int ret; @@ -340,7 +340,7 @@ #if DRM_DEBUG_CODExx -static int _drm_vma_info SYSCTL_HANDLER_ARGS +static int _drm_vma_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; drm_vma_entry_t *pt; @@ -412,7 +412,7 @@ return 0; } -static int drm_vma_info SYSCTL_HANDLER_ARGS +static int drm_vma_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int ret; @@ -426,7 +426,7 @@ #if DRM_DMA_HISTOGRAM -static int _drm_histo_info SYSCTL_HANDLER_ARGS +static int _drm_histo_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; drm_device_dma_t *dma = dev->dma; @@ -498,9 +498,9 @@ } else { DRM_SYSCTL_PRINT("lock none\n"); } - DRM_SYSCTL_PRINT("context_flag 0x%08x\n", dev->context_flag); - DRM_SYSCTL_PRINT("interrupt_flag 0x%08x\n", dev->interrupt_flag); - DRM_SYSCTL_PRINT("dma_flag 0x%08x\n", dev->dma_flag); + DRM_SYSCTL_PRINT("context_flag 0x%08lx\n", dev->context_flag); + DRM_SYSCTL_PRINT("interrupt_flag 0x%08lx\n", dev->interrupt_flag); + DRM_SYSCTL_PRINT("dma_flag 0x%08lx\n", dev->dma_flag); DRM_SYSCTL_PRINT("queue_count %10d\n", dev->queue_count); DRM_SYSCTL_PRINT("last_context %10d\n", dev->last_context); @@ -541,7 +541,7 @@ return 0; } -static int drm_histo_info SYSCTL_HANDLER_ARGS +static int drm_histo_info DRM_SYSCTL_HANDLER_ARGS { drm_device_t *dev = arg1; int ret; Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile:1.1 Fri Jun 16 20:03:31 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/gamma/Makefile Tue Mar 6 11:45:27 2001 @@ -3,7 +3,7 @@ KMOD = gamma SRCS = gamma_drv.c gamma_dma.c SRCS += device_if.h bus_if.h pci_if.h -CFLAGS += ${DEBUG_FLAGS} -I.. +CFLAGS += ${DEBUG_FLAGS} -I. -I.. KMODDEPS = drm @: Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c:1.1 Fri Jun 16 20:03:31 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_context.c Thu Mar 1 21:45:39 2001 @@ -188,7 +188,11 @@ ctx = *(drm_ctx_t *) data; DRM_DEBUG("%d\n", ctx.handle); - if(ctx.handle != DRM_KERNEL_CONTEXT) { +/* + if(ctx.handle == DRM_KERNEL_CONTEXT+1) + priv->remove_auth_on_close = 1; +*/ + if(ctx.handle != DRM_KERNEL_CONTEXT ) { drm_ctxbitmap_free(dev, ctx.handle); } Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c:1.1 Fri Jun 16 20:03:31 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_dma.c Thu Mar 1 21:45:39 2001 @@ -130,7 +130,6 @@ item->buf = buf; buf_priv->my_freelist = item; buf_priv->discard = 0; - buf_priv->dispatched = 0; dev_priv->head->next = item; } @@ -176,7 +175,7 @@ atomic_read(&dev->total_irq), atomic_read(&dma->total_lost)); DRM_ERROR("lockup\n"); - goto out_nolock; + return; } for (i = 0 ; i < 2000 ; i++) mga_delay(); } @@ -188,15 +187,15 @@ atomic_read(&dev->total_irq), atomic_read(&dma->total_lost)); DRM_ERROR("lockup\n"); - goto out_status; + clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); + return; } for (i = 0 ; i < 2000 ; i++) mga_delay(); } sarea_priv->dirty |= MGA_DMA_FLUSH; -out_status: clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); -out_nolock: + DRM_DEBUG("exit, dispatch_status = 0x%02x\n",dev_priv->dispatch_status); } static void mga_reset_freelist(drm_device_t *dev) @@ -236,20 +235,22 @@ set_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); for (;;) { mga_dma_schedule(dev, 0); - if(!test_bit(MGA_IN_GETBUF, - &dev_priv->dispatch_status)) +/* if(!test_bit(MGA_IN_GETBUF, + &dev_priv->dispatch_status)) */ + if(dev_priv->tail->age < dev_priv->last_prim_age) break; atomic_inc(&dev->total_sleeps); ret = tsleep(&dev_priv->buf_queue, PZERO|PCATCH, "mgafg", 0); - if (ret) { + if (ret == EINTR) { clear_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); - splx(s); - goto failed_getbuf; + break; } } splx(s); + clear_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); + if (ret) return NULL; } if(dev_priv->tail->age < dev_priv->last_prim_age) { @@ -263,7 +264,6 @@ return next->buf; } -failed_getbuf: failed++; return NULL; } @@ -520,61 +520,55 @@ static __inline int mga_decide_to_fire(drm_device_t *dev) { drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_device_dma_t *dma = dev->dma; DRM_DEBUG("%s\n", __FUNCTION__); if(test_bit(MGA_BUF_FORCE_FIRE, &dev_priv->next_prim->buffer_status)) { - atomic_inc(&dma->total_prio); return 1; } if (test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) && dev_priv->next_prim->num_dwords) { - atomic_inc(&dma->total_prio); return 1; } if (test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) && dev_priv->next_prim->num_dwords) { - atomic_inc(&dma->total_prio); return 1; } if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS - 1) { if(test_bit(MGA_BUF_SWAP_PENDING, &dev_priv->next_prim->buffer_status)) { - atomic_inc(&dma->total_dmas); return 1; } } if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS / 2) { if(dev_priv->next_prim->sec_used >= MGA_DMA_BUF_NR / 8) { - atomic_inc(&dma->total_hit); return 1; } } if(atomic_read(&dev_priv->pending_bufs) >= MGA_NUM_PRIM_BUFS / 2) { if(dev_priv->next_prim->sec_used >= MGA_DMA_BUF_NR / 4) { - atomic_inc(&dma->total_missed_free); return 1; } } - atomic_inc(&dma->total_tried); return 0; } int mga_dma_schedule(drm_device_t *dev, int locked) { drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_device_dma_t *dma = dev->dma; + int retval =0 ; + + if (!dev_priv) return EBUSY; if (test_and_set_bit(0, &dev->dma_flag)) { - atomic_inc(&dma->total_missed_dma); - return EBUSY; + retval = EBUSY; + goto sch_out_wakeup; } DRM_DEBUG("%s\n", __FUNCTION__); @@ -591,17 +585,15 @@ if (!locked && !drm_lock_take(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { - atomic_inc(&dma->total_missed_lock); clear_bit(0, &dev->dma_flag); DRM_DEBUG("Not locked\n"); - return EBUSY; + retval = EBUSY; + goto sch_out_wakeup; } - DRM_DEBUG("I'm locked\n"); if(!test_and_set_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status)) { /* Fire dma buffer */ if(mga_decide_to_fire(dev)) { - DRM_DEBUG("idx :%d\n", dev_priv->next_prim->idx); clear_bit(MGA_BUF_FORCE_FIRE, &dev_priv->next_prim->buffer_status); if(dev_priv->current_prim == dev_priv->next_prim) { @@ -613,8 +605,6 @@ } else { clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); } - } else { - DRM_DEBUG("I can't get the dispatch lock\n"); } if (!locked) { @@ -623,9 +613,9 @@ DRM_ERROR("\n"); } } - + clear_bit(0, &dev->dma_flag); +sch_out_wakeup: if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) && - dev_priv->next_prim->num_dwords == 0 && atomic_read(&dev_priv->pending_bufs) == 0) { /* Everything has been processed by the hardware */ clear_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); @@ -633,18 +623,10 @@ } if(test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) && - dev_priv->tail->age < dev_priv->last_prim_age) { - clear_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); - DRM_DEBUG("Waking up buf queue\n"); + dev_priv->tail->age < dev_priv->last_prim_age) wakeup(&dev_priv->buf_queue); - } else if (test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status)) { - DRM_DEBUG("Not waking buf_queue on %d %d\n", - atomic_read(&dev->total_irq), - dev_priv->last_prim_age); - } - clear_bit(0, &dev->dma_flag); - return 0; + return retval; } static void mga_dma_service(void *arg) @@ -653,7 +635,6 @@ drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; drm_mga_prim_buf_t *last_prim_buffer; - DRM_DEBUG("%s\n", __FUNCTION__); atomic_inc(&dev->total_irq); if((MGA_READ(MGAREG_STATUS) & 0x00000001) != 0x00000001) return; MGA_WRITE(MGAREG_ICLEAR, 0x00000001); @@ -663,11 +644,11 @@ dev_priv->sarea_priv->last_dispatch = dev_priv->last_prim_age = last_prim_buffer->prim_age; clear_bit(MGA_BUF_IN_USE, &last_prim_buffer->buffer_status); - wakeup(&dev_priv->wait_queue); clear_bit(MGA_BUF_SWAP_PENDING, &last_prim_buffer->buffer_status); clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); atomic_dec(&dev_priv->pending_bufs); taskqueue_enqueue(taskqueue_swi, &dev->task); + wakeup(&dev_priv->wait_queue); } static void mga_dma_task_queue(void *device, int pending) @@ -684,6 +665,8 @@ drm_mga_private_t *dev_priv = (drm_mga_private_t *) dev->dev_private; + if (dev->irq) mga_flush_queue(dev); + mga_dma_quiescent(dev); if(dev_priv->ioremap) { int temp = (dev_priv->warp_ucode_size + dev_priv->primary_size + @@ -723,9 +706,6 @@ static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) { drm_mga_private_t *dev_priv; drm_map_t *sarea_map = NULL; - int i; - - DRM_DEBUG("%s\n", __FUNCTION__); dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER); if(dev_priv == NULL) return ENOMEM; @@ -760,8 +740,8 @@ dev_priv->mAccess = init->mAccess; dev_priv->flush_queue = 0; - dev_priv->buf_queue = 0; - dev_priv->WarpPipe = -1; + dev_priv->WarpPipe = 0xff000000; + dev_priv->vertexsize = 0; DRM_DEBUG("chipset: %d ucode_size: %d backOffset: %x depthOffset: %x\n", dev_priv->chipset, dev_priv->warp_ucode_size, @@ -773,13 +753,6 @@ memcpy(&dev_priv->WarpIndex, &init->WarpIndex, sizeof(drm_mga_warp_index_t) * MGA_MAX_WARP_PIPES); - for (i = 0 ; i < MGA_MAX_WARP_PIPES ; i++) - DRM_DEBUG("warp pipe %d: installed: %d phys: %lx size: %x\n", - i, - dev_priv->WarpIndex[i].installed, - dev_priv->WarpIndex[i].phys_addr, - dev_priv->WarpIndex[i].size); - if(mga_init_primary_bufs(dev, init) != 0) { DRM_ERROR("Can not initialize primary buffers\n"); mga_dma_cleanup(dev); @@ -951,9 +924,7 @@ DRM_DEBUG("%s\n", __FUNCTION__); - if(dev_priv == NULL) { - return 0; - } + if(!dev_priv) return 0; if(dev_priv->next_prim->num_dwords != 0) { s = splsofttq(); @@ -1065,7 +1036,7 @@ } } - DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); + if (ret) DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); return ret; } @@ -1086,16 +1057,16 @@ } if(lock.flags & _DRM_LOCK_FLUSH || lock.flags & _DRM_LOCK_FLUSH_ALL) { - drm_mga_prim_buf_t *temp_buf = - dev_priv->prim_bufs[dev_priv->current_prim_idx]; + drm_mga_prim_buf_t *temp_buf; + temp_buf = dev_priv->current_prim; - if(temp_buf && temp_buf->num_dwords) { s = splsofttq(); + if(temp_buf && temp_buf->num_dwords) { set_bit(MGA_BUF_FORCE_FIRE, &temp_buf->buffer_status); mga_advance_primary(dev); + } mga_dma_schedule(dev, 1); splx(s); - } } if(lock.flags & _DRM_LOCK_QUIESCENT) { mga_flush_queue(dev); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c:1.1 Fri Jun 16 20:03:32 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.c Thu Mar 1 21:45:39 2001 @@ -40,8 +40,8 @@ #define MGA_NAME "mga" #define MGA_DESC "Matrox g200/g400" -#define MGA_DATE "19991213" -#define MGA_MAJOR 1 +#define MGA_DATE "20000928" +#define MGA_MAJOR 2 #define MGA_MINOR 0 #define MGA_PATCHLEVEL 0 Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h:1.1 Fri Jun 16 20:03:32 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_drv.h Thu Mar 1 21:45:39 2001 @@ -39,8 +39,8 @@ typedef struct { u_int32_t buffer_status; - unsigned int num_dwords; - unsigned int max_dwords; + int num_dwords; + int max_dwords; u_int32_t *current_dma_ptr; u_int32_t *head; u_int32_t phys_head; @@ -50,7 +50,7 @@ } drm_mga_prim_buf_t; typedef struct _drm_mga_freelist { - unsigned int age; + __volatile__ unsigned int age; drm_buf_t *buf; struct _drm_mga_freelist *next; struct _drm_mga_freelist *prev; @@ -82,6 +82,7 @@ int use_agp; drm_mga_warp_index_t WarpIndex[MGA_MAX_G400_PIPES]; unsigned int WarpPipe; + unsigned int vertexsize; atomic_t pending_bufs; void *status_page; unsigned long real_status_page; @@ -191,12 +192,20 @@ &tmp_buf->buffer_status)) { \ mga_advance_primary(dev); \ mga_dma_schedule(dev, 1); \ + tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ } else if( tmp_buf->max_dwords - tmp_buf->num_dwords < length ||\ tmp_buf->sec_used > MGA_DMA_BUF_NR/2) { \ set_bit(MGA_BUF_FORCE_FIRE, &tmp_buf->buffer_status); \ mga_advance_primary(dev); \ mga_dma_schedule(dev, 1); \ + tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ } \ + if(MGA_VERBOSE) \ + DRM_DEBUG("PRIMGETPTR in %s\n", __FUNCTION__); \ + dma_ptr = tmp_buf->current_dma_ptr; \ + num_dwords = tmp_buf->num_dwords; \ + phys_head = tmp_buf->phys_head; \ + outcount = 0; \ } while(0) #define PRIMGETPTR(dev_priv) do { \ @@ -343,6 +352,73 @@ #define MGAREG_YDSTORG 0x1c94 #define MGAREG_YTOP 0x1c98 #define MGAREG_ZORG 0x1c0c + +/* Warp registers */ +#define MGAREG_WR0 0x2d00 +#define MGAREG_WR1 0x2d04 +#define MGAREG_WR2 0x2d08 +#define MGAREG_WR3 0x2d0c +#define MGAREG_WR4 0x2d10 +#define MGAREG_WR5 0x2d14 +#define MGAREG_WR6 0x2d18 +#define MGAREG_WR7 0x2d1c +#define MGAREG_WR8 0x2d20 +#define MGAREG_WR9 0x2d24 +#define MGAREG_WR10 0x2d28 +#define MGAREG_WR11 0x2d2c +#define MGAREG_WR12 0x2d30 +#define MGAREG_WR13 0x2d34 +#define MGAREG_WR14 0x2d38 +#define MGAREG_WR15 0x2d3c +#define MGAREG_WR16 0x2d40 +#define MGAREG_WR17 0x2d44 +#define MGAREG_WR18 0x2d48 +#define MGAREG_WR19 0x2d4c +#define MGAREG_WR20 0x2d50 +#define MGAREG_WR21 0x2d54 +#define MGAREG_WR22 0x2d58 +#define MGAREG_WR23 0x2d5c +#define MGAREG_WR24 0x2d60 +#define MGAREG_WR25 0x2d64 +#define MGAREG_WR26 0x2d68 +#define MGAREG_WR27 0x2d6c +#define MGAREG_WR28 0x2d70 +#define MGAREG_WR29 0x2d74 +#define MGAREG_WR30 0x2d78 +#define MGAREG_WR31 0x2d7c +#define MGAREG_WR32 0x2d80 +#define MGAREG_WR33 0x2d84 +#define MGAREG_WR34 0x2d88 +#define MGAREG_WR35 0x2d8c +#define MGAREG_WR36 0x2d90 +#define MGAREG_WR37 0x2d94 +#define MGAREG_WR38 0x2d98 +#define MGAREG_WR39 0x2d9c +#define MGAREG_WR40 0x2da0 +#define MGAREG_WR41 0x2da4 +#define MGAREG_WR42 0x2da8 +#define MGAREG_WR43 0x2dac +#define MGAREG_WR44 0x2db0 +#define MGAREG_WR45 0x2db4 +#define MGAREG_WR46 0x2db8 +#define MGAREG_WR47 0x2dbc +#define MGAREG_WR48 0x2dc0 +#define MGAREG_WR49 0x2dc4 +#define MGAREG_WR50 0x2dc8 +#define MGAREG_WR51 0x2dcc +#define MGAREG_WR52 0x2dd0 +#define MGAREG_WR53 0x2dd4 +#define MGAREG_WR54 0x2dd8 +#define MGAREG_WR55 0x2ddc +#define MGAREG_WR56 0x2de0 +#define MGAREG_WR57 0x2de4 +#define MGAREG_WR58 0x2de8 +#define MGAREG_WR59 0x2dec +#define MGAREG_WR60 0x2df0 +#define MGAREG_WR61 0x2df4 +#define MGAREG_WR62 0x2df8 +#define MGAREG_WR63 0x2dfc + #define PDEA_pagpxfer_enable 0x2 Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c:1.1 Fri Jun 16 20:03:32 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/mga/mga_state.c Thu Mar 1 21:45:39 2001 @@ -37,6 +37,20 @@ typedef u_int16_t u16; typedef u_int32_t u32; +#define MGAEMITCLIP_SIZE 10 +#define MGAEMITCTX_SIZE 20 +#define MGAG200EMITTEX_SIZE 20 +#define MGAG400EMITTEX0_SIZE 30 +#define MGAG400EMITTEX1_SIZE 25 +#define MGAG400EMITPIPE_SIZE 50 +#define MGAG200EMITPIPE_SIZE 15 + +#define MAX_STATE_SIZE ((MGAEMITCLIP_SIZE * MGA_NR_SAREA_CLIPRECTS) + \ + MGAEMITCTX_SIZE + MGAG400EMITTEX0_SIZE + \ + MGAG400EMITTEX1_SIZE + MGAG400EMITPIPE_SIZE) + + + static void mgaEmitClipRect(drm_mga_private_t * dev_priv, drm_clip_rect_t * box) { @@ -49,6 +63,7 @@ PRIMGETPTR(dev_priv); /* Force reset of dwgctl (eliminates clip disable) */ + if (dev_priv->chipset == MGA_CARD_TYPE_G400) { #if 0 PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DWGSYNC, 0); @@ -60,11 +75,11 @@ PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000); #endif - + } PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_CXBNDRY, ((box->x2) << 16) | (box->x1)); - PRIMOUTREG(MGAREG_YTOP, box->y1 * dev_priv->stride / 2); - PRIMOUTREG(MGAREG_YBOT, box->y2 * dev_priv->stride / 2); + PRIMOUTREG(MGAREG_YTOP, box->y1 * dev_priv->stride / dev_priv->cpp); + PRIMOUTREG(MGAREG_YBOT, box->y2 * dev_priv->stride / dev_priv->cpp); PRIMADVANCE(dev_priv); } @@ -76,7 +91,7 @@ PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - /* This takes a max of 15 dwords */ + /* This takes a max of 20 dwords */ PRIMGETPTR(dev_priv); PRIMOUTREG(MGAREG_DSTORG, regs[MGA_CTXREG_DSTORG]); @@ -94,6 +109,12 @@ PRIMOUTREG(MGAREG_TDUALSTAGE0, regs[MGA_CTXREG_TDUAL0]); PRIMOUTREG(MGAREG_TDUALSTAGE1, regs[MGA_CTXREG_TDUAL1]); PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); + + PRIMOUTREG(MGAREG_STENCIL, regs[MGA_CTXREG_STENCIL]); + PRIMOUTREG(MGAREG_STENCILCTL, regs[MGA_CTXREG_STENCILCTL]); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + } else { PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); PRIMOUTREG(MGAREG_DMAPAD, 0); @@ -128,9 +149,9 @@ PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(0x2d00 + 24 * 4, regs[MGA_TEXREG_WIDTH]); + PRIMOUTREG(MGAREG_WR24, regs[MGA_TEXREG_WIDTH]); - PRIMOUTREG(0x2d00 + 34 * 4, regs[MGA_TEXREG_HEIGHT]); + PRIMOUTREG(MGAREG_WR34, regs[MGA_TEXREG_HEIGHT]); PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); PRIMOUTREG(MGAREG_DMAPAD, 0); @@ -138,11 +159,12 @@ PRIMADVANCE(dev_priv); } +#define TMC_dualtex_enable 0x80 + static void mgaG400EmitTex0(drm_mga_private_t * dev_priv) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int *regs = sarea_priv->TexState[0]; - int multitex = sarea_priv->WarpPipe & MGA_T2; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -163,22 +185,21 @@ PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(0x2d00 + 49 * 4, 0); + PRIMOUTREG(MGAREG_WR49, 0); - PRIMOUTREG(0x2d00 + 57 * 4, 0); - PRIMOUTREG(0x2d00 + 53 * 4, 0); - PRIMOUTREG(0x2d00 + 61 * 4, 0); + PRIMOUTREG(MGAREG_WR57, 0); + PRIMOUTREG(MGAREG_WR53, 0); + PRIMOUTREG(MGAREG_WR61, 0); + PRIMOUTREG(MGAREG_WR52, 0x40); + + PRIMOUTREG(MGAREG_WR60, 0x40); + PRIMOUTREG(MGAREG_WR54, regs[MGA_TEXREG_WIDTH] | 0x40); + PRIMOUTREG(MGAREG_WR62, regs[MGA_TEXREG_HEIGHT] | 0x40); PRIMOUTREG(MGAREG_DMAPAD, 0); - if (!multitex) { - PRIMOUTREG(0x2d00 + 52 * 4, 0x40); - PRIMOUTREG(0x2d00 + 60 * 4, 0x40); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); - } - PRIMOUTREG(0x2d00 + 54 * 4, regs[MGA_TEXREG_WIDTH] | 0x40); - PRIMOUTREG(0x2d00 + 62 * 4, regs[MGA_TEXREG_HEIGHT] | 0x40); PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); @@ -212,14 +233,15 @@ PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(0x2d00 + 49 * 4, 0); + PRIMOUTREG(MGAREG_WR49, 0); + + PRIMOUTREG(MGAREG_WR57, 0); + PRIMOUTREG(MGAREG_WR53, 0); + PRIMOUTREG(MGAREG_WR61, 0); + PRIMOUTREG(MGAREG_WR52, regs[MGA_TEXREG_WIDTH] | 0x40); - PRIMOUTREG(0x2d00 + 57 * 4, 0); - PRIMOUTREG(0x2d00 + 53 * 4, 0); - PRIMOUTREG(0x2d00 + 61 * 4, 0); - PRIMOUTREG(0x2d00 + 52 * 4, regs[MGA_TEXREG_WIDTH] | 0x40); + PRIMOUTREG(MGAREG_WR60, regs[MGA_TEXREG_HEIGHT] | 0x40); - PRIMOUTREG(0x2d00 + 60 * 4, regs[MGA_TEXREG_HEIGHT] | 0x40); PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000); @@ -227,12 +249,17 @@ PRIMADVANCE(dev_priv); } +#define MAGIC_FPARAM_HEX_VALUE 0x46480000 +/* This is the hex value of 12800.0f which is a magic value we must + * set in wr56. + */ + + #define EMIT_PIPE 50 static void mgaG400EmitPipe(drm_mga_private_t * dev_priv) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int pipe = sarea_priv->WarpPipe; - float fParam = 12800.0f; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -266,14 +293,14 @@ PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD); PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1); - PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); - PRIMOUTREG(MGAREG_DMAPAD, 0); - - PRIMOUTREG(MGAREG_TEXCTL2, 0 | 0x00008000); + PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000); PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000); PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); + PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000); + PRIMOUTREG(MGAREG_DMAPAD, 0); } PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001807); @@ -289,18 +316,20 @@ PRIMOUTREG(MGAREG_WFLAG, 0); PRIMOUTREG(MGAREG_WFLAG1, 0); - PRIMOUTREG(0x2d00 + 56 * 4, *((u32 *) (&fParam))); + PRIMOUTREG(MGAREG_WR56, MAGIC_FPARAM_HEX_VALUE); PRIMOUTREG(MGAREG_DMAPAD, 0); + + PRIMOUTREG(MGAREG_WR49, 0); /* Tex stage 0 */ + PRIMOUTREG(MGAREG_WR57, 0); /* Tex stage 0 */ + PRIMOUTREG(MGAREG_WR53, 0); /* Tex stage 1 */ + PRIMOUTREG(MGAREG_WR61, 0); /* Tex stage 1 */ + + + PRIMOUTREG(MGAREG_WR54, 0x40); /* Tex stage 0 : w */ + PRIMOUTREG(MGAREG_WR62, 0x40); /* Tex stage 0 : h */ + PRIMOUTREG(MGAREG_WR52, 0x40); /* Tex stage 1 : w */ + PRIMOUTREG(MGAREG_WR60, 0x40); /* Tex stage 1 : h */ - PRIMOUTREG(0x2d00 + 49 * 4, 0); /* Tex stage 0 */ - PRIMOUTREG(0x2d00 + 57 * 4, 0); /* Tex stage 0 */ - PRIMOUTREG(0x2d00 + 53 * 4, 0); /* Tex stage 1 */ - PRIMOUTREG(0x2d00 + 61 * 4, 0); /* Tex stage 1 */ - - PRIMOUTREG(0x2d00 + 54 * 4, 0x40); /* Tex stage 0 : w */ - PRIMOUTREG(0x2d00 + 62 * 4, 0x40); /* Tex stage 0 : h */ - PRIMOUTREG(0x2d00 + 52 * 4, 0x40); /* Tex stage 1 : w */ - PRIMOUTREG(0x2d00 + 60 * 4, 0x40); /* Tex stage 1 : h */ /* Dma pading required due to hw bug */ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); @@ -326,12 +355,12 @@ PRIMOUTREG(MGAREG_WIADDR, WIA_wmode_suspend); PRIMOUTREG(MGAREG_WVRTXSZ, 7); PRIMOUTREG(MGAREG_WFLAG, 0); - PRIMOUTREG(0x2d00 + 24 * 4, 0); /* tex w/h */ + PRIMOUTREG(MGAREG_WR24, 0); /* tex w/h */ - PRIMOUTREG(0x2d00 + 25 * 4, 0x100); - PRIMOUTREG(0x2d00 + 34 * 4, 0); /* tex w/h */ - PRIMOUTREG(0x2d00 + 42 * 4, 0xFFFF); - PRIMOUTREG(0x2d00 + 60 * 4, 0xFFFF); + PRIMOUTREG(MGAREG_WR25, 0x100); + PRIMOUTREG(MGAREG_WR34, 0); /* tex w/h */ + PRIMOUTREG(MGAREG_WR42, 0xFFFF); + PRIMOUTREG(MGAREG_WR60, 0xFFFF); /* Dma pading required due to hw bug */ PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); @@ -495,7 +524,6 @@ y2 = length / 64; PRIM_OVERFLOW(dev, dev_priv, 30); - PRIMGETPTR(dev_priv); PRIMOUTREG(MGAREG_DSTORG, destOrg); PRIMOUTREG(MGAREG_MACCESS, 0x00000000); @@ -513,10 +541,11 @@ PRIMOUTREG(MGAREG_FXBNDRY, (63 << 16)); PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, y2); + PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_SRCORG, 0); PRIMOUTREG(MGAREG_PITCH, dev_priv->stride / dev_priv->cpp); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); + PRIMADVANCE(dev_priv); } @@ -529,7 +558,6 @@ int length = buf->used; int use_agp = PDEA_pagpxfer_enable; int i = 0; - int primary_needed; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -545,11 +573,16 @@ * these numbers (Overestimating this doesn't hurt). */ buf_priv->dispatched = 1; - primary_needed = (50 + 15 + 15 + 30 + 25 + - 10 + 15 * MGA_NR_SAREA_CLIPRECTS); - PRIM_OVERFLOW(dev, dev_priv, primary_needed); + PRIM_OVERFLOW(dev, dev_priv, + (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS))); mgaEmitState(dev_priv); +#if 0 + length = dev_priv->vertexsize * 3 * 4; +#endif + + + do { if (i < sarea_priv->nbox) { DRM_DEBUG("idx %d Emit box %d/%d:" @@ -597,7 +630,6 @@ unsigned int address = (unsigned int) buf->bus_address; int use_agp = PDEA_pagpxfer_enable; int i = 0; - int primary_needed; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -611,9 +643,9 @@ * these numbers (Overestimating this doesn't hurt). */ buf_priv->dispatched = 1; - primary_needed = (50 + 15 + 15 + 30 + 25 + - 10 + 15 * MGA_NR_SAREA_CLIPRECTS); - PRIM_OVERFLOW(dev, dev_priv, primary_needed); + PRIM_OVERFLOW(dev, dev_priv, + (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS))); + mgaEmitState(dev_priv); do { @@ -639,6 +671,7 @@ SETADD_mode_vertlist)); PRIMOUTREG(MGAREG_SETUPEND, ((address + end) | use_agp)); + PRIMADVANCE(dev_priv); } while (++i < sarea_priv->nbox); } @@ -653,7 +686,10 @@ static void mga_dma_dispatch_clear(drm_device_t * dev, int flags, unsigned int clear_color, - unsigned int clear_zval) + unsigned int clear_zval, + unsigned int clear_colormask, + unsigned int clear_depthmask) + { drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; @@ -662,7 +698,6 @@ drm_clip_rect_t *pbox = sarea_priv->boxes; unsigned int cmd; int i; - int primary_needed; PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); @@ -671,11 +706,7 @@ else cmd = MGA_CLEAR_CMD | DC_atype_rstr; - primary_needed = nbox * 70; - if (primary_needed == 0) - primary_needed = 70; - PRIM_OVERFLOW(dev, dev_priv, primary_needed); - PRIMGETPTR(dev_priv); + PRIM_OVERFLOW(dev, dev_priv, 35 * MGA_NR_SAREA_CLIPRECTS); for (i = 0; i < nbox; i++) { unsigned int height = pbox[i].y2 - pbox[i].y1; @@ -686,8 +717,8 @@ if (flags & MGA_FRONT) { DRM_DEBUG("clear front\n"); - PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_PLNWT, clear_colormask); PRIMOUTREG(MGAREG_YDSTLEN, (pbox[i].y1 << 16) | height); PRIMOUTREG(MGAREG_FXBNDRY, @@ -702,7 +733,7 @@ if (flags & MGA_BACK) { DRM_DEBUG("clear back\n"); PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_PLNWT, clear_colormask); PRIMOUTREG(MGAREG_YDSTLEN, (pbox[i].y1 << 16) | height); PRIMOUTREG(MGAREG_FXBNDRY, @@ -716,8 +747,8 @@ if (flags & MGA_DEPTH) { DRM_DEBUG("clear depth\n"); - PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_PLNWT, clear_depthmask); PRIMOUTREG(MGAREG_YDSTLEN, (pbox[i].y1 << 16) | height); PRIMOUTREG(MGAREG_FXBNDRY, @@ -746,31 +777,32 @@ int nbox = sarea_priv->nbox; drm_clip_rect_t *pbox = sarea_priv->boxes; int i; - int primary_needed; + int pixel_stride = dev_priv->stride / dev_priv->cpp; + PRIMLOCALS; DRM_DEBUG("%s\n", __FUNCTION__); - primary_needed = nbox * 5; - primary_needed += 60; - PRIM_OVERFLOW(dev, dev_priv, primary_needed); - PRIMGETPTR(dev_priv); + PRIM_OVERFLOW(dev, dev_priv, (MGA_NR_SAREA_CLIPRECTS * 5) + 20); + + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DMAPAD, 0); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7100); + PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset); PRIMOUTREG(MGAREG_MACCESS, dev_priv->mAccess); PRIMOUTREG(MGAREG_SRCORG, dev_priv->backOffset); - PRIMOUTREG(MGAREG_AR5, dev_priv->stride / 2); + PRIMOUTREG(MGAREG_AR5, pixel_stride); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DMAPAD, 0); PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD); + for (i = 0; i < nbox; i++) { unsigned int h = pbox[i].y2 - pbox[i].y1; - unsigned int start = pbox[i].y1 * dev_priv->stride / 2; - - DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n", - pbox[i].x1, pbox[i].y1, pbox[i].x2, pbox[i].y2); + unsigned int start = pbox[i].y1 * pixel_stride; PRIMOUTREG(MGAREG_AR0, start + pbox[i].x2 - 1); PRIMOUTREG(MGAREG_AR3, start + pbox[i].x1); @@ -814,7 +846,10 @@ */ dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX; mga_dma_dispatch_clear(dev, clear.flags, - clear.clear_color, clear.clear_depth); + clear.clear_color, + clear.clear_depth, + clear.clear_color_mask, + clear.clear_depth_mask); PRIMUPDATE(dev_priv); mga_flush_write_combine(); s = splsofttq(); Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile:1.1 Fri Jun 16 20:03:32 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/Makefile Tue Mar 6 11:45:29 2001 @@ -3,7 +3,7 @@ KMOD = tdfx SRCS = tdfx_drv.c tdfx_context.c SRCS += device_if.h bus_if.h pci_if.h -CFLAGS += ${DEBUG_FLAGS} -I.. +CFLAGS += ${DEBUG_FLAGS} -I. -I.. KMODDEPS = drm @: Index: xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c:1.1 Fri Jun 16 20:03:32 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bsd/drm/kernel/tdfx/tdfx_drv.c Tue Mar 6 11:45:29 2001 @@ -42,7 +42,7 @@ #define TDFX_NAME "tdfx" #define TDFX_DESC "tdfx" -#define TDFX_DATE "19991009" +#define TDFX_DATE "20000928" #define TDFX_MAJOR 1 #define TDFX_MINOR 0 #define TDFX_PATCHLEVEL 0 @@ -63,6 +63,9 @@ case 0x0005121a: s = "3Dfx Voodoo 3 graphics accelerator"; + break; + case 0x0009121a: + s = "3Dfx Voodoo 5 graphics accelerator"; break; } Index: xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile:1.15 xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile:1.16 --- xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile:1.15 Thu Nov 30 19:24:35 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Imakefile Fri Apr 20 13:02:43 2001 @@ -3,7 +3,7 @@ -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 @@ 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) Index: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c:1.42 xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c:1.48.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c:1.42 Thu Dec 7 10:43:45 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c Mon May 21 01:00:36 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.42 2000/12/07 15:43:45 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.c,v 1.48.2.1 2001/05/21 05:00:36 tsi Exp $ */ /* * Pci.c - New server PCI access functions * @@ -568,7 +568,12 @@ mask1 >>= 1; } /* I/O maps can be no larger than 8 bits */ + +#if defined(Lynx) && defined(__powerpc__) + if (PCI_MAP_IS_IO(addr1) && bits > 8) +#else if ((index < 6) && PCI_MAP_IS_IO(addr1) && bits > 8) +#endif bits = 8; /* ROM maps can be no larger than 24 bits */ if (index == 6 && bits > 24) @@ -623,20 +628,20 @@ PCITAG pciGenFindNext(void) { - unsigned long devid, tmp; - unsigned char base_class, sub_class, sec_bus, pri_bus; - Bool speculativeProbe = FALSE; + unsigned long devid, tmp; + unsigned char base_class, sub_class, sec_bus, pri_bus; + Bool speculativeProbe = FALSE; #ifdef DEBUGPCI -ErrorF("pciGenFindNext\n"); + ErrorF("pciGenFindNext\n"); #endif - for (;;) { + for (;;) { #ifdef DEBUGPCI -ErrorF("pciGenFindNext: pciBusNum %d\n", pciBusNum); + ErrorF("pciGenFindNext: pciBusNum %d\n", pciBusNum); #endif - if (pciBusNum == -1) { + if (pciBusNum == -1) { /* * Start at top of the order */ @@ -646,34 +651,32 @@ pciBusNum = 0; pciFuncNum = 0; pciDevNum = 0; - } - else { + } else { #ifdef PCI_MFDEV_SUPPORT #ifdef DEBUGPCI -ErrorF("pciGenFindNext: pciFuncNum %d\n", pciFuncNum); + ErrorF("pciGenFindNext: pciFuncNum %d\n", pciFuncNum); #endif /* * Somewhere in middle of order. Determine who's * next up */ if (pciFuncNum == 0) { + /* + * Is current dev a multifunction device? + */ + if (pciMfDev(pciBusNum, pciDevNum)) + /* Probe for other functions */ + pciFuncNum = 1; + else /* - * Is current dev a multifunction device? + * No more functions this device. Next + * device please */ - if (pciMfDev(pciBusNum, pciDevNum)) - /* Probe for other functions */ - pciFuncNum = 1; - else - /* - * No more functions this device. Next - * device please - */ - pciDevNum ++; - } - else if (++pciFuncNum >= 8) { - /* No more functions for this device. Next device please */ - pciFuncNum = 0; pciDevNum ++; + } else if (++pciFuncNum >= 8) { + /* No more functions for this device. Next device please */ + pciFuncNum = 0; + pciDevNum ++; } #else pciDevNum ++; @@ -682,116 +685,113 @@ !pciBusInfo[pciBusNum] || pciDevNum >= pciBusInfo[pciBusNum]->numDevices) { #ifdef DEBUGPCI -ErrorF("pciGenFindNext: next bus\n"); + ErrorF("pciGenFindNext: next bus\n"); #endif - /* - * No more devices for this bus. Next bus please - */ - if (speculativeProbe) { - xfree(pciBusInfo[pciBusNum]); - pciBusInfo[pciBusNum] = NULL; - } + /* + * No more devices for this bus. Next bus please + */ + if (speculativeProbe) { + xfree(pciBusInfo[pciBusNum]); + pciBusInfo[pciBusNum] = NULL; + } - if (++pciBusNum >= MAX_PCI_BUSES) { + if (++pciBusNum >= MAX_PCI_BUSES) { #ifdef DEBUGPCI -ErrorF("pciGenFindNext: out of buses\n"); + ErrorF("pciGenFindNext: out of buses\n"); #endif - /* No more buses. All done for now */ - return(PCI_NOT_FOUND); - } + /* No more buses. All done for now */ + return(PCI_NOT_FOUND); + } - pciDevNum = 0; + pciDevNum = 0; } - } + } #ifdef DEBUGPCI -ErrorF("pciGenFindNext: pciBusInfo[%d] = 0x%lx\n", pciBusNum, pciBusInfo[pciBusNum]); + ErrorF("pciGenFindNext: pciBusInfo[%d] = 0x%lx\n", pciBusNum, pciBusInfo[pciBusNum]); #endif - if (!pciBusInfo[pciBusNum]) { - pciBusInfo[pciBusNum] = xnfalloc(sizeof(pciBusInfo_t)); - *pciBusInfo[pciBusNum] = *pciBusInfo[0]; + if (!pciBusInfo[pciBusNum]) { + pciBusInfo[pciBusNum] = xnfalloc(sizeof(pciBusInfo_t)); + *pciBusInfo[pciBusNum] = *pciBusInfo[0]; - speculativeProbe = TRUE; - } + speculativeProbe = TRUE; + } - /* - * At this point, pciBusNum, pciDevNum, and pciFuncNum have been - * advanced to the next device. Compute the tag, and read the - * device/vendor ID field. - */ + /* + * At this point, pciBusNum, pciDevNum, and pciFuncNum have been + * advanced to the next device. Compute the tag, and read the + * device/vendor ID field. + */ #ifdef DEBUGPCI -ErrorF("pciGenFindNext: [%d, %d, %d]\n", pciBusNum, pciDevNum, pciFuncNum); + ErrorF("pciGenFindNext: [%d, %d, %d]\n", pciBusNum, pciDevNum, pciFuncNum); #endif - pciDeviceTag = PCI_MAKE_TAG(pciBusNum, pciDevNum, pciFuncNum); - inProbe = TRUE; - devid = pciReadLong(pciDeviceTag, 0); - inProbe = FALSE; + pciDeviceTag = PCI_MAKE_TAG(pciBusNum, pciDevNum, pciFuncNum); + inProbe = TRUE; + devid = pciReadLong(pciDeviceTag, 0); + inProbe = FALSE; #ifdef DEBUGPCI -ErrorF("pciGenFindNext: pciDeviceTag = 0x%lx, devid = 0x%lx\n", pciDeviceTag, devid); + ErrorF("pciGenFindNext: pciDeviceTag = 0x%lx, devid = 0x%lx\n", pciDeviceTag, devid); #endif - if (devid == 0xffffffff) + if (devid == 0xffffffff) continue; /* Nobody home. Next device please */ - if (speculativeProbe && (pciNumBuses <= pciBusNum)) - pciNumBuses = pciBusNum + 1; + if (speculativeProbe && (pciNumBuses <= pciBusNum)) + pciNumBuses = pciBusNum + 1; - speculativeProbe = FALSE; + speculativeProbe = FALSE; - /* - * Before checking for a specific devid, look for enabled - * PCI to PCI bridge devices. If one is found, create and - * initialize a bus info record (if one does not already exist). - */ + /* + * Before checking for a specific devid, look for enabled + * PCI to PCI bridge devices. If one is found, create and + * initialize a bus info record (if one does not already exist). + */ #ifdef PCI_BRIDGE_SUPPORT - tmp = pciReadLong(pciDeviceTag, PCI_CLASS_REG); - base_class = PCI_CLASS_EXTRACT(tmp); - sub_class = PCI_SUBCLASS_EXTRACT(tmp); - if (base_class == PCI_CLASS_BRIDGE) - if (sub_class == PCI_SUBCLASS_BRIDGE_PCI) { + tmp = pciReadLong(pciDeviceTag, PCI_CLASS_REG); + base_class = PCI_CLASS_EXTRACT(tmp); + sub_class = PCI_SUBCLASS_EXTRACT(tmp); + if ((base_class == PCI_CLASS_BRIDGE) && + (sub_class == PCI_SUBCLASS_BRIDGE_PCI)) { tmp = pciReadLong(pciDeviceTag, PCI_PCI_BRIDGE_BUS_REG); sec_bus = PCI_SECONDARY_BUS_EXTRACT(tmp); pri_bus = PCI_PRIMARY_BUS_EXTRACT(tmp); #ifdef DEBUGPCI -ErrorF("pciGenFindNext: pri_bus %d sec_bus %d\n", pri_bus, sec_bus); + ErrorF("pciGenFindNext: pri_bus %d sec_bus %d\n", pri_bus, sec_bus); #endif if (sec_bus > 0 && sec_bus < MAX_PCI_BUSES && pciBusInfo[pri_bus]) { - /* - * Found a secondary PCI bus - */ - if (!pciBusInfo[sec_bus]) { - pciBusInfo[sec_bus] = - xnfalloc(sizeof(pciBusInfo_t)); - - } - - /* Copy parents settings... */ - *pciBusInfo[sec_bus] = *pciBusInfo[pri_bus]; - - /* ...but not everything same as parent */ - pciBusInfo[sec_bus]->primary_bus = pri_bus; - pciBusInfo[sec_bus]->secondary = TRUE; - pciBusInfo[sec_bus]->numDevices = 32; + /* + * Found a secondary PCI bus + */ + if (!pciBusInfo[sec_bus]) + pciBusInfo[sec_bus] = xnfalloc(sizeof(pciBusInfo_t)); + + /* Copy parents settings... */ + *pciBusInfo[sec_bus] = *pciBusInfo[pri_bus]; + + /* ...but not everything same as parent */ + pciBusInfo[sec_bus]->primary_bus = pri_bus; + pciBusInfo[sec_bus]->secondary = TRUE; + pciBusInfo[sec_bus]->numDevices = 32; - if (pciNumBuses <= sec_bus) - pciNumBuses = sec_bus+1; + if (pciNumBuses <= sec_bus) + pciNumBuses = sec_bus+1; } - } + } #endif - /* - * Does this device match the requested devid after - * applying mask? - */ + /* + * Does this device match the requested devid after + * applying mask? + */ #ifdef DEBUGPCI -ErrorF("pciGenFindNext: pciDevidMask = 0x%lx, pciDevid = 0x%lx\n", pciDevidMask, pciDevid); + ErrorF("pciGenFindNext: pciDevidMask = 0x%lx, pciDevid = 0x%lx\n", pciDevidMask, pciDevid); #endif - if ((devid & pciDevidMask) == pciDevid) - /* Yes - Return it. Otherwise, next device */ - return(pciDeviceTag); /* got a match */ + if ((devid & pciDevidMask) == pciDevid) + /* Yes - Return it. Otherwise, next device */ + return(pciDeviceTag); /* got a match */ - } /* for */ - /*NOTREACHED*/ + } /* for */ + /*NOTREACHED*/ } PCITAG @@ -1053,10 +1053,122 @@ readPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, unsigned char *Buf, int Len) { + CARD32 romsave = 0; + int i; + romBaseSource b_reg; ADDRESS hostbase; - CARD32 romaddr, savebase = 0, romsave = 0, newbase = 0; - int ret; + CARD8 tmp[64]; + CARD8 *image; + + unsigned long offset; + int ret, length, len, rlength; + + romsave = pciReadLong(Tag, PCI_MAP_ROM_REG); + + for (i = ROM_BASE_PRESET; i <= ROM_BASE_FIND; i++) { + memType savebase = 0, newbase, romaddr; + + if (i == ROM_BASE_PRESET) { + /* Does the driver have a preference? */ + if (basereg > ROM_BASE_PRESET && basereg <= ROM_BASE_FIND) + b_reg = basereg; + else + b_reg = ++i; + } else + b_reg = i; + + if (!(newbase = getValidBIOSBase(Tag, b_reg))) + continue; /* no valid address found */ + + romaddr = PCIGETROM(newbase); + /* if we use a mem base save it and move it out of the way */ + if (b_reg >= 0 && b_reg <= 5) { + savebase = pciReadLong(Tag, PCI_MAP_REG_START+(basereg<<2)); + xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]" + " for device %i:%i:%i\n", basereg, + PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag), + PCI_FUNC_FROM_TAG(Tag)); + pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2), + (CARD32)~0); + } + /* Set ROM base address and enable ROM address decoding */ + pciWriteLong(Tag, PCI_MAP_ROM_REG, romaddr + | PCI_MAP_ROM_DECODE_ENABLE); + + hostbase = pciBusAddrToHostAddr(Tag, PCI_MEM, PCIGETROM(romaddr)); + + if ((xf86ReadBIOS(hostbase, 0, tmp, sizeof(tmp)) != sizeof(tmp)) + || (tmp[0] != 0x55) + || (tmp[1] != 0xaa) + || !tmp[2] ) { + /* Restore the base register if it was changed. */ + if (savebase) pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2), + (CARD32) savebase); + /* No BIOS found: try another address */ + continue; + } + +#if 0 + /* + * Currently this is only good for PC style BIOSes. + * This code needs to be revistited after 4.1 is out. + * We need to pass an argument for the BIOS type to + * look for. Then we can pick the correct BIOS. + * Combine this with the code in int10/pci.c. + */ + if ((Offset) > (tmp[2] << 9)) { + xf86Msg(X_WARNING,"xf86ReadPciBios: requesting data past " + "end of BIOS %i > %i\n",(Offset) , (tmp[2] << 9)); + } else { + if ((Offset + Len) > (tmp[2] << 9)) { + Len = (tmp[2] << 9) - Offset; + xf86Msg(X_INFO,"Truncating PCI BIOS Length to %i\n",Len); + } + } +#endif + + /* Read BIOS in 64kB chunks */ + ret = 0; + offset = Offset; + image = Buf; + len = Len; + while ((length = len) > 0) { + if (length > 0x10000) length = 0x10000; + rlength = xf86ReadBIOS(hostbase, offset, image, length); + if (rlength < 0) { + ret = rlength; + break; + } + ret += rlength; + if (rlength < length) break; + offset += length; + image += length; + len -= length; + } + /* Restore the base register if it was changed. */ + if (savebase) pciWriteLong(Tag, PCI_MAP_REG_START + (b_reg << 2), + (CARD32) savebase); + /* Restore ROM address decoding */ + pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); + return ret; + + } + /* Restore ROM address decoding */ + pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); + return 0; +} + +#if 0 +static int +readPciBIOS(unsigned long Offset, PCITAG Tag, int basereg, + unsigned char *Buf, int Len) +{ + ADDRESS hostbase; + CARD8 *image = Buf; + unsigned long offset; + CARD32 romaddr, savebase = 0, romsave = 0, newbase = 0; + int ret, tmpLen, length, rlength, n; /* XXX This assumes that memory access is enabled */ /* @@ -1067,24 +1179,23 @@ romsave = pciReadLong(Tag, PCI_MAP_ROM_REG); romaddr = PCIGETROM(romsave); if ((newbase = getValidBIOSBase(Tag, &basereg)) != romaddr) { +RetryWithBase: romaddr = PCIGETROM(newbase); - if (romaddr != 0 && romaddr == newbase) { -#if 1 - /* move mem base out of the way if in conflict with ROM */ + if (romaddr) { + /* move mem base out of the way if in conflicts with ROM */ if ((basereg >= 0) && (basereg <= 5)) { - savebase = pciReadLong(Tag, PCI_MAP_REG_START + (basereg << 2)); + if (!savebase) + savebase = pciReadLong(Tag, PCI_MAP_REG_START+(basereg<<2)); if (PCIGETROM(savebase) == romaddr) { - xf86MsgVerb(X_INFO,5,"xf86ReadPciBios: modifying membase[%i]" + xf86MsgVerb(X_INFO,5,"xf86ReadPciBIOS: modifying membase[%i]" " for device %i:%i:%i\n", basereg, PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag), PCI_FUNC_FROM_TAG(Tag)); - pciWriteLong(Tag, PCI_MAP_REG_START + (basereg << 2), 0); + pciWriteLong(Tag, PCI_MAP_REG_START + (basereg << 2), + (CARD32)~0); } } -#endif - pciWriteLong(Tag, PCI_MAP_ROM_REG, romaddr); - } else - romaddr = 0; + } } @@ -1092,19 +1203,56 @@ xf86Msg(X_WARNING, "xf86ReadPciBIOS: cannot locate a BIOS address\n"); return -1; } - else - xf86MsgVerb(X_INFO,5,"xf86ReadPciBIOS: found ValidBIOSBase for %i:%i:%i:" - " %x\n", PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag), - PCI_FUNC_FROM_TAG(Tag),newbase); + xf86MsgVerb(X_INFO, 5, + "xf86ReadPciBIOS: found ValidBIOSBase for %i:%i:%i: %x\n", + PCI_BUS_FROM_TAG(Tag), PCI_DEV_FROM_TAG(Tag), PCI_FUNC_FROM_TAG(Tag), + newbase); hostbase = pciBusAddrToHostAddr(Tag, PCI_MEM, PCIGETROM(romaddr)); -#ifdef DEBUG - ErrorF("ReadPciBIOS: base = 0x%x\n",romaddr); -#endif + xf86MsgVerb(X_INFO, 5, "ReadPciBIOS: base = 0x%x\n",romaddr); /* Enable ROM address decoding */ pciWriteLong(Tag, PCI_MAP_ROM_REG, romaddr | PCI_MAP_ROM_DECODE_ENABLE); - ret = xf86ReadBIOS(hostbase, Offset, Buf, Len); + /* Check to see if we really have a PCI BIOS image */ + rlength = xf86ReadBIOS(hostbase, 0, tmp_buf, sizeof(tmp_buf)); + if (rlength < 0) return rlength; + /* If we found a BIOS image we read the requested data */ + if ((rlength == sizeof(tmp_buf)) && (tmp_buf[0] == 0x55) + && (tmp_buf[1] == 0xaa) && tmp_buf[2] ) { + + /* Read BIOS in 64kB chunks */ + ret = 0; + offset = Offset; + tmpLen = Len; + image = Buf; + + while ((length = tmpLen) > 0) { + if (length > 0x10000) length = 0x10000; + rlength = xf86ReadBIOS(hostbase, offset, image, length); + if (rlength < 0) { + ret = rlength; + break; + } + ret += rlength; + if (rlength < length) break; + offset += length; + image += length; + tmpLen -= length; + } + } else { + /* If we don't have a PCI BIOS image we look further */ + n = 0; + if ((basereg >= 0) && (basereg <= 5) && xf86PciVideoInfo) do { + pciVideoPtr pvp; + + if (!(pvp = xf86PciVideoInfo[n++])) break; + if (pciTag(pvp->bus, pvp->device, pvp->func) == Tag) { + if (newbase == pvp->memBase[basereg]) break; + newbase = pvp->memBase[basereg]; + goto RetryWithBase; + } + } while (1); + } /* Restore ROM address decoding */ pciWriteLong(Tag, PCI_MAP_ROM_REG, romsave); @@ -1114,6 +1262,7 @@ return ret; } +#endif typedef CARD32 (*ReadProcPtr)(PCITAG, int); typedef void (*WriteProcPtr)(PCITAG, int, CARD32); @@ -1129,7 +1278,8 @@ size = readPciBIOS(Offset,Tag,basereg,Buf,Len); - if (size != -1 && Buf[0] == 0x55 && Buf[1] == 0xaa) + if ((size == Len) && (Buf[0] == 0x55) && (Buf[1] == 0xaa) && Buf[2] && + (Len >= (Buf[2] << 9))) return size; num = pciTestMultiDeviceCard(PCI_BUS_FROM_TAG(Tag), @@ -1149,7 +1299,8 @@ PCI_CMD_STAT_REG,(Acc2 | PCI_ENA)); size = readPciBIOS(Offset,pTag[i],0,Buf,Len); ((WriteProcPtr)(pciLongFunc(pTag[i],WRITE)))(pTag[i],PCI_CMD_STAT_REG,Acc2); - if (size != -1 && ((CARD8*)Buf)[0] == 0x55 && ((CARD8*)Buf)[1] == 0xaa) + if ((size == Len) && (Buf[0] == 0x55) && (Buf[1] == 0xaa) && Buf[2] && + (Len >= (Buf[2] << 9))) break; } ((WriteProcPtr)(pciLongFunc(Tag,WRITE)))(Tag,PCI_CMD_STAT_REG,Acc1); Index: xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h:1.16 xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h:1.18.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h:1.16 Thu Nov 30 19:24:35 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Pci.h Mon May 21 01:00:36 2001 @@ -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.18.2.1 2001/05/21 05:00:36 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -85,7 +85,12 @@ */ #define MAX_PCI_DEVICES 64 /* Max number of devices accomodated */ /* by xf86scanpci */ +#if defined(i386) || defined(__i386) || defined(__i386__) +/* Q&D stopgap to deal with mainboards whose PCI space is smaller */ +#define MAX_PCI_BUSES 128 /* Max number of PCI buses */ +#else #define MAX_PCI_BUSES 256 /* Max number of PCI buses */ +#endif #define PCI_NOT_FOUND 0xffffffff @@ -147,7 +152,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) Index: xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c:1.1 --- /dev/null Mon Jun 4 12:41:24 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/Sbus.c Fri Apr 20 13:02:43 2001 @@ -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); +} Index: xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c:1.3.6.1 --- xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c:1.3 Sun Mar 28 10:32:57 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c Tue May 29 12:38:00 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c,v 1.3 1999/03/28 15:32:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/linuxPci.c,v 1.3.6.1 2001/05/29 16:38:00 tsi Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -80,21 +80,10 @@ }; #if X_BYTE_ORDER == X_BIG_ENDIAN -#ifdef __sparc__ -#ifndef ASI_PL -#define ASI_PL 0x88 -#endif -#define PCI_CPU(val) ({ \ -int __ret; \ -__asm__ __volatile__("lduwa [%1] %2, %0" : "=r" (__ret) : "r" (&val), "i" (ASI_PL)); \ -__ret; \ -}) -#else #define PCI_CPU(val) (((val >> 24) & 0x000000ff) | \ ((val >> 8) & 0x0000ff00) | \ ((val << 8) & 0x00ff0000) | \ ((val << 24) & 0xff000000)) -#endif #else #define PCI_CPU(val) (val) #endif Index: xc/programs/Xserver/hw/xfree86/os-support/bus/linuxSbus.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/linuxSbus.c:1.4 xc/programs/Xserver/hw/xfree86/os-support/bus/linuxSbus.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/bus/linuxSbus.c:1.4 Tue Oct 17 12:53:19 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/linuxSbus.c Mon Jun 4 12:41:25 2001 @@ -1,581 +0,0 @@ -/* - * Linux platform specific 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/linuxSbus.c,v 1.4 2000/10/17 16:53:19 tsi Exp $ */ - -#include <fcntl.h> -#include <stdio.h> -#include <unistd.h> -#include <stdlib.h> -#include <sys/ioctl.h> -#include <sys/mman.h> -#include <asm/openpromio.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); -} Index: xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c:1.5 xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c:1.5 Tue Feb 8 08:13:29 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c Fri May 11 04:16:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c,v 1.5 2000/02/08 13:13:29 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/ppcPci.c,v 1.6 2001/05/11 08:16:55 alanh Exp $ */ /* * ppcPci.c - PowerPC PCI access functions * @@ -140,7 +140,13 @@ } extern unsigned long motoPciMemBase = 0; + +#if defined(Lynx) && defined(__powerpc__) +extern unsigned long motoPciMemLen = 0x40000000; +#else extern unsigned long motoPciMemLen = 0x3f000000; +#endif + extern unsigned long motoPciMemBaseCPU = 0xc0000000; ADDRESS Index: xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c:1.3 Thu Nov 2 14:10:55 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/sparcPci.c Fri Apr 20 13:02:43 2001 @@ -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 @@ #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 @@ return(val); } -void +static void sparcPciCfgWrite(PCITAG tag, int off, CARD32 val) { int bus, dfn; @@ -122,7 +123,7 @@ syscall(__NR_pciconfig_write, bus, dfn, off, 4, &val); } -void +static void sparcPciCfgSetBits(PCITAG tag, int off, CARD32 mask, CARD32 bits) { int bus, dfn; Index: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h:1.26 xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h:1.27 --- xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h:1.26 Tue Sep 19 08:46:21 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h Tue May 15 06:19:42 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.26 2000/09/19 12:46:21 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Pci.h,v 1.27 2001/05/15 10:19:42 eich Exp $ */ /* * Copyright 1998 by Concurrent Computer Corporation * @@ -655,6 +655,18 @@ #endif extern int pciNumBuses; + +typedef enum { + ROM_BASE_PRESET = -2, + ROM_BASE_BIOS, + ROM_BASE_MEM0 = 0, + ROM_BASE_MEM1, + ROM_BASE_MEM2, + ROM_BASE_MEM3, + ROM_BASE_MEM4, + ROM_BASE_MEM5, + ROM_BASE_FIND +} romBaseSource; #endif /* _XF86PCI_H */ Index: xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h diff -u xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h:1.2 Fri Jun 30 13:15:18 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/bus/xf86Sbus.h Fri Apr 20 13:02:43 2001 @@ -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> Index: xc/programs/Xserver/hw/xfree86/os-support/cygwin/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/cygwin/Imakefile:1.2 xc/programs/Xserver/hw/xfree86/os-support/cygwin/Imakefile:removed --- xc/programs/Xserver/hw/xfree86/os-support/cygwin/Imakefile:1.2 Tue Aug 15 12:05:37 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/cygwin/Imakefile Mon Jun 4 12:41:25 2001 @@ -1,48 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/Imakefile,v 1.2 2000/08/15 16:05:37 dawes Exp $ - - - - -XCOMM $XConsortium: Imakefile /main/4 1996/09/28 17:23:58 rws $ - -#include <Server.tmpl> - -BIOS_MOD = bios_mmap - - -SRCS = cygwin_init.c ioperm_noop.c cygwin_io.c libc_wrapper.c cygwin_video.c \ - posix_tty.c stdPci.c $(BIOS_MOD).c VTsw_noop.c \ - stdResource.c sigiostubs.c std_kbdEv.c vidmem.c \ - stdResource.c stdPci.c sigiostubs.c pm_noop.c kmod_noop.c agp_noop.c - -OBJS = cygwin_init.o ioperm_noop.o cygwin_io.o libc_wrapper.o cygwin_video.o \ - posix_tty.o stdPci.o $(BIOS_MOD).o VTsw_noop.o \ - stdResource.o sigiostubs.o std_kbdEv.o vidmem.o \ - stdResource.o stdPci.o sigiostubs.o pm_noop.o kmod_noop.o agp_noop.o - -INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ - -I$(XINCLUDESRC) - -RESDEFINES = -DUSESTDRES -DEFINE = $(RESDEFINES) - -SubdirLibraryRule($(OBJS)) -NormalLibraryObjectRule() -NormalAsmObjectRule() - -LinkSourceFile(VTsw_noop.c,../shared) -LinkSourceFile(posix_tty.c,../shared) -LinkSourceFile(ioperm_noop.c,../shared) -LinkSourceFile(stdPci.c,../shared) -LinkSourceFile(libc_wrapper.c,../shared) -LinkSourceFile(sigiostubs.c,../shared) -LinkSourceFile(std_kbdEv.c,../shared) -LinkSourceFile(vidmem.c,../shared) -LinkSourceFile(stdResource.c,../shared) -LinkSourceFile(pm_noop.c,../shared) -LinkSourceFile(kmod_noop.c,../shared) -LinkSourceFile(agp_noop.c,../shared) - - -DependTarget() - Index: xc/programs/Xserver/hw/xfree86/os-support/cygwin/bios_mmap.c diff -u xc/programs/Xserver/hw/xfree86/os-support/cygwin/bios_mmap.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/cygwin/bios_mmap.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/cygwin/bios_mmap.c:1.1 Thu Aug 10 13:40:35 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/cygwin/bios_mmap.c Mon Jun 4 12:41:25 2001 @@ -1,76 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/bios_mmap.c,v 1.1 2000/08/10 17:40:35 dawes Exp $ */ -/* - * Copyright 1992 by Robert Baron <Robert.Baron@ernst.mach.cs.cmu.edu> - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Robert Baron and David Wexelblat not - * be used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. Robert Baron and - * David Wexelblat make no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * ROBERT BARON AND DAVID WEXELBLAT DISCLAIMS ALL WARRANTIES WITH REGARD TO - * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND - * FITNESS, IN NO EVENT SHALL ROBERT BARON OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: bios_mmap.c /main/4 1996/02/21 17:51:47 kaleb $ */ - -#include "X.h" -#include "misc.h" - -#define DevicePtr int -#include "xf86_OSlib.h" - -#define BIOS_SIZE 0x20000 -#define KERN_SUCCESS 0 - -int xf86ReadBIOS(Base, Offset, Buf, Len) -unsigned long Base; -unsigned long Offset; -unsigned char *Buf; -int Len; -{ - /*int fd; - int screen_addr; - int ret; - - if ((fd = open("/dev/zero", O_RDWR, 0)) < 0) - { - ErrorF("xf86ReadBIOS: Failed to open /dev/zero\n"); - return(-1); - } - if (KERN_SUCCESS != vm_allocate(task_self(), &screen_addr, - BIOS_SIZE, TRUE)) - { - ErrorF("xf86ReadBIOS: Failed vmallocate %x\n", BIOS_SIZE); - close(fd); - return(-1); - } - if (mmap(screen_addr, BIOS_SIZE, 3, 1, fd, Base) < 0) - { - ErrorF("xf86ReadBIOS: Failed to mmap %x at %x\n", - BIOS_SIZE, Base); - vm_deallocate(task_self(), screen_addr, BIOS_SIZE); - close(fd); - return(-1); - } - memcpy(Buf, (unsigned char *)(screen_addr + Offset), Len); - if (KERN_SUCCESS != vm_deallocate(task_self(), screen_addr, BIOS_SIZE)) - { - ErrorF("xf86ReadBIOS: Failed vmdeallocate %x\n", BIOS_SIZE); - close(fd); - return(-1); - } - close(fd);*/ - return(Len); -} Index: xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_init.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_init.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_init.c:1.2 Fri Aug 11 19:59:48 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_init.c Mon Jun 4 12:41:25 2001 @@ -1,167 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_init.c,v 1.2 2000/08/11 23:59:48 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany - * Copyright 1993 by David Wexelblat <dwex@goblin.org> - * Copyright 1999 by David Holland <davidh@iquest.net> - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Thomas Roell and David Wexelblat - * not be used in advertising or publicity pertaining to distribution of - * the software without specific, written prior permission. Thomas Roell and - * David Wexelblat makes no representations about the suitability of this - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * DAVID HOLLAND, THOMAS ROELL AND DAVID WEXELBLAT DISCLAIMS ALL - * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * DAVID HOLLAND, THOMAS ROELL OR DAVID WEXELBLAT BE LIABLE FOR - * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF - * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $XConsortium: cygwin_init.c /main/4 1996/02/21 17:54:10 kaleb $ */ - -#include <signal.h> -#include <sys/time.h> -#include <unistd.h> - -#include "X.h" -#include "Xmd.h" - -#include "scrnintstr.h" -#include <errno.h> -#include <sys/mman.h> -#include "compiler.h" - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - -static Bool KeepTty = FALSE; - -static Bool Protect0 = FALSE; - - -char fb_dev[PATH_MAX] = "/dev/conin"; - -#define MAX_SECONDS 60 -#define USEC_IN_SEC (unsigned long)1000000 - - -void -xf86OpenConsole() -{ - int fd; - int i; - MessageType from = X_PROBED; - - if (serverGeneration == 1) - { - /* check if we're run with euid==0 */ - if (geteuid() != 0) - { - FatalError("xf86OpenConsole: Server must be suid root\n"); - } - - /* Protect page 0 to help find NULL dereferencing */ - /* mprotect() doesn't seem to work */ - if (Protect0) - { - int fd = -1; - - if ((fd = open("/dev/zero", O_RDONLY, 0)) < 0) - { - xf86Msg(X_WARNING, - "xf86OpenConsole: cannot open /dev/zero (%s)\n", - strerror(errno)); - } - else - { - if ((int)mmap(0, 0x1000, PROT_NONE, - MAP_FIXED | MAP_SHARED, fd, 0) == -1) - { - xf86Msg(X_WARNING, - "xf86OpenConsole: failed to protect page 0 (%s)\n", - strerror(errno)); - } - close(fd); - } - } - - if (!KeepTty) - { - setpgrp(); - } - - if (((xf86Info.consoleFd = open(fb_dev, O_RDWR | O_NDELAY, 0)) < 0)) - { - FatalError("xf86OpenConsole: Cannot open %s (%s)\n", - fb_dev, strerror(errno)); - } - - } - return; -} - -void xf86CloseConsole() -{ - - int tmp; - - close(xf86Info.consoleFd); - - return; -} - -int xf86ProcessArgument(argc, argv, i) -int argc; -char *argv[]; -int i; -{ - /* - * Keep server from detaching from controlling tty. This is useful - * when debugging (so the server can receive keyboard signals. - */ - if (!strcmp(argv[i], "-keeptty")) - { - KeepTty = TRUE; - return(1); - } - /* - * Undocumented flag to protect page 0 from read/write to help - * catch NULL pointer dereferences. This is purely a debugging - * flag. - */ - if (!strcmp(argv[i], "-protect0")) - { - Protect0 = TRUE; - return(1); - } - if (!strcmp(argv[i], "-dev") && i+1 < argc) { - strncpy(fb_dev, argv[i+1], PATH_MAX); - fb_dev[PATH_MAX-1] = '\0'; - return(2); - } - - - return(0); -} - -void xf86UseMsg() -{ - ErrorF("-ar1 <float> Set autorepeat initiate time (sec)\n"); - ErrorF(" (If not using XKB)\n"); - ErrorF("-ar2 <float> Set autorepeat interval time (sec)\n"); - ErrorF(" (If not using XKB)\n"); - ErrorF("-dev <fb> FrameBuffer device\n"); - ErrorF("-keeptty "); - ErrorF("don't detach controlling tty (for debugging only)\n"); - return; -} - Index: xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_io.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_io.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_io.c:1.2 Wed Aug 23 17:06:21 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_io.c Mon Jun 4 12:41:25 2001 @@ -1,105 +0,0 @@ -/* - * (c) Copyright 1998 by Sebastien Marineau - * <sebastien@qnx.com> - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * SEBASTIEN MARINEAU BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Sebastien Marineau shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Sebastien Marineau. - * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_io.c,v 1.2 2000/08/23 21:06:21 dawes Exp $ - */ - -/* This module contains the qnx-specific functions to access the keyboard - * and the console. - */ - -#include <stdio.h> -#include <stdlib.h> -#include <sys/types.h> - -#include <sys/mman.h> -#include <sys/ioctl.h> -#include <errno.h> - -#include <X.h> -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" - - - -void -xf86SoundKbdBell(loudness, pitch, duration) -int loudness, pitch, duration; -{ - -/* Come back and fix! */ -ErrorF("xf86SoundKbdBell: to implement\n"); -} - -void -xf86SetKbdLeds(leds) -int leds; -{ -/* This just a dumb thing*/ - return; -} - -int -xf86GetKbdLeds() -{ - return; -} - -/* This is a no-op for now */ -void -xf86SetKbdRepeat(rad) -char rad; -{ - return; -} - - -/* This is a no-op for now */ -void -xf86KbdInit() -{ - - return; -} - - -void xf86MouseInit() -{ - return; -} - - -void xf86ProtocolIDToName() -{ - return FALSE; -} - -void OsVendorErrorFProc() -{ - return FALSE; -} - Index: xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_video.c diff -u xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_video.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_video.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_video.c:1.1 Thu Aug 10 13:40:36 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_video.c Mon Jun 4 12:41:25 2001 @@ -1,165 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/cygwin_video.c,v 1.1 2000/08/10 17:40:36 dawes Exp $ */ -/* - * Copyright 1993-1999 by The XFree86 Project, Inc - * - */ - -#include "X.h" -#include "input.h" -#include "scrnintstr.h" -#include <sys/mman.h> - -#include "xf86.h" -#include "xf86Priv.h" -#include "xf86_OSlib.h" -#include "xf86OSpriv.h" -#include "xf86_OSproc.h" - -/* - * This file contains the common part of the video memory mapping functions - */ - -/* - * Get a piece of the ScrnInfoRec. At the moment, this is only used to hold - * the MTRR option information, but it is likely to be expanded if we do - * auto unmapping of memory at VT switch. - * - */ - -typedef struct { - unsigned long physBase; - unsigned long size; - pointer virtBase; - pointer mtrrInfo; - int flags; -} MappingRec, *MappingPtr; - -typedef struct { - int numMappings; - MappingPtr * mappings; - Bool mtrrEnabled; - MessageType mtrrFrom; - Bool mtrrOptChecked; - ScrnInfoPtr pScrn; -} VidMapRec, *VidMapPtr; - -static int vidMapIndex = -1; - -#define VIDMAPPTR(p) ((VidMapPtr)((p)->privates[vidMapIndex].ptr)) - -static VidMemInfo vidMemInfo = {FALSE, }; - -static VidMapPtr -getVidMapRec(int scrnIndex) -{ - VidMapPtr vp; - - ScrnInfoPtr pScrn = xf86Screens[scrnIndex]; - if (vidMapIndex < 0) - vidMapIndex = xf86AllocateScrnInfoPrivateIndex(); - - if (VIDMAPPTR(pScrn) != NULL) - return VIDMAPPTR(pScrn); - - vp = pScrn->privates[vidMapIndex].ptr = xnfcalloc(sizeof(VidMapRec), 1); - vp->mtrrEnabled = TRUE; /* default to enabled */ - vp->mtrrFrom = X_DEFAULT; - vp->mtrrOptChecked = FALSE; - vp->pScrn = pScrn; - return vp; -} - -static MappingPtr -newMapping(VidMapPtr vp) -{ - vp->mappings = xnfrealloc(vp->mappings, sizeof(MappingPtr) * - (vp->numMappings + 1)); - vp->mappings[vp->numMappings] = xnfcalloc(sizeof(MappingRec), 1); - return vp->mappings[vp->numMappings++]; -} - -static MappingPtr -findMapping(VidMapPtr vp, pointer vbase, unsigned long size) -{ - int i; - - for (i = 0; i < vp->numMappings; i++) { - if (vp->mappings[i]->virtBase == vbase && - vp->mappings[i]->size == size) - return vp->mappings[i]; - } - return NULL; -} - -static void -removeMapping(VidMapPtr vp, MappingPtr mp) -{ - int i, found = 0; - - for (i = 0; i < vp->numMappings; i++) { - if (vp->mappings[i] == mp) { - found = 1; - xfree(vp->mappings[i]); - } else if (found) { - vp->mappings[i - 1] = vp->mappings[i]; - } - } - vp->numMappings--; - vp->mappings[vp->numMappings] = NULL; -} - -enum { OPTION_MTRR }; -static OptionInfoRec opts[] = -{ - { OPTION_MTRR, "mtrr", OPTV_BOOLEAN, {0}, FALSE }, - { -1, NULL, OPTV_NONE, {0}, FALSE } -}; - -static void -checkMtrrOption(VidMapPtr vp) -{ - if (!vp->mtrrOptChecked && vp->pScrn->options != NULL) { - /* - * We get called once for each screen, so reset - * the OptionInfoRecs. - */ - opts[0].found = FALSE; - - xf86ProcessOptions(vp->pScrn->scrnIndex, vp->pScrn->options, - opts); - if (xf86GetOptValBool(opts, OPTION_MTRR, &vp->mtrrEnabled)) - vp->mtrrFrom = X_CONFIG; - vp->mtrrOptChecked = TRUE; - } -} - - -/***************************************************************************/ -/* Interrupt Handling section */ -/***************************************************************************/ - -Bool xf86DisableInterrupts() -{ - /* allow interrupt disabling but check for side-effects. - * Not a good policy ... - */ - __asm__ __volatile__("sti"); - return TRUE; -} - -void xf86EnableInterrupts() -{ - /*Reenable*/ - __asm__ __volatile__ ("sti"); -} - - - -/***************************************************************************/ -/* Initialize video memory */ -/***************************************************************************/ - -void xf86OSInitVidMem(VidMemInfoPtr pVidMem) -{ - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/Imakefile:1.1 xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/Imakefile:removed --- xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/Imakefile:1.1 Thu Aug 10 13:40:36 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/Imakefile Mon Jun 4 12:41:25 2001 @@ -1,110 +0,0 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/Imakefile,v 1.1 2000/08/10 17:40:36 dawes Exp $ - -#define IHaveModules - -#include <Server.tmpl> - -SRCS1 = pci.c xf86int10module.c helper_exec.c helper_mem.c xf86int10.c -OBJS1 = pci.o xf86int10module.o helper_exec.o helper_mem.o xf86int10.o - -LinkSourceFile(helper_mem.c,$(XF86SRC)/int10) -LinkSourceFile(helper_exec.c,$(XF86SRC)/int10) -LinkSourceFile(xf86int10.c,$(XF86SRC)/int10) -LinkSourceFile(pci.c,$(XF86SRC)/int10) -LinkSourceFile(xf86int10module.c,$(XF86SRC)/int10) -LinkSourceFile(xf86x86emu.c,$(XF86SRC)/int10) -LinkSourceFile(generic.c,$(XF86SRC)/int10) - -INCLUDES = -I. -I$(XF86COMSRC) -I$(XF86SRC)/int10 \ - -I$(XF86OSSRC) \ - -I$(SERVERSRC)/include -I$(XINCLUDESRC) - -DEFINES=-DHAVE_SYSV_IPC - -#if 0 -/* debugging stuff */ -#DEFINES =-D_PC -#undef XF86INT10_BUILD -#define XF86INT10_BUILD X86EMU_GENERIC -#define X86EMU_LIBPATH /usr/local/lib -#endif - -#if defined(i386Architecture) -DEFINES =-D_PC -#endif - -/* XXX keep this temporarily for reference */ -#if 0 -#if (XF86INT10_BUILD == X86EMU_GENERIC) - -SRCS = $(SRCS1) xf86x86emu.c generic.c -OBJS = $(OBJS1) xf86x86emu.o generic.o x86emu.o -SpecialObjectRule(pci.o, pci.c, -D_X86EMU) -SpecialObjectRule(helper_exec.o, helper_exec.c, -D_X86EMU) -SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU -DSHOW_ALL_DEVICES) -SpecialObjectRule(generic.o, generic.c, -D_X86EMU) -SpecialObjectRule(xf86x86emu.o, xf86x86emu.c, -D_X86EMU) -BuildObjectFromLibraryWithPath(X86EMU_LIBPATH,x86emu,x86emu) -#endif -#endif - -#if defined(XF86INT10_BUILD) && (XF86INT10_BUILD == X86VM) - -SRCS = $(SRCS1) linux.c -OBJS = $(OBJS1) linux.o -SpecialObjectRule(pci.o, pci.c, -D_VM86_LINUX) -SpecialObjectRule(helper_exec.o, helper_exec.c, -D_VM86_LINUX) -SpecialObjectRule(xf86int10.o, xf86int10.c, -D_VM86_LINUX -DSHOW_ALL_DEVICES) -SpecialObjectRule(linux.o, linux.c, -D_VM86_LINUX -DHAVE_SYSV_IPC) - -#elif (XF86INT10_BUILD == X86EMU_OS) - -SpecialObjectRule(pci.o, pci.c, -D_X86EMU) -SpecialObjectRule(helper_exec.o, helper_exec.c, -D_X86EMU) -SpecialObjectRule(xf86int10.o, xf86int10.c, -D_X86EMU -DSHOW_ALL_DEVICES) -SpecialObjectRule(linux.o, linux.c, -D_X86EMU -DHAVE_SYSV_IPC) - -X86TOPDIR = $(TOP)/extras/x86emu -X86SRCDIR = $(X86TOPDIR)/src/x86emu -X86EMUINCLUDES = -I$(X86TOPDIR)/include -I$(X86SRCDIR) - -# if !defined(X86EMU_LIBPATH) -X86EMUSRCS = debug.c decode.c fpu.c ops.c ops2.c prim_ops.c sys.c -X86EMUOBJS = debug.o decode.o fpu.o ops.o ops2.o prim_ops.o sys.o - -LinkSourceFile(debug.c,$(X86SRCDIR)) -LinkSourceFile(decode.c,$(X86SRCDIR)) -LinkSourceFile(fpu.c,$(X86SRCDIR)) -LinkSourceFile(ops.c,$(X86SRCDIR)) -LinkSourceFile(ops2.c,$(X86SRCDIR)) -LinkSourceFile(prim_ops.c,$(X86SRCDIR)) -LinkSourceFile(sys.c,$(X86SRCDIR)) -# else -BuildObjectFromLibraryWithPath(X86EMU_LIBPATH,x86emu,x86emu) -X86EMUOBJS = x86emu.o -# endif - -SRCS = $(SRCS1) xf86x86emu.c linux.c $(X86EMUSRCS) -OBJS = $(OBJS1) xf86x86emu.o linux.o $(X86EMUOBJS) - -#endif - -#if defined(XF86INT10_BUILD) && XF86INT10_BUILD > X86EMU_GENERIC - -LibraryModuleTarget(int10, $(OBJS)) - -InstallLibraryModule(int10,$(MODULEDIR),linux) - -all:: - (set -x; cd ../..; \ - RemoveFile(LibraryTargetName(int10)); \ - $(LN) linux/int10/LibraryTargetName(int10) . ) - -InstallDriverSDKLibraryModule(int10,$(DRIVERSDKMODULEDIR),.) - -InstallDriverSDKNonExecFile(../../int10/xf86int10.h,$(DRIVERSDKINCLUDEDIR)) - -#endif - -DependTarget() - Index: xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/os2.c diff -u xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/os2.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/os2.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/os2.c:1.1 Thu Aug 10 13:40:36 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/os2.c Mon Jun 4 12:41:25 2001 @@ -1,451 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/cygwin/int10/os2.c,v 1.1 2000/08/10 17:40:36 dawes Exp $ */ -/* - * XFree86 int10 module - * execute BIOS int 10h calls in x86 real mode environment - * Copyright 1999 Egbert Eich - */ -#include "xf86.h" -#include "xf86str.h" -#include "xf86_OSproc.h" -#include "xf86_ansic.h" -#include "xf86Pci.h" -#include "compiler.h" -#define _INT10_PRIVATE -#include "xf86int10.h" -#include "int10Defines.h" - -static CARD8 read_b(xf86Int10InfoPtr pInt,int addr); -static CARD16 read_w(xf86Int10InfoPtr pInt,int addr); -static CARD32 read_l(xf86Int10InfoPtr pInt,int addr); -static void write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val); -static void write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val); -static void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val); - -/* - * the emulator cannot pass a pointer to the current xf86Int10InfoRec - * to the memory access functions therefore store it here. - */ - -typedef struct { - int shift; - int pagesize_1; - int entries; - void* vRam; - memType *alloc_rec; -} genericInt10Priv; - -#define INTPriv(x) ((genericInt10Priv*)x->private) - -int10MemRec genericMem = { - read_b, - read_w, - read_l, - write_b, - write_w, - write_l -}; - -static void MapVRam(xf86Int10InfoPtr pInt); -static void UnmapVRam(xf86Int10InfoPtr pInt); -static void setupTable(xf86Int10InfoPtr pInt, memType address, - int loc,int size); - -static void *sysMem = NULL; - -xf86Int10InfoPtr -xf86InitInt10(int entityIndex) -{ - xf86Int10InfoPtr pInt; - int screen; - void* intMem; - void* vbiosMem; - int pagesize; - int entries; - int shift; - legacyVGARec vga; - - screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; - - if (int10skip(xf86Screens[screen],entityIndex)) - return NULL; - - pInt = (xf86Int10InfoPtr)xnfcalloc(1,sizeof(xf86Int10InfoRec)); - pInt->entityIndex = entityIndex; - if (!xf86Int10ExecSetup(pInt)) - goto error0; - pInt->mem = &genericMem; - pagesize = xf86getpagesize(); - pInt->private = (pointer)xnfcalloc(1,sizeof(genericInt10Priv)); - entries = SYS_SIZE / pagesize; - - pInt->scrnIndex = screen; - INTPriv(pInt)->pagesize_1 = pagesize - 1; - INTPriv(pInt)->entries = entries; - INTPriv(pInt)->alloc_rec = - xnfcalloc(1,sizeof(memType) * entries); - for (shift = 0 ; (pagesize >> shift) ; shift++) {}; - shift -= 1; - INTPriv(pInt)->shift = shift; - - /* - * we need to map video RAM MMIO as some chipsets map mmio - * registers into this range. - */ - - MapVRam(pInt); - intMem = xnfalloc(pagesize); - setupTable(pInt,(memType)intMem,0,pagesize); - vbiosMem = xnfalloc(V_BIOS_SIZE); - -#ifdef _PC - if (!sysMem) - sysMem = xf86MapVidMem(screen,VIDMEM_FRAMEBUFFER,SYS_BIOS,BIOS_SIZE); - setupTable(pInt,(memType)sysMem,SYS_BIOS,BIOS_SIZE); - if (xf86ReadBIOS(0,0,(unsigned char *)intMem,LOW_PAGE_SIZE) < 0) { - xf86DrvMsg(screen,X_ERROR,"Cannot read int vect\n"); - goto error1; - } - if (xf86IsEntityPrimary(entityIndex)) { - int size; - int cs = MEM_RW(pInt,((0x10<<2)+2)); - -int i,k,m; -char buf[100], hx[10]; -for (i=0; i<0x100; i+=16) { -sprintf(buf,"%04x: ",i); -for (k=0; k<16; k++) { - m = MEM_RB(pInt,i+k); - sprintf(hx,"%02x ",((unsigned)m)&0xff); - strcat(buf,hx); -} -xf86DrvMsg(screen,X_INFO,"%s\n",buf); -} - - - - xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segmant is: 0x%x\n",cs); - if (xf86ReadBIOS(cs << 4,0,(unsigned char *)vbiosMem, - 0x10) < 0) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (1)\n"); - goto error1; - } - if (!((*(CARD8*)vbiosMem == 0x55) - && (*((CARD8*)vbiosMem + 1) == 0xAA))) { - xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n"); - goto error1; - } - - size = *((CARD8*)vbiosMem + 2) * 512; - if (xf86ReadBIOS(cs << 4,0,vbiosMem, size) < 0) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (2)\n"); - goto error1; - } - if (bios_checksum(vbiosMem,size)) { - xf86DrvMsg(screen,X_ERROR,"Bad checksum of V_BIOS \n"); - goto error1; - } - - setupTable(pInt,(memType)vbiosMem,cs<<4,size); - set_return_trap(pInt); - pInt->BIOSseg = cs; - } else { - reset_int_vect(pInt); - set_return_trap(pInt); - if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (3)\n"); - goto error1; - } - setupTable(pInt,(memType)vbiosMem,V_BIOS,V_BIOS_SIZE); - pInt->BIOSseg = V_BIOS >> 4; - pInt->num = 0xe6; - LockLegacyVGA(screen, &vga); - xf86ExecX86int10(pInt); - UnlockLegacyVGA(screen, &vga); - } -#else - if (!sysMem) { - sysMem = xnfalloc(BIOS_SIZE); - setup_system_bios((memType)sysMem); - } - setupTable(pInt,(memType)sysMem,SYS_BIOS,BIOS_SIZE); - setup_int_vect(pInt); - set_return_trap(pInt); - if (!mapPciRom(pInt,(unsigned char *)(vbiosMem))) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS (4)\n"); - goto error1; - } - setupTable(pInt,(memType)vbiosMem,V_BIOS,V_BIOS_SIZE); - pInt->BIOSseg = V_BIOS >> 4; - pInt->num = 0xe6; - LockLegacyVGA(screen, &vga); - xf86ExecX86int10(pInt); - UnlockLegacyVGA(screen, &vga); -#endif - return pInt; - - error1: - xfree(vbiosMem); - xfree(intMem); - UnmapVRam(pInt); - xfree(INTPriv(pInt)->alloc_rec); - xfree(pInt->private); - error0: - xfree(pInt); - - return NULL; -} - -static void -MapVRam(xf86Int10InfoPtr pInt) -{ - int screen = pInt->scrnIndex; - int pagesize = INTPriv(pInt)->pagesize_1 + 1; - int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize; - INTPriv(pInt)->vRam = xf86MapVidMem(screen,VIDMEM_MMIO,V_RAM,size); -} - -static void -UnmapVRam(xf86Int10InfoPtr pInt) -{ - int screen = pInt->scrnIndex; - int pagesize = INTPriv(pInt)->pagesize_1 + 1; - int size = ((VRAM_SIZE + pagesize - 1)/pagesize) * pagesize; - - xf86UnMapVidMem(screen,INTPriv(pInt)->vRam,size); -} - -void -MapCurrentInt10(xf86Int10InfoPtr pInt) -{ - /* nothing to do here */ -} - -void -xf86FreeInt10(xf86Int10InfoPtr pInt) -{ - int pagesize; - - if (!pInt) - return; - pagesize = INTPriv(pInt)->pagesize_1 + 1; - if (Int10Current == pInt) - Int10Current = NULL; - xfree(INTPriv(pInt)->alloc_rec[V_BIOS/pagesize]); - xfree(INTPriv(pInt)->alloc_rec[0]); - UnmapVRam(pInt); - xfree(INTPriv(pInt)->alloc_rec); - xfree(pInt->private); - xfree(pInt); -} - -void * -xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off) -{ - void* addr; - int pagesize = INTPriv(pInt)->pagesize_1 + 1; - int num_pages = INTPriv(pInt)->entries; - int i,j; - - for (i=0;i<num_pages - num;i++) { - if (INTPriv(pInt)->alloc_rec[i] == 0) { - for (j=i;j < num + i;j++) - if ((INTPriv(pInt)->alloc_rec[j] != 0)) - break; - if (j == num + i) - break; - else - i = i + num; - } - } - if (i == num_pages - num) - return NULL; - - *off = i * pagesize; - addr = xnfalloc(pagesize * num); - setupTable(pInt,(memType)addr,*off,pagesize * num); - - return addr; -} - -void -xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) -{ - int num_pages = INTPriv(pInt)->entries; - int i,j; - for (i = 0;i<num_pages - num; i++) - if (INTPriv(pInt)->alloc_rec[i]==(memType)pbase) { - for (j = 0; j < num; j++) - INTPriv(pInt)->alloc_rec[i] = 0; - break; - } - xfree(pbase); - return; -} - -static void -setupTable(xf86Int10InfoPtr pInt, memType address,int loc,int size) -{ - int pagesize = INTPriv(pInt)->pagesize_1 + 1; - int i,j,num; - - i = loc / pagesize; - num = (size + pagesize - 1)/ pagesize; /* round up to the nearest page */ - /* boudary if size is not */ - /* multiple of pagesize */ - for (j = 0; j<num; j++) { - INTPriv(pInt)->alloc_rec[i+j] = address; - address += pagesize; - } -} - -#define OFF(addr) \ - ((addr) & (INTPriv(pInt)->pagesize_1)) -#define SHIFT \ - (INTPriv(pInt)->shift) -#define BASE(addr,shift) \ - (INTPriv(pInt)->alloc_rec[addr >> shift]) -#define V_ADDR(addr,shift,off) \ - (BASE(addr,shift) + (off)) -#define VRAM_ADDR(addr) (addr - 0xA0000) -#define VRAM_BASE (INTPriv(pInt)->vRam) - -#define VRAM(addr) ((addr >= 0xA0000) && (addr <= 0xBFFFF)) -#define V_ADDR_RB(addr,shift,off) \ - (VRAM(addr)) ? MMIO_IN8((CARD8*)VRAM_BASE,VRAM_ADDR(addr)) \ - : *(CARD8*) V_ADDR(addr,shift,off) -#define V_ADDR_RW(addr,shift,off) \ - (VRAM(addr)) ? MMIO_IN16((CARD16*)VRAM_BASE,VRAM_ADDR(addr)) \ - : ldw_u((pointer)V_ADDR(addr,shift,off)) -#define V_ADDR_RL(addr,shift,off) \ - (VRAM(addr)) ? MMIO_IN32((CARD32*)VRAM_BASE,VRAM_ADDR(addr)) \ - : ldl_u((pointer)V_ADDR(addr,shift,off)) - -#define V_ADDR_WB(addr,shift,off,val) \ - if(VRAM(addr)) \ - MMIO_OUT8((CARD8*)VRAM_BASE,VRAM_ADDR(addr),val); \ - else \ - *(CARD8*) V_ADDR(addr,shift,off) = val; -#define V_ADDR_WW(addr,shift,off,val) \ - if(VRAM(addr)) \ - MMIO_OUT16((CARD16*)VRAM_BASE,VRAM_ADDR(addr),val); \ - else \ - stw_u((val),(pointer)(V_ADDR(addr,shift,off))); - -#define V_ADDR_WL(addr,shift,off,val) \ - if (VRAM(addr)) \ - MMIO_OUT32((CARD32*)VRAM_BASE,VRAM_ADDR(addr),val); \ - else \ - stl_u(val,(pointer)(V_ADDR(addr,shift,off))); - -static CARD8 -read_b(xf86Int10InfoPtr pInt, int addr) -{ - if (!BASE(addr,SHIFT)) return 0xff; - - return V_ADDR_RB(addr,SHIFT,OFF(addr)); -} - -static CARD16 -read_w(xf86Int10InfoPtr pInt, int addr) -{ - int shift = SHIFT; - int off = OFF(addr); - - if (!BASE(addr,shift)) return 0xffff; - -#if X_BYTE_ORDER == X_BIG_ENDIAN - return ((V_ADDR_RB(addr,shift,off)) - || ((V_ADDR_RB(addr,shift,off + 1)) << 8)); -#else - if (OFF(addr + 1) > 0) { - return V_ADDR_RW(addr,SHIFT,OFF(addr)); - } else { - return ((V_ADDR_RB(addr,shift,off + 1)) - || ((V_ADDR_RB(addr,shift,off)) << 8)); - } -#endif -} - -static CARD32 -read_l(xf86Int10InfoPtr pInt, int addr) -{ - int shift = SHIFT; - int off = OFF(addr); - - if (!BASE(addr,shift)) return 0xffffffff; - -#if X_BYTE_ORDER == X_BIG_ENDIAN - return ((V_ADDR_RB(addr,shift,off)) - || ((V_ADDR_RB(addr,shift,off + 1)) << 8) - || ((V_ADDR_RB(addr,shift,off + 2)) << 16) - || ((V_ADDR_RB(addr,shift,off + 3)) << 24)); -#else - if (OFF(addr + 3) > 2) { - return V_ADDR_RL(addr,SHIFT,OFF(addr)); - } else { - return ((V_ADDR_RB(addr,shift,off + 3)) - || ((V_ADDR_RB(addr,shift,off + 2)) << 8) - || ((V_ADDR_RB(addr,shift,off + 1)) << 16) - || ((V_ADDR_RB(addr,shift,off)) << 24)); - } -#endif -} - -static void -write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val) -{ - if (!BASE(addr,SHIFT)) return; - - V_ADDR_WB(addr,SHIFT,OFF(addr),val); -} - -static void -write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val) -{ - int shift = SHIFT; - int off = OFF(addr); - - if (!BASE(addr,shift)) return; - -#if X_BYTE_ORDER == X_BIG_ENDIAN - V_ADDR_WB(addr,shift,off,val); - V_ADDR_WB(addr,shift,off + 1,val >> 8); -#else - if (OFF(addr + 1) > 0) { - V_ADDR_WW(addr,shift,OFF(addr),val); - } else { - V_ADDR_WB(addr,shift,off + 1,val); - V_ADDR_WB(addr,shift,off,val >> 8); - } -#endif -} - -static void -write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) -{ - int shift = SHIFT; - int off = OFF(addr); - if (!BASE(addr,shift)) return; - -#if X_BYTE_ORDER == X_BIG_ENDIAN - V_ADDR_WB(addr,shift,off,val); - V_ADDR_WB(addr,shift,off + 1, val >> 8); - V_ADDR_WB(addr,shift,off + 2, val >> 16); - V_ADDR_WB(addr,shift,off + 3, val >> 24); -#else - if (OFF(addr + 3) > 2) { - V_ADDR_WL(addr,shift,OFF(addr),val); - } else { - V_ADDR_WB(addr,shift,off + 3, val); - V_ADDR_WB(addr,shift,off + 2, val >> 8); - V_ADDR_WB(addr,shift,off + 1, val >> 16); - V_ADDR_WB(addr,shift,off, val >> 24); - } -#endif -} - -pointer -xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr) -{ - return (pointer) V_ADDR(addr,SHIFT,OFF(addr)); -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c:3.11 xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c:3.15 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c:3.11 Tue Oct 17 12:53:20 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c Fri Feb 16 09:45:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.11 2000/10/17 16:53:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnxResource.c,v 3.15 2001/02/16 14:45:10 tsi Exp $ */ /* Resource information code */ @@ -21,10 +21,10 @@ resPtr ret = NULL; resRange range; - RANGE(range,0,0xffffffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0,0xffffffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock); ret = xf86AddResToList(ret, &range, -1); return ret; } @@ -39,76 +39,75 @@ * sparse address space are an image of the ISA bus range */ if (_bus_base_sparse()) { - RANGE(range,0,0x07ffffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0x07ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x09000000,0x0fffffff,ResExcMemBlock); + RANGE(range, 0x09000000, 0x0fffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x11000000,0x17ffffff,ResExcMemBlock); + RANGE(range, 0x11000000, 0x17ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x19000000,0x1fffffff,ResExcMemBlock); + RANGE(range, 0x19000000, 0x1fffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x21000000,0x27ffffff,ResExcMemBlock); + RANGE(range, 0x21000000, 0x27ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x29000000,0x2fffffff,ResExcMemBlock); + RANGE(range, 0x29000000, 0x2fffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x31000000,0x37ffffff,ResExcMemBlock); + RANGE(range, 0x31000000, 0x37ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x39000000,0x3fffffff,ResExcMemBlock); + RANGE(range, 0x39000000, 0x3fffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x41000000,0x47ffffff,ResExcMemBlock); + RANGE(range, 0x41000000, 0x47ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x49000000,0x4fffffff,ResExcMemBlock); + RANGE(range, 0x49000000, 0x4fffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x51000000,0x57ffffff,ResExcMemBlock); + RANGE(range, 0x51000000, 0x57ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x59000000,0x5fffffff,ResExcMemBlock); + RANGE(range, 0x59000000, 0x5fffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x61000000,0x67ffffff,ResExcMemBlock); + RANGE(range, 0x61000000, 0x67ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x69000000,0x6fffffff,ResExcMemBlock); + RANGE(range, 0x69000000, 0x6fffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x71000000,0x77ffffff,ResExcMemBlock); + RANGE(range, 0x71000000, 0x77ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x79000000,0x7fffffff,ResExcMemBlock); + RANGE(range, 0x79000000, 0x7fffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x81000000,0x87ffffff,ResExcMemBlock); + RANGE(range, 0x81000000, 0x87ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x89000000,0x8fffffff,ResExcMemBlock); + RANGE(range, 0x89000000, 0x8fffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x91000000,0x97ffffff,ResExcMemBlock); + RANGE(range, 0x91000000, 0x97ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x99000000,0x9fffffff,ResExcMemBlock); + RANGE(range, 0x99000000, 0x9fffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xA1000000,0xa7ffffff,ResExcMemBlock); + RANGE(range, 0xa1000000, 0xa7ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xA9000000,0xafffffff,ResExcMemBlock); + RANGE(range, 0xa9000000, 0xafffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xB1000000,0xb7ffffff,ResExcMemBlock); + RANGE(range, 0xb1000000, 0xb7ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xB9000000,0xbfffffff,ResExcMemBlock); + RANGE(range, 0xb9000000, 0xbfffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xC1000000,0xc7ffffff,ResExcMemBlock); + RANGE(range, 0xc1000000, 0xc7ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xC9000000,0xcfffffff,ResExcMemBlock); + RANGE(range, 0xc9000000, 0xcfffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xD1000000,0xd7ffffff,ResExcMemBlock); + RANGE(range, 0xd1000000, 0xd7ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xD9000000,0xdfffffff,ResExcMemBlock); + RANGE(range, 0xd9000000, 0xdfffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xE1000000,0xe7ffffff,ResExcMemBlock); + RANGE(range, 0xe1000000, 0xe7ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xE9000000,0xefffffff,ResExcMemBlock); + RANGE(range, 0xe9000000, 0xefffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xF1000000,0xf7ffffff,ResExcMemBlock); + RANGE(range, 0xf1000000, 0xf7ffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xF9000000,0xffffffff,ResExcMemBlock); + RANGE(range, 0xf9000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); } else { - /* Some drivers choke if a PCI base address is set to 0 */ - RANGE(range,1,0xffffffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); } - RANGE(range,0,0xffffffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock); ret = xf86AddResToList(ret, &range, -1); return ret; } @@ -119,10 +118,10 @@ resPtr ret = NULL; resRange range; - RANGE(range,0,0xffffffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0,0xffffffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcIoBlock); ret = xf86AddResToList(ret, &range, -1); return ret; } @@ -135,17 +134,33 @@ /* * Fallback is to claim the following areas: * - * 0x000C0000 - 0x000EFFFF location of VGA and other extensions ROMS + * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS */ - RANGE(range,0xc0000,0xeffff,ResExcMemBlock); + RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - /* Fallback is to claim well known ports in the 0x0 - 0x3ff range */ - /* Possibly should claim some of them as sparse ranges */ + /* + * Fallback would be to claim well known ports in the 0x0 - 0x3ff range + * along with their sparse I/O aliases, but that's too imprecise. Instead + * claim a bare minimum here. + */ + RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */ + ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0,0x1ff,ResExcIoBlock | ResEstimated); + /* + * At minimum, the top and bottom resources must be claimed, so that + * resources that are (or appear to be) unallocated can be relocated. + */ + RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); + RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); + ret = xf86AddResToList(ret, &range, -1); +/* RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); + ret = xf86AddResToList(ret, &range, -1); */ + RANGE(range, 0xffffffff, 0xffffffff, ResExcIoBlock); + ret = xf86AddResToList(ret, &range, -1); + /* XXX add others */ return ret; } @@ -168,13 +183,13 @@ resPtr ret = NULL; resRange range; - RANGE(range,0,0xffffffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); #ifdef __sparc__ - RANGE(range,0,0x00ffffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock); #else - RANGE(range,0,0x0000ffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); #endif ret = xf86AddResToList(ret, &range, -1); return ret; @@ -186,13 +201,13 @@ resPtr ret = NULL; resRange range; - RANGE(range,0,0xffffffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); #ifdef __sparc__ - RANGE(range,0,0x00ffffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock); #else - RANGE(range,0,0x0000ffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); #endif ret = xf86AddResToList(ret, &range, -1); return ret; @@ -204,13 +219,13 @@ resPtr ret = NULL; resRange range; - RANGE(range,0,0xffffffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); #ifdef __sparc__ - RANGE(range,0,0x00ffffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0x00ffffff, ResExcIoBlock); #else - RANGE(range,0,0x0000ffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); #endif ret = xf86AddResToList(ret, &range, -1); return ret; @@ -219,6 +234,25 @@ resPtr xf86AccResFromOS(resPtr ret) { + resRange range; + + /* + * At minimum, the top and bottom resources must be claimed, so that + * resources that are (or appear to be) unallocated can be relocated. + */ + RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); + ret = xf86AddResToList(ret, &range, -1); + RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); + ret = xf86AddResToList(ret, &range, -1); + RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); + ret = xf86AddResToList(ret, &range, -1); +#ifdef __sparc__ + RANGE(range, 0x00ffffff, 0x00ffffff, ResExcIoBlock); +#else + RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock); +#endif + ret = xf86AddResToList(ret, &range, -1); + return ret; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c:3.4 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c:3.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c:3.4 Mon Aug 28 14:12:56 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c Fri May 18 20:26:45 2001 @@ -6,7 +6,7 @@ * Copyright © 2000 VA Linux Systems, Inc. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c,v 3.4 2000/08/28 18:12:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_agp.c,v 3.5 2001/05/19 00:26:45 dawes Exp $ */ #include "X.h" #include "xf86.h" @@ -34,15 +34,29 @@ static int gartFd = -1; static int acquiredScreen = -1; - +static Bool initDone = FALSE; /* - * Open /dev/agpgart. Keep it open until server exit. + * Close /dev/agpgart. This frees all associated memory allocated during + * this server generation. */ +Bool +xf86GARTCloseScreen(int screenNum) +{ + if(gartFd != -1) { + close(gartFd); + acquiredScreen = -1; + gartFd = -1; + initDone = FALSE; + } + return TRUE; +} +/* + * Open /dev/agpgart. Keep it open until xf86GARTCloseScreen is called. + */ static Bool GARTInit() { - static Bool initDone = FALSE; struct _agp_info agpinf; if (initDone) Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c:1.2.2.1 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c:1.2.2.1 Fri Mar 9 13:03:52 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c Thu Feb 15 14:46:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c,v 1.2.2.1 2001/03/09 18:03:52 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_axp.c,v 1.4 2001/02/15 19:46:03 eich Exp $ */ #include <stdio.h> #include "X.h" @@ -9,6 +9,13 @@ axpDevice lnxGetAXP(void); +typedef struct + { char* sysName; + char* sysVari; + char* cpu; + axpDevice sys; } +AXP; + static AXP axpList[] = { { "Tsunami", NULL, NULL, TSUNAMI }, { "Eiger", NULL, NULL, TSUNAMI }, @@ -26,9 +33,9 @@ {"Mikasa",NULL,NULL,APECS}, {"EB164","EB164",NULL,CIA}, {"EB164","PC164", NULL,CIA}, - {"EB164","RX164",NULL, POLARIS}, - {"EB164","SX164",NULL, PYXIS}, {"EB164","LX164",NULL, PYXIS}, + {"EB164","SX164",NULL, PYXIS}, + {"EB164","RX164",NULL, POLARIS}, {"Alcor",NULL,NULL,CIA}, {"Takara",NULL,NULL,CIA}, {"Sable",NULL, "EV5",T2_GAMMA}, Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c:3.5 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c:3.6 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c:3.5 Thu Feb 17 08:45:49 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c Thu Feb 15 06:03:56 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c,v 3.5 2000/02/17 13:45:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_ev56.c,v 3.6 2001/02/15 11:03:56 alanh Exp $ */ #include "X.h" #include "input.h" @@ -29,18 +29,21 @@ int readDense8(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(volatile CARD8*) ((unsigned long)Base+(Offset)); } int readDense16(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(volatile CARD16*) ((unsigned long)Base+(Offset)); } int readDense32(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(volatile CARD32*)((unsigned long)Base+(Offset)); } @@ -65,20 +68,20 @@ void writeDense8(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(volatile CARD8 *)((unsigned long)Base+(Offset)) = Value; - mem_barrier(); } void writeDense16(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(volatile CARD16 *)((unsigned long)Base+(Offset)) = Value; - mem_barrier(); } void writeDense32(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(volatile CARD32 *)((unsigned long)Base+(Offset)) = Value; - mem_barrier(); } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c:3.18 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c:3.19 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c:3.18 Thu Aug 31 15:03:59 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c Mon Mar 5 15:18:24 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.18 2000/08/31 19:03:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_io.c,v 3.19 2001/03/05 20:18:24 dawes Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Dawes <dawes@xfree86.org> @@ -219,10 +219,12 @@ struct termios nTty; #ifdef __powerpc__ - ioctl(xf86Info.consoleFd, KDSKBMODE, K_MEDIUMRAW); -#else - ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW); + if (xf86Info.kbdCustomKeycodes) + ioctl(xf86Info.consoleFd, KDSKBMODE, K_MEDIUMRAW); + else #endif + ioctl(xf86Info.consoleFd, KDSKBMODE, K_RAW); + nTty = kbdtty; nTty.c_iflag = (IGNPAR | IGNBRK) & (~PARMRK) & (~ISTRIP); nTty.c_oflag = 0; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c:3.2 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c:3.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c:3.2 Fri Jun 30 13:15:18 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c Sun Apr 1 10:00:15 2001 @@ -1,16 +1,18 @@ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_kmod.c,v 3.4 2001/04/01 14:00:15 tsi Exp $ */ + #include <errno.h> #include <fcntl.h> #include <unistd.h> #include <sys/wait.h> #include <signal.h> #include "xf86_OSproc.h" -#include "xf86_ansic.h" #define MODPROBE_PATH_FILE "/proc/sys/kernel/modprobe" #define MAX_PATH 1024 +#if 0 /* XFree86 #defines execl to be the xf86execl() function which does * a fork AND exec. We don't want that. We want the regular, * standard execl(). @@ -18,6 +20,7 @@ #ifdef execl #undef execl #endif +#endif /* @@ -29,7 +32,8 @@ * Return: * 0 for failure, 1 for success */ -int xf86LoadKernelModule(const char *modName) +int +xf86LoadKernelModule(const char *modName) { char mpPath[MAX_PATH] = ""; int fd = -1, status, n; @@ -51,10 +55,15 @@ if (mpPath[0] == 0) { /* we failed to get the path from the system, use a default */ - xf86strcpy(mpPath, "/sbin/modprobe"); + strcpy(mpPath, "/sbin/modprobe"); } /* now fork/exec the modprobe command */ + /* + * It would be good to capture stdout/stderr so that it can be directed + * to the log file. modprobe errors currently are missing from the log + * file. + */ switch (pid = fork()) { case 0: /* child */ n = execl(mpPath, "modprobe", modName, NULL); Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c:3.5 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c:3.6.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c:3.5 Tue Oct 17 12:53:20 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c Fri Jun 1 16:03:52 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.5 2000/10/17 16:53:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_pci.c,v 3.6.2.1 2001/06/01 20:03:52 dawes Exp $ */ #include <stdio.h> #include "X.h" @@ -9,16 +9,26 @@ #include "xf86_OSproc.h" #include "xf86Pci.h" +#ifdef __sparc__ +#define PCIADDR_TYPE long long +#define PCIADDR_IGNORE_FMT "%*llx" +#define PCIADDR_FMT "%llx" +#else +#define PCIADDR_TYPE long +#define PCIADDR_IGNORE_FMT "%*lx" +#define PCIADDR_FMT "%lx" +#endif + Bool xf86GetPciSizeFromOS(PCITAG tag, int index, int* bits) { FILE *file; - char c[0x100]; + char c[0x200]; char *res; int bus, devfn, dev, fn; - unsigned int size[7]; + unsigned PCIADDR_TYPE size[7]; unsigned int num; - int Size; + signed PCIADDR_TYPE Size; if (index > 7) return FALSE; @@ -26,11 +36,27 @@ if (!(file = fopen("/proc/bus/pci/devices","r"))) return FALSE; do { - res = fgets(c,0xff,file); + res = fgets(c,0x1ff,file); if (res) { - num = sscanf(res,"%02x%02x\t%*04x%*04x\t%*x" - "\t%*x\t%*x\t%*x\t%*x\t%*x\t%*x\t%*x" - "\t%x\t%x\t%x\t%x\t%x\t%x\t%x", + num = sscanf(res, + /*bus+dev vendorid deviceid irq */ + "%02x%02x\t%*04x%*04x\t%*x" + /* 7 PCI resource base addresses */ + "\t" PCIADDR_IGNORE_FMT + "\t" PCIADDR_IGNORE_FMT + "\t" PCIADDR_IGNORE_FMT + "\t" PCIADDR_IGNORE_FMT + "\t" PCIADDR_IGNORE_FMT + "\t" PCIADDR_IGNORE_FMT + "\t" PCIADDR_IGNORE_FMT + /* 7 PCI resource sizes, and then optionally a driver name */ + "\t" PCIADDR_FMT + "\t" PCIADDR_FMT + "\t" PCIADDR_FMT + "\t" PCIADDR_FMT + "\t" PCIADDR_FMT + "\t" PCIADDR_FMT + "\t" PCIADDR_FMT, &bus,&devfn,&size[0],&size[1],&size[2],&size[3], &size[4],&size[5],&size[6]); if (num != 9) { /* apparantly not 2.3 style */ @@ -42,9 +68,9 @@ if (tag == pciTag(bus,dev,fn)) { *bits = 0; if (size[index] != 0) { - Size = size[index] - 1; - while (Size & 0x01) { - Size = Size >> 1; + Size = size[index] - ((PCIADDR_TYPE) 1); + while (Size & ((PCIADDR_TYPE) 0x01)) { + Size = Size >> ((PCIADDR_TYPE) 1); (*bits)++; } } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c:3.44 xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c:3.51.2.3 --- xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c:3.44 Wed Dec 6 13:08:55 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c Tue May 29 12:38:00 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.44 2000/12/06 18:08:55 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/lnx_video.c,v 3.51.2.3 2001/05/29 16:38:00 tsi Exp $ */ /* * Copyright 1992 by Orest Zborowski <obz@Kodak.com> * Copyright 1993 by David Wexelblat <dwex@goblin.org> @@ -100,6 +100,9 @@ #endif #ifdef HAS_MTRR_SUPPORT + +#define SPLIT_WC_REGIONS 1 + static pointer setWC(int, unsigned long, unsigned long, Bool, MessageType); static void undoWC(int, pointer); @@ -239,6 +242,56 @@ wcr->added = TRUE; wcr->next = NULL; +#if SPLIT_WC_REGIONS + /*********************************** by _usul ********************/ + /* + * Splits up the write-combining region if it is not aligned on a + * size boundary. + */ + if (base % size) { + struct mtrr_wc_region *wcrc = wcr; + int rgs = 1; + unsigned long srem, sdiv, bcurr; + + xf86DrvMsgVerb(screenNum, X_INFO, 2, + "WC region has to be split (0x%lx,0x%lx)\n", base, size); + + bcurr = base; + srem = size; + + do { + for (sdiv = (0x1 << 31); sdiv; sdiv = sdiv >> 1) { + while(sdiv > srem) { + sdiv >>= 1; + } + if (!(bcurr % sdiv)) { + mtrr_add_wc_region(screenNum, bcurr, + sdiv, from); + break; + } + } + if (!sdiv) { + xf86DrvMsg(screenNum, X_ERROR, + "Serious error in region splitting!\n"); + } + wcrc->sentry.base = bcurr; + wcrc->sentry.size = sdiv; + wcrc->sentry.type = MTRR_TYPE_WRCOMB; + wcrc->added = TRUE; + if ((srem - sdiv)) { + wcrc->next = xalloc(sizeof(*wcrc)); + wcrc = wcrc->next; + } else { + wcrc->next = NULL; + } + srem -= sdiv; + bcurr += sdiv; + } while (srem); + return wcr; + } + /*****************************************************************/ +#endif /* SPLIT_WC_REGIONS */ + if (ioctl(mtrr_fd, MTRRIOC_ADD_ENTRY, &wcr->sentry) >= 0) { /* Avoid printing on every VT switch */ if (xf86ServerIsInitialising()) { @@ -344,7 +397,15 @@ pVidMem->initialised = TRUE; } - +#ifdef __sparc__ +/* Basically, you simply cannot do this on Sparc. You have to do something portable + * like use /dev/fb* or mmap() on /proc/bus/pci/X/Y nodes. -DaveM + */ +static pointer mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) +{ + return NULL; +} +#else static pointer mapVidMem(int ScreenNum, unsigned long Base, unsigned long Size, int flags) { @@ -399,6 +460,7 @@ #endif return (char *)base + alignOff; } +#endif /* !(__sparc__) */ static void unmapVidMem(int ScreenNum, pointer Base, unsigned long Size) @@ -418,21 +480,50 @@ /***************************************************************************/ #if defined(__powerpc__) -/* FIXME: init this... */ -volatile unsigned char *ioBase = MAP_FAILED; +volatile unsigned char *ioBase = NULL; + +#ifndef __NR_pciconfig_iobase +#define __NR_pciconfig_iobase 200 +#endif #endif void xf86EnableIO(void) { +#if defined(__powerpc__) + int fd; + unsigned int ioBase_phys; +#endif + if (ExtendedEnabled) return; -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) +#if defined(__powerpc__) + ioBase_phys = syscall(__NR_pciconfig_iobase, 2, 0, 0); + + fd = open("/dev/mem", O_RDWR); + if (ioBase == NULL) { + ioBase = (volatile unsigned char *)mmap(0, 0x20000, + PROT_READ|PROT_WRITE, MAP_SHARED, fd, + ioBase_phys); +/* Should this be fatal or just a warning? */ +#if 0 + if (ioBase == MAP_FAILED) { + FatalError( + "xf86EnableIOPorts: Failed to map iobase (%s)\n", + strerror(errno)); + } +#endif + } + close(fd); +#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) if (ioperm(0, 1024, 1) || iopl(3)) - FatalError("%s: Failed to set IOPL for I/O\n", - "xf86EnableIOPorts"); + FatalError("xf86EnableIOPorts: Failed to set IOPL for I/O\n"); +# if !defined(__alpha__) + ioperm(0x40,4,0); /* trap access to the timer chip */ + ioperm(0x60,4,0); /* trap access to the keyboard controller */ +# endif #endif ExtendedEnabled = TRUE; @@ -444,8 +535,10 @@ { if (!ExtendedEnabled) return; - -#if !defined(__mc68000__) && !defined(__powerpc__) && !defined(__sparc__) && !defined(__mips__) +#if defined(__powerpc__) + munmap(ioBase, 0x20000); + ioBase = NULL; +#elif !defined(__mc68000__) && !defined(__sparc__) && !defined(__mips__) iopl(0); ioperm(0, 1024, 0); #endif @@ -471,7 +564,9 @@ #else #ifdef __GNUC__ #if defined(__ia64__) - __asm__ __volatile__ (";; rsm psr.i;; srlz.d" ::: "memory"); +#if 0 + __asm__ __volatile__ (";; rsm psr.i;; srlz.d" ::: "memory"); +#endif #else __asm__ __volatile__("cli"); #endif @@ -501,7 +596,9 @@ #else #ifdef __GNUC__ #if defined(__ia64__) - __asm__ __volatile__ (";; ssm psr.i;; srlz.d" ::: "memory"); +#if 0 + __asm__ __volatile__ (";; ssm psr.i;; srlz.d" ::: "memory"); +#endif #else __asm__ __volatile__("sti"); #endif @@ -612,17 +709,19 @@ register unsigned long result, shift; register unsigned long msb; + mem_barrier(); Offset += (unsigned long)Base - (unsigned long)lnxBase; shift = (Offset & 0x3) << 3; - if (Offset >= (hae_thresh)) { + 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; @@ -634,16 +733,19 @@ register unsigned long result, shift; register unsigned long msb; + mem_barrier(); Offset += (unsigned long)Base - (unsigned long)lnxBase; shift = (Offset & 0x2) << 3; - if (Offset >= hae_thresh) { + 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; @@ -652,6 +754,7 @@ static int readSparse32(pointer Base, register unsigned long Offset) { + mem_barrier(); return *(vuip)((unsigned long)Base+(Offset)); } @@ -661,17 +764,19 @@ register unsigned long msb; register unsigned int b = Value & 0xffU; + 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; - mem_barrier(); } static void @@ -680,26 +785,27 @@ register unsigned long msb; register unsigned int w = Value & 0xffffU; + 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; - mem_barrier(); - } static void writeSparse32(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(vuip)((unsigned long)Base + (Offset)) = Value; - mem_barrier(); return; } @@ -711,12 +817,12 @@ 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; } @@ -729,12 +835,12 @@ 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; @@ -847,6 +953,7 @@ { register unsigned long result, shift; + mem_barrier(); shift = (Offset & 0x3) << 3; result = *(vuip) ((unsigned long)Base + (Offset << SPARSE)); @@ -860,6 +967,7 @@ { register unsigned long result, shift; + mem_barrier(); shift = (Offset & 0x2) << 3; result = *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2))); @@ -873,6 +981,7 @@ { register unsigned long result; + mem_barrier(); result = *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2))); return result; @@ -883,9 +992,8 @@ { register unsigned int b = Value & 0xffU; + write_mem_barrier(); *(vuip) ((unsigned long)Base + (Offset << SPARSE)) = b * 0x01010101; - - mem_barrier(); } static void @@ -893,18 +1001,16 @@ { register unsigned int w = Value & 0xffffU; + write_mem_barrier(); *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(1<<(SPARSE-2))) = w * 0x00010001; - - mem_barrier(); } static void writeSparseJensen32(int Value, pointer Base, register unsigned long Offset) { + write_mem_barrier(); *(vuip)((unsigned long)Base+(Offset<<SPARSE)+(3<<(SPARSE-2))) = Value; - - mem_barrier(); } static void Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile:1.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile:1.9 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile:1.7 Tue Oct 10 12:38:43 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile Fri Jan 19 03:08:41 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile,v 1.7 2000/10/10 16:38:43 alanh Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/Imakefile,v 1.9 2001/01/19 08:08:41 dawes Exp $ #define IHaveModules #include <Server.tmpl> @@ -13,8 +13,27 @@ MTRR_DEFINES = -DHAS_MTRR_SUPPORT #endif -SRCS = xf86drm.c xf86drmHash.c xf86drmRandom.c xf86drmSL.c xf86drmI810.c xf86drmMga.c xf86drmR128.c xf86drmSiS.c $(MSRC) -OBJS = xf86drm.o xf86drmHash.o xf86drmRandom.o xf86drmSL.o xf86drmI810.o xf86drmMga.o xf86drmR128.o xf86drmSiS.o $(MOBJ) + SRCS = xf86drm.c \ + xf86drmHash.c \ + xf86drmRandom.c \ + xf86drmSL.c \ + xf86drmI810.c \ + xf86drmMga.c \ + xf86drmR128.c \ + xf86drmRadeon.c \ + xf86drmSiS.c \ + $(MSRC) + + OBJS = xf86drm.o \ + xf86drmHash.o \ + xf86drmRandom.o \ + xf86drmSL.o \ + xf86drmI810.o \ + xf86drmMga.o \ + xf86drmR128.o \ + xf86drmRadeon.o \ + xf86drmSiS.o \ + $(MOBJ) INCLUDES = -I$(XF86COMSRC) -I$(XF86OSSRC) -I. -I$(SERVERSRC)/include \ -I$(XINCLUDESRC) -I$(EXTINCSRC) -I../.. -Ikernel Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c:1.17 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c:1.22 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c:1.17 Sun Sep 24 09:51:32 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c Fri May 18 20:26:45 2001 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -23,23 +23,21 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * * Authors: Rickard E. (Rik) Faith <faith@valinux.com> * Kevin E. Martin <martin@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.17 2000/09/24 13:51:32 alanh Exp $ - * + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drm.c,v 1.22 2001/05/19 00:26:45 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 @@ -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,10 +67,12 @@ # endif #endif -#ifdef __alpha__ +/* No longer needed with CVS kernel modules on alpha +#if defined(__alpha__) && defined(__linux__) extern unsigned long _bus_base(void); #define BUS_BASE _bus_base() #endif +*/ /* Not all systems have MAP_FAILED defined */ #ifndef MAP_FAILED @@ -81,7 +82,18 @@ #include "xf86drm.h" #include "drm.h" -#define DRM_FIXED_DEVICE_MAJOR 145 +#ifndef DRM_MAJOR +#define DRM_MAJOR 226 /* Linux */ +#endif + +#ifndef __linux__ +#undef DRM_MAJOR +#define DRM_MAJOR 145 /* Should set in drm.h for *BSD */ +#endif + +#ifndef DRM_MAX_MINOR +#define DRM_MAX_MINOR 16 +#endif #ifdef __linux__ #include <sys/sysmacros.h> /* for makedev() */ @@ -119,7 +131,7 @@ static char *drmStrdup(const char *s) { char *retval = NULL; - + if (s) { retval = _DRM_MALLOC(strlen(s)+1); strcpy(retval, s); @@ -130,11 +142,7 @@ 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); @@ -160,94 +168,105 @@ } return entry; } - -/* drm_open is used to open the /dev/dri device */ -static int drm_open(const char *file) +static int drmOpenDevice(long dev, int minor) { - int fd = open(file, O_RDWR, 0); - - if (fd >= 0) return fd; - return -errno; -} - -static int drmOpenDevice(const char *path, long dev, - mode_t mode, uid_t user, gid_t group) -{ -#ifdef XFree86LOADER - struct xf86stat st; -#else - struct stat st; + stat_t st; + char buf[64]; + int fd; + mode_t dirmode = DRM_DEV_DIRMODE; + mode_t devmode = DRM_DEV_MODE; + int isroot = !geteuid(); +#if defined(XFree86Server) + uid_t user = DRM_DEV_UID; + gid_t group = DRM_DEV_GID; #endif - /* Fiddle mode to remove execute bits */ - mode &= ~(S_IXUSR|S_IXGRP|S_IXOTH); +#if defined(XFree86Server) + devmode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE; + dirmode = (devmode & S_IRUSR) ? S_IXUSR : 0; + dirmode |= (devmode & S_IRGRP) ? S_IXGRP : 0; + dirmode |= (devmode & S_IROTH) ? S_IXOTH : 0; + dirmode |= devmode; + devmode &= ~(S_IXUSR|S_IXGRP|S_IXOTH); + group = (xf86ConfigDRI.group >= 0) ? xf86ConfigDRI.group : DRM_DEV_GID; +#endif - if (!stat(path, &st) && st.st_rdev == dev) { - if (!geteuid()) { - chown(path, user, group); - chmod(path, mode); - } - return drm_open(path); + if (stat(DRM_DIR_NAME, &st)) { + if (!isroot) return DRM_ERR_NOT_ROOT; + remove(DRM_DIR_NAME); + mkdir(DRM_DIR_NAME, dirmode); } +#if defined(XFree86Server) + chown(DRM_DIR_NAME, user, group); + chmod(DRM_DIR_NAME, dirmode); +#endif - if (geteuid()) return DRM_ERR_NOT_ROOT; - remove(path); - if (mknod(path, S_IFCHR, dev)) { - remove(path); - return DRM_ERR_NOT_ROOT; + sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor); + if (stat(buf, &st) || st.st_rdev != dev) { + if (!isroot) return DRM_ERR_NOT_ROOT; + remove(buf); + mknod(buf, S_IFCHR | devmode, dev); } - chown(path, user, group); - chmod(path, mode); - return drm_open(path); +#if defined(XFree86Server) + chown(buf, user, group); + chmod(buf, devmode); +#endif + + if ((fd = open(buf, O_RDWR, 0)) >= 0) return fd; + remove(buf); + return -errno; +} + +static int drmOpenMinor(int minor, int create) +{ + int fd; + char buf[64]; + + if (create) return drmOpenDevice(makedev(DRM_MAJOR, minor), minor); + + sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, minor); + if ((fd = open(buf, O_RDWR, 0)) >= 0) return fd; + return -errno; } -/* drmAvailable looks for /proc/dri, and returns 1 if it is present. On - OSs that do not have a Linux-like /proc, this information will not be - available, and we'll have to create a device and check if the driver is - loaded that way. */ +/* drmAvailable looks for (DRM_MAJOR, 0) and returns 1 if it returns + information for DRM_IOCTL_VERSION. For backward compatibility with + older Linux implementations, /proc/dri is also checked. */ int drmAvailable(void) { - char dev_name[64]; drmVersionPtr version; int retval = 0; int fd; - - if (!access("/proc/dri/0", R_OK)) return 1; - - sprintf(dev_name, "/dev/dri-temp-%d", getpid()); - remove(dev_name); - if ((fd = drmOpenDevice(dev_name, makedev(DRM_FIXED_DEVICE_MAJOR, 0), - S_IRUSR, geteuid(), getegid())) >= 0) { - /* Read version to make sure this is - actually a DRI device. */ - if ((version = drmGetVersion(fd))) { - retval = 1; - drmFreeVersion(version); - } - close(fd); + if ((fd = drmOpenMinor(0, 1)) < 0) { + /* Try proc for backward Linux compatibility */ + if (!access("/proc/dri/0", R_OK)) return 1; + return 0; + } + + if ((version = drmGetVersion(fd))) { + retval = 1; + drmFreeVersion(version); } - remove(dev_name); + close(fd); return retval; } static int drmOpenByBusid(const char *busid) { - int i; - char dev_name[64]; - char *buf; - int fd; - - for (i = 0; i < 8; i++) { - sprintf(dev_name, "/dev/dri/card%d", i); - if ((fd = drm_open(dev_name)) >= 0) { + int i; + int fd; + const char *buf; + + for (i = 0; i < DRM_MAX_MINOR; i++) { + if ((fd = drmOpenMinor(i, 0)) >= 0) { buf = drmGetBusid(fd); if (buf && !strcmp(buf, busid)) { - drmFreeBusid(buf); - return fd; + drmFreeBusid(buf); + return fd; } if (buf) drmFreeBusid(buf); close(fd); @@ -258,54 +277,43 @@ static int drmOpenByName(const char *name) { - int i; - char proc_name[64]; - char dev_name[64]; - char buf[512]; - mode_t mode = DRM_DEV_MODE; - mode_t dirmode; - gid_t group = DRM_DEV_GID; - uid_t user = DRM_DEV_UID; - int fd; - char *pt; - char *driver = NULL; - char *devstring; - long dev = 0; - int retcode; - -#if defined(XFree86Server) - mode = xf86ConfigDRI.mode ? xf86ConfigDRI.mode : DRM_DEV_MODE; - group = (xf86ConfigDRI.group >= 0) ? xf86ConfigDRI.group : DRM_DEV_GID; -#endif - -#if defined(XFree86Server) + int i; + int fd; + drmVersionPtr version; + if (!drmAvailable()) { +#if !defined(XFree86Server) + return -1; +#else /* try to load the kernel module now */ if (!xf86LoadKernelModule(name)) { ErrorF("[drm] failed to load kernel module \"%s\"\n", name); return -1; } - } -#else - if (!drmAvailable()) - return -1; #endif + } - if (!geteuid()) { - dirmode = mode; - if (dirmode & S_IRUSR) dirmode |= S_IXUSR; - if (dirmode & S_IRGRP) dirmode |= S_IXGRP; - if (dirmode & S_IROTH) dirmode |= S_IXOTH; - dirmode &= ~(S_IWGRP | S_IWOTH); - mkdir("/dev/dri", 0); - chown("/dev/dri", user, group); - chmod("/dev/dri", dirmode); + for (i = 0; i < DRM_MAX_MINOR; i++) { + if ((fd = drmOpenMinor(i, 1)) >= 0) { + if ((version = drmGetVersion(fd))) { + if (!strcmp(version->name, name)) { + drmFreeVersion(version); + return fd; + } + drmFreeVersion(version); + } + } } +#ifdef __linux__ + /* Backward-compatibility /proc support */ for (i = 0; i < 8; i++) { + char proc_name[64], buf[512]; + char *driver, *pt, *devstring; + int retcode; + sprintf(proc_name, "/proc/dri/%d/name", i); - sprintf(dev_name, "/dev/dri/card%d", i); if ((fd = open(proc_name, 0, 0)) >= 0) { retcode = read(fd, buf, sizeof(buf)-1); close(fd); @@ -319,34 +327,17 @@ for (devstring = ++pt; *pt && *pt != ' '; ++pt) ; if (*pt) { /* Found busid */ - return drmOpenByBusid(++pt); + return drmOpenByBusid(++pt); } else { /* No busid */ - dev = strtol(devstring, NULL, 0); - return drmOpenDevice(dev_name, dev, - mode, user, group); + return drmOpenDevice(strtol(devstring, NULL, 0),i); } } } } - } else { - drmVersionPtr version; - /* /proc/dri not available, possibly - because we aren't on a Linux system. - So, try to create the next device and - see if it's active. */ - dev = makedev(DRM_FIXED_DEVICE_MAJOR, i); - if ((fd = drmOpenDevice(dev_name, dev, mode, user, group))) { - if ((version = drmGetVersion(fd))) { - if (!strcmp(version->name, name)) { - drmFreeVersion(version); - return fd; - } - drmFreeVersion(version); - } - } - remove(dev_name); } } +#endif + return -1; } @@ -408,7 +399,7 @@ version->date = NULL; version->desc_len = 0; version->desc = NULL; - + if (ioctl(fd, DRM_IOCTL_VERSION, version)) { drmFreeKernelVersion(version); return NULL; @@ -421,7 +412,7 @@ version->date = drmMalloc(version->date_len + 1); if (version->desc_len) version->desc = drmMalloc(version->desc_len + 1); - + if (ioctl(fd, DRM_IOCTL_VERSION, version)) { drmFreeKernelVersion(version); return NULL; @@ -501,11 +492,12 @@ drm_map_t map; map.offset = offset; +/* No longer needed with CVS kernel modules on alpha #ifdef __alpha__ - /* Make sure we add the bus_base to all but shm */ - if (type != DRM_SHM) + if (type != DRM_SHM) map.offset += BUS_BASE; #endif +*/ map.size = size; map.handle = 0; map.type = type; @@ -515,18 +507,28 @@ return 0; } +int drmRmMap(int fd, drmHandle handle) +{ + drm_map_t map; + + map.handle = (void *)handle; + + if(ioctl(fd, DRM_IOCTL_RM_MAP, &map)) return -errno; + return 0; +} + int drmAddBufs(int fd, int count, int size, drmBufDescFlags flags, int agp_offset) { drm_buf_desc_t request; - + request.count = count; request.size = size; request.low_mark = 0; request.high_mark = 0; request.flags = flags; request.agp_start = agp_offset; - + if (ioctl(fd, DRM_IOCTL_ADD_BUFS, &request)) return -errno; return request.count; } @@ -542,16 +544,16 @@ if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) return -EINVAL; if (!info.count) return -EINVAL; - + if (!(info.list = drmMalloc(info.count * sizeof(*info.list)))) return -ENOMEM; - + if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) { int retval = -errno; drmFree(info.list); return retval; } - + for (i = 0; i < info.count; i++) { info.list[i].low_mark = low * info.list[i].count; info.list[i].high_mark = high * info.list[i].count; @@ -562,7 +564,7 @@ } } drmFree(info.list); - + return 0; } @@ -630,7 +632,7 @@ if (info.count) { if (!(info.list = drmMalloc(info.count * sizeof(*info.list)))) return NULL; - + if (ioctl(fd, DRM_IOCTL_INFO_BUFS, &info)) { drmFree(info.list); return NULL; @@ -657,7 +659,7 @@ drm_buf_map_t bufs; drmBufMapPtr retval; int i; - + bufs.count = 0; bufs.list = NULL; if (ioctl(fd, DRM_IOCTL_MAP_BUFS, &bufs)) return NULL; @@ -689,16 +691,19 @@ int drmUnmapBufs(drmBufMapPtr bufs) { int i; - + for (i = 0; i < bufs->count; i++) { munmap(bufs->list[i].address, bufs->list[i].total); } return 0; } +#define DRM_DMA_RETRY 16 + int drmDMA(int fd, drmDMAReqPtr request) { drm_dma_t dma; + int ret, i = 0; /* Copy to hidden structure */ dma.context = request->context; @@ -710,10 +715,17 @@ dma.request_size = request->request_size; dma.request_indices = request->request_list; dma.request_sizes = request->request_sizes; - if (ioctl(fd, DRM_IOCTL_DMA, &dma)) return -errno; - request->granted_count = dma.granted_count; - - return 0; + + do { + ret = ioctl( fd, DRM_IOCTL_DMA, &dma ); + } while ( ret && errno == EAGAIN && i++ < DRM_DMA_RETRY ); + + if ( ret == 0 ) { + request->granted_count = dma.granted_count; + return 0; + } else { + return -errno; + } } int drmGetLock(int fd, drmContext context, drmLockFlags flags) @@ -728,7 +740,7 @@ if (flags & DRM_LOCK_FLUSH_ALL) lock.flags |= _DRM_LOCK_FLUSH_ALL; if (flags & DRM_HALT_ALL_QUEUES) lock.flags |= _DRM_HALT_ALL_QUEUES; if (flags & DRM_HALT_CUR_QUEUES) lock.flags |= _DRM_HALT_CUR_QUEUES; - + while (ioctl(fd, DRM_IOCTL_LOCK, &lock)) ; return 0; @@ -827,7 +839,7 @@ if (ctx.flags & _DRM_CONTEXT_2DONLY) *flags |= DRM_CONTEXT_2DONLY; return 0; } - + int drmDestroyContext(int fd, drmContext handle) { drm_ctx_t ctx; @@ -989,6 +1001,28 @@ 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) { @@ -1074,12 +1108,189 @@ { drmHashEntry *entry = drmGetEntry(fd); void *value; - + if (drmHashLookup(entry->tagTable, context, &value)) return NULL; return value; } +int drmAddContextPrivateMapping(int fd, drmContext ctx_id, drmHandle handle) +{ + drm_ctx_priv_map_t map; + + map.ctx_id = ctx_id; + map.handle = (void *)handle; + + if (ioctl(fd, DRM_IOCTL_SET_SAREA_CTX, &map)) return -errno; + return 0; +} + +int drmGetContextPrivateMapping(int fd, drmContext ctx_id, drmHandlePtr handle) +{ + drm_ctx_priv_map_t map; + + map.ctx_id = ctx_id; + + if (ioctl(fd, DRM_IOCTL_GET_SAREA_CTX, &map)) return -errno; + if (handle) *handle = (drmHandle)map.handle; + + return 0; +} + +int drmGetMap(int fd, int idx, drmHandle *offset, drmSize *size, + drmMapType *type, drmMapFlags *flags, drmHandle *handle, + int *mtrr) +{ + drm_map_t map; + + map.offset = idx; + if (ioctl(fd, DRM_IOCTL_GET_MAP, &map)) return -errno; + *offset = map.offset; + *size = map.size; + *type = map.type; + *flags = map.flags; + *handle = (unsigned long)map.handle; + *mtrr = map.mtrr; + return 0; +} + +int drmGetClient(int fd, int idx, int *auth, int *pid, int *uid, + unsigned long *magic, unsigned long *iocs) +{ + drm_client_t client; + + client.idx = idx; + if (ioctl(fd, DRM_IOCTL_GET_CLIENT, &client)) return -errno; + *auth = client.auth; + *pid = client.pid; + *uid = client.uid; + *magic = client.magic; + *iocs = client.iocs; + return 0; +} + +int drmGetStats(int fd, drmStatsT *stats) +{ + drm_stats_t s; + int i; + + if (ioctl(fd, DRM_IOCTL_GET_STATS, &s)) return -errno; + + stats->count = 0; + memset(stats, 0, sizeof(*stats)); + if (s.count > sizeof(stats->data)/sizeof(stats->data[0])) + return -1; + +#define SET_VALUE \ + stats->data[i].long_format = "%-20.20s"; \ + stats->data[i].rate_format = "%8.8s"; \ + stats->data[i].isvalue = 1; \ + stats->data[i].verbose = 0 + +#define SET_COUNT \ + stats->data[i].long_format = "%-20.20s"; \ + stats->data[i].rate_format = "%5.5s"; \ + stats->data[i].isvalue = 0; \ + stats->data[i].mult_names = "kgm"; \ + stats->data[i].mult = 1000; \ + stats->data[i].verbose = 0 + +#define SET_BYTE \ + stats->data[i].long_format = "%-20.20s"; \ + stats->data[i].rate_format = "%5.5s"; \ + stats->data[i].isvalue = 0; \ + stats->data[i].mult_names = "KGM"; \ + stats->data[i].mult = 1024; \ + stats->data[i].verbose = 0 + + + stats->count = s.count; + for (i = 0; i < s.count; i++) { + stats->data[i].value = s.data[i].value; + switch (s.data[i].type) { + case _DRM_STAT_LOCK: + stats->data[i].long_name = "Lock"; + stats->data[i].rate_name = "Lock"; + SET_VALUE; + break; + case _DRM_STAT_OPENS: + stats->data[i].long_name = "Opens"; + stats->data[i].rate_name = "O"; + SET_COUNT; + stats->data[i].verbose = 1; + break; + case _DRM_STAT_CLOSES: + stats->data[i].long_name = "Closes"; + stats->data[i].rate_name = "Lock"; + SET_COUNT; + stats->data[i].verbose = 1; + break; + case _DRM_STAT_IOCTLS: + stats->data[i].long_name = "Ioctls"; + stats->data[i].rate_name = "Ioc/s"; + SET_COUNT; + break; + case _DRM_STAT_LOCKS: + stats->data[i].long_name = "Locks"; + stats->data[i].rate_name = "Lck/s"; + SET_COUNT; + break; + case _DRM_STAT_UNLOCKS: + stats->data[i].long_name = "Unlocks"; + stats->data[i].rate_name = "Unl/s"; + SET_COUNT; + break; + case _DRM_STAT_IRQ: + stats->data[i].long_name = "IRQs"; + stats->data[i].rate_name = "IRQ/s"; + SET_COUNT; + break; + case _DRM_STAT_PRIMARY: + stats->data[i].long_name = "Primary Bytes"; + stats->data[i].rate_name = "PB/s"; + SET_BYTE; + break; + case _DRM_STAT_SECONDARY: + stats->data[i].long_name = "Secondary Bytes"; + stats->data[i].rate_name = "SB/s"; + SET_BYTE; + break; + case _DRM_STAT_DMA: + stats->data[i].long_name = "DMA"; + stats->data[i].rate_name = "DMA/s"; + SET_COUNT; + break; + case _DRM_STAT_SPECIAL: + stats->data[i].long_name = "Special DMA"; + stats->data[i].rate_name = "dma/s"; + SET_COUNT; + break; + case _DRM_STAT_MISSED: + stats->data[i].long_name = "Miss"; + stats->data[i].rate_name = "Ms/s"; + SET_COUNT; + break; + case _DRM_STAT_VALUE: + stats->data[i].long_name = "Value"; + stats->data[i].rate_name = "Value"; + SET_VALUE; + break; + case _DRM_STAT_BYTE: + stats->data[i].long_name = "Bytes"; + stats->data[i].rate_name = "B/s"; + SET_BYTE; + break; + case _DRM_STAT_COUNT: + default: + stats->data[i].long_name = "Count"; + stats->data[i].rate_name = "Cnt/s"; + SET_COUNT; + break; + } + } + return 0; +} + #if defined(XFree86Server) || defined(DRM_USE_MALLOC) static void drmSIGIOHandler(int interrupt, void *closure) { @@ -1108,7 +1319,7 @@ #if 0 fprintf(stderr, "Got %s\n", buf); #endif - + for (pt = buf; *pt != ' '; ++pt); /* Find first space */ ++pt; old = strtol(pt, &pt, 0); @@ -1141,7 +1352,7 @@ drmHashEntry *entry = drmGetEntry(fd); entry->f = NULL; - + return xf86RemoveSIGIOHandler(fd); } #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c:1.3 Fri Jun 16 20:03:34 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c Wed Mar 21 13:08:54 2001 @@ -10,11 +10,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -22,10 +22,10 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * * Authors: Rickard E. (Rik) Faith <faith@valinux.com> * - * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.3 2000/06/17 00:03:34 martin Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmHash.c,v 1.4 2001/03/21 18:08:54 dawes Exp $ * * DESCRIPTION * @@ -187,7 +187,7 @@ int i; if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ - + for (i = 0; i < HASH_SIZE; i++) { for (bucket = table->buckets[i]; bucket;) { next = bucket->next; @@ -235,8 +235,8 @@ HashTablePtr table = (HashTablePtr)t; HashBucketPtr bucket; - if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ - + if (!table || table->magic != HASH_MAGIC) return -1; /* Bad magic */ + bucket = HashFind(table, key, NULL); if (!bucket) return 1; /* Not found */ *value = bucket->value; @@ -250,7 +250,7 @@ unsigned long hash; if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ - + if (HashFind(table, key, &hash)) return 1; /* Already in table */ bucket = HASH_ALLOC(sizeof(*bucket)); @@ -272,7 +272,7 @@ HashBucketPtr bucket; if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ - + bucket = HashFind(table, key, &hash); if (!bucket) return 1; /* Not found */ @@ -285,7 +285,7 @@ int N(HashNext)(void *t, unsigned long *key, void **value) { HashTablePtr table = (HashTablePtr)t; - + for (; table->p0 < HASH_SIZE; ++table->p0, table->p1 = table->buckets[table->p0]) { if (table->p1) { @@ -301,7 +301,7 @@ int N(HashFirst)(void *t, unsigned long *key, void **value) { HashTablePtr table = (HashTablePtr)t; - + if (table->magic != HASH_MAGIC) return -1; /* Bad magic */ table->p0 = 0; @@ -337,7 +337,7 @@ { int i; HashBucketPtr bucket; - + printf("Entries = %ld, hits = %ld, partials = %ld, misses = %ld\n", table->entries, table->hits, table->partials, table->misses); clear_dist(); @@ -356,7 +356,7 @@ { unsigned long retval = 0; int retcode = N(HashLookup)(table, key, &retval); - + switch (retcode) { case -1: printf("Bad magic = 0x%08lx:" @@ -391,7 +391,7 @@ for (i = 256; i >= 0; i--) check_table(table, i, i); compute_dist(table); N(HashDestroy)(table); - + printf("\n***** 1024 consecutive integers ****\n"); table = N(HashCreate)(); for (i = 0; i < 1024; i++) N(HashInsert)(table, i, i); @@ -399,7 +399,7 @@ for (i = 1024; i >= 0; i--) check_table(table, i, i); compute_dist(table); N(HashDestroy)(table); - + printf("\n***** 1024 consecutive page addresses (4k pages) ****\n"); table = N(HashCreate)(); for (i = 0; i < 1024; i++) N(HashInsert)(table, i*4096, i); @@ -407,7 +407,7 @@ for (i = 1024; i >= 0; i--) check_table(table, i*4096, i); compute_dist(table); N(HashDestroy)(table); - + printf("\n***** 1024 random integers ****\n"); table = N(HashCreate)(); srandom(0xbeefbeef); @@ -429,7 +429,7 @@ for (i = 0; i < 5000; i++) check_table(table, random(), i); compute_dist(table); N(HashDestroy)(table); - + return 0; } #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c:1.3 Thu Aug 24 18:20:17 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c Tue Apr 10 12:08:04 2001 @@ -1,14 +1,12 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c,v 1.3 2000/08/24 22:20:17 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmI810.c,v 1.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> @@ -70,8 +67,8 @@ memset(&init, 0, sizeof(drm_i810_init_t)); init.func = I810_INIT_DMA; - init.ring_map_idx = info->ring_map_idx; - init.buffer_map_idx = info->buffer_map_idx; + init.mmio_offset = info->mmio_offset; + init.buffers_offset = info->buffers_offset; init.ring_start = info->start; init.ring_end = info->end; init.ring_size = info->size; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c:1.3 Thu Aug 24 18:20:17 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c Tue Apr 10 12:08:04 2001 @@ -1,14 +1,41 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c,v 1.3 2000/08/24 22:20:17 tsi Exp $ */ +/* xf86drmMga.c -- User-level interface to MGA DRM device + * Created: Sun Apr 9 18:13:54 2000 by gareth@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Author: + * Gareth Hughes <gareth@valinux.com> + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmMga.c,v 1.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 +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> @@ -49,73 +75,237 @@ #include "xf86drmMga.h" #include "drm.h" -Bool drmMgaCleanupDma(int driSubFD) +#define MGA_IDLE_RETRY 2048 + + +int drmMGAInitDMA( int fd, drmMGAInit *info ) +{ + drm_mga_init_t init; + + memset( &init, 0, sizeof(drm_mga_init_t) ); + + init.func = MGA_INIT_DMA; + + init.sarea_priv_offset = info->sarea_priv_offset; + init.sgram = info->sgram; + init.chipset = info->chipset; + init.maccess = info->maccess; + + init.fb_cpp = info->fb_cpp; + init.front_offset = info->front_offset; + init.front_pitch = info->front_pitch; + init.back_offset = info->back_offset; + init.back_pitch = info->back_pitch; + + init.depth_cpp = info->depth_cpp; + init.depth_offset = info->depth_offset; + init.depth_pitch = info->depth_pitch; + + init.texture_offset[0] = info->texture_offset[0]; + init.texture_size[0] = info->texture_size[0]; + init.texture_offset[1] = info->texture_offset[1]; + init.texture_size[1] = info->texture_size[1]; + + init.fb_offset = info->fb_offset; + init.mmio_offset = info->mmio_offset; + init.status_offset = info->status_offset; + init.warp_offset = info->warp_offset; + init.primary_offset = info->primary_offset; + init.buffers_offset = info->buffers_offset; + + if ( ioctl( fd, DRM_IOCTL_MGA_INIT, &init ) ) { + return -errno; + } else { + return 0; + } +} + +int drmMGACleanupDMA( int fd ) { drm_mga_init_t init; - memset(&init, 0, sizeof(drm_mga_init_t)); + + memset( &init, 0, sizeof(drm_mga_init_t) ); + init.func = MGA_CLEANUP_DMA; - if(ioctl(driSubFD, DRM_IOCTL_MGA_INIT, &init)) { - return FALSE; + + if ( ioctl( fd, DRM_IOCTL_MGA_INIT, &init ) ) { + return -errno; + } else { + return 0; } - - return TRUE; } -Bool drmMgaLockUpdate(int driSubFD, drmLockFlags flags) +int drmMGAFlushDMA( int fd, drmLockFlags flags ) { drm_lock_t lock; - - memset(&lock, 0, sizeof(drm_lock_t)); - - if (flags & DRM_LOCK_QUIESCENT) lock.flags |= _DRM_LOCK_QUIESCENT; - if (flags & DRM_LOCK_FLUSH) lock.flags |= _DRM_LOCK_FLUSH; - if (flags & DRM_LOCK_FLUSH_ALL) lock.flags |= _DRM_LOCK_FLUSH_ALL; - - if(ioctl(driSubFD, DRM_IOCTL_MGA_FLUSH, &lock)) { - return FALSE; - } - - return TRUE; -} - -Bool drmMgaInitDma(int driSubFD, drmMgaInit *info) -{ - drm_mga_init_t init; - int i; - - memset(&init, 0, sizeof(drm_mga_init_t)); - init.func = MGA_INIT_DMA; - init.reserved_map_agpstart = info->reserved_map_agpstart; - init.reserved_map_idx = info->reserved_map_idx; - init.buffer_map_idx = info->buffer_map_idx; - init.sarea_priv_offset = info->sarea_priv_offset; - init.primary_size = info->primary_size; - init.warp_ucode_size = info->warp_ucode_size; - init.frontOffset = info->frontOffset; - init.backOffset = info->backOffset; - init.depthOffset = info->depthOffset; - init.textureOffset = info->textureOffset; - init.textureSize = info->textureSize; - init.agpTextureSize = info->agpTextureSize; - init.agpTextureOffset = info->agpTextureOffset; - init.cpp = info->cpp; - init.stride = info->stride; - init.sgram = info->sgram; - init.chipset = info->chipset; - - for(i = 0; i < MGA_MAX_WARP_PIPES; i++) { - init.WarpIndex[i].installed = info->WarpIndex[i].installed; - init.WarpIndex[i].phys_addr = info->WarpIndex[i].phys_addr; - init.WarpIndex[i].size = info->WarpIndex[i].size; - } - - init.mAccess = info->mAccess; - - - - if(ioctl(driSubFD, DRM_IOCTL_MGA_INIT, &init)) { - return FALSE; - } - return TRUE; + int ret, i = 0; + + memset( &lock, 0, sizeof(drm_lock_t) ); + + if ( flags & DRM_LOCK_QUIESCENT ) lock.flags |= _DRM_LOCK_QUIESCENT; + if ( flags & DRM_LOCK_FLUSH ) lock.flags |= _DRM_LOCK_FLUSH; + if ( flags & DRM_LOCK_FLUSH_ALL ) lock.flags |= _DRM_LOCK_FLUSH_ALL; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_FLUSH, &lock ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) + return 0; + if ( errno != EBUSY ) + return -errno; + + if ( lock.flags & _DRM_LOCK_QUIESCENT ) { + /* Only keep trying if we need quiescence. + */ + lock.flags &= ~(_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL); + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_FLUSH, &lock ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + } + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmMGAEngineReset( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_MGA_RESET, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmMGAFullScreen( int fd, int enable ) +{ + return -EINVAL; +} + +int drmMGASwapBuffers( int fd ) +{ + int ret, i = 0; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_SWAP, NULL ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmMGAClear( int fd, unsigned int flags, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ) +{ + drm_mga_clear_t clear; + int ret, i = 0; + + clear.flags = flags; + clear.clear_color = clear_color; + clear.clear_depth = clear_depth; + clear.color_mask = color_mask; + clear.depth_mask = depth_mask; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_CLEAR, &clear ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmMGAFlushVertexBuffer( int fd, int index, int used, int discard ) +{ + drm_mga_vertex_t vertex; + + vertex.idx = index; + vertex.used = used; + vertex.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_MGA_VERTEX, &vertex ) ) { + return -errno; + } else { + return 0; + } +} + +int drmMGAFlushIndices( int fd, int index, int start, int end, int discard ) +{ + drm_mga_indices_t indices; + + indices.idx = index; + indices.start = start; + indices.end = end; + indices.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_MGA_INDICES, &indices ) ) { + return -errno; + } else { + return 0; + } +} + +int drmMGATextureLoad( int fd, int index, + unsigned int dstorg, unsigned int length ) +{ + drm_mga_iload_t iload; + int ret, i = 0; + + iload.idx = index; + iload.dstorg = dstorg; + iload.length = length; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_ILOAD, &iload ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } } +int drmMGAAgpBlit( int fd, unsigned int planemask, + unsigned int src_offset, int src_pitch, + unsigned int dst_offset, int dst_pitch, + int delta_sx, int delta_sy, + int delta_dx, int delta_dy, + int height, int ydir ) +{ + drm_mga_blit_t blit; + int ret, i = 0; + + blit.planemask = planemask; + blit.srcorg = src_offset; + blit.dstorg = dst_offset; + blit.src_pitch = src_pitch; + blit.dst_pitch = dst_pitch; + blit.delta_sx = delta_sx; + blit.delta_sy = delta_sy; + blit.delta_dx = delta_dx; + blit.delta_dx = delta_dx; + blit.height = height; + blit.ydir = ydir; + + do { + ret = ioctl( fd, DRM_IOCTL_MGA_BLIT, &blit ); + } while ( ret && errno == EBUSY && i++ < MGA_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c:1.9.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c:1.6 Tue Dec 12 12:17:14 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c Wed May 23 14:58:00 2001 @@ -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.6 2000/12/12 17:17:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmR128.c,v 1.9.2.1 2001/05/23 18:58:00 dawes Exp $ */ #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> @@ -78,7 +75,7 @@ #include "drm.h" #define R128_BUFFER_RETRY 32 -#define R128_IDLE_RETRY 16 +#define R128_IDLE_RETRY 32 int drmR128InitCCE( int fd, drmR128Init *info ) @@ -154,8 +151,11 @@ ret = ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ); - if ( ret && errno != EBUSY ) + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { return -errno; + } stop.flush = 0; @@ -163,8 +163,11 @@ ret = ioctl( fd, DRM_IOCTL_R128_CCE_STOP, &stop ); } while ( ret && errno == EBUSY && i++ < R128_IDLE_RETRY ); - if ( ret && errno != EBUSY ) + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { return -errno; + } stop.idle = 0; @@ -208,6 +211,23 @@ } } +int drmR128FullScreen( int fd, int enable ) +{ + drm_r128_fullscreen_t fs; + + if ( enable ) { + fs.func = R128_INIT_FULLSCREEN; + } else { + fs.func = R128_CLEANUP_FULLSCREEN; + } + + if ( ioctl( fd, DRM_IOCTL_R128_FULLSCREEN, &fs ) ) { + return -errno; + } else { + return 0; + } +} + int drmR128SwapBuffers( int fd ) { if ( ioctl( fd, DRM_IOCTL_R128_SWAP, NULL ) ) { @@ -218,19 +238,16 @@ } int drmR128Clear( int fd, unsigned int flags, - int x, int y, int w, int h, - unsigned int clear_color, - unsigned int clear_depth ) + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask ) { drm_r128_clear_t clear; clear.flags = flags; - clear.x = x; - clear.y = y; - clear.w = w; - clear.h = h; clear.clear_color = clear_color; clear.clear_depth = clear_depth; + clear.color_mask = color_mask; + clear.depth_mask = depth_mask; if ( ioctl( fd, DRM_IOCTL_R128_CLEAR, &clear ) < 0 ) { return -errno; @@ -387,25 +404,19 @@ } } -int drmR128SubmitPacket( int fd, void *buffer, int *count, int flags ) +int drmR128FlushIndirectBuffer( int fd, int index, + int start, int end, int discard ) { - drm_r128_packet_t packet; - int ret; + drm_r128_indirect_t ind; - memset( &packet, 0, sizeof(drm_r128_packet_t) ); + ind.idx = index; + ind.start = start; + ind.end = end; + ind.discard = discard; - packet.count = *count; - packet.flags = flags; - - while (packet.count > 0) { - packet.buffer = (unsigned int *)buffer + (*count - packet.count); - ret = ioctl(fd, DRM_IOCTL_R128_PACKET, &packet); - if (ret < 0 && ret != -EAGAIN) { - *count = packet.count; - return -errno; - } + if ( ioctl( fd, DRM_IOCTL_R128_INDIRECT, &ind ) < 0 ) { + return -errno; + } else { + return 0; } - - *count = 0; - return 0; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c:1.3 --- /dev/null Mon Jun 4 12:41:25 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmRadeon.c Tue Apr 10 12:08:04 2001 @@ -0,0 +1,368 @@ +/* xf86drmRadeon.c -- User-level interface to Radeon DRM device + * + * Copyright 2000 VA Linx Systems, Inc., Fremont, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * + */ +/* $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" +# define _DRM_MALLOC xalloc +# define _DRM_FREE xfree +# ifndef XFree86LOADER +# include <sys/mman.h> +# endif +#else +# include <stdio.h> +# include <stdlib.h> +# include <unistd.h> +# include <string.h> +# include <ctype.h> +# include <fcntl.h> +# include <errno.h> +# include <signal.h> +# include <sys/types.h> +# include <sys/ioctl.h> +# include <sys/mman.h> +# include <sys/time.h> +# ifdef DRM_USE_MALLOC +# define _DRM_MALLOC malloc +# define _DRM_FREE free +extern int xf86InstallSIGIOHandler(int fd, void (*f)(int, void *), void *); +extern int xf86RemoveSIGIOHandler(int fd); +# else +# include <Xlibint.h> +# define _DRM_MALLOC Xmalloc +# define _DRM_FREE Xfree +# endif +#endif + +/* Not all systems have MAP_FAILED defined */ +#ifndef MAP_FAILED +#define MAP_FAILED ((void *)-1) +#endif + +#ifdef __linux__ +#include <sys/sysmacros.h> /* for makedev() */ +#endif +#include "xf86drm.h" +#include "xf86drmRadeon.h" +#include "drm.h" + +#define RADEON_BUFFER_RETRY 32 +#define RADEON_IDLE_RETRY 16 + + +int drmRadeonInitCP( int fd, drmRadeonInit *info ) +{ + drm_radeon_init_t init; + + memset( &init, 0, sizeof(drm_radeon_init_t) ); + + init.func = RADEON_INIT_CP; + init.sarea_priv_offset = info->sarea_priv_offset; + init.is_pci = info->is_pci; + init.cp_mode = info->cp_mode; + init.agp_size = info->agp_size; + init.ring_size = info->ring_size; + init.usec_timeout = info->usec_timeout; + + init.fb_bpp = info->fb_bpp; + init.front_offset = info->front_offset; + init.front_pitch = info->front_pitch; + init.back_offset = info->back_offset; + init.back_pitch = info->back_pitch; + + init.depth_bpp = info->depth_bpp; + init.depth_offset = info->depth_offset; + init.depth_pitch = info->depth_pitch; + + init.fb_offset = info->fb_offset; + init.mmio_offset = info->mmio_offset; + init.ring_offset = info->ring_offset; + init.ring_rptr_offset = info->ring_rptr_offset; + init.buffers_offset = info->buffers_offset; + init.agp_textures_offset = info->agp_textures_offset; + + if ( ioctl( fd, DRM_IOCTL_RADEON_CP_INIT, &init ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonCleanupCP( int fd ) +{ + drm_radeon_init_t init; + + memset( &init, 0, sizeof(drm_radeon_init_t) ); + + init.func = RADEON_CLEANUP_CP; + + if ( ioctl( fd, DRM_IOCTL_RADEON_CP_INIT, &init ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonStartCP( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_RADEON_CP_START, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonStopCP( int fd ) +{ + drm_radeon_cp_stop_t stop; + int ret, i = 0; + + stop.flush = 1; + stop.idle = 1; + + ret = ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop ); + + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { + return -errno; + } + + stop.flush = 0; + + do { + ret = ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop ); + } while ( ret && errno == EBUSY && i++ < RADEON_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else if ( errno != EBUSY ) { + return -errno; + } + + stop.idle = 0; + + if ( ioctl( fd, DRM_IOCTL_RADEON_CP_STOP, &stop ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonResetCP( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_RADEON_CP_RESET, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonWaitForIdleCP( int fd ) +{ + int ret, i = 0; + + do { + ret = ioctl( fd, DRM_IOCTL_RADEON_CP_IDLE, NULL ); + } while ( ret && errno == EBUSY && i++ < RADEON_IDLE_RETRY ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmRadeonEngineReset( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_RADEON_RESET, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonFullScreen( int fd, int enable ) +{ + drm_radeon_fullscreen_t fs; + + if ( enable ) { + fs.func = RADEON_INIT_FULLSCREEN; + } else { + fs.func = RADEON_CLEANUP_FULLSCREEN; + } + + if ( ioctl( fd, DRM_IOCTL_RADEON_FULLSCREEN, &fs ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonSwapBuffers( int fd ) +{ + if ( ioctl( fd, DRM_IOCTL_RADEON_SWAP, NULL ) ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonClear( int fd, unsigned int flags, + unsigned int clear_color, unsigned int clear_depth, + unsigned int color_mask, unsigned int depth_mask, + void *b, int nbox ) +{ + drm_radeon_clear_t clear; + drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS]; + drm_clip_rect_t *boxes = (drm_clip_rect_t *)b; + int i; + + clear.flags = flags; + clear.clear_color = clear_color; + clear.clear_depth = clear_depth; + clear.color_mask = color_mask; + clear.depth_mask = depth_mask; + clear.depth_boxes = depth_boxes; + + /* We can remove this when we do real depth clears, instead of + * rendering a rectangle into the depth buffer. This prevents + * floating point calculations being done in the kernel. + */ + for ( i = 0 ; i < nbox ; i++ ) { + depth_boxes[i].f[CLEAR_X1] = (float)boxes[i].x1; + depth_boxes[i].f[CLEAR_Y1] = (float)boxes[i].y1; + depth_boxes[i].f[CLEAR_X2] = (float)boxes[i].x2; + depth_boxes[i].f[CLEAR_Y2] = (float)boxes[i].y2; + depth_boxes[i].f[CLEAR_DEPTH] = (float)clear_depth; + } + + if ( ioctl( fd, DRM_IOCTL_RADEON_CLEAR, &clear ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonFlushVertexBuffer( int fd, int prim, int index, + int count, int discard ) +{ + drm_radeon_vertex_t v; + + v.prim = prim; + v.idx = index; + v.count = count; + v.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_RADEON_VERTEX, &v ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonFlushIndices( int fd, int prim, int index, + int start, int end, int discard ) +{ + drm_radeon_indices_t elts; + + elts.prim = prim; + elts.idx = index; + elts.start = start; + elts.end = end; + elts.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_RADEON_INDICES, &elts ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonLoadTexture( int fd, int offset, int pitch, int format, + int width, int height, drmRadeonTexImage *image ) +{ + drm_radeon_texture_t tex; + drm_radeon_tex_image_t tmp; + int ret; + + tex.offset = offset; + tex.pitch = pitch; + tex.format = format; + tex.width = width; + tex.height = height; + tex.image = &tmp; + + /* This gets updated by the kernel when a multipass blit is needed. + */ + memcpy( &tmp, image, sizeof(drm_radeon_tex_image_t) ); + + do { + ret = ioctl( fd, DRM_IOCTL_RADEON_TEXTURE, &tex ); + } while ( ret && errno == EAGAIN ); + + if ( ret == 0 ) { + return 0; + } else { + return -errno; + } +} + +int drmRadeonPolygonStipple( int fd, unsigned int *mask ) +{ + drm_radeon_stipple_t stipple; + + stipple.mask = mask; + + if ( ioctl( fd, DRM_IOCTL_RADEON_STIPPLE, &stipple ) < 0 ) { + return -errno; + } else { + return 0; + } +} + +int drmRadeonFlushIndirectBuffer( int fd, int index, + int start, int end, int discard ) +{ + drm_radeon_indirect_t ind; + + ind.idx = index; + ind.start = start; + ind.end = end; + ind.discard = discard; + + if ( ioctl( fd, DRM_IOCTL_RADEON_INDIRECT, &ind ) < 0 ) { + return -errno; + } else { + return 0; + } +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c:1.6.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c:1.3 Tue Oct 10 15:35:30 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c Tue May 22 17:25:46 2001 @@ -1,14 +1,12 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c,v 1.3 2000/10/10 19:35:30 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/xf86drmSiS.c,v 1.6.2.1 2001/05/22 21:25:46 dawes Exp $ */ #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> @@ -46,7 +43,9 @@ #include <sys/sysmacros.h> /* for makedev() */ #endif #include "xf86drm.h" +#define CONFIG_DRM_SIS #include "drm.h" +#undef CONFIG_DRM_SIS Bool drmSiSAgpInit(int driSubFD, int offset, int size) { Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile:1.3 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile:1.3 Wed Nov 8 00:03:06 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Imakefile Wed Apr 18 10:52:43 2001 @@ -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 @@ $(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:: Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel:1.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel:1.10 Mon Dec 4 14:21:55 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.kernel Wed Mar 21 13:08:54 2001 @@ -6,7 +6,8 @@ # drm.o is a fake target -- it is never built # The real targets are in the module-list O_TARGET := drm.o -module-list := gamma.o tdfx.o r128.o ffb.o mga.o i810.o + +module-list := gamma.o tdfx.o r128.o radeon.o ffb.o mga.o i810.o export-objs := $(patsubst %.o,%_drv.o,$(module-list)) # libs-objs are included in every module so that radical changes to the @@ -25,6 +26,11 @@ # memory waste (in the dual-head case) for greatly improved long-term # maintainability. # +# NOTE: lib-objs will be eliminated in future versions, thereby +# eliminating the need to compile the .o files into every module, but +# for now we still need them. +# + lib-objs := init.o memory.o proc.o auth.o context.o drawable.o bufs.o lib-objs += lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o @@ -32,58 +38,71 @@ lib-objs += agpsupport.o else ifeq ($(CONFIG_AGP),m) - lib-objs += agpsupport.o + lib-objs += agpsupport.o endif endif -gamma-objs := $(lib-objs) gamma_drv.o gamma_dma.o -tdfx-objs := $(lib-objs) tdfx_drv.o tdfx_context.o -r128-objs := $(lib-objs) r128_drv.o r128_cce.o r128_context.o r128_bufs.o\ - r128_state.o -ffb-objs := $(lib-objs) ffb_drv.o ffb_context.o -mga-objs := $(lib-objs) mga_drv.o mga_dma.o mga_context.o mga_bufs.o \ - mga_state.o -i810-objs := $(lib-objs) i810_drv.o i810_dma.o i810_context.o i810_bufs.o - -obj-$(CONFIG_DRM_GAMMA) += gamma.o $(gamma-objs) -obj-$(CONFIG_DRM_TDFX) += tdfx.o $(tdfx-objs) -obj-$(CONFIG_DRM_R128) += r128.o $(r128-objs) -obj-$(CONFIG_DRM_FFB) += ffb.o $(ffb-objs) - -ifneq ($CONFIG_AGP),) -obj-$(CONFIG_DRM_MGA) += mga.o $(mga-objs) -obj-$(CONFIG_DRM_I810) += i810.o $(i810-objs) -endif +gamma-objs := gamma_drv.o gamma_dma.o +tdfx-objs := tdfx_drv.o tdfx_context.o +r128-objs := r128_drv.o r128_cce.o r128_context.o r128_bufs.o \ + r128_state.o +radeon-objs := radeon_drv.o radeon_cp.o radeon_context.o radeon_bufs.o \ + radeon_state.o +ffb-objs := ffb_drv.o ffb_context.o +mga-objs := mga_drv.o mga_dma.o mga_context.o mga_bufs.o \ + mga_state.o +i810-objs := i810_drv.o i810_dma.o i810_context.o i810_bufs.o + +obj-$(CONFIG_DRM_GAMMA) += gamma.o +obj-$(CONFIG_DRM_TDFX) += tdfx.o +obj-$(CONFIG_DRM_R128) += r128.o +obj-$(CONFIG_DRM_RADEON) += radeon.o +obj-$(CONFIG_DRM_FFB) += ffb.o +obj-$(CONFIG_DRM_MGA) += mga.o +obj-$(CONFIG_DRM_I810) += i810.o -# Take module names out of obj-y and int-m -obj-y := $(filter-out $(module-list), $(obj-y)) -int-m := $(filter-out $(module-list), $(obj-m)) +# When linking into the kernel, link the library just once. +# If making modules, we include the library into each module -# Translate to Rules.make lists. +lib-objs-mod := $(patsubst %.o,%-mod.o,$(lib-objs)) -O_OBJS := $(filter-out $(export-objs), $(obj-y)) -OX_OBJS := $(filter $(export-objs), $(obj-y)) -M_OBJS := $(sort $(filter $(module-list), $(obj-m))) -MI_OBJS := $(sort $(filter-out $(export-objs), $(int-m))) -MIX_OBJS := $(sort $(filter $(export-objs), $(int-m))) +ifdef MAKING_MODULES + lib = drmlib-mod.a +else + obj-y += drmlib.a +endif include $(TOPDIR)/Rules.make + +$(patsubst %.o,%.c,$(lib-objs-mod)): + @ln -sf $(subst -mod,,$@) $@ + +drmlib-mod.a: $(lib-objs-mod) + rm -f $@ + $(AR) $(EXTRA_ARFLAGS) rcs $@ $(lib-objs-mod) + +drmlib.a: $(lib-objs) + rm -f $@ + $(AR) $(EXTRA_ARFLAGS) rcs $@ $(lib-objs) + +gamma.o: $(gamma-objs) $(lib) + $(LD) -r -o $@ $(gamma-objs) $(lib) -gamma.o: $(gamma-objs) - $(LD) -r -o $@ $(gamma-objs) +tdfx.o: $(tdfx-objs) $(lib) + $(LD) -r -o $@ $(tdfx-objs) $(lib) -tdfx.o: $(tdfx-objs) - $(LD) -r -o $@ $(tdfx-objs) +mga.o: $(mga-objs) $(lib) + $(LD) -r -o $@ $(mga-objs) $(lib) -mga.o: $(mga-objs) - $(LD) -r -o $@ $(mga-objs) +i810.o: $(i810-objs) $(lib) + $(LD) -r -o $@ $(i810-objs) $(lib) -i810.o: $(i810-objs) - $(LD) -r -o $@ $(i810-objs) +r128.o: $(r128-objs) $(lib) + $(LD) -r -o $@ $(r128-objs) $(lib) -r128.o: $(r128-objs) - $(LD) -r -o $@ $(r128-objs) +radeon.o: $(radeon-objs) $(lib) + $(LD) -r -o $@ $(radeon-objs) $(lib) -ffb.o: $(ffb-objs) - $(LD) -r -o $@ $(ffb-objs) +ffb.o: $(ffb-objs) $(lib) + $(LD) -r -o $@ $(ffb-objs) $(lib) Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux:1.15 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux:1.21.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux:1.15 Mon Dec 4 14:21:57 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/Makefile.linux Tue May 22 17:25:46 2001 @@ -23,8 +23,8 @@ # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # DEALINGS IN THE SOFTWARE. -# # +# # ***** NOTE NOTE NOTE NOTE NOTE ***** # To override the automatic Linux source tree determination, pass the # pathname for the kernel that you want to compile on the command line, @@ -46,36 +46,42 @@ # *** Setup # **** End of SMP/MODVERSIONS detection + +MODS = gamma.o tdfx.o r128.o radeon.o +LIBS = -MODS= gamma.o tdfx.o r128.o -LIBS= libdrm.a +DRMTEMPLATES = drm_auth.h drm_bufs.h drm_context.h drm_dma.h drm_drawable.h \ + drm_drv.h drm_fops.h drm_init.h drm_ioctl.h drm_lists.h \ + drm_lock.h drm_memory.h drm_proc.h drm_stub.h drm_vm.h +DRMHEADERS = drm.h drmP.h compat-pre24.h -DRMOBJS= init.o memory.o proc.o auth.o context.o drawable.o bufs.o \ - lists.o lock.o ioctl.o fops.o vm.o dma.o ctxbitmap.o -DRMHEADERS= drm.h drmP.h compat-pre24.h +GAMMAOBJS = gamma_drv.o gamma_dma.o +GAMMAHEADERS = gamma_drv.h $(DRMHEADERS) $(DRMTEMPLATES) -GAMMAOBJS= gamma_drv.o gamma_dma.o -GAMMAHEADERS= gamma_drv.h $(DRMHEADERS) +TDFXOBJS = tdfx_drv.o +TDFXHEADERS = tdfx.h $(DRMHEADERS) $(DRMTEMPLATES) -TDFXOBJS= tdfx_drv.o tdfx_context.o -TDFXHEADERS= tdfx_drv.h $(DRMHEADERS) +R128OBJS = r128_drv.o r128_cce.o r128_state.o +R128HEADERS = r128.h r128_drv.h r128_drm.h $(DRMHEADERS) $(DRMTEMPLATES) -R128OBJS= r128_drv.o r128_cce.o r128_bufs.o r128_state.o r128_context.o -R128HEADERS= r128_drv.h r128_drm.h $(DRMHEADERS) +RADEONOBJS = radeon_drv.o radeon_cp.o radeon_state.o +RADEONHEADERS = radeon.h radeon_drv.h radeon_drm.h $(DRMHEADERS) \ + $(DRMTEMPLATES) -INC= /usr/include +INC = /usr/include -CFLAGS= -O2 $(WARNINGS) -WARNINGS= -Wall -Wwrite-strings -Wpointer-arith -Wcast-align \ +CFLAGS = -O2 $(WARNINGS) +WARNINGS = -Wall -Wwrite-strings -Wpointer-arith -Wcast-align \ -Wstrict-prototypes -Wnested-externs \ -Wpointer-arith # -Wshadow -Winline -- make output too noisy -MODCFLAGS= $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer -PRGCFLAGS= $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \ +MODCFLAGS = $(CFLAGS) -D__KERNEL__ -DMODULE -fomit-frame-pointer +PRGCFLAGS = $(CFLAGS) -g -ansi -pedantic -DPOSIX_C_SOURCE=199309L \ -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE \ -I../../../../../../include -I../../../../../../../../include \ - -I../../../../../../../../programs/Xserver/hw/xfree86/common -PRGLIBS= + -I../../../../../../../../programs/Xserver/hw/xfree86/common \ + -I. -I../../.. -I../../../../../../../../lib/X11 +PRGLIBS = # **** Start of SMP/MODVERSIONS detection @@ -84,9 +90,10 @@ # 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,16 +107,22 @@ else V := $(shell gcc -E -nostdinc -I$C picker.c 2>/dev/null \ | grep -s 'RELEASE = ' | cut -d' ' -f3) +ifeq ($(V),"$(VERSION)") + 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 := $C + 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) @@ -131,18 +144,26 @@ ifeq ($(AGP),1) MODCFLAGS += -DCONFIG_AGP -DCONFIG_AGP_MODULE -DRMOBJS += agpsupport.o +DRMTEMPLATES += drm_agpsupport.h +DRMHEADERS += agpsupport-pre24.h MODS += mga.o ifeq ($(MACHINE),i386) MODS += i810.o endif +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) -MGAOBJS= mga_drv.o mga_dma.o mga_bufs.o mga_state.o mga_context.o -MGAHEADERS= mga_drv.h $(DRMHEADERS) +I810OBJS = i810_drv.o i810_dma.o +I810HEADERS = i810.h i810_drv.h i810_drm.h $(DRMHEADERS) $(DRMTEMPLATES) + +endif -I810OBJS= i810_drv.o i810_dma.o i810_bufs.o i810_context.o -I810HEADERS= i810_drv.h $(DRMHEADERS) +ifeq ($(MACHINE),alpha) +MODCFLAGS+= -ffixed-8 -mno-fp-regs -mcpu=ev56 -Wa,-mev6 endif ifeq ($(SIS),1) @@ -154,14 +175,18 @@ # file to see if we can, at least, compile the driver. MODS += sis.o -SISOBJS= sis_drv.o sis_context.o sis_ds.o sis_mm.o -SISHEADERS= sis_drv.h sis_ds.h sis_drm.h $(DRMHEADERS) +SISOBJS= sis_drv.o sis_mm.o sis_ds.o +SISHEADERS= sis_drv.h sis_drm.h $(DRMHEADERS) +MODCFLAGS += -DCONFIG_DRM_SIS endif all::;@echo === KERNEL HEADERS IN $(TREE) all::;@echo === SMP=${SMP} MODULES=${MODULES} MODVERSIONS=${MODVERSIONS} AGP=${AGP} all::;@echo === kill_fasync has $(PARAMS) parameters all::;@echo === Compiling for machine $(MACHINE) +all::;@echo === WARNING +all::;@echo === WARNING 2.4.0 kernels before 2.4.0-test11 DO NOT WORK +all::;@echo === WARNING ifeq ($(MODULES),0) all::;@echo @@ -188,13 +213,15 @@ # **** End of configuration -libdrm.a: $(DRMOBJS) - -$(RM) -f $@ - $(AR) rcs $@ $(DRMOBJS) +dristat: dristat.c + $(CC) $(PRGCFLAGS) $< -o $@ +DRIsetup: DRIsetup.c + $(CC) $(PRGCFLAGS) $< -o $@ -L/usr/X11R6/lib -lGL -lm ../../../../parser/libxf86config.a ../libdrm.a + gamma_drv.o: gamma_drv.c $(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@ -gamma.o: $(GAMMAOBJS) $(LIBS) +gamma.o: $(GAMMAOBJS) $(LD) -r $^ -o $@ tdfx_drv.o: tdfx_drv.c @@ -202,24 +229,30 @@ tdfx.o: $(TDFXOBJS) $(LIBS) $(LD) -r $^ -o $@ +sis.o: $(SISOBJS) $(LIBS) + $(LD) -r $^ -o $@ + r128_drv.o: r128_drv.c $(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@ r128.o: $(R128OBJS) $(LIBS) $(LD) -r $^ -o $@ -sis.o: $(SISOBJS) $(LIBS) +radeon_drv.o: radeon_drv.c + $(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@ +radeon.o: $(RADEONOBJS) $(LIBS) $(LD) -r $^ -o $@ ifeq ($(AGP),1) mga_drv.o: mga_drv.c $(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@ -mga.o: $(MGAOBJS) $(LIBS) +mga.o: $(MGAOBJS) $(LD) -r $^ -o $@ i810_drv.o: i810_drv.c $(CC) $(MODCFLAGS) -DEXPORT_SYMTAB -I$(TREE) -c $< -o $@ i810.o: $(I810OBJS) $(LIBS) $(LD) -r $^ -o $@ + endif .PHONY: ChangeLog @@ -235,14 +268,14 @@ %.o: %.c $(CC) $(MODCFLAGS) -I$(TREE) -c $< -o $@ -$(DRMOBJS): $(DRMHEADERS) $(GAMMAOBJS): $(GAMMAHEADERS) $(TDFXOBJS): $(TDFXHEADERS) -$(R128OBJS): $(R128HEADERS) ifeq ($(AGP),1) $(MGAOBJS): $(MGAHEADERS) $(I810OBJS): $(I810HEADERS) +$(R128OBJS): $(R128HEADERS) +$(RADEONOBJS): $(RADEONHEADERS) endif -clean: +clean cleandir:: rm -f *.o *.a *~ core Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c:1.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c:1.7 Fri Dec 1 09:29:01 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/agpsupport.c Mon Jun 4 12:41:26 2001 @@ -1,328 +0,0 @@ -/* agpsupport.c -- DRM support for AGP/GART backend -*- linux-c -*- - * Created: Mon Dec 13 09:56:45 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" -#include <linux/module.h> -#if LINUX_VERSION_CODE < 0x020400 -#include "agpsupport-pre24.h" -#else -#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp") -#define DRM_AGP_PUT inter_module_put("drm_agp") -#endif - -static const drm_agp_t *drm_agp = NULL; - -int drm_agp_info(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - agp_kern_info *kern; - drm_agp_info_t info; - - if (!dev->agp->acquired || !drm_agp->copy_info) return -EINVAL; - - kern = &dev->agp->agp_info; - info.agp_version_major = kern->version.major; - info.agp_version_minor = kern->version.minor; - info.mode = kern->mode; - info.aperture_base = kern->aper_base; - info.aperture_size = kern->aper_size * 1024 * 1024; - info.memory_allowed = kern->max_memory << PAGE_SHIFT; - info.memory_used = kern->current_memory << PAGE_SHIFT; - info.id_vendor = kern->device->vendor; - info.id_device = kern->device->device; - - if (copy_to_user((drm_agp_info_t *)arg, &info, sizeof(info))) - return -EFAULT; - return 0; -} - -int drm_agp_acquire(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int retcode; - - if (dev->agp->acquired || !drm_agp->acquire) return -EINVAL; - if ((retcode = drm_agp->acquire())) return retcode; - dev->agp->acquired = 1; - return 0; -} - -int drm_agp_release(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - - if (!dev->agp->acquired || !drm_agp->release) return -EINVAL; - drm_agp->release(); - dev->agp->acquired = 0; - return 0; - -} - -void _drm_agp_release(void) -{ - if (drm_agp->release) drm_agp->release(); -} - -int drm_agp_enable(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_agp_mode_t mode; - - if (!dev->agp->acquired || !drm_agp->enable) return -EINVAL; - - if (copy_from_user(&mode, (drm_agp_mode_t *)arg, sizeof(mode))) - return -EFAULT; - - dev->agp->mode = mode.mode; - drm_agp->enable(mode.mode); - dev->agp->base = dev->agp->agp_info.aper_base; - dev->agp->enabled = 1; - return 0; -} - -int drm_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_agp_buffer_t request; - drm_agp_mem_t *entry; - agp_memory *memory; - unsigned long pages; - u32 type; - if (!dev->agp->acquired) return -EINVAL; - if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request))) - return -EFAULT; - if (!(entry = drm_alloc(sizeof(*entry), DRM_MEM_AGPLISTS))) - return -ENOMEM; - - memset(entry, 0, sizeof(*entry)); - - pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; - type = (u32) request.type; - - if (!(memory = drm_alloc_agp(pages, type))) { - drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); - return -ENOMEM; - } - - entry->handle = (unsigned long)memory->memory; - entry->memory = memory; - entry->bound = 0; - entry->pages = pages; - entry->prev = NULL; - entry->next = dev->agp->memory; - if (dev->agp->memory) dev->agp->memory->prev = entry; - dev->agp->memory = entry; - - request.handle = entry->handle; - request.physical = memory->physical; - - if (copy_to_user((drm_agp_buffer_t *)arg, &request, sizeof(request))) { - dev->agp->memory = entry->next; - dev->agp->memory->prev = NULL; - drm_free_agp(memory, pages); - drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); - return -EFAULT; - } - return 0; -} - -static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t *dev, - unsigned long handle) -{ - drm_agp_mem_t *entry; - - for (entry = dev->agp->memory; entry; entry = entry->next) { - if (entry->handle == handle) return entry; - } - return NULL; -} - -int drm_agp_unbind(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_agp_binding_t request; - drm_agp_mem_t *entry; - - if (!dev->agp->acquired) return -EINVAL; - if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request))) - return -EFAULT; - if (!(entry = drm_agp_lookup_entry(dev, request.handle))) - return -EINVAL; - if (!entry->bound) return -EINVAL; - return drm_unbind_agp(entry->memory); -} - -int drm_agp_bind(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_agp_binding_t request; - drm_agp_mem_t *entry; - int retcode; - int page; - - if (!dev->agp->acquired || !drm_agp->bind_memory) return -EINVAL; - if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request))) - return -EFAULT; - if (!(entry = drm_agp_lookup_entry(dev, request.handle))) - return -EINVAL; - if (entry->bound) return -EINVAL; - page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE; - if ((retcode = drm_bind_agp(entry->memory, page))) return retcode; - entry->bound = dev->agp->base + (page << PAGE_SHIFT); - DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n", - dev->agp->base, entry->bound); - return 0; -} - -int drm_agp_free(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_agp_buffer_t request; - drm_agp_mem_t *entry; - - if (!dev->agp->acquired) return -EINVAL; - if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request))) - return -EFAULT; - if (!(entry = drm_agp_lookup_entry(dev, request.handle))) - return -EINVAL; - if (entry->bound) drm_unbind_agp(entry->memory); - - if (entry->prev) entry->prev->next = entry->next; - else dev->agp->memory = entry->next; - if (entry->next) entry->next->prev = entry->prev; - drm_free_agp(entry->memory, entry->pages); - drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); - return 0; -} - -drm_agp_head_t *drm_agp_init(void) -{ - drm_agp_head_t *head = NULL; - - drm_agp = DRM_AGP_GET; - if (drm_agp) { - if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS))) - return NULL; - memset((void *)head, 0, sizeof(*head)); - drm_agp->copy_info(&head->agp_info); - if (head->agp_info.chipset == NOT_SUPPORTED) { - drm_free(head, sizeof(*head), DRM_MEM_AGPLISTS); - return NULL; - } - head->memory = NULL; - switch (head->agp_info.chipset) { - case INTEL_GENERIC: head->chipset = "Intel"; break; - case INTEL_LX: head->chipset = "Intel 440LX"; break; - case INTEL_BX: head->chipset = "Intel 440BX"; break; - case INTEL_GX: head->chipset = "Intel 440GX"; break; - case INTEL_I810: head->chipset = "Intel i810"; break; - -#if LINUX_VERSION_CODE >= 0x020400 - case INTEL_I840: head->chipset = "Intel i840"; break; -#endif - - case VIA_GENERIC: head->chipset = "VIA"; break; - case VIA_VP3: head->chipset = "VIA VP3"; break; - case VIA_MVP3: head->chipset = "VIA MVP3"; break; - -#if LINUX_VERSION_CODE >= 0x020400 - case VIA_MVP4: head->chipset = "VIA MVP4"; break; - case VIA_APOLLO_KX133: head->chipset = "VIA Apollo KX133"; - break; - case VIA_APOLLO_KT133: head->chipset = "VIA Apollo KT133"; - break; -#endif - - case VIA_APOLLO_PRO: head->chipset = "VIA Apollo Pro"; - break; - case SIS_GENERIC: head->chipset = "SiS"; break; - case AMD_GENERIC: head->chipset = "AMD"; break; - case AMD_IRONGATE: head->chipset = "AMD Irongate"; break; - case ALI_GENERIC: head->chipset = "ALi"; break; - case ALI_M1541: head->chipset = "ALi M1541"; break; - default: head->chipset = "Unknown"; break; - } - DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n", - head->agp_info.version.major, - head->agp_info.version.minor, - head->chipset, - head->agp_info.aper_base, - head->agp_info.aper_size); - } - return head; -} - -void drm_agp_uninit(void) -{ - DRM_AGP_PUT; - drm_agp = NULL; -} - -agp_memory *drm_agp_allocate_memory(size_t pages, u32 type) -{ - if (!drm_agp->allocate_memory) return NULL; - return drm_agp->allocate_memory(pages, type); -} - -int drm_agp_free_memory(agp_memory *handle) -{ - if (!handle || !drm_agp->free_memory) return 0; - drm_agp->free_memory(handle); - return 1; -} - -int drm_agp_bind_memory(agp_memory *handle, off_t start) -{ - if (!handle || !drm_agp->bind_memory) return -EINVAL; - return drm_agp->bind_memory(handle, start); -} - -int drm_agp_unbind_memory(agp_memory *handle) -{ - if (!handle || !drm_agp->unbind_memory) return -EINVAL; - return drm_agp->unbind_memory(handle); -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ati_pcigart.h Tue Apr 10 12:08:04 2001 @@ -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; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c:1.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c:1.7 Tue Sep 26 12:21:23 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/auth.c Mon Jun 4 12:41:26 2001 @@ -1,162 +0,0 @@ -/* auth.c -- IOCTLs for authentication -*- linux-c -*- - * Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" - -static int drm_hash_magic(drm_magic_t magic) -{ - return magic & (DRM_HASH_SIZE-1); -} - -static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic) -{ - drm_file_t *retval = NULL; - drm_magic_entry_t *pt; - int hash = drm_hash_magic(magic); - - down(&dev->struct_sem); - for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { - if (pt->magic == magic) { - retval = pt->priv; - break; - } - } - up(&dev->struct_sem); - return retval; -} - -int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) -{ - int hash; - drm_magic_entry_t *entry; - - DRM_DEBUG("%d\n", magic); - - hash = drm_hash_magic(magic); - entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC); - if (!entry) return -ENOMEM; - entry->magic = magic; - entry->priv = priv; - entry->next = NULL; - - down(&dev->struct_sem); - if (dev->magiclist[hash].tail) { - dev->magiclist[hash].tail->next = entry; - dev->magiclist[hash].tail = entry; - } else { - dev->magiclist[hash].head = entry; - dev->magiclist[hash].tail = entry; - } - up(&dev->struct_sem); - - return 0; -} - -int drm_remove_magic(drm_device_t *dev, drm_magic_t magic) -{ - drm_magic_entry_t *prev = NULL; - drm_magic_entry_t *pt; - int hash; - - DRM_DEBUG("%d\n", magic); - hash = drm_hash_magic(magic); - - down(&dev->struct_sem); - for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) { - if (pt->magic == magic) { - if (dev->magiclist[hash].head == pt) { - dev->magiclist[hash].head = pt->next; - } - if (dev->magiclist[hash].tail == pt) { - dev->magiclist[hash].tail = prev; - } - if (prev) { - prev->next = pt->next; - } - up(&dev->struct_sem); - return 0; - } - } - up(&dev->struct_sem); - - drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); - - return -EINVAL; -} - -int drm_getmagic(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - static drm_magic_t sequence = 0; - static spinlock_t lock = SPIN_LOCK_UNLOCKED; - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_auth_t auth; - - /* Find unique magic */ - if (priv->magic) { - auth.magic = priv->magic; - } else { - do { - spin_lock(&lock); - if (!sequence) ++sequence; /* reserve 0 */ - auth.magic = sequence++; - spin_unlock(&lock); - } while (drm_find_file(dev, auth.magic)); - priv->magic = auth.magic; - drm_add_magic(dev, priv, auth.magic); - } - - DRM_DEBUG("%u\n", auth.magic); - if (copy_to_user((drm_auth_t *)arg, &auth, sizeof(auth))) - return -EFAULT; - return 0; -} - -int drm_authmagic(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_auth_t auth; - drm_file_t *file; - - if (copy_from_user(&auth, (drm_auth_t *)arg, sizeof(auth))) - return -EFAULT; - DRM_DEBUG("%u\n", auth.magic); - if ((file = drm_find_file(dev, auth.magic))) { - file->authenticated = 1; - drm_remove_magic(dev, auth.magic); - return 0; - } - return -EINVAL; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c:1.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c:1.10 Tue Sep 26 12:21:23 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/bufs.c Mon Jun 4 12:41:26 2001 @@ -1,537 +0,0 @@ -/* bufs.c -- IOCTLs to manage buffers -*- linux-c -*- - * Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com - * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#define __NO_VERSION__ -#include <linux/config.h> -#include "drmP.h" -#include "linux/un.h" - - /* Compute order. Can be made faster. */ -int drm_order(unsigned long size) -{ - int order; - unsigned long tmp; - - for (order = 0, tmp = size; tmp >>= 1; ++order); - if (size & ~(1 << order)) ++order; - return order; -} - -int drm_addmap(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_map_t *map; - - if (!(filp->f_mode & 3)) return -EACCES; /* Require read/write */ - - map = drm_alloc(sizeof(*map), DRM_MEM_MAPS); - if (!map) return -ENOMEM; - if (copy_from_user(map, (drm_map_t *)arg, sizeof(*map))) { - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - return -EFAULT; - } - - DRM_DEBUG("offset = 0x%08lx, size = 0x%08lx, type = %d\n", - map->offset, map->size, map->type); - if ((map->offset & (~PAGE_MASK)) || (map->size & (~PAGE_MASK))) { - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - return -EINVAL; - } - map->mtrr = -1; - map->handle = 0; - - switch (map->type) { - case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: -#ifndef __sparc__ - if (map->offset + map->size < map->offset - || map->offset < virt_to_phys(high_memory)) { - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - return -EINVAL; - } -#endif -#ifdef CONFIG_MTRR - if (map->type == _DRM_FRAME_BUFFER - || (map->flags & _DRM_WRITE_COMBINING)) { - map->mtrr = mtrr_add(map->offset, map->size, - MTRR_TYPE_WRCOMB, 1); - } -#endif - map->handle = drm_ioremap(map->offset, map->size); - break; - - - case _DRM_SHM: - map->handle = (void *)drm_alloc_pages(drm_order(map->size) - - PAGE_SHIFT, - DRM_MEM_SAREA); - DRM_DEBUG("%ld %d %p\n", map->size, drm_order(map->size), - map->handle); - if (!map->handle) { - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - return -ENOMEM; - } - map->offset = (unsigned long)map->handle; - if (map->flags & _DRM_CONTAINS_LOCK) { - dev->lock.hw_lock = map->handle; /* Pointer to lock */ - } - break; -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - case _DRM_AGP: - map->offset = map->offset + dev->agp->base; - break; -#endif - default: - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - return -EINVAL; - } - - down(&dev->struct_sem); - if (dev->maplist) { - ++dev->map_count; - dev->maplist = drm_realloc(dev->maplist, - (dev->map_count-1) - * sizeof(*dev->maplist), - dev->map_count - * sizeof(*dev->maplist), - DRM_MEM_MAPS); - } else { - dev->map_count = 1; - dev->maplist = drm_alloc(dev->map_count*sizeof(*dev->maplist), - DRM_MEM_MAPS); - } - dev->maplist[dev->map_count-1] = map; - up(&dev->struct_sem); - - if (copy_to_user((drm_map_t *)arg, map, sizeof(*map))) - return -EFAULT; - if (map->type != _DRM_SHM) { - if (copy_to_user(&((drm_map_t *)arg)->handle, - &map->offset, - sizeof(map->offset))) - return -EFAULT; - } - return 0; -} - -int drm_addbufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - int count; - int order; - int size; - int total; - int page_order; - drm_buf_entry_t *entry; - unsigned long page; - drm_buf_t *buf; - int alignment; - unsigned long offset; - int i; - int byte_count; - int page_count; - - if (!dma) return -EINVAL; - - if (copy_from_user(&request, - (drm_buf_desc_t *)arg, - sizeof(request))) - return -EFAULT; - - count = request.count; - order = drm_order(request.size); - size = 1 << order; - - DRM_DEBUG("count = %d, size = %d (%d), order = %d, queue_count = %d\n", - request.count, request.size, size, order, dev->queue_count); - - if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL; - if (dev->queue_count) return -EBUSY; /* Not while in use */ - - alignment = (request.flags & _DRM_PAGE_ALIGN) ? PAGE_ALIGN(size):size; - page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; - total = PAGE_SIZE << page_order; - - spin_lock(&dev->count_lock); - if (dev->buf_use) { - spin_unlock(&dev->count_lock); - return -EBUSY; - } - atomic_inc(&dev->buf_alloc); - spin_unlock(&dev->count_lock); - - down(&dev->struct_sem); - entry = &dma->bufs[order]; - if (entry->buf_count) { - up(&dev->struct_sem); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; /* May only call once for each order */ - } - - entry->buflist = drm_alloc(count * sizeof(*entry->buflist), - DRM_MEM_BUFS); - if (!entry->buflist) { - up(&dev->struct_sem); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; - } - memset(entry->buflist, 0, count * sizeof(*entry->buflist)); - - entry->seglist = drm_alloc(count * sizeof(*entry->seglist), - DRM_MEM_SEGS); - if (!entry->seglist) { - drm_free(entry->buflist, - count * sizeof(*entry->buflist), - DRM_MEM_BUFS); - up(&dev->struct_sem); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; - } - memset(entry->seglist, 0, count * sizeof(*entry->seglist)); - - dma->pagelist = drm_realloc(dma->pagelist, - dma->page_count * sizeof(*dma->pagelist), - (dma->page_count + (count << page_order)) - * sizeof(*dma->pagelist), - DRM_MEM_PAGES); - DRM_DEBUG("pagelist: %d entries\n", - dma->page_count + (count << page_order)); - - - entry->buf_size = size; - entry->page_order = page_order; - byte_count = 0; - page_count = 0; - while (entry->buf_count < count) { - if (!(page = drm_alloc_pages(page_order, DRM_MEM_DMA))) break; - entry->seglist[entry->seg_count++] = page; - for (i = 0; i < (1 << page_order); i++) { - DRM_DEBUG("page %d @ 0x%08lx\n", - dma->page_count + page_count, - page + PAGE_SIZE * i); - dma->pagelist[dma->page_count + page_count++] - = page + PAGE_SIZE * i; - } - for (offset = 0; - offset + size <= total && entry->buf_count < count; - offset += alignment, ++entry->buf_count) { - buf = &entry->buflist[entry->buf_count]; - buf->idx = dma->buf_count + entry->buf_count; - buf->total = alignment; - buf->order = order; - buf->used = 0; - buf->offset = (dma->byte_count + byte_count + offset); - buf->address = (void *)(page + offset); - buf->next = NULL; - buf->waiting = 0; - buf->pending = 0; - init_waitqueue_head(&buf->dma_wait); - buf->pid = 0; -#if DRM_DMA_HISTOGRAM - buf->time_queued = 0; - buf->time_dispatched = 0; - buf->time_completed = 0; - buf->time_freed = 0; -#endif - DRM_DEBUG("buffer %d @ %p\n", - entry->buf_count, buf->address); - } - byte_count += PAGE_SIZE << page_order; - } - - dma->buflist = drm_realloc(dma->buflist, - dma->buf_count * sizeof(*dma->buflist), - (dma->buf_count + entry->buf_count) - * sizeof(*dma->buflist), - DRM_MEM_BUFS); - for (i = dma->buf_count; i < dma->buf_count + entry->buf_count; i++) - dma->buflist[i] = &entry->buflist[i - dma->buf_count]; - - dma->buf_count += entry->buf_count; - dma->seg_count += entry->seg_count; - dma->page_count += entry->seg_count << page_order; - dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order); - - 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]); - } - - up(&dev->struct_sem); - - request.count = entry->buf_count; - request.size = size; - - if (copy_to_user((drm_buf_desc_t *)arg, - &request, - sizeof(request))) - return -EFAULT; - - atomic_dec(&dev->buf_alloc); - return 0; -} - -int drm_infobufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_info_t request; - int i; - int count; - - if (!dma) return -EINVAL; - - spin_lock(&dev->count_lock); - if (atomic_read(&dev->buf_alloc)) { - spin_unlock(&dev->count_lock); - return -EBUSY; - } - ++dev->buf_use; /* Can't allocate more after this call */ - spin_unlock(&dev->count_lock); - - if (copy_from_user(&request, - (drm_buf_info_t *)arg, - sizeof(request))) - return -EFAULT; - - for (i = 0, count = 0; i < DRM_MAX_ORDER+1; i++) { - if (dma->bufs[i].buf_count) ++count; - } - - DRM_DEBUG("count = %d\n", count); - - if (request.count >= count) { - for (i = 0, count = 0; i < DRM_MAX_ORDER+1; i++) { - if (dma->bufs[i].buf_count) { - if (copy_to_user(&request.list[count].count, - &dma->bufs[i].buf_count, - sizeof(dma->bufs[0] - .buf_count)) || - copy_to_user(&request.list[count].size, - &dma->bufs[i].buf_size, - sizeof(dma->bufs[0].buf_size)) || - copy_to_user(&request.list[count].low_mark, - &dma->bufs[i] - .freelist.low_mark, - sizeof(dma->bufs[0] - .freelist.low_mark)) || - copy_to_user(&request.list[count] - .high_mark, - &dma->bufs[i] - .freelist.high_mark, - sizeof(dma->bufs[0] - .freelist.high_mark))) - return -EFAULT; - - DRM_DEBUG("%d %d %d %d %d\n", - i, - dma->bufs[i].buf_count, - dma->bufs[i].buf_size, - dma->bufs[i].freelist.low_mark, - dma->bufs[i].freelist.high_mark); - ++count; - } - } - } - request.count = count; - - if (copy_to_user((drm_buf_info_t *)arg, - &request, - sizeof(request))) - return -EFAULT; - - return 0; -} - -int drm_markbufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - int order; - drm_buf_entry_t *entry; - - if (!dma) return -EINVAL; - - if (copy_from_user(&request, - (drm_buf_desc_t *)arg, - sizeof(request))) - return -EFAULT; - - DRM_DEBUG("%d, %d, %d\n", - request.size, request.low_mark, request.high_mark); - order = drm_order(request.size); - if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL; - entry = &dma->bufs[order]; - - if (request.low_mark < 0 || request.low_mark > entry->buf_count) - return -EINVAL; - if (request.high_mark < 0 || request.high_mark > entry->buf_count) - return -EINVAL; - - entry->freelist.low_mark = request.low_mark; - entry->freelist.high_mark = request.high_mark; - - return 0; -} - -int drm_freebufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_free_t request; - int i; - int idx; - drm_buf_t *buf; - - if (!dma) return -EINVAL; - - if (copy_from_user(&request, - (drm_buf_free_t *)arg, - sizeof(request))) - return -EFAULT; - - DRM_DEBUG("%d\n", request.count); - for (i = 0; i < request.count; i++) { - if (copy_from_user(&idx, - &request.list[i], - sizeof(idx))) - return -EFAULT; - if (idx < 0 || idx >= dma->buf_count) { - DRM_ERROR("Index %d (of %d max)\n", - idx, dma->buf_count - 1); - return -EINVAL; - } - buf = dma->buflist[idx]; - if (buf->pid != current->pid) { - DRM_ERROR("Process %d freeing buffer owned by %d\n", - current->pid, buf->pid); - return -EINVAL; - } - drm_free_buffer(dev, buf); - } - - return 0; -} - -int drm_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - int retcode = 0; - const int zero = 0; - unsigned long virtual; - unsigned long address; - drm_buf_map_t request; - int i; - - if (!dma) return -EINVAL; - - DRM_DEBUG("\n"); - - spin_lock(&dev->count_lock); - if (atomic_read(&dev->buf_alloc)) { - spin_unlock(&dev->count_lock); - return -EBUSY; - } - ++dev->buf_use; /* Can't allocate more after this call */ - spin_unlock(&dev->count_lock); - - if (copy_from_user(&request, - (drm_buf_map_t *)arg, - sizeof(request))) - return -EFAULT; - - if (request.count >= dma->buf_count) { - down(¤t->mm->mmap_sem); - virtual = do_mmap(filp, 0, dma->byte_count, - PROT_READ|PROT_WRITE, MAP_SHARED, 0); - up(¤t->mm->mmap_sem); - if (virtual > -1024UL) { - /* Real error */ - retcode = (signed long)virtual; - goto done; - } - request.virtual = (void *)virtual; - - for (i = 0; i < dma->buf_count; i++) { - if (copy_to_user(&request.list[i].idx, - &dma->buflist[i]->idx, - sizeof(request.list[0].idx))) { - retcode = -EFAULT; - goto done; - } - if (copy_to_user(&request.list[i].total, - &dma->buflist[i]->total, - sizeof(request.list[0].total))) { - retcode = -EFAULT; - goto done; - } - if (copy_to_user(&request.list[i].used, - &zero, - sizeof(zero))) { - retcode = -EFAULT; - goto done; - } - address = virtual + dma->buflist[i]->offset; - if (copy_to_user(&request.list[i].address, - &address, - sizeof(address))) { - retcode = -EFAULT; - goto done; - } - } - } -done: - request.count = dma->buf_count; - DRM_DEBUG("%d buffers, retcode = %d\n", request.count, retcode); - - if (copy_to_user((drm_buf_map_t *)arg, - &request, - sizeof(request))) - return -EFAULT; - - return retcode; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h:1.4 Fri Dec 1 09:29:01 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/compat-pre24.h Wed Mar 21 13:08:54 2001 @@ -42,4 +42,10 @@ #define __exit #endif + /* This is a hack that only works for + this code base -- because we always + call this with dev->tq.* */ +#undef INIT_LIST_HEAD +#define INIT_LIST_HEAD(pointer) dev->tq.next = NULL + #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c:1.6 Tue Sep 26 12:21:23 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/context.c Mon Jun 4 12:41:26 2001 @@ -1,318 +0,0 @@ -/* context.c -- IOCTLs for contexts and DMA queues -*- linux-c -*- - * Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" - -static int drm_init_queue(drm_device_t *dev, drm_queue_t *q, drm_ctx_t *ctx) -{ - DRM_DEBUG("\n"); - - if (atomic_read(&q->use_count) != 1 - || atomic_read(&q->finalization) - || atomic_read(&q->block_count)) { - DRM_ERROR("New queue is already in use: u%d f%d b%d\n", - atomic_read(&q->use_count), - atomic_read(&q->finalization), - atomic_read(&q->block_count)); - } - - atomic_set(&q->finalization, 0); - atomic_set(&q->block_count, 0); - atomic_set(&q->block_read, 0); - atomic_set(&q->block_write, 0); - atomic_set(&q->total_queued, 0); - atomic_set(&q->total_flushed, 0); - atomic_set(&q->total_locks, 0); - - init_waitqueue_head(&q->write_queue); - init_waitqueue_head(&q->read_queue); - init_waitqueue_head(&q->flush_queue); - - q->flags = ctx->flags; - - drm_waitlist_create(&q->waitlist, dev->dma->buf_count); - - return 0; -} - - -/* drm_alloc_queue: -PRE: 1) dev->queuelist[0..dev->queue_count] is allocated and will not - disappear (so all deallocation must be done after IOCTLs are off) - 2) dev->queue_count < dev->queue_slots - 3) dev->queuelist[i].use_count == 0 and - dev->queuelist[i].finalization == 0 if i not in use -POST: 1) dev->queuelist[i].use_count == 1 - 2) dev->queue_count < dev->queue_slots */ - -static int drm_alloc_queue(drm_device_t *dev) -{ - int i; - drm_queue_t *queue; - int oldslots; - int newslots; - /* Check for a free queue */ - for (i = 0; i < dev->queue_count; i++) { - atomic_inc(&dev->queuelist[i]->use_count); - if (atomic_read(&dev->queuelist[i]->use_count) == 1 - && !atomic_read(&dev->queuelist[i]->finalization)) { - DRM_DEBUG("%d (free)\n", i); - return i; - } - atomic_dec(&dev->queuelist[i]->use_count); - } - /* Allocate a new queue */ - down(&dev->struct_sem); - - queue = drm_alloc(sizeof(*queue), DRM_MEM_QUEUES); - memset(queue, 0, sizeof(*queue)); - atomic_set(&queue->use_count, 1); - - ++dev->queue_count; - if (dev->queue_count >= dev->queue_slots) { - oldslots = dev->queue_slots * sizeof(*dev->queuelist); - if (!dev->queue_slots) dev->queue_slots = 1; - dev->queue_slots *= 2; - newslots = dev->queue_slots * sizeof(*dev->queuelist); - - dev->queuelist = drm_realloc(dev->queuelist, - oldslots, - newslots, - DRM_MEM_QUEUES); - if (!dev->queuelist) { - up(&dev->struct_sem); - DRM_DEBUG("out of memory\n"); - return -ENOMEM; - } - } - dev->queuelist[dev->queue_count-1] = queue; - - up(&dev->struct_sem); - DRM_DEBUG("%d (new)\n", dev->queue_count - 1); - return dev->queue_count - 1; -} - -int drm_resctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_res_t res; - drm_ctx_t ctx; - int i; - - DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); - if (copy_from_user(&res, (drm_ctx_res_t *)arg, sizeof(res))) - return -EFAULT; - if (res.count >= DRM_RESERVED_CONTEXTS) { - memset(&ctx, 0, sizeof(ctx)); - for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { - ctx.handle = i; - if (copy_to_user(&res.contexts[i], - &i, - sizeof(i))) - return -EFAULT; - } - } - res.count = DRM_RESERVED_CONTEXTS; - if (copy_to_user((drm_ctx_res_t *)arg, &res, sizeof(res))) - return -EFAULT; - return 0; -} - - -int drm_addctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - if ((ctx.handle = drm_alloc_queue(dev)) == DRM_KERNEL_CONTEXT) { - /* Init kernel's context and get a new one. */ - drm_init_queue(dev, dev->queuelist[ctx.handle], &ctx); - ctx.handle = drm_alloc_queue(dev); - } - drm_init_queue(dev, dev->queuelist[ctx.handle], &ctx); - DRM_DEBUG("%d\n", ctx.handle); - if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx))) - return -EFAULT; - return 0; -} - -int drm_modctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - drm_queue_t *q; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - - DRM_DEBUG("%d\n", ctx.handle); - - if (ctx.handle < 0 || ctx.handle >= dev->queue_count) return -EINVAL; - q = dev->queuelist[ctx.handle]; - - atomic_inc(&q->use_count); - if (atomic_read(&q->use_count) == 1) { - /* No longer in use */ - atomic_dec(&q->use_count); - return -EINVAL; - } - - if (DRM_BUFCOUNT(&q->waitlist)) { - atomic_dec(&q->use_count); - return -EBUSY; - } - - q->flags = ctx.flags; - - atomic_dec(&q->use_count); - return 0; -} - -int drm_getctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - drm_queue_t *q; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - - DRM_DEBUG("%d\n", ctx.handle); - - if (ctx.handle >= dev->queue_count) return -EINVAL; - q = dev->queuelist[ctx.handle]; - - atomic_inc(&q->use_count); - if (atomic_read(&q->use_count) == 1) { - /* No longer in use */ - atomic_dec(&q->use_count); - return -EINVAL; - } - - ctx.flags = q->flags; - atomic_dec(&q->use_count); - - if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx))) - return -EFAULT; - - return 0; -} - -int drm_switchctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - return drm_context_switch(dev, dev->last_context, ctx.handle); -} - -int drm_newctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - drm_context_switch_complete(dev, ctx.handle); - - return 0; -} - -int drm_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - drm_queue_t *q; - drm_buf_t *buf; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - - if (ctx.handle >= dev->queue_count) return -EINVAL; - q = dev->queuelist[ctx.handle]; - - atomic_inc(&q->use_count); - if (atomic_read(&q->use_count) == 1) { - /* No longer in use */ - atomic_dec(&q->use_count); - return -EINVAL; - } - - atomic_inc(&q->finalization); /* Mark queue in finalization state */ - atomic_sub(2, &q->use_count); /* Mark queue as unused (pending - finalization) */ - - while (test_and_set_bit(0, &dev->interrupt_flag)) { - schedule(); - if (signal_pending(current)) { - clear_bit(0, &dev->interrupt_flag); - return -EINTR; - } - } - /* Remove queued buffers */ - while ((buf = drm_waitlist_get(&q->waitlist))) { - drm_free_buffer(dev, buf); - } - clear_bit(0, &dev->interrupt_flag); - - /* Wakeup blocked processes */ - wake_up_interruptible(&q->read_queue); - wake_up_interruptible(&q->write_queue); - wake_up_interruptible(&q->flush_queue); - - /* Finalization over. Queue is made - available when both use_count and - finalization become 0, which won't - happen until all the waiting processes - stop waiting. */ - atomic_dec(&q->finalization); - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c:1.2 Fri Jun 16 20:03:35 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ctxbitmap.c Mon Jun 4 12:41:26 2001 @@ -1,85 +0,0 @@ -/* ctxbitmap.c -- Context bitmap management -*- linux-c -*- - * Created: Thu Jan 6 03:56:42 2000 by jhartmann@precisioninsight.com - * - * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: Jeff Hartmann <jhartmann@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" - -void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle) -{ - if (ctx_handle < 0) goto failed; - - if (ctx_handle < DRM_MAX_CTXBITMAP) { - clear_bit(ctx_handle, dev->ctx_bitmap); - return; - } -failed: - DRM_ERROR("Attempt to free invalid context handle: %d\n", - ctx_handle); - return; -} - -int drm_ctxbitmap_next(drm_device_t *dev) -{ - int bit; - - bit = find_first_zero_bit(dev->ctx_bitmap, DRM_MAX_CTXBITMAP); - if (bit < DRM_MAX_CTXBITMAP) { - set_bit(bit, dev->ctx_bitmap); - DRM_DEBUG("drm_ctxbitmap_next bit : %d\n", bit); - return bit; - } - return -1; -} - -int drm_ctxbitmap_init(drm_device_t *dev) -{ - int i; - int temp; - - dev->ctx_bitmap = (unsigned long *) drm_alloc(PAGE_SIZE, - DRM_MEM_CTXBITMAP); - if(dev->ctx_bitmap == NULL) { - return -ENOMEM; - } - memset((void *) dev->ctx_bitmap, 0, PAGE_SIZE); - for(i = 0; i < DRM_RESERVED_CONTEXTS; i++) { - temp = drm_ctxbitmap_next(dev); - DRM_DEBUG("drm_ctxbitmap_init : %d\n", temp); - } - - return 0; -} - -void drm_ctxbitmap_cleanup(drm_device_t *dev) -{ - drm_free((void *)dev->ctx_bitmap, PAGE_SIZE, - DRM_MEM_CTXBITMAP); -} - Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c:1.11 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c:1.11 Fri Dec 1 09:29:01 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dma.c Mon Jun 4 12:41:26 2001 @@ -1,543 +0,0 @@ -/* dma.c -- DMA IOCTL and function support -*- linux-c -*- - * Created: Fri Mar 19 14:30:16 1999 by faith@precisioninsight.com - * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinuxa.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" - -#include <linux/interrupt.h> /* For task queue support */ - -void drm_dma_setup(drm_device_t *dev) -{ - int i; - - dev->dma = drm_alloc(sizeof(*dev->dma), DRM_MEM_DRIVER); - memset(dev->dma, 0, sizeof(*dev->dma)); - for (i = 0; i <= DRM_MAX_ORDER; i++) - memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0])); -} - -void drm_dma_takedown(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - int i, j; - - if (!dma) return; - - /* Clear dma buffers */ - for (i = 0; i <= DRM_MAX_ORDER; i++) { - if (dma->bufs[i].seg_count) { - DRM_DEBUG("order %d: buf_count = %d," - " seg_count = %d\n", - i, - dma->bufs[i].buf_count, - dma->bufs[i].seg_count); - for (j = 0; j < dma->bufs[i].seg_count; j++) { - drm_free_pages(dma->bufs[i].seglist[j], - dma->bufs[i].page_order, - DRM_MEM_DMA); - } - drm_free(dma->bufs[i].seglist, - dma->bufs[i].seg_count - * sizeof(*dma->bufs[0].seglist), - DRM_MEM_SEGS); - } - if(dma->bufs[i].buf_count) { - for(j = 0; j < dma->bufs[i].buf_count; j++) { - if(dma->bufs[i].buflist[j].dev_private) { - drm_free(dma->bufs[i].buflist[j].dev_private, - dma->bufs[i].buflist[j].dev_priv_size, - DRM_MEM_BUFS); - } - } - drm_free(dma->bufs[i].buflist, - dma->bufs[i].buf_count * - sizeof(*dma->bufs[0].buflist), - DRM_MEM_BUFS); - drm_freelist_destroy(&dma->bufs[i].freelist); - } - } - - if (dma->buflist) { - drm_free(dma->buflist, - dma->buf_count * sizeof(*dma->buflist), - DRM_MEM_BUFS); - } - - if (dma->pagelist) { - drm_free(dma->pagelist, - dma->page_count * sizeof(*dma->pagelist), - DRM_MEM_PAGES); - } - drm_free(dev->dma, sizeof(*dev->dma), DRM_MEM_DRIVER); - dev->dma = NULL; -} - -#if DRM_DMA_HISTOGRAM -/* This is slow, but is useful for debugging. */ -int drm_histogram_slot(unsigned long count) -{ - int value = DRM_DMA_HISTOGRAM_INITIAL; - int slot; - - for (slot = 0; - slot < DRM_DMA_HISTOGRAM_SLOTS; - ++slot, value = DRM_DMA_HISTOGRAM_NEXT(value)) { - if (count < value) return slot; - } - return DRM_DMA_HISTOGRAM_SLOTS - 1; -} - -void drm_histogram_compute(drm_device_t *dev, drm_buf_t *buf) -{ - cycles_t queued_to_dispatched; - cycles_t dispatched_to_completed; - cycles_t completed_to_freed; - int q2d, d2c, c2f, q2c, q2f; - - if (buf->time_queued) { - queued_to_dispatched = (buf->time_dispatched - - buf->time_queued); - dispatched_to_completed = (buf->time_completed - - buf->time_dispatched); - completed_to_freed = (buf->time_freed - - buf->time_completed); - - q2d = drm_histogram_slot(queued_to_dispatched); - d2c = drm_histogram_slot(dispatched_to_completed); - c2f = drm_histogram_slot(completed_to_freed); - - q2c = drm_histogram_slot(queued_to_dispatched - + dispatched_to_completed); - q2f = drm_histogram_slot(queued_to_dispatched - + dispatched_to_completed - + completed_to_freed); - - atomic_inc(&dev->histo.total); - atomic_inc(&dev->histo.queued_to_dispatched[q2d]); - atomic_inc(&dev->histo.dispatched_to_completed[d2c]); - atomic_inc(&dev->histo.completed_to_freed[c2f]); - - atomic_inc(&dev->histo.queued_to_completed[q2c]); - atomic_inc(&dev->histo.queued_to_freed[q2f]); - - } - buf->time_queued = 0; - buf->time_dispatched = 0; - buf->time_completed = 0; - buf->time_freed = 0; -} -#endif - -void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf) -{ - drm_device_dma_t *dma = dev->dma; - - if (!buf) return; - - buf->waiting = 0; - buf->pending = 0; - buf->pid = 0; - buf->used = 0; -#if DRM_DMA_HISTOGRAM - buf->time_completed = get_cycles(); -#endif - if (waitqueue_active(&buf->dma_wait)) { - wake_up_interruptible(&buf->dma_wait); - } else { - /* If processes are waiting, the last one - to wake will put the buffer on the free - list. If no processes are waiting, we - put the buffer on the freelist here. */ - drm_freelist_put(dev, &dma->bufs[buf->order].freelist, buf); - } -} - -void drm_reclaim_buffers(drm_device_t *dev, pid_t pid) -{ - drm_device_dma_t *dma = dev->dma; - int i; - - if (!dma) return; - for (i = 0; i < dma->buf_count; i++) { - if (dma->buflist[i]->pid == pid) { - switch (dma->buflist[i]->list) { - case DRM_LIST_NONE: - drm_free_buffer(dev, dma->buflist[i]); - break; - case DRM_LIST_WAIT: - dma->buflist[i]->list = DRM_LIST_RECLAIM; - break; - default: - /* Buffer already on hardware. */ - break; - } - } - } -} - -int drm_context_switch(drm_device_t *dev, int old, int new) -{ - char buf[64]; - drm_queue_t *q; - - atomic_inc(&dev->total_ctx); - - if (test_and_set_bit(0, &dev->context_flag)) { - DRM_ERROR("Reentering -- FIXME\n"); - return -EBUSY; - } - -#if DRM_DMA_HISTOGRAM - dev->ctx_start = get_cycles(); -#endif - - DRM_DEBUG("Context switch from %d to %d\n", old, new); - - if (new >= dev->queue_count) { - clear_bit(0, &dev->context_flag); - return -EINVAL; - } - - if (new == dev->last_context) { - clear_bit(0, &dev->context_flag); - return 0; - } - - q = dev->queuelist[new]; - atomic_inc(&q->use_count); - if (atomic_read(&q->use_count) == 1) { - atomic_dec(&q->use_count); - clear_bit(0, &dev->context_flag); - return -EINVAL; - } - - if (drm_flags & DRM_FLAG_NOCTX) { - drm_context_switch_complete(dev, new); - } else { - sprintf(buf, "C %d %d\n", old, new); - drm_write_string(dev, buf); - } - - atomic_dec(&q->use_count); - - return 0; -} - -int drm_context_switch_complete(drm_device_t *dev, int new) -{ - drm_device_dma_t *dma = dev->dma; - - dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ - dev->last_switch = jiffies; - - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("Lock isn't held after context switch\n"); - } - - if (!dma || !(dma->next_buffer && dma->next_buffer->while_locked)) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("Cannot free lock\n"); - } - } - -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.ctx[drm_histogram_slot(get_cycles() - - dev->ctx_start)]); - -#endif - clear_bit(0, &dev->context_flag); - wake_up_interruptible(&dev->context_wait); - - return 0; -} - -void drm_clear_next_buffer(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - - dma->next_buffer = NULL; - if (dma->next_queue && !DRM_BUFCOUNT(&dma->next_queue->waitlist)) { - wake_up_interruptible(&dma->next_queue->flush_queue); - } - dma->next_queue = NULL; -} - - -int drm_select_queue(drm_device_t *dev, void (*wrapper)(unsigned long)) -{ - int i; - int candidate = -1; - int j = jiffies; - - if (!dev) { - DRM_ERROR("No device\n"); - return -1; - } - if (!dev->queuelist || !dev->queuelist[DRM_KERNEL_CONTEXT]) { - /* This only happens between the time the - interrupt is initialized and the time - the queues are initialized. */ - return -1; - } - - /* Doing "while locked" DMA? */ - if (DRM_WAITCOUNT(dev, DRM_KERNEL_CONTEXT)) { - return DRM_KERNEL_CONTEXT; - } - - /* If there are buffers on the last_context - queue, and we have not been executing - this context very long, continue to - execute this context. */ - if (dev->last_switch <= j - && dev->last_switch + DRM_TIME_SLICE > j - && DRM_WAITCOUNT(dev, dev->last_context)) { - return dev->last_context; - } - - /* Otherwise, find a candidate */ - for (i = dev->last_checked + 1; i < dev->queue_count; i++) { - if (DRM_WAITCOUNT(dev, i)) { - candidate = dev->last_checked = i; - break; - } - } - - if (candidate < 0) { - for (i = 0; i < dev->queue_count; i++) { - if (DRM_WAITCOUNT(dev, i)) { - candidate = dev->last_checked = i; - break; - } - } - } - - if (wrapper - && candidate >= 0 - && candidate != dev->last_context - && dev->last_switch <= j - && dev->last_switch + DRM_TIME_SLICE > j) { - if (dev->timer.expires != dev->last_switch + DRM_TIME_SLICE) { - del_timer(&dev->timer); - dev->timer.function = wrapper; - dev->timer.data = (unsigned long)dev; - dev->timer.expires = dev->last_switch+DRM_TIME_SLICE; - add_timer(&dev->timer); - } - return -1; - } - - return candidate; -} - - -int drm_dma_enqueue(drm_device_t *dev, drm_dma_t *d) -{ - int i; - drm_queue_t *q; - drm_buf_t *buf; - int idx; - int while_locked = 0; - drm_device_dma_t *dma = dev->dma; - DECLARE_WAITQUEUE(entry, current); - - DRM_DEBUG("%d\n", d->send_count); - - if (d->flags & _DRM_DMA_WHILE_LOCKED) { - int context = dev->lock.hw_lock->lock; - - if (!_DRM_LOCK_IS_HELD(context)) { - DRM_ERROR("No lock held during \"while locked\"" - " request\n"); - return -EINVAL; - } - if (d->context != _DRM_LOCKING_CONTEXT(context) - && _DRM_LOCKING_CONTEXT(context) != DRM_KERNEL_CONTEXT) { - DRM_ERROR("Lock held by %d while %d makes" - " \"while locked\" request\n", - _DRM_LOCKING_CONTEXT(context), - d->context); - return -EINVAL; - } - q = dev->queuelist[DRM_KERNEL_CONTEXT]; - while_locked = 1; - } else { - q = dev->queuelist[d->context]; - } - - - atomic_inc(&q->use_count); - if (atomic_read(&q->block_write)) { - add_wait_queue(&q->write_queue, &entry); - atomic_inc(&q->block_count); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!atomic_read(&q->block_write)) break; - schedule(); - if (signal_pending(current)) { - atomic_dec(&q->use_count); - remove_wait_queue(&q->write_queue, &entry); - return -EINTR; - } - } - atomic_dec(&q->block_count); - current->state = TASK_RUNNING; - remove_wait_queue(&q->write_queue, &entry); - } - - for (i = 0; i < d->send_count; i++) { - idx = d->send_indices[i]; - if (idx < 0 || idx >= dma->buf_count) { - atomic_dec(&q->use_count); - DRM_ERROR("Index %d (of %d max)\n", - d->send_indices[i], dma->buf_count - 1); - return -EINVAL; - } - buf = dma->buflist[ idx ]; - if (buf->pid != current->pid) { - atomic_dec(&q->use_count); - DRM_ERROR("Process %d using buffer owned by %d\n", - current->pid, buf->pid); - return -EINVAL; - } - if (buf->list != DRM_LIST_NONE) { - atomic_dec(&q->use_count); - DRM_ERROR("Process %d using buffer %d on list %d\n", - current->pid, buf->idx, buf->list); - } - buf->used = d->send_sizes[i]; - buf->while_locked = while_locked; - buf->context = d->context; - if (!buf->used) { - DRM_ERROR("Queueing 0 length buffer\n"); - } - if (buf->pending) { - atomic_dec(&q->use_count); - DRM_ERROR("Queueing pending buffer:" - " buffer %d, offset %d\n", - d->send_indices[i], i); - return -EINVAL; - } - if (buf->waiting) { - atomic_dec(&q->use_count); - DRM_ERROR("Queueing waiting buffer:" - " buffer %d, offset %d\n", - d->send_indices[i], i); - return -EINVAL; - } - buf->waiting = 1; - if (atomic_read(&q->use_count) == 1 - || atomic_read(&q->finalization)) { - drm_free_buffer(dev, buf); - } else { - drm_waitlist_put(&q->waitlist, buf); - atomic_inc(&q->total_queued); - } - } - atomic_dec(&q->use_count); - - return 0; -} - -static int drm_dma_get_buffers_of_order(drm_device_t *dev, drm_dma_t *d, - int order) -{ - int i; - drm_buf_t *buf; - drm_device_dma_t *dma = dev->dma; - - for (i = d->granted_count; i < d->request_count; i++) { - buf = drm_freelist_get(&dma->bufs[order].freelist, - d->flags & _DRM_DMA_WAIT); - if (!buf) break; - if (buf->pending || buf->waiting) { - DRM_ERROR("Free buffer %d in use by %d (w%d, p%d)\n", - buf->idx, - buf->pid, - buf->waiting, - buf->pending); - } - buf->pid = current->pid; - if (copy_to_user(&d->request_indices[i], - &buf->idx, - sizeof(buf->idx))) - return -EFAULT; - - if (copy_to_user(&d->request_sizes[i], - &buf->total, - sizeof(buf->total))) - return -EFAULT; - - ++d->granted_count; - } - return 0; -} - - -int drm_dma_get_buffers(drm_device_t *dev, drm_dma_t *dma) -{ - int order; - int retcode = 0; - int tmp_order; - - order = drm_order(dma->request_size); - - dma->granted_count = 0; - retcode = drm_dma_get_buffers_of_order(dev, dma, order); - - if (dma->granted_count < dma->request_count - && (dma->flags & _DRM_DMA_SMALLER_OK)) { - for (tmp_order = order - 1; - !retcode - && dma->granted_count < dma->request_count - && tmp_order >= DRM_MIN_ORDER; - --tmp_order) { - - retcode = drm_dma_get_buffers_of_order(dev, dma, - tmp_order); - } - } - - if (dma->granted_count < dma->request_count - && (dma->flags & _DRM_DMA_LARGER_OK)) { - for (tmp_order = order + 1; - !retcode - && dma->granted_count < dma->request_count - && tmp_order <= DRM_MAX_ORDER; - ++tmp_order) { - - retcode = drm_dma_get_buffers_of_order(dev, dma, - tmp_order); - } - } - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c:1.6 Tue Sep 26 12:21:23 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drawable.c Mon Jun 4 12:41:26 2001 @@ -1,51 +0,0 @@ -/* drawable.c -- IOCTLs for drawables -*- linux-c -*- - * Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" - -int drm_adddraw(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_draw_t draw; - - draw.handle = 0; /* NOOP */ - DRM_DEBUG("%d\n", draw.handle); - if (copy_to_user((drm_draw_t *)arg, &draw, sizeof(draw))) - return -EFAULT; - return 0; -} - -int drm_rmdraw(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - return 0; /* NOOP */ -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dristat.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dristat.c:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/dristat.c Wed Mar 21 13:08:55 2001 @@ -0,0 +1,280 @@ +/* dristat.c -- + * Created: Mon Jan 15 05:05:07 2001 by faith@acm.org + * + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: Rickard E. (Rik) Faith <faith@valinux.com> + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> +#include "../../../xf86drm.h" +#include "../xf86drmRandom.c" +#include "../xf86drmHash.c" +#include "../xf86drm.c" + +#define DRM_VERSION 0x00000001 +#define DRM_MEMORY 0x00000002 +#define DRM_CLIENTS 0x00000004 +#define DRM_STATS 0x00000008 +#define DRM_BUSID 0x00000010 + +static void getversion(int fd) +{ + drmVersionPtr version; + + version = drmGetVersion(fd); + if (version) { + printf(" Version information:\n"); + printf(" Name: %s\n", version->name ? version->name : "?"); + printf(" Version: %d.%d.%d\n", + version->version_major, + version->version_minor, + version->version_patchlevel); + printf(" Date: %s\n", version->date ? version->date : "?"); + printf(" Desc: %s\n", version->desc ? version->desc : "?"); + drmFreeVersion(version); + } else { + printf(" No version information available\n"); + } +} + +static void getbusid(int fd) +{ + const char *busid = drmGetBusid(fd); + + printf(" Busid: %s\n", *busid ? busid : "(not set)"); + drmFreeBusid(busid); +} + +#if 0 +typedef struct { + unsigned long offset; /* Requested physical address (0 for SAREA)*/ + unsigned long size; /* Requested physical size (bytes) */ + drm_map_type_t type; /* Type of memory to map */ + drm_map_flags_t flags; /* Flags */ + void *handle; /* User-space: "Handle" to pass to mmap */ + /* Kernel-space: kernel-virtual address */ + int mtrr; /* MTRR slot used */ + /* Private data */ +} drmVmRec, *drmVmPtr; +#endif + +static void getvm(int fd) +{ + int i; + const char *typename; + char flagname[33]; + drmHandle offset; + drmSize size; + drmMapType type; + drmMapFlags flags; + drmHandle handle; + int mtrr; + + printf(" VM map information (Restricted locked kernel WC Lock):\n"); + printf(" slot offset size type flags address mtrr\n"); + + for (i = 0; + !drmGetMap(fd, i, &offset, &size, &type, &flags, &handle, &mtrr); + i++) { + + switch (type) { + case DRM_FRAME_BUFFER: typename = "FB"; break; + case DRM_REGISTERS: typename = "REG"; break; + case DRM_SHM: typename = "SHM"; break; + case DRM_AGP: typename = "AGP"; break; + default: typename = "???"; break; + } + + flagname[0] = (flags & DRM_RESTRICTED) ? 'R' : ' '; + flagname[1] = (flags & DRM_READ_ONLY) ? 'r' : 'w'; + flagname[2] = (flags & DRM_LOCKED) ? 'l' : ' '; + flagname[3] = (flags & DRM_KERNEL) ? 'k' : ' '; + flagname[4] = (flags & DRM_WRITE_COMBINING) ? 'W' : ' '; + flagname[5] = (flags & DRM_CONTAINS_LOCK) ? 'L' : ' '; + flagname[6] = '\0'; + + printf(" %4d 0x%08lx 0x%08lx %3.3s %6.6s 0x%08lx ", + i, offset, (unsigned long)size, typename, flagname, handle); + if (mtrr < 0) printf("none\n"); + else printf("%4d\n", mtrr); + } +} + +static void getclients(int fd) +{ + int i; + int auth; + int pid; + int uid; + unsigned long magic; + unsigned long iocs; + char buf[64]; + char cmd[40]; + int procfd; + + printf(" DRI client information:\n"); + printf(" a pid uid magic ioctls prog\n"); + + for (i = 0; !drmGetClient(fd, i, &auth, &pid, &uid, &magic, &iocs); i++) { + sprintf(buf, "/proc/%d/cmdline", pid); + memset(cmd, sizeof(cmd), 0); + if ((procfd = open(buf, O_RDONLY, 0)) >= 0) { + read(procfd, cmd, sizeof(cmd)-1); + close(procfd); + } + if (*cmd) { + char *pt; + + for (pt = cmd; *pt; pt++) if (!isprint(*pt)) *pt = ' '; + printf(" %c %5d %5d %10lu %10lu %s\n", + auth ? 'y' : 'n', pid, uid, magic, iocs, cmd); + } else { + printf(" %c %5d %5d %10lu %10lu\n", + auth ? 'y' : 'n', pid, uid, magic, iocs); + } + } +} + +static void printhuman(unsigned long value, const char *name, int mult) +{ + const char *p; + double f; + /* Print width 5 number in width 6 space */ + if (value < 100000) { + printf(" %5lu", value); + return; + } + + p = name; + f = (double)value / (double)mult; + if (f < 10.0) { + printf(" %4.2f%c", f, *p); + return; + } + + p++; + f = (double)value / (double)mult; + if (f < 10.0) { + printf(" %4.2f%c", f, *p); + return; + } + + p++; + f = (double)value / (double)mult; + if (f < 10.0) { + printf(" %4.2f%c", f, *p); + return; + } +} + +static void getstats(int fd, int i) +{ + drmStatsT prev, curr; + int j; + double rate; + + printf(" System statistics:\n"); + + if (drmGetStats(fd, &prev)) return; + if (!i) { + for (j = 0; j < prev.count; j++) { + printf(" "); + printf(prev.data[j].long_format, prev.data[j].long_name); + if (prev.data[j].isvalue) printf(" 0x%08lx\n", prev.data[j].value); + else printf(" %10lu\n", prev.data[j].value); + } + return; + } + + printf(" "); + for (j = 0; j < prev.count; j++) + if (!prev.data[j].verbose) { + printf(" "); + printf(prev.data[j].rate_format, prev.data[j].rate_name); + } + printf("\n"); + + for (;;) { + sleep(i); + if (drmGetStats(fd, &curr)) return; + printf(" "); + for (j = 0; j < curr.count; j++) { + if (curr.data[j].verbose) continue; + if (curr.data[j].isvalue) { + printf(" %08lx", curr.data[j].value); + } else { + rate = (curr.data[j].value - prev.data[j].value) / (double)i; + printhuman(rate, curr.data[j].mult_names, curr.data[j].mult); + } + } + printf("\n"); + memcpy(&prev, &curr, sizeof(prev)); + } + +} + +int main(int argc, char **argv) +{ + int c; + int mask = 0; + int minor = 0; + int interval = 0; + int fd; + char buf[64]; + int i; + + while ((c = getopt(argc, argv, "avmcsbM:i:")) != EOF) + switch (c) { + case 'a': mask = ~0; break; + case 'v': mask |= DRM_VERSION; break; + case 'm': mask |= DRM_MEMORY; break; + case 'c': mask |= DRM_CLIENTS; break; + case 's': mask |= DRM_STATS; break; + case 'b': mask |= DRM_BUSID; break; + case 'i': interval = strtol(optarg, NULL, 0); break; + case 'M': minor = strtol(optarg, NULL, 0); break; + default: + fprintf( stderr, "Usage: dristat [options]\n" ); + return 1; + } + + for (i = 0; i < 16; i++) if (!minor || i == minor) { + sprintf(buf, DRM_DEV_NAME, DRM_DIR_NAME, i); + fd = drmOpenMinor(i, 1); + if (fd >= 0) { + printf("%s\n", buf); + if (mask & DRM_BUSID) getbusid(fd); + if (mask & DRM_VERSION) getversion(fd); + if (mask & DRM_MEMORY) getvm(fd); + if (mask & DRM_CLIENTS) getclients(fd); + if (mask & DRM_STATS) getstats(fd, interval); + close(fd); + } + } + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h:1.13 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h:1.18.2.2 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h:1.13 Mon Dec 4 14:21:58 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm.h Thu May 31 22:24:18 2001 @@ -19,10 +19,10 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> @@ -36,6 +36,7 @@ #define _DRM_H_ #if defined(__linux__) +#include <linux/config.h> #include <asm/ioctl.h> /* For _IO* macros */ #define DRM_IOCTL_NR(n) _IOC_NR(n) #elif defined(__FreeBSD__) @@ -43,6 +44,14 @@ #define DRM_IOCTL_NR(n) ((n) & 0xff) #endif +#define XFREE86_VERSION(major,minor,patch,snap) \ + ((major << 16) | (minor < 8) | patch) + +#ifndef CONFIG_XFREE86_VERSION +#define CONFIG_XFREE86_VERSION XFREE86_VERSION(4,1,0,0) +#endif + +#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) #define DRM_PROC_DEVICES "/proc/devices" #define DRM_PROC_MISC "/proc/misc" #define DRM_PROC_DRM "/proc/drm" @@ -50,8 +59,12 @@ #define DRM_DEV_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP) #define DRM_DEV_UID 0 #define DRM_DEV_GID 0 - +#endif +#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0) +#define DRM_MAJOR 226 +#define DRM_MAX_MINOR 15 +#endif #define DRM_NAME "drm" /* Name in kernel, /dev, and /proc */ #define DRM_MIN_ORDER 5 /* At least 2^5 bytes = 32 bytes */ #define DRM_MAX_ORDER 22 /* Up to 2^22 bytes = 4MB */ @@ -72,17 +85,28 @@ * XF86DRIClipRectRec in the server as well */ typedef struct drm_clip_rect { - unsigned short x1; - unsigned short y1; - unsigned short x2; - unsigned short y2; + unsigned short x1; + unsigned short y1; + unsigned short x2; + unsigned short y2; } drm_clip_rect_t; +typedef struct drm_tex_region { + unsigned char next; + unsigned char prev; + unsigned char in_use; + unsigned char padding; + unsigned int age; +} drm_tex_region_t; + /* Seperate include files for the i810/mga/r128 specific structures */ #include "mga_drm.h" #include "i810_drm.h" #include "r128_drm.h" +#include "radeon_drm.h" +#ifdef CONFIG_DRM_SIS #include "sis_drm.h" +#endif typedef struct drm_version { int version_major; /* Major version */ @@ -121,10 +145,11 @@ } 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 { @@ -133,9 +158,15 @@ _DRM_LOCKED = 0x04, /* shared, cached, locked */ _DRM_KERNEL = 0x08, /* kernel requires access */ _DRM_WRITE_COMBINING = 0x10, /* use write-combining if available */ - _DRM_CONTAINS_LOCK = 0x20 /* SHM page that contains lock */ + _DRM_CONTAINS_LOCK = 0x20, /* SHM page that contains lock */ + _DRM_REMOVABLE = 0x40 /* Removable mapping */ } drm_map_flags_t; +typedef struct drm_ctx_priv_map { + unsigned int ctx_id; /* Context requesting private mapping */ + void *handle; /* Handle of map */ +} drm_ctx_priv_map_t; + typedef struct drm_map { unsigned long offset; /* Requested physical address (0 for SAREA)*/ unsigned long size; /* Requested physical size (bytes) */ @@ -147,6 +178,44 @@ /* Private data */ } drm_map_t; +typedef struct drm_client { + int idx; /* Which client desired? */ + int auth; /* Is client authenticated? */ + unsigned long pid; /* Process id */ + unsigned long uid; /* User id */ + unsigned long magic; /* Magic */ + unsigned long iocs; /* Ioctl count */ +} drm_client_t; + +typedef enum { + _DRM_STAT_LOCK, + _DRM_STAT_OPENS, + _DRM_STAT_CLOSES, + _DRM_STAT_IOCTLS, + _DRM_STAT_LOCKS, + _DRM_STAT_UNLOCKS, + _DRM_STAT_VALUE, /* Generic value */ + _DRM_STAT_BYTE, /* Generic byte counter (1024bytes/K) */ + _DRM_STAT_COUNT, /* Generic non-byte counter (1000/k) */ + + _DRM_STAT_IRQ, /* IRQ */ + _DRM_STAT_PRIMARY, /* Primary DMA bytes */ + _DRM_STAT_SECONDARY, /* Secondary DMA bytes */ + _DRM_STAT_DMA, /* DMA */ + _DRM_STAT_SPECIAL, /* Special DMA (e.g., priority or polled) */ + _DRM_STAT_MISSED /* Missed DMA opportunity */ + + /* Add to the *END* of the list */ +} drm_stat_type_t; + +typedef struct drm_stats { + unsigned long count; + struct { + unsigned long value; + drm_stat_type_t type; + } data[15]; +} drm_stats_t; + typedef enum drm_lock_flags { _DRM_LOCK_READY = 0x01, /* Wait until hardware is ready for DMA */ _DRM_LOCK_QUIESCENT = 0x02, /* Wait until hardware quiescent */ @@ -189,7 +258,8 @@ 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 */ @@ -295,97 +365,134 @@ unsigned short id_device; } drm_agp_info_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) -#define DRM_IOW(nr,size) _IOW(DRM_IOCTL_BASE,nr,size) -#define DRM_IOWR(nr,size) _IOWR(DRM_IOCTL_BASE,nr,size) - - -#define DRM_IOCTL_VERSION DRM_IOWR(0x00, drm_version_t) -#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t) -#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t) -#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, drm_irq_busid_t) - -#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t) -#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t) -#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, drm_block_t) -#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, drm_block_t) -#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, drm_control_t) -#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, drm_map_t) -#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, drm_buf_desc_t) -#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, drm_buf_desc_t) -#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, drm_buf_info_t) -#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm_buf_map_t) -#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm_buf_free_t) - -#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t) -#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t) -#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, drm_ctx_t) -#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, drm_ctx_t) -#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, drm_ctx_t) -#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, drm_ctx_t) -#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, drm_ctx_res_t) -#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, drm_draw_t) -#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, drm_draw_t) -#define DRM_IOCTL_DMA DRM_IOWR(0x29, drm_dma_t) -#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, drm_lock_t) -#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, drm_lock_t) -#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, drm_lock_t) - -#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) -#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) -#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, drm_agp_mode_t) -#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, drm_agp_info_t) -#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, drm_agp_buffer_t) -#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, drm_agp_buffer_t) -#define DRM_IOCTL_AGP_BIND DRM_IOW( 0x36, drm_agp_binding_t) -#define DRM_IOCTL_AGP_UNBIND DRM_IOW( 0x37, drm_agp_binding_t) - -/* Mga specific ioctls */ -#define DRM_IOCTL_MGA_INIT DRM_IOW( 0x40, drm_mga_init_t) -#define DRM_IOCTL_MGA_SWAP DRM_IOW( 0x41, drm_mga_swap_t) -#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x42, drm_mga_clear_t) -#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x43, drm_mga_iload_t) -#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x44, drm_mga_vertex_t) -#define DRM_IOCTL_MGA_FLUSH DRM_IOW( 0x45, drm_lock_t ) -#define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t) - -/* I810 specific ioctls */ -#define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t) -#define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t) -#define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t) -#define DRM_IOCTL_I810_FLUSH DRM_IO ( 0x43) -#define DRM_IOCTL_I810_GETAGE DRM_IO ( 0x44) -#define DRM_IOCTL_I810_GETBUF DRM_IOWR(0x45, drm_i810_dma_t) -#define DRM_IOCTL_I810_SWAP DRM_IO ( 0x46) -#define DRM_IOCTL_I810_COPY DRM_IOW( 0x47, drm_i810_copy_t) -#define DRM_IOCTL_I810_DOCOPY DRM_IO ( 0x48) +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) +#define DRM_IOW(nr,size) _IOW(DRM_IOCTL_BASE,nr,size) +#define DRM_IOWR(nr,size) _IOWR(DRM_IOCTL_BASE,nr,size) + + +#define DRM_IOCTL_VERSION DRM_IOWR(0x00, drm_version_t) +#define DRM_IOCTL_GET_UNIQUE DRM_IOWR(0x01, drm_unique_t) +#define DRM_IOCTL_GET_MAGIC DRM_IOR( 0x02, drm_auth_t) +#define DRM_IOCTL_IRQ_BUSID DRM_IOWR(0x03, drm_irq_busid_t) +#define DRM_IOCTL_GET_MAP DRM_IOWR(0x04, drm_map_t) +#define DRM_IOCTL_GET_CLIENT DRM_IOWR(0x05, drm_client_t) +#define DRM_IOCTL_GET_STATS DRM_IOR( 0x06, drm_stats_t) + +#define DRM_IOCTL_SET_UNIQUE DRM_IOW( 0x10, drm_unique_t) +#define DRM_IOCTL_AUTH_MAGIC DRM_IOW( 0x11, drm_auth_t) +#define DRM_IOCTL_BLOCK DRM_IOWR(0x12, drm_block_t) +#define DRM_IOCTL_UNBLOCK DRM_IOWR(0x13, drm_block_t) +#define DRM_IOCTL_CONTROL DRM_IOW( 0x14, drm_control_t) +#define DRM_IOCTL_ADD_MAP DRM_IOWR(0x15, drm_map_t) +#define DRM_IOCTL_ADD_BUFS DRM_IOWR(0x16, drm_buf_desc_t) +#define DRM_IOCTL_MARK_BUFS DRM_IOW( 0x17, drm_buf_desc_t) +#define DRM_IOCTL_INFO_BUFS DRM_IOWR(0x18, drm_buf_info_t) +#define DRM_IOCTL_MAP_BUFS DRM_IOWR(0x19, drm_buf_map_t) +#define DRM_IOCTL_FREE_BUFS DRM_IOW( 0x1a, drm_buf_free_t) + +#define DRM_IOCTL_RM_MAP DRM_IOW( 0x1b, drm_map_t) + +#define DRM_IOCTL_SET_SAREA_CTX DRM_IOW( 0x1c, drm_ctx_priv_map_t) +#define DRM_IOCTL_GET_SAREA_CTX DRM_IOWR(0x1d, drm_ctx_priv_map_t) + +#define DRM_IOCTL_ADD_CTX DRM_IOWR(0x20, drm_ctx_t) +#define DRM_IOCTL_RM_CTX DRM_IOWR(0x21, drm_ctx_t) +#define DRM_IOCTL_MOD_CTX DRM_IOW( 0x22, drm_ctx_t) +#define DRM_IOCTL_GET_CTX DRM_IOWR(0x23, drm_ctx_t) +#define DRM_IOCTL_SWITCH_CTX DRM_IOW( 0x24, drm_ctx_t) +#define DRM_IOCTL_NEW_CTX DRM_IOW( 0x25, drm_ctx_t) +#define DRM_IOCTL_RES_CTX DRM_IOWR(0x26, drm_ctx_res_t) +#define DRM_IOCTL_ADD_DRAW DRM_IOWR(0x27, drm_draw_t) +#define DRM_IOCTL_RM_DRAW DRM_IOWR(0x28, drm_draw_t) +#define DRM_IOCTL_DMA DRM_IOWR(0x29, drm_dma_t) +#define DRM_IOCTL_LOCK DRM_IOW( 0x2a, drm_lock_t) +#define DRM_IOCTL_UNLOCK DRM_IOW( 0x2b, drm_lock_t) +#define DRM_IOCTL_FINISH DRM_IOW( 0x2c, drm_lock_t) + +#define DRM_IOCTL_AGP_ACQUIRE DRM_IO( 0x30) +#define DRM_IOCTL_AGP_RELEASE DRM_IO( 0x31) +#define DRM_IOCTL_AGP_ENABLE DRM_IOW( 0x32, drm_agp_mode_t) +#define DRM_IOCTL_AGP_INFO DRM_IOR( 0x33, drm_agp_info_t) +#define DRM_IOCTL_AGP_ALLOC DRM_IOWR(0x34, drm_agp_buffer_t) +#define DRM_IOCTL_AGP_FREE DRM_IOW( 0x35, drm_agp_buffer_t) +#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) +#define DRM_IOCTL_MGA_RESET DRM_IO( 0x42) +#define DRM_IOCTL_MGA_SWAP DRM_IO( 0x43) +#define DRM_IOCTL_MGA_CLEAR DRM_IOW( 0x44, drm_mga_clear_t) +#define DRM_IOCTL_MGA_VERTEX DRM_IOW( 0x45, drm_mga_vertex_t) +#define DRM_IOCTL_MGA_INDICES DRM_IOW( 0x46, drm_mga_indices_t) +#define DRM_IOCTL_MGA_ILOAD DRM_IOW( 0x47, drm_mga_iload_t) +#define DRM_IOCTL_MGA_BLIT DRM_IOW( 0x48, drm_mga_blit_t) + +/* i810 specific ioctls */ +#define DRM_IOCTL_I810_INIT DRM_IOW( 0x40, drm_i810_init_t) +#define DRM_IOCTL_I810_VERTEX DRM_IOW( 0x41, drm_i810_vertex_t) +#define DRM_IOCTL_I810_CLEAR DRM_IOW( 0x42, drm_i810_clear_t) +#define DRM_IOCTL_I810_FLUSH DRM_IO( 0x43) +#define DRM_IOCTL_I810_GETAGE DRM_IO( 0x44) +#define DRM_IOCTL_I810_GETBUF DRM_IOWR(0x45, drm_i810_dma_t) +#define DRM_IOCTL_I810_SWAP DRM_IO( 0x46) +#define DRM_IOCTL_I810_COPY DRM_IOW( 0x47, drm_i810_copy_t) +#define DRM_IOCTL_I810_DOCOPY DRM_IO( 0x48) /* Rage 128 specific ioctls */ -#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) -#define DRM_IOCTL_R128_CCE_START DRM_IO( 0x41) -#define DRM_IOCTL_R128_CCE_STOP DRM_IOW( 0x42, drm_r128_cce_stop_t) -#define DRM_IOCTL_R128_CCE_RESET DRM_IO( 0x43) -#define DRM_IOCTL_R128_CCE_IDLE DRM_IO( 0x44) -#define DRM_IOCTL_R128_RESET DRM_IO( 0x46) -#define DRM_IOCTL_R128_SWAP DRM_IO( 0x47) -#define DRM_IOCTL_R128_CLEAR DRM_IOW( 0x48, drm_r128_clear_t) -#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x49, drm_r128_vertex_t) -#define DRM_IOCTL_R128_INDICES DRM_IOW( 0x4a, drm_r128_indices_t) -#define DRM_IOCTL_R128_BLIT DRM_IOW( 0x4b, drm_r128_blit_t) -#define DRM_IOCTL_R128_DEPTH DRM_IOW( 0x4c, drm_r128_depth_t) -#define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t) -#define DRM_IOCTL_R128_PACKET DRM_IOWR(0x4e, drm_r128_packet_t) +#define DRM_IOCTL_R128_INIT DRM_IOW( 0x40, drm_r128_init_t) +#define DRM_IOCTL_R128_CCE_START DRM_IO( 0x41) +#define DRM_IOCTL_R128_CCE_STOP DRM_IOW( 0x42, drm_r128_cce_stop_t) +#define DRM_IOCTL_R128_CCE_RESET DRM_IO( 0x43) +#define DRM_IOCTL_R128_CCE_IDLE DRM_IO( 0x44) +#define DRM_IOCTL_R128_RESET DRM_IO( 0x46) +#define DRM_IOCTL_R128_SWAP DRM_IO( 0x47) +#define DRM_IOCTL_R128_CLEAR DRM_IOW( 0x48, drm_r128_clear_t) +#define DRM_IOCTL_R128_VERTEX DRM_IOW( 0x49, drm_r128_vertex_t) +#define DRM_IOCTL_R128_INDICES DRM_IOW( 0x4a, drm_r128_indices_t) +#define DRM_IOCTL_R128_BLIT DRM_IOW( 0x4b, drm_r128_blit_t) +#define DRM_IOCTL_R128_DEPTH DRM_IOW( 0x4c, drm_r128_depth_t) +#define DRM_IOCTL_R128_STIPPLE DRM_IOW( 0x4d, drm_r128_stipple_t) +#define DRM_IOCTL_R128_INDIRECT DRM_IOWR(0x4f, drm_r128_indirect_t) +#define DRM_IOCTL_R128_FULLSCREEN DRM_IOW( 0x50, drm_r128_fullscreen_t) + +/* Radeon specific ioctls */ +#define DRM_IOCTL_RADEON_CP_INIT DRM_IOW( 0x40, drm_radeon_init_t) +#define DRM_IOCTL_RADEON_CP_START DRM_IO( 0x41) +#define DRM_IOCTL_RADEON_CP_STOP DRM_IOW( 0x42, drm_radeon_cp_stop_t) +#define DRM_IOCTL_RADEON_CP_RESET DRM_IO( 0x43) +#define DRM_IOCTL_RADEON_CP_IDLE DRM_IO( 0x44) +#define DRM_IOCTL_RADEON_RESET DRM_IO( 0x45) +#define DRM_IOCTL_RADEON_FULLSCREEN DRM_IOW( 0x46, drm_radeon_fullscreen_t) +#define DRM_IOCTL_RADEON_SWAP DRM_IO( 0x47) +#define DRM_IOCTL_RADEON_CLEAR DRM_IOW( 0x48, drm_radeon_clear_t) +#define DRM_IOCTL_RADEON_VERTEX DRM_IOW( 0x49, drm_radeon_vertex_t) +#define DRM_IOCTL_RADEON_INDICES DRM_IOW( 0x4a, drm_radeon_indices_t) +#define DRM_IOCTL_RADEON_STIPPLE DRM_IOW( 0x4c, drm_radeon_stipple_t) +#define DRM_IOCTL_RADEON_INDIRECT DRM_IOWR(0x4d, drm_radeon_indirect_t) +#define DRM_IOCTL_RADEON_TEXTURE DRM_IOWR(0x4e, drm_radeon_texture_t) +#ifdef CONFIG_DRM_SIS /* SiS specific ioctls */ -#define SIS_IOCTL_FB_ALLOC DRM_IOWR( 0x44, drm_sis_mem_t) -#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t) -#define SIS_IOCTL_AGP_INIT DRM_IOWR( 0x53, drm_sis_agp_t) -#define SIS_IOCTL_AGP_ALLOC DRM_IOWR( 0x54, drm_sis_mem_t) -#define SIS_IOCTL_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t) -#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t) -#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49) -#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50) +#define SIS_IOCTL_FB_ALLOC DRM_IOWR(0x44, drm_sis_mem_t) +#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t) +#define SIS_IOCTL_AGP_INIT DRM_IOWR(0x53, drm_sis_agp_t) +#define SIS_IOCTL_AGP_ALLOC DRM_IOWR(0x54, drm_sis_mem_t) +#define SIS_IOCTL_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t) +#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t) +#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49) +#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50) +#endif #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h:1.14 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h:1.17 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h:1.14 Fri Dec 1 09:29:01 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drmP.h Wed May 2 11:06:10 2001 @@ -11,22 +11,22 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> - * + * Gareth Hughes <gareth@valinux.com> */ #ifndef _DRM_P_H_ @@ -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> @@ -73,11 +73,46 @@ #if LINUX_VERSION_CODE < 0x020400 #include "compat-pre24.h" #endif +#include <asm/pgalloc.h> #include "drm.h" +/* DRM template customization defaults + */ +#ifndef __HAVE_AGP +#define __HAVE_AGP 0 +#endif +#ifndef __HAVE_MTRR +#define __HAVE_MTRR 0 +#endif +#ifndef __HAVE_CTX_BITMAP +#define __HAVE_CTX_BITMAP 0 +#endif +#ifndef __HAVE_DMA +#define __HAVE_DMA 0 +#endif +#ifndef __HAVE_DMA_IRQ +#define __HAVE_DMA_IRQ 0 +#endif +#ifndef __HAVE_DMA_WAITLIST +#define __HAVE_DMA_WAITLIST 0 +#endif +#ifndef __HAVE_DMA_FREELIST +#define __HAVE_DMA_FREELIST 0 +#endif +#ifndef __HAVE_DMA_HISTOGRAM +#define __HAVE_DMA_HISTOGRAM 0 +#endif + +#define __REALLY_HAVE_AGP (__HAVE_AGP && (defined(CONFIG_AGP) || \ + defined(CONFIG_AGP_MODULE))) +#define __REALLY_HAVE_MTRR (__HAVE_MTRR && defined(CONFIG_MTRR)) + + +/* Begin the DRM... + */ + #define DRM_DEBUG_CODE 2 /* Include debugging code (if > 1, then also include looping detection. */ -#define DRM_DMA_HISTOGRAM 1 /* Make histogram of DMA latency. */ #define DRM_HASH_SIZE 16 /* Size of key hash table */ #define DRM_KERNEL_CONTEXT 0 /* Change drm_resctx if changed */ @@ -109,6 +144,8 @@ #define DRM_MEM_TOTALAGP 16 #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) @@ -163,7 +200,7 @@ 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" @@ -174,7 +211,8 @@ "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; } @@ -185,7 +223,7 @@ 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" @@ -196,7 +234,8 @@ "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; } @@ -248,27 +287,58 @@ 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) #define DRM_MEM_ERROR(area, fmt, arg...) \ printk(KERN_ERR "[" DRM_NAME ":" __FUNCTION__ ":%s] *ERROR* " fmt , \ - drm_mem_stats[area].name , ##arg) + DRM(mem_stats)[area].name , ##arg) #define DRM_INFO(fmt, arg...) printk(KERN_INFO "[" DRM_NAME "] " fmt , ##arg) #if DRM_DEBUG_CODE -#define DRM_DEBUG(fmt, arg...) \ - do { \ - if (drm_flags&DRM_FLAG_DEBUG) \ - printk(KERN_DEBUG \ - "[" DRM_NAME ":" __FUNCTION__ "] " fmt , \ - ##arg); \ +#define DRM_DEBUG(fmt, arg...) \ + do { \ + if ( DRM(flags) & DRM_FLAG_DEBUG ) \ + printk(KERN_DEBUG \ + "[" DRM_NAME ":" __FUNCTION__ "] " fmt , \ + ##arg); \ } while (0) #else #define DRM_DEBUG(fmt, arg...) do { } while (0) @@ -276,13 +346,36 @@ #define DRM_PROC_LIMIT (PAGE_SIZE-80) -#define DRM_PROC_PRINT(fmt, arg...) \ - len += sprintf(&buf[len], fmt , ##arg); \ - if (len > DRM_PROC_LIMIT) return len; - -#define DRM_PROC_PRINT_RET(ret, fmt, arg...) \ - len += sprintf(&buf[len], fmt , ##arg); \ - if (len > DRM_PROC_LIMIT) { ret; return len; } +#define DRM_PROC_PRINT(fmt, arg...) \ + len += sprintf(&buf[len], fmt , ##arg); \ + if (len > DRM_PROC_LIMIT) { *eof = 1; return len - offset; } + +#define DRM_PROC_PRINT_RET(ret, fmt, arg...) \ + len += sprintf(&buf[len], fmt , ##arg); \ + if (len > DRM_PROC_LIMIT) { ret; *eof = 1; return len - offset; } + + /* Mapping helper macros */ +#define DRM_IOREMAP(map) \ + (map)->handle = DRM(ioremap)( (map)->offset, (map)->size ) + +#define DRM_IOREMAPFREE(map) \ + do { \ + if ( (map)->handle && (map)->size ) \ + DRM(ioremapfree)( (map)->handle, (map)->size ); \ + } while (0) + +#define DRM_FIND_MAP(_map, _o) \ +do { \ + struct list_head *_list; \ + list_for_each( _list, &dev->maplist->head ) { \ + drm_map_list_t *_entry = (drm_map_list_t *)_list; \ + if ( _entry->map && \ + _entry->map->offset == (_o) ) { \ + (_map) = _entry->map; \ + break; \ + } \ + } \ +} while(0) /* Internal types and structures */ #define DRM_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) @@ -292,9 +385,13 @@ #define DRM_LEFTCOUNT(x) (((x)->rp + (x)->count - (x)->wp) % ((x)->count + 1)) #define DRM_BUFCOUNT(x) ((x)->count - DRM_LEFTCOUNT(x)) #define DRM_WAITCOUNT(dev,idx) DRM_BUFCOUNT(&dev->queuelist[idx]->waitlist) + +#define DRM_GET_PRIV_SAREA(_dev, _ctx, _map) do { \ + (_map) = (_dev)->context_sareas[_ctx]; \ +} while(0) -typedef int drm_ioctl_t(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); +typedef int drm_ioctl_t( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); typedef struct drm_ioctl_desc { drm_ioctl_t *func; @@ -304,7 +401,7 @@ typedef struct drm_devstate { pid_t owner; /* X server pid holding x_lock */ - + } drm_devstate_t; typedef struct drm_magic_entry { @@ -365,14 +462,14 @@ #define DRM_DMA_HISTOGRAM_NEXT(current) ((current)*10) typedef struct drm_histogram { atomic_t total; - + atomic_t queued_to_dispatched[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t dispatched_to_completed[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t completed_to_freed[DRM_DMA_HISTOGRAM_SLOTS]; - + atomic_t queued_to_completed[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t queued_to_freed[DRM_DMA_HISTOGRAM_SLOTS]; - + atomic_t dma[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t schedule[DRM_DMA_HISTOGRAM_SLOTS]; atomic_t ctx[DRM_DMA_HISTOGRAM_SLOTS]; @@ -396,7 +493,7 @@ int initialized; /* Freelist in use */ atomic_t count; /* Number of free buffers */ drm_buf_t *next; /* End pointer */ - + wait_queue_head_t waiting; /* Processes waiting on free bufs */ int low_mark; /* Low water mark */ int high_mark; /* High water mark */ @@ -442,9 +539,11 @@ wait_queue_head_t read_queue; /* Processes waiting on block_read */ atomic_t block_write; /* Queue blocked for writes */ wait_queue_head_t write_queue; /* Processes waiting on block_write */ +#if 1 atomic_t total_queued; /* Total queued statistic */ atomic_t total_flushed;/* Total flushes statistic */ atomic_t total_locks; /* Total locks statistics */ +#endif drm_ctx_flags_t flags; /* Context preserving and 2D-only */ drm_waitlist_t waitlist; /* Pending buffers */ wait_queue_head_t flush_queue; /* Processes waiting until flush */ @@ -458,11 +557,12 @@ } drm_lock_data_t; typedef struct drm_device_dma { +#if 0 /* Performance Counters */ atomic_t total_prio; /* Total DRM_DMA_PRIORITY */ atomic_t total_bytes; /* Total bytes DMA'd */ atomic_t total_dmas; /* Total DMA buffers dispatched */ - + atomic_t total_missed_dma; /* Missed drm_do_dma */ atomic_t total_missed_lock; /* Missed lock in drm_do_dma */ atomic_t total_missed_free; /* Missed drm_free_this_buffer */ @@ -471,16 +571,18 @@ atomic_t total_tried; /* Tried next_buffer */ atomic_t total_hit; /* Sent next_buffer */ atomic_t total_lost; /* Lost interrupt */ +#endif drm_buf_entry_t bufs[DRM_MAX_ORDER+1]; int buf_count; drm_buf_t **buflist; /* Vector of pointers info bufs */ - int seg_count; + int seg_count; int page_count; unsigned long *pagelist; unsigned long byte_count; enum { - _DRM_DMA_USE_AGP = 0x01 + _DRM_DMA_USE_AGP = 0x01, + _DRM_DMA_USE_SG = 0x02 } flags; /* DMA support */ @@ -490,7 +592,7 @@ wait_queue_head_t waiting; /* Processes waiting on free bufs */ } drm_device_dma_t; -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) +#if __REALLY_HAVE_AGP typedef struct drm_agp_mem { unsigned long handle; agp_memory *memory; @@ -512,18 +614,30 @@ } 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; } drm_sigdata_t; +typedef struct drm_map_list { + struct list_head head; + drm_map_t *map; +} drm_map_list_t; + typedef struct drm_device { const char *name; /* Simple driver name */ char *unique; /* Unique identifier: e.g., busid */ int unique_len; /* Length of unique field */ dev_t device; /* Device number for mknod */ char *devname; /* For /proc/interrupts */ - + int blocked; /* Blocked due to VC switch? */ struct proc_dir_entry *root; /* Root for this device's entries */ @@ -538,17 +652,10 @@ int buf_use; /* Buffers in use -- cannot alloc */ atomic_t buf_alloc; /* Buffer allocation in progress */ - /* Performance Counters */ - atomic_t total_open; - atomic_t total_close; - atomic_t total_ioctl; - atomic_t total_irq; /* Total interruptions */ - atomic_t total_ctx; /* Total context switches */ - - atomic_t total_locks; - atomic_t total_unlocks; - atomic_t total_contends; - atomic_t total_sleeps; + /* Performance counters */ + unsigned long counters; + drm_stat_type_t types[15]; + atomic_t counts[15]; /* Authentication */ drm_file_t *file_first; @@ -556,9 +663,12 @@ drm_magic_head_t magiclist[DRM_HASH_SIZE]; /* Memory management */ - drm_map_t **maplist; /* Vector of pointers to regions */ + drm_map_list_t *maplist; /* Linked list of regions */ int map_count; /* Number of mappable regions */ + drm_map_t **context_sareas; + int max_context; + drm_vma_entry_t *vmalist; /* List of vmas (for debugging) */ drm_lock_data_t lock; /* Information on hardware lock */ @@ -582,10 +692,10 @@ struct tq_struct tq; cycles_t ctx_start; cycles_t lck_start; -#if DRM_DMA_HISTOGRAM +#if __HAVE_DMA_HISTOGRAM drm_histogram_t histo; #endif - + /* Callback to X server for context switch and for heavy-handed reset. */ char buf[DRM_BSZ]; /* Output buffer */ @@ -595,10 +705,18 @@ struct fasync_struct *buf_async;/* Processes waiting for SIGIO */ wait_queue_head_t buf_readers; /* Processes waiting to read */ wait_queue_head_t buf_writers; /* Processes waiting to ctx switch */ - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) + +#if __REALLY_HAVE_AGP drm_agp_head_t *agp; #endif +#ifdef __alpha__ +#if LINUX_VERSION_CODE < 0x020403 + struct pci_controler *hose; +#else + struct pci_controller *hose; +#endif +#endif + drm_sg_mem_t *sg; /* Scatter gather memory */ unsigned long *ctx_bitmap; void *dev_private; drm_sigdata_t sigdata; /* For block_all_signals */ @@ -606,230 +724,297 @@ } drm_device_t; - /* Internal function definitions */ +/* ================================================================ + * Internal function definitions + */ - /* Misc. support (init.c) */ -extern int drm_flags; -extern void drm_parse_options(char *s); -extern int drm_cpu_valid(void); - - - /* Device support (fops.c) */ -extern int drm_open_helper(struct inode *inode, struct file *filp, - drm_device_t *dev); -extern int drm_flush(struct file *filp); -extern int drm_release(struct inode *inode, struct file *filp); -extern int drm_fasync(int fd, struct file *filp, int on); -extern ssize_t drm_read(struct file *filp, char *buf, size_t count, - loff_t *off); -extern int drm_write_string(drm_device_t *dev, const char *s); -extern unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait); + /* Misc. support (drm_init.h) */ +extern int DRM(flags); +extern void DRM(parse_options)( char *s ); +extern int DRM(cpu_valid)( void ); - /* Mapping support (vm.c) */ + /* Driver support (drm_drv.h) */ +extern int DRM(version)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(open)(struct inode *inode, struct file *filp); +extern int DRM(release)(struct inode *inode, struct file *filp); +extern int DRM(ioctl)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(lock)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(unlock)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); + + /* Device support (drm_fops.h) */ +extern int DRM(open_helper)(struct inode *inode, struct file *filp, + drm_device_t *dev); +extern int DRM(flush)(struct file *filp); +extern int DRM(release_fuck)(struct inode *inode, struct file *filp); +extern int DRM(fasync)(int fd, struct file *filp, int on); +extern ssize_t DRM(read)(struct file *filp, char *buf, size_t count, + loff_t *off); +extern int DRM(write_string)(drm_device_t *dev, const char *s); +extern unsigned int DRM(poll)(struct file *filp, + struct poll_table_struct *wait); + + /* Mapping support (drm_vm.h) */ #if LINUX_VERSION_CODE < 0x020317 -extern unsigned long drm_vm_nopage(struct vm_area_struct *vma, +extern unsigned long DRM(vm_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access); +extern unsigned long DRM(vm_shm_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access); +extern unsigned long DRM(vm_dma_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access); +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, unsigned long address, int write_access); -extern unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma, +extern struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma, unsigned long address, int write_access); -extern unsigned long drm_vm_shm_nopage_lock(struct vm_area_struct *vma, - unsigned long address, - int write_access); -extern unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma, +extern struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma, unsigned long address, int write_access); -#else - /* Return type changed in 2.3.23 */ -extern struct page *drm_vm_nopage(struct vm_area_struct *vma, - unsigned long address, - int write_access); -extern struct page *drm_vm_shm_nopage(struct vm_area_struct *vma, - unsigned long address, - int write_access); -extern struct page *drm_vm_shm_nopage_lock(struct vm_area_struct *vma, - unsigned long address, - int write_access); -extern struct page *drm_vm_dma_nopage(struct vm_area_struct *vma, +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); -extern int drm_mmap_dma(struct file *filp, - struct vm_area_struct *vma); -extern int drm_mmap(struct file *filp, struct vm_area_struct *vma); - - - /* Proc support (proc.c) */ -extern int drm_proc_init(drm_device_t *dev); -extern int drm_proc_cleanup(void); - - /* Memory management support (memory.c) */ -extern void drm_mem_init(void); -extern int drm_mem_info(char *buf, char **start, off_t offset, - int len, int *eof, void *data); -extern void *drm_alloc(size_t size, int area); -extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, - int area); -extern char *drm_strdup(const char *s, int area); -extern void drm_strfree(const char *s, int area); -extern void drm_free(void *pt, size_t size, int area); -extern unsigned long drm_alloc_pages(int order, int area); -extern void drm_free_pages(unsigned long address, int order, - int area); -extern void *drm_ioremap(unsigned long offset, unsigned long size); -extern void drm_ioremapfree(void *pt, unsigned long size); - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) -extern agp_memory *drm_alloc_agp(int pages, u32 type); -extern int drm_free_agp(agp_memory *handle, int pages); -extern int drm_bind_agp(agp_memory *handle, unsigned int start); -extern int drm_unbind_agp(agp_memory *handle); +extern void DRM(vm_open)(struct vm_area_struct *vma); +extern void DRM(vm_close)(struct vm_area_struct *vma); +extern void DRM(vm_shm_close)(struct vm_area_struct *vma); +extern int DRM(mmap_dma)(struct file *filp, + struct vm_area_struct *vma); +extern int DRM(mmap)(struct file *filp, struct vm_area_struct *vma); + + /* Memory management support (drm_memory.h) */ +extern void DRM(mem_init)(void); +extern int DRM(mem_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +extern void *DRM(alloc)(size_t size, int area); +extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, + int area); +extern char *DRM(strdup)(const char *s, int area); +extern void DRM(strfree)(const char *s, int area); +extern void DRM(free)(void *pt, size_t size, int area); +extern unsigned long DRM(alloc_pages)(int order, int area); +extern void DRM(free_pages)(unsigned long address, int order, + int area); +extern void *DRM(ioremap)(unsigned long offset, unsigned long size); +extern void DRM(ioremapfree)(void *pt, unsigned long size); + +#if __REALLY_HAVE_AGP +extern agp_memory *DRM(alloc_agp)(int pages, u32 type); +extern int DRM(free_agp)(agp_memory *handle, int pages); +extern int DRM(bind_agp)(agp_memory *handle, unsigned int start); +extern int DRM(unbind_agp)(agp_memory *handle); #endif - - /* Buffer management support (bufs.c) */ -extern int drm_order(unsigned long size); -extern int drm_addmap(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_addbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_infobufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_markbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_freebufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_mapbufs(struct inode *inode, struct file *filp, + /* Misc. IOCTL support (drm_ioctl.h) */ +extern int DRM(irq_busid)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(getunique)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(setunique)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(getmap)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); - - - /* Buffer list management support (lists.c) */ -extern int drm_waitlist_create(drm_waitlist_t *bl, int count); -extern int drm_waitlist_destroy(drm_waitlist_t *bl); -extern int drm_waitlist_put(drm_waitlist_t *bl, drm_buf_t *buf); -extern drm_buf_t *drm_waitlist_get(drm_waitlist_t *bl); - -extern int drm_freelist_create(drm_freelist_t *bl, int count); -extern int drm_freelist_destroy(drm_freelist_t *bl); -extern int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, - drm_buf_t *buf); -extern drm_buf_t *drm_freelist_get(drm_freelist_t *bl, int block); - - /* DMA support (gen_dma.c) */ -extern void drm_dma_setup(drm_device_t *dev); -extern void drm_dma_takedown(drm_device_t *dev); -extern void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf); -extern void drm_reclaim_buffers(drm_device_t *dev, pid_t pid); -extern int drm_context_switch(drm_device_t *dev, int old, int new); -extern int drm_context_switch_complete(drm_device_t *dev, int new); -extern void drm_clear_next_buffer(drm_device_t *dev); -extern int drm_select_queue(drm_device_t *dev, - void (*wrapper)(unsigned long)); -extern int drm_dma_enqueue(drm_device_t *dev, drm_dma_t *dma); -extern int drm_dma_get_buffers(drm_device_t *dev, drm_dma_t *dma); -#if DRM_DMA_HISTOGRAM -extern int drm_histogram_slot(unsigned long count); -extern void drm_histogram_compute(drm_device_t *dev, drm_buf_t *buf); -#endif - - - /* Misc. IOCTL support (ioctl.c) */ -extern int drm_irq_busid(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_getunique(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_setunique(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - - - /* Context IOCTL support (context.c) */ -extern int drm_resctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_addctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_modctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_getctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_switchctx(struct inode *inode, struct file *filp, +extern int DRM(getclient)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(getstats)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_newctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_rmctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); + /* Context IOCTL support (drm_context.h) */ +extern int DRM(resctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(addctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(modctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(getctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(switchctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(newctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(rmctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + +extern int DRM(context_switch)(drm_device_t *dev, int old, int new); +extern int DRM(context_switch_complete)(drm_device_t *dev, int new); + +#if __HAVE_CTX_BITMAP +extern int DRM(ctxbitmap_init)( drm_device_t *dev ); +extern void DRM(ctxbitmap_cleanup)( drm_device_t *dev ); +#endif + +extern int DRM(setsareactx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(getsareactx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); - /* Drawable IOCTL support (drawable.c) */ -extern int drm_adddraw(struct inode *inode, struct file *filp, + /* Drawable IOCTL support (drm_drawable.h) */ +extern int DRM(adddraw)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(rmdraw)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_rmdraw(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - /* Authentication IOCTL support (auth.c) */ -extern int drm_add_magic(drm_device_t *dev, drm_file_t *priv, - drm_magic_t magic); -extern int drm_remove_magic(drm_device_t *dev, drm_magic_t magic); -extern int drm_getmagic(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_authmagic(struct inode *inode, struct file *filp, + /* Authentication IOCTL support (drm_auth.h) */ +extern int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, + drm_magic_t magic); +extern int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic); +extern int DRM(getmagic)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); +extern int DRM(authmagic)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); - /* Locking IOCTL support (lock.c) */ -extern int drm_block(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_unblock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_lock_take(__volatile__ unsigned int *lock, - unsigned int context); -extern int drm_lock_transfer(drm_device_t *dev, - __volatile__ unsigned int *lock, - unsigned int context); -extern int drm_lock_free(drm_device_t *dev, - __volatile__ unsigned int *lock, - unsigned int context); -extern int drm_finish(struct inode *inode, struct file *filp, + /* Locking IOCTL support (drm_lock.h) */ +extern int DRM(block)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_flush_unblock(drm_device_t *dev, int context, - drm_lock_flags_t flags); -extern int drm_flush_block_and_flush(drm_device_t *dev, int context, - drm_lock_flags_t flags); -extern int drm_notifier(void *priv); - - /* Context Bitmap support (ctxbitmap.c) */ -extern int drm_ctxbitmap_init(drm_device_t *dev); -extern void drm_ctxbitmap_cleanup(drm_device_t *dev); -extern int drm_ctxbitmap_next(drm_device_t *dev); -extern void drm_ctxbitmap_free(drm_device_t *dev, int ctx_handle); +extern int DRM(unblock)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(lock_take)(__volatile__ unsigned int *lock, + unsigned int context); +extern int DRM(lock_transfer)(drm_device_t *dev, + __volatile__ unsigned int *lock, + unsigned int context); +extern int DRM(lock_free)(drm_device_t *dev, + __volatile__ unsigned int *lock, + unsigned int context); +extern int DRM(finish)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(flush_unblock)(drm_device_t *dev, int context, + drm_lock_flags_t flags); +extern int DRM(flush_block_and_flush)(drm_device_t *dev, int context, + drm_lock_flags_t flags); +extern int DRM(notifier)(void *priv); + + /* Buffer management support (drm_bufs.h) */ +extern int DRM(order)( unsigned long size ); +extern int DRM(addmap)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(rmmap)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +#if __HAVE_DMA +extern int DRM(addbufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(infobufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(markbufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(freebufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(mapbufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + + /* DMA support (drm_dma.h) */ +extern int DRM(dma_setup)(drm_device_t *dev); +extern void DRM(dma_takedown)(drm_device_t *dev); +extern void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf); +extern void DRM(reclaim_buffers)(drm_device_t *dev, pid_t pid); +#if __HAVE_OLD_DMA +/* GH: This is a dirty hack for now... + */ +extern void DRM(clear_next_buffer)(drm_device_t *dev); +extern int DRM(select_queue)(drm_device_t *dev, + void (*wrapper)(unsigned long)); +extern int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *dma); +extern int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma); +#endif +#if __HAVE_DMA_IRQ +extern int DRM(control)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int DRM(irq_install)( drm_device_t *dev, int irq ); +extern int DRM(irq_uninstall)( drm_device_t *dev ); +extern void DRM(dma_service)( int irq, void *device, + struct pt_regs *regs ); +#if __HAVE_DMA_IRQ_BH +extern void DRM(dma_immediate_bh)( void *dev ); +#endif +#endif +#if DRM_DMA_HISTOGRAM +extern int DRM(histogram_slot)(unsigned long count); +extern void DRM(histogram_compute)(drm_device_t *dev, drm_buf_t *buf); +#endif -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - /* AGP/GART support (agpsupport.c) */ -extern drm_agp_head_t *drm_agp_init(void); -extern void drm_agp_uninit(void); -extern int drm_agp_acquire(struct inode *inode, struct file *filp, + /* Buffer list support (drm_lists.h) */ +#if __HAVE_DMA_WAITLIST +extern int DRM(waitlist_create)(drm_waitlist_t *bl, int count); +extern int DRM(waitlist_destroy)(drm_waitlist_t *bl); +extern int DRM(waitlist_put)(drm_waitlist_t *bl, drm_buf_t *buf); +extern drm_buf_t *DRM(waitlist_get)(drm_waitlist_t *bl); +#endif +#if __HAVE_DMA_FREELIST +extern int DRM(freelist_create)(drm_freelist_t *bl, int count); +extern int DRM(freelist_destroy)(drm_freelist_t *bl); +extern int DRM(freelist_put)(drm_device_t *dev, drm_freelist_t *bl, + drm_buf_t *buf); +extern drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block); +#endif +#endif /* __HAVE_DMA */ + +#if __REALLY_HAVE_AGP + /* AGP/GART support (drm_agpsupport.h) */ +extern drm_agp_head_t *DRM(agp_init)(void); +extern void DRM(agp_uninit)(void); +extern int DRM(agp_acquire)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern void DRM(agp_do_release)(void); +extern int DRM(agp_release)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(agp_enable)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern void _drm_agp_release(void); -extern int drm_agp_release(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_agp_enable(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_agp_info(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_agp_alloc(struct inode *inode, struct file *filp, +extern int DRM(agp_info)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_agp_free(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int drm_agp_unbind(struct inode *inode, struct file *filp, +extern int DRM(agp_alloc)(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int drm_agp_bind(struct inode *inode, struct file *filp, +extern int DRM(agp_free)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(agp_unbind)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern int DRM(agp_bind)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg); +extern agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type); +extern int DRM(agp_free_memory)(agp_memory *handle); +extern int DRM(agp_bind_memory)(agp_memory *handle, off_t start); +extern int DRM(agp_unbind_memory)(agp_memory *handle); +#endif + + /* Stub support (drm_stub.h) */ +int DRM(stub_register)(const char *name, + struct file_operations *fops, + drm_device_t *dev); +int DRM(stub_unregister)(int minor); + + /* Proc support (drm_proc.h) */ +extern struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev, + int minor, + struct proc_dir_entry *root, + struct proc_dir_entry **dev_root); +extern int DRM(proc_cleanup)(int minor, + struct proc_dir_entry *root, + struct proc_dir_entry *dev_root); + +#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); -extern agp_memory *drm_agp_allocate_memory(size_t pages, u32 type); -extern int drm_agp_free_memory(agp_memory *handle); -extern int drm_agp_bind_memory(agp_memory *handle, off_t start); -extern int drm_agp_unbind_memory(agp_memory *handle); #endif -#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 Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h:1.2 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_agpsupport.h Tue Apr 10 12:08:04 2001 @@ -0,0 +1,340 @@ +/* drm_agpsupport.h -- DRM support for AGP/GART backend -*- linux-c -*- + * Created: Mon Dec 13 09:56:45 1999 by faith@precisioninsight.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Author: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" +#include <linux/module.h> + +#if __REALLY_HAVE_AGP + +#if LINUX_VERSION_CODE < 0x020400 +#include "agpsupport-pre24.h" +#else +#define DRM_AGP_GET (drm_agp_t *)inter_module_get("drm_agp") +#define DRM_AGP_PUT inter_module_put("drm_agp") +#endif + +static const drm_agp_t *drm_agp = NULL; + +int DRM(agp_info)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + agp_kern_info *kern; + drm_agp_info_t info; + + if (!dev->agp || !dev->agp->acquired || !drm_agp->copy_info) + return -EINVAL; + + kern = &dev->agp->agp_info; + info.agp_version_major = kern->version.major; + info.agp_version_minor = kern->version.minor; + info.mode = kern->mode; + info.aperture_base = kern->aper_base; + info.aperture_size = kern->aper_size * 1024 * 1024; + info.memory_allowed = kern->max_memory << PAGE_SHIFT; + info.memory_used = kern->current_memory << PAGE_SHIFT; + info.id_vendor = kern->device->vendor; + info.id_device = kern->device->device; + + if (copy_to_user((drm_agp_info_t *)arg, &info, sizeof(info))) + return -EFAULT; + return 0; +} + +int DRM(agp_acquire)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int retcode; + + if (!dev->agp || dev->agp->acquired || !drm_agp->acquire) + return -EINVAL; + if ((retcode = drm_agp->acquire())) return retcode; + dev->agp->acquired = 1; + return 0; +} + +int DRM(agp_release)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + + if (!dev->agp || !dev->agp->acquired || !drm_agp->release) + return -EINVAL; + drm_agp->release(); + dev->agp->acquired = 0; + return 0; + +} + +void DRM(agp_do_release)(void) +{ + if (drm_agp->release) drm_agp->release(); +} + +int DRM(agp_enable)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_mode_t mode; + + if (!dev->agp || !dev->agp->acquired || !drm_agp->enable) + return -EINVAL; + + if (copy_from_user(&mode, (drm_agp_mode_t *)arg, sizeof(mode))) + return -EFAULT; + + dev->agp->mode = mode.mode; + drm_agp->enable(mode.mode); + dev->agp->base = dev->agp->agp_info.aper_base; + dev->agp->enabled = 1; + return 0; +} + +int DRM(agp_alloc)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_buffer_t request; + drm_agp_mem_t *entry; + agp_memory *memory; + unsigned long pages; + u32 type; + + if (!dev->agp || !dev->agp->acquired) return -EINVAL; + if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request))) + return -EFAULT; + if (!(entry = DRM(alloc)(sizeof(*entry), DRM_MEM_AGPLISTS))) + return -ENOMEM; + + memset(entry, 0, sizeof(*entry)); + + pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE; + type = (u32) request.type; + + if (!(memory = DRM(alloc_agp)(pages, type))) { + DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return -ENOMEM; + } + + entry->handle = (unsigned long)memory->memory; + entry->memory = memory; + entry->bound = 0; + entry->pages = pages; + entry->prev = NULL; + entry->next = dev->agp->memory; + if (dev->agp->memory) dev->agp->memory->prev = entry; + dev->agp->memory = entry; + + request.handle = entry->handle; + request.physical = memory->physical; + + if (copy_to_user((drm_agp_buffer_t *)arg, &request, sizeof(request))) { + dev->agp->memory = entry->next; + dev->agp->memory->prev = NULL; + DRM(free_agp)(memory, pages); + DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return -EFAULT; + } + return 0; +} + +static drm_agp_mem_t *DRM(agp_lookup_entry)(drm_device_t *dev, + unsigned long handle) +{ + drm_agp_mem_t *entry; + + for (entry = dev->agp->memory; entry; entry = entry->next) { + if (entry->handle == handle) return entry; + } + return NULL; +} + +int DRM(agp_unbind)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_binding_t request; + drm_agp_mem_t *entry; + + if (!dev->agp || !dev->agp->acquired) return -EINVAL; + if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request))) + return -EFAULT; + if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) + return -EINVAL; + if (!entry->bound) return -EINVAL; + return DRM(unbind_agp)(entry->memory); +} + +int DRM(agp_bind)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_binding_t request; + drm_agp_mem_t *entry; + int retcode; + int page; + + if (!dev->agp || !dev->agp->acquired || !drm_agp->bind_memory) + return -EINVAL; + if (copy_from_user(&request, (drm_agp_binding_t *)arg, sizeof(request))) + return -EFAULT; + if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) + return -EINVAL; + if (entry->bound) return -EINVAL; + page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE; + if ((retcode = DRM(bind_agp)(entry->memory, page))) return retcode; + entry->bound = dev->agp->base + (page << PAGE_SHIFT); + DRM_DEBUG("base = 0x%lx entry->bound = 0x%lx\n", + dev->agp->base, entry->bound); + return 0; +} + +int DRM(agp_free)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_agp_buffer_t request; + drm_agp_mem_t *entry; + + if (!dev->agp || !dev->agp->acquired) return -EINVAL; + if (copy_from_user(&request, (drm_agp_buffer_t *)arg, sizeof(request))) + return -EFAULT; + if (!(entry = DRM(agp_lookup_entry)(dev, request.handle))) + return -EINVAL; + if (entry->bound) DRM(unbind_agp)(entry->memory); + + if (entry->prev) entry->prev->next = entry->next; + else dev->agp->memory = entry->next; + if (entry->next) entry->next->prev = entry->prev; + DRM(free_agp)(entry->memory, entry->pages); + DRM(free)(entry, sizeof(*entry), DRM_MEM_AGPLISTS); + return 0; +} + +drm_agp_head_t *DRM(agp_init)(void) +{ + drm_agp_head_t *head = NULL; + + drm_agp = DRM_AGP_GET; + if (drm_agp) { + if (!(head = DRM(alloc)(sizeof(*head), DRM_MEM_AGPLISTS))) + return NULL; + memset((void *)head, 0, sizeof(*head)); + drm_agp->copy_info(&head->agp_info); + if (head->agp_info.chipset == NOT_SUPPORTED) { + DRM(free)(head, sizeof(*head), DRM_MEM_AGPLISTS); + return NULL; + } + head->memory = NULL; + switch (head->agp_info.chipset) { + case INTEL_GENERIC: head->chipset = "Intel"; break; + case INTEL_LX: head->chipset = "Intel 440LX"; break; + case INTEL_BX: head->chipset = "Intel 440BX"; break; + case INTEL_GX: head->chipset = "Intel 440GX"; break; + case INTEL_I810: head->chipset = "Intel i810"; break; + +#if LINUX_VERSION_CODE >= 0x020400 + case INTEL_I840: head->chipset = "Intel i840"; break; +#endif + + case VIA_GENERIC: head->chipset = "VIA"; break; + case VIA_VP3: head->chipset = "VIA VP3"; break; + case VIA_MVP3: head->chipset = "VIA MVP3"; break; + +#if LINUX_VERSION_CODE >= 0x020400 + case VIA_MVP4: head->chipset = "VIA MVP4"; break; + case VIA_APOLLO_KX133: head->chipset = "VIA Apollo KX133"; + break; + case VIA_APOLLO_KT133: head->chipset = "VIA Apollo KT133"; + break; +#endif + + case VIA_APOLLO_PRO: head->chipset = "VIA Apollo Pro"; + break; + case SIS_GENERIC: head->chipset = "SiS"; break; + case AMD_GENERIC: head->chipset = "AMD"; break; + case AMD_IRONGATE: head->chipset = "AMD Irongate"; break; + case ALI_GENERIC: head->chipset = "ALi"; break; + case ALI_M1541: head->chipset = "ALi M1541"; break; + default: head->chipset = "Unknown"; break; + } + DRM_INFO("AGP %d.%d on %s @ 0x%08lx %ZuMB\n", + head->agp_info.version.major, + head->agp_info.version.minor, + head->chipset, + head->agp_info.aper_base, + head->agp_info.aper_size); + } + return head; +} + +void DRM(agp_uninit)(void) +{ + DRM_AGP_PUT; + drm_agp = NULL; +} + +agp_memory *DRM(agp_allocate_memory)(size_t pages, u32 type) +{ + if (!drm_agp->allocate_memory) return NULL; + return drm_agp->allocate_memory(pages, type); +} + +int DRM(agp_free_memory)(agp_memory *handle) +{ + if (!handle || !drm_agp->free_memory) return 0; + drm_agp->free_memory(handle); + return 1; +} + +int DRM(agp_bind_memory)(agp_memory *handle, off_t start) +{ + if (!handle || !drm_agp->bind_memory) return -EINVAL; + return drm_agp->bind_memory(handle, start); +} + +int DRM(agp_unbind_memory)(agp_memory *handle) +{ + if (!handle || !drm_agp->unbind_memory) return -EINVAL; + return drm_agp->unbind_memory(handle); +} + +#endif /* __REALLY_HAVE_AGP */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_auth.h Wed Mar 21 13:08:55 2001 @@ -0,0 +1,162 @@ +/* drm_auth.h -- IOCTLs for authentication -*- linux-c -*- + * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +static int DRM(hash_magic)(drm_magic_t magic) +{ + return magic & (DRM_HASH_SIZE-1); +} + +static drm_file_t *DRM(find_file)(drm_device_t *dev, drm_magic_t magic) +{ + drm_file_t *retval = NULL; + drm_magic_entry_t *pt; + int hash = DRM(hash_magic)(magic); + + down(&dev->struct_sem); + for (pt = dev->magiclist[hash].head; pt; pt = pt->next) { + if (pt->magic == magic) { + retval = pt->priv; + break; + } + } + up(&dev->struct_sem); + return retval; +} + +int DRM(add_magic)(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic) +{ + int hash; + drm_magic_entry_t *entry; + + DRM_DEBUG("%d\n", magic); + + hash = DRM(hash_magic)(magic); + entry = DRM(alloc)(sizeof(*entry), DRM_MEM_MAGIC); + if (!entry) return -ENOMEM; + entry->magic = magic; + entry->priv = priv; + entry->next = NULL; + + down(&dev->struct_sem); + if (dev->magiclist[hash].tail) { + dev->magiclist[hash].tail->next = entry; + dev->magiclist[hash].tail = entry; + } else { + dev->magiclist[hash].head = entry; + dev->magiclist[hash].tail = entry; + } + up(&dev->struct_sem); + + return 0; +} + +int DRM(remove_magic)(drm_device_t *dev, drm_magic_t magic) +{ + drm_magic_entry_t *prev = NULL; + drm_magic_entry_t *pt; + int hash; + + DRM_DEBUG("%d\n", magic); + hash = DRM(hash_magic)(magic); + + down(&dev->struct_sem); + for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) { + if (pt->magic == magic) { + if (dev->magiclist[hash].head == pt) { + dev->magiclist[hash].head = pt->next; + } + if (dev->magiclist[hash].tail == pt) { + dev->magiclist[hash].tail = prev; + } + if (prev) { + prev->next = pt->next; + } + up(&dev->struct_sem); + return 0; + } + } + up(&dev->struct_sem); + + DRM(free)(pt, sizeof(*pt), DRM_MEM_MAGIC); + + return -EINVAL; +} + +int DRM(getmagic)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + static drm_magic_t sequence = 0; + static spinlock_t lock = SPIN_LOCK_UNLOCKED; + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_auth_t auth; + + /* Find unique magic */ + if (priv->magic) { + auth.magic = priv->magic; + } else { + do { + spin_lock(&lock); + if (!sequence) ++sequence; /* reserve 0 */ + auth.magic = sequence++; + spin_unlock(&lock); + } while (DRM(find_file)(dev, auth.magic)); + priv->magic = auth.magic; + DRM(add_magic)(dev, priv, auth.magic); + } + + DRM_DEBUG("%u\n", auth.magic); + if (copy_to_user((drm_auth_t *)arg, &auth, sizeof(auth))) + return -EFAULT; + return 0; +} + +int DRM(authmagic)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_auth_t auth; + drm_file_t *file; + + if (copy_from_user(&auth, (drm_auth_t *)arg, sizeof(auth))) + return -EFAULT; + DRM_DEBUG("%u\n", auth.magic); + if ((file = DRM(find_file)(dev, auth.magic))) { + file->authenticated = 1; + DRM(remove_magic)(dev, auth.magic); + return 0; + } + return -EINVAL; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h:1.2 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_bufs.h Tue Apr 10 12:08:04 2001 @@ -0,0 +1,1023 @@ +/* drm_bufs.h -- Generic buffer template -*- linux-c -*- + * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include <linux/vmalloc.h> +#include "drmP.h" + +#ifndef __HAVE_PCI_DMA +#define __HAVE_PCI_DMA 0 +#endif + +#ifndef __HAVE_SG +#define __HAVE_SG 0 +#endif + +#ifndef DRIVER_BUF_PRIV_T +#define DRIVER_BUF_PRIV_T u32 +#endif +#ifndef DRIVER_AGP_BUFFERS_MAP +#if __HAVE_AGP && __HAVE_DMA +#error "You must define DRIVER_AGP_BUFFERS_MAP()" +#else +#define DRIVER_AGP_BUFFERS_MAP( dev ) NULL +#endif +#endif + +/* + * Compute order. Can be made faster. + */ +int DRM(order)( unsigned long size ) +{ + int order; + unsigned long tmp; + + for ( order = 0, tmp = size ; tmp >>= 1 ; ++order ); + + if ( size & ~(1 << order) ) + ++order; + + return order; +} + +int DRM(addmap)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_map_t *map; + drm_map_list_t *list; + + if ( !(filp->f_mode & 3) ) return -EACCES; /* Require read/write */ + + map = DRM(alloc)( sizeof(*map), DRM_MEM_MAPS ); + if ( !map ) + return -ENOMEM; + + if ( copy_from_user( map, (drm_map_t *)arg, sizeof(*map) ) ) { + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + return -EFAULT; + } + + /* Only allow shared memory to be removable since we only keep enough + * book keeping information about shared memory to allow for removal + * when processes fork. + */ + if ( (map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM ) { + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + return -EINVAL; + } + DRM_DEBUG( "offset = 0x%08lx, size = 0x%08lx, type = %d\n", + map->offset, map->size, map->type ); + if ( (map->offset & (~PAGE_MASK)) || (map->size & (~PAGE_MASK)) ) { + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + return -EINVAL; + } + map->mtrr = -1; + map->handle = 0; + + switch ( map->type ) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: +#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) ) { + map->mtrr = mtrr_add( map->offset, map->size, + MTRR_TYPE_WRCOMB, 1 ); + } +#endif + map->handle = DRM(ioremap)( map->offset, map->size ); + break; + + case _DRM_SHM: + map->handle = vmalloc_32(map->size); + DRM_DEBUG( "%ld %d %p\n", + map->size, DRM(order)( map->size ), map->handle ); + if ( !map->handle ) { + DRM(free)( map, sizeof(*map), DRM_MEM_MAPS ); + return -ENOMEM; + } + map->offset = (unsigned long)map->handle; + if ( map->flags & _DRM_CONTAINS_LOCK ) { + dev->lock.hw_lock = map->handle; /* Pointer to lock */ + } + break; +#if __REALLY_HAVE_AGP + case _DRM_AGP: +#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; + } + + list = DRM(alloc)(sizeof(*list), DRM_MEM_MAPS); + if(!list) { + DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); + return -EINVAL; + } + memset(list, 0, sizeof(*list)); + list->map = map; + + down(&dev->struct_sem); + list_add(&list->head, &dev->maplist->head); + up(&dev->struct_sem); + + if ( copy_to_user( (drm_map_t *)arg, map, sizeof(*map) ) ) + return -EFAULT; + if ( map->type != _DRM_SHM ) { + if ( copy_to_user( &((drm_map_t *)arg)->handle, + &map->offset, + sizeof(map->offset) ) ) + return -EFAULT; + } + return 0; +} + + +/* Remove a map private from list and deallocate resources if the mapping + * isn't in use. + */ + +int DRM(rmmap)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + struct list_head *list; + drm_map_list_t *r_list; + drm_vma_entry_t *pt, *prev; + drm_map_t *map; + drm_map_t request; + int found_maps = 0; + + if (copy_from_user(&request, (drm_map_t *)arg, + sizeof(request))) { + return -EFAULT; + } + + down(&dev->struct_sem); + list = &dev->maplist->head; + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *) list; + + if(r_list->map && + r_list->map->handle == request.handle && + r_list->map->flags & _DRM_REMOVABLE) break; + } + + /* List has wrapped around to the head pointer, or its empty we didn't + * find anything. + */ + if(list == (&dev->maplist->head)) { + up(&dev->struct_sem); + return -EINVAL; + } + map = r_list->map; + list_del(list); + DRM(free)(list, sizeof(*list), DRM_MEM_MAPS); + + for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { +#if LINUX_VERSION_CODE >= 0x020300 + if (pt->vma->vm_private_data == map) found_maps++; +#else + if (pt->vma->vm_pte == map) found_maps++; +#endif + } + + if(!found_maps) { + switch (map->type) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: +#if __REALLY_HAVE_MTRR + if (map->mtrr >= 0) { + int retcode; + retcode = mtrr_del(map->mtrr, + map->offset, + map->size); + DRM_DEBUG("mtrr_del = %d\n", retcode); + } +#endif + DRM(ioremapfree)(map->handle, map->size); + break; + case _DRM_SHM: + vfree(map->handle); + break; + case _DRM_AGP: + case _DRM_SCATTER_GATHER: + break; + } + DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); + } + up(&dev->struct_sem); + return 0; +} + +#if __HAVE_DMA + +#if __REALLY_HAVE_AGP +int DRM(addbufs_agp)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + drm_buf_entry_t *entry; + drm_buf_t *buf; + unsigned long offset; + unsigned long agp_offset; + int count; + int order; + int size; + int alignment; + int page_order; + int total; + int byte_count; + int i; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, (drm_buf_desc_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + count = request.count; + order = DRM(order)( request.size ); + size = 1 << order; + + alignment = (request.flags & _DRM_PAGE_ALIGN) + ? PAGE_ALIGN(size) : size; + page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; + total = PAGE_SIZE << page_order; + + byte_count = 0; + agp_offset = dev->agp->base + request.agp_start; + + DRM_DEBUG( "count: %d\n", count ); + DRM_DEBUG( "order: %d\n", order ); + DRM_DEBUG( "size: %d\n", size ); + DRM_DEBUG( "agp_offset: %ld\n", agp_offset ); + DRM_DEBUG( "alignment: %d\n", alignment ); + DRM_DEBUG( "page_order: %d\n", page_order ); + DRM_DEBUG( "total: %d\n", total ); + + if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; + if ( dev->queue_count ) return -EBUSY; /* Not while in use */ + + spin_lock( &dev->count_lock ); + if ( dev->buf_use ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + atomic_inc( &dev->buf_alloc ); + spin_unlock( &dev->count_lock ); + + down( &dev->struct_sem ); + entry = &dma->bufs[order]; + if ( entry->buf_count ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; /* May only call once for each order */ + } + + entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + if ( !entry->buflist ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); + + entry->buf_size = size; + entry->page_order = page_order; + + offset = 0; + + while ( entry->buf_count < count ) { + buf = &entry->buflist[entry->buf_count]; + buf->idx = dma->buf_count + entry->buf_count; + buf->total = alignment; + buf->order = order; + buf->used = 0; + + buf->offset = (dma->byte_count + offset); + buf->bus_address = agp_offset + offset; + buf->address = (void *)(agp_offset + offset); + buf->next = NULL; + buf->waiting = 0; + buf->pending = 0; + init_waitqueue_head( &buf->dma_wait ); + buf->pid = 0; + + buf->dev_priv_size = sizeof(DRIVER_BUF_PRIV_T); + buf->dev_private = DRM(alloc)( sizeof(DRIVER_BUF_PRIV_T), + DRM_MEM_BUFS ); + memset( buf->dev_private, 0, buf->dev_priv_size ); + +#if __HAVE_DMA_HISTOGRAM + buf->time_queued = 0; + buf->time_dispatched = 0; + buf->time_completed = 0; + buf->time_freed = 0; +#endif + DRM_DEBUG( "buffer %d @ %p\n", + entry->buf_count, buf->address ); + + offset += alignment; + entry->buf_count++; + byte_count += PAGE_SIZE << page_order; + } + + DRM_DEBUG( "byte_count: %d\n", byte_count ); + + dma->buflist = DRM(realloc)( dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS ); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dma->buflist[i + dma->buf_count] = &entry->buflist[i]; + } + + dma->buf_count += entry->buf_count; + dma->byte_count += byte_count; + + DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count ); + DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count ); + +#if __HAVE_DMA_FREELIST + DRM(freelist_create)( &entry->freelist, entry->buf_count ); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); + } +#endif + up( &dev->struct_sem ); + + request.count = entry->buf_count; + request.size = size; + + if ( copy_to_user( (drm_buf_desc_t *)arg, &request, sizeof(request) ) ) + return -EFAULT; + + dma->flags = _DRM_DMA_USE_AGP; + + atomic_dec( &dev->buf_alloc ); + return 0; +} +#endif /* __REALLY_HAVE_AGP */ + +#if __HAVE_PCI_DMA +int DRM(addbufs_pci)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + int count; + int order; + int size; + int total; + int page_order; + drm_buf_entry_t *entry; + unsigned long page; + drm_buf_t *buf; + int alignment; + unsigned long offset; + int i; + int byte_count; + int page_count; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, (drm_buf_desc_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + count = request.count; + order = DRM(order)( request.size ); + size = 1 << order; + + DRM_DEBUG( "count=%d, size=%d (%d), order=%d, queue_count=%d\n", + request.count, request.size, size, + order, dev->queue_count ); + + if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; + if ( dev->queue_count ) return -EBUSY; /* Not while in use */ + + alignment = (request.flags & _DRM_PAGE_ALIGN) + ? PAGE_ALIGN(size) : size; + page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; + total = PAGE_SIZE << page_order; + + spin_lock( &dev->count_lock ); + if ( dev->buf_use ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + atomic_inc( &dev->buf_alloc ); + spin_unlock( &dev->count_lock ); + + down( &dev->struct_sem ); + entry = &dma->bufs[order]; + if ( entry->buf_count ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; /* May only call once for each order */ + } + + entry->buflist = DRM(alloc)( count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + if ( !entry->buflist ) { + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( entry->buflist, 0, count * sizeof(*entry->buflist) ); + + entry->seglist = DRM(alloc)( count * sizeof(*entry->seglist), + DRM_MEM_SEGS ); + if ( !entry->seglist ) { + DRM(free)( entry->buflist, + count * sizeof(*entry->buflist), + DRM_MEM_BUFS ); + up( &dev->struct_sem ); + atomic_dec( &dev->buf_alloc ); + return -ENOMEM; + } + memset( entry->seglist, 0, count * sizeof(*entry->seglist) ); + + dma->pagelist = DRM(realloc)( dma->pagelist, + dma->page_count * sizeof(*dma->pagelist), + (dma->page_count + (count << page_order)) + * sizeof(*dma->pagelist), + DRM_MEM_PAGES ); + DRM_DEBUG( "pagelist: %d entries\n", + dma->page_count + (count << page_order) ); + + entry->buf_size = size; + entry->page_order = page_order; + byte_count = 0; + page_count = 0; + + while ( entry->buf_count < count ) { + page = DRM(alloc_pages)( page_order, DRM_MEM_DMA ); + if ( !page ) break; + entry->seglist[entry->seg_count++] = page; + for ( i = 0 ; i < (1 << page_order) ; i++ ) { + DRM_DEBUG( "page %d @ 0x%08lx\n", + dma->page_count + page_count, + page + PAGE_SIZE * i ); + dma->pagelist[dma->page_count + page_count++] + = page + PAGE_SIZE * i; + } + for ( offset = 0 ; + offset + size <= total && entry->buf_count < count ; + offset += alignment, ++entry->buf_count ) { + buf = &entry->buflist[entry->buf_count]; + buf->idx = dma->buf_count + entry->buf_count; + buf->total = alignment; + buf->order = order; + buf->used = 0; + buf->offset = (dma->byte_count + byte_count + offset); + buf->address = (void *)(page + offset); + buf->next = NULL; + buf->waiting = 0; + buf->pending = 0; + init_waitqueue_head( &buf->dma_wait ); + buf->pid = 0; +#if __HAVE_DMA_HISTOGRAM + buf->time_queued = 0; + buf->time_dispatched = 0; + buf->time_completed = 0; + buf->time_freed = 0; +#endif + DRM_DEBUG( "buffer %d @ %p\n", + entry->buf_count, buf->address ); + } + byte_count += PAGE_SIZE << page_order; + } + + dma->buflist = DRM(realloc)( dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + (dma->buf_count + entry->buf_count) + * sizeof(*dma->buflist), + DRM_MEM_BUFS ); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + dma->buflist[i + dma->buf_count] = &entry->buflist[i]; + } + + dma->buf_count += entry->buf_count; + dma->seg_count += entry->seg_count; + dma->page_count += entry->seg_count << page_order; + dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order); + +#if __HAVE_DMA_FREELIST + DRM(freelist_create)( &entry->freelist, entry->buf_count ); + for ( i = 0 ; i < entry->buf_count ; i++ ) { + DRM(freelist_put)( dev, &entry->freelist, &entry->buflist[i] ); + } +#endif + up( &dev->struct_sem ); + + request.count = entry->buf_count; + request.size = size; + + if ( copy_to_user( (drm_buf_desc_t *)arg, &request, sizeof(request) ) ) + return -EFAULT; + + atomic_dec( &dev->buf_alloc ); + return 0; +} +#endif /* __HAVE_PCI_DMA */ + +#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 ) +{ + drm_buf_desc_t request; + + if ( copy_from_user( &request, (drm_buf_desc_t *)arg, + sizeof(request) ) ) + return -EFAULT; + +#if __REALLY_HAVE_AGP + if ( request.flags & _DRM_AGP_BUFFER ) + return DRM(addbufs_agp)( inode, filp, cmd, arg ); + else +#endif +#if __HAVE_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 + return -EINVAL; +#endif +} + +int DRM(infobufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_info_t request; + int i; + int count; + + if ( !dma ) return -EINVAL; + + spin_lock( &dev->count_lock ); + if ( atomic_read( &dev->buf_alloc ) ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + ++dev->buf_use; /* Can't allocate more after this call */ + spin_unlock( &dev->count_lock ); + + if ( copy_from_user( &request, + (drm_buf_info_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) { + if ( dma->bufs[i].buf_count ) ++count; + } + + DRM_DEBUG( "count = %d\n", count ); + + if ( request.count >= count ) { + for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) { + if ( dma->bufs[i].buf_count ) { + drm_buf_desc_t *to = &request.list[count]; + drm_buf_entry_t *from = &dma->bufs[i]; + drm_freelist_t *list = &dma->bufs[i].freelist; + if ( copy_to_user( &to->count, + &from->buf_count, + sizeof(from->buf_count) ) || + copy_to_user( &to->size, + &from->buf_size, + sizeof(from->buf_size) ) || + copy_to_user( &to->low_mark, + &list->low_mark, + sizeof(list->low_mark) ) || + copy_to_user( &to->high_mark, + &list->high_mark, + sizeof(list->high_mark) ) ) + return -EFAULT; + + DRM_DEBUG( "%d %d %d %d %d\n", + i, + dma->bufs[i].buf_count, + dma->bufs[i].buf_size, + dma->bufs[i].freelist.low_mark, + dma->bufs[i].freelist.high_mark ); + ++count; + } + } + } + request.count = count; + + if ( copy_to_user( (drm_buf_info_t *)arg, + &request, + sizeof(request) ) ) + return -EFAULT; + + return 0; +} + +int DRM(markbufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + int order; + drm_buf_entry_t *entry; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, + (drm_buf_desc_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + DRM_DEBUG( "%d, %d, %d\n", + request.size, request.low_mark, request.high_mark ); + order = DRM(order)( request.size ); + if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL; + entry = &dma->bufs[order]; + + if ( request.low_mark < 0 || request.low_mark > entry->buf_count ) + return -EINVAL; + if ( request.high_mark < 0 || request.high_mark > entry->buf_count ) + return -EINVAL; + + entry->freelist.low_mark = request.low_mark; + entry->freelist.high_mark = request.high_mark; + + return 0; +} + +int DRM(freebufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_free_t request; + int i; + int idx; + drm_buf_t *buf; + + if ( !dma ) return -EINVAL; + + if ( copy_from_user( &request, + (drm_buf_free_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + DRM_DEBUG( "%d\n", request.count ); + for ( i = 0 ; i < request.count ; i++ ) { + if ( copy_from_user( &idx, + &request.list[i], + sizeof(idx) ) ) + return -EFAULT; + if ( idx < 0 || idx >= dma->buf_count ) { + DRM_ERROR( "Index %d (of %d max)\n", + idx, dma->buf_count - 1 ); + return -EINVAL; + } + buf = dma->buflist[idx]; + if ( buf->pid != current->pid ) { + DRM_ERROR( "Process %d freeing buffer owned by %d\n", + current->pid, buf->pid ); + return -EINVAL; + } + DRM(free_buffer)( dev, buf ); + } + + return 0; +} + +int DRM(mapbufs)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + int retcode = 0; + const int zero = 0; + unsigned long virtual; + unsigned long address; + drm_buf_map_t request; + int i; + + if ( !dma ) return -EINVAL; + + spin_lock( &dev->count_lock ); + if ( atomic_read( &dev->buf_alloc ) ) { + spin_unlock( &dev->count_lock ); + return -EBUSY; + } + dev->buf_use++; /* Can't allocate more after this call */ + spin_unlock( &dev->count_lock ); + + if ( copy_from_user( &request, (drm_buf_map_t *)arg, + sizeof(request) ) ) + return -EFAULT; + + if ( request.count >= dma->buf_count ) { + if ( (__HAVE_AGP && (dma->flags & _DRM_DMA_USE_AGP)) || + (__HAVE_SG && (dma->flags & _DRM_DMA_USE_SG)) ) { + drm_map_t *map = DRIVER_AGP_BUFFERS_MAP( dev ); + + if ( !map ) { + retcode = -EINVAL; + 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 */ + retcode = (signed long)virtual; + goto done; + } + request.virtual = (void *)virtual; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + if ( copy_to_user( &request.list[i].idx, + &dma->buflist[i]->idx, + sizeof(request.list[0].idx) ) ) { + retcode = -EFAULT; + goto done; + } + if ( copy_to_user( &request.list[i].total, + &dma->buflist[i]->total, + sizeof(request.list[0].total) ) ) { + retcode = -EFAULT; + goto done; + } + if ( copy_to_user( &request.list[i].used, + &zero, + sizeof(zero) ) ) { + retcode = -EFAULT; + goto done; + } + address = virtual + dma->buflist[i]->offset; /* *** */ + if ( copy_to_user( &request.list[i].address, + &address, + sizeof(address) ) ) { + retcode = -EFAULT; + goto done; + } + } + } + done: + request.count = dma->buf_count; + DRM_DEBUG( "%d buffers, retcode = %d\n", request.count, retcode ); + + if ( copy_to_user( (drm_buf_map_t *)arg, &request, sizeof(request) ) ) + return -EFAULT; + + return retcode; +} + +#endif /* __HAVE_DMA */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_context.h Wed Mar 21 13:08:55 2001 @@ -0,0 +1,760 @@ +/* drm_context.h -- IOCTLs for generic contexts -*- linux-c -*- + * Created: Fri Nov 24 18:31:37 2000 by gareth@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +#if __HAVE_CTX_BITMAP + +/* ================================================================ + * Context bitmap support + */ + +void DRM(ctxbitmap_free)( drm_device_t *dev, int ctx_handle ) +{ + if ( ctx_handle < 0 ) goto failed; + if ( !dev->ctx_bitmap ) goto failed; + + if ( ctx_handle < DRM_MAX_CTXBITMAP ) { + down(&dev->struct_sem); + clear_bit( ctx_handle, dev->ctx_bitmap ); + dev->context_sareas[ctx_handle] = NULL; + up(&dev->struct_sem); + return; + } +failed: + DRM_ERROR( "Attempt to free invalid context handle: %d\n", + ctx_handle ); + return; +} + +int DRM(ctxbitmap_next)( drm_device_t *dev ) +{ + int bit; + + if(!dev->ctx_bitmap) return -1; + + down(&dev->struct_sem); + bit = find_first_zero_bit( dev->ctx_bitmap, DRM_MAX_CTXBITMAP ); + if ( bit < DRM_MAX_CTXBITMAP ) { + set_bit( bit, dev->ctx_bitmap ); + DRM_DEBUG( "drm_ctxbitmap_next bit : %d\n", bit ); + if((bit+1) > dev->max_context) { + dev->max_context = (bit+1); + if(dev->context_sareas) { + dev->context_sareas = DRM(realloc)( + dev->context_sareas, + (dev->max_context - 1) * + sizeof(*dev->context_sareas), + dev->max_context * + sizeof(*dev->context_sareas), + DRM_MEM_MAPS); + dev->context_sareas[bit] = NULL; + } else { + /* max_context == 1 at this point */ + dev->context_sareas = DRM(alloc)( + dev->max_context * + sizeof(*dev->context_sareas), + DRM_MEM_MAPS); + dev->context_sareas[bit] = NULL; + } + } + up(&dev->struct_sem); + return bit; + } + up(&dev->struct_sem); + return -1; +} + +int DRM(ctxbitmap_init)( drm_device_t *dev ) +{ + int i; + int temp; + + down(&dev->struct_sem); + dev->ctx_bitmap = (unsigned long *) DRM(alloc)( PAGE_SIZE, + DRM_MEM_CTXBITMAP ); + if ( dev->ctx_bitmap == NULL ) { + up(&dev->struct_sem); + return -ENOMEM; + } + memset( (void *)dev->ctx_bitmap, 0, PAGE_SIZE ); + dev->context_sareas = NULL; + dev->max_context = -1; + up(&dev->struct_sem); + + for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { + temp = DRM(ctxbitmap_next)( dev ); + DRM_DEBUG( "drm_ctxbitmap_init : %d\n", temp ); + } + + return 0; +} + +void DRM(ctxbitmap_cleanup)( drm_device_t *dev ) +{ + down(&dev->struct_sem); + if( dev->context_sareas ) DRM(free)( dev->context_sareas, + sizeof(*dev->context_sareas) * + dev->max_context, + DRM_MEM_MAPS ); + DRM(free)( (void *)dev->ctx_bitmap, PAGE_SIZE, DRM_MEM_CTXBITMAP ); + up(&dev->struct_sem); +} + +/* ================================================================ + * Per Context SAREA Support + */ + +int DRM(getsareactx)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_priv_map_t request; + drm_map_t *map; + + if (copy_from_user(&request, + (drm_ctx_priv_map_t *)arg, + sizeof(request))) + return -EFAULT; + + down(&dev->struct_sem); + if ((int)request.ctx_id >= dev->max_context) { + up(&dev->struct_sem); + return -EINVAL; + } + + map = dev->context_sareas[request.ctx_id]; + up(&dev->struct_sem); + + request.handle = map->handle; + if (copy_to_user((drm_ctx_priv_map_t *)arg, &request, sizeof(request))) + return -EFAULT; + return 0; +} + +int DRM(setsareactx)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_priv_map_t request; + drm_map_t *map = NULL; + drm_map_list_t *r_list; + struct list_head *list; + + if (copy_from_user(&request, + (drm_ctx_priv_map_t *)arg, + sizeof(request))) + return -EFAULT; + + down(&dev->struct_sem); + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *)list; + if(r_list->map && + r_list->map->handle == request.handle) break; + } + if (list == &(dev->maplist->head)) { + up(&dev->struct_sem); + return -EINVAL; + } + map = r_list->map; + up(&dev->struct_sem); + + if (!map) return -EINVAL; + + down(&dev->struct_sem); + if ((int)request.ctx_id >= dev->max_context) { + up(&dev->struct_sem); + return -EINVAL; + } + dev->context_sareas[request.ctx_id] = map; + up(&dev->struct_sem); + return 0; +} + +/* ================================================================ + * The actual DRM context handling routines + */ + +int DRM(context_switch)( drm_device_t *dev, int old, int new ) +{ + char buf[64]; + + if ( test_and_set_bit( 0, &dev->context_flag ) ) { + DRM_ERROR( "Reentering -- FIXME\n" ); + return -EBUSY; + } + +#if __HAVE_DMA_HISTOGRAM + dev->ctx_start = get_cycles(); +#endif + + DRM_DEBUG( "Context switch from %d to %d\n", old, new ); + + if ( new == dev->last_context ) { + clear_bit( 0, &dev->context_flag ); + return 0; + } + + if ( DRM(flags) & DRM_FLAG_NOCTX ) { + DRM(context_switch_complete)( dev, new ); + } else { + sprintf( buf, "C %d %d\n", old, new ); + DRM(write_string)( dev, buf ); + } + + return 0; +} + +int DRM(context_switch_complete)( drm_device_t *dev, int new ) +{ + dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ + dev->last_switch = jiffies; + + if ( !_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) ) { + DRM_ERROR( "Lock isn't held after context switch\n" ); + } + + /* If a context switch is ever initiated + when the kernel holds the lock, release + that lock here. */ +#if __HAVE_DMA_HISTOGRAM + atomic_inc( &dev->histo.ctx[DRM(histogram_slot)(get_cycles() + - dev->ctx_start)] ); + +#endif + clear_bit( 0, &dev->context_flag ); + wake_up( &dev->context_wait ); + + return 0; +} + +int DRM(resctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_ctx_res_t res; + drm_ctx_t ctx; + int i; + + if ( copy_from_user( &res, (drm_ctx_res_t *)arg, sizeof(res) ) ) + return -EFAULT; + + if ( res.count >= DRM_RESERVED_CONTEXTS ) { + memset( &ctx, 0, sizeof(ctx) ); + for ( i = 0 ; i < DRM_RESERVED_CONTEXTS ; i++ ) { + ctx.handle = i; + if ( copy_to_user( &res.contexts[i], + &i, sizeof(i) ) ) + return -EFAULT; + } + } + res.count = DRM_RESERVED_CONTEXTS; + + if ( copy_to_user( (drm_ctx_res_t *)arg, &res, sizeof(res) ) ) + return -EFAULT; + return 0; +} + +int DRM(addctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) ) + return -EFAULT; + + ctx.handle = DRM(ctxbitmap_next)( dev ); + if ( ctx.handle == DRM_KERNEL_CONTEXT ) { + /* Skip kernel's context and get a new one. */ + ctx.handle = DRM(ctxbitmap_next)( dev ); + } + DRM_DEBUG( "%d\n", ctx.handle ); + if ( ctx.handle == -1 ) { + DRM_DEBUG( "Not enough free contexts.\n" ); + /* Should this return -EBUSY instead? */ + return -ENOMEM; + } + + if ( copy_to_user( (drm_ctx_t *)arg, &ctx, sizeof(ctx) ) ) + return -EFAULT; + return 0; +} + +int DRM(modctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + /* This does nothing */ + return 0; +} + +int DRM(getctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_ctx_t ctx; + + if ( copy_from_user( &ctx, (drm_ctx_t*)arg, sizeof(ctx) ) ) + return -EFAULT; + + /* This is 0, because we don't handle any context flags */ + ctx.flags = 0; + + if ( copy_to_user( (drm_ctx_t*)arg, &ctx, sizeof(ctx) ) ) + return -EFAULT; + return 0; +} + +int DRM(switchctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) ) + return -EFAULT; + + DRM_DEBUG( "%d\n", ctx.handle ); + return DRM(context_switch)( dev, dev->last_context, ctx.handle ); +} + +int DRM(newctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) ) + return -EFAULT; + + DRM_DEBUG( "%d\n", ctx.handle ); + DRM(context_switch_complete)( dev, ctx.handle ); + + return 0; +} + +int DRM(rmctx)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + if ( copy_from_user( &ctx, (drm_ctx_t *)arg, sizeof(ctx) ) ) + return -EFAULT; + + DRM_DEBUG( "%d\n", ctx.handle ); + if ( ctx.handle == DRM_KERNEL_CONTEXT + 1 ) { + priv->remove_auth_on_close = 1; + } + if ( ctx.handle != DRM_KERNEL_CONTEXT ) { + DRM(ctxbitmap_free)( dev, ctx.handle ); + } + + return 0; +} + + +#else /* __HAVE_CTX_BITMAP */ + +/* ================================================================ + * Old-style context support + */ + + +int DRM(context_switch)(drm_device_t *dev, int old, int new) +{ + char buf[64]; + drm_queue_t *q; + +#if 0 + atomic_inc(&dev->total_ctx); +#endif + + if (test_and_set_bit(0, &dev->context_flag)) { + DRM_ERROR("Reentering -- FIXME\n"); + return -EBUSY; + } + +#if __HAVE_DMA_HISTOGRAM + dev->ctx_start = get_cycles(); +#endif + + DRM_DEBUG("Context switch from %d to %d\n", old, new); + + if (new >= dev->queue_count) { + clear_bit(0, &dev->context_flag); + return -EINVAL; + } + + if (new == dev->last_context) { + clear_bit(0, &dev->context_flag); + return 0; + } + + q = dev->queuelist[new]; + atomic_inc(&q->use_count); + if (atomic_read(&q->use_count) == 1) { + atomic_dec(&q->use_count); + clear_bit(0, &dev->context_flag); + return -EINVAL; + } + + if (DRM(flags) & DRM_FLAG_NOCTX) { + DRM(context_switch_complete)(dev, new); + } else { + sprintf(buf, "C %d %d\n", old, new); + DRM(write_string)(dev, buf); + } + + atomic_dec(&q->use_count); + + return 0; +} + +int DRM(context_switch_complete)(drm_device_t *dev, int new) +{ + drm_device_dma_t *dma = dev->dma; + + dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ + dev->last_switch = jiffies; + + if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { + DRM_ERROR("Lock isn't held after context switch\n"); + } + + if (!dma || !(dma->next_buffer && dma->next_buffer->while_locked)) { + if (DRM(lock_free)(dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT)) { + DRM_ERROR("Cannot free lock\n"); + } + } + +#if __HAVE_DMA_HISTOGRAM + atomic_inc(&dev->histo.ctx[DRM(histogram_slot)(get_cycles() + - dev->ctx_start)]); + +#endif + clear_bit(0, &dev->context_flag); + wake_up_interruptible(&dev->context_wait); + + return 0; +} + +static int DRM(init_queue)(drm_device_t *dev, drm_queue_t *q, drm_ctx_t *ctx) +{ + DRM_DEBUG("\n"); + + if (atomic_read(&q->use_count) != 1 + || atomic_read(&q->finalization) + || atomic_read(&q->block_count)) { + DRM_ERROR("New queue is already in use: u%d f%d b%d\n", + atomic_read(&q->use_count), + atomic_read(&q->finalization), + atomic_read(&q->block_count)); + } + + atomic_set(&q->finalization, 0); + atomic_set(&q->block_count, 0); + atomic_set(&q->block_read, 0); + atomic_set(&q->block_write, 0); + atomic_set(&q->total_queued, 0); + atomic_set(&q->total_flushed, 0); + atomic_set(&q->total_locks, 0); + + init_waitqueue_head(&q->write_queue); + init_waitqueue_head(&q->read_queue); + init_waitqueue_head(&q->flush_queue); + + q->flags = ctx->flags; + + DRM(waitlist_create)(&q->waitlist, dev->dma->buf_count); + + return 0; +} + + +/* drm_alloc_queue: +PRE: 1) dev->queuelist[0..dev->queue_count] is allocated and will not + disappear (so all deallocation must be done after IOCTLs are off) + 2) dev->queue_count < dev->queue_slots + 3) dev->queuelist[i].use_count == 0 and + dev->queuelist[i].finalization == 0 if i not in use +POST: 1) dev->queuelist[i].use_count == 1 + 2) dev->queue_count < dev->queue_slots */ + +static int DRM(alloc_queue)(drm_device_t *dev) +{ + int i; + drm_queue_t *queue; + int oldslots; + int newslots; + /* Check for a free queue */ + for (i = 0; i < dev->queue_count; i++) { + atomic_inc(&dev->queuelist[i]->use_count); + if (atomic_read(&dev->queuelist[i]->use_count) == 1 + && !atomic_read(&dev->queuelist[i]->finalization)) { + DRM_DEBUG("%d (free)\n", i); + return i; + } + atomic_dec(&dev->queuelist[i]->use_count); + } + /* Allocate a new queue */ + down(&dev->struct_sem); + + queue = gamma_alloc(sizeof(*queue), DRM_MEM_QUEUES); + memset(queue, 0, sizeof(*queue)); + atomic_set(&queue->use_count, 1); + + ++dev->queue_count; + if (dev->queue_count >= dev->queue_slots) { + oldslots = dev->queue_slots * sizeof(*dev->queuelist); + if (!dev->queue_slots) dev->queue_slots = 1; + dev->queue_slots *= 2; + newslots = dev->queue_slots * sizeof(*dev->queuelist); + + dev->queuelist = DRM(realloc)(dev->queuelist, + oldslots, + newslots, + DRM_MEM_QUEUES); + if (!dev->queuelist) { + up(&dev->struct_sem); + DRM_DEBUG("out of memory\n"); + return -ENOMEM; + } + } + dev->queuelist[dev->queue_count-1] = queue; + + up(&dev->struct_sem); + DRM_DEBUG("%d (new)\n", dev->queue_count - 1); + return dev->queue_count - 1; +} + +int DRM(resctx)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_ctx_res_t res; + drm_ctx_t ctx; + int i; + + DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); + if (copy_from_user(&res, (drm_ctx_res_t *)arg, sizeof(res))) + return -EFAULT; + if (res.count >= DRM_RESERVED_CONTEXTS) { + memset(&ctx, 0, sizeof(ctx)); + for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { + ctx.handle = i; + if (copy_to_user(&res.contexts[i], + &i, + sizeof(i))) + return -EFAULT; + } + } + res.count = DRM_RESERVED_CONTEXTS; + if (copy_to_user((drm_ctx_res_t *)arg, &res, sizeof(res))) + return -EFAULT; + return 0; +} + +int DRM(addctx)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; + if ((ctx.handle = DRM(alloc_queue)(dev)) == DRM_KERNEL_CONTEXT) { + /* Init kernel's context and get a new one. */ + DRM(init_queue)(dev, dev->queuelist[ctx.handle], &ctx); + ctx.handle = DRM(alloc_queue)(dev); + } + DRM(init_queue)(dev, dev->queuelist[ctx.handle], &ctx); + DRM_DEBUG("%d\n", ctx.handle); + if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx))) + return -EFAULT; + return 0; +} + +int DRM(modctx)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + drm_queue_t *q; + + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; + + DRM_DEBUG("%d\n", ctx.handle); + + if (ctx.handle < 0 || ctx.handle >= dev->queue_count) return -EINVAL; + q = dev->queuelist[ctx.handle]; + + atomic_inc(&q->use_count); + if (atomic_read(&q->use_count) == 1) { + /* No longer in use */ + atomic_dec(&q->use_count); + return -EINVAL; + } + + if (DRM_BUFCOUNT(&q->waitlist)) { + atomic_dec(&q->use_count); + return -EBUSY; + } + + q->flags = ctx.flags; + + atomic_dec(&q->use_count); + return 0; +} + +int DRM(getctx)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + drm_queue_t *q; + + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; + + DRM_DEBUG("%d\n", ctx.handle); + + if (ctx.handle >= dev->queue_count) return -EINVAL; + q = dev->queuelist[ctx.handle]; + + atomic_inc(&q->use_count); + if (atomic_read(&q->use_count) == 1) { + /* No longer in use */ + atomic_dec(&q->use_count); + return -EINVAL; + } + + ctx.flags = q->flags; + atomic_dec(&q->use_count); + + if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx))) + return -EFAULT; + + return 0; +} + +int DRM(switchctx)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; + DRM_DEBUG("%d\n", ctx.handle); + return DRM(context_switch)(dev, dev->last_context, ctx.handle); +} + +int DRM(newctx)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; + DRM_DEBUG("%d\n", ctx.handle); + DRM(context_switch_complete)(dev, ctx.handle); + + return 0; +} + +int DRM(rmctx)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ctx_t ctx; + drm_queue_t *q; + drm_buf_t *buf; + + if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) + return -EFAULT; + DRM_DEBUG("%d\n", ctx.handle); + + if (ctx.handle >= dev->queue_count) return -EINVAL; + q = dev->queuelist[ctx.handle]; + + atomic_inc(&q->use_count); + if (atomic_read(&q->use_count) == 1) { + /* No longer in use */ + atomic_dec(&q->use_count); + return -EINVAL; + } + + atomic_inc(&q->finalization); /* Mark queue in finalization state */ + atomic_sub(2, &q->use_count); /* Mark queue as unused (pending + finalization) */ + + while (test_and_set_bit(0, &dev->interrupt_flag)) { + schedule(); + if (signal_pending(current)) { + clear_bit(0, &dev->interrupt_flag); + return -EINTR; + } + } + /* Remove queued buffers */ + while ((buf = DRM(waitlist_get)(&q->waitlist))) { + DRM(free_buffer)(dev, buf); + } + clear_bit(0, &dev->interrupt_flag); + + /* Wakeup blocked processes */ + wake_up_interruptible(&q->read_queue); + wake_up_interruptible(&q->write_queue); + wake_up_interruptible(&q->flush_queue); + + /* Finalization over. Queue is made + available when both use_count and + finalization become 0, which won't + happen until all the waiting processes + stop waiting. */ + atomic_dec(&q->finalization); + return 0; +} + +#endif /* __HAVE_CTX_BITMAP */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_dma.h Wed Mar 21 13:08:55 2001 @@ -0,0 +1,594 @@ +/* drm_dma.c -- DMA IOCTL and function support -*- linux-c -*- + * Created: Fri Mar 19 14:30:16 1999 by faith@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +#include <linux/interrupt.h> /* For task queue support */ + +#ifndef __HAVE_DMA_WAITQUEUE +#define __HAVE_DMA_WAITQUEUE 0 +#endif +#ifndef __HAVE_DMA_RECLAIM +#define __HAVE_DMA_RECLAIM 0 +#endif + +#if __HAVE_DMA + +int DRM(dma_setup)( drm_device_t *dev ) +{ + int i; + + dev->dma = DRM(alloc)( sizeof(*dev->dma), DRM_MEM_DRIVER ); + if ( !dev->dma ) + return -ENOMEM; + + memset( dev->dma, 0, sizeof(*dev->dma) ); + + for ( i = 0 ; i <= DRM_MAX_ORDER ; i++ ) + memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0])); + + return 0; +} + +void DRM(dma_takedown)(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + int i, j; + + if (!dma) return; + + /* Clear dma buffers */ + for (i = 0; i <= DRM_MAX_ORDER; i++) { + if (dma->bufs[i].seg_count) { + DRM_DEBUG("order %d: buf_count = %d," + " seg_count = %d\n", + i, + dma->bufs[i].buf_count, + dma->bufs[i].seg_count); + for (j = 0; j < dma->bufs[i].seg_count; j++) { + DRM(free_pages)(dma->bufs[i].seglist[j], + dma->bufs[i].page_order, + DRM_MEM_DMA); + } + DRM(free)(dma->bufs[i].seglist, + dma->bufs[i].seg_count + * sizeof(*dma->bufs[0].seglist), + DRM_MEM_SEGS); + } + if(dma->bufs[i].buf_count) { + for(j = 0; j < dma->bufs[i].buf_count; j++) { + if(dma->bufs[i].buflist[j].dev_private) { + DRM(free)(dma->bufs[i].buflist[j].dev_private, + dma->bufs[i].buflist[j].dev_priv_size, + DRM_MEM_BUFS); + } + } + DRM(free)(dma->bufs[i].buflist, + dma->bufs[i].buf_count * + sizeof(*dma->bufs[0].buflist), + DRM_MEM_BUFS); +#if __HAVE_DMA_FREELIST + DRM(freelist_destroy)(&dma->bufs[i].freelist); +#endif + } + } + + if (dma->buflist) { + DRM(free)(dma->buflist, + dma->buf_count * sizeof(*dma->buflist), + DRM_MEM_BUFS); + } + + if (dma->pagelist) { + DRM(free)(dma->pagelist, + dma->page_count * sizeof(*dma->pagelist), + DRM_MEM_PAGES); + } + DRM(free)(dev->dma, sizeof(*dev->dma), DRM_MEM_DRIVER); + dev->dma = NULL; +} + + +#if __HAVE_DMA_HISTOGRAM +/* This is slow, but is useful for debugging. */ +int DRM(histogram_slot)(unsigned long count) +{ + int value = DRM_DMA_HISTOGRAM_INITIAL; + int slot; + + for (slot = 0; + slot < DRM_DMA_HISTOGRAM_SLOTS; + ++slot, value = DRM_DMA_HISTOGRAM_NEXT(value)) { + if (count < value) return slot; + } + return DRM_DMA_HISTOGRAM_SLOTS - 1; +} + +void DRM(histogram_compute)(drm_device_t *dev, drm_buf_t *buf) +{ + cycles_t queued_to_dispatched; + cycles_t dispatched_to_completed; + cycles_t completed_to_freed; + int q2d, d2c, c2f, q2c, q2f; + + if (buf->time_queued) { + queued_to_dispatched = (buf->time_dispatched + - buf->time_queued); + dispatched_to_completed = (buf->time_completed + - buf->time_dispatched); + completed_to_freed = (buf->time_freed + - buf->time_completed); + + q2d = DRM(histogram_slot)(queued_to_dispatched); + d2c = DRM(histogram_slot)(dispatched_to_completed); + c2f = DRM(histogram_slot)(completed_to_freed); + + q2c = DRM(histogram_slot)(queued_to_dispatched + + dispatched_to_completed); + q2f = DRM(histogram_slot)(queued_to_dispatched + + dispatched_to_completed + + completed_to_freed); + + atomic_inc(&dev->histo.total); + atomic_inc(&dev->histo.queued_to_dispatched[q2d]); + atomic_inc(&dev->histo.dispatched_to_completed[d2c]); + atomic_inc(&dev->histo.completed_to_freed[c2f]); + + atomic_inc(&dev->histo.queued_to_completed[q2c]); + atomic_inc(&dev->histo.queued_to_freed[q2f]); + + } + buf->time_queued = 0; + buf->time_dispatched = 0; + buf->time_completed = 0; + buf->time_freed = 0; +} +#endif + +void DRM(free_buffer)(drm_device_t *dev, drm_buf_t *buf) +{ + if (!buf) return; + + buf->waiting = 0; + buf->pending = 0; + buf->pid = 0; + buf->used = 0; +#if __HAVE_DMA_HISTOGRAM + buf->time_completed = get_cycles(); +#endif + + if ( __HAVE_DMA_WAITQUEUE && waitqueue_active(&buf->dma_wait)) { + wake_up_interruptible(&buf->dma_wait); + } +#if __HAVE_DMA_FREELIST + else { + drm_device_dma_t *dma = dev->dma; + /* If processes are waiting, the last one + to wake will put the buffer on the free + list. If no processes are waiting, we + put the buffer on the freelist here. */ + DRM(freelist_put)(dev, &dma->bufs[buf->order].freelist, buf); + } +#endif +} + +#if !__HAVE_DMA_RECLAIM +void DRM(reclaim_buffers)(drm_device_t *dev, pid_t pid) +{ + drm_device_dma_t *dma = dev->dma; + int i; + + if (!dma) return; + for (i = 0; i < dma->buf_count; i++) { + if (dma->buflist[i]->pid == pid) { + switch (dma->buflist[i]->list) { + case DRM_LIST_NONE: + DRM(free_buffer)(dev, dma->buflist[i]); + break; + case DRM_LIST_WAIT: + dma->buflist[i]->list = DRM_LIST_RECLAIM; + break; + default: + /* Buffer already on hardware. */ + break; + } + } + } +} +#endif + + +/* GH: This is a big hack for now... + */ +#if __HAVE_OLD_DMA + +void DRM(clear_next_buffer)(drm_device_t *dev) +{ + drm_device_dma_t *dma = dev->dma; + + dma->next_buffer = NULL; + if (dma->next_queue && !DRM_BUFCOUNT(&dma->next_queue->waitlist)) { + wake_up_interruptible(&dma->next_queue->flush_queue); + } + dma->next_queue = NULL; +} + +int DRM(select_queue)(drm_device_t *dev, void (*wrapper)(unsigned long)) +{ + int i; + int candidate = -1; + int j = jiffies; + + if (!dev) { + DRM_ERROR("No device\n"); + return -1; + } + if (!dev->queuelist || !dev->queuelist[DRM_KERNEL_CONTEXT]) { + /* This only happens between the time the + interrupt is initialized and the time + the queues are initialized. */ + return -1; + } + + /* Doing "while locked" DMA? */ + if (DRM_WAITCOUNT(dev, DRM_KERNEL_CONTEXT)) { + return DRM_KERNEL_CONTEXT; + } + + /* If there are buffers on the last_context + queue, and we have not been executing + this context very long, continue to + execute this context. */ + if (dev->last_switch <= j + && dev->last_switch + DRM_TIME_SLICE > j + && DRM_WAITCOUNT(dev, dev->last_context)) { + return dev->last_context; + } + + /* Otherwise, find a candidate */ + for (i = dev->last_checked + 1; i < dev->queue_count; i++) { + if (DRM_WAITCOUNT(dev, i)) { + candidate = dev->last_checked = i; + break; + } + } + + if (candidate < 0) { + for (i = 0; i < dev->queue_count; i++) { + if (DRM_WAITCOUNT(dev, i)) { + candidate = dev->last_checked = i; + break; + } + } + } + + if (wrapper + && candidate >= 0 + && candidate != dev->last_context + && dev->last_switch <= j + && dev->last_switch + DRM_TIME_SLICE > j) { + if (dev->timer.expires != dev->last_switch + DRM_TIME_SLICE) { + del_timer(&dev->timer); + dev->timer.function = wrapper; + dev->timer.data = (unsigned long)dev; + dev->timer.expires = dev->last_switch+DRM_TIME_SLICE; + add_timer(&dev->timer); + } + return -1; + } + + return candidate; +} + + +int DRM(dma_enqueue)(drm_device_t *dev, drm_dma_t *d) +{ + int i; + drm_queue_t *q; + drm_buf_t *buf; + int idx; + int while_locked = 0; + drm_device_dma_t *dma = dev->dma; + DECLARE_WAITQUEUE(entry, current); + + DRM_DEBUG("%d\n", d->send_count); + + if (d->flags & _DRM_DMA_WHILE_LOCKED) { + int context = dev->lock.hw_lock->lock; + + if (!_DRM_LOCK_IS_HELD(context)) { + DRM_ERROR("No lock held during \"while locked\"" + " request\n"); + return -EINVAL; + } + if (d->context != _DRM_LOCKING_CONTEXT(context) + && _DRM_LOCKING_CONTEXT(context) != DRM_KERNEL_CONTEXT) { + DRM_ERROR("Lock held by %d while %d makes" + " \"while locked\" request\n", + _DRM_LOCKING_CONTEXT(context), + d->context); + return -EINVAL; + } + q = dev->queuelist[DRM_KERNEL_CONTEXT]; + while_locked = 1; + } else { + q = dev->queuelist[d->context]; + } + + + atomic_inc(&q->use_count); + if (atomic_read(&q->block_write)) { + add_wait_queue(&q->write_queue, &entry); + atomic_inc(&q->block_count); + for (;;) { + current->state = TASK_INTERRUPTIBLE; + if (!atomic_read(&q->block_write)) break; + schedule(); + if (signal_pending(current)) { + atomic_dec(&q->use_count); + remove_wait_queue(&q->write_queue, &entry); + return -EINTR; + } + } + atomic_dec(&q->block_count); + current->state = TASK_RUNNING; + remove_wait_queue(&q->write_queue, &entry); + } + + for (i = 0; i < d->send_count; i++) { + idx = d->send_indices[i]; + if (idx < 0 || idx >= dma->buf_count) { + atomic_dec(&q->use_count); + DRM_ERROR("Index %d (of %d max)\n", + d->send_indices[i], dma->buf_count - 1); + return -EINVAL; + } + buf = dma->buflist[ idx ]; + if (buf->pid != current->pid) { + atomic_dec(&q->use_count); + DRM_ERROR("Process %d using buffer owned by %d\n", + current->pid, buf->pid); + return -EINVAL; + } + if (buf->list != DRM_LIST_NONE) { + atomic_dec(&q->use_count); + DRM_ERROR("Process %d using buffer %d on list %d\n", + current->pid, buf->idx, buf->list); + } + buf->used = d->send_sizes[i]; + buf->while_locked = while_locked; + buf->context = d->context; + if (!buf->used) { + DRM_ERROR("Queueing 0 length buffer\n"); + } + if (buf->pending) { + atomic_dec(&q->use_count); + DRM_ERROR("Queueing pending buffer:" + " buffer %d, offset %d\n", + d->send_indices[i], i); + return -EINVAL; + } + if (buf->waiting) { + atomic_dec(&q->use_count); + DRM_ERROR("Queueing waiting buffer:" + " buffer %d, offset %d\n", + d->send_indices[i], i); + return -EINVAL; + } + buf->waiting = 1; + if (atomic_read(&q->use_count) == 1 + || atomic_read(&q->finalization)) { + DRM(free_buffer)(dev, buf); + } else { + DRM(waitlist_put)(&q->waitlist, buf); + atomic_inc(&q->total_queued); + } + } + atomic_dec(&q->use_count); + + return 0; +} + +static int DRM(dma_get_buffers_of_order)(drm_device_t *dev, drm_dma_t *d, + int order) +{ + int i; + drm_buf_t *buf; + drm_device_dma_t *dma = dev->dma; + + for (i = d->granted_count; i < d->request_count; i++) { + buf = DRM(freelist_get)(&dma->bufs[order].freelist, + d->flags & _DRM_DMA_WAIT); + if (!buf) break; + if (buf->pending || buf->waiting) { + DRM_ERROR("Free buffer %d in use by %d (w%d, p%d)\n", + buf->idx, + buf->pid, + buf->waiting, + buf->pending); + } + buf->pid = current->pid; + if (copy_to_user(&d->request_indices[i], + &buf->idx, + sizeof(buf->idx))) + return -EFAULT; + + if (copy_to_user(&d->request_sizes[i], + &buf->total, + sizeof(buf->total))) + return -EFAULT; + + ++d->granted_count; + } + return 0; +} + + +int DRM(dma_get_buffers)(drm_device_t *dev, drm_dma_t *dma) +{ + int order; + int retcode = 0; + int tmp_order; + + order = DRM(order)(dma->request_size); + + dma->granted_count = 0; + retcode = DRM(dma_get_buffers_of_order)(dev, dma, order); + + if (dma->granted_count < dma->request_count + && (dma->flags & _DRM_DMA_SMALLER_OK)) { + for (tmp_order = order - 1; + !retcode + && dma->granted_count < dma->request_count + && tmp_order >= DRM_MIN_ORDER; + --tmp_order) { + + retcode = DRM(dma_get_buffers_of_order)(dev, dma, + tmp_order); + } + } + + if (dma->granted_count < dma->request_count + && (dma->flags & _DRM_DMA_LARGER_OK)) { + for (tmp_order = order + 1; + !retcode + && dma->granted_count < dma->request_count + && tmp_order <= DRM_MAX_ORDER; + ++tmp_order) { + + retcode = DRM(dma_get_buffers_of_order)(dev, dma, + tmp_order); + } + } + return 0; +} + +#endif /* __HAVE_OLD_DMA */ + + +#if __HAVE_DMA_IRQ + +int DRM(irq_install)( drm_device_t *dev, int irq ) +{ + int ret; + + if ( !irq ) + return -EINVAL; + + down( &dev->struct_sem ); + if ( dev->irq ) { + up( &dev->struct_sem ); + return -EBUSY; + } + dev->irq = irq; + up( &dev->struct_sem ); + + DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq ); + + dev->context_flag = 0; + dev->interrupt_flag = 0; + dev->dma_flag = 0; + + dev->dma->next_buffer = NULL; + dev->dma->next_queue = NULL; + dev->dma->this_buffer = NULL; + +#if __HAVE_DMA_IRQ_BH + INIT_LIST_HEAD( &dev->tq.list ); + dev->tq.sync = 0; + dev->tq.routine = DRM(dma_immediate_bh); + dev->tq.data = dev; +#endif + + /* Before installing handler */ + DRIVER_PREINSTALL(); + + /* Install handler */ + ret = request_irq( dev->irq, DRM(dma_service), + 0, dev->devname, dev ); + if ( ret < 0 ) { + down( &dev->struct_sem ); + dev->irq = 0; + up( &dev->struct_sem ); + return ret; + } + + /* After installing handler */ + DRIVER_POSTINSTALL(); + + return 0; +} + +int DRM(irq_uninstall)( drm_device_t *dev ) +{ + int irq; + + down( &dev->struct_sem ); + irq = dev->irq; + dev->irq = 0; + up( &dev->struct_sem ); + + if ( !irq ) + return -EINVAL; + + DRM_DEBUG( "%s: irq=%d\n", __FUNCTION__, irq ); + + DRIVER_UNINSTALL(); + + free_irq( irq, dev ); + + return 0; +} + +int DRM(control)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_control_t ctl; + + if ( copy_from_user( &ctl, (drm_control_t *)arg, sizeof(ctl) ) ) + return -EFAULT; + + switch ( ctl.func ) { + case DRM_INST_HANDLER: + return DRM(irq_install)( dev, ctl.irq ); + case DRM_UNINST_HANDLER: + return DRM(irq_uninstall)( dev ); + default: + return -EINVAL; + } +} + +#endif /* __HAVE_DMA_IRQ */ + +#endif /* __HAVE_DMA */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drawable.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drawable.h:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drawable.h Wed Mar 21 13:08:55 2001 @@ -0,0 +1,51 @@ +/* drm_drawable.h -- IOCTLs for drawables -*- linux-c -*- + * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +int DRM(adddraw)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_draw_t draw; + + draw.handle = 0; /* NOOP */ + DRM_DEBUG("%d\n", draw.handle); + if (copy_to_user((drm_draw_t *)arg, &draw, sizeof(draw))) + return -EFAULT; + return 0; +} + +int DRM(rmdraw)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + return 0; /* NOOP */ +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h:1.3 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_drv.h Wed May 2 11:06:10 2001 @@ -0,0 +1,959 @@ +/* drm_drv.h -- Generic driver template -*- linux-c -*- + * Created: Thu Nov 23 03:10:50 2000 by gareth@valinux.com + * + * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +/* + * To use this template, you must at least define the following (samples + * given for the MGA driver): + * + * #define DRIVER_AUTHOR "VA Linux Systems, Inc." + * + * #define DRIVER_NAME "mga" + * #define DRIVER_DESC "Matrox G200/G400" + * #define DRIVER_DATE "20001127" + * + * #define DRIVER_MAJOR 2 + * #define DRIVER_MINOR 0 + * #define DRIVER_PATCHLEVEL 2 + * + * #define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( mga_ioctls ) + * + * #define DRM(x) mga_##x + */ + +#ifndef __MUST_HAVE_AGP +#define __MUST_HAVE_AGP 0 +#endif +#ifndef __HAVE_CTX_BITMAP +#define __HAVE_CTX_BITMAP 0 +#endif +#ifndef __HAVE_DMA_IRQ +#define __HAVE_DMA_IRQ 0 +#endif +#ifndef __HAVE_DMA_QUEUE +#define __HAVE_DMA_QUEUE 0 +#endif +#ifndef __HAVE_MULTIPLE_DMA_QUEUES +#define __HAVE_MULTIPLE_DMA_QUEUES 0 +#endif +#ifndef __HAVE_DMA_SCHEDULE +#define __HAVE_DMA_SCHEDULE 0 +#endif +#ifndef __HAVE_DMA_FLUSH +#define __HAVE_DMA_FLUSH 0 +#endif +#ifndef __HAVE_DMA_READY +#define __HAVE_DMA_READY 0 +#endif +#ifndef __HAVE_DMA_QUIESCENT +#define __HAVE_DMA_QUIESCENT 0 +#endif +#ifndef __HAVE_RELEASE +#define __HAVE_RELEASE 0 +#endif +#ifndef __HAVE_COUNTERS +#define __HAVE_COUNTERS 0 +#endif +#ifndef __HAVE_SG +#define __HAVE_SG 0 +#endif + +#ifndef DRIVER_PREINIT +#define DRIVER_PREINIT() +#endif +#ifndef DRIVER_POSTINIT +#define DRIVER_POSTINIT() +#endif +#ifndef DRIVER_PRERELEASE +#define DRIVER_PRERELEASE() +#endif +#ifndef DRIVER_PRETAKEDOWN +#define DRIVER_PRETAKEDOWN() +#endif +#ifndef DRIVER_IOCTLS +#define DRIVER_IOCTLS +#endif + + +static drm_device_t DRM(device); +static int DRM(minor); + +static struct file_operations DRM(fops) = { +#if LINUX_VERSION_CODE >= 0x020400 + /* This started being used during 2.4.0-test */ + owner: THIS_MODULE, +#endif + open: DRM(open), + flush: DRM(flush), + release: DRM(release), + ioctl: DRM(ioctl), + mmap: DRM(mmap), + read: DRM(read), + fasync: DRM(fasync), + poll: DRM(poll), +}; + + +static drm_ioctl_desc_t DRM(ioctls)[] = { + [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { DRM(version), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { DRM(getunique), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { DRM(getmagic), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { DRM(irq_busid), 0, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)] = { DRM(getmap), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = { DRM(getclient), 0, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)] = { DRM(getstats), 0, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { DRM(setunique), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { DRM(block), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { DRM(unblock), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { DRM(authmagic), 1, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { DRM(addmap), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = { DRM(rmmap), 1, 0 }, + +#if __HAVE_CTX_BITMAP + [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = { DRM(setsareactx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = { DRM(getsareactx), 1, 0 }, +#endif + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { DRM(addctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { DRM(rmctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { DRM(modctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { DRM(getctx), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { DRM(switchctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { DRM(newctx), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { DRM(resctx), 1, 0 }, + + [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { DRM(adddraw), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { DRM(rmdraw), 1, 1 }, + + [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { DRM(lock), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { DRM(unlock), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { DRM(finish), 1, 0 }, + +#if __HAVE_DMA + [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { DRM(addbufs), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { DRM(markbufs), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { DRM(infobufs), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { DRM(mapbufs), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { DRM(freebufs), 1, 0 }, + + /* The DRM_IOCTL_DMA ioctl should be defined by the driver. + */ +#if __HAVE_DMA_IRQ + [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { DRM(control), 1, 1 }, +#endif +#endif + +#if __REALLY_HAVE_AGP + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { DRM(agp_acquire), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { DRM(agp_release), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { DRM(agp_enable), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { DRM(agp_info), 1, 0 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { DRM(agp_alloc), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { DRM(agp_free), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { DRM(agp_bind), 1, 1 }, + [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { DRM(agp_unbind), 1, 1 }, +#endif + +#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 +}; + +#define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( DRM(ioctls) ) + +#ifdef MODULE +static char *drm_opts = NULL; +#endif + +MODULE_AUTHOR( DRIVER_AUTHOR ); +MODULE_DESCRIPTION( DRIVER_DESC ); +MODULE_PARM( drm_opts, "s" ); + +#ifndef MODULE +/* DRM(options) is called by the kernel to parse command-line options + * passed via the boot-loader (e.g., LILO). It calls the insmod option + * routine, drm_parse_drm. + */ + +static int __init DRM(options)( char *str ) +{ + DRM(parse_options)( str ); + return 1; +} + +__setup( DRIVER_NAME "=", DRM(options) ); +#endif + +static int DRM(setup)( drm_device_t *dev ) +{ + int i; + + atomic_set( &dev->ioctl_count, 0 ); + atomic_set( &dev->vma_count, 0 ); + dev->buf_use = 0; + atomic_set( &dev->buf_alloc, 0 ); + +#if __HAVE_DMA + i = DRM(dma_setup)( dev ); + if ( i < 0 ) + return i; +#endif + + dev->counters = 6 + __HAVE_COUNTERS; + dev->types[0] = _DRM_STAT_LOCK; + dev->types[1] = _DRM_STAT_OPENS; + dev->types[2] = _DRM_STAT_CLOSES; + dev->types[3] = _DRM_STAT_IOCTLS; + dev->types[4] = _DRM_STAT_LOCKS; + dev->types[5] = _DRM_STAT_UNLOCKS; +#ifdef __HAVE_COUNTER6 + dev->types[6] = __HAVE_COUNTER6; +#endif +#ifdef __HAVE_COUNTER7 + dev->types[7] = __HAVE_COUNTER7; +#endif +#ifdef __HAVE_COUNTER8 + dev->types[8] = __HAVE_COUNTER8; +#endif +#ifdef __HAVE_COUNTER9 + dev->types[9] = __HAVE_COUNTER9; +#endif +#ifdef __HAVE_COUNTER10 + dev->types[10] = __HAVE_COUNTER10; +#endif +#ifdef __HAVE_COUNTER11 + dev->types[11] = __HAVE_COUNTER11; +#endif +#ifdef __HAVE_COUNTER12 + dev->types[12] = __HAVE_COUNTER12; +#endif +#ifdef __HAVE_COUNTER13 + dev->types[13] = __HAVE_COUNTER13; +#endif +#ifdef __HAVE_COUNTER14 + dev->types[14] = __HAVE_COUNTER14; +#endif +#ifdef __HAVE_COUNTER15 + dev->types[14] = __HAVE_COUNTER14; +#endif + + for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ ) + atomic_set( &dev->counts[i], 0 ); + + for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) { + dev->magiclist[i].head = NULL; + dev->magiclist[i].tail = NULL; + } + + dev->maplist = DRM(alloc)(sizeof(*dev->maplist), + DRM_MEM_MAPS); + if(dev->maplist == NULL) return -ENOMEM; + memset(dev->maplist, 0, sizeof(*dev->maplist)); + INIT_LIST_HEAD(&dev->maplist->head); + dev->map_count = 0; + + dev->vmalist = NULL; + dev->lock.hw_lock = NULL; + init_waitqueue_head( &dev->lock.lock_queue ); + dev->queue_count = 0; + dev->queue_reserved = 0; + dev->queue_slots = 0; + dev->queuelist = NULL; + dev->irq = 0; + dev->context_flag = 0; + dev->interrupt_flag = 0; + dev->dma_flag = 0; + dev->last_context = 0; + dev->last_switch = 0; + dev->last_checked = 0; + init_timer( &dev->timer ); + init_waitqueue_head( &dev->context_wait ); + + dev->ctx_start = 0; + dev->lck_start = 0; + + dev->buf_rp = dev->buf; + dev->buf_wp = dev->buf; + dev->buf_end = dev->buf + DRM_BSZ; + dev->buf_async = NULL; + init_waitqueue_head( &dev->buf_readers ); + init_waitqueue_head( &dev->buf_writers ); + + DRM_DEBUG( "\n" ); + + /* The kernel's context could be created here, but is now created + * in drm_dma_enqueue. This is more resource-efficient for + * hardware that does not do DMA, but may mean that + * drm_select_queue fails between the time the interrupt is + * initialized and the time the queues are initialized. + */ + return 0; +} + + +static int DRM(takedown)( drm_device_t *dev ) +{ + drm_magic_entry_t *pt, *next; + drm_map_t *map; + drm_map_list_t *r_list; + struct list_head *list; + drm_vma_entry_t *vma, *vma_next; + int i; + + DRM_DEBUG( "\n" ); + + DRIVER_PRETAKEDOWN(); +#if __HAVE_DMA_IRQ + if ( dev->irq ) DRM(irq_uninstall)( dev ); +#endif + + down( &dev->struct_sem ); + del_timer( &dev->timer ); + + if ( dev->devname ) { + DRM(free)( dev->devname, strlen( dev->devname ) + 1, + DRM_MEM_DRIVER ); + dev->devname = NULL; + } + + if ( dev->unique ) { + DRM(free)( dev->unique, strlen( dev->unique ) + 1, + DRM_MEM_DRIVER ); + dev->unique = NULL; + dev->unique_len = 0; + } + /* Clear pid list */ + for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) { + for ( pt = dev->magiclist[i].head ; pt ; pt = next ) { + next = pt->next; + DRM(free)( pt, sizeof(*pt), DRM_MEM_MAGIC ); + } + dev->magiclist[i].head = dev->magiclist[i].tail = NULL; + } + +#if __REALLY_HAVE_AGP + /* Clear AGP information */ + if ( dev->agp ) { + drm_agp_mem_t *entry; + drm_agp_mem_t *nexte; + + /* Remove AGP resources, but leave dev->agp + intact until drv_cleanup is called. */ + for ( entry = dev->agp->memory ; entry ; entry = nexte ) { + nexte = entry->next; + if ( entry->bound ) DRM(unbind_agp)( entry->memory ); + DRM(free_agp)( entry->memory, entry->pages ); + DRM(free)( entry, sizeof(*entry), DRM_MEM_AGPLISTS ); + } + dev->agp->memory = NULL; + + if ( dev->agp->acquired ) DRM(agp_do_release)(); + + dev->agp->acquired = 0; + dev->agp->enabled = 0; + } +#endif + + /* Clear vma list (only built for debugging) */ + if ( dev->vmalist ) { + for ( vma = dev->vmalist ; vma ; vma = vma_next ) { + vma_next = vma->next; + DRM(free)( vma, sizeof(*vma), DRM_MEM_VMAS ); + } + dev->vmalist = NULL; + } + + if( dev->maplist ) { + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *)list; + map = r_list->map; + DRM(free)(r_list, sizeof(*r_list), DRM_MEM_MAPS); + if(!map) continue; + + switch ( map->type ) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: +#if __REALLY_HAVE_MTRR + if ( map->mtrr >= 0 ) { + int retcode; + retcode = mtrr_del( map->mtrr, + map->offset, + map->size ); + DRM_DEBUG( "mtrr_del=%d\n", retcode ); + } +#endif + DRM(ioremapfree)( map->handle, map->size ); + break; + case _DRM_SHM: + vfree(map->handle); + break; + + case _DRM_AGP: + /* Do nothing here, because this is all + * handled in the AGP/GART driver. + */ + break; + 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); + } + DRM(free)(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS); + dev->maplist = NULL; + } + +#if __HAVE_DMA_QUEUE || __HAVE_MULTIPLE_DMA_QUEUES + if ( dev->queuelist ) { + for ( i = 0 ; i < dev->queue_count ; i++ ) { + DRM(waitlist_destroy)( &dev->queuelist[i]->waitlist ); + if ( dev->queuelist[i] ) { + DRM(free)( dev->queuelist[i], + sizeof(*dev->queuelist[0]), + DRM_MEM_QUEUES ); + dev->queuelist[i] = NULL; + } + } + DRM(free)( dev->queuelist, + dev->queue_slots * sizeof(*dev->queuelist), + DRM_MEM_QUEUES ); + dev->queuelist = NULL; + } + dev->queue_count = 0; +#endif + +#if __HAVE_DMA + DRM(dma_takedown)( dev ); +#endif + if ( dev->lock.hw_lock ) { + dev->lock.hw_lock = NULL; /* SHM removed */ + dev->lock.pid = 0; + wake_up_interruptible( &dev->lock.lock_queue ); + } + up( &dev->struct_sem ); + + return 0; +} + +/* drm_init is called via init_module at module load time, or via + * linux/init/main.c (this is not currently supported). + */ +static int __init drm_init( void ) +{ + drm_device_t *dev = &DRM(device); +#if __HAVE_CTX_BITMAP + int retcode; +#endif + DRM_DEBUG( "\n" ); + + memset( (void *)dev, 0, sizeof(*dev) ); + dev->count_lock = SPIN_LOCK_UNLOCKED; + sema_init( &dev->struct_sem, 1 ); + +#ifdef MODULE + DRM(parse_options)( drm_opts ); +#endif + DRIVER_PREINIT(); + + DRM(mem_init)(); + + if ((DRM(minor) = DRM(stub_register)(DRIVER_NAME, &DRM(fops),dev)) < 0) + return -EPERM; + dev->device = MKDEV(DRM_MAJOR, DRM(minor) ); + dev->name = DRIVER_NAME; + +#if __REALLY_HAVE_AGP + dev->agp = DRM(agp_init)(); +#if __MUST_HAVE_AGP + if ( dev->agp == NULL ) { + DRM_ERROR( "Cannot initialize the agpgart module.\n" ); + DRM(stub_unregister)(DRM(minor)); + DRM(takedown)( dev ); + return -ENOMEM; + } +#endif +#if __REALLY_HAVE_MTRR + if (dev->agp) + dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size*1024*1024, + MTRR_TYPE_WRCOMB, + 1 ); +#endif +#endif + +#if __HAVE_CTX_BITMAP + retcode = DRM(ctxbitmap_init)( dev ); + if( retcode ) { + DRM_ERROR( "Cannot allocate memory for context bitmap.\n" ); + DRM(stub_unregister)(DRM(minor)); + DRM(takedown)( dev ); + return retcode; + } +#endif + + DRIVER_POSTINIT(); + + DRM_INFO( "Initialized %s %d.%d.%d %s on minor %d\n", + DRIVER_NAME, + DRIVER_MAJOR, + DRIVER_MINOR, + DRIVER_PATCHLEVEL, + DRIVER_DATE, + DRM(minor) ); + + return 0; +} + +/* drm_cleanup is called via cleanup_module at module unload time. + */ +static void __exit drm_cleanup( void ) +{ + drm_device_t *dev = &DRM(device); + + DRM_DEBUG( "\n" ); + + if ( DRM(stub_unregister)(DRM(minor)) ) { + DRM_ERROR( "Cannot unload module\n" ); + } else { + DRM_INFO( "Module unloaded\n" ); + } +#if __HAVE_CTX_BITMAP + DRM(ctxbitmap_cleanup)( dev ); +#endif + +#if __REALLY_HAVE_AGP && __REALLY_HAVE_MTRR + if ( dev->agp && dev->agp->agp_mtrr ) { + int retval; + retval = mtrr_del( dev->agp->agp_mtrr, + dev->agp->agp_info.aper_base, + dev->agp->agp_info.aper_size*1024*1024 ); + DRM_DEBUG( "mtrr_del=%d\n", retval ); + } +#endif + + DRM(takedown)( dev ); + +#if __REALLY_HAVE_AGP + if ( dev->agp ) { + DRM(agp_uninit)(); + DRM(free)( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS ); + dev->agp = NULL; + } +#endif +} + +module_init( drm_init ); +module_exit( drm_cleanup ); + + +int DRM(version)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_version_t version; + int len; + + if ( copy_from_user( &version, + (drm_version_t *)arg, + sizeof(version) ) ) + return -EFAULT; + +#define DRM_COPY( name, value ) \ + len = strlen( value ); \ + if ( len > name##_len ) len = name##_len; \ + name##_len = strlen( value ); \ + if ( len && name ) { \ + if ( copy_to_user( name, value, len ) ) \ + return -EFAULT; \ + } + + version.version_major = DRIVER_MAJOR; + version.version_minor = DRIVER_MINOR; + version.version_patchlevel = DRIVER_PATCHLEVEL; + + DRM_COPY( version.name, DRIVER_NAME ); + DRM_COPY( version.date, DRIVER_DATE ); + DRM_COPY( version.desc, DRIVER_DESC ); + + if ( copy_to_user( (drm_version_t *)arg, + &version, + sizeof(version) ) ) + return -EFAULT; + return 0; +} + +int DRM(open)( struct inode *inode, struct file *filp ) +{ + drm_device_t *dev = &DRM(device); + int retcode = 0; + + DRM_DEBUG( "open_count = %d\n", dev->open_count ); + + retcode = DRM(open_helper)( inode, filp, dev ); + if ( !retcode ) { +#if LINUX_VERSION_CODE < 0x020333 + MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ +#endif + atomic_inc( &dev->counts[_DRM_STAT_OPENS] ); + spin_lock( &dev->count_lock ); + if ( !dev->open_count++ ) { + spin_unlock( &dev->count_lock ); + return DRM(setup)( dev ); + } + spin_unlock( &dev->count_lock ); + } + + return retcode; +} + +int DRM(release)( struct inode *inode, struct file *filp ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev; + int retcode = 0; + + lock_kernel(); + dev = priv->dev; + + DRM_DEBUG( "open_count = %d\n", dev->open_count ); + + DRIVER_PRERELEASE(); + + /* ======================================================== + * Begin inline drm_release + */ + + DRM_DEBUG( "pid = %d, device = 0x%x, open_count = %d\n", + current->pid, dev->device, dev->open_count ); + + if ( dev->lock.hw_lock && + _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) && + dev->lock.pid == current->pid ) { + DRM_DEBUG( "Process %d dead, freeing lock for context %d\n", + current->pid, + _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) ); +#if __HAVE_RELEASE + DRIVER_RELEASE(); +#endif + DRM(lock_free)( dev, &dev->lock.hw_lock->lock, + _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) ); + + /* FIXME: may require heavy-handed reset of + hardware at this point, possibly + processed via a callback to the X + server. */ + } +#if __HAVE_RELEASE + else if ( dev->lock.hw_lock ) { + /* The lock is required to reclaim buffers */ + DECLARE_WAITQUEUE( entry, current ); + add_wait_queue( &dev->lock.lock_queue, &entry ); + for (;;) { + current->state = TASK_INTERRUPTIBLE; + if ( !dev->lock.hw_lock ) { + /* Device has been unregistered */ + retcode = -EINTR; + break; + } + if ( DRM(lock_take)( &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT ) ) { + dev->lock.pid = priv->pid; + dev->lock.lock_time = jiffies; + atomic_inc( &dev->counts[_DRM_STAT_LOCKS] ); + break; /* Got lock */ + } + /* Contention */ +#if 0 + atomic_inc( &dev->total_sleeps ); +#endif + schedule(); + if ( signal_pending( current ) ) { + retcode = -ERESTARTSYS; + break; + } + } + current->state = TASK_RUNNING; + remove_wait_queue( &dev->lock.lock_queue, &entry ); + if( !retcode ) { + DRIVER_RELEASE(); + DRM(lock_free)( dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT ); + } + } +#elif __HAVE_DMA + DRM(reclaim_buffers)( dev, priv->pid ); +#endif + + DRM(fasync)( -1, filp, 0 ); + + down( &dev->struct_sem ); + if ( priv->remove_auth_on_close == 1 ) { + drm_file_t *temp = dev->file_first; + while ( temp ) { + temp->authenticated = 0; + temp = temp->next; + } + } + if ( priv->prev ) { + priv->prev->next = priv->next; + } else { + dev->file_first = priv->next; + } + if ( priv->next ) { + priv->next->prev = priv->prev; + } else { + dev->file_last = priv->prev; + } + up( &dev->struct_sem ); + + DRM(free)( priv, sizeof(*priv), DRM_MEM_FILES ); + + /* ======================================================== + * End inline drm_release + */ + +#if LINUX_VERSION_CODE < 0x020333 + MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ +#endif + atomic_inc( &dev->counts[_DRM_STAT_CLOSES] ); + spin_lock( &dev->count_lock ); + if ( !--dev->open_count ) { + if ( atomic_read( &dev->ioctl_count ) || dev->blocked ) { + DRM_ERROR( "Device busy: %d %d\n", + atomic_read( &dev->ioctl_count ), + dev->blocked ); + spin_unlock( &dev->count_lock ); + unlock_kernel(); + return -EBUSY; + } + spin_unlock( &dev->count_lock ); + unlock_kernel(); + return DRM(takedown)( dev ); + } + spin_unlock( &dev->count_lock ); + + unlock_kernel(); + return retcode; +} + +/* DRM(ioctl) is called whenever a process performs an ioctl on /dev/drm. + */ +int DRM(ioctl)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_ioctl_desc_t *ioctl; + drm_ioctl_t *func; + int nr = DRM_IOCTL_NR(cmd); + int retcode = 0; + + atomic_inc( &dev->ioctl_count ); + atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] ); + ++priv->ioctl_count; + + DRM_DEBUG( "pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%x, auth=%d\n", + current->pid, cmd, nr, dev->device, priv->authenticated ); + + if ( nr >= DRIVER_IOCTL_COUNT ) { + retcode = -EINVAL; + } else { + ioctl = &DRM(ioctls)[nr]; + func = ioctl->func; + + if ( !func ) { + DRM_DEBUG( "no function\n" ); + retcode = -EINVAL; + } else if ( ( ioctl->root_only && !capable( CAP_SYS_ADMIN ) )|| + ( ioctl->auth_needed && !priv->authenticated ) ) { + retcode = -EACCES; + } else { + retcode = func( inode, filp, cmd, arg ); + } + } + + atomic_dec( &dev->ioctl_count ); + return retcode; +} + +int DRM(lock)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + DECLARE_WAITQUEUE( entry, current ); + drm_lock_t lock; + int ret = 0; +#if __HAVE_MULTIPLE_DMA_QUEUES + drm_queue_t *q; +#endif +#if __HAVE_DMA_HISTOGRAM + cycles_t start; + + dev->lck_start = start = get_cycles(); +#endif + + if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) ) + return -EFAULT; + + if ( lock.context == DRM_KERNEL_CONTEXT ) { + DRM_ERROR( "Process %d using kernel context %d\n", + current->pid, lock.context ); + return -EINVAL; + } + + DRM_DEBUG( "%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", + lock.context, current->pid, + dev->lock.hw_lock->lock, lock.flags ); + +#if __HAVE_DMA_QUEUE + if ( lock.context < 0 ) + return -EINVAL; +#elif __HAVE_MULTIPLE_DMA_QUEUES + if ( lock.context < 0 || lock.context >= dev->queue_count ) + return -EINVAL; + q = dev->queuelist[lock.context]; +#endif + +#if __HAVE_DMA_FLUSH + ret = DRM(flush_block_and_flush)( dev, lock.context, lock.flags ); +#endif + if ( !ret ) { + add_wait_queue( &dev->lock.lock_queue, &entry ); + for (;;) { + current->state = TASK_INTERRUPTIBLE; + if ( !dev->lock.hw_lock ) { + /* Device has been unregistered */ + ret = -EINTR; + break; + } + if ( DRM(lock_take)( &dev->lock.hw_lock->lock, + lock.context ) ) { + dev->lock.pid = current->pid; + dev->lock.lock_time = jiffies; + atomic_inc( &dev->counts[_DRM_STAT_LOCKS] ); + break; /* Got lock */ + } + + /* Contention */ + schedule(); + if ( signal_pending( current ) ) { + ret = -ERESTARTSYS; + break; + } + } + current->state = TASK_RUNNING; + remove_wait_queue( &dev->lock.lock_queue, &entry ); + } + +#if __HAVE_DMA_FLUSH + DRM(flush_unblock)( dev, lock.context, lock.flags ); /* cleanup phase */ +#endif + + if ( !ret ) { + sigemptyset( &dev->sigmask ); + sigaddset( &dev->sigmask, SIGSTOP ); + sigaddset( &dev->sigmask, SIGTSTP ); + sigaddset( &dev->sigmask, SIGTTIN ); + sigaddset( &dev->sigmask, SIGTTOU ); + dev->sigdata.context = lock.context; + dev->sigdata.lock = dev->lock.hw_lock; + block_all_signals( DRM(notifier), + &dev->sigdata, &dev->sigmask ); + +#if __HAVE_DMA_READY + if ( lock.flags & _DRM_LOCK_READY ) { + DRIVER_DMA_READY(); + } +#endif +#if __HAVE_DMA_QUIESCENT + if ( lock.flags & _DRM_LOCK_QUIESCENT ) { + DRIVER_DMA_QUIESCENT(); + } +#endif + } + + DRM_DEBUG( "%d %s\n", lock.context, ret ? "interrupted" : "has lock" ); + +#if __HAVE_DMA_HISTOGRAM + atomic_inc(&dev->histo.lacq[DRM(histogram_slot)(get_cycles()-start)]); +#endif + return ret; +} + + +int DRM(unlock)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_lock_t lock; + + if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) ) + return -EFAULT; + + if ( lock.context == DRM_KERNEL_CONTEXT ) { + DRM_ERROR( "Process %d using kernel context %d\n", + current->pid, lock.context ); + return -EINVAL; + } + + atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] ); + + DRM(lock_transfer)( dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT ); +#if __HAVE_DMA_SCHEDULE + DRM(dma_schedule)( dev, 1 ); +#endif + + /* FIXME: Do we ever really need to check this??? + */ + if ( 1 /* !dev->context_flag */ ) { + if ( DRM(lock_free)( dev, &dev->lock.hw_lock->lock, + DRM_KERNEL_CONTEXT ) ) { + DRM_ERROR( "\n" ); + } + } + + unblock_all_signals(); + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h:1.2 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_fops.h Tue Apr 10 12:08:04 2001 @@ -0,0 +1,223 @@ +/* drm_fops.h -- File operations for DRM -*- linux-c -*- + * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Daryll Strauss <daryll@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" +#include <linux/poll.h> + +/* drm_open is called whenever a process opens /dev/drm. */ + +int DRM(open_helper)(struct inode *inode, struct file *filp, drm_device_t *dev) +{ + kdev_t minor = MINOR(inode->i_rdev); + drm_file_t *priv; + + if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */ + if (!DRM(cpu_valid)()) return -EINVAL; + + DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); + + priv = DRM(alloc)(sizeof(*priv), DRM_MEM_FILES); + memset(priv, 0, sizeof(*priv)); + filp->private_data = priv; + priv->uid = current->euid; + priv->pid = current->pid; + priv->minor = minor; + priv->dev = dev; + priv->ioctl_count = 0; + priv->authenticated = capable(CAP_SYS_ADMIN); + + down(&dev->struct_sem); + if (!dev->file_last) { + priv->next = NULL; + priv->prev = NULL; + dev->file_first = priv; + dev->file_last = priv; + } else { + priv->next = NULL; + priv->prev = dev->file_last; + dev->file_last->next = priv; + dev->file_last = priv; + } + up(&dev->struct_sem); + +#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; +} + +int DRM(flush)(struct file *filp) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + + DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n", + current->pid, dev->device, dev->open_count); + return 0; +} + +int DRM(fasync)(int fd, struct file *filp, int on) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int retcode; + + DRM_DEBUG("fd = %d, device = 0x%x\n", fd, dev->device); + retcode = fasync_helper(fd, filp, on, &dev->buf_async); + if (retcode < 0) return retcode; + return 0; +} + + +/* The drm_read and drm_write_string code (especially that which manages + the circular buffer), is based on Alessandro Rubini's LINUX DEVICE + DRIVERS (Cambridge: O'Reilly, 1998), pages 111-113. */ + +ssize_t DRM(read)(struct file *filp, char *buf, size_t count, loff_t *off) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int left; + int avail; + int send; + int cur; + + DRM_DEBUG("%p, %p\n", dev->buf_rp, dev->buf_wp); + + while (dev->buf_rp == dev->buf_wp) { + DRM_DEBUG(" sleeping\n"); + if (filp->f_flags & O_NONBLOCK) { + return -EAGAIN; + } + interruptible_sleep_on(&dev->buf_readers); + if (signal_pending(current)) { + DRM_DEBUG(" interrupted\n"); + return -ERESTARTSYS; + } + DRM_DEBUG(" awake\n"); + } + + left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; + avail = DRM_BSZ - left; + send = DRM_MIN(avail, count); + + while (send) { + if (dev->buf_wp > dev->buf_rp) { + cur = DRM_MIN(send, dev->buf_wp - dev->buf_rp); + } else { + cur = DRM_MIN(send, dev->buf_end - dev->buf_rp); + } + if (copy_to_user(buf, dev->buf_rp, cur)) + return -EFAULT; + dev->buf_rp += cur; + if (dev->buf_rp == dev->buf_end) dev->buf_rp = dev->buf; + send -= cur; + } + + wake_up_interruptible(&dev->buf_writers); + return DRM_MIN(avail, count);; +} + +int DRM(write_string)(drm_device_t *dev, const char *s) +{ + int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; + int send = strlen(s); + int count; + + DRM_DEBUG("%d left, %d to send (%p, %p)\n", + left, send, dev->buf_rp, dev->buf_wp); + + if (left == 1 || dev->buf_wp != dev->buf_rp) { + DRM_ERROR("Buffer not empty (%d left, wp = %p, rp = %p)\n", + left, + dev->buf_wp, + dev->buf_rp); + } + + while (send) { + if (dev->buf_wp >= dev->buf_rp) { + count = DRM_MIN(send, dev->buf_end - dev->buf_wp); + if (count == left) --count; /* Leave a hole */ + } else { + count = DRM_MIN(send, dev->buf_rp - dev->buf_wp - 1); + } + strncpy(dev->buf_wp, s, count); + dev->buf_wp += count; + if (dev->buf_wp == dev->buf_end) dev->buf_wp = dev->buf; + send -= count; + } + +#if LINUX_VERSION_CODE < 0x020315 && !defined(KILLFASYNCHASTHREEPARAMETERS) + /* The extra parameter to kill_fasync was added in 2.3.21, and is + _not_ present in _stock_ 2.2.14 and 2.2.15. However, some + distributions patch 2.2.x kernels to add this parameter. The + Makefile.linux attempts to detect this addition and defines + KILLFASYNCHASTHREEPARAMETERS if three parameters are found. */ + if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO); +#else + + /* Parameter added in 2.3.21. */ +#if LINUX_VERSION_CODE < 0x020400 + if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_IN); +#else + /* Type of first parameter changed in + Linux 2.4.0-test2... */ + if (dev->buf_async) kill_fasync(&dev->buf_async, SIGIO, POLL_IN); +#endif +#endif + DRM_DEBUG("waking\n"); + wake_up_interruptible(&dev->buf_readers); + return 0; +} + +unsigned int DRM(poll)(struct file *filp, struct poll_table_struct *wait) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + + poll_wait(filp, &dev->buf_readers, wait); + if (dev->buf_wp != dev->buf_rp) return POLLIN | POLLRDNORM; + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h:1.2 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_init.h Tue Apr 10 12:08:04 2001 @@ -0,0 +1,116 @@ +/* drm_init.h -- Setup/Cleanup for DRM -*- linux-c -*- + * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +#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. + */ +static void DRM(parse_option)(char *s) +{ + char *c, *r; + + DRM_DEBUG("\"%s\"\n", s); + if (!s || !*s) return; + for (c = s; *c && *c != ':'; c++); /* find : or \0 */ + if (*c) r = c + 1; else r = NULL; /* remember remainder */ + *c = '\0'; /* terminate */ + if (!strcmp(s, "noctx")) { + DRM(flags) |= DRM_FLAG_NOCTX; + DRM_INFO("Server-mediated context switching OFF\n"); + return; + } + if (!strcmp(s, "debug")) { + DRM(flags) |= DRM_FLAG_DEBUG; + DRM_INFO("Debug messages ON\n"); + return; + } + DRM_ERROR("\"%s\" is not a valid option\n", s); + return; +} + +/* drm_parse_options parse the insmod "drm=" options, or the command-line + * options passed to the kernel via LILO. The grammar of the format is as + * follows: + * + * drm ::= 'drm=' option_list + * option_list ::= option [ ';' option_list ] + * option ::= 'device:' major + * | 'debug' + * | 'noctx' + * major ::= INTEGER + * + * Note that 's' contains option_list without the 'drm=' part. + * + * device=major,minor specifies the device number used for /dev/drm + * if major == 0 then the misc device is used + * if major == 0 and minor == 0 then dynamic misc allocation is used + * debug=on specifies that debugging messages will be printk'd + * debug=trace specifies that each function call will be logged via printk + * debug=off turns off all debugging options + * + */ + +void DRM(parse_options)(char *s) +{ + char *h, *t, *n; + + DRM_DEBUG("\"%s\"\n", s ?: ""); + if (!s || !*s) return; + + for (h = t = n = s; h && *h; h = n) { + for (; *t && *t != ';'; t++); /* find ; or \0 */ + if (*t) n = t + 1; else n = NULL; /* remember next */ + *t = '\0'; /* terminate */ + DRM(parse_option)(h); /* parse */ + } +} + +/* drm_cpu_valid returns non-zero if the DRI will run on this CPU, and 0 + * otherwise. + */ +int DRM(cpu_valid)(void) +{ +#if defined(__i386__) + if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */ +#endif +#if defined(__sparc__) && !defined(__sparc_v9__) + return 0; /* No cmpxchg before v9 sparc. */ +#endif + return 1; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h:1.2 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_ioctl.h Tue Apr 10 12:08:04 2001 @@ -0,0 +1,231 @@ +/* drm_ioctl.h -- IOCTL processing for DRM -*- linux-c -*- + * Created: Fri Jan 8 09:01:26 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +int DRM(irq_busid)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_irq_busid_t p; + struct pci_dev *dev; + + if (copy_from_user(&p, (drm_irq_busid_t *)arg, sizeof(p))) + return -EFAULT; + dev = pci_find_slot(p.busnum, PCI_DEVFN(p.devnum, p.funcnum)); + if (dev) p.irq = dev->irq; + else p.irq = 0; + DRM_DEBUG("%d:%d:%d => IRQ %d\n", + p.busnum, p.devnum, p.funcnum, p.irq); + if (copy_to_user((drm_irq_busid_t *)arg, &p, sizeof(p))) + return -EFAULT; + return 0; +} + +int DRM(getunique)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_unique_t u; + + if (copy_from_user(&u, (drm_unique_t *)arg, sizeof(u))) + return -EFAULT; + if (u.unique_len >= dev->unique_len) { + if (copy_to_user(u.unique, dev->unique, dev->unique_len)) + return -EFAULT; + } + u.unique_len = dev->unique_len; + if (copy_to_user((drm_unique_t *)arg, &u, sizeof(u))) + return -EFAULT; + return 0; +} + +int DRM(setunique)(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_unique_t u; + + if (dev->unique_len || dev->unique) + return -EBUSY; + + if (copy_from_user(&u, (drm_unique_t *)arg, sizeof(u))) + return -EFAULT; + + if (!u.unique_len) + return -EINVAL; + + dev->unique_len = u.unique_len; + dev->unique = DRM(alloc)(u.unique_len + 1, DRM_MEM_DRIVER); + if (copy_from_user(dev->unique, u.unique, dev->unique_len)) + return -EFAULT; + dev->unique[dev->unique_len] = '\0'; + + dev->devname = DRM(alloc)(strlen(dev->name) + strlen(dev->unique) + 2, + DRM_MEM_DRIVER); + sprintf(dev->devname, "%s@%s", dev->name, dev->unique); + +#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; +} + + +int DRM(getmap)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_map_t map; + drm_map_list_t *r_list = NULL; + struct list_head *list; + int idx; + int i; + + if (copy_from_user(&map, (drm_map_t *)arg, sizeof(map))) + return -EFAULT; + idx = map.offset; + + down(&dev->struct_sem); + if (idx < 0 || idx >= dev->map_count) { + up(&dev->struct_sem); + return -EINVAL; + } + + i = 0; + list_for_each(list, &dev->maplist->head) { + if(i == idx) { + r_list = (drm_map_list_t *)list; + break; + } + i++; + } + if(!r_list || !r_list->map) { + up(&dev->struct_sem); + return -EINVAL; + } + + map.offset = r_list->map->offset; + map.size = r_list->map->size; + map.type = r_list->map->type; + map.flags = r_list->map->flags; + map.handle = r_list->map->handle; + map.mtrr = r_list->map->mtrr; + up(&dev->struct_sem); + + if (copy_to_user((drm_map_t *)arg, &map, sizeof(map))) return -EFAULT; + return 0; +} + +int DRM(getclient)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_client_t client; + drm_file_t *pt; + int idx; + int i; + + if (copy_from_user(&client, (drm_client_t *)arg, sizeof(client))) + return -EFAULT; + idx = client.idx; + down(&dev->struct_sem); + for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) + ; + + if (!pt) { + up(&dev->struct_sem); + return -EINVAL; + } + client.auth = pt->authenticated; + client.pid = pt->pid; + client.uid = pt->uid; + client.magic = pt->magic; + client.iocs = pt->ioctl_count; + up(&dev->struct_sem); + + if (copy_to_user((drm_client_t *)arg, &client, sizeof(client))) + return -EFAULT; + return 0; +} + +int DRM(getstats)( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_stats_t stats; + int i; + + memset(&stats, 0, sizeof(stats)); + + down(&dev->struct_sem); + + for (i = 0; i < dev->counters; i++) { + if (dev->types[i] == _DRM_STAT_LOCK) + stats.data[i].value + = (dev->lock.hw_lock + ? dev->lock.hw_lock->lock : 0); + else + stats.data[i].value = atomic_read(&dev->counts[i]); + stats.data[i].type = dev->types[i]; + } + + stats.count = dev->counters; + + up(&dev->struct_sem); + + if (copy_to_user((drm_stats_t *)arg, &stats, sizeof(stats))) + return -EFAULT; + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lists.h Wed Mar 21 13:08:55 2001 @@ -0,0 +1,227 @@ +/* drm_lists.h -- Buffer list handling routines -*- linux-c -*- + * Created: Mon Apr 19 20:54:22 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +#if __HAVE_DMA_WAITLIST + +int DRM(waitlist_create)(drm_waitlist_t *bl, int count) +{ + if (bl->count) return -EINVAL; + + bl->count = count; + bl->bufs = DRM(alloc)((bl->count + 2) * sizeof(*bl->bufs), + DRM_MEM_BUFLISTS); + bl->rp = bl->bufs; + bl->wp = bl->bufs; + bl->end = &bl->bufs[bl->count+1]; + bl->write_lock = SPIN_LOCK_UNLOCKED; + bl->read_lock = SPIN_LOCK_UNLOCKED; + return 0; +} + +int DRM(waitlist_destroy)(drm_waitlist_t *bl) +{ + if (bl->rp != bl->wp) return -EINVAL; + if (bl->bufs) DRM(free)(bl->bufs, + (bl->count + 2) * sizeof(*bl->bufs), + DRM_MEM_BUFLISTS); + bl->count = 0; + bl->bufs = NULL; + bl->rp = NULL; + bl->wp = NULL; + bl->end = NULL; + return 0; +} + +int DRM(waitlist_put)(drm_waitlist_t *bl, drm_buf_t *buf) +{ + int left; + unsigned long flags; + + left = DRM_LEFTCOUNT(bl); + if (!left) { + DRM_ERROR("Overflow while adding buffer %d from pid %d\n", + buf->idx, buf->pid); + return -EINVAL; + } +#if __HAVE_DMA_HISTOGRAM + buf->time_queued = get_cycles(); +#endif + buf->list = DRM_LIST_WAIT; + + spin_lock_irqsave(&bl->write_lock, flags); + *bl->wp = buf; + if (++bl->wp >= bl->end) bl->wp = bl->bufs; + spin_unlock_irqrestore(&bl->write_lock, flags); + + return 0; +} + +drm_buf_t *DRM(waitlist_get)(drm_waitlist_t *bl) +{ + drm_buf_t *buf; + unsigned long flags; + + spin_lock_irqsave(&bl->read_lock, flags); + buf = *bl->rp; + if (bl->rp == bl->wp) { + spin_unlock_irqrestore(&bl->read_lock, flags); + return NULL; + } + if (++bl->rp >= bl->end) bl->rp = bl->bufs; + spin_unlock_irqrestore(&bl->read_lock, flags); + + return buf; +} + +#endif /* __HAVE_DMA_WAITLIST */ + + +#if __HAVE_DMA_FREELIST + +int DRM(freelist_create)(drm_freelist_t *bl, int count) +{ + atomic_set(&bl->count, 0); + bl->next = NULL; + init_waitqueue_head(&bl->waiting); + bl->low_mark = 0; + bl->high_mark = 0; + atomic_set(&bl->wfh, 0); + bl->lock = SPIN_LOCK_UNLOCKED; + ++bl->initialized; + return 0; +} + +int DRM(freelist_destroy)(drm_freelist_t *bl) +{ + atomic_set(&bl->count, 0); + bl->next = NULL; + return 0; +} + +int DRM(freelist_put)(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf) +{ + drm_device_dma_t *dma = dev->dma; + + if (!dma) { + DRM_ERROR("No DMA support\n"); + return 1; + } + + if (buf->waiting || buf->pending || buf->list == DRM_LIST_FREE) { + DRM_ERROR("Freed buffer %d: w%d, p%d, l%d\n", + buf->idx, buf->waiting, buf->pending, buf->list); + } + if (!bl) return 1; +#if __HAVE_DMA_HISTOGRAM + buf->time_freed = get_cycles(); + DRM(histogram_compute)(dev, buf); +#endif + buf->list = DRM_LIST_FREE; + + spin_lock(&bl->lock); + buf->next = bl->next; + bl->next = buf; + spin_unlock(&bl->lock); + + atomic_inc(&bl->count); + if (atomic_read(&bl->count) > dma->buf_count) { + DRM_ERROR("%d of %d buffers free after addition of %d\n", + atomic_read(&bl->count), dma->buf_count, buf->idx); + return 1; + } + /* Check for high water mark */ + if (atomic_read(&bl->wfh) && atomic_read(&bl->count)>=bl->high_mark) { + atomic_set(&bl->wfh, 0); + wake_up_interruptible(&bl->waiting); + } + return 0; +} + +static drm_buf_t *DRM(freelist_try)(drm_freelist_t *bl) +{ + drm_buf_t *buf; + + if (!bl) return NULL; + + /* Get buffer */ + spin_lock(&bl->lock); + if (!bl->next) { + spin_unlock(&bl->lock); + return NULL; + } + buf = bl->next; + bl->next = bl->next->next; + spin_unlock(&bl->lock); + + atomic_dec(&bl->count); + buf->next = NULL; + buf->list = DRM_LIST_NONE; + if (buf->waiting || buf->pending) { + DRM_ERROR("Free buffer %d: w%d, p%d, l%d\n", + buf->idx, buf->waiting, buf->pending, buf->list); + } + + return buf; +} + +drm_buf_t *DRM(freelist_get)(drm_freelist_t *bl, int block) +{ + drm_buf_t *buf = NULL; + DECLARE_WAITQUEUE(entry, current); + + if (!bl || !bl->initialized) return NULL; + + /* Check for low water mark */ + if (atomic_read(&bl->count) <= bl->low_mark) /* Became low */ + atomic_set(&bl->wfh, 1); + if (atomic_read(&bl->wfh)) { + if (block) { + add_wait_queue(&bl->waiting, &entry); + for (;;) { + current->state = TASK_INTERRUPTIBLE; + if (!atomic_read(&bl->wfh) + && (buf = DRM(freelist_try)(bl))) break; + schedule(); + if (signal_pending(current)) break; + } + current->state = TASK_RUNNING; + remove_wait_queue(&bl->waiting, &entry); + } + return buf; + } + + return DRM(freelist_try)(bl); +} + +#endif /* __HAVE_DMA_FREELIST */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_lock.h Wed Mar 21 13:08:55 2001 @@ -0,0 +1,251 @@ +/* lock.c -- IOCTLs for locking -*- linux-c -*- + * Created: Tue Feb 2 08:37:54 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +int DRM(block)(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + DRM_DEBUG("\n"); + return 0; +} + +int DRM(unblock)(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + DRM_DEBUG("\n"); + return 0; +} + +int DRM(lock_take)(__volatile__ unsigned int *lock, unsigned int context) +{ + unsigned int old, new, prev; + + do { + old = *lock; + if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT; + else new = context | _DRM_LOCK_HELD; + prev = cmpxchg(lock, old, new); + } while (prev != old); + if (_DRM_LOCKING_CONTEXT(old) == context) { + if (old & _DRM_LOCK_HELD) { + if (context != DRM_KERNEL_CONTEXT) { + DRM_ERROR("%d holds heavyweight lock\n", + context); + } + return 0; + } + } + if (new == (context | _DRM_LOCK_HELD)) { + /* Have lock */ + return 1; + } + return 0; +} + +/* This takes a lock forcibly and hands it to context. Should ONLY be used + inside *_unlock to give lock to kernel before calling *_dma_schedule. */ +int DRM(lock_transfer)(drm_device_t *dev, + __volatile__ unsigned int *lock, unsigned int context) +{ + unsigned int old, new, prev; + + dev->lock.pid = 0; + do { + old = *lock; + new = context | _DRM_LOCK_HELD; + prev = cmpxchg(lock, old, new); + } while (prev != old); + return 1; +} + +int DRM(lock_free)(drm_device_t *dev, + __volatile__ unsigned int *lock, unsigned int context) +{ + unsigned int old, new, prev; + pid_t pid = dev->lock.pid; + + dev->lock.pid = 0; + do { + old = *lock; + new = 0; + prev = cmpxchg(lock, old, new); + } while (prev != old); + if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) { + DRM_ERROR("%d freed heavyweight lock held by %d (pid %d)\n", + context, + _DRM_LOCKING_CONTEXT(old), + pid); + return 1; + } + wake_up_interruptible(&dev->lock.lock_queue); + return 0; +} + +static int DRM(flush_queue)(drm_device_t *dev, int context) +{ + DECLARE_WAITQUEUE(entry, current); + int ret = 0; + drm_queue_t *q = dev->queuelist[context]; + + DRM_DEBUG("\n"); + + atomic_inc(&q->use_count); + if (atomic_read(&q->use_count) > 1) { + atomic_inc(&q->block_write); + add_wait_queue(&q->flush_queue, &entry); + atomic_inc(&q->block_count); + for (;;) { + current->state = TASK_INTERRUPTIBLE; + if (!DRM_BUFCOUNT(&q->waitlist)) break; + schedule(); + if (signal_pending(current)) { + ret = -EINTR; /* Can't restart */ + break; + } + } + atomic_dec(&q->block_count); + current->state = TASK_RUNNING; + remove_wait_queue(&q->flush_queue, &entry); + } + atomic_dec(&q->use_count); + + /* NOTE: block_write is still incremented! + Use drm_flush_unlock_queue to decrement. */ + return ret; +} + +static int DRM(flush_unblock_queue)(drm_device_t *dev, int context) +{ + drm_queue_t *q = dev->queuelist[context]; + + DRM_DEBUG("\n"); + + atomic_inc(&q->use_count); + if (atomic_read(&q->use_count) > 1) { + if (atomic_read(&q->block_write)) { + atomic_dec(&q->block_write); + wake_up_interruptible(&q->write_queue); + } + } + atomic_dec(&q->use_count); + return 0; +} + +int DRM(flush_block_and_flush)(drm_device_t *dev, int context, + drm_lock_flags_t flags) +{ + int ret = 0; + int i; + + DRM_DEBUG("\n"); + + if (flags & _DRM_LOCK_FLUSH) { + ret = DRM(flush_queue)(dev, DRM_KERNEL_CONTEXT); + if (!ret) ret = DRM(flush_queue)(dev, context); + } + if (flags & _DRM_LOCK_FLUSH_ALL) { + for (i = 0; !ret && i < dev->queue_count; i++) { + ret = DRM(flush_queue)(dev, i); + } + } + return ret; +} + +int DRM(flush_unblock)(drm_device_t *dev, int context, drm_lock_flags_t flags) +{ + int ret = 0; + int i; + + DRM_DEBUG("\n"); + + if (flags & _DRM_LOCK_FLUSH) { + ret = DRM(flush_unblock_queue)(dev, DRM_KERNEL_CONTEXT); + if (!ret) ret = DRM(flush_unblock_queue)(dev, context); + } + if (flags & _DRM_LOCK_FLUSH_ALL) { + for (i = 0; !ret && i < dev->queue_count; i++) { + ret = DRM(flush_unblock_queue)(dev, i); + } + } + + return ret; +} + +int DRM(finish)(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + int ret = 0; + drm_lock_t lock; + + DRM_DEBUG("\n"); + + if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) + return -EFAULT; + ret = DRM(flush_block_and_flush)(dev, lock.context, lock.flags); + DRM(flush_unblock)(dev, lock.context, lock.flags); + return ret; +} + +/* If we get here, it means that the process has called DRM_IOCTL_LOCK + without calling DRM_IOCTL_UNLOCK. + + If the lock is not held, then let the signal proceed as usual. + + If the lock is held, then set the contended flag and keep the signal + blocked. + + + Return 1 if the signal should be delivered normally. + Return 0 if the signal should be blocked. */ + +int DRM(notifier)(void *priv) +{ + drm_sigdata_t *s = (drm_sigdata_t *)priv; + unsigned int old, new, prev; + + + /* Allow signal delivery if lock isn't held */ + if (!_DRM_LOCK_IS_HELD(s->lock->lock) + || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) return 1; + + /* Otherwise, set flag to force call to + drmUnlock */ + do { + old = s->lock->lock; + new = old | _DRM_LOCK_CONT; + prev = cmpxchg(&s->lock->lock, old, new); + } while (prev != old); + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h:1.2 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_memory.h Tue Apr 10 12:08:04 2001 @@ -0,0 +1,459 @@ +/* drm_memory.h -- Memory management wrappers for DRM -*- linux-c -*- + * Created: Thu Feb 4 14:00:34 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include <linux/config.h> +#include "drmP.h" +#include <linux/wrapper.h> + +typedef struct drm_mem_stats { + const char *name; + int succeed_count; + int free_count; + int fail_count; + unsigned long bytes_allocated; + unsigned long bytes_freed; +} drm_mem_stats_t; + +static spinlock_t DRM(mem_lock) = SPIN_LOCK_UNLOCKED; +static unsigned long DRM(ram_available) = 0; /* In pages */ +static unsigned long DRM(ram_used) = 0; +static drm_mem_stats_t DRM(mem_stats)[] = { + [DRM_MEM_DMA] = { "dmabufs" }, + [DRM_MEM_SAREA] = { "sareas" }, + [DRM_MEM_DRIVER] = { "driver" }, + [DRM_MEM_MAGIC] = { "magic" }, + [DRM_MEM_IOCTLS] = { "ioctltab" }, + [DRM_MEM_MAPS] = { "maplist" }, + [DRM_MEM_VMAS] = { "vmalist" }, + [DRM_MEM_BUFS] = { "buflist" }, + [DRM_MEM_SEGS] = { "seglist" }, + [DRM_MEM_PAGES] = { "pagelist" }, + [DRM_MEM_FILES] = { "files" }, + [DRM_MEM_QUEUES] = { "queues" }, + [DRM_MEM_CMDS] = { "commands" }, + [DRM_MEM_MAPPINGS] = { "mappings" }, + [DRM_MEM_BUFLISTS] = { "buflists" }, + [DRM_MEM_AGPLISTS] = { "agplist" }, + [DRM_MEM_SGLISTS] = { "sglist" }, + [DRM_MEM_TOTALAGP] = { "totalagp" }, + [DRM_MEM_BOUNDAGP] = { "boundagp" }, + [DRM_MEM_CTXBITMAP] = { "ctxbitmap"}, + [DRM_MEM_STUB] = { "stub" }, + { NULL, 0, } /* Last entry must be null */ +}; + +void DRM(mem_init)(void) +{ + drm_mem_stats_t *mem; + struct sysinfo si; + + for (mem = DRM(mem_stats); mem->name; ++mem) { + mem->succeed_count = 0; + mem->free_count = 0; + mem->fail_count = 0; + mem->bytes_allocated = 0; + mem->bytes_freed = 0; + } + + si_meminfo(&si); +#if LINUX_VERSION_CODE < 0x020317 + /* Changed to page count in 2.3.23 */ + DRM(ram_available) = si.totalram >> PAGE_SHIFT; +#else + DRM(ram_available) = si.totalram; +#endif + DRM(ram_used) = 0; +} + +/* drm_mem_info is called whenever a process reads /dev/drm/mem. */ + +static int DRM(_mem_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data) +{ + drm_mem_stats_t *pt; + int len = 0; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *eof = 0; + *start = &buf[offset]; + + DRM_PROC_PRINT(" total counts " + " | outstanding \n"); + DRM_PROC_PRINT("type alloc freed fail bytes freed" + " | allocs bytes\n\n"); + DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", + "system", 0, 0, 0, + DRM(ram_available) << (PAGE_SHIFT - 10)); + DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", + "locked", 0, 0, 0, DRM(ram_used) >> 10); + DRM_PROC_PRINT("\n"); + for (pt = DRM(mem_stats); pt->name; pt++) { + DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu %10lu | %6d %10ld\n", + pt->name, + pt->succeed_count, + pt->free_count, + pt->fail_count, + pt->bytes_allocated, + pt->bytes_freed, + pt->succeed_count - pt->free_count, + (long)pt->bytes_allocated + - (long)pt->bytes_freed); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +int DRM(mem_info)(char *buf, char **start, off_t offset, + int len, int *eof, void *data) +{ + int ret; + + spin_lock(&DRM(mem_lock)); + ret = DRM(_mem_info)(buf, start, offset, len, eof, data); + spin_unlock(&DRM(mem_lock)); + return ret; +} + +void *DRM(alloc)(size_t size, int area) +{ + void *pt; + + if (!size) { + DRM_MEM_ERROR(area, "Allocating 0 bytes\n"); + return NULL; + } + + if (!(pt = kmalloc(size, GFP_KERNEL))) { + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[area].fail_count; + spin_unlock(&DRM(mem_lock)); + return NULL; + } + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[area].succeed_count; + DRM(mem_stats)[area].bytes_allocated += size; + spin_unlock(&DRM(mem_lock)); + return pt; +} + +void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area) +{ + void *pt; + + if (!(pt = DRM(alloc)(size, area))) return NULL; + if (oldpt && oldsize) { + memcpy(pt, oldpt, oldsize); + DRM(free)(oldpt, oldsize, area); + } + return pt; +} + +char *DRM(strdup)(const char *s, int area) +{ + char *pt; + int length = s ? strlen(s) : 0; + + if (!(pt = DRM(alloc)(length+1, area))) return NULL; + strcpy(pt, s); + return pt; +} + +void DRM(strfree)(const char *s, int area) +{ + unsigned int size; + + if (!s) return; + + size = 1 + (s ? strlen(s) : 0); + DRM(free)((void *)s, size, area); +} + +void DRM(free)(void *pt, size_t size, int area) +{ + int alloc_count; + int free_count; + + if (!pt) DRM_MEM_ERROR(area, "Attempt to free NULL pointer\n"); + else kfree(pt); + spin_lock(&DRM(mem_lock)); + DRM(mem_stats)[area].bytes_freed += size; + free_count = ++DRM(mem_stats)[area].free_count; + alloc_count = DRM(mem_stats)[area].succeed_count; + spin_unlock(&DRM(mem_lock)); + if (free_count > alloc_count) { + DRM_MEM_ERROR(area, "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); + } +} + +unsigned long DRM(alloc_pages)(int order, int area) +{ + unsigned long address; + unsigned long bytes = PAGE_SIZE << order; + unsigned long addr; + unsigned int sz; + + spin_lock(&DRM(mem_lock)); + if ((DRM(ram_used) >> PAGE_SHIFT) + > (DRM_RAM_PERCENT * DRM(ram_available)) / 100) { + spin_unlock(&DRM(mem_lock)); + return 0; + } + spin_unlock(&DRM(mem_lock)); + + address = __get_free_pages(GFP_KERNEL, order); + if (!address) { + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[area].fail_count; + spin_unlock(&DRM(mem_lock)); + return 0; + } + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[area].succeed_count; + DRM(mem_stats)[area].bytes_allocated += bytes; + DRM(ram_used) += bytes; + spin_unlock(&DRM(mem_lock)); + + + /* Zero outside the lock */ + memset((void *)address, 0, bytes); + + /* Reserve */ + for (addr = address, sz = bytes; + sz > 0; + addr += PAGE_SIZE, sz -= PAGE_SIZE) { +#if LINUX_VERSION_CODE >= 0x020400 + /* Argument type changed in 2.4.0-test6/pre8 */ + mem_map_reserve(virt_to_page(addr)); +#else + mem_map_reserve(MAP_NR(addr)); +#endif + } + + return address; +} + +void DRM(free_pages)(unsigned long address, int order, int area) +{ + unsigned long bytes = PAGE_SIZE << order; + int alloc_count; + int free_count; + unsigned long addr; + unsigned int sz; + + if (!address) { + DRM_MEM_ERROR(area, "Attempt to free address 0\n"); + } else { + /* Unreserve */ + for (addr = address, sz = bytes; + sz > 0; + addr += PAGE_SIZE, sz -= PAGE_SIZE) { +#if LINUX_VERSION_CODE >= 0x020400 + /* Argument type changed in 2.4.0-test6/pre8 */ + mem_map_unreserve(virt_to_page(addr)); +#else + mem_map_unreserve(MAP_NR(addr)); +#endif + } + free_pages(address, order); + } + + spin_lock(&DRM(mem_lock)); + free_count = ++DRM(mem_stats)[area].free_count; + alloc_count = DRM(mem_stats)[area].succeed_count; + DRM(mem_stats)[area].bytes_freed += bytes; + DRM(ram_used) -= bytes; + spin_unlock(&DRM(mem_lock)); + if (free_count > alloc_count) { + DRM_MEM_ERROR(area, + "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); + } +} + +void *DRM(ioremap)(unsigned long offset, unsigned long size) +{ + void *pt; + + if (!size) { + DRM_MEM_ERROR(DRM_MEM_MAPPINGS, + "Mapping 0 bytes at 0x%08lx\n", offset); + return NULL; + } + + if (!(pt = ioremap(offset, size))) { + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].fail_count; + spin_unlock(&DRM(mem_lock)); + return NULL; + } + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; + DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_allocated += size; + spin_unlock(&DRM(mem_lock)); + return pt; +} + +void DRM(ioremapfree)(void *pt, unsigned long size) +{ + int alloc_count; + int free_count; + + if (!pt) + DRM_MEM_ERROR(DRM_MEM_MAPPINGS, + "Attempt to free NULL pointer\n"); + else + iounmap(pt); + + spin_lock(&DRM(mem_lock)); + DRM(mem_stats)[DRM_MEM_MAPPINGS].bytes_freed += size; + free_count = ++DRM(mem_stats)[DRM_MEM_MAPPINGS].free_count; + alloc_count = DRM(mem_stats)[DRM_MEM_MAPPINGS].succeed_count; + spin_unlock(&DRM(mem_lock)); + if (free_count > alloc_count) { + DRM_MEM_ERROR(DRM_MEM_MAPPINGS, + "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); + } +} + +#if __REALLY_HAVE_AGP + +agp_memory *DRM(alloc_agp)(int pages, u32 type) +{ + agp_memory *handle; + + if (!pages) { + DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Allocating 0 pages\n"); + return NULL; + } + + if ((handle = DRM(agp_allocate_memory)(pages, type))) { + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_TOTALAGP].succeed_count; + DRM(mem_stats)[DRM_MEM_TOTALAGP].bytes_allocated + += pages << PAGE_SHIFT; + spin_unlock(&DRM(mem_lock)); + return handle; + } + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_TOTALAGP].fail_count; + spin_unlock(&DRM(mem_lock)); + return NULL; +} + +int DRM(free_agp)(agp_memory *handle, int pages) +{ + int alloc_count; + int free_count; + int retval = -EINVAL; + + if (!handle) { + DRM_MEM_ERROR(DRM_MEM_TOTALAGP, + "Attempt to free NULL AGP handle\n"); + return retval;; + } + + if (DRM(agp_free_memory)(handle)) { + spin_lock(&DRM(mem_lock)); + free_count = ++DRM(mem_stats)[DRM_MEM_TOTALAGP].free_count; + alloc_count = DRM(mem_stats)[DRM_MEM_TOTALAGP].succeed_count; + DRM(mem_stats)[DRM_MEM_TOTALAGP].bytes_freed + += pages << PAGE_SHIFT; + spin_unlock(&DRM(mem_lock)); + if (free_count > alloc_count) { + DRM_MEM_ERROR(DRM_MEM_TOTALAGP, + "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); + } + return 0; + } + return retval; +} + +int DRM(bind_agp)(agp_memory *handle, unsigned int start) +{ + int retcode = -EINVAL; + + if (!handle) { + DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, + "Attempt to bind NULL AGP handle\n"); + return retcode; + } + + if (!(retcode = DRM(agp_bind_memory)(handle, start))) { + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].succeed_count; + DRM(mem_stats)[DRM_MEM_BOUNDAGP].bytes_allocated + += handle->page_count << PAGE_SHIFT; + spin_unlock(&DRM(mem_lock)); + return retcode; + } + spin_lock(&DRM(mem_lock)); + ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].fail_count; + spin_unlock(&DRM(mem_lock)); + return retcode; +} + +int DRM(unbind_agp)(agp_memory *handle) +{ + int alloc_count; + int free_count; + int retcode = -EINVAL; + + if (!handle) { + DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, + "Attempt to unbind NULL AGP handle\n"); + return retcode; + } + + if ((retcode = DRM(agp_unbind_memory)(handle))) return retcode; + spin_lock(&DRM(mem_lock)); + free_count = ++DRM(mem_stats)[DRM_MEM_BOUNDAGP].free_count; + alloc_count = DRM(mem_stats)[DRM_MEM_BOUNDAGP].succeed_count; + DRM(mem_stats)[DRM_MEM_BOUNDAGP].bytes_freed + += handle->page_count << PAGE_SHIFT; + spin_unlock(&DRM(mem_lock)); + if (free_count > alloc_count) { + DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, + "Excess frees: %d frees, %d allocs\n", + free_count, alloc_count); + } + return retcode; +} +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_proc.h Wed Mar 21 13:08:55 2001 @@ -0,0 +1,630 @@ +/* drm_proc.h -- /proc support for DRM -*- linux-c -*- + * Created: Mon Jan 11 09:48:47 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * + * Acknowledgements: + * Matthew J Sottek <matthew.j.sottek@intel.com> sent in a patch to fix + * the problem with the proc files not outputting all their information. + */ + +#define __NO_VERSION__ +#include "drmP.h" + +static int DRM(name_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +static int DRM(vm_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +static int DRM(clients_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +static int DRM(queues_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +static int DRM(bufs_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +#if DRM_DEBUG_CODE +static int DRM(vma_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +#endif +#if __HAVE_DMA_HISTOGRAM +static int DRM(histo_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data); +#endif + +struct drm_proc_list { + const char *name; + int (*f)(char *, char **, off_t, int, int *, void *); +} DRM(proc_list)[] = { + { "name", DRM(name_info) }, + { "mem", DRM(mem_info) }, + { "vm", DRM(vm_info) }, + { "clients", DRM(clients_info) }, + { "queues", DRM(queues_info) }, + { "bufs", DRM(bufs_info) }, +#if DRM_DEBUG_CODE + { "vma", DRM(vma_info) }, +#endif +#if __HAVE_DMA_HISTOGRAM + { "histo", DRM(histo_info) }, +#endif +}; +#define DRM_PROC_ENTRIES (sizeof(DRM(proc_list))/sizeof(DRM(proc_list)[0])) + +struct proc_dir_entry *DRM(proc_init)(drm_device_t *dev, int minor, + struct proc_dir_entry *root, + struct proc_dir_entry **dev_root) +{ + struct proc_dir_entry *ent; + int i, j; + char name[64]; + + if (!minor) root = create_proc_entry("dri", S_IFDIR, NULL); + if (!root) { + DRM_ERROR("Cannot create /proc/dri\n"); + return NULL; + } + + sprintf(name, "%d", minor); + *dev_root = create_proc_entry(name, S_IFDIR, root); + if (!*dev_root) { + DRM_ERROR("Cannot create /proc/%s\n", name); + return NULL; + } + + for (i = 0; i < DRM_PROC_ENTRIES; i++) { + ent = create_proc_entry(DRM(proc_list)[i].name, + S_IFREG|S_IRUGO, *dev_root); + if (!ent) { + DRM_ERROR("Cannot create /proc/dri/%s/%s\n", + name, DRM(proc_list)[i].name); + for (j = 0; j < i; j++) + remove_proc_entry(DRM(proc_list)[i].name, + *dev_root); + remove_proc_entry(name, root); + if (!minor) remove_proc_entry("dri", NULL); + return NULL; + } + ent->read_proc = DRM(proc_list)[i].f; + ent->data = dev; + } + + return root; +} + + +int DRM(proc_cleanup)(int minor, struct proc_dir_entry *root, + struct proc_dir_entry *dev_root) +{ + int i; + char name[64]; + + if (!root || !dev_root) return 0; + + for (i = 0; i < DRM_PROC_ENTRIES; i++) + remove_proc_entry(DRM(proc_list)[i].name, dev_root); + sprintf(name, "%d", minor); + remove_proc_entry(name, root); + if (!minor) remove_proc_entry("dri", NULL); + + return 0; +} + +static int DRM(name_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + if (dev->unique) { + DRM_PROC_PRINT("%s 0x%x %s\n", + dev->name, dev->device, dev->unique); + } else { + DRM_PROC_PRINT("%s 0x%x\n", dev->name, dev->device); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(_vm_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_map_t *map; + drm_map_list_t *r_list; + struct list_head *list; + + /* Hardcoded from _DRM_FRAME_BUFFER, + _DRM_REGISTERS, _DRM_SHM, and + _DRM_AGP. */ + const char *types[] = { "FB", "REG", "SHM", "AGP" }; + const char *type; + int i; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT("slot offset size type flags " + "address mtrr\n\n"); + i = 0; + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *)list; + map = r_list->map; + if(!map) continue; + if (map->type < 0 || map->type > 3) type = "??"; + else type = types[map->type]; + DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", + i, + map->offset, + map->size, + type, + map->flags, + (unsigned long)map->handle); + if (map->mtrr < 0) { + DRM_PROC_PRINT("none\n"); + } else { + DRM_PROC_PRINT("%4d\n", map->mtrr); + } + i++; + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(vm_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = DRM(_vm_info)(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} + + +static int DRM(_queues_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + int i; + drm_queue_t *q; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT(" ctx/flags use fin" + " blk/rw/rwf wait flushed queued" + " locks\n\n"); + for (i = 0; i < dev->queue_count; i++) { + q = dev->queuelist[i]; + atomic_inc(&q->use_count); + DRM_PROC_PRINT_RET(atomic_dec(&q->use_count), + "%5d/0x%03x %5d %5d" + " %5d/%c%c/%c%c%c %5Zd\n", + i, + q->flags, + atomic_read(&q->use_count), + atomic_read(&q->finalization), + atomic_read(&q->block_count), + atomic_read(&q->block_read) ? 'r' : '-', + atomic_read(&q->block_write) ? 'w' : '-', + waitqueue_active(&q->read_queue) ? 'r':'-', + waitqueue_active(&q->write_queue) ? 'w':'-', + waitqueue_active(&q->flush_queue) ? 'f':'-', + DRM_BUFCOUNT(&q->waitlist)); + atomic_dec(&q->use_count); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(queues_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = DRM(_queues_info)(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} + +/* drm_bufs_info is called whenever a process reads + /dev/dri/<dev>/bufs. */ + +static int DRM(_bufs_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_device_dma_t *dma = dev->dma; + int i; + + if (!dma || offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT(" o size count free segs pages kB\n\n"); + for (i = 0; i <= DRM_MAX_ORDER; i++) { + if (dma->bufs[i].buf_count) + DRM_PROC_PRINT("%2d %8d %5d %5d %5d %5d %5ld\n", + i, + dma->bufs[i].buf_size, + dma->bufs[i].buf_count, + atomic_read(&dma->bufs[i] + .freelist.count), + dma->bufs[i].seg_count, + dma->bufs[i].seg_count + *(1 << dma->bufs[i].page_order), + (dma->bufs[i].seg_count + * (1 << dma->bufs[i].page_order)) + * PAGE_SIZE / 1024); + } + DRM_PROC_PRINT("\n"); + for (i = 0; i < dma->buf_count; i++) { + if (i && !(i%32)) DRM_PROC_PRINT("\n"); + DRM_PROC_PRINT(" %d", dma->buflist[i]->list); + } + DRM_PROC_PRINT("\n"); + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(bufs_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = DRM(_bufs_info)(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} + + +static int DRM(_clients_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_file_t *priv; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT("a dev pid uid magic ioctls\n\n"); + for (priv = dev->file_first; priv; priv = priv->next) { + DRM_PROC_PRINT("%c %3d %5d %5d %10u %10lu\n", + priv->authenticated ? 'y' : 'n', + priv->minor, + priv->pid, + priv->uid, + priv->magic, + priv->ioctl_count); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(clients_info)(char *buf, char **start, off_t offset, + int request, int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = DRM(_clients_info)(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} + +#if DRM_DEBUG_CODE + +#define DRM_VMA_VERBOSE 0 + +static int DRM(_vma_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_vma_entry_t *pt; + struct vm_area_struct *vma; +#if DRM_VMA_VERBOSE + unsigned long i; + unsigned long address; + pgd_t *pgd; + pmd_t *pmd; + pte_t *pte; +#endif +#if defined(__i386__) + unsigned int pgprot; +#endif + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n", + atomic_read(&dev->vma_count), + high_memory, virt_to_phys(high_memory)); + for (pt = dev->vmalist; pt; pt = pt->next) { + if (!(vma = pt->vma)) continue; + DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx", + pt->pid, + vma->vm_start, + vma->vm_end, + vma->vm_flags & VM_READ ? 'r' : '-', + vma->vm_flags & VM_WRITE ? 'w' : '-', + vma->vm_flags & VM_EXEC ? 'x' : '-', + vma->vm_flags & VM_MAYSHARE ? 's' : 'p', + vma->vm_flags & VM_LOCKED ? 'l' : '-', + vma->vm_flags & VM_IO ? 'i' : '-', + VM_OFFSET(vma)); + +#if defined(__i386__) + pgprot = pgprot_val(vma->vm_page_prot); + DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c", + pgprot & _PAGE_PRESENT ? 'p' : '-', + pgprot & _PAGE_RW ? 'w' : 'r', + pgprot & _PAGE_USER ? 'u' : 's', + pgprot & _PAGE_PWT ? 't' : 'b', + pgprot & _PAGE_PCD ? 'u' : 'c', + pgprot & _PAGE_ACCESSED ? 'a' : '-', + pgprot & _PAGE_DIRTY ? 'd' : '-', + pgprot & _PAGE_PSE ? 'm' : 'k', + pgprot & _PAGE_GLOBAL ? 'g' : 'l' ); +#endif + DRM_PROC_PRINT("\n"); +#if 0 + for (i = vma->vm_start; i < vma->vm_end; i += PAGE_SIZE) { + pgd = pgd_offset(vma->vm_mm, i); + pmd = pmd_offset(pgd, i); + pte = pte_offset(pmd, i); + if (pte_present(*pte)) { + address = __pa(pte_page(*pte)) + + (i & (PAGE_SIZE-1)); + DRM_PROC_PRINT(" 0x%08lx -> 0x%08lx" + " %c%c%c%c%c\n", + i, + address, + pte_read(*pte) ? 'r' : '-', + pte_write(*pte) ? 'w' : '-', + pte_exec(*pte) ? 'x' : '-', + pte_dirty(*pte) ? 'd' : '-', + pte_young(*pte) ? 'a' : '-' ); + } else { + DRM_PROC_PRINT(" 0x%08lx\n", i); + } + } +#endif + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(vma_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = DRM(_vma_info)(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} +#endif + + +#if __HAVE_DMA_HISTOGRAM +static int DRM(_histo_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int len = 0; + drm_device_dma_t *dma = dev->dma; + int i; + unsigned long slot_value = DRM_DMA_HISTOGRAM_INITIAL; + unsigned long prev_value = 0; + drm_buf_t *buffer; + + if (offset > DRM_PROC_LIMIT) { + *eof = 1; + return 0; + } + + *start = &buf[offset]; + *eof = 0; + + DRM_PROC_PRINT("general statistics:\n"); + DRM_PROC_PRINT("total %10u\n", atomic_read(&dev->histo.total)); + DRM_PROC_PRINT("open %10u\n", + atomic_read(&dev->counts[_DRM_STAT_OPENS])); + DRM_PROC_PRINT("close %10u\n", + atomic_read(&dev->counts[_DRM_STAT_CLOSES])); + DRM_PROC_PRINT("ioctl %10u\n", + atomic_read(&dev->counts[_DRM_STAT_IOCTLS])); + + DRM_PROC_PRINT("\nlock statistics:\n"); + DRM_PROC_PRINT("locks %10u\n", + atomic_read(&dev->counts[_DRM_STAT_LOCKS])); + DRM_PROC_PRINT("unlocks %10u\n", + atomic_read(&dev->counts[_DRM_STAT_UNLOCKS])); + + if (dma) { +#if 0 + DRM_PROC_PRINT("\ndma statistics:\n"); + DRM_PROC_PRINT("prio %10u\n", + atomic_read(&dma->total_prio)); + DRM_PROC_PRINT("bytes %10u\n", + atomic_read(&dma->total_bytes)); + DRM_PROC_PRINT("dmas %10u\n", + atomic_read(&dma->total_dmas)); + DRM_PROC_PRINT("missed:\n"); + DRM_PROC_PRINT(" dma %10u\n", + atomic_read(&dma->total_missed_dma)); + DRM_PROC_PRINT(" lock %10u\n", + atomic_read(&dma->total_missed_lock)); + DRM_PROC_PRINT(" free %10u\n", + atomic_read(&dma->total_missed_free)); + DRM_PROC_PRINT(" sched %10u\n", + atomic_read(&dma->total_missed_sched)); + DRM_PROC_PRINT("tried %10u\n", + atomic_read(&dma->total_tried)); + DRM_PROC_PRINT("hit %10u\n", + atomic_read(&dma->total_hit)); + DRM_PROC_PRINT("lost %10u\n", + atomic_read(&dma->total_lost)); +#endif + + buffer = dma->next_buffer; + if (buffer) { + DRM_PROC_PRINT("next_buffer %7d\n", buffer->idx); + } else { + DRM_PROC_PRINT("next_buffer none\n"); + } + buffer = dma->this_buffer; + if (buffer) { + DRM_PROC_PRINT("this_buffer %7d\n", buffer->idx); + } else { + DRM_PROC_PRINT("this_buffer none\n"); + } + } + + + DRM_PROC_PRINT("\nvalues:\n"); + if (dev->lock.hw_lock) { + DRM_PROC_PRINT("lock 0x%08x\n", + dev->lock.hw_lock->lock); + } else { + DRM_PROC_PRINT("lock none\n"); + } + DRM_PROC_PRINT("context_flag 0x%08lx\n", dev->context_flag); + DRM_PROC_PRINT("interrupt_flag 0x%08lx\n", dev->interrupt_flag); + DRM_PROC_PRINT("dma_flag 0x%08lx\n", dev->dma_flag); + + DRM_PROC_PRINT("queue_count %10d\n", dev->queue_count); + DRM_PROC_PRINT("last_context %10d\n", dev->last_context); + DRM_PROC_PRINT("last_switch %10lu\n", dev->last_switch); + DRM_PROC_PRINT("last_checked %10d\n", dev->last_checked); + + + DRM_PROC_PRINT("\n q2d d2c c2f" + " q2c q2f dma sch" + " ctx lacq lhld\n\n"); + for (i = 0; i < DRM_DMA_HISTOGRAM_SLOTS; i++) { + DRM_PROC_PRINT("%s %10lu %10u %10u %10u %10u %10u" + " %10u %10u %10u %10u %10u\n", + i == DRM_DMA_HISTOGRAM_SLOTS - 1 ? ">=" : "< ", + i == DRM_DMA_HISTOGRAM_SLOTS - 1 + ? prev_value : slot_value , + + atomic_read(&dev->histo + .queued_to_dispatched[i]), + atomic_read(&dev->histo + .dispatched_to_completed[i]), + atomic_read(&dev->histo + .completed_to_freed[i]), + + atomic_read(&dev->histo + .queued_to_completed[i]), + atomic_read(&dev->histo + .queued_to_freed[i]), + atomic_read(&dev->histo.dma[i]), + atomic_read(&dev->histo.schedule[i]), + atomic_read(&dev->histo.ctx[i]), + atomic_read(&dev->histo.lacq[i]), + atomic_read(&dev->histo.lhld[i])); + prev_value = slot_value; + slot_value = DRM_DMA_HISTOGRAM_NEXT(slot_value); + } + + if (len > request + offset) return request; + *eof = 1; + return len - offset; +} + +static int DRM(histo_info)(char *buf, char **start, off_t offset, int request, + int *eof, void *data) +{ + drm_device_t *dev = (drm_device_t *)data; + int ret; + + down(&dev->struct_sem); + ret = DRM(_histo_info)(buf, start, offset, request, eof, data); + up(&dev->struct_sem); + return ret; +} +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_scatter.h Tue Apr 10 12:08:04 2001 @@ -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; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_stub.h Wed Mar 21 13:08:55 2001 @@ -0,0 +1,152 @@ +/* drm_stub.h -- -*- linux-c -*- + * Created: Fri Jan 19 10:48:35 2001 by faith@acm.org + * + * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * + */ + +#define __NO_VERSION__ +#include "drmP.h" + +#if LINUX_VERSION_CODE < 0x020400 +#include "stubsupport-pre24.h" +#endif + +#define DRM_STUB_MAXCARDS 16 /* Enough for one machine */ + +static struct drm_stub_list { + const char *name; + struct file_operations *fops; + struct proc_dir_entry *dev_root; +} *DRM(stub_list); + +static struct proc_dir_entry *DRM(stub_root); + +static struct drm_stub_info { + int (*info_register)(const char *name, struct file_operations *fops, + drm_device_t *dev); + int (*info_unregister)(int minor); +} DRM(stub_info); + +static int DRM(stub_open)(struct inode *inode, struct file *filp) +{ + int minor = MINOR(inode->i_rdev); + int err = -ENODEV; + struct file_operations *old_fops; + + if (!DRM(stub_list) || !DRM(stub_list)[minor].fops) return -ENODEV; + old_fops = filp->f_op; + filp->f_op = fops_get(DRM(stub_list)[minor].fops); + if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) { + fops_put(filp->f_op); + filp->f_op = fops_get(old_fops); + } + fops_put(old_fops); + + return err; +} + +static struct file_operations DRM(stub_fops) = { +#if LINUX_VERSION_CODE >= 0x020400 + owner: THIS_MODULE, +#endif + open: DRM(stub_open) +}; + +static int DRM(stub_getminor)(const char *name, struct file_operations *fops, + drm_device_t *dev) +{ + int i; + + if (!DRM(stub_list)) { + DRM(stub_list) = DRM(alloc)(sizeof(*DRM(stub_list)) + * DRM_STUB_MAXCARDS, DRM_MEM_STUB); + for (i = 0; i < DRM_STUB_MAXCARDS; i++) { + DRM(stub_list)[i].name = NULL; + DRM(stub_list)[i].fops = NULL; + } + } + for (i = 0; i < DRM_STUB_MAXCARDS; i++) { + if (!DRM(stub_list)[i].fops) { + DRM(stub_list)[i].name = name; + DRM(stub_list)[i].fops = fops; + DRM(stub_root) = DRM(proc_init)(dev, i, DRM(stub_root), + &DRM(stub_list)[i] + .dev_root); + return i; + } + } + return -1; +} + +static int DRM(stub_putminor)(int minor) +{ + if (minor < 0 || minor >= DRM_STUB_MAXCARDS) return -1; + DRM(stub_list)[minor].name = NULL; + DRM(stub_list)[minor].fops = NULL; + DRM(proc_cleanup)(minor, DRM(stub_root), + DRM(stub_list)[minor].dev_root); + if (minor) { + inter_module_put("drm"); + } else { + inter_module_unregister("drm"); + DRM(free)(DRM(stub_list), + sizeof(*DRM(stub_list)) * DRM_STUB_MAXCARDS, + DRM_MEM_STUB); + unregister_chrdev(DRM_MAJOR, "drm"); + } + return 0; +} + +int DRM(stub_register)(const char *name, struct file_operations *fops, + drm_device_t *dev) +{ + struct drm_stub_info *i = NULL; + + if (register_chrdev(DRM_MAJOR, "drm", &DRM(stub_fops))) + i = (struct drm_stub_info *)inter_module_get("drm"); + + if (i) { + /* Already registered */ + DRM(stub_info).info_register = i->info_register; + DRM(stub_info).info_unregister = i->info_unregister; + } else { + DRM(stub_info).info_register = DRM(stub_getminor); + DRM(stub_info).info_unregister = DRM(stub_putminor); + inter_module_register("drm", THIS_MODULE, &DRM(stub_info)); + } + if (DRM(stub_info).info_register) + return DRM(stub_info).info_register(name, fops, dev); + return -1; +} + +int DRM(stub_unregister)(int minor) +{ + DRM_DEBUG("%d\n", minor); + if (DRM(stub_info).info_unregister) + return DRM(stub_info).info_unregister(minor); + return -1; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h:1.2.2.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/drm_vm.h Wed May 23 14:58:00 2001 @@ -0,0 +1,484 @@ +/* drm_vm.h -- Memory mapping for DRM -*- linux-c -*- + * Created: Mon Jan 4 08:58:31 1999 by faith@valinux.com + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "drmP.h" + +struct vm_operations_struct drm_vm_ops = { + nopage: DRM(vm_nopage), + open: DRM(vm_open), + close: DRM(vm_close), +}; + +struct vm_operations_struct drm_vm_shm_ops = { + nopage: DRM(vm_shm_nopage), + open: DRM(vm_open), + close: DRM(vm_shm_close), +}; + +struct vm_operations_struct drm_vm_dma_ops = { + nopage: DRM(vm_dma_nopage), + open: DRM(vm_open), + close: DRM(vm_close), +}; + +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, + int write_access) +#else + /* Return type changed in 2.3.23 */ +struct page *DRM(vm_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#endif +{ + return NOPAGE_SIGBUS; /* Disallow mremap */ +} + +#if LINUX_VERSION_CODE < 0x020317 +unsigned long DRM(vm_shm_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#else + /* Return type changed in 2.3.23 */ +struct page *DRM(vm_shm_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#endif +{ +#if LINUX_VERSION_CODE >= 0x020300 + drm_map_t *map = (drm_map_t *)vma->vm_private_data; +#else + drm_map_t *map = (drm_map_t *)vma->vm_pte; +#endif + unsigned long physical; + unsigned long offset; + unsigned long i; + pgd_t *pgd; + pmd_t *pmd; + pte_t *pte; + + if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!map) return NOPAGE_OOM; /* Nothing allocated */ + + offset = address - vma->vm_start; + i = (unsigned long)map->handle + offset; + /* We have to walk page tables here because we need large SAREA's, and + * they need to be virtually contiguous in kernel space. + */ + pgd = pgd_offset_k( i ); + if( !pgd_present( *pgd ) ) return NOPAGE_OOM; + pmd = pmd_offset( pgd, i ); + if( !pmd_present( *pmd ) ) return NOPAGE_OOM; + pte = pte_offset( pmd, i ); + if( !pte_present( *pte ) ) return NOPAGE_OOM; + physical = (unsigned long)pte_page( *pte )->virtual; + atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */ + + DRM_DEBUG("0x%08lx => 0x%08lx\n", address, physical); +#if LINUX_VERSION_CODE < 0x020317 + return physical; +#else + return virt_to_page(physical); +#endif +} + +/* Special close routine which deletes map information if we are the last + * person to close a mapping and its not in the global maplist. + */ + +void DRM(vm_shm_close)(struct vm_area_struct *vma) +{ + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_vma_entry_t *pt, *prev; + drm_map_t *map; + drm_map_list_t *r_list; + struct list_head *list; + int found_maps = 0; + + DRM_DEBUG("0x%08lx,0x%08lx\n", + vma->vm_start, vma->vm_end - vma->vm_start); +#if LINUX_VERSION_CODE < 0x020333 + MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ +#endif + atomic_dec(&dev->vma_count); + +#if LINUX_VERSION_CODE >= 0x020300 + map = vma->vm_private_data; +#else + map = vma->vm_pte; +#endif + + down(&dev->struct_sem); + for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { +#if LINUX_VERSION_CODE >= 0x020300 + if (pt->vma->vm_private_data == map) found_maps++; +#else + if (pt->vma->vm_pte == map) found_maps++; +#endif + if (pt->vma == vma) { + if (prev) { + prev->next = pt->next; + } else { + dev->vmalist = pt->next; + } + DRM(free)(pt, sizeof(*pt), DRM_MEM_VMAS); + } + } + /* We were the only map that was found */ + if(found_maps == 1 && + map->flags & _DRM_REMOVABLE) { + /* Check to see if we are in the maplist, if we are not, then + * we delete this mappings information. + */ + found_maps = 0; + list = &dev->maplist->head; + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *) list; + if (r_list->map == map) found_maps++; + } + + if(!found_maps) { + switch (map->type) { + case _DRM_REGISTERS: + case _DRM_FRAME_BUFFER: +#if __REALLY_HAVE_MTRR + if (map->mtrr >= 0) { + int retcode; + retcode = mtrr_del(map->mtrr, + map->offset, + map->size); + DRM_DEBUG("mtrr_del = %d\n", retcode); + } +#endif + DRM(ioremapfree)(map->handle, map->size); + break; + case _DRM_SHM: + vfree(map->handle); + break; + case _DRM_AGP: + case _DRM_SCATTER_GATHER: + break; + } + DRM(free)(map, sizeof(*map), DRM_MEM_MAPS); + } + } + up(&dev->struct_sem); +} + +#if LINUX_VERSION_CODE < 0x020317 +unsigned long DRM(vm_dma_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#else + /* Return type changed in 2.3.23 */ +struct page *DRM(vm_dma_nopage)(struct vm_area_struct *vma, + unsigned long address, + int write_access) +#endif +{ + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + unsigned long physical; + unsigned long offset; + unsigned long page; + + if (!dma) return NOPAGE_SIGBUS; /* Error */ + if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ + if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */ + + offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ + page = offset >> PAGE_SHIFT; + physical = dma->pagelist[page] + (offset & (~PAGE_MASK)); + atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */ + + DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical); +#if LINUX_VERSION_CODE < 0x020317 + return physical; +#else + return virt_to_page(physical); +#endif +} + +#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; + drm_device_t *dev = priv->dev; + drm_vma_entry_t *vma_entry; + + DRM_DEBUG("0x%08lx,0x%08lx\n", + vma->vm_start, vma->vm_end - vma->vm_start); + atomic_inc(&dev->vma_count); +#if LINUX_VERSION_CODE < 0x020333 + /* The map can exist after the fd is closed. */ + MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ +#endif + + vma_entry = DRM(alloc)(sizeof(*vma_entry), DRM_MEM_VMAS); + if (vma_entry) { + down(&dev->struct_sem); + vma_entry->vma = vma; + vma_entry->next = dev->vmalist; + vma_entry->pid = current->pid; + dev->vmalist = vma_entry; + up(&dev->struct_sem); + } +} + +void DRM(vm_close)(struct vm_area_struct *vma) +{ + drm_file_t *priv = vma->vm_file->private_data; + drm_device_t *dev = priv->dev; + drm_vma_entry_t *pt, *prev; + + DRM_DEBUG("0x%08lx,0x%08lx\n", + vma->vm_start, vma->vm_end - vma->vm_start); +#if LINUX_VERSION_CODE < 0x020333 + MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ +#endif + atomic_dec(&dev->vma_count); + + down(&dev->struct_sem); + for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { + if (pt->vma == vma) { + if (prev) { + prev->next = pt->next; + } else { + dev->vmalist = pt->next; + } + DRM(free)(pt, sizeof(*pt), DRM_MEM_VMAS); + break; + } + } + up(&dev->struct_sem); +} + +int DRM(mmap_dma)(struct file *filp, struct vm_area_struct *vma) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev; + drm_device_dma_t *dma; + unsigned long length = vma->vm_end - vma->vm_start; + + lock_kernel(); + dev = priv->dev; + dma = dev->dma; + DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", + vma->vm_start, vma->vm_end, VM_OFFSET(vma)); + + /* Length must match exact page count */ + if (!dma || (length >> PAGE_SHIFT) != dma->page_count) { + unlock_kernel(); + return -EINVAL; + } + unlock_kernel(); + + vma->vm_ops = &drm_vm_dma_ops; + vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ + +#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */ + /* In Linux 2.2.3 and above, this is + handled in do_mmap() in mm/mmap.c. */ + ++filp->f_count; +#endif + vma->vm_file = filp; /* Needed for drm_vm_open() */ + DRM(vm_open)(vma); + return 0; +} + +int DRM(mmap)(struct file *filp, struct vm_area_struct *vma) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_map_t *map = NULL; + drm_map_list_t *r_list; + unsigned long offset = 0; + struct list_head *list; + + DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", + vma->vm_start, vma->vm_end, VM_OFFSET(vma)); + + if ( !priv->authenticated ) return -EACCES; + + if (!VM_OFFSET(vma)) return DRM(mmap_dma)(filp, vma); + + /* A sequential search of a linked list is + fine here because: 1) there will only be + about 5-10 entries in the list and, 2) a + DRI client only has to do this mapping + once, so it doesn't have to be optimized + for performance, even if the list was a + bit longer. */ + list_for_each(list, &dev->maplist->head) { + r_list = (drm_map_list_t *)list; + map = r_list->map; + if (!map) continue; + if (map->offset == VM_OFFSET(vma)) break; + } + + if (!map || ((map->flags&_DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN))) + return -EPERM; + + /* Check for valid size. */ + if (map->size != vma->vm_end - vma->vm_start) return -EINVAL; + + if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) { + vma->vm_flags &= VM_MAYWRITE; +#if defined(__i386__) + pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW; +#else + /* Ye gads this is ugly. With more thought + we could move this up higher and use + `protection_map' instead. */ + vma->vm_page_prot = __pgprot(pte_val(pte_wrprotect( + __pte(pgprot_val(vma->vm_page_prot))))); +#endif + } + + switch (map->type) { + case _DRM_FRAME_BUFFER: + case _DRM_REGISTERS: + case _DRM_AGP: + if (VM_OFFSET(vma) >= __pa(high_memory)) { +#if defined(__i386__) + if (boot_cpu_data.x86 > 3 && map->type != _DRM_AGP) { + pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; + pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT; + } +#elif defined(__ia64__) + if (map->type != _DRM_AGP) + vma->vm_page_prot = + pgprot_writecombine(vma->vm_page_prot); +#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) + 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) + offset); + vma->vm_ops = &drm_vm_ops; + break; + case _DRM_SHM: + vma->vm_ops = &drm_vm_shm_ops; +#if LINUX_VERSION_CODE >= 0x020300 + vma->vm_private_data = (void *)map; +#else + vma->vm_pte = (unsigned long)map; +#endif + /* Don't let this area swap. Change when + DRM_KERNEL advisory is supported. */ + vma->vm_flags |= VM_LOCKED; + break; + 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. */ + } + vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ + +#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */ + /* In Linux 2.2.3 and above, this is + handled in do_mmap() in mm/mmap.c. */ + ++filp->f_count; +#endif + vma->vm_file = filp; /* Needed for drm_vm_open() */ + DRM(vm_open)(vma); + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c:1.11 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c:1.11 Tue Sep 26 12:21:23 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/fops.c Mon Jun 4 12:41:26 2001 @@ -1,250 +0,0 @@ -/* fops.c -- File operations for DRM -*- linux-c -*- - * Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Daryll Strauss <daryll@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" -#include <linux/poll.h> - -/* drm_open is called whenever a process opens /dev/drm. */ - -int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev) -{ - kdev_t minor = MINOR(inode->i_rdev); - drm_file_t *priv; - - if (filp->f_flags & O_EXCL) return -EBUSY; /* No exclusive opens */ - if (!drm_cpu_valid()) return -EINVAL; - - DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor); - - priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES); - memset(priv, 0, sizeof(*priv)); - filp->private_data = priv; - priv->uid = current->euid; - priv->pid = current->pid; - priv->minor = minor; - priv->dev = dev; - priv->ioctl_count = 0; - priv->authenticated = capable(CAP_SYS_ADMIN); - - down(&dev->struct_sem); - if (!dev->file_last) { - priv->next = NULL; - priv->prev = NULL; - dev->file_first = priv; - dev->file_last = priv; - } else { - priv->next = NULL; - priv->prev = dev->file_last; - dev->file_last->next = priv; - dev->file_last = priv; - } - up(&dev->struct_sem); - - return 0; -} - -int drm_flush(struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - - DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n", - current->pid, dev->device, dev->open_count); - return 0; -} - -/* drm_release is called whenever a process closes /dev/drm*. Linux calls - this only if any mappings have been closed. */ - -int drm_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - - DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n", - current->pid, dev->device, dev->open_count); - - if (dev->lock.hw_lock - && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) - && dev->lock.pid == current->pid) { - DRM_ERROR("Process %d dead, freeing lock for context %d\n", - current->pid, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - drm_lock_free(dev, - &dev->lock.hw_lock->lock, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - - /* FIXME: may require heavy-handed reset of - hardware at this point, possibly - processed via a callback to the X - server. */ - } - drm_reclaim_buffers(dev, priv->pid); - - drm_fasync(-1, filp, 0); - - down(&dev->struct_sem); - if (priv->prev) priv->prev->next = priv->next; - else dev->file_first = priv->next; - if (priv->next) priv->next->prev = priv->prev; - else dev->file_last = priv->prev; - up(&dev->struct_sem); - - drm_free(priv, sizeof(*priv), DRM_MEM_FILES); - - return 0; -} - -int drm_fasync(int fd, struct file *filp, int on) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int retcode; - - DRM_DEBUG("fd = %d, device = 0x%x\n", fd, dev->device); - retcode = fasync_helper(fd, filp, on, &dev->buf_async); - if (retcode < 0) return retcode; - return 0; -} - - -/* The drm_read and drm_write_string code (especially that which manages - the circular buffer), is based on Alessandro Rubini's LINUX DEVICE - DRIVERS (Cambridge: O'Reilly, 1998), pages 111-113. */ - -ssize_t drm_read(struct file *filp, char *buf, size_t count, loff_t *off) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int left; - int avail; - int send; - int cur; - - DRM_DEBUG("%p, %p\n", dev->buf_rp, dev->buf_wp); - - while (dev->buf_rp == dev->buf_wp) { - DRM_DEBUG(" sleeping\n"); - if (filp->f_flags & O_NONBLOCK) { - return -EAGAIN; - } - interruptible_sleep_on(&dev->buf_readers); - if (signal_pending(current)) { - DRM_DEBUG(" interrupted\n"); - return -ERESTARTSYS; - } - DRM_DEBUG(" awake\n"); - } - - left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; - avail = DRM_BSZ - left; - send = DRM_MIN(avail, count); - - while (send) { - if (dev->buf_wp > dev->buf_rp) { - cur = DRM_MIN(send, dev->buf_wp - dev->buf_rp); - } else { - cur = DRM_MIN(send, dev->buf_end - dev->buf_rp); - } - if (copy_to_user(buf, dev->buf_rp, cur)) - return -EFAULT; - dev->buf_rp += cur; - if (dev->buf_rp == dev->buf_end) dev->buf_rp = dev->buf; - send -= cur; - } - - wake_up_interruptible(&dev->buf_writers); - return DRM_MIN(avail, count);; -} - -int drm_write_string(drm_device_t *dev, const char *s) -{ - int left = (dev->buf_rp + DRM_BSZ - dev->buf_wp) % DRM_BSZ; - int send = strlen(s); - int count; - - DRM_DEBUG("%d left, %d to send (%p, %p)\n", - left, send, dev->buf_rp, dev->buf_wp); - - if (left == 1 || dev->buf_wp != dev->buf_rp) { - DRM_ERROR("Buffer not empty (%d left, wp = %p, rp = %p)\n", - left, - dev->buf_wp, - dev->buf_rp); - } - - while (send) { - if (dev->buf_wp >= dev->buf_rp) { - count = DRM_MIN(send, dev->buf_end - dev->buf_wp); - if (count == left) --count; /* Leave a hole */ - } else { - count = DRM_MIN(send, dev->buf_rp - dev->buf_wp - 1); - } - strncpy(dev->buf_wp, s, count); - dev->buf_wp += count; - if (dev->buf_wp == dev->buf_end) dev->buf_wp = dev->buf; - send -= count; - } - -#if LINUX_VERSION_CODE < 0x020315 && !defined(KILLFASYNCHASTHREEPARAMETERS) - /* The extra parameter to kill_fasync was added in 2.3.21, and is - _not_ present in _stock_ 2.2.14 and 2.2.15. However, some - distributions patch 2.2.x kernels to add this parameter. The - Makefile.linux attempts to detect this addition and defines - KILLFASYNCHASTHREEPARAMETERS if three parameters are found. */ - if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO); -#else - - /* Parameter added in 2.3.21. */ -#if LINUX_VERSION_CODE < 0x020400 - if (dev->buf_async) kill_fasync(dev->buf_async, SIGIO, POLL_IN); -#else - /* Type of first parameter changed in - Linux 2.4.0-test2... */ - if (dev->buf_async) kill_fasync(&dev->buf_async, SIGIO, POLL_IN); -#endif -#endif - DRM_DEBUG("waking\n"); - wake_up_interruptible(&dev->buf_readers); - return 0; -} - -unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - - poll_wait(filp, &dev->buf_readers, wait); - if (dev->buf_wp != dev->buf_rp) return POLLIN | POLLRDNORM; - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma.h Wed Mar 21 13:08:55 2001 @@ -0,0 +1,93 @@ +/* gamma.c -- 3dlabs GMX 2000 driver -*- linux-c -*- + * Created: Mon Jan 4 08:58:31 1999 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __GAMMA_H__ +#define __GAMMA_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) gamma_##x + +/* General customization: + */ +#define __HAVE_MTRR 1 + +/* DMA customization: + */ +#define __HAVE_DMA 1 +#define __HAVE_OLD_DMA 1 +#define __HAVE_PCI_DMA 1 + +#define __HAVE_MULTIPLE_DMA_QUEUES 1 +#define __HAVE_DMA_WAITQUEUE 1 + +#define __HAVE_DMA_WAITLIST 1 +#define __HAVE_DMA_FREELIST 1 + +#define __HAVE_DMA_FLUSH 1 +#define __HAVE_DMA_SCHEDULE 1 + +#define __HAVE_DMA_READY 1 +#define DRIVER_DMA_READY() do { \ + gamma_dma_ready(dev); \ +} while (0) + +#define __HAVE_DMA_QUIESCENT 1 +#define DRIVER_DMA_QUIESCENT() do { \ + /* FIXME ! */ \ + gamma_dma_quiescent_dual(dev); \ + return 0; \ +} while (0) + +#define __HAVE_DMA_IRQ 1 +#define __HAVE_DMA_IRQ_BH 1 +#define DRIVER_PREINSTALL() do { \ + drm_gamma_private_t *dev_priv = \ + (drm_gamma_private_t *)dev->dev_private;\ + GAMMA_WRITE( GAMMA_GCOMMANDMODE, 0x00000000 ); \ + GAMMA_WRITE( GAMMA_GDMACONTROL, 0x00000000 ); \ +} while (0) + +#define DRIVER_POSTINSTALL() do { \ + drm_gamma_private_t *dev_priv = \ + (drm_gamma_private_t *)dev->dev_private;\ + GAMMA_WRITE( GAMMA_GINTENABLE, 0x00002001 ); \ + GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000008 ); \ + GAMMA_WRITE( GAMMA_GDELAYTIMER, 0x00039090 ); \ +} while (0) + +#define DRIVER_UNINSTALL() do { \ + drm_gamma_private_t *dev_priv = \ + (drm_gamma_private_t *)dev->dev_private;\ + GAMMA_WRITE( GAMMA_GDELAYTIMER, 0x00000000 ); \ + GAMMA_WRITE( GAMMA_COMMANDINTENABLE, 0x00000000 ); \ + GAMMA_WRITE( GAMMA_GINTENABLE, 0x00000000 ); \ +} while (0) + +#endif /* __GAMMA_H__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c:1.8 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c:1.11 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c:1.8 Wed Nov 8 00:03:06 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_dma.c Fri May 18 20:26:46 2001 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -23,73 +23,38 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> * */ #define __NO_VERSION__ +#include "gamma.h" #include "drmP.h" #include "gamma_drv.h" #include <linux/interrupt.h> /* For task queue support */ +#include <linux/delay.h> -/* WARNING!!! MAGIC NUMBER!!! The number of regions already added to the - kernel must be specified here. Currently, the number is 2. This must - match the order the X server uses for instantiating register regions , - or must be passed in a new ioctl. */ -#define GAMMA_REG(reg) \ - (2 \ - + ((reg < 0x1000) \ - ? 0 \ - : ((reg < 0x10000) ? 1 : ((reg < 0x11000) ? 2 : 3)))) - -#define GAMMA_OFF(reg) \ - ((reg < 0x1000) \ - ? reg \ - : ((reg < 0x10000) \ - ? (reg - 0x1000) \ - : ((reg < 0x11000) \ - ? (reg - 0x10000) \ - : (reg - 0x11000)))) - -#define GAMMA_BASE(reg) ((unsigned long)dev->maplist[GAMMA_REG(reg)]->handle) -#define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg)) -#define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg) -#define GAMMA_READ(reg) GAMMA_DEREF(reg) -#define GAMMA_WRITE(reg,val) do { GAMMA_DEREF(reg) = val; } while (0) - -#define GAMMA_BROADCASTMASK 0x9378 -#define GAMMA_COMMANDINTENABLE 0x0c48 -#define GAMMA_DMAADDRESS 0x0028 -#define GAMMA_DMACOUNT 0x0030 -#define GAMMA_FILTERMODE 0x8c00 -#define GAMMA_GCOMMANDINTFLAGS 0x0c50 -#define GAMMA_GCOMMANDMODE 0x0c40 -#define GAMMA_GCOMMANDSTATUS 0x0c60 -#define GAMMA_GDELAYTIMER 0x0c38 -#define GAMMA_GDMACONTROL 0x0060 -#define GAMMA_GINTENABLE 0x0808 -#define GAMMA_GINTFLAGS 0x0810 -#define GAMMA_INFIFOSPACE 0x0018 -#define GAMMA_OUTFIFOWORDS 0x0020 -#define GAMMA_OUTPUTFIFO 0x2000 -#define GAMMA_SYNC 0x8c40 -#define GAMMA_SYNC_TAG 0x0188 - static inline void gamma_dma_dispatch(drm_device_t *dev, unsigned long address, unsigned long length) { + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + GAMMA_WRITE(GAMMA_DMAADDRESS, virt_to_phys((void *)address)); while (GAMMA_READ(GAMMA_GCOMMANDSTATUS) != 4) ; GAMMA_WRITE(GAMMA_DMACOUNT, length / 4); } -static inline void gamma_dma_quiescent_single(drm_device_t *dev) +void gamma_dma_quiescent_single(drm_device_t *dev) { + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + while (GAMMA_READ(GAMMA_DMACOUNT)) ; while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3) @@ -97,15 +62,18 @@ GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10); GAMMA_WRITE(GAMMA_SYNC, 0); - + do { while (!GAMMA_READ(GAMMA_OUTFIFOWORDS)) ; } while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG); } -static inline void gamma_dma_quiescent_dual(drm_device_t *dev) +void gamma_dma_quiescent_dual(drm_device_t *dev) { + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + while (GAMMA_READ(GAMMA_DMACOUNT)) ; while (GAMMA_READ(GAMMA_INFIFOSPACE) < 3) @@ -115,13 +83,13 @@ GAMMA_WRITE(GAMMA_FILTERMODE, 1 << 10); GAMMA_WRITE(GAMMA_SYNC, 0); - + /* Read from first MX */ do { while (!GAMMA_READ(GAMMA_OUTFIFOWORDS)) ; } while (GAMMA_READ(GAMMA_OUTPUTFIFO) != GAMMA_SYNC_TAG); - + /* Read from second MX */ do { while (!GAMMA_READ(GAMMA_OUTFIFOWORDS + 0x10000)) @@ -129,34 +97,39 @@ } while (GAMMA_READ(GAMMA_OUTPUTFIFO + 0x10000) != GAMMA_SYNC_TAG); } -static inline void gamma_dma_ready(drm_device_t *dev) +void gamma_dma_ready(drm_device_t *dev) { + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + while (GAMMA_READ(GAMMA_DMACOUNT)) ; } static inline int gamma_dma_is_ready(drm_device_t *dev) { + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + return !GAMMA_READ(GAMMA_DMACOUNT); } -static void gamma_dma_service(int irq, void *device, struct pt_regs *regs) +void gamma_dma_service(int irq, void *device, struct pt_regs *regs) { - drm_device_t *dev = (drm_device_t *)device; - drm_device_dma_t *dma = dev->dma; - - atomic_inc(&dev->total_irq); + drm_device_t *dev = (drm_device_t *)device; + drm_device_dma_t *dma = dev->dma; + drm_gamma_private_t *dev_priv = + (drm_gamma_private_t *)dev->dev_private; + + atomic_inc(&dev->counts[6]); /* _DRM_STAT_IRQ */ GAMMA_WRITE(GAMMA_GDELAYTIMER, 0xc350/2); /* 0x05S */ GAMMA_WRITE(GAMMA_GCOMMANDINTFLAGS, 8); GAMMA_WRITE(GAMMA_GINTFLAGS, 0x2001); if (gamma_dma_is_ready(dev)) { /* Free previous buffer */ - if (test_and_set_bit(0, &dev->dma_flag)) { - atomic_inc(&dma->total_missed_free); - return; - } + if (test_and_set_bit(0, &dev->dma_flag)) return; if (dma->this_buffer) { - drm_free_buffer(dev, dma->this_buffer); + gamma_free_buffer(dev, dma->this_buffer); dma->this_buffer = NULL; } clear_bit(0, &dev->dma_flag); @@ -179,11 +152,8 @@ cycles_t dma_start, dma_stop; #endif - if (test_and_set_bit(0, &dev->dma_flag)) { - atomic_inc(&dma->total_missed_dma); - return -EBUSY; - } - + if (test_and_set_bit(0, &dev->dma_flag)) return -EBUSY; + #if DRM_DMA_HISTOGRAM dma_start = get_cycles(); #endif @@ -202,20 +172,20 @@ buf->context, buf->idx, length); if (buf->list == DRM_LIST_RECLAIM) { - drm_clear_next_buffer(dev); - drm_free_buffer(dev, buf); + gamma_clear_next_buffer(dev); + gamma_free_buffer(dev, buf); clear_bit(0, &dev->dma_flag); return -EINVAL; } if (!length) { DRM_ERROR("0 length buffer\n"); - drm_clear_next_buffer(dev); - drm_free_buffer(dev, buf); + gamma_clear_next_buffer(dev); + gamma_free_buffer(dev, buf); clear_bit(0, &dev->dma_flag); return 0; } - + if (!gamma_dma_is_ready(dev)) { clear_bit(0, &dev->dma_flag); return -EBUSY; @@ -228,9 +198,8 @@ buf->idx, buf->pid); } } else { - if (!locked && !drm_lock_take(&dev->lock.hw_lock->lock, + if (!locked && !gamma_lock_take(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { - atomic_inc(&dma->total_missed_lock); clear_bit(0, &dev->dma_flag); return -EBUSY; } @@ -240,13 +209,14 @@ && !(dev->queuelist[buf->context]->flags & _DRM_CONTEXT_PRESERVED)) { /* PRE: dev->last_context != buf->context */ - if (drm_context_switch(dev, dev->last_context, buf->context)) { - drm_clear_next_buffer(dev); - drm_free_buffer(dev, buf); + if (DRM(context_switch)(dev, dev->last_context, + buf->context)) { + DRM(clear_next_buffer)(dev); + DRM(free_buffer)(dev, buf); } retcode = -EBUSY; goto cleanup; - + /* POST: we will wait for the context switch and will dispatch on a later call when dev->last_context == buf->context. @@ -254,7 +224,7 @@ TIME! */ } - drm_clear_next_buffer(dev); + gamma_clear_next_buffer(dev); buf->pending = 1; buf->waiting = 0; buf->list = DRM_LIST_PEND; @@ -263,14 +233,14 @@ #endif gamma_dma_dispatch(dev, address, length); - drm_free_buffer(dev, dma->this_buffer); + gamma_free_buffer(dev, dma->this_buffer); dma->this_buffer = buf; - atomic_add(length, &dma->total_bytes); - atomic_inc(&dma->total_dmas); + atomic_inc(&dev->counts[7]); /* _DRM_STAT_DMA */ + atomic_add(length, &dev->counts[8]); /* _DRM_STAT_PRIMARY */ if (!buf->while_locked && !dev->context_flag && !locked) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, + if (gamma_lock_free(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { DRM_ERROR("\n"); } @@ -281,18 +251,18 @@ #if DRM_DMA_HISTOGRAM dma_stop = get_cycles(); - atomic_inc(&dev->histo.dma[drm_histogram_slot(dma_stop - dma_start)]); + atomic_inc(&dev->histo.dma[gamma_histogram_slot(dma_stop - dma_start)]); #endif return retcode; } -static void gamma_dma_schedule_timer_wrapper(unsigned long dev) +static void gamma_dma_timer_bh(unsigned long dev) { gamma_dma_schedule((drm_device_t *)dev, 0); } -static void gamma_dma_schedule_tq_wrapper(void *dev) +void gamma_dma_immediate_bh(void *dev) { gamma_dma_schedule(dev, 0); } @@ -313,10 +283,10 @@ if (test_and_set_bit(0, &dev->interrupt_flag)) { /* Not reentrant */ - atomic_inc(&dma->total_missed_sched); + atomic_inc(&dev->counts[10]); /* _DRM_STAT_MISSED */ return -EBUSY; } - missed = atomic_read(&dma->total_missed_sched); + missed = atomic_read(&dev->counts[10]); #if DRM_DMA_HISTOGRAM schedule_start = get_cycles(); @@ -333,23 +303,18 @@ because the lock could not be obtained or the DMA engine wasn't ready. Try again. */ - atomic_inc(&dma->total_tried); - if (!(retcode = gamma_do_dma(dev, locked))) { - atomic_inc(&dma->total_hit); - ++processed; - } + if (!(retcode = gamma_do_dma(dev, locked))) ++processed; } else { do { - next = drm_select_queue(dev, - gamma_dma_schedule_timer_wrapper); + next = gamma_select_queue(dev, gamma_dma_timer_bh); if (next >= 0) { q = dev->queuelist[next]; - buf = drm_waitlist_get(&q->waitlist); + buf = gamma_waitlist_get(&q->waitlist); dma->next_buffer = buf; dma->next_queue = q; if (buf && buf->list == DRM_LIST_RECLAIM) { - drm_clear_next_buffer(dev); - drm_free_buffer(dev, buf); + gamma_clear_next_buffer(dev); + gamma_free_buffer(dev, buf); } } } while (next >= 0 && !dma->next_buffer); @@ -361,21 +326,19 @@ } if (--expire) { - if (missed != atomic_read(&dma->total_missed_sched)) { - atomic_inc(&dma->total_lost); + if (missed != atomic_read(&dev->counts[10])) { if (gamma_dma_is_ready(dev)) goto again; } if (processed && gamma_dma_is_ready(dev)) { - atomic_inc(&dma->total_lost); processed = 0; goto again; } } - + clear_bit(0, &dev->interrupt_flag); - + #if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.schedule[drm_histogram_slot(get_cycles() + atomic_inc(&dev->histo.schedule[gamma_histogram_slot(get_cycles() - schedule_start)]); #endif return retcode; @@ -400,7 +363,7 @@ if (signal_pending(current)) return -EINTR; } if (!(d->flags & _DRM_DMA_WHILE_LOCKED)) { - while (!drm_lock_take(&dev->lock.hw_lock->lock, + while (!gamma_lock_take(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { schedule(); if (signal_pending(current)) { @@ -410,7 +373,6 @@ } ++must_free; } - atomic_inc(&dma->total_prio); for (i = 0; i < d->send_count; i++) { idx = d->send_indices[i]; @@ -461,15 +423,15 @@ goto cleanup; } buf->pending = 1; - + if (dev->last_context != buf->context && !(dev->queuelist[buf->context]->flags & _DRM_CONTEXT_PRESERVED)) { add_wait_queue(&dev->context_wait, &entry); current->state = TASK_INTERRUPTIBLE; /* PRE: dev->last_context != buf->context */ - drm_context_switch(dev, dev->last_context, - buf->context); + DRM(context_switch)(dev, dev->last_context, + buf->context); /* POST: we will wait for the context switch and will dispatch on a later call when dev->last_context == buf->context. @@ -494,11 +456,11 @@ buf->time_dispatched = buf->time_queued; #endif gamma_dma_dispatch(dev, address, length); - atomic_add(length, &dma->total_bytes); - atomic_inc(&dma->total_dmas); - + atomic_inc(&dev->counts[9]); /* _DRM_STAT_SPECIAL */ + atomic_add(length, &dev->counts[8]); /* _DRM_STAT_PRIMARY */ + if (last_buf) { - drm_free_buffer(dev, last_buf); + gamma_free_buffer(dev, last_buf); } last_buf = buf; } @@ -507,11 +469,11 @@ cleanup: if (last_buf) { gamma_dma_ready(dev); - drm_free_buffer(dev, last_buf); + gamma_free_buffer(dev, last_buf); } - + if (must_free && !dev->context_flag) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, + if (gamma_lock_free(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { DRM_ERROR("\n"); } @@ -531,15 +493,15 @@ last_buf = dma->buflist[d->send_indices[d->send_count-1]]; add_wait_queue(&last_buf->dma_wait, &entry); } - - if ((retcode = drm_dma_enqueue(dev, d))) { + + if ((retcode = gamma_dma_enqueue(dev, d))) { if (d->flags & _DRM_DMA_BLOCK) remove_wait_queue(&last_buf->dma_wait, &entry); return retcode; } - + gamma_dma_schedule(dev, 0); - + if (d->flags & _DRM_DMA_BLOCK) { DRM_DEBUG("%d waiting\n", current->pid); for (;;) { @@ -558,7 +520,7 @@ if (!retcode || (last_buf->list==DRM_LIST_PEND && !last_buf->pending)) { if (!waitqueue_active(&last_buf->dma_wait)) { - drm_free_buffer(dev, last_buf); + gamma_free_buffer(dev, last_buf); } } if (retcode) { @@ -587,19 +549,13 @@ if (copy_from_user(&d, (drm_dma_t *)arg, sizeof(d))) return -EFAULT; - DRM_DEBUG("%d %d: %d send, %d req\n", - current->pid, d.context, d.send_count, d.request_count); - if (d.context == DRM_KERNEL_CONTEXT || d.context >= dev->queue_slots) { - DRM_ERROR("Process %d using context %d\n", - current->pid, d.context); - return -EINVAL; - } if (d.send_count < 0 || d.send_count > dma->buf_count) { DRM_ERROR("Process %d trying to send %d buffers (of %d max)\n", current->pid, d.send_count, dma->buf_count); return -EINVAL; } + if (d.request_count < 0 || d.request_count > dma->buf_count) { DRM_ERROR("Process %d trying to get %d buffers (of %d max)\n", current->pid, d.request_count, dma->buf_count); @@ -609,14 +565,14 @@ if (d.send_count) { if (d.flags & _DRM_DMA_PRIORITY) retcode = gamma_dma_priority(dev, &d); - else + else retcode = gamma_dma_send_buffers(dev, &d); } d.granted_count = 0; if (!retcode && d.request_count) { - retcode = drm_dma_get_buffers(dev, &d); + retcode = gamma_dma_get_buffers(dev, &d); } DRM_DEBUG("%d returning, granted = %d\n", @@ -625,212 +581,4 @@ return -EFAULT; return retcode; -} - -int gamma_irq_install(drm_device_t *dev, int irq) -{ - int retcode; - - if (!irq) return -EINVAL; - - down(&dev->struct_sem); - if (dev->irq) { - up(&dev->struct_sem); - return -EBUSY; - } - dev->irq = irq; - up(&dev->struct_sem); - - DRM_DEBUG("%d\n", irq); - - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; - - dev->dma->next_buffer = NULL; - dev->dma->next_queue = NULL; - dev->dma->this_buffer = NULL; - - dev->tq.next = NULL; - dev->tq.sync = 0; - dev->tq.routine = gamma_dma_schedule_tq_wrapper; - dev->tq.data = dev; - - - /* Before installing handler */ - GAMMA_WRITE(GAMMA_GCOMMANDMODE, 0); - GAMMA_WRITE(GAMMA_GDMACONTROL, 0); - - /* Install handler */ - if ((retcode = request_irq(dev->irq, - gamma_dma_service, - 0, - dev->devname, - dev))) { - down(&dev->struct_sem); - dev->irq = 0; - up(&dev->struct_sem); - return retcode; - } - - /* After installing handler */ - GAMMA_WRITE(GAMMA_GINTENABLE, 0x2001); - GAMMA_WRITE(GAMMA_COMMANDINTENABLE, 0x0008); - GAMMA_WRITE(GAMMA_GDELAYTIMER, 0x39090); - - return 0; -} - -int gamma_irq_uninstall(drm_device_t *dev) -{ - int irq; - - down(&dev->struct_sem); - irq = dev->irq; - dev->irq = 0; - up(&dev->struct_sem); - - if (!irq) return -EINVAL; - - DRM_DEBUG("%d\n", irq); - - GAMMA_WRITE(GAMMA_GDELAYTIMER, 0); - GAMMA_WRITE(GAMMA_COMMANDINTENABLE, 0); - GAMMA_WRITE(GAMMA_GINTENABLE, 0); - free_irq(irq, dev); - - return 0; -} - - -int gamma_control(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_control_t ctl; - int retcode; - - if (copy_from_user(&ctl, (drm_control_t *)arg, sizeof(ctl))) - return -EFAULT; - - switch (ctl.func) { - case DRM_INST_HANDLER: - if ((retcode = gamma_irq_install(dev, ctl.irq))) - return retcode; - break; - case DRM_UNINST_HANDLER: - if ((retcode = gamma_irq_uninstall(dev))) - return retcode; - break; - default: - return -EINVAL; - } - return 0; -} - -int gamma_lock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - DECLARE_WAITQUEUE(entry, current); - int ret = 0; - drm_lock_t lock; - drm_queue_t *q; -#if DRM_DMA_HISTOGRAM - cycles_t start; - - dev->lck_start = start = get_cycles(); -#endif - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } - - DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", - lock.context, current->pid, dev->lock.hw_lock->lock, - lock.flags); - - if (lock.context < 0 || lock.context >= dev->queue_count) - return -EINVAL; - q = dev->queuelist[lock.context]; - - ret = drm_flush_block_and_flush(dev, lock.context, lock.flags); - - if (!ret) { - if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) - != lock.context) { - long j = jiffies - dev->lock.lock_time; - - if (j > 0 && j <= DRM_LOCK_SLICE) { - /* Can't take lock if we just had it and - there is contention. */ - current->state = TASK_INTERRUPTIBLE; - schedule_timeout(j); - } - } - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - ret = -EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - lock.context)) { - dev->lock.pid = current->pid; - dev->lock.lock_time = jiffies; - atomic_inc(&dev->total_locks); - atomic_inc(&q->total_locks); - break; /* Got lock */ - } - - /* Contention */ - atomic_inc(&dev->total_sleeps); - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - } - - drm_flush_unblock(dev, lock.context, lock.flags); /* cleanup phase */ - - if (!ret) { - sigemptyset(&dev->sigmask); - sigaddset(&dev->sigmask, SIGSTOP); - sigaddset(&dev->sigmask, SIGTSTP); - sigaddset(&dev->sigmask, SIGTTIN); - sigaddset(&dev->sigmask, SIGTTOU); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); - - if (lock.flags & _DRM_LOCK_READY) - gamma_dma_ready(dev); - if (lock.flags & _DRM_LOCK_QUIESCENT) { - if (gamma_found() == 1) { - gamma_dma_quiescent_single(dev); - } else { - gamma_dma_quiescent_dual(dev); - } - } - } - DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); - -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]); -#endif - - return ret; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c:1.11 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c:1.11 Fri Dec 1 09:29:01 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.c Wed Mar 21 13:08:55 2001 @@ -26,546 +26,48 @@ * * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> - * + * Gareth Hughes <gareth@valinux.com> */ #include <linux/config.h> +#include "gamma.h" #include "drmP.h" #include "gamma_drv.h" -#ifndef PCI_DEVICE_ID_3DLABS_GAMMA -#define PCI_DEVICE_ID_3DLABS_GAMMA 0x0008 -#endif -#ifndef PCI_DEVICE_ID_3DLABS_MX -#define PCI_DEVICE_ID_3DLABS_MX 0x0006 -#endif +#define DRIVER_AUTHOR "VA Linux Systems Inc." -#define GAMMA_NAME "gamma" -#define GAMMA_DESC "3dlabs GMX 2000" -#define GAMMA_DATE "20000910" -#define GAMMA_MAJOR 1 -#define GAMMA_MINOR 0 -#define GAMMA_PATCHLEVEL 0 - -static drm_device_t gamma_device; - -static struct file_operations gamma_fops = { -#if LINUX_VERSION_CODE >= 0x020400 - /* This started being used during 2.4.0-test */ - owner: THIS_MODULE, -#endif - open: gamma_open, - flush: drm_flush, - release: gamma_release, - ioctl: gamma_ioctl, - mmap: drm_mmap, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, -}; - -static struct miscdevice gamma_misc = { - minor: MISC_DYNAMIC_MINOR, - name: GAMMA_NAME, - fops: &gamma_fops, -}; - -static drm_ioctl_desc_t gamma_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { gamma_version, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_busid, 0, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { gamma_control, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { drm_addbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { drm_markbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { drm_mapbufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_freebufs, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { drm_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { drm_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { drm_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { drm_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { drm_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { drm_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { drm_resctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { gamma_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { gamma_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, -}; -#define GAMMA_IOCTL_COUNT DRM_ARRAY_SIZE(gamma_ioctls) - -#ifdef MODULE -static char *gamma = NULL; -#endif -static int devices = 0; - -MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("3dlabs GMX 2000"); -MODULE_PARM(gamma, "s"); -MODULE_PARM(devices, "i"); -MODULE_PARM_DESC(devices, - "devices=x, where x is the number of MX chips on card\n"); -#ifndef MODULE -/* gamma_options is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_options. - */ - - -static int __init gamma_options(char *str) -{ - drm_parse_options(str); - return 1; -} - -__setup("gamma=", gamma_options); -#endif - -static int gamma_setup(drm_device_t *dev) -{ - int i; - - atomic_set(&dev->ioctl_count, 0); - atomic_set(&dev->vma_count, 0); - dev->buf_use = 0; - atomic_set(&dev->buf_alloc, 0); - - drm_dma_setup(dev); - - atomic_set(&dev->total_open, 0); - atomic_set(&dev->total_close, 0); - atomic_set(&dev->total_ioctl, 0); - atomic_set(&dev->total_irq, 0); - atomic_set(&dev->total_ctx, 0); - atomic_set(&dev->total_locks, 0); - atomic_set(&dev->total_unlocks, 0); - atomic_set(&dev->total_contends, 0); - atomic_set(&dev->total_sleeps, 0); - - for (i = 0; i < DRM_HASH_SIZE; i++) { - dev->magiclist[i].head = NULL; - dev->magiclist[i].tail = NULL; - } - dev->maplist = NULL; - dev->map_count = 0; - dev->vmalist = NULL; - dev->lock.hw_lock = NULL; - init_waitqueue_head(&dev->lock.lock_queue); - dev->queue_count = 0; - dev->queue_reserved = 0; - dev->queue_slots = 0; - dev->queuelist = NULL; - dev->irq = 0; - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; - dev->last_context = 0; - dev->last_switch = 0; - dev->last_checked = 0; - init_timer(&dev->timer); - init_waitqueue_head(&dev->context_wait); -#if DRM_DMA_HISTO - memset(&dev->histo, 0, sizeof(dev->histo)); -#endif - dev->ctx_start = 0; - dev->lck_start = 0; - - dev->buf_rp = dev->buf; - dev->buf_wp = dev->buf; - dev->buf_end = dev->buf + DRM_BSZ; - dev->buf_async = NULL; - init_waitqueue_head(&dev->buf_readers); - init_waitqueue_head(&dev->buf_writers); - - DRM_DEBUG("\n"); - - /* The kernel's context could be created here, but is now created - in drm_dma_enqueue. This is more resource-efficient for - hardware that does not do DMA, but may mean that - drm_select_queue fails between the time the interrupt is - initialized and the time the queues are initialized. */ - - return 0; -} - - -static int gamma_takedown(drm_device_t *dev) -{ - int i; - drm_magic_entry_t *pt, *next; - drm_map_t *map; - drm_vma_entry_t *vma, *vma_next; - - DRM_DEBUG("\n"); - - if (dev->irq) gamma_irq_uninstall(dev); - - down(&dev->struct_sem); - del_timer(&dev->timer); - - if (dev->devname) { - drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); - dev->devname = NULL; - } - - if (dev->unique) { - drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); - dev->unique = NULL; - dev->unique_len = 0; - } - /* Clear pid list */ - for (i = 0; i < DRM_HASH_SIZE; i++) { - for (pt = dev->magiclist[i].head; pt; pt = next) { - next = pt->next; - drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); - } - dev->magiclist[i].head = dev->magiclist[i].tail = NULL; - } - - /* Clear vma list (only built for debugging) */ - if (dev->vmalist) { - for (vma = dev->vmalist; vma; vma = vma_next) { - vma_next = vma->next; - drm_free(vma, sizeof(*vma), DRM_MEM_VMAS); - } - dev->vmalist = NULL; - } - - /* Clear map area and mtrr information */ - if (dev->maplist) { - for (i = 0; i < dev->map_count; i++) { - map = dev->maplist[i]; - switch (map->type) { - case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: -#ifdef CONFIG_MTRR - if (map->mtrr >= 0) { - int retcode; - retcode = mtrr_del(map->mtrr, - map->offset, - map->size); - DRM_DEBUG("mtrr_del = %d\n", retcode); - } -#endif - drm_ioremapfree(map->handle, map->size); - break; - case _DRM_SHM: - drm_free_pages((unsigned long)map->handle, - drm_order(map->size) - - PAGE_SHIFT, - DRM_MEM_SAREA); - break; - case _DRM_AGP: - /* Do nothing here, because this is all - handled in the AGP/GART driver. */ - break; - } - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - } - drm_free(dev->maplist, - dev->map_count * sizeof(*dev->maplist), - DRM_MEM_MAPS); - dev->maplist = NULL; - dev->map_count = 0; - } - - if (dev->queuelist) { - for (i = 0; i < dev->queue_count; i++) { - drm_waitlist_destroy(&dev->queuelist[i]->waitlist); - if (dev->queuelist[i]) { - drm_free(dev->queuelist[i], - sizeof(*dev->queuelist[0]), - DRM_MEM_QUEUES); - dev->queuelist[i] = NULL; - } - } - drm_free(dev->queuelist, - dev->queue_slots * sizeof(*dev->queuelist), - DRM_MEM_QUEUES); - dev->queuelist = NULL; - } - - drm_dma_takedown(dev); - - dev->queue_count = 0; - if (dev->lock.hw_lock) { - dev->lock.hw_lock = NULL; /* SHM removed */ - dev->lock.pid = 0; - wake_up_interruptible(&dev->lock.lock_queue); - } - up(&dev->struct_sem); - - return 0; -} - -int gamma_found(void) -{ - return devices; -} - -int gamma_find_devices(void) -{ - struct pci_dev *d = NULL, *one = NULL, *two = NULL; - - d = pci_find_device(PCI_VENDOR_ID_3DLABS,PCI_DEVICE_ID_3DLABS_GAMMA,d); - if (!d) return 0; - - one = pci_find_device(PCI_VENDOR_ID_3DLABS,PCI_DEVICE_ID_3DLABS_MX,d); - if (!one) return 0; - - /* Make sure it's on the same card, if not - no MX's found */ - if (PCI_SLOT(d->devfn) != PCI_SLOT(one->devfn)) return 0; - - two = pci_find_device(PCI_VENDOR_ID_3DLABS,PCI_DEVICE_ID_3DLABS_MX,one); - if (!two) return 1; - - /* Make sure it's on the same card, if not - only 1 MX found */ - if (PCI_SLOT(d->devfn) != PCI_SLOT(two->devfn)) return 1; - - /* Two MX's found - we don't currently support more than 2 */ - return 2; -} - -/* gamma_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). */ - -static int __init gamma_init(void) -{ - int retcode; - drm_device_t *dev = &gamma_device; - - DRM_DEBUG("\n"); - - memset((void *)dev, 0, sizeof(*dev)); - dev->count_lock = SPIN_LOCK_UNLOCKED; - sema_init(&dev->struct_sem, 1); - -#ifdef MODULE - drm_parse_options(gamma); -#endif - devices = gamma_find_devices(); - if (devices == 0) return -1; - - if ((retcode = misc_register(&gamma_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", GAMMA_NAME); - return retcode; - } - dev->device = MKDEV(MISC_MAJOR, gamma_misc.minor); - dev->name = GAMMA_NAME; - - drm_mem_init(); - drm_proc_init(dev); - - DRM_INFO("Initialized %s %d.%d.%d %s on minor %d with %d MX devices\n", - GAMMA_NAME, - GAMMA_MAJOR, - GAMMA_MINOR, - GAMMA_PATCHLEVEL, - GAMMA_DATE, - gamma_misc.minor, - devices); - - return 0; -} - -/* gamma_cleanup is called via cleanup_module at module unload time. */ - -static void __exit gamma_cleanup(void) -{ - drm_device_t *dev = &gamma_device; - - DRM_DEBUG("\n"); - - drm_proc_cleanup(); - if (misc_deregister(&gamma_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } - gamma_takedown(dev); -} - -module_init(gamma_init); -module_exit(gamma_cleanup); - - -int gamma_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_version_t version; - int len; - - if (copy_from_user(&version, - (drm_version_t *)arg, - sizeof(version))) - return -EFAULT; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ - } - - version.version_major = GAMMA_MAJOR; - version.version_minor = GAMMA_MINOR; - version.version_patchlevel = GAMMA_PATCHLEVEL; - - DRM_COPY(version.name, GAMMA_NAME); - DRM_COPY(version.date, GAMMA_DATE); - DRM_COPY(version.desc, GAMMA_DESC); - - if (copy_to_user((drm_version_t *)arg, - &version, - sizeof(version))) - return -EFAULT; - return 0; -} - -int gamma_open(struct inode *inode, struct file *filp) -{ - drm_device_t *dev = &gamma_device; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_open_helper(inode, filp, dev))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_open); - spin_lock(&dev->count_lock); - if (!dev->open_count++) { - spin_unlock(&dev->count_lock); - return gamma_setup(dev); - } - spin_unlock(&dev->count_lock); - } - return retcode; -} - -int gamma_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_release(inode, filp))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_close); - spin_lock(&dev->count_lock); - if (!--dev->open_count) { - if (atomic_read(&dev->ioctl_count) || dev->blocked) { - DRM_ERROR("Device busy: %d %d\n", - atomic_read(&dev->ioctl_count), - dev->blocked); - spin_unlock(&dev->count_lock); - unlock_kernel(); - return -EBUSY; - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return gamma_takedown(dev); - } - spin_unlock(&dev->count_lock); - } - unlock_kernel(); - return retcode; -} - -/* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -int gamma_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - int nr = DRM_IOCTL_NR(cmd); - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int retcode = 0; - drm_ioctl_desc_t *ioctl; - drm_ioctl_t *func; - - atomic_inc(&dev->ioctl_count); - atomic_inc(&dev->total_ioctl); - ++priv->ioctl_count; - - DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", - current->pid, cmd, nr, dev->device, priv->authenticated); - - if (nr >= GAMMA_IOCTL_COUNT) { - retcode = -EINVAL; - } else { - ioctl = &gamma_ioctls[nr]; - func = ioctl->func; - - if (!func) { - DRM_DEBUG("no function\n"); - retcode = -EINVAL; - } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN)) - || (ioctl->auth_needed && !priv->authenticated)) { - retcode = -EACCES; - } else { - retcode = (func)(inode, filp, cmd, arg); - } - } - - atomic_dec(&dev->ioctl_count); - return retcode; -} - - -int gamma_unlock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_lock_t lock; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } - - DRM_DEBUG("%d frees lock (%d holds)\n", - lock.context, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - atomic_inc(&dev->total_unlocks); - if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock)) - atomic_inc(&dev->total_contends); - drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT); - gamma_dma_schedule(dev, 1); - if (!dev->context_flag) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } - } -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.lhld[drm_histogram_slot(get_cycles() - - dev->lck_start)]); -#endif - - unblock_all_signals(); - return 0; -} +#define DRIVER_NAME "gamma" +#define DRIVER_DESC "3DLabs gamma" +#define DRIVER_DATE "20010216" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { gamma_dma, 1, 0 } + + +#define __HAVE_COUNTERS 5 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_DMA +#define __HAVE_COUNTER8 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER9 _DRM_STAT_SPECIAL +#define __HAVE_COUNTER10 _DRM_STAT_MISSED + + +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lists.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h:1.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h:1.8 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h:1.7 Tue Sep 26 12:21:24 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/gamma_drv.h Wed Mar 21 13:08:55 2001 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -23,36 +23,83 @@ * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. - * + * * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> - * + * */ #ifndef _GAMMA_DRV_H_ #define _GAMMA_DRV_H_ - /* gamma_drv.c */ -extern int gamma_version(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int gamma_open(struct inode *inode, struct file *filp); -extern int gamma_release(struct inode *inode, struct file *filp); -extern int gamma_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int gamma_lock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int gamma_unlock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); +typedef struct drm_gamma_private { + drm_map_t *buffers; + drm_map_t *mmio0; + drm_map_t *mmio1; + drm_map_t *mmio2; + drm_map_t *mmio3; +} drm_gamma_private_t; + +#define LOCK_TEST_WITH_RETURN( dev ) \ +do { \ + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ + dev->lock.pid != current->pid ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + return -EINVAL; \ + } \ +} while (0) + + +extern void gamma_dma_ready(drm_device_t *dev); +extern void gamma_dma_quiescent_single(drm_device_t *dev); +extern void gamma_dma_quiescent_dual(drm_device_t *dev); + /* gamma_dma.c */ extern int gamma_dma_schedule(drm_device_t *dev, int locked); extern int gamma_dma(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int gamma_irq_install(drm_device_t *dev, int irq); -extern int gamma_irq_uninstall(drm_device_t *dev); -extern int gamma_control(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); extern int gamma_find_devices(void); extern int gamma_found(void); + + +#define GAMMA_OFF(reg) \ + ((reg < 0x1000) \ + ? reg \ + : ((reg < 0x10000) \ + ? (reg - 0x1000) \ + : ((reg < 0x11000) \ + ? (reg - 0x10000) \ + : (reg - 0x11000)))) + +#define GAMMA_BASE(reg) ((unsigned long) \ + ((reg < 0x1000) ? dev_priv->mmio0->handle : \ + ((reg < 0x10000) ? dev_priv->mmio1->handle : \ + ((reg < 0x11000) ? dev_priv->mmio2->handle : \ + dev_priv->mmio3->handle)))) + +#define GAMMA_ADDR(reg) (GAMMA_BASE(reg) + GAMMA_OFF(reg)) +#define GAMMA_DEREF(reg) *(__volatile__ int *)GAMMA_ADDR(reg) +#define GAMMA_READ(reg) GAMMA_DEREF(reg) +#define GAMMA_WRITE(reg,val) do { GAMMA_DEREF(reg) = val; } while (0) + +#define GAMMA_BROADCASTMASK 0x9378 +#define GAMMA_COMMANDINTENABLE 0x0c48 +#define GAMMA_DMAADDRESS 0x0028 +#define GAMMA_DMACOUNT 0x0030 +#define GAMMA_FILTERMODE 0x8c00 +#define GAMMA_GCOMMANDINTFLAGS 0x0c50 +#define GAMMA_GCOMMANDMODE 0x0c40 +#define GAMMA_GCOMMANDSTATUS 0x0c60 +#define GAMMA_GDELAYTIMER 0x0c38 +#define GAMMA_GDMACONTROL 0x0060 +#define GAMMA_GINTENABLE 0x0808 +#define GAMMA_GINTFLAGS 0x0810 +#define GAMMA_INFIFOSPACE 0x0018 +#define GAMMA_OUTFIFOWORDS 0x0020 +#define GAMMA_OUTPUTFIFO 0x2000 +#define GAMMA_SYNC 0x8c40 +#define GAMMA_SYNC_TAG 0x0188 #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h:1.1 --- /dev/null Mon Jun 4 12:41:26 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810.h Wed Mar 21 13:08:55 2001 @@ -0,0 +1,112 @@ +/* i810.h -- Intel i810/i815 DRM template customization -*- linux-c -*- + * Created: Thu Feb 15 00:01:12 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __I810_H__ +#define __I810_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) i810_##x + +/* General customization: + */ +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 1 +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 + +/* Driver customization: + */ +#define __HAVE_RELEASE 1 +#define DRIVER_RELEASE() do { \ + i810_reclaim_buffers( dev, priv->pid ); \ +} while (0) + +/* DMA customization: + */ +#define __HAVE_DMA 1 +#define __HAVE_DMA_QUEUE 1 +#define __HAVE_DMA_WAITLIST 1 +#define __HAVE_DMA_RECLAIM 1 + +#define __HAVE_DMA_QUIESCENT 1 +#define DRIVER_DMA_QUIESCENT() do { \ + i810_dma_quiescent( dev ); \ +} while (0) + +#define __HAVE_DMA_IRQ 1 +#define __HAVE_DMA_IRQ_BH 1 +#define DRIVER_PREINSTALL() do { \ + drm_i810_private_t *dev_priv = \ + (drm_i810_private_t *)dev->dev_private; \ + u16 tmp; \ + tmp = I810_READ16( I810REG_HWSTAM ); \ + tmp = tmp & 0x6000; \ + I810_WRITE16( I810REG_HWSTAM, tmp ); \ + \ + tmp = I810_READ16( I810REG_INT_MASK_R ); \ + tmp = tmp & 0x6000; /* Unmask interrupts */ \ + I810_WRITE16( I810REG_INT_MASK_R, tmp ); \ + tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; /* Disable all interrupts */ \ + I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ +} while (0) + +#define DRIVER_POSTINSTALL() do { \ + drm_i810_private_t *dev_priv = \ + (drm_i810_private_t *)dev->dev_private; \ + u16 tmp; \ + tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; \ + tmp = tmp | 0x0003; /* Enable bp & user interrupts */ \ + I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ +} while (0) + +#define DRIVER_UNINSTALL() do { \ + drm_i810_private_t *dev_priv = \ + (drm_i810_private_t *)dev->dev_private; \ + u16 tmp; \ + tmp = I810_READ16( I810REG_INT_IDENTITY_R ); \ + tmp = tmp & ~(0x6000); /* Clear all interrupts */ \ + if ( tmp != 0 ) I810_WRITE16( I810REG_INT_IDENTITY_R, tmp ); \ + \ + tmp = I810_READ16( I810REG_INT_ENABLE_R ); \ + tmp = tmp & 0x6000; /* Disable all interrupts */ \ + I810_WRITE16( I810REG_INT_ENABLE_R, tmp ); \ +} while (0) + +/* Buffer customization: + */ + +#define DRIVER_BUF_PRIV_T drm_i810_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_i810_private_t *)((dev)->dev_private))->buffer_map + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c:1.5 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c:1.5 Tue Sep 26 12:21:24 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_bufs.c Mon Jun 4 12:41:26 2001 @@ -1,332 +0,0 @@ -/* i810_bufs.c -- IOCTLs to manage buffers -*- linux-c -*- - * Created: Thu Jan 6 01:47:26 2000 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" -#include "i810_drv.h" -#include "linux/un.h" - -int i810_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - drm_buf_entry_t *entry; - drm_buf_t *buf; - unsigned long offset; - unsigned long agp_offset; - int count; - int order; - int size; - int alignment; - int page_order; - int total; - int byte_count; - int i; - - if (!dma) return -EINVAL; - - if (copy_from_user(&request, - (drm_buf_desc_t *)arg, - sizeof(request))) - return -EFAULT; - - count = request.count; - order = drm_order(request.size); - size = 1 << order; - agp_offset = request.agp_start; - 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; - - 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 = offset; - buf->bus_address = dev->agp->base + agp_offset + offset; - buf->address = (void *)(agp_offset + offset + dev->agp->base); - buf->next = NULL; - buf->waiting = 0; - buf->pending = 0; - init_waitqueue_head(&buf->dma_wait); - buf->pid = 0; - - buf->dev_private = drm_alloc(sizeof(drm_i810_buf_priv_t), - DRM_MEM_BUFS); - buf->dev_priv_size = sizeof(drm_i810_buf_priv_t); - memset(buf->dev_private, 0, sizeof(drm_i810_buf_priv_t)); - -#if DRM_DMA_HISTOGRAM - buf->time_queued = 0; - buf->time_dispatched = 0; - buf->time_completed = 0; - buf->time_freed = 0; -#endif - offset = offset + alignment; - entry->buf_count++; - byte_count += PAGE_SIZE << page_order; - - DRM_DEBUG("buffer %d @ %p\n", - entry->buf_count, buf->address); - } - - 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 = dma->buf_count; i < dma->buf_count + entry->buf_count; i++) - dma->buflist[i] = &entry->buflist[i - dma->buf_count]; - - dma->buf_count += entry->buf_count; - dma->byte_count += byte_count; - 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]); - } - - up(&dev->struct_sem); - - request.count = entry->buf_count; - request.size = size; - - if (copy_to_user((drm_buf_desc_t *)arg, - &request, - sizeof(request))) - return -EFAULT; - - atomic_dec(&dev->buf_alloc); - dma->flags = _DRM_DMA_USE_AGP; - return 0; -} - -int i810_addbufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_buf_desc_t request; - - if (copy_from_user(&request, - (drm_buf_desc_t *)arg, - sizeof(request))) - return -EFAULT; - - if(request.flags & _DRM_AGP_BUFFER) - return i810_addbufs_agp(inode, filp, cmd, arg); - else - return -EINVAL; -} - -int i810_infobufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_info_t request; - int i; - int count; - - if (!dma) return -EINVAL; - - spin_lock(&dev->count_lock); - if (atomic_read(&dev->buf_alloc)) { - spin_unlock(&dev->count_lock); - return -EBUSY; - } - ++dev->buf_use; /* Can't allocate more after this call */ - spin_unlock(&dev->count_lock); - - if (copy_from_user(&request, - (drm_buf_info_t *)arg, - sizeof(request))) - return -EFAULT; - - for (i = 0, count = 0; i < DRM_MAX_ORDER+1; i++) { - if (dma->bufs[i].buf_count) ++count; - } - - DRM_DEBUG("count = %d\n", count); - - if (request.count >= count) { - for (i = 0, count = 0; i < DRM_MAX_ORDER+1; i++) { - if (dma->bufs[i].buf_count) { - if (copy_to_user(&request.list[count].count, - &dma->bufs[i].buf_count, - sizeof(dma->bufs[0] - .buf_count)) || - copy_to_user(&request.list[count].size, - &dma->bufs[i].buf_size, - sizeof(dma->bufs[0].buf_size)) || - copy_to_user(&request.list[count].low_mark, - &dma->bufs[i] - .freelist.low_mark, - sizeof(dma->bufs[0] - .freelist.low_mark)) || - copy_to_user(&request.list[count] - .high_mark, - &dma->bufs[i] - .freelist.high_mark, - sizeof(dma->bufs[0] - .freelist.high_mark))) - return -EFAULT; - - DRM_DEBUG("%d %d %d %d %d\n", - i, - dma->bufs[i].buf_count, - dma->bufs[i].buf_size, - dma->bufs[i].freelist.low_mark, - dma->bufs[i].freelist.high_mark); - ++count; - } - } - } - request.count = count; - - if (copy_to_user((drm_buf_info_t *)arg, - &request, - sizeof(request))) - return -EFAULT; - - return 0; -} - -int i810_markbufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - int order; - drm_buf_entry_t *entry; - - if (!dma) return -EINVAL; - - if (copy_from_user(&request, - (drm_buf_desc_t *)arg, - sizeof(request))) - return -EFAULT; - - DRM_DEBUG("%d, %d, %d\n", - request.size, request.low_mark, request.high_mark); - order = drm_order(request.size); - if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL; - entry = &dma->bufs[order]; - - if (request.low_mark < 0 || request.low_mark > entry->buf_count) - return -EINVAL; - if (request.high_mark < 0 || request.high_mark > entry->buf_count) - return -EINVAL; - - entry->freelist.low_mark = request.low_mark; - entry->freelist.high_mark = request.high_mark; - - return 0; -} - -int i810_freebufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_free_t request; - int i; - int idx; - drm_buf_t *buf; - - if (!dma) return -EINVAL; - - if (copy_from_user(&request, - (drm_buf_free_t *)arg, - sizeof(request))) - return -EFAULT; - - DRM_DEBUG("%d\n", request.count); - for (i = 0; i < request.count; i++) { - if (copy_from_user(&idx, - &request.list[i], - sizeof(idx))) - return -EFAULT; - if (idx < 0 || idx >= dma->buf_count) { - DRM_ERROR("Index %d (of %d max)\n", - idx, dma->buf_count - 1); - return -EINVAL; - } - buf = dma->buflist[idx]; - if (buf->pid != current->pid) { - DRM_ERROR("Process %d freeing buffer owned by %d\n", - current->pid, buf->pid); - return -EINVAL; - } - drm_free_buffer(dev, buf); - } - - return 0; -} - Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_context.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_context.c:1.5 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_context.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_context.c:1.5 Tue Sep 26 12:21:24 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_context.c Mon Jun 4 12:41:26 2001 @@ -1,212 +0,0 @@ -/* i810_context.c -- IOCTLs for i810 contexts -*- linux-c -*- - * Created: Mon Dec 13 09:51:35 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" -#include "i810_drv.h" - -static int i810_alloc_queue(drm_device_t *dev) -{ - int temp = drm_ctxbitmap_next(dev); - DRM_DEBUG("i810_alloc_queue: %d\n", temp); - return temp; -} - -int i810_context_switch(drm_device_t *dev, int old, int new) -{ - char buf[64]; - - atomic_inc(&dev->total_ctx); - - if (test_and_set_bit(0, &dev->context_flag)) { - DRM_ERROR("Reentering -- FIXME\n"); - return -EBUSY; - } - -#if DRM_DMA_HISTOGRAM - dev->ctx_start = get_cycles(); -#endif - - DRM_DEBUG("Context switch from %d to %d\n", old, new); - - if (new == dev->last_context) { - clear_bit(0, &dev->context_flag); - return 0; - } - - if (drm_flags & DRM_FLAG_NOCTX) { - i810_context_switch_complete(dev, new); - } else { - sprintf(buf, "C %d %d\n", old, new); - drm_write_string(dev, buf); - } - - return 0; -} - -int i810_context_switch_complete(drm_device_t *dev, int new) -{ - dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ - dev->last_switch = jiffies; - - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("Lock isn't held after context switch\n"); - } - - /* If a context switch is ever initiated - when the kernel holds the lock, release - that lock here. */ -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.ctx[drm_histogram_slot(get_cycles() - - dev->ctx_start)]); - -#endif - clear_bit(0, &dev->context_flag); - wake_up(&dev->context_wait); - - return 0; -} - -int i810_resctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_res_t res; - drm_ctx_t ctx; - int i; - - DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); - if (copy_from_user(&res, (drm_ctx_res_t *)arg, sizeof(res))) - return -EFAULT; - if (res.count >= DRM_RESERVED_CONTEXTS) { - memset(&ctx, 0, sizeof(ctx)); - for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { - ctx.handle = i; - if (copy_to_user(&res.contexts[i], - &i, - sizeof(i))) - return -EFAULT; - } - } - res.count = DRM_RESERVED_CONTEXTS; - if (copy_to_user((drm_ctx_res_t *)arg, &res, sizeof(res))) - return -EFAULT; - return 0; -} - -int i810_addctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - if ((ctx.handle = i810_alloc_queue(dev)) == DRM_KERNEL_CONTEXT) { - /* Skip kernel's context and get a new one. */ - ctx.handle = i810_alloc_queue(dev); - } - if (ctx.handle == -1) { - DRM_DEBUG("Not enough free contexts.\n"); - /* Should this return -EBUSY instead? */ - return -ENOMEM; - } - DRM_DEBUG("%d\n", ctx.handle); - if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx))) - return -EFAULT; - return 0; -} - -int i810_modctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - /* This does nothing for the i810 */ - return 0; -} - -int i810_getctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t*)arg, sizeof(ctx))) - return -EFAULT; - /* This is 0, because we don't hanlde any context flags */ - ctx.flags = 0; - if (copy_to_user((drm_ctx_t*)arg, &ctx, sizeof(ctx))) - return -EFAULT; - return 0; -} - -int i810_switchctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - return i810_context_switch(dev, dev->last_context, ctx.handle); -} - -int i810_newctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - i810_context_switch_complete(dev, ctx.handle); - - return 0; -} - -int i810_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - if(ctx.handle != DRM_KERNEL_CONTEXT) { - drm_ctxbitmap_free(dev, ctx.handle); - } - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c:1.9 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c:1.12 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c:1.9 Wed Nov 8 00:03:06 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_dma.c Wed May 2 11:06:10 2001 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -31,6 +31,7 @@ */ #define __NO_VERSION__ +#include "i810.h" #include "drmP.h" #include "i810_drv.h" #include <linux/interrupt.h> /* For task queue support */ @@ -47,17 +48,6 @@ #define I810_BUF_UNMAPPED 0 #define I810_BUF_MAPPED 1 -#define I810_REG(reg) 2 -#define I810_BASE(reg) ((unsigned long) \ - dev->maplist[I810_REG(reg)]->handle) -#define I810_ADDR(reg) (I810_BASE(reg) + reg) -#define I810_DEREF(reg) *(__volatile__ int *)I810_ADDR(reg) -#define I810_READ(reg) I810_DEREF(reg) -#define I810_WRITE(reg,val) do { I810_DEREF(reg) = val; } while (0) -#define I810_DEREF16(reg) *(__volatile__ u16 *)I810_ADDR(reg) -#define I810_READ16(reg) I810_DEREF16(reg) -#define I810_WRITE16(reg,val) do { I810_DEREF16(reg) = val; } while (0) - #define RING_LOCALS unsigned int outring, ringmask; volatile char *virt; #define BEGIN_LP_RING(n) do { \ @@ -107,14 +97,14 @@ drm_device_dma_t *dma = dev->dma; int i; int used; - + /* Linear search might not be the best solution */ for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; drm_i810_buf_priv_t *buf_priv = buf->dev_private; /* In use is already a pointer */ - used = cmpxchg(buf_priv->in_use, I810_BUF_FREE, + used = cmpxchg(buf_priv->in_use, I810_BUF_FREE, I810_BUF_CLIENT); if(used == I810_BUF_FREE) { return buf; @@ -131,26 +121,26 @@ { drm_i810_buf_priv_t *buf_priv = buf->dev_private; int used; - + /* In use is already a pointer */ used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_FREE); if(used != I810_BUF_CLIENT) { DRM_ERROR("Freeing buffer thats not in use : %d\n", buf->idx); return -EINVAL; } - + return 0; } static struct file_operations i810_buffer_fops = { - open: i810_open, - flush: drm_flush, - release: i810_release, - ioctl: i810_ioctl, + open: DRM(open), + flush: DRM(flush), + release: DRM(release), + ioctl: DRM(ioctl), mmap: i810_mmap_buffers, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, + read: DRM(read), + fasync: DRM(fasync), + poll: DRM(poll), }; int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma) @@ -166,10 +156,10 @@ dev_priv = dev->dev_private; buf = dev_priv->mmap_buffer; buf_priv = buf->dev_private; - + vma->vm_flags |= (VM_IO | VM_DONTCOPY); vma->vm_file = filp; - + buf_priv->currently_mapped = I810_BUF_MAPPED; unlock_kernel(); @@ -192,13 +182,17 @@ if(buf_priv->currently_mapped == I810_BUF_MAPPED) return -EINVAL; if(VM_DONTCOPY != 0) { - down(¤t->mm->mmap_sem); +#if LINUX_VERSION_CODE <= 0x020402 + down( ¤t->mm->mmap_sem ); +#else + down_write( ¤t->mm->mmap_sem ); +#endif old_fops = filp->f_op; filp->f_op = &i810_buffer_fops; dev_priv->mmap_buffer = buf; - buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, + buf_priv->virtual = (void *)do_mmap(filp, 0, buf->total, PROT_READ|PROT_WRITE, - MAP_SHARED, + MAP_SHARED, buf->bus_address); dev_priv->mmap_buffer = NULL; filp->f_op = old_fops; @@ -208,7 +202,11 @@ retcode = (signed int)buf_priv->virtual; buf_priv->virtual = 0; } - up(¤t->mm->mmap_sem); +#if LINUX_VERSION_CODE <= 0x020402 + up( ¤t->mm->mmap_sem ); +#else + up_write( ¤t->mm->mmap_sem ); +#endif } else { buf_priv->virtual = buf_priv->kernel_virtual; buf_priv->currently_mapped = I810_BUF_MAPPED; @@ -222,18 +220,26 @@ int retcode = 0; if(VM_DONTCOPY != 0) { - if(buf_priv->currently_mapped != I810_BUF_MAPPED) + if(buf_priv->currently_mapped != I810_BUF_MAPPED) return -EINVAL; - down(¤t->mm->mmap_sem); +#if LINUX_VERSION_CODE <= 0x020402 + down( ¤t->mm->mmap_sem ); +#else + down_write( ¤t->mm->mmap_sem ); +#endif #if LINUX_VERSION_CODE < 0x020399 - retcode = do_munmap((unsigned long)buf_priv->virtual, + retcode = do_munmap((unsigned long)buf_priv->virtual, (size_t) buf->total); #else - retcode = do_munmap(current->mm, - (unsigned long)buf_priv->virtual, + retcode = do_munmap(current->mm, + (unsigned long)buf_priv->virtual, (size_t) buf->total); +#endif +#if LINUX_VERSION_CODE <= 0x020402 + up( ¤t->mm->mmap_sem ); +#else + up_write( ¤t->mm->mmap_sem ); #endif - up(¤t->mm->mmap_sem); } buf_priv->currently_mapped = I810_BUF_UNMAPPED; buf_priv->virtual = 0; @@ -241,7 +247,7 @@ return retcode; } -static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d, +static int i810_dma_get_buffer(drm_device_t *dev, drm_i810_dma_t *d, struct file *filp) { drm_file_t *priv = filp->private_data; @@ -255,7 +261,7 @@ DRM_DEBUG("retcode=%d\n", retcode); return retcode; } - + retcode = i810_map_buffer(buf, filp); if(retcode) { i810_freelist_put(dev, buf); @@ -263,7 +269,7 @@ return retcode; } buf->pid = priv->pid; - buf_priv = buf->dev_private; + buf_priv = buf->dev_private; d->granted = 1; d->request_idx = buf->idx; d->request_size = buf->total; @@ -275,22 +281,22 @@ static unsigned long i810_alloc_page(drm_device_t *dev) { unsigned long address; - + address = __get_free_page(GFP_KERNEL); - if(address == 0UL) + if(address == 0UL) return 0; - + atomic_inc(&virt_to_page(address)->count); set_bit(PG_locked, &virt_to_page(address)->flags); - + return address; } static void i810_free_page(drm_device_t *dev, unsigned long page) { - if(page == 0UL) + if(page == 0UL) return; - + atomic_dec(&virt_to_page(page)->count); clear_bit(PG_locked, &virt_to_page(page)->flags); wake_up(&virt_to_page(page)->wait); @@ -304,26 +310,26 @@ if(dev->dev_private) { int i; - drm_i810_private_t *dev_priv = + drm_i810_private_t *dev_priv = (drm_i810_private_t *) dev->dev_private; - + if(dev_priv->ring.virtual_start) { - drm_ioremapfree((void *) dev_priv->ring.virtual_start, - dev_priv->ring.Size); + DRM(ioremapfree)((void *) dev_priv->ring.virtual_start, + dev_priv->ring.Size); } if(dev_priv->hw_status_page != 0UL) { i810_free_page(dev, dev_priv->hw_status_page); /* Need to rewrite hardware status page */ I810_WRITE(0x02080, 0x1ffff000); } - drm_free(dev->dev_private, sizeof(drm_i810_private_t), + DRM(free)(dev->dev_private, sizeof(drm_i810_private_t), DRM_MEM_DRIVER); dev->dev_private = NULL; for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; drm_i810_buf_priv_t *buf_priv = buf->dev_private; - drm_ioremapfree(buf_priv->kernel_virtual, buf->total); + DRM(ioremapfree)(buf_priv->kernel_virtual, buf->total); } } return 0; @@ -340,14 +346,14 @@ end = jiffies + (HZ*3); while (ring->space < n) { int i; - + ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; ring->space = ring->head - (ring->tail+8); if (ring->space < 0) ring->space += ring->Size; - + if (ring->head != last_head) end = jiffies + (HZ*3); - + iters++; if((signed)(end - jiffies) <= 0) { DRM_ERROR("space: %d wanted %d\n", ring->space, n); @@ -358,7 +364,7 @@ for (i = 0 ; i < 2000 ; i++) ; } -out_wait_ring: +out_wait_ring: return iters; } @@ -366,7 +372,7 @@ { drm_i810_private_t *dev_priv = dev->dev_private; drm_i810_ring_buffer_t *ring = &(dev_priv->ring); - + ring->head = I810_READ(LP_RING + RING_HEAD) & HEAD_ADDR; ring->tail = I810_READ(LP_RING + RING_TAIL); ring->space = ring->head - (ring->tail+8); @@ -380,7 +386,7 @@ int my_idx = 24; u32 *hw_status = (u32 *)(dev_priv->hw_status_page + my_idx); int i; - + if(dma->buf_count > 1019) { /* Not enough space in the status page for the freelist */ return -EINVAL; @@ -389,55 +395,58 @@ for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; drm_i810_buf_priv_t *buf_priv = buf->dev_private; - + buf_priv->in_use = hw_status++; buf_priv->my_use_idx = my_idx; my_idx += 4; *buf_priv->in_use = I810_BUF_FREE; - buf_priv->kernel_virtual = drm_ioremap(buf->bus_address, - buf->total); + buf_priv->kernel_virtual = DRM(ioremap)(buf->bus_address, + buf->total); } return 0; } -static int i810_dma_initialize(drm_device_t *dev, +static int i810_dma_initialize(drm_device_t *dev, drm_i810_private_t *dev_priv, drm_i810_init_t *init) { - drm_map_t *sarea_map; + struct list_head *list; dev->dev_private = (void *) dev_priv; memset(dev_priv, 0, sizeof(drm_i810_private_t)); - if (init->ring_map_idx >= dev->map_count || - init->buffer_map_idx >= dev->map_count) { - i810_dma_cleanup(dev); - DRM_ERROR("ring_map or buffer_map are invalid\n"); - return -EINVAL; - } - - dev_priv->ring_map_idx = init->ring_map_idx; - dev_priv->buffer_map_idx = init->buffer_map_idx; - sarea_map = dev->maplist[0]; - dev_priv->sarea_priv = (drm_i810_sarea_t *) - ((u8 *)sarea_map->handle + + list_for_each(list, &dev->maplist->head) { + drm_map_list_t *r_list = (drm_map_list_t *)list; + if( r_list->map && + r_list->map->type == _DRM_SHM && + r_list->map->flags & _DRM_CONTAINS_LOCK ) { + dev_priv->sarea_map = r_list->map; + break; + } + } + + DRM_FIND_MAP( dev_priv->mmio_map, init->mmio_offset ); + DRM_FIND_MAP( dev_priv->buffer_map, init->buffers_offset ); + + dev_priv->sarea_priv = (drm_i810_sarea_t *) + ((u8 *)dev_priv->sarea_map->handle + init->sarea_priv_offset); atomic_set(&dev_priv->flush_done, 0); init_waitqueue_head(&dev_priv->flush_queue); - + dev_priv->ring.Start = init->ring_start; dev_priv->ring.End = init->ring_end; dev_priv->ring.Size = init->ring_size; - dev_priv->ring.virtual_start = drm_ioremap(dev->agp->base + - init->ring_start, - init->ring_size); + dev_priv->ring.virtual_start = DRM(ioremap)(dev->agp->base + + init->ring_start, + init->ring_size); dev_priv->ring.tail_mask = dev_priv->ring.Size - 1; - + if (dev_priv->ring.virtual_start == NULL) { i810_dma_cleanup(dev); DRM_ERROR("can not ioremap virtual address for" @@ -454,8 +463,8 @@ dev_priv->front_di1 = init->front_offset | init->pitch_bits; dev_priv->back_di1 = init->back_offset | init->pitch_bits; dev_priv->zi1 = init->depth_offset | init->pitch_bits; - - + + /* Program Hardware Status Page */ dev_priv->hw_status_page = i810_alloc_page(dev); memset((void *) dev_priv->hw_status_page, 0, PAGE_SIZE); @@ -465,10 +474,10 @@ return -ENOMEM; } DRM_DEBUG("hw status page @ %lx\n", dev_priv->hw_status_page); - + I810_WRITE(0x02080, virt_to_bus((void *)dev_priv->hw_status_page)); DRM_DEBUG("Enabled hardware status page\n"); - + /* Now we need to init our freelist */ if(i810_freelist_init(dev) != 0) { i810_dma_cleanup(dev); @@ -487,13 +496,13 @@ drm_i810_private_t *dev_priv; drm_i810_init_t init; int retcode = 0; - + if (copy_from_user(&init, (drm_i810_init_t *)arg, sizeof(init))) return -EFAULT; - + switch(init.func) { case I810_INIT_DMA: - dev_priv = drm_alloc(sizeof(drm_i810_private_t), + dev_priv = DRM(alloc)(sizeof(drm_i810_private_t), DRM_MEM_DRIVER); if(dev_priv == NULL) return -ENOMEM; retcode = i810_dma_initialize(dev, dev_priv, &init); @@ -505,7 +514,7 @@ retcode = -EINVAL; break; } - + return retcode; } @@ -517,9 +526,9 @@ * Use 'volatile' & local var tmp to force the emitted values to be * identical to the verified ones. */ -static void i810EmitContextVerified( drm_device_t *dev, - volatile unsigned int *code ) -{ +static void i810EmitContextVerified( drm_device_t *dev, + volatile unsigned int *code ) +{ drm_i810_private_t *dev_priv = dev->dev_private; int i, j = 0; unsigned int tmp; @@ -537,22 +546,22 @@ tmp = code[i]; if ((tmp & (7<<29)) == (3<<29) && - (tmp & (0x1f<<24)) < (0x1d<<24)) + (tmp & (0x1f<<24)) < (0x1d<<24)) { - OUT_RING( tmp ); + OUT_RING( tmp ); j++; - } + } } - if (j & 1) - OUT_RING( 0 ); + if (j & 1) + OUT_RING( 0 ); ADVANCE_LP_RING(); } -static void i810EmitTexVerified( drm_device_t *dev, - volatile unsigned int *code ) -{ +static void i810EmitTexVerified( drm_device_t *dev, + volatile unsigned int *code ) +{ drm_i810_private_t *dev_priv = dev->dev_private; int i, j = 0; unsigned int tmp; @@ -569,15 +578,15 @@ tmp = code[i]; if ((tmp & (7<<29)) == (3<<29) && - (tmp & (0x1f<<24)) < (0x1d<<24)) + (tmp & (0x1f<<24)) < (0x1d<<24)) { - OUT_RING( tmp ); + OUT_RING( tmp ); j++; } - } - - if (j & 1) - OUT_RING( 0 ); + } + + if (j & 1) + OUT_RING( 0 ); ADVANCE_LP_RING(); } @@ -585,9 +594,9 @@ /* Need to do some additional checking when setting the dest buffer. */ -static void i810EmitDestVerified( drm_device_t *dev, - volatile unsigned int *code ) -{ +static void i810EmitDestVerified( drm_device_t *dev, + volatile unsigned int *code ) +{ drm_i810_private_t *dev_priv = dev->dev_private; unsigned int tmp; RING_LOCALS; @@ -651,9 +660,9 @@ -/* need to verify +/* need to verify */ -static void i810_dma_dispatch_clear( drm_device_t *dev, int flags, +static void i810_dma_dispatch_clear( drm_device_t *dev, int flags, unsigned int clear_color, unsigned int clear_zval ) { @@ -684,10 +693,10 @@ pbox->y2 > dev_priv->h) continue; - if ( flags & I810_FRONT ) { + if ( flags & I810_FRONT ) { DRM_DEBUG("clear front\n"); - BEGIN_LP_RING( 6 ); - OUT_RING( BR00_BITBLT_CLIENT | + BEGIN_LP_RING( 6 ); + OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); OUT_RING( BR13_SOLID_PATTERN | (0xF0 << 16) | pitch ); OUT_RING( (height << 16) | width ); @@ -699,8 +708,8 @@ if ( flags & I810_BACK ) { DRM_DEBUG("clear back\n"); - BEGIN_LP_RING( 6 ); - OUT_RING( BR00_BITBLT_CLIENT | + BEGIN_LP_RING( 6 ); + OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); OUT_RING( BR13_SOLID_PATTERN | (0xF0 << 16) | pitch ); OUT_RING( (height << 16) | width ); @@ -712,8 +721,8 @@ if ( flags & I810_DEPTH ) { DRM_DEBUG("clear depth\n"); - BEGIN_LP_RING( 6 ); - OUT_RING( BR00_BITBLT_CLIENT | + BEGIN_LP_RING( 6 ); + OUT_RING( BR00_BITBLT_CLIENT | BR00_OP_COLOR_BLT | 0x3 ); OUT_RING( BR13_SOLID_PATTERN | (0xF0 << 16) | pitch ); OUT_RING( (height << 16) | width ); @@ -744,7 +753,7 @@ if (nbox > I810_NR_SAREA_CLIPRECTS) nbox = I810_NR_SAREA_CLIPRECTS; - for (i = 0 ; i < nbox; i++, pbox++) + for (i = 0 ; i < nbox; i++, pbox++) { unsigned int w = pbox->x2 - pbox->x1; unsigned int h = pbox->y2 - pbox->y1; @@ -756,7 +765,7 @@ pbox->x2 > dev_priv->w || pbox->y2 > dev_priv->h) continue; - + DRM_DEBUG("dispatch swap %d,%d-%d,%d!\n", pbox[i].x1, pbox[i].y1, pbox[i].x2, pbox[i].y2); @@ -766,14 +775,14 @@ OUT_RING( pitch | (0xCC << 16)); OUT_RING( (h << 16) | (w * cpp)); OUT_RING( dst ); - OUT_RING( pitch ); + OUT_RING( pitch ); OUT_RING( start ); ADVANCE_LP_RING(); } } -static void i810_dma_dispatch_vertex(drm_device_t *dev, +static void i810_dma_dispatch_vertex(drm_device_t *dev, drm_buf_t *buf, int discard, int used) @@ -784,30 +793,30 @@ drm_clip_rect_t *box = sarea_priv->boxes; int nbox = sarea_priv->nbox; unsigned long address = (unsigned long)buf->bus_address; - unsigned long start = address - dev->agp->base; + unsigned long start = address - dev->agp->base; int i = 0, u; RING_LOCALS; i810_kernel_lost_context(dev); - if (nbox > I810_NR_SAREA_CLIPRECTS) + if (nbox > I810_NR_SAREA_CLIPRECTS) nbox = I810_NR_SAREA_CLIPRECTS; if (discard) { - u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, + u = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_HARDWARE); if(u != I810_BUF_CLIENT) { DRM_DEBUG("xxxx 2\n"); } } - if (used > 4*1024) + if (used > 4*1024) used = 0; if (sarea_priv->dirty) i810EmitState( dev ); - DRM_DEBUG("dispatch vertex addr 0x%lx, used 0x%x nbox %d\n", + DRM_DEBUG("dispatch vertex addr 0x%lx, used 0x%x nbox %d\n", address, used, nbox); dev_priv->counter++; @@ -821,7 +830,7 @@ *(u32 *)buf_priv->virtual = (GFX_OP_PRIMITIVE | sarea_priv->vertex_prim | ((used/4)-2)); - + if (used & 4) { *(u32 *)((u32)buf_priv->virtual + used) = 0; used += 4; @@ -829,26 +838,26 @@ i810_unmap_buffer(buf); } - + if (used) { do { if (i < nbox) { BEGIN_LP_RING(4); - OUT_RING( GFX_OP_SCISSOR | SC_UPDATE_SCISSOR | + OUT_RING( GFX_OP_SCISSOR | SC_UPDATE_SCISSOR | SC_ENABLE ); OUT_RING( GFX_OP_SCISSOR_INFO ); OUT_RING( box[i].x1 | (box[i].y1<<16) ); OUT_RING( (box[i].x2-1) | ((box[i].y2-1)<<16) ); ADVANCE_LP_RING(); } - + BEGIN_LP_RING(4); OUT_RING( CMD_OP_BATCH_BUFFER ); OUT_RING( start | BB1_PROTECTED ); OUT_RING( start + used - 4 ); OUT_RING( 0 ); ADVANCE_LP_RING(); - + } while (++i < nbox); } @@ -872,24 +881,25 @@ /* Interrupts are only for flushing */ -static void i810_dma_service(int irq, void *device, struct pt_regs *regs) +void i810_dma_service(int irq, void *device, struct pt_regs *regs) { drm_device_t *dev = (drm_device_t *)device; + drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; u16 temp; - - atomic_inc(&dev->total_irq); + + atomic_inc(&dev->counts[_DRM_STAT_IRQ]); temp = I810_READ16(I810REG_INT_IDENTITY_R); temp = temp & ~(0x6000); - if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R, + if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R, temp); /* Clear all interrupts */ else return; - + queue_task(&dev->tq, &tq_immediate); mark_bh(IMMEDIATE_BH); } -static void i810_dma_task_queue(void *device) +void i810_dma_immediate_bh(void *device) { drm_device_t *dev = (drm_device_t *) device; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; @@ -898,129 +908,6 @@ wake_up_interruptible(&dev_priv->flush_queue); } -int i810_irq_install(drm_device_t *dev, int irq) -{ - int retcode; - u16 temp; - - if (!irq) return -EINVAL; - - down(&dev->struct_sem); - if (dev->irq) { - up(&dev->struct_sem); - return -EBUSY; - } - dev->irq = irq; - up(&dev->struct_sem); - - DRM_DEBUG( "Interrupt Install : %d\n", irq); - DRM_DEBUG("%d\n", irq); - - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; - - dev->dma->next_buffer = NULL; - dev->dma->next_queue = NULL; - dev->dma->this_buffer = NULL; - - dev->tq.next = NULL; - dev->tq.sync = 0; - dev->tq.routine = i810_dma_task_queue; - dev->tq.data = dev; - - /* Before installing handler */ - temp = I810_READ16(I810REG_HWSTAM); - temp = temp & 0x6000; - I810_WRITE16(I810REG_HWSTAM, temp); - - temp = I810_READ16(I810REG_INT_MASK_R); - temp = temp & 0x6000; - I810_WRITE16(I810REG_INT_MASK_R, temp); /* Unmask interrupts */ - temp = I810_READ16(I810REG_INT_ENABLE_R); - temp = temp & 0x6000; - I810_WRITE16(I810REG_INT_ENABLE_R, temp); /* Disable all interrupts */ - - /* Install handler */ - if ((retcode = request_irq(dev->irq, - i810_dma_service, - SA_SHIRQ, - dev->devname, - dev))) { - down(&dev->struct_sem); - dev->irq = 0; - up(&dev->struct_sem); - return retcode; - } - temp = I810_READ16(I810REG_INT_ENABLE_R); - temp = temp & 0x6000; - temp = temp | 0x0003; - I810_WRITE16(I810REG_INT_ENABLE_R, - temp); /* Enable bp & user interrupts */ - return 0; -} - -int i810_irq_uninstall(drm_device_t *dev) -{ - int irq; - u16 temp; - - -/* return 0; */ - - down(&dev->struct_sem); - irq = dev->irq; - dev->irq = 0; - up(&dev->struct_sem); - - if (!irq) return -EINVAL; - - DRM_DEBUG( "Interrupt UnInstall: %d\n", irq); - DRM_DEBUG("%d\n", irq); - - temp = I810_READ16(I810REG_INT_IDENTITY_R); - temp = temp & ~(0x6000); - if(temp != 0) I810_WRITE16(I810REG_INT_IDENTITY_R, - temp); /* Clear all interrupts */ - - temp = I810_READ16(I810REG_INT_ENABLE_R); - temp = temp & 0x6000; - I810_WRITE16(I810REG_INT_ENABLE_R, - temp); /* Disable all interrupts */ - - free_irq(irq, dev); - - return 0; -} - -int i810_control(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_control_t ctl; - int retcode; - - DRM_DEBUG( "i810_control\n"); - - if (copy_from_user(&ctl, (drm_control_t *)arg, sizeof(ctl))) - return -EFAULT; - - switch (ctl.func) { - case DRM_INST_HANDLER: - if ((retcode = i810_irq_install(dev, ctl.irq))) - return retcode; - break; - case DRM_UNINST_HANDLER: - if ((retcode = i810_irq_uninstall(dev))) - return retcode; - break; - default: - return -EINVAL; - } - return 0; -} - static inline void i810_dma_emit_flush(drm_device_t *dev) { drm_i810_private_t *dev_priv = dev->dev_private; @@ -1057,11 +944,11 @@ /* wake_up_interruptible(&dev_priv->flush_queue); */ } -static void i810_dma_quiescent(drm_device_t *dev) +void i810_dma_quiescent(drm_device_t *dev) { DECLARE_WAITQUEUE(entry, current); drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; - unsigned long end; + unsigned long end; if(dev_priv == NULL) { return; @@ -1069,7 +956,7 @@ atomic_set(&dev_priv->flush_done, 0); add_wait_queue(&dev_priv->flush_queue, &entry); end = jiffies + (HZ*3); - + for (;;) { current->state = TASK_INTERRUPTIBLE; i810_dma_quiescent_emit(dev); @@ -1077,16 +964,16 @@ if((signed)(end - jiffies) <= 0) { DRM_ERROR("lockup\n"); break; - } + } schedule_timeout(HZ*3); if (signal_pending(current)) { break; } } - + current->state = TASK_RUNNING; remove_wait_queue(&dev_priv->flush_queue, &entry); - + return; } @@ -1096,7 +983,7 @@ drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; drm_device_dma_t *dma = dev->dma; unsigned long end; - int i, ret = 0; + int i, ret = 0; if(dev_priv == NULL) { return 0; @@ -1111,14 +998,14 @@ if((signed)(end - jiffies) <= 0) { DRM_ERROR("lockup\n"); break; - } + } schedule_timeout(HZ*3); if (signal_pending(current)) { ret = -EINTR; /* Can't restart */ break; } } - + current->state = TASK_RUNNING; remove_wait_queue(&dev_priv->flush_queue, &entry); @@ -1126,8 +1013,8 @@ for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; drm_i810_buf_priv_t *buf_priv = buf->dev_private; - - int used = cmpxchg(buf_priv->in_use, I810_BUF_HARDWARE, + + int used = cmpxchg(buf_priv->in_use, I810_BUF_HARDWARE, I810_BUF_FREE); if (used == I810_BUF_HARDWARE) @@ -1154,9 +1041,9 @@ for (i = 0; i < dma->buf_count; i++) { drm_buf_t *buf = dma->buflist[ i ]; drm_i810_buf_priv_t *buf_priv = buf->dev_private; - + if (buf->pid == pid && buf_priv) { - int used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, + int used = cmpxchg(buf_priv->in_use, I810_BUF_CLIENT, I810_BUF_FREE); if (used == I810_BUF_CLIENT) @@ -1166,92 +1053,13 @@ } } } - -int i810_lock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - - DECLARE_WAITQUEUE(entry, current); - int ret = 0; - drm_lock_t lock; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } - - DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", - lock.context, current->pid, dev->lock.hw_lock->lock, - lock.flags); - - if (lock.context < 0) { - return -EINVAL; - } - /* Only one queue: - */ - - if (!ret) { - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - ret = -EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - lock.context)) { - dev->lock.pid = current->pid; - dev->lock.lock_time = jiffies; - atomic_inc(&dev->total_locks); - break; /* Got lock */ - } - - /* Contention */ - atomic_inc(&dev->total_sleeps); - DRM_DEBUG("Calling lock schedule\n"); - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - } - - if (!ret) { - sigemptyset(&dev->sigmask); - sigaddset(&dev->sigmask, SIGSTOP); - sigaddset(&dev->sigmask, SIGTSTP); - sigaddset(&dev->sigmask, SIGTTIN); - sigaddset(&dev->sigmask, SIGTTOU); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); - - if (lock.flags & _DRM_LOCK_QUIESCENT) { - DRM_DEBUG("_DRM_LOCK_QUIESCENT\n"); - DRM_DEBUG("fred\n"); - i810_dma_quiescent(dev); - } - } - DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); - return ret; -} - -int i810_flush_ioctl(struct inode *inode, struct file *filp, +int i810_flush_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - + DRM_DEBUG("i810_flush_ioctl\n"); if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("i810_flush_ioctl called without lock held\n"); @@ -1271,8 +1079,8 @@ drm_device_dma_t *dma = dev->dma; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) - dev_priv->sarea_priv; + drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) + dev_priv->sarea_priv; drm_i810_vertex_t vertex; if (copy_from_user(&vertex, (drm_i810_vertex_t *)arg, sizeof(vertex))) @@ -1286,15 +1094,15 @@ DRM_DEBUG("i810 dma vertex, idx %d used %d discard %d\n", vertex.idx, vertex.used, vertex.discard); - i810_dma_dispatch_vertex( dev, - dma->buflist[ vertex.idx ], + i810_dma_dispatch_vertex( dev, + dma->buflist[ vertex.idx ], vertex.discard, vertex.used ); - atomic_add(vertex.used, &dma->total_bytes); - atomic_inc(&dma->total_dmas); + atomic_add(vertex.used, &dev->counts[_DRM_STAT_SECONDARY]); + atomic_inc(&dev->counts[_DRM_STAT_DMA]); sarea_priv->last_enqueue = dev_priv->counter-1; sarea_priv->last_dispatch = (int) hw_status[5]; - + return 0; } @@ -1309,14 +1117,14 @@ if (copy_from_user(&clear, (drm_i810_clear_t *)arg, sizeof(clear))) return -EFAULT; - + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("i810_clear_bufs called without lock held\n"); return -EINVAL; } - i810_dma_dispatch_clear( dev, clear.flags, - clear.clear_color, + i810_dma_dispatch_clear( dev, clear.flags, + clear.clear_color, clear.clear_depth ); return 0; } @@ -1326,7 +1134,7 @@ { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - + DRM_DEBUG("i810_swap_bufs\n"); if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { @@ -1345,8 +1153,8 @@ drm_device_t *dev = priv->dev; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) - dev_priv->sarea_priv; + drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) + dev_priv->sarea_priv; sarea_priv->last_dispatch = (int) hw_status[5]; return 0; @@ -1361,18 +1169,18 @@ drm_i810_dma_t d; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) - dev_priv->sarea_priv; + drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) + dev_priv->sarea_priv; DRM_DEBUG("getbuf\n"); if (copy_from_user(&d, (drm_i810_dma_t *)arg, sizeof(d))) return -EFAULT; - + if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { DRM_ERROR("i810_dma called without lock held\n"); return -EINVAL; } - + d.granted = 0; retcode = i810_dma_get_buffer(dev, &d, filp); @@ -1395,8 +1203,8 @@ drm_i810_copy_t d; drm_i810_private_t *dev_priv = (drm_i810_private_t *)dev->dev_private; u32 *hw_status = (u32 *)dev_priv->hw_status_page; - drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) - dev_priv->sarea_priv; + drm_i810_sarea_t *sarea_priv = (drm_i810_sarea_t *) + dev_priv->sarea_priv; drm_buf_t *buf; drm_i810_buf_priv_t *buf_priv; drm_device_dma_t *dma = dev->dma; @@ -1405,7 +1213,7 @@ DRM_ERROR("i810_dma called without lock held\n"); return -EINVAL; } - + if (copy_from_user(&d, (drm_i810_copy_t *)arg, sizeof(d))) return -EFAULT; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h:1.3.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h:1.2 Wed Aug 2 22:30:26 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drm.h Thu May 31 22:24:18 2001 @@ -98,8 +98,13 @@ I810_INIT_DMA = 0x01, I810_CLEANUP_DMA = 0x02 } func; +#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) int ring_map_idx; int buffer_map_idx; +#else + unsigned int mmio_offset; + unsigned int buffers_offset; +#endif int sarea_priv_offset; unsigned int ring_start; unsigned int ring_end; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c:1.9 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c:1.10 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c:1.9 Fri Dec 1 09:29:01 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.c Wed Mar 21 13:08:55 2001 @@ -19,630 +19,64 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> + * Gareth Hughes <gareth@valinux.com> */ #include <linux/config.h> +#include "i810.h" #include "drmP.h" #include "i810_drv.h" - -#define I810_NAME "i810" -#define I810_DESC "Intel I810" -#define I810_DATE "20000928" -#define I810_MAJOR 1 -#define I810_MINOR 1 -#define I810_PATCHLEVEL 0 - -static drm_device_t i810_device; -drm_ctx_t i810_res_ctx; - -static struct file_operations i810_fops = { -#if LINUX_VERSION_CODE >= 0x020400 - /* This started being used during 2.4.0-test */ - owner: THIS_MODULE, -#endif - open: i810_open, - flush: drm_flush, - release: i810_release, - ioctl: i810_ioctl, - mmap: drm_mmap, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, -}; - -static struct miscdevice i810_misc = { - minor: MISC_DYNAMIC_MINOR, - name: I810_NAME, - fops: &i810_fops, -}; - -static drm_ioctl_desc_t i810_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { i810_version, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_busid, 0, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { i810_control, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { i810_addbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { i810_markbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { i810_infobufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { i810_freebufs, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { i810_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { i810_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { i810_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { i810_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { i810_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { i810_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { i810_resctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { i810_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { i810_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { drm_agp_info, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { drm_agp_alloc, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { drm_agp_free, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { drm_agp_unbind, 1, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_I810_INIT)] = { i810_dma_init, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_I810_VERTEX)] = { i810_dma_vertex, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_I810_CLEAR)] = { i810_clear_bufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_I810_FLUSH)] = { i810_flush_ioctl,1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_I810_GETAGE)] = { i810_getage, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_I810_GETBUF)] = { i810_getbuf, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_I810_SWAP)] = { i810_swap_bufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_I810_COPY)] = { i810_copybuf, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_I810_DOCOPY)] = { i810_docopy, 1, 0 }, -}; - -#define I810_IOCTL_COUNT DRM_ARRAY_SIZE(i810_ioctls) - -#ifdef MODULE -static char *i810 = NULL; -#endif - -MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("Intel I810"); -MODULE_PARM(i810, "s"); - -#ifndef MODULE -/* i810_options is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_drm. - */ - -static int __init i810_options(char *str) -{ - drm_parse_options(str); - return 1; -} - -__setup("i810=", i810_options); -#endif - -static int i810_setup(drm_device_t *dev) -{ - int i; - - atomic_set(&dev->ioctl_count, 0); - atomic_set(&dev->vma_count, 0); - dev->buf_use = 0; - atomic_set(&dev->buf_alloc, 0); - - drm_dma_setup(dev); - - atomic_set(&dev->total_open, 0); - atomic_set(&dev->total_close, 0); - atomic_set(&dev->total_ioctl, 0); - atomic_set(&dev->total_irq, 0); - atomic_set(&dev->total_ctx, 0); - atomic_set(&dev->total_locks, 0); - atomic_set(&dev->total_unlocks, 0); - atomic_set(&dev->total_contends, 0); - atomic_set(&dev->total_sleeps, 0); - - for (i = 0; i < DRM_HASH_SIZE; i++) { - dev->magiclist[i].head = NULL; - dev->magiclist[i].tail = NULL; - } - dev->maplist = NULL; - dev->map_count = 0; - dev->vmalist = NULL; - dev->lock.hw_lock = NULL; - init_waitqueue_head(&dev->lock.lock_queue); - dev->queue_count = 0; - dev->queue_reserved = 0; - dev->queue_slots = 0; - dev->queuelist = NULL; - dev->irq = 0; - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; - dev->last_context = 0; - dev->last_switch = 0; - dev->last_checked = 0; - init_timer(&dev->timer); - init_waitqueue_head(&dev->context_wait); -#if DRM_DMA_HISTO - memset(&dev->histo, 0, sizeof(dev->histo)); -#endif - dev->ctx_start = 0; - dev->lck_start = 0; - - dev->buf_rp = dev->buf; - dev->buf_wp = dev->buf; - dev->buf_end = dev->buf + DRM_BSZ; - dev->buf_async = NULL; - init_waitqueue_head(&dev->buf_readers); - init_waitqueue_head(&dev->buf_writers); - - DRM_DEBUG("\n"); - - /* The kernel's context could be created here, but is now created - in drm_dma_enqueue. This is more resource-efficient for - hardware that does not do DMA, but may mean that - drm_select_queue fails between the time the interrupt is - initialized and the time the queues are initialized. */ - - return 0; -} - - -static int i810_takedown(drm_device_t *dev) -{ - int i; - drm_magic_entry_t *pt, *next; - drm_map_t *map; - drm_vma_entry_t *vma, *vma_next; - - DRM_DEBUG("\n"); - - if (dev->irq) i810_irq_uninstall(dev); - - down(&dev->struct_sem); - del_timer(&dev->timer); - - if (dev->devname) { - drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); - dev->devname = NULL; - } - - if (dev->unique) { - drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); - dev->unique = NULL; - dev->unique_len = 0; - } - /* Clear pid list */ - for (i = 0; i < DRM_HASH_SIZE; i++) { - for (pt = dev->magiclist[i].head; pt; pt = next) { - next = pt->next; - drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); - } - dev->magiclist[i].head = dev->magiclist[i].tail = NULL; - } - /* Clear AGP information */ - if (dev->agp) { - drm_agp_mem_t *entry; - drm_agp_mem_t *nexte; - - /* Remove AGP resources, but leave dev->agp - intact until r128_cleanup is called. */ - for (entry = dev->agp->memory; entry; entry = nexte) { - nexte = entry->next; - if (entry->bound) drm_unbind_agp(entry->memory); - drm_free_agp(entry->memory, entry->pages); - drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); - } - dev->agp->memory = NULL; - - if (dev->agp->acquired) _drm_agp_release(); - - dev->agp->acquired = 0; - dev->agp->enabled = 0; - } - /* Clear vma list (only built for debugging) */ - if (dev->vmalist) { - for (vma = dev->vmalist; vma; vma = vma_next) { - vma_next = vma->next; - drm_free(vma, sizeof(*vma), DRM_MEM_VMAS); - } - dev->vmalist = NULL; - } - - /* Clear map area and mtrr information */ - if (dev->maplist) { - for (i = 0; i < dev->map_count; i++) { - map = dev->maplist[i]; - switch (map->type) { - case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: -#ifdef CONFIG_MTRR - if (map->mtrr >= 0) { - int retcode; - retcode = mtrr_del(map->mtrr, - map->offset, - map->size); - DRM_DEBUG("mtrr_del = %d\n", retcode); - } -#endif - drm_ioremapfree(map->handle, map->size); - break; - case _DRM_SHM: - drm_free_pages((unsigned long)map->handle, - drm_order(map->size) - - PAGE_SHIFT, - DRM_MEM_SAREA); - break; - case _DRM_AGP: - break; - } - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - } - drm_free(dev->maplist, - dev->map_count * sizeof(*dev->maplist), - DRM_MEM_MAPS); - dev->maplist = NULL; - dev->map_count = 0; - } - - if (dev->queuelist) { - for (i = 0; i < dev->queue_count; i++) { - drm_waitlist_destroy(&dev->queuelist[i]->waitlist); - if (dev->queuelist[i]) { - drm_free(dev->queuelist[i], - sizeof(*dev->queuelist[0]), - DRM_MEM_QUEUES); - dev->queuelist[i] = NULL; - } - } - drm_free(dev->queuelist, - dev->queue_slots * sizeof(*dev->queuelist), - DRM_MEM_QUEUES); - dev->queuelist = NULL; - } - - drm_dma_takedown(dev); - - dev->queue_count = 0; - if (dev->lock.hw_lock) { - dev->lock.hw_lock = NULL; /* SHM removed */ - dev->lock.pid = 0; - wake_up_interruptible(&dev->lock.lock_queue); - } - up(&dev->struct_sem); - - return 0; -} - -/* i810_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). */ - -static int __init i810_init(void) -{ - int retcode; - drm_device_t *dev = &i810_device; - - DRM_DEBUG("\n"); - - memset((void *)dev, 0, sizeof(*dev)); - dev->count_lock = SPIN_LOCK_UNLOCKED; - sema_init(&dev->struct_sem, 1); - -#ifdef MODULE - drm_parse_options(i810); -#endif - DRM_DEBUG("doing misc_register\n"); - if ((retcode = misc_register(&i810_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", I810_NAME); - return retcode; - } - dev->device = MKDEV(MISC_MAJOR, i810_misc.minor); - dev->name = I810_NAME; - - DRM_DEBUG("doing mem init\n"); - drm_mem_init(); - DRM_DEBUG("doing proc init\n"); - drm_proc_init(dev); - DRM_DEBUG("doing agp init\n"); - dev->agp = drm_agp_init(); - if(dev->agp == NULL) { - DRM_INFO("The i810 drm module requires the agpgart module" - " to function correctly\nPlease load the agpgart" - " module before you load the i810 module\n"); - drm_proc_cleanup(); - misc_deregister(&i810_misc); - i810_takedown(dev); - return -ENOMEM; - } - DRM_DEBUG("doing ctxbitmap init\n"); - if((retcode = drm_ctxbitmap_init(dev))) { - DRM_ERROR("Cannot allocate memory for context bitmap.\n"); - drm_proc_cleanup(); - misc_deregister(&i810_misc); - i810_takedown(dev); - return retcode; - } - - DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", - I810_NAME, - I810_MAJOR, - I810_MINOR, - I810_PATCHLEVEL, - I810_DATE, - i810_misc.minor); - - return 0; -} - -/* i810_cleanup is called via cleanup_module at module unload time. */ - -static void __exit i810_cleanup(void) -{ - drm_device_t *dev = &i810_device; - - DRM_DEBUG("\n"); - - drm_proc_cleanup(); - if (misc_deregister(&i810_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } - drm_ctxbitmap_cleanup(dev); - i810_takedown(dev); - if (dev->agp) { - drm_agp_uninit(); - drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); - dev->agp = NULL; - } -} - -module_init(i810_init); -module_exit(i810_cleanup); - - -int i810_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_version_t version; - int len; - - if (copy_from_user(&version, - (drm_version_t *)arg, - sizeof(version))) - return -EFAULT; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ - } - - version.version_major = I810_MAJOR; - version.version_minor = I810_MINOR; - version.version_patchlevel = I810_PATCHLEVEL; - - DRM_COPY(version.name, I810_NAME); - DRM_COPY(version.date, I810_DATE); - DRM_COPY(version.desc, I810_DESC); - - if (copy_to_user((drm_version_t *)arg, - &version, - sizeof(version))) - return -EFAULT; - return 0; -} - -int i810_open(struct inode *inode, struct file *filp) -{ - drm_device_t *dev = &i810_device; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_open_helper(inode, filp, dev))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_open); - spin_lock(&dev->count_lock); - if (!dev->open_count++) { - spin_unlock(&dev->count_lock); - return i810_setup(dev); - } - spin_unlock(&dev->count_lock); - } - return retcode; -} - -int i810_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n", - current->pid, dev->device, dev->open_count); - - if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) - && dev->lock.pid == current->pid) { - i810_reclaim_buffers(dev, priv->pid); - DRM_ERROR("Process %d dead, freeing lock for context %d\n", - current->pid, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - drm_lock_free(dev, - &dev->lock.hw_lock->lock, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - - /* FIXME: may require heavy-handed reset of - hardware at this point, possibly - processed via a callback to the X - server. */ - } else if (dev->lock.hw_lock) { - /* The lock is required to reclaim buffers */ - DECLARE_WAITQUEUE(entry, current); - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - retcode = -EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - dev->lock.pid = priv->pid; - dev->lock.lock_time = jiffies; - atomic_inc(&dev->total_locks); - break; /* Got lock */ - } - /* Contention */ - atomic_inc(&dev->total_sleeps); - schedule(); - if (signal_pending(current)) { - retcode = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - if(!retcode) { - i810_reclaim_buffers(dev, priv->pid); - drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT); - } - } - drm_fasync(-1, filp, 0); - - down(&dev->struct_sem); - if (priv->prev) priv->prev->next = priv->next; - else dev->file_first = priv->next; - if (priv->next) priv->next->prev = priv->prev; - else dev->file_last = priv->prev; - up(&dev->struct_sem); - - drm_free(priv, sizeof(*priv), DRM_MEM_FILES); -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_close); - spin_lock(&dev->count_lock); - if (!--dev->open_count) { - if (atomic_read(&dev->ioctl_count) || dev->blocked) { - DRM_ERROR("Device busy: %d %d\n", - atomic_read(&dev->ioctl_count), - dev->blocked); - spin_unlock(&dev->count_lock); - unlock_kernel(); - return -EBUSY; - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return i810_takedown(dev); - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return retcode; -} - -/* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -int i810_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - int nr = DRM_IOCTL_NR(cmd); - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int retcode = 0; - drm_ioctl_desc_t *ioctl; - drm_ioctl_t *func; - - atomic_inc(&dev->ioctl_count); - atomic_inc(&dev->total_ioctl); - ++priv->ioctl_count; - - DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", - current->pid, cmd, nr, dev->device, priv->authenticated); - - if (nr >= I810_IOCTL_COUNT) { - retcode = -EINVAL; - } else { - ioctl = &i810_ioctls[nr]; - func = ioctl->func; - - if (!func) { - DRM_DEBUG("no function\n"); - retcode = -EINVAL; - } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN)) - || (ioctl->auth_needed && !priv->authenticated)) { - retcode = -EACCES; - } else { - retcode = (func)(inode, filp, cmd, arg); - } - } - - atomic_dec(&dev->ioctl_count); - return retcode; -} - -int i810_unlock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_lock_t lock; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } - DRM_DEBUG("%d frees lock (%d holds)\n", - lock.context, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - atomic_inc(&dev->total_unlocks); - if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock)) - atomic_inc(&dev->total_contends); - drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT); - if (!dev->context_flag) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } - } -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.lhld[drm_histogram_slot(get_cycles() - - dev->lck_start)]); -#endif +#define DRIVER_AUTHOR "VA Linux Systems Inc." - unblock_all_signals(); - return 0; -} +#define DRIVER_NAME "i810" +#define DRIVER_DESC "Intel i810" +#define DRIVER_DATE "20010215" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 1 +#define DRIVER_PATCHLEVEL 0 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_INIT)] = { i810_dma_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_VERTEX)] = { i810_dma_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_CLEAR)] = { i810_clear_bufs, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_FLUSH)] = { i810_flush_ioctl, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_GETAGE)] = { i810_getage, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_GETBUF)] = { i810_getbuf, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_SWAP)] = { i810_swap_bufs, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_COPY)] = { i810_copybuf, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_I810_DOCOPY)] = { i810_docopy, 1, 0 }, + + +#define __HAVE_COUNTERS 4 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY +#define __HAVE_COUNTER9 _DRM_STAT_DMA + + +#include "drm_agpsupport.h" +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_lists.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h:1.6 Tue Sep 26 12:21:24 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/i810_drv.h Wed Mar 21 13:08:55 2001 @@ -11,11 +11,11 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL @@ -54,11 +54,12 @@ } drm_i810_ring_buffer_t; typedef struct drm_i810_private { - int ring_map_idx; - int buffer_map_idx; + drm_map_t *sarea_map; + drm_map_t *buffer_map; + drm_map_t *mmio_map; - drm_i810_ring_buffer_t ring; drm_i810_sarea_t *sarea_priv; + drm_i810_ring_buffer_t ring; unsigned long hw_status_page; unsigned long counter; @@ -67,78 +68,33 @@ wait_queue_head_t flush_queue; /* Processes waiting until flush */ drm_buf_t *mmap_buffer; - + u32 front_di1, back_di1, zi1; - + int back_offset; int depth_offset; int w, h; int pitch; } drm_i810_private_t; - /* i810_drv.c */ -extern int i810_version(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_open(struct inode *inode, struct file *filp); -extern int i810_release(struct inode *inode, struct file *filp); -extern int i810_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_unlock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - /* i810_dma.c */ extern int i810_dma_schedule(drm_device_t *dev, int locked); extern int i810_getbuf(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int i810_irq_install(drm_device_t *dev, int irq); -extern int i810_irq_uninstall(drm_device_t *dev); -extern int i810_control(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_lock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); extern int i810_dma_init(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern int i810_flush_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); extern void i810_reclaim_buffers(drm_device_t *dev, pid_t pid); -extern int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg); -extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma); -extern int i810_copybuf(struct inode *inode, struct file *filp, +extern int i810_getage(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int i810_docopy(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - - /* i810_bufs.c */ -extern int i810_addbufs(struct inode *inode, struct file *filp, +extern int i810_mmap_buffers(struct file *filp, struct vm_area_struct *vma); +extern int i810_copybuf(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); -extern int i810_infobufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_markbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_freebufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_addmap(struct inode *inode, struct file *filp, +extern int i810_docopy(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); - /* i810_context.c */ -extern int i810_resctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_addctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_modctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_getctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_switchctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_newctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int i810_rmctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -extern int i810_context_switch(drm_device_t *dev, int old, int new); -extern int i810_context_switch_complete(drm_device_t *dev, int new); +extern void i810_dma_quiescent(drm_device_t *dev); #define I810_VERBOSE 0 @@ -152,6 +108,18 @@ int i810_clear_bufs(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); + +#define I810_BASE(reg) ((unsigned long) \ + dev_priv->mmio_map->handle) +#define I810_ADDR(reg) (I810_BASE(reg) + reg) +#define I810_DEREF(reg) *(__volatile__ int *)I810_ADDR(reg) +#define I810_READ(reg) I810_DEREF(reg) +#define I810_WRITE(reg,val) do { I810_DEREF(reg) = val; } while (0) +#define I810_DEREF16(reg) *(__volatile__ u16 *)I810_ADDR(reg) +#define I810_READ16(reg) I810_DEREF16(reg) +#define I810_WRITE16(reg,val) do { I810_DEREF16(reg) = val; } while (0) + + #define GFX_OP_USER_INTERRUPT ((0<<29)|(2<<23)) #define GFX_OP_BREAKPOINT_INTERRUPT ((0<<29)|(1<<23)) #define CMD_REPORT_HEAD (7<<23) @@ -184,7 +152,7 @@ #define RING_START 0x08 #define START_ADDR 0x00FFFFF8 #define RING_LEN 0x0C -#define RING_NR_PAGES 0x000FF000 +#define RING_NR_PAGES 0x000FF000 #define RING_REPORT_MASK 0x00000006 #define RING_REPORT_64K 0x00000002 #define RING_REPORT_128K 0x00000004 @@ -222,4 +190,3 @@ #endif - Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c:1.6 Tue Sep 26 12:21:24 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/init.c Mon Jun 4 12:41:26 2001 @@ -1,113 +0,0 @@ -/* init.c -- Setup/Cleanup for DRM -*- linux-c -*- - * Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" - -int drm_flags = 0; - -/* drm_parse_option parses a single option. See description for - drm_parse_options for details. */ - -static void drm_parse_option(char *s) -{ - char *c, *r; - - DRM_DEBUG("\"%s\"\n", s); - if (!s || !*s) return; - for (c = s; *c && *c != ':'; c++); /* find : or \0 */ - if (*c) r = c + 1; else r = NULL; /* remember remainder */ - *c = '\0'; /* terminate */ - if (!strcmp(s, "noctx")) { - drm_flags |= DRM_FLAG_NOCTX; - DRM_INFO("Server-mediated context switching OFF\n"); - return; - } - if (!strcmp(s, "debug")) { - drm_flags |= DRM_FLAG_DEBUG; - DRM_INFO("Debug messages ON\n"); - return; - } - DRM_ERROR("\"%s\" is not a valid option\n", s); - return; -} - -/* drm_parse_options parse the insmod "drm=" options, or the command-line - * options passed to the kernel via LILO. The grammar of the format is as - * follows: - * - * drm ::= 'drm=' option_list - * option_list ::= option [ ';' option_list ] - * option ::= 'device:' major - * | 'debug' - * | 'noctx' - * major ::= INTEGER - * - * Note that 's' contains option_list without the 'drm=' part. - * - * device=major,minor specifies the device number used for /dev/drm - * if major == 0 then the misc device is used - * if major == 0 and minor == 0 then dynamic misc allocation is used - * debug=on specifies that debugging messages will be printk'd - * debug=trace specifies that each function call will be logged via printk - * debug=off turns off all debugging options - * - */ - -void drm_parse_options(char *s) -{ - char *h, *t, *n; - - DRM_DEBUG("\"%s\"\n", s ?: ""); - if (!s || !*s) return; - - for (h = t = n = s; h && *h; h = n) { - for (; *t && *t != ';'; t++); /* find ; or \0 */ - if (*t) n = t + 1; else n = NULL; /* remember next */ - *t = '\0'; /* terminate */ - drm_parse_option(h); /* parse */ - } -} - -/* drm_cpu_valid returns non-zero if the DRI will run on this CPU, and 0 - * otherwise. */ - -int drm_cpu_valid(void) -{ -#if defined(__i386__) - if (boot_cpu_data.x86 == 3) return 0; /* No cmpxchg on a 386 */ -#endif -#if defined(__sparc__) && !defined(__sparc_v9__) - if (1) - return 0; /* No cmpxchg before v9 sparc. */ -#endif - return 1; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c:1.6 Tue Sep 26 12:21:24 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/ioctl.c Mon Jun 4 12:41:26 2001 @@ -1,99 +0,0 @@ -/* ioctl.c -- IOCTL processing for DRM -*- linux-c -*- - * Created: Fri Jan 8 09:01:26 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" - -int drm_irq_busid(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_irq_busid_t p; - struct pci_dev *dev; - - if (copy_from_user(&p, (drm_irq_busid_t *)arg, sizeof(p))) - return -EFAULT; - dev = pci_find_slot(p.busnum, PCI_DEVFN(p.devnum, p.funcnum)); - if (dev) p.irq = dev->irq; - else p.irq = 0; - DRM_DEBUG("%d:%d:%d => IRQ %d\n", - p.busnum, p.devnum, p.funcnum, p.irq); - if (copy_to_user((drm_irq_busid_t *)arg, &p, sizeof(p))) - return -EFAULT; - return 0; -} - -int drm_getunique(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_unique_t u; - - if (copy_from_user(&u, (drm_unique_t *)arg, sizeof(u))) - return -EFAULT; - if (u.unique_len >= dev->unique_len) { - if (copy_to_user(u.unique, dev->unique, dev->unique_len)) - return -EFAULT; - } - u.unique_len = dev->unique_len; - if (copy_to_user((drm_unique_t *)arg, &u, sizeof(u))) - return -EFAULT; - return 0; -} - -int drm_setunique(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_unique_t u; - - if (dev->unique_len || dev->unique) - return -EBUSY; - - if (copy_from_user(&u, (drm_unique_t *)arg, sizeof(u))) - return -EFAULT; - - if (!u.unique_len) - return -EINVAL; - - dev->unique_len = u.unique_len; - dev->unique = drm_alloc(u.unique_len + 1, DRM_MEM_DRIVER); - if (copy_from_user(dev->unique, u.unique, dev->unique_len)) - return -EFAULT; - dev->unique[dev->unique_len] = '\0'; - - dev->devname = drm_alloc(strlen(dev->name) + strlen(dev->unique) + 2, - DRM_MEM_DRIVER); - sprintf(dev->devname, "%s@%s", dev->name, dev->unique); - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c:1.11 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c:1.11 Wed Nov 8 00:03:06 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lists.c Mon Jun 4 12:41:26 2001 @@ -1,218 +0,0 @@ -/* lists.c -- Buffer list handling routines -*- linux-c -*- - * Created: Mon Apr 19 20:54:22 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" - -int drm_waitlist_create(drm_waitlist_t *bl, int count) -{ - if (bl->count) return -EINVAL; - - bl->count = count; - bl->bufs = drm_alloc((bl->count + 2) * sizeof(*bl->bufs), - DRM_MEM_BUFLISTS); - bl->rp = bl->bufs; - bl->wp = bl->bufs; - bl->end = &bl->bufs[bl->count+1]; - bl->write_lock = SPIN_LOCK_UNLOCKED; - bl->read_lock = SPIN_LOCK_UNLOCKED; - return 0; -} - -int drm_waitlist_destroy(drm_waitlist_t *bl) -{ - if (bl->rp != bl->wp) return -EINVAL; - if (bl->bufs) drm_free(bl->bufs, - (bl->count + 2) * sizeof(*bl->bufs), - DRM_MEM_BUFLISTS); - bl->count = 0; - bl->bufs = NULL; - bl->rp = NULL; - bl->wp = NULL; - bl->end = NULL; - return 0; -} - -int drm_waitlist_put(drm_waitlist_t *bl, drm_buf_t *buf) -{ - int left; - unsigned long flags; - - left = DRM_LEFTCOUNT(bl); - if (!left) { - DRM_ERROR("Overflow while adding buffer %d from pid %d\n", - buf->idx, buf->pid); - return -EINVAL; - } -#if DRM_DMA_HISTOGRAM - buf->time_queued = get_cycles(); -#endif - buf->list = DRM_LIST_WAIT; - - spin_lock_irqsave(&bl->write_lock, flags); - *bl->wp = buf; - if (++bl->wp >= bl->end) bl->wp = bl->bufs; - spin_unlock_irqrestore(&bl->write_lock, flags); - - return 0; -} - -drm_buf_t *drm_waitlist_get(drm_waitlist_t *bl) -{ - drm_buf_t *buf; - unsigned long flags; - - spin_lock_irqsave(&bl->read_lock, flags); - buf = *bl->rp; - if (bl->rp == bl->wp) { - spin_unlock_irqrestore(&bl->read_lock, flags); - return NULL; - } - if (++bl->rp >= bl->end) bl->rp = bl->bufs; - spin_unlock_irqrestore(&bl->read_lock, flags); - - return buf; -} - -int drm_freelist_create(drm_freelist_t *bl, int count) -{ - atomic_set(&bl->count, 0); - bl->next = NULL; - init_waitqueue_head(&bl->waiting); - bl->low_mark = 0; - bl->high_mark = 0; - atomic_set(&bl->wfh, 0); - bl->lock = SPIN_LOCK_UNLOCKED; - ++bl->initialized; - return 0; -} - -int drm_freelist_destroy(drm_freelist_t *bl) -{ - atomic_set(&bl->count, 0); - bl->next = NULL; - return 0; -} - -int drm_freelist_put(drm_device_t *dev, drm_freelist_t *bl, drm_buf_t *buf) -{ - drm_device_dma_t *dma = dev->dma; - - if (!dma) { - DRM_ERROR("No DMA support\n"); - return 1; - } - - if (buf->waiting || buf->pending || buf->list == DRM_LIST_FREE) { - DRM_ERROR("Freed buffer %d: w%d, p%d, l%d\n", - buf->idx, buf->waiting, buf->pending, buf->list); - } - if (!bl) return 1; -#if DRM_DMA_HISTOGRAM - buf->time_freed = get_cycles(); - drm_histogram_compute(dev, buf); -#endif - buf->list = DRM_LIST_FREE; - - spin_lock(&bl->lock); - buf->next = bl->next; - bl->next = buf; - spin_unlock(&bl->lock); - - atomic_inc(&bl->count); - if (atomic_read(&bl->count) > dma->buf_count) { - DRM_ERROR("%d of %d buffers free after addition of %d\n", - atomic_read(&bl->count), dma->buf_count, buf->idx); - return 1; - } - /* Check for high water mark */ - if (atomic_read(&bl->wfh) && atomic_read(&bl->count)>=bl->high_mark) { - atomic_set(&bl->wfh, 0); - wake_up_interruptible(&bl->waiting); - } - return 0; -} - -static drm_buf_t *drm_freelist_try(drm_freelist_t *bl) -{ - drm_buf_t *buf; - - if (!bl) return NULL; - - /* Get buffer */ - spin_lock(&bl->lock); - if (!bl->next) { - spin_unlock(&bl->lock); - return NULL; - } - buf = bl->next; - bl->next = bl->next->next; - spin_unlock(&bl->lock); - - atomic_dec(&bl->count); - buf->next = NULL; - buf->list = DRM_LIST_NONE; - if (buf->waiting || buf->pending) { - DRM_ERROR("Free buffer %d: w%d, p%d, l%d\n", - buf->idx, buf->waiting, buf->pending, buf->list); - } - - return buf; -} - -drm_buf_t *drm_freelist_get(drm_freelist_t *bl, int block) -{ - drm_buf_t *buf = NULL; - DECLARE_WAITQUEUE(entry, current); - - if (!bl || !bl->initialized) return NULL; - - /* Check for low water mark */ - if (atomic_read(&bl->count) <= bl->low_mark) /* Became low */ - atomic_set(&bl->wfh, 1); - if (atomic_read(&bl->wfh)) { - if (block) { - add_wait_queue(&bl->waiting, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!atomic_read(&bl->wfh) - && (buf = drm_freelist_try(bl))) break; - schedule(); - if (signal_pending(current)) break; - } - current->state = TASK_RUNNING; - remove_wait_queue(&bl->waiting, &entry); - } - return buf; - } - - return drm_freelist_try(bl); -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c:1.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c:1.10 Wed Nov 8 00:03:07 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/lock.c Mon Jun 4 12:41:27 2001 @@ -1,252 +0,0 @@ -/* lock.c -- IOCTLs for locking -*- linux-c -*- - * Created: Tue Feb 2 08:37:54 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" - -int drm_block(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - DRM_DEBUG("\n"); - return 0; -} - -int drm_unblock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - DRM_DEBUG("\n"); - return 0; -} - -int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context) -{ - unsigned int old, new, prev; - - do { - old = *lock; - if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT; - else new = context | _DRM_LOCK_HELD; - prev = cmpxchg(lock, old, new); - } while (prev != old); - if (_DRM_LOCKING_CONTEXT(old) == context) { - if (old & _DRM_LOCK_HELD) { - if (context != DRM_KERNEL_CONTEXT) { - DRM_ERROR("%d holds heavyweight lock\n", - context); - } - return 0; - } - } - if (new == (context | _DRM_LOCK_HELD)) { - /* Have lock */ - return 1; - } - return 0; -} - -/* This takes a lock forcibly and hands it to context. Should ONLY be used - inside *_unlock to give lock to kernel before calling *_dma_schedule. */ -int drm_lock_transfer(drm_device_t *dev, - __volatile__ unsigned int *lock, unsigned int context) -{ - unsigned int old, new, prev; - - dev->lock.pid = 0; - do { - old = *lock; - new = context | _DRM_LOCK_HELD; - prev = cmpxchg(lock, old, new); - } while (prev != old); - return 1; -} - -int drm_lock_free(drm_device_t *dev, - __volatile__ unsigned int *lock, unsigned int context) -{ - unsigned int old, new, prev; - pid_t pid = dev->lock.pid; - - dev->lock.pid = 0; - do { - old = *lock; - new = 0; - prev = cmpxchg(lock, old, new); - } while (prev != old); - if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) { - DRM_ERROR("%d freed heavyweight lock held by %d (pid %d)\n", - context, - _DRM_LOCKING_CONTEXT(old), - pid); - return 1; - } - wake_up_interruptible(&dev->lock.lock_queue); - return 0; -} - -static int drm_flush_queue(drm_device_t *dev, int context) -{ - DECLARE_WAITQUEUE(entry, current); - int ret = 0; - drm_queue_t *q = dev->queuelist[context]; - - DRM_DEBUG("\n"); - - atomic_inc(&q->use_count); - if (atomic_read(&q->use_count) > 1) { - atomic_inc(&q->block_write); - add_wait_queue(&q->flush_queue, &entry); - atomic_inc(&q->block_count); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!DRM_BUFCOUNT(&q->waitlist)) break; - schedule(); - if (signal_pending(current)) { - ret = -EINTR; /* Can't restart */ - break; - } - } - atomic_dec(&q->block_count); - current->state = TASK_RUNNING; - remove_wait_queue(&q->flush_queue, &entry); - } - atomic_dec(&q->use_count); - atomic_inc(&q->total_flushed); - - /* NOTE: block_write is still incremented! - Use drm_flush_unlock_queue to decrement. */ - return ret; -} - -static int drm_flush_unblock_queue(drm_device_t *dev, int context) -{ - drm_queue_t *q = dev->queuelist[context]; - - DRM_DEBUG("\n"); - - atomic_inc(&q->use_count); - if (atomic_read(&q->use_count) > 1) { - if (atomic_read(&q->block_write)) { - atomic_dec(&q->block_write); - wake_up_interruptible(&q->write_queue); - } - } - atomic_dec(&q->use_count); - return 0; -} - -int drm_flush_block_and_flush(drm_device_t *dev, int context, - drm_lock_flags_t flags) -{ - int ret = 0; - int i; - - DRM_DEBUG("\n"); - - if (flags & _DRM_LOCK_FLUSH) { - ret = drm_flush_queue(dev, DRM_KERNEL_CONTEXT); - if (!ret) ret = drm_flush_queue(dev, context); - } - if (flags & _DRM_LOCK_FLUSH_ALL) { - for (i = 0; !ret && i < dev->queue_count; i++) { - ret = drm_flush_queue(dev, i); - } - } - return ret; -} - -int drm_flush_unblock(drm_device_t *dev, int context, drm_lock_flags_t flags) -{ - int ret = 0; - int i; - - DRM_DEBUG("\n"); - - if (flags & _DRM_LOCK_FLUSH) { - ret = drm_flush_unblock_queue(dev, DRM_KERNEL_CONTEXT); - if (!ret) ret = drm_flush_unblock_queue(dev, context); - } - if (flags & _DRM_LOCK_FLUSH_ALL) { - for (i = 0; !ret && i < dev->queue_count; i++) { - ret = drm_flush_unblock_queue(dev, i); - } - } - - return ret; -} - -int drm_finish(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int ret = 0; - drm_lock_t lock; - - DRM_DEBUG("\n"); - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - ret = drm_flush_block_and_flush(dev, lock.context, lock.flags); - drm_flush_unblock(dev, lock.context, lock.flags); - return ret; -} - -/* If we get here, it means that the process has called DRM_IOCTL_LOCK - without calling DRM_IOCTL_UNLOCK. - - If the lock is not held, then let the signal proceed as usual. - - If the lock is held, then set the contended flag and keep the signal - blocked. - - - Return 1 if the signal should be delivered normally. - Return 0 if the signal should be blocked. */ - -int drm_notifier(void *priv) -{ - drm_sigdata_t *s = (drm_sigdata_t *)priv; - unsigned int old, new, prev; - - - /* Allow signal delivery if lock isn't held */ - if (!_DRM_LOCK_IS_HELD(s->lock->lock) - || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) return 1; - - /* Otherwise, set flag to force call to - drmUnlock */ - do { - old = s->lock->lock; - new = old | _DRM_LOCK_CONT; - prev = cmpxchg(&s->lock->lock, old, new); - } while (prev != old); - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c:1.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c:1.10 Fri Dec 1 09:29:02 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/memory.c Mon Jun 4 12:41:27 2001 @@ -1,448 +0,0 @@ -/* memory.c -- Memory management wrappers for DRM -*- linux-c -*- - * Created: Thu Feb 4 14:00:34 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#define __NO_VERSION__ -#include <linux/config.h> -#include "drmP.h" -#include <linux/wrapper.h> - -typedef struct drm_mem_stats { - const char *name; - int succeed_count; - int free_count; - int fail_count; - unsigned long bytes_allocated; - unsigned long bytes_freed; -} drm_mem_stats_t; - -static spinlock_t drm_mem_lock = SPIN_LOCK_UNLOCKED; -static unsigned long drm_ram_available = 0; /* In pages */ -static unsigned long drm_ram_used = 0; -static drm_mem_stats_t drm_mem_stats[] = { - [DRM_MEM_DMA] = { "dmabufs" }, - [DRM_MEM_SAREA] = { "sareas" }, - [DRM_MEM_DRIVER] = { "driver" }, - [DRM_MEM_MAGIC] = { "magic" }, - [DRM_MEM_IOCTLS] = { "ioctltab" }, - [DRM_MEM_MAPS] = { "maplist" }, - [DRM_MEM_VMAS] = { "vmalist" }, - [DRM_MEM_BUFS] = { "buflist" }, - [DRM_MEM_SEGS] = { "seglist" }, - [DRM_MEM_PAGES] = { "pagelist" }, - [DRM_MEM_FILES] = { "files" }, - [DRM_MEM_QUEUES] = { "queues" }, - [DRM_MEM_CMDS] = { "commands" }, - [DRM_MEM_MAPPINGS] = { "mappings" }, - [DRM_MEM_BUFLISTS] = { "buflists" }, - [DRM_MEM_AGPLISTS] = { "agplist" }, - [DRM_MEM_TOTALAGP] = { "totalagp" }, - [DRM_MEM_BOUNDAGP] = { "boundagp" }, - [DRM_MEM_CTXBITMAP] = { "ctxbitmap"}, - { NULL, 0, } /* Last entry must be null */ -}; - -void drm_mem_init(void) -{ - drm_mem_stats_t *mem; - struct sysinfo si; - - for (mem = drm_mem_stats; mem->name; ++mem) { - mem->succeed_count = 0; - mem->free_count = 0; - mem->fail_count = 0; - mem->bytes_allocated = 0; - mem->bytes_freed = 0; - } - - si_meminfo(&si); -#if LINUX_VERSION_CODE < 0x020317 - /* Changed to page count in 2.3.23 */ - drm_ram_available = si.totalram >> PAGE_SHIFT; -#else - drm_ram_available = si.totalram; -#endif - drm_ram_used = 0; -} - -/* drm_mem_info is called whenever a process reads /dev/drm/mem. */ - -static int _drm_mem_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_mem_stats_t *pt; - - if (offset > 0) return 0; /* no partial requests */ - len = 0; - *eof = 1; - DRM_PROC_PRINT(" total counts " - " | outstanding \n"); - DRM_PROC_PRINT("type alloc freed fail bytes freed" - " | allocs bytes\n\n"); - DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", - "system", 0, 0, 0, - drm_ram_available << (PAGE_SHIFT - 10)); - DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu kB |\n", - "locked", 0, 0, 0, drm_ram_used >> 10); - DRM_PROC_PRINT("\n"); - for (pt = drm_mem_stats; pt->name; pt++) { - DRM_PROC_PRINT("%-9.9s %5d %5d %4d %10lu %10lu | %6d %10ld\n", - pt->name, - pt->succeed_count, - pt->free_count, - pt->fail_count, - pt->bytes_allocated, - pt->bytes_freed, - pt->succeed_count - pt->free_count, - (long)pt->bytes_allocated - - (long)pt->bytes_freed); - } - - return len; -} - -int drm_mem_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - int ret; - - spin_lock(&drm_mem_lock); - ret = _drm_mem_info(buf, start, offset, len, eof, data); - spin_unlock(&drm_mem_lock); - return ret; -} - -void *drm_alloc(size_t size, int area) -{ - void *pt; - - if (!size) { - DRM_MEM_ERROR(area, "Allocating 0 bytes\n"); - return NULL; - } - - if (!(pt = kmalloc(size, GFP_KERNEL))) { - spin_lock(&drm_mem_lock); - ++drm_mem_stats[area].fail_count; - spin_unlock(&drm_mem_lock); - return NULL; - } - spin_lock(&drm_mem_lock); - ++drm_mem_stats[area].succeed_count; - drm_mem_stats[area].bytes_allocated += size; - spin_unlock(&drm_mem_lock); - return pt; -} - -void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area) -{ - void *pt; - - if (!(pt = drm_alloc(size, area))) return NULL; - if (oldpt && oldsize) { - memcpy(pt, oldpt, oldsize); - drm_free(oldpt, oldsize, area); - } - return pt; -} - -char *drm_strdup(const char *s, int area) -{ - char *pt; - int length = s ? strlen(s) : 0; - - if (!(pt = drm_alloc(length+1, area))) return NULL; - strcpy(pt, s); - return pt; -} - -void drm_strfree(const char *s, int area) -{ - unsigned int size; - - if (!s) return; - - size = 1 + (s ? strlen(s) : 0); - drm_free((void *)s, size, area); -} - -void drm_free(void *pt, size_t size, int area) -{ - int alloc_count; - int free_count; - - if (!pt) DRM_MEM_ERROR(area, "Attempt to free NULL pointer\n"); - else kfree(pt); - spin_lock(&drm_mem_lock); - drm_mem_stats[area].bytes_freed += size; - free_count = ++drm_mem_stats[area].free_count; - alloc_count = drm_mem_stats[area].succeed_count; - spin_unlock(&drm_mem_lock); - if (free_count > alloc_count) { - DRM_MEM_ERROR(area, "Excess frees: %d frees, %d allocs\n", - free_count, alloc_count); - } -} - -unsigned long drm_alloc_pages(int order, int area) -{ - unsigned long address; - unsigned long bytes = PAGE_SIZE << order; - unsigned long addr; - unsigned int sz; - - spin_lock(&drm_mem_lock); - if ((drm_ram_used >> PAGE_SHIFT) - > (DRM_RAM_PERCENT * drm_ram_available) / 100) { - spin_unlock(&drm_mem_lock); - return 0; - } - spin_unlock(&drm_mem_lock); - - address = __get_free_pages(GFP_KERNEL, order); - if (!address) { - spin_lock(&drm_mem_lock); - ++drm_mem_stats[area].fail_count; - spin_unlock(&drm_mem_lock); - return 0; - } - spin_lock(&drm_mem_lock); - ++drm_mem_stats[area].succeed_count; - drm_mem_stats[area].bytes_allocated += bytes; - drm_ram_used += bytes; - spin_unlock(&drm_mem_lock); - - - /* Zero outside the lock */ - memset((void *)address, 0, bytes); - - /* Reserve */ - for (addr = address, sz = bytes; - sz > 0; - addr += PAGE_SIZE, sz -= PAGE_SIZE) { -#if LINUX_VERSION_CODE >= 0x020400 - /* Argument type changed in 2.4.0-test6/pre8 */ - mem_map_reserve(virt_to_page(addr)); -#else - mem_map_reserve(MAP_NR(addr)); -#endif - } - - return address; -} - -void drm_free_pages(unsigned long address, int order, int area) -{ - unsigned long bytes = PAGE_SIZE << order; - int alloc_count; - int free_count; - unsigned long addr; - unsigned int sz; - - if (!address) { - DRM_MEM_ERROR(area, "Attempt to free address 0\n"); - } else { - /* Unreserve */ - for (addr = address, sz = bytes; - sz > 0; - addr += PAGE_SIZE, sz -= PAGE_SIZE) { -#if LINUX_VERSION_CODE >= 0x020400 - /* Argument type changed in 2.4.0-test6/pre8 */ - mem_map_unreserve(virt_to_page(addr)); -#else - mem_map_unreserve(MAP_NR(addr)); -#endif - } - free_pages(address, order); - } - - spin_lock(&drm_mem_lock); - free_count = ++drm_mem_stats[area].free_count; - alloc_count = drm_mem_stats[area].succeed_count; - drm_mem_stats[area].bytes_freed += bytes; - drm_ram_used -= bytes; - spin_unlock(&drm_mem_lock); - if (free_count > alloc_count) { - DRM_MEM_ERROR(area, - "Excess frees: %d frees, %d allocs\n", - free_count, alloc_count); - } -} - -void *drm_ioremap(unsigned long offset, unsigned long size) -{ - void *pt; - - if (!size) { - DRM_MEM_ERROR(DRM_MEM_MAPPINGS, - "Mapping 0 bytes at 0x%08lx\n", offset); - return NULL; - } - - if (!(pt = ioremap(offset, size))) { - spin_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_MAPPINGS].fail_count; - spin_unlock(&drm_mem_lock); - return NULL; - } - spin_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_MAPPINGS].succeed_count; - drm_mem_stats[DRM_MEM_MAPPINGS].bytes_allocated += size; - spin_unlock(&drm_mem_lock); - return pt; -} - -void drm_ioremapfree(void *pt, unsigned long size) -{ - int alloc_count; - int free_count; - - if (!pt) - DRM_MEM_ERROR(DRM_MEM_MAPPINGS, - "Attempt to free NULL pointer\n"); - else - iounmap(pt); - - spin_lock(&drm_mem_lock); - drm_mem_stats[DRM_MEM_MAPPINGS].bytes_freed += size; - free_count = ++drm_mem_stats[DRM_MEM_MAPPINGS].free_count; - alloc_count = drm_mem_stats[DRM_MEM_MAPPINGS].succeed_count; - spin_unlock(&drm_mem_lock); - if (free_count > alloc_count) { - DRM_MEM_ERROR(DRM_MEM_MAPPINGS, - "Excess frees: %d frees, %d allocs\n", - free_count, alloc_count); - } -} - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) -agp_memory *drm_alloc_agp(int pages, u32 type) -{ - agp_memory *handle; - - if (!pages) { - DRM_MEM_ERROR(DRM_MEM_TOTALAGP, "Allocating 0 pages\n"); - return NULL; - } - - if ((handle = drm_agp_allocate_memory(pages, type))) { - spin_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count; - drm_mem_stats[DRM_MEM_TOTALAGP].bytes_allocated - += pages << PAGE_SHIFT; - spin_unlock(&drm_mem_lock); - return handle; - } - spin_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_TOTALAGP].fail_count; - spin_unlock(&drm_mem_lock); - return NULL; -} - -int drm_free_agp(agp_memory *handle, int pages) -{ - int alloc_count; - int free_count; - int retval = -EINVAL; - - if (!handle) { - DRM_MEM_ERROR(DRM_MEM_TOTALAGP, - "Attempt to free NULL AGP handle\n"); - return retval;; - } - - if (drm_agp_free_memory(handle)) { - spin_lock(&drm_mem_lock); - free_count = ++drm_mem_stats[DRM_MEM_TOTALAGP].free_count; - alloc_count = drm_mem_stats[DRM_MEM_TOTALAGP].succeed_count; - drm_mem_stats[DRM_MEM_TOTALAGP].bytes_freed - += pages << PAGE_SHIFT; - spin_unlock(&drm_mem_lock); - if (free_count > alloc_count) { - DRM_MEM_ERROR(DRM_MEM_TOTALAGP, - "Excess frees: %d frees, %d allocs\n", - free_count, alloc_count); - } - return 0; - } - return retval; -} - -int drm_bind_agp(agp_memory *handle, unsigned int start) -{ - int retcode = -EINVAL; - - if (!handle) { - DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, - "Attempt to bind NULL AGP handle\n"); - return retcode; - } - - if (!(retcode = drm_agp_bind_memory(handle, start))) { - spin_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; - drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_allocated - += handle->page_count << PAGE_SHIFT; - spin_unlock(&drm_mem_lock); - return retcode; - } - spin_lock(&drm_mem_lock); - ++drm_mem_stats[DRM_MEM_BOUNDAGP].fail_count; - spin_unlock(&drm_mem_lock); - return retcode; -} - -int drm_unbind_agp(agp_memory *handle) -{ - int alloc_count; - int free_count; - int retcode = -EINVAL; - - if (!handle) { - DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, - "Attempt to unbind NULL AGP handle\n"); - return retcode; - } - - if ((retcode = drm_agp_unbind_memory(handle))) return retcode; - spin_lock(&drm_mem_lock); - free_count = ++drm_mem_stats[DRM_MEM_BOUNDAGP].free_count; - alloc_count = drm_mem_stats[DRM_MEM_BOUNDAGP].succeed_count; - drm_mem_stats[DRM_MEM_BOUNDAGP].bytes_freed - += handle->page_count << PAGE_SHIFT; - spin_unlock(&drm_mem_lock); - if (free_count > alloc_count) { - DRM_MEM_ERROR(DRM_MEM_BOUNDAGP, - "Excess frees: %d frees, %d allocs\n", - free_count, alloc_count); - } - return retcode; -} -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h:1.1 --- /dev/null Mon Jun 4 12:41:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga.h Wed Mar 21 13:08:55 2001 @@ -0,0 +1,67 @@ +/* mga.h -- Matrox G200/G400 DRM template customization -*- linux-c -*- + * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __MGA_H__ +#define __MGA_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) mga_##x + +/* General customization: + */ +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 1 +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 + +/* Driver customization: + */ +#define DRIVER_PRETAKEDOWN() do { \ + if ( dev->dev_private ) mga_do_cleanup_dma( dev ); \ +} while (0) + +/* DMA customization: + */ +#define __HAVE_DMA 1 + +#define __HAVE_DMA_QUIESCENT 1 +#define DRIVER_DMA_QUIESCENT() do { \ + drm_mga_private_t *dev_priv = dev->dev_private; \ + return mga_do_wait_for_idle( dev_priv ); \ +} while (0) + +/* Buffer customization: + */ +#define DRIVER_BUF_PRIV_T drm_mga_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_mga_private_t *)((dev)->dev_private))->buffers + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c:1.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c:1.7 Fri Dec 1 09:29:02 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_bufs.c Mon Jun 4 12:41:27 2001 @@ -1,612 +0,0 @@ -/* mga_bufs.c -- IOCTLs to manage buffers -*- linux-c -*- - * Created: Thu Jan 6 01:47:26 2000 by jhartmann@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" -#include "mga_drv.h" -#include "linux/un.h" - - -int mga_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - drm_buf_entry_t *entry; - drm_buf_t *buf; - unsigned long offset; - unsigned long agp_offset; - int count; - int order; - int size; - int alignment; - int page_order; - int total; - int byte_count; - int i; - - if (!dma) return -EINVAL; - - if (copy_from_user(&request, - (drm_buf_desc_t *)arg, - sizeof(request))) - return -EFAULT; - - count = request.count; - order = drm_order(request.size); - size = 1 << order; - agp_offset = request.agp_start; - 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; - - 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); - DRM_DEBUG("byte_count: %d\n", byte_count); - - 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 = offset; /* Hrm */ - buf->bus_address = dev->agp->base + agp_offset + offset; - buf->address = (void *)(agp_offset + offset + dev->agp->base); - buf->next = NULL; - buf->waiting = 0; - buf->pending = 0; - init_waitqueue_head(&buf->dma_wait); - buf->pid = 0; - - buf->dev_private = drm_alloc(sizeof(drm_mga_buf_priv_t), - DRM_MEM_BUFS); - buf->dev_priv_size = sizeof(drm_mga_buf_priv_t); - -#if DRM_DMA_HISTOGRAM - buf->time_queued = 0; - buf->time_dispatched = 0; - buf->time_completed = 0; - buf->time_freed = 0; -#endif - offset = offset + alignment; - entry->buf_count++; - byte_count += PAGE_SIZE << page_order; - } - - dma->buflist = drm_realloc(dma->buflist, - dma->buf_count * sizeof(*dma->buflist), - (dma->buf_count + entry->buf_count) - * sizeof(*dma->buflist), - DRM_MEM_BUFS); - for (i = dma->buf_count; i < dma->buf_count + entry->buf_count; i++) - dma->buflist[i] = &entry->buflist[i - dma->buf_count]; - - dma->buf_count += entry->buf_count; - - DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count); - - dma->byte_count += byte_count; - - DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count); - - 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]); - } - - up(&dev->struct_sem); - - request.count = entry->buf_count; - request.size = size; - - if (copy_to_user((drm_buf_desc_t *)arg, - &request, - sizeof(request))) - return -EFAULT; - - atomic_dec(&dev->buf_alloc); - - 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); - DRM_DEBUG("byte_count: %d\n", byte_count); - - dma->flags = _DRM_DMA_USE_AGP; - - DRM_DEBUG("dma->flags : %x\n", dma->flags); - - return 0; -} - -int mga_addbufs_pci(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - int count; - int order; - int size; - int total; - int page_order; - drm_buf_entry_t *entry; - unsigned long page; - drm_buf_t *buf; - int alignment; - unsigned long offset; - int i; - int byte_count; - int page_count; - - if (!dma) return -EINVAL; - - if (copy_from_user(&request, - (drm_buf_desc_t *)arg, - sizeof(request))) - return -EFAULT; - - count = request.count; - order = drm_order(request.size); - size = 1 << order; - - DRM_DEBUG("count = %d, size = %d (%d), order = %d, queue_count = %d\n", - request.count, request.size, size, order, dev->queue_count); - - if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL; - if (dev->queue_count) return -EBUSY; /* Not while in use */ - - alignment = (request.flags & _DRM_PAGE_ALIGN) ? PAGE_ALIGN(size):size; - page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; - total = PAGE_SIZE << page_order; - - spin_lock(&dev->count_lock); - if (dev->buf_use) { - spin_unlock(&dev->count_lock); - return -EBUSY; - } - atomic_inc(&dev->buf_alloc); - spin_unlock(&dev->count_lock); - - down(&dev->struct_sem); - entry = &dma->bufs[order]; - if (entry->buf_count) { - up(&dev->struct_sem); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; /* May only call once for each order */ - } - - entry->buflist = drm_alloc(count * sizeof(*entry->buflist), - DRM_MEM_BUFS); - if (!entry->buflist) { - up(&dev->struct_sem); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; - } - memset(entry->buflist, 0, count * sizeof(*entry->buflist)); - - entry->seglist = drm_alloc(count * sizeof(*entry->seglist), - DRM_MEM_SEGS); - if (!entry->seglist) { - drm_free(entry->buflist, - count * sizeof(*entry->buflist), - DRM_MEM_BUFS); - up(&dev->struct_sem); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; - } - memset(entry->seglist, 0, count * sizeof(*entry->seglist)); - - dma->pagelist = drm_realloc(dma->pagelist, - dma->page_count * sizeof(*dma->pagelist), - (dma->page_count + (count << page_order)) - * sizeof(*dma->pagelist), - DRM_MEM_PAGES); - DRM_DEBUG("pagelist: %d entries\n", - dma->page_count + (count << page_order)); - - - entry->buf_size = size; - entry->page_order = page_order; - byte_count = 0; - page_count = 0; - while (entry->buf_count < count) { - if (!(page = drm_alloc_pages(page_order, DRM_MEM_DMA))) break; - entry->seglist[entry->seg_count++] = page; - for (i = 0; i < (1 << page_order); i++) { - DRM_DEBUG("page %d @ 0x%08lx\n", - dma->page_count + page_count, - page + PAGE_SIZE * i); - dma->pagelist[dma->page_count + page_count++] - = page + PAGE_SIZE * i; - } - for (offset = 0; - offset + size <= total && entry->buf_count < count; - offset += alignment, ++entry->buf_count) { - buf = &entry->buflist[entry->buf_count]; - buf->idx = dma->buf_count + entry->buf_count; - buf->total = alignment; - buf->order = order; - buf->used = 0; - buf->offset = (dma->byte_count + byte_count + offset); - buf->address = (void *)(page + offset); - buf->next = NULL; - buf->waiting = 0; - buf->pending = 0; - init_waitqueue_head(&buf->dma_wait); - buf->pid = 0; -#if DRM_DMA_HISTOGRAM - buf->time_queued = 0; - buf->time_dispatched = 0; - buf->time_completed = 0; - buf->time_freed = 0; -#endif - DRM_DEBUG("buffer %d @ %p\n", - entry->buf_count, buf->address); - } - byte_count += PAGE_SIZE << page_order; - } - - dma->buflist = drm_realloc(dma->buflist, - dma->buf_count * sizeof(*dma->buflist), - (dma->buf_count + entry->buf_count) - * sizeof(*dma->buflist), - DRM_MEM_BUFS); - for (i = dma->buf_count; i < dma->buf_count + entry->buf_count; i++) - dma->buflist[i] = &entry->buflist[i - dma->buf_count]; - - dma->buf_count += entry->buf_count; - dma->seg_count += entry->seg_count; - dma->page_count += entry->seg_count << page_order; - dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order); - - 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]); - } - - up(&dev->struct_sem); - - request.count = entry->buf_count; - request.size = size; - - if (copy_to_user((drm_buf_desc_t *)arg, - &request, - sizeof(request))) - return -EFAULT; - - atomic_dec(&dev->buf_alloc); - return 0; -} - -int mga_addbufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_buf_desc_t request; - - if (copy_from_user(&request, - (drm_buf_desc_t *)arg, - sizeof(request))) - return -EFAULT; - - if(request.flags & _DRM_AGP_BUFFER) - return mga_addbufs_agp(inode, filp, cmd, arg); - else - return mga_addbufs_pci(inode, filp, cmd, arg); -} - -int mga_infobufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_info_t request; - int i; - int count; - - if (!dma) return -EINVAL; - - spin_lock(&dev->count_lock); - if (atomic_read(&dev->buf_alloc)) { - spin_unlock(&dev->count_lock); - return -EBUSY; - } - ++dev->buf_use; /* Can't allocate more after this call */ - spin_unlock(&dev->count_lock); - - if (copy_from_user(&request, - (drm_buf_info_t *)arg, - sizeof(request))) - return -EFAULT; - - for (i = 0, count = 0; i < DRM_MAX_ORDER+1; i++) { - if (dma->bufs[i].buf_count) ++count; - } - - if (request.count >= count) { - for (i = 0, count = 0; i < DRM_MAX_ORDER+1; i++) { - if (dma->bufs[i].buf_count) { - if (copy_to_user(&request.list[count].count, - &dma->bufs[i].buf_count, - sizeof(dma->bufs[0] - .buf_count)) || - copy_to_user(&request.list[count].size, - &dma->bufs[i].buf_size, - sizeof(dma->bufs[0].buf_size)) || - copy_to_user(&request.list[count].low_mark, - &dma->bufs[i] - .freelist.low_mark, - sizeof(dma->bufs[0] - .freelist.low_mark)) || - copy_to_user(&request.list[count] - .high_mark, - &dma->bufs[i] - .freelist.high_mark, - sizeof(dma->bufs[0] - .freelist.high_mark))) - return -EFAULT; - ++count; - } - } - } - request.count = count; - - if (copy_to_user((drm_buf_info_t *)arg, - &request, - sizeof(request))) - return -EFAULT; - - return 0; -} - -int mga_markbufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - int order; - drm_buf_entry_t *entry; - - if (!dma) return -EINVAL; - - if (copy_from_user(&request, (drm_buf_desc_t *)arg, sizeof(request))) - return -EFAULT; - - order = drm_order(request.size); - if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL; - entry = &dma->bufs[order]; - - if (request.low_mark < 0 || request.low_mark > entry->buf_count) - return -EINVAL; - if (request.high_mark < 0 || request.high_mark > entry->buf_count) - return -EINVAL; - - entry->freelist.low_mark = request.low_mark; - entry->freelist.high_mark = request.high_mark; - - return 0; -} - -int mga_freebufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_free_t request; - int i; - int idx; - drm_buf_t *buf; - - if (!dma) return -EINVAL; - - if (copy_from_user(&request, - (drm_buf_free_t *)arg, - sizeof(request))) - return -EFAULT; - - for (i = 0; i < request.count; i++) { - if (copy_from_user(&idx, - &request.list[i], - sizeof(idx))) - return -EFAULT; - if (idx < 0 || idx >= dma->buf_count) { - DRM_ERROR("Index %d (of %d max)\n", - idx, dma->buf_count - 1); - return -EINVAL; - } - buf = dma->buflist[idx]; - if (buf->pid != current->pid) { - DRM_ERROR("Process %d freeing buffer owned by %d\n", - current->pid, buf->pid); - return -EINVAL; - } - drm_free_buffer(dev, buf); - } - - return 0; -} - -int mga_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - int retcode = 0; - const int zero = 0; - unsigned long virtual; - unsigned long address; - drm_buf_map_t request; - int i; - - if (!dma) return -EINVAL; - - spin_lock(&dev->count_lock); - if (atomic_read(&dev->buf_alloc)) { - spin_unlock(&dev->count_lock); - return -EBUSY; - } - ++dev->buf_use; /* Can't allocate more after this call */ - spin_unlock(&dev->count_lock); - - if (copy_from_user(&request, - (drm_buf_map_t *)arg, - sizeof(request))) - return -EFAULT; - - if (request.count >= dma->buf_count) { - if(dma->flags & _DRM_DMA_USE_AGP) { - drm_mga_private_t *dev_priv = dev->dev_private; - drm_map_t *map = NULL; - - map = dev->maplist[dev_priv->buffer_map_idx]; - if (!map) { - retcode = -EINVAL; - goto done; - } - - DRM_DEBUG("map->offset : %lx\n", map->offset); - DRM_DEBUG("map->size : %lx\n", map->size); - DRM_DEBUG("map->type : %d\n", map->type); - DRM_DEBUG("map->flags : %x\n", map->flags); - DRM_DEBUG("map->handle : %p\n", map->handle); - DRM_DEBUG("map->mtrr : %d\n", map->mtrr); - down(¤t->mm->mmap_sem); - virtual = do_mmap(filp, 0, map->size, - PROT_READ|PROT_WRITE, - MAP_SHARED, - (unsigned long)map->offset); - up(¤t->mm->mmap_sem); - } else { - down(¤t->mm->mmap_sem); - virtual = do_mmap(filp, 0, dma->byte_count, - PROT_READ|PROT_WRITE, MAP_SHARED, 0); - up(¤t->mm->mmap_sem); - } - if (virtual > -1024UL) { - /* Real error */ - DRM_DEBUG("mmap error\n"); - retcode = (signed long)virtual; - goto done; - } - request.virtual = (void *)virtual; - - for (i = 0; i < dma->buf_count; i++) { - if (copy_to_user(&request.list[i].idx, - &dma->buflist[i]->idx, - sizeof(request.list[0].idx))) { - retcode = -EFAULT; - goto done; - } - if (copy_to_user(&request.list[i].total, - &dma->buflist[i]->total, - sizeof(request.list[0].total))) { - retcode = -EFAULT; - goto done; - } - if (copy_to_user(&request.list[i].used, - &zero, - sizeof(zero))) { - retcode = -EFAULT; - goto done; - } - address = virtual + dma->buflist[i]->offset; - if (copy_to_user(&request.list[i].address, - &address, - sizeof(address))) { - retcode = -EFAULT; - goto done; - } - } - } - done: - request.count = dma->buf_count; - DRM_DEBUG("%d buffers, retcode = %d\n", request.count, retcode); - - if (copy_to_user((drm_buf_map_t *)arg, - &request, - sizeof(request))) - return -EFAULT; - - DRM_DEBUG("retcode : %d\n", retcode); - - return retcode; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c:1.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c:1.7 Wed Nov 8 00:03:07 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_context.c Mon Jun 4 12:41:27 2001 @@ -1,209 +0,0 @@ -/* mga_context.c -- IOCTLs for mga contexts -*- linux-c -*- - * Created: Mon Dec 13 09:51:35 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" -#include "mga_drv.h" - -static int mga_alloc_queue(drm_device_t *dev) -{ - return drm_ctxbitmap_next(dev); -} - -int mga_context_switch(drm_device_t *dev, int old, int new) -{ - char buf[64]; - - atomic_inc(&dev->total_ctx); - - if (test_and_set_bit(0, &dev->context_flag)) { - DRM_ERROR("Reentering -- FIXME\n"); - return -EBUSY; - } - -#if DRM_DMA_HISTOGRAM - dev->ctx_start = get_cycles(); -#endif - - DRM_DEBUG("Context switch from %d to %d\n", old, new); - - if (new == dev->last_context) { - clear_bit(0, &dev->context_flag); - return 0; - } - - if (drm_flags & DRM_FLAG_NOCTX) { - mga_context_switch_complete(dev, new); - } else { - sprintf(buf, "C %d %d\n", old, new); - drm_write_string(dev, buf); - } - - return 0; -} - -int mga_context_switch_complete(drm_device_t *dev, int new) -{ - dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ - dev->last_switch = jiffies; - - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("Lock isn't held after context switch\n"); - } - - /* If a context switch is ever initiated - when the kernel holds the lock, release - that lock here. */ -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.ctx[drm_histogram_slot(get_cycles() - - dev->ctx_start)]); - -#endif - clear_bit(0, &dev->context_flag); - wake_up(&dev->context_wait); - - return 0; -} - -int mga_resctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_res_t res; - drm_ctx_t ctx; - int i; - - if (copy_from_user(&res, (drm_ctx_res_t *)arg, sizeof(res))) - return -EFAULT; - if (res.count >= DRM_RESERVED_CONTEXTS) { - memset(&ctx, 0, sizeof(ctx)); - for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { - ctx.handle = i; - if (copy_to_user(&res.contexts[i], - &i, - sizeof(i))) - return -EFAULT; - } - } - res.count = DRM_RESERVED_CONTEXTS; - if (copy_to_user((drm_ctx_res_t *)arg, &res, sizeof(res))) - return -EFAULT; - return 0; -} - -int mga_addctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - if ((ctx.handle = mga_alloc_queue(dev)) == DRM_KERNEL_CONTEXT) { - /* Skip kernel's context and get a new one. */ - ctx.handle = mga_alloc_queue(dev); - } - if (ctx.handle == -1) { - return -ENOMEM; - } - DRM_DEBUG("%d\n", ctx.handle); - if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx))) - return -EFAULT; - return 0; -} - -int mga_modctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - /* This does nothing for the mga */ - return 0; -} - -int mga_getctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t*)arg, sizeof(ctx))) - return -EFAULT; - /* This is 0, because we don't hanlde any context flags */ - ctx.flags = 0; - if (copy_to_user((drm_ctx_t*)arg, &ctx, sizeof(ctx))) - return -EFAULT; - return 0; -} - -int mga_switchctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - return mga_context_switch(dev, dev->last_context, ctx.handle); -} - -int mga_newctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - mga_context_switch_complete(dev, ctx.handle); - - return 0; -} - -int mga_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - if(ctx.handle == DRM_KERNEL_CONTEXT+1) priv->remove_auth_on_close = 1; - - if(ctx.handle != DRM_KERNEL_CONTEXT) { - drm_ctxbitmap_free(dev, ctx.handle); - } - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c:1.8 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c:1.11 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c:1.8 Wed Nov 8 00:03:07 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_dma.c Tue Apr 10 12:08:04 2001 @@ -24,1028 +24,725 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> + * Keith Whitwell <keithw@valinux.com> * + * Rewritten by: + * Gareth Hughes <gareth@valinux.com> */ #define __NO_VERSION__ +#include "mga.h" #include "drmP.h" #include "mga_drv.h" #include <linux/interrupt.h> /* For task queue support */ +#include <linux/delay.h> -#define MGA_REG(reg) 2 -#define MGA_BASE(reg) ((unsigned long) \ - ((drm_device_t *)dev)->maplist[MGA_REG(reg)]->handle) -#define MGA_ADDR(reg) (MGA_BASE(reg) + reg) -#define MGA_DEREF(reg) *(__volatile__ int *)MGA_ADDR(reg) -#define MGA_READ(reg) MGA_DEREF(reg) -#define MGA_WRITE(reg,val) do { MGA_DEREF(reg) = val; } while (0) +#define MGA_DEFAULT_USEC_TIMEOUT 10000 +#define MGA_FREELIST_DEBUG 0 -#define PDEA_pagpxfer_enable 0x2 -static int mga_flush_queue(drm_device_t *dev); +/* ================================================================ + * Engine control + */ -static unsigned long mga_alloc_page(drm_device_t *dev) +int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ) { - unsigned long address; + u32 status = 0; + int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); - address = __get_free_page(GFP_KERNEL); - if(address == 0UL) { - return 0; + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + status = MGA_READ( MGA_STATUS ) & MGA_ENGINE_IDLE_MASK; + if ( status == MGA_ENDPRDMASTS ) { + MGA_WRITE8( MGA_CRTC_INDEX, 0 ); + return 0; + } + udelay( 1 ); } - atomic_inc(&virt_to_page(address)->count); - set_bit(PG_reserved, &virt_to_page(address)->flags); - return address; +#if MGA_DMA_DEBUG + DRM_ERROR( "failed!\n" ); + DRM_INFO( " status=0x%08x\n", status ); +#endif + return -EBUSY; } -static void mga_free_page(drm_device_t *dev, unsigned long page) +int mga_do_dma_idle( drm_mga_private_t *dev_priv ) { - if(!page) return; - atomic_dec(&virt_to_page(page)->count); - clear_bit(PG_reserved, &virt_to_page(page)->flags); - free_page(page); - return; + u32 status = 0; + int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + status = MGA_READ( MGA_STATUS ) & MGA_DMA_IDLE_MASK; + if ( status == MGA_ENDPRDMASTS ) return 0; + udelay( 1 ); + } + +#if MGA_DMA_DEBUG + DRM_ERROR( "failed! status=0x%08x\n", status ); +#endif + return -EBUSY; } -static void mga_delay(void) +int mga_do_dma_reset( drm_mga_private_t *dev_priv ) { - return; -} + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_primary_buffer_t *primary = &dev_priv->prim; -/* These are two age tags that will never be sent to - * the hardware */ -#define MGA_BUF_USED 0xffffffff -#define MGA_BUF_FREE 0 + DRM_DEBUG( "%s\n", __FUNCTION__ ); -static int mga_freelist_init(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_mga_freelist_t *item; - int i; - - dev_priv->head = drm_alloc(sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); - if(dev_priv->head == NULL) return -ENOMEM; - memset(dev_priv->head, 0, sizeof(drm_mga_freelist_t)); - dev_priv->head->age = MGA_BUF_USED; + /* The primary DMA stream should look like new right about now. + */ + primary->tail = 0; + primary->space = primary->size; + primary->last_flush = 0; - for (i = 0; i < dma->buf_count; i++) { - buf = dma->buflist[ i ]; - buf_priv = buf->dev_private; - item = drm_alloc(sizeof(drm_mga_freelist_t), - DRM_MEM_DRIVER); - if(item == NULL) return -ENOMEM; - memset(item, 0, sizeof(drm_mga_freelist_t)); - item->age = MGA_BUF_FREE; - item->prev = dev_priv->head; - item->next = dev_priv->head->next; - if(dev_priv->head->next != NULL) - dev_priv->head->next->prev = item; - if(item->next == NULL) dev_priv->tail = item; - item->buf = buf; - buf_priv->my_freelist = item; - buf_priv->discard = 0; - buf_priv->dispatched = 0; - dev_priv->head->next = item; - } + sarea_priv->last_wrap = 0; - return 0; -} + /* FIXME: Reset counters, buffer ages etc... + */ -static void mga_freelist_cleanup(drm_device_t *dev) -{ - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_mga_freelist_t *item; - drm_mga_freelist_t *prev; - - item = dev_priv->head; - while(item) { - prev = item; - item = item->next; - drm_free(prev, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER); - } + /* FIXME: What else do we need to reinitialize? WARP stuff? + */ - dev_priv->head = dev_priv->tail = NULL; + return 0; } -/* Frees dispatch lock */ -static inline void mga_dma_quiescent(drm_device_t *dev) +int mga_do_engine_reset( drm_mga_private_t *dev_priv ) { - drm_device_dma_t *dma = dev->dma; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned long end; - int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); - DRM_DEBUG("dispatch_status = 0x%02x\n", dev_priv->dispatch_status); - end = jiffies + (HZ*3); - while(1) { - if(!test_and_set_bit(MGA_IN_DISPATCH, - &dev_priv->dispatch_status)) { - break; - } - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), - atomic_read(&dma->total_lost)); - DRM_ERROR("lockup: dispatch_status = 0x%02x," - " jiffies = %lu, end = %lu\n", - dev_priv->dispatch_status, jiffies, end); - return; - } - for (i = 0 ; i < 2000 ; i++) mga_delay(); - } - end = jiffies + (HZ*3); - DRM_DEBUG("quiescent status : %x\n", MGA_READ(MGAREG_STATUS)); - while((MGA_READ(MGAREG_STATUS) & 0x00030001) != 0x00020000) { - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), - atomic_read(&dma->total_lost)); - DRM_ERROR("lockup\n"); - clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); - return; - } - for (i = 0 ; i < 2000 ; i++) mga_delay(); - } - sarea_priv->dirty |= MGA_DMA_FLUSH; + /* Okay, so we've completely screwed up and locked the engine. + * How about we clean up after ourselves? + */ + MGA_WRITE( MGA_RST, MGA_SOFTRESET ); + udelay( 15 ); /* Wait at least 10 usecs */ + MGA_WRITE( MGA_RST, 0 ); + + /* Initialize the registers that get clobbered by the soft + * reset. Many of the core register values survive a reset, + * but the drawing registers are basically all gone. + * + * 3D clients should probably die after calling this. The X + * server should reset the engine state to known values. + */ +#if 0 + MGA_WRITE( MGA_PRIMPTR, + virt_to_bus((void *)dev_priv->prim.status_page) | + MGA_PRIMPTREN0 | + MGA_PRIMPTREN1 ); +#endif - clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); - DRM_DEBUG("exit, dispatch_status = 0x%02x\n", - dev_priv->dispatch_status); -} + MGA_WRITE( MGA_ICLEAR, MGA_SOFTRAPICLR ); + MGA_WRITE( MGA_IEN, MGA_SOFTRAPIEN ); -static void mga_reset_freelist(drm_device_t *dev) -{ - drm_device_dma_t *dma = dev->dma; - drm_buf_t *buf; - drm_mga_buf_priv_t *buf_priv; - int i; + /* The primary DMA stream should look like new right about now. + */ + mga_do_dma_reset( dev_priv ); - for (i = 0; i < dma->buf_count; i++) { - buf = dma->buflist[ i ]; - buf_priv = buf->dev_private; - buf_priv->my_freelist->age = MGA_BUF_FREE; - } + /* This bad boy will never fail. + */ + return 0; } -/* Least recently used : - * These operations are not atomic b/c they are protected by the - * hardware lock */ -drm_buf_t *mga_freelist_get(drm_device_t *dev) +/* ================================================================ + * Primary DMA stream + */ + +void mga_do_dma_flush( drm_mga_private_t *dev_priv ) { - DECLARE_WAITQUEUE(entry, current); - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; - drm_mga_freelist_t *prev; - drm_mga_freelist_t *next; - static int failed = 0; - int return_null = 0; - - if(failed >= 1000 && dev_priv->tail->age >= dev_priv->last_prim_age) { - DRM_DEBUG("Waiting on freelist," - " tail->age = %d, last_prim_age= %d\n", - dev_priv->tail->age, - dev_priv->last_prim_age); - add_wait_queue(&dev_priv->buf_queue, &entry); - set_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - mga_dma_schedule(dev, 0); - if(dev_priv->tail->age < dev_priv->last_prim_age) - break; - atomic_inc(&dev->total_sleeps); - schedule(); - if (signal_pending(current)) { - ++return_null; - break; - } - } - clear_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status); - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->buf_queue, &entry); - if (return_null) return NULL; - } + drm_mga_primary_buffer_t *primary = &dev_priv->prim; + u32 head, tail; + DMA_LOCALS; + DRM_DEBUG( "%s:\n", __FUNCTION__ ); - if(dev_priv->tail->age < dev_priv->last_prim_age) { - prev = dev_priv->tail->prev; - next = dev_priv->tail; - prev->next = NULL; - next->prev = next->next = NULL; - dev_priv->tail = prev; - next->age = MGA_BUF_USED; - failed = 0; - return next->buf; + if ( primary->tail == primary->last_flush ) { + DRM_DEBUG( " bailing out...\n" ); + return; } - failed++; - return NULL; -} + tail = primary->tail + dev_priv->primary->offset; -int mga_freelist_put(drm_device_t *dev, drm_buf_t *buf) -{ - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; - drm_mga_buf_priv_t *buf_priv = buf->dev_private; - drm_mga_freelist_t *prev; - drm_mga_freelist_t *head; - drm_mga_freelist_t *next; + /* We need to pad the stream between flushes, as the card + * actually (partially?) reads the first of these commands. + * See page 4-16 in the G400 manual, middle of the page or so. + */ + BEGIN_DMA( 1 ); - if(buf_priv->my_freelist->age == MGA_BUF_USED) { - /* Discarded buffer, put it on the tail */ - next = buf_priv->my_freelist; - next->age = MGA_BUF_FREE; - prev = dev_priv->tail; - prev->next = next; - next->prev = prev; - next->next = NULL; - dev_priv->tail = next; + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + ADVANCE_DMA(); + + primary->last_flush = primary->tail; + + head = MGA_READ( MGA_PRIMADDRESS ); + + if ( head <= tail ) { + primary->space = primary->size - primary->tail; } else { - /* Normally aged buffer, put it on the head + 1, - * as the real head is a sentinal element - */ - next = buf_priv->my_freelist; - head = dev_priv->head; - prev = head->next; - head->next = next; - prev->prev = next; - next->prev = head; - next->next = prev; + primary->space = head - tail; } + + DRM_DEBUG( " head = 0x%06lx\n", head - dev_priv->primary->offset ); + DRM_DEBUG( " tail = 0x%06lx\n", tail - dev_priv->primary->offset ); + DRM_DEBUG( " space = 0x%06x\n", primary->space ); - return 0; + mga_flush_write_combine(); + MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); + + DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); } -static int mga_init_primary_bufs(drm_device_t *dev, drm_mga_init_t *init) +void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ) { - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_prim_buf_t *prim_buffer; - int i, temp, size_of_buf; - int offset = init->reserved_map_agpstart; - - dev_priv->primary_size = ((init->primary_size + PAGE_SIZE - 1) / - PAGE_SIZE) * PAGE_SIZE; - size_of_buf = dev_priv->primary_size / MGA_NUM_PRIM_BUFS; - dev_priv->warp_ucode_size = init->warp_ucode_size; - dev_priv->prim_bufs = drm_alloc(sizeof(drm_mga_prim_buf_t *) * - (MGA_NUM_PRIM_BUFS + 1), - DRM_MEM_DRIVER); - if(dev_priv->prim_bufs == NULL) { - DRM_ERROR("Unable to allocate memory for prim_buf\n"); - return -ENOMEM; - } - memset(dev_priv->prim_bufs, - 0, sizeof(drm_mga_prim_buf_t *) * (MGA_NUM_PRIM_BUFS + 1)); + drm_mga_primary_buffer_t *primary = &dev_priv->prim; + u32 head, tail; + DMA_LOCALS; + DRM_DEBUG( "%s:\n", __FUNCTION__ ); - temp = init->warp_ucode_size + dev_priv->primary_size; - temp = ((temp + PAGE_SIZE - 1) / PAGE_SIZE) * PAGE_SIZE; + BEGIN_DMA_WRAP(); - dev_priv->ioremap = drm_ioremap(dev->agp->base + offset, - temp); - if(dev_priv->ioremap == NULL) { - DRM_ERROR("Ioremap failed\n"); - return -ENOMEM; + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + ADVANCE_DMA(); + + tail = primary->tail + dev_priv->primary->offset; + + primary->tail = 0; + primary->last_flush = 0; + primary->last_wrap++; + + head = MGA_READ( MGA_PRIMADDRESS ); + + if ( head == dev_priv->primary->offset ) { + primary->space = primary->size; + } else { + primary->space = head - dev_priv->primary->offset; } - init_waitqueue_head(&dev_priv->wait_queue); - for(i = 0; i < MGA_NUM_PRIM_BUFS; i++) { - prim_buffer = drm_alloc(sizeof(drm_mga_prim_buf_t), - DRM_MEM_DRIVER); - if(prim_buffer == NULL) return -ENOMEM; - memset(prim_buffer, 0, sizeof(drm_mga_prim_buf_t)); - prim_buffer->phys_head = offset + dev->agp->base; - prim_buffer->current_dma_ptr = - prim_buffer->head = - (u32 *) (dev_priv->ioremap + - offset - - init->reserved_map_agpstart); - prim_buffer->num_dwords = 0; - prim_buffer->max_dwords = size_of_buf / sizeof(u32); - prim_buffer->max_dwords -= 5; /* Leave room for the softrap */ - prim_buffer->sec_used = 0; - prim_buffer->idx = i; - prim_buffer->prim_age = i + 1; - offset = offset + size_of_buf; - dev_priv->prim_bufs[i] = prim_buffer; - } - dev_priv->current_prim_idx = 0; - dev_priv->next_prim = - dev_priv->last_prim = - dev_priv->current_prim = - dev_priv->prim_bufs[0]; - dev_priv->next_prim_age = 2; - dev_priv->last_prim_age = 1; - set_bit(MGA_BUF_IN_USE, &dev_priv->current_prim->buffer_status); - return 0; + DRM_DEBUG( " head = 0x%06lx\n", + head - dev_priv->primary->offset ); + DRM_DEBUG( " tail = 0x%06x\n", primary->tail ); + DRM_DEBUG( " wrap = %d\n", primary->last_wrap ); + DRM_DEBUG( " space = 0x%06x\n", primary->space ); + + mga_flush_write_combine(); + MGA_WRITE( MGA_PRIMEND, tail | MGA_PAGPXFER ); + + set_bit( 0, &primary->wrapped ); + DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); } -void mga_fire_primary(drm_device_t *dev, drm_mga_prim_buf_t *prim) +void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ) { - drm_mga_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - int use_agp = PDEA_pagpxfer_enable; - unsigned long end; - int i; - int next_idx; - PRIMLOCALS; - - dev_priv->last_prim = prim; - - /* We never check for overflow, b/c there is always room */ - PRIMPTR(prim); - if(num_dwords <= 0) { - DRM_ERROR("num_dwords == 0 when dispatched\n"); - goto out_prim_wait; - } - PRIMOUTREG( MGAREG_DMAPAD, 0); - PRIMOUTREG( MGAREG_DMAPAD, 0); - PRIMOUTREG( MGAREG_DMAPAD, 0); - PRIMOUTREG( MGAREG_SOFTRAP, 0); - PRIMFINISH(prim); - - end = jiffies + (HZ*3); - if(sarea_priv->dirty & MGA_DMA_FLUSH) { - while((MGA_READ(MGAREG_STATUS) & 0x00030001) != 0x00020000) { - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), - atomic_read(&dma->total_lost)); - DRM_ERROR("lockup (flush)\n"); - goto out_prim_wait; - } + 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__ ); - for (i = 0 ; i < 4096 ; i++) mga_delay(); - } - sarea_priv->dirty &= ~(MGA_DMA_FLUSH); - } else { - while((MGA_READ(MGAREG_STATUS) & 0x00020001) != 0x00020000) { - if((signed)(end - jiffies) <= 0) { - DRM_ERROR("irqs: %d wanted %d\n", - atomic_read(&dev->total_irq), - atomic_read(&dma->total_lost)); - DRM_ERROR("lockup (wait)\n"); - goto out_prim_wait; - } + sarea_priv->last_wrap++; + DRM_DEBUG( " wrap = %d\n", sarea_priv->last_wrap ); - for (i = 0 ; i < 4096 ; i++) mga_delay(); - } - } + mga_flush_write_combine(); + MGA_WRITE( MGA_PRIMADDRESS, head | MGA_DMA_GENERAL ); - mga_flush_write_combine(); - atomic_inc(&dev_priv->pending_bufs); - MGA_WRITE(MGAREG_PRIMADDRESS, phys_head | TT_GENERAL); - MGA_WRITE(MGAREG_PRIMEND, (phys_head + num_dwords * 4) | use_agp); - prim->num_dwords = 0; - sarea_priv->last_enqueue = prim->prim_age; - - next_idx = prim->idx + 1; - if(next_idx >= MGA_NUM_PRIM_BUFS) - next_idx = 0; - - dev_priv->next_prim = dev_priv->prim_bufs[next_idx]; - return; - - out_prim_wait: - prim->num_dwords = 0; - prim->sec_used = 0; - clear_bit(MGA_BUF_IN_USE, &prim->buffer_status); - wake_up_interruptible(&dev_priv->wait_queue); - clear_bit(MGA_BUF_SWAP_PENDING, &prim->buffer_status); - clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); + clear_bit( 0, &primary->wrapped ); + DRM_DEBUG( "%s: done.\n", __FUNCTION__ ); } -int mga_advance_primary(drm_device_t *dev) + +/* ================================================================ + * Freelist management + */ + +#define MGA_BUFFER_USED ~0 +#define MGA_BUFFER_FREE 0 + +#if MGA_FREELIST_DEBUG +static void mga_freelist_print( drm_device_t *dev ) { - DECLARE_WAITQUEUE(entry, current); - drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_prim_buf_t *prim_buffer; - drm_device_dma_t *dma = dev->dma; - int next_prim_idx; - int ret = 0; - - /* This needs to reset the primary buffer if available, - * we should collect stats on how many times it bites - * it's tail */ - - next_prim_idx = dev_priv->current_prim_idx + 1; - if(next_prim_idx >= MGA_NUM_PRIM_BUFS) - next_prim_idx = 0; - prim_buffer = dev_priv->prim_bufs[next_prim_idx]; - set_bit(MGA_IN_WAIT, &dev_priv->dispatch_status); - - /* In use is cleared in interrupt handler */ - - if(test_and_set_bit(MGA_BUF_IN_USE, &prim_buffer->buffer_status)) { - add_wait_queue(&dev_priv->wait_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - mga_dma_schedule(dev, 0); - if(!test_and_set_bit(MGA_BUF_IN_USE, - &prim_buffer->buffer_status)) - break; - atomic_inc(&dev->total_sleeps); - atomic_inc(&dma->total_missed_sched); - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->wait_queue, &entry); - if(ret) return ret; - } - clear_bit(MGA_IN_WAIT, &dev_priv->dispatch_status); - - /* This primary buffer is now free to use */ - prim_buffer->current_dma_ptr = prim_buffer->head; - prim_buffer->num_dwords = 0; - prim_buffer->sec_used = 0; - prim_buffer->prim_age = dev_priv->next_prim_age++; - if(prim_buffer->prim_age == 0 || prim_buffer->prim_age == 0xffffffff) { - mga_flush_queue(dev); - mga_dma_quiescent(dev); - mga_reset_freelist(dev); - prim_buffer->prim_age = (dev_priv->next_prim_age += 2); - } - - /* Reset all buffer status stuff */ - clear_bit(MGA_BUF_NEEDS_OVERFLOW, &prim_buffer->buffer_status); - clear_bit(MGA_BUF_FORCE_FIRE, &prim_buffer->buffer_status); - clear_bit(MGA_BUF_SWAP_PENDING, &prim_buffer->buffer_status); - - dev_priv->current_prim = prim_buffer; - dev_priv->current_prim_idx = next_prim_idx; - return 0; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_freelist_t *entry; + + DRM_INFO( "\n" ); + DRM_INFO( "current dispatch: last=0x%x done=0x%x\n", + dev_priv->sarea_priv->last_dispatch, + (unsigned int)(MGA_READ( MGA_PRIMADDRESS ) - + dev_priv->primary->offset) ); + DRM_INFO( "current freelist:\n" ); + + for ( entry = dev_priv->head->next ; entry ; entry = entry->next ) { + DRM_INFO( " %p idx=%2d age=0x%x 0x%06lx\n", + entry, entry->buf->idx, entry->age.head, + entry->age.head - dev_priv->primary->offset ); + } + DRM_INFO( "\n" ); } +#endif -/* More dynamic performance decisions */ -static inline int mga_decide_to_fire(drm_device_t *dev) +static int mga_freelist_init( drm_device_t *dev ) { - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_buf_t *buf; + drm_mga_buf_priv_t *buf_priv; + drm_mga_freelist_t *entry; + int i; + DRM_DEBUG( "%s: count=%d\n", + __FUNCTION__, dma->buf_count ); - if(test_bit(MGA_BUF_FORCE_FIRE, &dev_priv->next_prim->buffer_status)) { - return 1; - } + dev_priv->head = DRM(alloc)( sizeof(drm_mga_freelist_t), + DRM_MEM_DRIVER ); + if ( dev_priv->head == NULL ) + return -ENOMEM; - if (test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) && - dev_priv->next_prim->num_dwords) { - return 1; - } + memset( dev_priv->head, 0, sizeof(drm_mga_freelist_t) ); + SET_AGE( &dev_priv->head->age, MGA_BUFFER_USED, 0 ); - if (test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) && - dev_priv->next_prim->num_dwords) { - return 1; - } + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; - if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS - 1) { - if(test_bit(MGA_BUF_SWAP_PENDING, - &dev_priv->next_prim->buffer_status)) { - return 1; - } - } + entry = DRM(alloc)( sizeof(drm_mga_freelist_t), + DRM_MEM_DRIVER ); + if ( entry == NULL ) + return -ENOMEM; + + memset( entry, 0, sizeof(drm_mga_freelist_t) ); + + entry->next = dev_priv->head->next; + entry->prev = dev_priv->head; + SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 ); + entry->buf = buf; + + if ( dev_priv->head->next != NULL ) + dev_priv->head->next->prev = entry; + if ( entry->next == NULL ) + dev_priv->tail = entry; - if(atomic_read(&dev_priv->pending_bufs) <= MGA_NUM_PRIM_BUFS / 2) { - if(dev_priv->next_prim->sec_used >= MGA_DMA_BUF_NR / 8) { - return 1; - } - } + buf_priv->list_entry = entry; + buf_priv->discard = 0; + buf_priv->dispatched = 0; - if(atomic_read(&dev_priv->pending_bufs) >= MGA_NUM_PRIM_BUFS / 2) { - if(dev_priv->next_prim->sec_used >= MGA_DMA_BUF_NR / 4) { - return 1; - } + dev_priv->head->next = entry; } - return 0; + return 0; } -int mga_dma_schedule(drm_device_t *dev, int locked) +static void mga_freelist_cleanup( drm_device_t *dev ) { - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - int retval = 0; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_freelist_t *entry; + drm_mga_freelist_t *next; + DRM_DEBUG( "%s\n", __FUNCTION__ ); - if (!dev_priv) return -EBUSY; - - if (test_and_set_bit(0, &dev->dma_flag)) { - retval = -EBUSY; - goto sch_out_wakeup; - } - - if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) || - test_bit(MGA_IN_WAIT, &dev_priv->dispatch_status) || - test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status)) { - locked = 1; - } - - if (!locked && - !drm_lock_take(&dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT)) { - clear_bit(0, &dev->dma_flag); - retval = -EBUSY; - goto sch_out_wakeup; - } - - if(!test_and_set_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status)) { - /* Fire dma buffer */ - if(mga_decide_to_fire(dev)) { - clear_bit(MGA_BUF_FORCE_FIRE, - &dev_priv->next_prim->buffer_status); - if(dev_priv->current_prim == dev_priv->next_prim) { - /* Schedule overflow for a later time */ - set_bit(MGA_BUF_NEEDS_OVERFLOW, - &dev_priv->next_prim->buffer_status); - } - mga_fire_primary(dev, dev_priv->next_prim); - } else { - clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); - } + entry = dev_priv->head; + while ( entry ) { + next = entry->next; + DRM(free)( entry, sizeof(drm_mga_freelist_t), DRM_MEM_DRIVER ); + entry = next; } - if (!locked) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } - } + dev_priv->head = dev_priv->tail = NULL; +} - clear_bit(0, &dev->dma_flag); +#if 0 +/* FIXME: Still needed? + */ +static void mga_freelist_reset( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_mga_buf_priv_t *buf_priv; + int i; -sch_out_wakeup: - if(test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status) && - atomic_read(&dev_priv->pending_bufs) == 0) { - /* Everything has been processed by the hardware */ - clear_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); - wake_up_interruptible(&dev_priv->flush_queue); + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + SET_AGE( &buf_priv->list_entry->age, + MGA_BUFFER_FREE, 0 ); } - - if(test_bit(MGA_IN_GETBUF, &dev_priv->dispatch_status) - && dev_priv->tail->age < dev_priv->last_prim_age) - wake_up_interruptible(&dev_priv->buf_queue); - - return retval; } +#endif -static void mga_dma_service(int irq, void *device, struct pt_regs *regs) +static drm_buf_t *mga_freelist_get( drm_device_t *dev ) { - drm_device_t *dev = (drm_device_t *)device; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - drm_mga_prim_buf_t *last_prim_buffer; - - atomic_inc(&dev->total_irq); - if((MGA_READ(MGAREG_STATUS) & 0x00000001) != 0x00000001) return; - MGA_WRITE(MGAREG_ICLEAR, 0x00000001); - last_prim_buffer = dev_priv->last_prim; - last_prim_buffer->num_dwords = 0; - last_prim_buffer->sec_used = 0; - dev_priv->sarea_priv->last_dispatch = - dev_priv->last_prim_age = last_prim_buffer->prim_age; - clear_bit(MGA_BUF_IN_USE, &last_prim_buffer->buffer_status); - clear_bit(MGA_BUF_SWAP_PENDING, &last_prim_buffer->buffer_status); - clear_bit(MGA_IN_DISPATCH, &dev_priv->dispatch_status); - atomic_dec(&dev_priv->pending_bufs); - queue_task(&dev->tq, &tq_immediate); - mark_bh(IMMEDIATE_BH); - wake_up_interruptible(&dev_priv->wait_queue); -} + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_freelist_t *next; + drm_mga_freelist_t *prev; + drm_mga_freelist_t *tail = dev_priv->tail; + u32 head, wrap; + DRM_DEBUG( "%s:\n", __FUNCTION__ ); + + head = MGA_READ( MGA_PRIMADDRESS ); + wrap = dev_priv->sarea_priv->last_wrap; + + DRM_DEBUG( " tail=0x%06lx %d\n", + tail->age.head ? + tail->age.head - dev_priv->primary->offset : 0, + tail->age.wrap ); + DRM_DEBUG( " head=0x%06lx %d\n", + head - dev_priv->primary->offset, wrap ); -static void mga_dma_task_queue(void *device) -{ - mga_dma_schedule((drm_device_t *)device, 0); + if ( TEST_AGE( &tail->age, head, wrap ) ) { + prev = dev_priv->tail->prev; + next = dev_priv->tail; + prev->next = NULL; + next->prev = next->next = NULL; + dev_priv->tail = prev; + SET_AGE( &next->age, MGA_BUFFER_USED, 0 ); + return next->buf; + } + + DRM_DEBUG( "returning NULL!\n" ); + return NULL; } -int mga_dma_cleanup(drm_device_t *dev) +int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ) { - if(dev->dev_private) { - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; - - if (dev->irq) mga_flush_queue(dev); - mga_dma_quiescent(dev); - - if(dev_priv->ioremap) { - int temp = (dev_priv->warp_ucode_size + - dev_priv->primary_size + - PAGE_SIZE - 1) / PAGE_SIZE * PAGE_SIZE; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_buf_priv_t *buf_priv = buf->dev_private; + drm_mga_freelist_t *head, *entry, *prev; - drm_ioremapfree((void *) dev_priv->ioremap, temp); - } - if(dev_priv->status_page != NULL) { - iounmap(dev_priv->status_page); - } - if(dev_priv->real_status_page != 0UL) { - mga_free_page(dev, dev_priv->real_status_page); - } - if(dev_priv->prim_bufs != NULL) { - int i; - for(i = 0; i < MGA_NUM_PRIM_BUFS; i++) { - if(dev_priv->prim_bufs[i] != NULL) { - drm_free(dev_priv->prim_bufs[i], - sizeof(drm_mga_prim_buf_t), - DRM_MEM_DRIVER); - } - } - drm_free(dev_priv->prim_bufs, sizeof(void *) * - (MGA_NUM_PRIM_BUFS + 1), - DRM_MEM_DRIVER); - } - if(dev_priv->head != NULL) { - mga_freelist_cleanup(dev); - } + DRM_DEBUG( "%s: age=0x%06lx wrap=%d\n", + __FUNCTION__, + buf_priv->list_entry->age.head - + dev_priv->primary->offset, + buf_priv->list_entry->age.wrap ); + entry = buf_priv->list_entry; + head = dev_priv->head; - drm_free(dev->dev_private, sizeof(drm_mga_private_t), - DRM_MEM_DRIVER); - dev->dev_private = NULL; + if ( buf_priv->list_entry->age.head == MGA_BUFFER_USED ) { + SET_AGE( &entry->age, MGA_BUFFER_FREE, 0 ); + prev = dev_priv->tail; + prev->next = entry; + entry->prev = prev; + entry->next = NULL; + } else { + prev = head->next; + head->next = entry; + prev->prev = entry; + entry->prev = head; + entry->next = prev; } return 0; } + -static int mga_dma_initialize(drm_device_t *dev, drm_mga_init_t *init) { +/* ================================================================ + * DMA initialization, cleanup + */ + +static int mga_do_init_dma( drm_device_t *dev, drm_mga_init_t *init ) +{ drm_mga_private_t *dev_priv; - drm_map_t *sarea_map = NULL; + struct list_head *list; + int ret; + DRM_DEBUG( "%s\n", __FUNCTION__ ); - dev_priv = drm_alloc(sizeof(drm_mga_private_t), DRM_MEM_DRIVER); - if(dev_priv == NULL) return -ENOMEM; - dev->dev_private = (void *) dev_priv; + dev_priv = DRM(alloc)( sizeof(drm_mga_private_t), DRM_MEM_DRIVER ); + if ( !dev_priv ) + return -ENOMEM; + dev->dev_private = (void *)dev_priv; - memset(dev_priv, 0, sizeof(drm_mga_private_t)); + memset( dev_priv, 0, sizeof(drm_mga_private_t) ); - if((init->reserved_map_idx >= dev->map_count) || - (init->buffer_map_idx >= dev->map_count)) { - mga_dma_cleanup(dev); - return -EINVAL; + dev_priv->chipset = init->chipset; + + dev_priv->usec_timeout = MGA_DEFAULT_USEC_TIMEOUT; + + if ( init->sgram ) { + dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_BLK; + } else { + dev_priv->clear_cmd = MGA_DWGCTL_CLEAR | MGA_ATYPE_RSTR; } + dev_priv->maccess = init->maccess; - dev_priv->reserved_map_idx = init->reserved_map_idx; - dev_priv->buffer_map_idx = init->buffer_map_idx; - sarea_map = dev->maplist[0]; - dev_priv->sarea_priv = (drm_mga_sarea_t *) - ((u8 *)sarea_map->handle + - init->sarea_priv_offset); + dev_priv->fb_cpp = init->fb_cpp; + dev_priv->front_offset = init->front_offset; + dev_priv->front_pitch = init->front_pitch; + dev_priv->back_offset = init->back_offset; + dev_priv->back_pitch = init->back_pitch; - /* Scale primary size to the next page */ - dev_priv->chipset = init->chipset; - dev_priv->frontOffset = init->frontOffset; - dev_priv->backOffset = init->backOffset; - dev_priv->depthOffset = init->depthOffset; - dev_priv->textureOffset = init->textureOffset; - dev_priv->textureSize = init->textureSize; - dev_priv->cpp = init->cpp; - dev_priv->sgram = init->sgram; - dev_priv->stride = init->stride; - - dev_priv->mAccess = init->mAccess; - init_waitqueue_head(&dev_priv->flush_queue); - init_waitqueue_head(&dev_priv->buf_queue); - dev_priv->WarpPipe = 0xff000000; - dev_priv->vertexsize = 0; - - DRM_DEBUG("chipset=%d ucode_size=%d backOffset=%x depthOffset=%x\n", - dev_priv->chipset, dev_priv->warp_ucode_size, - dev_priv->backOffset, dev_priv->depthOffset); - DRM_DEBUG("cpp: %d sgram: %d stride: %d maccess: %x\n", - dev_priv->cpp, dev_priv->sgram, dev_priv->stride, - dev_priv->mAccess); - - memcpy(&dev_priv->WarpIndex, &init->WarpIndex, - sizeof(drm_mga_warp_index_t) * MGA_MAX_WARP_PIPES); - - if(mga_init_primary_bufs(dev, init) != 0) { - DRM_ERROR("Can not initialize primary buffers\n"); - mga_dma_cleanup(dev); - return -ENOMEM; + dev_priv->depth_cpp = init->depth_cpp; + 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 && + entry->map->type == _DRM_SHM && + (entry->map->flags & _DRM_CONTAINS_LOCK) ) { + dev_priv->sarea = entry->map; + break; + } + } + + DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + DRM_FIND_MAP( dev_priv->status, init->status_offset ); + + DRM_FIND_MAP( dev_priv->warp, init->warp_offset ); + DRM_FIND_MAP( dev_priv->primary, init->primary_offset ); + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + + dev_priv->sarea_priv = + (drm_mga_sarea_t *)((u8 *)dev_priv->sarea->handle + + init->sarea_priv_offset); + + DRM_IOREMAP( dev_priv->warp ); + DRM_IOREMAP( dev_priv->primary ); + DRM_IOREMAP( dev_priv->buffers ); + + ret = mga_warp_install_microcode( dev ); + if ( ret < 0 ) { + DRM_ERROR( "failed to install WARP ucode!\n" ); + mga_do_cleanup_dma( dev ); + return ret; } - dev_priv->real_status_page = mga_alloc_page(dev); - if(dev_priv->real_status_page == 0UL) { - mga_dma_cleanup(dev); - DRM_ERROR("Can not allocate status page\n"); - return -ENOMEM; + + ret = mga_warp_init( dev ); + if ( ret < 0 ) { + DRM_ERROR( "failed to init WARP engine!\n" ); + mga_do_cleanup_dma( dev ); + return ret; } - dev_priv->status_page = - ioremap_nocache(virt_to_bus((void *)dev_priv->real_status_page), - PAGE_SIZE); - - if(dev_priv->status_page == NULL) { - mga_dma_cleanup(dev); - DRM_ERROR("Can not remap status page\n"); + dev_priv->prim.status = (u32 *)dev_priv->status->handle; + + mga_do_wait_for_idle( dev_priv ); + + /* Init the primary DMA registers. + */ + MGA_WRITE( MGA_PRIMADDRESS, + dev_priv->primary->offset | MGA_DMA_GENERAL ); +#if 0 + MGA_WRITE( MGA_PRIMPTR, + virt_to_bus((void *)dev_priv->prim.status) | + MGA_PRIMPTREN0 | /* Soft trap, SECEND, SETUPEND */ + MGA_PRIMPTREN1 ); /* DWGSYNC */ +#endif + + dev_priv->prim.start = (u8 *)dev_priv->primary->handle; + dev_priv->prim.end = ((u8 *)dev_priv->primary->handle + + dev_priv->primary->size); + dev_priv->prim.size = dev_priv->primary->size; + + 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; + + dev_priv->prim.high_mark = 256 * DMA_BLOCK_SIZE; + + spin_lock_init( &dev_priv->prim.list_lock ); + + dev_priv->prim.status[0] = dev_priv->primary->offset; + dev_priv->prim.status[1] = 0; + + dev_priv->sarea_priv->last_wrap = 0; + dev_priv->sarea_priv->last_frame.head = 0; + dev_priv->sarea_priv->last_frame.wrap = 0; + + if ( mga_freelist_init( dev ) < 0 ) { + DRM_ERROR( "could not initialize freelist\n" ); + mga_do_cleanup_dma( dev ); return -ENOMEM; } - - /* Write status page when secend or softrap occurs */ - MGA_WRITE(MGAREG_PRIMPTR, - virt_to_bus((void *)dev_priv->real_status_page) | 0x00000003); + return 0; +} - /* Private is now filled in, initialize the hardware */ - { - PRIMLOCALS; - PRIMGETPTR( dev_priv ); +int mga_do_cleanup_dma( drm_device_t *dev ) +{ + DRM_DEBUG( "%s\n", __FUNCTION__ ); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGSYNC, 0x0100); - PRIMOUTREG(MGAREG_SOFTRAP, 0); - /* Poll for the first buffer to insure that - * the status register will be correct - */ + if ( dev->dev_private ) { + drm_mga_private_t *dev_priv = dev->dev_private; - mga_flush_write_combine(); - MGA_WRITE(MGAREG_PRIMADDRESS, phys_head | TT_GENERAL); + DRM_IOREMAPFREE( dev_priv->warp ); + DRM_IOREMAPFREE( dev_priv->primary ); + DRM_IOREMAPFREE( dev_priv->buffers ); - MGA_WRITE(MGAREG_PRIMEND, ((phys_head + num_dwords * 4) | - PDEA_pagpxfer_enable)); + if ( dev_priv->head != NULL ) { + mga_freelist_cleanup( dev ); + } - while(MGA_READ(MGAREG_DWGSYNC) != 0x0100) ; + DRM(free)( dev->dev_private, sizeof(drm_mga_private_t), + DRM_MEM_DRIVER ); + dev->dev_private = NULL; } - if(mga_freelist_init(dev) != 0) { - DRM_ERROR("Could not initialize freelist\n"); - mga_dma_cleanup(dev); - return -ENOMEM; - } return 0; } -int mga_dma_init(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_init( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_mga_init_t init; - if (copy_from_user(&init, (drm_mga_init_t *)arg, sizeof(init))) + if ( copy_from_user( &init, (drm_mga_init_t *)arg, sizeof(init) ) ) return -EFAULT; - switch(init.func) { + switch ( init.func ) { case MGA_INIT_DMA: - return mga_dma_initialize(dev, &init); + return mga_do_init_dma( dev, &init ); case MGA_CLEANUP_DMA: - return mga_dma_cleanup(dev); + return mga_do_cleanup_dma( dev ); } return -EINVAL; } -int mga_irq_install(drm_device_t *dev, int irq) -{ - int retcode; - - if (!irq) return -EINVAL; - down(&dev->struct_sem); - if (dev->irq) { - up(&dev->struct_sem); - return -EBUSY; - } - dev->irq = irq; - up(&dev->struct_sem); - - DRM_DEBUG("install irq handler %d\n", irq); - - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; - dev->dma->next_buffer = NULL; - dev->dma->next_queue = NULL; - dev->dma->this_buffer = NULL; - dev->tq.next = NULL; - dev->tq.sync = 0; - dev->tq.routine = mga_dma_task_queue; - dev->tq.data = dev; - - /* Before installing handler */ - MGA_WRITE(MGAREG_IEN, 0); - /* Install handler */ - if ((retcode = request_irq(dev->irq, - mga_dma_service, - SA_SHIRQ, - dev->devname, - dev))) { - down(&dev->struct_sem); - dev->irq = 0; - up(&dev->struct_sem); - return retcode; - } - /* After installing handler */ - MGA_WRITE(MGAREG_ICLEAR, 0x00000001); - MGA_WRITE(MGAREG_IEN, 0x00000001); - return 0; -} +/* ================================================================ + * Primary DMA stream management + */ -int mga_irq_uninstall(drm_device_t *dev) +int mga_dma_flush( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) { - int irq; - - down(&dev->struct_sem); - irq = dev->irq; - dev->irq = 0; - up(&dev->struct_sem); - - if (!irq) return -EINVAL; - DRM_DEBUG("remove irq handler %d\n", irq); - MGA_WRITE(MGAREG_ICLEAR, 0x00000001); - MGA_WRITE(MGAREG_IEN, 0); - free_irq(irq, dev); - return 0; -} + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + drm_lock_t lock; -int mga_control(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_control_t ctl; + LOCK_TEST_WITH_RETURN( dev ); - if (copy_from_user(&ctl, (drm_control_t *)arg, sizeof(ctl))) + if ( copy_from_user( &lock, (drm_lock_t *)arg, sizeof(lock) ) ) return -EFAULT; - switch (ctl.func) { - case DRM_INST_HANDLER: - return mga_irq_install(dev, ctl.irq); - case DRM_UNINST_HANDLER: - return mga_irq_uninstall(dev); - default: - return -EINVAL; + DRM_DEBUG( "%s: %s%s%s\n", + __FUNCTION__, + (lock.flags & _DRM_LOCK_FLUSH) ? "flush, " : "", + (lock.flags & _DRM_LOCK_FLUSH_ALL) ? "flush all, " : "", + (lock.flags & _DRM_LOCK_QUIESCENT) ? "idle, " : "" ); + + WRAP_WAIT_WITH_RETURN( dev_priv ); + + if ( lock.flags & (_DRM_LOCK_FLUSH | _DRM_LOCK_FLUSH_ALL) ) { + mga_do_dma_flush( dev_priv ); + } + + 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; } } -static int mga_flush_queue(drm_device_t *dev) +int mga_dma_reset( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) { - DECLARE_WAITQUEUE(entry, current); - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; - int ret = 0; - - if(!dev_priv) return 0; - - if(dev_priv->next_prim->num_dwords != 0) { - add_wait_queue(&dev_priv->flush_queue, &entry); - if (test_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status)) - DRM_ERROR("Incorrect mga_flush_queue logic\n"); - set_bit(MGA_IN_FLUSH, &dev_priv->dispatch_status); - mga_dma_schedule(dev, 0); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!test_bit(MGA_IN_FLUSH, - &dev_priv->dispatch_status)) - break; - atomic_inc(&dev->total_sleeps); - schedule(); - if (signal_pending(current)) { - ret = -EINTR; /* Can't restart */ - clear_bit(MGA_IN_FLUSH, - &dev_priv->dispatch_status); - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev_priv->flush_queue, &entry); - } - return ret; -} + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; -/* Must be called with the lock held */ -void mga_reclaim_buffers(drm_device_t *dev, pid_t pid) -{ - drm_device_dma_t *dma = dev->dma; - int i; + LOCK_TEST_WITH_RETURN( dev ); - if (!dma) return; - if(dev->dev_private == NULL) return; - if(dma->buflist == NULL) return; - - DRM_DEBUG("buf_count=%d\n", dma->buf_count); - - mga_flush_queue(dev); - - for (i = 0; i < dma->buf_count; i++) { - drm_buf_t *buf = dma->buflist[ i ]; - drm_mga_buf_priv_t *buf_priv = buf->dev_private; - - /* Only buffers that need to get reclaimed ever - * get set to free - */ - if (buf->pid == pid && buf_priv) { - if(buf_priv->my_freelist->age == MGA_BUF_USED) - buf_priv->my_freelist->age = MGA_BUF_FREE; - } - } + return mga_do_dma_reset( dev_priv ); } -int mga_lock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - DECLARE_WAITQUEUE(entry, current); - int ret = 0; - drm_lock_t lock; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } +/* ================================================================ + * DMA buffer management + */ - if (lock.context < 0) return -EINVAL; +static int mga_dma_get_buffers( drm_device_t *dev, drm_dma_t *d ) +{ + drm_buf_t *buf; + int i; - /* Only one queue: - */ + for ( i = d->granted_count ; i < d->request_count ; i++ ) { + buf = mga_freelist_get( dev ); + if ( !buf ) return -EAGAIN; + + buf->pid = current->pid; + + if ( copy_to_user( &d->request_indices[i], + &buf->idx, sizeof(buf->idx) ) ) + return -EFAULT; + if ( copy_to_user( &d->request_sizes[i], + &buf->total, sizeof(buf->total) ) ) + return -EFAULT; - if (!ret) { - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - ret = -EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - lock.context)) { - dev->lock.pid = current->pid; - dev->lock.lock_time = jiffies; - atomic_inc(&dev->total_locks); - break; /* Got lock */ - } - - /* Contention */ - atomic_inc(&dev->total_sleeps); - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); + d->granted_count++; } - - if (!ret) { - sigemptyset(&dev->sigmask); - sigaddset(&dev->sigmask, SIGSTOP); - sigaddset(&dev->sigmask, SIGTSTP); - sigaddset(&dev->sigmask, SIGTTIN); - sigaddset(&dev->sigmask, SIGTTOU); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); - - if (lock.flags & _DRM_LOCK_QUIESCENT) { - DRM_DEBUG("_DRM_LOCK_QUIESCENT\n"); - mga_flush_queue(dev); - mga_dma_quiescent(dev); - } - } - - if (ret) DRM_DEBUG("%d %s\n", lock.context, - ret ? "interrupted" : "has lock"); - return ret; + return 0; } -int mga_flush_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_buffers( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) { - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_lock_t lock; - drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = (drm_mga_private_t *)dev->dev_private; + drm_dma_t d; + int ret = 0; - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) + LOCK_TEST_WITH_RETURN( dev ); + + if ( copy_from_user( &d, (drm_dma_t *)arg, sizeof(d) ) ) return -EFAULT; - if(!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("lock not held\n"); + /* Please don't send us buffers. + */ + if ( d.send_count != 0 ) { + DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", + current->pid, d.send_count ); return -EINVAL; } - if(lock.flags & _DRM_LOCK_FLUSH || lock.flags & _DRM_LOCK_FLUSH_ALL) { - drm_mga_prim_buf_t *temp_buf; + /* We'll send you buffers. + */ + if ( d.request_count < 0 || d.request_count > dma->buf_count ) { + DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", + current->pid, d.request_count, dma->buf_count ); + return -EINVAL; + } - temp_buf = dev_priv->current_prim; + WRAP_TEST_WITH_RETURN( dev_priv ); - if(temp_buf && temp_buf->num_dwords) { - set_bit(MGA_BUF_FORCE_FIRE, &temp_buf->buffer_status); - mga_advance_primary(dev); - } - mga_dma_schedule(dev, 1); - } - if(lock.flags & _DRM_LOCK_QUIESCENT) { - mga_flush_queue(dev); - mga_dma_quiescent(dev); + d.granted_count = 0; + + if ( d.request_count ) { + ret = mga_dma_get_buffers( dev, &d ); } - return 0; + if ( copy_to_user( (drm_dma_t *)arg, &d, sizeof(d) ) ) + return -EFAULT; + + return ret; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h:1.4 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h:1.7 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h:1.4 Tue Sep 26 12:21:24 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drm.h Tue Apr 10 12:08:05 2001 @@ -11,197 +11,178 @@ * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: - * + * * The above copyright notice and this permission notice (including the next * paragraph) shall be included in all copies or substantial portions of the * Software. - * + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * Authors: Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> + * Authors: + * Jeff Hartmann <jhartmann@valinux.com> + * Keith Whitwell <keithw@valinux.com> * + * Rewritten by: + * Gareth Hughes <gareth@valinux.com> */ -#ifndef _MGA_DRM_H_ -#define _MGA_DRM_H_ +#ifndef __MGA_DRM_H__ +#define __MGA_DRM_H__ /* WARNING: If you change any of these defines, make sure to change the - * defines in the Xserver file (xf86drmMga.h) + * defines in the Xserver file (mga_sarea.h) */ -#ifndef _MGA_DEFINES_ -#define _MGA_DEFINES_ +#ifndef __MGA_SAREA_DEFINES__ +#define __MGA_SAREA_DEFINES__ -#define MGA_F 0x1 /* fog */ -#define MGA_A 0x2 /* alpha */ -#define MGA_S 0x4 /* specular */ -#define MGA_T2 0x8 /* multitexture */ - -#define MGA_WARP_TGZ 0 -#define MGA_WARP_TGZF (MGA_F) -#define MGA_WARP_TGZA (MGA_A) -#define MGA_WARP_TGZAF (MGA_F|MGA_A) -#define MGA_WARP_TGZS (MGA_S) -#define MGA_WARP_TGZSF (MGA_S|MGA_F) -#define MGA_WARP_TGZSA (MGA_S|MGA_A) -#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) -#define MGA_WARP_T2GZ (MGA_T2) -#define MGA_WARP_T2GZF (MGA_T2|MGA_F) -#define MGA_WARP_T2GZA (MGA_T2|MGA_A) -#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) -#define MGA_WARP_T2GZS (MGA_T2|MGA_S) -#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) -#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) -#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) - -#define MGA_MAX_G400_PIPES 16 -#define MGA_MAX_G200_PIPES 8 /* no multitex */ -#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES - -#define MGA_CARD_TYPE_G200 1 -#define MGA_CARD_TYPE_G400 2 - -#define MGA_FRONT 0x1 -#define MGA_BACK 0x2 -#define MGA_DEPTH 0x4 - -/* 3d state excluding texture units: - */ -#define MGA_CTXREG_DSTORG 0 /* validated */ -#define MGA_CTXREG_MACCESS 1 -#define MGA_CTXREG_PLNWT 2 -#define MGA_CTXREG_DWGCTL 3 -#define MGA_CTXREG_ALPHACTRL 4 -#define MGA_CTXREG_FOGCOLOR 5 -#define MGA_CTXREG_WFLAG 6 -#define MGA_CTXREG_TDUAL0 7 -#define MGA_CTXREG_TDUAL1 8 -#define MGA_CTXREG_FCOL 9 -#define MGA_CTXREG_STENCIL 10 -#define MGA_CTXREG_STENCILCTL 11 -#define MGA_CTX_SETUP_SIZE 12 - -/* 2d state - */ -#define MGA_2DREG_PITCH 0 -#define MGA_2D_SETUP_SIZE 1 - -/* Each texture unit has a state: - */ -#define MGA_TEXREG_CTL 0 -#define MGA_TEXREG_CTL2 1 -#define MGA_TEXREG_FILTER 2 -#define MGA_TEXREG_BORDERCOL 3 -#define MGA_TEXREG_ORG 4 /* validated */ -#define MGA_TEXREG_ORG1 5 -#define MGA_TEXREG_ORG2 6 -#define MGA_TEXREG_ORG3 7 -#define MGA_TEXREG_ORG4 8 -#define MGA_TEXREG_WIDTH 9 -#define MGA_TEXREG_HEIGHT 10 -#define MGA_TEX_SETUP_SIZE 11 +/* WARP pipe flags + */ +#define MGA_F 0x1 /* fog */ +#define MGA_A 0x2 /* alpha */ +#define MGA_S 0x4 /* specular */ +#define MGA_T2 0x8 /* multitexture */ + +#define MGA_WARP_TGZ 0 +#define MGA_WARP_TGZF (MGA_F) +#define MGA_WARP_TGZA (MGA_A) +#define MGA_WARP_TGZAF (MGA_F|MGA_A) +#define MGA_WARP_TGZS (MGA_S) +#define MGA_WARP_TGZSF (MGA_S|MGA_F) +#define MGA_WARP_TGZSA (MGA_S|MGA_A) +#define MGA_WARP_TGZSAF (MGA_S|MGA_F|MGA_A) +#define MGA_WARP_T2GZ (MGA_T2) +#define MGA_WARP_T2GZF (MGA_T2|MGA_F) +#define MGA_WARP_T2GZA (MGA_T2|MGA_A) +#define MGA_WARP_T2GZAF (MGA_T2|MGA_A|MGA_F) +#define MGA_WARP_T2GZS (MGA_T2|MGA_S) +#define MGA_WARP_T2GZSF (MGA_T2|MGA_S|MGA_F) +#define MGA_WARP_T2GZSA (MGA_T2|MGA_S|MGA_A) +#define MGA_WARP_T2GZSAF (MGA_T2|MGA_S|MGA_F|MGA_A) + +#define MGA_MAX_G200_PIPES 8 /* no multitex */ +#define MGA_MAX_G400_PIPES 16 +#define MGA_MAX_WARP_PIPES MGA_MAX_G400_PIPES +#define MGA_WARP_UCODE_SIZE 32768 /* in bytes */ + +#define MGA_CARD_TYPE_G200 1 +#define MGA_CARD_TYPE_G400 2 + + +#define MGA_FRONT 0x1 +#define MGA_BACK 0x2 +#define MGA_DEPTH 0x4 /* What needs to be changed for the current vertex dma buffer? */ -#define MGA_UPLOAD_CTX 0x1 -#define MGA_UPLOAD_TEX0 0x2 -#define MGA_UPLOAD_TEX1 0x4 -#define MGA_UPLOAD_PIPE 0x8 -#define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ -#define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ -#define MGA_UPLOAD_2D 0x40 -#define MGA_WAIT_AGE 0x80 /* handled client-side */ -#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ -#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock - quiescent */ +#define MGA_UPLOAD_CONTEXT 0x1 +#define MGA_UPLOAD_TEX0 0x2 +#define MGA_UPLOAD_TEX1 0x4 +#define MGA_UPLOAD_PIPE 0x8 +#define MGA_UPLOAD_TEX0IMAGE 0x10 /* handled client-side */ +#define MGA_UPLOAD_TEX1IMAGE 0x20 /* handled client-side */ +#define MGA_UPLOAD_2D 0x40 +#define MGA_WAIT_AGE 0x80 /* handled client-side */ +#define MGA_UPLOAD_CLIPRECTS 0x100 /* handled client-side */ +#if 0 +#define MGA_DMA_FLUSH 0x200 /* set when someone gets the lock + quiescent */ +#endif /* 32 buffers of 64k each, total 2 meg. */ -#define MGA_DMA_BUF_ORDER 16 -#define MGA_DMA_BUF_SZ (1<<MGA_DMA_BUF_ORDER) -#define MGA_DMA_BUF_NR 31 +#define MGA_BUFFER_SIZE (1 << 16) +#define MGA_NUM_BUFFERS 128 /* Keep these small for testing. */ -#define MGA_NR_SAREA_CLIPRECTS 8 +#define MGA_NR_SAREA_CLIPRECTS 8 /* 2 heaps (1 for card, 1 for agp), each divided into upto 128 - * regions, subject to a minimum region size of (1<<16) == 64k. + * regions, subject to a minimum region size of (1<<16) == 64k. * * Clients may subdivide regions internally, but when sharing between - * clients, the region size is the minimum granularity. + * clients, the region size is the minimum granularity. */ -#define MGA_CARD_HEAP 0 -#define MGA_AGP_HEAP 1 -#define MGA_NR_TEX_HEAPS 2 -#define MGA_NR_TEX_REGIONS 16 -#define MGA_LOG_MIN_TEX_REGION_SIZE 16 -#endif +#define MGA_CARD_HEAP 0 +#define MGA_AGP_HEAP 1 +#define MGA_NR_TEX_HEAPS 2 +#define MGA_NR_TEX_REGIONS 16 +#define MGA_LOG_MIN_TEX_REGION_SIZE 16 -typedef struct _drm_mga_warp_index { - int installed; - unsigned long phys_addr; - int size; -} drm_mga_warp_index_t; +#endif /* __MGA_SAREA_DEFINES__ */ -typedef struct drm_mga_init { - enum { - MGA_INIT_DMA = 0x01, - MGA_CLEANUP_DMA = 0x02 - } func; - int reserved_map_agpstart; - int reserved_map_idx; - int buffer_map_idx; - int sarea_priv_offset; - int primary_size; - int warp_ucode_size; - unsigned int frontOffset; - unsigned int backOffset; - unsigned int depthOffset; - unsigned int textureOffset; - unsigned int textureSize; - unsigned int agpTextureOffset; - unsigned int agpTextureSize; - unsigned int cpp; - unsigned int stride; - int sgram; - int chipset; - drm_mga_warp_index_t WarpIndex[MGA_MAX_WARP_PIPES]; - unsigned int mAccess; -} drm_mga_init_t; + +/* Setup registers for 3D context + */ +typedef struct { + unsigned int dstorg; + unsigned int maccess; + unsigned int plnwt; + unsigned int dwgctl; + unsigned int alphactrl; + unsigned int fogcolor; + unsigned int wflag; + unsigned int tdualstage0; + unsigned int tdualstage1; + unsigned int fcol; + unsigned int stencil; + unsigned int stencilctl; +} drm_mga_context_regs_t; + +/* Setup registers for 2D, X server + */ +typedef struct { + unsigned int pitch; +} drm_mga_server_regs_t; -/* Warning: if you change the sarea structure, you must change the Xserver - * structures as well */ +/* Setup registers for each texture unit + */ +typedef struct { + unsigned int texctl; + unsigned int texctl2; + unsigned int texfilter; + unsigned int texbordercol; + unsigned int texorg; + unsigned int texwidth; + unsigned int texheight; + unsigned int texorg1; + unsigned int texorg2; + unsigned int texorg3; + unsigned int texorg4; +} drm_mga_texture_regs_t; -typedef struct _drm_mga_tex_region { - unsigned char next, prev; - unsigned char in_use; - unsigned int age; -} drm_mga_tex_region_t; +/* General aging mechanism + */ +typedef struct { + unsigned int head; /* Position of head pointer */ + unsigned int wrap; /* Primary DMA wrap count */ +} drm_mga_age_t; typedef struct _drm_mga_sarea { /* The channel for communication of state information to the kernel * on firing a vertex dma buffer. */ - unsigned int ContextState[MGA_CTX_SETUP_SIZE]; - unsigned int ServerState[MGA_2D_SETUP_SIZE]; - unsigned int TexState[2][MGA_TEX_SETUP_SIZE]; - unsigned int WarpPipe; + drm_mga_context_regs_t context_state; + drm_mga_server_regs_t server_state; + drm_mga_texture_regs_t tex_state[2]; + unsigned int warp_pipe; unsigned int dirty; + unsigned int vertsize; - unsigned int nbox; + /* The current cliprects, or a subset thereof. + */ drm_clip_rect_t boxes[MGA_NR_SAREA_CLIPRECTS]; - + unsigned int nbox; /* Information about the most recently used 3d drawable. The - * client fills in the req_* fields, the server fills in the + * client fills in the req_* fields, the server fills in the * exported_ fields and puts the cliprects into boxes, above. * * The client clears the exported_drawable field before @@ -210,65 +191,120 @@ unsigned int req_drawable; /* the X drawable id */ unsigned int req_draw_buffer; /* MGA_FRONT or MGA_BACK */ - unsigned int exported_drawable; - unsigned int exported_index; - unsigned int exported_stamp; - unsigned int exported_buffers; + unsigned int exported_drawable; + unsigned int exported_index; + unsigned int exported_stamp; + unsigned int exported_buffers; unsigned int exported_nfront; unsigned int exported_nback; - int exported_back_x, exported_front_x, exported_w; + int exported_back_x, exported_front_x, exported_w; int exported_back_y, exported_front_y, exported_h; drm_clip_rect_t exported_boxes[MGA_NR_SAREA_CLIPRECTS]; - + /* Counters for aging textures and for client-side throttling. */ + unsigned int status[4]; + unsigned int last_wrap; + + drm_mga_age_t last_frame; unsigned int last_enqueue; /* last time a buffer was enqueued */ unsigned int last_dispatch; /* age of the most recently dispatched buffer */ unsigned int last_quiescent; /* */ - - /* LRU lists for texture memory in agp space and on the card + /* LRU lists for texture memory in agp space and on the card. */ - drm_mga_tex_region_t texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1]; + drm_tex_region_t texList[MGA_NR_TEX_HEAPS][MGA_NR_TEX_REGIONS+1]; unsigned int texAge[MGA_NR_TEX_HEAPS]; - + /* Mechanism to validate card state. */ int ctxOwner; - int vertexsize; -} drm_mga_sarea_t; +} drm_mga_sarea_t; -/* Device specific ioctls: + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (xf86drmMga.h) */ -typedef struct _drm_mga_clear { +typedef struct _drm_mga_warp_index { + int installed; + unsigned long phys_addr; + int size; +} drm_mga_warp_index_t; + +typedef struct drm_mga_init { + enum { + MGA_INIT_DMA = 0x01, + MGA_CLEANUP_DMA = 0x02 + } func; + + unsigned long sarea_priv_offset; + + int chipset; + int sgram; + + unsigned int maccess; + + unsigned int fb_cpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + + unsigned int depth_cpp; + unsigned int depth_offset, depth_pitch; + + unsigned int texture_offset[MGA_NR_TEX_HEAPS]; + unsigned int texture_size[MGA_NR_TEX_HEAPS]; + + unsigned 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 { + enum { + MGA_INIT_FULLSCREEN = 0x01, + MGA_CLEANUP_FULLSCREEN = 0x02 + } func; +} drm_mga_fullscreen_t; + +typedef struct drm_mga_clear { + unsigned int flags; unsigned int clear_color; unsigned int clear_depth; - unsigned int flags; - unsigned int clear_depth_mask; - unsigned int clear_color_mask; + unsigned int color_mask; + unsigned int depth_mask; } drm_mga_clear_t; + +typedef struct drm_mga_vertex { + int idx; /* buffer to queue */ + int used; /* bytes in use */ + int discard; /* client finished with buffer? */ +} drm_mga_vertex_t; -typedef struct _drm_mga_swap { - int dummy; -} drm_mga_swap_t; +typedef struct drm_mga_indices { + int idx; /* buffer to queue */ + unsigned int start; + unsigned int end; + int discard; /* client finished with buffer? */ +} drm_mga_indices_t; -typedef struct _drm_mga_iload { +typedef struct drm_mga_iload { int idx; - int length; - unsigned int destOrg; + unsigned int dstorg; + unsigned int length; } drm_mga_iload_t; -typedef struct _drm_mga_vertex { - int idx; /* buffer to queue */ - int used; /* bytes in use */ - int discard; /* client finished with buffer? */ -} drm_mga_vertex_t; - -typedef struct _drm_mga_indices { - int idx; /* buffer to queue */ - unsigned int start; - unsigned int end; - int discard; /* client finished with buffer? */ -} drm_mga_indices_t; +typedef struct _drm_mga_blit { + unsigned int planemask; + unsigned int srcorg; + unsigned int dstorg; + int src_pitch, dst_pitch; + int delta_sx, delta_sy; + int delta_dx, delta_dy; + int height, ydir; /* flip image vertically */ + int source_pitch, dest_pitch; +} drm_mga_blit_t; #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c:1.8 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c:1.11 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c:1.8 Fri Dec 1 09:29:02 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.c Tue Apr 10 12:08:05 2001 @@ -1,4 +1,4 @@ -/* mga_drv.c -- Matrox g200/g400 driver -*- linux-c -*- +/* mga_drv.c -- Matrox G200/G400 driver -*- linux-c -*- * Created: Mon Dec 13 01:56:22 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. @@ -19,647 +19,62 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * - * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * Gareth Hughes <gareth@valinux.com> */ #include <linux/config.h> +#include "mga.h" #include "drmP.h" #include "mga_drv.h" - -#define MGA_NAME "mga" -#define MGA_DESC "Matrox G200/G400" -#define MGA_DATE "20000928" -#define MGA_MAJOR 2 -#define MGA_MINOR 0 -#define MGA_PATCHLEVEL 1 - -static drm_device_t mga_device; -drm_ctx_t mga_res_ctx; - -static struct file_operations mga_fops = { -#if LINUX_VERSION_CODE >= 0x020400 - /* This started being used during 2.4.0-test */ - owner: THIS_MODULE, -#endif - open: mga_open, - flush: drm_flush, - release: mga_release, - ioctl: mga_ioctl, - mmap: drm_mmap, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, -}; - -static struct miscdevice mga_misc = { - minor: MISC_DYNAMIC_MINOR, - name: MGA_NAME, - fops: &mga_fops, -}; - -static drm_ioctl_desc_t mga_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { mga_version, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_busid, 0, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { mga_control, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { mga_addbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { mga_markbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { mga_infobufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { mga_mapbufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { mga_freebufs, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { mga_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { mga_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { mga_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { mga_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { mga_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { mga_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { mga_resctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { mga_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { mga_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { drm_agp_info, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { drm_agp_alloc, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { drm_agp_free, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { drm_agp_unbind, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_swap_bufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_clear_bufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_iload, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_VERTEX)] = { mga_vertex, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_FLUSH)] = { mga_flush_ioctl, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MGA_INDICES)] = { mga_indices, 1, 0 }, -}; - -#define MGA_IOCTL_COUNT DRM_ARRAY_SIZE(mga_ioctls) - -#ifdef MODULE -static char *mga = NULL; -#endif - -MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("Matrox G200/G400"); -MODULE_PARM(mga, "s"); - -#ifndef MODULE -/* mga_options is called by the kernel to parse command-line options passed - * via the boot-loader (e.g., LILO). It calls the insmod option routine, - * drm_parse_drm. - */ - -static int __init mga_options(char *str) -{ - drm_parse_options(str); - return 1; -} - -__setup("mga=", mga_options); -#endif - -static int mga_setup(drm_device_t *dev) -{ - int i; - - atomic_set(&dev->ioctl_count, 0); - atomic_set(&dev->vma_count, 0); - dev->buf_use = 0; - atomic_set(&dev->buf_alloc, 0); - - drm_dma_setup(dev); - - atomic_set(&dev->total_open, 0); - atomic_set(&dev->total_close, 0); - atomic_set(&dev->total_ioctl, 0); - atomic_set(&dev->total_irq, 0); - atomic_set(&dev->total_ctx, 0); - atomic_set(&dev->total_locks, 0); - atomic_set(&dev->total_unlocks, 0); - atomic_set(&dev->total_contends, 0); - atomic_set(&dev->total_sleeps, 0); - - for (i = 0; i < DRM_HASH_SIZE; i++) { - dev->magiclist[i].head = NULL; - dev->magiclist[i].tail = NULL; - } - dev->maplist = NULL; - dev->map_count = 0; - dev->vmalist = NULL; - dev->lock.hw_lock = NULL; - init_waitqueue_head(&dev->lock.lock_queue); - dev->queue_count = 0; - dev->queue_reserved = 0; - dev->queue_slots = 0; - dev->queuelist = NULL; - dev->irq = 0; - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; - dev->last_context = 0; - dev->last_switch = 0; - dev->last_checked = 0; - init_timer(&dev->timer); - init_waitqueue_head(&dev->context_wait); - - dev->ctx_start = 0; - dev->lck_start = 0; - - dev->buf_rp = dev->buf; - dev->buf_wp = dev->buf; - dev->buf_end = dev->buf + DRM_BSZ; - dev->buf_async = NULL; - init_waitqueue_head(&dev->buf_readers); - init_waitqueue_head(&dev->buf_writers); - - DRM_DEBUG("\n"); - - /* The kernel's context could be created here, but is now created - in drm_dma_enqueue. This is more resource-efficient for - hardware that does not do DMA, but may mean that - drm_select_queue fails between the time the interrupt is - initialized and the time the queues are initialized. */ - - return 0; -} - - -static int mga_takedown(drm_device_t *dev) -{ - int i; - drm_magic_entry_t *pt, *next; - drm_map_t *map; - drm_vma_entry_t *vma, *vma_next; - - DRM_DEBUG("\n"); - - if (dev->dev_private) mga_dma_cleanup(dev); - if (dev->irq) mga_irq_uninstall(dev); - - down(&dev->struct_sem); - del_timer(&dev->timer); - - if (dev->devname) { - drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); - dev->devname = NULL; - } - - if (dev->unique) { - drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); - dev->unique = NULL; - dev->unique_len = 0; - } - /* Clear pid list */ - for (i = 0; i < DRM_HASH_SIZE; i++) { - for (pt = dev->magiclist[i].head; pt; pt = next) { - next = pt->next; - drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); - } - dev->magiclist[i].head = dev->magiclist[i].tail = NULL; - } - /* Clear AGP information */ - if (dev->agp) { - drm_agp_mem_t *entry; - drm_agp_mem_t *nexte; - - /* Remove AGP resources, but leave dev->agp - intact until cleanup is called. */ - for (entry = dev->agp->memory; entry; entry = nexte) { - nexte = entry->next; - if (entry->bound) drm_unbind_agp(entry->memory); - drm_free_agp(entry->memory, entry->pages); - drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); - } - dev->agp->memory = NULL; - - if (dev->agp->acquired) _drm_agp_release(); - - dev->agp->acquired = 0; - dev->agp->enabled = 0; - } - /* Clear vma list (only built for debugging) */ - if (dev->vmalist) { - for (vma = dev->vmalist; vma; vma = vma_next) { - vma_next = vma->next; - drm_free(vma, sizeof(*vma), DRM_MEM_VMAS); - } - dev->vmalist = NULL; - } - - /* Clear map area and mtrr information */ - if (dev->maplist) { - for (i = 0; i < dev->map_count; i++) { - map = dev->maplist[i]; - switch (map->type) { - case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: -#ifdef CONFIG_MTRR - if (map->mtrr >= 0) { - int retcode; - retcode = mtrr_del(map->mtrr, - map->offset, - map->size); - DRM_DEBUG("mtrr_del = %d\n", retcode); - } -#endif - drm_ioremapfree(map->handle, map->size); - break; - case _DRM_SHM: - drm_free_pages((unsigned long)map->handle, - drm_order(map->size) - - PAGE_SHIFT, - DRM_MEM_SAREA); - break; - case _DRM_AGP: - break; - } - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - } - drm_free(dev->maplist, - dev->map_count * sizeof(*dev->maplist), - DRM_MEM_MAPS); - dev->maplist = NULL; - dev->map_count = 0; - } - - if (dev->queuelist) { - for (i = 0; i < dev->queue_count; i++) { - drm_waitlist_destroy(&dev->queuelist[i]->waitlist); - if (dev->queuelist[i]) { - drm_free(dev->queuelist[i], - sizeof(*dev->queuelist[0]), - DRM_MEM_QUEUES); - dev->queuelist[i] = NULL; - } - } - drm_free(dev->queuelist, - dev->queue_slots * sizeof(*dev->queuelist), - DRM_MEM_QUEUES); - dev->queuelist = NULL; - } - - drm_dma_takedown(dev); - - dev->queue_count = 0; - if (dev->lock.hw_lock) { - dev->lock.hw_lock = NULL; /* SHM removed */ - dev->lock.pid = 0; - wake_up_interruptible(&dev->lock.lock_queue); - } - up(&dev->struct_sem); - - return 0; -} - -/* mga_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). */ - -static int __init mga_init(void) -{ - int retcode; - drm_device_t *dev = &mga_device; - - DRM_DEBUG("\n"); - - memset((void *)dev, 0, sizeof(*dev)); - dev->count_lock = SPIN_LOCK_UNLOCKED; - sema_init(&dev->struct_sem, 1); - -#ifdef MODULE - drm_parse_options(mga); -#endif - if ((retcode = misc_register(&mga_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", MGA_NAME); - return retcode; - } - dev->device = MKDEV(MISC_MAJOR, mga_misc.minor); - dev->name = MGA_NAME; - - drm_mem_init(); - drm_proc_init(dev); - dev->agp = drm_agp_init(); - if(dev->agp == NULL) { - DRM_INFO("The mga drm module requires the agpgart module" - " to function correctly\nPlease load the agpgart" - " module before you load the mga module\n"); - drm_proc_cleanup(); - misc_deregister(&mga_misc); - mga_takedown(dev); - return -ENOMEM; - } -#ifdef CONFIG_MTRR - dev->agp->agp_mtrr = mtrr_add(dev->agp->agp_info.aper_base, - dev->agp->agp_info.aper_size * 1024 * 1024, - MTRR_TYPE_WRCOMB, - 1); -#endif - if((retcode = drm_ctxbitmap_init(dev))) { - DRM_ERROR("Cannot allocate memory for context bitmap.\n"); - drm_proc_cleanup(); - misc_deregister(&mga_misc); - mga_takedown(dev); - return retcode; - } - - DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", - MGA_NAME, - MGA_MAJOR, - MGA_MINOR, - MGA_PATCHLEVEL, - MGA_DATE, - mga_misc.minor); - - return 0; -} - -/* mga_cleanup is called via cleanup_module at module unload time. */ - -static void __exit mga_cleanup(void) -{ - drm_device_t *dev = &mga_device; - - DRM_DEBUG("\n"); - - drm_proc_cleanup(); - if (misc_deregister(&mga_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } - drm_ctxbitmap_cleanup(dev); -#ifdef CONFIG_MTRR - if(dev->agp && dev->agp->agp_mtrr) { - int retval; - retval = mtrr_del(dev->agp->agp_mtrr, - dev->agp->agp_info.aper_base, - dev->agp->agp_info.aper_size * 1024*1024); - DRM_DEBUG("mtrr_del = %d\n", retval); - } -#endif - - mga_takedown(dev); - if (dev->agp) { - drm_agp_uninit(); - drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); - dev->agp = NULL; - } -} - -module_init(mga_init); -module_exit(mga_cleanup); - - -int mga_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_version_t version; - int len; - - if (copy_from_user(&version, - (drm_version_t *)arg, - sizeof(version))) - return -EFAULT; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ - } - - version.version_major = MGA_MAJOR; - version.version_minor = MGA_MINOR; - version.version_patchlevel = MGA_PATCHLEVEL; - - DRM_COPY(version.name, MGA_NAME); - DRM_COPY(version.date, MGA_DATE); - DRM_COPY(version.desc, MGA_DESC); - - if (copy_to_user((drm_version_t *)arg, - &version, - sizeof(version))) - return -EFAULT; - return 0; -} - -int mga_open(struct inode *inode, struct file *filp) -{ - drm_device_t *dev = &mga_device; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_open_helper(inode, filp, dev))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_open); - spin_lock(&dev->count_lock); - if (!dev->open_count++) { - spin_unlock(&dev->count_lock); - return mga_setup(dev); - } - spin_unlock(&dev->count_lock); - } - return retcode; -} - -int mga_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - DRM_DEBUG("pid = %d, device = 0x%x, open_count = %d\n", - current->pid, dev->device, dev->open_count); - - if (dev->lock.hw_lock && _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) - && dev->lock.pid == current->pid) { - mga_reclaim_buffers(dev, priv->pid); - DRM_INFO("Process %d dead (ctx %d, d_s = 0x%02x)\n", - current->pid, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock), - dev->dev_private ? - ((drm_mga_private_t *)dev->dev_private) - ->dispatch_status - : 0); - - if (dev->dev_private) - ((drm_mga_private_t *)dev->dev_private) - ->dispatch_status &= MGA_IN_DISPATCH; - - drm_lock_free(dev, - &dev->lock.hw_lock->lock, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - } else if (dev->lock.hw_lock) { - /* The lock is required to reclaim buffers */ - DECLARE_WAITQUEUE(entry, current); - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - retcode = -EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - dev->lock.pid = priv->pid; - dev->lock.lock_time = jiffies; - atomic_inc(&dev->total_locks); - break; /* Got lock */ - } - /* Contention */ - atomic_inc(&dev->total_sleeps); - schedule(); - if (signal_pending(current)) { - retcode = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - if(!retcode) { - mga_reclaim_buffers(dev, priv->pid); - if (dev->dev_private) - ((drm_mga_private_t *)dev->dev_private) - ->dispatch_status &= MGA_IN_DISPATCH; - drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT); - } - } - drm_fasync(-1, filp, 0); - - down(&dev->struct_sem); - if (priv->remove_auth_on_close == 1) { - drm_file_t *temp = dev->file_first; - while(temp) { - temp->authenticated = 0; - temp = temp->next; - } - } - if (priv->prev) priv->prev->next = priv->next; - else dev->file_first = priv->next; - if (priv->next) priv->next->prev = priv->prev; - else dev->file_last = priv->prev; - up(&dev->struct_sem); - - drm_free(priv, sizeof(*priv), DRM_MEM_FILES); -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_close); - spin_lock(&dev->count_lock); - if (!--dev->open_count) { - if (atomic_read(&dev->ioctl_count) || dev->blocked) { - DRM_ERROR("Device busy: %d %d\n", - atomic_read(&dev->ioctl_count), - dev->blocked); - spin_unlock(&dev->count_lock); - unlock_kernel(); - return -EBUSY; - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return mga_takedown(dev); - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return retcode; -} - - -/* drm_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -int mga_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - int nr = DRM_IOCTL_NR(cmd); - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int retcode = 0; - drm_ioctl_desc_t *ioctl; - drm_ioctl_t *func; - - atomic_inc(&dev->ioctl_count); - atomic_inc(&dev->total_ioctl); - ++priv->ioctl_count; - - if (nr >= MGA_IOCTL_COUNT) { - retcode = -EINVAL; - } else { - ioctl = &mga_ioctls[nr]; - func = ioctl->func; - - if (!func) { - DRM_DEBUG("no function: pid = %d, cmd = 0x%02x," - " nr = 0x%02x, dev 0x%x, auth = %d\n", - current->pid, cmd, nr, dev->device, - priv->authenticated); - retcode = -EINVAL; - } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN)) - || (ioctl->auth_needed && !priv->authenticated)) { - retcode = -EACCES; - } else { - retcode = (func)(inode, filp, cmd, arg); - } - } - - atomic_dec(&dev->ioctl_count); - return retcode; -} - -int mga_unlock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_lock_t lock; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } - - atomic_inc(&dev->total_unlocks); - if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock)) - atomic_inc(&dev->total_contends); - drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT); - mga_dma_schedule(dev, 1); - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) DRM_ERROR("\n"); +#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." - unblock_all_signals(); - return 0; -} +#define DRIVER_NAME "mga" +#define DRIVER_DESC "Matrox G200/G400" +#define DRIVER_DATE "20010321" + +#define DRIVER_MAJOR 3 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 2 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { mga_dma_buffers, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_INIT)] = { mga_dma_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_FLUSH)] = { mga_dma_flush, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_RESET)] = { mga_dma_reset, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_SWAP)] = { mga_dma_swap, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_CLEAR)] = { mga_dma_clear, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_VERTEX)] = { mga_dma_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_INDICES)] = { mga_dma_indices, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_ILOAD)] = { mga_dma_iload, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_MGA_BLIT)] = { mga_dma_blit, 1, 0 }, + + +#define __HAVE_COUNTERS 3 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY + + +#include "drm_agpsupport.h" +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h:1.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h:1.10 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h:1.7 Wed Nov 8 00:03:07 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_drv.h Tue Apr 10 12:08:05 2001 @@ -1,4 +1,4 @@ -/* mga_drv.h -- Private header for the Matrox g200/g400 driver -*- linux-c -*- +/* mga_drv.h -- Private header for the Matrox G200/G400 driver -*- linux-c -*- * Created: Mon Dec 13 01:50:01 1999 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. @@ -19,180 +19,140 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * Authors: Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * + * Authors: + * Gareth Hughes <gareth@valinux.com> */ -#ifndef _MGA_DRV_H_ -#define _MGA_DRV_H_ +#ifndef __MGA_DRV_H__ +#define __MGA_DRV_H__ -#define MGA_BUF_IN_USE 0 -#define MGA_BUF_SWAP_PENDING 1 -#define MGA_BUF_FORCE_FIRE 2 -#define MGA_BUF_NEEDS_OVERFLOW 3 +typedef struct drm_mga_primary_buffer { + u8 *start; + u8 *end; + int size; -typedef struct { - u32 buffer_status; - int num_dwords; - int max_dwords; - u32 *current_dma_ptr; - u32 *head; - u32 phys_head; - unsigned int prim_age; - int sec_used; - int idx; -} drm_mga_prim_buf_t; + u32 tail; + int space; + volatile int wrapped; + + volatile u32 *status; + + u32 last_flush; + u32 last_wrap; + + u32 high_mark; + + spinlock_t list_lock; +} drm_mga_primary_buffer_t; -typedef struct _drm_mga_freelist { - __volatile__ unsigned int age; +typedef struct drm_mga_freelist { + struct drm_mga_freelist *next; + struct drm_mga_freelist *prev; + drm_mga_age_t age; drm_buf_t *buf; - struct _drm_mga_freelist *next; - struct _drm_mga_freelist *prev; } drm_mga_freelist_t; + +typedef struct { + drm_mga_freelist_t *list_entry; + int discard; + int dispatched; +} drm_mga_buf_priv_t; -#define MGA_IN_DISPATCH 0 -#define MGA_IN_FLUSH 1 -#define MGA_IN_WAIT 2 -#define MGA_IN_GETBUF 3 - -typedef struct _drm_mga_private { - u32 dispatch_status; - unsigned int next_prim_age; - __volatile__ unsigned int last_prim_age; - int reserved_map_idx; - int buffer_map_idx; - drm_mga_sarea_t *sarea_priv; - int primary_size; - int warp_ucode_size; - int chipset; - unsigned int frontOffset; - unsigned int backOffset; - unsigned int depthOffset; - unsigned int textureOffset; - unsigned int textureSize; - int cpp; - unsigned int stride; - int sgram; - int use_agp; - drm_mga_warp_index_t WarpIndex[MGA_MAX_G400_PIPES]; - unsigned int WarpPipe; - unsigned int vertexsize; - atomic_t pending_bufs; - void *status_page; - unsigned long real_status_page; - u8 *ioremap; - drm_mga_prim_buf_t **prim_bufs; - drm_mga_prim_buf_t *next_prim; - drm_mga_prim_buf_t *last_prim; - drm_mga_prim_buf_t *current_prim; - int current_prim_idx; +typedef struct drm_mga_private { + drm_mga_primary_buffer_t prim; + drm_mga_sarea_t *sarea_priv; + drm_mga_freelist_t *head; drm_mga_freelist_t *tail; - wait_queue_head_t flush_queue; /* Processes waiting until flush */ - wait_queue_head_t wait_queue; /* Processes waiting until interrupt */ - wait_queue_head_t buf_queue; /* Processes waiting for a free buf */ - /* Some validated register values: - */ - u32 mAccess; -} drm_mga_private_t; + + unsigned int warp_pipe; + unsigned long warp_pipe_phys[MGA_MAX_WARP_PIPES]; - /* mga_drv.c */ -extern int mga_version(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_open(struct inode *inode, struct file *filp); -extern int mga_release(struct inode *inode, struct file *filp); -extern int mga_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_unlock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); + int chipset; + int usec_timeout; + + u32 clear_cmd; + u32 maccess; + + unsigned int fb_cpp; + unsigned int front_offset; + unsigned int front_pitch; + unsigned int back_offset; + unsigned int back_pitch; + + unsigned int depth_cpp; + unsigned int depth_offset; + unsigned int depth_pitch; + + unsigned int texture_offset; + unsigned int texture_size; + + drm_map_t *sarea; + drm_map_t *fb; + drm_map_t *mmio; + drm_map_t *status; + drm_map_t *warp; + drm_map_t *primary; + drm_map_t *buffers; + drm_map_t *agp_textures; +} drm_mga_private_t; /* mga_dma.c */ -extern int mga_dma_schedule(drm_device_t *dev, int locked); -extern int mga_dma(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_irq_install(drm_device_t *dev, int irq); -extern int mga_irq_uninstall(drm_device_t *dev); -extern int mga_control(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_lock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -/* mga_dma_init does init and release */ -extern int mga_dma_init(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_dma_cleanup(drm_device_t *dev); -extern int mga_flush_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern unsigned int mga_create_sync_tag(drm_device_t *dev); -extern drm_buf_t *mga_freelist_get(drm_device_t *dev); -extern int mga_freelist_put(drm_device_t *dev, drm_buf_t *buf); -extern int mga_advance_primary(drm_device_t *dev); -extern void mga_reclaim_buffers(drm_device_t *dev, pid_t pid); - - - /* mga_bufs.c */ -extern int mga_addbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_infobufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_markbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_freebufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_mapbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_addmap(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - /* mga_state.c */ -extern int mga_clear_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_swap_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_iload(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_vertex(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_indices(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - /* mga_context.c */ -extern int mga_resctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_addctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_modctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_getctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_switchctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_newctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int mga_rmctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); +extern int mga_dma_init( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_flush( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_reset( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_buffers( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + +extern int mga_do_wait_for_idle( drm_mga_private_t *dev_priv ); +extern int mga_do_dma_idle( drm_mga_private_t *dev_priv ); +extern int mga_do_dma_reset( drm_mga_private_t *dev_priv ); +extern int mga_do_engine_reset( drm_mga_private_t *dev_priv ); +extern int mga_do_cleanup_dma( drm_device_t *dev ); + +extern void mga_do_dma_flush( drm_mga_private_t *dev_priv ); +extern void mga_do_dma_wrap_start( drm_mga_private_t *dev_priv ); +extern void mga_do_dma_wrap_end( drm_mga_private_t *dev_priv ); + +extern int mga_freelist_put( drm_device_t *dev, drm_buf_t *buf ); -extern int mga_context_switch(drm_device_t *dev, int old, int new); -extern int mga_context_switch_complete(drm_device_t *dev, int new); + /* mga_state.c */ +extern int mga_dma_clear( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_swap( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_vertex( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_indices( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_iload( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int mga_dma_blit( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + + /* mga_warp.c */ +extern int mga_warp_install_microcode( drm_device_t *dev ); +extern int mga_warp_init( drm_device_t *dev ); #define mga_flush_write_combine() mb() -typedef enum { - TT_GENERAL, - TT_BLIT, - TT_VECTOR, - TT_VERTEX -} transferType_t; -typedef struct { - drm_mga_freelist_t *my_freelist; - int discard; - int dispatched; -} drm_mga_buf_priv_t; +#define MGA_BASE( reg ) ((u32)(dev_priv->mmio->handle)) +#define MGA_ADDR( reg ) (MGA_BASE(reg) + reg) + +#define MGA_DEREF( reg ) *(volatile u32 *)MGA_ADDR( reg ) +#define MGA_READ( reg ) MGA_DEREF( reg ) +#define MGA_WRITE( reg, val ) do { MGA_DEREF( reg ) = val; } while (0) +#define MGA_DEREF8( reg ) *(volatile u8 *)MGA_ADDR( reg ) +#define MGA_WRITE8( reg, val ) do { MGA_DEREF8( reg ) = val; } while (0) #define DWGREG0 0x1c00 #define DWGREG0_END 0x1dff @@ -200,321 +160,470 @@ #define DWGREG1_END 0x2dff #define ISREG0(r) (r >= DWGREG0 && r <= DWGREG0_END) -#define ADRINDEX0(r) (u8)((r - DWGREG0) >> 2) -#define ADRINDEX1(r) (u8)(((r - DWGREG1) >> 2) | 0x80) -#define ADRINDEX(r) (ISREG0(r) ? ADRINDEX0(r) : ADRINDEX1(r)) - -#define MGA_VERBOSE 0 -#define MGA_NUM_PRIM_BUFS 8 - -#define PRIMLOCALS u8 tempIndex[4]; u32 *dma_ptr; u32 phys_head; \ - int outcount, num_dwords - -#define PRIM_OVERFLOW(dev, dev_priv, length) do { \ - drm_mga_prim_buf_t *tmp_buf = \ - dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - if( test_bit(MGA_BUF_NEEDS_OVERFLOW, &tmp_buf->buffer_status)) { \ - mga_advance_primary(dev); \ - mga_dma_schedule(dev, 1); \ - tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - } else if( tmp_buf->max_dwords - tmp_buf->num_dwords < length || \ - tmp_buf->sec_used > MGA_DMA_BUF_NR/2) { \ - set_bit(MGA_BUF_FORCE_FIRE, &tmp_buf->buffer_status); \ - mga_advance_primary(dev); \ - mga_dma_schedule(dev, 1); \ - tmp_buf = dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - } \ - if(MGA_VERBOSE) \ - DRM_DEBUG("PRIMGETPTR in %s\n", __FUNCTION__); \ - dma_ptr = tmp_buf->current_dma_ptr; \ - num_dwords = tmp_buf->num_dwords; \ - phys_head = tmp_buf->phys_head; \ - outcount = 0; \ -} while(0) - -#define PRIMGETPTR(dev_priv) do { \ - drm_mga_prim_buf_t *tmp_buf = \ - dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - if(MGA_VERBOSE) \ - DRM_DEBUG("PRIMGETPTR in %s\n", __FUNCTION__); \ - dma_ptr = tmp_buf->current_dma_ptr; \ - num_dwords = tmp_buf->num_dwords; \ - phys_head = tmp_buf->phys_head; \ - outcount = 0; \ -} while(0) - -#define PRIMPTR(prim_buf) do { \ - if(MGA_VERBOSE) \ - DRM_DEBUG("PRIMPTR in %s\n", __FUNCTION__); \ - dma_ptr = prim_buf->current_dma_ptr; \ - num_dwords = prim_buf->num_dwords; \ - phys_head = prim_buf->phys_head; \ - outcount = 0; \ -} while(0) - -#define PRIMFINISH(prim_buf) do { \ - if (MGA_VERBOSE) { \ - DRM_DEBUG( "PRIMFINISH in %s\n", __FUNCTION__); \ - if (outcount & 3) \ - DRM_DEBUG(" --- truncation\n"); \ - } \ - prim_buf->num_dwords = num_dwords; \ - prim_buf->current_dma_ptr = dma_ptr; \ -} while(0) - -#define PRIMADVANCE(dev_priv) do { \ -drm_mga_prim_buf_t *tmp_buf = \ - dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - if (MGA_VERBOSE) { \ - DRM_DEBUG("PRIMADVANCE in %s\n", __FUNCTION__); \ - if (outcount & 3) \ - DRM_DEBUG(" --- truncation\n"); \ - } \ - tmp_buf->num_dwords = num_dwords; \ - tmp_buf->current_dma_ptr = dma_ptr; \ -} while (0) - -#define PRIMUPDATE(dev_priv) do { \ - drm_mga_prim_buf_t *tmp_buf = \ - dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - tmp_buf->sec_used++; \ -} while (0) - -#define AGEBUF(dev_priv, buf_priv) do { \ - drm_mga_prim_buf_t *tmp_buf = \ - dev_priv->prim_bufs[dev_priv->current_prim_idx]; \ - buf_priv->my_freelist->age = tmp_buf->prim_age; \ -} while (0) - - -#define PRIMOUTREG(reg, val) do { \ - tempIndex[outcount]=ADRINDEX(reg); \ - dma_ptr[1+outcount] = val; \ - if (MGA_VERBOSE) \ - DRM_DEBUG(" PRIMOUT %d: 0x%x -- 0x%x\n", \ - num_dwords + 1 + outcount, ADRINDEX(reg), val); \ - if( ++outcount == 4) { \ - outcount = 0; \ - dma_ptr[0] = *(unsigned long *)tempIndex; \ - dma_ptr+=5; \ - num_dwords += 5; \ +#define DMAREG0(r) (u8)((r - DWGREG0) >> 2) +#define DMAREG1(r) (u8)(((r - DWGREG1) >> 2) | 0x80) +#define DMAREG(r) (ISREG0(r) ? DMAREG0(r) : DMAREG1(r)) + + + +/* ================================================================ + * Helper macross... + */ + +#define MGA_EMIT_STATE( dev_priv, dirty ) \ +do { \ + if ( (dirty) & ~MGA_UPLOAD_CLIPRECTS ) { \ + if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { \ + mga_g400_emit_state( dev_priv ); \ + } else { \ + mga_g200_emit_state( dev_priv ); \ + } \ + } \ +} while (0) + +#define LOCK_TEST_WITH_RETURN( dev ) \ +do { \ + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ + dev->lock.pid != current->pid ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + return -EINVAL; \ } \ -}while (0) +} while (0) + +#define WRAP_TEST_WITH_RETURN( dev_priv ) \ +do { \ + 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) + + +/* ================================================================ + * Primary DMA command stream + */ +#define MGA_VERBOSE 0 + +#define DMA_LOCALS unsigned int write; volatile u8 *prim; + +#define DMA_BLOCK_SIZE (5 * sizeof(u32)) + +#define BEGIN_DMA( n ) \ +do { \ + if ( MGA_VERBOSE ) { \ + DRM_INFO( "BEGIN_DMA( %d ) in %s\n", \ + (n), __FUNCTION__ ); \ + DRM_INFO( " space=0x%x req=0x%x\n", \ + dev_priv->prim.space, (n) * DMA_BLOCK_SIZE ); \ + } \ + prim = dev_priv->prim.start; \ + write = dev_priv->prim.tail; \ +} while (0) + +#define BEGIN_DMA_WRAP() \ +do { \ + if ( MGA_VERBOSE ) { \ + DRM_INFO( "BEGIN_DMA() in %s\n", __FUNCTION__ ); \ + DRM_INFO( " space=0x%x\n", dev_priv->prim.space ); \ + } \ + prim = dev_priv->prim.start; \ + write = dev_priv->prim.tail; \ +} while (0) + +#define ADVANCE_DMA() \ +do { \ + dev_priv->prim.tail = write; \ + if ( MGA_VERBOSE ) { \ + DRM_INFO( "ADVANCE_DMA() tail=0x%05x sp=0x%x\n", \ + write, dev_priv->prim.space ); \ + } \ +} while (0) + +#define FLUSH_DMA() \ +do { \ + if ( 0 ) { \ + DRM_INFO( __FUNCTION__ ":\n" ); \ + DRM_INFO( " tail=0x%06x head=0x%06lx\n", \ + dev_priv->prim.tail, \ + MGA_READ( MGA_PRIMADDRESS ) - \ + dev_priv->primary->offset ); \ + } \ + if ( !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) + +/* Never use this, always use DMA_BLOCK(...) for primary DMA output. + */ +#define DMA_WRITE( offset, val ) \ +do { \ + if ( MGA_VERBOSE ) { \ + DRM_INFO( " DMA_WRITE( 0x%08x ) at 0x%04x\n", \ + (u32)(val), write + (offset) * sizeof(u32) ); \ + } \ + *(volatile u32 *)(prim + write + (offset) * sizeof(u32)) = val; \ +} while (0) + +#define DMA_BLOCK( reg0, val0, reg1, val1, reg2, val2, reg3, val3 ) \ +do { \ + DMA_WRITE( 0, ((DMAREG( reg0 ) << 0) | \ + (DMAREG( reg1 ) << 8) | \ + (DMAREG( reg2 ) << 16) | \ + (DMAREG( reg3 ) << 24)) ); \ + DMA_WRITE( 1, val0 ); \ + DMA_WRITE( 2, val1 ); \ + DMA_WRITE( 3, val2 ); \ + DMA_WRITE( 4, val3 ); \ + write += DMA_BLOCK_SIZE; \ +} while (0) + + +/* Buffer aging via primary DMA stream head pointer. + */ + +#define SET_AGE( age, h, w ) \ +do { \ + (age)->head = h; \ + (age)->wrap = w; \ +} while (0) + +#define TEST_AGE( age, h, w ) ( (age)->wrap < w || \ + ( (age)->wrap == w && \ + (age)->head < h ) ) + +#define AGE_BUFFER( buf_priv ) \ +do { \ + drm_mga_freelist_t *entry = (buf_priv)->list_entry; \ + if ( (buf_priv)->dispatched ) { \ + entry->age.head = (dev_priv->prim.tail + \ + dev_priv->primary->offset); \ + entry->age.wrap = dev_priv->sarea_priv->last_wrap; \ + } else { \ + entry->age.head = 0; \ + entry->age.wrap = 0; \ + } \ +} while (0) + + +#define MGA_ENGINE_IDLE_MASK (MGA_SOFTRAPEN | \ + MGA_DWGENGSTS | \ + MGA_ENDPRDMASTS) +#define MGA_DMA_IDLE_MASK (MGA_SOFTRAPEN | \ + MGA_ENDPRDMASTS) + +#define MGA_DMA_DEBUG 0 + + + /* A reduced set of the mga registers. */ +#define MGA_CRTC_INDEX 0x1fd4 + +#define MGA_ALPHACTRL 0x2c7c +#define MGA_AR0 0x1c60 +#define MGA_AR1 0x1c64 +#define MGA_AR2 0x1c68 +#define MGA_AR3 0x1c6c +#define MGA_AR4 0x1c70 +#define MGA_AR5 0x1c74 +#define MGA_AR6 0x1c78 + +#define MGA_CXBNDRY 0x1c80 +#define MGA_CXLEFT 0x1ca0 +#define MGA_CXRIGHT 0x1ca4 + +#define MGA_DMAPAD 0x1c54 +#define MGA_DSTORG 0x2cb8 +#define MGA_DWGCTL 0x1c00 +# define MGA_OPCOD_MASK (15 << 0) +# define MGA_OPCOD_TRAP (4 << 0) +# define MGA_OPCOD_TEXTURE_TRAP (6 << 0) +# define MGA_OPCOD_BITBLT (8 << 0) +# define MGA_OPCOD_ILOAD (9 << 0) +# define MGA_ATYPE_MASK (7 << 4) +# define MGA_ATYPE_RPL (0 << 4) +# define MGA_ATYPE_RSTR (1 << 4) +# define MGA_ATYPE_ZI (3 << 4) +# define MGA_ATYPE_BLK (4 << 4) +# define MGA_ATYPE_I (7 << 4) +# define MGA_LINEAR (1 << 7) +# define MGA_ZMODE_MASK (7 << 8) +# define MGA_ZMODE_NOZCMP (0 << 8) +# define MGA_ZMODE_ZE (2 << 8) +# define MGA_ZMODE_ZNE (3 << 8) +# define MGA_ZMODE_ZLT (4 << 8) +# define MGA_ZMODE_ZLTE (5 << 8) +# define MGA_ZMODE_ZGT (6 << 8) +# define MGA_ZMODE_ZGTE (7 << 8) +# define MGA_SOLID (1 << 11) +# define MGA_ARZERO (1 << 12) +# define MGA_SGNZERO (1 << 13) +# define MGA_SHIFTZERO (1 << 14) +# define MGA_BOP_MASK (15 << 16) +# define MGA_BOP_ZERO (0 << 16) +# define MGA_BOP_DST (10 << 16) +# define MGA_BOP_SRC (12 << 16) +# define MGA_BOP_ONE (15 << 16) +# define MGA_TRANS_SHIFT 20 +# define MGA_TRANS_MASK (15 << 20) +# define MGA_BLTMOD_MASK (15 << 25) +# define MGA_BLTMOD_BMONOLEF (0 << 25) +# define MGA_BLTMOD_BMONOWF (4 << 25) +# define MGA_BLTMOD_PLAN (1 << 25) +# define MGA_BLTMOD_BFCOL (2 << 25) +# define MGA_BLTMOD_BU32BGR (3 << 25) +# define MGA_BLTMOD_BU32RGB (7 << 25) +# define MGA_BLTMOD_BU24BGR (11 << 25) +# define MGA_BLTMOD_BU24RGB (15 << 25) +# define MGA_PATTERN (1 << 29) +# define MGA_TRANSC (1 << 30) +# define MGA_CLIPDIS (1 << 31) +#define MGA_DWGSYNC 0x2c4c + +#define MGA_FCOL 0x1c24 +#define MGA_FIFOSTATUS 0x1e10 +#define MGA_FOGCOL 0x1cf4 +#define MGA_FXBNDRY 0x1c84 +#define MGA_FXLEFT 0x1ca8 +#define MGA_FXRIGHT 0x1cac + +#define MGA_ICLEAR 0x1e18 +# define MGA_SOFTRAPICLR (1 << 0) +#define MGA_IEN 0x1e1c +# define MGA_SOFTRAPIEN (1 << 0) + +#define MGA_LEN 0x1c5c + +#define MGA_MACCESS 0x1c04 + +#define MGA_PITCH 0x1c8c +#define MGA_PLNWT 0x1c1c +#define MGA_PRIMADDRESS 0x1e58 +# define MGA_DMA_GENERAL (0 << 0) +# define MGA_DMA_BLIT (1 << 0) +# define MGA_DMA_VECTOR (2 << 0) +# define MGA_DMA_VERTEX (3 << 0) +#define MGA_PRIMEND 0x1e5c +# define MGA_PRIMNOSTART (1 << 0) +# define MGA_PAGPXFER (1 << 1) +#define MGA_PRIMPTR 0x1e50 +# define MGA_PRIMPTREN0 (1 << 0) +# define MGA_PRIMPTREN1 (1 << 1) + +#define MGA_RST 0x1e40 +# define MGA_SOFTRESET (1 << 0) +# define MGA_SOFTEXTRST (1 << 1) + +#define MGA_SECADDRESS 0x2c40 +#define MGA_SECEND 0x2c44 +#define MGA_SETUPADDRESS 0x2cd0 +#define MGA_SETUPEND 0x2cd4 +#define MGA_SGN 0x1c58 +#define MGA_SOFTRAP 0x2c48 +#define MGA_SRCORG 0x2cb4 +# define MGA_SRMMAP_MASK (1 << 0) +# define MGA_SRCMAP_FB (0 << 0) +# define MGA_SRCMAP_SYSMEM (1 << 0) +# define MGA_SRCACC_MASK (1 << 1) +# define MGA_SRCACC_PCI (0 << 1) +# define MGA_SRCACC_AGP (1 << 1) +#define MGA_STATUS 0x1e14 +# define MGA_SOFTRAPEN (1 << 0) +# define MGA_DWGENGSTS (1 << 16) +# define MGA_ENDPRDMASTS (1 << 17) +#define MGA_STENCIL 0x2cc8 +#define MGA_STENCILCTL 0x2ccc + +#define MGA_TDUALSTAGE0 0x2cf8 +#define MGA_TDUALSTAGE1 0x2cfc +#define MGA_TEXBORDERCOL 0x2c5c +#define MGA_TEXCTL 0x2c30 +#define MGA_TEXCTL2 0x2c3c +# define MGA_DUALTEX (1 << 7) +# define MGA_G400_TC2_MAGIC (1 << 15) +# define MGA_MAP1_ENABLE (1 << 31) +#define MGA_TEXFILTER 0x2c58 +#define MGA_TEXHEIGHT 0x2c2c +#define MGA_TEXORG 0x2c24 +# define MGA_TEXORGMAP_MASK (1 << 0) +# define MGA_TEXORGMAP_FB (0 << 0) +# define MGA_TEXORGMAP_SYSMEM (1 << 0) +# define MGA_TEXORGACC_MASK (1 << 1) +# define MGA_TEXORGACC_PCI (0 << 1) +# define MGA_TEXORGACC_AGP (1 << 1) +#define MGA_TEXORG1 0x2ca4 +#define MGA_TEXORG2 0x2ca8 +#define MGA_TEXORG3 0x2cac +#define MGA_TEXORG4 0x2cb0 +#define MGA_TEXTRANS 0x2c34 +#define MGA_TEXTRANSHIGH 0x2c38 +#define MGA_TEXWIDTH 0x2c28 + +#define MGA_WACCEPTSEQ 0x1dd4 +#define MGA_WCODEADDR 0x1e6c +#define MGA_WFLAG 0x1dc4 +#define MGA_WFLAG1 0x1de0 +#define MGA_WFLAGNB 0x1e64 +#define MGA_WFLAGNB1 0x1e08 +#define MGA_WGETMSB 0x1dc8 +#define MGA_WIADDR 0x1dc0 +#define MGA_WIADDR2 0x1dd8 +# define MGA_WMODE_SUSPEND (0 << 0) +# define MGA_WMODE_RESUME (1 << 0) +# define MGA_WMODE_JUMP (2 << 0) +# define MGA_WMODE_START (3 << 0) +# define MGA_WAGP_ENABLE (1 << 2) +#define MGA_WMISC 0x1e70 +# define MGA_WUCODECACHE_ENABLE (1 << 0) +# define MGA_WMASTER_ENABLE (1 << 1) +# define MGA_WCACHEFLUSH_ENABLE (1 << 3) +#define MGA_WVRTXSZ 0x1dcc + +#define MGA_YBOT 0x1c9c +#define MGA_YDST 0x1c90 +#define MGA_YDSTLEN 0x1c88 +#define MGA_YDSTORG 0x1c94 +#define MGA_YTOP 0x1c98 + +#define MGA_ZORG 0x1c0c + +/* This finishes the current batch of commands + */ +#define MGA_EXEC 0x0100 -#define MGAREG_MGA_EXEC 0x0100 -#define MGAREG_ALPHACTRL 0x2c7c -#define MGAREG_AR0 0x1c60 -#define MGAREG_AR1 0x1c64 -#define MGAREG_AR2 0x1c68 -#define MGAREG_AR3 0x1c6c -#define MGAREG_AR4 0x1c70 -#define MGAREG_AR5 0x1c74 -#define MGAREG_AR6 0x1c78 -#define MGAREG_CXBNDRY 0x1c80 -#define MGAREG_CXLEFT 0x1ca0 -#define MGAREG_CXRIGHT 0x1ca4 -#define MGAREG_DMAPAD 0x1c54 -#define MGAREG_DSTORG 0x2cb8 -#define MGAREG_DWGCTL 0x1c00 -#define MGAREG_DWGSYNC 0x2c4c -#define MGAREG_FCOL 0x1c24 -#define MGAREG_FIFOSTATUS 0x1e10 -#define MGAREG_FOGCOL 0x1cf4 -#define MGAREG_FXBNDRY 0x1c84 -#define MGAREG_FXLEFT 0x1ca8 -#define MGAREG_FXRIGHT 0x1cac -#define MGAREG_ICLEAR 0x1e18 -#define MGAREG_IEN 0x1e1c -#define MGAREG_LEN 0x1c5c -#define MGAREG_MACCESS 0x1c04 -#define MGAREG_PITCH 0x1c8c -#define MGAREG_PLNWT 0x1c1c -#define MGAREG_PRIMADDRESS 0x1e58 -#define MGAREG_PRIMEND 0x1e5c -#define MGAREG_PRIMPTR 0x1e50 -#define MGAREG_SECADDRESS 0x2c40 -#define MGAREG_SECEND 0x2c44 -#define MGAREG_SETUPADDRESS 0x2cd0 -#define MGAREG_SETUPEND 0x2cd4 -#define MGAREG_SOFTRAP 0x2c48 -#define MGAREG_SRCORG 0x2cb4 -#define MGAREG_STATUS 0x1e14 -#define MGAREG_STENCIL 0x2cc8 -#define MGAREG_STENCILCTL 0x2ccc -#define MGAREG_TDUALSTAGE0 0x2cf8 -#define MGAREG_TDUALSTAGE1 0x2cfc -#define MGAREG_TEXBORDERCOL 0x2c5c -#define MGAREG_TEXCTL 0x2c30 -#define MGAREG_TEXCTL2 0x2c3c -#define MGAREG_TEXFILTER 0x2c58 -#define MGAREG_TEXHEIGHT 0x2c2c -#define MGAREG_TEXORG 0x2c24 -#define MGAREG_TEXORG1 0x2ca4 -#define MGAREG_TEXORG2 0x2ca8 -#define MGAREG_TEXORG3 0x2cac -#define MGAREG_TEXORG4 0x2cb0 -#define MGAREG_TEXTRANS 0x2c34 -#define MGAREG_TEXTRANSHIGH 0x2c38 -#define MGAREG_TEXWIDTH 0x2c28 -#define MGAREG_WACCEPTSEQ 0x1dd4 -#define MGAREG_WCODEADDR 0x1e6c -#define MGAREG_WFLAG 0x1dc4 -#define MGAREG_WFLAG1 0x1de0 -#define MGAREG_WFLAGNB 0x1e64 -#define MGAREG_WFLAGNB1 0x1e08 -#define MGAREG_WGETMSB 0x1dc8 -#define MGAREG_WIADDR 0x1dc0 -#define MGAREG_WIADDR2 0x1dd8 -#define MGAREG_WMISC 0x1e70 -#define MGAREG_WVRTXSZ 0x1dcc -#define MGAREG_YBOT 0x1c9c -#define MGAREG_YDST 0x1c90 -#define MGAREG_YDSTLEN 0x1c88 -#define MGAREG_YDSTORG 0x1c94 -#define MGAREG_YTOP 0x1c98 -#define MGAREG_ZORG 0x1c0c - -/* Warp registers */ -#define MGAREG_WR0 0x2d00 -#define MGAREG_WR1 0x2d04 -#define MGAREG_WR2 0x2d08 -#define MGAREG_WR3 0x2d0c -#define MGAREG_WR4 0x2d10 -#define MGAREG_WR5 0x2d14 -#define MGAREG_WR6 0x2d18 -#define MGAREG_WR7 0x2d1c -#define MGAREG_WR8 0x2d20 -#define MGAREG_WR9 0x2d24 -#define MGAREG_WR10 0x2d28 -#define MGAREG_WR11 0x2d2c -#define MGAREG_WR12 0x2d30 -#define MGAREG_WR13 0x2d34 -#define MGAREG_WR14 0x2d38 -#define MGAREG_WR15 0x2d3c -#define MGAREG_WR16 0x2d40 -#define MGAREG_WR17 0x2d44 -#define MGAREG_WR18 0x2d48 -#define MGAREG_WR19 0x2d4c -#define MGAREG_WR20 0x2d50 -#define MGAREG_WR21 0x2d54 -#define MGAREG_WR22 0x2d58 -#define MGAREG_WR23 0x2d5c -#define MGAREG_WR24 0x2d60 -#define MGAREG_WR25 0x2d64 -#define MGAREG_WR26 0x2d68 -#define MGAREG_WR27 0x2d6c -#define MGAREG_WR28 0x2d70 -#define MGAREG_WR29 0x2d74 -#define MGAREG_WR30 0x2d78 -#define MGAREG_WR31 0x2d7c -#define MGAREG_WR32 0x2d80 -#define MGAREG_WR33 0x2d84 -#define MGAREG_WR34 0x2d88 -#define MGAREG_WR35 0x2d8c -#define MGAREG_WR36 0x2d90 -#define MGAREG_WR37 0x2d94 -#define MGAREG_WR38 0x2d98 -#define MGAREG_WR39 0x2d9c -#define MGAREG_WR40 0x2da0 -#define MGAREG_WR41 0x2da4 -#define MGAREG_WR42 0x2da8 -#define MGAREG_WR43 0x2dac -#define MGAREG_WR44 0x2db0 -#define MGAREG_WR45 0x2db4 -#define MGAREG_WR46 0x2db8 -#define MGAREG_WR47 0x2dbc -#define MGAREG_WR48 0x2dc0 -#define MGAREG_WR49 0x2dc4 -#define MGAREG_WR50 0x2dc8 -#define MGAREG_WR51 0x2dcc -#define MGAREG_WR52 0x2dd0 -#define MGAREG_WR53 0x2dd4 -#define MGAREG_WR54 0x2dd8 -#define MGAREG_WR55 0x2ddc -#define MGAREG_WR56 0x2de0 -#define MGAREG_WR57 0x2de4 -#define MGAREG_WR58 0x2de8 -#define MGAREG_WR59 0x2dec -#define MGAREG_WR60 0x2df0 -#define MGAREG_WR61 0x2df4 -#define MGAREG_WR62 0x2df8 -#define MGAREG_WR63 0x2dfc - -#define PDEA_pagpxfer_enable 0x2 - -#define WIA_wmode_suspend 0x0 -#define WIA_wmode_start 0x3 -#define WIA_wagp_agp 0x4 - -#define DC_opcod_line_open 0x0 -#define DC_opcod_autoline_open 0x1 -#define DC_opcod_line_close 0x2 -#define DC_opcod_autoline_close 0x3 -#define DC_opcod_trap 0x4 -#define DC_opcod_texture_trap 0x6 -#define DC_opcod_bitblt 0x8 -#define DC_opcod_iload 0x9 -#define DC_atype_rpl 0x0 -#define DC_atype_rstr 0x10 -#define DC_atype_zi 0x30 -#define DC_atype_blk 0x40 -#define DC_atype_i 0x70 -#define DC_linear_xy 0x0 -#define DC_linear_linear 0x80 -#define DC_zmode_nozcmp 0x0 -#define DC_zmode_ze 0x200 -#define DC_zmode_zne 0x300 -#define DC_zmode_zlt 0x400 -#define DC_zmode_zlte 0x500 -#define DC_zmode_zgt 0x600 -#define DC_zmode_zgte 0x700 -#define DC_solid_disable 0x0 -#define DC_solid_enable 0x800 -#define DC_arzero_disable 0x0 -#define DC_arzero_enable 0x1000 -#define DC_sgnzero_disable 0x0 -#define DC_sgnzero_enable 0x2000 -#define DC_shftzero_disable 0x0 -#define DC_shftzero_enable 0x4000 -#define DC_bop_SHIFT 16 -#define DC_trans_SHIFT 20 -#define DC_bltmod_bmonolef 0x0 -#define DC_bltmod_bmonowf 0x8000000 -#define DC_bltmod_bplan 0x2000000 -#define DC_bltmod_bfcol 0x4000000 -#define DC_bltmod_bu32bgr 0x6000000 -#define DC_bltmod_bu32rgb 0xe000000 -#define DC_bltmod_bu24bgr 0x16000000 -#define DC_bltmod_bu24rgb 0x1e000000 -#define DC_pattern_disable 0x0 -#define DC_pattern_enable 0x20000000 -#define DC_transc_disable 0x0 -#define DC_transc_enable 0x40000000 -#define DC_clipdis_disable 0x0 -#define DC_clipdis_enable 0x80000000 - - -#define SETADD_mode_vertlist 0x0 - - -#define MGA_CLEAR_CMD (DC_opcod_trap | DC_arzero_enable | \ - DC_sgnzero_enable | DC_shftzero_enable | \ - (0xC << DC_bop_SHIFT) | DC_clipdis_enable | \ - DC_solid_enable | DC_transc_enable) - - -#define MGA_COPY_CMD (DC_opcod_bitblt | DC_atype_rpl | DC_linear_xy | \ - DC_solid_disable | DC_arzero_disable | \ - DC_sgnzero_enable | DC_shftzero_enable | \ - (0xC << DC_bop_SHIFT) | DC_bltmod_bfcol | \ - DC_pattern_disable | DC_transc_disable | \ - DC_clipdis_enable) \ - -#define MGA_FLUSH_CMD (DC_opcod_texture_trap | (0xF << DC_trans_SHIFT) |\ - DC_arzero_enable | DC_sgnzero_enable | \ - DC_atype_i) +/* Warp registers + */ +#define MGA_WR0 0x2d00 +#define MGA_WR1 0x2d04 +#define MGA_WR2 0x2d08 +#define MGA_WR3 0x2d0c +#define MGA_WR4 0x2d10 +#define MGA_WR5 0x2d14 +#define MGA_WR6 0x2d18 +#define MGA_WR7 0x2d1c +#define MGA_WR8 0x2d20 +#define MGA_WR9 0x2d24 +#define MGA_WR10 0x2d28 +#define MGA_WR11 0x2d2c +#define MGA_WR12 0x2d30 +#define MGA_WR13 0x2d34 +#define MGA_WR14 0x2d38 +#define MGA_WR15 0x2d3c +#define MGA_WR16 0x2d40 +#define MGA_WR17 0x2d44 +#define MGA_WR18 0x2d48 +#define MGA_WR19 0x2d4c +#define MGA_WR20 0x2d50 +#define MGA_WR21 0x2d54 +#define MGA_WR22 0x2d58 +#define MGA_WR23 0x2d5c +#define MGA_WR24 0x2d60 +#define MGA_WR25 0x2d64 +#define MGA_WR26 0x2d68 +#define MGA_WR27 0x2d6c +#define MGA_WR28 0x2d70 +#define MGA_WR29 0x2d74 +#define MGA_WR30 0x2d78 +#define MGA_WR31 0x2d7c +#define MGA_WR32 0x2d80 +#define MGA_WR33 0x2d84 +#define MGA_WR34 0x2d88 +#define MGA_WR35 0x2d8c +#define MGA_WR36 0x2d90 +#define MGA_WR37 0x2d94 +#define MGA_WR38 0x2d98 +#define MGA_WR39 0x2d9c +#define MGA_WR40 0x2da0 +#define MGA_WR41 0x2da4 +#define MGA_WR42 0x2da8 +#define MGA_WR43 0x2dac +#define MGA_WR44 0x2db0 +#define MGA_WR45 0x2db4 +#define MGA_WR46 0x2db8 +#define MGA_WR47 0x2dbc +#define MGA_WR48 0x2dc0 +#define MGA_WR49 0x2dc4 +#define MGA_WR50 0x2dc8 +#define MGA_WR51 0x2dcc +#define MGA_WR52 0x2dd0 +#define MGA_WR53 0x2dd4 +#define MGA_WR54 0x2dd8 +#define MGA_WR55 0x2ddc +#define MGA_WR56 0x2de0 +#define MGA_WR57 0x2de4 +#define MGA_WR58 0x2de8 +#define MGA_WR59 0x2dec +#define MGA_WR60 0x2df0 +#define MGA_WR61 0x2df4 +#define MGA_WR62 0x2df8 +#define MGA_WR63 0x2dfc +# define MGA_G400_WR_MAGIC (1 << 6) +# define MGA_G400_WR56_MAGIC 0x46480000 /* 12800.0f */ + + +#define MGA_ILOAD_ALIGN 64 +#define MGA_ILOAD_MASK (MGA_ILOAD_ALIGN - 1) + +#define MGA_DWGCTL_FLUSH (MGA_OPCOD_TEXTURE_TRAP | \ + MGA_ATYPE_I | \ + MGA_ZMODE_NOZCMP | \ + MGA_ARZERO | \ + MGA_SGNZERO | \ + MGA_BOP_SRC | \ + (15 << MGA_TRANS_SHIFT)) + +#define MGA_DWGCTL_CLEAR (MGA_OPCOD_TRAP | \ + MGA_ZMODE_NOZCMP | \ + MGA_SOLID | \ + MGA_ARZERO | \ + MGA_SGNZERO | \ + MGA_SHIFTZERO | \ + MGA_BOP_SRC | \ + (0 << MGA_TRANS_SHIFT) | \ + MGA_BLTMOD_BMONOLEF | \ + MGA_TRANSC | \ + MGA_CLIPDIS) + +#define MGA_DWGCTL_COPY (MGA_OPCOD_BITBLT | \ + MGA_ATYPE_RPL | \ + MGA_SGNZERO | \ + MGA_SHIFTZERO | \ + MGA_BOP_SRC | \ + (0 << MGA_TRANS_SHIFT) | \ + MGA_BLTMOD_BFCOL | \ + MGA_CLIPDIS) + +/* 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 Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c:1.8 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c:1.11 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c:1.8 Wed Nov 8 00:03:07 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_state.c Tue Apr 10 12:08:05 2001 @@ -1,4 +1,4 @@ -/* mga_state.c -- State support for mga g200/g400 -*- linux-c -*- +/* mga_state.c -- State support for MGA G200/G400 -*- linux-c -*- * Created: Thu Jan 27 02:53:43 2000 by jhartmann@precisioninsight.com * * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. @@ -19,404 +19,400 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * - * Authors: Jeff Hartmann <jhartmann@valinux.com> - * Keith Whitwell <keithw@valinux.com> + * Authors: + * Jeff Hartmann <jhartmann@valinux.com> + * Keith Whitwell <keithw@valinux.com> * + * Rewritten by: + * Gareth Hughes <gareth@valinux.com> */ #define __NO_VERSION__ +#include "mga.h" #include "drmP.h" #include "mga_drv.h" #include "drm.h" -/* If you change the functions to set state, PLEASE - * change these values + +/* ================================================================ + * DMA hardware state programming functions */ -#define MGAEMITCLIP_SIZE 10 -#define MGAEMITCTX_SIZE 20 -#define MGAG200EMITTEX_SIZE 20 -#define MGAG400EMITTEX0_SIZE 30 -#define MGAG400EMITTEX1_SIZE 25 -#define MGAG400EMITPIPE_SIZE 50 -#define MGAG200EMITPIPE_SIZE 15 - -#define MAX_STATE_SIZE ((MGAEMITCLIP_SIZE * MGA_NR_SAREA_CLIPRECTS) + \ - MGAEMITCTX_SIZE + MGAG400EMITTEX0_SIZE + \ - MGAG400EMITTEX1_SIZE + MGAG400EMITPIPE_SIZE) - -static void mgaEmitClipRect(drm_mga_private_t * dev_priv, - drm_clip_rect_t * box) +static void mga_emit_clip_rect( drm_mga_private_t *dev_priv, + drm_clip_rect_t *box ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - PRIMLOCALS; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + unsigned int pitch = dev_priv->front_pitch; + DMA_LOCALS; - /* This takes 10 dwords */ - PRIMGETPTR(dev_priv); + BEGIN_DMA( 2 ); - /* Force reset of dwgctl on G400 (eliminates clip disable bit) */ - if (dev_priv->chipset == MGA_CARD_TYPE_G400) { -#if 0 - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGSYNC, 0); - PRIMOUTREG(MGAREG_DWGSYNC, 0); - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); -#else - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000); - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0x80000000); -#endif + /* Force reset of DWGCTL on G400 (eliminates clip disable bit). + */ + if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { + DMA_BLOCK( MGA_DWGCTL, ctx->dwgctl, + MGA_LEN + MGA_EXEC, 0x80000000, + MGA_DWGCTL, ctx->dwgctl, + MGA_LEN + MGA_EXEC, 0x80000000 ); } - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_CXBNDRY, ((box->x2) << 16) | (box->x1)); - PRIMOUTREG(MGAREG_YTOP, box->y1 * dev_priv->stride / dev_priv->cpp); - PRIMOUTREG(MGAREG_YBOT, box->y2 * dev_priv->stride / dev_priv->cpp); + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_CXBNDRY, (box->x2 << 16) | box->x1, + MGA_YTOP, box->y1 * pitch, + MGA_YBOT, box->y2 * pitch ); - PRIMADVANCE(dev_priv); + ADVANCE_DMA(); } -static void mgaEmitContext(drm_mga_private_t * dev_priv) +static inline void mga_g200_emit_context( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - PRIMLOCALS; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + DMA_LOCALS; - /* This takes a max of 20 dwords */ - PRIMGETPTR(dev_priv); + BEGIN_DMA( 3 ); - PRIMOUTREG(MGAREG_DSTORG, regs[MGA_CTXREG_DSTORG]); - PRIMOUTREG(MGAREG_MACCESS, regs[MGA_CTXREG_MACCESS]); - PRIMOUTREG(MGAREG_PLNWT, regs[MGA_CTXREG_PLNWT]); - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); + DMA_BLOCK( MGA_DSTORG, ctx->dstorg, + MGA_MACCESS, ctx->maccess, + MGA_PLNWT, ctx->plnwt, + MGA_DWGCTL, ctx->dwgctl ); - PRIMOUTREG(MGAREG_ALPHACTRL, regs[MGA_CTXREG_ALPHACTRL]); - PRIMOUTREG(MGAREG_FOGCOL, regs[MGA_CTXREG_FOGCOLOR]); - PRIMOUTREG(MGAREG_WFLAG, regs[MGA_CTXREG_WFLAG]); - PRIMOUTREG(MGAREG_ZORG, dev_priv->depthOffset); /* invarient */ + DMA_BLOCK( MGA_ALPHACTRL, ctx->alphactrl, + MGA_FOGCOL, ctx->fogcolor, + MGA_WFLAG, ctx->wflag, + MGA_ZORG, dev_priv->depth_offset ); - if (dev_priv->chipset == MGA_CARD_TYPE_G400) { - PRIMOUTREG(MGAREG_WFLAG1, regs[MGA_CTXREG_WFLAG]); - PRIMOUTREG(MGAREG_TDUALSTAGE0, regs[MGA_CTXREG_TDUAL0]); - PRIMOUTREG(MGAREG_TDUALSTAGE1, regs[MGA_CTXREG_TDUAL1]); - PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); + DMA_BLOCK( MGA_FCOL, ctx->fcol, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); - PRIMOUTREG(MGAREG_STENCIL, regs[MGA_CTXREG_STENCIL]); - PRIMOUTREG(MGAREG_STENCILCTL, regs[MGA_CTXREG_STENCILCTL]); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - } else { - PRIMOUTREG(MGAREG_FCOL, regs[MGA_CTXREG_FCOL]); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - } - - PRIMADVANCE(dev_priv); + ADVANCE_DMA(); } -static void mgaG200EmitTex(drm_mga_private_t * dev_priv) +static inline void mga_g400_emit_context( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->TexState[0]; - PRIMLOCALS; - - PRIMGETPTR(dev_priv); + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + DMA_LOCALS; - /* This takes 20 dwords */ + BEGIN_DMA( 4 ); - PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2]); - PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]); - PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]); - PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]); + DMA_BLOCK( MGA_DSTORG, ctx->dstorg, + MGA_MACCESS, ctx->maccess, + MGA_PLNWT, ctx->plnwt, + MGA_DWGCTL, ctx->dwgctl ); - PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]); - PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]); - PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]); - PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]); + DMA_BLOCK( MGA_ALPHACTRL, ctx->alphactrl, + MGA_FOGCOL, ctx->fogcolor, + MGA_WFLAG, ctx->wflag, + MGA_ZORG, dev_priv->depth_offset ); - PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); - PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); - PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(MGAREG_WR24, regs[MGA_TEXREG_WIDTH]); + DMA_BLOCK( MGA_WFLAG1, ctx->wflag, + MGA_TDUALSTAGE0, ctx->tdualstage0, + MGA_TDUALSTAGE1, ctx->tdualstage1, + MGA_FCOL, ctx->fcol ); - PRIMOUTREG(MGAREG_WR34, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); - PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); - PRIMOUTREG(MGAREG_DMAPAD, 0); + DMA_BLOCK( MGA_STENCIL, ctx->stencil, + MGA_STENCILCTL, ctx->stencilctl, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); - PRIMADVANCE(dev_priv); + ADVANCE_DMA(); } -#define TMC_dualtex_enable 0x80 - -static void mgaG400EmitTex0(drm_mga_private_t * dev_priv) +static inline void mga_g200_emit_tex0( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->TexState[0]; - PRIMLOCALS; - - PRIMGETPTR(dev_priv); - - /* This takes 30 dwords */ - - PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000); - PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]); - PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]); - PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]); + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0]; + DMA_LOCALS; - PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]); - PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]); - PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]); - PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]); + BEGIN_DMA( 4 ); - PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); - PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); - PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(MGAREG_WR49, 0); + DMA_BLOCK( MGA_TEXCTL2, tex->texctl2, + MGA_TEXCTL, tex->texctl, + MGA_TEXFILTER, tex->texfilter, + MGA_TEXBORDERCOL, tex->texbordercol ); - PRIMOUTREG(MGAREG_WR57, 0); - PRIMOUTREG(MGAREG_WR53, 0); - PRIMOUTREG(MGAREG_WR61, 0); - PRIMOUTREG(MGAREG_WR52, 0x40); + DMA_BLOCK( MGA_TEXORG, tex->texorg, + MGA_TEXORG1, tex->texorg1, + MGA_TEXORG2, tex->texorg2, + MGA_TEXORG3, tex->texorg3 ); - PRIMOUTREG(MGAREG_WR60, 0x40); - PRIMOUTREG(MGAREG_WR54, regs[MGA_TEXREG_WIDTH] | 0x40); - PRIMOUTREG(MGAREG_WR62, regs[MGA_TEXREG_HEIGHT] | 0x40); - PRIMOUTREG(MGAREG_DMAPAD, 0); + DMA_BLOCK( MGA_TEXORG4, tex->texorg4, + MGA_TEXWIDTH, tex->texwidth, + MGA_TEXHEIGHT, tex->texheight, + MGA_WR24, tex->texwidth ); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); - PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); + DMA_BLOCK( MGA_WR34, tex->texheight, + MGA_TEXTRANS, 0x0000ffff, + MGA_TEXTRANSHIGH, 0x0000ffff, + MGA_DMAPAD, 0x00000000 ); - PRIMADVANCE(dev_priv); + ADVANCE_DMA(); } -#define TMC_map1_enable 0x80000000 - -static void mgaG400EmitTex1(drm_mga_private_t * dev_priv) +static inline void mga_g400_emit_tex0( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->TexState[1]; - PRIMLOCALS; + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[0]; + DMA_LOCALS; - PRIMGETPTR(dev_priv); + BEGIN_DMA( 6 ); - /* This takes 25 dwords */ + DMA_BLOCK( MGA_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC, + MGA_TEXCTL, tex->texctl, + MGA_TEXFILTER, tex->texfilter, + MGA_TEXBORDERCOL, tex->texbordercol ); - PRIMOUTREG(MGAREG_TEXCTL2, - regs[MGA_TEXREG_CTL2] | TMC_map1_enable | 0x00008000); - PRIMOUTREG(MGAREG_TEXCTL, regs[MGA_TEXREG_CTL]); - PRIMOUTREG(MGAREG_TEXFILTER, regs[MGA_TEXREG_FILTER]); - PRIMOUTREG(MGAREG_TEXBORDERCOL, regs[MGA_TEXREG_BORDERCOL]); + DMA_BLOCK( MGA_TEXORG, tex->texorg, + MGA_TEXORG1, tex->texorg1, + MGA_TEXORG2, tex->texorg2, + MGA_TEXORG3, tex->texorg3 ); - PRIMOUTREG(MGAREG_TEXORG, regs[MGA_TEXREG_ORG]); - PRIMOUTREG(MGAREG_TEXORG1, regs[MGA_TEXREG_ORG1]); - PRIMOUTREG(MGAREG_TEXORG2, regs[MGA_TEXREG_ORG2]); - PRIMOUTREG(MGAREG_TEXORG3, regs[MGA_TEXREG_ORG3]); + DMA_BLOCK( MGA_TEXORG4, tex->texorg4, + MGA_TEXWIDTH, tex->texwidth, + MGA_TEXHEIGHT, tex->texheight, + MGA_WR49, 0x00000000 ); - PRIMOUTREG(MGAREG_TEXORG4, regs[MGA_TEXREG_ORG4]); - PRIMOUTREG(MGAREG_TEXWIDTH, regs[MGA_TEXREG_WIDTH]); - PRIMOUTREG(MGAREG_TEXHEIGHT, regs[MGA_TEXREG_HEIGHT]); - PRIMOUTREG(MGAREG_WR49, 0); + DMA_BLOCK( MGA_WR57, 0x00000000, + MGA_WR53, 0x00000000, + MGA_WR61, 0x00000000, + MGA_WR52, MGA_G400_WR_MAGIC ); - PRIMOUTREG(MGAREG_WR57, 0); - PRIMOUTREG(MGAREG_WR53, 0); - PRIMOUTREG(MGAREG_WR61, 0); - PRIMOUTREG(MGAREG_WR52, regs[MGA_TEXREG_WIDTH] | 0x40); + DMA_BLOCK( MGA_WR60, MGA_G400_WR_MAGIC, + MGA_WR54, tex->texwidth | MGA_G400_WR_MAGIC, + MGA_WR62, tex->texheight | MGA_G400_WR_MAGIC, + MGA_DMAPAD, 0x00000000 ); - PRIMOUTREG(MGAREG_WR60, regs[MGA_TEXREG_HEIGHT] | 0x40); - PRIMOUTREG(MGAREG_TEXTRANS, 0xffff); - PRIMOUTREG(MGAREG_TEXTRANSHIGH, 0xffff); - PRIMOUTREG(MGAREG_TEXCTL2, regs[MGA_TEXREG_CTL2] | 0x00008000); + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_TEXTRANS, 0x0000ffff, + MGA_TEXTRANSHIGH, 0x0000ffff ); - PRIMADVANCE(dev_priv); + ADVANCE_DMA(); } - -#define MAGIC_FPARAM_HEX_VALUE 0x46480000 -/* This is the hex value of 12800.0f which is a magic value we must - * set in wr56. - */ -static void mgaG400EmitPipe(drm_mga_private_t * dev_priv) +static inline void mga_g400_emit_tex1( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int pipe = sarea_priv->WarpPipe; - PRIMLOCALS; + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[1]; + DMA_LOCALS; - PRIMGETPTR(dev_priv); + BEGIN_DMA( 5 ); - /* This takes 50 dwords */ + DMA_BLOCK( MGA_TEXCTL2, (tex->texctl2 | + MGA_MAP1_ENABLE | + MGA_G400_TC2_MAGIC), + MGA_TEXCTL, tex->texctl, + MGA_TEXFILTER, tex->texfilter, + MGA_TEXBORDERCOL, tex->texbordercol ); + + DMA_BLOCK( MGA_TEXORG, tex->texorg, + MGA_TEXORG1, tex->texorg1, + MGA_TEXORG2, tex->texorg2, + MGA_TEXORG3, tex->texorg3 ); + + DMA_BLOCK( MGA_TEXORG4, tex->texorg4, + MGA_TEXWIDTH, tex->texwidth, + MGA_TEXHEIGHT, tex->texheight, + MGA_WR49, 0x00000000 ); + + DMA_BLOCK( MGA_WR57, 0x00000000, + MGA_WR53, 0x00000000, + MGA_WR61, 0x00000000, + MGA_WR52, tex->texwidth | MGA_G400_WR_MAGIC ); + + DMA_BLOCK( MGA_WR60, tex->texheight | MGA_G400_WR_MAGIC, + MGA_TEXTRANS, 0x0000ffff, + MGA_TEXTRANSHIGH, 0x0000ffff, + MGA_TEXCTL2, tex->texctl2 | MGA_G400_TC2_MAGIC ); - /* Establish vertex size. - */ - PRIMOUTREG(MGAREG_WIADDR2, WIA_wmode_suspend); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - - if (pipe & MGA_T2) { - PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001e09); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x1e000000); - } else { - if (dev_priv->WarpPipe & MGA_T2) { - /* Flush the WARP pipe */ - PRIMOUTREG(MGAREG_YDST, 0); - PRIMOUTREG(MGAREG_FXLEFT, 0); - PRIMOUTREG(MGAREG_FXRIGHT, 1); - PRIMOUTREG(MGAREG_DWGCTL, MGA_FLUSH_CMD); - - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 1); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); - PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); - - PRIMOUTREG(MGAREG_TEXCTL2, 0x80 | 0x00008000); - PRIMOUTREG(MGAREG_LEN + MGAREG_MGA_EXEC, 0); - PRIMOUTREG(MGAREG_TEXCTL2, 0x00008000); - PRIMOUTREG(MGAREG_DMAPAD, 0); - } - - PRIMOUTREG(MGAREG_WVRTXSZ, 0x00001807); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); + ADVANCE_DMA(); +} - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0); - PRIMOUTREG(MGAREG_WACCEPTSEQ, 0x18000000); - } +static inline void mga_g200_emit_pipe( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int pipe = sarea_priv->warp_pipe; + DMA_LOCALS; - PRIMOUTREG(MGAREG_WFLAG, 0); - PRIMOUTREG(MGAREG_WFLAG1, 0); - PRIMOUTREG(MGAREG_WR56, MAGIC_FPARAM_HEX_VALUE); - PRIMOUTREG(MGAREG_DMAPAD, 0); + BEGIN_DMA( 3 ); - PRIMOUTREG(MGAREG_WR49, 0); /* Tex stage 0 */ - PRIMOUTREG(MGAREG_WR57, 0); /* Tex stage 0 */ - PRIMOUTREG(MGAREG_WR53, 0); /* Tex stage 1 */ - PRIMOUTREG(MGAREG_WR61, 0); /* Tex stage 1 */ + DMA_BLOCK( MGA_WIADDR, MGA_WMODE_SUSPEND, + MGA_WVRTXSZ, 0x00000007, + MGA_WFLAG, 0x00000000, + MGA_WR24, 0x00000000 ); + + DMA_BLOCK( MGA_WR25, 0x00000100, + MGA_WR34, 0x00000000, + MGA_WR42, 0x0000ffff, + MGA_WR60, 0x0000ffff ); - PRIMOUTREG(MGAREG_WR54, 0x40); /* Tex stage 0 : w */ - PRIMOUTREG(MGAREG_WR62, 0x40); /* Tex stage 0 : h */ - PRIMOUTREG(MGAREG_WR52, 0x40); /* Tex stage 1 : w */ - PRIMOUTREG(MGAREG_WR60, 0x40); /* Tex stage 1 : h */ + /* Padding required to to hardware bug. + */ + DMA_BLOCK( MGA_DMAPAD, 0xffffffff, + MGA_DMAPAD, 0xffffffff, + MGA_DMAPAD, 0xffffffff, + MGA_WIADDR, (dev_priv->warp_pipe_phys[pipe] | + MGA_WMODE_START | + MGA_WAGP_ENABLE) ); - /* Dma pading required due to hw bug */ - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_WIADDR2, - (u32) (dev_priv->WarpIndex[pipe]. - phys_addr | WIA_wmode_start | WIA_wagp_agp)); - PRIMADVANCE(dev_priv); + ADVANCE_DMA(); } -static void mgaG200EmitPipe(drm_mga_private_t * dev_priv) +static inline void mga_g400_emit_pipe( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int pipe = sarea_priv->WarpPipe; - PRIMLOCALS; - - PRIMGETPTR(dev_priv); - - /* This takes 15 dwords */ + unsigned int pipe = sarea_priv->warp_pipe; + DMA_LOCALS; - PRIMOUTREG(MGAREG_WIADDR, WIA_wmode_suspend); - PRIMOUTREG(MGAREG_WVRTXSZ, 7); - PRIMOUTREG(MGAREG_WFLAG, 0); - PRIMOUTREG(MGAREG_WR24, 0); /* tex w/h */ + BEGIN_DMA( 10 ); - PRIMOUTREG(MGAREG_WR25, 0x100); - PRIMOUTREG(MGAREG_WR34, 0); /* tex w/h */ - PRIMOUTREG(MGAREG_WR42, 0xFFFF); - PRIMOUTREG(MGAREG_WR60, 0xFFFF); + DMA_BLOCK( MGA_WIADDR2, MGA_WMODE_SUSPEND, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + if ( pipe & MGA_T2 ) { + DMA_BLOCK( MGA_WVRTXSZ, 0x00001e09, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + DMA_BLOCK( MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x1e000000 ); + } else { + if ( dev_priv->warp_pipe & MGA_T2 ) { + /* Flush the WARP pipe */ + DMA_BLOCK( MGA_YDST, 0x00000000, + MGA_FXLEFT, 0x00000000, + MGA_FXRIGHT, 0x00000001, + MGA_DWGCTL, MGA_DWGCTL_FLUSH ); + + DMA_BLOCK( MGA_LEN + MGA_EXEC, 0x00000001, + MGA_DWGSYNC, 0x00007000, + MGA_TEXCTL2, MGA_G400_TC2_MAGIC, + MGA_LEN + MGA_EXEC, 0x00000000 ); + + DMA_BLOCK( MGA_TEXCTL2, (MGA_DUALTEX | + MGA_G400_TC2_MAGIC), + MGA_LEN + MGA_EXEC, 0x00000000, + MGA_TEXCTL2, MGA_G400_TC2_MAGIC, + MGA_DMAPAD, 0x00000000 ); + } - /* Dma pading required due to hw bug */ - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_DMAPAD, 0xffffffff); - PRIMOUTREG(MGAREG_WIADDR, - (u32) (dev_priv->WarpIndex[pipe]. - phys_addr | WIA_wmode_start | WIA_wagp_agp)); + DMA_BLOCK( MGA_WVRTXSZ, 0x00001807, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000 ); + + DMA_BLOCK( MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x00000000, + MGA_WACCEPTSEQ, 0x18000000 ); + } + + DMA_BLOCK( MGA_WFLAG, 0x00000000, + MGA_WFLAG1, 0x00000000, + MGA_WR56, MGA_G400_WR56_MAGIC, + MGA_DMAPAD, 0x00000000 ); + + DMA_BLOCK( MGA_WR49, 0x00000000, /* tex0 */ + MGA_WR57, 0x00000000, /* tex0 */ + MGA_WR53, 0x00000000, /* tex1 */ + MGA_WR61, 0x00000000 ); /* tex1 */ + + DMA_BLOCK( MGA_WR54, MGA_G400_WR_MAGIC, /* tex0 width */ + MGA_WR62, MGA_G400_WR_MAGIC, /* tex0 height */ + MGA_WR52, MGA_G400_WR_MAGIC, /* tex1 width */ + MGA_WR60, MGA_G400_WR_MAGIC ); /* tex1 height */ + + /* Padding required to to hardware bug */ + DMA_BLOCK( MGA_DMAPAD, 0xffffffff, + MGA_DMAPAD, 0xffffffff, + MGA_DMAPAD, 0xffffffff, + MGA_WIADDR2, (dev_priv->warp_pipe_phys[pipe] | + MGA_WMODE_START | + MGA_WAGP_ENABLE) ); - PRIMADVANCE( dev_priv ); + ADVANCE_DMA(); } -static void mgaEmitState(drm_mga_private_t * dev_priv) +static void mga_g200_emit_state( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int dirty = sarea_priv->dirty; - if (dev_priv->chipset == MGA_CARD_TYPE_G400) { - int multitex = sarea_priv->WarpPipe & MGA_T2; + if ( sarea_priv->warp_pipe != dev_priv->warp_pipe ) { + mga_g200_emit_pipe( dev_priv ); + dev_priv->warp_pipe = sarea_priv->warp_pipe; + } - if (sarea_priv->WarpPipe != dev_priv->WarpPipe) { - mgaG400EmitPipe(dev_priv); - dev_priv->WarpPipe = sarea_priv->WarpPipe; - } + if ( dirty & MGA_UPLOAD_CONTEXT ) { + mga_g200_emit_context( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_CONTEXT; + } - if (dirty & MGA_UPLOAD_CTX) { - mgaEmitContext(dev_priv); - sarea_priv->dirty &= ~MGA_UPLOAD_CTX; - } + if ( dirty & MGA_UPLOAD_TEX0 ) { + mga_g200_emit_tex0( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; + } +} - if (dirty & MGA_UPLOAD_TEX0) { - mgaG400EmitTex0(dev_priv); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; - } +static void mga_g400_emit_state( drm_mga_private_t *dev_priv ) +{ + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int dirty = sarea_priv->dirty; + int multitex = sarea_priv->warp_pipe & MGA_T2; - if ((dirty & MGA_UPLOAD_TEX1) && multitex) { - mgaG400EmitTex1(dev_priv); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX1; - } - } else { - if (sarea_priv->WarpPipe != dev_priv->WarpPipe) { - mgaG200EmitPipe(dev_priv); - dev_priv->WarpPipe = sarea_priv->WarpPipe; - } + if ( sarea_priv->warp_pipe != dev_priv->warp_pipe ) { + mga_g400_emit_pipe( dev_priv ); + dev_priv->warp_pipe = sarea_priv->warp_pipe; + } - if (dirty & MGA_UPLOAD_CTX) { - mgaEmitContext(dev_priv); - sarea_priv->dirty &= ~MGA_UPLOAD_CTX; - } + if ( dirty & MGA_UPLOAD_CONTEXT ) { + mga_g400_emit_context( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_CONTEXT; + } - if (dirty & MGA_UPLOAD_TEX0) { - mgaG200EmitTex(dev_priv); - sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; - } + if ( dirty & MGA_UPLOAD_TEX0 ) { + mga_g400_emit_tex0( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_TEX0; + } + + if ( (dirty & MGA_UPLOAD_TEX1) && multitex ) { + mga_g400_emit_tex1( dev_priv ); + sarea_priv->dirty &= ~MGA_UPLOAD_TEX1; } } + +/* ================================================================ + * SAREA state verification + */ + /* Disallow all write destinations except the front and backbuffer. */ -static int mgaVerifyContext(drm_mga_private_t * dev_priv) +static int mga_verify_context( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; - if (regs[MGA_CTXREG_DSTORG] != dev_priv->frontOffset && - regs[MGA_CTXREG_DSTORG] != dev_priv->backOffset) { - DRM_DEBUG("BAD DSTORG: %x (front %x, back %x)\n\n", - regs[MGA_CTXREG_DSTORG], dev_priv->frontOffset, - dev_priv->backOffset); - regs[MGA_CTXREG_DSTORG] = 0; - return -1; + if ( ctx->dstorg != dev_priv->front_offset && + ctx->dstorg != dev_priv->back_offset ) { + DRM_ERROR( "*** bad DSTORG: %x (front %x, back %x)\n\n", + ctx->dstorg, dev_priv->front_offset, + dev_priv->back_offset ); + ctx->dstorg = 0; + return -EINVAL; } return 0; @@ -424,590 +420,664 @@ /* Disallow texture reads from PCI space. */ -static int mgaVerifyTex(drm_mga_private_t * dev_priv, int unit) +static int mga_verify_tex( drm_mga_private_t *dev_priv, int unit ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_texture_regs_t *tex = &sarea_priv->tex_state[unit]; + unsigned int org; - if ((sarea_priv->TexState[unit][MGA_TEXREG_ORG] & 0x3) == 0x1) { - DRM_DEBUG("BAD TEXREG_ORG: %x, unit %d\n", - sarea_priv->TexState[unit][MGA_TEXREG_ORG], - unit); - sarea_priv->TexState[unit][MGA_TEXREG_ORG] = 0; - return -1; + org = tex->texorg & (MGA_TEXORGMAP_MASK | MGA_TEXORGACC_MASK); + + if ( org == (MGA_TEXORGMAP_SYSMEM | MGA_TEXORGACC_PCI) ) { + DRM_ERROR( "*** bad TEXORG: 0x%x, unit %d\n", + tex->texorg, unit ); + tex->texorg = 0; + return -EINVAL; } return 0; } -static int mgaVerifyState(drm_mga_private_t * dev_priv) +static int mga_verify_state( drm_mga_private_t *dev_priv ) { drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; unsigned int dirty = sarea_priv->dirty; - int rv = 0; + int ret = 0; - if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - if (dirty & MGA_UPLOAD_CTX) - rv |= mgaVerifyContext(dev_priv); + if ( dirty & MGA_UPLOAD_CONTEXT ) + ret |= mga_verify_context( dev_priv ); - if (dirty & MGA_UPLOAD_TEX0) - rv |= mgaVerifyTex(dev_priv, 0); + if ( dirty & MGA_UPLOAD_TEX0 ) + ret |= mga_verify_tex( dev_priv, 0 ); - if (dev_priv->chipset == MGA_CARD_TYPE_G400) { - if (dirty & MGA_UPLOAD_TEX1) - rv |= mgaVerifyTex(dev_priv, 1); + if ( dev_priv->chipset == MGA_CARD_TYPE_G400 ) { + if ( dirty & MGA_UPLOAD_TEX1 ) + ret |= mga_verify_tex( dev_priv, 1 ); - if (dirty & MGA_UPLOAD_PIPE) - rv |= (sarea_priv->WarpPipe > MGA_MAX_G400_PIPES); + if ( dirty & MGA_UPLOAD_PIPE ) + ret |= ( sarea_priv->warp_pipe > MGA_MAX_G400_PIPES ); } else { - if (dirty & MGA_UPLOAD_PIPE) - rv |= (sarea_priv->WarpPipe > MGA_MAX_G200_PIPES); + if ( dirty & MGA_UPLOAD_PIPE ) + ret |= ( sarea_priv->warp_pipe > MGA_MAX_G200_PIPES ); } - return rv == 0; + return ( ret == 0 ); } -static int mgaVerifyIload(drm_mga_private_t * dev_priv, - unsigned long bus_address, - unsigned int dstOrg, int length) +static int mga_verify_iload( drm_mga_private_t *dev_priv, + unsigned int dstorg, unsigned int length ) { - if (dstOrg < dev_priv->textureOffset || - dstOrg + length > - (dev_priv->textureOffset + dev_priv->textureSize)) { + if ( dstorg < dev_priv->texture_offset || + dstorg + length > (dev_priv->texture_offset + + dev_priv->texture_size) ) { + DRM_ERROR( "*** bad iload DSTORG: 0x%x\n", dstorg ); return -EINVAL; } - if (length % 64) { + + if ( length & MGA_ILOAD_MASK ) { + DRM_ERROR( "*** bad iload length: 0x%x\n", + length & MGA_ILOAD_MASK ); + return -EINVAL; + } + + return 0; +} + +static int mga_verify_blit( drm_mga_private_t *dev_priv, + unsigned int srcorg, unsigned int dstorg ) +{ + if ( (srcorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) || + (dstorg & 0x3) == (MGA_SRCACC_PCI | MGA_SRCMAP_SYSMEM) ) { + DRM_ERROR( "*** bad blit: src=0x%x dst=0x%x\n", + srcorg, dstorg ); return -EINVAL; } return 0; } + -/* This copies a 64 byte aligned agp region to the frambuffer - * with a standard blit, the ioctl needs to do checking */ +/* ================================================================ + * + */ -static void mga_dma_dispatch_tex_blit(drm_device_t * dev, - unsigned long bus_address, - int length, unsigned int destOrg) +static void mga_dma_dispatch_clear( drm_device_t *dev, + drm_mga_clear_t *clear ) { drm_mga_private_t *dev_priv = dev->dev_private; - int use_agp = PDEA_pagpxfer_enable | 0x00000001; - u16 y2; - PRIMLOCALS; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int nbox = sarea_priv->nbox; + int i; + DMA_LOCALS; + DRM_DEBUG( __FUNCTION__ ":\n" ); - y2 = length / 64; + 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; + + DRM_DEBUG( " from=%d,%d to=%d,%d\n", + box->x1, box->y1, box->x2, box->y2 ); + + if ( clear->flags & MGA_FRONT ) { + BEGIN_DMA( 2 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, clear->color_mask, + MGA_YDSTLEN, (box->y1 << 16) | height, + MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_FCOL, clear->clear_color, + MGA_DSTORG, dev_priv->front_offset, + MGA_DWGCTL + MGA_EXEC, + dev_priv->clear_cmd ); + + ADVANCE_DMA(); + } + + + if ( clear->flags & MGA_BACK ) { + BEGIN_DMA( 2 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, clear->color_mask, + MGA_YDSTLEN, (box->y1 << 16) | height, + MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_FCOL, clear->clear_color, + MGA_DSTORG, dev_priv->back_offset, + MGA_DWGCTL + MGA_EXEC, + dev_priv->clear_cmd ); + + ADVANCE_DMA(); + } + + if ( clear->flags & MGA_DEPTH ) { + BEGIN_DMA( 2 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, clear->depth_mask, + MGA_YDSTLEN, (box->y1 << 16) | height, + MGA_FXBNDRY, (box->x2 << 16) | box->x1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_FCOL, clear->clear_depth, + MGA_DSTORG, dev_priv->depth_offset, + MGA_DWGCTL + MGA_EXEC, + dev_priv->clear_cmd ); + + ADVANCE_DMA(); + } + + } + + BEGIN_DMA( 1 ); + + /* Force reset of DWGCTL */ + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_PLNWT, ctx->plnwt, + MGA_DWGCTL, ctx->dwgctl ); + + ADVANCE_DMA(); + + FLUSH_DMA(); +} + +static void mga_dma_dispatch_swap( drm_device_t *dev ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int nbox = sarea_priv->nbox; + int i; + DMA_LOCALS; + DRM_DEBUG( __FUNCTION__ ":\n" ); + + sarea_priv->last_frame.head = dev_priv->prim.tail; + sarea_priv->last_frame.wrap = dev_priv->prim.last_wrap; - PRIM_OVERFLOW(dev, dev_priv, 30); + BEGIN_DMA( 4 + nbox ); - PRIMOUTREG(MGAREG_DSTORG, destOrg); - PRIMOUTREG(MGAREG_MACCESS, 0x00000000); - PRIMOUTREG(MGAREG_SRCORG, (u32) bus_address | use_agp); - PRIMOUTREG(MGAREG_AR5, 64); - - PRIMOUTREG(MGAREG_PITCH, 64); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD); - - PRIMOUTREG(MGAREG_AR0, 63); - PRIMOUTREG(MGAREG_AR3, 0); - PRIMOUTREG(MGAREG_FXBNDRY, (63 << 16)); - PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, y2); - - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_SRCORG, 0); - PRIMOUTREG(MGAREG_PITCH, dev_priv->stride / dev_priv->cpp); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); - PRIMADVANCE(dev_priv); + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x00007100, + MGA_DWGSYNC, 0x00007000 ); + + DMA_BLOCK( MGA_DSTORG, dev_priv->front_offset, + MGA_MACCESS, dev_priv->maccess, + MGA_SRCORG, dev_priv->back_offset, + MGA_AR5, dev_priv->front_pitch ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_PLNWT, 0xffffffff, + MGA_DWGCTL, MGA_DWGCTL_COPY ); + + for ( i = 0 ; i < nbox ; i++ ) { + drm_clip_rect_t *box = &pbox[i]; + u32 height = box->y2 - box->y1; + u32 start = box->y1 * dev_priv->front_pitch; + + DRM_DEBUG( " from=%d,%d to=%d,%d\n", + box->x1, box->y1, box->x2, box->y2 ); + + DMA_BLOCK( MGA_AR0, start + box->x2 - 1, + MGA_AR3, start + box->x1, + MGA_FXBNDRY, ((box->x2 - 1) << 16) | box->x1, + MGA_YDSTLEN + MGA_EXEC, + (box->y1 << 16) | height ); + } + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, ctx->plnwt, + MGA_SRCORG, dev_priv->front_offset, + MGA_DWGCTL, ctx->dwgctl ); + + ADVANCE_DMA(); + + FLUSH_DMA(); + + DRM_DEBUG( "%s... done.\n", __FUNCTION__ ); } -static void mga_dma_dispatch_vertex(drm_device_t * dev, drm_buf_t * buf) +static void mga_dma_dispatch_vertex( drm_device_t *dev, drm_buf_t *buf ) { drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_buf_priv_t *buf_priv = buf->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned long address = (unsigned long) buf->bus_address; - int length = buf->used; - int use_agp = PDEA_pagpxfer_enable; + u32 address = (u32) buf->bus_address; + u32 length = (u32) buf->used; int i = 0; - PRIMLOCALS; + DMA_LOCALS; + DRM_DEBUG( "vertex: buf=%d used=%d\n", buf->idx, buf->used ); - if (buf->used) { - /* WARNING: if you change any of the state functions verify - * these numbers (Overestimating this doesn't hurt). - */ + if ( buf->used ) { buf_priv->dispatched = 1; - PRIM_OVERFLOW(dev, dev_priv, - (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS))); - mgaEmitState(dev_priv); -#if 0 - length = dev_priv->vertexsize * 3 * 4; -#endif + MGA_EMIT_STATE( dev_priv, sarea_priv->dirty ); do { - if (i < sarea_priv->nbox) { - mgaEmitClipRect(dev_priv, - &sarea_priv->boxes[i]); + if ( i < sarea_priv->nbox ) { + mga_emit_clip_rect( dev_priv, + &sarea_priv->boxes[i] ); } - PRIMGETPTR(dev_priv); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_SECADDRESS, - ((u32) address) | TT_VERTEX); - PRIMOUTREG(MGAREG_SECEND, - (((u32) (address + length)) | use_agp)); - PRIMADVANCE(dev_priv); - } while (++i < sarea_priv->nbox); - } - if (buf_priv->discard) { - if (buf_priv->dispatched == 1) - AGEBUF(dev_priv, buf_priv); + BEGIN_DMA( 1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_SECADDRESS, (address | + MGA_DMA_VERTEX), + MGA_SECEND, ((address + length) | + MGA_PAGPXFER) ); + + ADVANCE_DMA(); + } while ( ++i < sarea_priv->nbox ); + } + + if ( buf_priv->discard ) { + AGE_BUFFER( buf_priv ); + buf->pending = 0; + buf->used = 0; buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); - } + mga_freelist_put( dev, buf ); + } + FLUSH_DMA(); } - -static void mga_dma_dispatch_indices(drm_device_t * dev, - drm_buf_t * buf, - unsigned int start, unsigned int end) +static void mga_dma_dispatch_indices( drm_device_t *dev, drm_buf_t *buf, + unsigned int start, unsigned int end ) { drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_buf_priv_t *buf_priv = buf->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int address = (unsigned int) buf->bus_address; - int use_agp = PDEA_pagpxfer_enable; + u32 address = (u32) buf->bus_address; int i = 0; - PRIMLOCALS; + DMA_LOCALS; + DRM_DEBUG( "indices: buf=%d start=%d end=%d\n", buf->idx, start, end ); - if (start != end) { - /* WARNING: if you change any of the state functions verify - * these numbers (Overestimating this doesn't hurt). - */ + if ( start != end ) { buf_priv->dispatched = 1; - PRIM_OVERFLOW(dev, dev_priv, - (MAX_STATE_SIZE + (5 * MGA_NR_SAREA_CLIPRECTS))); - mgaEmitState(dev_priv); + + MGA_EMIT_STATE( dev_priv, sarea_priv->dirty ); do { - if (i < sarea_priv->nbox) { - mgaEmitClipRect(dev_priv, - &sarea_priv->boxes[i]); + if ( i < sarea_priv->nbox ) { + mga_emit_clip_rect( dev_priv, + &sarea_priv->boxes[i] ); } - PRIMGETPTR(dev_priv); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_SETUPADDRESS, - ((address + start) | - SETADD_mode_vertlist)); - PRIMOUTREG(MGAREG_SETUPEND, - ((address + end) | use_agp)); -/* ((address + start + 12) | use_agp)); */ - PRIMADVANCE(dev_priv); - } while (++i < sarea_priv->nbox); - } - if (buf_priv->discard) { - if (buf_priv->dispatched == 1) - AGEBUF(dev_priv, buf_priv); + BEGIN_DMA( 1 ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_SETUPADDRESS, address + start, + MGA_SETUPEND, ((address + end) | + MGA_PAGPXFER) ); + + ADVANCE_DMA(); + } while ( ++i < sarea_priv->nbox ); + } + + if ( buf_priv->discard ) { + AGE_BUFFER( buf_priv ); + buf->pending = 0; + buf->used = 0; buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); + + mga_freelist_put( dev, buf ); } -} + FLUSH_DMA(); +} -static void mga_dma_dispatch_clear(drm_device_t * dev, int flags, - unsigned int clear_color, - unsigned int clear_zval, - unsigned int clear_colormask, - unsigned int clear_depthmask) +/* This copies a 64 byte aligned agp region to the frambuffer with a + * standard blit, the ioctl needs to do checking. + */ +static void mga_dma_dispatch_iload( drm_device_t *dev, drm_buf_t *buf, + unsigned int dstorg, unsigned int length ) { drm_mga_private_t *dev_priv = dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - int nbox = sarea_priv->nbox; - drm_clip_rect_t *pbox = sarea_priv->boxes; - unsigned int cmd; - int i; - PRIMLOCALS; + drm_mga_buf_priv_t *buf_priv = buf->dev_private; + drm_mga_context_regs_t *ctx = &dev_priv->sarea_priv->context_state; + u32 srcorg = buf->bus_address | MGA_SRCACC_AGP | MGA_SRCMAP_SYSMEM; + u32 y2; + DMA_LOCALS; + DRM_DEBUG( "%s: buf=%d used=%d\n", + __FUNCTION__, buf->idx, buf->used ); - if (dev_priv->sgram) - cmd = MGA_CLEAR_CMD | DC_atype_blk; - else - cmd = MGA_CLEAR_CMD | DC_atype_rstr; - - PRIM_OVERFLOW(dev, dev_priv, 35 * MGA_NR_SAREA_CLIPRECTS); - - for (i = 0; i < nbox; i++) { - unsigned int height = pbox[i].y2 - pbox[i].y1; - - if (flags & MGA_FRONT) { - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_PLNWT, clear_colormask); - PRIMOUTREG(MGAREG_YDSTLEN, - (pbox[i].y1 << 16) | height); - PRIMOUTREG(MGAREG_FXBNDRY, - (pbox[i].x2 << 16) | pbox[i].x1); - - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_FCOL, clear_color); - PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset); - PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd); - } + y2 = length / 64; - if (flags & MGA_BACK) { - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_PLNWT, clear_colormask); - PRIMOUTREG(MGAREG_YDSTLEN, - (pbox[i].y1 << 16) | height); - PRIMOUTREG(MGAREG_FXBNDRY, - (pbox[i].x2 << 16) | pbox[i].x1); - - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_FCOL, clear_color); - PRIMOUTREG(MGAREG_DSTORG, dev_priv->backOffset); - PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd); - } + BEGIN_DMA( 5 ); - if (flags & MGA_DEPTH) { - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_PLNWT, clear_depthmask); - PRIMOUTREG(MGAREG_YDSTLEN, - (pbox[i].y1 << 16) | height); - PRIMOUTREG(MGAREG_FXBNDRY, - (pbox[i].x2 << 16) | pbox[i].x1); - - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_FCOL, clear_zval); - PRIMOUTREG(MGAREG_DSTORG, dev_priv->depthOffset); - PRIMOUTREG(MGAREG_DWGCTL + MGAREG_MGA_EXEC, cmd); - } - } + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x00007100, + MGA_DWGSYNC, 0x00007000 ); - /* Force reset of DWGCTL */ - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); - PRIMADVANCE(dev_priv); + DMA_BLOCK( MGA_DSTORG, dstorg, + MGA_MACCESS, 0x00000000, + MGA_SRCORG, srcorg, + MGA_AR5, 64 ); + + DMA_BLOCK( MGA_PITCH, 64, + MGA_PLNWT, 0xffffffff, + MGA_DMAPAD, 0x00000000, + MGA_DWGCTL, MGA_DWGCTL_COPY ); + + DMA_BLOCK( MGA_AR0, 63, + MGA_AR3, 0, + MGA_FXBNDRY, (63 << 16) | 0, + MGA_YDSTLEN + MGA_EXEC, y2 ); + + DMA_BLOCK( MGA_PLNWT, ctx->plnwt, + MGA_SRCORG, dev_priv->front_offset, + MGA_PITCH, dev_priv->front_pitch, + MGA_DWGSYNC, 0x00007000 ); + + ADVANCE_DMA(); + + AGE_BUFFER( buf_priv ); + + buf->pending = 0; + buf->used = 0; + buf_priv->dispatched = 0; + + mga_freelist_put( dev, buf ); + + FLUSH_DMA(); } -static void mga_dma_dispatch_swap(drm_device_t * dev) +static void mga_dma_dispatch_blit( drm_device_t *dev, + drm_mga_blit_t *blit ) { drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - unsigned int *regs = sarea_priv->ContextState; - int nbox = sarea_priv->nbox; + drm_mga_context_regs_t *ctx = &sarea_priv->context_state; drm_clip_rect_t *pbox = sarea_priv->boxes; - int i; - int pixel_stride = dev_priv->stride / dev_priv->cpp; + int nbox = sarea_priv->nbox; + u32 scandir = 0, i; + DMA_LOCALS; + DRM_DEBUG( __FUNCTION__ ":\n" ); + + BEGIN_DMA( 4 + nbox ); + + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_DMAPAD, 0x00000000, + MGA_DWGSYNC, 0x00007100, + MGA_DWGSYNC, 0x00007000 ); + + DMA_BLOCK( MGA_DWGCTL, MGA_DWGCTL_COPY, + MGA_PLNWT, blit->planemask, + MGA_SRCORG, blit->srcorg, + MGA_DSTORG, blit->dstorg ); + + DMA_BLOCK( MGA_SGN, scandir, + MGA_MACCESS, dev_priv->maccess, + MGA_AR5, blit->ydir * blit->src_pitch, + MGA_PITCH, blit->dst_pitch ); + + for ( i = 0 ; i < nbox ; i++ ) { + int srcx = pbox[i].x1 + blit->delta_sx; + int srcy = pbox[i].y1 + blit->delta_sy; + int dstx = pbox[i].x1 + blit->delta_dx; + int dsty = pbox[i].y1 + blit->delta_dy; + int h = pbox[i].y2 - pbox[i].y1; + int w = pbox[i].x2 - pbox[i].x1 - 1; + int start; - PRIMLOCALS; + if ( blit->ydir == -1 ) { + srcy = blit->height - srcy - 1; + } - PRIM_OVERFLOW(dev, dev_priv, (MGA_NR_SAREA_CLIPRECTS * 5) + 20); + start = srcy * blit->src_pitch + srcx; - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7100); - PRIMOUTREG(MGAREG_DWGSYNC, 0x7000); - - PRIMOUTREG(MGAREG_DSTORG, dev_priv->frontOffset); - PRIMOUTREG(MGAREG_MACCESS, dev_priv->mAccess); - PRIMOUTREG(MGAREG_SRCORG, dev_priv->backOffset); - PRIMOUTREG(MGAREG_AR5, pixel_stride); - - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DWGCTL, MGA_COPY_CMD); - - for (i = 0; i < nbox; i++) { - unsigned int h = pbox[i].y2 - pbox[i].y1; - unsigned int start = pbox[i].y1 * pixel_stride; - - PRIMOUTREG(MGAREG_AR0, start + pbox[i].x2 - 1); - PRIMOUTREG(MGAREG_AR3, start + pbox[i].x1); - PRIMOUTREG(MGAREG_FXBNDRY, - pbox[i].x1 | ((pbox[i].x2 - 1) << 16)); - PRIMOUTREG(MGAREG_YDSTLEN + MGAREG_MGA_EXEC, - (pbox[i].y1 << 16) | h); + DMA_BLOCK( MGA_AR0, start + w, + MGA_AR3, start, + MGA_FXBNDRY, ((dstx + w) << 16) | (dstx & 0xffff), + MGA_YDSTLEN + MGA_EXEC, (dsty << 16) | h ); } + /* Do something to flush AGP? + */ + /* Force reset of DWGCTL */ - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_DMAPAD, 0); - PRIMOUTREG(MGAREG_SRCORG, 0); - PRIMOUTREG(MGAREG_DWGCTL, regs[MGA_CTXREG_DWGCTL]); + DMA_BLOCK( MGA_DMAPAD, 0x00000000, + MGA_PLNWT, ctx->plnwt, + MGA_PITCH, dev_priv->front_pitch, + MGA_DWGCTL, ctx->dwgctl ); - PRIMADVANCE(dev_priv); + ADVANCE_DMA(); } + + +/* ================================================================ + * + */ -int mga_clear_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_clear( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; + drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_mga_clear_t clear; - if (copy_from_user(&clear, (drm_mga_clear_t *) arg, sizeof(clear))) - return -EFAULT; + LOCK_TEST_WITH_RETURN( dev ); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_clear_bufs called without lock held\n"); - return -EINVAL; - } + if ( copy_from_user( &clear, (drm_mga_clear_t *) arg, sizeof(clear) ) ) + return -EFAULT; - if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; + WRAP_TEST_WITH_RETURN( dev_priv ); + + mga_dma_dispatch_clear( dev, &clear ); + /* Make sure we restore the 3D state next time. */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX; - mga_dma_dispatch_clear(dev, clear.flags, - clear.clear_color, - clear.clear_depth, - clear.clear_color_mask, - clear.clear_depth_mask); - PRIMUPDATE(dev_priv); - mga_flush_write_combine(); - mga_dma_schedule(dev, 1); + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; + return 0; } -int mga_swap_bufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_swap( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; + drm_mga_private_t *dev_priv = dev->dev_private; drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_swap_bufs called without lock held\n"); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); - if (sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS) + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; + WRAP_TEST_WITH_RETURN( dev_priv ); + + mga_dma_dispatch_swap( dev ); + /* Make sure we restore the 3D state next time. */ - dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CTX; - mga_dma_dispatch_swap(dev); - PRIMUPDATE(dev_priv); - set_bit(MGA_BUF_SWAP_PENDING, - &dev_priv->current_prim->buffer_status); - mga_flush_write_combine(); - mga_dma_schedule(dev, 1); + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; + return 0; } -int mga_iload(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_vertex( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; + drm_mga_private_t *dev_priv = dev->dev_private; drm_device_dma_t *dma = dev->dma; - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; - drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; drm_buf_t *buf; drm_mga_buf_priv_t *buf_priv; - drm_mga_iload_t iload; - unsigned long bus_address; + drm_mga_vertex_t vertex; - if (copy_from_user(&iload, (drm_mga_iload_t *) arg, sizeof(iload))) - return -EFAULT; + LOCK_TEST_WITH_RETURN( dev ); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_iload called without lock held\n"); - return -EINVAL; - } + if ( copy_from_user( &vertex, + (drm_mga_vertex_t *)arg, + sizeof(vertex) ) ) + return -EFAULT; - buf = dma->buflist[iload.idx]; + buf = dma->buflist[vertex.idx]; buf_priv = buf->dev_private; - bus_address = buf->bus_address; - if (mgaVerifyIload(dev_priv, - bus_address, iload.destOrg, iload.length)) { - mga_freelist_put(dev, buf); + buf->used = vertex.used; + buf_priv->discard = vertex.discard; + + if ( !mga_verify_state( dev_priv ) ) { + if ( vertex.discard ) { + if ( buf_priv->dispatched == 1 ) + AGE_BUFFER( buf_priv ); + buf_priv->dispatched = 0; + mga_freelist_put( dev, buf ); + } return -EINVAL; } + + WRAP_TEST_WITH_RETURN( dev_priv ); - sarea_priv->dirty |= MGA_UPLOAD_CTX; + mga_dma_dispatch_vertex( dev, buf ); - mga_dma_dispatch_tex_blit(dev, bus_address, iload.length, - iload.destOrg); - AGEBUF(dev_priv, buf_priv); - buf_priv->discard = 1; - mga_freelist_put(dev, buf); - mga_flush_write_combine(); - mga_dma_schedule(dev, 1); return 0; } -int mga_vertex(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_indices( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; + drm_mga_private_t *dev_priv = dev->dev_private; drm_device_dma_t *dma = dev->dma; drm_buf_t *buf; drm_mga_buf_priv_t *buf_priv; - drm_mga_vertex_t vertex; + drm_mga_indices_t indices; - if (copy_from_user(&vertex, (drm_mga_vertex_t *) arg, sizeof(vertex))) - return -EFAULT; + LOCK_TEST_WITH_RETURN( dev ); - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_vertex called without lock held\n"); - return -EINVAL; - } + if ( copy_from_user( &indices, + (drm_mga_indices_t *)arg, + sizeof(indices) ) ) + return -EFAULT; - buf = dma->buflist[vertex.idx]; + buf = dma->buflist[indices.idx]; buf_priv = buf->dev_private; - buf->used = vertex.used; - buf_priv->discard = vertex.discard; + buf_priv->discard = indices.discard; - if (!mgaVerifyState(dev_priv)) { - if (vertex.discard) { - if (buf_priv->dispatched == 1) - AGEBUF(dev_priv, buf_priv); + if ( !mga_verify_state( dev_priv ) ) { + if ( indices.discard ) { + if ( buf_priv->dispatched == 1 ) + AGE_BUFFER( buf_priv ); buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); + mga_freelist_put( dev, buf ); } return -EINVAL; } + + WRAP_TEST_WITH_RETURN( dev_priv ); - mga_dma_dispatch_vertex(dev, buf); + mga_dma_dispatch_indices( dev, buf, indices.start, indices.end ); - PRIMUPDATE(dev_priv); - mga_flush_write_combine(); - mga_dma_schedule(dev, 1); return 0; } - -int mga_indices(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) +int mga_dma_iload( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - drm_mga_private_t *dev_priv = - (drm_mga_private_t *) dev->dev_private; drm_device_dma_t *dma = dev->dma; + drm_mga_private_t *dev_priv = dev->dev_private; drm_buf_t *buf; drm_mga_buf_priv_t *buf_priv; - drm_mga_indices_t indices; + drm_mga_iload_t iload; + DRM_DEBUG( __FUNCTION__ ":\n" ); - if (copy_from_user(&indices, - (drm_mga_indices_t *)arg, sizeof(indices))) + LOCK_TEST_WITH_RETURN( dev ); + + if ( copy_from_user( &iload, (drm_mga_iload_t *)arg, sizeof(iload) ) ) return -EFAULT; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_indices called without lock held\n"); - return -EINVAL; +#if 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[indices.idx]; + buf = dma->buflist[iload.idx]; buf_priv = buf->dev_private; - - buf_priv->discard = indices.discard; - if (!mgaVerifyState(dev_priv)) { - if (indices.discard) { - if (buf_priv->dispatched == 1) - AGEBUF(dev_priv, buf_priv); - buf_priv->dispatched = 0; - mga_freelist_put(dev, buf); - } + if ( mga_verify_iload( dev_priv, iload.dstorg, iload.length ) ) { + mga_freelist_put( dev, buf ); return -EINVAL; } - - mga_dma_dispatch_indices(dev, buf, indices.start, indices.end); - PRIMUPDATE(dev_priv); - mga_flush_write_combine(); - mga_dma_schedule(dev, 1); - return 0; -} + WRAP_TEST_WITH_RETURN( dev_priv ); + mga_dma_dispatch_iload( dev, buf, iload.dstorg, iload.length ); + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; -static int mga_dma_get_buffers(drm_device_t * dev, drm_dma_t * d) -{ - int i; - drm_buf_t *buf; - - for (i = d->granted_count; i < d->request_count; i++) { - buf = mga_freelist_get(dev); - if (!buf) - break; - buf->pid = current->pid; - if (copy_to_user(&d->request_indices[i], - &buf->idx, sizeof(buf->idx))) - return -EFAULT; - if (copy_to_user(&d->request_sizes[i], - &buf->total, sizeof(buf->total))) - return -EFAULT; - ++d->granted_count; - } return 0; } -int mga_dma(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) +int mga_dma_blit( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - int retcode = 0; - drm_dma_t d; + drm_mga_private_t *dev_priv = dev->dev_private; + drm_mga_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_mga_blit_t blit; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); - if (copy_from_user(&d, (drm_dma_t *) arg, sizeof(d))) + if ( copy_from_user( &blit, (drm_mga_blit_t *)arg, sizeof(blit) ) ) return -EFAULT; - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("mga_dma called without lock held\n"); - return -EINVAL; - } + if ( sarea_priv->nbox > MGA_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = MGA_NR_SAREA_CLIPRECTS; - /* Please don't send us buffers. - */ - if (d.send_count != 0) { - DRM_ERROR - ("Process %d trying to send %d buffers via drmDMA\n", - current->pid, d.send_count); + if ( mga_verify_blit( dev_priv, blit.srcorg, blit.dstorg ) ) return -EINVAL; - } - /* We'll send you buffers. - */ - if (d.request_count < 0 || d.request_count > dma->buf_count) { - DRM_ERROR - ("Process %d trying to get %d buffers (of %d max)\n", - current->pid, d.request_count, dma->buf_count); - return -EINVAL; - } + WRAP_TEST_WITH_RETURN( dev_priv ); - d.granted_count = 0; + mga_dma_dispatch_blit( dev, &blit ); - if (d.request_count) { - retcode = mga_dma_get_buffers(dev, &d); - } + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= MGA_UPLOAD_CONTEXT; - if (copy_to_user((drm_dma_t *) arg, &d, sizeof(d))) - return -EFAULT; - return retcode; + return 0; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h:1.1 --- /dev/null Mon Jun 4 12:41:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_ucode.h Wed Mar 21 13:08:56 2001 @@ -0,0 +1,11645 @@ +/* mga_ucode.h -- Matrox G200/G400 WARP engine microcode -*- linux-c -*- + * Created: Thu Jan 11 21:20:43 2001 by gareth@valinux.com + * + * Copyright 1999 Matrox Graphics Inc. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * MATROX GRAPHICS INC., OR ANY OTHER CONTRIBUTORS BE LIABLE FOR ANY CLAIM, + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE + * OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Kernel-based WARP engine management: + * Gareth Hughes <gareth@valinux.com> + */ + +/* + * WARP pipes are named according to the functions they perform, where: + * + * - T stands for computation of texture stage 0 + * - T2 stands for computation of both texture stage 0 and texture stage 1 + * - G stands for computation of triangle intensity (Gouraud interpolation) + * - Z stands for computation of Z buffer interpolation + * - S stands for computation of specular highlight + * - A stands for computation of the alpha channel + * - F stands for computation of vertex fog interpolation + */ + +static unsigned char warp_g200_tgz[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x72, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x60, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x03, 0x80, 0x0A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x3C, 0x27, 0x4F, 0xE9, + +0x57, 0x39, 0x20, 0xE9, +0x28, 0x19, 0x60, 0xEC, + +0x2B, 0x32, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0xB3, 0x05, +0x00, 0xE0, +0x16, 0x28, 0x20, 0xE9, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x2B, 0x20, 0xE9, + +0x1C, 0x80, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x85, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x84, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x82, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x7F, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgza[] = { + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x7D, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x6B, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x44, 0x4C, 0xB6, +0x25, 0x44, 0x54, 0xB6, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x07, 0xC0, 0x44, 0xC6, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x3C, 0x27, 0x4F, 0xE9, + +0x1F, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x3F, 0x3D, 0x5D, 0x9F, +0x00, 0xE0, +0x07, 0x20, + +0x00, 0x80, 0x00, 0xE8, +0x28, 0x19, 0x60, 0xEC, + +0xB3, 0x05, +0x00, 0xE0, +0x00, 0x80, 0x00, 0xE8, + +0x23, 0x3B, 0x33, 0xAD, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0x26, 0x1F, 0xDF, +0x9D, 0x1F, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x9E, 0x3F, 0x4F, 0xE9, + +0x07, 0x07, 0x1F, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x9C, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x7A, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x79, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x77, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x74, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzaf[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x83, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x6F, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0D, 0x21, 0x1A, 0xB6, +0x05, 0x21, 0x31, 0xB6, + +0x2D, 0x44, 0x4C, 0xB6, +0x25, 0x44, 0x54, 0xB6, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x0D, 0x20, +0x05, 0x20, +0x2F, 0xC0, 0x21, 0xC6, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x3C, 0x27, 0x4F, 0xE9, + +0x00, 0xE0, +0x25, 0x20, +0x07, 0xC0, 0x44, 0xC6, + +0x17, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x2D, 0x20, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x1F, 0x62, 0x57, 0x9F, +0x00, 0xE0, +0x07, 0x20, + +0x3F, 0x3D, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x28, 0x19, 0x60, 0xEC, + +0xB3, 0x05, +0x00, 0xE0, +0x17, 0x26, 0x17, 0xDF, + +0x23, 0x3B, 0x33, 0xAD, +0x35, 0x17, 0x4F, 0xE9, + +0x1F, 0x26, 0x1F, 0xDF, +0x9D, 0x1F, 0x4F, 0xE9, + +0x9E, 0x3F, 0x4F, 0xE9, +0x39, 0x37, 0x4F, 0xE9, + +0x2F, 0x2F, 0x17, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x07, 0x07, 0x1F, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x31, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x9C, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x74, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x73, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x71, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x6E, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzf[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x7F, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x6B, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0D, 0x21, 0x1A, 0xB6, +0x05, 0x21, 0x31, 0xB6, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x0D, 0x20, +0x05, 0x20, +0x2F, 0xC0, 0x21, 0xC6, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x3C, 0x27, 0x4F, 0xE9, + +0x17, 0x50, 0x56, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x00, 0x80, 0x00, 0xE8, +0x28, 0x19, 0x60, 0xEC, + +0xB3, 0x05, +0x00, 0xE0, +0x00, 0x80, 0x00, 0xE8, + +0x23, 0x3B, 0x33, 0xAD, +0x00, 0x80, 0x00, 0xE8, + +0x17, 0x26, 0x17, 0xDF, +0x35, 0x17, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x39, 0x37, 0x4F, 0xE9, + +0x2F, 0x2F, 0x17, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x31, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x78, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x77, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x75, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x72, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzs[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x8B, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x77, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x21, 0x1A, 0xB0, +0x25, 0x21, 0x31, 0xB0, + +0x0D, 0x21, 0x1A, 0xB2, +0x05, 0x21, 0x31, 0xB2, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x05, 0x20, +0x0D, 0x20, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x2F, 0xC0, 0x21, 0xC0, + +0x16, 0x42, 0x56, 0x9F, +0x3C, 0x27, 0x4F, 0xE9, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x21, 0x31, 0xB4, +0x2D, 0x21, 0x1A, 0xB4, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0x05, +0x00, 0xE0, +0x28, 0x19, 0x60, 0xEC, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x26, 0x1E, 0xDF, + +0xA7, 0x1E, 0x4F, 0xE9, +0x17, 0x26, 0x16, 0xDF, + +0x2D, 0x20, +0x00, 0xE0, +0xA8, 0x3F, 0x4F, 0xE9, + +0x2F, 0x2F, 0x1E, 0xAF, +0x25, 0x20, +0x00, 0xE0, + +0xA4, 0x16, 0x4F, 0xE9, +0x0F, 0xC0, 0x21, 0xC2, + +0xA6, 0x80, 0x4F, 0xE9, +0x1F, 0x62, 0x57, 0x9F, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0xE0, +0x8F, 0x20, + +0xA5, 0x37, 0x4F, 0xE9, +0x0F, 0x17, 0x0F, 0xAF, + +0x06, 0xC0, 0x21, 0xC4, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0xA3, 0x80, 0x4F, 0xE9, + +0x06, 0x20, +0x00, 0xE0, +0x1F, 0x26, 0x1F, 0xDF, + +0xA1, 0x1F, 0x4F, 0xE9, +0xA2, 0x3F, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x06, 0x06, 0x1F, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x6C, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x6B, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x69, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzsa[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x8F, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x7B, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x21, 0x1A, 0xB0, +0x25, 0x21, 0x31, 0xB0, + +0x0D, 0x21, 0x1A, 0xB2, +0x05, 0x21, 0x31, 0xB2, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x05, 0x20, +0x0D, 0x20, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x2F, 0xC0, 0x21, 0xC0, + +0x16, 0x42, 0x56, 0x9F, +0x3C, 0x27, 0x4F, 0xE9, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x21, 0x31, 0xB4, +0x2D, 0x21, 0x1A, 0xB4, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0x05, +0x00, 0xE0, +0x28, 0x19, 0x60, 0xEC, + +0x0D, 0x44, 0x4C, 0xB6, +0x05, 0x44, 0x54, 0xB6, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x26, 0x1E, 0xDF, + +0xA7, 0x1E, 0x4F, 0xE9, +0x17, 0x26, 0x16, 0xDF, + +0x2D, 0x20, +0x00, 0xE0, +0xA8, 0x3F, 0x4F, 0xE9, + +0x2F, 0x2F, 0x1E, 0xAF, +0x25, 0x20, +0x00, 0xE0, + +0xA4, 0x16, 0x4F, 0xE9, +0x0F, 0xC0, 0x21, 0xC2, + +0xA6, 0x80, 0x4F, 0xE9, +0x1F, 0x62, 0x57, 0x9F, + +0x0D, 0x20, +0x05, 0x20, +0x00, 0x80, 0x00, 0xE8, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0xE0, +0x0F, 0x20, + +0x17, 0x50, 0x56, 0x9F, +0xA5, 0x37, 0x4F, 0xE9, + +0x06, 0xC0, 0x21, 0xC4, +0x0F, 0x17, 0x0F, 0xAF, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x2F, 0xC0, 0x44, 0xC6, +0xA3, 0x80, 0x4F, 0xE9, + +0x06, 0x20, +0x00, 0xE0, +0x1F, 0x26, 0x1F, 0xDF, + +0x17, 0x26, 0x17, 0xDF, +0x9D, 0x17, 0x4F, 0xE9, + +0xA1, 0x1F, 0x4F, 0xE9, +0xA2, 0x3F, 0x4F, 0xE9, + +0x06, 0x06, 0x1F, 0xAF, +0x00, 0xE0, +0xAF, 0x20, + +0x9E, 0x37, 0x4F, 0xE9, +0x2F, 0x17, 0x2F, 0xAF, + +0xA0, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x9C, 0x80, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x68, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x67, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x65, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x62, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzsaf[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x94, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x80, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x21, 0x1A, 0xB0, +0x25, 0x21, 0x31, 0xB0, + +0x0D, 0x21, 0x1A, 0xB2, +0x05, 0x21, 0x31, 0xB2, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x05, 0x20, +0x0D, 0x20, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x2F, 0xC0, 0x21, 0xC0, + +0x16, 0x42, 0x56, 0x9F, +0x3C, 0x27, 0x4F, 0xE9, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x21, 0x31, 0xB4, +0x2D, 0x21, 0x1A, 0xB4, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0x05, +0x00, 0xE0, +0x28, 0x19, 0x60, 0xEC, + +0x0D, 0x21, 0x1A, 0xB6, +0x05, 0x21, 0x31, 0xB6, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x26, 0x1E, 0xDF, + +0xA7, 0x1E, 0x4F, 0xE9, +0x17, 0x26, 0x16, 0xDF, + +0x2D, 0x20, +0x00, 0xE0, +0xA8, 0x3F, 0x4F, 0xE9, + +0x2F, 0x2F, 0x1E, 0xAF, +0x25, 0x20, +0x00, 0xE0, + +0xA4, 0x16, 0x4F, 0xE9, +0x0F, 0xC0, 0x21, 0xC2, + +0xA6, 0x80, 0x4F, 0xE9, +0x1F, 0x62, 0x57, 0x9F, + +0x0D, 0x20, +0x05, 0x20, +0x2F, 0xC0, 0x21, 0xC6, + +0x2D, 0x44, 0x4C, 0xB6, +0x25, 0x44, 0x54, 0xB6, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0xE0, +0x0F, 0x20, + +0x2D, 0x20, +0x25, 0x20, +0x07, 0xC0, 0x44, 0xC6, + +0x17, 0x50, 0x56, 0x9F, +0xA5, 0x37, 0x4F, 0xE9, + +0x06, 0xC0, 0x21, 0xC4, +0x0F, 0x17, 0x0F, 0xAF, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x3E, 0x3D, 0x5D, 0x9F, +0x00, 0xE0, +0x07, 0x20, + +0x2F, 0x20, +0x00, 0xE0, +0xA3, 0x0F, 0x4F, 0xE9, + +0x06, 0x20, +0x00, 0xE0, +0x1F, 0x26, 0x1F, 0xDF, + +0x17, 0x26, 0x17, 0xDF, +0xA1, 0x1F, 0x4F, 0xE9, + +0x1E, 0x26, 0x1E, 0xDF, +0x9D, 0x1E, 0x4F, 0xE9, + +0x35, 0x17, 0x4F, 0xE9, +0xA2, 0x3F, 0x4F, 0xE9, + +0x06, 0x06, 0x1F, 0xAF, +0x39, 0x37, 0x4F, 0xE9, + +0x2F, 0x2F, 0x17, 0xAF, +0x07, 0x07, 0x1E, 0xAF, + +0xA0, 0x80, 0x4F, 0xE9, +0x9E, 0x3E, 0x4F, 0xE9, + +0x31, 0x80, 0x4F, 0xE9, +0x9C, 0x80, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x63, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x62, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x60, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x5D, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g200_tgzsf[] = { + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x98, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x81, 0x04, +0x89, 0x04, +0x01, 0x04, +0x09, 0x04, + +0xC9, 0x41, 0xC0, 0xEC, +0x11, 0x04, +0x00, 0xE0, + +0x41, 0xCC, 0x41, 0xCD, +0x49, 0xCC, 0x49, 0xCD, + +0xD1, 0x41, 0xC0, 0xEC, +0x51, 0xCC, 0x51, 0xCD, + +0x80, 0x04, +0x10, 0x04, +0x08, 0x04, +0x00, 0xE0, + +0x00, 0xCC, 0xC0, 0xCD, +0xD1, 0x49, 0xC0, 0xEC, + +0x8A, 0x1F, 0x20, 0xE9, +0x8B, 0x3F, 0x20, 0xE9, + +0x41, 0x3C, 0x41, 0xAD, +0x49, 0x3C, 0x49, 0xAD, + +0x10, 0xCC, 0x10, 0xCD, +0x08, 0xCC, 0x08, 0xCD, + +0xB9, 0x41, 0x49, 0xBB, +0x1F, 0xF0, 0x41, 0xCD, + +0x51, 0x3C, 0x51, 0xAD, +0x00, 0x98, 0x80, 0xE9, + +0x8F, 0x80, 0x07, 0xEA, +0x24, 0x1F, 0x20, 0xE9, + +0x21, 0x45, 0x80, 0xE8, +0x1A, 0x4D, 0x80, 0xE8, + +0x31, 0x55, 0x80, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0x41, 0x49, 0xBD, +0x1D, 0x41, 0x51, 0xBD, + +0x2E, 0x41, 0x2A, 0xB8, +0x34, 0x53, 0xA0, 0xE8, + +0x15, 0x30, +0x1D, 0x30, +0x58, 0xE3, +0x00, 0xE0, + +0xB5, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x24, 0x43, 0xA0, 0xE8, +0x2C, 0x4B, 0xA0, 0xE8, + +0x15, 0x72, +0x09, 0xE3, +0x00, 0xE0, +0x1D, 0x72, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0x97, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x6C, 0x64, 0xC8, 0xEC, +0x98, 0xE1, +0xB5, 0x05, + +0xBD, 0x05, +0x2E, 0x30, +0x32, 0xC0, 0xA0, 0xE8, + +0x33, 0xC0, 0xA0, 0xE8, +0x74, 0x64, 0xC8, 0xEC, + +0x40, 0x3C, 0x40, 0xAD, +0x32, 0x6A, +0x2A, 0x30, + +0x20, 0x73, +0x33, 0x6A, +0x00, 0xE0, +0x28, 0x73, + +0x1C, 0x72, +0x83, 0xE2, +0x7B, 0x80, 0x15, 0xEA, + +0xB8, 0x3D, 0x28, 0xDF, +0x30, 0x35, 0x20, 0xDF, + +0x40, 0x30, +0x00, 0xE0, +0xCC, 0xE2, +0x64, 0x72, + +0x25, 0x42, 0x52, 0xBF, +0x2D, 0x42, 0x4A, 0xBF, + +0x30, 0x2E, 0x30, 0xDF, +0x38, 0x2E, 0x38, 0xDF, + +0x18, 0x1D, 0x45, 0xE9, +0x1E, 0x15, 0x45, 0xE9, + +0x2B, 0x49, 0x51, 0xBD, +0x00, 0xE0, +0x1F, 0x73, + +0x38, 0x38, 0x40, 0xAF, +0x30, 0x30, 0x40, 0xAF, + +0x24, 0x1F, 0x24, 0xDF, +0x1D, 0x32, 0x20, 0xE9, + +0x2C, 0x1F, 0x2C, 0xDF, +0x1A, 0x33, 0x20, 0xE9, + +0xB0, 0x10, +0x08, 0xE3, +0x40, 0x10, +0xB8, 0x10, + +0x26, 0xF0, 0x30, 0xCD, +0x2F, 0xF0, 0x38, 0xCD, + +0x2B, 0x80, 0x20, 0xE9, +0x2A, 0x80, 0x20, 0xE9, + +0xA6, 0x20, +0x88, 0xE2, +0x00, 0xE0, +0xAF, 0x20, + +0x28, 0x2A, 0x26, 0xAF, +0x20, 0x2A, 0xC0, 0xAF, + +0x34, 0x1F, 0x34, 0xDF, +0x46, 0x24, 0x46, 0xDF, + +0x28, 0x30, 0x80, 0xBF, +0x20, 0x38, 0x80, 0xBF, + +0x47, 0x24, 0x47, 0xDF, +0x4E, 0x2C, 0x4E, 0xDF, + +0x4F, 0x2C, 0x4F, 0xDF, +0x56, 0x34, 0x56, 0xDF, + +0x28, 0x15, 0x28, 0xDF, +0x20, 0x1D, 0x20, 0xDF, + +0x57, 0x34, 0x57, 0xDF, +0x00, 0xE0, +0x1D, 0x05, + +0x04, 0x80, 0x10, 0xEA, +0x89, 0xE2, +0x2B, 0x30, + +0x3F, 0xC1, 0x1D, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x68, +0xBF, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x20, 0xC0, 0x20, 0xAF, +0x28, 0x05, +0x97, 0x74, + +0x00, 0xE0, +0x2A, 0x10, +0x16, 0xC0, 0x20, 0xE9, + +0x04, 0x80, 0x10, 0xEA, +0x8C, 0xE2, +0x95, 0x05, + +0x28, 0xC1, 0x28, 0xAD, +0x1F, 0xC1, 0x15, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xA8, 0x67, +0x9F, 0x6B, +0x00, 0x80, 0x00, 0xE8, + +0x28, 0xC0, 0x28, 0xAD, +0x1D, 0x25, +0x20, 0x05, + +0x28, 0x32, 0x80, 0xAD, +0x40, 0x2A, 0x40, 0xBD, + +0x1C, 0x80, 0x20, 0xE9, +0x20, 0x33, 0x20, 0xAD, + +0x20, 0x73, +0x00, 0xE0, +0xB6, 0x49, 0x51, 0xBB, + +0x26, 0x2F, 0xB0, 0xE8, +0x19, 0x20, 0x20, 0xE9, + +0x35, 0x20, 0x35, 0xDF, +0x3D, 0x20, 0x3D, 0xDF, + +0x15, 0x20, 0x15, 0xDF, +0x1D, 0x20, 0x1D, 0xDF, + +0x26, 0xD0, 0x26, 0xCD, +0x29, 0x49, 0x2A, 0xB8, + +0x26, 0x40, 0x80, 0xBD, +0x3B, 0x48, 0x50, 0xBD, + +0x3E, 0x54, 0x57, 0x9F, +0x00, 0xE0, +0x82, 0xE1, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x26, 0x30, +0x29, 0x30, +0x48, 0x3C, 0x48, 0xAD, + +0x2B, 0x72, +0xC2, 0xE1, +0x2C, 0xC0, 0x44, 0xC2, + +0x05, 0x24, 0x34, 0xBF, +0x0D, 0x24, 0x2C, 0xBF, + +0x2D, 0x46, 0x4E, 0xBF, +0x25, 0x46, 0x56, 0xBF, + +0x20, 0x1D, 0x6F, 0x8F, +0x32, 0x3E, 0x5F, 0xE9, + +0x3E, 0x50, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x30, + +0x1E, 0x8F, 0x51, 0x9F, +0x33, 0x1E, 0x5F, 0xE9, + +0x05, 0x44, 0x54, 0xB2, +0x0D, 0x44, 0x4C, 0xB2, + +0x19, 0xC0, 0xB0, 0xE8, +0x34, 0xC0, 0x44, 0xC4, + +0x33, 0x73, +0x00, 0xE0, +0x3E, 0x62, 0x57, 0x9F, + +0x1E, 0xAF, 0x59, 0x9F, +0x00, 0xE0, +0x0D, 0x20, + +0x84, 0x3E, 0x58, 0xE9, +0x28, 0x1D, 0x6F, 0x8F, + +0x05, 0x20, +0x00, 0xE0, +0x85, 0x1E, 0x58, 0xE9, + +0x9B, 0x3B, 0x33, 0xDF, +0x20, 0x20, 0x42, 0xAF, + +0x30, 0x42, 0x56, 0x9F, +0x80, 0x3E, 0x57, 0xE9, + +0x3F, 0x8F, 0x51, 0x9F, +0x30, 0x80, 0x5F, 0xE9, + +0x28, 0x28, 0x24, 0xAF, +0x81, 0x1E, 0x57, 0xE9, + +0x05, 0x47, 0x57, 0xBF, +0x0D, 0x47, 0x4F, 0xBF, + +0x88, 0x80, 0x58, 0xE9, +0x1B, 0x29, 0x1B, 0xDF, + +0x30, 0x1D, 0x6F, 0x8F, +0x3A, 0x30, 0x4F, 0xE9, + +0x1C, 0x30, 0x26, 0xDF, +0x09, 0xE3, +0x3B, 0x05, + +0x3E, 0x50, 0x56, 0x9F, +0x3B, 0x3F, 0x4F, 0xE9, + +0x1E, 0x8F, 0x51, 0x9F, +0x00, 0xE0, +0xAC, 0x20, + +0x2D, 0x44, 0x4C, 0xB4, +0x2C, 0x1C, 0xC0, 0xAF, + +0x25, 0x44, 0x54, 0xB4, +0x00, 0xE0, +0xC8, 0x30, + +0x30, 0x46, 0x30, 0xAF, +0x1B, 0x1B, 0x48, 0xAF, + +0x00, 0xE0, +0x25, 0x20, +0x38, 0x2C, 0x4F, 0xE9, + +0x86, 0x80, 0x57, 0xE9, +0x38, 0x1D, 0x6F, 0x8F, + +0x28, 0x74, +0x00, 0xE0, +0x0D, 0x44, 0x4C, 0xB0, + +0x05, 0x44, 0x54, 0xB0, +0x2D, 0x20, +0x9B, 0x10, + +0x82, 0x3E, 0x57, 0xE9, +0x32, 0xF0, 0x1B, 0xCD, + +0x1E, 0xBD, 0x59, 0x9F, +0x83, 0x1E, 0x57, 0xE9, + +0x38, 0x47, 0x38, 0xAF, +0x34, 0x20, +0x2A, 0x30, + +0x00, 0xE0, +0x0D, 0x20, +0x32, 0x20, +0x05, 0x20, + +0x87, 0x80, 0x57, 0xE9, +0x1F, 0x54, 0x57, 0x9F, + +0x17, 0x42, 0x56, 0x9F, +0x00, 0xE0, +0x3B, 0x6A, + +0x3F, 0x8F, 0x51, 0x9F, +0x37, 0x1E, 0x4F, 0xE9, + +0x37, 0x32, 0x2A, 0xAF, +0x00, 0xE0, +0x32, 0x00, + +0x00, 0x80, 0x00, 0xE8, +0x27, 0xC0, 0x44, 0xC0, + +0x36, 0x1F, 0x4F, 0xE9, +0x1F, 0x1F, 0x26, 0xDF, + +0x37, 0x1B, 0x37, 0xBF, +0x17, 0x26, 0x17, 0xDF, + +0x3E, 0x17, 0x4F, 0xE9, +0x3F, 0x3F, 0x4F, 0xE9, + +0x34, 0x1F, 0x34, 0xAF, +0x2B, 0x05, +0xA7, 0x20, + +0x33, 0x2B, 0x37, 0xDF, +0x27, 0x17, 0xC0, 0xAF, + +0x34, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x2D, 0x21, 0x1A, 0xB0, +0x25, 0x21, 0x31, 0xB0, + +0x0D, 0x21, 0x1A, 0xB2, +0x05, 0x21, 0x31, 0xB2, + +0x03, 0x80, 0x2A, 0xEA, +0x17, 0xC1, 0x2B, 0xBD, + +0x2D, 0x20, +0x25, 0x20, +0x05, 0x20, +0x0D, 0x20, + +0xB3, 0x68, +0x97, 0x25, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0xC0, 0x33, 0xAF, +0x2F, 0xC0, 0x21, 0xC0, + +0x16, 0x42, 0x56, 0x9F, +0x3C, 0x27, 0x4F, 0xE9, + +0x1E, 0x62, 0x57, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x21, 0x31, 0xB4, +0x2D, 0x21, 0x1A, 0xB4, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x33, 0x05, +0x00, 0xE0, +0x28, 0x19, 0x60, 0xEC, + +0x0D, 0x21, 0x1A, 0xB6, +0x05, 0x21, 0x31, 0xB6, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0xE0, +0x2F, 0x20, + +0x23, 0x3B, 0x33, 0xAD, +0x1E, 0x26, 0x1E, 0xDF, + +0xA7, 0x1E, 0x4F, 0xE9, +0x17, 0x26, 0x16, 0xDF, + +0x2D, 0x20, +0x00, 0xE0, +0xA8, 0x3F, 0x4F, 0xE9, + +0x2F, 0x2F, 0x1E, 0xAF, +0x25, 0x20, +0x00, 0xE0, + +0xA4, 0x16, 0x4F, 0xE9, +0x0F, 0xC0, 0x21, 0xC2, + +0xA6, 0x80, 0x4F, 0xE9, +0x1F, 0x62, 0x57, 0x9F, + +0x0D, 0x20, +0x05, 0x20, +0x2F, 0xC0, 0x21, 0xC6, + +0x3F, 0x2F, 0x5D, 0x9F, +0x00, 0xE0, +0x0F, 0x20, + +0x17, 0x50, 0x56, 0x9F, +0xA5, 0x37, 0x4F, 0xE9, + +0x06, 0xC0, 0x21, 0xC4, +0x0F, 0x17, 0x0F, 0xAF, + +0x37, 0x0F, 0x5C, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x2F, 0x20, +0x00, 0xE0, +0xA3, 0x80, 0x4F, 0xE9, + +0x06, 0x20, +0x00, 0xE0, +0x1F, 0x26, 0x1F, 0xDF, + +0x17, 0x26, 0x17, 0xDF, +0x35, 0x17, 0x4F, 0xE9, + +0xA1, 0x1F, 0x4F, 0xE9, +0xA2, 0x3F, 0x4F, 0xE9, + +0x06, 0x06, 0x1F, 0xAF, +0x39, 0x37, 0x4F, 0xE9, + +0x2F, 0x2F, 0x17, 0xAF, +0x00, 0x80, 0x00, 0xE8, + +0xA0, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x31, 0x80, 0x4F, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x57, 0x39, 0x20, 0xE9, + +0x16, 0x28, 0x20, 0xE9, +0x1D, 0x3B, 0x20, 0xE9, + +0x1E, 0x2B, 0x20, 0xE9, +0x2B, 0x32, 0x20, 0xE9, + +0x1C, 0x23, 0x20, 0xE9, +0x57, 0x36, 0x20, 0xE9, + +0x00, 0x80, 0xA0, 0xE9, +0x40, 0x40, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x90, 0xE2, +0x00, 0xE0, + +0x68, 0xFF, 0x20, 0xEA, +0x19, 0xC8, 0xC1, 0xCD, + +0x1F, 0xD7, 0x18, 0xBD, +0x3F, 0xD7, 0x22, 0xBD, + +0x9F, 0x41, 0x49, 0xBD, +0x00, 0x80, 0x00, 0xE8, + +0x25, 0x41, 0x49, 0xBD, +0x2D, 0x41, 0x51, 0xBD, + +0x0D, 0x80, 0x07, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x35, 0x40, 0x48, 0xBD, +0x3D, 0x40, 0x50, 0xBD, + +0x00, 0x80, 0x00, 0xE8, +0x25, 0x30, +0x2D, 0x30, + +0x35, 0x30, +0xB5, 0x30, +0xBD, 0x30, +0x3D, 0x30, + +0x9C, 0xA7, 0x5B, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x67, 0xFF, 0x0A, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0xC9, 0x41, 0xC8, 0xEC, +0x42, 0xE1, +0x00, 0xE0, + +0x65, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0xC8, 0x40, 0xC0, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x62, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +}; + +static unsigned char warp_g400_t2gz[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x78, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x69, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x25, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x9F, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xBE, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x7D, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gza[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x7C, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x6D, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x29, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x74, 0xC6, +0x3D, 0xCF, 0x74, 0xC2, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x0F, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB4, +0x02, 0x44, 0x64, 0xB4, + +0x2A, 0x44, 0x54, 0xB6, +0x1A, 0x44, 0x64, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x9B, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xBA, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x79, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzaf[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x81, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x72, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x37, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x2E, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x0F, 0xCF, 0x74, 0xC6, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x0F, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB4, +0x02, 0x44, 0x64, 0xB4, + +0x2A, 0x44, 0x54, 0xB6, +0x1A, 0x44, 0x64, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x3D, 0xCF, 0x75, 0xC6, +0x00, 0x80, 0x00, 0xE8, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x0A, 0x45, 0x55, 0xB6, +0x02, 0x45, 0x65, 0xB6, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x3D, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x38, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x96, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xB5, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x74, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzf[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x7D, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x6E, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x39, 0xE5, 0x2C, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x88, 0x73, 0x5E, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0F, 0xCF, 0x75, 0xC6, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x28, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x31, 0x0F, 0x20, 0xE9, + +0x0A, 0x44, 0x54, 0xB4, +0x02, 0x44, 0x64, 0xB4, + +0x2A, 0x45, 0x55, 0xB6, +0x1A, 0x45, 0x65, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x9A, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xBB, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x78, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzs[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x85, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x76, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x0F, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x31, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x0A, 0x45, 0x55, 0xB0, +0x02, 0x45, 0x65, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB2, +0x1A, 0x45, 0x65, 0xB2, + +0x0A, 0x45, 0x55, 0xB4, +0x02, 0x45, 0x65, 0xB4, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x20, +0x1A, 0x20, +0x0A, 0x20, +0x02, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0xA7, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x92, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xB2, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x70, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzsa[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x8A, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x7B, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x0F, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x36, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x0A, 0x45, 0x55, 0xB0, +0x02, 0x45, 0x65, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB2, +0x1A, 0x45, 0x65, 0xB2, + +0x0A, 0x45, 0x55, 0xB4, +0x02, 0x45, 0x65, 0xB4, + +0x0F, 0xCF, 0x74, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x44, 0x54, 0xB6, +0x1A, 0x44, 0x64, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x8D, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xAD, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x6B, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzsaf[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x8E, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x7F, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x0F, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x3A, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x0A, 0x45, 0x55, 0xB0, +0x02, 0x45, 0x65, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB2, +0x1A, 0x45, 0x65, 0xB2, + +0x0A, 0x45, 0x55, 0xB4, +0x02, 0x45, 0x65, 0xB4, + +0x0F, 0xCF, 0x74, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x44, 0x54, 0xB6, +0x1A, 0x44, 0x64, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x0A, 0x45, 0x55, 0xB6, +0x02, 0x45, 0x65, 0xB6, + +0x3D, 0xCF, 0x75, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x31, 0x3D, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x38, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x89, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xA9, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x67, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_t2gzsf[] = { + +0x00, 0x8A, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x0A, 0x40, 0x50, 0xBF, +0x2A, 0x40, 0x60, 0xBF, + +0x32, 0x41, 0x51, 0xBF, +0x3A, 0x41, 0x61, 0xBF, + +0xC3, 0x6B, +0xD3, 0x6B, +0x00, 0x8A, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x53, 0xA0, 0xE8, + +0xAD, 0xEE, 0x23, 0x9F, +0x00, 0xE0, +0x51, 0x04, + +0x90, 0xE2, +0x61, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x51, 0x41, 0xE0, 0xEC, +0x39, 0x67, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x63, 0xA0, 0xE8, + +0x61, 0x41, 0xE0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x8A, 0x80, 0x15, 0xEA, +0x10, 0x04, +0x20, 0x04, + +0x61, 0x51, 0xE0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x52, 0xBF, +0x0F, 0x52, 0xA0, 0xE8, + +0x1A, 0x42, 0x62, 0xBF, +0x1E, 0x51, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x0E, 0x61, 0x60, 0xEA, + +0x32, 0x40, 0x50, 0xBD, +0x22, 0x40, 0x60, 0xBD, + +0x12, 0x41, 0x51, 0xBD, +0x3A, 0x41, 0x61, 0xBD, + +0xBF, 0x2F, 0x0E, 0xBD, +0x97, 0xE2, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x35, 0x48, 0xB1, 0xE8, +0x3D, 0x59, 0xB1, 0xE8, + +0x46, 0x31, 0x46, 0xBF, +0x56, 0x31, 0x56, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x66, 0x31, 0x66, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x57, 0x39, 0x57, 0xBF, +0x67, 0x39, 0x67, 0xBF, + +0x7B, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x35, 0x00, +0x3D, 0x00, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0x8D, 0x2F, 0x1E, 0xBD, + +0x43, 0x75, 0xF8, 0xEC, +0x35, 0x20, +0x3D, 0x20, + +0x43, 0x43, 0x2D, 0xDF, +0x53, 0x53, 0x2D, 0xDF, + +0xAE, 0x1E, 0x0E, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x48, 0x35, 0x48, 0xBF, +0x58, 0x35, 0x58, 0xBF, + +0x68, 0x35, 0x68, 0xBF, +0x49, 0x3D, 0x49, 0xBF, + +0x59, 0x3D, 0x59, 0xBF, +0x69, 0x3D, 0x69, 0xBF, + +0x63, 0x63, 0x2D, 0xDF, +0x4D, 0x7D, 0xF8, 0xEC, + +0x59, 0xE3, +0x00, 0xE0, +0xB8, 0x38, 0x33, 0xBF, + +0x2D, 0x73, +0x30, 0x76, +0x18, 0x3A, 0x41, 0xE9, + +0x3F, 0x53, 0xA0, 0xE8, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x63, 0xA0, 0xE8, + +0x50, 0x70, 0xF8, 0xEC, +0x2B, 0x50, 0x3C, 0xE9, + +0x1F, 0x0F, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x59, 0x78, 0xF8, 0xEC, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x46, 0x37, 0x46, 0xDF, +0x56, 0x3F, 0x56, 0xDF, + +0x2B, 0x40, 0x3D, 0xE9, +0x66, 0x3D, 0x66, 0xDF, + +0x1D, 0x32, 0x41, 0xE9, +0x67, 0x3D, 0x67, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3F, 0x57, 0xDF, + +0x2A, 0x40, 0x20, 0xE9, +0x59, 0x3F, 0x59, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x69, 0x3D, 0x69, 0xDF, + +0x48, 0x37, 0x48, 0xDF, +0x58, 0x3F, 0x58, 0xDF, + +0x68, 0x3D, 0x68, 0xDF, +0x49, 0x37, 0x49, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x0F, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x54, 0xB0, +0x02, 0x44, 0x64, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB2, +0x1A, 0x44, 0x64, 0xB2, + +0x36, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x0F, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x54, 0xB4, +0x1A, 0x44, 0x64, 0xB4, + +0x0A, 0x45, 0x55, 0xB0, +0x02, 0x45, 0x65, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB2, +0x1A, 0x45, 0x65, 0xB2, + +0x0A, 0x45, 0x55, 0xB4, +0x02, 0x45, 0x65, 0xB4, + +0x0F, 0xCF, 0x75, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x31, 0x0F, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x45, 0x55, 0xB6, +0x1A, 0x45, 0x65, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x56, 0xBF, +0x1A, 0x46, 0x66, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x0A, 0x47, 0x57, 0xBF, +0x02, 0x47, 0x67, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x53, 0xBF, +0x1A, 0x43, 0x63, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x39, 0x4F, 0xE9, + +0x0A, 0x48, 0x58, 0xBF, +0x02, 0x48, 0x68, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x2A, 0x49, 0x59, 0xBF, +0x1A, 0x49, 0x69, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x82, 0x30, 0x57, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x83, 0x38, 0x57, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x84, 0x31, 0x5E, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x85, 0x39, 0x5E, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8A, 0x36, 0x20, 0xE9, + +0x87, 0x77, 0x57, 0xE9, +0x8B, 0x3E, 0xBF, 0xEA, + +0x80, 0x30, 0x57, 0xE9, +0x81, 0x38, 0x57, 0xE9, + +0x82, 0x31, 0x57, 0xE9, +0x86, 0x78, 0x57, 0xE9, + +0x83, 0x39, 0x57, 0xE9, +0x87, 0x79, 0x57, 0xE9, + +0x30, 0x1F, 0x5F, 0xE9, +0x8A, 0x34, 0x20, 0xE9, + +0x8B, 0x3C, 0x20, 0xE9, +0x37, 0x50, 0x60, 0xBD, + +0x57, 0x0D, 0x20, 0xE9, +0x35, 0x51, 0x61, 0xBD, + +0x2B, 0x50, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x0E, 0x77, + +0x24, 0x51, 0x20, 0xE9, +0x8D, 0xFF, 0x20, 0xEA, + +0x16, 0x0E, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x0B, 0x46, 0xA0, 0xE8, +0x1B, 0x56, 0xA0, 0xE8, + +0x2B, 0x66, 0xA0, 0xE8, +0x0C, 0x47, 0xA0, 0xE8, + +0x1C, 0x57, 0xA0, 0xE8, +0x2C, 0x67, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x57, 0x80, 0x57, 0xCF, + +0x66, 0x33, 0x66, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x67, 0x3B, 0x67, 0xCF, + +0x0B, 0x48, 0xA0, 0xE8, +0x1B, 0x58, 0xA0, 0xE8, + +0x2B, 0x68, 0xA0, 0xE8, +0x0C, 0x49, 0xA0, 0xE8, + +0x1C, 0x59, 0xA0, 0xE8, +0x2C, 0x69, 0xA0, 0xE8, + +0x0B, 0x00, +0x1B, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x0C, 0x00, +0x1C, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x0B, 0x65, +0x1B, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x0C, 0x65, +0x1C, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x0B, 0x1B, 0x60, 0xEC, +0x34, 0xD7, 0x34, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x0C, 0x1C, 0x60, 0xEC, + +0x3C, 0xD7, 0x3C, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x0B, 0x2B, 0xDE, 0xE8, +0x1B, 0x80, 0xDE, 0xE8, + +0x34, 0x80, 0x34, 0xBD, +0x3C, 0x80, 0x3C, 0xBD, + +0x33, 0xD7, 0x0B, 0xBD, +0x3B, 0xD7, 0x1B, 0xBD, + +0x48, 0x80, 0x48, 0xCF, +0x59, 0x80, 0x59, 0xCF, + +0x68, 0x33, 0x68, 0xCF, +0x49, 0x3B, 0x49, 0xCF, + +0xAD, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x58, 0x33, 0x58, 0xCF, +0x69, 0x3B, 0x69, 0xCF, + +0x6B, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgz[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x58, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x4A, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x1D, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xAF, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xD6, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x9D, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgza[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x5C, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x4E, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x27, 0xCF, 0x74, 0xC6, +0x3D, 0xCF, 0x74, 0xC2, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x20, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x27, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB4, +0x02, 0x44, 0x54, 0xB4, + +0x2A, 0x44, 0x4C, 0xB6, +0x1A, 0x44, 0x54, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xAB, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xD3, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x99, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzaf[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x61, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x53, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x31, 0x53, 0x2F, 0x9F, +0x34, 0x37, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x26, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x27, 0xCF, 0x74, 0xC6, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x27, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB4, +0x02, 0x44, 0x54, 0xB4, + +0x2A, 0x44, 0x4C, 0xB6, +0x1A, 0x44, 0x54, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x3D, 0xCF, 0x75, 0xC6, +0x00, 0x80, 0x00, 0xE8, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x0A, 0x45, 0x4D, 0xB6, +0x02, 0x45, 0x55, 0xB6, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x3D, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xA6, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xCD, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x94, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzf[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x5D, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x4F, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x3D, 0xCF, 0x74, 0xC0, +0x37, 0xCF, 0x74, 0xC4, + +0x39, 0xE5, 0x2C, 0x9F, +0x34, 0x80, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x88, 0x73, 0x5E, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x27, 0xCF, 0x75, 0xC6, +0x3C, 0x3D, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x20, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x3D, 0xCF, 0x74, 0xC2, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x31, 0x27, 0x20, 0xE9, + +0x0A, 0x44, 0x4C, 0xB4, +0x02, 0x44, 0x54, 0xB4, + +0x2A, 0x45, 0x4D, 0xB6, +0x1A, 0x45, 0x55, 0xB6, + +0x39, 0xE5, 0x2C, 0x9F, +0x38, 0x3D, 0x20, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xAA, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xD3, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x98, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzs[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x65, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x57, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x27, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x29, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x27, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x0A, 0x45, 0x4D, 0xB0, +0x02, 0x45, 0x55, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB2, +0x1A, 0x45, 0x55, 0xB2, + +0x0A, 0x45, 0x4D, 0xB4, +0x02, 0x45, 0x55, 0xB4, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x0A, 0x20, +0x02, 0x20, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0xA7, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0xA2, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xCA, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x90, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzsa[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x6A, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x5C, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x27, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x2E, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x27, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x0A, 0x45, 0x4D, 0xB0, +0x02, 0x45, 0x55, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB2, +0x1A, 0x45, 0x55, 0xB2, + +0x0A, 0x45, 0x4D, 0xB4, +0x02, 0x45, 0x55, 0xB4, + +0x27, 0xCF, 0x74, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x44, 0x4C, 0xB6, +0x1A, 0x44, 0x54, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0x9D, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xC5, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x8B, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzsaf[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x6E, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x60, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x27, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x32, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x27, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x0A, 0x45, 0x4D, 0xB0, +0x02, 0x45, 0x55, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB2, +0x1A, 0x45, 0x55, 0xB2, + +0x0A, 0x45, 0x4D, 0xB4, +0x02, 0x45, 0x55, 0xB4, + +0x27, 0xCF, 0x74, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x9C, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x44, 0x4C, 0xB6, +0x1A, 0x44, 0x54, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x0A, 0x45, 0x4D, 0xB6, +0x02, 0x45, 0x55, 0xB6, + +0x3D, 0xCF, 0x75, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x31, 0x3D, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x9D, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x9E, 0x39, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x30, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x38, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0x99, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xC1, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x87, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; + +static unsigned char warp_g400_tgzsf[] = { + +0x00, 0x88, 0x98, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +0xFF, 0x80, 0xC0, 0xE9, +0x00, 0x80, 0x00, 0xE8, + +0x22, 0x40, 0x48, 0xBF, +0x2A, 0x40, 0x50, 0xBF, + +0x32, 0x41, 0x49, 0xBF, +0x3A, 0x41, 0x51, 0xBF, + +0xC3, 0x6B, +0xCB, 0x6B, +0x00, 0x88, 0x98, 0xE9, + +0x73, 0x7B, 0xC8, 0xEC, +0x96, 0xE2, +0x41, 0x04, + +0x7B, 0x43, 0xA0, 0xE8, +0x73, 0x4B, 0xA0, 0xE8, + +0xAD, 0xEE, 0x29, 0x9F, +0x00, 0xE0, +0x49, 0x04, + +0x90, 0xE2, +0x51, 0x04, +0x31, 0x46, 0xB1, 0xE8, + +0x49, 0x41, 0xC0, 0xEC, +0x39, 0x57, 0xB1, 0xE8, + +0x00, 0x04, +0x46, 0xE2, +0x73, 0x53, 0xA0, 0xE8, + +0x51, 0x41, 0xC0, 0xEC, +0x31, 0x00, +0x39, 0x00, + +0x6A, 0x80, 0x15, 0xEA, +0x08, 0x04, +0x10, 0x04, + +0x51, 0x49, 0xC0, 0xEC, +0x2F, 0x41, 0x60, 0xEA, + +0x31, 0x20, +0x39, 0x20, +0x1F, 0x42, 0xA0, 0xE8, + +0x2A, 0x42, 0x4A, 0xBF, +0x27, 0x4A, 0xA0, 0xE8, + +0x1A, 0x42, 0x52, 0xBF, +0x1E, 0x49, 0x60, 0xEA, + +0x73, 0x7B, 0xC8, 0xEC, +0x26, 0x51, 0x60, 0xEA, + +0x32, 0x40, 0x48, 0xBD, +0x22, 0x40, 0x50, 0xBD, + +0x12, 0x41, 0x49, 0xBD, +0x3A, 0x41, 0x51, 0xBD, + +0xBF, 0x2F, 0x26, 0xBD, +0x00, 0xE0, +0x7B, 0x72, + +0x32, 0x20, +0x22, 0x20, +0x12, 0x20, +0x3A, 0x20, + +0x46, 0x31, 0x46, 0xBF, +0x4E, 0x31, 0x4E, 0xBF, + +0xB3, 0xE2, 0x2D, 0x9F, +0x00, 0x80, 0x00, 0xE8, + +0x56, 0x31, 0x56, 0xBF, +0x47, 0x39, 0x47, 0xBF, + +0x4F, 0x39, 0x4F, 0xBF, +0x57, 0x39, 0x57, 0xBF, + +0x5C, 0x80, 0x07, 0xEA, +0x24, 0x41, 0x20, 0xE9, + +0x42, 0x73, 0xF8, 0xEC, +0x00, 0xE0, +0x2D, 0x73, + +0x33, 0x72, +0x0C, 0xE3, +0xA5, 0x2F, 0x1E, 0xBD, + +0x43, 0x43, 0x2D, 0xDF, +0x4B, 0x4B, 0x2D, 0xDF, + +0xAE, 0x1E, 0x26, 0xBD, +0x58, 0xE3, +0x33, 0x66, + +0x53, 0x53, 0x2D, 0xDF, +0x00, 0x80, 0x00, 0xE8, + +0xB8, 0x38, 0x33, 0xBF, +0x00, 0xE0, +0x59, 0xE3, + +0x1E, 0x12, 0x41, 0xE9, +0x1A, 0x22, 0x41, 0xE9, + +0x2B, 0x40, 0x3D, 0xE9, +0x3F, 0x4B, 0xA0, 0xE8, + +0x2D, 0x73, +0x30, 0x76, +0x05, 0x80, 0x3D, 0xEA, + +0x37, 0x43, 0xA0, 0xE8, +0x3D, 0x53, 0xA0, 0xE8, + +0x48, 0x70, 0xF8, 0xEC, +0x2B, 0x48, 0x3C, 0xE9, + +0x1F, 0x27, 0xBC, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x00, 0x80, 0x00, 0xE8, +0x00, 0x80, 0x00, 0xE8, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x15, 0xC0, 0x20, 0xE9, +0x15, 0xC0, 0x20, 0xE9, + +0x18, 0x3A, 0x41, 0xE9, +0x1D, 0x32, 0x41, 0xE9, + +0x2A, 0x40, 0x20, 0xE9, +0x56, 0x3D, 0x56, 0xDF, + +0x46, 0x37, 0x46, 0xDF, +0x4E, 0x3F, 0x4E, 0xDF, + +0x16, 0x30, 0x20, 0xE9, +0x4F, 0x3F, 0x4F, 0xDF, + +0x47, 0x37, 0x47, 0xDF, +0x57, 0x3D, 0x57, 0xDF, + +0x32, 0x32, 0x2D, 0xDF, +0x22, 0x22, 0x2D, 0xDF, + +0x12, 0x12, 0x2D, 0xDF, +0x3A, 0x3A, 0x2D, 0xDF, + +0x27, 0xCF, 0x74, 0xC2, +0x37, 0xCF, 0x74, 0xC4, + +0x0A, 0x44, 0x4C, 0xB0, +0x02, 0x44, 0x54, 0xB0, + +0x3D, 0xCF, 0x74, 0xC0, +0x34, 0x37, 0x20, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x38, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3C, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB2, +0x1A, 0x44, 0x54, 0xB2, + +0x2E, 0x80, 0x3A, 0xEA, +0x0A, 0x20, +0x02, 0x20, + +0x27, 0xCF, 0x75, 0xC0, +0x2A, 0x20, +0x1A, 0x20, + +0x30, 0x50, 0x2E, 0x9F, +0x32, 0x31, 0x5F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x33, 0x39, 0x5F, 0xE9, + +0x3D, 0xCF, 0x75, 0xC2, +0x37, 0xCF, 0x75, 0xC4, + +0x31, 0x53, 0x2F, 0x9F, +0xA6, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA3, 0x3D, 0x20, 0xE9, + +0x2A, 0x44, 0x4C, 0xB4, +0x1A, 0x44, 0x54, 0xB4, + +0x0A, 0x45, 0x4D, 0xB0, +0x02, 0x45, 0x55, 0xB0, + +0x88, 0x73, 0x5E, 0xE9, +0x2A, 0x20, +0x1A, 0x20, + +0xA0, 0x37, 0x20, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x3E, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x3F, 0x38, 0x4F, 0xE9, + +0x30, 0x50, 0x2E, 0x9F, +0x3A, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x3B, 0x39, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB2, +0x1A, 0x45, 0x55, 0xB2, + +0x0A, 0x45, 0x4D, 0xB4, +0x02, 0x45, 0x55, 0xB4, + +0x27, 0xCF, 0x75, 0xC6, +0x2A, 0x20, +0x1A, 0x20, + +0xA7, 0x30, 0x4F, 0xE9, +0x0A, 0x20, +0x02, 0x20, + +0x31, 0x53, 0x2F, 0x9F, +0x31, 0x27, 0x20, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA8, 0x38, 0x4F, 0xE9, + +0x2A, 0x45, 0x4D, 0xB6, +0x1A, 0x45, 0x55, 0xB6, + +0x30, 0x50, 0x2E, 0x9F, +0x36, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x37, 0x39, 0x4F, 0xE9, + +0x00, 0x80, 0x00, 0xE8, +0x2A, 0x20, +0x1A, 0x20, + +0x2A, 0x46, 0x4E, 0xBF, +0x1A, 0x46, 0x56, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA4, 0x31, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA5, 0x39, 0x4F, 0xE9, + +0x0A, 0x47, 0x4F, 0xBF, +0x02, 0x47, 0x57, 0xBF, + +0x31, 0x53, 0x2F, 0x9F, +0xA1, 0x30, 0x4F, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0xA2, 0x38, 0x4F, 0xE9, + +0x2A, 0x43, 0x4B, 0xBF, +0x1A, 0x43, 0x53, 0xBF, + +0x30, 0x50, 0x2E, 0x9F, +0x35, 0x31, 0x4F, 0xE9, + +0x38, 0x21, 0x2C, 0x9F, +0x39, 0x39, 0x4F, 0xE9, + +0x31, 0x53, 0x2F, 0x9F, +0x80, 0x31, 0x57, 0xE9, + +0x39, 0xE5, 0x2C, 0x9F, +0x81, 0x39, 0x57, 0xE9, + +0x37, 0x48, 0x50, 0xBD, +0x8A, 0x36, 0x20, 0xE9, + +0x86, 0x76, 0x57, 0xE9, +0x8B, 0x3E, 0x20, 0xE9, + +0x82, 0x30, 0x57, 0xE9, +0x87, 0x77, 0x57, 0xE9, + +0x83, 0x38, 0x57, 0xE9, +0x35, 0x49, 0x51, 0xBD, + +0x84, 0x31, 0x5E, 0xE9, +0x30, 0x1F, 0x5F, 0xE9, + +0x85, 0x39, 0x5E, 0xE9, +0x57, 0x25, 0x20, 0xE9, + +0x2B, 0x48, 0x20, 0xE9, +0x1D, 0x37, 0xE1, 0xEA, + +0x1E, 0x35, 0xE1, 0xEA, +0x00, 0xE0, +0x26, 0x77, + +0x24, 0x49, 0x20, 0xE9, +0x9D, 0xFF, 0x20, 0xEA, + +0x16, 0x26, 0x20, 0xE9, +0x57, 0x2E, 0xBF, 0xEA, + +0x1C, 0x46, 0xA0, 0xE8, +0x23, 0x4E, 0xA0, 0xE8, + +0x2B, 0x56, 0xA0, 0xE8, +0x1D, 0x47, 0xA0, 0xE8, + +0x24, 0x4F, 0xA0, 0xE8, +0x2C, 0x57, 0xA0, 0xE8, + +0x1C, 0x00, +0x23, 0x00, +0x2B, 0x00, +0x00, 0xE0, + +0x1D, 0x00, +0x24, 0x00, +0x2C, 0x00, +0x00, 0xE0, + +0x1C, 0x65, +0x23, 0x65, +0x2B, 0x65, +0x00, 0xE0, + +0x1D, 0x65, +0x24, 0x65, +0x2C, 0x65, +0x00, 0xE0, + +0x1C, 0x23, 0x60, 0xEC, +0x36, 0xD7, 0x36, 0xAD, + +0x2B, 0x80, 0x60, 0xEC, +0x1D, 0x24, 0x60, 0xEC, + +0x3E, 0xD7, 0x3E, 0xAD, +0x2C, 0x80, 0x60, 0xEC, + +0x1C, 0x2B, 0xDE, 0xE8, +0x23, 0x80, 0xDE, 0xE8, + +0x36, 0x80, 0x36, 0xBD, +0x3E, 0x80, 0x3E, 0xBD, + +0x33, 0xD7, 0x1C, 0xBD, +0x3B, 0xD7, 0x23, 0xBD, + +0x46, 0x80, 0x46, 0xCF, +0x4F, 0x80, 0x4F, 0xCF, + +0x56, 0x33, 0x56, 0xCF, +0x47, 0x3B, 0x47, 0xCF, + +0xC5, 0xFF, 0x20, 0xEA, +0x00, 0x80, 0x00, 0xE8, + +0x4E, 0x33, 0x4E, 0xCF, +0x57, 0x3B, 0x57, 0xCF, + +0x8B, 0xFF, 0x20, 0xEA, +0x57, 0xC0, 0xBF, 0xEA, + +0x00, 0x80, 0xA0, 0xE9, +0x00, 0x00, 0xD8, 0xEC, + +}; Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c:1.1 --- /dev/null Mon Jun 4 12:41:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/mga_warp.c Wed Mar 21 13:08:56 2001 @@ -0,0 +1,215 @@ +/* mga_warp.c -- Matrox G200/G400 WARP engine management -*- linux-c -*- + * Created: Thu Jan 11 21:29:32 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "mga.h" +#include "drmP.h" +#include "mga_drv.h" +#include "mga_ucode.h" + + +#define MGA_WARP_CODE_ALIGN 256 /* in bytes */ + +#define WARP_UCODE_SIZE( which ) \ + ((sizeof(which) / MGA_WARP_CODE_ALIGN + 1) * MGA_WARP_CODE_ALIGN) + +#define WARP_UCODE_INSTALL( which, where ) \ +do { \ + DRM_DEBUG( " pcbase = 0x%08lx vcbase = %p\n", pcbase, vcbase );\ + dev_priv->warp_pipe_phys[where] = pcbase; \ + memcpy( vcbase, which, sizeof(which) ); \ + pcbase += WARP_UCODE_SIZE( which ); \ + vcbase += WARP_UCODE_SIZE( which ); \ +} while (0) + + +static unsigned int mga_warp_g400_microcode_size( drm_mga_private_t *dev_priv ) +{ + unsigned int size; + + size = ( WARP_UCODE_SIZE( warp_g400_tgz ) + + WARP_UCODE_SIZE( warp_g400_tgza ) + + WARP_UCODE_SIZE( warp_g400_tgzaf ) + + WARP_UCODE_SIZE( warp_g400_tgzf ) + + WARP_UCODE_SIZE( warp_g400_tgzs ) + + WARP_UCODE_SIZE( warp_g400_tgzsa ) + + WARP_UCODE_SIZE( warp_g400_tgzsaf ) + + WARP_UCODE_SIZE( warp_g400_tgzsf ) + + WARP_UCODE_SIZE( warp_g400_t2gz ) + + WARP_UCODE_SIZE( warp_g400_t2gza ) + + WARP_UCODE_SIZE( warp_g400_t2gzaf ) + + WARP_UCODE_SIZE( warp_g400_t2gzf ) + + WARP_UCODE_SIZE( warp_g400_t2gzs ) + + WARP_UCODE_SIZE( warp_g400_t2gzsa ) + + WARP_UCODE_SIZE( warp_g400_t2gzsaf ) + + WARP_UCODE_SIZE( warp_g400_t2gzsf ) ); + + size = PAGE_ALIGN( size ); + + DRM_DEBUG( "G400 ucode size = %d bytes\n", size ); + return size; +} + +static unsigned int mga_warp_g200_microcode_size( drm_mga_private_t *dev_priv ) +{ + unsigned int size; + + size = ( WARP_UCODE_SIZE( warp_g200_tgz ) + + WARP_UCODE_SIZE( warp_g200_tgza ) + + WARP_UCODE_SIZE( warp_g200_tgzaf ) + + WARP_UCODE_SIZE( warp_g200_tgzf ) + + WARP_UCODE_SIZE( warp_g200_tgzs ) + + WARP_UCODE_SIZE( warp_g200_tgzsa ) + + WARP_UCODE_SIZE( warp_g200_tgzsaf ) + + WARP_UCODE_SIZE( warp_g200_tgzsf ) ); + + size = PAGE_ALIGN( size ); + + DRM_DEBUG( "G200 ucode size = %d bytes\n", size ); + return size; +} + +static int mga_warp_install_g400_microcode( drm_mga_private_t *dev_priv ) +{ + unsigned char *vcbase = dev_priv->warp->handle; + unsigned long pcbase = dev_priv->warp->offset; + unsigned int size; + + size = mga_warp_g400_microcode_size( dev_priv ); + if ( size > dev_priv->warp->size ) { + DRM_ERROR( "microcode too large! (%u > %lu)\n", + size, dev_priv->warp->size ); + return -ENOMEM; + } + + memset( dev_priv->warp_pipe_phys, 0, + sizeof(dev_priv->warp_pipe_phys) ); + + WARP_UCODE_INSTALL( warp_g400_tgz, MGA_WARP_TGZ ); + WARP_UCODE_INSTALL( warp_g400_tgzf, MGA_WARP_TGZF ); + WARP_UCODE_INSTALL( warp_g400_tgza, MGA_WARP_TGZA ); + WARP_UCODE_INSTALL( warp_g400_tgzaf, MGA_WARP_TGZAF ); + WARP_UCODE_INSTALL( warp_g400_tgzs, MGA_WARP_TGZS ); + WARP_UCODE_INSTALL( warp_g400_tgzsf, MGA_WARP_TGZSF ); + WARP_UCODE_INSTALL( warp_g400_tgzsa, MGA_WARP_TGZSA ); + WARP_UCODE_INSTALL( warp_g400_tgzsaf, MGA_WARP_TGZSAF ); + + WARP_UCODE_INSTALL( warp_g400_t2gz, MGA_WARP_T2GZ ); + WARP_UCODE_INSTALL( warp_g400_t2gzf, MGA_WARP_T2GZF ); + WARP_UCODE_INSTALL( warp_g400_t2gza, MGA_WARP_T2GZA ); + WARP_UCODE_INSTALL( warp_g400_t2gzaf, MGA_WARP_T2GZAF ); + WARP_UCODE_INSTALL( warp_g400_t2gzs, MGA_WARP_T2GZS ); + WARP_UCODE_INSTALL( warp_g400_t2gzsf, MGA_WARP_T2GZSF ); + WARP_UCODE_INSTALL( warp_g400_t2gzsa, MGA_WARP_T2GZSA ); + WARP_UCODE_INSTALL( warp_g400_t2gzsaf, MGA_WARP_T2GZSAF ); + + return 0; +} + +static int mga_warp_install_g200_microcode( drm_mga_private_t *dev_priv ) +{ + unsigned char *vcbase = dev_priv->warp->handle; + unsigned long pcbase = dev_priv->warp->offset; + unsigned int size; + + size = mga_warp_g200_microcode_size( dev_priv ); + if ( size > dev_priv->warp->size ) { + DRM_ERROR( "microcode too large! (%u > %lu)\n", + size, dev_priv->warp->size ); + return -ENOMEM; + } + + memset( dev_priv->warp_pipe_phys, 0, + sizeof(dev_priv->warp_pipe_phys) ); + + WARP_UCODE_INSTALL( warp_g200_tgz, MGA_WARP_TGZ ); + WARP_UCODE_INSTALL( warp_g200_tgzf, MGA_WARP_TGZF ); + WARP_UCODE_INSTALL( warp_g200_tgza, MGA_WARP_TGZA ); + WARP_UCODE_INSTALL( warp_g200_tgzaf, MGA_WARP_TGZAF ); + WARP_UCODE_INSTALL( warp_g200_tgzs, MGA_WARP_TGZS ); + WARP_UCODE_INSTALL( warp_g200_tgzsf, MGA_WARP_TGZSF ); + WARP_UCODE_INSTALL( warp_g200_tgzsa, MGA_WARP_TGZSA ); + WARP_UCODE_INSTALL( warp_g200_tgzsaf, MGA_WARP_TGZSAF ); + + return 0; +} + +int mga_warp_install_microcode( drm_device_t *dev ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + switch ( dev_priv->chipset ) { + case MGA_CARD_TYPE_G400: + return mga_warp_install_g400_microcode( dev_priv ); + case MGA_CARD_TYPE_G200: + return mga_warp_install_g200_microcode( dev_priv ); + default: + return -EINVAL; + } +} + +#define WMISC_EXPECTED (MGA_WUCODECACHE_ENABLE | MGA_WMASTER_ENABLE) + +int mga_warp_init( drm_device_t *dev ) +{ + drm_mga_private_t *dev_priv = dev->dev_private; + u32 wmisc; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + /* FIXME: Get rid of these damned magic numbers... + */ + switch ( dev_priv->chipset ) { + case MGA_CARD_TYPE_G400: + MGA_WRITE( MGA_WIADDR2, MGA_WMODE_SUSPEND ); + MGA_WRITE( MGA_WGETMSB, 0x00000E00 ); + MGA_WRITE( MGA_WVRTXSZ, 0x00001807 ); + MGA_WRITE( MGA_WACCEPTSEQ, 0x18000000 ); + break; + case MGA_CARD_TYPE_G200: + MGA_WRITE( MGA_WIADDR, MGA_WMODE_SUSPEND ); + MGA_WRITE( MGA_WGETMSB, 0x1606 ); + MGA_WRITE( MGA_WVRTXSZ, 7 ); + break; + default: + return -EINVAL; + } + + MGA_WRITE( MGA_WMISC, (MGA_WUCODECACHE_ENABLE | + MGA_WMASTER_ENABLE | + MGA_WCACHEFLUSH_ENABLE) ); + wmisc = MGA_READ( MGA_WMISC ); + if ( wmisc != WMISC_EXPECTED ) { + DRM_ERROR( "WARP engine config failed! 0x%x != 0x%x\n", + wmisc, WMISC_EXPECTED ); + return -EINVAL; + } + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c:1.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c:1.10 Tue Sep 26 12:21:25 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/proc.c Mon Jun 4 12:41:27 2001 @@ -1,577 +0,0 @@ -/* proc.c -- /proc support for DRM -*- linux-c -*- - * Created: Mon Jan 11 09:48:47 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - */ - -#define __NO_VERSION__ -#include "drmP.h" - -static struct proc_dir_entry *drm_root = NULL; -static struct proc_dir_entry *drm_dev_root = NULL; -static char drm_slot_name[64]; - -static int drm_name_info(char *buf, char **start, off_t offset, - int len, int *eof, void *data); -static int drm_vm_info(char *buf, char **start, off_t offset, - int len, int *eof, void *data); -static int drm_clients_info(char *buf, char **start, off_t offset, - int len, int *eof, void *data); -static int drm_queues_info(char *buf, char **start, off_t offset, - int len, int *eof, void *data); -static int drm_bufs_info(char *buf, char **start, off_t offset, - int len, int *eof, void *data); -#if DRM_DEBUG_CODE -static int drm_vma_info(char *buf, char **start, off_t offset, - int len, int *eof, void *data); -#endif -#if DRM_DMA_HISTOGRAM -static int drm_histo_info(char *buf, char **start, off_t offset, - int len, int *eof, void *data); -#endif - -struct drm_proc_list { - const char *name; - int (*f)(char *, char **, off_t, int, int *, void *); -} drm_proc_list[] = { - { "name", drm_name_info }, - { "mem", drm_mem_info }, - { "vm", drm_vm_info }, - { "clients", drm_clients_info }, - { "queues", drm_queues_info }, - { "bufs", drm_bufs_info }, -#if DRM_DEBUG_CODE - { "vma", drm_vma_info }, -#endif -#if DRM_DMA_HISTOGRAM - { "histo", drm_histo_info }, -#endif -}; -#define DRM_PROC_ENTRIES (sizeof(drm_proc_list)/sizeof(drm_proc_list[0])) - -int drm_proc_init(drm_device_t *dev) -{ - struct proc_dir_entry *ent; - int i, j; - - drm_root = create_proc_entry("dri", S_IFDIR, NULL); - if (!drm_root) { - DRM_ERROR("Cannot create /proc/dri\n"); - return -1; - } - - /* Instead of doing this search, we should - add some global support for /proc/dri. */ - for (i = 0; i < 8; i++) { - sprintf(drm_slot_name, "dri/%d", i); - drm_dev_root = create_proc_entry(drm_slot_name, S_IFDIR, NULL); - if (!drm_dev_root) { - DRM_ERROR("Cannot create /proc/%s\n", drm_slot_name); - remove_proc_entry("dri", NULL); - } - if (drm_dev_root->nlink == 2) break; - drm_dev_root = NULL; - } - if (!drm_dev_root) { - DRM_ERROR("Cannot find slot in /proc/dri\n"); - return -1; - } - - for (i = 0; i < DRM_PROC_ENTRIES; i++) { - ent = create_proc_entry(drm_proc_list[i].name, - S_IFREG|S_IRUGO, drm_dev_root); - if (!ent) { - DRM_ERROR("Cannot create /proc/%s/%s\n", - drm_slot_name, drm_proc_list[i].name); - for (j = 0; j < i; j++) - remove_proc_entry(drm_proc_list[i].name, - drm_dev_root); - remove_proc_entry(drm_slot_name, NULL); - remove_proc_entry("dri", NULL); - return -1; - } - ent->read_proc = drm_proc_list[i].f; - ent->data = dev; - } - - return 0; -} - - -int drm_proc_cleanup(void) -{ - int i; - - if (drm_root) { - if (drm_dev_root) { - for (i = 0; i < DRM_PROC_ENTRIES; i++) { - remove_proc_entry(drm_proc_list[i].name, - drm_dev_root); - } - remove_proc_entry(drm_slot_name, NULL); - } - remove_proc_entry("dri", NULL); - remove_proc_entry(DRM_NAME, NULL); - } - drm_root = drm_dev_root = NULL; - return 0; -} - -static int drm_name_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - - if (offset > 0) return 0; /* no partial requests */ - len = 0; - *eof = 1; - - if (dev->unique) { - DRM_PROC_PRINT("%s 0x%x %s\n", - dev->name, dev->device, dev->unique); - } else { - DRM_PROC_PRINT("%s 0x%x\n", dev->name, dev->device); - } - return len; -} - -static int _drm_vm_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - drm_map_t *map; - /* Hardcoded from _DRM_FRAME_BUFFER, - _DRM_REGISTERS, _DRM_SHM, and - _DRM_AGP. */ - const char *types[] = { "FB", "REG", "SHM", "AGP" }; - const char *type; - int i; - - if (offset > 0) return 0; /* no partial requests */ - len = 0; - *eof = 1; - DRM_PROC_PRINT("slot offset size type flags " - "address mtrr\n\n"); - for (i = 0; i < dev->map_count; i++) { - map = dev->maplist[i]; - if (map->type < 0 || map->type > 3) type = "??"; - else type = types[map->type]; - DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s 0x%02x 0x%08lx ", - i, - map->offset, - map->size, - type, - map->flags, - (unsigned long)map->handle); - if (map->mtrr < 0) { - DRM_PROC_PRINT("none\n"); - } else { - DRM_PROC_PRINT("%4d\n", map->mtrr); - } - } - - return len; -} - -static int drm_vm_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int ret; - - down(&dev->struct_sem); - ret = _drm_vm_info(buf, start, offset, len, eof, data); - up(&dev->struct_sem); - return ret; -} - - -static int _drm_queues_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int i; - drm_queue_t *q; - - if (offset > 0) return 0; /* no partial requests */ - len = 0; - *eof = 1; - DRM_PROC_PRINT(" ctx/flags use fin" - " blk/rw/rwf wait flushed queued" - " locks\n\n"); - for (i = 0; i < dev->queue_count; i++) { - q = dev->queuelist[i]; - atomic_inc(&q->use_count); - DRM_PROC_PRINT_RET(atomic_dec(&q->use_count), - "%5d/0x%03x %5d %5d" - " %5d/%c%c/%c%c%c %5Zd %10d %10d %10d\n", - i, - q->flags, - atomic_read(&q->use_count), - atomic_read(&q->finalization), - atomic_read(&q->block_count), - atomic_read(&q->block_read) ? 'r' : '-', - atomic_read(&q->block_write) ? 'w' : '-', - waitqueue_active(&q->read_queue) ? 'r':'-', - waitqueue_active(&q->write_queue) ? 'w':'-', - waitqueue_active(&q->flush_queue) ? 'f':'-', - DRM_BUFCOUNT(&q->waitlist), - atomic_read(&q->total_flushed), - atomic_read(&q->total_queued), - atomic_read(&q->total_locks)); - atomic_dec(&q->use_count); - } - - return len; -} - -static int drm_queues_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int ret; - - down(&dev->struct_sem); - ret = _drm_queues_info(buf, start, offset, len, eof, data); - up(&dev->struct_sem); - return ret; -} - -/* drm_bufs_info is called whenever a process reads - /dev/drm/<dev>/bufs. */ - -static int _drm_bufs_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - drm_device_dma_t *dma = dev->dma; - int i; - - if (!dma) return 0; - if (offset > 0) return 0; /* no partial requests */ - len = 0; - *eof = 1; - DRM_PROC_PRINT(" o size count free segs pages kB\n\n"); - for (i = 0; i <= DRM_MAX_ORDER; i++) { - if (dma->bufs[i].buf_count) - DRM_PROC_PRINT("%2d %8d %5d %5d %5d %5d %5ld\n", - i, - dma->bufs[i].buf_size, - dma->bufs[i].buf_count, - atomic_read(&dma->bufs[i] - .freelist.count), - dma->bufs[i].seg_count, - dma->bufs[i].seg_count - *(1 << dma->bufs[i].page_order), - (dma->bufs[i].seg_count - * (1 << dma->bufs[i].page_order)) - * PAGE_SIZE / 1024); - } - DRM_PROC_PRINT("\n"); - for (i = 0; i < dma->buf_count; i++) { - if (i && !(i%32)) DRM_PROC_PRINT("\n"); - DRM_PROC_PRINT(" %d", dma->buflist[i]->list); - } - DRM_PROC_PRINT("\n"); - - return len; -} - -static int drm_bufs_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int ret; - - down(&dev->struct_sem); - ret = _drm_bufs_info(buf, start, offset, len, eof, data); - up(&dev->struct_sem); - return ret; -} - - -static int _drm_clients_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - drm_file_t *priv; - - if (offset > 0) return 0; /* no partial requests */ - len = 0; - *eof = 1; - DRM_PROC_PRINT("a dev pid uid magic ioctls\n\n"); - for (priv = dev->file_first; priv; priv = priv->next) { - DRM_PROC_PRINT("%c %3d %5d %5d %10u %10lu\n", - priv->authenticated ? 'y' : 'n', - priv->minor, - priv->pid, - priv->uid, - priv->magic, - priv->ioctl_count); - } - - return len; -} - -static int drm_clients_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int ret; - - down(&dev->struct_sem); - ret = _drm_clients_info(buf, start, offset, len, eof, data); - up(&dev->struct_sem); - return ret; -} - -#if DRM_DEBUG_CODE - -#define DRM_VMA_VERBOSE 0 - -static int _drm_vma_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - drm_vma_entry_t *pt; - struct vm_area_struct *vma; -#if DRM_VMA_VERBOSE - unsigned long i; - unsigned long address; - pgd_t *pgd; - pmd_t *pmd; - pte_t *pte; -#endif -#if defined(__i386__) - unsigned int pgprot; -#endif - - if (offset > 0) return 0; /* no partial requests */ - len = 0; - *eof = 1; - DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n", - atomic_read(&dev->vma_count), - high_memory, virt_to_phys(high_memory)); - for (pt = dev->vmalist; pt; pt = pt->next) { - if (!(vma = pt->vma)) continue; - DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx", - pt->pid, - vma->vm_start, - vma->vm_end, - vma->vm_flags & VM_READ ? 'r' : '-', - vma->vm_flags & VM_WRITE ? 'w' : '-', - vma->vm_flags & VM_EXEC ? 'x' : '-', - vma->vm_flags & VM_MAYSHARE ? 's' : 'p', - vma->vm_flags & VM_LOCKED ? 'l' : '-', - vma->vm_flags & VM_IO ? 'i' : '-', - VM_OFFSET(vma)); - -#if defined(__i386__) - pgprot = pgprot_val(vma->vm_page_prot); - DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c", - pgprot & _PAGE_PRESENT ? 'p' : '-', - pgprot & _PAGE_RW ? 'w' : 'r', - pgprot & _PAGE_USER ? 'u' : 's', - pgprot & _PAGE_PWT ? 't' : 'b', - pgprot & _PAGE_PCD ? 'u' : 'c', - pgprot & _PAGE_ACCESSED ? 'a' : '-', - pgprot & _PAGE_DIRTY ? 'd' : '-', - pgprot & _PAGE_PSE ? 'm' : 'k', - pgprot & _PAGE_GLOBAL ? 'g' : 'l' ); -#endif - DRM_PROC_PRINT("\n"); -#if 0 - for (i = vma->vm_start; i < vma->vm_end; i += PAGE_SIZE) { - pgd = pgd_offset(vma->vm_mm, i); - pmd = pmd_offset(pgd, i); - pte = pte_offset(pmd, i); - if (pte_present(*pte)) { - address = __pa(pte_page(*pte)) - + (i & (PAGE_SIZE-1)); - DRM_PROC_PRINT(" 0x%08lx -> 0x%08lx" - " %c%c%c%c%c\n", - i, - address, - pte_read(*pte) ? 'r' : '-', - pte_write(*pte) ? 'w' : '-', - pte_exec(*pte) ? 'x' : '-', - pte_dirty(*pte) ? 'd' : '-', - pte_young(*pte) ? 'a' : '-' ); - } else { - DRM_PROC_PRINT(" 0x%08lx\n", i); - } - } -#endif - } - - return len; -} - -static int drm_vma_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int ret; - - down(&dev->struct_sem); - ret = _drm_vma_info(buf, start, offset, len, eof, data); - up(&dev->struct_sem); - return ret; -} -#endif - - -#if DRM_DMA_HISTOGRAM -static int _drm_histo_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - drm_device_dma_t *dma = dev->dma; - int i; - unsigned long slot_value = DRM_DMA_HISTOGRAM_INITIAL; - unsigned long prev_value = 0; - drm_buf_t *buffer; - - if (offset > 0) return 0; /* no partial requests */ - len = 0; - *eof = 1; - - DRM_PROC_PRINT("general statistics:\n"); - DRM_PROC_PRINT("total %10u\n", atomic_read(&dev->histo.total)); - DRM_PROC_PRINT("open %10u\n", atomic_read(&dev->total_open)); - DRM_PROC_PRINT("close %10u\n", atomic_read(&dev->total_close)); - DRM_PROC_PRINT("ioctl %10u\n", atomic_read(&dev->total_ioctl)); - DRM_PROC_PRINT("irq %10u\n", atomic_read(&dev->total_irq)); - DRM_PROC_PRINT("ctx %10u\n", atomic_read(&dev->total_ctx)); - - DRM_PROC_PRINT("\nlock statistics:\n"); - DRM_PROC_PRINT("locks %10u\n", atomic_read(&dev->total_locks)); - DRM_PROC_PRINT("unlocks %10u\n", atomic_read(&dev->total_unlocks)); - DRM_PROC_PRINT("contends %10u\n", atomic_read(&dev->total_contends)); - DRM_PROC_PRINT("sleeps %10u\n", atomic_read(&dev->total_sleeps)); - - - if (dma) { - DRM_PROC_PRINT("\ndma statistics:\n"); - DRM_PROC_PRINT("prio %10u\n", - atomic_read(&dma->total_prio)); - DRM_PROC_PRINT("bytes %10u\n", - atomic_read(&dma->total_bytes)); - DRM_PROC_PRINT("dmas %10u\n", - atomic_read(&dma->total_dmas)); - DRM_PROC_PRINT("missed:\n"); - DRM_PROC_PRINT(" dma %10u\n", - atomic_read(&dma->total_missed_dma)); - DRM_PROC_PRINT(" lock %10u\n", - atomic_read(&dma->total_missed_lock)); - DRM_PROC_PRINT(" free %10u\n", - atomic_read(&dma->total_missed_free)); - DRM_PROC_PRINT(" sched %10u\n", - atomic_read(&dma->total_missed_sched)); - DRM_PROC_PRINT("tried %10u\n", - atomic_read(&dma->total_tried)); - DRM_PROC_PRINT("hit %10u\n", - atomic_read(&dma->total_hit)); - DRM_PROC_PRINT("lost %10u\n", - atomic_read(&dma->total_lost)); - - buffer = dma->next_buffer; - if (buffer) { - DRM_PROC_PRINT("next_buffer %7d\n", buffer->idx); - } else { - DRM_PROC_PRINT("next_buffer none\n"); - } - buffer = dma->this_buffer; - if (buffer) { - DRM_PROC_PRINT("this_buffer %7d\n", buffer->idx); - } else { - DRM_PROC_PRINT("this_buffer none\n"); - } - } - - - DRM_PROC_PRINT("\nvalues:\n"); - if (dev->lock.hw_lock) { - DRM_PROC_PRINT("lock 0x%08x\n", - dev->lock.hw_lock->lock); - } else { - DRM_PROC_PRINT("lock none\n"); - } - DRM_PROC_PRINT("context_flag 0x%08lx\n", dev->context_flag); - DRM_PROC_PRINT("interrupt_flag 0x%08lx\n", dev->interrupt_flag); - DRM_PROC_PRINT("dma_flag 0x%08lx\n", dev->dma_flag); - - DRM_PROC_PRINT("queue_count %10d\n", dev->queue_count); - DRM_PROC_PRINT("last_context %10d\n", dev->last_context); - DRM_PROC_PRINT("last_switch %10lu\n", dev->last_switch); - DRM_PROC_PRINT("last_checked %10d\n", dev->last_checked); - - - DRM_PROC_PRINT("\n q2d d2c c2f" - " q2c q2f dma sch" - " ctx lacq lhld\n\n"); - for (i = 0; i < DRM_DMA_HISTOGRAM_SLOTS; i++) { - DRM_PROC_PRINT("%s %10lu %10u %10u %10u %10u %10u" - " %10u %10u %10u %10u %10u\n", - i == DRM_DMA_HISTOGRAM_SLOTS - 1 ? ">=" : "< ", - i == DRM_DMA_HISTOGRAM_SLOTS - 1 - ? prev_value : slot_value , - - atomic_read(&dev->histo - .queued_to_dispatched[i]), - atomic_read(&dev->histo - .dispatched_to_completed[i]), - atomic_read(&dev->histo - .completed_to_freed[i]), - - atomic_read(&dev->histo - .queued_to_completed[i]), - atomic_read(&dev->histo - .queued_to_freed[i]), - atomic_read(&dev->histo.dma[i]), - atomic_read(&dev->histo.schedule[i]), - atomic_read(&dev->histo.ctx[i]), - atomic_read(&dev->histo.lacq[i]), - atomic_read(&dev->histo.lhld[i])); - prev_value = slot_value; - slot_value = DRM_DMA_HISTOGRAM_NEXT(slot_value); - } - return len; -} - -static int drm_histo_info(char *buf, char **start, off_t offset, int len, - int *eof, void *data) -{ - drm_device_t *dev = (drm_device_t *)data; - int ret; - - down(&dev->struct_sem); - ret = _drm_histo_info(buf, start, offset, len, eof, data); - up(&dev->struct_sem); - return ret; -} -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h:1.2 --- /dev/null Mon Jun 4 12:41:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128.h Tue Apr 10 12:08:05 2001 @@ -0,0 +1,81 @@ +/* r128.h -- ATI Rage 128 DRM template customization -*- linux-c -*- + * Created: Wed Feb 14 16:07:10 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __R128_H__ +#define __R128_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) r128_##x + +/* General customization: + */ +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 0 +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 +#define __HAVE_SG 1 +#define __HAVE_PCI_DMA 1 + +/* Driver customization: + */ +#define DRIVER_PRERELEASE() do { \ + if ( dev->dev_private ) { \ + drm_r128_private_t *dev_priv = dev->dev_private; \ + if ( dev_priv->page_flipping ) { \ + r128_do_cleanup_pageflip( dev ); \ + } \ + } \ +} while (0) + +#define DRIVER_PRETAKEDOWN() do { \ + if ( dev->dev_private ) r128_do_cleanup_cce( dev ); \ +} while (0) + +/* DMA customization: + */ +#define __HAVE_DMA 1 + +#if 0 +/* GH: Remove this for now... */ +#define __HAVE_DMA_QUIESCENT 1 +#define DRIVER_DMA_QUIESCENT() do { \ + drm_r128_private_t *dev_priv = dev->dev_private; \ + return r128_do_cce_idle( dev_priv ); \ +} while (0) +#endif + +/* Buffer customization: + */ +#define DRIVER_BUF_PRIV_T drm_r128_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_r128_private_t *)((dev)->dev_private))->buffers + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_bufs.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_bufs.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_bufs.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_bufs.c:1.6 Mon Dec 4 14:21:58 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_bufs.c Mon Jun 4 12:41:27 2001 @@ -1,309 +0,0 @@ -/* r128_bufs.c -- IOCTLs to manage buffers -*- linux-c -*- - * Created: Wed Apr 12 16:19:08 2000 by kevin@precisioninsight.com - * - * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * 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: Kevin E. Martin <martin@valinux.com> - * Rickard E. (Rik) Faith <faith@valinux.com> - * Jeff Hartmann <jhartmann@valinux.com> - * - */ - -#define __NO_VERSION__ -#include <linux/config.h> -#include "drmP.h" -#include "r128_drv.h" -#include "linux/un.h" - - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) -int r128_addbufs_agp(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - drm_buf_desc_t request; - drm_buf_entry_t *entry; - drm_buf_t *buf; - unsigned long offset; - unsigned long agp_offset; - int count; - int order; - int size; - int alignment; - int page_order; - int total; - int byte_count; - int i; - - if (!dma) return -EINVAL; - - if (copy_from_user(&request, - (drm_buf_desc_t *)arg, - sizeof(request))) - return -EFAULT; - - count = request.count; - order = drm_order(request.size); - size = 1 << order; - - alignment = (request.flags & _DRM_PAGE_ALIGN) ? PAGE_ALIGN(size):size; - page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; - total = PAGE_SIZE << page_order; - - byte_count = 0; - agp_offset = dev->agp->base + request.agp_start; - - DRM_DEBUG("count: %d\n", count); - DRM_DEBUG("order: %d\n", order); - DRM_DEBUG("size: %d\n", size); - DRM_DEBUG("agp_offset: %ld\n", agp_offset); - DRM_DEBUG("alignment: %d\n", alignment); - DRM_DEBUG("page_order: %d\n", page_order); - DRM_DEBUG("total: %d\n", total); - - if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL; - if (dev->queue_count) return -EBUSY; /* Not while in use */ - - spin_lock(&dev->count_lock); - if (dev->buf_use) { - spin_unlock(&dev->count_lock); - return -EBUSY; - } - atomic_inc(&dev->buf_alloc); - spin_unlock(&dev->count_lock); - - down(&dev->struct_sem); - entry = &dma->bufs[order]; - if (entry->buf_count) { - up(&dev->struct_sem); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; /* May only call once for each order */ - } - - entry->buflist = drm_alloc(count * sizeof(*entry->buflist), - DRM_MEM_BUFS); - if (!entry->buflist) { - up(&dev->struct_sem); - atomic_dec(&dev->buf_alloc); - return -ENOMEM; - } - memset(entry->buflist, 0, count * sizeof(*entry->buflist)); - - entry->buf_size = size; - entry->page_order = page_order; - offset = 0; - - for (offset = 0; - entry->buf_count < count; - offset += alignment, ++entry->buf_count) { - buf = &entry->buflist[entry->buf_count]; - buf->idx = dma->buf_count + entry->buf_count; - buf->total = alignment; - buf->order = order; - buf->used = 0; - buf->offset = (dma->byte_count + offset); - buf->address = (void *)(agp_offset + offset); - buf->next = NULL; - buf->waiting = 0; - buf->pending = 0; - init_waitqueue_head(&buf->dma_wait); - buf->pid = 0; - - buf->dev_priv_size = sizeof(drm_r128_buf_priv_t); - buf->dev_private = drm_alloc(sizeof(drm_r128_buf_priv_t), - DRM_MEM_BUFS); - memset(buf->dev_private, 0, buf->dev_priv_size); - -#if DRM_DMA_HISTOGRAM - buf->time_queued = 0; - buf->time_dispatched = 0; - buf->time_completed = 0; - buf->time_freed = 0; -#endif - - byte_count += PAGE_SIZE << page_order; - - DRM_DEBUG("buffer %d @ %p\n", - entry->buf_count, buf->address); - } - - 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 = dma->buf_count; i < dma->buf_count + entry->buf_count; i++) - dma->buflist[i] = &entry->buflist[i - dma->buf_count]; - - dma->buf_count += entry->buf_count; - dma->byte_count += byte_count; - - 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]); - } - - up(&dev->struct_sem); - - request.count = entry->buf_count; - request.size = size; - - if (copy_to_user((drm_buf_desc_t *)arg, - &request, - sizeof(request))) - return -EFAULT; - - dma->flags = _DRM_DMA_USE_AGP; - - atomic_dec(&dev->buf_alloc); - return 0; -} -#endif - -int r128_addbufs(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_r128_private_t *dev_priv = dev->dev_private; - drm_buf_desc_t request; - - if (!dev_priv || dev_priv->is_pci) return -EINVAL; - - if (copy_from_user(&request, - (drm_buf_desc_t *)arg, - sizeof(request))) - return -EFAULT; - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - if (request.flags & _DRM_AGP_BUFFER) - return r128_addbufs_agp(inode, filp, cmd, arg); - else -#endif - return -EINVAL; -} - -int r128_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_device_dma_t *dma = dev->dma; - int retcode = 0; - const int zero = 0; - unsigned long virtual; - unsigned long address; - drm_buf_map_t request; - int i; - - if (!dma || !dev_priv || dev_priv->is_pci) return -EINVAL; - - DRM_DEBUG("\n"); - - spin_lock(&dev->count_lock); - if (atomic_read(&dev->buf_alloc)) { - spin_unlock(&dev->count_lock); - return -EBUSY; - } - ++dev->buf_use; /* Can't allocate more after this call */ - spin_unlock(&dev->count_lock); - - if (copy_from_user(&request, - (drm_buf_map_t *)arg, - sizeof(request))) - return -EFAULT; - - if (request.count >= dma->buf_count) { - if (dma->flags & _DRM_DMA_USE_AGP) { - drm_map_t *map; - - map = dev_priv->buffers; - if (!map) { - retcode = -EINVAL; - goto done; - } - - down(¤t->mm->mmap_sem); - virtual = do_mmap(filp, 0, map->size, - PROT_READ|PROT_WRITE, - MAP_SHARED, - (unsigned long)map->offset); - up(¤t->mm->mmap_sem); - } else { - down(¤t->mm->mmap_sem); - virtual = do_mmap(filp, 0, dma->byte_count, - PROT_READ|PROT_WRITE, MAP_SHARED, 0); - up(¤t->mm->mmap_sem); - } - if (virtual > -1024UL) { - /* Real error */ - retcode = (signed long)virtual; - goto done; - } - request.virtual = (void *)virtual; - - for (i = 0; i < dma->buf_count; i++) { - if (copy_to_user(&request.list[i].idx, - &dma->buflist[i]->idx, - sizeof(request.list[0].idx))) { - retcode = -EFAULT; - goto done; - } - if (copy_to_user(&request.list[i].total, - &dma->buflist[i]->total, - sizeof(request.list[0].total))) { - retcode = -EFAULT; - goto done; - } - if (copy_to_user(&request.list[i].used, - &zero, - sizeof(zero))) { - retcode = -EFAULT; - goto done; - } - address = virtual + dma->buflist[i]->offset; - if (copy_to_user(&request.list[i].address, - &address, - sizeof(address))) { - retcode = -EFAULT; - goto done; - } - } - } - done: - request.count = dma->buf_count; - DRM_DEBUG("%d buffers, retcode = %d\n", request.count, retcode); - - if (copy_to_user((drm_buf_map_t *)arg, - &request, - sizeof(request))) - return -EFAULT; - - return retcode; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c:1.5.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c:1.2 Tue Dec 12 12:17:14 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_cce.c Wed May 23 14:58:00 2001 @@ -25,20 +25,19 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Gareth Hughes <gareth@valinux.com> - * + * Gareth Hughes <gareth@valinux.com> */ #define __NO_VERSION__ +#include "r128.h" #include "drmP.h" #include "r128_drv.h" #include <linux/interrupt.h> /* For task queue support */ #include <linux/delay.h> +#define R128_FIFO_DEBUG 0 -/* FIXME: Temporary CCE packet buffer */ -u32 r128_cce_buffer[(1 << 14)] __attribute__ ((aligned (32))); /* CCE microcode (from ATI) */ static u32 r128_cce_microcode[] = { @@ -86,26 +85,6 @@ }; -#define DO_REMAP(_m) (_m)->handle = drm_ioremap((_m)->offset, (_m)->size) - -#define DO_REMAPFREE(_m) \ - do { \ - if ((_m)->handle && (_m)->size) \ - drm_ioremapfree((_m)->handle, (_m)->size); \ - } while (0) - -#define DO_FIND_MAP(_m, _o) \ - do { \ - int _i; \ - for (_i = 0; _i < dev->map_count; _i++) { \ - if (dev->maplist[_i]->offset == _o) { \ - _m = dev->maplist[_i]; \ - break; \ - } \ - } \ - } while (0) - - int R128_READ_PLL(drm_device_t *dev, int addr) { drm_r128_private_t *dev_priv = dev->dev_private; @@ -114,7 +93,7 @@ return R128_READ(R128_CLOCK_CNTL_DATA); } -#if 0 +#if R128_FIFO_DEBUG static void r128_status( drm_r128_private_t *dev_priv ) { printk( "GUI_STAT = 0x%08x\n", @@ -152,7 +131,9 @@ udelay( 1 ); } +#if R128_FIFO_DEBUG DRM_ERROR( "%s failed!\n", __FUNCTION__ ); +#endif return -EBUSY; } @@ -166,16 +147,18 @@ udelay( 1 ); } +#if R128_FIFO_DEBUG DRM_ERROR( "%s failed!\n", __FUNCTION__ ); +#endif return -EBUSY; } -static int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ) +int r128_do_wait_for_idle( drm_r128_private_t *dev_priv ) { int i, ret; ret = r128_do_wait_for_fifo( dev_priv, 64 ); - if ( !ret ) return ret; + if ( ret < 0 ) return ret; for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { if ( !(R128_READ( R128_GUI_STAT ) & R128_GUI_ACTIVE) ) { @@ -185,7 +168,9 @@ udelay( 1 ); } +#if R128_FIFO_DEBUG DRM_ERROR( "%s failed!\n", __FUNCTION__ ); +#endif return -EBUSY; } @@ -199,6 +184,8 @@ { int i; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + r128_do_wait_for_idle( dev_priv ); R128_WRITE( R128_PM4_MICROCODE_ADDR, 0 ); @@ -224,12 +211,12 @@ /* Wait for the CCE to go idle. */ -static int r128_do_cce_idle( drm_r128_private_t *dev_priv ) +int r128_do_cce_idle( drm_r128_private_t *dev_priv ) { int i; 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 ) && @@ -241,7 +228,7 @@ udelay( 1 ); } -#if 0 +#if R128_FIFO_DEBUG DRM_ERROR( "failed!\n" ); r128_status( dev_priv ); #endif @@ -263,19 +250,19 @@ } /* Reset the Concurrent Command Engine. This will not flush any pending - * commangs, so you must wait for the CCE command stream to complete + * commands, so you must wait for the CCE command stream to complete * before calling this routine. */ 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; } /* Stop the Concurrent Command Engine. This will not flush any pending - * commangs, so you must flush the command stream and wait for the CCE + * commands, so you must flush the command stream and wait for the CCE * to go idle before calling this routine. */ static void r128_do_cce_stop( drm_r128_private_t *dev_priv ) @@ -333,19 +320,43 @@ 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, @@ -365,9 +376,11 @@ static int r128_do_init_cce( drm_device_t *dev, drm_r128_init_t *init ) { drm_r128_private_t *dev_priv; - int i; + struct list_head *list; + + DRM_DEBUG( "%s\n", __FUNCTION__ ); - dev_priv = drm_alloc( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); + dev_priv = DRM(alloc)( sizeof(drm_r128_private_t), DRM_MEM_DRIVER ); if ( dev_priv == NULL ) return -ENOMEM; dev->dev_private = (void *)dev_priv; @@ -376,12 +389,10 @@ 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 ) { - drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + 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; } @@ -389,13 +400,13 @@ dev_priv->usec_timeout = init->usec_timeout; if ( dev_priv->usec_timeout < 1 || dev_priv->usec_timeout > R128_MAX_USEC_TIMEOUT ) { - drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + DRM_DEBUG( "TIMEOUT problem!\n" ); + DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; } dev_priv->cce_mode = init->cce_mode; - dev_priv->cce_secure = init->cce_secure; /* GH: Simple idle check. */ @@ -409,7 +420,8 @@ ( init->cce_mode != R128_PM4_128BM_64INDBM ) && ( init->cce_mode != R128_PM4_64BM_128INDBM ) && ( init->cce_mode != R128_PM4_64BM_64VCBM_64INDBM ) ) { - drm_free( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + DRM_DEBUG( "Bad cce_mode!\n" ); + DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); dev->dev_private = NULL; return -EINVAL; } @@ -435,13 +447,30 @@ break; } - dev_priv->fb_bpp = init->fb_bpp; + switch ( init->fb_bpp ) { + case 16: + dev_priv->color_fmt = R128_DATATYPE_RGB565; + break; + case 32: + default: + dev_priv->color_fmt = R128_DATATYPE_ARGB8888; + break; + } dev_priv->front_offset = init->front_offset; dev_priv->front_pitch = init->front_pitch; dev_priv->back_offset = init->back_offset; dev_priv->back_pitch = init->back_pitch; - dev_priv->depth_bpp = init->depth_bpp; + switch ( init->depth_bpp ) { + case 16: + dev_priv->depth_fmt = R128_DATATYPE_RGB565; + break; + case 24: + case 32: + default: + dev_priv->depth_fmt = R128_DATATYPE_ARGB8888; + break; + } dev_priv->depth_offset = init->depth_offset; dev_priv->depth_pitch = init->depth_pitch; dev_priv->span_offset = init->span_offset; @@ -455,40 +484,50 @@ R128_DST_TILE); dev_priv->span_pitch_offset_c = (((dev_priv->depth_pitch/8) << 21) | (dev_priv->span_offset >> 5)); - - /* FIXME: We want multiple shared areas, including one shared - * only by the X Server and kernel module. - */ - for ( i = 0 ; i < dev->map_count ; i++ ) { - if ( dev->maplist[i]->type == _DRM_SHM ) { - dev_priv->sarea = dev->maplist[i]; - break; - } - } - DO_FIND_MAP( dev_priv->fb, init->fb_offset ); - DO_FIND_MAP( dev_priv->mmio, init->mmio_offset ); - DO_FIND_MAP( dev_priv->cce_ring, init->ring_offset ); - DO_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); - DO_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + list_for_each(list, &dev->maplist->head) { + drm_map_list_t *r_list = (drm_map_list_t *)list; + if( r_list->map && + r_list->map->type == _DRM_SHM && + r_list->map->flags & _DRM_CONTAINS_LOCK ) { + dev_priv->sarea = r_list->map; + break; + } + } + + DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + DRM_FIND_MAP( dev_priv->cce_ring, init->ring_offset ); + DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); if ( !dev_priv->is_pci ) { - DO_FIND_MAP( dev_priv->agp_textures, - init->agp_textures_offset ); + DRM_FIND_MAP( dev_priv->agp_textures, + init->agp_textures_offset ); } dev_priv->sarea_priv = (drm_r128_sarea_t *)((u8 *)dev_priv->sarea->handle + init->sarea_priv_offset); - DO_REMAP( dev_priv->cce_ring ); - DO_REMAP( dev_priv->ring_rptr ); - DO_REMAP( dev_priv->buffers ); -#if 0 if ( !dev_priv->is_pci ) { - DO_REMAP( dev_priv->agp_textures ); - } + 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); @@ -497,11 +536,13 @@ dev_priv->ring.end = ((u32 *)dev_priv->cce_ring->handle + init->ring_size / sizeof(u32)); dev_priv->ring.size = init->ring_size; - dev_priv->ring.size_l2qw = drm_order( init->ring_size / 8 ); + dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 ); dev_priv->ring.tail_mask = (dev_priv->ring.size / sizeof(u32)) - 1; + dev_priv->ring.high_mark = 128; + dev_priv->sarea_priv->last_frame = 0; R128_WRITE( R128_LAST_FRAME_REG, dev_priv->sarea_priv->last_frame ); @@ -509,6 +550,20 @@ 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 ); @@ -516,22 +571,19 @@ return 0; } -static int r128_do_cleanup_cce( drm_device_t *dev ) +int r128_do_cleanup_cce( drm_device_t *dev ) { if ( dev->dev_private ) { drm_r128_private_t *dev_priv = dev->dev_private; - DO_REMAPFREE( dev_priv->cce_ring ); - DO_REMAPFREE( dev_priv->ring_rptr ); - DO_REMAPFREE( dev_priv->buffers ); -#if 0 if ( !dev_priv->is_pci ) { - DO_REMAPFREE( dev_priv->agp_textures ); + DRM_IOREMAPFREE( dev_priv->cce_ring ); + DRM_IOREMAPFREE( dev_priv->ring_rptr ); + DRM_IOREMAPFREE( dev_priv->buffers ); } -#endif - drm_free( dev->dev_private, sizeof(drm_r128_private_t), - DRM_MEM_DRIVER ); + DRM(free)( dev->dev_private, sizeof(drm_r128_private_t), + DRM_MEM_DRIVER ); dev->dev_private = NULL; } @@ -545,6 +597,8 @@ 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; @@ -566,11 +620,8 @@ drm_r128_private_t *dev_priv = dev->dev_private; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + if ( dev_priv->cce_running || dev_priv->cce_mode == R128_PM4_NONPM4 ) { DRM_DEBUG( "%s while CCE running\n", __FUNCTION__ ); return 0; @@ -594,11 +645,7 @@ int ret; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &stop, (drm_r128_init_t *)arg, sizeof(stop) ) ) return -EFAULT; @@ -640,11 +687,8 @@ drm_r128_private_t *dev_priv = dev->dev_private; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + if ( !dev_priv ) { DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); return -EINVAL; @@ -666,11 +710,7 @@ drm_r128_private_t *dev_priv = dev->dev_private; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( dev_priv->cce_running ) { r128_do_cce_flush( dev_priv ); @@ -686,17 +726,72 @@ drm_device_t *dev = priv->dev; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); return r128_do_engine_reset( dev ); } /* ================================================================ + * Fullscreen mode + */ + +static int r128_do_init_pageflip( drm_device_t *dev ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + dev_priv->crtc_offset = R128_READ( R128_CRTC_OFFSET ); + dev_priv->crtc_offset_cntl = R128_READ( R128_CRTC_OFFSET_CNTL ); + + R128_WRITE( R128_CRTC_OFFSET, dev_priv->front_offset ); + R128_WRITE( R128_CRTC_OFFSET_CNTL, + dev_priv->crtc_offset_cntl | R128_CRTC_OFFSET_FLIP_CNTL ); + + dev_priv->page_flipping = 1; + dev_priv->current_page = 0; + + return 0; +} + +int r128_do_cleanup_pageflip( drm_device_t *dev ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + R128_WRITE( R128_CRTC_OFFSET, dev_priv->crtc_offset ); + R128_WRITE( R128_CRTC_OFFSET_CNTL, dev_priv->crtc_offset_cntl ); + + dev_priv->page_flipping = 0; + dev_priv->current_page = 0; + + return 0; +} + +int r128_fullscreen( 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_r128_fullscreen_t fs; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( copy_from_user( &fs, (drm_r128_fullscreen_t *)arg, sizeof(fs) ) ) + return -EFAULT; + + switch ( fs.func ) { + case R128_INIT_FULLSCREEN: + return r128_do_init_pageflip( dev ); + case R128_CLEANUP_FULLSCREEN: + return r128_do_cleanup_pageflip( dev ); + } + + return -EINVAL; +} + + +/* ================================================================ * Freelist management */ #define R128_BUFFER_USED 0xffffffff @@ -712,8 +807,8 @@ drm_r128_freelist_t *entry; int i; - dev_priv->head = drm_alloc( sizeof(drm_r128_freelist_t), - DRM_MEM_DRIVER ); + dev_priv->head = DRM(alloc)( sizeof(drm_r128_freelist_t), + DRM_MEM_DRIVER ); if ( dev_priv->head == NULL ) return -ENOMEM; @@ -724,8 +819,8 @@ buf = dma->buflist[i]; buf_priv = buf->dev_private; - entry = drm_alloc( sizeof(drm_r128_freelist_t), - DRM_MEM_DRIVER ); + entry = DRM(alloc)( sizeof(drm_r128_freelist_t), + DRM_MEM_DRIVER ); if ( !entry ) return -ENOMEM; entry->age = R128_BUFFER_FREE; @@ -802,7 +897,7 @@ /* ================================================================ - * CCE packet submission + * CCE command submission */ int r128_wait_ring( drm_r128_private_t *dev_priv, int n ) @@ -811,378 +906,17 @@ int i; for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { - ring->space = *ring->head - ring->tail; - if ( ring->space <= 0 ) - ring->space += ring->size; - + r128_update_ring_snapshot( ring ); if ( ring->space >= n ) return 0; - udelay( 1 ); } + /* FIXME: This is being ignored... */ + DRM_ERROR( "failed!\n" ); return -EBUSY; } -void r128_update_ring_snapshot( drm_r128_private_t *dev_priv ) -{ - drm_r128_ring_buffer_t *ring = &dev_priv->ring; - - ring->space = *ring->head - ring->tail; -#if R128_PERFORMANCE_BOXES - if ( ring->space == 0 ) - atomic_inc( &dev_priv->idle_count ); -#endif - if ( ring->space <= 0 ) - ring->space += ring->size; -} - -#if 0 -static int r128_verify_command( drm_r128_private_t *dev_priv, - u32 cmd, int *size ) -{ - int writing = 1; - - *size = 0; - - switch ( cmd & R128_CCE_PACKET_MASK ) { - case R128_CCE_PACKET0: - if ( (cmd & R128_CCE_PACKET0_REG_MASK) <= (0x1004 >> 2) && - (cmd & R128_CCE_PACKET0_REG_MASK) != - (R128_PM4_VC_FPU_SETUP >> 2) ) { - writing = 0; - } - *size = ((cmd & R128_CCE_PACKET_COUNT_MASK) >> 16) + 2; - break; - - case R128_CCE_PACKET1: - if ( (cmd & R128_CCE_PACKET1_REG0_MASK) <= (0x1004 >> 2) && - (cmd & R128_CCE_PACKET1_REG0_MASK) != - (R128_PM4_VC_FPU_SETUP >> 2) ) { - writing = 0; - } - if ( (cmd & R128_CCE_PACKET1_REG1_MASK) <= (0x1004 << 9) && - (cmd & R128_CCE_PACKET1_REG1_MASK) != - (R128_PM4_VC_FPU_SETUP << 9) ) { - writing = 0; - } - *size = 3; - break; - - case R128_CCE_PACKET2: - break; - - case R128_CCE_PACKET3: - *size = ((cmd & R128_CCE_PACKET_COUNT_MASK) >> 16) + 2; - break; - - } - - return writing; -} - -static int r128_submit_packet_ring_secure( drm_r128_private_t *dev_priv, - u32 *commands, int *count ) -{ -#if 0 - int write = dev_priv->sarea_priv->ring_write; - int *write_ptr = dev_priv->ring_start + write; - int c = *count; - u32 tmp = 0; - int psize = 0; - int writing = 1; - int timeout; - - while ( c > 0 ) { - tmp = *commands++; - if ( !psize ) { - writing = r128_verify_command( dev_priv, tmp, &psize ); - } - psize--; - - if ( writing ) { - write++; - *write_ptr++ = tmp; - } - if ( write >= dev_priv->ring_entries ) { - write = 0; - write_ptr = dev_priv->ring_start; - } - timeout = 0; - while ( write == *dev_priv->ring_read_ptr ) { - R128_READ( R128_PM4_BUFFER_DL_RPTR ); - if ( timeout++ >= dev_priv->usec_timeout ) - return -EBUSY; - udelay( 1 ); - } - c--; - } - - if ( write < 32 ) { - memcpy( dev_priv->ring_end, - dev_priv->ring_start, - write * sizeof(u32) ); - } - - /* Make sure WC cache has been flushed */ - r128_flush_write_combine(); - - dev_priv->sarea_priv->ring_write = write; - R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write ); - - *count = 0; -#endif - return 0; -} - -static int r128_submit_packet_ring_insecure( drm_r128_private_t *dev_priv, - u32 *commands, int *count ) -{ -#if 0 - int write = dev_priv->sarea_priv->ring_write; - int *write_ptr = dev_priv->ring_start + write; - int c = *count; - int timeout; - - while ( c > 0 ) { - write++; - *write_ptr++ = *commands++; - if ( write >= dev_priv->ring_entries ) { - write = 0; - write_ptr = dev_priv->ring_start; - } - - timeout = 0; - while ( write == *dev_priv->ring_read_ptr ) { - R128_READ( R128_PM4_BUFFER_DL_RPTR ); - if ( timeout++ >= dev_priv->usec_timeout ) - return -EBUSY; - udelay( 1 ); - } - c--; - } - - if ( write < 32 ) { - memcpy( dev_priv->ring_end, - dev_priv->ring_start, - write * sizeof(u32) ); - } - - /* Make sure WC cache has been flushed */ - r128_flush_write_combine(); - - dev_priv->sarea_priv->ring_write = write; - R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write ); - - *count = 0; -#endif - return 0; -} -#endif - -/* Internal packet submission routine. This uses the insecure versions - * of the packet submission functions, and thus should only be used for - * packets generated inside the kernel module. - */ -int r128_do_submit_packet( drm_r128_private_t *dev_priv, - u32 *buffer, int count ) -{ - int c = count; - int ret = 0; - -#if 0 - int left = 0; - - if ( c >= dev_priv->ring_entries ) { - c = dev_priv->ring_entries - 1; - left = count - c; - } - - /* Since this is only used by the kernel we can use the - * insecure ring buffer submit packet routine. - */ - ret = r128_submit_packet_ring_insecure( dev_priv, buffer, &c ); - c += left; -#endif - - return ( ret < 0 ) ? ret : c; -} - -/* External packet submission routine. This uses the secure versions - * by default, and can thus submit packets received from user space. - */ -int r128_cce_packet( 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_r128_private_t *dev_priv = dev->dev_private; - drm_r128_packet_t packet; - u32 *buffer; - int c; - int size; - int ret = 0; - -#if 0 - /* GH: Disable packet submission for now. - */ - return -EINVAL; -#endif - - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "r128_submit_packet called without lock held\n" ); - return -EINVAL; - } - - if ( copy_from_user( &packet, (drm_r128_packet_t *)arg, - sizeof(packet) ) ) - return -EFAULT; - -#if 0 - c = packet.count; - size = c * sizeof(*buffer); - - { - int left = 0; - - if ( c >= dev_priv->ring_entries ) { - c = dev_priv->ring_entries - 1; - size = c * sizeof(*buffer); - left = packet.count - c; - } - - buffer = kmalloc( size, 0 ); - if ( buffer == NULL) - return -ENOMEM; - if ( copy_from_user( buffer, packet.buffer, size ) ) - return -EFAULT; - - if ( dev_priv->cce_secure ) { - ret = r128_submit_packet_ring_secure( dev_priv, - buffer, &c ); - } else { - ret = r128_submit_packet_ring_insecure( dev_priv, - buffer, &c ); - } - c += left; - } - - kfree( buffer ); -#else - c = 0; -#endif - - packet.count = c; - if ( copy_to_user( (drm_r128_packet_t *)arg, &packet, - sizeof(packet) ) ) - return -EFAULT; - - if ( ret ) { - return ret; - } else if ( c > 0 ) { - return -EAGAIN; - } - return 0; -} - -#if 0 -static int r128_send_vertbufs( drm_device_t *dev, drm_r128_vertex_t *v ) -{ - drm_device_dma_t *dma = dev->dma; - drm_r128_private_t *dev_priv = dev->dev_private; - drm_r128_buf_priv_t *buf_priv; - drm_buf_t *buf; - int i, ret; - RING_LOCALS; - - /* Make sure we have valid data */ - for (i = 0; i < v->send_count; i++) { - int idx = v->send_indices[i]; - - if (idx < 0 || idx >= dma->buf_count) { - DRM_ERROR("Index %d (of %d max)\n", - idx, dma->buf_count - 1); - return -EINVAL; - } - buf = dma->buflist[idx]; - if (buf->pid != current->pid) { - DRM_ERROR("Process %d using buffer owned by %d\n", - current->pid, buf->pid); - return -EINVAL; - } - if (buf->pending) { - DRM_ERROR("Sending pending buffer:" - " buffer %d, offset %d\n", - v->send_indices[i], i); - return -EINVAL; - } - } - - /* Wait for idle, if we've wrapped to make sure that all pending - buffers have been processed */ - if (dev_priv->submit_age == R128_MAX_VBUF_AGE) { - if ((ret = r128_do_cce_idle(dev)) < 0) return ret; - dev_priv->submit_age = 0; - r128_freelist_reset(dev); - } - - /* Make sure WC cache has been flushed (if in PIO mode) */ - if (!dev_priv->cce_is_bm_mode) r128_flush_write_combine(); - - /* FIXME: Add support for sending vertex buffer to the CCE here - instead of in client code. The v->prim holds the primitive - type that should be drawn. Loop over the list buffers in - send_indices[] and submit a packet for each VB. - - This will require us to loop over the clip rects here as - well, which implies that we extend the kernel driver to allow - cliprects to be stored here. Note that the cliprects could - possibly come from the X server instead of the client, but - this will require additional changes to the DRI to allow for - this optimization. */ - - /* Submit a CCE packet that writes submit_age to R128_VB_AGE_REG */ -#if 0 - cce_buffer[0] = R128CCE0(R128_CCE_PACKET0, R128_VB_AGE_REG, 0); - cce_buffer[1] = dev_priv->submit_age; - - if ((ret = r128_do_submit_packet(dev, cce_buffer, 2)) < 0) { - /* Until we add support for sending VBs to the CCE in - this routine, we can recover from this error. After - we add that support, we won't be able to easily - recover, so we will probably have to implement - another mechanism for handling timeouts from packets - submitted directly by the kernel. */ - return ret; - } -#else - BEGIN_RING( 2 ); - - OUT_RING( CCE_PACKET0( R128_VB_AGE_REG, 0 ) ); - OUT_RING( dev_priv->submit_age ); - - ADVANCE_RING(); -#endif - /* Now that the submit packet request has succeeded, we can mark - the buffers as pending */ - for (i = 0; i < v->send_count; i++) { - buf = dma->buflist[v->send_indices[i]]; - buf->pending = 1; - - buf_priv = buf->dev_private; - buf_priv->age = dev_priv->submit_age; - } - - dev_priv->submit_age++; - - return 0; -} -#endif - - - - static int r128_cce_get_buffers( drm_device_t *dev, drm_dma_t *d ) { int i; @@ -1215,14 +949,10 @@ int ret = 0; drm_dma_t d; + LOCK_TEST_WITH_RETURN( dev ); + if ( copy_from_user( &d, (drm_dma_t *) arg, sizeof(d) ) ) return -EFAULT; - - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } /* Please don't send us buffers. */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_context.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_context.c:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_context.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_context.c:1.6 Mon Dec 4 14:21:59 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_context.c Mon Jun 4 12:41:27 2001 @@ -1,217 +0,0 @@ -/* r128_context.c -- IOCTLs for r128 contexts -*- linux-c -*- - * Created: Mon Dec 13 09:51:35 1999 by faith@precisioninsight.com - * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Author: Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" -#include "r128_drv.h" - -extern drm_ctx_t r128_res_ctx; - -static int r128_alloc_queue(drm_device_t *dev) -{ - return drm_ctxbitmap_next(dev); -} - -int r128_context_switch(drm_device_t *dev, int old, int new) -{ - char buf[64]; - - atomic_inc(&dev->total_ctx); - - if (test_and_set_bit(0, &dev->context_flag)) { - DRM_ERROR("Reentering -- FIXME\n"); - return -EBUSY; - } - -#if DRM_DMA_HISTOGRAM - dev->ctx_start = get_cycles(); -#endif - - DRM_DEBUG("Context switch from %d to %d\n", old, new); - - if (new == dev->last_context) { - clear_bit(0, &dev->context_flag); - return 0; - } - - if (drm_flags & DRM_FLAG_NOCTX) { - r128_context_switch_complete(dev, new); - } else { - sprintf(buf, "C %d %d\n", old, new); - drm_write_string(dev, buf); - } - - return 0; -} - -int r128_context_switch_complete(drm_device_t *dev, int new) -{ - dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ - dev->last_switch = jiffies; - - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("Lock isn't held after context switch\n"); - } - - /* If a context switch is ever initiated - when the kernel holds the lock, release - that lock here. */ -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.ctx[drm_histogram_slot(get_cycles() - - dev->ctx_start)]); - -#endif - clear_bit(0, &dev->context_flag); - wake_up(&dev->context_wait); - - return 0; -} - - -int r128_resctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_res_t res; - drm_ctx_t ctx; - int i; - - DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); - if (copy_from_user(&res, (drm_ctx_res_t *)arg, sizeof(res))) - return -EFAULT; - if (res.count >= DRM_RESERVED_CONTEXTS) { - memset(&ctx, 0, sizeof(ctx)); - for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { - ctx.handle = i; - if (copy_to_user(&res.contexts[i], - &i, - sizeof(i))) - return -EFAULT; - } - } - res.count = DRM_RESERVED_CONTEXTS; - if (copy_to_user((drm_ctx_res_t *)arg, &res, sizeof(res))) - return -EFAULT; - return 0; -} - - -int r128_addctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - if ((ctx.handle = r128_alloc_queue(dev)) == DRM_KERNEL_CONTEXT) { - /* Skip kernel's context and get a new one. */ - ctx.handle = r128_alloc_queue(dev); - } - DRM_DEBUG("%d\n", ctx.handle); - if (ctx.handle == -1) { - DRM_DEBUG("Not enough free contexts.\n"); - /* Should this return -EBUSY instead? */ - return -ENOMEM; - } - - if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx))) - return -EFAULT; - return 0; -} - -int r128_modctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t*)arg, sizeof(ctx))) - return -EFAULT; - if (ctx.flags==_DRM_CONTEXT_PRESERVED) - r128_res_ctx.handle=ctx.handle; - return 0; -} - -int r128_getctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t*)arg, sizeof(ctx))) - return -EFAULT; - /* This is 0, because we don't hanlde any context flags */ - ctx.flags = 0; - if (copy_to_user((drm_ctx_t*)arg, &ctx, sizeof(ctx))) - return -EFAULT; - return 0; -} - -int r128_switchctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - return r128_context_switch(dev, dev->last_context, ctx.handle); -} - -int r128_newctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - r128_context_switch_complete(dev, ctx.handle); - - return 0; -} - -int r128_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - drm_ctxbitmap_free(dev, ctx.handle); - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h:1.9.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h:1.6 Tue Dec 12 12:17:14 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drm.h Thu May 31 22:24:18 2001 @@ -25,13 +25,12 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Kevin E. Martin <martin@valinux.com> * Gareth Hughes <gareth@valinux.com> - * + * Kevin E. Martin <martin@valinux.com> */ -#ifndef _R128_DRM_H_ -#define _R128_DRM_H_ +#ifndef __R128_DRM_H__ +#define __R128_DRM_H__ /* WARNING: If you change any of these defines, make sure to change the * defines in the X server file (r128_sarea.h) @@ -69,21 +68,13 @@ /* Vertex/indirect buffer size */ -#if 1 #define R128_BUFFER_SIZE 16384 -#else -#define R128_BUFFER_SIZE (128 * 1024) -#endif /* Byte offsets for indirect buffer data */ #define R128_INDEX_PRIM_OFFSET 20 #define R128_HOSTDATA_BLIT_OFFSET 32 -/* 2048x2048 @ 32bpp texture requires this many indirect buffers - */ -#define R128_MAX_BLIT_BUFFERS ((2048 * 2048 * 4) / R128_BUFFER_SIZE) - /* Keep these small for testing. */ #define R128_NR_SAREA_CLIPRECTS 12 @@ -98,8 +89,10 @@ #define R128_LOG_TEX_GRANULARITY 16 #define R128_NR_CONTEXT_REGS 12 -#define R128_TEX_MAXLEVELS 11 +#define R128_MAX_TEXTURE_LEVELS 11 +#define R128_MAX_TEXTURE_UNITS 2 + #endif /* __R128_SAREA_DEFINES__ */ typedef struct { @@ -137,28 +130,23 @@ unsigned int scale_3d_cntl; } drm_r128_context_regs_t; -/* Setup registers for each texture unit */ +/* Setup registers for each texture unit + */ typedef struct { unsigned int tex_cntl; unsigned int tex_combine_cntl; unsigned int tex_size_pitch; - unsigned int tex_offset[R128_TEX_MAXLEVELS]; + unsigned int tex_offset[R128_MAX_TEXTURE_LEVELS]; unsigned int tex_border_color; } drm_r128_texture_regs_t; -typedef struct drm_tex_region { - unsigned char next, prev; - unsigned char in_use; - int age; -} drm_tex_region_t; - typedef struct drm_r128_sarea { /* The channel for communication of state information to the kernel * on firing a vertex buffer. */ drm_r128_context_regs_t context_state; - drm_r128_texture_regs_t tex_state[R128_NR_TEX_HEAPS]; + drm_r128_texture_regs_t tex_state[R128_MAX_TEXTURE_UNITS]; unsigned int dirty; unsigned int vertsize; unsigned int vc_format; @@ -187,7 +175,11 @@ R128_INIT_CCE = 0x01, R128_CLEANUP_CCE = 0x02 } func; +#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) int sarea_priv_offset; +#else + unsigned long sarea_priv_offset; +#endif int is_pci; int cce_mode; int cce_secure; @@ -201,12 +193,21 @@ unsigned int depth_offset, depth_pitch; unsigned int span_offset; +#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) 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; +#else + 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; +#endif } drm_r128_init_t; typedef struct drm_r128_cce_stop { @@ -216,9 +217,15 @@ typedef struct drm_r128_clear { unsigned int flags; +#if CONFIG_XFREE86_VERSION < XFREE86_VERSION(4,1,0,0) int x, y, w, h; +#endif unsigned int clear_color; unsigned int clear_depth; +#if CONFIG_XFREE86_VERSION >= XFREE86_VERSION(4,1,0,0) + unsigned int color_mask; + unsigned int depth_mask; +#endif } drm_r128_clear_t; typedef struct drm_r128_vertex { @@ -263,10 +270,18 @@ unsigned int *mask; } drm_r128_stipple_t; -typedef struct drm_r128_packet { - unsigned int *buffer; - int count; - int flags; -} drm_r128_packet_t; +typedef struct drm_r128_indirect { + int idx; + int start; + int end; + int discard; +} drm_r128_indirect_t; + +typedef struct drm_r128_fullscreen { + enum { + R128_INIT_FULLSCREEN = 0x01, + R128_CLEANUP_FULLSCREEN = 0x02 + } func; +} drm_r128_fullscreen_t; #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c:1.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c:1.13 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c:1.10 Fri Dec 15 17:48:43 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.c Tue Apr 10 12:08:05 2001 @@ -1,7 +1,7 @@ /* r128_drv.c -- ATI Rage 128 driver -*- linux-c -*- * Created: Mon Dec 13 09:47:27 1999 by faith@precisioninsight.com * - * Copyright 1999, 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. * All Rights Reserved. * @@ -19,681 +19,74 @@ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. * * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> - * Kevin E. Martin <martin@valinux.com> * Gareth Hughes <gareth@valinux.com> - * */ #include <linux/config.h> +#include "r128.h" #include "drmP.h" #include "r128_drv.h" - -#define R128_NAME "r128" -#define R128_DESC "ATI Rage 128" -#define R128_DATE "20001215" -#define R128_MAJOR 2 -#define R128_MINOR 1 -#define R128_PATCHLEVEL 2 - -static drm_device_t r128_device; -drm_ctx_t r128_res_ctx; - -static struct file_operations r128_fops = { -#if LINUX_VERSION_CODE >= 0x020400 - /* This started being used during 2.4.0-test */ - owner: THIS_MODULE, -#endif - open: r128_open, - flush: drm_flush, - release: r128_release, - ioctl: r128_ioctl, - mmap: drm_mmap, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, -}; - -static struct miscdevice r128_misc = { - minor: MISC_DYNAMIC_MINOR, - name: R128_NAME, - fops: &r128_fops, -}; - -static drm_ioctl_desc_t r128_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { r128_version, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_busid, 0, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = { r128_addbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = { drm_markbufs, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = { drm_infobufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = { r128_mapbufs, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = { drm_freebufs, 1, 0 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { r128_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { r128_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { r128_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { r128_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { r128_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { r128_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { r128_resctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { r128_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { r128_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = { drm_agp_acquire, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = { drm_agp_release, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = { drm_agp_enable, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = { drm_agp_info, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = { drm_agp_alloc, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = { drm_agp_free, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = { drm_agp_bind, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = { drm_agp_unbind, 1, 1 }, -#endif - - [DRM_IOCTL_NR(DRM_IOCTL_R128_INIT)] = { r128_cce_init, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_START)] = { r128_cce_start, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_STOP)] = { r128_cce_stop, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_RESET)] = { r128_cce_reset, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_IDLE)] = { r128_cce_idle, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_engine_reset, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_SWAP)] = { r128_cce_swap, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_CLEAR)] = { r128_cce_clear, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_cce_vertex, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_INDICES)] = { r128_cce_indices, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_BLIT)] = { r128_cce_blit, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_DEPTH)] = { r128_cce_depth, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_R128_PACKET)] = { r128_cce_packet, 1, 0 }, -}; -#define R128_IOCTL_COUNT DRM_ARRAY_SIZE(r128_ioctls) - -#ifdef MODULE -static char *r128 = NULL; -#endif - -MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("r128"); -MODULE_PARM(r128, "s"); - -#ifndef MODULE -/* r128_options is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_drm. - */ - -static int __init r128_options(char *str) -{ - drm_parse_options(str); - return 1; -} - -__setup("r128=", r128_options); -#endif - -static int r128_setup(drm_device_t *dev) -{ - int i; - - atomic_set(&dev->ioctl_count, 0); - atomic_set(&dev->vma_count, 0); - dev->buf_use = 0; - atomic_set(&dev->buf_alloc, 0); - - drm_dma_setup(dev); - - atomic_set(&dev->total_open, 0); - atomic_set(&dev->total_close, 0); - atomic_set(&dev->total_ioctl, 0); - atomic_set(&dev->total_irq, 0); - atomic_set(&dev->total_ctx, 0); - atomic_set(&dev->total_locks, 0); - atomic_set(&dev->total_unlocks, 0); - atomic_set(&dev->total_contends, 0); - atomic_set(&dev->total_sleeps, 0); - - for (i = 0; i < DRM_HASH_SIZE; i++) { - dev->magiclist[i].head = NULL; - dev->magiclist[i].tail = NULL; - } - dev->maplist = NULL; - dev->map_count = 0; - dev->vmalist = NULL; - dev->lock.hw_lock = NULL; - init_waitqueue_head(&dev->lock.lock_queue); - dev->queue_count = 0; - dev->queue_reserved = 0; - dev->queue_slots = 0; - dev->queuelist = NULL; - dev->irq = 0; - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma_flag = 0; - dev->last_context = 0; - dev->last_switch = 0; - dev->last_checked = 0; - init_timer(&dev->timer); - init_waitqueue_head(&dev->context_wait); - - dev->ctx_start = 0; - dev->lck_start = 0; - - dev->buf_rp = dev->buf; - dev->buf_wp = dev->buf; - dev->buf_end = dev->buf + DRM_BSZ; - dev->buf_async = NULL; - init_waitqueue_head(&dev->buf_readers); - init_waitqueue_head(&dev->buf_writers); - - r128_res_ctx.handle=-1; - - DRM_DEBUG("\n"); - - /* The kernel's context could be created here, but is now created - in drm_dma_enqueue. This is more resource-efficient for - hardware that does not do DMA, but may mean that - drm_select_queue fails between the time the interrupt is - initialized and the time the queues are initialized. */ - - return 0; -} - - -static int r128_takedown(drm_device_t *dev) -{ - int i; - drm_magic_entry_t *pt, *next; - drm_map_t *map; - drm_vma_entry_t *vma, *vma_next; - - DRM_DEBUG("\n"); - - down(&dev->struct_sem); - del_timer(&dev->timer); - - if (dev->devname) { - drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); - dev->devname = NULL; - } - - if (dev->unique) { - drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); - dev->unique = NULL; - dev->unique_len = 0; - } - /* Clear pid list */ - for (i = 0; i < DRM_HASH_SIZE; i++) { - for (pt = dev->magiclist[i].head; pt; pt = next) { - next = pt->next; - drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); - } - dev->magiclist[i].head = dev->magiclist[i].tail = NULL; - } - -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - /* Clear AGP information */ - if (dev->agp) { - drm_agp_mem_t *entry; - drm_agp_mem_t *nexte; - - /* Remove AGP resources, but leave dev->agp - intact until r128_cleanup is called. */ - for (entry = dev->agp->memory; entry; entry = nexte) { - nexte = entry->next; - if (entry->bound) drm_unbind_agp(entry->memory); - drm_free_agp(entry->memory, entry->pages); - drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); - } - dev->agp->memory = NULL; - - if (dev->agp->acquired) _drm_agp_release(); - - dev->agp->acquired = 0; - dev->agp->enabled = 0; - } -#endif - - /* Clear vma list (only built for debugging) */ - if (dev->vmalist) { - for (vma = dev->vmalist; vma; vma = vma_next) { - vma_next = vma->next; - drm_free(vma, sizeof(*vma), DRM_MEM_VMAS); - } - dev->vmalist = NULL; - } - - /* Clear map area and mtrr information */ - if (dev->maplist) { - for (i = 0; i < dev->map_count; i++) { - map = dev->maplist[i]; - switch (map->type) { - case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: -#ifdef CONFIG_MTRR - if (map->mtrr >= 0) { - int retcode; - retcode = mtrr_del(map->mtrr, - map->offset, - map->size); - DRM_DEBUG("mtrr_del = %d\n", retcode); - } -#endif - drm_ioremapfree(map->handle, map->size); - break; - case _DRM_SHM: - drm_free_pages((unsigned long)map->handle, - drm_order(map->size) - - PAGE_SHIFT, - DRM_MEM_SAREA); - break; - case _DRM_AGP: - /* Do nothing here, because this is all - handled in the AGP/GART driver. */ - break; - } - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - } - drm_free(dev->maplist, - dev->map_count * sizeof(*dev->maplist), - DRM_MEM_MAPS); - dev->maplist = NULL; - dev->map_count = 0; - } - - drm_dma_takedown(dev); - - dev->queue_count = 0; - if (dev->lock.hw_lock) { - dev->lock.hw_lock = NULL; /* SHM removed */ - dev->lock.pid = 0; - wake_up_interruptible(&dev->lock.lock_queue); - } - up(&dev->struct_sem); - - return 0; -} - -/* r128_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). */ - -static int __init r128_init(void) -{ - int retcode; - drm_device_t *dev = &r128_device; - - DRM_DEBUG("\n"); - - memset((void *)dev, 0, sizeof(*dev)); - dev->count_lock = SPIN_LOCK_UNLOCKED; - sema_init(&dev->struct_sem, 1); - -#ifdef MODULE - drm_parse_options(r128); -#endif - - if ((retcode = misc_register(&r128_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", R128_NAME); - return retcode; - } - dev->device = MKDEV(MISC_MAJOR, r128_misc.minor); - dev->name = R128_NAME; +#include "ati_pcigart.h" - drm_mem_init(); - drm_proc_init(dev); +#define DRIVER_AUTHOR "Gareth Hughes, VA Linux Systems Inc." -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - dev->agp = drm_agp_init(); - if (dev->agp == NULL) { - DRM_ERROR("Cannot initialize agpgart module.\n"); - drm_proc_cleanup(); - misc_deregister(&r128_misc); - r128_takedown(dev); - return -ENOMEM; - } +#define DRIVER_NAME "r128" +#define DRIVER_DESC "ATI Rage 128" +#define DRIVER_DATE "20010405" + +#define DRIVER_MAJOR 2 +#define DRIVER_MINOR 1 +#define DRIVER_PATCHLEVEL 6 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { r128_cce_buffers, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_INIT)] = { r128_cce_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_START)] = { r128_cce_start, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_STOP)] = { r128_cce_stop, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_RESET)] = { r128_cce_reset, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CCE_IDLE)] = { r128_cce_idle, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_RESET)] = { r128_engine_reset, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_FULLSCREEN)] = { r128_fullscreen, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_SWAP)] = { r128_cce_swap, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_CLEAR)] = { r128_cce_clear, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_VERTEX)] = { r128_cce_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_INDICES)] = { r128_cce_indices, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_BLIT)] = { r128_cce_blit, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_DEPTH)] = { r128_cce_depth, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_STIPPLE)] = { r128_cce_stipple, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_R128_INDIRECT)] = { r128_cce_indirect, 1, 1 }, -#ifdef CONFIG_MTRR - dev->agp->agp_mtrr = mtrr_add(dev->agp->agp_info.aper_base, - dev->agp->agp_info.aper_size*1024*1024, - MTRR_TYPE_WRCOMB, - 1); -#endif -#endif - - if((retcode = drm_ctxbitmap_init(dev))) { - DRM_ERROR("Cannot allocate memory for context bitmap.\n"); - drm_proc_cleanup(); - misc_deregister(&r128_misc); - r128_takedown(dev); - return retcode; - } - - DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", - R128_NAME, - R128_MAJOR, - R128_MINOR, - R128_PATCHLEVEL, - R128_DATE, - r128_misc.minor); - - return 0; -} - -/* r128_cleanup is called via cleanup_module at module unload time. */ - -static void __exit r128_cleanup(void) -{ - drm_device_t *dev = &r128_device; - - DRM_DEBUG("\n"); - - drm_proc_cleanup(); - if (misc_deregister(&r128_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } - drm_ctxbitmap_cleanup(dev); - r128_takedown(dev); -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - if (dev->agp) { - drm_agp_uninit(); - drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); - dev->agp = NULL; - } -#endif -} - -module_init(r128_init); -module_exit(r128_cleanup); - - -int r128_version(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_version_t version; - int len; - - if (copy_from_user(&version, - (drm_version_t *)arg, - sizeof(version))) - return -EFAULT; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ - } - - version.version_major = R128_MAJOR; - version.version_minor = R128_MINOR; - version.version_patchlevel = R128_PATCHLEVEL; - - DRM_COPY(version.name, R128_NAME); - DRM_COPY(version.date, R128_DATE); - DRM_COPY(version.desc, R128_DESC); - - if (copy_to_user((drm_version_t *)arg, - &version, - sizeof(version))) - return -EFAULT; - return 0; -} - -int r128_open(struct inode *inode, struct file *filp) -{ - drm_device_t *dev = &r128_device; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_open_helper(inode, filp, dev))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_open); - spin_lock(&dev->count_lock); - if (!dev->open_count++) { - spin_unlock(&dev->count_lock); - return r128_setup(dev); - } - spin_unlock(&dev->count_lock); - } - - return retcode; -} - -int r128_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_release(inode, filp))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_close); - spin_lock(&dev->count_lock); - if (!--dev->open_count) { - if (atomic_read(&dev->ioctl_count) || dev->blocked) { - DRM_ERROR("Device busy: %d %d\n", - atomic_read(&dev->ioctl_count), - dev->blocked); - spin_unlock(&dev->count_lock); - unlock_kernel(); - return -EBUSY; - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return r128_takedown(dev); - } - spin_unlock(&dev->count_lock); - } - - unlock_kernel(); - return retcode; -} - -/* r128_ioctl is called whenever a process performs an ioctl on /dev/drm. */ -int r128_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - int nr = DRM_IOCTL_NR(cmd); - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int retcode = 0; - drm_ioctl_desc_t *ioctl; - drm_ioctl_t *func; - - atomic_inc(&dev->ioctl_count); - atomic_inc(&dev->total_ioctl); - ++priv->ioctl_count; - DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", - current->pid, cmd, nr, dev->device, priv->authenticated); - - if (nr >= R128_IOCTL_COUNT) { - retcode = -EINVAL; - } else { - ioctl = &r128_ioctls[nr]; - func = ioctl->func; - - if (!func) { - DRM_DEBUG("no function\n"); - retcode = -EINVAL; - } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN)) - || (ioctl->auth_needed && !priv->authenticated)) { - retcode = -EACCES; - } else { - retcode = (func)(inode, filp, cmd, arg); - } - } - #if 0 - if ( retcode ) { - DRM_INFO( "%s 0x%x ret = %d\n", __FUNCTION__, nr, retcode ); - } -#endif - - atomic_dec(&dev->ioctl_count); - return retcode; -} - -int r128_lock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - DECLARE_WAITQUEUE(entry, current); - int ret = 0; - drm_lock_t lock; -#if DRM_DMA_HISTOGRAM - cycles_t start; - - dev->lck_start = start = get_cycles(); -#endif - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } - - DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", - lock.context, current->pid, dev->lock.hw_lock->lock, - lock.flags); - - if (lock.context < 0) - return -EINVAL; - - if (!ret) { - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - ret = -EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - lock.context)) { - dev->lock.pid = current->pid; - dev->lock.lock_time = jiffies; - atomic_inc(&dev->total_locks); - break; /* Got lock */ - } - - /* Contention */ - atomic_inc(&dev->total_sleeps); - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - } - - if (!ret) { - sigemptyset(&dev->sigmask); - sigaddset(&dev->sigmask, SIGSTOP); - sigaddset(&dev->sigmask, SIGTSTP); - sigaddset(&dev->sigmask, SIGTTIN); - sigaddset(&dev->sigmask, SIGTTOU); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); - if (lock.flags & _DRM_LOCK_READY) { - /* Wait for space in DMA/FIFO */ - } - if (lock.flags & _DRM_LOCK_QUIESCENT) { - /* Make hardware quiescent */ - DRM_DEBUG( "not quiescent!\n" ); -#if 0 - r128_quiescent(dev); -#endif - } - } - -#if LINUX_VERSION_CODE < 0x020400 - if (lock.context != r128_res_ctx.handle) { - current->counter = 5; - current->priority = DEF_PRIORITY/4; - } -#endif - DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); - -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]); +/* GH: Count data sent to card via ring or vertex/indirect buffers. + */ +#define __HAVE_COUNTERS 3 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY #endif - return ret; -} - -int r128_unlock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_lock_t lock; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } - - DRM_DEBUG("%d frees lock (%d holds)\n", - lock.context, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - atomic_inc(&dev->total_unlocks); - if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock)) - atomic_inc(&dev->total_contends); - drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT); - /* FIXME: Try to send data to card here */ - if (!dev->context_flag) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } - } - -#if LINUX_VERSION_CODE < 0x020400 - if (lock.context != r128_res_ctx.handle) { - current->counter = 5; - current->priority = DEF_PRIORITY; - } -#endif - unblock_all_signals(); - return 0; -} +#include "drm_agpsupport.h" +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" +#include "drm_scatter.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h:1.8 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h:1.11 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h:1.8 Mon Dec 4 14:22:00 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_drv.h Tue Apr 10 12:08:05 2001 @@ -25,15 +25,18 @@ * DEALINGS IN THE SOFTWARE. * * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Kevin E. Martin <martin@valinux.com> - * Gareth Hughes <gareth@valinux.com> - * + * Rickard E. (Rik) Faith <faith@valinux.com> + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> + * 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; @@ -51,6 +54,8 @@ u32 tail; u32 tail_mask; int space; + + int high_mark; } drm_r128_ring_buffer_t; typedef struct drm_r128_private { @@ -59,7 +64,6 @@ int cce_mode; int cce_fifo_size; - int cce_secure; int cce_running; drm_r128_freelist_t *head; @@ -67,16 +71,23 @@ int usec_timeout; int is_pci; + unsigned long phys_pci_gart; + unsigned long cce_buffers_offset; atomic_t idle_count; + + int page_flipping; + int current_page; + u32 crtc_offset; + u32 crtc_offset_cntl; - unsigned int fb_bpp; + u32 color_fmt; unsigned int front_offset; unsigned int front_pitch; unsigned int back_offset; unsigned int back_pitch; - unsigned int depth_bpp; + u32 depth_fmt; unsigned int depth_offset; unsigned int depth_pitch; unsigned int span_offset; @@ -103,18 +114,6 @@ drm_r128_freelist_t *list_entry; } drm_r128_buf_priv_t; - /* r128_drv.c */ -extern int r128_version( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_open( struct inode *inode, struct file *filp ); -extern int r128_release( struct inode *inode, struct file *filp ); -extern int r128_ioctl( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_lock( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); -extern int r128_unlock( struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg ); - /* r128_cce.c */ extern int r128_cce_init( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); @@ -128,7 +127,7 @@ unsigned int cmd, unsigned long arg ); extern int r128_engine_reset( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); -extern int r128_cce_packet( struct inode *inode, struct file *filp, +extern int r128_fullscreen( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); extern int r128_cce_buffers( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); @@ -137,8 +136,19 @@ extern drm_buf_t *r128_freelist_get( drm_device_t *dev ); extern int r128_wait_ring( drm_r128_private_t *dev_priv, int n ); -extern void r128_update_ring_snapshot( drm_r128_private_t *dev_priv ); +static inline void +r128_update_ring_snapshot( drm_r128_ring_buffer_t *ring ) +{ + ring->space = (GET_RING_HEAD( ring ) - ring->tail) * sizeof(u32); + if ( ring->space <= 0 ) + ring->space += ring->size; +} + +extern int r128_do_cce_idle( drm_r128_private_t *dev_priv ); +extern int r128_do_cleanup_cce( drm_device_t *dev ); +extern int r128_do_cleanup_pageflip( drm_device_t *dev ); + /* r128_state.c */ extern int r128_cce_clear( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); @@ -154,31 +164,8 @@ unsigned int cmd, unsigned long arg ); extern int r128_cce_stipple( struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg ); - - /* r128_bufs.c */ -extern int r128_addbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_mapbufs(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - - /* r128_context.c */ -extern int r128_resctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_addctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_modctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_getctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_switchctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_newctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int r128_rmctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -extern int r128_context_switch(drm_device_t *dev, int old, int new); -extern int r128_context_switch_complete(drm_device_t *dev, int new); +extern int r128_cce_indirect( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); /* Register definitions, register access macros and drmAddMap constants @@ -215,8 +202,10 @@ #define R128_CLOCK_CNTL_INDEX 0x0008 #define R128_CLOCK_CNTL_DATA 0x000c # define R128_PLL_WR_EN (1 << 7) - #define R128_CONSTANT_COLOR_C 0x1d34 +#define R128_CRTC_OFFSET 0x0224 +#define R128_CRTC_OFFSET_CNTL 0x0228 +# define R128_CRTC_OFFSET_FLIP_CNTL (1 << 16) #define R128_DP_GUI_MASTER_CNTL 0x146c # define R128_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) @@ -265,6 +254,7 @@ # 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 @@ -276,6 +266,8 @@ #define R128_TEX_CNTL_C 0x1c9c # define R128_TEX_CACHE_FLUSH (1 << 23) +#define R128_WAIT_UNTIL 0x1720 +# define R128_EVENT_CRTC_OFFSET (1 << 0) #define R128_WINDOW_XY_OFFSET 0x1bcc @@ -376,40 +368,68 @@ #define R128_WATERMARK_N 8 #define R128_WATERMARK_K 128 -#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */ +#define R128_MAX_USEC_TIMEOUT 100000 /* 100 ms */ #define R128_LAST_FRAME_REG R128_GUI_SCRATCH_REG0 #define R128_LAST_DISPATCH_REG R128_GUI_SCRATCH_REG1 -#define R128_MAX_VB_AGE 0xffffffff - +#define R128_MAX_VB_AGE 0x7fffffff #define R128_MAX_VB_VERTS (0xffff) +#define R128_RING_HIGH_MARK 128 -#define R128_BASE(reg) ((u32)(dev_priv->mmio->handle)) -#define R128_ADDR(reg) (R128_BASE(reg) + reg) +#define R128_PERFORMANCE_BOXES 0 -#define R128_DEREF(reg) *(__volatile__ int *)R128_ADDR(reg) -#define R128_READ(reg) R128_DEREF(reg) -#define R128_WRITE(reg,val) do { R128_DEREF(reg) = val; } while (0) - -#define R128_DEREF8(reg) *(__volatile__ char *)R128_ADDR(reg) -#define R128_READ8(reg) R128_DEREF8(reg) -#define R128_WRITE8(reg,val) do { R128_DEREF8(reg) = val; } while (0) - -#define R128_WRITE_PLL(addr,val) \ -do { \ - 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); +#define R128_BASE(reg) ((unsigned long)(dev_priv->mmio->handle)) +#define R128_ADDR(reg) (R128_BASE( reg ) + reg) -#define R128CCE0(p,r,n) ((p) | ((n) << 16) | ((r) >> 2)) -#define R128CCE1(p,r1,r2) ((p) | (((r2) >> 2) << 11) | ((r1) >> 2)) -#define R128CCE2(p) ((p)) -#define R128CCE3(p,n) ((p) | ((n) << 16)) +#define R128_DEREF(reg) *(volatile u32 *)R128_ADDR( reg ) +#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)); \ +} while (0) +extern int R128_READ_PLL(drm_device_t *dev, int addr); #define CCE_PACKET0( reg, n ) (R128_CCE_PACKET0 | \ @@ -420,33 +440,97 @@ #define CCE_PACKET3( pkt, n ) (R128_CCE_PACKET3 | \ (pkt) | ((n) << 16)) + +/* ================================================================ + * Misc helper macros + */ + +#define LOCK_TEST_WITH_RETURN( dev ) \ +do { \ + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ + dev->lock.pid != current->pid ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + return -EINVAL; \ + } \ +} while (0) + +#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + drm_r128_ring_buffer_t *ring = &dev_priv->ring; int i; \ + if ( ring->space < ring->high_mark ) { \ + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ + r128_update_ring_snapshot( ring ); \ + if ( ring->space >= ring->high_mark ) \ + goto __ring_space_done; \ + udelay( 1 ); \ + } \ + DRM_ERROR( "ring space check failed!\n" ); \ + return -EBUSY; \ + } \ + __ring_space_done: \ +} while (0) -#define r128_flush_write_combine() mb() +#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; \ + if ( sarea_priv->last_dispatch >= R128_MAX_VB_AGE ) { \ + int __ret = r128_do_cce_idle( dev_priv ); \ + if ( __ret < 0 ) return __ret; \ + sarea_priv->last_dispatch = 0; \ + r128_freelist_reset( dev ); \ + } \ +} while (0) +#define R128_WAIT_UNTIL_PAGE_FLIPPED() do { \ + OUT_RING( CCE_PACKET0( R128_WAIT_UNTIL, 0 ) ); \ + OUT_RING( R128_EVENT_CRTC_OFFSET ); \ +} while (0) + +/* ================================================================ + * Ring control + */ + +#define r128_flush_write_combine() mb() + + #define R128_VERBOSE 0 -#define RING_LOCALS int write; unsigned int tail_mask; volatile u32 *ring; +#define RING_LOCALS \ + int write; unsigned int tail_mask; volatile u32 *ring; #define BEGIN_RING( n ) do { \ if ( R128_VERBOSE ) { \ DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ - n, __FUNCTION__ ); \ + (n), __FUNCTION__ ); \ } \ - if ( dev_priv->ring.space < n * sizeof(u32) ) { \ - r128_wait_ring( dev_priv, n * sizeof(u32) ); \ + if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ + r128_wait_ring( dev_priv, (n) * sizeof(u32) ); \ } \ - dev_priv->ring.space -= n * sizeof(u32); \ + dev_priv->ring.space -= (n) * sizeof(u32); \ ring = dev_priv->ring.start; \ write = dev_priv->ring.tail; \ tail_mask = dev_priv->ring.tail_mask; \ } while (0) +/* You can set this to zero if you want. If the card locks up, you'll + * need to keep this set. It works around a bug in early revs of the + * Rage 128 chipset, where the CCE would read 32 dwords past the end of + * the ring buffer before wrapping around. + */ +#define R128_BROKEN_CCE 1 + #define ADVANCE_RING() do { \ if ( R128_VERBOSE ) { \ - DRM_INFO( "ADVANCE_RING() tail=0x%06x wr=0x%06x\n", \ + DRM_INFO( "ADVANCE_RING() wr=0x%06x tail=0x%06x\n", \ write, dev_priv->ring.tail ); \ } \ + if ( R128_BROKEN_CCE && write < 32 ) { \ + memcpy( dev_priv->ring.end, \ + dev_priv->ring.start, \ + write * sizeof(u32) ); \ + } \ r128_flush_write_combine(); \ dev_priv->ring.tail = write; \ R128_WRITE( R128_PM4_BUFFER_DL_WPTR, write ); \ @@ -457,10 +541,8 @@ 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) - -#define R128_PERFORMANCE_BOXES 0 #endif /* __R128_DRV_H__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c:1.2 Tue Dec 12 12:17:14 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/r128_state.c Tue Apr 10 12:08:05 2001 @@ -25,13 +25,14 @@ * * Authors: * Gareth Hughes <gareth@valinux.com> - * */ #define __NO_VERSION__ +#include "r128.h" #include "drmP.h" #include "r128_drv.h" #include "drm.h" +#include <linux/delay.h> /* ================================================================ @@ -181,14 +182,14 @@ RING_LOCALS; DRM_DEBUG( " %s\n", __FUNCTION__ ); - BEGIN_RING( 7 + R128_TEX_MAXLEVELS ); + BEGIN_RING( 7 + R128_MAX_TEXTURE_LEVELS ); OUT_RING( CCE_PACKET0( R128_PRIM_TEX_CNTL_C, - 2 + R128_TEX_MAXLEVELS ) ); + 2 + R128_MAX_TEXTURE_LEVELS ) ); OUT_RING( tex->tex_cntl ); OUT_RING( tex->tex_combine_cntl ); OUT_RING( ctx->tex_size_pitch_c ); - for ( i = 0 ; i < R128_TEX_MAXLEVELS ; i++ ) { + for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) { OUT_RING( tex->tex_offset[i] ); } @@ -207,13 +208,13 @@ RING_LOCALS; DRM_DEBUG( " %s\n", __FUNCTION__ ); - BEGIN_RING( 5 + R128_TEX_MAXLEVELS ); + BEGIN_RING( 5 + R128_MAX_TEXTURE_LEVELS ); OUT_RING( CCE_PACKET0( R128_SEC_TEX_CNTL_C, - 1 + R128_TEX_MAXLEVELS ) ); + 1 + R128_MAX_TEXTURE_LEVELS ) ); OUT_RING( tex->tex_cntl ); OUT_RING( tex->tex_combine_cntl ); - for ( i = 0 ; i < R128_TEX_MAXLEVELS ; i++ ) { + for ( i = 0 ; i < R128_MAX_TEXTURE_LEVELS ; i++ ) { OUT_RING( tex->tex_offset[i] ); } @@ -310,13 +311,13 @@ BEGIN_RING( 6 ); OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL - | R128_GMC_BRUSH_SOLID_COLOR - | fb_bpp - | R128_GMC_SRC_DATATYPE_COLOR - | R128_ROP3_P - | R128_GMC_CLR_CMP_CNTL_DIS - | R128_GMC_AUX_CLIP_DIS ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + fb_bpp | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS ); OUT_RING( (pitch << 21) | (offset >> 5) ); OUT_RING( color ); @@ -360,43 +361,24 @@ } static void r128_cce_dispatch_clear( drm_device_t *dev, - unsigned int flags, - int cx, int cy, int cw, int ch, - unsigned int clear_color, - unsigned int clear_depth ) + drm_r128_clear_t *clear ) { drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; int nbox = sarea_priv->nbox; drm_clip_rect_t *pbox = sarea_priv->boxes; - u32 fb_bpp, depth_bpp; + unsigned int flags = clear->flags; int i; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); + if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { + unsigned int tmp = flags; - switch ( dev_priv->fb_bpp ) { - case 16: - fb_bpp = R128_GMC_DST_16BPP; - break; - case 32: - fb_bpp = R128_GMC_DST_32BPP; - break; - default: - return; + flags &= ~(R128_FRONT | R128_BACK); + if ( tmp & R128_FRONT ) flags |= R128_BACK; + if ( tmp & R128_BACK ) flags |= R128_FRONT; } - switch ( dev_priv->depth_bpp ) { - case 16: - depth_bpp = R128_GMC_DST_16BPP; - break; - case 24: - case 32: - depth_bpp = R128_GMC_DST_32BPP; - break; - default: - return; - } for ( i = 0 ; i < nbox ; i++ ) { int x = pbox[i].x1; @@ -412,7 +394,7 @@ BEGIN_RING( 2 ); OUT_RING( CCE_PACKET0( R128_DP_WRITE_MASK, 0 ) ); - OUT_RING( sarea_priv->context_state.plane_3d_mask_c ); + OUT_RING( clear->color_mask ); ADVANCE_RING(); } @@ -421,16 +403,16 @@ BEGIN_RING( 6 ); OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL - | R128_GMC_BRUSH_SOLID_COLOR - | fb_bpp - | R128_GMC_SRC_DATATYPE_COLOR - | R128_ROP3_P - | R128_GMC_CLR_CMP_CNTL_DIS - | R128_GMC_AUX_CLIP_DIS ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->color_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS ); OUT_RING( dev_priv->front_pitch_offset_c ); - OUT_RING( clear_color ); + OUT_RING( clear->clear_color ); OUT_RING( (x << 16) | y ); OUT_RING( (w << 16) | h ); @@ -442,16 +424,16 @@ BEGIN_RING( 6 ); OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL - | R128_GMC_BRUSH_SOLID_COLOR - | fb_bpp - | R128_GMC_SRC_DATATYPE_COLOR - | R128_ROP3_P - | R128_GMC_CLR_CMP_CNTL_DIS - | R128_GMC_AUX_CLIP_DIS ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->color_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS ); OUT_RING( dev_priv->back_pitch_offset_c ); - OUT_RING( clear_color ); + OUT_RING( clear->clear_color ); OUT_RING( (x << 16) | y ); OUT_RING( (w << 16) | h ); @@ -463,17 +445,17 @@ BEGIN_RING( 6 ); OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL - | R128_GMC_BRUSH_SOLID_COLOR - | depth_bpp - | R128_GMC_SRC_DATATYPE_COLOR - | R128_ROP3_P - | R128_GMC_CLR_CMP_CNTL_DIS - | R128_GMC_AUX_CLIP_DIS - | R128_GMC_WR_MSK_DIS ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS | + R128_GMC_WR_MSK_DIS ); OUT_RING( dev_priv->depth_pitch_offset_c ); - OUT_RING( clear_depth ); + OUT_RING( clear->clear_depth ); OUT_RING( (x << 16) | y ); OUT_RING( (w << 16) | h ); @@ -489,29 +471,16 @@ drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; int nbox = sarea_priv->nbox; drm_clip_rect_t *pbox = sarea_priv->boxes; - u32 fb_bpp; int i; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - #if R128_PERFORMANCE_BOXES /* Do some trivial performance monitoring... */ r128_cce_performance_boxes( dev_priv ); #endif - switch ( dev_priv->fb_bpp ) { - case 16: - fb_bpp = R128_GMC_DST_16BPP; - break; - case 32: - default: - fb_bpp = R128_GMC_DST_32BPP; - break; - } - for ( i = 0 ; i < nbox ; i++ ) { int x = pbox[i].x1; int y = pbox[i].y1; @@ -521,16 +490,16 @@ BEGIN_RING( 7 ); OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); - OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL - | R128_GMC_DST_PITCH_OFFSET_CNTL - | R128_GMC_BRUSH_NONE - | fb_bpp - | R128_GMC_SRC_DATATYPE_COLOR - | R128_ROP3_S - | R128_DP_SRC_SOURCE_MEMORY - | R128_GMC_CLR_CMP_CNTL_DIS - | R128_GMC_AUX_CLIP_DIS - | R128_GMC_WR_MSK_DIS ); + OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | + R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_NONE | + (dev_priv->color_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_S | + R128_DP_SRC_SOURCE_MEMORY | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_AUX_CLIP_DIS | + R128_GMC_WR_MSK_DIS ); OUT_RING( dev_priv->back_pitch_offset_c ); OUT_RING( dev_priv->front_pitch_offset_c ); @@ -556,6 +525,47 @@ ADVANCE_RING(); } +static void r128_cce_dispatch_flip( drm_device_t *dev ) +{ + drm_r128_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page ); + +#if R128_PERFORMANCE_BOXES + /* Do some trivial performance monitoring... + */ + r128_cce_performance_boxes( dev_priv ); +#endif + + BEGIN_RING( 4 ); + + R128_WAIT_UNTIL_PAGE_FLIPPED(); + OUT_RING( CCE_PACKET0( R128_CRTC_OFFSET, 0 ) ); + + if ( dev_priv->current_page == 0 ) { + OUT_RING( dev_priv->back_offset ); + dev_priv->current_page = 1; + } else { + OUT_RING( dev_priv->front_offset ); + dev_priv->current_page = 0; + } + + ADVANCE_RING(); + + /* Increment the frame counter. The client-side 3D driver must + * throttle the framerate by waiting for this value before + * performing the swapbuffer ioctl. + */ + dev_priv->sarea_priv->last_frame++; + + BEGIN_RING( 2 ); + + OUT_RING( CCE_PACKET0( R128_LAST_FRAME_REG, 0 ) ); + OUT_RING( dev_priv->sarea_priv->last_frame ); + + ADVANCE_RING(); +} + static void r128_cce_dispatch_vertex( drm_device_t *dev, drm_buf_t *buf ) { @@ -563,7 +573,7 @@ drm_r128_buf_priv_t *buf_priv = buf->dev_private; drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; int format = sarea_priv->vc_format; - int offset = dev_priv->buffers->offset + buf->offset - dev->agp->base; + int offset = buf->bus_address; int size = buf->used; int prim = buf_priv->prim; int i = 0; @@ -571,8 +581,6 @@ DRM_DEBUG( "%s: buf=%d nbox=%d\n", __FUNCTION__, buf->idx, sarea_priv->nbox ); - r128_update_ring_snapshot( dev_priv ); - if ( 0 ) r128_print_dirty( "dispatch_vertex", sarea_priv->dirty ); @@ -626,22 +634,10 @@ dev_priv->sarea_priv->last_dispatch++; -#if 0 - if ( dev_priv->submit_age == R128_MAX_VB_AGE ) { - ret = r128_do_cce_idle( dev_priv ); - if ( ret < 0 ) return ret; - dev_priv->submit_age = 0; - r128_freelist_reset( dev ); - } -#endif - sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS; sarea_priv->nbox = 0; } - - - static void r128_cce_dispatch_indirect( drm_device_t *dev, drm_buf_t *buf, int start, int end ) @@ -652,11 +648,8 @@ DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", buf->idx, start, end ); - r128_update_ring_snapshot( dev_priv ); - if ( start != end ) { - int offset = (dev_priv->buffers->offset - dev->agp->base - + buf->offset + start); + int offset = buf->bus_address + start; int dwords = (end - start + 3) / sizeof(u32); /* Indirect buffer data must be an even number of @@ -667,7 +660,7 @@ 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; @@ -700,15 +693,6 @@ } dev_priv->sarea_priv->last_dispatch++; - -#if 0 - if ( dev_priv->submit_age == R128_MAX_VB_AGE ) { - ret = r128_do_cce_idle( dev_priv ); - if ( ret < 0 ) return ret; - dev_priv->submit_age = 0; - r128_freelist_reset( dev ); - } -#endif } static void r128_cce_dispatch_indices( drm_device_t *dev, @@ -720,7 +704,7 @@ 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; @@ -728,8 +712,6 @@ RING_LOCALS; DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count ); - r128_update_ring_snapshot( dev_priv ); - if ( 0 ) r128_print_dirty( "dispatch_indices", sarea_priv->dirty ); @@ -745,16 +727,21 @@ 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 { @@ -789,15 +776,6 @@ dev_priv->sarea_priv->last_dispatch++; -#if 0 - if ( dev_priv->submit_age == R128_MAX_VB_AGE ) { - ret = r128_do_cce_idle( dev_priv ); - if ( ret < 0 ) return ret; - dev_priv->submit_age = 0; - r128_freelist_reset( dev ); - } -#endif - sarea_priv->dirty &= ~R128_UPLOAD_CLIPRECTS; sarea_priv->nbox = 0; } @@ -814,20 +792,22 @@ RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - /* The compiler won't optimize away a division by a variable, * even if the only legal values are powers of two. Thus, we'll * use a shift instead. */ switch ( blit->format ) { + case R128_DATATYPE_ARGB8888: + dword_shift = 0; + break; case R128_DATATYPE_ARGB1555: case R128_DATATYPE_RGB565: case R128_DATATYPE_ARGB4444: dword_shift = 1; break; - case R128_DATATYPE_ARGB8888: - dword_shift = 0; + case R128_DATATYPE_CI8: + case R128_DATATYPE_RGB8: + dword_shift = 2; break; default: DRM_ERROR( "invalid blit format %d\n", blit->format ); @@ -867,23 +847,23 @@ 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); @@ -918,25 +898,10 @@ int count, x, y; u32 *buffer; u8 *mask; - u32 depth_bpp; int i; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - - switch ( dev_priv->depth_bpp ) { - case 16: - depth_bpp = R128_GMC_DST_16BPP; - break; - case 24: - case 32: - depth_bpp = R128_GMC_DST_32BPP; - break; - default: - return -EINVAL; - } - count = depth->n; if ( copy_from_user( &x, depth->x, sizeof(x) ) ) { return -EFAULT; @@ -971,15 +936,14 @@ if ( mask[i] ) { BEGIN_RING( 6 ); - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, - 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL - | R128_GMC_BRUSH_SOLID_COLOR - | depth_bpp - | R128_GMC_SRC_DATATYPE_COLOR - | R128_ROP3_P - | R128_GMC_CLR_CMP_CNTL_DIS - | R128_GMC_WR_MSK_DIS ); + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_WR_MSK_DIS ); OUT_RING( dev_priv->depth_pitch_offset_c ); OUT_RING( buffer[i] ); @@ -997,13 +961,13 @@ BEGIN_RING( 6 ); OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL - | R128_GMC_BRUSH_SOLID_COLOR - | depth_bpp - | R128_GMC_SRC_DATATYPE_COLOR - | R128_ROP3_P - | R128_GMC_CLR_CMP_CNTL_DIS - | R128_GMC_WR_MSK_DIS ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_WR_MSK_DIS ); OUT_RING( dev_priv->depth_pitch_offset_c ); OUT_RING( buffer[i] ); @@ -1027,25 +991,10 @@ int count, *x, *y; u32 *buffer; u8 *mask; - u32 depth_bpp; int i; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - - switch ( dev_priv->depth_bpp ) { - case 16: - depth_bpp = R128_GMC_DST_16BPP; - break; - case 24: - case 32: - depth_bpp = R128_GMC_DST_32BPP; - break; - default: - return -EINVAL; - } - count = depth->n; x = kmalloc( count * sizeof(*x), 0 ); @@ -1103,15 +1052,14 @@ if ( mask[i] ) { BEGIN_RING( 6 ); - OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, - 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL - | R128_GMC_BRUSH_SOLID_COLOR - | depth_bpp - | R128_GMC_SRC_DATATYPE_COLOR - | R128_ROP3_P - | R128_GMC_CLR_CMP_CNTL_DIS - | R128_GMC_WR_MSK_DIS ); + OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_WR_MSK_DIS ); OUT_RING( dev_priv->depth_pitch_offset_c ); OUT_RING( buffer[i] ); @@ -1129,13 +1077,13 @@ BEGIN_RING( 6 ); OUT_RING( CCE_PACKET3( R128_CNTL_PAINT_MULTI, 4 ) ); - OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL - | R128_GMC_BRUSH_SOLID_COLOR - | depth_bpp - | R128_GMC_SRC_DATATYPE_COLOR - | R128_ROP3_P - | R128_GMC_CLR_CMP_CNTL_DIS - | R128_GMC_WR_MSK_DIS ); + OUT_RING( R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_SOLID_COLOR | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_P | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_WR_MSK_DIS ); OUT_RING( dev_priv->depth_pitch_offset_c ); OUT_RING( buffer[i] ); @@ -1159,24 +1107,9 @@ { drm_r128_private_t *dev_priv = dev->dev_private; int count, x, y; - u32 depth_bpp; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - - switch ( dev_priv->depth_bpp ) { - case 16: - depth_bpp = R128_GMC_DST_16BPP; - break; - case 24: - case 32: - depth_bpp = R128_GMC_DST_32BPP; - break; - default: - return -EINVAL; - } - count = depth->n; if ( copy_from_user( &x, depth->x, sizeof(x) ) ) { return -EFAULT; @@ -1188,15 +1121,15 @@ BEGIN_RING( 7 ); OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); - OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL - | R128_GMC_DST_PITCH_OFFSET_CNTL - | R128_GMC_BRUSH_NONE - | depth_bpp - | R128_GMC_SRC_DATATYPE_COLOR - | R128_ROP3_S - | R128_DP_SRC_SOURCE_MEMORY - | R128_GMC_CLR_CMP_CNTL_DIS - | R128_GMC_WR_MSK_DIS ); + OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | + R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_NONE | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_S | + R128_DP_SRC_SOURCE_MEMORY | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_WR_MSK_DIS ); OUT_RING( dev_priv->depth_pitch_offset_c ); OUT_RING( dev_priv->span_pitch_offset_c ); @@ -1215,25 +1148,10 @@ { drm_r128_private_t *dev_priv = dev->dev_private; int count, *x, *y; - u32 depth_bpp; int i; RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - - switch ( dev_priv->depth_bpp ) { - case 16: - depth_bpp = R128_GMC_DST_16BPP; - break; - case 24: - case 32: - depth_bpp = R128_GMC_DST_32BPP; - break; - default: - return -EINVAL; - } - count = depth->n; if ( count > dev_priv->depth_pitch ) { count = dev_priv->depth_pitch; @@ -1263,15 +1181,15 @@ BEGIN_RING( 7 ); OUT_RING( CCE_PACKET3( R128_CNTL_BITBLT_MULTI, 5 ) ); - OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL - | R128_GMC_DST_PITCH_OFFSET_CNTL - | R128_GMC_BRUSH_NONE - | depth_bpp - | R128_GMC_SRC_DATATYPE_COLOR - | R128_ROP3_S - | R128_DP_SRC_SOURCE_MEMORY - | R128_GMC_CLR_CMP_CNTL_DIS - | R128_GMC_WR_MSK_DIS ); + OUT_RING( R128_GMC_SRC_PITCH_OFFSET_CNTL | + R128_GMC_DST_PITCH_OFFSET_CNTL | + R128_GMC_BRUSH_NONE | + (dev_priv->depth_fmt << 8) | + R128_GMC_SRC_DATATYPE_COLOR | + R128_ROP3_S | + R128_DP_SRC_SOURCE_MEMORY | + R128_GMC_CLR_CMP_CNTL_DIS | + R128_GMC_WR_MSK_DIS ); OUT_RING( dev_priv->depth_pitch_offset_c ); OUT_RING( dev_priv->span_pitch_offset_c ); @@ -1301,11 +1219,9 @@ RING_LOCALS; DRM_DEBUG( "%s\n", __FUNCTION__ ); - r128_update_ring_snapshot( dev_priv ); - BEGIN_RING( 33 ); - OUT_RING( CCE_PACKET0( R128_BRUSH_DATA0, 31 ) ); + OUT_RING( CCE_PACKET0( R128_BRUSH_DATA0, 31 ) ); for ( i = 0 ; i < 32 ; i++ ) { OUT_RING( stipple[i] ); } @@ -1328,22 +1244,18 @@ drm_r128_clear_t clear; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "r128_cce_clear called without lock held\n" ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &clear, (drm_r128_clear_t *) arg, sizeof(clear) ) ) return -EFAULT; + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS ) sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; - r128_cce_dispatch_clear( dev, clear.flags, - clear.x, clear.y, clear.w, clear.h, - clear.clear_color, clear.clear_depth ); + r128_cce_dispatch_clear( dev, &clear ); /* Make sure we restore the 3D state next time. */ @@ -1361,20 +1273,20 @@ drm_r128_sarea_t *sarea_priv = dev_priv->sarea_priv; DRM_DEBUG( "%s\n", __FUNCTION__ ); - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "r128_cce_swap called without lock held\n" ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); if ( sarea_priv->nbox > R128_NR_SAREA_CLIPRECTS ) sarea_priv->nbox = R128_NR_SAREA_CLIPRECTS; - r128_cce_dispatch_swap( dev ); - - /* Make sure we restore the 3D state next time. - */ - dev_priv->sarea_priv->dirty |= R128_UPLOAD_CONTEXT | R128_UPLOAD_MASKS; + if ( !dev_priv->page_flipping ) { + r128_cce_dispatch_swap( dev ); + dev_priv->sarea_priv->dirty |= (R128_UPLOAD_CONTEXT | + R128_UPLOAD_MASKS); + } else { + r128_cce_dispatch_flip( dev ); + } return 0; } @@ -1390,13 +1302,10 @@ drm_r128_buf_priv_t *buf_priv; drm_r128_vertex_t vertex; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } - if ( !dev_priv || dev_priv->is_pci ) { - DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); return -EINVAL; } @@ -1419,6 +1328,9 @@ return -EINVAL; } + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + buf = dma->buflist[vertex.idx]; buf_priv = buf->dev_private; @@ -1453,13 +1365,10 @@ drm_r128_indices_t elts; int count; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } - if ( !dev_priv || dev_priv->is_pci ) { - DRM_ERROR( "%s called with a PCI card\n", __FUNCTION__ ); + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); return -EINVAL; } @@ -1482,6 +1391,9 @@ return -EINVAL; } + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + buf = dma->buflist[elts.idx]; buf_priv = buf->dev_private; @@ -1522,13 +1434,10 @@ drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; drm_device_dma_t *dma = dev->dma; + drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_blit_t blit; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &blit, (drm_r128_blit_t *)arg, sizeof(blit) ) ) @@ -1543,6 +1452,9 @@ return -EINVAL; } + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + return r128_cce_dispatch_blit( dev, &blit ); } @@ -1551,18 +1463,17 @@ { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_depth_t depth; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &depth, (drm_r128_depth_t *)arg, sizeof(depth) ) ) return -EFAULT; + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + switch ( depth.func ) { case R128_WRITE_SPAN: return r128_cce_dispatch_write_span( dev, &depth ); @@ -1582,14 +1493,11 @@ { drm_file_t *priv = filp->private_data; drm_device_t *dev = priv->dev; + drm_r128_private_t *dev_priv = dev->dev_private; drm_r128_stipple_t stipple; u32 mask[32]; - if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || - dev->lock.pid != current->pid ) { - DRM_ERROR( "%s called without lock held\n", __FUNCTION__ ); - return -EINVAL; - } + LOCK_TEST_WITH_RETURN( dev ); if ( copy_from_user( &stipple, (drm_r128_stipple_t *)arg, sizeof(stipple) ) ) @@ -1599,7 +1507,22 @@ 32 * sizeof(u32) ) ) return -EFAULT; + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + r128_cce_dispatch_stipple( dev, mask ); return 0; +} + +int r128_cce_indirect( 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; + + LOCK_TEST_WITH_RETURN( dev ); + + /* Indirect buffer firing is not supported at this time. + */ + return -EINVAL; } Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h:1.2 --- /dev/null Mon Jun 4 12:41:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon.h Tue Apr 10 12:08:05 2001 @@ -0,0 +1,81 @@ +/* radeon.h -- ATI Radeon DRM template customization -*- linux-c -*- + * Created: Wed Feb 14 17:07:34 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __RADEON_H__ +#define __RADEON_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) radeon_##x + +/* General customization: + */ +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 0 +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 +#define __HAVE_SG 1 +#define __HAVE_PCI_DMA 1 + +/* Driver customization: + */ +#define DRIVER_PRERELEASE() do { \ + if ( dev->dev_private ) { \ + drm_radeon_private_t *dev_priv = dev->dev_private; \ + if ( dev_priv->page_flipping ) { \ + radeon_do_cleanup_pageflip( dev ); \ + } \ + } \ +} while (0) + +#define DRIVER_PRETAKEDOWN() do { \ + if ( dev->dev_private ) radeon_do_cleanup_cp( dev ); \ +} while (0) + +/* DMA customization: + */ +#define __HAVE_DMA 1 + +#if 0 +/* GH: Remove this for now... */ +#define __HAVE_DMA_QUIESCENT 1 +#define DRIVER_DMA_QUIESCENT() do { \ + drm_radeon_private_t *dev_priv = dev->dev_private; \ + return radeon_do_cp_idle( dev_priv ); \ +} while (0) +#endif + +/* Buffer customization: + */ +#define DRIVER_BUF_PRIV_T drm_radeon_buf_priv_t + +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_radeon_private_t *)((dev)->dev_private))->buffers + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_bufs.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_bufs.c:1.1 --- /dev/null Mon Jun 4 12:41:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_bufs.c Sun Jan 7 20:07:39 2001 @@ -0,0 +1,298 @@ +/* radeon_bufs.c -- IOCTLs to manage buffers -*- linux-c -*- + * + * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: Kevin E. Martin <martin@valinux.com> + * Rickard E. (Rik) Faith <faith@valinux.com> + * Jeff Hartmann <jhartmann@valinux.com> + * + */ + +#define __NO_VERSION__ +#include <linux/config.h> +#include "drmP.h" +#include "radeon_drv.h" +#include "linux/un.h" + + +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) +int radeon_addbufs_agp(struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + drm_buf_desc_t request; + drm_buf_entry_t *entry; + drm_buf_t *buf; + unsigned long offset; + unsigned long agp_offset; + int count; + int order; + int size; + int alignment; + int page_order; + int total; + int byte_count; + int i; + + if (!dma) return -EINVAL; + + if (copy_from_user(&request, (drm_buf_desc_t *)arg, sizeof(request))) + return -EFAULT; + + count = request.count; + order = drm_order(request.size); + size = 1 << order; + + alignment = (request.flags & _DRM_PAGE_ALIGN) ? PAGE_ALIGN(size):size; + page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0; + total = PAGE_SIZE << page_order; + + byte_count = 0; + agp_offset = dev->agp->base + request.agp_start; + + DRM_DEBUG("count: %d\n", count); + DRM_DEBUG("order: %d\n", order); + DRM_DEBUG("size: %d\n", size); + DRM_DEBUG("agp_offset: %ld\n", agp_offset); + DRM_DEBUG("alignment: %d\n", alignment); + DRM_DEBUG("page_order: %d\n", page_order); + DRM_DEBUG("total: %d\n", total); + + if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER) return -EINVAL; + if (dev->queue_count) return -EBUSY; /* Not while in use */ + + spin_lock(&dev->count_lock); + if (dev->buf_use) { + spin_unlock(&dev->count_lock); + return -EBUSY; + } + atomic_inc(&dev->buf_alloc); + spin_unlock(&dev->count_lock); + + down(&dev->struct_sem); + entry = &dma->bufs[order]; + if (entry->buf_count) { + up(&dev->struct_sem); + atomic_dec(&dev->buf_alloc); + return -ENOMEM; /* May only call once for each order */ + } + + entry->buflist = drm_alloc(count * sizeof(*entry->buflist), + DRM_MEM_BUFS); + if (!entry->buflist) { + up(&dev->struct_sem); + atomic_dec(&dev->buf_alloc); + return -ENOMEM; + } + memset(entry->buflist, 0, count * sizeof(*entry->buflist)); + + entry->buf_size = size; + entry->page_order = page_order; + offset = 0; + + for (offset = 0; + entry->buf_count < count; + offset += alignment, ++entry->buf_count) { + buf = &entry->buflist[entry->buf_count]; + buf->idx = dma->buf_count + entry->buf_count; + buf->total = alignment; + buf->order = order; + buf->used = 0; + buf->offset = (dma->byte_count + offset); + buf->address = (void *)(agp_offset + offset); + buf->next = NULL; + buf->waiting = 0; + buf->pending = 0; + init_waitqueue_head(&buf->dma_wait); + buf->pid = 0; + + buf->dev_priv_size = sizeof(drm_radeon_buf_priv_t); + buf->dev_private = drm_alloc(sizeof(drm_radeon_buf_priv_t), + DRM_MEM_BUFS); + memset(buf->dev_private, 0, buf->dev_priv_size); + +#if DRM_DMA_HISTOGRAM + buf->time_queued = 0; + buf->time_dispatched = 0; + buf->time_completed = 0; + buf->time_freed = 0; +#endif + + byte_count += PAGE_SIZE << page_order; + + DRM_DEBUG("buffer %d @ %p\n", + entry->buf_count, buf->address); + } + + 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 = dma->buf_count; i < dma->buf_count + entry->buf_count; i++) + dma->buflist[i] = &entry->buflist[i - dma->buf_count]; + + dma->buf_count += entry->buf_count; + dma->byte_count += byte_count; + + 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]); + } + + up(&dev->struct_sem); + + request.count = entry->buf_count; + request.size = size; + + if (copy_to_user((drm_buf_desc_t *)arg, &request, sizeof(request))) + return -EFAULT; + + dma->flags = _DRM_DMA_USE_AGP; + + atomic_dec(&dev->buf_alloc); + return 0; +} +#endif + +int radeon_addbufs(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_buf_desc_t request; + + if (!dev_priv || dev_priv->is_pci) return -EINVAL; + + if (copy_from_user(&request, (drm_buf_desc_t *)arg, sizeof(request))) + return -EFAULT; + +#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) + if (request.flags & _DRM_AGP_BUFFER) + return radeon_addbufs_agp(inode, filp, cmd, arg); + else +#endif + return -EINVAL; +} + +int radeon_mapbufs(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + int retcode = 0; + const int zero = 0; + unsigned long virtual; + unsigned long address; + drm_buf_map_t request; + int i; + + if (!dma || !dev_priv || dev_priv->is_pci) return -EINVAL; + + DRM_DEBUG("\n"); + + spin_lock(&dev->count_lock); + if (atomic_read(&dev->buf_alloc)) { + spin_unlock(&dev->count_lock); + return -EBUSY; + } + ++dev->buf_use; /* Can't allocate more after this call */ + spin_unlock(&dev->count_lock); + + if (copy_from_user(&request, (drm_buf_map_t *)arg, sizeof(request))) + return -EFAULT; + + if (request.count >= dma->buf_count) { + if (dma->flags & _DRM_DMA_USE_AGP) { + drm_map_t *map; + + map = dev_priv->buffers; + if (!map) { + retcode = -EINVAL; + goto done; + } + + down(¤t->mm->mmap_sem); + virtual = do_mmap(filp, 0, map->size, + PROT_READ|PROT_WRITE, + MAP_SHARED, + (unsigned long)map->offset); + up(¤t->mm->mmap_sem); + } else { + down(¤t->mm->mmap_sem); + virtual = do_mmap(filp, 0, dma->byte_count, + PROT_READ|PROT_WRITE, MAP_SHARED, 0); + up(¤t->mm->mmap_sem); + } + if (virtual > -1024UL) { + /* Real error */ + retcode = (signed long)virtual; + goto done; + } + request.virtual = (void *)virtual; + + for (i = 0; i < dma->buf_count; i++) { + if (copy_to_user(&request.list[i].idx, + &dma->buflist[i]->idx, + sizeof(request.list[0].idx))) { + retcode = -EFAULT; + goto done; + } + if (copy_to_user(&request.list[i].total, + &dma->buflist[i]->total, + sizeof(request.list[0].total))) { + retcode = -EFAULT; + goto done; + } + if (copy_to_user(&request.list[i].used, + &zero, + sizeof(zero))) { + retcode = -EFAULT; + goto done; + } + address = virtual + dma->buflist[i]->offset; + if (copy_to_user(&request.list[i].address, + &address, + sizeof(address))) { + retcode = -EFAULT; + goto done; + } + } + } + done: + request.count = dma->buf_count; + DRM_DEBUG("%d buffers, retcode = %d\n", request.count, retcode); + + if (copy_to_user((drm_buf_map_t *)arg, &request, sizeof(request))) + return -EFAULT; + + return retcode; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c:1.4.2.1 --- /dev/null Mon Jun 4 12:41:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_cp.c Thu May 31 04:36:15 2001 @@ -0,0 +1,1381 @@ +/* radeon_cp.c -- CP support for Radeon -*- linux-c -*- + * + * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#define __NO_VERSION__ +#include "radeon.h" +#include "drmP.h" +#include "radeon_drv.h" + +#include <linux/interrupt.h> /* For task queue support */ +#include <linux/delay.h> + +#define RADEON_FIFO_DEBUG 0 + +#if defined(__alpha__) +# define PCIGART_ENABLED +#else +# undef PCIGART_ENABLED +#endif + + +/* CP microcode (from ATI) */ +static u32 radeon_cp_microcode[][2] = { + { 0x21007000, 0000000000 }, + { 0x20007000, 0000000000 }, + { 0x000000b4, 0x00000004 }, + { 0x000000b8, 0x00000004 }, + { 0x6f5b4d4c, 0000000000 }, + { 0x4c4c427f, 0000000000 }, + { 0x5b568a92, 0000000000 }, + { 0x4ca09c6d, 0000000000 }, + { 0xad4c4c4c, 0000000000 }, + { 0x4ce1af3d, 0000000000 }, + { 0xd8afafaf, 0000000000 }, + { 0xd64c4cdc, 0000000000 }, + { 0x4cd10d10, 0000000000 }, + { 0x000f0000, 0x00000016 }, + { 0x362f242d, 0000000000 }, + { 0x00000012, 0x00000004 }, + { 0x000f0000, 0x00000016 }, + { 0x362f282d, 0000000000 }, + { 0x000380e7, 0x00000002 }, + { 0x04002c97, 0x00000002 }, + { 0x000f0001, 0x00000016 }, + { 0x333a3730, 0000000000 }, + { 0x000077ef, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x00000021, 0x0000001a }, + { 0x00004000, 0x0000001e }, + { 0x00061000, 0x00000002 }, + { 0x00000021, 0x0000001a }, + { 0x00004000, 0x0000001e }, + { 0x00061000, 0x00000002 }, + { 0x00000021, 0x0000001a }, + { 0x00004000, 0x0000001e }, + { 0x00000017, 0x00000004 }, + { 0x0003802b, 0x00000002 }, + { 0x040067e0, 0x00000002 }, + { 0x00000017, 0x00000004 }, + { 0x000077e0, 0x00000002 }, + { 0x00065000, 0x00000002 }, + { 0x000037e1, 0x00000002 }, + { 0x040067e1, 0x00000006 }, + { 0x000077e0, 0x00000002 }, + { 0x000077e1, 0x00000002 }, + { 0x000077e1, 0x00000006 }, + { 0xffffffff, 0000000000 }, + { 0x10000000, 0000000000 }, + { 0x0003802b, 0x00000002 }, + { 0x040067e0, 0x00000006 }, + { 0x00007675, 0x00000002 }, + { 0x00007676, 0x00000002 }, + { 0x00007677, 0x00000002 }, + { 0x00007678, 0x00000006 }, + { 0x0003802c, 0x00000002 }, + { 0x04002676, 0x00000002 }, + { 0x00007677, 0x00000002 }, + { 0x00007678, 0x00000006 }, + { 0x0000002f, 0x00000018 }, + { 0x0000002f, 0x00000018 }, + { 0000000000, 0x00000006 }, + { 0x00000030, 0x00000018 }, + { 0x00000030, 0x00000018 }, + { 0000000000, 0x00000006 }, + { 0x01605000, 0x00000002 }, + { 0x00065000, 0x00000002 }, + { 0x00098000, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x64c0603e, 0x00000004 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00080000, 0x00000016 }, + { 0000000000, 0000000000 }, + { 0x0400251d, 0x00000002 }, + { 0x00007580, 0x00000002 }, + { 0x00067581, 0x00000002 }, + { 0x04002580, 0x00000002 }, + { 0x00067581, 0x00000002 }, + { 0x00000049, 0x00000004 }, + { 0x00005000, 0000000000 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x0000750e, 0x00000002 }, + { 0x00019000, 0x00000002 }, + { 0x00011055, 0x00000014 }, + { 0x00000055, 0x00000012 }, + { 0x0400250f, 0x00000002 }, + { 0x0000504f, 0x00000004 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00007565, 0x00000002 }, + { 0x00007566, 0x00000002 }, + { 0x00000058, 0x00000004 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x01e655b4, 0x00000002 }, + { 0x4401b0e4, 0x00000002 }, + { 0x01c110e4, 0x00000002 }, + { 0x26667066, 0x00000018 }, + { 0x040c2565, 0x00000002 }, + { 0x00000066, 0x00000018 }, + { 0x04002564, 0x00000002 }, + { 0x00007566, 0x00000002 }, + { 0x0000005d, 0x00000004 }, + { 0x00401069, 0x00000008 }, + { 0x00101000, 0x00000002 }, + { 0x000d80ff, 0x00000002 }, + { 0x0080006c, 0x00000008 }, + { 0x000f9000, 0x00000002 }, + { 0x000e00ff, 0x00000002 }, + { 0000000000, 0x00000006 }, + { 0x0000008f, 0x00000018 }, + { 0x0000005b, 0x00000004 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00007576, 0x00000002 }, + { 0x00065000, 0x00000002 }, + { 0x00009000, 0x00000002 }, + { 0x00041000, 0x00000002 }, + { 0x0c00350e, 0x00000002 }, + { 0x00049000, 0x00000002 }, + { 0x00051000, 0x00000002 }, + { 0x01e785f8, 0x00000002 }, + { 0x00200000, 0x00000002 }, + { 0x0060007e, 0x0000000c }, + { 0x00007563, 0x00000002 }, + { 0x006075f0, 0x00000021 }, + { 0x20007073, 0x00000004 }, + { 0x00005073, 0x00000004 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00007576, 0x00000002 }, + { 0x00007577, 0x00000002 }, + { 0x0000750e, 0x00000002 }, + { 0x0000750f, 0x00000002 }, + { 0x00a05000, 0x00000002 }, + { 0x00600083, 0x0000000c }, + { 0x006075f0, 0x00000021 }, + { 0x000075f8, 0x00000002 }, + { 0x00000083, 0x00000004 }, + { 0x000a750e, 0x00000002 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x0020750f, 0x00000002 }, + { 0x00600086, 0x00000004 }, + { 0x00007570, 0x00000002 }, + { 0x00007571, 0x00000002 }, + { 0x00007572, 0x00000006 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00005000, 0x00000002 }, + { 0x00a05000, 0x00000002 }, + { 0x00007568, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x00000095, 0x0000000c }, + { 0x00058000, 0x00000002 }, + { 0x0c607562, 0x00000002 }, + { 0x00000097, 0x00000004 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x00600096, 0x00000004 }, + { 0x400070e5, 0000000000 }, + { 0x000380e6, 0x00000002 }, + { 0x040025c5, 0x00000002 }, + { 0x000380e5, 0x00000002 }, + { 0x000000a8, 0x0000001c }, + { 0x000650aa, 0x00000018 }, + { 0x040025bb, 0x00000002 }, + { 0x000610ab, 0x00000018 }, + { 0x040075bc, 0000000000 }, + { 0x000075bb, 0x00000002 }, + { 0x000075bc, 0000000000 }, + { 0x00090000, 0x00000006 }, + { 0x00090000, 0x00000002 }, + { 0x000d8002, 0x00000006 }, + { 0x00007832, 0x00000002 }, + { 0x00005000, 0x00000002 }, + { 0x000380e7, 0x00000002 }, + { 0x04002c97, 0x00000002 }, + { 0x00007820, 0x00000002 }, + { 0x00007821, 0x00000002 }, + { 0x00007800, 0000000000 }, + { 0x01200000, 0x00000002 }, + { 0x20077000, 0x00000002 }, + { 0x01200000, 0x00000002 }, + { 0x20007000, 0x00000002 }, + { 0x00061000, 0x00000002 }, + { 0x0120751b, 0x00000002 }, + { 0x8040750a, 0x00000002 }, + { 0x8040750b, 0x00000002 }, + { 0x00110000, 0x00000002 }, + { 0x000380e5, 0x00000002 }, + { 0x000000c6, 0x0000001c }, + { 0x000610ab, 0x00000018 }, + { 0x844075bd, 0x00000002 }, + { 0x000610aa, 0x00000018 }, + { 0x840075bb, 0x00000002 }, + { 0x000610ab, 0x00000018 }, + { 0x844075bc, 0x00000002 }, + { 0x000000c9, 0x00000004 }, + { 0x804075bd, 0x00000002 }, + { 0x800075bb, 0x00000002 }, + { 0x804075bc, 0x00000002 }, + { 0x00108000, 0x00000002 }, + { 0x01400000, 0x00000002 }, + { 0x006000cd, 0x0000000c }, + { 0x20c07000, 0x00000020 }, + { 0x000000cf, 0x00000012 }, + { 0x00800000, 0x00000006 }, + { 0x0080751d, 0x00000006 }, + { 0000000000, 0000000000 }, + { 0x0000775c, 0x00000002 }, + { 0x00a05000, 0x00000002 }, + { 0x00661000, 0x00000002 }, + { 0x0460275d, 0x00000020 }, + { 0x00004000, 0000000000 }, + { 0x01e00830, 0x00000002 }, + { 0x21007000, 0000000000 }, + { 0x6464614d, 0000000000 }, + { 0x69687420, 0000000000 }, + { 0x00000073, 0000000000 }, + { 0000000000, 0000000000 }, + { 0x00005000, 0x00000002 }, + { 0x000380d0, 0x00000002 }, + { 0x040025e0, 0x00000002 }, + { 0x000075e1, 0000000000 }, + { 0x00000001, 0000000000 }, + { 0x000380e0, 0x00000002 }, + { 0x04002394, 0x00000002 }, + { 0x00005000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0x00000008, 0000000000 }, + { 0x00000004, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, + { 0000000000, 0000000000 }, +}; + + +int RADEON_READ_PLL(drm_device_t *dev, int addr) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + + RADEON_WRITE8(RADEON_CLOCK_CNTL_INDEX, addr & 0x1f); + return RADEON_READ(RADEON_CLOCK_CNTL_DATA); +} + +#if RADEON_FIFO_DEBUG +static void radeon_status( drm_radeon_private_t *dev_priv ) +{ + printk( "%s:\n", __FUNCTION__ ); + printk( "RBBM_STATUS = 0x%08x\n", + (unsigned int)RADEON_READ( RADEON_RBBM_STATUS ) ); + printk( "CP_RB_RTPR = 0x%08x\n", + (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 + + +/* ================================================================ + * Engine, FIFO control + */ + +static int radeon_do_pixcache_flush( drm_radeon_private_t *dev_priv ) +{ + u32 tmp; + int i; + + tmp = RADEON_READ( RADEON_RB2D_DSTCACHE_CTLSTAT ); + tmp |= RADEON_RB2D_DC_FLUSH_ALL; + RADEON_WRITE( RADEON_RB2D_DSTCACHE_CTLSTAT, tmp ); + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + if ( !(RADEON_READ( RADEON_RB2D_DSTCACHE_CTLSTAT ) + & RADEON_RB2D_DC_BUSY) ) { + return 0; + } + udelay( 1 ); + } + +#if RADEON_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); + radeon_status( dev_priv ); +#endif + return -EBUSY; +} + +static int radeon_do_wait_for_fifo( drm_radeon_private_t *dev_priv, + int entries ) +{ + int i; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + int slots = ( RADEON_READ( RADEON_RBBM_STATUS ) + & RADEON_RBBM_FIFOCNT_MASK ); + if ( slots >= entries ) return 0; + udelay( 1 ); + } + +#if RADEON_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); + radeon_status( dev_priv ); +#endif + return -EBUSY; +} + +static int radeon_do_wait_for_idle( drm_radeon_private_t *dev_priv ) +{ + int i, ret; + + ret = radeon_do_wait_for_fifo( dev_priv, 64 ); + if ( ret < 0 ) return ret; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + if ( !(RADEON_READ( RADEON_RBBM_STATUS ) + & RADEON_RBBM_ACTIVE) ) { + radeon_do_pixcache_flush( dev_priv ); + return 0; + } + udelay( 1 ); + } + +#if RADEON_FIFO_DEBUG + DRM_ERROR( "failed!\n" ); + radeon_status( dev_priv ); +#endif + return -EBUSY; +} + + +/* ================================================================ + * CP control, initialization + */ + +/* Load the microcode for the CP */ +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 ); + + RADEON_WRITE( RADEON_CP_ME_RAM_ADDR, 0 ); + for ( i = 0 ; i < 256 ; i++ ) { + RADEON_WRITE( RADEON_CP_ME_RAM_DATAH, + radeon_cp_microcode[i][1] ); + RADEON_WRITE( RADEON_CP_ME_RAM_DATAL, + radeon_cp_microcode[i][0] ); + } +} + +/* Flush any pending commands to the CP. This should only be used just + * prior to a wait for idle, as it informs the engine that the command + * stream is ending. + */ +static void radeon_do_cp_flush( drm_radeon_private_t *dev_priv ) +{ + DRM_DEBUG( "%s\n", __FUNCTION__ ); +#if 0 + u32 tmp; + + tmp = RADEON_READ( RADEON_CP_RB_WPTR ) | (1 << 31); + RADEON_WRITE( RADEON_CP_RB_WPTR, tmp ); +#endif +} + +/* Wait for the CP to go idle. + */ +int radeon_do_cp_idle( drm_radeon_private_t *dev_priv ) +{ + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + BEGIN_RING( 6 ); + + RADEON_PURGE_CACHE(); + RADEON_PURGE_ZCACHE(); + RADEON_WAIT_UNTIL_IDLE(); + + ADVANCE_RING(); + + return radeon_do_wait_for_idle( dev_priv ); +} + +/* Start the Command Processor. + */ +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 ); + + RADEON_WRITE( RADEON_CP_CSQ_CNTL, dev_priv->cp_mode ); + + dev_priv->cp_running = 1; + + BEGIN_RING( 6 ); + + RADEON_PURGE_CACHE(); + RADEON_PURGE_ZCACHE(); + RADEON_WAIT_UNTIL_IDLE(); + + ADVANCE_RING(); +} + +/* Reset the Command Processor. This will not flush any pending + * commands, so you must wait for the CP command stream to complete + * before calling this routine. + */ +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 ); + *dev_priv->ring.head = cur_read_ptr; + dev_priv->ring.tail = cur_read_ptr; +} + +/* Stop the Command Processor. This will not flush any pending + * commands, so you must flush the command stream and wait for the CP + * to go idle before calling this routine. + */ +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; +} + +/* Reset the engine. This will stop the CP if it is running. + */ +static int radeon_do_engine_reset( drm_device_t *dev ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + u32 clock_cntl_index, mclk_cntl, rbbm_soft_reset; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + radeon_do_pixcache_flush( dev_priv ); + + clock_cntl_index = RADEON_READ( RADEON_CLOCK_CNTL_INDEX ); + mclk_cntl = RADEON_READ_PLL( dev, RADEON_MCLK_CNTL ); + + RADEON_WRITE_PLL( RADEON_MCLK_CNTL, ( mclk_cntl | + RADEON_FORCEON_MCLKA | + RADEON_FORCEON_MCLKB | + RADEON_FORCEON_YCLKA | + RADEON_FORCEON_YCLKB | + RADEON_FORCEON_MC | + RADEON_FORCEON_AIC ) ); + + rbbm_soft_reset = RADEON_READ( RADEON_RBBM_SOFT_RESET ); + + RADEON_WRITE( RADEON_RBBM_SOFT_RESET, ( rbbm_soft_reset | + RADEON_SOFT_RESET_CP | + RADEON_SOFT_RESET_HI | + RADEON_SOFT_RESET_SE | + RADEON_SOFT_RESET_RE | + RADEON_SOFT_RESET_PP | + RADEON_SOFT_RESET_E2 | + RADEON_SOFT_RESET_RB | + RADEON_SOFT_RESET_HDP ) ); + RADEON_READ( RADEON_RBBM_SOFT_RESET ); + RADEON_WRITE( RADEON_RBBM_SOFT_RESET, ( rbbm_soft_reset & + ~( RADEON_SOFT_RESET_CP | + RADEON_SOFT_RESET_HI | + RADEON_SOFT_RESET_SE | + RADEON_SOFT_RESET_RE | + RADEON_SOFT_RESET_PP | + RADEON_SOFT_RESET_E2 | + RADEON_SOFT_RESET_RB | + RADEON_SOFT_RESET_HDP ) ) ); + RADEON_READ( RADEON_RBBM_SOFT_RESET ); + + + RADEON_WRITE_PLL( RADEON_MCLK_CNTL, mclk_cntl ); + RADEON_WRITE( RADEON_CLOCK_CNTL_INDEX, clock_cntl_index ); + RADEON_WRITE( RADEON_RBBM_SOFT_RESET, rbbm_soft_reset ); + + /* Reset the CP ring */ + radeon_do_cp_reset( dev_priv ); + + /* The CP is no longer running after an engine reset */ + dev_priv->cp_running = 0; + + /* Reset any pending vertex, indirect buffers */ + radeon_freelist_reset( dev ); + + return 0; +} + +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 ); + + 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 ); + + /* Set the write pointer delay */ + RADEON_WRITE( RADEON_CP_RB_WPTR_DELAY, 0 ); + + /* Initialize the ring buffer's read and write pointers */ + cur_read_ptr = RADEON_READ( RADEON_CP_RB_RPTR ); + RADEON_WRITE( RADEON_CP_RB_WPTR, cur_read_ptr ); + *dev_priv->ring.head = cur_read_ptr; + dev_priv->ring.tail = cur_read_ptr; + + 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 on bus mastering */ + tmp = RADEON_READ( RADEON_BUS_CNTL ) & ~RADEON_BUS_MASTER_DIS; + RADEON_WRITE( RADEON_BUS_CNTL, tmp ); + + /* Sync everything up */ + RADEON_WRITE( RADEON_ISYNC_CNTL, + (RADEON_ISYNC_ANY2D_IDLE3D | + RADEON_ISYNC_ANY3D_IDLE2D | + RADEON_ISYNC_WAIT_IDLEGUI | + RADEON_ISYNC_CPSCRATCH_IDLEGUI) ); +} + +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 ) + return -ENOMEM; + dev->dev_private = (void *)dev_priv; + + memset( dev_priv, 0, sizeof(drm_radeon_private_t) ); + + dev_priv->is_pci = init->is_pci; + +#if !defined(PCIGART_ENABLED) + /* 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_ERROR( "PCI GART memory not allocated!\n" ); + DRM(free)( dev_priv, sizeof(*dev_priv), DRM_MEM_DRIVER ); + dev->dev_private = NULL; + return -EINVAL; + } + + 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; + } + + dev_priv->cp_mode = init->cp_mode; + + /* Simple idle check. + */ + atomic_set( &dev_priv->idle_count, 0 ); + + /* We don't support anything other than bus-mastering ring mode, + * but the ring can be in either AGP or PCI space for the ring + * read pointer. + */ + 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; + } + + switch ( init->fb_bpp ) { + case 16: + dev_priv->color_fmt = RADEON_COLOR_FORMAT_RGB565; + break; + case 32: + default: + dev_priv->color_fmt = RADEON_COLOR_FORMAT_ARGB8888; + break; + } + dev_priv->front_offset = init->front_offset; + dev_priv->front_pitch = init->front_pitch; + dev_priv->back_offset = init->back_offset; + dev_priv->back_pitch = init->back_pitch; + + switch ( init->depth_bpp ) { + case 16: + dev_priv->depth_fmt = RADEON_DEPTH_FORMAT_16BIT_INT_Z; + break; + case 32: + default: + dev_priv->depth_fmt = RADEON_DEPTH_FORMAT_24BIT_INT_Z; + break; + } + dev_priv->depth_offset = init->depth_offset; + dev_priv->depth_pitch = init->depth_pitch; + + dev_priv->front_pitch_offset = (((dev_priv->front_pitch/64) << 22) | + (dev_priv->front_offset >> 10)); + dev_priv->back_pitch_offset = (((dev_priv->back_pitch/64) << 22) | + (dev_priv->back_offset >> 10)); + dev_priv->depth_pitch_offset = (((dev_priv->depth_pitch/64) << 22) | + (dev_priv->depth_offset >> 10)); + + /* Hardware state for depth clears. Remove this if/when we no + * longer clear the depth buffer with a 3D rectangle. Hard-code + * all values to prevent unwanted 3D state from slipping through + * and screwing with the clear operation. + */ + dev_priv->depth_clear.rb3d_cntl = (RADEON_PLANE_MASK_ENABLE | + RADEON_Z_ENABLE | + (dev_priv->color_fmt << 10) | + RADEON_ZBLOCK16); + + dev_priv->depth_clear.rb3d_zstencilcntl = (dev_priv->depth_fmt | + RADEON_Z_TEST_ALWAYS | + RADEON_STENCIL_TEST_ALWAYS | + RADEON_STENCIL_S_FAIL_KEEP | + RADEON_STENCIL_ZPASS_KEEP | + RADEON_STENCIL_ZFAIL_KEEP | + RADEON_Z_WRITE_ENABLE); + + dev_priv->depth_clear.se_cntl = (RADEON_FFACE_CULL_CW | + RADEON_BFACE_SOLID | + RADEON_FFACE_SOLID | + RADEON_FLAT_SHADE_VTX_LAST | + RADEON_DIFFUSE_SHADE_FLAT | + RADEON_ALPHA_SHADE_FLAT | + RADEON_SPECULAR_SHADE_FLAT | + RADEON_FOG_SHADE_FLAT | + RADEON_VTX_PIX_CENTER_OGL | + RADEON_ROUND_MODE_TRUNC | + RADEON_ROUND_PREC_8TH_PIX); + + list_for_each(list, &dev->maplist->head) { + drm_map_list_t *r_list = (drm_map_list_t *)list; + if( r_list->map && + r_list->map->type == _DRM_SHM && + r_list->map->flags & _DRM_CONTAINS_LOCK ) { + dev_priv->sarea = r_list->map; + break; + } + } + + DRM_FIND_MAP( dev_priv->fb, init->fb_offset ); + DRM_FIND_MAP( dev_priv->mmio, init->mmio_offset ); + DRM_FIND_MAP( dev_priv->cp_ring, init->ring_offset ); + DRM_FIND_MAP( dev_priv->ring_rptr, init->ring_rptr_offset ); + DRM_FIND_MAP( dev_priv->buffers, init->buffers_offset ); + + if ( !dev_priv->is_pci ) { + DRM_FIND_MAP( dev_priv->agp_textures, + init->agp_textures_offset ); + } + + dev_priv->sarea_priv = + (drm_radeon_sarea_t *)((u8 *)dev_priv->sarea->handle + + init->sarea_priv_offset); + + 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 ); +#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); + + dev_priv->ring.start = (u32 *)dev_priv->cp_ring->handle; + dev_priv->ring.end = ((u32 *)dev_priv->cp_ring->handle + + init->ring_size / sizeof(u32)); + dev_priv->ring.size = init->ring_size; + dev_priv->ring.size_l2qw = DRM(order)( init->ring_size / 8 ); + + dev_priv->ring.tail_mask = + (dev_priv->ring.size / sizeof(u32)) - 1; + + dev_priv->ring.high_mark = RADEON_RING_HIGH_MARK; + +#if 0 + /* Initialize the scratch register pointer. This will cause + * the scratch register values to be written out to memory + * whenever they are updated. + * FIXME: This doesn't quite work yet, so we're disabling it + * for the release. + */ + RADEON_WRITE( RADEON_SCRATCH_ADDR, (dev_priv->ring_rptr->offset + + RADEON_SCRATCH_REG_OFFSET) ); + RADEON_WRITE( RADEON_SCRATCH_UMSK, 0x7 ); +#endif + + dev_priv->scratch = ((__volatile__ u32 *) + dev_priv->ring_rptr->handle + + (RADEON_SCRATCH_REG_OFFSET / sizeof(u32))); + + dev_priv->sarea_priv->last_frame = 0; + RADEON_WRITE( RADEON_LAST_FRAME_REG, + dev_priv->sarea_priv->last_frame ); + + dev_priv->sarea_priv->last_dispatch = 0; + RADEON_WRITE( RADEON_LAST_DISPATCH_REG, + dev_priv->sarea_priv->last_dispatch ); + + dev_priv->sarea_priv->last_clear = 0; + 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_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, 0xffffffc0 ); /* ?? */ + RADEON_WRITE( RADEON_AGP_COMMAND, 0 ); /* clear AGP_COMMAND */ + } 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 ); + +#if ROTATE_BUFS + dev_priv->last_buf = 0; +#endif + + return 0; +} + +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; + + 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 ); + dev->dev_private = NULL; + } + + return 0; +} + +int radeon_cp_init( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_init_t init; + + if ( copy_from_user( &init, (drm_radeon_init_t *)arg, sizeof(init) ) ) + return -EFAULT; + + switch ( init.func ) { + case RADEON_INIT_CP: + return radeon_do_init_cp( dev, &init ); + case RADEON_CLEANUP_CP: + return radeon_do_cleanup_cp( dev ); + } + + return -EINVAL; +} + +int radeon_cp_start( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); + + if ( dev_priv->cp_running ) { + DRM_DEBUG( "%s while CP running\n", __FUNCTION__ ); + return 0; + } + if ( dev_priv->cp_mode == RADEON_CSQ_PRIDIS_INDDIS ) { + DRM_DEBUG( "%s called with bogus CP mode (%d)\n", + __FUNCTION__, dev_priv->cp_mode ); + return 0; + } + + radeon_do_cp_start( dev_priv ); + + return 0; +} + +/* Stop the CP. The engine must have been idled before calling this + * routine. + */ +int radeon_cp_stop( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_cp_stop_t stop; + int ret; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); + + if ( copy_from_user( &stop, (drm_radeon_init_t *)arg, sizeof(stop) ) ) + return -EFAULT; + + /* Flush any pending CP commands. This ensures any outstanding + * commands are exectuted by the engine before we turn it off. + */ + if ( stop.flush ) { + radeon_do_cp_flush( dev_priv ); + } + + /* If we fail to make the engine go idle, we return an error + * code so that the DRM ioctl wrapper can try again. + */ + if ( stop.idle ) { + ret = radeon_do_cp_idle( dev_priv ); + if ( ret < 0 ) return ret; + } + + /* Finally, we can turn off the CP. If the engine isn't idle, + * we will get some dropped triangles as they won't be fully + * rendered before the CP is shut down. + */ + radeon_do_cp_stop( dev_priv ); + + /* Reset the engine */ + radeon_do_engine_reset( dev ); + + return 0; +} + +/* Just reset the CP ring. Called as part of an X Server engine reset. + */ +int radeon_cp_reset( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_DEBUG( "%s called before init done\n", __FUNCTION__ ); + return -EINVAL; + } + + radeon_do_cp_reset( dev_priv ); + + /* The CP is no longer running after an engine reset */ + dev_priv->cp_running = 0; + + return 0; +} + +int radeon_cp_idle( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); + + return radeon_do_cp_idle( dev_priv ); +} + +int radeon_engine_reset( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); + + return radeon_do_engine_reset( dev ); +} + + +/* ================================================================ + * Fullscreen mode + */ + +static int radeon_do_init_pageflip( drm_device_t *dev ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + dev_priv->crtc_offset = RADEON_READ( RADEON_CRTC_OFFSET ); + dev_priv->crtc_offset_cntl = RADEON_READ( RADEON_CRTC_OFFSET_CNTL ); + + RADEON_WRITE( RADEON_CRTC_OFFSET, dev_priv->front_offset ); + RADEON_WRITE( RADEON_CRTC_OFFSET_CNTL, + dev_priv->crtc_offset_cntl | + RADEON_CRTC_OFFSET_FLIP_CNTL ); + + dev_priv->page_flipping = 1; + dev_priv->current_page = 0; + + return 0; +} + +int radeon_do_cleanup_pageflip( drm_device_t *dev ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + RADEON_WRITE( RADEON_CRTC_OFFSET, dev_priv->crtc_offset ); + RADEON_WRITE( RADEON_CRTC_OFFSET_CNTL, dev_priv->crtc_offset_cntl ); + + dev_priv->page_flipping = 0; + dev_priv->current_page = 0; + + return 0; +} + +int radeon_fullscreen( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_fullscreen_t fs; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( copy_from_user( &fs, (drm_radeon_fullscreen_t *)arg, + sizeof(fs) ) ) + return -EFAULT; + + switch ( fs.func ) { + case RADEON_INIT_FULLSCREEN: + return radeon_do_init_pageflip( dev ); + case RADEON_CLEANUP_FULLSCREEN: + return radeon_do_cleanup_pageflip( dev ); + } + + return -EINVAL; +} + + +/* ================================================================ + * Freelist management + */ +#define RADEON_BUFFER_USED 0xffffffff +#define RADEON_BUFFER_FREE 0 + +#if 0 +static int radeon_freelist_init( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_buf_t *buf; + drm_radeon_buf_priv_t *buf_priv; + drm_radeon_freelist_t *entry; + int i; + + dev_priv->head = DRM(alloc)( sizeof(drm_radeon_freelist_t), + DRM_MEM_DRIVER ); + if ( dev_priv->head == NULL ) + return -ENOMEM; + + memset( dev_priv->head, 0, sizeof(drm_radeon_freelist_t) ); + dev_priv->head->age = RADEON_BUFFER_USED; + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + + entry = DRM(alloc)( sizeof(drm_radeon_freelist_t), + DRM_MEM_DRIVER ); + if ( !entry ) return -ENOMEM; + + entry->age = RADEON_BUFFER_FREE; + entry->buf = buf; + entry->prev = dev_priv->head; + entry->next = dev_priv->head->next; + if ( !entry->next ) + dev_priv->tail = entry; + + buf_priv->discard = 0; + buf_priv->dispatched = 0; + buf_priv->list_entry = entry; + + dev_priv->head->next = entry; + + if ( dev_priv->head->next ) + dev_priv->head->next->prev = entry; + } + + return 0; + +} +#endif + +drm_buf_t *radeon_freelist_get( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_buf_priv_t *buf_priv; + drm_buf_t *buf; + int i, t; +#if ROTATE_BUFS + int start; +#endif + + /* FIXME: Optimize -- use freelist code */ + + for ( i = 0 ; i < dma->buf_count ; i++ ) { + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + if ( buf->pid == 0 ) { + DRM_DEBUG( " ret buf=%d last=%d pid=0\n", + buf->idx, dev_priv->last_buf ); + return buf; + } + DRM_DEBUG( " skipping buf=%d pid=%d\n", + buf->idx, buf->pid ); + } + +#if ROTATE_BUFS + if ( ++dev_priv->last_buf >= dma->buf_count ) + dev_priv->last_buf = 0; + start = dev_priv->last_buf; +#endif + for ( t = 0 ; t < dev_priv->usec_timeout ; t++ ) { +#if 0 + /* FIXME: Disable this for now */ + u32 done_age = dev_priv->scratch[RADEON_LAST_DISPATCH]; +#else + u32 done_age = RADEON_READ( RADEON_LAST_DISPATCH_REG ); +#endif +#if ROTATE_BUFS + for ( i = start ; i < dma->buf_count ; i++ ) { +#else + for ( i = 0 ; i < dma->buf_count ; i++ ) { +#endif + buf = dma->buflist[i]; + buf_priv = buf->dev_private; + if ( buf->pending && buf_priv->age <= done_age ) { + /* The buffer has been processed, so it + * can now be used. + */ + buf->pending = 0; + DRM_DEBUG( " ret buf=%d last=%d age=%d done=%d\n", buf->idx, dev_priv->last_buf, buf_priv->age, done_age ); + return buf; + } + DRM_DEBUG( " skipping buf=%d age=%d done=%d\n", + buf->idx, buf_priv->age, + done_age ); +#if ROTATE_BUFS + start = 0; +#endif + } + udelay( 1 ); + } + + DRM_ERROR( "returning NULL!\n" ); + return NULL; +} + +void radeon_freelist_reset( drm_device_t *dev ) +{ + drm_device_dma_t *dma = dev->dma; +#if ROTATE_BUFS + drm_radeon_private_t *dev_priv = dev->dev_private; +#endif + int i; + +#if ROTATE_BUFS + dev_priv->last_buf = 0; +#endif + for ( i = 0 ; i < dma->buf_count ; i++ ) { + drm_buf_t *buf = dma->buflist[i]; + drm_radeon_buf_priv_t *buf_priv = buf->dev_private; + buf_priv->age = 0; + } +} + + +/* ================================================================ + * CP command submission + */ + +int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ) +{ + drm_radeon_ring_buffer_t *ring = &dev_priv->ring; + int i; + + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { + radeon_update_ring_snapshot( ring ); + if ( ring->space > n ) + return 0; + udelay( 1 ); + } + + /* 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; +} + +static int radeon_cp_get_buffers( drm_device_t *dev, drm_dma_t *d ) +{ + int i; + drm_buf_t *buf; + + for ( i = d->granted_count ; i < d->request_count ; i++ ) { + buf = radeon_freelist_get( dev ); + if ( !buf ) return -EAGAIN; + + buf->pid = current->pid; + + if ( copy_to_user( &d->request_indices[i], &buf->idx, + sizeof(buf->idx) ) ) + return -EFAULT; + if ( copy_to_user( &d->request_sizes[i], &buf->total, + sizeof(buf->total) ) ) + return -EFAULT; + + d->granted_count++; + } + return 0; +} + +int radeon_cp_buffers( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_device_dma_t *dma = dev->dma; + int ret = 0; + drm_dma_t d; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( copy_from_user( &d, (drm_dma_t *)arg, sizeof(d) ) ) + return -EFAULT; + + /* Please don't send us buffers. + */ + if ( d.send_count != 0 ) { + DRM_ERROR( "Process %d trying to send %d buffers via drmDMA\n", + current->pid, d.send_count ); + return -EINVAL; + } + + /* We'll send you buffers. + */ + if ( d.request_count < 0 || d.request_count > dma->buf_count ) { + DRM_ERROR( "Process %d trying to get %d buffers (of %d max)\n", + current->pid, d.request_count, dma->buf_count ); + return -EINVAL; + } + + d.granted_count = 0; + + if ( d.request_count ) { + ret = radeon_cp_get_buffers( dev, &d ); + } + + if ( copy_to_user( (drm_dma_t *)arg, &d, sizeof(d) ) ) + return -EFAULT; + + return ret; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h:1.3 --- /dev/null Mon Jun 4 12:41:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drm.h Tue Apr 10 12:08:05 2001 @@ -0,0 +1,333 @@ +/* radeon_drm.h -- Public header for the radeon driver -*- linux-c -*- + * + * Copyright 2000 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __RADEON_DRM_H__ +#define __RADEON_DRM_H__ + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the X server file (radeon_sarea.h) + */ +#ifndef __RADEON_SAREA_DEFINES__ +#define __RADEON_SAREA_DEFINES__ + +/* What needs to be changed for the current vertex buffer? + */ +#define RADEON_UPLOAD_CONTEXT 0x00000001 +#define RADEON_UPLOAD_VERTFMT 0x00000002 +#define RADEON_UPLOAD_LINE 0x00000004 +#define RADEON_UPLOAD_BUMPMAP 0x00000008 +#define RADEON_UPLOAD_MASKS 0x00000010 +#define RADEON_UPLOAD_VIEWPORT 0x00000020 +#define RADEON_UPLOAD_SETUP 0x00000040 +#define RADEON_UPLOAD_TCL 0x00000080 +#define RADEON_UPLOAD_MISC 0x00000100 +#define RADEON_UPLOAD_TEX0 0x00000200 +#define RADEON_UPLOAD_TEX1 0x00000400 +#define RADEON_UPLOAD_TEX2 0x00000800 +#define RADEON_UPLOAD_TEX0IMAGES 0x00001000 +#define RADEON_UPLOAD_TEX1IMAGES 0x00002000 +#define RADEON_UPLOAD_TEX2IMAGES 0x00004000 +#define RADEON_UPLOAD_CLIPRECTS 0x00008000 /* handled client-side */ +#define RADEON_REQUIRE_QUIESCENCE 0x00010000 +#define RADEON_UPLOAD_ALL 0x0001ffff + +#define RADEON_FRONT 0x1 +#define RADEON_BACK 0x2 +#define RADEON_DEPTH 0x4 + +/* Primitive types + */ +#define RADEON_POINTS 0x1 +#define RADEON_LINES 0x2 +#define RADEON_LINE_STRIP 0x3 +#define RADEON_TRIANGLES 0x4 +#define RADEON_TRIANGLE_FAN 0x5 +#define RADEON_TRIANGLE_STRIP 0x6 + +/* Vertex/indirect buffer size + */ +#define RADEON_BUFFER_SIZE 65536 + +/* Byte offsets for indirect buffer data + */ +#define RADEON_INDEX_PRIM_OFFSET 20 +#define RADEON_HOSTDATA_BLIT_OFFSET 32 + +#define RADEON_SCRATCH_REG_OFFSET 32 + +/* Keep these small for testing + */ +#define RADEON_NR_SAREA_CLIPRECTS 12 + +/* There are 2 heaps (local/AGP). Each region within a heap is a + * minimum of 64k, and there are at most 64 of them per heap. + */ +#define RADEON_LOCAL_TEX_HEAP 0 +#define RADEON_AGP_TEX_HEAP 1 +#define RADEON_NR_TEX_HEAPS 2 +#define RADEON_NR_TEX_REGIONS 64 +#define RADEON_LOG_TEX_GRANULARITY 16 + +#define RADEON_MAX_TEXTURE_LEVELS 11 +#define RADEON_MAX_TEXTURE_UNITS 3 + +#endif /* __RADEON_SAREA_DEFINES__ */ + +typedef struct { + unsigned int red; + unsigned int green; + unsigned int blue; + unsigned int alpha; +} radeon_color_regs_t; + +typedef struct { + /* Context state */ + unsigned int pp_misc; /* 0x1c14 */ + unsigned int pp_fog_color; + unsigned int re_solid_color; + unsigned int rb3d_blendcntl; + unsigned int rb3d_depthoffset; + unsigned int rb3d_depthpitch; + unsigned int rb3d_zstencilcntl; + + unsigned int pp_cntl; /* 0x1c38 */ + unsigned int rb3d_cntl; + unsigned int rb3d_coloroffset; + unsigned int re_width_height; + unsigned int rb3d_colorpitch; + unsigned int se_cntl; + + /* Vertex format state */ + unsigned int se_coord_fmt; /* 0x1c50 */ + + /* Line state */ + unsigned int re_line_pattern; /* 0x1cd0 */ + unsigned int re_line_state; + + unsigned int se_line_width; /* 0x1db8 */ + + /* Bumpmap state */ + unsigned int pp_lum_matrix; /* 0x1d00 */ + + unsigned int pp_rot_matrix_0; /* 0x1d58 */ + unsigned int pp_rot_matrix_1; + + /* Mask state */ + unsigned int rb3d_stencilrefmask; /* 0x1d7c */ + unsigned int rb3d_ropcntl; + unsigned int rb3d_planemask; + + /* Viewport state */ + unsigned int se_vport_xscale; /* 0x1d98 */ + unsigned int se_vport_xoffset; + unsigned int se_vport_yscale; + unsigned int se_vport_yoffset; + unsigned int se_vport_zscale; + unsigned int se_vport_zoffset; + + /* Setup state */ + unsigned int se_cntl_status; /* 0x2140 */ + +#ifdef TCL_ENABLE + /* TCL state */ + radeon_color_regs_t se_tcl_material_emmissive; /* 0x2210 */ + radeon_color_regs_t se_tcl_material_ambient; + radeon_color_regs_t se_tcl_material_diffuse; + radeon_color_regs_t se_tcl_material_specular; + unsigned int se_tcl_shininess; + unsigned int se_tcl_output_vtx_fmt; + unsigned int se_tcl_output_vtx_sel; + unsigned int se_tcl_matrix_select_0; + unsigned int se_tcl_matrix_select_1; + unsigned int se_tcl_ucp_vert_blend_ctl; + unsigned int se_tcl_texture_proc_ctl; + unsigned int se_tcl_light_model_ctl; + unsigned int se_tcl_per_light_ctl[4]; +#endif + + /* Misc state */ + unsigned int re_top_left; /* 0x26c0 */ + unsigned int re_misc; +} drm_radeon_context_regs_t; + +/* Setup registers for each texture unit + */ +typedef struct { + unsigned int pp_txfilter; + unsigned int pp_txformat; + unsigned int pp_txoffset; + unsigned int pp_txcblend; + unsigned int pp_txablend; + unsigned int pp_tfactor; + + unsigned int pp_border_color; + +#ifdef CUBIC_ENABLE + unsigned int pp_cubic_faces; + unsigned int pp_cubic_offset[5]; +#endif +} drm_radeon_texture_regs_t; + +typedef struct { + unsigned char next, prev; + unsigned char in_use; + int age; +} drm_radeon_tex_region_t; + +typedef struct { + /* The channel for communication of state information to the kernel + * on firing a vertex buffer. + */ + drm_radeon_context_regs_t context_state; + drm_radeon_texture_regs_t tex_state[RADEON_MAX_TEXTURE_UNITS]; + unsigned int dirty; + unsigned int vertsize; + unsigned int vc_format; + + /* The current cliprects, or a subset thereof. + */ + drm_clip_rect_t boxes[RADEON_NR_SAREA_CLIPRECTS]; + unsigned int nbox; + + /* Counters for client-side throttling of rendering clients. + */ + unsigned int last_frame; + unsigned int last_dispatch; + unsigned int last_clear; + + drm_radeon_tex_region_t tex_list[RADEON_NR_TEX_HEAPS][RADEON_NR_TEX_REGIONS+1]; + int tex_age[RADEON_NR_TEX_HEAPS]; + int ctx_owner; +} drm_radeon_sarea_t; + + +/* WARNING: If you change any of these defines, make sure to change the + * defines in the Xserver file (xf86drmRadeon.h) + */ +typedef struct drm_radeon_init { + enum { + RADEON_INIT_CP = 0x01, + RADEON_CLEANUP_CP = 0x02 + } func; + unsigned long sarea_priv_offset; + int is_pci; + int cp_mode; + int agp_size; + int ring_size; + int usec_timeout; + + unsigned int fb_bpp; + unsigned int front_offset, front_pitch; + unsigned int back_offset, back_pitch; + unsigned int depth_bpp; + unsigned int depth_offset, depth_pitch; + + unsigned 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 { + int flush; + int idle; +} drm_radeon_cp_stop_t; + +typedef struct drm_radeon_fullscreen { + enum { + RADEON_INIT_FULLSCREEN = 0x01, + RADEON_CLEANUP_FULLSCREEN = 0x02 + } func; +} drm_radeon_fullscreen_t; + +#define CLEAR_X1 0 +#define CLEAR_Y1 1 +#define CLEAR_X2 2 +#define CLEAR_Y2 3 +#define CLEAR_DEPTH 4 + +typedef union drm_radeon_clear_rect { + float f[5]; + unsigned int ui[5]; +} drm_radeon_clear_rect_t; + +typedef struct drm_radeon_clear { + unsigned int flags; + unsigned int clear_color; + unsigned int clear_depth; + unsigned int color_mask; + unsigned int depth_mask; + drm_radeon_clear_rect_t *depth_boxes; +} drm_radeon_clear_t; + +typedef struct drm_radeon_vertex { + int prim; + int idx; /* Index of vertex buffer */ + int count; /* Number of vertices in buffer */ + int discard; /* Client finished with buffer? */ +} drm_radeon_vertex_t; + +typedef struct drm_radeon_indices { + int prim; + int idx; + int start; + int end; + int discard; /* Client finished with buffer? */ +} drm_radeon_indices_t; + +typedef struct drm_radeon_tex_image { + unsigned int x, y; /* Blit coordinates */ + unsigned int width, height; + const void *data; +} drm_radeon_tex_image_t; + +typedef struct drm_radeon_texture { + int offset; + int pitch; + int format; + int width; /* Texture image coordinates */ + int height; + drm_radeon_tex_image_t *image; +} drm_radeon_texture_t; + +typedef struct drm_radeon_stipple { + unsigned int *mask; +} drm_radeon_stipple_t; + +typedef struct drm_radeon_indirect { + int idx; + int start; + int end; + int discard; +} drm_radeon_indirect_t; + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c:1.3 --- /dev/null Mon Jun 4 12:41:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.c Tue Apr 10 12:08:05 2001 @@ -0,0 +1,89 @@ +/* radeon_drv.c -- ATI Radeon driver -*- linux-c -*- + * Created: Wed Feb 14 17:10:04 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#include <linux/config.h> +#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 "20010405" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 1 +#define DRIVER_PATCHLEVEL 1 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = { radeon_cp_buffers, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_INIT)] = { radeon_cp_init, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_START)] = { radeon_cp_start, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_STOP)] = { radeon_cp_stop, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_RESET)] = { radeon_cp_reset, 1, 1 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CP_IDLE)] = { radeon_cp_idle, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_RESET)] = { radeon_engine_reset, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_FULLSCREEN)] = { radeon_fullscreen, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_SWAP)] = { radeon_cp_swap, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_CLEAR)] = { radeon_cp_clear, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_VERTEX)] = { radeon_cp_vertex, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDICES)] = { radeon_cp_indices, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_TEXTURE)] = { radeon_cp_texture, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_STIPPLE)] = { radeon_cp_stipple, 1, 0 }, \ + [DRM_IOCTL_NR(DRM_IOCTL_RADEON_INDIRECT)] = { radeon_cp_indirect, 1, 1 }, + + +#if 0 +/* GH: Count data sent to card via ring or vertex/indirect buffers. + */ +#define __HAVE_COUNTERS 3 +#define __HAVE_COUNTER6 _DRM_STAT_IRQ +#define __HAVE_COUNTER7 _DRM_STAT_PRIMARY +#define __HAVE_COUNTER8 _DRM_STAT_SECONDARY +#endif + + +#include "drm_agpsupport.h" +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" +#include "drm_scatter.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h:1.4 --- /dev/null Mon Jun 4 12:41:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_drv.h Wed May 2 11:06:10 2001 @@ -0,0 +1,738 @@ +/* radeon_drv.h -- Private header for radeon driver -*- linux-c -*- + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Kevin E. Martin <martin@valinux.com> + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __RADEON_DRV_H__ +#define __RADEON_DRV_H__ + +typedef struct drm_radeon_freelist { + unsigned int age; + drm_buf_t *buf; + struct drm_radeon_freelist *next; + struct drm_radeon_freelist *prev; +} drm_radeon_freelist_t; + +typedef struct drm_radeon_ring_buffer { + u32 *start; + u32 *end; + int size; + int size_l2qw; + + volatile u32 *head; + u32 tail; + u32 tail_mask; + int space; + + int high_mark; +} drm_radeon_ring_buffer_t; + +typedef struct drm_radeon_depth_clear_t { + u32 rb3d_cntl; + u32 rb3d_zstencilcntl; + u32 se_cntl; +} drm_radeon_depth_clear_t; + +typedef struct drm_radeon_private { + drm_radeon_ring_buffer_t ring; + drm_radeon_sarea_t *sarea_priv; + + int agp_size; + u32 agp_vm_start; + unsigned long agp_buffers_offset; + + int cp_mode; + int cp_running; + + drm_radeon_freelist_t *head; + drm_radeon_freelist_t *tail; +/* FIXME: ROTATE_BUFS is a hask to cycle through bufs until freelist + code is used. Note this hides a problem with the scratch register + (used to keep track of last buffer completed) being written to before + the last buffer has actually completed rendering. */ +#define ROTATE_BUFS 1 +#if ROTATE_BUFS + int last_buf; +#endif + volatile u32 *scratch; + + int usec_timeout; + int is_pci; + unsigned long phys_pci_gart; + + atomic_t idle_count; + + int page_flipping; + int current_page; + u32 crtc_offset; + u32 crtc_offset_cntl; + + u32 color_fmt; + unsigned int front_offset; + unsigned int front_pitch; + unsigned int back_offset; + unsigned int back_pitch; + + u32 depth_fmt; + unsigned int depth_offset; + unsigned int depth_pitch; + + u32 front_pitch_offset; + u32 back_pitch_offset; + u32 depth_pitch_offset; + + drm_radeon_depth_clear_t depth_clear; + + drm_map_t *sarea; + drm_map_t *fb; + drm_map_t *mmio; + drm_map_t *cp_ring; + drm_map_t *ring_rptr; + drm_map_t *buffers; + drm_map_t *agp_textures; +} drm_radeon_private_t; + +typedef struct drm_radeon_buf_priv { + u32 age; + int prim; + int discard; + int dispatched; + drm_radeon_freelist_t *list_entry; +} drm_radeon_buf_priv_t; + + /* radeon_cp.c */ +extern int radeon_cp_init( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_cp_start( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_cp_stop( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_cp_reset( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_cp_idle( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_engine_reset( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_fullscreen( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_cp_buffers( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + +extern void radeon_freelist_reset( drm_device_t *dev ); +extern drm_buf_t *radeon_freelist_get( drm_device_t *dev ); + +extern int radeon_wait_ring( drm_radeon_private_t *dev_priv, int n ); + +static inline void +radeon_update_ring_snapshot( drm_radeon_ring_buffer_t *ring ) +{ + ring->space = (*(volatile int *)ring->head - ring->tail) * sizeof(u32); + if ( ring->space <= 0 ) + ring->space += ring->size; +} + +extern int radeon_do_cp_idle( drm_radeon_private_t *dev_priv ); +extern int radeon_do_cleanup_cp( drm_device_t *dev ); +extern int radeon_do_cleanup_pageflip( drm_device_t *dev ); + + /* radeon_state.c */ +extern int radeon_cp_clear( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_cp_swap( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_cp_vertex( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_cp_indices( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_cp_texture( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_cp_stipple( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); +extern int radeon_cp_indirect( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ); + + +/* Register definitions, register access macros and drmAddMap constants + * for Radeon kernel driver. + */ + +#define RADEON_AGP_COMMAND 0x0f60 +#define RADEON_AUX_SCISSOR_CNTL 0x26f0 +# define RADEON_EXCLUSIVE_SCISSOR_0 (1 << 24) +# define RADEON_EXCLUSIVE_SCISSOR_1 (1 << 25) +# define RADEON_EXCLUSIVE_SCISSOR_2 (1 << 26) +# define RADEON_SCISSOR_0_ENABLE (1 << 28) +# define RADEON_SCISSOR_1_ENABLE (1 << 29) +# define RADEON_SCISSOR_2_ENABLE (1 << 30) + +#define RADEON_BUS_CNTL 0x0030 +# define RADEON_BUS_MASTER_DIS (1 << 6) + +#define RADEON_CLOCK_CNTL_DATA 0x000c +# define RADEON_PLL_WR_EN (1 << 7) +#define RADEON_CLOCK_CNTL_INDEX 0x0008 +#define RADEON_CONFIG_APER_SIZE 0x0108 +#define RADEON_CRTC_OFFSET 0x0224 +#define RADEON_CRTC_OFFSET_CNTL 0x0228 +# define RADEON_CRTC_TILE_EN (1 << 15) +# define RADEON_CRTC_OFFSET_FLIP_CNTL (1 << 16) + +#define RADEON_RB3D_COLORPITCH 0x1c48 +#define RADEON_RB3D_DEPTHCLEARVALUE 0x1c30 +#define RADEON_RB3D_DEPTHXY_OFFSET 0x1c60 + +#define RADEON_DP_GUI_MASTER_CNTL 0x146c +# define RADEON_GMC_SRC_PITCH_OFFSET_CNTL (1 << 0) +# define RADEON_GMC_DST_PITCH_OFFSET_CNTL (1 << 1) +# define RADEON_GMC_BRUSH_SOLID_COLOR (13 << 4) +# define RADEON_GMC_BRUSH_NONE (15 << 4) +# define RADEON_GMC_DST_16BPP (4 << 8) +# define RADEON_GMC_DST_24BPP (5 << 8) +# define RADEON_GMC_DST_32BPP (6 << 8) +# define RADEON_GMC_DST_DATATYPE_SHIFT 8 +# define RADEON_GMC_SRC_DATATYPE_COLOR (3 << 12) +# define RADEON_DP_SRC_SOURCE_MEMORY (2 << 24) +# define RADEON_DP_SRC_SOURCE_HOST_DATA (3 << 24) +# define RADEON_GMC_CLR_CMP_CNTL_DIS (1 << 28) +# define RADEON_GMC_WR_MSK_DIS (1 << 30) +# define RADEON_ROP3_S 0x00cc0000 +# define RADEON_ROP3_P 0x00f00000 +#define RADEON_DP_WRITE_MASK 0x16cc +#define RADEON_DST_PITCH_OFFSET 0x142c +#define RADEON_DST_PITCH_OFFSET_C 0x1c80 +# define RADEON_DST_TILE_LINEAR (0 << 30) +# define RADEON_DST_TILE_MACRO (1 << 30) +# define RADEON_DST_TILE_MICRO (2 << 30) +# define RADEON_DST_TILE_BOTH (3 << 30) + +#define RADEON_SCRATCH_REG0 0x15e0 +#define RADEON_SCRATCH_REG1 0x15e4 +#define RADEON_SCRATCH_REG2 0x15e8 +#define RADEON_SCRATCH_REG3 0x15ec +#define RADEON_SCRATCH_REG4 0x15f0 +#define RADEON_SCRATCH_REG5 0x15f4 +#define RADEON_SCRATCH_UMSK 0x0770 +#define RADEON_SCRATCH_ADDR 0x0774 + +#define RADEON_HOST_PATH_CNTL 0x0130 +# define RADEON_HDP_SOFT_RESET (1 << 26) +# define RADEON_HDP_WC_TIMEOUT_MASK (7 << 28) +# define RADEON_HDP_WC_TIMEOUT_28BCLK (7 << 28) + +#define RADEON_ISYNC_CNTL 0x1724 +# define RADEON_ISYNC_ANY2D_IDLE3D (1 << 0) +# define RADEON_ISYNC_ANY3D_IDLE2D (1 << 1) +# define RADEON_ISYNC_TRIG2D_IDLE3D (1 << 2) +# define RADEON_ISYNC_TRIG3D_IDLE2D (1 << 3) +# define RADEON_ISYNC_WAIT_IDLEGUI (1 << 4) +# define RADEON_ISYNC_CPSCRATCH_IDLEGUI (1 << 5) + +#define RADEON_MC_AGP_LOCATION 0x014c +#define RADEON_MC_FB_LOCATION 0x0148 +#define RADEON_MCLK_CNTL 0x0012 +# define RADEON_FORCEON_MCLKA (1 << 16) +# define RADEON_FORCEON_MCLKB (1 << 17) +# define RADEON_FORCEON_YCLKA (1 << 18) +# define RADEON_FORCEON_YCLKB (1 << 19) +# define RADEON_FORCEON_MC (1 << 20) +# define RADEON_FORCEON_AIC (1 << 21) + +#define RADEON_PP_BORDER_COLOR_0 0x1d40 +#define RADEON_PP_BORDER_COLOR_1 0x1d44 +#define RADEON_PP_BORDER_COLOR_2 0x1d48 +#define RADEON_PP_CNTL 0x1c38 +# define RADEON_SCISSOR_ENABLE (1 << 1) +#define RADEON_PP_LUM_MATRIX 0x1d00 +#define RADEON_PP_MISC 0x1c14 +#define RADEON_PP_ROT_MATRIX_0 0x1d58 +#define RADEON_PP_TXFILTER_0 0x1c54 +#define RADEON_PP_TXFILTER_1 0x1c6c +#define RADEON_PP_TXFILTER_2 0x1c84 + +#define RADEON_RB2D_DSTCACHE_CTLSTAT 0x342c +# define RADEON_RB2D_DC_FLUSH (3 << 0) +# define RADEON_RB2D_DC_FREE (3 << 2) +# define RADEON_RB2D_DC_FLUSH_ALL 0xf +# define RADEON_RB2D_DC_BUSY (1 << 31) +#define RADEON_RB3D_CNTL 0x1c3c +# define RADEON_ALPHA_BLEND_ENABLE (1 << 0) +# define RADEON_PLANE_MASK_ENABLE (1 << 1) +# define RADEON_DITHER_ENABLE (1 << 2) +# define RADEON_ROUND_ENABLE (1 << 3) +# define RADEON_SCALE_DITHER_ENABLE (1 << 4) +# define RADEON_DITHER_INIT (1 << 5) +# define RADEON_ROP_ENABLE (1 << 6) +# define RADEON_STENCIL_ENABLE (1 << 7) +# define RADEON_Z_ENABLE (1 << 8) +# define RADEON_DEPTH_XZ_OFFEST_ENABLE (1 << 9) +# define RADEON_ZBLOCK8 (0 << 15) +# define RADEON_ZBLOCK16 (1 << 15) +#define RADEON_RB3D_DEPTHOFFSET 0x1c24 +#define RADEON_RB3D_PLANEMASK 0x1d84 +#define RADEON_RB3D_STENCILREFMASK 0x1d7c +#define RADEON_RB3D_ZCACHE_MODE 0x3250 +#define RADEON_RB3D_ZCACHE_CTLSTAT 0x3254 +# define RADEON_RB3D_ZC_FLUSH (1 << 0) +# define RADEON_RB3D_ZC_FREE (1 << 2) +# define RADEON_RB3D_ZC_FLUSH_ALL 0x5 +# define RADEON_RB3D_ZC_BUSY (1 << 31) +#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c +# define RADEON_Z_TEST_MASK (7 << 4) +# define RADEON_Z_TEST_ALWAYS (7 << 4) +# define RADEON_STENCIL_TEST_ALWAYS (7 << 12) +# define RADEON_STENCIL_S_FAIL_KEEP (0 << 16) +# define RADEON_STENCIL_ZPASS_KEEP (0 << 20) +# define RADEON_STENCIL_ZFAIL_KEEP (0 << 20) +# define RADEON_Z_WRITE_ENABLE (1 << 30) +#define RADEON_RBBM_SOFT_RESET 0x00f0 +# define RADEON_SOFT_RESET_CP (1 << 0) +# define RADEON_SOFT_RESET_HI (1 << 1) +# define RADEON_SOFT_RESET_SE (1 << 2) +# define RADEON_SOFT_RESET_RE (1 << 3) +# define RADEON_SOFT_RESET_PP (1 << 4) +# define RADEON_SOFT_RESET_E2 (1 << 5) +# define RADEON_SOFT_RESET_RB (1 << 6) +# define RADEON_SOFT_RESET_HDP (1 << 7) +#define RADEON_RBBM_STATUS 0x0e40 +# define RADEON_RBBM_FIFOCNT_MASK 0x007f +# define RADEON_RBBM_ACTIVE (1 << 31) +#define RADEON_RE_LINE_PATTERN 0x1cd0 +#define RADEON_RE_MISC 0x26c4 +#define RADEON_RE_TOP_LEFT 0x26c0 +#define RADEON_RE_WIDTH_HEIGHT 0x1c44 +#define RADEON_RE_STIPPLE_ADDR 0x1cc8 +#define RADEON_RE_STIPPLE_DATA 0x1ccc + +#define RADEON_SCISSOR_TL_0 0x1cd8 +#define RADEON_SCISSOR_BR_0 0x1cdc +#define RADEON_SCISSOR_TL_1 0x1ce0 +#define RADEON_SCISSOR_BR_1 0x1ce4 +#define RADEON_SCISSOR_TL_2 0x1ce8 +#define RADEON_SCISSOR_BR_2 0x1cec +#define RADEON_SE_COORD_FMT 0x1c50 +#define RADEON_SE_CNTL 0x1c4c +# define RADEON_FFACE_CULL_CW (0 << 0) +# define RADEON_BFACE_SOLID (3 << 1) +# define RADEON_FFACE_SOLID (3 << 3) +# define RADEON_FLAT_SHADE_VTX_LAST (3 << 6) +# define RADEON_DIFFUSE_SHADE_FLAT (1 << 8) +# define RADEON_DIFFUSE_SHADE_GOURAUD (2 << 8) +# define RADEON_ALPHA_SHADE_FLAT (1 << 10) +# define RADEON_ALPHA_SHADE_GOURAUD (2 << 10) +# define RADEON_SPECULAR_SHADE_FLAT (1 << 12) +# define RADEON_SPECULAR_SHADE_GOURAUD (2 << 12) +# define RADEON_FOG_SHADE_FLAT (1 << 14) +# define RADEON_FOG_SHADE_GOURAUD (2 << 14) +# define RADEON_VPORT_XY_XFORM_ENABLE (1 << 24) +# define RADEON_VPORT_Z_XFORM_ENABLE (1 << 25) +# define RADEON_VTX_PIX_CENTER_OGL (1 << 27) +# define RADEON_ROUND_MODE_TRUNC (0 << 28) +# define RADEON_ROUND_PREC_8TH_PIX (1 << 30) +#define RADEON_SE_CNTL_STATUS 0x2140 +#define RADEON_SE_LINE_WIDTH 0x1db8 +#define RADEON_SE_VPORT_XSCALE 0x1d98 +#define RADEON_SURFACE_ACCESS_FLAGS 0x0bf8 +#define RADEON_SURFACE_ACCESS_CLR 0x0bfc +#define RADEON_SURFACE_CNTL 0x0b00 +# define RADEON_SURF_TRANSLATION_DIS (1 << 8) +# define RADEON_NONSURF_AP0_SWP_MASK (3 << 20) +# define RADEON_NONSURF_AP0_SWP_LITTLE (0 << 20) +# define RADEON_NONSURF_AP0_SWP_BIG16 (1 << 20) +# define RADEON_NONSURF_AP0_SWP_BIG32 (2 << 20) +# define RADEON_NONSURF_AP1_SWP_MASK (3 << 22) +# define RADEON_NONSURF_AP1_SWP_LITTLE (0 << 22) +# define RADEON_NONSURF_AP1_SWP_BIG16 (1 << 22) +# define RADEON_NONSURF_AP1_SWP_BIG32 (2 << 22) +#define RADEON_SURFACE0_INFO 0x0b0c +# define RADEON_SURF_PITCHSEL_MASK (0x1ff << 0) +# define RADEON_SURF_TILE_MODE_MASK (3 << 16) +# define RADEON_SURF_TILE_MODE_MACRO (0 << 16) +# define RADEON_SURF_TILE_MODE_MICRO (1 << 16) +# define RADEON_SURF_TILE_MODE_32BIT_Z (2 << 16) +# define RADEON_SURF_TILE_MODE_16BIT_Z (3 << 16) +#define RADEON_SURFACE0_LOWER_BOUND 0x0b04 +#define RADEON_SURFACE0_UPPER_BOUND 0x0b08 +#define RADEON_SURFACE1_INFO 0x0b1c +#define RADEON_SURFACE1_LOWER_BOUND 0x0b14 +#define RADEON_SURFACE1_UPPER_BOUND 0x0b18 +#define RADEON_SURFACE2_INFO 0x0b2c +#define RADEON_SURFACE2_LOWER_BOUND 0x0b24 +#define RADEON_SURFACE2_UPPER_BOUND 0x0b28 +#define RADEON_SURFACE3_INFO 0x0b3c +#define RADEON_SURFACE3_LOWER_BOUND 0x0b34 +#define RADEON_SURFACE3_UPPER_BOUND 0x0b38 +#define RADEON_SURFACE4_INFO 0x0b4c +#define RADEON_SURFACE4_LOWER_BOUND 0x0b44 +#define RADEON_SURFACE4_UPPER_BOUND 0x0b48 +#define RADEON_SURFACE5_INFO 0x0b5c +#define RADEON_SURFACE5_LOWER_BOUND 0x0b54 +#define RADEON_SURFACE5_UPPER_BOUND 0x0b58 +#define RADEON_SURFACE6_INFO 0x0b6c +#define RADEON_SURFACE6_LOWER_BOUND 0x0b64 +#define RADEON_SURFACE6_UPPER_BOUND 0x0b68 +#define RADEON_SURFACE7_INFO 0x0b7c +#define RADEON_SURFACE7_LOWER_BOUND 0x0b74 +#define RADEON_SURFACE7_UPPER_BOUND 0x0b78 +#define RADEON_SW_SEMAPHORE 0x013c + +#define RADEON_WAIT_UNTIL 0x1720 +# define RADEON_WAIT_CRTC_PFLIP (1 << 0) +# define RADEON_WAIT_2D_IDLECLEAN (1 << 16) +# define RADEON_WAIT_3D_IDLECLEAN (1 << 17) +# define RADEON_WAIT_HOST_IDLECLEAN (1 << 18) + +#define RADEON_RB3D_ZMASKOFFSET 0x1c34 +#define RADEON_RB3D_ZSTENCILCNTL 0x1c2c +# define RADEON_DEPTH_FORMAT_16BIT_INT_Z (0 << 0) +# define RADEON_DEPTH_FORMAT_24BIT_INT_Z (2 << 0) + + +/* CP registers */ +#define RADEON_CP_ME_RAM_ADDR 0x07d4 +#define RADEON_CP_ME_RAM_RADDR 0x07d8 +#define RADEON_CP_ME_RAM_DATAH 0x07dc +#define RADEON_CP_ME_RAM_DATAL 0x07e0 + +#define RADEON_CP_RB_BASE 0x0700 +#define RADEON_CP_RB_CNTL 0x0704 +#define RADEON_CP_RB_RPTR_ADDR 0x070c +#define RADEON_CP_RB_RPTR 0x0710 +#define RADEON_CP_RB_WPTR 0x0714 + +#define RADEON_CP_RB_WPTR_DELAY 0x0718 +# define RADEON_PRE_WRITE_TIMER_SHIFT 0 +# define RADEON_PRE_WRITE_LIMIT_SHIFT 23 + +#define RADEON_CP_IB_BASE 0x0738 + +#define RADEON_CP_CSQ_CNTL 0x0740 +# define RADEON_CSQ_CNT_PRIMARY_MASK (0xff << 0) +# define RADEON_CSQ_PRIDIS_INDDIS (0 << 28) +# define RADEON_CSQ_PRIPIO_INDDIS (1 << 28) +# define RADEON_CSQ_PRIBM_INDDIS (2 << 28) +# define RADEON_CSQ_PRIPIO_INDBM (3 << 28) +# define RADEON_CSQ_PRIBM_INDBM (4 << 28) +# define RADEON_CSQ_PRIPIO_INDPIO (15 << 28) + +#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 +# define RADEON_ONE_REG_WR (1 << 15) +#define RADEON_CP_PACKET1 0x40000000 +#define RADEON_CP_PACKET2 0x80000000 +#define RADEON_CP_PACKET3 0xC0000000 +# define RADEON_3D_RNDR_GEN_INDX_PRIM 0x00002300 +# define RADEON_WAIT_FOR_IDLE 0x00002600 +# define RADEON_3D_DRAW_IMMD 0x00002900 +# define RADEON_3D_CLEAR_ZMASK 0x00003200 +# define RADEON_CNTL_HOSTDATA_BLT 0x00009400 +# define RADEON_CNTL_PAINT_MULTI 0x00009A00 +# define RADEON_CNTL_BITBLT_MULTI 0x00009B00 + +#define RADEON_CP_PACKET_MASK 0xC0000000 +#define RADEON_CP_PACKET_COUNT_MASK 0x3fff0000 +#define RADEON_CP_PACKET0_REG_MASK 0x000007ff +#define RADEON_CP_PACKET1_REG0_MASK 0x000007ff +#define RADEON_CP_PACKET1_REG1_MASK 0x003ff800 + +#define RADEON_VTX_Z_PRESENT (1 << 31) + +#define RADEON_PRIM_TYPE_NONE (0 << 0) +#define RADEON_PRIM_TYPE_POINT (1 << 0) +#define RADEON_PRIM_TYPE_LINE (2 << 0) +#define RADEON_PRIM_TYPE_LINE_STRIP (3 << 0) +#define RADEON_PRIM_TYPE_TRI_LIST (4 << 0) +#define RADEON_PRIM_TYPE_TRI_FAN (5 << 0) +#define RADEON_PRIM_TYPE_TRI_STRIP (6 << 0) +#define RADEON_PRIM_TYPE_TRI_TYPE2 (7 << 0) +#define RADEON_PRIM_TYPE_RECT_LIST (8 << 0) +#define RADEON_PRIM_TYPE_3VRT_POINT_LIST (9 << 0) +#define RADEON_PRIM_TYPE_3VRT_LINE_LIST (10 << 0) +#define RADEON_PRIM_WALK_IND (1 << 4) +#define RADEON_PRIM_WALK_LIST (2 << 4) +#define RADEON_PRIM_WALK_RING (3 << 4) +#define RADEON_COLOR_ORDER_BGRA (0 << 6) +#define RADEON_COLOR_ORDER_RGBA (1 << 6) +#define RADEON_MAOS_ENABLE (1 << 7) +#define RADEON_VTX_FMT_R128_MODE (0 << 8) +#define RADEON_VTX_FMT_RADEON_MODE (1 << 8) +#define RADEON_NUM_VERTICES_SHIFT 16 + +#define RADEON_COLOR_FORMAT_CI8 2 +#define RADEON_COLOR_FORMAT_ARGB1555 3 +#define RADEON_COLOR_FORMAT_RGB565 4 +#define RADEON_COLOR_FORMAT_ARGB8888 6 +#define RADEON_COLOR_FORMAT_RGB332 7 +#define RADEON_COLOR_FORMAT_RGB8 9 +#define RADEON_COLOR_FORMAT_ARGB4444 15 + +#define RADEON_TXFORMAT_I8 0 +#define RADEON_TXFORMAT_AI88 1 +#define RADEON_TXFORMAT_RGB332 2 +#define RADEON_TXFORMAT_ARGB1555 3 +#define RADEON_TXFORMAT_RGB565 4 +#define RADEON_TXFORMAT_ARGB4444 5 +#define RADEON_TXFORMAT_ARGB8888 6 +#define RADEON_TXFORMAT_RGBA8888 7 + +/* Constants */ +#define RADEON_MAX_USEC_TIMEOUT 100000 /* 100 ms */ + +#define RADEON_LAST_FRAME_REG RADEON_SCRATCH_REG0 +#define RADEON_LAST_DISPATCH_REG RADEON_SCRATCH_REG1 +#define RADEON_LAST_CLEAR_REG RADEON_SCRATCH_REG2 +#define RADEON_LAST_DISPATCH 1 + +#define RADEON_MAX_VB_AGE 0x7fffffff +#define RADEON_MAX_VB_VERTS (0xffff) + +#define RADEON_RING_HIGH_MARK 128 + + +#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 { \ + RADEON_WRITE8( RADEON_CLOCK_CNTL_INDEX, \ + ((addr) & 0x1f) | RADEON_PLL_WR_EN ); \ + RADEON_WRITE( RADEON_CLOCK_CNTL_DATA, (val) ); \ +} while (0) + +extern int RADEON_READ_PLL( drm_device_t *dev, int addr ); + + +#define CP_PACKET0( reg, n ) \ + (RADEON_CP_PACKET0 | ((n) << 16) | ((reg) >> 2)) +#define CP_PACKET0_TABLE( reg, n ) \ + (RADEON_CP_PACKET0 | RADEON_ONE_REG_WR | ((n) << 16) | ((reg) >> 2)) +#define CP_PACKET1( reg0, reg1 ) \ + (RADEON_CP_PACKET1 | (((reg1) >> 2) << 15) | ((reg0) >> 2)) +#define CP_PACKET2() \ + (RADEON_CP_PACKET2) +#define CP_PACKET3( pkt, n ) \ + (RADEON_CP_PACKET3 | (pkt) | ((n) << 16)) + + +/* ================================================================ + * Engine control helper macros + */ + +#define RADEON_WAIT_UNTIL_2D_IDLE() do { \ + OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ + OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ + RADEON_WAIT_HOST_IDLECLEAN) ); \ +} while (0) + +#define RADEON_WAIT_UNTIL_3D_IDLE() do { \ + OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ + OUT_RING( (RADEON_WAIT_3D_IDLECLEAN | \ + RADEON_WAIT_HOST_IDLECLEAN) ); \ +} while (0) + +#define RADEON_WAIT_UNTIL_IDLE() do { \ + OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ + OUT_RING( (RADEON_WAIT_2D_IDLECLEAN | \ + RADEON_WAIT_3D_IDLECLEAN | \ + RADEON_WAIT_HOST_IDLECLEAN) ); \ +} while (0) + +#define RADEON_WAIT_UNTIL_PAGE_FLIPPED() do { \ + OUT_RING( CP_PACKET0( RADEON_WAIT_UNTIL, 0 ) ); \ + OUT_RING( RADEON_WAIT_CRTC_PFLIP ); \ +} while (0) + +#define RADEON_FLUSH_CACHE() do { \ + OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ + OUT_RING( RADEON_RB2D_DC_FLUSH ); \ +} while (0) + +#define RADEON_PURGE_CACHE() do { \ + OUT_RING( CP_PACKET0( RADEON_RB2D_DSTCACHE_CTLSTAT, 0 ) ); \ + OUT_RING( RADEON_RB2D_DC_FLUSH_ALL ); \ +} while (0) + +#define RADEON_FLUSH_ZCACHE() do { \ + OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \ + OUT_RING( RADEON_RB3D_ZC_FLUSH ); \ +} while (0) + +#define RADEON_PURGE_ZCACHE() do { \ + OUT_RING( CP_PACKET0( RADEON_RB3D_ZCACHE_CTLSTAT, 0 ) ); \ + OUT_RING( RADEON_RB3D_ZC_FLUSH_ALL ); \ +} while (0) + + +/* ================================================================ + * Misc helper macros + */ + +#define LOCK_TEST_WITH_RETURN( dev ) \ +do { \ + if ( !_DRM_LOCK_IS_HELD( dev->lock.hw_lock->lock ) || \ + dev->lock.pid != current->pid ) { \ + DRM_ERROR( "%s called without lock held\n", \ + __FUNCTION__ ); \ + return -EINVAL; \ + } \ +} while (0) + +#define RING_SPACE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + drm_radeon_ring_buffer_t *ring = &dev_priv->ring; int i; \ + if ( ring->space < ring->high_mark ) { \ + for ( i = 0 ; i < dev_priv->usec_timeout ; i++ ) { \ + radeon_update_ring_snapshot( ring ); \ + if ( ring->space >= ring->high_mark ) \ + goto __ring_space_done; \ + udelay( 1 ); \ + } \ + DRM_ERROR( "ring space check failed!\n" ); \ + return -EBUSY; \ + } \ + __ring_space_done: \ +} while (0) + +#define VB_AGE_TEST_WITH_RETURN( dev_priv ) \ +do { \ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; \ + if ( sarea_priv->last_dispatch >= RADEON_MAX_VB_AGE ) { \ + int __ret = radeon_do_cp_idle( dev_priv ); \ + if ( __ret < 0 ) return __ret; \ + sarea_priv->last_dispatch = 0; \ + radeon_freelist_reset( dev ); \ + } \ +} while (0) + +#define RADEON_DISPATCH_AGE( age ) do { \ + OUT_RING( CP_PACKET0( RADEON_LAST_DISPATCH_REG, 0 ) ); \ + OUT_RING( age ); \ +} while (0) + +#define RADEON_FRAME_AGE( age ) do { \ + OUT_RING( CP_PACKET0( RADEON_LAST_FRAME_REG, 0 ) ); \ + OUT_RING( age ); \ +} while (0) + +#define RADEON_CLEAR_AGE( age ) do { \ + OUT_RING( CP_PACKET0( RADEON_LAST_CLEAR_REG, 0 ) ); \ + OUT_RING( age ); \ +} while (0) + + +/* ================================================================ + * Ring control + */ + +#define radeon_flush_write_combine() mb() + + +#define RADEON_VERBOSE 0 + +#define RING_LOCALS int write; unsigned int mask; volatile u32 *ring; + +#define BEGIN_RING( n ) do { \ + if ( RADEON_VERBOSE ) { \ + DRM_INFO( "BEGIN_RING( %d ) in %s\n", \ + n, __FUNCTION__ ); \ + } \ + if ( dev_priv->ring.space <= (n) * sizeof(u32) ) { \ + radeon_wait_ring( dev_priv, (n) * sizeof(u32) ); \ + } \ + dev_priv->ring.space -= (n) * sizeof(u32); \ + ring = dev_priv->ring.start; \ + write = dev_priv->ring.tail; \ + mask = dev_priv->ring.tail_mask; \ +} while (0) + +#define ADVANCE_RING() do { \ + if ( RADEON_VERBOSE ) { \ + DRM_INFO( "ADVANCE_RING() wr=0x%06x tail=0x%06x\n", \ + write, dev_priv->ring.tail ); \ + } \ + radeon_flush_write_combine(); \ + dev_priv->ring.tail = write; \ + RADEON_WRITE( RADEON_CP_RB_WPTR, write ); \ +} while (0) + +#define OUT_RING( x ) do { \ + if ( RADEON_VERBOSE ) { \ + DRM_INFO( " OUT_RING( 0x%08x ) at 0x%x\n", \ + (unsigned int)(x), write ); \ + } \ + ring[write++] = (x); \ + write &= mask; \ +} while (0) + +#define RADEON_PERFORMANCE_BOXES 0 + +#endif /* __RADEON_DRV_H__ */ Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c:1.3 --- /dev/null Mon Jun 4 12:41:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/radeon_state.c Tue Apr 10 12:08:05 2001 @@ -0,0 +1,1483 @@ +/* radeon_state.c -- State support for Radeon -*- linux-c -*- + * + * Copyright 2000 VA Linux Systems, Inc., Fremont, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + * Kevin E. Martin <martin@valinux.com> + */ + +#define __NO_VERSION__ +#include "radeon.h" +#include "drmP.h" +#include "radeon_drv.h" +#include "drm.h" +#include <linux/delay.h> + + +/* ================================================================ + * CP hardware state programming functions + */ + +static inline void radeon_emit_clip_rect( drm_radeon_private_t *dev_priv, + drm_clip_rect_t *box ) +{ + RING_LOCALS; + + DRM_DEBUG( " box: x1=%d y1=%d x2=%d y2=%d\n", + box->x1, box->y1, box->x2, box->y2 ); + + BEGIN_RING( 4 ); + + OUT_RING( CP_PACKET0( RADEON_RE_TOP_LEFT, 0 ) ); + OUT_RING( (box->y1 << 16) | box->x1 ); + + OUT_RING( CP_PACKET0( RADEON_RE_WIDTH_HEIGHT, 0 ) ); + OUT_RING( ((box->y2 - 1) << 16) | (box->x2 - 1) ); + + ADVANCE_RING(); +} + +static inline void radeon_emit_context( drm_radeon_private_t *dev_priv ) +{ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 14 ); + + OUT_RING( CP_PACKET0( RADEON_PP_MISC, 6 ) ); + OUT_RING( ctx->pp_misc ); + OUT_RING( ctx->pp_fog_color ); + OUT_RING( ctx->re_solid_color ); + OUT_RING( ctx->rb3d_blendcntl ); + OUT_RING( ctx->rb3d_depthoffset ); + OUT_RING( ctx->rb3d_depthpitch ); + OUT_RING( ctx->rb3d_zstencilcntl ); + + OUT_RING( CP_PACKET0( RADEON_PP_CNTL, 2 ) ); + OUT_RING( ctx->pp_cntl ); + OUT_RING( ctx->rb3d_cntl ); + OUT_RING( ctx->rb3d_coloroffset ); + + OUT_RING( CP_PACKET0( RADEON_RB3D_COLORPITCH, 0 ) ); + OUT_RING( ctx->rb3d_colorpitch ); + + ADVANCE_RING(); +} + +static inline void radeon_emit_vertfmt( drm_radeon_private_t *dev_priv ) +{ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 2 ); + + OUT_RING( CP_PACKET0( RADEON_SE_COORD_FMT, 0 ) ); + OUT_RING( ctx->se_coord_fmt ); + + ADVANCE_RING(); +} + +static inline void radeon_emit_line( drm_radeon_private_t *dev_priv ) +{ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 5 ); + + OUT_RING( CP_PACKET0( RADEON_RE_LINE_PATTERN, 1 ) ); + OUT_RING( ctx->re_line_pattern ); + OUT_RING( ctx->re_line_state ); + + OUT_RING( CP_PACKET0( RADEON_SE_LINE_WIDTH, 0 ) ); + OUT_RING( ctx->se_line_width ); + + ADVANCE_RING(); +} + +static inline void radeon_emit_bumpmap( drm_radeon_private_t *dev_priv ) +{ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 5 ); + + OUT_RING( CP_PACKET0( RADEON_PP_LUM_MATRIX, 0 ) ); + OUT_RING( ctx->pp_lum_matrix ); + + OUT_RING( CP_PACKET0( RADEON_PP_ROT_MATRIX_0, 1 ) ); + OUT_RING( ctx->pp_rot_matrix_0 ); + OUT_RING( ctx->pp_rot_matrix_1 ); + + ADVANCE_RING(); +} + +static inline void radeon_emit_masks( drm_radeon_private_t *dev_priv ) +{ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 4 ); + + OUT_RING( CP_PACKET0( RADEON_RB3D_STENCILREFMASK, 2 ) ); + OUT_RING( ctx->rb3d_stencilrefmask ); + OUT_RING( ctx->rb3d_ropcntl ); + OUT_RING( ctx->rb3d_planemask ); + + ADVANCE_RING(); +} + +static inline void radeon_emit_viewport( drm_radeon_private_t *dev_priv ) +{ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 7 ); + + OUT_RING( CP_PACKET0( RADEON_SE_VPORT_XSCALE, 5 ) ); + OUT_RING( ctx->se_vport_xscale ); + OUT_RING( ctx->se_vport_xoffset ); + OUT_RING( ctx->se_vport_yscale ); + OUT_RING( ctx->se_vport_yoffset ); + OUT_RING( ctx->se_vport_zscale ); + OUT_RING( ctx->se_vport_zoffset ); + + ADVANCE_RING(); +} + +static inline void radeon_emit_setup( drm_radeon_private_t *dev_priv ) +{ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 4 ); + + OUT_RING( CP_PACKET0( RADEON_SE_CNTL, 0 ) ); + OUT_RING( ctx->se_cntl ); + OUT_RING( CP_PACKET0( RADEON_SE_CNTL_STATUS, 0 ) ); + OUT_RING( ctx->se_cntl_status ); + + ADVANCE_RING(); +} + +static inline void radeon_emit_tcl( drm_radeon_private_t *dev_priv ) +{ +#ifdef TCL_ENABLE + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 29 ); + + OUT_RING( CP_PACKET0( RADEON_SE_TCL_MATERIAL_EMMISSIVE_RED, 27 ) ); + OUT_RING( ctx->se_tcl_material_emmissive.red ); + OUT_RING( ctx->se_tcl_material_emmissive.green ); + OUT_RING( ctx->se_tcl_material_emmissive.blue ); + OUT_RING( ctx->se_tcl_material_emmissive.alpha ); + OUT_RING( ctx->se_tcl_material_ambient.red ); + OUT_RING( ctx->se_tcl_material_ambient.green ); + OUT_RING( ctx->se_tcl_material_ambient.blue ); + OUT_RING( ctx->se_tcl_material_ambient.alpha ); + OUT_RING( ctx->se_tcl_material_diffuse.red ); + OUT_RING( ctx->se_tcl_material_diffuse.green ); + OUT_RING( ctx->se_tcl_material_diffuse.blue ); + OUT_RING( ctx->se_tcl_material_diffuse.alpha ); + OUT_RING( ctx->se_tcl_material_specular.red ); + OUT_RING( ctx->se_tcl_material_specular.green ); + OUT_RING( ctx->se_tcl_material_specular.blue ); + OUT_RING( ctx->se_tcl_material_specular.alpha ); + OUT_RING( ctx->se_tcl_shininess ); + OUT_RING( ctx->se_tcl_output_vtx_fmt ); + OUT_RING( ctx->se_tcl_output_vtx_sel ); + OUT_RING( ctx->se_tcl_matrix_select_0 ); + OUT_RING( ctx->se_tcl_matrix_select_1 ); + OUT_RING( ctx->se_tcl_ucp_vert_blend_ctl ); + OUT_RING( ctx->se_tcl_texture_proc_ctl ); + OUT_RING( ctx->se_tcl_light_model_ctl ); + for ( i = 0 ; i < 4 ; i++ ) { + OUT_RING( ctx->se_tcl_per_light_ctl[i] ); + } + + ADVANCE_RING(); +#else + DRM_ERROR( "TCL not enabled!\n" ); +#endif +} + +static inline void radeon_emit_misc( drm_radeon_private_t *dev_priv ) +{ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_context_regs_t *ctx = &sarea_priv->context_state; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 2 ); + + OUT_RING( CP_PACKET0( RADEON_RE_MISC, 0 ) ); + OUT_RING( ctx->re_misc ); + + ADVANCE_RING(); +} + +static inline void radeon_emit_tex0( drm_radeon_private_t *dev_priv ) +{ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_texture_regs_t *tex = &sarea_priv->tex_state[0]; + RING_LOCALS; + DRM_DEBUG( " %s: offset=0x%x\n", __FUNCTION__, tex->pp_txoffset ); + + BEGIN_RING( 9 ); + + OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_0, 5 ) ); + OUT_RING( tex->pp_txfilter ); + OUT_RING( tex->pp_txformat ); + OUT_RING( tex->pp_txoffset ); + OUT_RING( tex->pp_txcblend ); + OUT_RING( tex->pp_txablend ); + OUT_RING( tex->pp_tfactor ); + + OUT_RING( CP_PACKET0( RADEON_PP_BORDER_COLOR_0, 0 ) ); + OUT_RING( tex->pp_border_color ); + + ADVANCE_RING(); +} + +static inline void radeon_emit_tex1( drm_radeon_private_t *dev_priv ) +{ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_texture_regs_t *tex = &sarea_priv->tex_state[1]; + RING_LOCALS; + DRM_DEBUG( " %s: offset=0x%x\n", __FUNCTION__, tex->pp_txoffset ); + + BEGIN_RING( 9 ); + + OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_1, 5 ) ); + OUT_RING( tex->pp_txfilter ); + OUT_RING( tex->pp_txformat ); + OUT_RING( tex->pp_txoffset ); + OUT_RING( tex->pp_txcblend ); + OUT_RING( tex->pp_txablend ); + OUT_RING( tex->pp_tfactor ); + + OUT_RING( CP_PACKET0( RADEON_PP_BORDER_COLOR_1, 0 ) ); + OUT_RING( tex->pp_border_color ); + + ADVANCE_RING(); +} + +static inline void radeon_emit_tex2( drm_radeon_private_t *dev_priv ) +{ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_texture_regs_t *tex = &sarea_priv->tex_state[2]; + RING_LOCALS; + DRM_DEBUG( " %s\n", __FUNCTION__ ); + + BEGIN_RING( 9 ); + + OUT_RING( CP_PACKET0( RADEON_PP_TXFILTER_2, 5 ) ); + OUT_RING( tex->pp_txfilter ); + OUT_RING( tex->pp_txformat ); + OUT_RING( tex->pp_txoffset ); + OUT_RING( tex->pp_txcblend ); + OUT_RING( tex->pp_txablend ); + OUT_RING( tex->pp_tfactor ); + + OUT_RING( CP_PACKET0( RADEON_PP_BORDER_COLOR_2, 0 ) ); + OUT_RING( tex->pp_border_color ); + + ADVANCE_RING(); +} + +static inline void radeon_emit_state( drm_radeon_private_t *dev_priv ) +{ + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + unsigned int dirty = sarea_priv->dirty; + + DRM_DEBUG( "%s: dirty=0x%08x\n", __FUNCTION__, dirty ); + + if ( dirty & RADEON_UPLOAD_CONTEXT ) { + radeon_emit_context( dev_priv ); + sarea_priv->dirty &= ~RADEON_UPLOAD_CONTEXT; + } + + if ( dirty & RADEON_UPLOAD_VERTFMT ) { + radeon_emit_vertfmt( dev_priv ); + sarea_priv->dirty &= ~RADEON_UPLOAD_VERTFMT; + } + + if ( dirty & RADEON_UPLOAD_LINE ) { + radeon_emit_line( dev_priv ); + sarea_priv->dirty &= ~RADEON_UPLOAD_LINE; + } + + if ( dirty & RADEON_UPLOAD_BUMPMAP ) { + radeon_emit_bumpmap( dev_priv ); + sarea_priv->dirty &= ~RADEON_UPLOAD_BUMPMAP; + } + + if ( dirty & RADEON_UPLOAD_MASKS ) { + radeon_emit_masks( dev_priv ); + sarea_priv->dirty &= ~RADEON_UPLOAD_MASKS; + } + + if ( dirty & RADEON_UPLOAD_VIEWPORT ) { + radeon_emit_viewport( dev_priv ); + sarea_priv->dirty &= ~RADEON_UPLOAD_VIEWPORT; + } + + if ( dirty & RADEON_UPLOAD_SETUP ) { + radeon_emit_setup( dev_priv ); + sarea_priv->dirty &= ~RADEON_UPLOAD_SETUP; + } + + if ( dirty & RADEON_UPLOAD_TCL ) { +#ifdef TCL_ENABLE + radeon_emit_tcl( dev_priv ); +#endif + sarea_priv->dirty &= ~RADEON_UPLOAD_TCL; + } + + if ( dirty & RADEON_UPLOAD_MISC ) { + radeon_emit_misc( dev_priv ); + sarea_priv->dirty &= ~RADEON_UPLOAD_MISC; + } + + if ( dirty & RADEON_UPLOAD_TEX0 ) { + radeon_emit_tex0( dev_priv ); + sarea_priv->dirty &= ~RADEON_UPLOAD_TEX0; + } + + if ( dirty & RADEON_UPLOAD_TEX1 ) { + radeon_emit_tex1( dev_priv ); + sarea_priv->dirty &= ~RADEON_UPLOAD_TEX1; + } + + if ( dirty & RADEON_UPLOAD_TEX2 ) { +#if 0 + radeon_emit_tex2( dev_priv ); +#endif + sarea_priv->dirty &= ~RADEON_UPLOAD_TEX2; + } + + sarea_priv->dirty &= ~(RADEON_UPLOAD_TEX0IMAGES | + RADEON_UPLOAD_TEX1IMAGES | + RADEON_UPLOAD_TEX2IMAGES | + RADEON_REQUIRE_QUIESCENCE); +} + + +#if RADEON_PERFORMANCE_BOXES +/* ================================================================ + * Performance monitoring functions + */ + +static void radeon_clear_box( drm_radeon_private_t *dev_priv, + int x, int y, int w, int h, + int r, int g, int b ) +{ + u32 pitch, offset; + u32 color; + RING_LOCALS; + + switch ( dev_priv->color_fmt ) { + case RADEON_COLOR_FORMAT_RGB565: + color = (((r & 0xf8) << 8) | + ((g & 0xfc) << 3) | + ((b & 0xf8) >> 3)); + break; + case RADEON_COLOR_FORMAT_ARGB8888: + default: + color = (((0xff) << 24) | (r << 16) | (g << 8) | b); + break; + } + + offset = dev_priv->back_offset; + pitch = dev_priv->back_pitch >> 3; + + BEGIN_RING( 6 ); + + OUT_RING( CP_PACKET3( RADEON_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_BRUSH_SOLID_COLOR | + (dev_priv->color_fmt << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_ROP3_P | + RADEON_GMC_CLR_CMP_CNTL_DIS ); + + OUT_RING( (pitch << 22) | (offset >> 5) ); + OUT_RING( color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); +} + +static void radeon_cp_performance_boxes( drm_radeon_private_t *dev_priv ) +{ + if ( atomic_read( &dev_priv->idle_count ) == 0 ) { + radeon_clear_box( dev_priv, 64, 4, 8, 8, 0, 255, 0 ); + } else { + atomic_set( &dev_priv->idle_count, 0 ); + } +} + +#endif + + +/* ================================================================ + * CP command dispatch functions + */ + +static void radeon_print_dirty( const char *msg, unsigned int flags ) +{ + DRM_DEBUG( "%s: (0x%x) %s%s%s%s%s%s%s%s%s%s%s%s%s%s\n", + msg, + flags, + (flags & RADEON_UPLOAD_CONTEXT) ? "context, " : "", + (flags & RADEON_UPLOAD_VERTFMT) ? "vertfmt, " : "", + (flags & RADEON_UPLOAD_LINE) ? "line, " : "", + (flags & RADEON_UPLOAD_BUMPMAP) ? "bumpmap, " : "", + (flags & RADEON_UPLOAD_MASKS) ? "masks, " : "", + (flags & RADEON_UPLOAD_VIEWPORT) ? "viewport, " : "", + (flags & RADEON_UPLOAD_SETUP) ? "setup, " : "", + (flags & RADEON_UPLOAD_TCL) ? "tcl, " : "", + (flags & RADEON_UPLOAD_MISC) ? "misc, " : "", + (flags & RADEON_UPLOAD_TEX0) ? "tex0, " : "", + (flags & RADEON_UPLOAD_TEX1) ? "tex1, " : "", + (flags & RADEON_UPLOAD_TEX2) ? "tex2, " : "", + (flags & RADEON_UPLOAD_CLIPRECTS) ? "cliprects, " : "", + (flags & RADEON_REQUIRE_QUIESCENCE) ? "quiescence, " : "" ); +} + +static void radeon_cp_dispatch_clear( drm_device_t *dev, + drm_radeon_clear_t *clear, + drm_radeon_clear_rect_t *depth_boxes ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + unsigned int flags = clear->flags; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + if ( dev_priv->page_flipping && dev_priv->current_page == 1 ) { + unsigned int tmp = flags; + + flags &= ~(RADEON_FRONT | RADEON_BACK); + if ( tmp & RADEON_FRONT ) flags |= RADEON_BACK; + if ( tmp & RADEON_BACK ) flags |= RADEON_FRONT; + } + + for ( i = 0 ; i < nbox ; i++ ) { + int x = pbox[i].x1; + int y = pbox[i].y1; + int w = pbox[i].x2 - x; + int h = pbox[i].y2 - y; + + DRM_DEBUG( "dispatch clear %d,%d-%d,%d flags 0x%x\n", + x, y, w, h, flags ); + + if ( flags & (RADEON_FRONT | RADEON_BACK) ) { + BEGIN_RING( 4 ); + + /* Ensure the 3D stream is idle before doing a + * 2D fill to clear the front or back buffer. + */ + RADEON_WAIT_UNTIL_3D_IDLE(); + + OUT_RING( CP_PACKET0( RADEON_DP_WRITE_MASK, 0 ) ); + OUT_RING( clear->color_mask ); + + ADVANCE_RING(); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= (RADEON_UPLOAD_CONTEXT | + RADEON_UPLOAD_MASKS); + } + + if ( flags & RADEON_FRONT ) { + BEGIN_RING( 6 ); + + OUT_RING( CP_PACKET3( RADEON_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_BRUSH_SOLID_COLOR | + (dev_priv->color_fmt << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_ROP3_P | + RADEON_GMC_CLR_CMP_CNTL_DIS ); + + OUT_RING( dev_priv->front_pitch_offset ); + OUT_RING( clear->clear_color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + + if ( flags & RADEON_BACK ) { + BEGIN_RING( 6 ); + + OUT_RING( CP_PACKET3( RADEON_CNTL_PAINT_MULTI, 4 ) ); + OUT_RING( RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_BRUSH_SOLID_COLOR | + (dev_priv->color_fmt << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_ROP3_P | + RADEON_GMC_CLR_CMP_CNTL_DIS ); + + OUT_RING( dev_priv->back_pitch_offset ); + OUT_RING( clear->clear_color ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + + } + + if ( flags & RADEON_DEPTH ) { + drm_radeon_depth_clear_t *depth_clear = + &dev_priv->depth_clear; + + if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { + radeon_emit_state( dev_priv ); + } + + /* FIXME: Render a rectangle to clear the depth + * buffer. So much for those "fast Z clears"... + */ + BEGIN_RING( 23 ); + + RADEON_WAIT_UNTIL_2D_IDLE(); + + OUT_RING( CP_PACKET0( RADEON_PP_CNTL, 1 ) ); + OUT_RING( 0x00000000 ); + OUT_RING( depth_clear->rb3d_cntl ); + OUT_RING( CP_PACKET0( RADEON_RB3D_ZSTENCILCNTL, 0 ) ); + OUT_RING( depth_clear->rb3d_zstencilcntl ); + OUT_RING( CP_PACKET0( RADEON_RB3D_PLANEMASK, 0 ) ); + OUT_RING( 0x00000000 ); + OUT_RING( CP_PACKET0( RADEON_SE_CNTL, 0 ) ); + OUT_RING( depth_clear->se_cntl ); + + OUT_RING( CP_PACKET3( RADEON_3D_DRAW_IMMD, 10 ) ); + OUT_RING( RADEON_VTX_Z_PRESENT ); + OUT_RING( (RADEON_PRIM_TYPE_RECT_LIST | + RADEON_PRIM_WALK_RING | + RADEON_MAOS_ENABLE | + RADEON_VTX_FMT_RADEON_MODE | + (3 << RADEON_NUM_VERTICES_SHIFT)) ); + + OUT_RING( depth_boxes[i].ui[CLEAR_X1] ); + OUT_RING( depth_boxes[i].ui[CLEAR_Y1] ); + OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); + + OUT_RING( depth_boxes[i].ui[CLEAR_X1] ); + OUT_RING( depth_boxes[i].ui[CLEAR_Y2] ); + OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); + + OUT_RING( depth_boxes[i].ui[CLEAR_X2] ); + OUT_RING( depth_boxes[i].ui[CLEAR_Y2] ); + OUT_RING( depth_boxes[i].ui[CLEAR_DEPTH] ); + + ADVANCE_RING(); + + /* Make sure we restore the 3D state next time. + */ + dev_priv->sarea_priv->dirty |= (RADEON_UPLOAD_CONTEXT | + RADEON_UPLOAD_SETUP | + RADEON_UPLOAD_MASKS); + } + } + + /* Increment the clear counter. The client-side 3D driver must + * wait on this value before performing the clear ioctl. We + * need this because the card's so damned fast... + */ + dev_priv->sarea_priv->last_clear++; + + BEGIN_RING( 4 ); + + RADEON_CLEAR_AGE( dev_priv->sarea_priv->last_clear ); + RADEON_WAIT_UNTIL_IDLE(); + + ADVANCE_RING(); +} + +static void radeon_cp_dispatch_swap( drm_device_t *dev ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + int nbox = sarea_priv->nbox; + drm_clip_rect_t *pbox = sarea_priv->boxes; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + +#if RADEON_PERFORMANCE_BOXES + /* Do some trivial performance monitoring... + */ + radeon_cp_performance_boxes( dev_priv ); +#endif + + /* Wait for the 3D stream to idle before dispatching the bitblt. + * This will prevent data corruption between the two streams. + */ + BEGIN_RING( 2 ); + + RADEON_WAIT_UNTIL_3D_IDLE(); + + ADVANCE_RING(); + + for ( i = 0 ; i < nbox ; i++ ) { + int x = pbox[i].x1; + int y = pbox[i].y1; + int w = pbox[i].x2 - x; + int h = pbox[i].y2 - y; + + DRM_DEBUG( "dispatch swap %d,%d-%d,%d\n", + x, y, w, h ); + + BEGIN_RING( 7 ); + + OUT_RING( CP_PACKET3( RADEON_CNTL_BITBLT_MULTI, 5 ) ); + OUT_RING( RADEON_GMC_SRC_PITCH_OFFSET_CNTL | + RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_BRUSH_NONE | + (dev_priv->color_fmt << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_ROP3_S | + RADEON_DP_SRC_SOURCE_MEMORY | + RADEON_GMC_CLR_CMP_CNTL_DIS | + RADEON_GMC_WR_MSK_DIS ); + + OUT_RING( dev_priv->back_pitch_offset ); + OUT_RING( dev_priv->front_pitch_offset ); + + OUT_RING( (x << 16) | y ); + OUT_RING( (x << 16) | y ); + OUT_RING( (w << 16) | h ); + + ADVANCE_RING(); + } + + /* Increment the frame counter. The client-side 3D driver must + * throttle the framerate by waiting for this value before + * performing the swapbuffer ioctl. + */ + dev_priv->sarea_priv->last_frame++; + + BEGIN_RING( 4 ); + + RADEON_FRAME_AGE( dev_priv->sarea_priv->last_frame ); + RADEON_WAIT_UNTIL_2D_IDLE(); + + ADVANCE_RING(); +} + +static void radeon_cp_dispatch_flip( drm_device_t *dev ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + RING_LOCALS; + DRM_DEBUG( "%s: page=%d\n", __FUNCTION__, dev_priv->current_page ); + +#if RADEON_PERFORMANCE_BOXES + /* Do some trivial performance monitoring... + */ + radeon_cp_performance_boxes( dev_priv ); +#endif + + BEGIN_RING( 6 ); + + RADEON_WAIT_UNTIL_3D_IDLE(); + RADEON_WAIT_UNTIL_PAGE_FLIPPED(); + + OUT_RING( CP_PACKET0( RADEON_CRTC_OFFSET, 0 ) ); + + if ( dev_priv->current_page == 0 ) { + OUT_RING( dev_priv->back_offset ); + dev_priv->current_page = 1; + } else { + OUT_RING( dev_priv->front_offset ); + dev_priv->current_page = 0; + } + + ADVANCE_RING(); + + /* Increment the frame counter. The client-side 3D driver must + * throttle the framerate by waiting for this value before + * performing the swapbuffer ioctl. + */ + dev_priv->sarea_priv->last_frame++; + + BEGIN_RING( 2 ); + + RADEON_FRAME_AGE( dev_priv->sarea_priv->last_frame ); + + ADVANCE_RING(); +} + +static void radeon_cp_dispatch_vertex( drm_device_t *dev, + drm_buf_t *buf ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_buf_priv_t *buf_priv = buf->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + int format = sarea_priv->vc_format; + int offset = dev_priv->agp_buffers_offset + buf->offset; + int size = buf->used; + int prim = buf_priv->prim; + int i = 0; + RING_LOCALS; + DRM_DEBUG( "%s: nbox=%d\n", __FUNCTION__, sarea_priv->nbox ); + + if ( 0 ) + radeon_print_dirty( "dispatch_vertex", sarea_priv->dirty ); + + if ( buf->used ) { + buf_priv->dispatched = 1; + + if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { + radeon_emit_state( dev_priv ); + } + + do { + /* Emit the next set of up to three cliprects */ + if ( i < sarea_priv->nbox ) { + radeon_emit_clip_rect( dev_priv, + &sarea_priv->boxes[i] ); + } + + /* Emit the vertex buffer rendering commands */ + BEGIN_RING( 5 ); + + OUT_RING( CP_PACKET3( RADEON_3D_RNDR_GEN_INDX_PRIM, 3 ) ); + OUT_RING( offset ); + OUT_RING( size ); + OUT_RING( format ); + OUT_RING( prim | RADEON_PRIM_WALK_LIST | + RADEON_COLOR_ORDER_RGBA | + RADEON_VTX_FMT_RADEON_MODE | + (size << RADEON_NUM_VERTICES_SHIFT) ); + + ADVANCE_RING(); + + i++; + } while ( i < sarea_priv->nbox ); + } + + if ( buf_priv->discard ) { + buf_priv->age = dev_priv->sarea_priv->last_dispatch; + + /* Emit the vertex buffer age */ + BEGIN_RING( 2 ); + RADEON_DISPATCH_AGE( buf_priv->age ); + ADVANCE_RING(); + + buf->pending = 1; + buf->used = 0; + /* FIXME: Check dispatched field */ + buf_priv->dispatched = 0; + } + + dev_priv->sarea_priv->last_dispatch++; + + sarea_priv->dirty &= ~RADEON_UPLOAD_CLIPRECTS; + sarea_priv->nbox = 0; +} + + +static void radeon_cp_dispatch_indirect( drm_device_t *dev, + drm_buf_t *buf, + int start, int end ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_buf_priv_t *buf_priv = buf->dev_private; + RING_LOCALS; + DRM_DEBUG( "indirect: buf=%d s=0x%x e=0x%x\n", + buf->idx, start, end ); + + if ( start != end ) { + int offset = (dev_priv->agp_buffers_offset + + buf->offset + start); + int dwords = (end - start + 3) / sizeof(u32); + + /* Indirect buffer data must be an even number of + * dwords, so if we've been given an odd number we must + * pad the data with a Type-2 CP packet. + */ + if ( dwords & 1 ) { + u32 *data = (u32 *) + ((char *)dev_priv->buffers->handle + + buf->offset + start); + data[dwords++] = RADEON_CP_PACKET2; + } + + buf_priv->dispatched = 1; + + /* Fire off the indirect buffer */ + BEGIN_RING( 3 ); + + OUT_RING( CP_PACKET0( RADEON_CP_IB_BASE, 1 ) ); + OUT_RING( offset ); + OUT_RING( dwords ); + + ADVANCE_RING(); + } + + if ( buf_priv->discard ) { + buf_priv->age = dev_priv->sarea_priv->last_dispatch; + + /* Emit the indirect buffer age */ + BEGIN_RING( 2 ); + RADEON_DISPATCH_AGE( buf_priv->age ); + ADVANCE_RING(); + + buf->pending = 1; + buf->used = 0; + /* FIXME: Check dispatched field */ + buf_priv->dispatched = 0; + } + + dev_priv->sarea_priv->last_dispatch++; +} + +static void radeon_cp_dispatch_indices( drm_device_t *dev, + drm_buf_t *buf, + int start, int end, + int count ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_buf_priv_t *buf_priv = buf->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + int format = sarea_priv->vc_format; + int offset = dev_priv->agp_buffers_offset; + int prim = buf_priv->prim; + u32 *data; + int dwords; + int i = 0; + RING_LOCALS; + DRM_DEBUG( "indices: s=%d e=%d c=%d\n", start, end, count ); + + if ( 0 ) + radeon_print_dirty( "dispatch_indices", sarea_priv->dirty ); + + if ( start != end ) { + buf_priv->dispatched = 1; + + if ( sarea_priv->dirty & ~RADEON_UPLOAD_CLIPRECTS ) { + radeon_emit_state( dev_priv ); + } + + dwords = (end - start + 3) / sizeof(u32); + + data = (u32 *)((char *)dev_priv->buffers->handle + + buf->offset + start); + + data[0] = CP_PACKET3( RADEON_3D_RNDR_GEN_INDX_PRIM, dwords-2 ); + + data[1] = offset; + data[2] = RADEON_MAX_VB_VERTS; + data[3] = format; + data[4] = (prim | RADEON_PRIM_WALK_IND | + RADEON_COLOR_ORDER_RGBA | + RADEON_VTX_FMT_RADEON_MODE | + (count << RADEON_NUM_VERTICES_SHIFT) ); + + if ( count & 0x1 ) { + data[dwords-1] &= 0x0000ffff; + } + + do { + /* Emit the next set of up to three cliprects */ + if ( i < sarea_priv->nbox ) { + radeon_emit_clip_rect( dev_priv, + &sarea_priv->boxes[i] ); + } + + radeon_cp_dispatch_indirect( dev, buf, start, end ); + + i++; + } while ( i < sarea_priv->nbox ); + } + + if ( buf_priv->discard ) { + buf_priv->age = dev_priv->sarea_priv->last_dispatch; + + /* Emit the vertex buffer age */ + BEGIN_RING( 2 ); + RADEON_DISPATCH_AGE( buf_priv->age ); + ADVANCE_RING(); + + buf->pending = 1; + /* FIXME: Check dispatched field */ + buf_priv->dispatched = 0; + } + + dev_priv->sarea_priv->last_dispatch++; + + sarea_priv->dirty &= ~RADEON_UPLOAD_CLIPRECTS; + sarea_priv->nbox = 0; +} + +#define RADEON_MAX_TEXTURE_SIZE (RADEON_BUFFER_SIZE - 8 * sizeof(u32)) + +static int radeon_cp_dispatch_texture( drm_device_t *dev, + drm_radeon_texture_t *tex, + drm_radeon_tex_image_t *image ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_buf_t *buf; + drm_radeon_buf_priv_t *buf_priv; + u32 format; + u32 *buffer; + u8 *data; + int size, dwords, tex_width, blit_width; + u32 y, height; + int ret = 0, i; + RING_LOCALS; + + /* FIXME: Be smarter about this... + */ + buf = radeon_freelist_get( dev ); + if ( !buf ) return -EAGAIN; + + DRM_DEBUG( "tex: ofs=0x%x p=%d f=%d x=%hd y=%hd w=%hd h=%hd\n", + tex->offset >> 10, tex->pitch, tex->format, + image->x, image->y, image->width, image->height ); + + buf_priv = buf->dev_private; + + /* The compiler won't optimize away a division by a variable, + * even if the only legal values are powers of two. Thus, we'll + * use a shift instead. + */ + switch ( tex->format ) { + case RADEON_TXFORMAT_ARGB8888: + case RADEON_TXFORMAT_RGBA8888: + format = RADEON_COLOR_FORMAT_ARGB8888; + tex_width = tex->width * 4; + blit_width = image->width * 4; + break; + case RADEON_TXFORMAT_AI88: + case RADEON_TXFORMAT_ARGB1555: + case RADEON_TXFORMAT_RGB565: + case RADEON_TXFORMAT_ARGB4444: + format = RADEON_COLOR_FORMAT_RGB565; + tex_width = tex->width * 2; + blit_width = image->width * 2; + break; + case RADEON_TXFORMAT_I8: + case RADEON_TXFORMAT_RGB332: + format = RADEON_COLOR_FORMAT_CI8; + tex_width = tex->width * 1; + blit_width = image->width * 1; + break; + default: + DRM_ERROR( "invalid texture format %d\n", tex->format ); + return -EINVAL; + } + + DRM_DEBUG( " tex=%dx%d blit=%d\n", + tex_width, tex->height, blit_width ); + + /* Flush the pixel cache. This ensures no pixel data gets mixed + * up with the texture data from the host data blit, otherwise + * part of the texture image may be corrupted. + */ + BEGIN_RING( 4 ); + + RADEON_FLUSH_CACHE(); + RADEON_WAIT_UNTIL_IDLE(); + + ADVANCE_RING(); + + /* Make a copy of the parameters in case we have to update them + * for a multi-pass texture blit. + */ + y = image->y; + height = image->height; + data = (u8 *)image->data; + + size = height * blit_width; + + if ( size > RADEON_MAX_TEXTURE_SIZE ) { + /* Texture image is too large, do a multipass upload */ + ret = -EAGAIN; + + /* Adjust the blit size to fit the indirect buffer */ + height = RADEON_MAX_TEXTURE_SIZE / blit_width; + size = height * blit_width; + + /* Update the input parameters for next time */ + image->y += height; + image->height -= height; + image->data = (char *)image->data + size; + + if ( copy_to_user( tex->image, image, sizeof(*image) ) ) { + DRM_ERROR( "EFAULT on tex->image\n" ); + return -EFAULT; + } + } else if ( size < 4 ) { + size = 4; + } + + dwords = size / 4; + + /* Dispatch the indirect buffer. + */ + buffer = (u32 *)((char *)dev_priv->buffers->handle + buf->offset); + + buffer[0] = CP_PACKET3( RADEON_CNTL_HOSTDATA_BLT, dwords + 6 ); + buffer[1] = (RADEON_GMC_DST_PITCH_OFFSET_CNTL | + RADEON_GMC_BRUSH_NONE | + (format << 8) | + RADEON_GMC_SRC_DATATYPE_COLOR | + RADEON_ROP3_S | + RADEON_DP_SRC_SOURCE_HOST_DATA | + RADEON_GMC_CLR_CMP_CNTL_DIS | + RADEON_GMC_WR_MSK_DIS); + + buffer[2] = (tex->pitch << 22) | (tex->offset >> 10); + buffer[3] = 0xffffffff; + buffer[4] = 0xffffffff; + buffer[5] = (y << 16) | image->x; + buffer[6] = (height << 16) | image->width; + buffer[7] = dwords; + + buffer += 8; + + if ( tex_width >= 32 ) { + /* Texture image width is larger than the minimum, so we + * can upload it directly. + */ + if ( copy_from_user( buffer, data, dwords * sizeof(u32) ) ) { + DRM_ERROR( "EFAULT on data, %d dwords\n", dwords ); + return -EFAULT; + } + } else { + /* Texture image width is less than the minimum, so we + * need to pad out each image scanline to the minimum + * width. + */ + for ( i = 0 ; i < tex->height ; i++ ) { + if ( copy_from_user( buffer, data, tex_width ) ) { + DRM_ERROR( "EFAULT on pad, %d bytes\n", + tex_width ); + return -EFAULT; + } + buffer += 8; + data += tex_width; + } + } + + buf->pid = current->pid; + buf->used = (dwords + 8) * sizeof(u32); + buf_priv->discard = 1; + + radeon_cp_dispatch_indirect( dev, buf, 0, buf->used ); + + /* Flush the pixel cache after the blit completes. This ensures + * the texture data is written out to memory before rendering + * continues. + */ + BEGIN_RING( 4 ); + + RADEON_FLUSH_CACHE(); + RADEON_WAIT_UNTIL_2D_IDLE(); + + ADVANCE_RING(); + + return ret; +} + +static void radeon_cp_dispatch_stipple( drm_device_t *dev, u32 *stipple ) +{ + drm_radeon_private_t *dev_priv = dev->dev_private; + int i; + RING_LOCALS; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + BEGIN_RING( 35 ); + + OUT_RING( CP_PACKET0( RADEON_RE_STIPPLE_ADDR, 0 ) ); + OUT_RING( 0x00000000 ); + + OUT_RING( CP_PACKET0_TABLE( RADEON_RE_STIPPLE_DATA, 31 ) ); + for ( i = 0 ; i < 32 ; i++ ) { + OUT_RING( stipple[i] ); + } + + ADVANCE_RING(); +} + + +/* ================================================================ + * IOCTL functions + */ + +int radeon_cp_clear( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + drm_radeon_clear_t clear; + drm_radeon_clear_rect_t depth_boxes[RADEON_NR_SAREA_CLIPRECTS]; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); + + if ( copy_from_user( &clear, (drm_radeon_clear_t *)arg, + sizeof(clear) ) ) + return -EFAULT; + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS; + + if ( copy_from_user( &depth_boxes, clear.depth_boxes, + sarea_priv->nbox * sizeof(depth_boxes[0]) ) ) + return -EFAULT; + + radeon_cp_dispatch_clear( dev, &clear, depth_boxes ); + + return 0; +} + +int radeon_cp_swap( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_sarea_t *sarea_priv = dev_priv->sarea_priv; + DRM_DEBUG( "%s\n", __FUNCTION__ ); + + LOCK_TEST_WITH_RETURN( dev ); + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + if ( sarea_priv->nbox > RADEON_NR_SAREA_CLIPRECTS ) + sarea_priv->nbox = RADEON_NR_SAREA_CLIPRECTS; + + if ( !dev_priv->page_flipping ) { + radeon_cp_dispatch_swap( dev ); + dev_priv->sarea_priv->dirty |= (RADEON_UPLOAD_CONTEXT | + RADEON_UPLOAD_MASKS); + } else { + radeon_cp_dispatch_flip( dev ); + } + + return 0; +} + +int radeon_cp_vertex( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_radeon_buf_priv_t *buf_priv; + drm_radeon_vertex_t vertex; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return -EINVAL; + } + + if ( copy_from_user( &vertex, (drm_radeon_vertex_t *)arg, + sizeof(vertex) ) ) + return -EFAULT; + + DRM_DEBUG( "%s: pid=%d index=%d count=%d discard=%d\n", + __FUNCTION__, current->pid, + vertex.idx, vertex.count, vertex.discard ); + + if ( vertex.idx < 0 || vertex.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + vertex.idx, dma->buf_count - 1 ); + return -EINVAL; + } + if ( vertex.prim < 0 || + vertex.prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST ) { + DRM_ERROR( "buffer prim %d\n", vertex.prim ); + return -EINVAL; + } + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + buf = dma->buflist[vertex.idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != current->pid ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + current->pid, buf->pid ); + return -EINVAL; + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", vertex.idx ); + return -EINVAL; + } + + buf->used = vertex.count; + buf_priv->prim = vertex.prim; + buf_priv->discard = vertex.discard; + + radeon_cp_dispatch_vertex( dev, buf ); + + return 0; +} + +int radeon_cp_indices( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_radeon_buf_priv_t *buf_priv; + drm_radeon_indices_t elts; + int count; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return -EINVAL; + } + + if ( copy_from_user( &elts, (drm_radeon_indices_t *)arg, + sizeof(elts) ) ) + return -EFAULT; + + DRM_DEBUG( "%s: pid=%d index=%d start=%d end=%d discard=%d\n", + __FUNCTION__, current->pid, + elts.idx, elts.start, elts.end, elts.discard ); + + if ( elts.idx < 0 || elts.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + elts.idx, dma->buf_count - 1 ); + return -EINVAL; + } + if ( elts.prim < 0 || + elts.prim > RADEON_PRIM_TYPE_3VRT_LINE_LIST ) { + DRM_ERROR( "buffer prim %d\n", elts.prim ); + return -EINVAL; + } + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + buf = dma->buflist[elts.idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != current->pid ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + current->pid, buf->pid ); + return -EINVAL; + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", elts.idx ); + return -EINVAL; + } + + count = (elts.end - elts.start) / sizeof(u16); + elts.start -= RADEON_INDEX_PRIM_OFFSET; + + if ( elts.start & 0x7 ) { + DRM_ERROR( "misaligned buffer 0x%x\n", elts.start ); + return -EINVAL; + } + if ( elts.start < buf->used ) { + DRM_ERROR( "no header 0x%x - 0x%x\n", elts.start, buf->used ); + return -EINVAL; + } + + buf->used = elts.end; + buf_priv->prim = elts.prim; + buf_priv->discard = elts.discard; + + radeon_cp_dispatch_indices( dev, buf, elts.start, elts.end, count ); + + return 0; +} + +int radeon_cp_texture( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_texture_t tex; + drm_radeon_tex_image_t image; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( copy_from_user( &tex, (drm_radeon_texture_t *)arg, sizeof(tex) ) ) + return -EFAULT; + + if ( tex.image == NULL ) { + DRM_ERROR( "null texture image!\n" ); + return -EINVAL; + } + + if ( copy_from_user( &image, + (drm_radeon_tex_image_t *)tex.image, + sizeof(image) ) ) + return -EFAULT; + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + return radeon_cp_dispatch_texture( dev, &tex, &image ); +} + +int radeon_cp_stipple( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_radeon_stipple_t stipple; + u32 mask[32]; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( copy_from_user( &stipple, (drm_radeon_stipple_t *)arg, + sizeof(stipple) ) ) + return -EFAULT; + + if ( copy_from_user( &mask, stipple.mask, 32 * sizeof(u32) ) ) + return -EFAULT; + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + + radeon_cp_dispatch_stipple( dev, mask ); + + return 0; +} + +int radeon_cp_indirect( struct inode *inode, struct file *filp, + unsigned int cmd, unsigned long arg ) +{ + drm_file_t *priv = filp->private_data; + drm_device_t *dev = priv->dev; + drm_radeon_private_t *dev_priv = dev->dev_private; + drm_device_dma_t *dma = dev->dma; + drm_buf_t *buf; + drm_radeon_buf_priv_t *buf_priv; + drm_radeon_indirect_t indirect; + RING_LOCALS; + + LOCK_TEST_WITH_RETURN( dev ); + + if ( !dev_priv ) { + DRM_ERROR( "%s called with no initialization\n", __FUNCTION__ ); + return -EINVAL; + } + + if ( copy_from_user( &indirect, (drm_radeon_indirect_t *)arg, + sizeof(indirect) ) ) + return -EFAULT; + + DRM_DEBUG( "indirect: idx=%d s=%d e=%d d=%d\n", + indirect.idx, indirect.start, + indirect.end, indirect.discard ); + + if ( indirect.idx < 0 || indirect.idx >= dma->buf_count ) { + DRM_ERROR( "buffer index %d (of %d max)\n", + indirect.idx, dma->buf_count - 1 ); + return -EINVAL; + } + + buf = dma->buflist[indirect.idx]; + buf_priv = buf->dev_private; + + if ( buf->pid != current->pid ) { + DRM_ERROR( "process %d using buffer owned by %d\n", + current->pid, buf->pid ); + return -EINVAL; + } + if ( buf->pending ) { + DRM_ERROR( "sending pending buffer %d\n", indirect.idx ); + return -EINVAL; + } + + if ( indirect.start < buf->used ) { + DRM_ERROR( "reusing indirect: start=0x%x actual=0x%x\n", + indirect.start, buf->used ); + return -EINVAL; + } + + RING_SPACE_TEST_WITH_RETURN( dev_priv ); + VB_AGE_TEST_WITH_RETURN( dev_priv ); + + buf->used = indirect.end; + buf_priv->discard = indirect.discard; + + /* Wait for the 3D stream to idle before the indirect buffer + * containing 2D acceleration commands is processed. + */ + BEGIN_RING( 2 ); + + RADEON_WAIT_UNTIL_3D_IDLE(); + + ADVANCE_RING(); + + /* Dispatch the indirect buffer full of commands from the + * X server. This is insecure and is thus only available to + * privileged clients. + */ + radeon_cp_dispatch_indirect( dev, buf, indirect.start, indirect.end ); + + return 0; +} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h:1.1.2.1 --- /dev/null Mon Jun 4 12:41:27 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h Tue May 22 17:54:54 2001 @@ -0,0 +1,50 @@ +/* sis_drv.h -- Private header for sis driver -*- linux-c -*- + * + * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis.h,v 1.1.2.1 2001/05/22 21:54:54 dawes Exp $ */ + +#ifndef __SIS_H__ +#define __SIS_H__ + +/* This remains constant for all DRM template files. + * Name it sisdrv_##x as there's a conflict with sis_free/malloc in the kernel + * that's used for fb devices + */ +#define DRM(x) sisdrv_##x + +/* General customization: + */ +#define __HAVE_AGP 1 +#define __MUST_HAVE_AGP 0 +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 + +/* Buffer customization: + */ +#define DRIVER_AGP_BUFFERS_MAP( dev ) \ + ((drm_sis_private_t *)((dev)->dev_private))->buffers + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c:1.5 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c:1.5 Fri Dec 1 09:29:02 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_context.c Mon Jun 4 12:41:27 2001 @@ -1,221 +0,0 @@ -/* sis_context.c -- IOCTLs for sis contexts -*- linux-c -*- - * Created: Thu Oct 7 10:50:22 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * 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: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Daryll Strauss <daryll@valinux.com> - * Sung-Ching Lin <sclin@sis.com.tw> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" -#include "sis_drv.h" - -extern drm_ctx_t sis_res_ctx; - -static int sis_alloc_queue(drm_device_t *dev) -{ - return drm_ctxbitmap_next(dev); -} - -int sis_context_switch(drm_device_t *dev, int old, int new) -{ - char buf[64]; - - atomic_inc(&dev->total_ctx); - - if (test_and_set_bit(0, &dev->context_flag)) { - DRM_ERROR("Reentering -- FIXME\n"); - return -EBUSY; - } - -#if DRM_DMA_HISTOGRAM - dev->ctx_start = get_cycles(); -#endif - - DRM_DEBUG("Context switch from %d to %d\n", old, new); - - if (new == dev->last_context) { - clear_bit(0, &dev->context_flag); - return 0; - } - - if (drm_flags & DRM_FLAG_NOCTX) { - sis_context_switch_complete(dev, new); - } else { - sprintf(buf, "C %d %d\n", old, new); - drm_write_string(dev, buf); - } - - return 0; -} - -int sis_context_switch_complete(drm_device_t *dev, int new) -{ - dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ - dev->last_switch = jiffies; - - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("Lock isn't held after context switch\n"); - } - - /* If a context switch is ever initiated - when the kernel holds the lock, release - that lock here. */ -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.ctx[drm_histogram_slot(get_cycles() - - dev->ctx_start)]); - -#endif - clear_bit(0, &dev->context_flag); - wake_up(&dev->context_wait); - - return 0; -} - - -int sis_resctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_res_t res; - drm_ctx_t ctx; - int i; - - DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); - if (copy_from_user(&res, (drm_ctx_res_t *)arg, sizeof(res))) - return -EFAULT; - if (res.count >= DRM_RESERVED_CONTEXTS) { - memset(&ctx, 0, sizeof(ctx)); - for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { - ctx.handle = i; - if (copy_to_user(&res.contexts[i], &i, sizeof(i))) - return -EFAULT; - } - } - res.count = DRM_RESERVED_CONTEXTS; - if (copy_to_user((drm_ctx_res_t *)arg, &res, sizeof(res))) - return -EFAULT; - return 0; -} - - -int sis_addctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - if ((ctx.handle = sis_alloc_queue(dev)) == DRM_KERNEL_CONTEXT) { - /* Skip kernel's context and get a new one. */ - ctx.handle = sis_alloc_queue(dev); - } - DRM_DEBUG("%d\n", ctx.handle); - if (ctx.handle == -1) { - DRM_DEBUG("Not enough free contexts.\n"); - /* Should this return -EBUSY instead? */ - return -ENOMEM; - } - - /* new added */ - sis_init_context(ctx.handle); - - if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx))) - return -EFAULT; - return 0; -} - -int sis_modctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t*)arg, sizeof(ctx))) - return -EFAULT; - if (ctx.flags==_DRM_CONTEXT_PRESERVED) - sis_res_ctx.handle=ctx.handle; - return 0; -} - -int sis_getctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t*)arg, sizeof(ctx))) - return -EFAULT; - /* This is 0, because we don't hanlde any context flags */ - ctx.flags = 0; - if (copy_to_user((drm_ctx_t*)arg, &ctx, sizeof(ctx))) - return -EFAULT; - return 0; -} - -int sis_switchctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - return sis_context_switch(dev, dev->last_context, ctx.handle); -} - -int sis_newctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - sis_context_switch_complete(dev, ctx.handle); - - return 0; -} - -int sis_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - drm_ctxbitmap_free(dev, ctx.handle); - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm.h:1.5 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm.h:1.6.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm.h:1.5 Wed Nov 8 00:03:07 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drm.h Tue May 22 17:25:46 2001 @@ -2,30 +2,35 @@ #ifndef _sis_drm_public_h_ #define _sis_drm_public_h_ -typedef struct { +typedef struct { int context; unsigned int offset; unsigned int size; unsigned int free; -} drm_sis_mem_t; +} drm_sis_mem_t; -typedef struct { +typedef struct { unsigned int offset, size; -} drm_sis_agp_t; +} drm_sis_agp_t; -typedef struct { +typedef struct { unsigned int left, right; -} drm_sis_flip_t; +} drm_sis_flip_t; -#define SIS_IOCTL_FB_ALLOC DRM_IOWR( 0x44, drm_sis_mem_t) -#define SIS_IOCTL_FB_FREE DRM_IOW( 0x45, drm_sis_mem_t) +#ifdef __KERNEL__ -#define SIS_IOCTL_AGP_INIT DRM_IOWR( 0x53, drm_sis_agp_t) -#define SIS_IOCTL_AGP_ALLOC DRM_IOWR( 0x54, drm_sis_mem_t) -#define SIS_IOCTL_AGP_FREE DRM_IOW( 0x55, drm_sis_mem_t) - -#define SIS_IOCTL_FLIP DRM_IOW( 0x48, drm_sis_flip_t) -#define SIS_IOCTL_FLIP_INIT DRM_IO( 0x49) -#define SIS_IOCTL_FLIP_FINAL DRM_IO( 0x50) +int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int sis_fb_free(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); + +int sisp_agp_init(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int sisp_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); +int sisp_agp_free(struct inode *inode, struct file *filp, unsigned int cmd, + unsigned long arg); + +#endif #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c:1.9 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c:1.10.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c:1.9 Fri Dec 1 09:29:03 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.c Tue May 22 17:25:46 2001 @@ -26,669 +26,49 @@ */ #include <linux/config.h> +#include "sis.h" #include "drmP.h" #include "sis_drm.h" #include "sis_drv.h" -#define SIS_NAME "sis" -#define SIS_DESC "SIS 300/630/540" -#define SIS_DATE "20000831" -#define SIS_MAJOR 1 -#define SIS_MINOR 0 -#define SIS_PATCHLEVEL 0 - -static drm_device_t sis_device; -drm_ctx_t sis_res_ctx; - -static struct file_operations sis_fops = { -#if LINUX_VERSION_CODE >= 0x020400 - /* This started being used during 2.4.0-test */ - owner: THIS_MODULE, -#endif - open: sis_open, - flush: drm_flush, - release: sis_release, - ioctl: sis_ioctl, - mmap: drm_mmap, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, -}; - -static struct miscdevice sis_misc = { - minor: MISC_DYNAMIC_MINOR, - name: SIS_NAME, - fops: &sis_fops, -}; - -static drm_ioctl_desc_t sis_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { sis_version, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_busid, 0, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { sis_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { sis_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { sis_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { sis_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { sis_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { sis_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { sis_resctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { sis_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { sis_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = {drm_agp_info, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = {drm_agp_alloc, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = {drm_agp_free, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = {drm_agp_bind, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = {drm_agp_unbind, 1, 1}, -#endif - /* FB Memory Management */ - [DRM_IOCTL_NR(SIS_IOCTL_FB_ALLOC)] = { sis_fb_alloc, 1, 1 }, - [DRM_IOCTL_NR(SIS_IOCTL_FB_FREE)] = { sis_fb_free, 1, 1 }, - - /* AGP Memory Management */ - [DRM_IOCTL_NR(SIS_IOCTL_AGP_INIT)] = { sis_agp_init, 1, 1 }, - [DRM_IOCTL_NR(SIS_IOCTL_AGP_ALLOC)] = { sis_agp_alloc, 1, 1 }, - [DRM_IOCTL_NR(SIS_IOCTL_AGP_FREE)] = { sis_agp_free, 1, 1 }, - -#if defined(SIS_STEREO) - [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { sis_control, 1, 1 }, - [DRM_IOCTL_NR(SIS_IOCTL_FLIP)] = { sis_flip, 1, 1 }, - [DRM_IOCTL_NR(SIS_IOCTL_FLIP_INIT)] = { sis_flip_init, 1, 1 }, - [DRM_IOCTL_NR(SIS_IOCTL_FLIP_FINAL)] = { sis_flip_final, 1, 1 }, -#endif -}; -#define SIS_IOCTL_COUNT DRM_ARRAY_SIZE(sis_ioctls) - -#ifdef MODULE -static char *sis = NULL; -#endif - -MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("sis"); -MODULE_PARM(sis, "s"); - -#ifndef MODULE -/* sis_options is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_drm. - */ - -static int __init sis_options(char *str) -{ - drm_parse_options(str); - return 1; -} - -__setup("sis=", sis_options); -#endif - -static int sis_setup(drm_device_t *dev) -{ - int i; - - atomic_set(&dev->ioctl_count, 0); - atomic_set(&dev->vma_count, 0); - dev->buf_use = 0; - atomic_set(&dev->buf_alloc, 0); - - atomic_set(&dev->total_open, 0); - atomic_set(&dev->total_close, 0); - atomic_set(&dev->total_ioctl, 0); - atomic_set(&dev->total_irq, 0); - atomic_set(&dev->total_ctx, 0); - atomic_set(&dev->total_locks, 0); - atomic_set(&dev->total_unlocks, 0); - atomic_set(&dev->total_contends, 0); - atomic_set(&dev->total_sleeps, 0); - - for (i = 0; i < DRM_HASH_SIZE; i++) { - dev->magiclist[i].head = NULL; - dev->magiclist[i].tail = NULL; - } - dev->maplist = NULL; - dev->map_count = 0; - dev->vmalist = NULL; - dev->lock.hw_lock = NULL; - init_waitqueue_head(&dev->lock.lock_queue); - dev->queue_count = 0; - dev->queue_reserved = 0; - dev->queue_slots = 0; - dev->queuelist = NULL; - dev->irq = 0; - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma = 0; - dev->dma_flag = 0; - dev->last_context = 0; - dev->last_switch = 0; - dev->last_checked = 0; - init_timer(&dev->timer); - init_waitqueue_head(&dev->context_wait); - - dev->ctx_start = 0; - dev->lck_start = 0; - - dev->buf_rp = dev->buf; - dev->buf_wp = dev->buf; - dev->buf_end = dev->buf + DRM_BSZ; - dev->buf_async = NULL; - init_waitqueue_head(&dev->buf_readers); - init_waitqueue_head(&dev->buf_writers); - - sis_res_ctx.handle=-1; - - DRM_DEBUG("\n"); - - /* The kernel's context could be created here, but is now created - in drm_dma_enqueue. This is more resource-efficient for - hardware that does not do DMA, but may mean that - drm_select_queue fails between the time the interrupt is - initialized and the time the queues are initialized. */ - - return 0; -} - - -static int sis_takedown(drm_device_t *dev) -{ - int i; - drm_magic_entry_t *pt, *next; - drm_map_t *map; - drm_vma_entry_t *vma, *vma_next; - - DRM_DEBUG("\n"); - -#if defined(SIS_STEREO) - if (dev->irq) sis_irq_uninstall(dev); -#endif - - down(&dev->struct_sem); - del_timer(&dev->timer); - - if (dev->devname) { - drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); - dev->devname = NULL; - } - - if (dev->unique) { - drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); - dev->unique = NULL; - dev->unique_len = 0; - } - /* Clear pid list */ - for (i = 0; i < DRM_HASH_SIZE; i++) { - for (pt = dev->magiclist[i].head; pt; pt = next) { - next = pt->next; - drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); - } - dev->magiclist[i].head = dev->magiclist[i].tail = NULL; - } -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - /* Clear AGP information */ - if (dev->agp) { - drm_agp_mem_t *temp; - drm_agp_mem_t *temp_next; - - temp = dev->agp->memory; - while(temp != NULL) { - temp_next = temp->next; - drm_free_agp(temp->memory, temp->pages); - drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); - temp = temp_next; - } - if (dev->agp->acquired) _drm_agp_release(); - } -#endif - /* Clear vma list (only built for debugging) */ - if (dev->vmalist) { - for (vma = dev->vmalist; vma; vma = vma_next) { - vma_next = vma->next; - drm_free(vma, sizeof(*vma), DRM_MEM_VMAS); - } - dev->vmalist = NULL; - } - - /* Clear map area and mtrr information */ - if (dev->maplist) { - for (i = 0; i < dev->map_count; i++) { - map = dev->maplist[i]; - switch (map->type) { - case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: -#ifdef CONFIG_MTRR - if (map->mtrr >= 0) { - int retcode; - retcode = mtrr_del(map->mtrr, - map->offset, - map->size); - DRM_DEBUG("mtrr_del = %d\n", retcode); - } -#endif - drm_ioremapfree(map->handle, map->size); - break; - case _DRM_SHM: - drm_free_pages((unsigned long)map->handle, - drm_order(map->size) - - PAGE_SHIFT, - DRM_MEM_SAREA); - break; - case _DRM_AGP: - /* Do nothing here, because this is all - handled in the AGP/GART driver. */ - break; - } - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - } - drm_free(dev->maplist, - dev->map_count * sizeof(*dev->maplist), - DRM_MEM_MAPS); - dev->maplist = NULL; - dev->map_count = 0; - } - - if (dev->lock.hw_lock) { - dev->lock.hw_lock = NULL; /* SHM removed */ - dev->lock.pid = 0; - wake_up_interruptible(&dev->lock.lock_queue); - } - up(&dev->struct_sem); - - return 0; -} - -/* sis_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). */ - -static int sis_init(void) -{ - int retcode; - drm_device_t *dev = &sis_device; - - DRM_DEBUG("\n"); - - memset((void *)dev, 0, sizeof(*dev)); - dev->count_lock = SPIN_LOCK_UNLOCKED; - sema_init(&dev->struct_sem, 1); - -#ifdef MODULE - drm_parse_options(sis); -#endif - - if ((retcode = misc_register(&sis_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", SIS_NAME); - return retcode; - } - dev->device = MKDEV(MISC_MAJOR, sis_misc.minor); - dev->name = SIS_NAME; - - drm_mem_init(); - drm_proc_init(dev); -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - dev->agp = drm_agp_init(); -#endif - if((retcode = drm_ctxbitmap_init(dev))) { - DRM_ERROR("Cannot allocate memory for context bitmap.\n"); - drm_proc_cleanup(); - misc_deregister(&sis_misc); - sis_takedown(dev); - return retcode; - } - - DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", - SIS_NAME, - SIS_MAJOR, - SIS_MINOR, - SIS_PATCHLEVEL, - SIS_DATE, - sis_misc.minor); - - return 0; -} - -/* sis_cleanup is called via cleanup_module at module unload time. */ - -static void sis_cleanup(void) -{ - drm_device_t *dev = &sis_device; - - DRM_DEBUG("\n"); - - drm_proc_cleanup(); - if (misc_deregister(&sis_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } - drm_ctxbitmap_cleanup(dev); - sis_takedown(dev); -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - if (dev->agp) { - drm_agp_uninit(); - drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); - dev->agp = NULL; - } -#endif -} - -module_init(sis_init); -module_exit(sis_cleanup); - - -int sis_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_version_t version; - int len; - - if (copy_from_user(&version, (drm_version_t *)arg, sizeof(version))) - return -EFAULT; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ - } - - version.version_major = SIS_MAJOR; - version.version_minor = SIS_MINOR; - version.version_patchlevel = SIS_PATCHLEVEL; - - DRM_COPY(version.name, SIS_NAME); - DRM_COPY(version.date, SIS_DATE); - DRM_COPY(version.desc, SIS_DESC); - - if (copy_to_user((drm_version_t *)arg, &version, sizeof(version))) - return -EFAULT; - return 0; -} - -int sis_open(struct inode *inode, struct file *filp) -{ - drm_device_t *dev = &sis_device; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_open_helper(inode, filp, dev))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_open); - spin_lock(&dev->count_lock); - if (!dev->open_count++) { - spin_unlock(&dev->count_lock); - return sis_setup(dev); - } - spin_unlock(&dev->count_lock); - } - return retcode; -} - -int sis_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_release(inode, filp))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_close); - spin_lock(&dev->count_lock); - if (!--dev->open_count) { - if (atomic_read(&dev->ioctl_count) || dev->blocked) { - DRM_ERROR("Device busy: %d %d\n", - atomic_read(&dev->ioctl_count), - dev->blocked); - spin_unlock(&dev->count_lock); - unlock_kernel(); - return -EBUSY; - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return sis_takedown(dev); - } - spin_unlock(&dev->count_lock); - } - - unlock_kernel(); - return retcode; -} - -/* sis_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -int sis_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - int nr = DRM_IOCTL_NR(cmd); - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int retcode = 0; - drm_ioctl_desc_t *ioctl; - drm_ioctl_t *func; - - atomic_inc(&dev->ioctl_count); - atomic_inc(&dev->total_ioctl); - ++priv->ioctl_count; - - DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", - current->pid, cmd, nr, dev->device, priv->authenticated); - - if (nr >= SIS_IOCTL_COUNT) { - retcode = -EINVAL; - } else { - ioctl = &sis_ioctls[nr]; - func = ioctl->func; - - if (!func) { - DRM_DEBUG("no function\n"); - retcode = -EINVAL; - } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN)) - || (ioctl->auth_needed && !priv->authenticated)) { - retcode = -EACCES; - } else { - retcode = (func)(inode, filp, cmd, arg); - } - } - - atomic_dec(&dev->ioctl_count); - return retcode; -} - -int sis_lock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - DECLARE_WAITQUEUE(entry, current); - int ret = 0; - drm_lock_t lock; -#if DRM_DMA_HISTOGRAM - cycles_t start; - - dev->lck_start = start = get_cycles(); -#endif - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } - - DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", - lock.context, current->pid, dev->lock.hw_lock->lock, - lock.flags); - -#if 0 - /* dev->queue_count == 0 right now for - sis. FIXME? */ - if (lock.context < 0 || lock.context >= dev->queue_count) - return -EINVAL; -#endif - - if (!ret) { -#if 0 - if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) - != lock.context) { - long j = jiffies - dev->lock.lock_time; - - if (lock.context == sis_res_ctx.handle && - j >= 0 && j < DRM_LOCK_SLICE) { - /* Can't take lock if we just had it and - there is contention. */ - DRM_DEBUG("%d (pid %d) delayed j=%d dev=%d jiffies=%d\n", - lock.context, current->pid, j, - dev->lock.lock_time, jiffies); - current->state = TASK_INTERRUPTIBLE; - current->policy |= SCHED_YIELD; - schedule_timeout(DRM_LOCK_SLICE-j); - DRM_DEBUG("jiffies=%d\n", jiffies); - } - } -#endif - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - ret = -EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - lock.context)) { - dev->lock.pid = current->pid; - dev->lock.lock_time = jiffies; - atomic_inc(&dev->total_locks); - break; /* Got lock */ - } - - /* Contention */ - atomic_inc(&dev->total_sleeps); -#if 1 - current->policy |= SCHED_YIELD; -#endif - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - } - -#if 0 - if (!ret && dev->last_context != lock.context && - lock.context != sis_res_ctx.handle && - dev->last_context != sis_res_ctx.handle) { - add_wait_queue(&dev->context_wait, &entry); - current->state = TASK_INTERRUPTIBLE; - /* PRE: dev->last_context != lock.context */ - sis_context_switch(dev, dev->last_context, lock.context); - /* POST: we will wait for the context - switch and will dispatch on a later call - when dev->last_context == lock.context - NOTE WE HOLD THE LOCK THROUGHOUT THIS - TIME! */ - current->policy |= SCHED_YIELD; - schedule(); - current->state = TASK_RUNNING; - remove_wait_queue(&dev->context_wait, &entry); - if (signal_pending(current)) { - ret = -EINTR; - } else if (dev->last_context != lock.context) { - DRM_ERROR("Context mismatch: %d %d\n", - dev->last_context, lock.context); - } - } -#endif - - if (!ret) { - sigemptyset(&dev->sigmask); - sigaddset(&dev->sigmask, SIGSTOP); - sigaddset(&dev->sigmask, SIGTSTP); - sigaddset(&dev->sigmask, SIGTTIN); - sigaddset(&dev->sigmask, SIGTTOU); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); - - if (lock.flags & _DRM_LOCK_READY) { - /* Wait for space in DMA/FIFO */ - } - if (lock.flags & _DRM_LOCK_QUIESCENT) { - /* Make hardware quiescent */ -#if 0 - sis_quiescent(dev); -#endif - } - } - - DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); - -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]); -#endif - - return ret; -} - - -int sis_unlock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_lock_t lock; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } - - DRM_DEBUG("%d frees lock (%d holds)\n", - lock.context, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - atomic_inc(&dev->total_unlocks); - if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock)) - atomic_inc(&dev->total_contends); - drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT); - /* FIXME: Try to send data to card here */ - if (!dev->context_flag) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } - } - - unblock_all_signals(); - return 0; -} +#define DRIVER_AUTHOR "SIS" +#define DRIVER_NAME "sis" +#define DRIVER_DESC "SIS 300/630/540" +#define DRIVER_DATE "20010503" +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 + +#define DRIVER_IOCTLS \ + [DRM_IOCTL_NR(SIS_IOCTL_FB_ALLOC)] = { sis_fb_alloc, 1, 1 }, \ + [DRM_IOCTL_NR(SIS_IOCTL_FB_FREE)] = { sis_fb_free, 1, 1 }, \ + /* AGP Memory Management */ \ + [DRM_IOCTL_NR(SIS_IOCTL_AGP_INIT)] = { sisp_agp_init, 1, 1 }, \ + [DRM_IOCTL_NR(SIS_IOCTL_AGP_ALLOC)] = { sisp_agp_alloc, 1, 1 }, \ + [DRM_IOCTL_NR(SIS_IOCTL_AGP_FREE)] = { sisp_agp_free, 1, 1 } +#if 0 /* these don't appear to be defined */ + /* SIS Stereo */ + [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = { sis_control, 1, 1 }, + [DRM_IOCTL_NR(SIS_IOCTL_FLIP)] = { sis_flip, 1, 1 }, + [DRM_IOCTL_NR(SIS_IOCTL_FLIP_INIT)] = { sis_flip_init, 1, 1 }, + [DRM_IOCTL_NR(SIS_IOCTL_FLIP_FINAL)] = { sis_flip_final, 1, 1 } +#endif + +#define __HAVE_COUNTERS 5 + +#include "drm_auth.h" +#include "drm_agpsupport.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lists.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.h:1.5 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.h:1.6 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.h:1.5 Tue Sep 26 12:21:25 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_drv.h Fri May 18 20:26:46 2001 @@ -28,54 +28,12 @@ #ifndef _SIS_DRV_H_ #define _SIS_DRV_H_ - /* sis_drv.c */ -extern int sis_version(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int sis_open(struct inode *inode, struct file *filp); -extern int sis_release(struct inode *inode, struct file *filp); -extern int sis_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int sis_irq_install(drm_device_t *dev, int irq); -extern int sis_irq_uninstall(drm_device_t *dev); -extern int sis_control(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int sis_lock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int sis_unlock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); +typedef struct drm_sis_private { + drm_map_t *buffers; +} drm_sis_private_t; - /* sis_context.c */ +/* Stereo ? - this was never committed */ -extern int sis_resctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int sis_addctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int sis_modctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int sis_getctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int sis_switchctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int sis_newctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int sis_rmctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -extern int sis_context_switch(drm_device_t *dev, int old, int new); -extern int sis_context_switch_complete(drm_device_t *dev, int new); - -int sis_fb_alloc(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg); -int sis_fb_free(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg); - -int sis_agp_init(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg); -int sis_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg); -int sis_agp_free(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg); - int sis_flip(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); int sis_flip_init(struct inode *inode, struct file *filp, unsigned int cmd, @@ -83,8 +41,5 @@ int sis_flip_final(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg); void flip_final(void); - -int sis_init_context(int contexy); -int sis_final_context(int context); #endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c:1.8 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c:1.9.2.1 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c:1.8 Fri Dec 1 09:29:03 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/sis_mm.c Tue May 22 17:25:46 2001 @@ -29,10 +29,12 @@ */ #define __NO_VERSION__ +#include "sis.h" +#include <linux/sisfb.h> #include "drmP.h" #include "sis_drm.h" -#include "sis_ds.h" #include "sis_drv.h" +#include "sis_ds.h" #define MAX_CONTEXT 100 #define VIDEO_TYPE 0 @@ -149,7 +151,7 @@ static memHeap_t *AgpHeap = NULL; -int sis_agp_init(struct inode *inode, struct file *filp, unsigned int cmd, +int sisp_agp_init(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_sis_agp_t agp; @@ -164,7 +166,7 @@ return 0; } -int sis_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd, +int sisp_agp_alloc(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_sis_mem_t agp; @@ -201,7 +203,7 @@ return retval; } -int sis_agp_free(struct inode *inode, struct file *filp, unsigned int cmd, +int sisp_agp_free(struct inode *inode, struct file *filp, unsigned int cmd, unsigned long arg) { drm_sis_mem_t agp; @@ -277,7 +279,9 @@ retval = setFirst(set, &item); while(retval){ DRM_DEBUG("free video memory 0x%x\n", item); +#if 0 sis_free(item); +#endif retval = setNext(set, &item); } setDestroy(set); Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h:1.1 --- /dev/null Mon Jun 4 12:41:28 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/stubsupport-pre24.h Wed Mar 21 13:08:56 2001 @@ -0,0 +1,44 @@ +/* stubsupport.h -- -*- linux-c -*- + * Created: Fri Jan 19 10:48:35 2001 by faith@acm.org + * + * Copyright 2001 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + * Authors: + * Rickard E. (Rik) Faith <faith@valinux.com> + * + */ + +#ifndef _STUBSUPPORT_PRE24_H_ +#define _STUBSUPPORT_PRE24_H_ +struct drm_stub_info *DRM(_stub_pointer) = NULL; +#define inter_module_put(x) +#define inter_module_unregister(x) +#define inter_module_get(x) DRM(_stub_pointer) +#define inter_module_register(x,y,z) do { DRM(_stub_pointer) = z; } while (0) + + /* This is a kludge for backward compatibility + that is only useful in DRM(stub_open) */ +#define fops_put(fops) MOD_DEC_USE_COUNT +#define fops_get(fops) (fops); MOD_INC_USE_COUNT + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx.h diff -u /dev/null xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx.h:1.1 --- /dev/null Mon Jun 4 12:41:28 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx.h Wed Mar 21 13:08:56 2001 @@ -0,0 +1,42 @@ +/* tdfx.h -- 3dfx DRM template customization -*- linux-c -*- + * Created: Wed Feb 14 12:32:32 2001 by gareth@valinux.com + * + * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. + * All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Authors: + * Gareth Hughes <gareth@valinux.com> + */ + +#ifndef __TDFX_H__ +#define __TDFX_H__ + +/* This remains constant for all DRM template files. + */ +#define DRM(x) tdfx_##x + +/* General customization: + */ +#define __HAVE_MTRR 1 +#define __HAVE_CTX_BITMAP 1 + +#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_context.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_context.c:1.7 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_context.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_context.c:1.7 Tue Sep 26 12:21:25 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_context.c Mon Jun 4 12:41:28 2001 @@ -1,219 +0,0 @@ -/* tdfx_context.c -- IOCTLs for tdfx contexts -*- linux-c -*- - * Created: Thu Oct 7 10:50:22 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Daryll Strauss <daryll@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" -#include "tdfx_drv.h" - -extern drm_ctx_t tdfx_res_ctx; - -static int tdfx_alloc_queue(drm_device_t *dev) -{ - return drm_ctxbitmap_next(dev); -} - -int tdfx_context_switch(drm_device_t *dev, int old, int new) -{ - char buf[64]; - - atomic_inc(&dev->total_ctx); - - if (test_and_set_bit(0, &dev->context_flag)) { - DRM_ERROR("Reentering -- FIXME\n"); - return -EBUSY; - } - -#if DRM_DMA_HISTOGRAM - dev->ctx_start = get_cycles(); -#endif - - DRM_DEBUG("Context switch from %d to %d\n", old, new); - - if (new == dev->last_context) { - clear_bit(0, &dev->context_flag); - return 0; - } - - if (drm_flags & DRM_FLAG_NOCTX) { - tdfx_context_switch_complete(dev, new); - } else { - sprintf(buf, "C %d %d\n", old, new); - drm_write_string(dev, buf); - } - - return 0; -} - -int tdfx_context_switch_complete(drm_device_t *dev, int new) -{ - dev->last_context = new; /* PRE/POST: This is the _only_ writer. */ - dev->last_switch = jiffies; - - if (!_DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock)) { - DRM_ERROR("Lock isn't held after context switch\n"); - } - - /* If a context switch is ever initiated - when the kernel holds the lock, release - that lock here. */ -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.ctx[drm_histogram_slot(get_cycles() - - dev->ctx_start)]); - -#endif - clear_bit(0, &dev->context_flag); - wake_up(&dev->context_wait); - - return 0; -} - - -int tdfx_resctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_res_t res; - drm_ctx_t ctx; - int i; - - DRM_DEBUG("%d\n", DRM_RESERVED_CONTEXTS); - if (copy_from_user(&res, (drm_ctx_res_t *)arg, sizeof(res))) - return -EFAULT; - if (res.count >= DRM_RESERVED_CONTEXTS) { - memset(&ctx, 0, sizeof(ctx)); - for (i = 0; i < DRM_RESERVED_CONTEXTS; i++) { - ctx.handle = i; - if (copy_to_user(&res.contexts[i], - &i, - sizeof(i))) - return -EFAULT; - } - } - res.count = DRM_RESERVED_CONTEXTS; - if (copy_to_user((drm_ctx_res_t *)arg, &res, sizeof(res))) - return -EFAULT; - return 0; -} - - -int tdfx_addctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - if ((ctx.handle = tdfx_alloc_queue(dev)) == DRM_KERNEL_CONTEXT) { - /* Skip kernel's context and get a new one. */ - ctx.handle = tdfx_alloc_queue(dev); - } - DRM_DEBUG("%d\n", ctx.handle); - if (ctx.handle == -1) { - DRM_DEBUG("Not enough free contexts.\n"); - /* Should this return -EBUSY instead? */ - return -ENOMEM; - } - - if (copy_to_user((drm_ctx_t *)arg, &ctx, sizeof(ctx))) - return -EFAULT; - return 0; -} - -int tdfx_modctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t*)arg, sizeof(ctx))) - return -EFAULT; - if (ctx.flags==_DRM_CONTEXT_PRESERVED) - tdfx_res_ctx.handle=ctx.handle; - return 0; -} - -int tdfx_getctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t*)arg, sizeof(ctx))) - return -EFAULT; - /* This is 0, because we don't handle any context flags */ - ctx.flags = 0; - if (copy_to_user((drm_ctx_t*)arg, &ctx, sizeof(ctx))) - return -EFAULT; - return 0; -} - -int tdfx_switchctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - return tdfx_context_switch(dev, dev->last_context, ctx.handle); -} - -int tdfx_newctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - tdfx_context_switch_complete(dev, ctx.handle); - - return 0; -} - -int tdfx_rmctx(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_ctx_t ctx; - - if (copy_from_user(&ctx, (drm_ctx_t *)arg, sizeof(ctx))) - return -EFAULT; - DRM_DEBUG("%d\n", ctx.handle); - drm_ctxbitmap_free(dev, ctx.handle); - - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c:1.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c:1.11 --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c:1.10 Fri Dec 1 09:29:03 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.c Wed Mar 21 13:08:56 2001 @@ -27,670 +27,35 @@ * Authors: * Rickard E. (Rik) Faith <faith@valinux.com> * Daryll Strauss <daryll@valinux.com> - * + * Gareth Hughes <gareth@valinux.com> */ #include <linux/config.h> +#include "tdfx.h" #include "drmP.h" -#include "tdfx_drv.h" -#define TDFX_NAME "tdfx" -#define TDFX_DESC "3dfx Banshee/Voodoo3+" -#define TDFX_DATE "20000928" -#define TDFX_MAJOR 1 -#define TDFX_MINOR 0 -#define TDFX_PATCHLEVEL 0 +#define DRIVER_AUTHOR "VA Linux Systems Inc." -static drm_device_t tdfx_device; -drm_ctx_t tdfx_res_ctx; - -static struct file_operations tdfx_fops = { -#if LINUX_VERSION_CODE >= 0x020400 - /* This started being used during 2.4.0-test */ - owner: THIS_MODULE, -#endif - open: tdfx_open, - flush: drm_flush, - release: tdfx_release, - ioctl: tdfx_ioctl, - mmap: drm_mmap, - read: drm_read, - fasync: drm_fasync, - poll: drm_poll, -}; - -static struct miscdevice tdfx_misc = { - minor: MISC_DYNAMIC_MINOR, - name: TDFX_NAME, - fops: &tdfx_fops, -}; - -static drm_ioctl_desc_t tdfx_ioctls[] = { - [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = { tdfx_version, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = { drm_getunique, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = { drm_getmagic, 0, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = { drm_irq_busid, 0, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = { drm_setunique, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = { drm_block, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = { drm_unblock, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = { drm_authmagic, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = { drm_addmap, 1, 1 }, - - [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = { tdfx_addctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = { tdfx_rmctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = { tdfx_modctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = { tdfx_getctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = { tdfx_switchctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = { tdfx_newctx, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = { tdfx_resctx, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = { drm_adddraw, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = { drm_rmdraw, 1, 1 }, - [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = { tdfx_lock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = { tdfx_unlock, 1, 0 }, - [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = { drm_finish, 1, 0 }, -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = {drm_agp_info, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = {drm_agp_alloc, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = {drm_agp_free, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = {drm_agp_unbind, 1, 1}, - [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = {drm_agp_bind, 1, 1}, -#endif -}; -#define TDFX_IOCTL_COUNT DRM_ARRAY_SIZE(tdfx_ioctls) - -#ifdef MODULE -static char *tdfx = NULL; -#endif - -MODULE_AUTHOR("VA Linux Systems, Inc."); -MODULE_DESCRIPTION("tdfx"); -MODULE_PARM(tdfx, "s"); - -#ifndef MODULE -/* tdfx_options is called by the kernel to parse command-line options - * passed via the boot-loader (e.g., LILO). It calls the insmod option - * routine, drm_parse_drm. - */ - -static int __init tdfx_options(char *str) -{ - drm_parse_options(str); - return 1; -} - -__setup("tdfx=", tdfx_options); -#endif - -static int tdfx_setup(drm_device_t *dev) -{ - int i; - - atomic_set(&dev->ioctl_count, 0); - atomic_set(&dev->vma_count, 0); - dev->buf_use = 0; - atomic_set(&dev->buf_alloc, 0); - - atomic_set(&dev->total_open, 0); - atomic_set(&dev->total_close, 0); - atomic_set(&dev->total_ioctl, 0); - atomic_set(&dev->total_irq, 0); - atomic_set(&dev->total_ctx, 0); - atomic_set(&dev->total_locks, 0); - atomic_set(&dev->total_unlocks, 0); - atomic_set(&dev->total_contends, 0); - atomic_set(&dev->total_sleeps, 0); - - for (i = 0; i < DRM_HASH_SIZE; i++) { - dev->magiclist[i].head = NULL; - dev->magiclist[i].tail = NULL; - } - dev->maplist = NULL; - dev->map_count = 0; - dev->vmalist = NULL; - dev->lock.hw_lock = NULL; - init_waitqueue_head(&dev->lock.lock_queue); - dev->queue_count = 0; - dev->queue_reserved = 0; - dev->queue_slots = 0; - dev->queuelist = NULL; - dev->irq = 0; - dev->context_flag = 0; - dev->interrupt_flag = 0; - dev->dma = 0; - dev->dma_flag = 0; - dev->last_context = 0; - dev->last_switch = 0; - dev->last_checked = 0; - init_timer(&dev->timer); - init_waitqueue_head(&dev->context_wait); - - dev->ctx_start = 0; - dev->lck_start = 0; - - dev->buf_rp = dev->buf; - dev->buf_wp = dev->buf; - dev->buf_end = dev->buf + DRM_BSZ; - dev->buf_async = NULL; - init_waitqueue_head(&dev->buf_readers); - init_waitqueue_head(&dev->buf_writers); - - tdfx_res_ctx.handle=-1; - - DRM_DEBUG("\n"); - - /* The kernel's context could be created here, but is now created - in drm_dma_enqueue. This is more resource-efficient for - hardware that does not do DMA, but may mean that - drm_select_queue fails between the time the interrupt is - initialized and the time the queues are initialized. */ - - return 0; -} - - -static int tdfx_takedown(drm_device_t *dev) -{ - int i; - drm_magic_entry_t *pt, *next; - drm_map_t *map; - drm_vma_entry_t *vma, *vma_next; - - DRM_DEBUG("\n"); - - down(&dev->struct_sem); - del_timer(&dev->timer); - - if (dev->devname) { - drm_free(dev->devname, strlen(dev->devname)+1, DRM_MEM_DRIVER); - dev->devname = NULL; - } - - if (dev->unique) { - drm_free(dev->unique, strlen(dev->unique)+1, DRM_MEM_DRIVER); - dev->unique = NULL; - dev->unique_len = 0; - } - /* Clear pid list */ - for (i = 0; i < DRM_HASH_SIZE; i++) { - for (pt = dev->magiclist[i].head; pt; pt = next) { - next = pt->next; - drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); - } - dev->magiclist[i].head = dev->magiclist[i].tail = NULL; - } -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - /* Clear AGP information */ - if (dev->agp) { - drm_agp_mem_t *temp; - drm_agp_mem_t *temp_next; - - temp = dev->agp->memory; - while(temp != NULL) { - temp_next = temp->next; - drm_free_agp(temp->memory, temp->pages); - drm_free(temp, sizeof(*temp), DRM_MEM_AGPLISTS); - temp = temp_next; - } - if (dev->agp->acquired) _drm_agp_release(); - } -#endif - /* Clear vma list (only built for debugging) */ - if (dev->vmalist) { - for (vma = dev->vmalist; vma; vma = vma_next) { - vma_next = vma->next; - drm_free(vma, sizeof(*vma), DRM_MEM_VMAS); - } - dev->vmalist = NULL; - } - - /* Clear map area and mtrr information */ - if (dev->maplist) { - for (i = 0; i < dev->map_count; i++) { - map = dev->maplist[i]; - switch (map->type) { - case _DRM_REGISTERS: - case _DRM_FRAME_BUFFER: -#ifdef CONFIG_MTRR - if (map->mtrr >= 0) { - int retcode; - retcode = mtrr_del(map->mtrr, - map->offset, - map->size); - DRM_DEBUG("mtrr_del = %d\n", retcode); - } -#endif - drm_ioremapfree(map->handle, map->size); - break; - case _DRM_SHM: - drm_free_pages((unsigned long)map->handle, - drm_order(map->size) - - PAGE_SHIFT, - DRM_MEM_SAREA); - break; - case _DRM_AGP: - /* Do nothing here, because this is all - handled in the AGP/GART driver. */ - break; - } - drm_free(map, sizeof(*map), DRM_MEM_MAPS); - } - drm_free(dev->maplist, - dev->map_count * sizeof(*dev->maplist), - DRM_MEM_MAPS); - dev->maplist = NULL; - dev->map_count = 0; - } - - if (dev->lock.hw_lock) { - dev->lock.hw_lock = NULL; /* SHM removed */ - dev->lock.pid = 0; - wake_up_interruptible(&dev->lock.lock_queue); - } - up(&dev->struct_sem); - - return 0; -} - -/* tdfx_init is called via init_module at module load time, or via - * linux/init/main.c (this is not currently supported). */ - -static int __init tdfx_init(void) -{ - int retcode; - drm_device_t *dev = &tdfx_device; - - DRM_DEBUG("\n"); - - memset((void *)dev, 0, sizeof(*dev)); - dev->count_lock = SPIN_LOCK_UNLOCKED; - sema_init(&dev->struct_sem, 1); - -#ifdef MODULE - drm_parse_options(tdfx); -#endif - - if ((retcode = misc_register(&tdfx_misc))) { - DRM_ERROR("Cannot register \"%s\"\n", TDFX_NAME); - return retcode; - } - dev->device = MKDEV(MISC_MAJOR, tdfx_misc.minor); - dev->name = TDFX_NAME; - - drm_mem_init(); - drm_proc_init(dev); -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - dev->agp = drm_agp_init(); -#endif - if((retcode = drm_ctxbitmap_init(dev))) { - DRM_ERROR("Cannot allocate memory for context bitmap.\n"); - drm_proc_cleanup(); - misc_deregister(&tdfx_misc); - tdfx_takedown(dev); - return retcode; - } - - DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n", - TDFX_NAME, - TDFX_MAJOR, - TDFX_MINOR, - TDFX_PATCHLEVEL, - TDFX_DATE, - tdfx_misc.minor); - - return 0; -} - -/* tdfx_cleanup is called via cleanup_module at module unload time. */ - -static void __exit tdfx_cleanup(void) -{ - drm_device_t *dev = &tdfx_device; - - DRM_DEBUG("\n"); - - drm_proc_cleanup(); - if (misc_deregister(&tdfx_misc)) { - DRM_ERROR("Cannot unload module\n"); - } else { - DRM_INFO("Module unloaded\n"); - } - drm_ctxbitmap_cleanup(dev); - tdfx_takedown(dev); -#if defined(CONFIG_AGP) || defined(CONFIG_AGP_MODULE) - if (dev->agp) { - drm_agp_uninit(); - drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS); - dev->agp = NULL; - } -#endif -} - -module_init(tdfx_init); -module_exit(tdfx_cleanup); - - -int tdfx_version(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_version_t version; - int len; - - if (copy_from_user(&version, - (drm_version_t *)arg, - sizeof(version))) - return -EFAULT; - -#define DRM_COPY(name,value) \ - len = strlen(value); \ - if (len > name##_len) len = name##_len; \ - name##_len = strlen(value); \ - if (len && name) { \ - if (copy_to_user(name, value, len)) \ - return -EFAULT; \ - } - - version.version_major = TDFX_MAJOR; - version.version_minor = TDFX_MINOR; - version.version_patchlevel = TDFX_PATCHLEVEL; - - DRM_COPY(version.name, TDFX_NAME); - DRM_COPY(version.date, TDFX_DATE); - DRM_COPY(version.desc, TDFX_DESC); - - if (copy_to_user((drm_version_t *)arg, - &version, - sizeof(version))) - return -EFAULT; - return 0; -} - -int tdfx_open(struct inode *inode, struct file *filp) -{ - drm_device_t *dev = &tdfx_device; - int retcode = 0; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_open_helper(inode, filp, dev))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_open); - spin_lock(&dev->count_lock); - if (!dev->open_count++) { - spin_unlock(&dev->count_lock); - return tdfx_setup(dev); - } - spin_unlock(&dev->count_lock); - } - return retcode; -} - -int tdfx_release(struct inode *inode, struct file *filp) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - int retcode = 0; - - lock_kernel(); - dev = priv->dev; - - DRM_DEBUG("open_count = %d\n", dev->open_count); - if (!(retcode = drm_release(inode, filp))) { -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_inc(&dev->total_close); - spin_lock(&dev->count_lock); - if (!--dev->open_count) { - if (atomic_read(&dev->ioctl_count) || dev->blocked) { - DRM_ERROR("Device busy: %d %d\n", - atomic_read(&dev->ioctl_count), - dev->blocked); - spin_unlock(&dev->count_lock); - unlock_kernel(); - return -EBUSY; - } - spin_unlock(&dev->count_lock); - unlock_kernel(); - return tdfx_takedown(dev); - } - spin_unlock(&dev->count_lock); - } - - unlock_kernel(); - return retcode; -} - -/* tdfx_ioctl is called whenever a process performs an ioctl on /dev/drm. */ - -int tdfx_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - int nr = DRM_IOCTL_NR(cmd); - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - int retcode = 0; - drm_ioctl_desc_t *ioctl; - drm_ioctl_t *func; - - atomic_inc(&dev->ioctl_count); - atomic_inc(&dev->total_ioctl); - ++priv->ioctl_count; - - DRM_DEBUG("pid = %d, cmd = 0x%02x, nr = 0x%02x, dev 0x%x, auth = %d\n", - current->pid, cmd, nr, dev->device, priv->authenticated); - - if (nr >= TDFX_IOCTL_COUNT) { - retcode = -EINVAL; - } else { - ioctl = &tdfx_ioctls[nr]; - func = ioctl->func; - - if (!func) { - DRM_DEBUG("no function\n"); - retcode = -EINVAL; - } else if ((ioctl->root_only && !capable(CAP_SYS_ADMIN)) - || (ioctl->auth_needed && !priv->authenticated)) { - retcode = -EACCES; - } else { - retcode = (func)(inode, filp, cmd, arg); - } - } - - atomic_dec(&dev->ioctl_count); - return retcode; -} - -int tdfx_lock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - DECLARE_WAITQUEUE(entry, current); - int ret = 0; - drm_lock_t lock; -#if DRM_DMA_HISTOGRAM - cycles_t start; - - dev->lck_start = start = get_cycles(); -#endif - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } - - DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n", - lock.context, current->pid, dev->lock.hw_lock->lock, - lock.flags); - -#if 0 - /* dev->queue_count == 0 right now for - tdfx. FIXME? */ - if (lock.context < 0 || lock.context >= dev->queue_count) - return -EINVAL; -#endif - - if (!ret) { -#if 0 - if (_DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) - != lock.context) { - long j = jiffies - dev->lock.lock_time; - - if (lock.context == tdfx_res_ctx.handle && - j >= 0 && j < DRM_LOCK_SLICE) { - /* Can't take lock if we just had it and - there is contention. */ - DRM_DEBUG("%d (pid %d) delayed j=%d dev=%d jiffies=%d\n", - lock.context, current->pid, j, - dev->lock.lock_time, jiffies); - current->state = TASK_INTERRUPTIBLE; - current->policy |= SCHED_YIELD; - schedule_timeout(DRM_LOCK_SLICE-j); - DRM_DEBUG("jiffies=%d\n", jiffies); - } - } -#endif - add_wait_queue(&dev->lock.lock_queue, &entry); - for (;;) { - current->state = TASK_INTERRUPTIBLE; - if (!dev->lock.hw_lock) { - /* Device has been unregistered */ - ret = -EINTR; - break; - } - if (drm_lock_take(&dev->lock.hw_lock->lock, - lock.context)) { - dev->lock.pid = current->pid; - dev->lock.lock_time = jiffies; - atomic_inc(&dev->total_locks); - break; /* Got lock */ - } - - /* Contention */ - atomic_inc(&dev->total_sleeps); -#if 1 - current->policy |= SCHED_YIELD; -#endif - schedule(); - if (signal_pending(current)) { - ret = -ERESTARTSYS; - break; - } - } - current->state = TASK_RUNNING; - remove_wait_queue(&dev->lock.lock_queue, &entry); - } - -#if 0 - if (!ret && dev->last_context != lock.context && - lock.context != tdfx_res_ctx.handle && - dev->last_context != tdfx_res_ctx.handle) { - add_wait_queue(&dev->context_wait, &entry); - current->state = TASK_INTERRUPTIBLE; - /* PRE: dev->last_context != lock.context */ - tdfx_context_switch(dev, dev->last_context, lock.context); - /* POST: we will wait for the context - switch and will dispatch on a later call - when dev->last_context == lock.context - NOTE WE HOLD THE LOCK THROUGHOUT THIS - TIME! */ - current->policy |= SCHED_YIELD; - schedule(); - current->state = TASK_RUNNING; - remove_wait_queue(&dev->context_wait, &entry); - if (signal_pending(current)) { - ret = -EINTR; - } else if (dev->last_context != lock.context) { - DRM_ERROR("Context mismatch: %d %d\n", - dev->last_context, lock.context); - } - } -#endif - - if (!ret) { - sigemptyset(&dev->sigmask); - sigaddset(&dev->sigmask, SIGSTOP); - sigaddset(&dev->sigmask, SIGTSTP); - sigaddset(&dev->sigmask, SIGTTIN); - sigaddset(&dev->sigmask, SIGTTOU); - dev->sigdata.context = lock.context; - dev->sigdata.lock = dev->lock.hw_lock; - block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask); - - if (lock.flags & _DRM_LOCK_READY) { - /* Wait for space in DMA/FIFO */ - } - if (lock.flags & _DRM_LOCK_QUIESCENT) { - /* Make hardware quiescent */ -#if 0 - tdfx_quiescent(dev); -#endif - } - } - -#if LINUX_VERSION_CODE < 0x020400 - if (lock.context != tdfx_res_ctx.handle) { - current->counter = 5; - current->priority = DEF_PRIORITY/4; - } -#endif - DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock"); - -#if DRM_DMA_HISTOGRAM - atomic_inc(&dev->histo.lacq[drm_histogram_slot(get_cycles() - start)]); -#endif - - return ret; -} - - -int tdfx_unlock(struct inode *inode, struct file *filp, unsigned int cmd, - unsigned long arg) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_lock_t lock; - - if (copy_from_user(&lock, (drm_lock_t *)arg, sizeof(lock))) - return -EFAULT; - - if (lock.context == DRM_KERNEL_CONTEXT) { - DRM_ERROR("Process %d using kernel context %d\n", - current->pid, lock.context); - return -EINVAL; - } - - DRM_DEBUG("%d frees lock (%d holds)\n", - lock.context, - _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock)); - atomic_inc(&dev->total_unlocks); - if (_DRM_LOCK_IS_CONT(dev->lock.hw_lock->lock)) - atomic_inc(&dev->total_contends); - drm_lock_transfer(dev, &dev->lock.hw_lock->lock, DRM_KERNEL_CONTEXT); - /* FIXME: Try to send data to card here */ - if (!dev->context_flag) { - if (drm_lock_free(dev, &dev->lock.hw_lock->lock, - DRM_KERNEL_CONTEXT)) { - DRM_ERROR("\n"); - } - } - -#if LINUX_VERSION_CODE < 0x020400 - if (lock.context != tdfx_res_ctx.handle) { - current->counter = 5; - current->priority = DEF_PRIORITY; - } -#endif - - unblock_all_signals(); - return 0; -} +#define DRIVER_NAME "tdfx" +#define DRIVER_DESC "3dfx Banshee/Voodoo3+" +#define DRIVER_DATE "20010216" + +#define DRIVER_MAJOR 1 +#define DRIVER_MINOR 0 +#define DRIVER_PATCHLEVEL 0 + + +#include "drm_auth.h" +#include "drm_bufs.h" +#include "drm_context.h" +#include "drm_dma.h" +#include "drm_drawable.h" +#include "drm_drv.h" +#include "drm_fops.h" +#include "drm_init.h" +#include "drm_ioctl.h" +#include "drm_lock.h" +#include "drm_memory.h" +#include "drm_proc.h" +#include "drm_vm.h" +#include "drm_stub.h" Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.h diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.h:1.6 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.h:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.h:1.6 Tue Sep 26 12:21:26 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/tdfx_drv.h Mon Jun 4 12:41:28 2001 @@ -1,67 +0,0 @@ -/* tdfx_drv.h -- Private header for tdfx driver -*- linux-c -*- - * Created: Thu Oct 7 10:40:04 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * Daryll Strauss <daryll@valinux.com> - * - */ - -#ifndef _TDFX_DRV_H_ -#define _TDFX_DRV_H_ - - /* tdfx_drv.c */ -extern int tdfx_version(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int tdfx_open(struct inode *inode, struct file *filp); -extern int tdfx_release(struct inode *inode, struct file *filp); -extern int tdfx_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int tdfx_lock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int tdfx_unlock(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - - /* tdfx_context.c */ - -extern int tdfx_resctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int tdfx_addctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int tdfx_modctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int tdfx_getctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int tdfx_switchctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int tdfx_newctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); -extern int tdfx_rmctx(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg); - -extern int tdfx_context_switch(drm_device_t *dev, int old, int new); -extern int tdfx_context_switch_complete(drm_device_t *dev, int new); -#endif Index: xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c:1.10 xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c:removed --- xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c:1.10 Wed Nov 8 00:03:07 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel/vm.c Mon Jun 4 12:41:28 2001 @@ -1,370 +0,0 @@ -/* vm.c -- Memory mapping for DRM -*- linux-c -*- - * Created: Mon Jan 4 08:58:31 1999 by faith@precisioninsight.com - * - * Copyright 1999 Precision Insight, Inc., Cedar Park, Texas. - * Copyright 2000 VA Linux Systems, Inc., Sunnyvale, California. - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PRECISION INSIGHT AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - * Authors: - * Rickard E. (Rik) Faith <faith@valinux.com> - * - */ - -#define __NO_VERSION__ -#include "drmP.h" - -struct vm_operations_struct drm_vm_ops = { - nopage: drm_vm_nopage, - open: drm_vm_open, - close: drm_vm_close, -}; - -struct vm_operations_struct drm_vm_shm_ops = { - nopage: drm_vm_shm_nopage, - open: drm_vm_open, - close: drm_vm_close, -}; - -struct vm_operations_struct drm_vm_shm_lock_ops = { - nopage: drm_vm_shm_nopage_lock, - open: drm_vm_open, - close: drm_vm_close, -}; - -struct vm_operations_struct drm_vm_dma_ops = { - nopage: drm_vm_dma_nopage, - open: drm_vm_open, - close: drm_vm_close, -}; - -#if LINUX_VERSION_CODE < 0x020317 -unsigned long drm_vm_nopage(struct vm_area_struct *vma, - unsigned long address, - int write_access) -#else - /* Return type changed in 2.3.23 */ -struct page *drm_vm_nopage(struct vm_area_struct *vma, - unsigned long address, - int write_access) -#endif -{ - return NOPAGE_SIGBUS; /* Disallow mremap */ -} - -#if LINUX_VERSION_CODE < 0x020317 -unsigned long drm_vm_shm_nopage(struct vm_area_struct *vma, - unsigned long address, - int write_access) -#else - /* Return type changed in 2.3.23 */ -struct page *drm_vm_shm_nopage(struct vm_area_struct *vma, - unsigned long address, - int write_access) -#endif -{ -#if LINUX_VERSION_CODE >= 0x020300 - drm_map_t *map = (drm_map_t *)vma->vm_private_data; -#else - drm_map_t *map = (drm_map_t *)vma->vm_pte; -#endif - unsigned long physical; - unsigned long offset; - - if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ - if (!map) return NOPAGE_OOM; /* Nothing allocated */ - - offset = address - vma->vm_start; - physical = (unsigned long)map->handle + offset; - atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */ - - DRM_DEBUG("0x%08lx => 0x%08lx\n", address, physical); -#if LINUX_VERSION_CODE < 0x020317 - return physical; -#else - return virt_to_page(physical); -#endif -} - -#if LINUX_VERSION_CODE < 0x020317 -unsigned long drm_vm_shm_nopage_lock(struct vm_area_struct *vma, - unsigned long address, - int write_access) -#else - /* Return type changed in 2.3.23 */ -struct page *drm_vm_shm_nopage_lock(struct vm_area_struct *vma, - unsigned long address, - int write_access) -#endif -{ - drm_file_t *priv = vma->vm_file->private_data; - drm_device_t *dev = priv->dev; - unsigned long physical; - unsigned long offset; - unsigned long page; - - if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ - if (!dev->lock.hw_lock) return NOPAGE_OOM; /* Nothing allocated */ - - offset = address - vma->vm_start; - page = offset >> PAGE_SHIFT; - physical = (unsigned long)dev->lock.hw_lock + offset; - atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */ - - DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical); -#if LINUX_VERSION_CODE < 0x020317 - return physical; -#else - return virt_to_page(physical); -#endif -} - -#if LINUX_VERSION_CODE < 0x020317 -unsigned long drm_vm_dma_nopage(struct vm_area_struct *vma, - unsigned long address, - int write_access) -#else - /* Return type changed in 2.3.23 */ -struct page *drm_vm_dma_nopage(struct vm_area_struct *vma, - unsigned long address, - int write_access) -#endif -{ - drm_file_t *priv = vma->vm_file->private_data; - drm_device_t *dev = priv->dev; - drm_device_dma_t *dma = dev->dma; - unsigned long physical; - unsigned long offset; - unsigned long page; - - if (!dma) return NOPAGE_SIGBUS; /* Error */ - if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */ - if (!dma->pagelist) return NOPAGE_OOM ; /* Nothing allocated */ - - offset = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */ - page = offset >> PAGE_SHIFT; - physical = dma->pagelist[page] + (offset & (~PAGE_MASK)); - atomic_inc(&virt_to_page(physical)->count); /* Dec. by kernel */ - - DRM_DEBUG("0x%08lx (page %lu) => 0x%08lx\n", address, page, physical); -#if LINUX_VERSION_CODE < 0x020317 - return physical; -#else - return virt_to_page(physical); -#endif -} - -void drm_vm_open(struct vm_area_struct *vma) -{ - drm_file_t *priv = vma->vm_file->private_data; - drm_device_t *dev = priv->dev; -#if DRM_DEBUG_CODE - drm_vma_entry_t *vma_entry; -#endif - - DRM_DEBUG("0x%08lx,0x%08lx\n", - vma->vm_start, vma->vm_end - vma->vm_start); - atomic_inc(&dev->vma_count); -#if LINUX_VERSION_CODE < 0x020333 - /* The map can exist after the fd is closed. */ - MOD_INC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - - -#if DRM_DEBUG_CODE - vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS); - if (vma_entry) { - down(&dev->struct_sem); - vma_entry->vma = vma; - vma_entry->next = dev->vmalist; - vma_entry->pid = current->pid; - dev->vmalist = vma_entry; - up(&dev->struct_sem); - } -#endif -} - -void drm_vm_close(struct vm_area_struct *vma) -{ - drm_file_t *priv = vma->vm_file->private_data; - drm_device_t *dev = priv->dev; -#if DRM_DEBUG_CODE - drm_vma_entry_t *pt, *prev; -#endif - - DRM_DEBUG("0x%08lx,0x%08lx\n", - vma->vm_start, vma->vm_end - vma->vm_start); -#if LINUX_VERSION_CODE < 0x020333 - MOD_DEC_USE_COUNT; /* Needed before Linux 2.3.51 */ -#endif - atomic_dec(&dev->vma_count); - -#if DRM_DEBUG_CODE - down(&dev->struct_sem); - for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) { - if (pt->vma == vma) { - if (prev) { - prev->next = pt->next; - } else { - dev->vmalist = pt->next; - } - drm_free(pt, sizeof(*pt), DRM_MEM_VMAS); - break; - } - } - up(&dev->struct_sem); -#endif -} - -int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev; - drm_device_dma_t *dma; - unsigned long length = vma->vm_end - vma->vm_start; - - lock_kernel(); - dev = priv->dev; - dma = dev->dma; - DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", - vma->vm_start, vma->vm_end, VM_OFFSET(vma)); - - /* Length must match exact page count */ - if (!dma || (length >> PAGE_SHIFT) != dma->page_count) { - unlock_kernel(); - return -EINVAL; - } - unlock_kernel(); - - vma->vm_ops = &drm_vm_dma_ops; - vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ - -#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */ - /* In Linux 2.2.3 and above, this is - handled in do_mmap() in mm/mmap.c. */ - ++filp->f_count; -#endif - vma->vm_file = filp; /* Needed for drm_vm_open() */ - drm_vm_open(vma); - return 0; -} - -int drm_mmap(struct file *filp, struct vm_area_struct *vma) -{ - drm_file_t *priv = filp->private_data; - drm_device_t *dev = priv->dev; - drm_map_t *map = NULL; - int i; - - DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n", - vma->vm_start, vma->vm_end, VM_OFFSET(vma)); - - if (!VM_OFFSET(vma)) return drm_mmap_dma(filp, vma); - - /* A sequential search of a linked list is - fine here because: 1) there will only be - about 5-10 entries in the list and, 2) a - DRI client only has to do this mapping - once, so it doesn't have to be optimized - for performance, even if the list was a - bit longer. */ - for (i = 0; i < dev->map_count; i++) { - map = dev->maplist[i]; - if (map->offset == VM_OFFSET(vma)) break; - } - - if (i >= dev->map_count) return -EINVAL; - if (!map || ((map->flags&_DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN))) - return -EPERM; - - /* Check for valid size. */ - if (map->size != vma->vm_end - vma->vm_start) return -EINVAL; - - if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) { - vma->vm_flags &= VM_MAYWRITE; -#if defined(__i386__) - pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW; -#else - /* Ye gads this is ugly. With more thought - we could move this up higher and use - `protection_map' instead. */ - vma->vm_page_prot = __pgprot(pte_val(pte_wrprotect( - __pte(pgprot_val(vma->vm_page_prot))))); -#endif - } - - switch (map->type) { - case _DRM_FRAME_BUFFER: - case _DRM_REGISTERS: - case _DRM_AGP: - if (VM_OFFSET(vma) >= __pa(high_memory)) { -#if defined(__i386__) - if (boot_cpu_data.x86 > 3 && map->type != _DRM_AGP) { - pgprot_val(vma->vm_page_prot) |= _PAGE_PCD; - pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT; - } -#elif defined(__ia64__) - if (map->type != _DRM_AGP) - vma->vm_page_prot = pgprot_writecombine(vma->vm_page_prot); -#endif - vma->vm_flags |= VM_IO; /* not in core dump */ - } - if (remap_page_range(vma->vm_start, - VM_OFFSET(vma), - vma->vm_end - vma->vm_start, - vma->vm_page_prot)) - return -EAGAIN; - DRM_DEBUG(" Type = %d; start = 0x%lx, end = 0x%lx," - " offset = 0x%lx\n", - map->type, - vma->vm_start, vma->vm_end, VM_OFFSET(vma)); - vma->vm_ops = &drm_vm_ops; - break; - case _DRM_SHM: - if (map->flags & _DRM_CONTAINS_LOCK) - vma->vm_ops = &drm_vm_shm_lock_ops; - else { - vma->vm_ops = &drm_vm_shm_ops; -#if LINUX_VERSION_CODE >= 0x020300 - vma->vm_private_data = (void *)map; -#else - vma->vm_pte = (unsigned long)map; -#endif - } - - /* Don't let this area swap. Change when - DRM_KERNEL advisory is supported. */ - vma->vm_flags |= VM_LOCKED; - break; - default: - return -EINVAL; /* This should never happen. */ - } - vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */ - -#if LINUX_VERSION_CODE < 0x020203 /* KERNEL_VERSION(2,2,3) */ - /* In Linux 2.2.3 and above, this is - handled in do_mmap() in mm/mmap.c. */ - ++filp->f_count; -#endif - vma->vm_file = filp; /* Needed for drm_vm_open() */ - drm_vm_open(vma); - return 0; -} Index: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c diff -u xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c:1.19 xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c:1.24 --- xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c:1.19 Wed Dec 6 10:35:31 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c Tue May 15 06:19:42 2001 @@ -1,10 +1,9 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.19 2000/12/06 15:35:31 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/linux/int10/linux.c,v 1.24 2001/05/15 10:19:42 eich Exp $ */ /* * linux specific part of the int10 module * Copyright 1999 Egbert Eich */ #include "xf86.h" -#include "xf86str.h" #include "xf86_OSproc.h" #include "xf86_ansic.h" #include "xf86Pci.h" @@ -25,15 +24,16 @@ #endif #define ALLOC_ENTRIES(x) ((V_RAM / x) - 1) #define REG pInt +#define SHMERRORPTR (pointer)(-1) static int counter = 0; -static CARD8 read_b(xf86Int10InfoPtr pInt,int addr); -static CARD16 read_w(xf86Int10InfoPtr pInt,int addr); -static CARD32 read_l(xf86Int10InfoPtr pInt,int addr); -static void write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val); -static void write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val); -static void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val); +static CARD8 read_b(xf86Int10InfoPtr pInt, int addr); +static CARD16 read_w(xf86Int10InfoPtr pInt, int addr); +static CARD32 read_l(xf86Int10InfoPtr pInt, int addr); +static void write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val); +static void write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val); +static void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val); int10MemRec linuxMem = { read_b, @@ -62,28 +62,33 @@ int fd; static void* vidMem = NULL; static void* sysMem = NULL; + void *options = NULL; int low_mem; int high_mem; - char *base; - char *base_high; + char *base = SHMERRORPTR; + char *base_high = SHMERRORPTR; int pagesize, cs; legacyVGARec vga; - + xf86int10BiosLocation bios; + screen = (xf86FindScreenForEntity(entityIndex))->scrnIndex; - if (int10skip(xf86Screens[screen],entityIndex)) + + options = xf86HandleInt10Options(xf86Screens[screen],entityIndex); + + if (int10skip(options)) return NULL; if ((!vidMem) || (!sysMem)) { - if ((fd = open(DEV_MEM,O_RDWR,0)) >= 0) { + if ((fd = open(DEV_MEM, O_RDWR, 0)) >= 0) { if (!sysMem) { #ifdef DEBUG ErrorF("Mapping sys bios area\n"); #endif - if ((sysMem = mmap((void *)(SYS_BIOS),BIOS_SIZE,PROT_READ - | PROT_WRITE | PROT_EXEC, - MAP_SHARED | MAP_FIXED,fd, SYS_BIOS)) + if ((sysMem = mmap((void *)(SYS_BIOS), BIOS_SIZE, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_SHARED | MAP_FIXED, fd, SYS_BIOS)) == MAP_FAILED) { - xf86DrvMsg(screen,X_ERROR,"Cannot map SYS BIOS\n"); + xf86DrvMsg(screen, X_ERROR, "Cannot map SYS BIOS\n"); close(fd); goto error0; } @@ -92,33 +97,33 @@ #ifdef DEBUG ErrorF("Mapping VRAM area\n"); #endif - if ((vidMem = mmap((void *)(V_RAM),VRAM_SIZE,PROT_READ - | PROT_WRITE | PROT_EXEC, - MAP_SHARED | MAP_FIXED,fd, V_RAM)) + if ((vidMem = mmap((void *)(V_RAM), VRAM_SIZE, + PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_SHARED | MAP_FIXED, fd, V_RAM)) == MAP_FAILED) { - xf86DrvMsg(screen,X_ERROR,"Cannot map V_RAM\n"); + xf86DrvMsg(screen, X_ERROR, "Cannot map V_RAM\n"); close(fd); goto error0; } } close(fd); } else { - xf86DrvMsg(screen,X_ERROR,"Cannot open %s\n",DEV_MEM); + xf86DrvMsg(screen, X_ERROR, "Cannot open %s\n", DEV_MEM); goto error0; } } - - pInt = (xf86Int10InfoPtr)xnfcalloc(1,sizeof(xf86Int10InfoRec)); + + pInt = (xf86Int10InfoPtr)xnfcalloc(1, sizeof(xf86Int10InfoRec)); pInt->scrnIndex = screen; pInt->entityIndex = entityIndex; if (!xf86Int10ExecSetup(pInt)) goto error0; pInt->mem = &linuxMem; pagesize = getpagesize(); - pInt->private = (pointer)xnfcalloc(1,sizeof(linuxInt10Priv)); + pInt->private = (pointer)xnfcalloc(1, sizeof(linuxInt10Priv)); ((linuxInt10Priv*)pInt->private)->screen = screen; - ((linuxInt10Priv*)pInt->private)->alloc = - (pointer)xnfcalloc(1,ALLOC_ENTRIES(pagesize)); + ((linuxInt10Priv*)pInt->private)->alloc = + (pointer)xnfcalloc(1, ALLOC_ENTRIES(pagesize)); #ifdef DEBUG ErrorF("Mapping high memory area\n"); @@ -135,23 +140,25 @@ ErrorF("Mapping 640kB area\n"); #endif if ((low_mem = shmget(counter++, V_RAM, - IPC_CREAT|SHM_R|SHM_W)) == -1) + IPC_CREAT | SHM_R | SHM_W)) == -1) goto error2; - + ((linuxInt10Priv*)pInt->private)->lowMem = low_mem; - base = shmat(low_mem,0,0); + base = shmat(low_mem, 0, 0); + if (base == SHMERRORPTR) goto error4; ((linuxInt10Priv *)pInt->private)->base = base; - base_high = shmat(high_mem,0,0); - ((linuxInt10Priv *)pInt->private)->base_high = base_high; - - MapCurrentInt10(pInt); + base_high = shmat(high_mem, 0, 0); + if (base_high == SHMERRORPTR) goto error4; + ((linuxInt10Priv*)pInt->private)->base_high = base_high; + + MapCurrentInt10(pInt); Int10Current = pInt; - + #ifdef DEBUG ErrorF("Mapping int area\n"); #endif - if (xf86ReadBIOS(0,0,(unsigned char *)0,LOW_PAGE_SIZE) < 0) { - xf86DrvMsg(screen,X_ERROR,"Cannot read int vect\n"); + if (xf86ReadBIOS(0, 0, (unsigned char *)0, LOW_PAGE_SIZE) < 0) { + xf86DrvMsg(screen, X_ERROR, "Cannot read int vect\n"); goto error3; } @@ -165,34 +172,130 @@ if (xf86ReadBIOS(cs, 0, (pointer)cs, V_BIOS_SIZE) < V_BIOS_SIZE) xf86DrvMsg(screen, X_WARNING, "Unable to retrieve all of segment 0x%06X.\n", cs); - - if (xf86IsEntityPrimary(entityIndex)) { - cs = ((CARD16*)0)[(0x10<<1)+1]; - bios_base = (unsigned char *)(cs << 4); - - if (!int10_check_bios(screen, cs, bios_base)) { - cs = ((CARD16*)0)[(0x42<<1)+1]; + + xf86int10ParseBiosLocation(options,&bios); + + if (xf86IsEntityPrimary(entityIndex) + && !(initPrimary(options))) { + if (bios.bus == BUS_ISA && bios.location.legacy) { + xf86DrvMsg(screen, X_CONFIG, + "Overriding BIOS location: 0x%lx\n", + bios.location.legacy); + cs = bios.location.legacy >> 4; bios_base = (unsigned char *)(cs << 4); if (!int10_check_bios(screen, cs, bios_base)) { - cs = V_BIOS >> 4; + xf86DrvMsg(screen, X_ERROR, + "No V_BIOS at specified address 0x%x\n",cs << 4); + goto error3; + } + } else { + if (bios.bus == BUS_PCI) { + xf86DrvMsg(screen, X_WARNING, + "Option BiosLocation for primary device ignored: " + "It points to PCI.\n"); + xf86DrvMsg(screen, X_WARNING, + "You must set Option InitPrimary also\n"); + } + + cs = ((CARD16*)0)[(0x10<<1) + 1]; + + bios_base = (unsigned char *)(cs << 4); + + if (!int10_check_bios(screen, cs, bios_base)) { + cs = ((CARD16*)0)[(0x42 << 1) + 1]; bios_base = (unsigned char *)(cs << 4); if (!int10_check_bios(screen, cs, bios_base)) { - xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n"); - goto error3; + cs = V_BIOS >> 4; + bios_base = (unsigned char *)(cs << 4); + if (!int10_check_bios(screen, cs, bios_base)) { + xf86DrvMsg(screen, X_ERROR, "No V_BIOS found\n"); + goto error3; + } } } } - xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%x\n",cs); + + xf86DrvMsg(screen, X_INFO, "Primary V_BIOS segment is: 0x%x\n", cs); pInt->BIOSseg = cs; set_return_trap(pInt); } else { - if (!mapPciRom(pInt,(unsigned char *)(V_BIOS))) { - xf86DrvMsg(screen,X_ERROR,"Cannot read V_BIOS\n"); + EntityInfoPtr pEnt = xf86GetEntityInfo(pInt->entityIndex); + BusType location_type; + + if (bios.bus != BUS_NONE) { + switch (location_type = bios.bus) { + case BUS_PCI: + xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: " + "PCI:%i:%i%i\n",bios.location.pci.bus, + bios.location.pci.dev,bios.location.pci.func); + break; + case BUS_ISA: + if (bios.location.legacy) + xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: " + "Legacy:0x%x\n",bios.location.legacy); + else + xf86DrvMsg(screen,X_CONFIG,"Overriding bios location: " + "Legacy\n"); + break; + default: + break; + } + } else + location_type = pEnt->location.type; + + switch (location_type) { + case BUS_PCI: + { + int pci_entity; + + if (bios.bus == BUS_PCI) + pci_entity = xf86GetPciEntity(bios.location.pci.bus, + bios.location.pci.dev, + bios.location.pci.func); + else + pci_entity = pInt->entityIndex; + + if (!mapPciRom(pci_entity, (unsigned char *)(V_BIOS))) { + xf86DrvMsg(screen, X_ERROR, "Cannot read V_BIOS\n"); + goto error3; + } + pInt->BIOSseg = V_BIOS >> 4; + break; + } + case BUS_ISA: + if (bios.bus == BUS_ISA && bios.location.legacy) { + cs = bios.location.legacy >> 4; + bios_base = (unsigned char *)(cs << 4); + if (!int10_check_bios(screen, cs, bios_base)) { + xf86DrvMsg(screen,X_ERROR,"No V_BIOS found " + "on override address 0x%x\n",bios_base); + goto error3; + } + } else { + cs = ((CARD16*)0)[(0x10<<1)+1]; + bios_base = (unsigned char *)(cs << 4); + + if (!int10_check_bios(screen, cs, bios_base)) { + cs = ((CARD16*)0)[(0x42<<1)+1]; + bios_base = (unsigned char *)(cs << 4); + if (!int10_check_bios(screen, cs, bios_base)) { + cs = V_BIOS >> 4; + bios_base = (unsigned char *)(cs << 4); + if (!int10_check_bios(screen, cs, bios_base)) { + xf86DrvMsg(screen,X_ERROR,"No V_BIOS found\n"); + goto error3; + } + } + } + } + xf86DrvMsg(screen,X_INFO,"Primary V_BIOS segment is: 0x%x\n",cs); + pInt->BIOSseg = cs; + break; + default: goto error3; } - - pInt->BIOSseg = V_BIOS >> 4; + xfree(pEnt); pInt->num = 0xe6; reset_int_vect(pInt); set_return_trap(pInt); @@ -201,149 +304,162 @@ UnlockLegacyVGA(screen, &vga); } #ifdef DEBUG - dprint(0xc0000,0x20); + dprint(0xc0000, 0x20); #endif - + return pInt; - - error3: + +error4: + xf86DrvMsg(screen, X_ERROR, "shmat() call retruned errno %d\n", errno); +error3: shmdt(base_high); shmdt(base); shmdt(0); shmdt((char*)HIGH_MEM); - shmctl(low_mem,IPC_RMID,NULL); + shmctl(low_mem, IPC_RMID, NULL); Int10Current = NULL; - error2: - shmctl(high_mem,IPC_RMID,NULL); - error1: +error2: + shmctl(high_mem, IPC_RMID,NULL); +error1: xfree(((linuxInt10Priv*)pInt->private)->alloc); xfree(pInt->private); - error0: +error0: xfree(pInt); return NULL; } -void +Bool MapCurrentInt10(xf86Int10InfoPtr pInt) { + pointer addr; + if (Int10Current) { shmdt(0); shmdt((char*)HIGH_MEM); + } + addr = shmat(((linuxInt10Priv*)pInt->private)->lowMem, (char*)1, SHM_RND); + if (addr == SHMERRORPTR) { + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() low memory\n"); + return FALSE; } - shmat(((linuxInt10Priv *)pInt->private)->lowMem,(char*)1,SHM_RND); - shmat(((linuxInt10Priv *)pInt->private)->highMem,(char*)HIGH_MEM,0); + addr = shmat(((linuxInt10Priv*)pInt->private)->highMem, (char*)HIGH_MEM, 0); + if (addr == SHMERRORPTR) { + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "Cannot shmat() high memory\n"); + return FALSE; + } + return TRUE; } void xf86FreeInt10(xf86Int10InfoPtr pInt) { if (!pInt) - return; + return; if (Int10Current == pInt) { shmdt(0); shmdt((char*)HIGH_MEM); Int10Current = NULL; } - shmdt(((linuxInt10Priv *)pInt->private)->base_high); - shmdt(((linuxInt10Priv *)pInt->private)->base); - shmctl(((linuxInt10Priv *)pInt->private)->lowMem,IPC_RMID,NULL); - shmctl(((linuxInt10Priv *)pInt->private)->highMem,IPC_RMID,NULL); + shmdt(((linuxInt10Priv*)pInt->private)->base_high); + shmdt(((linuxInt10Priv*)pInt->private)->base); + shmctl(((linuxInt10Priv*)pInt->private)->lowMem, IPC_RMID, NULL); + shmctl(((linuxInt10Priv*)pInt->private)->highMem, IPC_RMID, NULL); xfree(((linuxInt10Priv*)pInt->private)->alloc); xfree(pInt->private); + xfree(pInt->cpuRegs); xfree(pInt); } void * -xf86Int10AllocPages(xf86Int10InfoPtr pInt,int num, int *off) +xf86Int10AllocPages(xf86Int10InfoPtr pInt, int num, int *off) { int pagesize = getpagesize(); int num_pages = ALLOC_ENTRIES(pagesize); - int i,j; + int i, j; - for (i=0;i<num_pages - num;i++) { + for (i = 0; i < (num_pages - num); i++) { if (((linuxInt10Priv*)pInt->private)->alloc[i] == 0) { - for (j=i;j < num + i;j++) + for (j = i; j < (num + i); j++) if ((((linuxInt10Priv*)pInt->private)->alloc[j] != 0)) break; - if (j == num + i) + if (j == (num + i)) break; else i = i + num; } } - if (i == num_pages - num) + if (i == (num_pages - num)) return NULL; - - for (j = i; j < i + num; j++) + + for (j = i; j < (i + num); j++) ((linuxInt10Priv*)pInt->private)->alloc[j] = 1; *off = (i + 1) * pagesize; - - return (void *) - (((linuxInt10Priv*)pInt->private)->base + (i + 1) * pagesize); + + return ((linuxInt10Priv*)pInt->private)->base + ((i + 1) * pagesize); } void xf86Int10FreePages(xf86Int10InfoPtr pInt, void *pbase, int num) { int pagesize = getpagesize(); - int first = ((unsigned long)pbase + int first = (((unsigned long)pbase - (unsigned long)((linuxInt10Priv*)pInt->private)->base) - / pagesize - 1; + / pagesize) - 1; int i; - for (i = first; i < first + num; i++) + for (i = first; i < (first + num); i++) ((linuxInt10Priv*)pInt->private)->alloc[i] = 0; } static CARD8 -read_b(xf86Int10InfoPtr pInt,int addr) +read_b(xf86Int10InfoPtr pInt, int addr) { - return *((CARD8 *)(addr)); + return *((CARD8 *)addr); } static CARD16 -read_w(xf86Int10InfoPtr pInt,int addr) +read_w(xf86Int10InfoPtr pInt, int addr) { - return *((CARD16 *)(addr)); + return *((CARD16 *)addr); } static CARD32 -read_l(xf86Int10InfoPtr pInt,int addr) +read_l(xf86Int10InfoPtr pInt, int addr) { - return *((CARD32 *)(addr)); + return *((CARD32 *)addr); } static void -write_b(xf86Int10InfoPtr pInt,int addr, CARD8 val) +write_b(xf86Int10InfoPtr pInt, int addr, CARD8 val) { - *((CARD8 *)(addr)) = (CARD8)val; + *((CARD8 *)addr) = val; } static void -write_w(xf86Int10InfoPtr pInt,int addr, CARD16 val) +write_w(xf86Int10InfoPtr pInt, int addr, CARD16 val) { - *((CARD16 *)(addr)) = (CARD16)val; + *((CARD16 *)addr) = val; } static -void write_l(xf86Int10InfoPtr pInt,int addr, CARD32 val) +void write_l(xf86Int10InfoPtr pInt, int addr, CARD32 val) { - *((CARD32 *)(addr)) = (CARD32)val; + *((CARD32 *)addr) = val; } pointer xf86int10Addr(xf86Int10InfoPtr pInt, CARD32 addr) { if (addr < V_RAM) - return (pointer)(((linuxInt10Priv*)pInt->private)->base + addr); + return ((linuxInt10Priv*)pInt->private)->base + addr; else if (addr < V_BIOS) - return (pointer) addr; + return (pointer)addr; else if (addr < SYS_BIOS) - return (pointer)(((linuxInt10Priv*)pInt->private)->base_high + return (pointer)(((linuxInt10Priv*)pInt->private)->base_high - V_BIOS + addr); else - return (pointer) addr; + return (pointer)addr; } #ifdef _VM86_LINUX @@ -355,38 +471,200 @@ { #define VM86S ((struct vm86_struct *)pInt->cpuRegs) - pInt->cpuRegs = (pointer) xnfcalloc(1,sizeof(struct vm86_struct)); + pInt->cpuRegs = (pointer)xnfcalloc(1, sizeof(struct vm86_struct)); VM86S->flags = 0; VM86S->screen_bitmap = 0; VM86S->cpu_type = CPU_586; - memset(&VM86S->int_revectored, 0xff,sizeof(VM86S->int_revectored)) ; - memset(&VM86S->int21_revectored, 0xff,sizeof(VM86S->int21_revectored)) ; + memset(&VM86S->int_revectored, 0xff, sizeof(VM86S->int_revectored)); + memset(&VM86S->int21_revectored, 0xff, sizeof(VM86S->int21_revectored)); return TRUE; } - + +/* get the linear address */ +#define LIN_PREF_SI ((pref_seg << 4) + X86_SI) +#define LWECX ((prefix66 ^ prefix67) ? X86_ECX : X86_CX) +#define LWECX_ZERO {if (prefix66 ^ prefix67) X86_ECX = 0; else X86_CX = 0;} +#define DF (1 << 10) + +/* vm86 fault handling */ +static Bool +vm86_GP_fault(xf86Int10InfoPtr pInt) +{ + unsigned char *csp, *lina; + CARD32 org_eip; + int pref_seg; + int done, is_rep, prefix66, prefix67; + + csp = lina = SEG_ADR((unsigned char *), X86_CS, IP); + + is_rep = 0; + prefix66 = prefix67 = 0; + pref_seg = -1; + + /* eat up prefixes */ + done = 0; + do { + switch (MEM_RB(pInt, (int)csp++)) { + case 0x66: /* operand prefix */ prefix66=1; break; + case 0x67: /* address prefix */ prefix67=1; break; + case 0x2e: /* CS */ pref_seg=X86_CS; break; + case 0x3e: /* DS */ pref_seg=X86_DS; break; + case 0x26: /* ES */ pref_seg=X86_ES; break; + case 0x36: /* SS */ pref_seg=X86_SS; break; + case 0x65: /* GS */ pref_seg=X86_GS; break; + case 0x64: /* FS */ pref_seg=X86_FS; break; + case 0xf0: /* lock */ break; + case 0xf2: /* repnz */ + case 0xf3: /* rep */ is_rep=1; break; + default: done=1; + } + } while (!done); + csp--; /* oops one too many */ + org_eip = X86_EIP; + X86_IP += (csp - lina); + + switch (MEM_RB(pInt, (int)csp)) { + case 0x6c: /* insb */ + /* NOTE: ES can't be overwritten; prefixes 66,67 should use esi,edi,ecx + * but is anyone using extended regs in real mode? */ + /* WARNING: no test for DI wrapping! */ + X86_EDI += port_rep_inb(pInt, X86_DX, SEG_EADR((CARD32), X86_ES, DI), + X86_FLAGS & DF, is_rep ? LWECX : 1); + if (is_rep) LWECX_ZERO; + X86_IP++; + break; + + case 0x6d: /* (rep) insw / insd */ + /* NOTE: ES can't be overwritten */ + /* WARNING: no test for _DI wrapping! */ + if (prefix66) { + X86_DI += port_rep_inl(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI), + X86_EFLAGS & DF, is_rep ? LWECX : 1); + } + else { + X86_DI += port_rep_inw(pInt, X86_DX, SEG_ADR((CARD32), X86_ES, DI), + X86_FLAGS & DF, is_rep ? LWECX : 1); + } + if (is_rep) LWECX_ZERO; + X86_IP++; + break; + + case 0x6e: /* (rep) outsb */ + if (pref_seg < 0) pref_seg = X86_DS; + /* WARNING: no test for _SI wrapping! */ + X86_SI += port_rep_outb(pInt, X86_DX, (CARD32)LIN_PREF_SI, + X86_FLAGS & DF, is_rep ? LWECX : 1); + if (is_rep) LWECX_ZERO; + X86_IP++; + break; + + case 0x6f: /* (rep) outsw / outsd */ + if (pref_seg < 0) pref_seg = X86_DS; + /* WARNING: no test for _SI wrapping! */ + if (prefix66) { + X86_SI += port_rep_outl(pInt, X86_DX, (CARD32)LIN_PREF_SI, + X86_EFLAGS & DF, is_rep ? LWECX : 1); + } + else { + X86_SI += port_rep_outw(pInt, X86_DX, (CARD32)LIN_PREF_SI, + X86_FLAGS & DF, is_rep ? LWECX : 1); + } + if (is_rep) LWECX_ZERO; + X86_IP++; + break; + + case 0xe5: /* inw xx, inl xx */ + if (prefix66) X86_EAX = x_inl(csp[1]); + else X86_AX = x_inw(csp[1]); + X86_IP += 2; + break; + + case 0xe4: /* inb xx */ + X86_AL = x_inb(csp[1]); + X86_IP += 2; + break; + + case 0xed: /* inw dx, inl dx */ + if (prefix66) X86_EAX = x_inl(X86_DX); + else X86_AX = x_inw(X86_DX); + X86_IP += 1; + break; + + case 0xec: /* inb dx */ + X86_AL = x_inb(X86_DX); + X86_IP += 1; + break; + + case 0xe7: /* outw xx */ + if (prefix66) x_outl(csp[1], X86_EAX); + else x_outw(csp[1], X86_AX); + X86_IP += 2; + break; + + case 0xe6: /* outb xx */ + x_outb(csp[1], X86_AL); + X86_IP += 2; + break; + + case 0xef: /* outw dx */ + if (prefix66) x_outl(X86_DX, X86_EAX); + else x_outw(X86_DX, X86_AX); + X86_IP += 1; + break; + + case 0xee: /* outb dx */ + x_outb(X86_DX, X86_AL); + X86_IP += 1; + break; + + case 0xf4: +#ifdef DEBUG + ErrorF("hlt at %p\n", lina); +#endif + return FALSE; + + case 0x0f: + xf86DrvMsg(pInt->scrnIndex, X_ERROR, + "CPU 0x0f Trap at CS:EIP=0x%4.4x:0x%8.8x\n", X86_CS, X86_EIP); + goto op0ferr; + + default: + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown reason for exception\n"); + + op0ferr: + dump_registers(pInt); + stack_trace(pInt); + dump_code(pInt); + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "cannot continue\n"); + return FALSE; + } /* end of switch() */ + return TRUE; +} + static int do_vm86(xf86Int10InfoPtr pInt) { int retval, signo; - + xf86InterceptSignals(&signo); retval = vm86_rep(VM86S); xf86InterceptSignals(NULL); if (signo >= 0) { - xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86() syscall generated signal %d.\n", signo); + xf86DrvMsg(pInt->scrnIndex, X_ERROR, + "vm86() syscall generated signal %d.\n", signo); dump_registers(pInt); dump_code(pInt); stack_trace(pInt); return 0; } - + switch (VM86_TYPE(retval)) { case VM86_UNKNOWN: if (!vm86_GP_fault(pInt)) return 0; break; case VM86_STI: - xf86DrvMsg(pInt->scrnIndex,X_ERROR,"vm86_sti :-((\n"); + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "vm86_sti :-((\n"); dump_registers(pInt); dump_code(pInt); stack_trace(pInt); @@ -394,8 +672,8 @@ case VM86_INTx: pInt->num = VM86_ARG(retval); if (!int_handler(pInt)) { - xf86DrvMsg(pInt->scrnIndex, - X_ERROR,"Unknown vm86_int: 0x%X\n\n",VM86_ARG(retval)); + xf86DrvMsg(pInt->scrnIndex, X_ERROR, + "Unknown vm86_int: 0x%X\n\n", VM86_ARG(retval)); dump_registers(pInt); dump_code(pInt); stack_trace(pInt); @@ -409,17 +687,17 @@ * we used to warn here and bail out - but now the sigio stuff * always fires signals at us. So we just ignore them for now. */ - xf86DrvMsg(pInt->scrnIndex,X_WARNING,"received signal\n"); + xf86DrvMsg(pInt->scrnIndex, X_WARNING, "received signal\n"); return 0; default: - xf86DrvMsg(pInt->scrnIndex,X_ERROR,"unknown type(0x%x)=0x%x\n", - VM86_ARG(retval),VM86_TYPE(retval)); + xf86DrvMsg(pInt->scrnIndex, X_ERROR, "unknown type(0x%x)=0x%x\n", + VM86_ARG(retval), VM86_TYPE(retval)); dump_registers(pInt); dump_code(pInt); stack_trace(pInt); return 0; } - + return 1; } @@ -431,11 +709,11 @@ if (int_handler(pInt)) while(do_vm86(pInt)) {}; - finish_int(pInt,sig); + finish_int(pInt, sig); } static int -vm86_rep(struct vm86_struct *ptr) +vm86_rep(struct vm86_struct *ptr) { int __res; @@ -455,9 +733,9 @@ "b" ((struct vm86_struct *)ptr)); #endif - if ((__res) < 0) { + if (__res < 0) { errno = -__res; - __res=-1; + __res = -1; } else errno = 0; return __res; Index: xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c diff -u xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c:1.2 Thu Jul 13 17:31:40 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c Mon Apr 30 10:34:58 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c,v 1.2 2000/07/13 21:31:40 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/os2/int10/os2.c,v 1.3 2001/04/30 14:34:58 tsi Exp $ */ /* * XFree86 int10 module * execute BIOS int 10h calls in x86 real mode environment @@ -210,10 +210,11 @@ xf86UnMapVidMem(screen,INTPriv(pInt)->vRam,size); } -void +Bool MapCurrentInt10(xf86Int10InfoPtr pInt) { - /* nothing to do here */ + /* nothing to do here */ + return TRUE; } void Index: xc/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c:1.2 xc/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c:1.2 Thu Aug 24 21:19:17 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c Fri May 18 20:26:46 2001 @@ -3,13 +3,19 @@ * AGP GART support. */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c,v 1.2 2000/08/25 01:19:17 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/agp_noop.c,v 1.3 2001/05/19 00:26:46 dawes Exp $ */ #include "X.h" #include "xf86.h" #include "xf86Priv.h" #include "xf86_OSlib.h" #include "xf86OSpriv.h" + +Bool +xf86GARTCloseScreen(int screenNum) +{ + return FALSE; +} Bool xf86AgpGARTSupported() Index: xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c:1.8 xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c:1.8.4.1 --- xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c:1.8 Sun Nov 19 11:38:06 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c Wed May 23 10:47:45 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c,v 1.8 2000/11/19 16:38:06 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/bios_mmap.c,v 1.8.4.1 2001/05/23 14:47:45 alanh Exp $ */ /* * Copyright 1993 by David Wexelblat <dwex@goblin.org> * @@ -149,7 +149,8 @@ return(-1); } - xf86SlowBCopyFromBus(base+JENSEN_SHIFT(Offset), Buf, Len); + xf86SlowBCopyFromBus((unsigned char *)(base+JENSEN_SHIFT(Offset)), + Buf, Len); munmap((caddr_t)JENSEN_SHIFT(base), JENSEN_SHIFT(mlen)); close(fd); Index: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c:1.71 xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c:1.75 --- xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c:1.71 Wed Dec 6 15:39:54 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c Fri May 18 16:22:30 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.71 2000/12/06 20:39:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/libc_wrapper.c,v 1.75 2001/05/18 20:22:30 tsi Exp $ */ /* * Copyright 1997 by The XFree86 Project, Inc. * @@ -25,6 +25,7 @@ #include <X.h> #include <Xmd.h> +#include <Xos.h> #include <sys/types.h> #include <sys/stat.h> #if defined(__bsdi__) @@ -858,12 +859,51 @@ return ftell(fp->filehnd); } +#define mapnum(e) case (xf86_##e): err = e; break; + char* xf86strerror(int n) { - return strerror(n); + int err; + + switch (n) + { + case 0: err = 0; break; + mapnum (EACCES); + mapnum (EAGAIN); + mapnum (EBADF); + mapnum (EEXIST); + mapnum (EFAULT); + mapnum (EINTR); + mapnum (EINVAL); + mapnum (EISDIR); + mapnum (ELOOP); /* not POSIX 1 */ + mapnum (EMFILE); + mapnum (ENAMETOOLONG); + mapnum (ENFILE); + mapnum (ENOENT); + mapnum (ENOMEM); + mapnum (ENOSPC); + mapnum (ENOTDIR); + mapnum (EPIPE); + mapnum (EROFS); +#ifndef __EMX__ + mapnum (ETXTBSY); /* not POSIX 1 */ +#endif + mapnum (ENOTTY); + mapnum (EBUSY); + mapnum (ENODEV); + mapnum (EIO); + + default: + err = 999; + } + return strerror(err); } +#undef mapnum + + /* required for portable fgetpos/fsetpos, * use as * XF86fpos_t* pos = xalloc(xf86fpossize()); @@ -1095,9 +1135,11 @@ { struct timeval tv; - gettimeofday(&tv, NULL); - *secs = tv.tv_sec; - *usecs= tv.tv_usec; + X_GETTIMEOFDAY(&tv); + if (secs) + *secs = tv.tv_sec; + if (usecs) + *usecs= tv.tv_usec; return; } @@ -1844,7 +1886,7 @@ * for now only implement the rmid command. */ int -xf86shmctl(int id, int xf86cmd, pointer *buf) +xf86shmctl(int id, int xf86cmd, pointer buf) { int cmd; @@ -1856,7 +1898,7 @@ return 0; } - return shmctl(id, cmd, NULL); + return shmctl(id, cmd, buf); } #else @@ -1874,7 +1916,7 @@ } int -xf86shmctl(int id, int xf86cmd, pointer *buf) +xf86shmctl(int id, int xf86cmd, pointer buf) { return -1; } Index: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c:3.25 xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c:3.26 --- xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c:3.25 Tue Nov 14 16:59:24 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c Thu Feb 15 14:46:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c,v 3.25 2000/11/14 21:59:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/posix_tty.c,v 3.26 2001/02/15 19:46:03 eich Exp $ */ /* * Copyright 1993-1999 by The XFree86 Project, Inc. * @@ -138,6 +138,7 @@ xf86Msg (X_ERROR, "xf86OpenSerial: Cannot open device %s\n\t%s.\n", dev, strerror (errno)); + xfree(dev); return (-1); } @@ -145,6 +146,7 @@ { #if 1 /* Allow non-tty devices to be opened. */ + xfree(dev); return (fd); #else xf86Msg (X_WARNING, @@ -152,6 +154,7 @@ dev); SYSCALL (close (fd)); errno = EINVAL; + xfree(dev); return (-1); #endif } @@ -181,6 +184,7 @@ if (xf86SetSerial (fd, options) == -1) { SYSCALL (close (fd)); + xfree(dev); return (-1); } @@ -188,6 +192,7 @@ if (i == -1) { SYSCALL (close (fd)); + xfree(dev); return (-1); } i &= ~O_NONBLOCK; @@ -195,8 +200,10 @@ if (i == -1) { SYSCALL (close (fd)); + xfree(dev); return (-1); } + xfree(dev); return (fd); } Index: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c:1.15 xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c:1.19 --- xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c:1.15 Sun Apr 23 15:27:03 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c Fri Feb 16 09:45:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v 1.15 2000/04/23 19:27:03 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/stdResource.c,v 1.19 2001/02/16 14:45:11 tsi Exp $ */ /* Standard resource information code */ @@ -27,11 +27,11 @@ resPtr ret = NULL; resRange range; - RANGE(range,0,0xffffffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); /* Fallback is to allow addressing of all I/O space */ - RANGE(range,0,0xffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); ret = xf86AddResToList(ret, &range, -1); return ret; } @@ -43,11 +43,11 @@ resPtr ret = NULL; resRange range; - RANGE(range,0,0xffffffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); /* Fallback is to allow addressing of all I/O space */ - RANGE(range,0,0xffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); ret = xf86AddResToList(ret, &range, -1); return ret; } @@ -59,11 +59,11 @@ resPtr ret = NULL; resRange range; - RANGE(range,0,0xffffffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); /* Fallback is to allow addressing of all I/O space */ - RANGE(range,0,0xffff,ResExcIoBlock); + RANGE(range, 0x00000000, 0x0000ffff, ResExcIoBlock); ret = xf86AddResToList(ret, &range, -1); return ret; } @@ -77,7 +77,7 @@ * Fallback is to claim the following areas: * * 0x00000000 - 0x0009ffff low 640k host memory - * 0x000C0000 - 0x000EFFFF location of VGA and other extensions ROMS + * 0x000c0000 - 0x000effff location of VGA and other extensions ROMS * 0x000f0000 - 0x000fffff system BIOS * 0x00100000 - 0x3fffffff low 1G - 1MB host memory * 0xfec00000 - 0xfecfffff default I/O APIC config space @@ -91,28 +91,45 @@ */ /* Fallback is to claim 0x0 - 0x9ffff and 0x100000 - 0x7fffffff */ - RANGE(range,0,0x9ffff,ResExcMemBlock); + RANGE(range, 0x00000000, 0x0009ffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xc0000,0xeffff,ResExcMemBlock); + RANGE(range, 0x000c0000, 0x000effff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xf0000,0xfffff,ResExcMemBlock); + RANGE(range, 0x000f0000, 0x000fffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0x100000,0x3fffffff,ResExcMemBlock | ResBios | ResEstimated); + RANGE(range, 0x00100000, 0x3fffffff, + ResExcMemBlock | ResBios | ResEstimated); ret = xf86AddResToList(ret, &range, -1); #if 0 - RANGE(range,0xfec00000,0xfecfffff,ResExcMemBlock | ResBios); + RANGE(range, 0xfec00000, 0xfecfffff, ResExcMemBlock | ResBios); ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0xfee00000,0xfeefffff,ResExcMemBlock | ResBios); + RANGE(range, 0xfee00000, 0xfeefffff, ResExcMemBlock | ResBios); ret = xf86AddResToList(ret, &range, -1); #endif - RANGE(range,0xffe00000,0xffffffff,ResExcMemBlock | ResBios); + RANGE(range, 0xffe00000, 0xffffffff, ResExcMemBlock | ResBios); ret = xf86AddResToList(ret, &range, -1); - /* Fallback is to claim well known ports in the 0x0 - 0x3ff range */ - /* Possibly should claim some of them as sparse ranges */ + /* + * Fallback would be to claim well known ports in the 0x0 - 0x3ff range + * along with their sparse I/O aliases, but that's too imprecise. Instead + * claim a bare minimum here. + */ + RANGE(range, 0x00000000, 0x000000ff, ResExcIoBlock); /* For mainboard */ + ret = xf86AddResToList(ret, &range, -1); - RANGE(range,0,0x1ff,ResExcIoBlock | ResEstimated); + /* + * At minimum, the top and bottom resources must be claimed, so that + * resources that are (or appear to be) unallocated can be relocated. + */ +/* RANGE(range, 0x00000000, 0x00000000, ResExcMemBlock); + ret = xf86AddResToList(ret, &range, -1); + RANGE(range, 0xffffffff, 0xffffffff, ResExcMemBlock); ret = xf86AddResToList(ret, &range, -1); + RANGE(range, 0x00000000, 0x00000000, ResExcIoBlock); + ret = xf86AddResToList(ret, &range, -1); */ + RANGE(range, 0x0000ffff, 0x0000ffff, ResExcIoBlock); + ret = xf86AddResToList(ret, &range, -1); + /* XXX add others */ return ret; } Index: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c:1.13 xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c:1.14 --- xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c:1.13 Fri Oct 27 21:42:28 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c Fri May 4 15:05:51 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c,v 1.13 2000/10/28 01:42:28 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/vidmem.c,v 1.14 2001/05/04 19:05:51 dawes Exp $ */ /* * Copyright 1993-1999 by The XFree86 Project, Inc * @@ -112,25 +112,25 @@ } enum { OPTION_MTRR }; -static OptionInfoRec opts[] = +static const OptionInfoRec opts[] = { { OPTION_MTRR, "mtrr", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE } }; -#define nopts (sizeof(opts) / sizeof(opts[0])) - static void checkMtrrOption(VidMapPtr vp) { if (!vp->mtrrOptChecked && vp->pScrn && vp->pScrn->options != NULL) { - OptionInfoRec options[nopts]; + OptionInfoPtr options; + options = xnfalloc(sizeof(opts)); (void)memcpy(options, opts, sizeof(opts)); xf86ProcessOptions(vp->pScrn->scrnIndex, vp->pScrn->options, options); if (xf86GetOptValBool(options, OPTION_MTRR, &vp->mtrrEnabled)) vp->mtrrFrom = X_CONFIG; + xfree(options); vp->mtrrOptChecked = TRUE; } } Index: xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h diff -u xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h:1.2 xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h:1.3 --- xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h:1.2 Mon Nov 6 16:57:11 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h Thu Feb 15 14:46:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h,v 1.2 2000/11/06 21:57:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/shared/xf86Axp.h,v 1.3 2001/02/15 19:46:03 eich Exp $ */ #ifndef _XF86_AXP_H_ #define _XF86_AXP_H_ @@ -19,13 +19,6 @@ IRONGATE } axpDevice; -typedef struct - { char* sysName; - char* sysVari; - char* cpu; - axpDevice sys; } -AXP; - typedef struct { axpDevice id; unsigned long hae_thresh; Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile:1.7 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile:1.8 --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile:1.7 Tue Aug 15 12:05:40 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/Imakefile Sat Apr 7 12:37:16 2001 @@ -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 @@ 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 Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h:1.8 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h:1.10 --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h:1.8 Sun Dec 17 21:25:58 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h Sat Apr 7 12:37:16 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h,v 1.8 2000/12/18 02:25:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_keynames.h,v 1.10 2001/04/07 16:37:16 dawes Exp $ */ #ifndef _SOL8KEYNAMES_H #define _SOL8KEYNAMES_H @@ -64,7 +64,7 @@ KEY_Comma, /* 53 */ KEY_Period, /* 54 */ KEY_Slash, /* 55 */ - 0x73, /*KEY_P_BKSL*/ /* 56 */ + KEY_BSlash2, /* 56 */ KEY_ShiftR, /* 57 */ KEY_LCtrl, /* 58 */ KEY_LMeta, /* 59 */ @@ -139,9 +139,9 @@ KEY_UNKNOWN, /* 128 */ KEY_UNKNOWN, /* 129 */ KEY_UNKNOWN, /* 130 */ - 0x7B, /*KEY_P_NFER*/ /* 131 */ - 0x79, /*KEY_P_XFER*/ /* 132 */ - 0x70, /*KEY_HKTG*/ /* 133 */ + KEY_NFER, /* 131 */ + KEY_XFER, /* 132 */ + KEY_HKTG, /* 133 */ KEY_UNKNOWN, /* 134 */ /* The rest default to KEY_UNKNOWN */ }; Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c:1.1 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c:1.2 --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c:1.1 Sat Sep 25 10:38:10 1999 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c Thu Apr 5 22:16:25 2001 @@ -1,19 +1,271 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c,v 1.1 1999/09/25 14:38:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_mouse.c,v 1.2 2001/04/06 02:16:25 dawes Exp $ */ /* - * Copyright 1999 by The XFree86 Project, Inc. + * Copyright 1999-2001 by The XFree86 Project, Inc. */ #include "X.h" #include "xf86.h" +#include "xf86Priv.h" +#include "xf86_OSlib.h" #include "xf86Xinput.h" #include "xf86OSmouse.h" +#include "xisb.h" +#include "mipointer.h" +#include <sys/vuid_event.h> +/* Names of protocols that are handled internally here. */ + +static const char *internalNames[] = { + "VUID", + NULL +}; + +typedef struct _VuidMseRec { + Firm_event event; + unsigned char *buffer; +} VuidMseRec, *VuidMsePtr; + + +static int vuidMouseProc(DeviceIntPtr pPointer, int what); +static void vuidReadInput(InputInfoPtr pInfo); + +/* This function is called when the protocol is "VUID". */ +static Bool +vuidPreInit(InputInfoPtr pInfo, const char *protocol, int flags) +{ + MouseDevPtr pMse = pInfo->private; + VuidMsePtr pVuidMse; + int i; + + pVuidMse = xalloc(sizeof(VuidMseRec)); + if (pVuidMse == NULL) { + xf86Msg(X_ERROR, "%s: cannot allocate VuidMouseRec\n", pInfo->name); + xfree(pMse); + return FALSE; + } + + pMse->protocol = protocol; + xf86Msg(X_CONFIG, "%s: Protocol: %s\n", pInfo->name, protocol); + + /* Collect the options, and process the common options. */ + xf86CollectInputOptions(pInfo, NULL, NULL); + xf86ProcessCommonOptions(pInfo, pInfo->options); + + /* Check if the device can be opened. */ + pInfo->fd = xf86OpenSerial(pInfo->options); + if (pInfo->fd == -1) { + if (xf86GetAllowMouseOpenFail()) + xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); + else { + xf86Msg(X_ERROR, "%s: cannot open input device\n", pInfo->name); + xfree(pVuidMse); + xfree(pMse); + return FALSE; + } + } + pVuidMse->buffer = (unsigned char *)&pVuidMse->event; + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + + /* Private structure */ + pMse->mousePriv = pVuidMse; + + /* Process common mouse options (like Emulate3Buttons, etc). */ + pMse->CommonOptions(pInfo); + + /* Setup the local procs. */ + pInfo->device_control = vuidMouseProc; + pInfo->read_input = vuidReadInput; + + pInfo->flags |= XI86_CONFIGURED; + return TRUE; +} + +static void +vuidReadInput(InputInfoPtr pInfo) +{ + MouseDevPtr pMse; + VuidMsePtr pVuidMse; + int buttons; + int dx = 0, dy = 0, dz = 0, dw = 0; + unsigned int n; + int c; + unsigned char *pBuf; + + pMse = pInfo->private; + pVuidMse = pMse->mousePriv; + buttons = pMse->lastButtons; + XisbBlockDuration(pMse->buffer, -1); + pBuf = pVuidMse->buffer; + n = 0; + + do { + while (n < sizeof(Firm_event) && (c = XisbRead(pMse->buffer)) >= 0) { + pBuf[n++] = (unsigned char)c; + } + + if (n == 0) + return; + + if (n != sizeof(Firm_event)) { + xf86Msg(X_WARNING, "%s: incomplete packet, size %d\n", + pInfo->name, n); + } + + if (pVuidMse->event.id >= BUT_FIRST && pVuidMse->event.id <= BUT_LAST) { + /* button */ + int butnum = pVuidMse->event.id - BUT_FIRST; + if (butnum < 3) + butnum = 2 - butnum; + if (!pVuidMse->event.value) + buttons &= ~(1 << butnum); + else + buttons |= (1 << butnum); + } else if (pVuidMse->event.id >= VLOC_FIRST && + pVuidMse->event.id <= VLOC_LAST) { + /* axis */ + int delta = pVuidMse->event.value; + switch(pVuidMse->event.id) { + case LOC_X_DELTA: + dx += delta; + break; + case LOC_Y_DELTA: + dy -= delta; + break; + } + } + + n = 0; + if ((c = XisbRead(pMse->buffer)) >= 0) { + /* Another packet. Handle it right away. */ + pBuf[n++] = c; + } + } while (n != 0); + + pMse->PostEvent(pInfo, buttons, dx, dy, dz, dw); + return; +} + +#define NUMEVENTS 64 + static int +vuidMouseProc(DeviceIntPtr pPointer, int what) +{ + InputInfoPtr pInfo; + MouseDevPtr pMse; + VuidMsePtr pVuidMse; + unsigned char map[MSE_MAXBUTTONS + 1]; + int nbuttons; + + pInfo = pPointer->public.devicePrivate; + pMse = pInfo->private; + pMse->device = pPointer; + pVuidMse = pMse->mousePriv; + + switch (what) { + case DEVICE_INIT: + pPointer->public.on = FALSE; + + for (nbuttons = 0; nbuttons < MSE_MAXBUTTONS; ++nbuttons) + map[nbuttons + 1] = nbuttons + 1; + + InitPointerDeviceStruct((DevicePtr)pPointer, + map, + min(pMse->buttons, MSE_MAXBUTTONS), + miPointerGetMotionEvents, + pMse->Ctrl, + miPointerGetMotionBufferSize()); + + /* X valuator */ + xf86InitValuatorAxisStruct(pPointer, 0, 0, -1, 1, 0, 1); + xf86InitValuatorDefaults(pPointer, 0); + /* Y valuator */ + xf86InitValuatorAxisStruct(pPointer, 1, 0, -1, 1, 0, 1); + xf86InitValuatorDefaults(pPointer, 1); + xf86MotionHistoryAllocate(pInfo); + break; + + case DEVICE_ON: + pInfo->fd = xf86OpenSerial(pInfo->options); + if (pInfo->fd == -1) + xf86Msg(X_WARNING, "%s: cannot open input device\n", pInfo->name); + else { + pMse->buffer = XisbNew(pInfo->fd, + NUMEVENTS * sizeof(Firm_event)); + if (!pMse->buffer) { + xfree(pMse); + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + } else { + int fmt = VUID_FIRM_EVENT; + ioctl(pInfo->fd, VUIDSFORMAT, &fmt); + xf86FlushInput(pInfo->fd); + AddEnabledDevice(pInfo->fd); + } + } + pMse->lastButtons = 0; + pMse->emulateState = 0; + pPointer->public.on = TRUE; + break; + + case DEVICE_OFF: + case DEVICE_CLOSE: + if (pInfo->fd != -1) { + RemoveEnabledDevice(pInfo->fd); + if (pMse->buffer) { + XisbFree(pMse->buffer); + pMse->buffer = NULL; + } + xf86CloseSerial(pInfo->fd); + pInfo->fd = -1; + } + pPointer->public.on = FALSE; + usleep(300000); + break; + } + return Success; +} + +static Bool +sol8MousePreInit(InputInfoPtr pInfo, const char *protocol, int flags) +{ + /* The protocol is guaranteed to be one of the internalNames[] */ + if (xf86NameCmp(protocol, "VUID") == 0) { + return vuidPreInit(pInfo, protocol, flags); + } + return TRUE; +} + +static const char ** +BuiltinNames(void) +{ + return internalNames; +} + +static Bool +CheckProtocol(const char *protocol) +{ + int i; + + for (i = 0; internalNames[i]; i++) + if (xf86NameCmp(protocol, internalNames[i]) == 0) + return TRUE; + + return FALSE; +} + +static int SupportedInterfaces(void) { /* XXX This needs to be checked. */ - return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2; + return MSE_SERIAL | MSE_BUS | MSE_PS2 | MSE_AUTO | MSE_XPS2 | MSE_MISC; +} + +static const char * +DefaultProtocol(void) +{ + return "VUID"; } OSMouseInfoPtr @@ -25,6 +277,10 @@ if (!p) return NULL; p->SupportedInterfaces = SupportedInterfaces; + p->BuiltinNames = BuiltinNames; + p->DefaultProtocol = DefaultProtocol; + p->CheckProtocol = CheckProtocol; + p->PreInit = sol8MousePreInit; return p; } Index: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c:1.3 xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c:1.4 --- xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c:1.3 Mon Aug 14 13:47:08 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c Sun Jan 21 16:19:38 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c,v 1.3 2000/08/14 17:47:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sol8_x86/sol8_postkbdevents.c,v 1.4 2001/01/21 21:19:38 tsi Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -173,9 +173,7 @@ case KEY_BackSpace: if (!xf86Info.dontZap) { -#ifdef XFreeXDGA DGAShutdown(); -#endif GiveUp(0); } break; Index: xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c diff -u xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c:3.19.2.1 xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c:3.20 --- xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c:3.19.2.1 Tue Mar 6 13:31:48 2001 +++ xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c Tue Mar 6 13:20:31 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c,v 3.19.2.1 2001/03/06 18:31:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/sysv/xqueue.c,v 3.20 2001/03/06 18:20:31 dawes Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany * Copyright 1993-1999 by The XFree86 Project, Inc. Index: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c diff -u xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c:1.14 xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c:1.16 --- xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c:1.14 Wed Dec 6 10:35:32 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c Fri May 4 15:05:51 2001 @@ -1,5 +1,15 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.14 2000/12/06 15:35:32 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.c,v 1.16 2001/05/04 19:05:51 dawes Exp $ */ +/* + * XFree86 vbe module + * Copyright 2000 Egbert Eich + * + * The mode query/save/set/restore functions from the vesa driver + * have been moved here. + * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) + * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> + */ + #include "xf86.h" #include "xf86_ansic.h" #include "vbe.h" @@ -17,6 +27,8 @@ #endif #define L_ADD(x) (B_O32(x) & 0xffff) + ((B_O32(x) >> 12) & 0xffff00) +#define FARP(p) (((unsigned)(p & 0xffff0000) >> 12) | (p & 0xffff)) + static unsigned char * vbeReadEDID(vbeInfoPtr pVbe); static Bool vbeProbeDDC(vbeInfoPtr pVbe); @@ -203,13 +215,11 @@ VBEOPT_NOVBE } VBEOpts; -static OptionInfoRec VBEOptions[] = { +static const OptionInfoRec VBEOptions[] = { { VBEOPT_NOVBE, "NoVBE", OPTV_BOOLEAN, {0}, FALSE }, { -1, NULL, OPTV_NONE, {0}, FALSE }, }; -#define nVBEOptions (sizeof(VBEOptions) / sizeof(VBEOptions[0])) - static unsigned char * vbeReadEDID(vbeInfoPtr pVbe) { @@ -218,13 +228,15 @@ unsigned char *tmp = NULL; Bool novbe = FALSE; int screen = pVbe->pInt10->scrnIndex; - OptionInfoRec options[nVBEOptions]; + OptionInfoPtr options; if (!page) return NULL; + options = xnfalloc(sizeof(VBEOptions)); (void)memcpy(options, VBEOptions, sizeof(VBEOptions)); xf86ProcessOptions(screen, xf86Screens[screen]->options, options); xf86GetOptValBool(options, VBEOPT_NOVBE, &novbe); + xfree(options); if (novbe) return NULL; if (!vbeProbeDDC(pVbe)) goto error; @@ -294,18 +306,590 @@ } +VbeInfoBlock * +VBEGetVBEInfo(vbeInfoPtr pVbe) +{ + VbeInfoBlock *block = NULL; + int i, pStr, pModes; + char *str; + CARD16 major, minor, *modes; + + bzero(pVbe->memory, sizeof(VbeInfoBlock)); + + /* + Input: + AH := 4Fh Super VGA support + AL := 00h Return Super VGA information + ES:DI := Pointer to buffer + + Output: + AX := status + (All other registers are preserved) + */ + + ((char*)pVbe->memory)[0] = 'V'; + ((char*)pVbe->memory)[1] = 'B'; + ((char*)pVbe->memory)[2] = 'E'; + ((char*)pVbe->memory)[3] = '2'; + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f00; + pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); + pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); + xf86ExecX86int10(pVbe->pInt10); + + if (pVbe->pInt10->ax != 0x4f) + return (NULL); + + block = xcalloc(sizeof(VbeInfoBlock), 1); + block->VESASignature[0] = ((char*)pVbe->memory)[0]; + block->VESASignature[1] = ((char*)pVbe->memory)[1]; + block->VESASignature[2] = ((char*)pVbe->memory)[2]; + block->VESASignature[3] = ((char*)pVbe->memory)[3]; + + block->VESAVersion = *(CARD16*)(((char*)pVbe->memory) + 4); + major = (unsigned)block->VESAVersion >> 8; + minor = block->VESAVersion & 0xff; + + pStr = *(CARD32*)(((char*)pVbe->memory) + 6); + str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); + block->OEMStringPtr = strdup(str); + + block->Capabilities[0] = ((char*)pVbe->memory)[10]; + block->Capabilities[1] = ((char*)pVbe->memory)[11]; + block->Capabilities[2] = ((char*)pVbe->memory)[12]; + block->Capabilities[3] = ((char*)pVbe->memory)[13]; + + pModes = *(CARD32*)(((char*)pVbe->memory) + 14); + modes = xf86int10Addr(pVbe->pInt10, FARP(pModes)); + i = 0; + while (modes[i] != 0xffff) + i++; + block->VideoModePtr = xalloc(sizeof(CARD16) * i + 1); + memcpy(block->VideoModePtr, modes, sizeof(CARD16) * i); + block->VideoModePtr[i] = 0xffff; + + block->TotalMemory = *(CARD16*)(((char*)pVbe->memory) + 18); + + if (major < 2) + memcpy(&block->OemSoftwareRev, ((char*)pVbe->memory) + 20, 236); + else { + block->OemSoftwareRev = *(CARD16*)(((char*)pVbe->memory) + 20); + pStr = *(CARD32*)(((char*)pVbe->memory) + 22); + str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); + block->OemVendorNamePtr = strdup(str); + pStr = *(CARD32*)(((char*)pVbe->memory) + 26); + str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); + block->OemProductNamePtr = strdup(str); + pStr = *(CARD32*)(((char*)pVbe->memory) + 30); + str = xf86int10Addr(pVbe->pInt10, FARP(pStr)); + block->OemProductRevPtr = strdup(str); + memcpy(&block->Reserved, ((char*)pVbe->memory) + 34, 222); + memcpy(&block->OemData, ((char*)pVbe->memory) + 256, 256); + } + + return (block); +} + +void +VBEFreeVBEInfo(VbeInfoBlock *block) +{ + xfree(block->OEMStringPtr); + xfree(block->VideoModePtr); + if (((unsigned)block->VESAVersion >> 8) >= 2) { + xfree(block->OemVendorNamePtr); + xfree(block->OemProductNamePtr); + xfree(block->OemProductRevPtr); + } + xfree(block); +} + +Bool +VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *block) +{ + /* + Input: + AH := 4Fh Super VGA support + AL := 02h Set Super VGA video mode + BX := Video mode + D0-D8 := Mode number + D9-D10 := Reserved (must be 0) + D11 := 0 Use current default refresh rate + := 1 Use user specified CRTC values for refresh rate + D12-13 Reserved for VBE/AF (must be 0) + D14 := 0 Use windowed frame buffer model + := 1 Use linear/flat frame buffer model + D15 := 0 Clear video memory + := 1 Don't clear video memory + ES:DI := Pointer to VbeCRTCInfoBlock structure + + Output: AX = Status + (All other registers are preserved) + */ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f02; + pVbe->pInt10->bx = mode; + if (block) { + pVbe->pInt10->bx |= 1 << 11; + memcpy(pVbe->memory, block, sizeof(VbeCRTCInfoBlock)); + pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); + pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); + } + + xf86ExecX86int10(pVbe->pInt10); + + return (pVbe->pInt10->ax == 0x4f); +} + Bool -vbeModeInit(vbeInfoPtr pVbe, int mode) +VBEGetVBEMode(vbeInfoPtr pVbe, int *mode) { - pVbe->pInt10->ax = 0x4F02; - pVbe->pInt10->bx = mode | (1 << 14); + /* + Input: + AH := 4Fh Super VGA support + AL := 03h Return current video mode + + Output: + AX := Status + BX := Current video mode + (All other registers are preserved) + */ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f03; + xf86ExecX86int10(pVbe->pInt10); - if ((pVbe->pInt10->ax & 0xff) != 0x4f) - return FALSE; + if (pVbe->pInt10->ax == 0x4f) { + *mode = pVbe->pInt10->bx; + + return (TRUE); + } + return (FALSE); +} + +VbeModeInfoBlock * +VBEGetModeInfo(vbeInfoPtr pVbe, int mode) +{ + VbeModeInfoBlock *block = NULL; + + bzero(pVbe->memory, sizeof(VbeModeInfoBlock)); + + /* + Input: + AH := 4Fh Super VGA support + AL := 01h Return Super VGA mode information + CX := Super VGA video mode + (mode number must be one of those returned by Function 0) + ES:DI := Pointer to buffer + + Output: + AX := status + (All other registers are preserved) + */ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f01; + pVbe->pInt10->cx = mode; + pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); + pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); + xf86ExecX86int10(pVbe->pInt10); + if (pVbe->pInt10->ax != 0x4f) + return (NULL); + + block = xcalloc(sizeof(VbeModeInfoBlock), 1); + + block->ModeAttributes = *(CARD16*)pVbe->memory; + block->WinAAttributes = ((char*)pVbe->memory)[2]; + block->WinBAttributes = ((char*)pVbe->memory)[3]; + block->WinGranularity = *(CARD16*)(((char*)pVbe->memory) + 4); + block->WinSize = *(CARD16*)(((char*)pVbe->memory) + 6); + block->WinASegment = *(CARD16*)(((char*)pVbe->memory) + 8); + block->WinBSegment = *(CARD16*)(((char*)pVbe->memory) + 10); + block->WinFuncPtr = *(CARD32*)(((char*)pVbe->memory) + 12); + block->BytesPerScanline = *(CARD16*)(((char*)pVbe->memory) + 16); + + /* mandatory information for VBE 1.2 and above */ + block->XResolution = *(CARD16*)(((char*)pVbe->memory) + 18); + block->YResolution = *(CARD16*)(((char*)pVbe->memory) + 20); + block->XCharSize = ((char*)pVbe->memory)[22]; + block->YCharSize = ((char*)pVbe->memory)[23]; + block->NumberOfPlanes = ((char*)pVbe->memory)[24]; + block->BitsPerPixel = ((char*)pVbe->memory)[25]; + block->NumberOfBanks = ((char*)pVbe->memory)[26]; + block->MemoryModel = ((char*)pVbe->memory)[27]; + block->BankSize = ((char*)pVbe->memory)[28]; + block->NumberOfImages = ((char*)pVbe->memory)[29]; + block->Reserved = ((char*)pVbe->memory)[30]; + + /* Direct color fields (required for direct/6 and YUV/7 memory models) */ + block->RedMaskSize = ((char*)pVbe->memory)[31]; + block->RedFieldPosition = ((char*)pVbe->memory)[32]; + block->GreenMaskSize = ((char*)pVbe->memory)[33]; + block->GreenFieldPosition = ((char*)pVbe->memory)[34]; + block->BlueMaskSize = ((char*)pVbe->memory)[35]; + block->BlueFieldPosition = ((char*)pVbe->memory)[36]; + block->RsvdMaskSize = ((char*)pVbe->memory)[37]; + block->RsvdFieldPosition = ((char*)pVbe->memory)[38]; + block->DirectColorModeInfo = ((char*)pVbe->memory)[39]; + + /* Mandatory information for VBE 2.0 and above */ + if (pVbe->version >= 0x200) { + block->PhysBasePtr = *(CARD32*)(((char*)pVbe->memory) + 40); + block->Reserved32 = *(CARD32*)(((char*)pVbe->memory) + 44); + block->Reserved16 = *(CARD16*)(((char*)pVbe->memory) + 48); + + /* Mandatory information for VBE 3.0 and above */ + if (pVbe->version >= 0x300) { + block->LinBytesPerScanLine = *(CARD16*)(((char*)pVbe->memory) + 50); + block->BnkNumberOfImagePages = ((char*)pVbe->memory)[52]; + block->LinNumberOfImagePages = ((char*)pVbe->memory)[53]; + block->LinRedMaskSize = ((char*)pVbe->memory)[54]; + block->LinRedFieldPosition = ((char*)pVbe->memory)[55]; + block->LinGreenMaskSize = ((char*)pVbe->memory)[56]; + block->LinGreenFieldPosition = ((char*)pVbe->memory)[57]; + block->LinBlueMaskSize = ((char*)pVbe->memory)[58]; + block->LinBlueFieldPosition = ((char*)pVbe->memory)[59]; + block->LinRsvdMaskSize = ((char*)pVbe->memory)[60]; + block->LinRsvdFieldPosition = ((char*)pVbe->memory)[61]; + block->MaxPixelClock = *(CARD32*)(((char*)pVbe->memory) + 62); + memcpy(&block->Reserved2, ((char*)pVbe->memory) + 66, 188); + } + else + memcpy(&block->LinBytesPerScanLine, ((char*)pVbe->memory) + 50, 206); + } + else + memcpy(&block->PhysBasePtr, ((char*)pVbe->memory) + 40, 216); + + return (block); +} + +void +VBEFreeModeInfo(VbeModeInfoBlock *block) +{ + xfree(block); +} + +Bool +VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction function, + pointer *memory, int *size, int *real_mode_pages) +{ + /* + Input: + AH := 4Fh Super VGA support + AL := 04h Save/restore Super VGA video state + DL := 00h Return save/restore state buffer size + CX := Requested states + D0 = Save/restore video hardware state + D1 = Save/restore video BIOS data state + D2 = Save/restore video DAC state + D3 = Save/restore Super VGA state + + Output: + AX = Status + BX = Number of 64-byte blocks to hold the state buffer + (All other registers are preserved) + + + Input: + AH := 4Fh Super VGA support + AL := 04h Save/restore Super VGA video state + DL := 01h Save Super VGA video state + CX := Requested states (see above) + ES:BX := Pointer to buffer + + Output: + AX := Status + (All other registers are preserved) + + + Input: + AH := 4Fh Super VGA support + AL := 04h Save/restore Super VGA video state + DL := 02h Restore Super VGA video state + CX := Requested states (see above) + ES:BX := Pointer to buffer + + Output: + AX := Status + (All other registers are preserved) + */ + + if ((pVbe->version & 0xff00) > 0x100) { + int screen = pVbe->pInt10->scrnIndex; + if (function == MODE_QUERY || + (function == MODE_SAVE && !*memory)) { + /* Query amount of memory to save state */ + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f04; + pVbe->pInt10->dx = 0; + pVbe->pInt10->cx = 0x000f; + xf86ExecX86int10(pVbe->pInt10); + if (pVbe->pInt10->ax != 0x4f) + return (FALSE); + + if (function == MODE_SAVE) { + int npages = (pVbe->pInt10->bx * 64) / 4096 + 1; + if ((*memory = xf86Int10AllocPages(pVbe->pInt10, npages, + real_mode_pages)) == NULL) { + xf86DrvMsg(screen, X_ERROR, + "Cannot allocate memory to save SVGA state.\n"); + return (FALSE); + } + } + *size = pVbe->pInt10->bx * 64; + } + + /* Save/Restore Super VGA state */ + if (function != MODE_QUERY) { + + if (!*memory) return FALSE; + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f04; + switch (function) { + case MODE_SAVE: + pVbe->pInt10->dx = 1; + break; + case MODE_RESTORE: + pVbe->pInt10->dx = 2; + break; + case MODE_QUERY: + return FALSE; + } + pVbe->pInt10->cx = 0x000f; + + pVbe->pInt10->es = SEG_ADDR(*real_mode_pages); + pVbe->pInt10->bx = SEG_OFF(*real_mode_pages); + xf86ExecX86int10(pVbe->pInt10); + return (pVbe->pInt10->ax == 0x4f); + + } + } return TRUE; - } +Bool +VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window) +{ + /* + Input: + AH := 4Fh Super VGA support + AL := 05h + Output: + */ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f05; + pVbe->pInt10->bx = window; + pVbe->pInt10->dx = iBank; + xf86ExecX86int10(pVbe->pInt10); + + if (pVbe->pInt10->ax != 0x4f) + return (FALSE); + + return (0); +} + +Bool +VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, vbeScanwidthCommand command, + int width, int *pixels, int *bytes, int *max) +{ + if (command < SCANWID_SET || command > SCANWID_GET_MAX) + return (FALSE); + + /* + Input: + AX := 4F06h VBE Set/Get Logical Scan Line Length + BL := 00h Set Scan Line Length in Pixels + := 01h Get Scan Line Length + := 02h Set Scan Line Length in Bytes + := 03h Get Maximum Scan Line Length + CX := If BL=00h Desired Width in Pixels + If BL=02h Desired Width in Bytes + (Ignored for Get Functions) + + Output: + AX := VBE Return Status + BX := Bytes Per Scan Line + CX := Actual Pixels Per Scan Line + (truncated to nearest complete pixel) + DX := Maximum Number of Scan Lines + */ + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f06; + pVbe->pInt10->bx = command; + if (command == SCANWID_SET || command == SCANWID_SET_BYTES) + pVbe->pInt10->cx = width; + xf86ExecX86int10(pVbe->pInt10); + + if (pVbe->pInt10->ax != 0x4f) + return (FALSE); + + if (command == SCANWID_GET || command == SCANWID_GET_MAX) { + if (pixels) + *pixels = pVbe->pInt10->cx; + if (bytes) + *bytes = pVbe->pInt10->bx; + if (max) + *max = pVbe->pInt10->dx; + } + + return (TRUE); +} + +Bool +VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace) +{ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f07; + pVbe->pInt10->bx = wait_retrace ? 0x80 : 0x00; + pVbe->pInt10->cx = x; + pVbe->pInt10->dx = y; + xf86ExecX86int10(pVbe->pInt10); + + if (pVbe->pInt10->ax != 0x4f) + return (FALSE); + + return (TRUE); +} + +Bool +VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y) +{ + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f07; + pVbe->pInt10->bx = 0x01; + xf86ExecX86int10(pVbe->pInt10); + + if (pVbe->pInt10->ax != 0x4f) + return (FALSE); + + *x = pVbe->pInt10->cx; + *y = pVbe->pInt10->dx; + + return (TRUE); +} + +int +VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits) +{ + /* + Input: + AX := 4F08h VBE Set/Get Palette Format + BL := 00h Set DAC Palette Format + := 01h Get DAC Palette Format + BH := Desired bits of color per primary + (Set DAC Palette Format only) + + Output: + AX := VBE Return Status + BH := Current number of bits of color per primary + */ + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f08; + if (!bits) + pVbe->pInt10->bx = 0x01; + else + pVbe->pInt10->bx = (bits & 0x00ff) << 8; + xf86ExecX86int10(pVbe->pInt10); + + if (pVbe->pInt10->ax != 0x4f) + return (0); + + return (bits != 0 ? bits : (pVbe->pInt10->bx >> 8) & 0x00ff); +} + +CARD32 * +VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, + CARD32 *data, Bool secondary, Bool wait_retrace) +{ + /* + Input: + (16-bit) + AX := 4F09h VBE Load/Unload Palette Data + BL := 00h Set Palette Data + := 01h Get Palette Data + := 02h Set Secondary Palette Data + := 03h Get Secondary Palette Data + := 80h Set Palette Data during Vertical Retrace + CX := Number of palette registers to update (to a maximum of 256) + DX := First of the palette registers to update (start) + ES:DI := Table of palette values (see below for format) + + Output: + AX := VBE Return Status + + + Input: + (32-bit) + BL := 00h Set Palette Data + := 80h Set Palette Data during Vertical Retrace + CX := Number of palette registers to update (to a maximum of 256) + DX := First of the palette registers to update (start) + ES:EDI := Table of palette values (see below for format) + DS := Selector for memory mapped registers + */ + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f09; + if (!secondary) + pVbe->pInt10->bx = set && wait_retrace ? 0x80 : set ? 0 : 1; + else + pVbe->pInt10->bx = set ? 2 : 3; + pVbe->pInt10->cx = num; + pVbe->pInt10->dx = first; + pVbe->pInt10->es = SEG_ADDR(pVbe->real_mode_base); + pVbe->pInt10->di = SEG_OFF(pVbe->real_mode_base); + if (set) + memcpy(pVbe->memory, data, num * sizeof(CARD32)); + xf86ExecX86int10(pVbe->pInt10); + + if (pVbe->pInt10->ax != 0x4f) + return (NULL); + + if (set) + return (data); + + data = xalloc(num * sizeof(CARD32)); + memcpy(data, pVbe->memory, num * sizeof(CARD32)); + + return (data); +} + +VBEpmi * +VBEGetVBEpmi(vbeInfoPtr pVbe) +{ + VBEpmi *pmi; + + /* + Input: + AH := 4Fh Super VGA support + AL := 0Ah Protected Mode Interface + BL := 00h Return Protected Mode Table + + Output: + AX := Status + ES := Real Mode Segment of Table + DI := Offset of Table + CX := Lenght of Table including protected mode code in bytes (for copying purposes) + (All other registers are preserved) + */ + + pVbe->pInt10->num = 0x10; + pVbe->pInt10->ax = 0x4f0a; + pVbe->pInt10->bx = 0; + pVbe->pInt10->di = 0; + xf86ExecX86int10(pVbe->pInt10); + + if (pVbe->pInt10->ax != 0x4f) + return (NULL); + + pmi = xalloc(sizeof(VBEpmi)); + pmi->seg_tbl = pVbe->pInt10->es; + pmi->tbl_off = pVbe->pInt10->di; + pmi->tbl_len = pVbe->pInt10->cx; + + return (pmi); +} Index: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h diff -u xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h:1.4 xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h:1.5 --- xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h:1.4 Thu Apr 20 17:28:50 2000 +++ xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h Thu Feb 15 15:00:09 2001 @@ -1,5 +1,15 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h,v 1.4 2000/04/20 21:28:50 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/os-support/vbe/vbe.h,v 1.5 2001/02/15 20:00:09 eich Exp $ */ +/* + * XFree86 vbe module + * Copyright 2000 Egbert Eich + * + * The mode query/save/set/restore functions from the vesa driver + * have been moved here. + * Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.com) + * Authors: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> + */ + #ifndef _VBE_H #define _VBE_H #include "xf86int10.h" @@ -47,4 +57,237 @@ } vbeControllerInfoRec, *vbeControllerInfoPtr; #pragma pack() + +#ifndef __GNUC__ +#define __attribute__(a) +#endif + +typedef struct _VbeInfoBlock VbeInfoBlock; +typedef struct _VbeModeInfoBlock VbeModeInfoBlock; +typedef struct _VbeCRTCInfoBlock VbeCRTCInfoBlock; + +/* + * INT 0 + */ + +struct _VbeInfoBlock { + /* VESA 1.2 fields */ + CARD8 VESASignature[4]; /* VESA */ + CARD16 VESAVersion; /* Higher byte major, lower byte minor */ + /*CARD32*/char *OEMStringPtr; /* Pointer to OEM string */ + CARD8 Capabilities[4]; /* Capabilities of the video environment */ + + /*CARD32*/CARD16 *VideoModePtr; /* pointer to supported Super VGA modes */ + + CARD16 TotalMemory; /* Number of 64kb memory blocks on board */ + /* if not VESA 2, 236 scratch bytes follow (256 bytes total size) */ + + /* VESA 2 fields */ + CARD16 OemSoftwareRev; /* VBE implementation Software revision */ + /*CARD32*/char *OemVendorNamePtr; /* Pointer to Vendor Name String */ + /*CARD32*/char *OemProductNamePtr; /* Pointer to Product Name String */ + /*CARD32*/char *OemProductRevPtr; /* Pointer to Product Revision String */ + CARD8 Reserved[222]; /* Reserved for VBE implementation */ + CARD8 OemData[256]; /* Data Area for OEM Strings */ +} __attribute__((packed)); + +/* Return Super VGA Information */ +VbeInfoBlock *VBEGetVBEInfo(vbeInfoPtr pVbe); +void VBEFreeVBEInfo(VbeInfoBlock *block); + +/* + * INT 1 + */ + +struct _VbeModeInfoBlock { + CARD16 ModeAttributes; /* mode attributes */ + CARD8 WinAAttributes; /* window A attributes */ + CARD8 WinBAttributes; /* window B attributes */ + CARD16 WinGranularity; /* window granularity */ + CARD16 WinSize; /* window size */ + CARD16 WinASegment; /* window A start segment */ + CARD16 WinBSegment; /* window B start segment */ + CARD32 WinFuncPtr; /* real mode pointer to window function */ + CARD16 BytesPerScanline; /* bytes per scanline */ + + /* Mandatory information for VBE 1.2 and above */ + CARD16 XResolution; /* horizontal resolution in pixels or characters */ + CARD16 YResolution; /* vertical resolution in pixels or characters */ + CARD8 XCharSize; /* character cell width in pixels */ + CARD8 YCharSize; /* character cell height in pixels */ + CARD8 NumberOfPlanes; /* number of memory planes */ + CARD8 BitsPerPixel; /* bits per pixel */ + CARD8 NumberOfBanks; /* number of banks */ + CARD8 MemoryModel; /* memory model type */ + CARD8 BankSize; /* bank size in KB */ + CARD8 NumberOfImages; /* number of images */ + CARD8 Reserved; /* 1 */ /* reserved for page function */ + + /* Direct color fields (required for direct/6 and YUV/7 memory models) */ + CARD8 RedMaskSize; /* size of direct color red mask in bits */ + CARD8 RedFieldPosition; /* bit position of lsb of red mask */ + CARD8 GreenMaskSize; /* size of direct color green mask in bits */ + CARD8 GreenFieldPosition; /* bit position of lsb of green mask */ + CARD8 BlueMaskSize; /* size of direct color blue mask in bits */ + CARD8 BlueFieldPosition; /* bit position of lsb of blue mask */ + CARD8 RsvdMaskSize; /* size of direct color reserved mask in bits */ + CARD8 RsvdFieldPosition; /* bit position of lsb of reserved mask */ + CARD8 DirectColorModeInfo; /* direct color mode attributes */ + + /* Mandatory information for VBE 2.0 and above */ + CARD32 PhysBasePtr; /* physical address for flat memory frame buffer */ + CARD32 Reserved32; /* 0 */ /* Reserved - always set to 0 */ + CARD16 Reserved16; /* 0 */ /* Reserved - always set to 0 */ + + /* Mandatory information for VBE 3.0 and above */ + CARD16 LinBytesPerScanLine; /* bytes per scan line for linear modes */ + CARD8 BnkNumberOfImagePages; /* number of images for banked modes */ + CARD8 LinNumberOfImagePages; /* number of images for linear modes */ + CARD8 LinRedMaskSize; /* size of direct color red mask (linear modes) */ + CARD8 LinRedFieldPosition; /* bit position of lsb of red mask (linear modes) */ + CARD8 LinGreenMaskSize; /* size of direct color green mask (linear modes) */ + CARD8 LinGreenFieldPosition; /* bit position of lsb of green mask (linear modes) */ + CARD8 LinBlueMaskSize; /* size of direct color blue mask (linear modes) */ + CARD8 LinBlueFieldPosition; /* bit position of lsb of blue mask (linear modes) */ + CARD8 LinRsvdMaskSize; /* size of direct color reserved mask (linear modes) */ + CARD8 LinRsvdFieldPosition; /* bit position of lsb of reserved mask (linear modes) */ + CARD32 MaxPixelClock; /* maximum pixel clock (in Hz) for graphics mode */ + CARD8 Reserved2[189]; /* remainder of VbeModeInfoBlock */ +} __attribute__((packed)); + +/* Return VBE Mode Information */ +VbeModeInfoBlock *VBEGetModeInfo(vbeInfoPtr pVbe, int mode); +void VBEFreeModeInfo(VbeModeInfoBlock *block); + +/* + * INT2 + */ + +#define CRTC_DBLSCAN (1<<0) +#define CRTC_INTERLACE (1<<1) +#define CRTC_NHSYNC (1<<2) +#define CRTC_NVSYNC (1<<3) + +struct _VbeCRTCInfoBlock { + CARD16 HorizontalTotal; /* Horizontal total in pixels */ + CARD16 HorizontalSyncStart; /* Horizontal sync start in pixels */ + CARD16 HorizontalSyncEnd; /* Horizontal sync end in pixels */ + CARD16 VerticalTotal; /* Vertical total in lines */ + CARD16 VerticalSyncStart; /* Vertical sync start in lines */ + CARD16 VerticalSyncEnd; /* Vertical sync end in lines */ + CARD8 Flags; /* Flags (Interlaced, Double Scan etc) */ + CARD32 PixelClock; /* Pixel clock in units of Hz */ + CARD16 RefreshRate; /* Refresh rate in units of 0.01 Hz */ + CARD8 Reserved[40]; /* remainder of ModeInfoBlock */ +} __attribute__((packed)); +/* VbeCRTCInfoBlock is in the VESA 3.0 specs */ + +Bool VBESetVBEMode(vbeInfoPtr pVbe, int mode, VbeCRTCInfoBlock *crtc); + +/* + * INT 3 + */ + +Bool VBEGetVBEMode(vbeInfoPtr pVbe, int *mode); + +/* + * INT 4 + */ + +/* Save/Restore Super VGA video state */ +/* function values are (values stored in VESAPtr): + * 0 := query & allocate amount of memory to save state + * 1 := save state + * 2 := restore state + * + * function 0 called automatically if function 1 called without + * a previous call to function 0. + */ + +typedef enum { + MODE_QUERY, + MODE_SAVE, + MODE_RESTORE +} vbeSaveRestoreFunction; + +Bool +VBESaveRestore(vbeInfoPtr pVbe, vbeSaveRestoreFunction fuction, + pointer *memory, int *size, int *real_mode_pages); + +/* + * INT 5 + */ + +Bool +VBEBankSwitch(vbeInfoPtr pVbe, unsigned int iBank, int window); + +/* + * INT 6 + */ + +typedef enum { + SCANWID_SET, + SCANWID_GET, + SCANWID_SET_BYTES, + SCANWID_GET_MAX +} vbeScanwidthCommand; + +#define VBESetLogicalScanline(pVbe, width) \ + VBESetGetLogicalScanlineLength(pVbe, SCANWID_SET, \ + width, NULL, NULL, NULL) +#define VBESetLogicalScanlineBytes(pVbe, width) \ + VBESetGetLogicalScanlineLength(pVbe, width, SCANWID_SET_BYTES, \ + NULL, NULL, NULL) +#define VBEGetLogicalScanline(pVbe, pixels, bytes, max) \ + VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET, NULL, \ + pixels, bytes, max) +#define VBEGetMaxLogicalScanline(pVbe, pixels, bytes, max) \ + VBESetGetLogicalScanlineLength(pVbe, SCANWID_GET_MAX, \ + NULL, pixels, bytes, max) +Bool VBESetGetLogicalScanlineLength(vbeInfoPtr pVbe, + vbeScanwidthCommand command, int width, + int *pixels, int *bytes, int *max); + +/* + * INT 7 + */ + +/* 16 bit code */ +Bool VBESetDisplayStart(vbeInfoPtr pVbe, int x, int y, Bool wait_retrace); +Bool VBEGetDisplayStart(vbeInfoPtr pVbe, int *x, int *y); + +/* + * INT 8 + */ + +/* if bits is 0, then it is a GET */ +int VBESetGetDACPaletteFormat(vbeInfoPtr pVbe, int bits); + +/* + * INT 9 + */ + +/* + * If getting a palette, the data argument is not used. It will return + * the data. + * If setting a palette, it will return the pointer received on success, + * NULL on failure. + */ +CARD32 *VBESetGetPaletteData(vbeInfoPtr pVbe, Bool set, int first, int num, + CARD32 *data, Bool secondary, Bool wait_retrace); +#define VBEFreePaletteData(data) xfree(data) + +/* + * INT A + */ + +typedef struct _VBEpmi { + int seg_tbl; + int tbl_off; + int tbl_len; +} VBEpmi; + +VBEpmi *VBEGetVBEpmi(vbeInfoPtr pVbe); +#define VESAFreeVBEpmi(pmi) xfree(pmi) + #endif Index: xc/programs/Xserver/hw/xfree86/parser/Configint.h diff -u xc/programs/Xserver/hw/xfree86/parser/Configint.h:1.16 xc/programs/Xserver/hw/xfree86/parser/Configint.h:1.17 --- xc/programs/Xserver/hw/xfree86/parser/Configint.h:1.16 Fri Oct 20 10:59:02 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Configint.h Wed Feb 21 18:37:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Configint.h,v 1.16 2000/10/20 14:59:02 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Configint.h,v 1.17 2001/02/21 23:37:04 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -184,6 +184,8 @@ #define GROUP_MSG \ "The Group keyword must be followed by either a group name in quotes or\n" \ "\ta numerical group id." +#define MULTIPLE_MSG \ +"Multiple \"%s\" lines." /* Warning messages */ #define OBSOLETE_MSG \ Index: xc/programs/Xserver/hw/xfree86/parser/DRI.c diff -u xc/programs/Xserver/hw/xfree86/parser/DRI.c:1.8 xc/programs/Xserver/hw/xfree86/parser/DRI.c:1.9 --- xc/programs/Xserver/hw/xfree86/parser/DRI.c:1.8 Thu Nov 30 15:45:33 2000 +++ xc/programs/Xserver/hw/xfree86/parser/DRI.c Thu Mar 8 16:32:35 2001 @@ -24,7 +24,7 @@ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * - * $XFree86: xc/programs/Xserver/hw/xfree86/parser/DRI.c,v 1.8 2000/11/30 20:45:33 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/parser/DRI.c,v 1.9 2001/03/08 21:32:35 anderson Exp $ * */ @@ -129,6 +129,7 @@ if (ptr == NULL) return; + fprintf (cf, "Section \"DRI\"\n"); if (ptr->dri_group_name) fprintf (cf, "\tGroup \"%s\"\n", ptr->dri_group_name); else if (ptr->dri_group >= 0) @@ -141,6 +142,7 @@ if (bufs->buf_flags) fprintf (cf, " \"%s\"", bufs->buf_flags); fprintf (cf, "\n"); } + fprintf (cf, "EndSection\n\n"); } void Index: xc/programs/Xserver/hw/xfree86/parser/Device.c diff -u xc/programs/Xserver/hw/xfree86/parser/Device.c:1.17 xc/programs/Xserver/hw/xfree86/parser/Device.c:1.18 --- xc/programs/Xserver/hw/xfree86/parser/Device.c:1.17 Thu Nov 30 15:45:33 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Device.c Wed Feb 21 18:37:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Device.c,v 1.17 2000/11/30 20:45:33 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Device.c,v 1.18 2001/02/21 23:37:04 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -89,6 +89,8 @@ case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->dev_identifier = val.str; has_ident = TRUE; break; Index: xc/programs/Xserver/hw/xfree86/parser/Imakefile diff -u xc/programs/Xserver/hw/xfree86/parser/Imakefile:1.11 xc/programs/Xserver/hw/xfree86/parser/Imakefile:1.12 --- xc/programs/Xserver/hw/xfree86/parser/Imakefile:1.11 Thu Mar 2 12:53:13 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Imakefile Fri Jan 12 14:28:35 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Imakefile,v 1.11 2000/03/02 17:53:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Imakefile,v 1.12 2001/01/12 19:28:35 dawes Exp $ */ @@ -39,7 +39,7 @@ CONFIG_DEFINES = -DXCONFIGDIR=\"$(XCONFIGDIR)\" \ -DXCONFIGFILE=\"$(XCONFIGFILE)\" \ - -DXVERSION=$(XVERS) + -DXVERSION="$(XVERS)" #include <Library.tmpl> Index: xc/programs/Xserver/hw/xfree86/parser/Input.c diff -u xc/programs/Xserver/hw/xfree86/parser/Input.c:1.5 xc/programs/Xserver/hw/xfree86/parser/Input.c:1.6 --- xc/programs/Xserver/hw/xfree86/parser/Input.c:1.5 Fri Oct 20 10:59:02 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Input.c Wed Feb 21 18:37:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Input.c,v 1.5 2000/10/20 14:59:02 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Input.c,v 1.6 2001/02/21 23:37:04 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -66,6 +66,8 @@ case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->inp_identifier = val.str; has_ident = TRUE; break; Index: xc/programs/Xserver/hw/xfree86/parser/Layout.c diff -u xc/programs/Xserver/hw/xfree86/parser/Layout.c:1.13 xc/programs/Xserver/hw/xfree86/parser/Layout.c:1.14 --- xc/programs/Xserver/hw/xfree86/parser/Layout.c:1.13 Fri Oct 20 10:59:02 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Layout.c Wed Feb 21 18:37:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Layout.c,v 1.13 2000/10/20 14:59:02 alanh Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Layout.c,v 1.14 2001/02/21 23:37:04 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -78,6 +78,8 @@ case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->lay_identifier = val.str; has_ident = TRUE; break; Index: xc/programs/Xserver/hw/xfree86/parser/Monitor.c diff -u xc/programs/Xserver/hw/xfree86/parser/Monitor.c:1.18.2.1 xc/programs/Xserver/hw/xfree86/parser/Monitor.c:1.20 --- xc/programs/Xserver/hw/xfree86/parser/Monitor.c:1.18.2.1 Fri Feb 9 15:45:11 2001 +++ xc/programs/Xserver/hw/xfree86/parser/Monitor.c Wed Feb 21 18:37:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.18.2.1 2001/02/09 20:45:11 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Monitor.c,v 1.20 2001/02/21 23:37:04 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -391,6 +391,8 @@ case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->mon_identifier = val.str; has_ident = TRUE; break; @@ -437,7 +439,10 @@ (float)val.realnum < ptr->mon_hsync[ptr->mon_n_hsync].lo) Error (HORIZSYNC_MSG, NULL); ptr->mon_hsync[ptr->mon_n_hsync].hi = val.realnum; - break; + if (token = xf86getToken (NULL) == COMMA) + break; + ptr->mon_n_hsync++; + goto HorizDone; default: /* We cannot currently know if a '\n' was found, * or this is a real error @@ -471,7 +476,10 @@ (float)val.realnum < ptr->mon_vrefresh[ptr->mon_n_vrefresh].lo) Error (VERTREFRESH_MSG, NULL); ptr->mon_vrefresh[ptr->mon_n_vrefresh].hi = val.realnum; - break; + if (token = xf86getToken (NULL) == COMMA) + break; + ptr->mon_n_vrefresh++; + goto VertDone; default: /* We cannot currently know if a '\n' was found, * or this is a real error @@ -589,6 +597,8 @@ case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->modes_identifier = val.str; has_ident = TRUE; break; Index: xc/programs/Xserver/hw/xfree86/parser/Screen.c diff -u xc/programs/Xserver/hw/xfree86/parser/Screen.c:1.16 xc/programs/Xserver/hw/xfree86/parser/Screen.c:1.17 --- xc/programs/Xserver/hw/xfree86/parser/Screen.c:1.16 Fri Dec 1 11:10:01 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Screen.c Thu Feb 15 14:54:40 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Screen.c,v 1.16 2000/12/01 16:10:01 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Screen.c,v 1.17 2001/02/15 19:54:40 eich Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -315,6 +315,7 @@ if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "SubSection"); { + xf86conffree(val.str); HANDLE_LIST (scrn_display_lst, xf86parseDisplaySubSection, XF86ConfDisplayPtr); } Index: xc/programs/Xserver/hw/xfree86/parser/Vendor.c diff -u xc/programs/Xserver/hw/xfree86/parser/Vendor.c:1.8 xc/programs/Xserver/hw/xfree86/parser/Vendor.c:1.9 --- xc/programs/Xserver/hw/xfree86/parser/Vendor.c:1.8 Thu Nov 30 15:45:34 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Vendor.c Wed Feb 21 18:37:04 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Vendor.c,v 1.8 2000/11/30 20:45:34 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Vendor.c,v 1.9 2001/02/21 23:37:04 paulo Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -48,6 +48,7 @@ XF86ConfVendSubPtr xf86parseVendorSubSection (void) { + int has_ident = FALSE; parsePrologue (XF86ConfVendSubPtr, XF86ConfVendSubRec) while ((token = xf86getToken (VendorSubTab)) != ENDSUBSECTION) @@ -57,7 +58,10 @@ case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->vs_identifier = val.str; + has_ident = TRUE; break; case OPTION: { @@ -129,6 +133,8 @@ case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->vnd_identifier = val.str; has_ident = TRUE; break; Index: xc/programs/Xserver/hw/xfree86/parser/Video.c diff -u xc/programs/Xserver/hw/xfree86/parser/Video.c:1.6 xc/programs/Xserver/hw/xfree86/parser/Video.c:1.7 --- xc/programs/Xserver/hw/xfree86/parser/Video.c:1.6 Thu Nov 30 15:45:34 2000 +++ xc/programs/Xserver/hw/xfree86/parser/Video.c Wed Feb 21 18:37:04 2001 @@ -25,7 +25,7 @@ * in this Software without prior written authorization from Metro Link. * */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.6 2000/11/30 20:45:34 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/Video.c,v 1.7 2001/02/21 23:37:04 paulo Exp $ */ /* View/edit this file with tab stops set to 4 */ @@ -48,6 +48,7 @@ XF86ConfVideoPortPtr xf86parseVideoPortSubSection (void) { + int has_ident = FALSE; parsePrologue (XF86ConfVideoPortPtr, XF86ConfVideoPortRec) while ((token = xf86getToken (VideoPortTab)) != ENDSUBSECTION) @@ -57,7 +58,10 @@ case IDENTIFIER: if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); ptr->vp_identifier = val.str; + has_ident = TRUE; break; case OPTION: { @@ -129,6 +133,8 @@ if (xf86getToken (NULL) != STRING) Error (QUOTE_MSG, "Identifier"); ptr->va_identifier = val.str; + if (has_ident == TRUE) + Error (MULTIPLE_MSG, "Identifier"); has_ident = TRUE; break; case VENDOR: Index: xc/programs/Xserver/hw/xfree86/parser/read.c diff -u xc/programs/Xserver/hw/xfree86/parser/read.c:1.17 xc/programs/Xserver/hw/xfree86/parser/read.c:1.18 --- xc/programs/Xserver/hw/xfree86/parser/read.c:1.17 Wed Dec 6 10:35:32 2000 +++ xc/programs/Xserver/hw/xfree86/parser/read.c Thu Feb 15 14:54:40 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/read.c,v 1.17 2000/12/06 15:35:32 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/read.c,v 1.18 2001/02/15 19:54:40 eich Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -69,77 +69,109 @@ xf86setSection (val.str); if (xf86nameCompare (val.str, "files") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_RETURN (conf_files, xf86parseFilesSection ()); } else if (xf86nameCompare (val.str, "serverflags") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_RETURN (conf_flags, xf86parseFlagsSection ()); } else if (xf86nameCompare (val.str, "keyboard") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_LIST (conf_input_lst, xf86parseKeyboardSection, XF86ConfInputPtr); } else if (xf86nameCompare (val.str, "pointer") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_LIST (conf_input_lst, xf86parsePointerSection, XF86ConfInputPtr); } else if (xf86nameCompare (val.str, "videoadaptor") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_LIST (conf_videoadaptor_lst, xf86parseVideoAdaptorSection, XF86ConfVideoAdaptorPtr); } else if (xf86nameCompare (val.str, "device") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_LIST (conf_device_lst, xf86parseDeviceSection, XF86ConfDevicePtr); } else if (xf86nameCompare (val.str, "monitor") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_LIST (conf_monitor_lst, xf86parseMonitorSection, XF86ConfMonitorPtr); } else if (xf86nameCompare (val.str, "modes") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_LIST (conf_modes_lst, xf86parseModesSection, XF86ConfModesPtr); } else if (xf86nameCompare (val.str, "screen") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_LIST (conf_screen_lst, xf86parseScreenSection, XF86ConfScreenPtr); } else if (xf86nameCompare(val.str, "inputdevice") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_LIST (conf_input_lst, xf86parseInputSection, XF86ConfInputPtr); } else if (xf86nameCompare (val.str, "module") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_RETURN (conf_modules, xf86parseModuleSection ()); } else if (xf86nameCompare (val.str, "serverlayout") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_LIST (conf_layout_lst, xf86parseLayoutSection, XF86ConfLayoutPtr); } else if (xf86nameCompare (val.str, "vendor") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_LIST (conf_vendor_lst, xf86parseVendorSection, XF86ConfVendorPtr); } else if (xf86nameCompare (val.str, "dri") == 0) { + xf86conffree(val.str); + val.str = NULL; HANDLE_RETURN (conf_dri, xf86parseDRISection ()); } else { Error (INVALID_SECTION_MSG, xf86tokenString ()); + xf86conffree(val.str); + val.str = NULL; } break; default: Error (INVALID_KEYWORD_MSG, xf86tokenString ()); + xf86conffree(val.str); + val.str = NULL; } } Index: xc/programs/Xserver/hw/xfree86/parser/scan.c diff -u xc/programs/Xserver/hw/xfree86/parser/scan.c:1.14 xc/programs/Xserver/hw/xfree86/parser/scan.c:1.16 --- xc/programs/Xserver/hw/xfree86/parser/scan.c:1.14 Thu Nov 2 14:58:20 2000 +++ xc/programs/Xserver/hw/xfree86/parser/scan.c Thu Feb 15 14:54:41 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/scan.c,v 1.14 2000/11/02 19:58:20 anderson Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/scan.c,v 1.16 2001/02/15 19:54:41 eich Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -70,7 +70,7 @@ static int configLineNo = 0; /* linenumber */ static char *configBuf, *configRBuf; /* buffer for lines */ static char *configPath; /* path to config file */ -static char *configSection; /* name of current section being parsed */ +static char *configSection = NULL; /* name of current section being parsed */ static int pushToken = LOCK_TOKEN; LexRec val; @@ -373,7 +373,11 @@ #endif #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 @@ -622,7 +626,9 @@ } template = strtok(NULL, ","); } + xf86conffree(pathcopy); if (!configFile) { + return NULL; } @@ -817,10 +823,14 @@ xf86closeConfigFile (void) { xf86conffree (configPath); + configPath = NULL; xf86conffree (configRBuf); + configRBuf = NULL; xf86conffree (configBuf); + configBuf = NULL; fclose (configFile); + configFile = NULL; } void @@ -901,7 +911,10 @@ void xf86setSection (char *section) { - configSection = section; + if (configSection) + xf86conffree(configSection); + configSection = xf86confmalloc(strlen (section) + 1); + strcpy (configSection, section); } /* Index: xc/programs/Xserver/hw/xfree86/parser/write.c diff -u xc/programs/Xserver/hw/xfree86/parser/write.c:1.12 xc/programs/Xserver/hw/xfree86/parser/write.c:1.13 --- xc/programs/Xserver/hw/xfree86/parser/write.c:1.12 Tue Nov 14 12:33:01 2000 +++ xc/programs/Xserver/hw/xfree86/parser/write.c Thu Mar 8 16:32:35 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/write.c,v 1.12 2000/11/14 17:33:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/parser/write.c,v 1.13 2001/03/08 21:32:35 anderson Exp $ */ /* * * Copyright (c) 1997 Metro Link Incorporated @@ -98,9 +98,7 @@ xf86printScreenSection (cf, cptr->conf_screen_lst); - fprintf (cf, "Section \"DRI\"\n"); xf86printDRISection (cf, cptr->conf_dri); - fprintf (cf, "EndSection\n\n"); fclose(cf); return 1; Index: xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES diff -u xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES:1.3 xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES:1.4 --- xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES:1.3 Sun Jan 31 07:22:05 1999 +++ xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES Tue May 8 23:12:06 2001 @@ -100,6 +100,22 @@ they should be the pixel values from the current colormap. + /* Cursor data loading flags */ + + HARDWARE_CURSOR_SHOW_TRANSPARENT + + The HideCursor entry will normally be called instead of displaying a + completely transparent cursor. This flag prevents this behaviour, thus + causing the LoadCursorImage entry to be called with the transparent cursor + data. + + HARDWARE_CURSOR_UPDATE_UNHIDDEN + + This flag prevents the HideCursor call that would normally occur just before + the LoadCursorImage entry is to be called to load a new hardware cursor + image. + + /* Cursor data packing flags */ Hardware cursor data consists of two pieces, a source and a mask. @@ -169,4 +185,4 @@ -$XFree86: xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES,v 1.3 1999/01/31 12:22:05 dawes Exp $ +$XFree86: xc/programs/Xserver/hw/xfree86/ramdac/CURSOR.NOTES,v 1.4 2001/05/09 03:12:06 tsi Exp $ Index: xc/programs/Xserver/hw/xfree86/ramdac/IBM.c diff -u xc/programs/Xserver/hw/xfree86/ramdac/IBM.c:1.10 xc/programs/Xserver/hw/xfree86/ramdac/IBM.c:1.11 --- xc/programs/Xserver/hw/xfree86/ramdac/IBM.c:1.10 Sun Mar 28 10:33:01 1999 +++ xc/programs/Xserver/hw/xfree86/ramdac/IBM.c Sun Apr 8 20:04:12 2001 @@ -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 @@ 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; Index: xc/programs/Xserver/hw/xfree86/ramdac/Imakefile diff -u xc/programs/Xserver/hw/xfree86/ramdac/Imakefile:1.9 xc/programs/Xserver/hw/xfree86/ramdac/Imakefile:1.10 --- xc/programs/Xserver/hw/xfree86/ramdac/Imakefile:1.9 Sat Aug 14 06:50:07 1999 +++ xc/programs/Xserver/hw/xfree86/ramdac/Imakefile Mon Apr 23 12:17:11 2001 @@ -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 @@ 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() Index: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c diff -u xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c:1.7 xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c:1.9 --- xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c:1.7 Mon Apr 24 19:40:27 2000 +++ xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.c Fri May 18 16:22:31 2001 @@ -1,20 +1,10 @@ -/* $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.9 2001/05/18 20:22:31 tsi Exp $ */ -#include "misc.h" #include "xf86.h" #include "xf86_ansic.h" -#include "xf86_OSproc.h" -#include "xf86str.h" - -#include "X.h" -#include "scrnintstr.h" -#include "pixmapstr.h" -#include "windowstr.h" -#include "xf86str.h" -#include "cursorstr.h" +#include "xf86CursorPriv.h" #include "colormapst.h" -#include "mi.h" -#include "xf86Cursor.h" +#include "cursorstr.h" int xf86CursorScreenIndex = -1; static unsigned long xf86CursorGeneration = 0; @@ -38,8 +28,8 @@ 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 +38,30 @@ 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 +77,31 @@ 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 +114,127 @@ 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, - ScreenPriv->x, ScreenPriv->y); + /* + * Cannot restore cursor here because the new frame[XY][01] haven't been + * calculated yet. + */ + ScreenPriv->CursorToRestore = ScreenPriv->CurrentCursor; 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,153 +242,141 @@ (*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; ScreenPriv->CurrentCursor = pCurs; ScreenPriv->x = x; ScreenPriv->y = y; + ScreenPriv->CursorToRestore = NULL; - 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->CursorToRestore) + xf86CursorSetCursor(pScreen, ScreenPriv->CursorToRestore, + ScreenPriv->x, ScreenPriv->y); + else 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); } - - - - - - - - Index: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h diff -u xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h:1.4 xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h:1.7 --- xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h:1.4 Sun Mar 14 06:18:08 1999 +++ xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h Fri May 18 16:22:31 2001 @@ -1,9 +1,10 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h,v 1.4 1999/03/14 11:18:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86Cursor.h,v 1.7 2001/05/18 20:22:31 tsi Exp $ */ #ifndef _XF86CURSOR_H #define _XF86CURSOR_H -#include "mipointrst.h" +#include "xf86str.h" +#include "mipointer.h" typedef struct _xf86CursorInfoRec { ScrnInfoPtr pScrn; @@ -20,28 +21,6 @@ } xf86CursorInfoRec, *xf86CursorInfoPtr; -typedef struct { - Bool SWCursor; - Bool isUp; - short HotX; - short HotY; - short x; - short y; - CursorPtr CurrentCursor; - xf86CursorInfoPtr CursorInfoPtr; - CloseScreenProcPtr CloseScreen; - RecolorCursorProcPtr RecolorCursor; - InstallColormapProcPtr InstallColormap; - QueryBestSizeProcPtr QueryBestSize; - miPointerSpriteFuncPtr spriteFuncs; - Bool PalettedCursor; - ColormapPtr pInstalledMap; - Bool (*SwitchMode)(int, DisplayModePtr,int); - Bool (*EnterVT)(int, int); - void (*LeaveVT)(int, int); - int (*SetDGAMode)(int, int, DGADevicePtr); -} xf86CursorScreenRec, *xf86CursorScreenPtr; - Bool xf86InitCursor( ScreenPtr pScreen, xf86CursorInfoPtr infoPtr @@ -70,5 +49,7 @@ #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 */ Index: xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h diff -u xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h:1.1 xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h:1.2 --- xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h:1.1 Sat Aug 29 10:34:41 1998 +++ xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h Fri May 18 16:22:31 2001 @@ -1,7 +1,33 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h,v 1.1 1998/08/29 14:34:41 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/ramdac/xf86CursorPriv.h,v 1.2 2001/05/18 20:22:31 tsi Exp $ */ #ifndef _XF86CURSORPRIV_H #define _XF86CURSORPRIV_H + +#include "xf86Cursor.h" +#include "mipointrst.h" + +typedef struct { + Bool SWCursor; + Bool isUp; + Bool showTransparent; + short HotX; + short HotY; + short x; + short y; + CursorPtr CurrentCursor, CursorToRestore; + xf86CursorInfoPtr CursorInfoPtr; + CloseScreenProcPtr CloseScreen; + RecolorCursorProcPtr RecolorCursor; + InstallColormapProcPtr InstallColormap; + QueryBestSizeProcPtr QueryBestSize; + miPointerSpriteFuncPtr spriteFuncs; + Bool PalettedCursor; + ColormapPtr pInstalledMap; + Bool (*SwitchMode)(int, DisplayModePtr,int); + Bool (*EnterVT)(int, int); + void (*LeaveVT)(int, int); + int (*SetDGAMode)(int, int, DGADevicePtr); +} xf86CursorScreenRec, *xf86CursorScreenPtr; CARD32 xf86ReverseBitOrder(CARD32 data); Index: xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c diff -u xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c:1.6 xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c:1.10 --- xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c:1.6 Tue Feb 8 08:13:32 2000 +++ xc/programs/Xserver/hw/xfree86/ramdac/xf86HWCurs.c Fri May 18 16:22:31 2001 @@ -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.10 2001/05/18 20:22:31 tsi Exp $ */ #include "misc.h" #include "xf86.h" @@ -13,7 +13,6 @@ #include "cursorstr.h" #include "mi.h" #include "mipointer.h" -#include "xf86Cursor.h" #include "xf86CursorPriv.h" #include "servermd.h" @@ -47,7 +46,7 @@ p[6] = byte_reversed[p[6]]; p[7] = byte_reversed[p[7]]; - return(w); + return w; } #endif @@ -60,8 +59,6 @@ #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 +66,18 @@ 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 +91,48 @@ } 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 +142,32 @@ (*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 +181,20 @@ 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 +207,7 @@ 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,36 +223,37 @@ 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--; - pSrc+=DstPitch, pMsk+=DstPitch, SrcS+=SrcPitch, SrcM+=SrcPitch) { - for(x = 0; x < Pitch; x++) { - pSrc[x] = SrcS[x]; - pMsk[x] = SrcM[x]; + if (infoPtr->Flags & HARDWARE_CURSOR_AND_SOURCE_WITH_MASK) { + 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] & SrcM[x]; + pMsk[x] = SrcM[x]; + } } - } - - if(infoPtr->Flags & HARDWARE_CURSOR_AND_SOURCE_WITH_MASK) { - int count = words; - SCANLINE* pntr = DstS; - SCANLINE* pntr2 = DstM; - while(count--) { - *pntr &= *pntr2; - pntr++; pntr2++; + } else { + 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]; + pMsk[x] = SrcM[x]; + } } } - 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 @@ * 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 @@ return mem; } -static unsigned char* +static unsigned char* RealizeCursorInterleave1(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { unsigned char *DstS, *DstM; @@ -307,17 +304,17 @@ 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 @@ return mem; } -static unsigned char* +static unsigned char* RealizeCursorInterleave8(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { unsigned char *DstS, *DstM; @@ -350,17 +347,17 @@ 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 @@ return mem; } -static unsigned char* +static unsigned char* RealizeCursorInterleave16(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { unsigned short *DstS, *DstM; @@ -385,17 +382,17 @@ 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 @@ return mem; } -static unsigned char* +static unsigned char* RealizeCursorInterleave32(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { CARD32 *DstS, *DstM; @@ -420,17 +417,17 @@ 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 @@ return mem; } -static unsigned char* +static unsigned char* RealizeCursorInterleave64(xf86CursorInfoPtr infoPtr, CursorPtr pCurs) { CARD32 *DstS, *DstM; @@ -455,17 +452,17 @@ 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++; Index: xc/programs/Xserver/hw/xfree86/reconfig/reconfig.man diff -u xc/programs/Xserver/hw/xfree86/reconfig/reconfig.man:3.8 xc/programs/Xserver/hw/xfree86/reconfig/reconfig.man:3.9 --- xc/programs/Xserver/hw/xfree86/reconfig/reconfig.man:3.8 Sat Apr 4 21:28:42 1998 +++ xc/programs/Xserver/hw/xfree86/reconfig/reconfig.man Sat Jan 27 13:20:59 2001 @@ -1,5 +1,5 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/reconfig/reconfig.man,v 3.8 1998/04/05 02:28:42 dawes Exp $ -.TH reconfig 1 "Version 3.2" "XFree86" +.\" $XFree86: xc/programs/Xserver/hw/xfree86/reconfig/reconfig.man,v 3.9 2001/01/27 18:20:59 dawes Exp $ +.TH reconfig 1 __vendorversion__ .SH NAME reconfig \- convert old Xconfig to new XF86Config .SH SYNOPSIS Index: xc/programs/Xserver/hw/xfree86/vgahw/vgaCmap.c diff -u xc/programs/Xserver/hw/xfree86/vgahw/vgaCmap.c:1.5 xc/programs/Xserver/hw/xfree86/vgahw/vgaCmap.c:1.7 --- xc/programs/Xserver/hw/xfree86/vgahw/vgaCmap.c:1.5 Sun Nov 22 05:37:38 1998 +++ xc/programs/Xserver/hw/xfree86/vgahw/vgaCmap.c Thu Feb 15 13:31:22 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaCmap.c,v 1.5 1998/11/22 10:37:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaCmap.c,v 1.7 2001/02/15 18:31:22 eich Exp $ */ /* * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. * @@ -35,11 +35,9 @@ #include "vgaHW.h" #include "xf86_ansic.h" -#ifdef XFreeXDGA #define _XF86DGA_SERVER_ #include "extensions/xf86dgastr.h" #include "dgaproc.h" -#endif #define NOMAPYET (ColormapPtr) 0 @@ -105,7 +103,6 @@ } writeColormap = scrninfp->vtSema; -#ifdef XFreeXDGA if (DGAAvailable(scrnIndex)) { writeColormap = writeColormap || @@ -113,7 +110,6 @@ !(DGAGetFlags(scrnIndex) & XF86DGADirectColormap)) || (DGAGetFlags(scrnIndex) & XF86DGAHasColormap); } -#endif if (writeColormap) hwp->enablePalette(hwp); @@ -260,7 +256,6 @@ defs[i].blue = prgb[i].blue; defs[i].flags = DoRed|DoGreen|DoBlue; } - pmap->pScreen->StoreColors(pmap, entries, defs); WalkTree(pmap->pScreen, TellGainedMap, &pmap->mid); Index: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c diff -u xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c:1.42.2.1 xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c:1.50 --- xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c:1.42.2.1 Tue Feb 13 16:06:19 2001 +++ xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c Thu May 10 18:18:57 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.42.2.1 2001/02/13 21:06:19 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.c,v 1.50 2001/05/10 22:18:57 dbateman Exp $ */ /* * @@ -155,67 +155,67 @@ static void stdWriteCrtc(vgaHWPtr hwp, CARD8 index, CARD8 value) { - outb(hwp->IOBase + VGA_CRTC_INDEX_OFFSET, index); - outb(hwp->IOBase + VGA_CRTC_DATA_OFFSET, value); + outb(hwp->IOBase + hwp->PIOOffset + VGA_CRTC_INDEX_OFFSET, index); + outb(hwp->IOBase + hwp->PIOOffset + VGA_CRTC_DATA_OFFSET, value); } static CARD8 stdReadCrtc(vgaHWPtr hwp, CARD8 index) { - outb(hwp->IOBase + VGA_CRTC_INDEX_OFFSET, index); - return inb(hwp->IOBase + VGA_CRTC_DATA_OFFSET); + outb(hwp->IOBase + hwp->PIOOffset + VGA_CRTC_INDEX_OFFSET, index); + return inb(hwp->IOBase + hwp->PIOOffset + VGA_CRTC_DATA_OFFSET); } static void stdWriteGr(vgaHWPtr hwp, CARD8 index, CARD8 value) { - outb(VGA_GRAPH_INDEX, index); - outb(VGA_GRAPH_DATA, value); + outb(hwp->PIOOffset + VGA_GRAPH_INDEX, index); + outb(hwp->PIOOffset + VGA_GRAPH_DATA, value); } static CARD8 stdReadGr(vgaHWPtr hwp, CARD8 index) { - outb(VGA_GRAPH_INDEX, index); - return inb(VGA_GRAPH_DATA); + outb(hwp->PIOOffset + VGA_GRAPH_INDEX, index); + return inb(hwp->PIOOffset + VGA_GRAPH_DATA); } static void stdWriteSeq(vgaHWPtr hwp, CARD8 index, CARD8 value) { - outb(VGA_SEQ_INDEX, index); - outb(VGA_SEQ_DATA, value); + outb(hwp->PIOOffset + VGA_SEQ_INDEX, index); + outb(hwp->PIOOffset + VGA_SEQ_DATA, value); } static CARD8 stdReadSeq(vgaHWPtr hwp, CARD8 index) { - outb(VGA_SEQ_INDEX, index); - return inb(VGA_SEQ_DATA); + outb(hwp->PIOOffset + VGA_SEQ_INDEX, index); + return inb(hwp->PIOOffset + VGA_SEQ_DATA); } static CARD8 stdReadST00(vgaHWPtr hwp) { - return inb(VGA_IN_STAT_0); + return inb(hwp->PIOOffset + VGA_IN_STAT_0); } static CARD8 stdReadST01(vgaHWPtr hwp) { - return inb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); + return inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET); } static CARD8 stdReadFCR(vgaHWPtr hwp) { - return inb(VGA_FEATURE_R); + return inb(hwp->PIOOffset + VGA_FEATURE_R); } static void stdWriteFCR(vgaHWPtr hwp, CARD8 value) { - outb(hwp->IOBase + VGA_FEATURE_W_OFFSET,value); + outb(hwp->IOBase + hwp->PIOOffset + VGA_FEATURE_W_OFFSET,value); } static void @@ -228,9 +228,9 @@ else index |= 0x20; - tmp = inb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); - outb(VGA_ATTR_INDEX, index); - outb(VGA_ATTR_DATA_W, value); + tmp = inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET); + outb(hwp->PIOOffset + VGA_ATTR_INDEX, index); + outb(hwp->PIOOffset + VGA_ATTR_DATA_W, value); } static CARD8 @@ -243,21 +243,21 @@ else index |= 0x20; - tmp = inb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); - outb(VGA_ATTR_INDEX, index); - return inb(VGA_ATTR_DATA_R); + tmp = inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET); + outb(hwp->PIOOffset + VGA_ATTR_INDEX, index); + return inb(hwp->PIOOffset + VGA_ATTR_DATA_R); } static void stdWriteMiscOut(vgaHWPtr hwp, CARD8 value) { - outb(VGA_MISC_OUT_W, value); + outb(hwp->PIOOffset + VGA_MISC_OUT_W, value); } static CARD8 stdReadMiscOut(vgaHWPtr hwp) { - return inb(VGA_MISC_OUT_R); + return inb(hwp->PIOOffset + VGA_MISC_OUT_R); } static void @@ -265,8 +265,8 @@ { CARD8 tmp; - tmp = inb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); - outb(VGA_ATTR_INDEX, 0x00); + tmp = inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET); + outb(hwp->PIOOffset + VGA_ATTR_INDEX, 0x00); hwp->paletteEnabled = TRUE; } @@ -275,47 +275,59 @@ { CARD8 tmp; - tmp = inb(hwp->IOBase + VGA_IN_STAT_1_OFFSET); - outb(VGA_ATTR_INDEX, 0x20); + tmp = inb(hwp->IOBase + hwp->PIOOffset + VGA_IN_STAT_1_OFFSET); + outb(hwp->PIOOffset + VGA_ATTR_INDEX, 0x20); hwp->paletteEnabled = FALSE; } static void stdWriteDacMask(vgaHWPtr hwp, CARD8 value) { - outb(VGA_DAC_MASK, value); + outb(hwp->PIOOffset + VGA_DAC_MASK, value); } static CARD8 stdReadDacMask(vgaHWPtr hwp) { - return inb(VGA_DAC_MASK); + return inb(hwp->PIOOffset + VGA_DAC_MASK); } static void stdWriteDacReadAddr(vgaHWPtr hwp, CARD8 value) { - outb(VGA_DAC_READ_ADDR, value); + outb(hwp->PIOOffset + VGA_DAC_READ_ADDR, value); } static void stdWriteDacWriteAddr(vgaHWPtr hwp, CARD8 value) { - outb(VGA_DAC_WRITE_ADDR, value); + outb(hwp->PIOOffset + VGA_DAC_WRITE_ADDR, value); } static void stdWriteDacData(vgaHWPtr hwp, CARD8 value) { - outb(VGA_DAC_DATA, value); + outb(hwp->PIOOffset + VGA_DAC_DATA, value); } static CARD8 stdReadDacData(vgaHWPtr hwp) { - return inb(VGA_DAC_DATA); + return inb(hwp->PIOOffset + VGA_DAC_DATA); } +static CARD8 +stdReadEnable(vgaHWPtr hwp) +{ + return inb(hwp->PIOOffset + VGA_ENABLE); +} + +static void +stdWriteEnable(vgaHWPtr hwp, CARD8 value) +{ + outb(hwp->PIOOffset + VGA_ENABLE, value); +} + void vgaHWSetStdFuncs(vgaHWPtr hwp) { @@ -341,6 +353,9 @@ hwp->writeDacReadAddr = stdWriteDacReadAddr; hwp->writeDacData = stdWriteDacData; hwp->readDacData = stdReadDacData; + hwp->PIOOffset = 0; + hwp->readEnable = stdReadEnable; + hwp->writeEnable = stdWriteEnable; } /* @@ -516,6 +531,18 @@ return minb(VGA_DAC_DATA); } +static CARD8 +mmioReadEnable(vgaHWPtr hwp) +{ + return minb(VGA_ENABLE); +} + +static void +mmioWriteEnable(vgaHWPtr hwp, CARD8 value) +{ + moutb(VGA_ENABLE, value); +} + void vgaHWSetMmioFuncs(vgaHWPtr hwp, CARD8 *base, int offset) { @@ -543,6 +570,8 @@ hwp->readDacData = mmioReadDacData; hwp->MMIOBase = base; hwp->MMIOOffset = offset; + hwp->readEnable = mmioReadEnable; + hwp->writeEnable = mmioWriteEnable; } /* @@ -644,7 +673,6 @@ void vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags) { -#ifdef DPMSExtension unsigned char seq1 = 0, crtc17 = 0; vgaHWPtr hwp = VGAHWPTR(pScrn); @@ -679,7 +707,6 @@ usleep(10000); hwp->writeCrtc(hwp, 0x17, crtc17); hwp->writeSeq(hwp, 0x00, 0x03); /* End Reset */ -#endif } @@ -748,8 +775,9 @@ * * BUG ALERT: The (S)VGA's segment-select register MUST be set correctly! */ - +#if 0 hwp->writeAttr(hwp, 0x10, 0x01); /* graphics mode */ +#endif if (scrninfp->depth == 4) { /* GJA */ hwp->writeGr(hwp, 0x03, 0x00); /* don't rotate, write unmodified */ @@ -941,9 +969,9 @@ * * BUG ALERT: The (S)VGA's segment-select register MUST be set correctly! */ - +#if 0 hwp->writeAttr(hwp, 0x10, 0x01); /* graphics mode */ - +#endif #ifdef SAVE_FONT1 if (hwp->FontInfo1 || (hwp->FontInfo1 = xalloc(FONT_AMOUNT))) { hwp->writeSeq(hwp, 0x02, 0x04); /* write to plane 2 */ @@ -1282,68 +1310,9 @@ else regp->CRTC[23] = 0xC3; regp->CRTC[24] = 0xFF; - - /* - * OK, so much for theory. Now, let's deal with the >real< world... - * - * The above CRTC settings are precise in theory, except that many, if not - * most, VGA clones fail to reset the blanking signal when the character or - * line counter reaches [HV]Total. In this case, the signal is only - * unblanked when the counter reaches [HV]BlankEnd (mod 64, 128 or 256 as - * the case may be) at the start of the >next< scanline or frame, which - * means only part of the screen shows. This affects how null overscans - * are to be implemented on such adapters. - * - * Henceforth, VGA cores that implement this broken, but unfortunately - * common, behaviour are to be designated as KGA's, in honour of Koen - * Gadeyne, whose zeal to eliminate overscans (read: fury) set in motion - * a series of events that led to the discovery of this problem. - * - * Some VGA's are KGA's only in the horizontal, or only in the vertical, - * some in both, others in neither. Don't let anyone tell you there is - * such a thing as a VGA "standard"... And, thank the Creator for the fact - * that Hilbert spaces are not yet implemented in this industry. - * - * The following implements a trick suggested by David Dawes. This sets - * [HV]BlankEnd to zero if the blanking interval does not already contain a - * 0-point, and decrements it by one otherwise. In the latter case, this - * will produce a left and/or top overscan which the colourmap code will - * (still) need to ensure is as close to black as possible. This will make - * the behaviour consistent across all chipsets, while allowing all - * chipsets to display the entire screen. Non-KGA drivers can ignore the - * following in their own copy of this code. - * - * -- TSI @ UQV, 1998.08.21 - */ - - /* First the horizontal case */ - if ((mode->CrtcHBlankEnd >> 3) == (mode->CrtcHTotal >> 3)) - { - i = (regp->CRTC[3] & 0x1F) | ((regp->CRTC[5] & 0x80) >> 2); - if ((i-- > (regp->CRTC[2] & 0x3F)) && - (mode->CrtcHBlankEnd == mode->CrtcHTotal)) - i = 0; - regp->CRTC[3] = (regp->CRTC[3] & ~0x1F) | (i & 0x1F); - regp->CRTC[5] = (regp->CRTC[5] & ~0x80) | ((i << 2) & 0x80); - } - /* - * The vertical case is a little trickier. Some VGA's ignore bit 0x80 of - * CRTC[22]. Also, in some cases, a zero CRTC[22] will still blank the - * very first scanline in a double- or multi-scanned mode. This last case - * needs further investigation. - */ - if (mode->CrtcVBlankEnd == mode->CrtcVTotal) /* Null top overscan */ - { - i = regp->CRTC[22]; - if ((i > regp->CRTC[21]) && /* 8-bit case */ - ((i & 0x7F) > (regp->CRTC[21] & 0x7F)) && /* 7-bit case */ - !(regp->CRTC[9] & 0x9F)) /* 1 scanline/row */ - i = 0; - else - i = (CARD8)(i - 1); - regp->CRTC[22] = i; - } + vgaHWHBlankKGA(mode, regp, 0, KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO); + vgaHWVBlankKGA(mode, regp, 0, KGA_FIX_OVERSCAN | KGA_ENABLE_ON_ZERO); /* * Theory resumes here.... @@ -1414,6 +1383,110 @@ return(TRUE); } + /* + * OK, so much for theory. Now, let's deal with the >real< world... + * + * The above CRTC settings are precise in theory, except that many, if not + * most, VGA clones fail to reset the blanking signal when the character or + * line counter reaches [HV]Total. In this case, the signal is only + * unblanked when the counter reaches [HV]BlankEnd (mod 64, 128 or 256 as + * the case may be) at the start of the >next< scanline or frame, which + * means only part of the screen shows. This affects how null overscans + * are to be implemented on such adapters. + * + * Henceforth, VGA cores that implement this broken, but unfortunately + * common, behaviour are to be designated as KGA's, in honour of Koen + * Gadeyne, whose zeal to eliminate overscans (read: fury) set in motion + * a series of events that led to the discovery of this problem. + * + * Some VGA's are KGA's only in the horizontal, or only in the vertical, + * some in both, others in neither. Don't let anyone tell you there is + * such a thing as a VGA "standard"... And, thank the Creator for the fact + * that Hilbert spaces are not yet implemented in this industry. + * + * The following implements a trick suggested by David Dawes. This sets + * [HV]BlankEnd to zero if the blanking interval does not already contain a + * 0-point, and decrements it by one otherwise. In the latter case, this + * will produce a left and/or top overscan which the colourmap code will + * (still) need to ensure is as close to black as possible. This will make + * the behaviour consistent across all chipsets, while allowing all + * chipsets to display the entire screen. Non-KGA drivers can ignore the + * following in their own copy of this code. + * + * -- TSI @ UQV, 1998.08.21 + */ + +CARD32 +vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits, + unsigned int Flags) +{ + int nExtBits = (nBits < 6) ? 0 : nBits - 6; + CARD32 ExtBits; + CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 6; + + regp->CRTC[3] = (regp->CRTC[3] & ~0x1F) + | (((mode->CrtcHBlankEnd >> 3) - 1) & 0x1F); + regp->CRTC[5] = (regp->CRTC[5] & ~0x80) + | ((((mode->CrtcHBlankEnd >> 3) - 1) & 0x20) << 2); + ExtBits = ((mode->CrtcHBlankEnd >> 3) - 1) & ExtBitMask; + + /* First the horizontal case */ + if ((Flags & KGA_FIX_OVERSCAN) + && ((mode->CrtcHBlankEnd >> 3) == (mode->CrtcHTotal >> 3))) + { + int i = (regp->CRTC[3] & 0x1F) + | ((regp->CRTC[5] & 0x80) >> 2) + | ExtBits; + if ((Flags & KGA_ENABLE_ON_ZERO) + && (i-- > (((mode->CrtcHBlankStart >> 3) - 1) + & (0x3F | ExtBitMask))) + && (mode->CrtcHBlankEnd == mode->CrtcHTotal)) + i = 0; + regp->CRTC[3] = (regp->CRTC[3] & ~0x1F) | (i & 0x1F); + regp->CRTC[5] = (regp->CRTC[5] & ~0x80) | ((i << 2) & 0x80); + ExtBits = i & ExtBitMask; + } + return ExtBits >> 6; +} + + /* + * The vertical case is a little trickier. Some VGA's ignore bit 0x80 of + * CRTC[22]. Also, in some cases, a zero CRTC[22] will still blank the + * very first scanline in a double- or multi-scanned mode. This last case + * needs further investigation. + */ +CARD32 +vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits, + unsigned int Flags) +{ + CARD32 ExtBits; + CARD32 nExtBits = (nBits < 8) ? 0 : (nBits - 8); + CARD32 ExtBitMask = ((1 << nExtBits) - 1) << 8; + /* If width is not known nBits should be 0. In this + * case BitMask is set to 0 so we can check for it. */ + CARD32 BitMask = (nBits < 7) ? 0 : ((1 << nExtBits) - 1); + int VBlankStart = (mode->CrtcVBlankStart - 1) & 0xFF; + regp->CRTC[22] = (mode->CrtcVBlankEnd - 1) & 0xFF; + ExtBits = (mode->CrtcVBlankEnd - 1) & ExtBitMask; + + if ((Flags & KGA_FIX_OVERSCAN) + && (mode->CrtcVBlankEnd == mode->CrtcVTotal)) + /* Null top overscan */ + { + int i = regp->CRTC[22] | ExtBits; + if ((Flags & KGA_ENABLE_ON_ZERO) + && ((BitMask && ((i & BitMask) > (VBlankStart & BitMask))) + || ((i > VBlankStart) && /* 8-bit case */ + ((i & 0x7F) > (VBlankStart & 0x7F)))) && /* 7-bit case */ + !(regp->CRTC[9] & 0x9F)) /* 1 scanline/row */ + i = 0; + else + i = (i - 1); + regp->CRTC[22] = i & 0xFF; + ExtBits = i & 0xFF00; + } + return ExtBits >> 8; +} /* * these are some more hardware specific helpers, formerly in vga.c @@ -1471,7 +1544,7 @@ } -static Bool +Bool vgaHWAllocDefaultRegs(vgaRegPtr regp) { regp->numCRTC = VGA_NUM_CRTC; @@ -1602,10 +1675,21 @@ rgb blackColour = scrp->display->blackColour, whiteColour = scrp->display->whiteColour; - /* Detect default for black & white */ - if (!blackColour.red && !blackColour.green && !blackColour.blue && - !whiteColour.red && !whiteColour.green && !whiteColour.blue) - whiteColour.red = whiteColour.green = whiteColour.blue = 0x3F; + if (blackColour.red > 0x3F) blackColour.red = 0x3F; + if (blackColour.green > 0x3F) blackColour.green = 0x3F; + if (blackColour.blue > 0x3F) blackColour.blue = 0x3F; + + if (whiteColour.red > 0x3F) whiteColour.red = 0x3F; + if (whiteColour.green > 0x3F) whiteColour.green = 0x3F; + if (whiteColour.blue > 0x3F) whiteColour.blue = 0x3F; + + if ((blackColour.red == whiteColour.red ) && + (blackColour.green == whiteColour.green) && + (blackColour.blue == whiteColour.blue )) { + blackColour.red ^= 0x3F; + blackColour.green ^= 0x3F; + blackColour.blue ^= 0x3F; + } /* * initialize default colormap for monochrome @@ -1749,6 +1833,20 @@ { /* Unprotect CRTC[0-7] */ hwp->writeCrtc(hwp, 0x11, hwp->readCrtc(hwp, 0x11) | 0x80); +} + + +void +vgaHWEnable(vgaHWPtr hwp) +{ + hwp->writeEnable(hwp, hwp->readEnable(hwp) | 0x01); +} + + +void +vgaHWDisable(vgaHWPtr hwp) +{ + hwp->writeEnable(hwp, hwp->readEnable(hwp) & ~0x01); } Index: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h diff -u xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h:1.24 xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h:1.28 --- xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h:1.24 Thu Nov 2 11:33:27 2000 +++ xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h Thu May 10 18:18:58 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h,v 1.24 2000/11/02 16:33:27 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/vgahw/vgaHW.h,v 1.28 2001/05/10 22:18:58 dbateman Exp $ */ /* @@ -24,11 +24,9 @@ #include "xf86DDC.h" -#ifdef DPMSExtension #include "globals.h" #define DPMS_SERVER #include "extensions/dpms.h" -#endif extern int vgaHWGetIndex(void); @@ -154,6 +152,10 @@ vgaHWWriteProcPtr writeDacData; vgaHWReadProcPtr readDacData; pointer ddc; + int PIOOffset; /* offset + vgareg + = pioreg */ + vgaHWReadProcPtr readEnable; + vgaHWWriteProcPtr writeEnable; } vgaHWRec; /* Some macros that VGA drivers can use in their ChipProbe() function */ @@ -177,6 +179,11 @@ #define OVERSCAN 0x11 /* Index of OverScan register */ +/* Flags that define how overscan correction should take place */ +#define KGA_FIX_OVERSCAN 1 /* overcan correction required */ +#define KGA_ENABLE_ON_ZERO 2 /* if possible enable display at beginning */ + /* of next scanline/frame */ + #define BIT_PLANE 3 /* Which plane we write to in mono mode */ #define BITS_PER_GUN 6 #define COLORMAP_SIZE 256 @@ -216,8 +223,14 @@ void vgaHWGetIOBase(vgaHWPtr hwp); void vgaHWLock(vgaHWPtr hwp); void vgaHWUnlock(vgaHWPtr hwp); +void vgaHWEnable(vgaHWPtr hwp); +void vgaHWDisable(vgaHWPtr hwp); void vgaHWDPMSSet(ScrnInfoPtr pScrn, int PowerManagementMode, int flags); Bool vgaHWHandleColormaps(ScreenPtr pScreen); void vgaHWddc1SetSpeed(ScrnInfoPtr pScrn, xf86ddcSpeed speed); - +CARD32 vgaHWHBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits, + unsigned int Flags); +CARD32 vgaHWVBlankKGA(DisplayModePtr mode, vgaRegPtr regp, int nBits, + unsigned int Flags); +Bool vgaHWAllocDefaultRegs(vgaRegPtr regp); #endif /* _VGAHW_H */ Index: xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c:1.6 xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c:1.7 --- xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c:1.6 Mon Jun 12 22:51:24 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c Fri May 18 16:22:31 2001 @@ -1,14 +1,6 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c,v 1.6 2000/06/13 02:51:24 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaBitOrder.c,v 1.7 2001/05/18 20:22:31 tsi Exp $ */ -#include "xf86.h" -#include "xf86_ansic.h" -#ifndef RAMDAC_MODULE -#include "xaa.h" -#include "xaalocal.h" -#else -#include "xf86CursorPriv.h" -#endif - +#include "Xmd.h" CARD32 XAAReverseBitOrder(CARD32 v) Index: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c:1.12 xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c:1.13 --- xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c:1.12 Thu Sep 28 16:47:59 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c Mon Feb 19 17:19:49 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c,v 1.12 2000/09/28 20:47:59 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaCpyArea.c,v 1.13 2001/02/19 22:19:49 mvojkovi Exp $ */ #include "misc.h" #include "xf86.h" @@ -65,17 +65,6 @@ pGC, srcx, srcy, width, height, dstx, dsty, XAADoBitBlt, 0L)); } - } else if((pSrcDrawable->type == DRAWABLE_WINDOW) || - IS_OFFSCREEN_PIXMAP(pSrcDrawable)) { - if(infoRec->ReadPixmap && (pGC->alu == GXcopy) && - (pSrcDrawable->bitsPerPixel == pDstDrawable->bitsPerPixel) && - ((pGC->planemask & infoRec->FullPlanemasks[pSrcDrawable->depth - 1]) - == infoRec->FullPlanemasks[pSrcDrawable->depth - 1])) - { - return (XAABitBlt( pSrcDrawable, pDstDrawable, - pGC, srcx, srcy, width, height, dstx, dsty, - XAADoImageRead, 0L)); - } } return (XAAFallbackOps.CopyArea(pSrcDrawable, pDstDrawable, pGC, @@ -245,10 +234,11 @@ BoxPtr pbox = REGION_RECTS(prgnDst); int nbox = REGION_NUM_RECTS(prgnDst); XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); - int Bpp = pSrc->bitsPerPixel >> 3; + int Bpp = pSrc->bitsPerPixel >> 3; /* wouldn't get here unless both + src and dst have same bpp */ pdstBase = (unsigned char *)((PixmapPtr)pDst)->devPrivate.ptr; - dstwidth = (int)((PixmapPtr)pSrc)->devKind; + dstwidth = (int)((PixmapPtr)pDst)->devKind; for(; nbox; pbox++, pptSrc++, nbox--) { dstPntr = pdstBase + (pbox->y1 * dstwidth) + (pbox->x1 * Bpp); Index: xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c:1.18 xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c:1.19 --- xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c:1.18 Thu Sep 28 16:48:00 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c Mon Feb 19 17:19:50 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c,v 1.18 2000/09/28 20:48:00 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaGC.c,v 1.19 2001/02/19 22:19:50 mvojkovi Exp $ */ #include "misc.h" #include "xf86.h" @@ -369,19 +369,33 @@ XAAInfoRecPtr infoRec = GET_XAAINFORECPTR_FROM_GC(pGC); RegionPtr ret; - XAA_PIXMAP_OP_PROLOGUE(pGC, pDst); - if(infoRec->pScrn->vtSema && - ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))){ + ((pSrc->type == DRAWABLE_WINDOW) || IS_OFFSCREEN_PIXMAP(pSrc))) + { + if(infoRec->ReadPixmap && (pGC->alu == GXcopy) && + (pSrc->bitsPerPixel == pDst->bitsPerPixel) && + ((pGC->planemask & infoRec->FullPlanemasks[pSrc->depth - 1]) + == infoRec->FullPlanemasks[pSrc->depth - 1])) + { + XAAPixmapPtr pixPriv = XAA_GET_PIXMAP_PRIVATE((PixmapPtr)(pDst)); + pixPriv->flags |= DIRTY; + + return (XAABitBlt( pSrc, pDst, pGC, + srcx, srcy, width, height, dstx, dsty, + XAADoImageRead, 0L)); + } else if(infoRec->NeedToSync) { (*infoRec->Sync)(infoRec->pScrn); infoRec->NeedToSync = FALSE; } } - ret = (*pGC->ops->CopyArea)(pSrc, pDst, + { + XAA_PIXMAP_OP_PROLOGUE(pGC, pDst); + ret = (*pGC->ops->CopyArea)(pSrc, pDst, pGC, srcx, srcy, width, height, dstx, dsty); - XAA_PIXMAP_OP_EPILOGUE(pGC); + XAA_PIXMAP_OP_EPILOGUE(pGC); + } return ret; } Index: xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c:1.32 xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c:1.33 --- xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c:1.32 Thu Nov 16 14:45:05 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c Tue May 15 14:22:23 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c,v 1.32 2000/11/16 19:45:05 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInit.c,v 1.33 2001/05/15 18:22:23 paulo Exp $ */ #include "misc.h" #include "xf86.h" @@ -47,29 +47,6 @@ /* temp kludge */ static Bool SwitchedOut = FALSE; - - -#ifdef XFree86LOADER - -static XF86ModuleVersionInfo xaaVersRec = -{ - "xaa", - MODULEVENDORSTRING, - MODINFOSTRING1, - MODINFOSTRING2, - XF86_VERSION_CURRENT, - 1, 0, 0, - ABI_CLASS_VIDEODRV, /* requires the video driver ABI */ - ABI_VIDEODRV_VERSION, - MOD_CLASS_NONE, - {0,0,0,0} -}; - - -XF86ModuleData xaaModuleData = { &xaaVersRec, NULL, NULL }; - -#endif - XAAInfoRecPtr XAACreateInfoRec() Index: xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c:1.27 xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c:1.31 --- xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c:1.27 Sat Oct 21 18:26:20 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c Tue May 15 14:22:23 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c,v 1.27 2000/10/21 22:26:20 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaInitAccel.c,v 1.31 2001/05/15 18:22:23 paulo Exp $ */ #include "misc.h" #include "xf86.h" @@ -13,6 +13,7 @@ #include "xf86fbman.h" #include "servermd.h" +static const OptionInfoRec *XAAAvailableOptions(void *unused); /* * XAA Config options @@ -36,11 +37,13 @@ XAAOPT_SCREEN_TO_SCREEN_COL_EXP_FILL, XAAOPT_IMAGE_WRITE_RECT, XAAOPT_SCANLINE_IMAGE_WRITE_RECT, + XAAOPT_WRITE_BITMAP, + XAAOPT_WRITE_PIXMAP, XAAOPT_PIXMAP_CACHE, XAAOPT_OFFSCREEN_PIXMAPS } XAAOpts; -static OptionInfoRec XAAOptions[] = { +static const OptionInfoRec XAAOptions[] = { {XAAOPT_SCREEN_TO_SCREEN_COPY, "XaaNoScreenToScreenCopy", OPTV_BOOLEAN, {0}, FALSE }, {XAAOPT_SOLID_FILL_RECT, "XaaNoSolidFillRect", @@ -75,6 +78,10 @@ OPTV_BOOLEAN, {0}, FALSE }, {XAAOPT_SCANLINE_IMAGE_WRITE_RECT, "XaaNoScanlineImageWriteRect", OPTV_BOOLEAN, {0}, FALSE }, + {XAAOPT_WRITE_BITMAP, "XaaNoWriteBitmap", + OPTV_BOOLEAN, {0}, FALSE }, + {XAAOPT_WRITE_PIXMAP, "XaaNoWritePixmap", + OPTV_BOOLEAN, {0}, FALSE }, {XAAOPT_PIXMAP_CACHE, "XaaNoPixmapCache", OPTV_BOOLEAN, {0}, FALSE }, {XAAOPT_OFFSCREEN_PIXMAPS, "XaaNoOffscreenPixmaps", @@ -82,8 +89,58 @@ { -1, NULL, OPTV_NONE, {0}, FALSE } }; + +#ifdef XFree86LOADER +static MODULESETUPPROTO(xaaSetup); + +static XF86ModuleVersionInfo xaaVersRec = +{ + "xaa", + MODULEVENDORSTRING, + MODINFOSTRING1, + MODINFOSTRING2, + XF86_VERSION_CURRENT, + 1, 0, 0, + ABI_CLASS_VIDEODRV, /* requires the video driver ABI */ + ABI_VIDEODRV_VERSION, + MOD_CLASS_NONE, + {0,0,0,0} +}; + +XF86ModuleData xaaModuleData = { &xaaVersRec, xaaSetup, NULL }; + +ModuleInfoRec XAA = { + 1, + "XAA", + NULL, + 0, + XAAAvailableOptions, +}; + +/*ARGSUSED*/ +static pointer +xaaSetup(pointer Module, pointer Options, int *ErrorMajor, int *ErrorMinor) +{ + static Bool Initialised = FALSE; + + if (!Initialised) { + Initialised = TRUE; +#ifndef REMOVE_LOADER_CHECK_MODULE_INFO + if (xf86LoaderCheckSymbol("xf86AddModuleInfo")) +#endif + xf86AddModuleInfo(&XAA, Module); + } + + return (pointer)TRUE; +} +#endif -#define nXAAOptions (sizeof(XAAOptions) / sizeof(XAAOptions[0])) +/*ARGSUSED*/ +static const OptionInfoRec * +XAAAvailableOptions(void *unused) +{ + return (XAAOptions); +} Bool XAAInitAccel(ScreenPtr pScreen, XAAInfoRecPtr infoRec) @@ -107,10 +164,11 @@ Bool HaveImageWriteRect = FALSE; Bool HaveScanlineImageWriteRect = FALSE; Bool HaveScreenToScreenColorExpandFill = FALSE; - OptionInfoRec options[nXAAOptions]; + OptionInfoPtr options; int is_shared = 0; int i; + options = xnfalloc(sizeof(XAAOptions)); (void)memcpy(options, XAAOptions, sizeof(XAAOptions)); xf86ProcessOptions(pScrn->scrnIndex, pScrn->options, options); @@ -767,7 +825,8 @@ /**** WriteBitmap ****/ - if(infoRec->WriteBitmap) { + if(infoRec->WriteBitmap && + !xf86IsOptionSet(options, XAAOPT_WRITE_BITMAP)) { XAAMSG("\tDriver provided WriteBitmap replacement\n"); } else if(HaveColorExpansion) { if (infoRec->CPUToScreenColorExpandFillFlags & TRIPLE_BITS_24BPP) { @@ -924,7 +983,8 @@ /**** WritePixmap ****/ - if(infoRec->WritePixmap) { + if(infoRec->WritePixmap && + !xf86IsOptionSet(options, XAAOPT_WRITE_PIXMAP)) { XAAMSG("\tDriver provided WritePixmap replacement\n"); } else if(HaveImageWriteRect) { infoRec->WritePixmap = XAAWritePixmap; @@ -1210,7 +1270,12 @@ { infoRec->Composite = XAADoComposite; } - + + if(!infoRec->Glyphs && infoRec->WriteBitmap && + !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) + { + infoRec->Glyphs = XAADoGlyphs; + } #endif /************ Validation Functions **************/ @@ -1417,6 +1482,8 @@ if(BITMAP_SCANLINE_PAD == 64) infoRec->CachePixelGranularity *= 2; } + + xfree(options); if(!infoRec->CacheTile && infoRec->WritePixmapToCache) infoRec->CacheTile = XAACacheTile; Index: xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c diff -u xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c:1.5 xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c:1.12 --- xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c:1.5 Sun Oct 22 16:54:30 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c Sat Apr 21 19:32:56 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaaPict.c,v 1.5 2000/10/22 20:54:30 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. * @@ -40,10 +40,54 @@ #include "xaa.h" #include "xaalocal.h" #include "xaawrap.h" +#include "xaacexp.h" #include "xf86fbman.h" #include "servermd.h" -static Bool +Bool +XAAGetPixelFromRGBA ( + CARD32 *pixel, + CARD16 red, + CARD16 green, + CARD16 blue, + CARD16 alpha, + CARD32 format +){ + int rbits, bbits, gbits, abits; + int rshift, bshift, gshift, ashift; + + *pixel = 0; + + if(!PICT_FORMAT_COLOR(format)) + return FALSE; + + rbits = PICT_FORMAT_R(format); + gbits = PICT_FORMAT_G(format); + bbits = PICT_FORMAT_B(format); + abits = PICT_FORMAT_A(format); + + if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) { + bshift = 0; + gshift = bbits; + rshift = gshift + gbits; + ashift = rshift + rbits; + } else { /* PICT_TYPE_ABGR */ + rshift = 0; + gshift = rbits; + bshift = gshift + gbits; + ashift = bshift + bbits; + } + + *pixel |= ( blue >> (16 - bbits)) << bshift; + *pixel |= ( red >> (16 - rbits)) << rshift; + *pixel |= (green >> (16 - gbits)) << gshift; + *pixel |= (alpha >> (16 - abits)) << ashift; + + return TRUE; +} + + +Bool XAAGetRGBAFromPixel( CARD32 pixel, CARD16 *red, @@ -52,68 +96,56 @@ CARD16 *alpha, CARD32 format ){ - - *alpha = 0xffff; - - switch(PICT_FORMAT_BPP(format)) { - case 32: - switch(format) { - case PICT_a8r8g8b8: - *alpha = (pixel >> 24) & 0x000000ff; - *alpha |= *alpha << 8; - case PICT_x8r8g8b8: - *blue = pixel & 0x000000ff; - *blue |= *blue << 8; - *green = pixel & 0x0000ff00; - *green |= *green >> 8; - *red = (pixel >> 16) & 0x000000ff; - *red |= *red << 8; - return TRUE; - case PICT_a8b8g8r8: - *alpha = (pixel >> 24) & 0x000000ff; - *alpha |= *alpha << 8; - case PICT_x8b8g8r8: - *red = pixel & 0x000000ff; - *red |= *red << 8; - *green = pixel & 0x0000ff00; - *green |= *green >> 8; - *blue = (pixel >> 16) & 0x000000ff; - *blue |= *blue << 8; - return TRUE; - default: - break; - } - break; - case 24: - switch(format) { - case PICT_r8g8b8: - *blue = pixel & 0x000000ff; - *blue |= *blue << 8; - *green = pixel & 0x0000ff00; - *green |= *green >> 8; - *red = (pixel >> 16) & 0x000000ff; - *red |= *red << 8; - return TRUE; - case PICT_b8g8r8: - *red = pixel & 0x000000ff; - *red |= *red << 8; - *green = pixel & 0x0000ff00; - *green |= *green >> 8; - *blue = (pixel >> 16) & 0x000000ff; - *blue |= *blue << 8; - return TRUE; - default: - break; - } - break; - case 16: - case 8: - case 4: - default: - return FALSE; + int rbits, bbits, gbits, abits; + int rshift, bshift, gshift, ashift; + + if(!PICT_FORMAT_COLOR(format)) + return FALSE; + + rbits = PICT_FORMAT_R(format); + gbits = PICT_FORMAT_G(format); + bbits = PICT_FORMAT_B(format); + abits = PICT_FORMAT_A(format); + + if(PICT_FORMAT_TYPE(format) == PICT_TYPE_ARGB) { + bshift = 0; + gshift = bbits; + rshift = gshift + gbits; + ashift = rshift + rbits; + } else { /* PICT_TYPE_ABGR */ + rshift = 0; + gshift = rbits; + bshift = gshift + gbits; + ashift = bshift + bbits; } - - return FALSE; + + *red = ((pixel >> rshift ) & ((1 << rbits) - 1)) << (16 - rbits); + while(rbits < 16) { + *red |= *red >> rbits; + rbits <<= 1; + } + + *green = ((pixel >> gshift ) & ((1 << gbits) - 1)) << (16 - gbits); + while(gbits < 16) { + *green |= *green >> gbits; + gbits <<= 1; + } + + *blue = ((pixel >> bshift ) & ((1 << bbits) - 1)) << (16 - bbits); + while(bbits < 16) { + *blue |= *blue >> bbits; + bbits <<= 1; + } + + if(abits) { + *alpha = ((pixel >> ashift ) & ((1 << abits) - 1)) << (16 - abits); + while(abits < 16) { + *alpha |= *alpha >> abits; + abits <<= 1; + } + } else *alpha = 0xffff; + + return TRUE; } /* 8:8:8 + PICT_a8 -> 8:8:8:8 texture */ @@ -140,7 +172,6 @@ } } - Bool XAADoComposite ( CARD8 op, @@ -163,11 +194,18 @@ 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; @@ -183,22 +221,66 @@ if(!XAAGetRGBAFromPixel(pixel,&red,&green,&blue,&alpha,pSrc->format)) return FALSE; + + xMask += pMask->pDrawable->x; + yMask += pMask->pDrawable->y; + + /* pull out color expandable operations here */ + if((pMask->format == PICT_a1) && (alpha == 0xffff) && + (op == PictOpOver) && infoRec->WriteBitmap && + !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY) && + (!(infoRec->WriteBitmapFlags & RGB_EQUAL) || + (red == green == blue))) + { + PixmapPtr pPix = (PixmapPtr)(pMask->pDrawable); + int skipleft; + + if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, + xSrc, ySrc, xMask, yMask, xDst, yDst, + width, height)) + return TRUE; + + nbox = REGION_NUM_RECTS(®ion); + pbox = REGION_RECTS(®ion); + + if(!nbox) + return TRUE; + + XAAGetPixelFromRGBA(&pixel, red, green, blue, 0, pDst->format); + + xMask -= xDst; + yMask -= yDst; + + while(nbox--) { + skipleft = pbox->x1 + xMask; + + (*infoRec->WriteBitmap)(infoRec->pScrn, + pbox->x1, pbox->y1, + pbox->x2 - pbox->x1, pbox->y2 - pbox->y1, + (unsigned char*)(pPix->devPrivate.ptr) + + (pPix->devKind * (pbox->y1 + yMask)) + + ((skipleft >> 3) & ~3), pPix->devKind, + skipleft & 31, pixel, -1, GXcopy, ~0); + pbox++; + } + + /* WriteBitmap sets the Sync flag */ + REGION_UNINIT(pScreen, ®ion); + return TRUE; + } - if((alpha != 0xffff) && + if((alpha != 0xffff) && (infoRec->CPUToScreenAlphaTextureFlags & XAA_RENDER_NO_SRC_ALPHA)) return FALSE; - formats = infoRec->CPUToScreenAlphaTextureFormats; + formats = infoRec->CPUToScreenAlphaTextureFormats; - while(*formats != pMask->format) { + while(*formats != pMask->format) { if(!(*formats)) return FALSE; formats++; - } + } - xMask += pMask->pDrawable->x; - yMask += pMask->pDrawable->y; - - if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, + if (!miComputeCompositeRegion (®ion, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height)) return TRUE; @@ -206,15 +288,20 @@ nbox = REGION_NUM_RECTS(®ion); pbox = REGION_RECTS(®ion); - if(!nbox) + if(!nbox) { + REGION_UNINIT(pScreen, ®ion); return TRUE; + } if(!(infoRec->SetupForCPUToScreenAlphaTexture)(infoRec->pScrn, op, red, green, blue, alpha, pMask->format, ((PixmapPtr)(pMask->pDrawable))->devPrivate.ptr, ((PixmapPtr)(pMask->pDrawable))->devKind, pMask->pDrawable->width, pMask->pDrawable->height, 0)) + { + REGION_UNINIT(pScreen, ®ion); return FALSE; + } xMask -= xDst; yMask -= yDst; @@ -247,16 +334,23 @@ nbox = REGION_NUM_RECTS(®ion); pbox = REGION_RECTS(®ion); - if(!nbox) - return TRUE; + if(!nbox) { + REGION_UNINIT(pScreen, ®ion); + return TRUE; + } + if(!(infoRec->SetupForCPUToScreenTexture)(infoRec->pScrn, op, pSrc->format, ((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr, ((PixmapPtr)(pSrc->pDrawable))->devKind, pSrc->pDrawable->width, pSrc->pDrawable->height, 0)) - return FALSE; + { + REGION_UNINIT(pScreen, ®ion); + return FALSE; + } + xSrc -= xDst; ySrc -= yDst; @@ -322,6 +416,180 @@ XAA_RENDER_EPILOGUE(pScreen, Composite, XAAComposite); } +Bool +XAADoGlyphs (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int nlist, + GlyphListPtr list, + GlyphPtr *glyphs) +{ + 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 && + !(infoRec->WriteBitmapFlags & NO_TRANSPARENCY)) + { + CARD16 red, green, blue, alpha; + CARD32 pixel = + *((CARD32*)(((PixmapPtr)(pSrc->pDrawable))->devPrivate.ptr)); + CARD32 *bits, *pntr, *pnt; + int x, y, i, n, left, top, right, bottom, width, height, pitch; + int L, T, R, B, X, Y, h, w, dwords, row, column, nbox; + int leftEdge, rightEdge, topLine, botLine; + BoxPtr pbox; + GlyphPtr glyph; + + if(!XAAGetRGBAFromPixel(pixel,&red,&green,&blue,&alpha,pSrc->format)) + return FALSE; + + if(alpha != 0xffff) return FALSE; + + XAAGetPixelFromRGBA(&pixel, red, green, blue, 0, pDst->format); + + if((infoRec->WriteBitmapFlags & RGB_EQUAL) && !(red == green == blue)) + return FALSE; + + x = pDst->pDrawable->x; + y = pDst->pDrawable->y; + + while(nlist--) { + x += list->xOff; + y += list->yOff; + left = right = X = x; + top = bottom = Y = y; + for(i = 0; i < list->len; i++) { + glyph = glyphs[i]; + + L = X - glyph->info.x; + if(L < left) left = L; + R = L + glyph->info.width; + if(R > right) right = R; + + T = Y - glyph->info.y; + if(T < top) top = T; + B = T + glyph->info.height; + if(B > bottom) bottom = B; + + X += glyph->info.xOff; + Y += glyph->info.yOff; + } + + width = right - left; + height = bottom - top; + + if(width && height) { + pitch = (((width + 31) & ~31) >> 5) + 1; + pntr = (CARD32*)xalloc(sizeof(CARD32) * pitch * height); + if(!pntr) + return TRUE; + bzero(pntr, sizeof(CARD32) * pitch * height); + n = list->len; + + X = x; Y = y; + while(n--) { + glyph = *glyphs++; + h = glyph->info.height; + w = glyph->info.width; + if(h && w) { + row = y - top - glyph->info.y; + column = x - left - glyph->info.x; + pnt = pntr + (row * pitch) + (column >> 5); + column &= 31; + dwords = ((w + 31) >> 5) - 1; + bits = (CARD32*)(glyph + 1); + if(dwords) { + while(h--) { + for(i = 0; i <= dwords; i++) { + if(column) { + pnt[i] |= SHIFT_L(*bits, column); + pnt[i + 1] |= SHIFT_R(*bits, 32 - column); + } else + pnt[i] |= *bits; + + if(i != dwords) bits++; + } + bits++; + pnt += pitch; + } + } else { + if(column) { + while(h--) { + pnt[0] |= SHIFT_L(*bits, column); + pnt[0 + 1] |= SHIFT_R(*bits, 32 - column); + bits++; + pnt += pitch; + } + } else { + while(h--) { + *pnt |= *bits++; + pnt += pitch; + } + } + } + } + x += glyph->info.xOff; + y += glyph->info.yOff; + } + + nbox = REGION_NUM_RECTS(pDst->pCompositeClip); + pbox = REGION_RECTS(pDst->pCompositeClip); + + while(nbox && (top >= pbox->y2)) { + pbox++; nbox--; + } + + while(nbox && (bottom > pbox->y1)) { + leftEdge = max(left, pbox->x1); + rightEdge = min(right, pbox->x2); + + if(rightEdge > leftEdge) { + column = leftEdge - left; + topLine = max(top, pbox->y1); + botLine = min(bottom, pbox->y2); + h = botLine - topLine; + + if(h > 0) { + (*infoRec->WriteBitmap)(infoRec->pScrn, + leftEdge, topLine, rightEdge - leftEdge, h, + (unsigned char*)(pntr + + ((topLine - top) * pitch) + (column >> 5)), + pitch << 2, column & 31, pixel, -1, GXcopy, ~0); + } + } + nbox--; pbox++; + } + xfree(pntr); + } else { + x = X; y = Y; + } + list++; + } + + return TRUE; + } + + return FALSE; +} + + void XAAGlyphs (CARD8 op, PicturePtr pSrc, Index: xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h diff -u xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h:1.32 xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h:1.34 --- xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h:1.32 Sat Nov 18 14:37:25 2000 +++ xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h Sun Apr 15 19:16:01 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xaa/xaalocal.h,v 1.32 2000/11/18 19:37:25 tsi 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 @@ -1542,6 +1542,22 @@ CARD16 width, CARD16 height); + +Bool +XAADoComposite (CARD8 op, + PicturePtr pSrc, + PicturePtr pMask, + PicturePtr pDst, + INT16 xSrc, + INT16 ySrc, + INT16 xMask, + INT16 yMask, + INT16 xDst, + INT16 yDst, + CARD16 width, + CARD16 height); + + void XAAGlyphs (CARD8 op, PicturePtr pSrc, @@ -1553,20 +1569,17 @@ GlyphListPtr list, GlyphPtr *glyphs); - Bool -XAADoComposite (CARD8 op, - PicturePtr pSrc, - PicturePtr pMask, - PicturePtr pDst, - INT16 xSrc, - INT16 ySrc, - INT16 xMask, - INT16 yMask, - INT16 xDst, - INT16 yDst, - CARD16 width, - CARD16 height); +XAADoGlyphs (CARD8 op, + PicturePtr pSrc, + PicturePtr pDst, + PictFormatPtr maskFormat, + INT16 xSrc, + INT16 ySrc, + int nlist, + GlyphListPtr list, + GlyphPtr *glyphs); + /* helpers */ @@ -1579,6 +1592,27 @@ int dstPitch, /* in dwords */ int width, 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 Index: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c:1.4 xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c:1.6 --- xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c:1.4 Sat Sep 25 10:38:15 1999 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c Tue May 15 06:19:43 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c,v 1.4 1999/09/25 14:38:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/mfbimggblt.c,v 1.6 2001/05/15 10:19:43 eich Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -127,7 +127,6 @@ in the general case, NOT necessarily the same as the string's bounding box */ - /* GJA -- I agree, this ALL should be moved to GC validation. */ if ( (pDrawable->type != DRAWABLE_WINDOW) || (pGC->alu != GXcopy) || !xf86Screens[pDrawable->pScreen->myNum]->vtSema || @@ -193,6 +192,7 @@ colorRrop.alu = oldalu; /* GJA */ pGC->alu = oldalu; } + } static void @@ -212,13 +212,13 @@ int widthDst; /* width of dst in longwords */ /* these keep track of the character origin */ - unsigned long *pdstBase; + CARD32 *pdstBase; /* points to longword with character origin */ int xchar; /* xorigin of char (mod 32) */ /* these are used for placing the glyph */ register int xoff; /* x offset of left edge of glyph (mod 32) */ - register unsigned long *pdst; + register CARD32 *pdst; /* pointer to current longword in dst */ int w; /* width of glyph in bits */ @@ -239,20 +239,19 @@ yorg = pDrawable->y; if (pDrawable->type == DRAWABLE_WINDOW) { - pdstBase = (unsigned long *) + pdstBase = (CARD32 *) (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devPrivate.ptr); widthDst = (int) (((PixmapPtr)(pDrawable->pScreen->devPrivate))->devKind) >> 2; } else { - pdstBase = (unsigned long *)(((PixmapPtr)pDrawable)->devPrivate.ptr); + pdstBase = (CARD32 *)(((PixmapPtr)pDrawable)->devPrivate.ptr); widthDst = (int)(((PixmapPtr)pDrawable)->devKind) >> 2; } x += xorg; y += yorg; - bbox.x1 = x + infop->overallLeft; bbox.x2 = x + infop->overallRight; bbox.y1 = y - infop->overallAscent; @@ -313,6 +312,7 @@ { /* glyph all in one longword */ maskpartialbits(xoff, w, startmask); + while (h--) { getleftbits(pglyph, w, tmpSrc); Index: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h diff -u xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h:1.5 xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h:1.6 --- xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h:1.5 Tue Sep 26 11:57:21 2000 +++ xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h Thu Mar 8 12:12:17 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h,v 1.5 2000/09/26 15:57:21 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf4bpp/xf4bpp.h,v 1.6 2001/03/08 17:12:17 eich Exp $ */ #ifndef __XF4BPP_H__ @@ -10,7 +10,7 @@ #include "colormapst.h" #include "fontstruct.h" #ifndef PixelType -#define PixelType unsigned long +#define PixelType CARD32 #endif /* ppcArea.c */ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile:1.13.2.2 xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile:1.18 --- xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile:1.13.2.2 Wed Feb 28 15:06:22 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile Sun Apr 22 04:36:31 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/Imakefile,v 1.13.2.2 2001/02/28 20:06:22 dawes 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 @@ -96,9 +96,11 @@ #endif XF86CONFIGFILE = XConfigFile +XF86CONFIGDIR = XConfigDir DEFINES = -DXF86CONFIG=\"$(XF86CONFIGFILE)\" $(MODULEDEFINES) \ - $(CURSESDEFINES) -DPROJECT_ROOT=\"$(PROJECTROOT)\" + $(CURSESDEFINES) -DPROJECT_ROOT=\"$(PROJECTROOT)\" \ + -DXF86CONFIGDIR=\"$(XF86CONFIGDIR)\" XFree86ConsoleDefines #if HasDlopen DLLIB = DlLibrary @@ -115,7 +117,6 @@ InstallMultipleFlags($(XPMPICS),$(INCDIR)/X11/pixmaps,$(INSTINCFLAGS)) InstallAppDefaults(XF86Cfg) -CppManTarget(xf86cfg,) InstallManPage(xf86cfg,$(MANDIR)) NormalLibraryObjectRule() Index: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad:1.6.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad:1.13 --- xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad:1.6.2.1 Fri Feb 9 15:45:11 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad Tue May 15 14:22:23 2001 @@ -26,7 +26,7 @@ !! !! Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> !! -!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.6.2.1 2001/02/09 20:45:11 paulo Exp $ +!! $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/XF86Cfg.ad,v 1.13 2001/05/15 18:22:23 paulo Exp $ !! *Form.background: gray85 @@ -187,10 +187,23 @@ *card.fromHoriz: keyboard *monitor.fromHoriz: card -*commands.mouse.tip: Add mouse -*commands.keyboard.tip: Add keyboard -*commands.card.tip: Add video card -*commands.monitor.tip: Add monitor +*commands.mouse*new.label: Add new mouse +*commands.keyboard*new.label: Add new keyboard +*commands.card*new.label: Add new video card +*commands.monitor*new.label: Add new monitor +*commands.mouse*configure.label: Configure mouse(s) +*commands.keyboard*configure.label: Configure keyboard(s) +*commands.card*configure.label: Configure video card(s) +*commands.monitor*configure.label: Configure monitor(s) +*commands.mouse*SimpleMenu*newMouse.label: New mouse +*commands.keyboard*SimpleMenu*newKeyboard.label:New keyboard +*commands.card*SimpleMenu*newcard.label: New card +*commands.monitor*SimpleMenu*newMonitor.label: New monitor + +*commands.MenuButton.translations: \ +<Enter>: highlight()\n\ +<Leave>: reset()\n\ +Any<BtnDown>: highlight() set() PopupMenu() *hpane.showGrip: False *hpane.expert.label: Expert Mode @@ -324,28 +337,40 @@ !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! keyboardML widget !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! -*keyboardML.labelL.vertDistance: 16 -*keyboardML.layout.vertDistance: 16 -*keyboardML.keyboard.vertDistance: 16 +*keyboardML.Label.vertDistance: 8 +*keyboardML.MenuButton.vertDistance: 8 +*keyboardML.keyboard.vertDistance: 10 *keyboardML.Label.borderWidth: 0 *keyboardML.Label.width: 115 +*keyboardML.MenuButton.width: 185 +*keyboardML.MenuButton.justify: left *keyboardML.Label.internalWidth: 0 *keyboardML.Label.justify: right -*keyboardML.model.width: 185 +*keyboardML.labelR.label: Xkb rules: +*keyboardML.rules.left: chainRight +*keyboardML.rules.right: chainRight +*keyboardML.rules.fromHoriz: labelR +*keyboardML.model.fromVert: rules +*keyboardML.labelM.fromVert: rules *keyboardML.model.left: chainRight *keyboardML.model.right: chainRight -*keyboardML.model.justify: left *keyboardML.model.fromHoriz: labelM *keyboardML.labelM.label: Keyboard model: -*keyboardML.layout.width: 185 *keyboardML.layout.left: chainRight *keyboardML.layout.right: chainRight -*keyboardML.layout.justify: left *keyboardML.layout.fromVert: model *keyboardML.labelL.fromVert: model *keyboardML.layout.fromHoriz: labelL *keyboardML.labelL.label: Keyboard layout: -*keyboardML.keyboard.fromVert: labelL +*keyboardML.variant.fromVert: labelL +*keyboardML.variant.fromHoriz: labelV +*keyboardML.labelV.fromVert: labelL +*keyboardML.labelV.label: Xkb variant: +*keyboardML.options.fromVert: labelV +*keyboardML.options.fromHoriz: labelO +*keyboardML.labelO.fromVert: labelV +*keyboardML.labelO.label: Xkb options: +*keyboardML.keyboard.fromVert: labelO *keyboardML.keyboard.borderWidth: 0 *keyboardML.keyboard.width: 305 *keyboardML.keyboard.height: 121 @@ -450,6 +475,8 @@ <Message>WM_PROTOCOLS: testmode-cancel() .xf86cfg.Expert.translations: #override \ <Message>WM_PROTOCOLS: expert-close() +.xf86cfg.options.moduleOptions.translations: #override \ +<Message>WM_PROTOCOLS: module-options-close() !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -463,6 +490,7 @@ *options*commands.remove.fromHoriz: add *options*commands.update.fromHoriz: remove +*options*commands.help.fromHoriz: update *options*commands.min: 30 *options*commands.max: 30 *options*commands.showGrip: False @@ -476,18 +504,18 @@ *options*label3.fromHoriz: value *options*viewport.fromVert: name *options*Label.borderWidth: 0 -*options*Label.internalWidth: 0 -*options*Label.height: 21 -*options*Text.height: 19 -*options*Label.top: chainTop -*options*Text.top: chainTop -*options*Label.bottom: chainTop -*options*Text.bottom: chainTop -*options*Label.horizDistance: 0 -*options*Text.horizDistance: 0 -*options*Label.vertDistance: 8 -*options*Text.vertDistance: 8 -*options*Text.width: 147 +*options.pane.form.Label.internalWidth: 0 +*options.pane.form.Label.height: 21 +*options.pane.form.Text.height: 19 +*options.pane.form.Label.top: chainTop +*options.pane.form.Text.top: chainTop +*options.pane.form.Label.bottom: chainTop +*options.pane.form.Text.bottom: chainTop +*options.pane.form.Label.horizDistance: 0 +*options.pane.form.Text.horizDistance: 0 +*options.pane.form.Label.vertDistance: 8 +*options.pane.form.Text.vertDistance: 8 +*options.pane.form.Text.width: 147 *options*viewport.width: 390 *options*viewport.height: 50 @@ -497,7 +525,7 @@ *options*viewport.right: chainRight *options*list.longest: 376 -*options*driverOpts.label: Options for driver\ +*options*driverOpts.label: Options for module\ *options*driverOpts.justify: left *options*driverOpts.width: 278 *options*popdown.label: Popdown dialog @@ -505,6 +533,40 @@ o option name\n\ o option type +.xf86cfg*options.moduleOptions.geometry: 360x245 +.xf86cfg*options.moduleOptions.minWidth: 360 +.xf86cfg*options.moduleOptions.maxWidth: 360 +.xf86cfg*options.moduleOptions.minHeight: 245 +.xf86cfg*options.moduleOptions.maxHeight: 245 +*options.moduleOptions*descriptions*labelType.label: Select option +*options.moduleOptions*descriptions*labelType.width: 348 +*options.moduleOptions*descriptions*module.fromVert: labelType +*options.moduleOptions*descriptions*module.label: Module +*options.moduleOptions*descriptions*Label.horizDistance: 8 +*options.moduleOptions*descriptions*option.fromVert: labelType +*options.moduleOptions*descriptions*option.label: Option +*options.moduleOptions*descriptions*option.fromHoriz: viewM +*options.moduleOptions*descriptions*viewM.fromVert: module +*options.moduleOptions*descriptions*viewM.width: 120 +*options.moduleOptions*descriptions*viewM.height: 94 +*options.moduleOptions*descriptions*modL.longest: 100 +*options.moduleOptions*descriptions*viewO.fromHoriz: viewM +*options.moduleOptions*descriptions*viewO.fromVert: option +*options.moduleOptions*descriptions*viewO.width: 220 +*options.moduleOptions*descriptions*viewO.height: 94 +*options.moduleOptions*descriptions*optL.longest: 220 +*options.moduleOptions*descriptions*desc.horizDistance: 4 +*options.moduleOptions*descriptions*desc.fromVert: viewM +*options.moduleOptions*descriptions*desc.width: 348 +*options.moduleOptions*descriptions*desc.height: 62 +*options.moduleOptions*descriptions*desc.wrap: word +*options.moduleOptions*descriptions*desc.scrollVertical: Always +*options.moduleOptions*descriptions*desc.Scrollbar.foreground: rgb:a/5/5 +*options.moduleOptions*descriptions*desc.Scrollbar.borderWidth: 1 +*options.moduleOptions*descriptions*desc.Scrollbar.borderColor: gray60 +*options.moduleOptions*descriptions.showGrip: False +*options.moduleOptions*popdown.label: Popdown dialog + !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !! monitor !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! @@ -1275,11 +1337,16 @@ code?family=Courier&pixelsize=10,\ samp?family=Courier&pixelsize=10,\ tt?family=Courier&pixelsize=10 -*help*close.min: 18 -*help*close.max: 18 -*help*close.showGrip: False +*help*commands.min: 22 +*help*commands.max: 22 +*help*commands.showGrip:False *help*wrap: word +*help*commands.close.label: Close .xf86cfg.help.geometry: 320x369 +.xf86cfg.help.minWidth: 320 +.xf86cfg.help.maxWidth: 320 +.xf86cfg.help.minHeight: 369 +.xf86cfg.help.maxHeight: 369 .xf86cfg.help.translations: #override \ <Message>WM_PROTOCOLS: help-close() *help*text.translations:\ @@ -1386,6 +1453,8 @@ *expert*tree*Text.width: 160 *expert*tree*fontpath.Text.width: 228 +*expert*tree*fontpath.up.fromHoriz: remove +*expert*tree*fontpath.down.fromHoriz: up *expert*tree*fontpath.value.fromVert: remove *expert*tree*fontpath.valueNew.fromVert: new @@ -1767,4 +1836,4 @@ *expert*tree*buffers.flagsL.fromVert: size *expert*tree*buffers.flags.fromVert: size *expert*tree*buffers.flags.fromHoriz: flagsL -*Expert*close.label: Close \ No newline at end of file +*Expert*close.label: Close Index: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c:1.7.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c:1.9 --- xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c:1.7.2.1 Fri Feb 9 15:45:11 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c Fri Mar 2 17:39:27 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c,v 1.7.2.1 2001/02/09 20:45:11 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/accessx.c,v 1.9 2001/03/02 22:39:27 paulo Exp $ */ #include "config.h" @@ -109,7 +109,7 @@ xkb_info->xkb->ctrls->mk_max_speed = 500; xkb_info->xkb->ctrls->mk_curve = 0; XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb); - UpdateKeyboard(True); + (void)UpdateKeyboard(True); CreateAccessXHelpDialog(); } @@ -676,5 +676,5 @@ XkbSetControls(DPY, XkbAllControlsMask, xkb_info->xkb); XSync(DPY, False); - UpdateKeyboard(True); + (void)UpdateKeyboard(True); } Index: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c:1.4 xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c:1.6.2.2 --- xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c:1.4 Fri Dec 1 18:27:54 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c Wed May 23 10:45:15 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.4 2000/12/01 23:27:54 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/card-cfg.c,v 1.6.2.2 2001/05/23 14:45:15 tsi Exp $ */ #include "xf86config.h" @@ -111,10 +111,11 @@ XtSetArg(args[0], XtNstring, card->dev_busid); XtSetValues(busid, args, 1); #ifdef USE_MODULES - XtSetArg(args[0], XtNlabel, driver_str = XtNewString(card->dev_driver)); -#else - XtSetArg(args[0], XtNstring, card->dev_driver); + if (!nomodules) + XtSetArg(args[0], XtNlabel, driver_str = XtNewString(card->dev_driver)); + else #endif + XtSetArg(args[0], XtNstring, card->dev_driver); XtSetValues(driver, args, 1); } else { @@ -126,8 +127,8 @@ device = (XF86ConfDevicePtr)(device->list.next); } do { - ++ndevices; XmuSnprintf(card_name, sizeof(card_name), "Card%d", ndevices); + ++ndevices; } while (xf86findDevice(card_name, XF86Config->conf_device_lst)); @@ -136,10 +137,11 @@ XtSetArg(args[0], XtNstring, ""); XtSetValues(busid, args, 1); #ifdef USE_MODULES - XtSetArg(args[0], XtNlabel, driver_str = XtNewString("vga")); -#else - XtSetArg(args[0], XtNstring, "vga"); + if (!nomodules) + XtSetArg(args[0], XtNlabel, driver_str = XtNewString("vga")); + else #endif + XtSetArg(args[0], XtNstring, "vga"); XtSetValues(driver, args, 1); } @@ -152,14 +154,17 @@ if (card == NULL) { card = (XF86ConfDevicePtr)XtCalloc(1, sizeof(XF86ConfDeviceRec)); card->dev_identifier = XtNewString(ident_string); - card->dev_driver = XtNewString(card_entry->driver); - card->dev_card = XtNewString(card_entry->name); - if (card_entry->chipset) - card->dev_chipset = XtNewString(card_entry->chipset); - if (card_entry->ramdac) - card->dev_ramdac = XtNewString(card_entry->ramdac); - if (card_entry->clockchip) - card->dev_clockchip = XtNewString(card_entry->clockchip); + if (card_entry) { + card->dev_driver = XtNewString(card_entry->driver); + card->dev_card = XtNewString(card_entry->name); + if (card_entry->chipset) + card->dev_chipset = XtNewString(card_entry->chipset); + if (card_entry->ramdac) + card->dev_ramdac = XtNewString(card_entry->ramdac); + if (card_entry->clockchip) + card->dev_clockchip = XtNewString(card_entry->clockchip); + } + /* else will fallback to "vga" */ } else if (card_entry != NULL) { XtFree(card->dev_driver); @@ -185,23 +190,28 @@ card->dev_busid = XtNewString(bus); #ifdef USE_MODULES - drv_nam = driver_str; -#else - XtSetArg(args[0], XtNstring, &drv_nam); - XtGetValues(driver, args, 1); + if (!nomodules) + drv_nam = driver_str; + else #endif + { + XtSetArg(args[0], XtNstring, &drv_nam); + XtGetValues(driver, args, 1); + } XtFree(card->dev_driver); card->dev_driver = XtNewString(drv_nam); #ifdef USE_MODULES - XtFree(driver_str); + if (!nomodules) + XtFree(driver_str); #endif return ((XtPointer)card); } #ifdef USE_MODULES - XtFree(driver_str); + if (!nomodules) + XtFree(driver_str); #endif return (NULL); @@ -214,15 +224,22 @@ char *drv_nam; #ifdef USE_MODULES - drv_nam = driver_str; -#else - Arg args[1]; - - XtSetArg(args[0], XtNstring, &drv_nam); - XtGetValues(driver, args, 1); + if (!nomodules) + drv_nam = driver_str; + else #endif + { + Arg args[1]; + + XtSetArg(args[0], XtNstring, &drv_nam); + XtGetValues(driver, args, 1); + } + if (ident_string == NULL || strlen(ident_string) == 0 || +#if 0 + /* not all available cards are in the Cards database */ (current_device == NULL && card_entry == NULL) || +#endif drv_nam == NULL || *drv_nam == '\0') return (False); @@ -258,9 +275,11 @@ "Chipset: %s\n", card_entry->chipset); if (card_entry->driver != NULL) { #ifdef USE_MODULES - XtFree(driver_str); - driver_str = XtNewString(card_entry->driver); - XtVaSetValues(driver, XtNlabel, driver_str, NULL, 0); + if (!nomodules) { + XtFree(driver_str); + driver_str = XtNewString(card_entry->driver); + XtVaSetValues(driver, XtNlabel, driver_str, NULL, 0); + } #endif len += XmuSnprintf(tip + len, sizeof(tip) - len, "Driver: %s\n", card_entry->driver); @@ -288,8 +307,11 @@ first = 0; #ifndef USE_MODULES - XtSetArg(args[0], XtNstring, card_entry->driver ? card_entry->driver : "vga"); - XtSetValues(driver, args, 1); + if (!nomodules) { + XtSetArg(args[0], XtNstring, + card_entry->driver ? card_entry->driver : "vga"); + XtSetValues(driver, args, 1); + } #endif str = XtNewString(tip); @@ -381,29 +403,34 @@ (XtPointer)info); XtCreateManagedWidget("driverL", labelWidgetClass, model, NULL, 0); #ifdef USE_MODULES - driver = XtVaCreateManagedWidget("driver", menuButtonWidgetClass, - model, - XtNmenuName, "driverM", - NULL, 0); - { - Widget menu, sme; - xf86cfgDriverOptions *opts = video_driver_info; - - menu = XtCreatePopupShell("driverM", simpleMenuWidgetClass, - driver, NULL, 0); - while (opts) { - sme = XtCreateManagedWidget(opts->name, smeBSBObjectClass, - menu, NULL, 0); - XtAddCallback(sme, XtNcallback, DriverCallback, NULL); - opts = opts->next; + if (!nomodules) { + driver = XtVaCreateManagedWidget("driver", menuButtonWidgetClass, + model, + XtNmenuName, "driverM", + NULL, 0); + { + Widget menu, sme; + xf86cfgModuleOptions *opts = module_options; + + menu = XtCreatePopupShell("driverM", simpleMenuWidgetClass, + driver, NULL, 0); + while (opts) { + if (opts->type == VideoModule) { + sme = XtCreateManagedWidget(opts->name, smeBSBObjectClass, + menu, NULL, 0); + XtAddCallback(sme, XtNcallback, DriverCallback, NULL); + } + opts = opts->next; + } } } -#else - driver = XtVaCreateManagedWidget("driver", asciiTextWidgetClass, - model, - XtNeditType, XawtextEdit, - NULL, 0); + else #endif + driver = XtVaCreateManagedWidget("driver", asciiTextWidgetClass, + model, + XtNeditType, XawtextEdit, + NULL, 0); + XtCreateManagedWidget("busidL", labelWidgetClass, model, NULL, 0); busid = XtVaCreateManagedWidget("busid", asciiTextWidgetClass, model, Index: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/config.h:1.9 xc/programs/Xserver/hw/xfree86/xf86cfg/config.h:1.10.2.1 --- xc/programs/Xserver/hw/xfree86/xf86cfg/config.h:1.9 Fri Dec 8 16:51:05 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/config.h Mon May 21 18:24:02 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.9 2000/12/08 21:51:05 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/config.h,v 1.10.2.1 2001/05/21 22:24:02 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -216,5 +216,7 @@ extern xf86cfgComputer computer; extern Atom wm_delete_window; extern Display *DPY; +extern Pixmap menuPixmap; +extern Bool nomodules; #endif /* _xf86cfg_config_h */ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c:1.5.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c:1.8.2.1 --- xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c:1.5.2.1 Fri Feb 9 15:45:12 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c Mon May 21 18:24:02 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.5.2.1 2001/02/09 20:45:12 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/expert.c,v 1.8.2.1 2001/05/21 22:24:02 paulo Exp $ */ #include "config.h" @@ -124,6 +124,7 @@ } layout; struct { Widget menu, button, scrnum, adjx, adjy; + XF86ConfScreenPtr screen; XF86ConfAdjacencyPtr adjacency; } adjacency; struct { @@ -182,6 +183,7 @@ static Widget CreateFontPathField(TreeNode*, char*, Bool); static void FontPathChanged(TreeNode*); static void NewFontPathCallback(Widget, XtPointer, XtPointer); +static void FontPathCallback(Widget, XtPointer, XtPointer); static void CreateModulePath(TreeNode*, char*); static Widget CreateModulePathField(TreeNode*, char*, Bool); @@ -522,6 +524,12 @@ NULL, 0); XtAddCallback(command, XtNcallback, DestroyCallback, (XtPointer)fontpath); + command = XtCreateManagedWidget("up", commandWidgetClass, box, NULL, 0); + XtAddCallback(command, XtNcallback, FontPathCallback, + (XtPointer)fontpath); + command = XtCreateManagedWidget("down", commandWidgetClass, box, NULL, 0); + XtAddCallback(command, XtNcallback, FontPathCallback, + (XtPointer)fontpath); text = XtVaCreateManagedWidget("value", asciiTextWidgetClass, box, XtNeditType, XawtextEdit, XtNstring, value, NULL, 0); @@ -590,6 +598,44 @@ RelayoutTree(); } +/*ARGSUSED*/ +static void +FontPathCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + TreeNode *parent, *node, *fontpath = (TreeNode*)user_data; + char *t1, *t2; + Widget w1, w2; + + parent = fontpath->parent; + node = parent->child; + if (!node->next->next) + return; + if (strcmp(XtName(w), "up") == 0) { + if (node == fontpath) + while (node->next->next) + node = node->next; + else + while (node && node->next != fontpath) + node = node->next; + } + else { + if (fontpath->next->next) + node = fontpath->next; + /* else is already correct */ + } + + w1 = node->data->files.text; + w2 = fontpath->data->files.text; + + XtVaGetValues(w1, XtNstring, &t1, NULL); + XtVaGetValues(w2, XtNstring, &t2, NULL); + t1 = XtNewString(t1); + XtVaSetValues(w1, XtNstring, t2, NULL); + XtVaSetValues(w2, XtNstring, t1, NULL); + XtFree(t1); +} + + /* ModulePath */ /* Don't need to set the update tree field, as it is already set * as the destroy field */ @@ -2361,6 +2407,10 @@ DeleteNode(node); dev = (XF86ConfDevicePtr)XtCalloc(1, sizeof(XF86ConfDeviceRec)); dev->dev_identifier = XtNewString(label); + dev->dev_chipid = -1; + dev->dev_chiprev = -1; + dev->dev_irq = -1; + XF86Config->conf_device_lst = xf86addDevice(XF86Config->conf_device_lst, dev); @@ -2759,13 +2809,14 @@ for (i = 0; i < composite->composite.num_children; ++i) if (strcmp(XtName(composite->composite.children[i]), - node->data->screen.screen->scrn_identifier) == 0) + node->data->screen.screen->scrn_identifier) == 0) { XtDestroyWidget(composite->composite.children[i]); + break; + } - if (adj && adj->data->adjacency.adjacency && - strcmp(adj->data->adjacency.adjacency->adj_screen_str, - node->data->screen.screen->scrn_identifier) == 0) + if (adj->data->adjacency.screen == node->data->screen.screen) DeleteNode(adj); + adj = next; } @@ -2777,6 +2828,9 @@ config = computer.screens[i]->widget; RemoveDeviceCallback(NULL, NULL, NULL); } + + /* for the case of screens added and removed in the expert dialog */ + xf86removeScreen(XF86Config, node->data->screen.screen); } } @@ -3084,6 +3138,8 @@ parent = node->parent; DeleteNode(node); dsp = (XF86ConfDisplayPtr)XtCalloc(1, sizeof(XF86ConfDisplayRec)); + dsp->disp_black.red = dsp->disp_black.green = dsp->disp_black.blue = + dsp->disp_white.red = dsp->disp_white.green = dsp->disp_white.blue = -1; parent->parent->data->screen.screen->scrn_display_lst = xf86addScreenDisplay(parent->parent->data->screen.screen->scrn_display_lst, dsp); @@ -3584,6 +3640,7 @@ while (adj) { data = (TreeData*)XtCalloc(1, sizeof(TreeData)); + data->adjacency.screen = adj ? adj->adj_screen : NULL; data->adjacency.adjacency = adj; node = NewNode(parent, NULL, NULL, parent->node, data); node->destroy = AdjacencyDestroy; @@ -3740,6 +3797,8 @@ DeleteNode(node); adj = (XF86ConfAdjacencyPtr)XtCalloc(1, sizeof(XF86ConfAdjacencyRec)); adj->adj_screen = xf86findScreen(ident, XF86Config->conf_screen_lst); + if (adj->adj_screen) + adj->adj_screen_str = XtNewString(adj->adj_screen->scrn_identifier); parent->parent->data->layout.layout->lay_adjacency_lst = xf86addAdjacency(parent->parent->data->layout.layout->lay_adjacency_lst, adj); @@ -3767,7 +3826,7 @@ XF86ConfAdjacencyPtr adj = node->data->adjacency.adjacency; char *x, *y; - if ((Bool)call_data == False) + if ((Bool)(long)call_data == False) return; XtVaGetValues(node->data->adjacency.adjx, XtNstring, &x, NULL, 0); @@ -4501,7 +4560,7 @@ if (nodeParent->child) { if (XtIsRealized(tree)) XtUnmapWidget(tree); - ToggleNode(nodeParent->child, (Bool)call_data); + ToggleNode(nodeParent->child, (Bool)(long)call_data); RelayoutTree(); if (XtIsRealized(tree)) XtMapWidget(tree); Index: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/help.c:1.3 xc/programs/Xserver/hw/xfree86/xf86cfg/help.c:1.4 --- xc/programs/Xserver/hw/xfree86/xf86cfg/help.c:1.3 Fri Oct 20 10:59:05 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/help.c Tue May 15 14:22:23 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c,v 1.3 2000/10/20 14:59:05 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/help.c,v 1.4 2001/05/15 18:22:23 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -34,6 +34,7 @@ #include <X11/Shell.h> #include <X11/Xaw/AsciiText.h> #include <X11/Xaw/Command.h> +#include <X11/Xaw/Form.h> #include <X11/Xaw/Paned.h> #include <X11/Xaw/Text.h> @@ -46,6 +47,7 @@ #endif #include <ctype.h> #include "help.h" +#include "options.h" /* * Prototypes @@ -122,7 +124,7 @@ }; if (shell == NULL) { - Widget pane, close; + Widget pane, commands, close; char *props; XawTextPropertyList *propl; @@ -132,8 +134,10 @@ shell, NULL, 0); text = XtVaCreateManagedWidget("text", asciiTextWidgetClass, pane, XtNeditType, XawtextRead, NULL, 0); + commands = XtCreateManagedWidget("commands", formWidgetClass, pane, + NULL, 0); close = XtCreateManagedWidget("close", commandWidgetClass, - pane, NULL, 0); + commands, NULL, 0); XtAddCallback(close, XtNcallback, CloseCallback, NULL); XtRealizeWidget(shell); XSetWMProtocols(DPY, XtWindow(shell), &wm_delete_window, 1); Index: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c:1.13.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c:1.23.2.1 --- xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c:1.13.2.1 Fri Feb 9 15:45:13 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c Mon May 21 18:24:02 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.13.2.1 2001/02/09 20:45:13 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/interface.c,v 1.23.2.1 2001/05/21 22:24:02 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -81,6 +81,7 @@ void DevicePopdownMenu(Widget, XEvent*, String*, Cardinal*); void AddDeviceCallback(Widget, XtPointer, XtPointer); void QuitCallback(Widget, XtPointer, XtPointer); +void SmeConfigureDeviceCallback(Widget, XtPointer, XtPointer); void ConfigureDeviceCallback(Widget, XtPointer, XtPointer); void EnableDeviceCallback(Widget, XtPointer, XtPointer); void DisableDeviceCallback(Widget, XtPointer, XtPointer); @@ -100,6 +101,7 @@ static void ErrorCancelAction(Widget, XEvent*, String*, Cardinal*); static void QuitCancelAction(Widget, XEvent*, String*, Cardinal*); static void HelpCallback(Widget, XtPointer, XtPointer); +static void UpdateMenuDeviceList(int); extern void AccessXConfigureStart(void); extern void AccessXConfigureEnd(void); @@ -115,6 +117,8 @@ Widget toplevel, work, config, layout, layoutsme, layoutp; XtAppContext appcon; +Pixmap menuPixmap; + char *XF86Config_path = NULL; char *XF86Module_path = NULL; char *XFree86_path = NULL; @@ -126,7 +130,7 @@ static char XkbConfig_path_static[1024]; Bool xf86config_set = False; -Bool textmode = False; +Bool textmode = False, nomodules = False; xf86cfgComputer computer; xf86cfgDevice cpu_device; @@ -137,6 +141,9 @@ static char no_cursor_data[] = { 0,0,0,0, 0,0,0,0 }; static GC cablegc, cablegcshadow; Atom wm_delete_window; +static Bool config_set = False; +static Widget mouseSme, mouseMenu, keyboardSme, keyboardMenu, + cardSme, cardMenu, monitorSme, monitorMenu; #define CONFIG_LAYOUT 0 #define CONFIG_SCREEN 1 @@ -164,6 +171,9 @@ {"testmode-cancel", CancelTestModeAction}, {"help-close", HelpCancelAction}, {"expert-close", ExpertCloseAction}, +#ifdef USE_MODULES + {"module-options-close", ModuleOptionsCancelAction}, +#endif }; static char *device_names[] = { @@ -179,12 +189,16 @@ "screen", }; -/* static XtResource appResources[] = { +#if 0 {"xf86config", "XF86Config", XtRString, sizeof(char*), 0, XtRString, "/etc/X11/XF86Config"}, +#endif + {"menuBitmap", "MenuBitmap", XtRString, sizeof(char*), + 0, XtRString, "menu10"}, }; +/* static XrmOptionDescRec optionDescList[] = { {"-xf86config", "*xf86config", XrmoptionSepArg, (XtPointer)"/etc/X11/XF86Config"}, }; @@ -203,6 +217,8 @@ XGCValues values; XF86ConfLayoutPtr lay; int i, startedx; + char *menuPixmapPath = NULL; + XrmValue from, to; #ifdef USE_MODULES xf86Verbose = 1; @@ -215,8 +231,10 @@ for (i = 1; i < argc; i++) { if (strcmp(argv[i], "-xf86config") == 0) { - if (i + 1 < argc) + if (i + 1 < argc) { XF86Config_path = argv[++i]; + config_set = True; + } } else if (strcmp(argv[i], "-modulepath") == 0) { if (i + 1 < argc) XF86Module_path = argv[++i]; @@ -234,6 +252,8 @@ else if (strcmp(argv[i], "-textmode") == 0) textmode = True; #endif + else if (strcmp(argv[i], "-nomodules") == 0) + nomodules = True; } #ifdef HAS_NCURSES @@ -244,8 +264,8 @@ #endif startedx = startx(); -/* if (XF86Config_path == NULL) - XF86Config_path = "/etc/X11/XF86Config-4";*/ + if (XF86Config_path == NULL) + XF86Config_path = "XF86Config-4"; if (XkbConfig_path == NULL) XkbConfig_path = XkbConfigDir XkbConfigFile; toplevel = XtAppInitialize(&appcon, "XF86Cfg", @@ -256,10 +276,15 @@ if (DPY == NULL) DPY = XtDisplay(toplevel); -/* - XtGetApplicationResources(toplevel, (XtPointer)&XF86Config_path, + XtGetApplicationResources(toplevel, (XtPointer)&menuPixmapPath, appResources, XtNumber(appResources), NULL, 0); -*/ + if (menuPixmapPath && strlen(menuPixmapPath)) { + from.size = strlen(menuPixmapPath); + from.addr = menuPixmapPath; + to.size = sizeof(Pixmap); + to.addr = (XtPointer)&(menuPixmap); + XtConvertAndStore(toplevel, XtRString, &from, XtRBitmap, &to); + } XtAppAddActions(appcon, actions, XtNumber(actions)); @@ -297,19 +322,55 @@ commands = XtCreateManagedWidget("commands", formWidgetClass, pane, NULL, 0); - mouse = XtCreateManagedWidget("mouse", commandWidgetClass, - commands, NULL, 0); - XtAddCallback(mouse, XtNcallback, AddDeviceCallback, (XtPointer)MOUSE); - keyboard = XtCreateManagedWidget("keyboard", commandWidgetClass, - commands, NULL, 0); - XtAddCallback(keyboard, XtNcallback, AddDeviceCallback, (XtPointer)KEYBOARD); - card = XtCreateManagedWidget("card", commandWidgetClass, - commands, NULL, 0); - XtAddCallback(card, XtNcallback, AddDeviceCallback, (XtPointer)CARD); - monitor = XtCreateManagedWidget("monitor", commandWidgetClass, - commands, NULL, 0); - XtAddCallback(monitor, XtNcallback, AddDeviceCallback, (XtPointer)MONITOR); + mouse = XtVaCreateManagedWidget("mouse", menuButtonWidgetClass, + commands, XtNmenuName, "mouseP", NULL, 0); + popup = XtCreatePopupShell("mouseP", simpleMenuWidgetClass, + mouse, NULL, 0); + sme = XtCreateManagedWidget("new", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)MOUSE); + mouseSme = XtCreateManagedWidget("configure", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(mouseSme, XtNcallback, SmeConfigureDeviceCallback, + (XtPointer)MOUSE); + + keyboard = XtVaCreateManagedWidget("keyboard", menuButtonWidgetClass, + commands, XtNmenuName, "keyboardP", NULL, 0); + popup = XtCreatePopupShell("keyboardP", simpleMenuWidgetClass, + keyboard, NULL, 0); + sme = XtCreateManagedWidget("new", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)KEYBOARD); + keyboardSme = XtCreateManagedWidget("configure", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(keyboardSme, XtNcallback, SmeConfigureDeviceCallback, + (XtPointer)KEYBOARD); + + card = XtVaCreateManagedWidget("card", menuButtonWidgetClass, + commands, XtNmenuName, "cardP", NULL, 0); + popup = XtCreatePopupShell("cardP", simpleMenuWidgetClass, + card, NULL, 0); + sme = XtCreateManagedWidget("new", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)CARD); + cardSme = XtCreateManagedWidget("configure", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(cardSme, XtNcallback, SmeConfigureDeviceCallback, + (XtPointer)CARD); + + monitor = XtVaCreateManagedWidget("monitor", menuButtonWidgetClass, + commands, XtNmenuName, "monitorP", NULL, 0); + popup = XtCreatePopupShell("monitorP", simpleMenuWidgetClass, + monitor, NULL, 0); + sme = XtCreateManagedWidget("new", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(sme, XtNcallback, AddDeviceCallback, (XtPointer)MONITOR); + monitorSme = XtCreateManagedWidget("configure", smeBSBObjectClass, + popup, NULL, 0); + XtAddCallback(monitorSme, XtNcallback, SmeConfigureDeviceCallback, + (XtPointer)MONITOR); + work = XtCreateManagedWidget("work", compositeWidgetClass, pane, NULL, 0); @@ -380,6 +441,10 @@ StartConfig(); InitializeDevices(); + UpdateMenuDeviceList(MOUSE); + UpdateMenuDeviceList(KEYBOARD); + UpdateMenuDeviceList(CARD); + UpdateMenuDeviceList(MONITOR); XtSetSensitive(smemodeline, VideoModeInitialize()); ReadCardsDatabase(); @@ -389,6 +454,7 @@ layoutp, XtNlabel, lay->lay_identifier, XtNmenuName, "options", + XtNleftBitmap, menuPixmap, NULL, 0); XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay); if (layoutsme == NULL) @@ -418,9 +484,26 @@ } #ifdef USE_MODULES + if (!nomodules) LoaderInitializeOptions(); #endif + if (!config_set && startedx) { + XtFree(XF86Config_path); +#ifdef XF86CONFIG +# ifdef XF86CONFIGDIR + XF86Config_path = XtNewString(XF86CONFIGDIR "/" XF86CONFIG); +# else + XF86Config_path = XtNewString("/etc/X11/" XF86CONFIG); +# endif +#else +# ifdef XF86CONFIGDIR + XF86Config_path = XtNewString(XF86CONFIGDIR "/XF86Config-4"); +# else + XF86Config_path = XtNewString("/etc/X11/XF86Config-4"); +# endif +#endif + } XtAppMainLoop(appcon); if (startedx) endx(); @@ -789,6 +872,8 @@ return (NULL); } + UpdateMenuDeviceList(type); + return (computer.devices[computer.num_devices - 1]); } @@ -931,6 +1016,7 @@ layoutp, XtNlabel, name, XtNmenuName, "options", + XtNleftBitmap, menuPixmap, NULL, 0); XtAddCallback(layoutsme, XtNcallback, SelectLayoutCallback, (XtPointer)l); @@ -1033,6 +1119,7 @@ layoutp, XtNlabel, lay->lay_identifier, XtNmenuName, "options", + XtNleftBitmap, menuPixmap, NULL, 0); XtAddCallback(sme, XtNcallback, SelectLayoutCallback, (XtPointer)lay); if (layoutsme == NULL) @@ -1214,6 +1301,46 @@ } void +SmeConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + int i; + + switch ((long)user_data) { + case MOUSE: + case KEYBOARD: + case CARD: + case MONITOR: + for (i = 0; i < computer.num_devices; i++) + if (computer.devices[i]->type == (long)user_data) { + config = computer.devices[i]->widget; + ConfigureDeviceCallback(w, NULL, NULL); + } + break; + + /* hack for newly added devices */ + case -(MOUSE + 100): + case -(KEYBOARD + 100): + case -(CARD + 100): + case -(MONITOR + 100): + for (i = 0; i < computer.num_devices; i++) + if (-(computer.devices[i]->type + 100) == (long)user_data && + computer.devices[i]->config == NULL) { + config = computer.devices[i]->widget; + ConfigureDeviceCallback(w, NULL, NULL); + } + break; + + default: + for (i = 0; i < computer.num_devices; i++) + if (computer.devices[i]->config == user_data) { + config = computer.devices[i]->widget; + ConfigureDeviceCallback(w, NULL, NULL); + } + break; + } +} + +void ConfigureDeviceCallback(Widget w, XtPointer user_data, XtPointer call_data) { int i, j; @@ -1277,6 +1404,8 @@ SetTip((xf86cfgDevice*)computer.screens[j]); } break; } + /* Need to update because it may have been renamed */ + UpdateMenuDeviceList(computer.devices[i]->type); break; } } @@ -1296,7 +1425,7 @@ int i; XF86OptionPtr *options; #ifdef USE_MODULES - xf86cfgDriverOptions *drv_opts = NULL; + xf86cfgModuleOptions *drv_opts = NULL; #endif if (config_mode == CONFIG_SCREEN) { @@ -1323,19 +1452,37 @@ case KEYBOARD: options = (XF86OptionPtr*)&(((XF86ConfInputPtr) (computer.devices[i]->config))->inp_option_lst); +#ifdef USE_MODULES + if (!nomodules) { + char *drv = ((XF86ConfInputPtr) + (computer.devices[i]->config))->inp_driver; + + if (drv) { + drv_opts = module_options; + while (drv_opts) { + if (drv_opts->type == InputModule && + strcmp(drv_opts->name, drv) == 0) + break; + drv_opts = drv_opts->next; + } + } + } +#endif + break; case CARD: options = (XF86OptionPtr*)&(((XF86ConfDevicePtr) (computer.devices[i]->config))->dev_option_lst); #ifdef USE_MODULES - { + if (!nomodules) { char *drv = ((XF86ConfDevicePtr) (computer.devices[i]->config))->dev_driver; if (drv) { - drv_opts = video_driver_info; + drv_opts = module_options; while (drv_opts) { - if (strcmp(drv_opts->name, drv) == 0) + if (drv_opts->type == VideoModule && + strcmp(drv_opts->name, drv) == 0) break; drv_opts = drv_opts->next; } @@ -1572,6 +1719,8 @@ } if (computer.devices[i]->refcount <= 0) { + int type = computer.devices[i]->type; + XtDestroyWidget(computer.devices[i]->widget); XtFree((XtPointer)computer.devices[i]); if (--computer.num_devices > i) @@ -1579,11 +1728,133 @@ (computer.num_devices - i) * sizeof(xf86cfgDevice*)); DrawCables(); + UpdateMenuDeviceList(type); } break; } } +} + +static void +UpdateMenuDeviceList(int type) +{ + Widget sme = NULL, menu = NULL; + int i, count; + static char *mouseM = "mouseM", *keyboardM = "keyboardM", + *cardM = "cardM", *monitorM = "monitorM"; + + for (i = count = 0; i < computer.num_devices; i++) + if (computer.devices[i]->type == type) + ++count; + + switch (type) { + case MOUSE: + sme = mouseSme; + menu = mouseMenu; + break; + case KEYBOARD: + sme = keyboardSme; + menu = keyboardMenu; + break; + case CARD: + sme = cardSme; + menu = cardMenu; + break; + case MONITOR: + sme = monitorSme; + menu = monitorMenu; + break; + } + + if (menu) + for (i = ((CompositeWidget)menu)->composite.num_children - 1; i >= 0; i--) + XtDestroyWidget(((CompositeWidget)menu)->composite.children[i]); + + if (count < 2) { + XtVaSetValues(sme, XtNmenuName, NULL, XtNleftBitmap, None, NULL); + return; + } + + switch (type) { + case MOUSE: + if (mouseMenu == NULL) + menu = mouseMenu = + XtCreatePopupShell(mouseM, simpleMenuWidgetClass, + XtParent(mouseSme), NULL, 0); + XtVaSetValues(mouseSme, XtNmenuName, mouseM, + XtNleftBitmap, menuPixmap, NULL); + break; + case KEYBOARD: + if (keyboardMenu == NULL) + menu = keyboardMenu = + XtCreatePopupShell(keyboardM, simpleMenuWidgetClass, + XtParent(keyboardSme), NULL, 0); + XtVaSetValues(keyboardSme, XtNmenuName, keyboardM, + XtNleftBitmap, menuPixmap, NULL); + break; + case CARD: + if (cardMenu == NULL) + menu = cardMenu = + XtCreatePopupShell(cardM, simpleMenuWidgetClass, + XtParent(cardSme), NULL, 0); + XtVaSetValues(cardSme, XtNmenuName, cardM, + XtNleftBitmap, menuPixmap, NULL); + break; + case MONITOR: + if (monitorMenu == NULL) + menu = monitorMenu = + XtCreatePopupShell(monitorM, simpleMenuWidgetClass, + XtParent(monitorSme), NULL, 0); + XtVaSetValues(monitorSme, XtNmenuName, monitorM, + XtNleftBitmap, menuPixmap, NULL); + break; + } + + for (i = 0; i < computer.num_devices; i++) + if (computer.devices[i]->type == type) { + char *label = NULL; + + if (computer.devices[i]->config) { + switch (type) { + case MOUSE: + case KEYBOARD: + label = ((XF86ConfInputPtr)computer.devices[i]->config) + ->inp_identifier; + break; + case CARD: + label = ((XF86ConfDevicePtr)computer.devices[i]->config) + ->dev_identifier; + break; + case MONITOR: + label = ((XF86ConfMonitorPtr)computer.devices[i]->config) + ->mon_identifier; + break; + } + } + else { + switch (type) { + case MOUSE: + label = "newMouse"; + break; + case KEYBOARD: + label = "newKeyboard"; + break; + case CARD: + label = "newCard"; + break; + case MONITOR: + label = "newMonitor"; + break; + } + } + + sme = XtCreateManagedWidget(label, smeBSBObjectClass, menu, NULL, 0); + XtAddCallback(sme, XtNcallback, SmeConfigureDeviceCallback, + computer.devices[i]->config ? + computer.devices[i]->config : + (XtPointer) (-((long)type + 100))); + } } /*ARGSUSED*/ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c:1.10 xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c:1.14 --- xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c:1.10 Mon Dec 11 13:47:46 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c Thu Mar 29 11:54:30 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c,v 1.10 2000/12/11 18:47:46 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.c,v 1.14 2001/03/29 16:54:30 paulo Exp $ */ #include "xf86config.h" @@ -39,30 +39,47 @@ #include <X11/Xaw/SmeBSB.h> /* + * Types + */ +typedef struct { + char *rules; + XkbRF_RulesPtr list; + XF86XkbDescInfo model; + XF86XkbDescInfo layout; + XF86XkbDescInfo variant; + XF86XkbDescInfo option; +} XF86XkbRulesDescInfo; + +/* * Prototypes */ +static void KeyboardRulesCallback(Widget, XtPointer, XtPointer); static void KeyboardModelCallback(Widget, XtPointer, XtPointer); static void KeyboardLayoutCallback(Widget, XtPointer, XtPointer); +static void KeyboardVariantCallback(Widget, XtPointer, XtPointer); +static void KeyboardOptionsCallback(Widget, XtPointer, XtPointer); static void KeyboardApplyCallback(Widget, XtPointer, XtPointer); static Bool KeyboardConfigCheck(void); static void XkbUIEventHandler(Widget, XtPointer, XEvent*, Boolean*); +static XF86XkbRulesDescInfo *GetXkbRulesDesc(char*); +static void UpdateRulesPopups(void); /* * Initialization */ -static XF86XkbDescInfo xkb_model; -static XF86XkbDescInfo xkb_layout; -static XF86XkbDescInfo xkb_variant; -static XF86XkbDescInfo xkb_option; +static XF86XkbRulesDescInfo **xkb_desc, *xkb_rules; +static int num_xkb_desc; +static char *XkbRulesDir = "lib/X11/xkb/rules/"; #ifdef XFREE98_XKB -static char *XkbRulesFile = "lib/X11/xkb/rules/xfree98"; +static char *XkbRulesFile = "xfree98"; #else -static char *XkbRulesFile = "lib/X11/xkb/rules/xfree86"; +static char *XkbRulesFile = "xfree86"; #endif static XF86ConfInputPtr current_input; -static char *model, *layout; -static Widget kbd, modelb, layoutb; +static char *rules, *model, *layout, *variant, *options; +static Widget kbd, rulesb, modelb, layoutb, variantb, optionsb, + modelp, layoutp, variantp, optionsp; static XkbInfo **xkb_infos; static int num_xkb_infos; XkbInfo *xkb_info; @@ -79,9 +96,20 @@ XF86ConfInputPtr keyboard = (XF86ConfInputPtr)config; XF86OptionPtr option; Arg args[1]; - static char *XkbModel = "XkbModel", *XkbLayout = "XkbLayout"; + static char *XkbRules = "XkbRules", *XkbModel = "XkbModel", + *XkbLayout = "XkbLayout", *XkbVariant = "XkbVariant", + *XkbOptions = "XkbOptions"; + XF86XkbRulesDescInfo *info; + char *omodel, *olayout, *ovariant, *ooptions; InitializeKeyboard(); + rules = xkb_rules->rules; + if (xkb_info->config.rules_file == NULL) + xkb_info->config.rules_file = rules; + + if (options) + XtFree(options); + options = NULL; if (xkb_info->conf == NULL) xkb_info->conf = keyboard; @@ -148,19 +176,38 @@ current_input = keyboard; if (keyboard != NULL) { + if ((option = xf86findOption(keyboard->inp_option_lst, XkbRules)) != NULL) { + if (strcmp(rules, option->opt_val)) { + XF86XkbRulesDescInfo *info = GetXkbRulesDesc(option->opt_val); + + if (info) { + rules = info->rules; + UpdateRulesPopups(); + } + } + } if ((option = xf86findOption(keyboard->inp_option_lst, XkbModel)) != NULL) xkb_info->defs.model = model = option->opt_val; else - xkb_info->defs.model = model = xkb_model.name[0]; + xkb_info->defs.model = model = xkb_rules->model.name[0]; if ((option = xf86findOption(keyboard->inp_option_lst, XkbLayout)) != NULL) xkb_info->defs.layout = layout = option->opt_val; + else + xkb_info->defs.layout = layout = xkb_rules->layout.name[0]; + if ((option = xf86findOption(keyboard->inp_option_lst, XkbVariant)) != NULL) + xkb_info->defs.variant = variant = option->opt_val; + else + xkb_info->defs.variant = variant = NULL; + + if ((option = xf86findOption(keyboard->inp_option_lst, XkbOptions)) != NULL) + xkb_info->defs.options = options = XtNewString(option->opt_val); else - xkb_info->defs.layout = layout = xkb_layout.name[0]; + xkb_info->defs.options = options = NULL; XtSetArg(args[0], XtNstring, keyboard->inp_identifier); XtSetValues(ident_widget, args, 1); - UpdateKeyboard(False); + (void)UpdateKeyboard(False); } else { XF86ConfInputPtr input = XF86Config->conf_input_lst; @@ -173,18 +220,26 @@ input = (XF86ConfInputPtr)(input->list.next); } do { - ++nkeyboards; XmuSnprintf(keyboard_name, sizeof(keyboard_name), "Keyboard%d", nkeyboards); + ++nkeyboards; } while (xf86findInput(keyboard_name, XF86Config->conf_input_lst)); - model = xkb_model.name[0]; - layout = xkb_layout.name[0]; + model = xkb_rules->model.name[0]; + layout = xkb_rules->layout.name[0]; + variant = ""; + options = XtNewString(""); XtSetArg(args[0], XtNstring, keyboard_name); XtSetValues(ident_widget, args, 1); } + info = xkb_rules; + omodel = model; + olayout = layout; + ovariant = variant; + ooptions = options ? XtNewString(options) : NULL; + xf86info.cur_list = KEYBOARD; XtSetSensitive(back, xf86info.lists[KEYBOARD].cur_function > 0); XtSetSensitive(next, xf86info.lists[KEYBOARD].cur_function < @@ -198,10 +253,20 @@ keyboard->list.next = NULL; keyboard->inp_identifier = XtNewString(ident_string); keyboard->inp_driver = XtNewString("keyboard"); - keyboard->inp_option_lst = xf86newOption(XtNewString(XkbModel), - XtNewString(model)); + keyboard->inp_option_lst = xf86newOption(XtNewString(XkbRules), + XtNewString(rules)); xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbModel), XtNewString(model)); + xf86addNewOption(keyboard->inp_option_lst, XtNewString(XkbLayout), XtNewString(layout)); + if (variant && *variant) + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbVariant), XtNewString(variant)); + if (options && *options) { + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbOptions), options); + options = NULL; + } keyboard->inp_comment = NULL; } else { @@ -210,34 +275,41 @@ XtSetArg(args[0], XtNlabel, &str); XtGetValues(modelb, args, 1); - for (i = 0; i < xkb_model.nelem; i++) - if (strcmp(xkb_model.desc[i], str) == 0) { - model = xkb_model.name[i]; + for (i = 0; i < xkb_rules->model.nelem; i++) + if (strcmp(xkb_rules->model.desc[i], str) == 0) { + model = xkb_rules->model.name[i]; break; } XtSetArg(args[0], XtNlabel, &str); XtGetValues(layoutb, args, 1); - for (i = 0; i < xkb_layout.nelem; i++) - if (strcmp(xkb_layout.desc[i], str) == 0) { - layout = xkb_layout.name[i]; + for (i = 0; i < xkb_rules->layout.nelem; i++) + if (strcmp(xkb_rules->layout.desc[i], str) == 0) { + layout = xkb_rules->layout.name[i]; break; } + if ((option = xf86findOption(keyboard->inp_option_lst, XkbRules)) + != NULL) { + XtFree(option->opt_val); + option->opt_val = XtNewString(rules); + XtFree(option->opt_comment); + } + else + keyboard->inp_option_lst = + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbRules), XtNewString(rules)); + if ((option = xf86findOption(keyboard->inp_option_lst, XkbModel)) != NULL) { XtFree(option->opt_val); option->opt_val = XtNewString(model); XtFree(option->opt_comment); } - else { - if (keyboard->inp_option_lst == NULL) - keyboard->inp_option_lst = xf86newOption(XtNewString(XkbModel), - XtNewString(model)); - else + else + keyboard->inp_option_lst = xf86addNewOption(keyboard->inp_option_lst, XtNewString(XkbModel), XtNewString(model)); - } XtFree(xkb_info->config.model); xkb_info->config.model = XtNewString(model); @@ -245,21 +317,66 @@ != NULL) { XtFree(option->opt_val); option->opt_val = XtNewString(layout); - XtFree(option->opt_comment); } else - xf86addNewOption(keyboard->inp_option_lst, - XtNewString(XkbLayout), XtNewString(layout)); + keyboard->inp_option_lst = + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbLayout), XtNewString(layout)); XtFree(xkb_info->config.layout); xkb_info->config.layout = XtNewString(layout); + + if ((option = xf86findOption(keyboard->inp_option_lst, XkbVariant)) + != NULL) { + if (variant && *variant) { + XtFree(option->opt_val); + option->opt_val = XtNewString(variant); + } + else + xf86removeOption(&keyboard->inp_option_lst, XkbVariant); + } + else if (variant && *variant) + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbVariant), XtNewString(variant)); + XtFree(xkb_info->config.variant); + xkb_info->config.variant = variant && *variant ? + XtNewString(variant) : NULL; + + XtFree(xkb_info->config.options); + xkb_info->config.options = options && *options ? + XtNewString(options) : NULL; + if ((option = xf86findOption(keyboard->inp_option_lst, XkbOptions)) + != NULL) { + if (options && *options) { + XtFree(option->opt_val); + option->opt_val = options; + options = NULL; + } + else + xf86removeOption(&keyboard->inp_option_lst, XkbOptions); + } + else if (options && *options) { + xf86addNewOption(keyboard->inp_option_lst, + XtNewString(XkbOptions), options); + options = NULL; + } } if (strcasecmp(keyboard->inp_identifier, ident_string)) xf86renameInput(XF86Config, keyboard, ident_string); xkb_info->conf = keyboard; + xkb_info->config.rules_file = rules; + return ((XtPointer)keyboard); } + xkb_rules = info; + rules = info->rules; + model = omodel; + layout = olayout; + variant = ovariant; + XtFree(options); + options = ooptions; + return (NULL); } @@ -312,8 +429,7 @@ { int major, minor, op, event, error; static int first = 1; - XkbRF_RulesPtr list; - int i, timeout = 5; + int timeout = 5; XF86ConfInputPtr keyboard = XF86Config->conf_input_lst; XF86OptionPtr option; char name[PATH_MAX]; @@ -355,69 +471,9 @@ bzero((char*)&(xkb_info->defs), sizeof(XkbRF_VarDefsRec)); - if ((list = XkbRF_Create(0, 0)) == NULL || - !XkbRF_LoadDescriptionsByName(XkbRulesFile, NULL, list)) { - fprintf(stderr, "Can't create rules structure\n"); - exit(1); - } - - for (i = 0; i < list->models.num_desc; i++) { - if (i % 16 == 0) { - xkb_model.name = (char**)XtRealloc((XtPointer)xkb_model.name, - (i + 16) * sizeof(char*)); - xkb_model.desc = (char**)XtRealloc((XtPointer)xkb_model.desc, - (i + 16) * sizeof(char*)); - } - xkb_model.name[i] = XtNewString(list->models.desc[i].name); - xkb_model.desc[i] = XtNewString(list->models.desc[i].desc); - } - xkb_model.nelem = i; - - for (i = 0; i < list->layouts.num_desc; i++) { - if (i % 16 == 0) { - xkb_layout.name = (char**)XtRealloc((XtPointer)xkb_layout.name, - (i + 16) * sizeof(char*)); - xkb_layout.desc = (char**)XtRealloc((XtPointer)xkb_layout.desc, - (i + 16) * sizeof(char*)); - } - xkb_layout.name[i] = XtNewString(list->layouts.desc[i].name); - xkb_layout.desc[i] = XtNewString(list->layouts.desc[i].desc); - } - xkb_layout.nelem = i; - - for (i = 0; i < list->variants.num_desc; i++) { - if (i % 16 == 0) { - xkb_variant.name = (char**)XtRealloc((XtPointer)xkb_variant.name, - (i + 16) * sizeof(char*)); - xkb_variant.desc = (char**)XtRealloc((XtPointer)xkb_variant.desc, - (i + 16) * sizeof(char*)); - } - xkb_variant.name[i] = XtNewString(list->variants.desc[i].name); - xkb_variant.desc[i] = XtNewString(list->variants.desc[i].desc); - } - xkb_variant.nelem = i; - - for (i = 0; i < list->options.num_desc; i++) { - if (i % 16 == 0) { - xkb_option.name = (char**)XtRealloc((XtPointer)xkb_option.name, - (i + 16) * sizeof(char*)); - xkb_option.desc = (char**)XtRealloc((XtPointer)xkb_option.desc, - (i + 16) * sizeof(char*)); - } - xkb_option.name[i] = XtNewString(list->options.desc[i].name); - xkb_option.desc[i] = XtNewString(list->options.desc[i].desc); - } - xkb_option.nelem = i; - - XkbRF_Free(list, True); - /* Load configuration */ XmuSnprintf(name, sizeof(name), "%s%s", XkbConfigDir, XkbConfigFile); file = fopen(name, "r"); -/* if ((file = fopen(name, "r")) == NULL) { - strcpy(name, XkbConfigFile); - file = fopen(name, "r"); - }*/ if (file != NULL) { if (XkbCFParse(file, XkbCFDflts, xkb_info->xkb, &xkb_info->config) == 0) { fprintf(stderr, "Error parsing config file: "); @@ -427,6 +483,12 @@ fclose(file); } + xkb_rules = GetXkbRulesDesc(xkb_info->config.rules_file != NULL ? + xkb_info->config.rules_file : XkbRulesFile); + if (xkb_rules == NULL) + /* error message was printed */ + exit(1); + /* XXX Assumes the first keyboard is the core keyboard */ while (keyboard != NULL) { if (strcasecmp(keyboard->inp_driver, "keyboard") == 0) @@ -436,21 +498,153 @@ if (keyboard == NULL) return; + if (xkb_info->config.rules_file != NULL) + rules = xkb_info->config.rules_file; + else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbRules")) + != NULL) + rules = option->opt_val; + else + rules = XkbRulesFile; + + if (strcmp(rules, xkb_rules->rules)) { + xkb_rules = GetXkbRulesDesc(rules); + if (xkb_rules == NULL) + /* error message was printed */ + exit(1); + } + { + FILE *fp; + char filename[1024]; + + XmuSnprintf(filename, sizeof(filename), "%s%s", + XkbRulesDir, xkb_rules->rules); + if ((fp = fopen(filename, "r")) == NULL) { + fprintf(stderr, "Can't open rules file\n"); + exit(1); + } + + if (!XkbRF_LoadRules(fp, xkb_rules->list)) { + fclose(fp); + fprintf(stderr, "Can't load rules\n"); + exit(1); + } + fclose(fp); + } + + if (xkb_info->config.rules_file == NULL) + xkb_info->config.rules_file = xkb_rules->rules; + if (xkb_info->config.model != NULL) xkb_info->defs.model = xkb_info->config.model; else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbModel")) != NULL) xkb_info->defs.model = option->opt_val; else - xkb_info->defs.model = xkb_model.name[0]; + xkb_info->defs.model = xkb_rules->model.name[0]; if (xkb_info->config.layout != NULL) xkb_info->defs.layout = xkb_info->config.layout; else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbLayout")) != NULL) xkb_info->defs.layout = option->opt_val; + else + xkb_info->defs.layout = xkb_rules->layout.name[0]; + + if (xkb_info->config.variant != NULL) + xkb_info->defs.variant = xkb_info->config.variant; + else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbVariant")) + != NULL) + xkb_info->defs.variant = option->opt_val; else - xkb_info->defs.layout = xkb_layout.name[0]; + xkb_info->defs.variant = NULL; + + if (xkb_info->config.options != NULL) + xkb_info->defs.options = xkb_info->config.options; + else if ((option = xf86findOption(keyboard->inp_option_lst, "XkbOptions")) + != NULL) + xkb_info->defs.options = option->opt_val; + else + xkb_info->defs.options = NULL; +} + +static XF86XkbRulesDescInfo * +GetXkbRulesDesc(char *rules) +{ + int i; + XkbRF_RulesPtr list; + char filename[1024]; + XF86XkbRulesDescInfo *info; + + if (rules == NULL) + return (NULL); + + for (i = 0; i < num_xkb_desc; i++) + if (strcmp(rules, xkb_desc[i]->rules) == 0) + return (xkb_desc[i]); + + XmuSnprintf(filename, sizeof(filename), "%s%s", XkbRulesDir, rules); + if ((list = XkbRF_Create(0, 0)) == NULL || + !XkbRF_LoadDescriptionsByName(filename, NULL, list)) { + fprintf(stderr, "Can't create rules structure\n"); + return (NULL); + } + + info = (XF86XkbRulesDescInfo*)XtCalloc(1, sizeof(XF86XkbRulesDescInfo)); + xkb_desc = (XF86XkbRulesDescInfo**) + XtRealloc((XtPointer)xkb_desc, + sizeof(XF86XkbRulesDescInfo*) * (num_xkb_desc + 1)); + xkb_desc[num_xkb_desc++] = info; + info->rules = XtNewString(rules); + for (i = 0; i < list->models.num_desc; i++) { + if (i % 16 == 0) { + info->model.name = (char**)XtRealloc((XtPointer)info->model.name, + (i + 16) * sizeof(char*)); + info->model.desc = (char**)XtRealloc((XtPointer)info->model.desc, + (i + 16) * sizeof(char*)); + } + info->model.name[i] = XtNewString(list->models.desc[i].name); + info->model.desc[i] = XtNewString(list->models.desc[i].desc); + } + info->model.nelem = i; + + for (i = 0; i < list->layouts.num_desc; i++) { + if (i % 16 == 0) { + info->layout.name = (char**)XtRealloc((XtPointer)info->layout.name, + (i + 16) * sizeof(char*)); + info->layout.desc = (char**)XtRealloc((XtPointer)info->layout.desc, + (i + 16) * sizeof(char*)); + } + info->layout.name[i] = XtNewString(list->layouts.desc[i].name); + info->layout.desc[i] = XtNewString(list->layouts.desc[i].desc); + } + info->layout.nelem = i; + + for (i = 0; i < list->variants.num_desc; i++) { + if (i % 16 == 0) { + info->variant.name = (char**)XtRealloc((XtPointer)info->variant.name, + (i + 16) * sizeof(char*)); + info->variant.desc = (char**)XtRealloc((XtPointer)info->variant.desc, + (i + 16) * sizeof(char*)); + } + info->variant.name[i] = XtNewString(list->variants.desc[i].name); + info->variant.desc[i] = XtNewString(list->variants.desc[i].desc); + } + info->variant.nelem = i; + + for (i = 0; i < list->options.num_desc; i++) { + if (i % 16 == 0) { + info->option.name = (char**)XtRealloc((XtPointer)info->option.name, + (i + 16) * sizeof(char*)); + info->option.desc = (char**)XtRealloc((XtPointer)info->option.desc, + (i + 16) * sizeof(char*)); + } + info->option.name[i] = XtNewString(list->options.desc[i].name); + info->option.desc[i] = XtNewString(list->options.desc[i].desc); + } + info->option.nelem = i; + info->list = list; + + return (info); } static xf86ConfigSymTabRec ax_controls[] = @@ -499,7 +693,7 @@ return (False); if (conf->rules_file != NULL) - fprintf(fp, "Rules = %s\n", + fprintf(fp, "Rules = \"%s\"\n", conf->rules_file); if (conf->model != NULL) fprintf(fp, "Model = \"%s\"\n", @@ -508,10 +702,10 @@ fprintf(fp, "Layout = \"%s\"\n", conf->layout); if (conf->variant != NULL) - fprintf(fp, "Variant = %s\n", + fprintf(fp, "Variant = \"%s\"\n", conf->variant); if (conf->options != NULL) - fprintf(fp, "Options = %s\n", + fprintf(fp, "Options = \"%s\"\n", conf->options); if (conf->keymap != NULL) fprintf(fp, "Keymap = %s\n", @@ -645,45 +839,21 @@ return (True); } -void +Bool UpdateKeyboard(Bool load) { - static XkbRF_RulesPtr rules; XkbComponentNamesRec comps; XkbDescPtr xkb; - if (rules == NULL) { - FILE *fp; - - if ((fp = fopen(XkbRulesFile, "r")) == NULL) { - fprintf(stderr, "Can't open rules file\n"); - exit(1); - } - - if ((rules = XkbRF_Create(0, 0)) == NULL) { - fclose(fp); - fprintf(stderr, "Can't create rules structure\n"); - exit(1); - } - - if (!XkbRF_LoadRules(fp, rules)) { - fclose(fp); - XkbRF_Free(rules, True); - fprintf(stderr, "Can't load rules\n"); - exit(1); - } - fclose(fp); - } - bzero((char*)&comps, sizeof(XkbComponentNamesRec)); - XkbRF_GetComponents(rules, &(xkb_info->defs), &comps); + XkbRF_GetComponents(xkb_rules->list, &(xkb_info->defs), &comps); xkb = XkbGetKeyboardByName(DPY, XkbUseCoreKbd, &comps, XkbGBN_AllComponentsMask, 0, load); if (xkb == NULL || xkb->geom == NULL) { fprintf(stderr, "Couldn't get keyboard\n"); - exit(1); + return (False); } if (xkb->names->geometry == 0) xkb->names->geometry = xkb->geom->name; @@ -701,6 +871,150 @@ if (kbd != NULL) XClearArea(XtDisplay(configp), XtWindow(kbd), 0, 0, 0, 0, True); + + return (True); +} + +static void +KeyboardRulesCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + int i; + FILE *fp; + Arg args[1]; + char filename[1024], *omodel, *olayout, *ovariant, *ooptions, + *dmodel, *dlayout, *dvariant; + XF86XkbRulesDescInfo *oxkb_rules, *info = GetXkbRulesDesc(XtName(w)); + + if (strcmp(XtName(w), rules) == 0 || info == NULL) + /* a error message was printed */ + return; + + XmuSnprintf(filename, sizeof(filename), "%s%s", + XkbRulesDir, info->rules); + if ((fp = fopen(filename, "r")) == NULL) { + fprintf(stderr, "Can't open rules file\n"); + return; + } + + if (!XkbRF_LoadRules(fp, info->list)) { + fclose(fp); + fprintf(stderr, "Can't load rules\n"); + return; + } + fclose(fp); + + oxkb_rules = xkb_rules; + omodel = xkb_info->defs.model; + olayout = xkb_info->defs.layout; + ovariant = xkb_info->defs.variant; + ooptions = xkb_info->defs.options; + + if (omodel) { + for (i = 0; i < info->model.nelem; i++) { + if (strcmp(omodel, info->model.name[i]) == 0) + break; + } + } + else + i = 0; + model = xkb_info->defs.model = info->model.name + [i < info->model.nelem ? i : 0]; + dmodel = info->model.desc[i < info->model.nelem ? i : 0]; + + if (olayout) { + for (i = 0; i < info->layout.nelem; i++) { + if (strcmp(olayout, info->layout.name[i]) == 0) + break; + } + } + else + i = 0; + layout = xkb_info->defs.layout = info->layout.name + [i < info->layout.nelem ? i : 0]; + dlayout = info->layout.desc[i < info->layout.nelem ? i : 0]; + + if (ovariant) { + for (i = 0; i < info->variant.nelem; i++) { + if (strcmp(ovariant, info->variant.name[i]) == 0) + break; + } + } + else + i = info->variant.nelem; + variant = xkb_info->defs.variant = i < info->variant.nelem ? + info->variant.name[i] : NULL; + dvariant = i < info->variant.nelem ? + info->variant.desc[i] : NULL; + + if (ooptions) { + char *ptr, *tmp = XtNewString(options); + + for (ptr = strtok(tmp, ","); ptr != NULL; ptr = strtok(NULL, ",")) { + if (strchr(ptr, ':') == NULL) + continue; + + for (i = 0; i < xkb_rules->option.nelem; i++) + if (strcmp(xkb_rules->option.name[i], ptr) == 0) + break; + + if (i == xkb_rules->option.nelem) { + XtFree(options); + options = NULL; + /* no option with the same name */ + break; + } + } + XtFree(tmp); + } + else { + XtFree(options); + options = NULL; + } + + oxkb_rules = xkb_rules; + xkb_rules = info; + rules = info->rules; + + if (!UpdateKeyboard(False)) { + model = xkb_info->defs.model = omodel; + layout = xkb_info->defs.layout = olayout; + variant = xkb_info->defs.variant = ovariant; + options = xkb_info->defs.options = ooptions; + xkb_rules = oxkb_rules; + rules = xkb_rules->rules; + + XmuSnprintf(filename, sizeof(filename), "%s%s", + XkbRulesDir, rules); + if ((fp = fopen(filename, "r")) == NULL) { + fprintf(stderr, "Can't open rules file\n"); + return; + } + + if (!XkbRF_LoadRules(fp, xkb_rules->list)) { + fclose(fp); + fprintf(stderr, "Can't load rules\n"); + } + fclose(fp); + + return; + } + + UpdateRulesPopups(); + + XtSetArg(args[0], XtNlabel, rules); + XtSetValues(rulesb, args, 1); + + XtSetArg(args[0], XtNlabel, dmodel); + XtSetValues(modelb, args, 1); + + XtSetArg(args[0], XtNlabel, dlayout); + XtSetValues(layoutb, args, 1); + + XtSetArg(args[0], XtNlabel, dvariant ? dvariant : ""); + XtSetValues(variantb, args, 1); + + XtSetArg(args[0], XtNlabel, options ? options : ""); + XtSetValues(variantb, args, 1); } static void @@ -708,14 +1022,18 @@ { Arg args[1]; int i; + char *oldval = xkb_info->defs.model; - for (i = 0; i < xkb_model.nelem; i++) - if (strcmp(XtName(w), xkb_model.name[i]) == 0) + for (i = 0; i < xkb_rules->model.nelem; i++) + if (strcmp(XtName(w), xkb_rules->model.name[i]) == 0) break; - XtSetArg(args[0], XtNlabel, xkb_model.desc[i]); - XtSetValues(modelb, args, 1); - model = xkb_info->defs.model = xkb_model.name[i]; - UpdateKeyboard(False); + model = xkb_info->defs.model = xkb_rules->model.name[i]; + if (!UpdateKeyboard(False)) + model = xkb_info->defs.model = oldval; + else { + XtSetArg(args[0], XtNlabel, xkb_rules->model.desc[i]); + XtSetValues(modelb, args, 1); + } } static void @@ -723,20 +1041,209 @@ { Arg args[1]; int i; + char *oldval = xkb_info->defs.layout; - for (i = 0; i < xkb_layout.nelem; i++) - if (strcmp(XtName(w), xkb_layout.name[i]) == 0) + for (i = 0; i < xkb_rules->layout.nelem; i++) + if (strcmp(XtName(w), xkb_rules->layout.name[i]) == 0) break; - XtSetArg(args[0], XtNlabel, xkb_layout.desc[i]); - XtSetValues(layoutb, args, 1); - layout = xkb_info->defs.layout = xkb_layout.name[i]; + layout = xkb_info->defs.layout = xkb_rules->layout.name[i]; + if (!UpdateKeyboard(False)) + layout = xkb_info->defs.layout = oldval; + else { + XtSetArg(args[0], XtNlabel, xkb_rules->layout.desc[i]); + XtSetValues(layoutb, args, 1); + } +} + +static void +KeyboardVariantCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + Arg args[1]; + int i; + char *label, *oldval = xkb_info->defs.variant; + + for (i = 0; i < xkb_rules->variant.nelem; i++) + if (strcmp(XtName(w), xkb_rules->variant.name[i]) == 0) + break; + variant = i < xkb_rules->variant.nelem ? xkb_rules->variant.name[i] : ""; + xkb_info->defs.variant = variant && *variant ? variant : NULL; + + if (!UpdateKeyboard(False)) + xkb_info->defs.variant = variant = oldval; + else { + label = i < xkb_rules->variant.nelem ? xkb_rules->variant.desc[i] : ""; + XtSetArg(args[0], XtNlabel, label); + XtSetValues(variantb, args, 1); + } +} + +static void +KeyboardOptionsCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + Arg args[1]; + int i; + char *oldval = xkb_info->defs.options ? + XtNewString(xkb_info->defs.options) : XtNewString(""); + + for (i = 0; i < xkb_rules->option.nelem; i++) + if (strcmp(XtName(w), xkb_rules->option.name[i]) == 0) + break; + + if (i < xkb_rules->option.nelem) { + char *delim, *ptr, str[256]; + + /* remove old string, don't check if the same */ + if ((delim = strchr(XtName(w), ':')) != NULL) { + if (delim - XtName(w) >= sizeof(str) - 2) + return; + strncpy(str, XtName(w), delim - XtName(w) + 1); + str[delim - XtName(w) + 1] = '\0'; + } + else + XmuSnprintf(str, sizeof(str), "%s:", XtName(w)); + if (options && (delim = strstr(options, str)) != NULL) { + if ((ptr = strchr(delim, ',')) != NULL) { + *delim = *ptr = '\0'; + XmuSnprintf(str, sizeof(str), "%s%s", options, ptr + 1); + XtFree(options); + options = XtNewString(str); + } + else { + if (delim > options) + delim[-1] = '\0'; + else + delim[0] = '\0'; + } + } + + /* update string, if required */ + if ((delim = strchr(XtName(w), ':')) != NULL) { + if (options && *options) + XmuSnprintf(str, sizeof(str), "%s,%s", options, XtName(w)); + else + XmuSnprintf(str, sizeof(str), "%s", XtName(w)); + XtFree(options); + options = XtNewString(str); + } + } + else { + XtFree(options); + options = XtNewString(""); + } + + if (options == NULL) + options = XtNewString(""); + + xkb_info->defs.options = *options ? options : NULL; + if (!UpdateKeyboard(False)) { + XtFree(options); + xkb_info->defs.options = *oldval ? oldval : NULL; + } + else { + XtFree(oldval); + XtSetArg(args[0], XtNlabel, options); + XtSetValues(optionsb, args, 1); + XtSetArg(args[0], XtNtip, options); + XtSetValues(optionsb, args, 1); + } } /*ARGSUSED*/ static void KeyboardApplyCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + (void)UpdateKeyboard(True); +} + +static void +UpdateRulesPopups(void) { - UpdateKeyboard(True); + int i; + char *optname; + Widget sme, optpopup, optparent; + + /* MODEL */ + if (modelp) + XtDestroyWidget(modelp); + modelp = XtCreatePopupShell("modelP", simpleMenuWidgetClass, + modelb, NULL, 0); + for (i = 0; i < xkb_rules->model.nelem; i++) { + sme = XtVaCreateManagedWidget(xkb_rules->model.name[i], smeBSBObjectClass, + modelp, + XtNlabel, xkb_rules->model.desc[i], + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardModelCallback, NULL); + } + + /* LAYOUT */ + if (layoutp) + XtDestroyWidget(layoutp); + layoutp = XtCreatePopupShell("layoutP", simpleMenuWidgetClass, + layoutb, NULL, 0); + for (i = 0; i < xkb_rules->layout.nelem; i++) { + sme = XtVaCreateManagedWidget(xkb_rules->layout.name[i], smeBSBObjectClass, + layoutp, + XtNlabel, xkb_rules->layout.desc[i], + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardLayoutCallback, NULL); + } + + /* VARIANT */ + if (variantp) + XtDestroyWidget(variantp); + variantp = XtCreatePopupShell("variantP", simpleMenuWidgetClass, + variantb, NULL, 0); + sme = XtVaCreateManagedWidget("None", smeBSBObjectClass, + variantp, + XtNlabel, "None", + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardVariantCallback, NULL); + for (i = 0; i < xkb_rules->variant.nelem; i++) { + sme = XtVaCreateManagedWidget(xkb_rules->variant.name[i], smeBSBObjectClass, + variantp, + XtNlabel, xkb_rules->variant.desc[i], + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardVariantCallback, NULL); + } + + /* OPTIONS */ + if (optionsp) + XtDestroyWidget(optionsp); + optionsp = XtCreatePopupShell("optionsP", simpleMenuWidgetClass, + optionsb, NULL, 0); + sme = XtVaCreateManagedWidget("None", smeBSBObjectClass, + optionsp, + XtNlabel, "None", + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL); + optparent = optionsp; + optname = NULL; + for (i = 0; i < xkb_rules->option.nelem; i++) { + if (!strchr(xkb_rules->option.name[i], ':')) { + optpopup = + XtCreatePopupShell(optname = xkb_rules->option.desc[i], + simpleMenuWidgetClass, + optparent = optionsp, NULL, 0); + sme = XtVaCreateManagedWidget(xkb_rules->option.name[i], + smeBSBObjectClass, + optpopup, + XtNlabel, "None", + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL); + } + else { + optparent = optpopup; + optname = NULL; + } + sme = XtVaCreateManagedWidget(xkb_rules->option.name[i], smeBSBObjectClass, + optparent, + XtNlabel, xkb_rules->option.desc[i], + XtNmenuName, optname, + XtNleftBitmap, optname ? menuPixmap : None, + NULL, 0); + if (optparent != optionsp) + XtAddCallback(sme, XtNcallback, KeyboardOptionsCallback, NULL); + } } void @@ -748,45 +1255,69 @@ int i; if (first) { - Widget label, popup, sme; + Widget popup, sme; first = 0; kbdml = XtCreateWidget("keyboardML", formWidgetClass, configp, NULL, 0); + /* RULES */ + XtCreateManagedWidget("labelR", labelWidgetClass, kbdml, NULL, 0); + rulesb = XtVaCreateManagedWidget("rules", menuButtonWidgetClass, kbdml, + XtNmenuName, "rulesP", + NULL, 0); + popup = XtCreatePopupShell("rulesP", simpleMenuWidgetClass, + rulesb, NULL, 0); + { + struct dirent *ent; + DIR *dir; + + if ((dir = opendir(XkbRulesDir)) != NULL) { + (void)readdir(dir); + (void)readdir(dir); + while ((ent = readdir(dir)) != NULL) { + if (strchr(ent->d_name, '.')) + continue; + + sme = XtVaCreateManagedWidget(ent->d_name, smeBSBObjectClass, + popup, + XtNlabel, ent->d_name, + NULL, 0); + XtAddCallback(sme, XtNcallback, KeyboardRulesCallback, NULL); + } + closedir(dir); + } + } + /* MODEL */ - label = XtCreateManagedWidget("labelM", labelWidgetClass, - kbdml, NULL, 0); + XtCreateManagedWidget("labelM", labelWidgetClass, kbdml, NULL, 0); modelb = XtVaCreateManagedWidget("model", menuButtonWidgetClass, kbdml, XtNmenuName, "modelP", NULL, 0); - popup = XtCreatePopupShell("modelP", simpleMenuWidgetClass, - modelb, NULL, 0); - for (i = 0; i < xkb_model.nelem; i++) { - sme = XtVaCreateManagedWidget(xkb_model.name[i], smeBSBObjectClass, - popup, - XtNlabel, xkb_model.desc[i], - NULL, 0); - XtAddCallback(sme, XtNcallback, KeyboardModelCallback, NULL); - } /* LAYOUT */ - label = XtCreateManagedWidget("labelL", labelWidgetClass, - kbdml, NULL, 0); + XtCreateManagedWidget("labelL", labelWidgetClass, kbdml, NULL, 0); layoutb = XtVaCreateManagedWidget("layout", menuButtonWidgetClass, kbdml, XtNmenuName, "layoutP", - XtNlabel, xkb_layout.desc[0], + XtNlabel, xkb_rules->layout.desc[0], NULL, 0); - popup = XtCreatePopupShell("layoutP", simpleMenuWidgetClass, - layoutb, NULL, 0); - for (i = 0; i < xkb_layout.nelem; i++) { - sme = XtVaCreateManagedWidget(xkb_layout.name[i], smeBSBObjectClass, - popup, - XtNlabel, xkb_layout.desc[i], + + /* VARIANT */ + XtCreateManagedWidget("labelV", labelWidgetClass, kbdml, NULL, 0); + variantb = XtVaCreateManagedWidget("variant", menuButtonWidgetClass, kbdml, + XtNmenuName, "variantP", + XtNlabel, "", NULL, 0); - XtAddCallback(sme, XtNcallback, KeyboardLayoutCallback, NULL); - } + + /* OPTIONS */ + XtCreateManagedWidget("labelO", labelWidgetClass, kbdml, NULL, 0); + optionsb = XtVaCreateManagedWidget("options", menuButtonWidgetClass, kbdml, + XtNmenuName, "optionsP", + XtNlabel, "", + NULL, 0); + + UpdateRulesPopups(); kbd = XtCreateManagedWidget("keyboard", coreWidgetClass, kbdml, NULL, 0); @@ -802,19 +1333,35 @@ XClearArea(XtDisplay(kbd), XtWindow(kbd), 0, 0, 0, 0, True); } - for (i = 0; i < xkb_model.nelem; i++) - if (strcmp(model, xkb_model.name[i]) == 0) { - XtSetArg(args[0], XtNlabel, xkb_model.desc[i]); + XtSetArg(args[0], XtNlabel, xkb_rules->rules); + XtSetValues(rulesb, args, 1); + + for (i = 0; i < xkb_rules->model.nelem; i++) + if (strcmp(model, xkb_rules->model.name[i]) == 0) { + XtSetArg(args[0], XtNlabel, xkb_rules->model.desc[i]); XtSetValues(modelb, args, 1); break; } - for (i = 0; i < xkb_layout.nelem; i++) - if (strcmp(layout, xkb_layout.name[i]) == 0) { - XtSetArg(args[0], XtNlabel, xkb_layout.desc[i]); + for (i = 0; i < xkb_rules->layout.nelem; i++) + if (strcmp(layout, xkb_rules->layout.name[i]) == 0) { + XtSetArg(args[0], XtNlabel, xkb_rules->layout.desc[i]); XtSetValues(layoutb, args, 1); break; } + + if (variant) + for (i = 0; i < xkb_rules->variant.nelem; i++) + if (strcmp(variant, xkb_rules->variant.name[i]) == 0) { + XtSetArg(args[0], XtNlabel, xkb_rules->variant.desc[i]); + XtSetValues(variantb, args, 1); + break; + } + + if (options) { + XtSetArg(args[0], XtNlabel, options); + XtSetValues(optionsb, args, 1); + } XtChangeManagedSet(¤t, 1, NULL, NULL, &kbdml, 1); current = kbdml; Index: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h:1.2 xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h:1.3 --- xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h:1.2 Tue Jun 13 19:15:51 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h Fri Mar 2 17:39:27 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h,v 1.2 2000/06/13 23:15:51 dawes Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/keyboard-cfg.h,v 1.3 2001/03/02 22:39:27 paulo Exp $ */ #include "config.h" @@ -63,7 +63,7 @@ XtPointer KeyboardConfig(XtPointer); void KeyboardModelAndLayout(XF86SetupInfo*); void InitializeKeyboard(void); -void UpdateKeyboard(Bool); +Bool UpdateKeyboard(Bool); Bool WriteXKBConfiguration(char*, XkbConfigRtrnPtr); /* Index: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c:1.3 xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c:1.5.2.1 --- xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c:1.3 Fri Dec 1 13:31:07 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c Mon May 28 17:36:44 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.3 2000/12/01 18:31:07 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.c,v 1.5.2.1 2001/05/28 21:36:44 paulo Exp $ */ #define LOADER_PRIVATE #include "loader.h" @@ -34,10 +34,16 @@ /* XXX beware (or fix it) libc functions called here are the xf86 ones */ #ifdef USE_MODULES +static void AddModuleOptions(char*, OptionInfoPtr); void xf86AddDriver(DriverPtr, void*, int); Bool xf86ServerIsOnlyDetecting(void); +void xf86AddInputDriver(InputDriverPtr, pointer, int); +void xf86AddModuleInfo(ModuleInfoPtr, void*); +Bool xf86LoaderCheckSymbol(const char*); +void xf86LoaderReqSymLists(const char **, ...); +void xf86Msg(int, const char*, ...); -xf86cfgDriverOptions *video_driver_info; +xf86cfgModuleOptions *module_options; int xf86ShowUnresolved = 1; @@ -231,11 +237,50 @@ SYMFUNC(xf86AddDriver) SYMFUNC(xf86ServerIsOnlyDetecting) + SYMFUNC(xf86AddInputDriver) + SYMFUNC(xf86AddModuleInfo) + SYMFUNC(xf86LoaderCheckSymbol) + + SYMFUNC(xf86LoaderReqSymLists) + SYMFUNC(xf86Msg) + SYMFUNC(ErrorF) {0,0} }; static DriverPtr driver; +static ModuleInfoPtr info; +static ModuleType type = GenericModule; +static void +AddModuleOptions(char *name, OptionInfoPtr option) +{ + xf86cfgModuleOptions *ptr; + OptionInfoPtr tmp; + + ptr = XtNew(xf86cfgModuleOptions); + ptr->name = XtNewString(name); + ptr->type = type; + if (option) { + int count; + + for (count = 0, tmp = option; tmp->name != NULL; tmp++, count++) + ; + ++count; + ptr->option = (XtPointer)XtCalloc(1, count * sizeof(OptionInfoRec)); + for (count = 0, tmp = option; tmp->name != NULL; count++, tmp++) { + memcpy(&ptr->option[count], tmp, sizeof(OptionInfoRec)); + ptr->option[count].name = XtNewString(tmp->name); + if (tmp->type == OPTV_STRING || tmp->type == OPTV_ANYSTR) + ptr->option[count].value.str = XtNewString(tmp->value.str); + } + } + else + ptr->option = NULL; + + ptr->next = module_options; + module_options = ptr; +} + Bool LoaderInitializeOptions(void) { @@ -257,7 +302,9 @@ if (path == NULL || strcmp(XF86Module_path, path)) { char **list, **l; const char *subdirs[] = { + ".", "drivers", + "input", NULL }; int errmaj, errmin; @@ -268,61 +315,32 @@ list = LoaderListDirs(subdirs, NULL); if (list) { - xf86cfgDriverOptions *prev, *ptr = video_driver_info; - +#if 0 if (ptr) { - while (video_driver_info) { - video_driver_info = video_driver_info->next; + while (module_options) { + module_options = module_options->next; XtFree(ptr->name); XtFree((XtPointer)ptr->option); XtFree((XtPointer)ptr); - ptr = video_driver_info; + ptr = module_options; } } +#endif for (l = list; *l; l++) { driver = NULL; + info = NULL; + type = GenericModule; xf86Verbose = 0; if ((module = LoadModule(*l, NULL, NULL, NULL, NULL, NULL, &errmaj, &errmin)) == NULL) LoaderErrorMsg(NULL, *l, errmaj, errmin); - else if (driver && driver->AvailableOptions) { - OptionInfoPtr tmp, - option = (*driver->AvailableOptions)(-1, -1); - - ptr = XtNew(xf86cfgDriverOptions); - ptr->name = XtNewString(*l); - if (option) { - int count; - - for (count = 0, tmp = option; tmp->name != NULL; tmp++, count++) - ; - ++count; - ptr->option = (XtPointer)XtCalloc(1, count * - sizeof(OptionInfoRec)); - for (count = 0, tmp = option; tmp->name != NULL; - count++, tmp++) { - memcpy(&ptr->option[count], tmp, - sizeof(OptionInfoRec)); - ptr->option[count].name = - XtNewString(tmp->name); - if (tmp->type == OPTV_STRING || - tmp->type == OPTV_ANYSTR) - ptr->option[count].value.str = - XtNewString(tmp->value.str); - } - } - else - ptr->option = NULL; - ptr->next = NULL; - if (video_driver_info == NULL) - video_driver_info = ptr; - else - prev->next = ptr; - prev = ptr; + else if (driver && driver->AvailableOptions) + AddModuleOptions(*l, (*driver->AvailableOptions)(-1, -1)); + else if (info && info->AvailableOptions) + AddModuleOptions(*l, (*info->AvailableOptions)(NULL)); - UnloadModule(module); - } + UnloadModule(module); xf86Verbose = saveVerbose; } LoaderFreeDirList(list); @@ -342,11 +360,39 @@ xf86AddDriver(DriverPtr drv, void *module, int flags) { driver = drv; + type = VideoModule; } Bool xf86ServerIsOnlyDetecting(void) { return (True); +} + +void +xf86AddInputDriver(InputDriverPtr inp, void *module, int flags) +{ + type = InputModule; +} + +void +xf86AddModuleInfo(ModuleInfoPtr inf, void *module) +{ + info = inf; +} + +Bool +xf86LoaderCheckSymbol(const char *symbol) +{ + return LoaderSymbol(symbol) != NULL; +} + +void +xf86LoaderReqSymLists(const char **list0, ...) +{ +} + +void xf86Msg(int type, const char *format, ...) +{ } #endif Index: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h:1.1 xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h:1.4 --- xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h:1.1 Fri Oct 20 10:59:05 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h Fri May 18 16:22:31 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h,v 1.1 2000/10/20 14:59:05 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/loader.h,v 1.4 2001/05/18 20:22:31 tsi Exp $ */ #ifdef USE_MODULES #include "config.h" @@ -149,15 +149,65 @@ void * module; int refCount; } DriverRec, *DriverPtr; + +typedef struct _InputDriverRec { + int driverVersion; + char * driverName; + void (*Identify)(int flags); + struct _LocalDeviceRec *(*PreInit)(struct _InputDriverRec *drv, + void *dev, int flags); + void (*UnInit)(struct _InputDriverRec *drv, + void *pInfo, + int flags); + pointer module; + int refCount; +} InputDriverRec, *InputDriverPtr; + +typedef struct _loader_item *itemPtr; +typedef struct _loader_item { + char *name ; + void *address ; + itemPtr next ; + int handle ; + int module ; + itemPtr exports; +#if defined(__powerpc__) + /* + * PowerPC file formats require special routines in some circumstances + * to assist in the linking process. See the specific loader for + * more details. + */ + union { + unsigned short plt[8]; /* ELF */ + unsigned short glink[14]; /* XCOFF */ + } code ; +#endif + } itemRec ; + +typedef struct _ModuleInfoRec { + int moduleVersion; + char * moduleName; + pointer module; + int refCount; + OptionInfoRec * (*AvailableOptions)(void *unused); + pointer unused[2]; /* leave some space for more fields */ +} ModuleInfoRec, *ModuleInfoPtr; #endif /* LOADER_PRIVATE */ + +typedef enum { + VideoModule, + InputModule, + GenericModule +} ModuleType; -typedef struct _xf86cfgDriverOptions { +typedef struct _xf86cfgModuleOptions { char *name; + ModuleType type; OptionInfoPtr option; - struct _xf86cfgDriverOptions *next; -} xf86cfgDriverOptions; + struct _xf86cfgModuleOptions *next; +} xf86cfgModuleOptions; -extern xf86cfgDriverOptions *video_driver_info; +extern xf86cfgModuleOptions *module_options; Bool LoaderInitializeOptions(void); #endif /* USE_MODULES */ Index: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c:1.4.2.1 xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c:1.7 --- xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c:1.4.2.1 Fri Feb 9 15:45:13 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c Fri Mar 23 20:17:20 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c,v 1.4.2.1 2001/02/09 20:45:13 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/monitor-cfg.c,v 1.7 2001/03/24 01:17:20 paulo Exp $ */ #include "xf86config.h" @@ -166,9 +166,9 @@ monitor = (XF86ConfMonitorPtr)(monitor->list.next); } do { - ++nmonitors; XmuSnprintf(monitor_name, sizeof(monitor_name), "Monitor%d", nmonitors); + ++nmonitors; } while (xf86findMonitor(monitor_name, XF86Config->conf_monitor_lst)); @@ -266,6 +266,10 @@ while (*str) { while (*str && isspace(*str)) ++str; + if (!isdigit(*str)) { + ++str; + continue; + } val = strtod(str, &str); while (*str && isspace(*str)) ++str; Index: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c:1.5 xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c:1.7 --- xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c:1.5 Fri Oct 20 10:59:06 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c Sun Apr 22 04:36:31 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.5 2000/10/20 14:59:06 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/mouse-cfg.c,v 1.7 2001/04/22 08:36:31 herrb Exp $ */ #include "xf86config.h" @@ -52,6 +52,9 @@ * Initialization */ static char *protocols[] = { +#ifdef WSCONS_SUPPORT + "wsmouse", +#endif "Auto", "BusMouse", "GlidePoint", @@ -115,8 +118,8 @@ input = (XF86ConfInputPtr)(input->list.next); } do { - ++nmouses; XmuSnprintf(mouse_name, sizeof(mouse_name), "Mouse%d", nmouses); + ++nmouses; } while (xf86findInput(mouse_name, XF86Config->conf_input_lst)); @@ -302,6 +305,9 @@ static Widget mouse_dp, listD, listP, emul3, apply; static char **devices; static char *patterns[] = { +#ifdef WSCONS_SUPPORT + "wsmouse", +#endif "cua", "mouse", "ps", Index: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/options.c:1.4 xc/programs/Xserver/hw/xfree86/xf86cfg/options.c:1.6.2.2 --- xc/programs/Xserver/hw/xfree86/xf86cfg/options.c:1.4 Thu Nov 30 15:55:18 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/options.c Fri May 25 17:45:01 2001 @@ -26,11 +26,12 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c,v 1.4 2000/11/30 20:55:18 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.c,v 1.6.2.2 2001/05/25 21:45:01 paulo Exp $ */ #include "options.h" #include "xf86config.h" +#include <X11/Xresource.h> #include <X11/Shell.h> #include <X11/Xaw/AsciiText.h> #include <X11/Xaw/List.h> @@ -52,6 +53,9 @@ static void UpdateOptionList(void); #ifdef USE_MODULES static void AddDriverOption(Widget, XtPointer, XtPointer); +static void SelectModuleCallback(Widget, XtPointer, XtPointer); +static void SelectModuleOptionCallback(Widget, XtPointer, XtPointer); +static void ModuleOptionsPopdown(Widget, XtPointer, XtPointer); #endif /* @@ -62,11 +66,154 @@ static Widget add, remov, update, list, name, value; static char *option_str; static int option_index, popped = False; +static char *Options = "lib/X11/Options"; +static XrmDatabase xrm; +#ifdef USE_MODULES +static Widget modList, optList, desc, modOptionsShell, labelType; +static char *module_sel; +static char *types[] = { + "none", "integer", "(non null) string", "string", "real", + "boolean", "frequency", +}; +#endif /* * Implementation */ +#ifdef USE_MODULES +static int +qcmp_str(_Xconst void *a, _Xconst void *b) +{ + return (strcmp(*(char**)a, *(char**)b)); +} + void +ModuleOptionsPopup(Widget w, XtPointer user_data, XtPointer call_data) +{ + xf86cfgModuleOptions *info = module_options; + + if (modOptionsShell == NULL) { + char **ops; + int nops; + Widget pane, form, viewport, bottom, popdown; + + modOptionsShell = XtCreatePopupShell("moduleOptions", + transientShellWidgetClass, + optionsShell, NULL, 0); + + pane = XtCreateManagedWidget("pane", panedWidgetClass, + modOptionsShell, NULL, 0); + + form = XtCreateManagedWidget("descriptions", formWidgetClass, + pane, NULL, 0); + labelType = XtCreateManagedWidget("labelType", labelWidgetClass, + form, NULL, 0); + XtCreateManagedWidget("module", labelWidgetClass, form, NULL, 0); + viewport = XtCreateManagedWidget("viewM", viewportWidgetClass, + form, NULL, 0); + ops = NULL; + nops = 0; + while (info) { + ++nops; + ops = (char**)XtRealloc((XtPointer)ops, sizeof(char*) * nops); + ops[nops - 1] = XtNewString(info->name); + info = info->next; + } + if (nops == 0) { + ops = (char**)XtMalloc(sizeof(char*)); + ops[0] = XtNewString(""); + nops = 1; + } + else + qsort(ops, nops, sizeof(char*), qcmp_str); + modList = XtVaCreateManagedWidget("modL", listWidgetClass, + viewport, XtNlist, ops, + XtNnumberStrings, nops, + NULL, 0); + XtAddCallback(modList, XtNcallback, SelectModuleCallback, NULL); + XtCreateManagedWidget("option", labelWidgetClass, form, NULL, 0); + viewport = XtCreateManagedWidget("viewO", viewportWidgetClass, + form, NULL, 0); + ops = (char**)XtMalloc(sizeof(char*)); + ops[0] = XtNewString(""); + optList = XtVaCreateManagedWidget("optL", listWidgetClass, + viewport, XtNlist, ops, + XtNnumberStrings, 1, NULL, 0); + XtAddCallback(optList, XtNcallback, SelectModuleOptionCallback, NULL); + desc = XtVaCreateManagedWidget("desc", asciiTextWidgetClass, + form, XtNeditType, XawtextRead, + NULL, 0); + + bottom = XtCreateManagedWidget("bottom", formWidgetClass, + pane, NULL, 0); + popdown = XtVaCreateManagedWidget("popdown", commandWidgetClass, + bottom, NULL, 0); + XtAddCallback(popdown, XtNcallback, ModuleOptionsPopdown, NULL); + XtRealizeWidget(modOptionsShell); + XSetWMProtocols(DPY, XtWindow(modOptionsShell), &wm_delete_window, 1); + + info = module_options; + } + + if (module_sel && *module_sel) { + XawListReturnStruct list; /* hack to call ballbacks */ + char **strs; + int nstrs, idx = 0; + + XtVaGetValues(modList, XtNlist, &strs, XtNnumberStrings, &nstrs, NULL); + for (idx = nstrs - 1; idx > 0; idx--) + if (strcmp(module_sel, strs[idx]) == 0) + break; + while (info) { + if (strcmp(module_sel, info->name) == 0) + break; + info = info->next; + } + if (info) { + list.string = info->name; + list.list_index = idx; + XawListHighlight(modList, idx); + SelectModuleCallback(modList, NULL, (XtPointer)&list); + } + if (option_str && *option_str) { + OptionInfoPtr opts = info->option; + + idx = 0; + while (opts && opts->name) { + if (strcmp(opts->name, option_str) == 0) + break; + ++idx; + ++opts; + } + + if (opts && opts->name) { + list.string = (char *)opts->name; + list.list_index = idx; + XawListHighlight(optList, idx); + SelectModuleOptionCallback(optList, NULL, (XtPointer)&list); + } + } + } + XtPopup(modOptionsShell, XtGrabNone); +} + +/*ARGSUSED*/ +static void +ModuleOptionsPopdown(Widget w, XtPointer user_data, XtPointer call_data) +{ + XtPopdown(modOptionsShell); +} + +/*ARGSUSED*/ +void +ModuleOptionsCancelAction(Widget w, XEvent *event, + String *params, Cardinal *num_params) +{ + ModuleOptionsPopdown(w, NULL, NULL); +} +#endif + +void CreateOptionsShell(void) { optionsShell = XtCreatePopupShell("options", transientShellWidgetClass, @@ -95,7 +242,7 @@ option_str = NULL; options = opts; if (first) { - Widget pane, form, viewport, bottom, popdown; + Widget pane, form, viewport, bottom, popdown, command; first = 0; @@ -103,6 +250,7 @@ CreateOptionsShell(); pane = XtCreateManagedWidget("pane", panedWidgetClass, optionsShell, NULL, 0); + form = XtCreateManagedWidget("commands", formWidgetClass, pane, NULL, 0); add = XtCreateManagedWidget("add", commandWidgetClass, @@ -114,6 +262,13 @@ update = XtCreateManagedWidget("update", commandWidgetClass, form, NULL, 0); XtAddCallback(update, XtNcallback, UpdateOption, NULL); +#ifdef USE_MODULES + if (!nomodules) { + command = XtCreateManagedWidget("help", commandWidgetClass, + form, NULL, 0); + XtAddCallback(command, XtNcallback, ModuleOptionsPopup, NULL); + } +#endif form = XtCreateManagedWidget("form", formWidgetClass, pane, NULL, 0); XtVaCreateManagedWidget("label1", labelWidgetClass, form, @@ -140,13 +295,15 @@ bottom = XtCreateManagedWidget("bottom", formWidgetClass, pane, NULL, 0); #ifdef USE_MODULES - button = XtCreateManagedWidget("driverOpts", menuButtonWidgetClass, - bottom, NULL, 0); + if (!nomodules) + button = XtCreateManagedWidget("driverOpts", menuButtonWidgetClass, + bottom, NULL, 0); #endif popdown = XtVaCreateManagedWidget("popdown", commandWidgetClass, bottom, NULL, 0); #ifdef USE_MODULES - XtVaSetValues(popdown, XtNfromHoriz, button, NULL, 0); + if (!nomodules) + XtVaSetValues(popdown, XtNfromHoriz, button, NULL, 0); #endif XtAddCallback(popdown, XtNcallback, PopdownCallback, NULL); @@ -154,7 +311,7 @@ XSetWMProtocols(DPY, XtWindow(optionsShell), &wm_delete_window, 1); #ifdef USE_MODULES - { + if (!nomodules) { char *str; XtSetArg(args[0], XtNlabel, &str); @@ -165,49 +322,57 @@ } #ifdef USE_MODULES - if (menu) - XtDestroyWidget(menu); - XmuSnprintf(menuName, sizeof(buf), "optionM%d", menuN); - menuN = !menuN; - menu = XtCreatePopupShell(menuName, simpleMenuWidgetClass, button, - NULL, 0); - XtVaSetValues(button, XtNmenuName, menuName, NULL, 0); - if (drv_opts) { - int len, longest = 0; - char fmt[32]; - static char *types[] = { - "none", "integer", "(non null) string", "string", "real", - "boolean", "frequency", - }; - - for (i = 0; drv_opts[i].name != NULL; i++) { - len = strlen(drv_opts[i].name); - if (len > longest) - longest = len; - } - XmuSnprintf(fmt, sizeof(fmt), "%c-%ds %%s", '%', longest); - for (; drv_opts->name != NULL; drv_opts++) { - char *type; - - if (drv_opts->type >= OPTV_NONE && drv_opts->type <= OPTV_FREQ) - type = types[drv_opts->type]; - else - type = "UNKNOWN"; - - XmuSnprintf(buf, sizeof(buf), fmt, drv_opts->name, type); - sme = XtVaCreateManagedWidget(drv_opts->name, smeBSBObjectClass, - menu, XtNlabel, buf, NULL, 0); - XtAddCallback(sme, XtNcallback, AddDriverOption, (XtPointer)drv_opts); - } - } - if (i) { - XmuSnprintf(buf, sizeof(buf), "%s%s", label, driver); - XtSetArg(args[0], XtNlabel, buf); - XtSetValues(button, args, 1); - XtMapWidget(button); + if (!nomodules) { + if (menu) + XtDestroyWidget(menu); + XmuSnprintf(menuName, sizeof(buf), "optionM%d", menuN); + menuN = !menuN; + menu = XtCreatePopupShell(menuName, simpleMenuWidgetClass, button, + NULL, 0); + XtVaSetValues(button, XtNmenuName, menuName, NULL, 0); + if (drv_opts) { + int len, longest = 0; + char fmt[32]; + + for (i = 0; drv_opts[i].name != NULL; i++) { + len = strlen(drv_opts[i].name); + if (len > longest) + longest = len; + } + XmuSnprintf(fmt, sizeof(fmt), "%c-%ds %%s", '%', longest); + for (; drv_opts->name != NULL; drv_opts++) { + char *type; + + if (drv_opts->type >= OPTV_NONE && drv_opts->type <= OPTV_FREQ) + type = types[drv_opts->type]; + else + type = "UNKNOWN"; + + XmuSnprintf(buf, sizeof(buf), fmt, drv_opts->name, type); + sme = XtVaCreateManagedWidget(drv_opts->name, smeBSBObjectClass, + menu, XtNlabel, buf, NULL, 0); + XtAddCallback(sme, XtNcallback, AddDriverOption, (XtPointer)drv_opts); + } + } + if (i) { + xf86cfgModuleOptions *mod = module_options; + + while (mod) { + if (strcmp(mod->name, driver) == 0) { + /* don't assign to driver, as it may be a temp string */ + module_sel = mod->name; + break; + } + mod = mod->next; + } + XmuSnprintf(buf, sizeof(buf), "%s%s", label, driver); + XtSetArg(args[0], XtNlabel, buf); + XtSetValues(button, args, 1); + XtMapWidget(button); + } + else + XtUnmapWidget(button); } - else - XtUnmapWidget(button); #endif UpdateOptionList(); @@ -334,6 +499,7 @@ OptionInfoPtr opt = (OptionInfoPtr)user_data; XF86OptionPtr option; + option_str = (char *)opt->name; XtSetArg(args[0], XtNstring, opt->name); XtSetValues(name, args, 1); if ((option = xf86findOption(*options, opt->name)) == NULL) @@ -342,6 +508,90 @@ XtSetArg(args[0], XtNstring, option->opt_val); XtSetValues(value, args, 1); } + +/*ARGSUSED*/ +static void +SelectModuleCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + xf86cfgModuleOptions *mod = module_options; + XawListReturnStruct *info = (XawListReturnStruct *)call_data; + + while (mod) { + if (strcmp(mod->name, info->string) == 0) + break; + mod = mod->next; + } + + if (mod) { + Arg args[2]; + char **list = NULL, **old; + OptionInfoPtr opts = mod->option; + int num = 0, oldnum; + + module_sel = mod->name; + XtSetArg(args[0], XtNlist, &old); + XtSetArg(args[1], XtNnumberStrings, &oldnum); + XtGetValues(optList, args, 2); + while (opts && opts->name) { + ++num; + list = (char**)XtRealloc((XtPointer)list, sizeof(char*) * num); + list[num - 1] = XtNewString(opts->name); + ++opts; + } + if (num == 0) { + list = (char**)XtMalloc(sizeof(char*)); + list[0] = XtNewString(""); + num = 1; + } + XtSetArg(args[0], XtNlist, list); + XtSetArg(args[1], XtNnumberStrings, num); + XtSetValues(optList, args, 2); + while (--oldnum >= 0) + XtFree(old[oldnum]); + XtFree((XtPointer)old); + + XtVaSetValues(desc, XtNstring, "", NULL); + XawListUnhighlight(optList); + } +} + +static void +SelectModuleOptionCallback(Widget w, XtPointer user_data, XtPointer call_data) +{ + xf86cfgModuleOptions *mod = module_options; + XawListReturnStruct *info = (XawListReturnStruct *)call_data; + char *description = NULL, *type = "undefined"; + char label[256]; + + if (module_sel && info->string) + description = GetOptionDescription(module_sel, info->string); + if (description == NULL) + description = "** NO DESCRIPTION AVAILABLE **"; + + XtVaSetValues(desc, XtNstring, description, NULL); + + while (mod) { + if (strcmp(module_sel, mod->name) == 0) + break; + mod = mod->next; + } + if (mod) { + OptionInfoPtr opts = mod->option; + + while (opts && opts->name) { + if (strcmp(info->string, opts->name) == 0) + break; + ++opts; + } + if (opts && opts->name && opts->type >= OPTV_NONE && + opts->type <= OPTV_FREQ) + type = types[opts->type]; + } + + XmuSnprintf(label, sizeof(label), "%s.%s (%s)", module_sel, info->string, + type); + XtVaSetValues(labelType, XtNlabel, label, NULL); +} #endif /*ARGSUSED*/ @@ -392,4 +642,28 @@ XtSetSensitive(remov, True); XtSetSensitive(update, True); +} + +char * +GetOptionDescription(char *module, char *option) +{ + static int first = 1; + char *type; + XrmValue value; + char query[256]; + + if (first) { + first = 0; + XrmInitialize(); + if ((xrm = XrmGetFileDatabase(Options)) == (XrmDatabase)0) { + fprintf(stderr, "Cannot open '%s' database.\n", Options); + return (NULL); + } + } + + XmuSnprintf(query, sizeof(query), "%s.%s", module, option); + if (XrmGetResource(xrm, query, "Module.Option", &type, &value)) + return ((char*)value.addr); + + return (NULL); } Index: xc/programs/Xserver/hw/xfree86/xf86cfg/options.h diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/options.h:1.3 xc/programs/Xserver/hw/xfree86/xf86cfg/options.h:1.4.2.1 --- xc/programs/Xserver/hw/xfree86/xf86cfg/options.h:1.3 Fri Oct 20 10:59:07 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/options.h Fri May 25 17:45:01 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.h,v 1.3 2000/10/20 14:59:07 alanh Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/options.h,v 1.4.2.1 2001/05/25 21:45:01 paulo Exp $ */ #include "config.h" @@ -39,7 +39,12 @@ */ #ifdef USE_MODULES void OptionsPopup(XF86OptionPtr*, char*, OptionInfoPtr); +void ModuleOptionsPopup(Widget, XtPointer, XtPointer); #else void OptionsPopup(XF86OptionPtr*); #endif void OptionsCancelAction(Widget, XEvent*, String*, Cardinal*); +void ModuleOptionsCancelAction(Widget, XEvent*, String*, Cardinal*); +char *GetOptionDescription(char *module, char *option); + +void CreateOptionsShell(void); \ No newline at end of file Index: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c:1.6 xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c:1.8.2.1 --- xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c:1.6 Fri Dec 8 16:51:06 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c Mon May 21 18:24:02 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.6 2000/12/08 21:51:06 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen-cfg.c,v 1.8.2.1 2001/05/21 22:24:02 paulo Exp $ */ #include "xf86config.h" @@ -367,7 +367,7 @@ MoveCallback(Widget w, XtPointer user_data, XtPointer call_data) { char *tmp; - Bool down = (Bool)user_data; + Bool down = (long)user_data; if (unsel_index < 0 || unsel_index >= ndefmodes) return; @@ -406,7 +406,7 @@ XF86ConfModeLinePtr mline = mon != NULL ? mon->mon_modeline_lst : NULL; int i; #ifdef USE_MODULES - xf86cfgDriverOptions *drv_opts = video_driver_info; + xf86cfgModuleOptions *drv_opts = module_options; Bool foundRotate = False; #endif @@ -486,31 +486,34 @@ } #ifdef USE_MODULES - while (drv_opts) { - if (strcmp(drv_opts->name, screen->scrn_device->dev_driver) == 0) { - OptionInfoPtr opts = drv_opts->option; - - while (opts->name) { - if (xf86nameCompare(opts->name, "Rotate") == 0) { - foundRotate = True; - break; + if (!nomodules) { + while (drv_opts) { + if (drv_opts->type == VideoModule && + strcmp(drv_opts->name, screen->scrn_device->dev_driver) == 0) { + OptionInfoPtr opts = drv_opts->option; + + while (opts->name) { + if (xf86nameCompare(opts->name, "Rotate") == 0) { + foundRotate = True; + break; + } + opts++; } - opts++; + break; } - break; + drv_opts = drv_opts->next; } - drv_opts = drv_opts->next; - } - if (!foundRotate) { - XtUnmapWidget(labelRotate); - XtUnmapWidget(cw); - XtUnmapWidget(ccw); - } - else { - XtMapWidget(labelRotate); - XtMapWidget(cw); - XtMapWidget(ccw); + if (!foundRotate) { + XtUnmapWidget(labelRotate); + XtUnmapWidget(cw); + XtUnmapWidget(ccw); + } + else { + XtMapWidget(labelRotate); + XtMapWidget(cw); + XtMapWidget(ccw); + } } #endif if (rotate == CW) { Index: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c:1.5 xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c:1.6 --- xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c:1.5 Fri Dec 1 13:31:07 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c Fri Mar 23 20:17:21 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.5 2000/12/01 18:31:07 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/screen.c,v 1.6 2001/03/24 01:17:21 paulo Exp $ */ #include <X11/IntrinsicP.h> @@ -194,9 +194,9 @@ screen = (XF86ConfScreenPtr)(screen->list.next); } do { - ++nscreens; XmuSnprintf(screen_name, sizeof(screen_name), "Screen%d", nscreens); + ++nscreens; } while (xf86findScreen(screen_name, XF86Config->conf_screen_lst) != NULL); Index: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c:1.7 xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c:1.10.2.1 --- xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c:1.7 Wed Dec 13 07:58:20 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c Mon May 21 18:24:02 2001 @@ -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.7 2000/12/13 12:58:20 tsi Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/text-mode.c,v 1.10.2.1 2001/05/21 22:24:02 paulo Exp $ */ #include <stdio.h> @@ -43,6 +43,10 @@ #define XKB_RULES_DIR "/usr/X11R6/lib/X11/xkb/rules" +#define CONTROL_A 1 +#define CONTROL_D 4 +#define CONTROL_E 5 +#define CONTROL_K 11 #define TAB 9 #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define MAX(a, b) ((a) > (b) ? (a) : (b)) @@ -334,6 +338,9 @@ "MouseSystems", "SysMouse", "ThinkingMouse", +#ifdef WSCONS_SUPPORT + "wsmouse", +#endif }; static int @@ -492,7 +499,11 @@ if (option) str = option->opt_val; if (str == NULL) +#ifdef WSCONS_SUPPORT + str = "/dev/wsmouse"; +#else str = "/dev/mouse"; +#endif ClearScreen(); refresh(); @@ -794,6 +805,7 @@ int nlist, def; char hsync_str[256], vrefresh_str[256]; + hsync_str[0] = vrefresh_str[0] = '\0'; nlist = 0; while (monitor) { list = (char**)XtRealloc((XtPointer)list, (nlist + 1) * sizeof(char*)); @@ -925,7 +937,7 @@ } } } - else + if (hsync_str[0] == '\0') strcpy(hsync_str, "31.5"); ClearScreen(); @@ -983,7 +995,7 @@ } } } - else + if (vrefresh_str[0] == '\0') strcpy(vrefresh_str, "50 - 70"); ClearScreen(); refresh(); @@ -1043,31 +1055,16 @@ char **list = NULL, *identifier = NULL, *driver, *busid, *tmp; int nlist, def; CardsEntry *entry = NULL; -#ifdef USE_MODULES static char **drivers; static int ndrivers; +#ifdef USE_MODULES static char *path = NULL, *modules = "lib/modules"; const char *subdirs[] = { "drivers", NULL }; - - if (XF86Module_path == NULL) { - XF86Module_path = XtMalloc(strlen(XFree86Dir) + strlen(modules) + 2); - sprintf(XF86Module_path, "%s/%s", XFree86Dir, modules); - } - - if (drivers == NULL) { - xf86Verbose = 0; - LoaderInit(); - path = XtNewString(XF86Module_path); - LoaderSetPath(path); - drivers = LoaderListDirs((char**)subdirs, NULL); - for (; drivers[ndrivers]; ndrivers++) - ; - } -#else - static char *drivers[] = { +#endif + static char *xdrivers[] = { "apm", "ark", "ati", @@ -1095,8 +1092,30 @@ "vga", "vesa", }; - static int ndrivers = sizeof(drivers) / sizeof(drivers[0]); + +#ifdef USE_MODULES + if (!nomodules) { + if (XF86Module_path == NULL) { + XF86Module_path = XtMalloc(strlen(XFree86Dir) + strlen(modules) + 2); + sprintf(XF86Module_path, "%s/%s", XFree86Dir, modules); + } + + if (drivers == NULL) { + xf86Verbose = 0; + LoaderInit(); + path = XtNewString(XF86Module_path); + LoaderSetPath(path); + drivers = LoaderListDirs((char**)subdirs, NULL); + for (; drivers[ndrivers]; ndrivers++) + ; + } + } + else #endif + { + ndrivers = sizeof(xdrivers) / sizeof(xdrivers[0]); + drivers = xdrivers; + } nlist = 0; while (device) { @@ -1648,7 +1667,7 @@ XtFree((XtPointer)list); if (disp_allocated) { - display->list.next = screen->scrn_display_lst; + display->list.next = NULL; if (screen->scrn_display_lst == NULL) screen->scrn_display_lst = display; else @@ -1674,7 +1693,7 @@ adj->adj_scrnum = ptr->adj_scrnum; adj->adj_screen = ptr->adj_screen; - adj->adj_screen_str = XtNewString(adj->adj_screen_str); + adj->adj_screen_str = XtNewString(ptr->adj_screen_str); adj->adj_top = ptr->adj_top; if (ptr->adj_top_str) adj->adj_top_str = XtNewString(ptr->adj_top_str); @@ -2148,7 +2167,7 @@ ClearScreen(); refresh(); Dialog("Layout configuration", - (nmouses > 1 && nkeyboards > 1) ? + (nmouses > 1 || nkeyboards > 1) ? "As you have only one screen configured, I can now finish " "creating this Layout configuration." : @@ -3117,17 +3136,19 @@ } continue; case KEY_RIGHT: - if (input_x == box_width - 1) { - ++scroll; - wmove(dialog, box_y, box_x); - for (i = scroll; i < scroll + box_width; i++) - waddch(dialog, instr[scroll + i] ? instr[scroll + i] : ' '); - wmove(dialog, box_y, input_x + box_x); - wrefresh(dialog); - } - else if (input_x + scroll < len) { - wmove(dialog, box_y, ++input_x + box_x); - wrefresh(dialog); + if (input_x + scroll < len) { + if (input_x == box_width - 1) { + ++scroll; + wmove(dialog, box_y, box_x); + for (i = scroll; i < scroll + box_width; i++) + waddch(dialog, instr[i] ? instr[i] : ' '); + wmove(dialog, box_y, input_x + box_x); + wrefresh(dialog); + } + else { + wmove(dialog, box_y, ++input_x + box_x); + wrefresh(dialog); + } } continue; case KEY_BACKSPACE: @@ -3153,12 +3174,68 @@ for (i = scroll + input_x; i < len && i < scroll + box_width; i++) waddch(dialog, instr[i]); - waddch(dialog, ' '); + if (i < scroll + box_width) + waddch(dialog, ' '); } wmove(dialog, box_y, input_x + box_x); wrefresh(dialog); } continue; + case KEY_HOME: + case CONTROL_A: + wmove(dialog, box_y, box_x); + if (scroll != 0) { + scroll = 0; + for (i = 0; i < box_width; i++) + waddch(dialog, instr[i] ? instr[i] : ' '); + } + input_x = 0; + wmove(dialog, box_y, box_x); + wrefresh(dialog); + break; + case CONTROL_D: + if (input_x + scroll < len) { + memmove(instr + scroll + input_x, + instr + scroll + input_x + 1, + len - (scroll + input_x)); + instr[--len] = '\0'; + for (i = scroll + input_x; i < len && + i < scroll + box_width; i++) + waddch(dialog, instr[i]); + if (i < scroll + box_width) + waddch(dialog, ' '); + wmove(dialog, box_y, input_x + box_x); + wrefresh(dialog); + } + break; + case CONTROL_E: + case KEY_END: + if (box_width + scroll < len) { + input_x = box_width - 1; + scroll = len - box_width + 1; + wmove(dialog, box_y, box_x); + for (i = scroll; i < scroll + box_width; i++) + waddch(dialog, instr[i] ? instr[i] : ' '); + wmove(dialog, box_y, input_x + box_x); + wrefresh(dialog); + } + else { + input_x = len - scroll; + wmove(dialog, box_y, input_x + box_x); + wrefresh(dialog); + } + break; + case CONTROL_K: + if (len) { + for (i = input_x; i < box_width; i++) + waddch(dialog, ' '); + for (i = scroll + input_x; i < len; i++) + instr[i] = '\0'; + len = scroll + input_x; + wmove(dialog, box_y, box_x + input_x); + wrefresh(dialog); + } + break; default: if (key < 0x100 && isprint(key)) { if (scroll + input_x < sizeof(instr) - 1) { @@ -3246,7 +3323,7 @@ case '\r': case '\n': delwin(dialog); - return (button == -1 ? XtNewString(instr) : NULL); + return (button != 1 ? XtNewString(instr) : NULL); } } } Index: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.cpp diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.cpp:1.1 xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.cpp:removed --- xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.cpp:1.1 Mon Dec 11 15:48:56 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.cpp Mon Jun 4 12:42:05 2001 @@ -1,148 +0,0 @@ -.\" -.\" Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.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 -.\" CONECTIVA LINUX 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 Conectiva Linux shall -.\" not be used in advertising or otherwise to promote the sale, use or other -.\" dealings in this Software without prior written authorization from -.\" Conectiva Linux. -.\" -.\" Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> -.\" -.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.cpp,v 1.1 2000/12/11 20:48:56 dawes Exp $ -.\" -.TH xf86cfg 1 "Version 4.0.2" "XFree86" -.SH NAME -xf86cfg - Graphical configuration tool for XFree86 4.0 -.SH SYNOPSIS -.B xf86cfg -[-xf86config \fIXF86Config\fP] [-modulepath \fImoduledir\fP] -[-fontpath \fIfontsdir\fP] [-toolkitoption ...] -.SH DESCRITPION -.I Xf86cfg -is a tool to configure \fIXFree86 4.0\fP, and can be used to either write the -initial configuration file or make customizations to the current configuration. -.PP -When the \fBDISPLAY\fP environment variable is not set, xf86cfg will run -the command \fIXFree86 -configure\fP to allow the xserver detect the -hardware in the computer, and write an initial \fIXF86Config\fP file -in the user's home directory. Then, it will start XFree86 and allow -customizations. -.br -If the \fBDISPLAY\fP environment variable is set, xf86cfg will read the -default \fIXF86Config\fP, that may not be the same being used by the current -server, and allow customizations. -.PP -To use an alternative location for modules or fonts the respective search -paths may be specified. -.PP -Unless there is an \fBApply\fP button in the current xf86cfg dialog, the -changes made will take place the next time \fIXFree86\fP is started. - -.PP -Xf86cfg allows addition and configuration of new devices, such as video cards, -monitors, keyboards and mouses. -.PP -Screen layout configuration for xinerama or traditional multi-head is also -available. -.PP -Modelines can be configured or optimized. -.PP -AccessX basic configurations can be made in the xf86cfg's accessx section. - -.SH OPTIONS -.TP 8 -.I -xf86config -Specifies an alternate XF86Config file for configuration. -.TP 8 -.I -modulepath -Specifies where xf86cfg, and the server it may start, should look for -XFree86 modules. -.TP 8 -.I -serverpath -Specifies the complete path, not including the binary name, of the -XFree86 binary. -.TP 8 -.I -fontpath -Specifies the path to the fonts that should be used by the server started -by xf86cfg. -.TP 8 -.I -rgbpath -Specifies the path to the rgb.txt file that should be used by the server -started by xf86cfg, if any. -.TP 8 -.I -textmode -If xf86cfg was compiled with support to ncurses, this option makes xf86cfg -enters a text mode interface. - -.SH ENVIRONMENT -.TP 8 -.I DISPLAY -Default host and display number -.TP 8 -.I XWINHOME -Directory where XFree86 was installed, defaults to /usr/X11R6. -.TP 8 -.I XENVIRONMENT -Name of a resource file that overrides the global resources -stored in the RESOURCE_MANAGER property - -.SH FILES -.TP 8 -.I /etc/XF86Config -Server configuration file -.TP 8 -.I /etc/X11/XF86Config -Server configuration file -.TP 8 -.I /usr/X11R6/etc/XF86Config -Server configuration file -.TP 8 -.I <XRoot>/lib/X11/XF86Config.\fIhostname\fP -Server configuration file -.TP 8 -.I <XRoot>/lib/X11/XF86Config -Server configuration file -.TP 8 -.I <XRoot>/lib/X11/app-default/XF86Cfg -Specifies xf86cfg resources -.TP 8 -.I <Xroot>/lib/X11/xkb/X0-config.keyboard -Keyboard specific configuration - -.SH "SEE ALSO" -.IR XFree86 (1) -.IR XF86Config (__filemansuffix__) - -.SH COPYRIGHT -.TP 8 -Copyright 2000, Conectiva Linux S.A. -\fIhttp://www.conectiva.com\fP -.TP 8 -Copyright 2000, The XFree86 Project -\fIhttp://www.XFree86.org\fP - -.SH AUTHORS -.TP 8 -Paulo César Pereira de Andrade \fI<pcpa@conectiva.com.br>\fP -The XFree86 Project - -.SH BUGS -Probably. Index: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man:1.6.2.1 --- /dev/null Mon Jun 4 12:42:05 2001 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man Mon May 21 18:24:02 2001 @@ -0,0 +1,152 @@ +.\" +.\" Copyright (c) 2000 by Conectiva S.A. (http://www.conectiva.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 +.\" CONECTIVA LINUX 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 Conectiva Linux shall +.\" not be used in advertising or otherwise to promote the sale, use or other +.\" dealings in this Software without prior written authorization from +.\" Conectiva Linux. +.\" +.\" Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> +.\" +.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86cfg.man,v 1.6.2.1 2001/05/21 22:24:02 paulo Exp $ +.\" +.TH xf86cfg 1 __vendorversion__ +.SH NAME +xf86cfg - Graphical configuration tool for XFree86 4.0 +.SH SYNOPSIS +.B xf86cfg +[-xf86config \fIXF86Config\fP] [-modulepath \fImoduledir\fP] +[-fontpath \fIfontsdir\fP] [-toolkitoption ...] +.SH DESCRITPION +.I Xf86cfg +is a tool to configure \fIXFree86 4.0\fP, and can be used to either write the +initial configuration file or make customizations to the current configuration. +.PP +When the \fBDISPLAY\fP environment variable is not set, xf86cfg will run +the command \fIXFree86 -configure\fP to allow the xserver detect the +hardware in the computer, and write an initial \fIXF86Config\fP file +in the user's home directory. Then, it will start XFree86 and allow +customizations. +.br +If the \fBDISPLAY\fP environment variable is set, xf86cfg will read the +default \fIXF86Config\fP, that may not be the same being used by the current +server, and allow customizations. +.PP +To use an alternative location for modules or fonts the respective search +paths may be specified. +.PP +Unless there is an \fBApply\fP button in the current xf86cfg dialog, the +changes made will take place the next time \fIXFree86\fP is started. + +.PP +Xf86cfg allows addition and configuration of new devices, such as video cards, +monitors, keyboards and mouses. +.PP +Screen layout configuration for xinerama or traditional multi-head is also +available. +.PP +Modelines can be configured or optimized. +.PP +AccessX basic configurations can be made in the xf86cfg's accessx section. + +.SH OPTIONS +.TP 8 +.I -xf86config +Specifies an alternate XF86Config file for configuration. +.TP 8 +.I -modulepath +Specifies where xf86cfg, and the server it may start, should look for +XFree86 modules. +.TP 8 +.I -serverpath +Specifies the complete path, not including the binary name, of the +XFree86 binary. +.TP 8 +.I -fontpath +Specifies the path to the fonts that should be used by the server started +by xf86cfg. +.TP 8 +.I -rgbpath +Specifies the path to the rgb.txt file that should be used by the server +started by xf86cfg, if any. +.TP 8 +.I -textmode +If xf86cfg was compiled with support to ncurses, this option makes xf86cfg +enters a text mode interface. +.TP 8 +.I -nomodules +When built with support for loading modules, this options changes xf86cfg +behaviour, so that it will not load any modules, and thus start quickier. + +.SH ENVIRONMENT +.TP 8 +.I DISPLAY +Default host and display number +.TP 8 +.I XWINHOME +Directory where XFree86 was installed, defaults to /usr/X11R6. +.TP 8 +.I XENVIRONMENT +Name of a resource file that overrides the global resources +stored in the RESOURCE_MANAGER property + +.SH FILES +.TP 8 +.I /etc/XF86Config +Server configuration file +.TP 8 +.I /etc/X11/XF86Config +Server configuration file +.TP 8 +.I /usr/X11R6/etc/XF86Config +Server configuration file +.TP 8 +.I <XRoot>/lib/X11/XF86Config.\fIhostname\fP +Server configuration file +.TP 8 +.I <XRoot>/lib/X11/XF86Config +Server configuration file +.TP 8 +.I <XRoot>/lib/X11/app-default/XF86Cfg +Specifies xf86cfg resources +.TP 8 +.I <Xroot>/lib/X11/xkb/X0-config.keyboard +Keyboard specific configuration + +.SH "SEE ALSO" +.IR XFree86 (1) +.IR XF86Config (__filemansuffix__) + +.SH COPYRIGHT +.TP 8 +Copyright 2000, Conectiva Linux S.A. +\fIhttp://www.conectiva.com\fP +.TP 8 +Copyright 2000, The XFree86 Project +\fIhttp://www.XFree86.org\fP + +.SH AUTHORS +.TP 8 +Paulo César Pereira de Andrade \fI<pcpa@conectiva.com.br>\fP +The XFree86 Project + +.SH BUGS +Probably. Index: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c diff -u xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c:1.4 xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c:1.5 --- xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c:1.4 Thu Nov 30 15:55:18 2000 +++ xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c Tue Mar 27 15:25:30 2001 @@ -26,7 +26,7 @@ * * Author: Paulo César Pereira de Andrade <pcpa@conectiva.com.br> * - * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c,v 1.4 2000/11/30 20:55:18 paulo Exp $ + * $XFree86: xc/programs/Xserver/hw/xfree86/xf86cfg/xf86config.c,v 1.5 2001/03/27 20:25:30 paulo Exp $ */ #include "xf86config.h" @@ -247,6 +247,8 @@ scrn = (XF86ConfScreenPtr)(scrn->list.next); } + if (scrn == NULL) + return (False); while (lay != NULL) { XF86ConfAdjacencyPtr pad, ad = NULL, adj = lay->lay_adjacency_lst; Index: xc/programs/Xserver/hw/xfree86/xf86config/Cards diff -u xc/programs/Xserver/hw/xfree86/xf86config/Cards:3.75 xc/programs/Xserver/hw/xfree86/xf86config/Cards:3.76 --- xc/programs/Xserver/hw/xfree86/xf86config/Cards:3.75 Tue Dec 12 12:01:40 2000 +++ xc/programs/Xserver/hw/xfree86/xf86config/Cards Sun Apr 1 10:00:16 2001 @@ -18,7 +18,7 @@ # The majority of entries are just a binding of a model name to a # chipset/server and untested. # -# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.75 2000/12/12 17:01:40 dawes Exp $ +# $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Cards,v 3.76 2001/04/01 14:00:16 tsi Exp $ # VGA @@ -1645,7 +1645,7 @@ NAME ATI Rage 128 CHIPSET ati SERVER SVGA -DRIVER r128 +DRIVER ati NAME ATI 8514 Ultra (no VGA) CHIPSET ati Index: xc/programs/Xserver/hw/xfree86/xf86config/Imakefile diff -u xc/programs/Xserver/hw/xfree86/xf86config/Imakefile:3.9 xc/programs/Xserver/hw/xfree86/xf86config/Imakefile:3.13 --- xc/programs/Xserver/hw/xfree86/xf86config/Imakefile:3.9 Mon Dec 11 15:49:01 2000 +++ xc/programs/Xserver/hw/xfree86/xf86config/Imakefile Mon Apr 23 13:15:57 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/Imakefile,v 3.9 2000/12/11 20:49:01 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 @@ 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)) @@ -28,5 +34,4 @@ InstallNonExecFile(Cards,$(LIBDIR)) -CppManTarget(xf86config,) InstallManPage(xf86config,$(MANDIR)) Index: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c diff -u xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c:3.55 xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c:3.57 --- xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c:3.55 Sun Dec 3 14:46:18 2000 +++ xc/programs/Xserver/hw/xfree86/xf86config/xf86config.c Mon Apr 23 13:15:58 2001 @@ -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,19 +147,39 @@ /* 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; int config_chordmiddle; @@ -248,7 +268,7 @@ "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 @@ 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 @@ "MMHitTab", "IntelliMouse", #if defined(__EMX__) || defined(QNX4) - "OSMOUSE" + "OSMOUSE", +#endif +#ifdef WSCONS_SUPPORT + "wsmouse", #endif }; @@ -353,12 +385,18 @@ "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 @@ "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 @@ 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 @@ 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,7 +2524,24 @@ 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 @@ 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 @@ #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 @@ #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 @@ static void -configdir_check() +configdir_check(void) { /* /etc/X11 may not exist on some systems */ #ifndef __EMX__ Index: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.cpp diff -u xc/programs/Xserver/hw/xfree86/xf86config/xf86config.cpp:1.1 xc/programs/Xserver/hw/xfree86/xf86config/xf86config.cpp:removed --- xc/programs/Xserver/hw/xfree86/xf86config/xf86config.cpp:1.1 Mon Dec 11 15:49:07 2000 +++ xc/programs/Xserver/hw/xfree86/xf86config/xf86config.cpp Mon Jun 4 12:42:05 2001 @@ -1,16 +0,0 @@ -.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.cpp,v 1.1 2000/12/11 20:49:07 dawes Exp $ -.TH xf86config 1 "Version 4.0.2" "XFree86" -.SH NAME -xf86config \- generate an XF86Config file -.SH SYNOPSIS -.B xf86config -.SH DESCRIPTION -\fIxf86config\fP is an interactive program for generating an XF86Config file -for use with XFree86 X servers. -.SH FILES -<xroot>/lib/X11/Cards Video cards database -.SH "SEE ALSO" -XFree86(1), XF86Config(__filemansuffix__), reconfig(1) -.SH AUTHOR -Harm Hanemaayer. -.\" $TOG: xf86conf.man /main/9 1997/07/19 10:53:08 kaleb $ Index: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man diff -u /dev/null xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man:1.4 --- /dev/null Mon Jun 4 12:42:05 2001 +++ xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man Sat Jan 27 13:20:59 2001 @@ -0,0 +1,16 @@ +.\" $XFree86: xc/programs/Xserver/hw/xfree86/xf86config/xf86config.man,v 1.4 2001/01/27 18:20:59 dawes Exp $ +.TH xf86config 1 __vendorversion__ +.SH NAME +xf86config \- generate an XF86Config file +.SH SYNOPSIS +.B xf86config +.SH DESCRIPTION +\fIxf86config\fP is an interactive program for generating an XF86Config file +for use with XFree86 X servers. +.SH FILES +<xroot>/lib/X11/Cards Video cards database +.SH "SEE ALSO" +XFree86(1), XF86Config(__filemansuffix__), reconfig(1) +.SH AUTHOR +Harm Hanemaayer. +.\" $TOG: xf86conf.man /main/9 1997/07/19 10:53:08 kaleb $ Index: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c diff -u xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c:1.2.4.1 xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c:1.3 --- xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c:1.2.4.1 Fri Mar 9 13:03:53 2001 +++ xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c Thu Feb 15 14:51:14 2001 @@ -4,7 +4,7 @@ Written by Mark Vojkovich (mvojkovi@ucsd.edu) */ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c,v 1.2.4.1 2001/03/09 18:03:53 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_16bpp/cfbwindow.c,v 1.3 2001/02/15 19:51:14 eich Exp $ */ #include "X.h" #include "scrnintstr.h" Index: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbscrinit.c diff -u xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbscrinit.c:1.9 xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbscrinit.c:1.11 --- xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbscrinit.c:1.9 Thu Mar 2 19:22:47 2000 +++ xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbscrinit.c Sat Apr 14 17:17:49 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/hw/xfree86/xf8_32bpp/cfbscrinit.c,v 1.9 2000/03/03 00:22:47 mvojkovi 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" @@ -152,17 +152,17 @@ cfb8_32CloseScreen (int i, ScreenPtr pScreen) { cfb8_32ScreenPtr pScreenPriv = CFB8_32_GET_SCREEN_PRIVATE(pScreen); - if(pScreenPriv->visualData) xfree(pScreenPriv->visualData); xfree((pointer) pScreenPriv); + pScreen->devPrivates[cfb8_32ScreenPrivateIndex].ptr = NULL; return(cfb32CloseScreen(i, pScreen)); } static void -cfb8_32TransFunction( +cfb8_32TransFunc( ScreenPtr pScreen, int nbox, BoxPtr pbox @@ -172,6 +172,12 @@ } 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 @@ 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; @@ -266,10 +272,8 @@ } overlayVisualsAtom = MakeAtom(atomString, sizeof(atomString) - 1, TRUE); - xf86RegisterRootWindowProperty(pScreen->myNum, overlayVisualsAtom, overlayVisualsAtom, 32, numVisuals * 4, overlayVisuals); - pScreenPriv->visualData = (pointer)overlayVisuals; } Index: xc/programs/Xserver/hw/xnest/Args.c diff -u xc/programs/Xserver/hw/xnest/Args.c:1.1.1.3 xc/programs/Xserver/hw/xnest/Args.c:1.1.1.4 --- xc/programs/Xserver/hw/xnest/Args.c:1.1.1.3 Sat Dec 21 22:35:58 1996 +++ xc/programs/Xserver/hw/xnest/Args.c Tue Jan 16 17:43:42 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Args.c /main/3 1996/08/20 11:31:52 kaleb $ */ +/* $Xorg: Args.c,v 1.3 2000/08/17 19:53:26 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Args.h diff -u xc/programs/Xserver/hw/xnest/Args.h:1.1.1.1 xc/programs/Xserver/hw/xnest/Args.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/Args.h:1.1.1.1 Wed Apr 27 03:15:00 1994 +++ xc/programs/Xserver/hw/xnest/Args.h Tue Jan 16 17:43:42 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Args.h,v 1.1 93/07/12 15:27:56 rws Exp $ */ +/* $Xorg: Args.h,v 1.3 2000/08/17 19:53:27 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Color.c diff -u xc/programs/Xserver/hw/xnest/Color.c:1.2 xc/programs/Xserver/hw/xnest/Color.c:1.3 --- xc/programs/Xserver/hw/xnest/Color.c:1.2 Fri Mar 20 16:08:00 1998 +++ xc/programs/Xserver/hw/xnest/Color.c Wed Jan 17 17:36:54 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Color.c /main/8 1996/12/02 10:20:51 lehors $ */ +/* $Xorg: Color.c,v 1.3 2000/08/17 19:53:27 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Color.h diff -u xc/programs/Xserver/hw/xnest/Color.h:1.1.1.1 xc/programs/Xserver/hw/xnest/Color.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/Color.h:1.1.1.1 Wed Apr 27 03:15:01 1994 +++ xc/programs/Xserver/hw/xnest/Color.h Tue Jan 16 17:43:43 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Color.h,v 1.1 93/07/12 15:28:00 rws Exp $ */ +/* $Xorg: Color.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Cursor.c diff -u xc/programs/Xserver/hw/xnest/Cursor.c:1.1.1.3 xc/programs/Xserver/hw/xnest/Cursor.c:1.1.1.4 --- xc/programs/Xserver/hw/xnest/Cursor.c:1.1.1.3 Sat Dec 21 22:36:01 1996 +++ xc/programs/Xserver/hw/xnest/Cursor.c Tue Jan 16 17:43:42 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Cursor.c /main/5 1996/09/28 17:13:30 rws $ */ +/* $Xorg: Cursor.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Cursor.h diff -u xc/programs/Xserver/hw/xnest/Cursor.h:1.1.1.1 xc/programs/Xserver/hw/xnest/Cursor.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/Cursor.h:1.1.1.1 Wed Apr 27 03:15:01 1994 +++ xc/programs/Xserver/hw/xnest/Cursor.h Tue Jan 16 17:43:43 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Cursor.h,v 1.1 93/07/12 15:28:04 rws Exp $ */ +/* $Xorg: Cursor.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Display.c diff -u xc/programs/Xserver/hw/xnest/Display.c:3.1 xc/programs/Xserver/hw/xnest/Display.c:3.2 --- xc/programs/Xserver/hw/xnest/Display.c:3.1 Mon Dec 23 02:09:11 1996 +++ xc/programs/Xserver/hw/xnest/Display.c Wed Jan 17 17:36:55 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: Display.c /main/4 1996/08/20 11:31:58 kaleb $ */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Display.c,v 3.1 1996/12/23 07:09:11 dawes Exp $ */ +/* $Xorg: Display.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic @@ -13,6 +12,7 @@ is" without express or implied warranty. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Display.c,v 3.2 2001/01/17 22:36:55 dawes Exp $ */ #include "X.h" Index: xc/programs/Xserver/hw/xnest/Display.h diff -u xc/programs/Xserver/hw/xnest/Display.h:1.5 xc/programs/Xserver/hw/xnest/Display.h:1.6 --- xc/programs/Xserver/hw/xnest/Display.h:1.5 Tue Aug 1 16:05:43 2000 +++ xc/programs/Xserver/hw/xnest/Display.h Wed Jan 17 17:36:55 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Display.h,v 1.2 94/02/06 17:51:43 rws Exp $ */ +/* $Xorg: Display.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic @@ -12,7 +12,7 @@ is" without express or implied warranty. */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Display.h,v 1.5 2000/08/01 20:05:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Display.h,v 1.6 2001/01/17 22:36:55 dawes Exp $ */ #ifndef XNESTCOMMON_H #define XNESTCOMMON_H Index: xc/programs/Xserver/hw/xnest/Drawable.h diff -u xc/programs/Xserver/hw/xnest/Drawable.h:1.1.1.2 xc/programs/Xserver/hw/xnest/Drawable.h:1.1.1.3 --- xc/programs/Xserver/hw/xnest/Drawable.h:1.1.1.2 Sat Dec 21 22:36:04 1996 +++ xc/programs/Xserver/hw/xnest/Drawable.h Tue Jan 16 17:43:44 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Drawable.h /main/2 1996/12/02 10:20:59 lehors $ */ +/* $Xorg: Drawable.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Events.c diff -u xc/programs/Xserver/hw/xnest/Events.c:1.1.1.3 xc/programs/Xserver/hw/xnest/Events.c:1.1.1.4 --- xc/programs/Xserver/hw/xnest/Events.c:1.1.1.3 Sat Dec 21 22:36:05 1996 +++ xc/programs/Xserver/hw/xnest/Events.c Tue Jan 16 17:43:44 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Events.c /main/6 1996/12/02 10:21:07 lehors $ */ +/* $Xorg: Events.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Events.h diff -u xc/programs/Xserver/hw/xnest/Events.h:1.1.1.1 xc/programs/Xserver/hw/xnest/Events.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/Events.h:1.1.1.1 Wed Apr 27 03:15:03 1994 +++ xc/programs/Xserver/hw/xnest/Events.h Tue Jan 16 17:43:44 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Events.h,v 1.2 93/09/23 18:57:02 rws Exp $ */ +/* $Xorg: Events.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Font.c diff -u xc/programs/Xserver/hw/xnest/Font.c:3.4 xc/programs/Xserver/hw/xnest/Font.c:3.5 --- xc/programs/Xserver/hw/xnest/Font.c:3.4 Fri Dec 27 02:07:48 1996 +++ xc/programs/Xserver/hw/xnest/Font.c Wed Jan 17 17:36:55 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: Font.c /main/4 1996/12/02 10:21:13 lehors $ */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Font.c,v 3.4 1996/12/27 07:07:48 dawes Exp $ */ +/* $Xorg: Font.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic @@ -13,6 +12,8 @@ is" without express or implied warranty. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Font.c,v 3.5 2001/01/17 22:36:55 dawes Exp $ */ + #include "X.h" #include "Xatom.h" #include "Xproto.h" Index: xc/programs/Xserver/hw/xnest/GC.c diff -u xc/programs/Xserver/hw/xnest/GC.c:3.4 xc/programs/Xserver/hw/xnest/GC.c:3.5 --- xc/programs/Xserver/hw/xnest/GC.c:3.4 Sat Sep 25 10:38:20 1999 +++ xc/programs/Xserver/hw/xnest/GC.c Wed Jan 17 17:36:55 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: GC.c /main/8 1996/12/02 10:21:19 lehors $ */ -/* $XFree86: xc/programs/Xserver/hw/xnest/GC.c,v 3.4 1999/09/25 14:38:20 dawes Exp $ */ +/* $Xorg: GC.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic @@ -13,6 +12,8 @@ is" without express or implied warranty. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/GC.c,v 3.5 2001/01/17 22:36:55 dawes Exp $ */ + #include "X.h" #include "Xproto.h" #include "gcstruct.h" Index: xc/programs/Xserver/hw/xnest/GCOps.c diff -u xc/programs/Xserver/hw/xnest/GCOps.c:3.3 xc/programs/Xserver/hw/xnest/GCOps.c:3.4 --- xc/programs/Xserver/hw/xnest/GCOps.c:3.3 Mon Dec 23 02:09:14 1996 +++ xc/programs/Xserver/hw/xnest/GCOps.c Wed Jan 17 17:36:55 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: GCOps.c /main/10 1996/12/02 10:21:24 lehors $ */ -/* $XFree86: xc/programs/Xserver/hw/xnest/GCOps.c,v 3.3 1996/12/23 07:09:14 dawes Exp $ */ +/* $Xorg: GCOps.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic @@ -13,6 +12,8 @@ is" without express or implied warranty. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/GCOps.c,v 3.4 2001/01/17 22:36:55 dawes Exp $ */ + #include "X.h" #include "Xproto.h" #include "miscstruct.h" Index: xc/programs/Xserver/hw/xnest/GCOps.h diff -u xc/programs/Xserver/hw/xnest/GCOps.h:1.1.1.1 xc/programs/Xserver/hw/xnest/GCOps.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/GCOps.h:1.1.1.1 Wed Apr 27 03:15:03 1994 +++ xc/programs/Xserver/hw/xnest/GCOps.h Tue Jan 16 17:43:46 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: GCOps.h,v 1.2 93/09/20 20:18:48 dpw Exp $ */ +/* $Xorg: GCOps.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/GetTime.c diff -u xc/programs/Xserver/hw/xnest/GetTime.c:1.1.1.1 xc/programs/Xserver/hw/xnest/GetTime.c:1.1.1.2 --- xc/programs/Xserver/hw/xnest/GetTime.c:1.1.1.1 Wed Apr 27 03:15:04 1994 +++ xc/programs/Xserver/hw/xnest/GetTime.c Tue Jan 16 17:43:46 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: GetTime.c,v 1.5 94/04/17 20:30:01 dpw Exp $ */ +/* $Xorg: GetTime.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright (c) 1993 X Consortium Index: xc/programs/Xserver/hw/xnest/Handlers.c diff -u xc/programs/Xserver/hw/xnest/Handlers.c:1.1.1.2 xc/programs/Xserver/hw/xnest/Handlers.c:1.1.1.3 --- xc/programs/Xserver/hw/xnest/Handlers.c:1.1.1.2 Wed Jan 3 02:09:37 1996 +++ xc/programs/Xserver/hw/xnest/Handlers.c Tue Jan 16 17:43:46 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Handlers.c,v 1.2 95/07/10 17:42:22 ray Exp $ */ +/* $Xorg: Handlers.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Handlers.h diff -u xc/programs/Xserver/hw/xnest/Handlers.h:1.1.1.1 xc/programs/Xserver/hw/xnest/Handlers.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/Handlers.h:1.1.1.1 Wed Apr 27 03:15:04 1994 +++ xc/programs/Xserver/hw/xnest/Handlers.h Tue Jan 16 17:43:46 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Handlers.h,v 1.1 93/07/12 15:28:31 rws Exp $ */ +/* $Xorg: Handlers.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Imakefile diff -u xc/programs/Xserver/hw/xnest/Imakefile:3.18.2.1 xc/programs/Xserver/hw/xnest/Imakefile:3.21 --- xc/programs/Xserver/hw/xnest/Imakefile:3.18.2.1 Sat Mar 3 19:09:20 2001 +++ xc/programs/Xserver/hw/xnest/Imakefile Fri Apr 20 11:51:21 2001 @@ -1,5 +1,10 @@ -XCOMM $TOG: Imakefile /main/12 1997/11/03 14:13:20 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/hw/xnest/Imakefile,v 3.18.2.1 2001/03/04 00:09:20 tsi Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/Xserver/hw/xnest/Imakefile,v 3.21 2001/04/20 15:51:21 tsi Exp $ + #include <Server.tmpl> #ifdef OS2Architecture @@ -53,6 +58,7 @@ 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 Index: xc/programs/Xserver/hw/xnest/Init.c diff -u xc/programs/Xserver/hw/xnest/Init.c:3.19 xc/programs/Xserver/hw/xnest/Init.c:3.21 --- xc/programs/Xserver/hw/xnest/Init.c:3.19 Mon Nov 27 12:45:56 2000 +++ xc/programs/Xserver/hw/xnest/Init.c Sun Mar 4 12:40:13 2001 @@ -1,4 +1,4 @@ -/* $TOG: Init.c /main/8 1997/11/12 14:38:50 kaleb $ */ +/* $Xorg: Init.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic @@ -12,7 +12,7 @@ is" without express or implied warranty. */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Init.c,v 3.19 2000/11/27 17:45:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Init.c,v 3.21 2001/03/04 17:40:13 herrb Exp $ */ #include "X.h" #include "Xproto.h" @@ -123,6 +123,13 @@ { AbortDDX(); } + +#ifdef __DARWIN__ +void +DarwinHandleGUI(int argc, char *argv[]) +{ +} +#endif void OsVendorInit() { Index: xc/programs/Xserver/hw/xnest/Init.h diff -u xc/programs/Xserver/hw/xnest/Init.h:1.1.1.1 xc/programs/Xserver/hw/xnest/Init.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/Init.h:1.1.1.1 Wed Apr 27 03:15:04 1994 +++ xc/programs/Xserver/hw/xnest/Init.h Tue Jan 16 17:43:48 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Init.h,v 1.1 93/07/12 15:28:35 rws Exp $ */ +/* $Xorg: Init.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Keyboard.c diff -u xc/programs/Xserver/hw/xnest/Keyboard.c:1.3 xc/programs/Xserver/hw/xnest/Keyboard.c:1.6 --- xc/programs/Xserver/hw/xnest/Keyboard.c:1.3 Sat Feb 26 23:52:56 2000 +++ xc/programs/Xserver/hw/xnest/Keyboard.c Sun Mar 25 00:32:15 2001 @@ -1,4 +1,4 @@ -/* $TOG: Keyboard.c /main/5 1998/04/21 09:19:15 msr $ */ +/* $Xorg: Keyboard.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic @@ -12,7 +12,7 @@ is" without express or implied warranty. */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Keyboard.c,v 1.3 2000/02/27 04:52:56 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Keyboard.c,v 1.6 2001/03/25 05:32:15 tsi Exp $ */ #define NEED_EVENTS #include "X.h" @@ -31,6 +31,55 @@ #include "Keyboard.h" #include "Args.h" +#ifdef XKB +#include <X11/extensions/XKB.h> +#include <X11/extensions/XKBsrv.h> +#include <X11/extensions/XKBconfig.h> + +extern Bool XkbQueryExtension( +#if NeedFunctionPrototypes + Display * /* dpy */, + int * /* opcodeReturn */, + int * /* eventBaseReturn */, + int * /* errorBaseReturn */, + int * /* majorRtrn */, + int * /* minorRtrn */ +#endif +); + +extern XkbDescPtr XkbGetKeyboard( +#if NeedFunctionPrototypes + Display * /* dpy */, + unsigned int /* which */, + unsigned int /* deviceSpec */ +#endif +); + +#ifndef XKB_BASE_DIRECTORY +#define XKB_BASE_DIRECTORY "/usr/X11R6/lib/X11/xkb/" +#endif +#ifndef XKB_CONFIG_FILE +#define XKB_CONFIG_FILE "X0-config.keyboard" +#endif +#ifndef XKB_DFLT_RULES_FILE +#define XKB_DFLT_RULES_FILE "xfree86" +#endif +#ifndef XKB_DFLT_KB_LAYOUT +#define XKB_DFLT_KB_LAYOUT "us" +#endif +#ifndef XKB_DFLT_KB_MODEL +#define XKB_DFLT_KB_MODEL "pc101" +#endif +#ifndef XKB_DFLT_KB_VARIANT +#define XKB_DFLT_KB_VARIANT NULL +#endif +#ifndef XKB_DFLT_KB_OPTIONS +#define XKB_DFLT_KB_OPTIONS NULL +#endif + +extern Bool noXkbExtension; +#endif + void xnestBell(volume, pDev, ctrl, cls) int volume; DeviceIntPtr pDev; @@ -44,6 +93,7 @@ DeviceIntPtr pDev; KeybdCtrl *ctrl; { +#if 0 unsigned long value_mask; XKeyboardControl values; int i; @@ -75,6 +125,7 @@ values.led_mode = (ctrl->leds & (1 << (i - 1))) ? LedModeOn : LedModeOff; XChangeKeyboardControl(xnestDisplay, value_mask, &values); } +#endif } int xnestKeyboardProc(pDev, onoff, argc, argv) @@ -134,6 +185,10 @@ keySyms.mapWidth = mapWidth; keySyms.map = keymap; +#ifdef XKB + if (noXkbExtension) { +XkbError: +#endif XGetKeyboardControl(xnestDisplay, &values); memmove((char *) defaultKeyboardControl.autoRepeats, @@ -141,6 +196,68 @@ InitKeyboardDeviceStruct(pDev, &keySyms, modmap, xnestBell, xnestChangeKeyboardControl); +#ifdef XKB + } else { + FILE *file; + XkbConfigRtrnRec config; + + XkbComponentNamesRec names; + char *rules, *model, *layout, *variants, *options; + + XkbDescPtr xkb; + int op, event, error, major, minor; + + if (XkbQueryExtension(xnestDisplay, &op, &event, &error, &major, &minor) == 0) { + ErrorF("Unable to initialize XKEYBOARD extension.\n"); + goto XkbError; + } + xkb = XkbGetKeyboard(xnestDisplay, XkbGBN_AllComponentsMask, XkbUseCoreKbd); + if (xkb == NULL || xkb->geom == NULL) { + ErrorF("Couldn't get keyboard.\n"); + goto XkbError; + } + XkbGetControls(xnestDisplay, XkbAllControlsMask, xkb); + + memset(&names, 0, sizeof(XkbComponentNamesRec)); + rules = XKB_DFLT_RULES_FILE; + model = XKB_DFLT_KB_MODEL; + layout = XKB_DFLT_KB_LAYOUT; + variants = XKB_DFLT_KB_VARIANT; + options = XKB_DFLT_KB_OPTIONS; + if (XkbInitialMap) { + if ((names.keymap = strchr(XkbInitialMap, '/')) != NULL) + ++names.keymap; + else + names.keymap = XkbInitialMap; + } + + if ((file = fopen(XKB_BASE_DIRECTORY XKB_CONFIG_FILE, "r")) != NULL) { + if (XkbCFParse(file, XkbCFDflts, xkb, &config) == 0) { + ErrorF("Error parsing config file.\n"); + fclose(file); + goto XkbError; + } + if (config.rules_file) + rules = config.rules_file; + if (config.model) + model = config.model; + if (config.layout) + layout = config.layout; + if (config.variant) + variants = config.variant; + if (config.options) + options = config.options; + + fclose(file); + } + + XkbSetRulesDflts(rules, model, layout, variants, options); + XkbInitKeyboardDeviceStruct((pointer)pDev, &names, &keySyms, modmap, + xnestBell, xnestChangeKeyboardControl); + XkbDDXChangeControls((pointer)pDev, xkb->ctrls, xkb->ctrls); + XkbFreeKeyboard(xkb, 0, False); + } +#endif #ifdef _XSERVER64 xfree(keymap); #else Index: xc/programs/Xserver/hw/xnest/Keyboard.h diff -u xc/programs/Xserver/hw/xnest/Keyboard.h:1.1.1.1 xc/programs/Xserver/hw/xnest/Keyboard.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/Keyboard.h:1.1.1.1 Wed Apr 27 03:15:05 1994 +++ xc/programs/Xserver/hw/xnest/Keyboard.h Tue Jan 16 17:43:48 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Keyboard.h,v 1.1 93/07/12 15:28:38 rws Exp $ */ +/* $Xorg: Keyboard.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Pixmap.c diff -u xc/programs/Xserver/hw/xnest/Pixmap.c:3.1 xc/programs/Xserver/hw/xnest/Pixmap.c:3.2 --- xc/programs/Xserver/hw/xnest/Pixmap.c:3.1 Fri Dec 27 02:07:49 1996 +++ xc/programs/Xserver/hw/xnest/Pixmap.c Wed Jan 17 17:36:55 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Pixmap.c,v 1.3 95/07/10 17:42:22 ray Exp $ */ +/* $Xorg: Pixmap.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Pixmap.h diff -u xc/programs/Xserver/hw/xnest/Pixmap.h:1.1.1.1 xc/programs/Xserver/hw/xnest/Pixmap.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/Pixmap.h:1.1.1.1 Wed Apr 27 03:15:05 1994 +++ xc/programs/Xserver/hw/xnest/Pixmap.h Tue Jan 16 17:43:49 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Pixmap.h,v 1.1 93/07/12 15:28:41 rws Exp $ */ +/* $Xorg: Pixmap.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Pointer.c diff -u xc/programs/Xserver/hw/xnest/Pointer.c:1.1.1.3 xc/programs/Xserver/hw/xnest/Pointer.c:1.1.1.4 --- xc/programs/Xserver/hw/xnest/Pointer.c:1.1.1.3 Sat Dec 21 22:36:16 1996 +++ xc/programs/Xserver/hw/xnest/Pointer.c Tue Jan 16 17:43:49 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Pointer.c /main/3 1996/09/28 17:13:56 rws $ */ +/* $Xorg: Pointer.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Pointer.h diff -u xc/programs/Xserver/hw/xnest/Pointer.h:1.1.1.1 xc/programs/Xserver/hw/xnest/Pointer.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/Pointer.h:1.1.1.1 Wed Apr 27 03:15:05 1994 +++ xc/programs/Xserver/hw/xnest/Pointer.h Tue Jan 16 17:43:49 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Pointer.h,v 1.1 93/07/12 15:28:44 rws Exp $ */ +/* $Xorg: Pointer.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Screen.c diff -u xc/programs/Xserver/hw/xnest/Screen.c:3.7 xc/programs/Xserver/hw/xnest/Screen.c:3.9 --- xc/programs/Xserver/hw/xnest/Screen.c:3.7 Sun Dec 20 06:57:54 1998 +++ xc/programs/Xserver/hw/xnest/Screen.c Thu Mar 22 20:27:09 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: Screen.c /main/8 1996/12/02 10:21:46 lehors $ */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Screen.c,v 3.7 1998/12/20 11:57:54 dawes Exp $ */ +/* $Xorg: Screen.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic @@ -13,6 +12,8 @@ is" without express or implied warranty. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Screen.c,v 3.9 2001/03/23 01:27:09 paulo Exp $ */ + #include "X.h" #include "Xproto.h" #include "scrnintstr.h" @@ -36,6 +37,7 @@ #include "Visual.h" #include "Events.h" #include "Init.h" +#include "mipointer.h" #include "Args.h" extern Window xnestParentWindow; @@ -99,6 +101,28 @@ } } +static Bool +xnestCursorOffScreen (ppScreen, x, y) + ScreenPtr *ppScreen; + int *x, *y; +{ + return FALSE; +} + +static void +xnestCrossScreen (pScreen, entering) + ScreenPtr pScreen; + Bool entering; +{ +} + +static miPointerScreenFuncRec xnestPointerCursorFuncs = +{ + xnestCursorOffScreen, + xnestCrossScreen, + miPointerWarpCursor +}; + Bool xnestOpenScreen(index, pScreen, argc, argv) int index; register ScreenPtr pScreen; @@ -182,6 +206,8 @@ numVisuals, visuals); miInitializeBackingStore(pScreen); + + miDCInitialize(pScreen, &xnestPointerCursorFuncs); pScreen->mmWidth = xnestWidth * DisplayWidthMM(xnestDisplay, DefaultScreen(xnestDisplay)) / Index: xc/programs/Xserver/hw/xnest/Screen.h diff -u xc/programs/Xserver/hw/xnest/Screen.h:1.1.1.1 xc/programs/Xserver/hw/xnest/Screen.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/Screen.h:1.1.1.1 Wed Apr 27 03:15:06 1994 +++ xc/programs/Xserver/hw/xnest/Screen.h Tue Jan 16 17:43:51 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Screen.h,v 1.1 93/07/12 15:28:49 rws Exp $ */ +/* $Xorg: Screen.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/TestExt.c diff -u xc/programs/Xserver/hw/xnest/TestExt.c:3.2 xc/programs/Xserver/hw/xnest/TestExt.c:3.3 --- xc/programs/Xserver/hw/xnest/TestExt.c:3.2 Sun Jan 7 05:46:49 1996 +++ xc/programs/Xserver/hw/xnest/TestExt.c Wed Jan 17 17:36:55 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: TestExt.c,v 1.3 94/10/28 20:47:10 dpw Exp $ */ -/* $XFree86: xc/programs/Xserver/hw/xnest/TestExt.c,v 3.2 1996/01/07 10:46:49 dawes Exp $ */ +/* $Xorg: TestExt.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic @@ -13,6 +12,8 @@ is" without express or implied warranty. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/TestExt.c,v 3.3 2001/01/17 22:36:55 dawes Exp $ */ + #include "X.h" #include "Xproto.h" #include "Xlib.h" Index: xc/programs/Xserver/hw/xnest/Visual.c diff -u xc/programs/Xserver/hw/xnest/Visual.c:1.1.1.2 xc/programs/Xserver/hw/xnest/Visual.c:1.1.1.3 --- xc/programs/Xserver/hw/xnest/Visual.c:1.1.1.2 Wed Jan 3 02:09:49 1996 +++ xc/programs/Xserver/hw/xnest/Visual.c Tue Jan 16 17:43:52 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Visual.c,v 1.2 95/07/10 17:42:22 ray Exp $ */ +/* $Xorg: Visual.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Visual.h diff -u xc/programs/Xserver/hw/xnest/Visual.h:1.1.1.1 xc/programs/Xserver/hw/xnest/Visual.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/Visual.h:1.1.1.1 Wed Apr 27 03:15:06 1994 +++ xc/programs/Xserver/hw/xnest/Visual.h Tue Jan 16 17:43:52 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Visual.h,v 1.1 93/07/12 15:28:54 rws Exp $ */ +/* $Xorg: Visual.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Window.c diff -u xc/programs/Xserver/hw/xnest/Window.c:3.4 xc/programs/Xserver/hw/xnest/Window.c:3.5 --- xc/programs/Xserver/hw/xnest/Window.c:3.4 Fri Dec 27 02:07:53 1996 +++ xc/programs/Xserver/hw/xnest/Window.c Wed Jan 17 17:36:55 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: Window.c /main/8 1996/12/02 10:21:53 lehors $ */ -/* $XFree86: xc/programs/Xserver/hw/xnest/Window.c,v 3.4 1996/12/27 07:07:53 dawes Exp $ */ +/* $Xorg: Window.c,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic @@ -13,6 +12,8 @@ is" without express or implied warranty. */ +/* $XFree86: xc/programs/Xserver/hw/xnest/Window.c,v 3.5 2001/01/17 22:36:55 dawes Exp $ */ + #include "X.h" #include "Xproto.h" #include "gcstruct.h" Index: xc/programs/Xserver/hw/xnest/XNFont.h diff -u xc/programs/Xserver/hw/xnest/XNFont.h:1.1.1.1 xc/programs/Xserver/hw/xnest/XNFont.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/XNFont.h:1.1.1.1 Sat Dec 21 22:36:22 1996 +++ xc/programs/Xserver/hw/xnest/XNFont.h Tue Jan 16 17:43:54 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Font.h,v 1.1 93/07/12 15:28:20 rws Exp $ */ +/* $Xorg: XNFont.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/XNGC.h diff -u xc/programs/Xserver/hw/xnest/XNGC.h:1.1.1.1 xc/programs/Xserver/hw/xnest/XNGC.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/XNGC.h:1.1.1.1 Sat Dec 21 22:36:07 1996 +++ xc/programs/Xserver/hw/xnest/XNGC.h Tue Jan 16 17:43:54 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: GC.h,v 1.1 93/07/12 15:28:24 rws Exp $ */ +/* $Xorg: XNGC.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/XNWindow.h diff -u xc/programs/Xserver/hw/xnest/XNWindow.h:1.1.1.1 xc/programs/Xserver/hw/xnest/XNWindow.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/XNWindow.h:1.1.1.1 Sat Dec 21 22:36:22 1996 +++ xc/programs/Xserver/hw/xnest/XNWindow.h Tue Jan 16 17:43:54 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Window.h,v 1.1 93/07/12 15:28:58 rws Exp $ */ +/* $Xorg: XNWindow.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright 1993 by Davor Matic Index: xc/programs/Xserver/hw/xnest/Xnest.h diff -u xc/programs/Xserver/hw/xnest/Xnest.h:1.1.1.1 xc/programs/Xserver/hw/xnest/Xnest.h:1.1.1.2 --- xc/programs/Xserver/hw/xnest/Xnest.h:1.1.1.1 Wed Jan 3 02:09:54 1996 +++ xc/programs/Xserver/hw/xnest/Xnest.h Tue Jan 16 17:43:54 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: Xnest.h,v 1.1 95/07/10 17:43:42 ray Exp $ */ +/* $Xorg: Xnest.h,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ */ /* Copyright (c) 1995 X Consortium Index: xc/programs/Xserver/hw/xnest/Xnest.man diff -u xc/programs/Xserver/hw/xnest/Xnest.man:1.4 xc/programs/Xserver/hw/xnest/Xnest.man:1.6 --- xc/programs/Xserver/hw/xnest/Xnest.man:1.4 Sun Oct 4 05:38:53 1998 +++ xc/programs/Xserver/hw/xnest/Xnest.man Sat Jan 27 13:21:00 2001 @@ -1,4 +1,4 @@ -.\" $TOG: Xnest.man /main/7 1997/11/04 21:21:03 kaleb $ +.\" $Xorg: Xnest.man,v 1.3 2000/08/17 19:53:28 cpqbld Exp $ .\" Copyright (c) 1993, 1994 X Consortium .\" .\" Permission is hereby granted, free of charge, to any person obtaining @@ -24,7 +24,10 @@ .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from the X Consortium. -.TH XNEST 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/Xserver/hw/xnest/Xnest.man,v 1.6 2001/01/27 18:21:00 dawes Exp $ +.\" +.TH XNEST 1 __xorgversion__ .SH NAME Xnest \- a nested X server .SH SYNOPSIS Index: xc/programs/Xserver/hw/xwin/Imakefile diff -u xc/programs/Xserver/hw/xwin/Imakefile:1.3 xc/programs/Xserver/hw/xwin/Imakefile:1.6 --- xc/programs/Xserver/hw/xwin/Imakefile:1.3 Tue Nov 28 11:10:40 2000 +++ xc/programs/Xserver/hw/xwin/Imakefile Wed Apr 25 15:44:02 2001 @@ -1,55 +1,87 @@ XCOMM $XConsortium: Imakefile /main/10 1996/12/02 10:20:33 lehors $ -XCOMM $XFree86: xc/programs/Xserver/hw/xwin/Imakefile,v 1.3 2000/11/28 16:10:40 dawes Exp $ +XCOMM $XFree86: xc/programs/Xserver/hw/xwin/Imakefile,v 1.6 2001/04/25 19:44:02 tsi Exp $ + #include <Server.tmpl> #if HasShm SHMDEF = -DHAS_SHM #endif -XCOMM add more architectures here as we discover them -#if defined(HPArchitecture) || (defined(SparcArchitecture) && !defined(LynxOSArchitecture)) || SystemV4 || defined(OSF1Architecture) || defined(cygwinArchitecture) || defined(i386BsdArchitecture) MMAPDEF = -DHAS_MMAP -#endif - -#ifdef OS2Architecture -SRCS1 = os2_stubs.c -OBJS1 = os2_stubs.o -#endif - - -SRCSA = InitInput.c InitOutput.c stubs.c miinitext.c directx.c +SRCSA = InitInput.c \ + InitOutput.c \ + stubs.c \ + wingc.c \ + winpolyline.c \ + winfillsp.c \ + wingetsp.c \ + winsetsp.c \ + winwindow.c \ + winpntwin.c \ + winpixmap.c \ + winfont.c \ + wincmap.c \ + winclip.c \ + winallpriv.c \ + winscrinit.c \ + winmisc.c \ + winblock.c \ + winwakeup.c \ + wincursor.c \ + winwndproc.c \ + winshadgdi.c \ + winshaddd.c \ + winshadddnl.c \ + winpfbdd.c \ + winkeybd.c \ + winmouse.c + +OBJSA = InitInput.o \ + InitOutput.o \ + stubs.o \ + wingc.o \ + winpolyline.o \ + winfillsp.o \ + wingetsp.o \ + winsetsp.o \ + winwindow.o \ + winpntwin.o \ + winpixmap.o \ + winfont.o \ + wincmap.o \ + winclip.o \ + winallpriv.o \ + winscrinit.o \ + winmisc.o \ + winblock.o \ + winwakeup.o \ + wincursor.o \ + winwndproc.o \ + winshadgdi.o \ + winshaddd.o \ + winshadddnl.o \ + winpfbdd.o \ + winkeybd.o \ + winmouse.o -OBJSA = InitInput.o InitOutput.o stubs.o miinitext.o directx.o - INCLUDES = -I. -I$(XBUILDINCDIR) -I$(FONTINCSRC) -I$(SERVERSRC)/render \ - -I$(SERVERSRC)/cfb -I$(SERVERSRC)/mfb -I$(SERVERSRC)/mi \ + -I$(SERVERSRC)/fb -I$(SERVERSRC)/mi \ -I$(SERVERSRC)/include -I$(SERVERSRC)/os \ - -I$(EXTINCSRC) -I$(XINCLUDESRC) + -I$(EXTINCSRC) -I$(XINCLUDESRC) -I$(SERVERSRC)/miext/shadow -DEFINES = ServerOSDefines $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI +DEFINES = $(OS_DEFINES) $(SHMDEF) $(MMAPDEF) -UXFree86LOADER -UXF86DRI #if BuildDPMS -SRCSC = dpmsstubs.c -OBJSC = dpmsstubs.o +SRCSB = dpmsstubs.c +OBJSB = dpmsstubs.o #endif SRCS = $(SRCSA) $(SRCSB) $(SRCSC) OBJS = $(OBJSA) $(OBJSB) $(OBJSC) - -NormalLibraryObjectRule() -NormalLibraryTarget(Xwin,$(OBJS)) - -#ifdef OS2Architecture -LinkSourceFile(os2_stubs.c,../xfree86/os-support/os2) -SpecialCObjectRule(os2_stubs,$(ICONFIGFILES),-DOS2NULLSELECT) -#endif - -LinkSourceFile(stubs.c,../../Xi) -SpecialCObjectRule(InitInput,$(ICONFIGFILES),$(EXT_DEFINES)) -LinkSourceFile(miinitext.c,../../mi) -SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES) $(PAN_DEFINES) -DNO_HW_ONLY_EXTS -DNO_MODULE_EXTS $(EXT_MODULE_DEFINES) -UXFree86LOADER) +LinkSourceFile(stubs.c,$(SERVERSRC)/Xi) +SpecialCObjectRule(stubs,$(ICONFIGFILES),$(EXT_DEFINES)) #if BuildDPMS LinkSourceFile(dpmsstubs.c,$(SERVERSRC)/Xext) Index: xc/programs/Xserver/hw/xwin/InitInput.c diff -u xc/programs/Xserver/hw/xwin/InitInput.c:1.1 xc/programs/Xserver/hw/xwin/InitInput.c:1.4 --- xc/programs/Xserver/hw/xwin/InitInput.c:1.1 Thu Aug 10 13:40:37 2000 +++ xc/programs/Xserver/hw/xwin/InitInput.c Tue May 1 20:45:26 2001 @@ -1,283 +1,115 @@ /* $TOG: InitInput.c /main/12 1998/02/10 13:23:52 kaleb $ */ /* -Copyright 1993, 1998 The Open Group + Copyright 1993, 1998 The Open Group -All Rights Reserved. + All Rights Reserved. -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -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. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + Except as contained in this notice, the name of The Open Group shall + not be used in advertising or otherwise to promote the sale, use or + other dealings in this Software without prior written authorization + from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/xwin/InitInput.c,v 1.1 2000/08/10 17:40:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitInput.c,v 1.4 2001/05/02 00:45:26 alanh Exp $ */ +#include "win.h" +CARD32 g_c32LastInputEventTime = 0; -#include "X11/X.h" -#define NEED_EVENTS -#include "X11/Xproto.h" -#include "scrnintstr.h" -#include "inputstr.h" -#include "X11/Xos.h" -#include "mibstore.h" -#include "mipointer.h" -#include "winkeynames.h" -#include "winkeymap.h" -#include "keysym.h" - - - - -CARD32 lastEventTime = 0; - -int TimeSinceLastInputEvent() -{ - if (lastEventTime == 0) - lastEventTime = GetTimeInMillis(); - return GetTimeInMillis() - lastEventTime; -} - -void SetTimeSinceLastInputEvent() -{ - lastEventTime = GetTimeInMillis(); -} - +/* Called from dix/devices.c */ +/* + * All of our keys generate up and down transition notifications, + * so all of our keys can be used as modifiers. + * + * An example of a modifier is mapping the A key to the Control key. + * A has to be a legal modifier. I think. + */ Bool -LegalModifier(key, pDev) - unsigned int key; - DevicePtr pDev; +LegalModifier (unsigned int uiKey, DevicePtr pDevice) { - return TRUE; + return TRUE; } +/* Called from dix/dispatch.c */ +/* We tell mi to dequeue the events that we have sent it */ void -ProcessInputEvents() +ProcessInputEvents (void) { - mieqProcessInputEvents(); - miPointerUpdate(); + mieqProcessInputEvents (); + miPointerUpdate (); } - -#define WIN_MIN_KEY 8 -#define WIN_MAX_KEY 255 -void -GetWinMappings (pKeySyms, pModMap) - KeySymsPtr pKeySyms; - CARD8 *pModMap; +int +TimeSinceLastInputEvent () { - KeySym *k; - char type; - int i, j; - KeySym *pMap; - - pMap = map; - - for (i = 0; i < MAP_LENGTH; i++) - pModMap[i] = NoSymbol; /* make sure it is restored */ - - for (k = pMap, i = MIN_KEYCODE; i < (NUM_KEYCODES + MIN_KEYCODE); i++, k += 4) - switch(*k) { - case XK_Shift_L: - case XK_Shift_R: - pModMap[i] = ShiftMask; - break; - - case XK_Control_L: - case XK_Control_R: - pModMap[i] = ControlMask; - break; - - case XK_Caps_Lock: - pModMap[i] = LockMask; - break; - - case XK_Alt_L: - case XK_Alt_R: - pModMap[i] = AltMask; - break; - - case XK_Num_Lock: - pModMap[i] = NumLockMask; - break; - - case XK_Scroll_Lock: - pModMap[i] = ScrollLockMask; - break; - - /* kana support */ - case XK_Kana_Lock: - case XK_Kana_Shift: - pModMap[i] = KanaMask; - break; - - /* alternate toggle for multinational support */ - case XK_Mode_switch: - pModMap[i] = AltLangMask; - break; - - } - pKeySyms->map = pMap; - pKeySyms->mapWidth = GLYPHS_PER_KEY; - pKeySyms->minKeyCode = MIN_KEYCODE; - pKeySyms->maxKeyCode = MAX_STD_KEYCODE; + if (g_c32LastInputEventTime == 0) + g_c32LastInputEventTime = GetTickCount (); + return GetTickCount () - g_c32LastInputEventTime; } -static int -winKeybdProc(pDevice, onoff) - DeviceIntPtr pDevice; - int onoff; +/* See Porting Layer Definition - p. 17 */ +void +InitInput (int argc, char *argv[]) { - KeySymsRec keySyms; - CARD8 modMap[MAP_LENGTH]; - int i; - DevicePtr pDev = (DevicePtr)pDevice; + DeviceIntPtr pMouse, pKeyboard; - switch (onoff) - { - case DEVICE_INIT: - GetWinMappings(&keySyms, modMap); - InitKeyboardDeviceStruct(pDev, &keySyms, modMap, - (BellProcPtr)NoopDDA, (KbdCtrlProcPtr)NoopDDA); - DIInitKeyboard () ; - break; - case DEVICE_ON: - pDev->on = TRUE; - break; - case DEVICE_OFF: - pDev->on = FALSE; - break; - case DEVICE_CLOSE: - DITermKeyboard () ; - break; - } - return Success; -} - -static int -winMouseProc(pDevice, onoff) - DeviceIntPtr pDevice; - int onoff; -{ - BYTE map[4]; - DevicePtr pDev = (DevicePtr)pDevice; +#if CYGDEBUG + ErrorF ("InitInput ()\n"); +#endif - switch (onoff) - { - case DEVICE_INIT: - map[1] = 1; - map[2] = 2; - map[3] = 3; - InitPointerDeviceStruct(pDev, map, 3, miPointerGetMotionEvents, - (PtrCtrlProcPtr)NoopDDA, miPointerGetMotionBufferSize()); - DIInitMouse () ; - break; - - case DEVICE_ON: - pDev->on = TRUE; - break; - - case DEVICE_OFF: - pDev->on = FALSE; - break; - - case DEVICE_CLOSE: - DITermMouse () ; - break; - } - return Success; -} + pMouse = AddInputDevice (winMouseProc, TRUE); + pKeyboard = AddInputDevice (winKeybdProc, TRUE); + + RegisterPointerDevice (pMouse); + RegisterKeyboardDevice (pKeyboard); -void -InitInput(argc, argv) - int argc; - char *argv[]; -{ - DevicePtr p, k; - p = AddInputDevice(winMouseProc, TRUE); - k = AddInputDevice(winKeybdProc, TRUE); - RegisterPointerDevice(p); - RegisterKeyboardDevice(k); - miRegisterPointerDevice(screenInfo.screens[0], p); - (void)mieqInit (k, p); -} + miRegisterPointerDevice (screenInfo.screens[0], pMouse); + mieqInit ((DevicePtr)pKeyboard, (DevicePtr)pMouse); -GenerateInputEvent (type, ix, iy, button) -{ - xEvent x ; + /* Initialize the mode key states */ + winInitializeModeKeyStates (); - /* Event types defined in directx.c */ - switch (type) - { - case 0: /* Mouse motion */ - miPointerDeltaCursor (ix,iy,lastEventTime = GetTimeInMillis ()); - break; - - case 1: /* Mouse button pressed */ - x.u.u.type = ButtonPress; - x.u.u.detail = Button1 + button ; - x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis(); - mieqEnqueue(&x); - break; - - case 2: /* Mouse button released */ - x.u.u.type = ButtonRelease; - x.u.u.detail = button + 1 ; - x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis(); - mieqEnqueue(&x); - break; - - case 3: /* Keyboard keypress */ - x.u.u.type = KeyPress; - x.u.u.detail = button + MIN_KEYCODE ; - x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis(); - mieqEnqueue(&x); - break; + /* 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); - case 4: /* Keyboard keyrelease */ - x.u.u.type = KeyRelease; - x.u.u.detail = button + MIN_KEYCODE ; - x.u.keyButtonPointer.time = lastEventTime = GetTimeInMillis(); - mieqEnqueue(&x); - break ; - } + /* Add the message queue as a device to wait for in WaitForSomething */ + AddEnabledDevice (g_fdMessageQueue); + } } #ifdef XTESTEXT1 void -XTestGenerateEvent(dev_type, keycode, keystate, mousex, mousey) - int dev_type; - int keycode; - int keystate; - int mousex; - int mousey; +XTestGenerateEvent (int dev_type, int keycode, int keystate, + int mousex, int mousey) { + ErrorF ("XTestGenerateEvent ()\n"); } void -XTestGetPointerPos(fmousex, fmousey) - short *fmousex, *fmousey; +XTestGetPointerPos (short *fmousex, short *fmousey) { + ErrorF ("XTestGetPointerPos ()\n"); } void -XTestJumpPointer(jx, jy, dev_type) - int jx; - int jy; - int dev_type; +XTestJumpPointer (int jx, int jy, int dev_type) { + ErrorF ("XTestJumpPointer ()\n"); } #endif Index: xc/programs/Xserver/hw/xwin/InitOutput.c diff -u xc/programs/Xserver/hw/xwin/InitOutput.c:1.2 xc/programs/Xserver/hw/xwin/InitOutput.c:1.8 --- xc/programs/Xserver/hw/xwin/InitOutput.c:1.2 Tue Nov 28 11:10:40 2000 +++ xc/programs/Xserver/hw/xwin/InitOutput.c Tue May 8 04:14:09 2001 @@ -22,759 +22,442 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.2 2000/11/28 16:10:40 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/InitOutput.c,v 1.8 2001/05/08 08:14:09 alanh Exp $ */ -#if defined(WIN32) && !defined(__CYGWIN__) -#include <X11/Xwinsock.h> -#endif -#include <stdio.h> -#include "X11/X.h" -#define NEED_EVENTS -#include "X11/Xproto.h" -#include "X11/Xos.h" -#include "scrnintstr.h" -#include "servermd.h" -#define PSZ 8 -#include "cfb.h" -#include "mibstore.h" -#include "colormapst.h" -#include "gcstruct.h" -#include "input.h" -#include "mipointer.h" -#include "picturestr.h" -#include <sys/types.h> -#ifdef HAS_MMAP -#include <sys/mman.h> -#ifndef MAP_FILE -#define MAP_FILE 0 -#endif -#endif /* HAS_MMAP */ -#include <sys/stat.h> -#include <errno.h> -#ifndef WIN32 -#include <sys/param.h> -#endif -#include <X11/XWDFile.h> -#if defined(HAS_SHM) && !defined(__CYGWIN__) -#include <sys/cygipc.h> -#include <sys/shm.h> -#endif /* HAS_SHM */ -#include "dix.h" -#include "miline.h" - -extern char *display; -extern void winfbBlockHandler (); -extern int winfbWakeupHandler (); - -#define WIN_DEFAULT_WIDTH 1280 -#define WIN_DEFAULT_HEIGHT 1024 -#define WIN_DEFAULT_DEPTH 16 -#define WIN_DEFAULT_WHITEPIXEL 255 -#define WIN_DEFAULT_BLACKPIXEL 0 -#define WIN_DEFAULT_LINEBIAS 0 -#define XWD_WINDOW_NAME_LEN 60 +#include "win.h" -typedef struct -{ - int scrnum; - int width; - int paddedWidth; - int height; - int depth; - int bitsPerPixel; - char *pfbMemory; - XWDColor *pXWDCmap; - XWDFileHeader *pXWDHeader; - Pixel blackPixel; - Pixel whitePixel; - ScreenPtr pScreen ; - unsigned int lineBias; - -} winScreenInfo, *winScreenInfoPtr; - -typedef enum { NORMAL_MEMORY_FB, SHARED_MEMORY_FB, MMAPPED_FILE_FB } fbMemType; - -static int winNumScreens; -static winScreenInfo winScreens[MAXSCREENS]; -static Bool winPixmapDepths[33]; -static char *pfbdir = NULL; -static fbMemType fbmemtype = NORMAL_MEMORY_FB; -static char needswap = 0; -static int lastScreen = -1; -static ColormapPtr InstalledMaps[MAXSCREENS]; - -#define swapcopy16(_dst, _src) \ - if (needswap) { CARD16 _s = _src; cpswaps(_s, _dst); } \ - else _dst = _src; - -#define swapcopy32(_dst, _src) \ - if (needswap) { CARD32 _s = _src; cpswapl(_s, _dst); } \ - else _dst = _src; - -static void -winInitializePixmapDepths() -{ - int i; - winPixmapDepths[1] = TRUE; /* always need bitmaps */ - for (i = 2; i <= 32; i++) - winPixmapDepths[i] = FALSE; -} - -static Bool -winCreateDefColormap (ScreenPtr pScreen) -{ - int i; - Pixel wp, bp; - VisualPtr pVisual; - ColormapPtr cmap; - unsigned short zero = 0, ones = 0xFFFF; - - /* - * these are the MS-Windows desktop colors, adjusted for X's 16-bit - * color specifications. - */ - static xColorItem citems[] = { - { 0, 0, 0, 0, 0, 0 }, - { 1, 0x8000, 0, 0, 0, 0 }, - { 2, 0, 0x8000, 0, 0, 0 }, - { 3, 0x8000, 0x8000, 0, 0, 0 }, - { 4, 0, 0, 0x8000, 0, 0 }, - { 5, 0x8000, 0, 0x8000, 0, 0 }, - { 6, 0, 0x8000, 0x8000, 0, 0 }, - { 7, 0xc000, 0xc000, 0xc000, 0, 0 }, - { 8, 0xc000, 0xdc00, 0xc000, 0, 0 }, - { 9, 0xa600, 0xca00, 0xf000, 0, 0 }, - { 246, 0xff00, 0xfb00, 0xf000, 0, 0 }, - { 247, 0xa000, 0xa000, 0xa400, 0, 0 }, - { 248, 0x8000, 0x8000, 0x8000, 0, 0 }, - { 249, 0xff00, 0, 0, 0, 0 }, - { 250, 0, 0xff00, 0, 0, 0 }, - { 251, 0xff00, 0xff00, 0, 0, 0 }, - { 252, 0, 0, 0xff00, 0, 0 }, - { 253, 0xff00, 0, 0xff00, 0, 0 }, - { 254, 0, 0xff00, 0xff00, 0, 0 }, - { 255, 0xff00, 0xff00, 0xff00, 0, 0 } - }; -#define NUM_DESKTOP_COLORS sizeof citems / sizeof citems[0] - - for (pVisual = pScreen->visuals; - pVisual->vid != pScreen->rootVisual; - pVisual++); - - if (CreateColormap (pScreen->defColormap, pScreen, pVisual, &cmap, - (pVisual->class & DynamicClass) ? AllocNone : AllocAll, - 0) - != Success) - return FALSE; - if (pVisual->class == PseudoColor) - { - for (i = 0; i < NUM_DESKTOP_COLORS; i++) - { - if (AllocColor (cmap, - &citems[i].red, - &citems[i].green, - &citems[i].blue, - &citems[i].pixel, - 0) != Success) - return FALSE; - } - pScreen->whitePixel = 255; - pScreen->blackPixel = 0; - } - else - { - if ((AllocColor (cmap, &ones, &ones, &ones, &wp, 0) - != Success) - || (AllocColor (cmap, &zero, &zero, &zero, &bp, 0) - != Success)) - return FALSE; - pScreen->whitePixel = wp; - pScreen->blackPixel = bp; - } - (*pScreen->InstallColormap)(cmap); - return TRUE; -} +int g_nNumScreens; +winScreenInfo g_winScreens[MAXSCREENS]; +int g_nLastScreen = -1; +ColormapPtr g_cmInstalledMaps[MAXSCREENS]; +int g_fdMessageQueue = WIN_FD_INVALID; +int g_winScreenPrivateIndex = -1; +unsigned long g_winGeneration = 0; + +static PixmapFormatRec g_PixmapFormats[] = { + { 1, 1, BITMAP_SCANLINE_PAD }, + { 4, 8, BITMAP_SCANLINE_PAD }, + { 8, 8, BITMAP_SCANLINE_PAD }, + { 15, 16, BITMAP_SCANLINE_PAD }, + { 16, 16, BITMAP_SCANLINE_PAD }, + { 24, 24, BITMAP_SCANLINE_PAD }, + { 32, 32, BITMAP_SCANLINE_PAD } +}; +const int NUMFORMATS = sizeof (g_PixmapFormats) / sizeof (g_PixmapFormats[0]); -static void -winInitializeDefaultScreens() +void +winInitializeDefaultScreens (void) { int i; for (i = 0; i < MAXSCREENS; i++) { - winScreens[i].scrnum = i; - winScreens[i].width = WIN_DEFAULT_WIDTH; - winScreens[i].height = WIN_DEFAULT_HEIGHT; - winScreens[i].depth = WIN_DEFAULT_DEPTH; - winScreens[i].blackPixel = WIN_DEFAULT_BLACKPIXEL; - winScreens[i].whitePixel = WIN_DEFAULT_WHITEPIXEL; - winScreens[i].lineBias = WIN_DEFAULT_LINEBIAS; - winScreens[i].pfbMemory = NULL; - } - winNumScreens = 1; -} - -static int -winBitsPerPixel (int depth) -{ - if (depth == 1) return 1; - else if (depth <= 8) return 8; - else if (depth <= 16) return 16; - else if (depth <= 24) return 24; + g_winScreens[i].dwScreen = i; + g_winScreens[i].dwWidth = WIN_DEFAULT_WIDTH; + g_winScreens[i].dwHeight = WIN_DEFAULT_HEIGHT; + g_winScreens[i].dwDepth = WIN_DEFAULT_DEPTH; + g_winScreens[i].pixelBlack = WIN_DEFAULT_BLACKPIXEL; + g_winScreens[i].pixelWhite = WIN_DEFAULT_WHITEPIXEL; + g_winScreens[i].dwLineBias = WIN_DEFAULT_LINEBIAS; + g_winScreens[i].pfb = NULL; + g_winScreens[i].fFullScreen = FALSE; + g_winScreens[i].iE3BTimeout = WIN_E3B_OFF; + } + g_nNumScreens = 1; +} + +DWORD +winBitsPerPixel (DWORD dwDepth) +{ + if (dwDepth == 1) return 1; + else if (dwDepth <= 8) return 8; + else if (dwDepth <= 16) return 16; else return 32; } +/* See Porting Layer Definition - p. 57 */ void ddxGiveUp() { - return; +#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); } +/* See Porting Layer Definition - p. 57 */ void -AbortDDX() +AbortDDX (void) { - ddxGiveUp(); +#if CYGDEBUG + ErrorF ("AbortDDX ()\n"); +#endif + ddxGiveUp (); } void -OsVendorInit() +OsVendorInit (void) { +#if CYGDEBUG + ErrorF ("OsVendorInit ()\n"); +#endif } +/* See Porting Layer Definition - p. 57 */ void -ddxUseMsg() +ddxUseMsg (void) { - ErrorF("-screen scrn WxHxD set screen's width, height, bit depth\n"); - ErrorF("-pixdepths list-of-int support given pixmap depths\n"); - ErrorF("-linebias n adjust thin line pixelization\n"); - ErrorF("-blackpixel n pixel value for black\n"); - ErrorF("-whitepixel n pixel value for white\n"); + ErrorF ("-screen n WxHxD\n"\ + "\tSet screen n's width, height, and bit depth\n"); + ErrorF ("-linebias n\n"\ + "\tAdjust thin line pixelization\n"); + ErrorF ("-blackpixel n\n"\ + "\tPixel value for black\n"); + ErrorF ("-whitepixel n\n"\ + "\tPixel value for white\n"); + ErrorF ("-engine n\n"\ + "\tOverride the server's detected engine type:\n"\ + "\t\tGDI blitter\t\t1\n"\ + "\t\tDirectDraw blitter\t2\n"\ + "\t\tDirectDraw4 blitter\t4\n"); + ErrorF ("-fullscreen\n" + "\tRun the specified server engine in fullscreen mode\n"); + ErrorF ("-emulate3buttons [n]\n" + "\tEmulate 3 button mouse with timeout of n milliseconds\n"); } +/* See Porting Layer Definition - p. 57 */ int ddxProcessArgument (int argc, char *argv[], int i) { - static Bool firstTime = TRUE; + static Bool fFirstTime = TRUE; - if (firstTime) + /* Run some initialization procedures the first time through */ + if (fFirstTime) { - winInitializeDefaultScreens(); - winInitializePixmapDepths(); - firstTime = FALSE; + winInitializeDefaultScreens (); + fFirstTime = FALSE; } - - if (strcmp (argv[i], "-screen") == 0) /* -screen n WxHxD */ + + /* + * Look for the '-screen n WxHxD' arugment + */ + if (strcmp (argv[i], "-screen") == 0) { - int screenNum; - if (i + 2 >= argc) UseMsg(); - screenNum = atoi(argv[i+1]); - if (screenNum < 0 || screenNum >= MAXSCREENS) - { - ErrorF("Invalid screen number %d\n", screenNum); - UseMsg(); - } - if (3 != sscanf(argv[i+2], "%dx%dx%d", - &winScreens[screenNum].width, - &winScreens[screenNum].height, - &winScreens[screenNum].depth)) - { - ErrorF("Invalid screen configuration %s\n", argv[i+2]); - UseMsg(); - } + int nScreenNum; - if (screenNum >= winNumScreens) - winNumScreens = screenNum + 1; - lastScreen = screenNum; - return 3; - } + /* Display the usage message if the argument is malformed */ + if (i + 2 >= argc) + { + UseMsg (); + return 0; + } - if (strcmp (argv[i], "-pixdepths") == 0) /* -pixdepths list-of-depth */ - { - int depth, ret = 1; + nScreenNum = atoi (argv[i+1]); - if (++i >= argc) UseMsg(); - while ((i < argc) && (depth = atoi(argv[i++])) != 0) + /* Validate the specified screen number */ + if (nScreenNum < 0 || nScreenNum >= MAXSCREENS) { - if (depth < 0 || depth > 32) - { - ErrorF("Invalid pixmap depth %d\n", depth); - UseMsg(); - } - winPixmapDepths[depth] = TRUE; - ret++; - } - return ret; + ErrorF ("Invalid screen number %d\n", nScreenNum); + UseMsg (); + return 0; + } + + /* Grab the height, width, and depth parameters */ + if (3 != sscanf (argv[i+2], "%dx%dx%d", + (int*)&g_winScreens[nScreenNum].dwWidth, + (int*)&g_winScreens[nScreenNum].dwHeight, + (int*)&g_winScreens[nScreenNum].dwDepth)) + { + /* I see no height, width, and depth here */ + ErrorF ("Invalid screen configuration %s\n", argv[i+2]); + UseMsg (); + return 0; + } + + if (nScreenNum >= g_nNumScreens) + g_nNumScreens = nScreenNum + 1; + g_nLastScreen = nScreenNum; + return 3; } + /* + * Look for the '-blackpixel n' argument + */ if (strcmp (argv[i], "-blackpixel") == 0) /* -blackpixel n */ { - Pixel pix; - if (++i >= argc) UseMsg(); - pix = atoi(argv[i]); - if (-1 == lastScreen) + Pixel pix; + + /* Display the usage message if the argument is malformed */ + if (++i >= argc) + { + UseMsg (); + return 0; + } + + pix = atoi (argv[i]); + + /* Is this parameter attached to a screen or global? */ + if (-1 == g_nLastScreen) { - int i; - for (i = 0; i < MAXSCREENS; i++) + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) { - winScreens[i].blackPixel = pix; + g_winScreens[j].pixelBlack = pix; } } else { - winScreens[lastScreen].blackPixel = pix; + /* Parameter is for a single screen */ + g_winScreens[g_nLastScreen].pixelBlack = pix; } return 2; } + /* + * Look for the '-whitepixel n' argument + */ if (strcmp (argv[i], "-whitepixel") == 0) /* -whitepixel n */ { - Pixel pix; - if (++i >= argc) UseMsg(); - pix = atoi(argv[i]); - if (-1 == lastScreen) + Pixel pix; + + /* Display the usage message if the argument is malformed */ + if (++i >= argc) + { + UseMsg (); + return 0; + } + + pix = atoi (argv[i]); + + /* Is this parameter attached to a screen or global? */ + if (-1 == g_nLastScreen) { - int i; - for (i = 0; i < MAXSCREENS; i++) + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) { - winScreens[i].whitePixel = pix; + g_winScreens[j].pixelWhite = pix; } } else { - winScreens[lastScreen].whitePixel = pix; + /* Parameter is for a single screen */ + g_winScreens[g_nLastScreen].pixelWhite = pix; } return 2; } - if (strcmp (argv[i], "-linebias") == 0) /* -linebias n */ + /* + * Look for the '-linebias n' argument + */ + if (strcmp (argv[i], "-linebias") == 0) { - unsigned int linebias; - if (++i >= argc) UseMsg(); - linebias = atoi(argv[i]); - if (-1 == lastScreen) + unsigned int uiLinebias; + + /* Display the usage message if the argument is malformed */ + if (++i >= argc) + { + UseMsg (); + return 0; + } + + uiLinebias = atoi (argv[i]); + + /* Is this parameter attached to a screen or global? */ + if (-1 == g_nLastScreen) { - int i; - for (i = 0; i < MAXSCREENS; i++) + int j; + + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) { - winScreens[i].lineBias = linebias; + g_winScreens[j].dwLineBias = uiLinebias; } } else { - winScreens[lastScreen].lineBias = linebias; + /* Parameter is for a single screen */ + g_winScreens[g_nLastScreen].dwLineBias = uiLinebias; } return 2; } - if (strcmp (argv[i], "-probe") == 0) /* -linebias n */ + /* + * Look for the '-engine n' argument + */ + if (strcmp (argv[i], "-engine") == 0) { - ListModes (); - return 1; - } - - return 0; -} + DWORD dwEngine = 0; + CARD8 c8OnBits = 0; + + /* Display the usage message if the argument is malformed */ + if (++i >= argc) + { + UseMsg (); + return 0; + } -#ifdef DDXTIME /* from ServerOSDefines */ -CARD32 -GetTimeInMillis() -{ - struct timeval tp; + /* Grab the argument */ + dwEngine = atoi (argv[i]); - X_GETTIMEOFDAY(&tp); - return(tp.tv_sec * 1000) + (tp.tv_usec / 1000); -} -#endif + /* Count the one bits in the engine argument */ + c8OnBits = winCountBits (dwEngine); -static Bool -winMultiDepthCreateGC (GCPtr pGC) -{ - switch (winBitsPerPixel(pGC->depth)) - { - case 1: return mfbCreateGC (pGC); - case 8: return cfbCreateGC (pGC); - case 16: return cfb16CreateGC (pGC); - case 24: return cfb24CreateGC (pGC); - case 32: return cfb32CreateGC (pGC); - default: return FALSE; - } -} + /* Argument should only have a single bit on */ + if (c8OnBits != 1) + { + UseMsg (); + return 0; + } -static void -winMultiDepthGetSpans (DrawablePtr pDrawable, int wMax, - register DDXPointPtr ppt, - int *pwidth, int nspans, char *pdstStart) -{ - switch (pDrawable->bitsPerPixel) - { - case 1: - mfbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); - break; - case 8: - cfbGetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); - break; - case 16: - cfb16GetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); - break; - case 24: - cfb24GetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); - break; - case 32: - cfb32GetSpans (pDrawable, wMax, ppt, pwidth, nspans, pdstStart); - break; - } - return; -} + /* Is this parameter attached to a screen or global? */ + if (-1 == g_nLastScreen) + { + int j; -static void -winMultiDepthGetImage (DrawablePtr pDrawable, int sx, int sy, - int w, int h, unsigned int format, - unsigned long planeMask, - char *pdstLine) -{ - switch (pDrawable->bitsPerPixel) - { - case 1: - mfbGetImage (pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - break; - case 8: - cfbGetImage (pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - break; - case 16: - cfb16GetImage (pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - break; - case 24: - cfb24GetImage (pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - break; - case 32: - cfb32GetImage (pDrawable, sx, sy, w, h, format, planeMask, pdstLine); - break; + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_winScreens[j].dwEnginePreferred = dwEngine; + } + } + else + { + /* Parameter is for a single screen */ + g_winScreens[g_nLastScreen].dwEnginePreferred = dwEngine; + } + + /* Indicate that we have processed the argument */ + return 2; } -} - -static int -winListInstalledColormaps (ScreenPtr pScreen, Colormap *pmaps) -{ - /* By the time we are processing requests, we can guarantee that there - * is always a colormap installed */ - *pmaps = InstalledMaps[pScreen->myNum]->mid; - return (1); -} -static void -winInstallColormap (ColormapPtr pmap) -{ - int index = pmap->pScreen->myNum; - ColormapPtr oldpmap = InstalledMaps[index]; - int entries; - VisualPtr pVisual; - Pixel *ppix; - xrgb *prgb; - xColorItem *defs; - int i; - - if (pmap != oldpmap) + /* + * Look for the '-fullscreen' argument + */ + if (strcmp(argv[i], "-fullscreen") == 0) { - if(oldpmap != (ColormapPtr)None) - { - WalkTree (pmap->pScreen, TellLostMap, (char *)&oldpmap->mid); - } - - /* Install pmap */ - InstalledMaps[index] = pmap; - WalkTree (pmap->pScreen, TellGainedMap, (char *)&pmap->mid); - - entries = pmap->pVisual->ColormapEntries; - pVisual = pmap->pVisual; - - ppix = (Pixel *)ALLOCATE_LOCAL(entries * sizeof(Pixel)); - prgb = (xrgb *)ALLOCATE_LOCAL(entries * sizeof(xrgb)); - defs = (xColorItem *)ALLOCATE_LOCAL(entries * sizeof(xColorItem)); - - for (i = 0; i < entries; i++) - { - ppix[i] = i; - } - - /* XXX truecolor */ - QueryColors(pmap, entries, ppix, prgb); + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_nLastScreen) + { + int j; - /* convert xrgbs to xColorItems */ - for (i = 0; i < entries; i++) - { - defs[i].pixel = ppix[i] & 0xff; /* change pixel to index */ - defs[i].red = prgb[i].red; - defs[i].green = prgb[i].green; - defs[i].blue = prgb[i].blue; - defs[i].flags = DoRed|DoGreen|DoBlue; - } - (*pmap->pScreen->StoreColors)(pmap, entries, defs); + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_winScreens[j].fFullScreen = TRUE; + } + } + else + { + /* Parameter is for a single screen */ + g_winScreens[g_nLastScreen].fFullScreen = TRUE; + } - DEALLOCATE_LOCAL(ppix); - DEALLOCATE_LOCAL(prgb); - DEALLOCATE_LOCAL(defs); + /* Indicate that we have processed this argument */ + return 1; } -} -static void -winUninstallColormap (ColormapPtr pmap) -{ - ColormapPtr curpmap = InstalledMaps[pmap->pScreen->myNum]; - - if (pmap == curpmap) + /* + * Look for the '-emulate3buttons' argument + */ + if (strcmp(argv[i], "-emulate3buttons") == 0) { - if (pmap->mid != pmap->pScreen->defColormap) - { - curpmap = (ColormapPtr) LookupIDByType(pmap->pScreen->defColormap, - RT_COLORMAP); - (*pmap->pScreen->InstallColormap)(curpmap); - } - } -} - -static void -winStoreColors (ColormapPtr pmap, int ndef, xColorItem *pdefs) -{ - int i; - - if (pmap != InstalledMaps[pmap->pScreen->myNum]) return; + int iArgsProcessed = 1; + int iE3BTimeout = WIN_DEFAULT_E3B_TIME; - if ((pmap->pVisual->class | DynamicClass) == DirectColor) - return; - - // TrueColor or Pseudo Color - if (pmap->pVisual->class == PseudoColor) - { - for (i = 0; i < ndef; i++, pdefs++) + /* Grab the optional timeout value */ + if (i + 1 < argc + && 1 == sscanf (argv[i + 1], "%d", + &iE3BTimeout)) { - DXStoreColors (pdefs->pixel, - pdefs->red, - pdefs->green, - pdefs->blue); + /* Indicate that we have processed the next argument */ + iArgsProcessed++; } - } -} + else + { + /* + * sscanf () won't modify iE3BTimeout if it doesn't find + * the specified format; however, I want to be explicit + * about setting the default timeout in such cases to + * prevent some programs (me) from getting confused. + */ + iE3BTimeout = WIN_DEFAULT_E3B_TIME; + } -static Bool -winSaveScreen (ScreenPtr pScreen, int on) -{ - return TRUE; -} + /* Is this parameter attached to a screen or is it global? */ + if (-1 == g_nLastScreen) + { + int j; -static char * -winAllocateFramebufferMemory (winScreenInfoPtr pwin) -{ - pwin->pfbMemory = winDXAllocateFramebufferMemory (&pwin->width, - &pwin->height, - &pwin->depth, - &pwin->paddedWidth); - return pwin->pfbMemory; -} + /* Parameter is for all screens */ + for (j = 0; j < MAXSCREENS; j++) + { + g_winScreens[j].iE3BTimeout = iE3BTimeout; + } + } + else + { + /* Parameter is for a single screen */ + g_winScreens[g_nLastScreen].iE3BTimeout = TRUE; + } -static Bool -winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y) -{ - return FALSE; -} + /* Indicate that we have processed this argument */ + return iArgsProcessed; + } -static void -winCrossScreen (ScreenPtr pScreen, Bool entering) -{ + return 0; } - -static miPointerScreenFuncRec winPointerCursorFuncs = -{ - winCursorOffScreen, - winCrossScreen, - miPointerWarpCursor -}; - -Bool miCreateScreenResources (ScreenPtr pScreen) ; -static Bool -winScreenInit (int index, ScreenPtr pScreen, int argc, char *argv[]) +#ifdef DDXTIME /* from ServerOSDefines */ +CARD32 +GetTimeInMillis (void) { - winScreenInfoPtr pwin = &winScreens[index]; - PictFormatPtr formats = NULL; - int nformats = 0; - int dpix = 100, dpiy = 100; - int ret = FALSE; - char *pbits; - BOOL fResult = FALSE; - unsigned long stack_ptr; - - /* Initial display parameters */ - pwin->paddedWidth = PixmapBytePad(pwin->width, pwin->depth); - pwin->bitsPerPixel = winBitsPerPixel(pwin->depth); - - pbits = winAllocateFramebufferMemory (pwin); - - if (!pbits) return FALSE; - - fprintf (stderr, "Obtained Width: %d, Height: %d, Depth: %d\n", - pwin->width, pwin->height, pwin->bitsPerPixel); - - switch (pwin->bitsPerPixel) - { - case 1: - ret = mfbScreenInit (pScreen, pbits, pwin->width, pwin->height, - dpix, dpiy, pwin->paddedWidth * 8); - break; - case 8: - fprintf( stderr, "Calling cfbScreenInit (%08x, %08x, %d, %d, %d, %d, %d)\n", - pScreen, pbits, pwin->width, pwin->height, - dpix, dpiy, pwin->paddedWidth); - - ret = cfbScreenInit (pScreen, pbits, pwin->width, pwin->height, - dpix, dpiy, pwin->paddedWidth); - break; - case 16: - fprintf( stderr, "Calling cfb16ScreenInit (%08x, %08x, %d, %d, %d, %d, %d)\n", - pScreen, pbits, pwin->width, pwin->height, - dpix, dpiy, pwin->paddedWidth); - ret = cfb16ScreenInit (pScreen, pbits, pwin->width, pwin->height, - dpix, dpiy, pwin->paddedWidth); - break; - case 24: - fprintf( stderr, "Calling cfb24ScreenInit (%08x, %08x, %d, %d, %d, %d, %d)\n", - pScreen, pbits, pwin->width, pwin->height, - dpix, dpiy, pwin->paddedWidth); - ret = cfb24ScreenInit (pScreen, pbits, pwin->width, pwin->height, - dpix, dpiy, pwin->paddedWidth); - break; - case 32: - fprintf( stderr, "Calling cfb32ScreenInit (%08x, %08x, %d, %d, %d, %d, %d)\n", - pScreen, pbits, pwin->width, pwin->height, - dpix, dpiy, pwin->paddedWidth); - - ret = cfb32ScreenInit (pScreen, pbits, pwin->width, pwin->height, - dpix, dpiy, pwin->paddedWidth); - break; - default: - return FALSE; - } - - if (!ret) return FALSE; - - pScreen->CreateGC = winMultiDepthCreateGC; - pScreen->GetImage = winMultiDepthGetImage; - pScreen->GetSpans = winMultiDepthGetSpans; - - pScreen->InstallColormap = winInstallColormap; - pScreen->UninstallColormap = winUninstallColormap; - pScreen->ListInstalledColormaps = winListInstalledColormaps; - - pScreen->SaveScreen = winSaveScreen; - pScreen->StoreColors = winStoreColors; - - miPictureInit(pScreen, formats, nformats); - miDCInitialize (pScreen, &winPointerCursorFuncs); - - pScreen->blackPixel = pwin->blackPixel; - pScreen->whitePixel = pwin->whitePixel; - - if (pwin->bitsPerPixel == 1) - { - ret = mfbCreateDefColormap (pScreen); - } - else - { - ret = winCreateDefColormap (pScreen); - } - - miSetZeroLineBias (pScreen, pwin->lineBias); - - if (ret) - { - RegisterBlockAndWakeupHandlers (winfbBlockHandler, - winfbWakeupHandler, - NULL); - } - pwin->pScreen = pScreen ; - ErrorF ("Successful addition of Screen %p %p\n", - pScreen->devPrivate, - pScreen); - return ret; - + return GetTickCount (); } +#endif /* DDXTIME */ +/* See Porting Layer Definition - p. 20 */ +/* We use ddxProcessArgument, so we don't need to touch argc and argv */ void InitOutput (ScreenInfo *screenInfo, int argc, char *argv[]) { int i; - int iNumFormats = 0; - int *piDepth = 0, *piWidth = 0, *piHeight = 0; - FILE *pf = stderr; - /* Initialize pixmap formats */ - - /* cfbLoad() ;*/ - - /* Adjust bit depth for all screens */ - for (i = 0; i < winNumScreens; i++) - { - piWidth = &winScreens[i].width; - piHeight = &winScreens[i].height; - piDepth = &winScreens[i].depth; - - fprintf (stderr, "Desired Width: %d, Height: %d, Depth: %d\n", - *piWidth, *piHeight, *piDepth); - - /* Adjust bit depth and display size for hardware requirements */ - AdjustVideoMode (piWidth, piHeight, piDepth, TRUE); - - fprintf (stderr, "Adjusted Width: %d, Height: %d, Depth: %d\n", - *piWidth, *piHeight, *piDepth); - } - - /* must have a pixmap depth to match every screen depth */ - for (i = 0; i < winNumScreens; i++) - { - winPixmapDepths[winScreens[i].depth] = TRUE; - } - - for (i = 1; i <= 32; i++) - { - if (winPixmapDepths[i]) - { - if (iNumFormats >= MAXFORMATS) - FatalError ("MAXFORMATS is too small for this server\n"); - screenInfo->formats[iNumFormats].depth = i; - screenInfo->formats[iNumFormats].bitsPerPixel = winBitsPerPixel(i); - screenInfo->formats[iNumFormats].scanlinePad = BITMAP_SCANLINE_PAD; - iNumFormats++; - } - } - + /* Setup global screen info parameters */ screenInfo->imageByteOrder = IMAGE_BYTE_ORDER; - screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; screenInfo->bitmapScanlinePad = BITMAP_SCANLINE_PAD; + screenInfo->bitmapScanlineUnit = BITMAP_SCANLINE_UNIT; screenInfo->bitmapBitOrder = BITMAP_BIT_ORDER; - screenInfo->numPixmapFormats = iNumFormats; + screenInfo->numPixmapFormats = NUMFORMATS; + + /* Describe how we want common pixmap formats padded */ + for (i = 0; i < NUMFORMATS; i++) + { + screenInfo->formats[i] = g_PixmapFormats[i]; + } - /* initialize screens */ - for (i = 0; i < winNumScreens; i++) + /* Initialize each screen */ + for (i = 0; i < g_nNumScreens; i++) { if (-1 == AddScreen (winScreenInit, argc, argv)) { FatalError ("Couldn't add screen %d", i); } } -} - -void -SwitchFramebuffer (pointer pbits) -{ - PixmapPtr pmap; - ScreenPtr s = winScreens[0].pScreen; - - pmap = ((PixmapPtr) (s)->devPrivate); - /* - if (winScreens[0].depth == 8) - pmap = ((PixmapPtr) (s)->devPrivate); - else - pmap = ((PixmapPtr) (s)->devPrivates[0].ptr); - */ - /*ErrorF ("Switch: %p, %p\n", winScreens[0].pScreen, pmap);*/ - pmap->devPrivate.ptr = pbits; } Index: xc/programs/Xserver/hw/xwin/ddraw.h diff -u xc/programs/Xserver/hw/xwin/ddraw.h:1.1 xc/programs/Xserver/hw/xwin/ddraw.h:1.2 --- xc/programs/Xserver/hw/xwin/ddraw.h:1.1 Thu Aug 10 13:40:37 2000 +++ xc/programs/Xserver/hw/xwin/ddraw.h Thu Apr 5 16:13:49 2001 @@ -1,16 +1,22 @@ -/* $XFree86: xc/programs/Xserver/hw/xwin/ddraw.h,v 1.1 2000/08/10 17:40:37 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/hw/xwin/ddraw.h,v 1.2 2001/04/05 20:13:49 dawes Exp $ */ #ifndef __WINE_DDRAW_H #define __WINE_DDRAW_H -#include <X11/Xlib.h> -#ifdef HAVE_LIBXXSHM -#include <X11/extensions/XShm.h> -#endif /* defined(HAVE_LIBXXSHM) */ - -#include "winnt.h" /* LARGE_INTEGER ... */ -#include "wingdi.h" /* PALETTE stuff ... */ -#include "wine/obj_base.h" +#include <winnt.h> /* LARGE_INTEGER ... */ +#include <wingdi.h> /* PALETTE stuff ... */ +#include "obj_base.h" + +# ifdef UNICODE +# define WINELIB_NAME_AW(func) func##W +# else +# define WINELIB_NAME_AW(func) func##A +# endif /* UNICODE */ +#define DECL_WINELIB_TYPE_AW(type) typedef WINELIB_NAME_AW(type) type; + +#ifdef __cplusplus +extern "C" { +#endif /* defined(__cplusplus) */ #ifndef DIRECTDRAW_VERSION #define DIRECTDRAW_VERSION 0x0500 @@ -20,28 +26,35 @@ * Predeclare the interfaces */ DEFINE_GUID( CLSID_DirectDraw, 0xD7B70EE0,0x4340,0x11CF,0xB0,0x63,0x00,0x20,0xAF,0xC2,0xCD,0x35 ); +DEFINE_GUID( CLSID_DirectDraw7, 0x3C305196,0x50DB,0x11D3,0x9C,0xFE,0x00,0xC0,0x4F,0xD9,0x30,0xC5 ); DEFINE_GUID( CLSID_DirectDrawClipper, 0x593817A0,0x7DB3,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xb9,0x33,0x56 ); DEFINE_GUID( IID_IDirectDraw, 0x6C14DB80,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); DEFINE_GUID( IID_IDirectDraw2, 0xB3A6F3E0,0x2B43,0x11CF,0xA2,0xDE,0x00,0xAA,0x00,0xB9,0x33,0x56 ); DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); +DEFINE_GUID( IID_IDirectDraw7, 0x15e65ec0,0x3b9c,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); DEFINE_GUID( IID_IDirectDrawSurface, 0x6C14DB81,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); DEFINE_GUID( IID_IDirectDrawSurface2, 0x57805885,0x6eec,0x11cf,0x94,0x41,0xa8,0x23,0x03,0xc1,0x0e,0x27 ); DEFINE_GUID( IID_IDirectDrawSurface3, 0xDA044E00,0x69B2,0x11D0,0xA1,0xD5,0x00,0xAA,0x00,0xB8,0xDF,0xBB ); DEFINE_GUID( IID_IDirectDrawSurface4, 0x0B2B8630,0xAD35,0x11D0,0x8E,0xA6,0x00,0x60,0x97,0x97,0xEA,0x5B ); +DEFINE_GUID( IID_IDirectDrawSurface7, 0x06675a80,0x3b9b,0x11d2,0xb9,0x2f,0x00,0x60,0x97,0x97,0xea,0x5b ); DEFINE_GUID( IID_IDirectDrawPalette, 0x6C14DB84,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); DEFINE_GUID( IID_IDirectDrawClipper, 0x6C14DB85,0xA733,0x11CE,0xA5,0x21,0x00,0x20,0xAF,0x0B,0xE5,0x60 ); DEFINE_GUID( IID_IDirectDrawColorControl,0x4B9F0EE0,0x0D7E,0x11D0,0x9B,0x06,0x00,0xA0,0xC9,0x03,0xA3,0xB8 ); +DEFINE_GUID( IID_IDirectDrawGammaControl,0x69C11C3E,0xB46B,0x11D1,0xAD,0x7A,0x00,0xC0,0x4F,0xC2,0x9B,0x4E ); typedef struct IDirectDraw IDirectDraw,*LPDIRECTDRAW; typedef struct IDirectDraw2 IDirectDraw2,*LPDIRECTDRAW2; typedef struct IDirectDraw4 IDirectDraw4,*LPDIRECTDRAW4; +typedef struct IDirectDraw7 IDirectDraw7,*LPDIRECTDRAW7; typedef struct IDirectDrawClipper IDirectDrawClipper,*LPDIRECTDRAWCLIPPER; typedef struct IDirectDrawPalette IDirectDrawPalette,*LPDIRECTDRAWPALETTE; typedef struct IDirectDrawSurface IDirectDrawSurface,*LPDIRECTDRAWSURFACE; typedef struct IDirectDrawSurface2 IDirectDrawSurface2,*LPDIRECTDRAWSURFACE2; typedef struct IDirectDrawSurface3 IDirectDrawSurface3,*LPDIRECTDRAWSURFACE3; typedef struct IDirectDrawSurface4 IDirectDrawSurface4,*LPDIRECTDRAWSURFACE4; +typedef struct IDirectDrawSurface7 IDirectDrawSurface7,*LPDIRECTDRAWSURFACE7; typedef struct IDirectDrawColorControl IDirectDrawColorControl,*LPDIRECTDRAWCOLORCONTROL; +typedef struct IDirectDrawGammaControl IDirectDrawGammaControl,*LPDIRECTDRAWGAMMACONTROL; #define DDENUMRET_CANCEL 0 @@ -71,6 +84,8 @@ #define DDERR_LOCKEDSURFACES MAKE_DDHRESULT( 160 ) #define DDERR_NO3D MAKE_DDHRESULT( 170 ) #define DDERR_NOALPHAHW MAKE_DDHRESULT( 180 ) +#define DDERR_NOSTEREOHARDWARE MAKE_DDHRESULT( 181 ) +#define DDERR_NOSURFACELEFT MAKE_DDHRESULT( 182 ) #define DDERR_NOCLIPLIST MAKE_DDHRESULT( 205 ) #define DDERR_NOCOLORCONVHW MAKE_DDHRESULT( 210 ) #define DDERR_NOCOOPERATIVELEVELSET MAKE_DDHRESULT( 212 ) @@ -83,6 +98,7 @@ #define DDERR_NOMIRRORHW MAKE_DDHRESULT( 250 ) #define DDERR_NOTFOUND MAKE_DDHRESULT( 255 ) #define DDERR_NOOVERLAYHW MAKE_DDHRESULT( 260 ) +#define DDERR_OVERLAPPINGRECTS MAKE_DDHRESULT( 270 ) #define DDERR_NORASTEROPHW MAKE_DDHRESULT( 280 ) #define DDERR_NOROTATIONHW MAKE_DDHRESULT( 290 ) #define DDERR_NOSTRETCHHW MAKE_DDHRESULT( 310 ) @@ -113,8 +129,10 @@ #define DDERR_UNSUPPORTED E_NOTIMPL #define DDERR_UNSUPPORTEDFORMAT MAKE_DDHRESULT( 510 ) #define DDERR_UNSUPPORTEDMASK MAKE_DDHRESULT( 520 ) +#define DDERR_INVALIDSTREAM MAKE_DDHRESULT( 521 ) #define DDERR_VERTICALBLANKINPROGRESS MAKE_DDHRESULT( 537 ) #define DDERR_WASSTILLDRAWING MAKE_DDHRESULT( 540 ) +#define DDERR_DDSCAPSCOMPLEXREQUIRED MAKE_DDHRESULT( 542 ) #define DDERR_XALIGN MAKE_DDHRESULT( 560 ) #define DDERR_INVALIDDIRECTDRAWGUID MAKE_DDHRESULT( 561 ) #define DDERR_DIRECTDRAWALREADYCREATED MAKE_DDHRESULT( 562 ) @@ -151,13 +169,20 @@ #define DDERR_NOOPTIMIZEHW MAKE_DDHRESULT( 600 ) #define DDERR_NOTLOADED MAKE_DDHRESULT( 601 ) #define DDERR_NOFOCUSWINDOW MAKE_DDHRESULT( 602 ) +#define DDERR_NOTONMIPMAPSUBLEVEL MAKE_DDHRESULT( 603 ) #define DDERR_DCALREADYCREATED MAKE_DDHRESULT( 620 ) #define DDERR_NONONLOCALVIDMEM MAKE_DDHRESULT( 630 ) #define DDERR_CANTPAGELOCK MAKE_DDHRESULT( 640 ) #define DDERR_CANTPAGEUNLOCK MAKE_DDHRESULT( 660 ) #define DDERR_NOTPAGELOCKED MAKE_DDHRESULT( 680 ) #define DDERR_MOREDATA MAKE_DDHRESULT( 690 ) +#define DDERR_EXPIRED MAKE_DDHRESULT( 691 ) +#define DDERR_TESTFINISHED MAKE_DDHRESULT( 692 ) +#define DDERR_NEWMODE MAKE_DDHRESULT( 693 ) +#define DDERR_D3DNOTINITIALIZED MAKE_DDHRESULT( 694 ) #define DDERR_VIDEONOTACTIVE MAKE_DDHRESULT( 695 ) +#define DDERR_NOMONITORINFORMATION MAKE_DDHRESULT( 696 ) +#define DDERR_NODRIVERSUPPORT MAKE_DDHRESULT( 697 ) #define DDERR_DEVICEDOESNTOWNSURFACE MAKE_DDHRESULT( 699 ) #define DDERR_NOTINITIALIZED CO_E_NOTINITIALIZED @@ -188,17 +213,22 @@ #define DDBLT_ZBUFFERSRCOVERRIDE 0x00800000 #define DDBLT_WAIT 0x01000000 #define DDBLT_DEPTHFILL 0x02000000 +#define DDBLT_DONOTWAIT 0x08000000 /* dwTrans for BltFast */ #define DDBLTFAST_NOCOLORKEY 0x00000000 #define DDBLTFAST_SRCCOLORKEY 0x00000001 #define DDBLTFAST_DESTCOLORKEY 0x00000002 #define DDBLTFAST_WAIT 0x00000010 +#define DDBLTFAST_DONOTWAIT 0x00000020 /* dwFlags for Flip */ -#define DDFLIP_WAIT 0x00000001 -#define DDFLIP_EVEN 0x00000002 /* only valid for overlay */ -#define DDFLIP_ODD 0x00000004 /* only valid for overlay */ +#define DDFLIP_WAIT 0x00000001 +#define DDFLIP_EVEN 0x00000002 /* only valid for overlay */ +#define DDFLIP_ODD 0x00000004 /* only valid for overlay */ +#define DDFLIP_NOVSYNC 0x00000008 +#define DDFLIP_STEREO 0x00000010 +#define DDFLIP_DONOTWAIT 0x00000020 /* dwFlags for GetBltStatus */ #define DDGBS_CANBLT 0x00000001 @@ -269,9 +299,242 @@ DWORD dwCaps; /* capabilities of surface wanted */ } DDSCAPS,*LPDDSCAPS; +/* DDSCAPS2.dwCaps2 */ +/* indicates the surface will receive data from a video port using + deinterlacing hardware. */ +#define DDSCAPS2_HARDWAREDEINTERLACE 0x00000002 +/* indicates the surface will be locked very frequently. */ +#define DDSCAPS2_HINTDYNAMIC 0x00000004 +/* indicates surface can be re-ordered or retiled on load() */ +#define DDSCAPS2_HINTSTATIC 0x00000008 +/* indicates surface to be managed by directdraw/direct3D */ +#define DDSCAPS2_TEXTUREMANAGE 0x00000010 +/* reserved bits */ +#define DDSCAPS2_RESERVED1 0x00000020 +#define DDSCAPS2_RESERVED2 0x00000040 +/* indicates surface will never be locked again */ +#define DDSCAPS2_OPAQUE 0x00000080 +/* set at CreateSurface() time to indicate antialising will be used */ +#define DDSCAPS2_HINTANTIALIASING 0x00000100 +/* set at CreateSurface() time to indicate cubic environment map */ +#define DDSCAPS2_CUBEMAP 0x00000200 +/* face flags for cube maps */ +#define DDSCAPS2_CUBEMAP_POSITIVEX 0x00000400 +#define DDSCAPS2_CUBEMAP_NEGATIVEX 0x00000800 +#define DDSCAPS2_CUBEMAP_POSITIVEY 0x00001000 +#define DDSCAPS2_CUBEMAP_NEGATIVEY 0x00002000 +#define DDSCAPS2_CUBEMAP_POSITIVEZ 0x00004000 +#define DDSCAPS2_CUBEMAP_NEGATIVEZ 0x00008000 +/* specifies all faces of a cube for CreateSurface() */ +#define DDSCAPS2_CUBEMAP_ALLFACES ( DDSCAPS2_CUBEMAP_POSITIVEX |\ + DDSCAPS2_CUBEMAP_NEGATIVEX |\ + DDSCAPS2_CUBEMAP_POSITIVEY |\ + DDSCAPS2_CUBEMAP_NEGATIVEY |\ + DDSCAPS2_CUBEMAP_POSITIVEZ |\ + DDSCAPS2_CUBEMAP_NEGATIVEZ ) +/* set for mipmap sublevels on DirectX7 and later. ignored by CreateSurface() */ +#define DDSCAPS2_MIPMAPSUBLEVEL 0x00010000 +/* indicates texture surface to be managed by Direct3D *only* */ +#define DDSCAPS2_D3DTEXTUREMANAGE 0x00020000 +/* indicates managed surface that can safely be lost */ +#define DDSCAPS2_DONOTPERSIST 0x00040000 +/* indicates surface is part of a stereo flipping chain */ +#define DDSCAPS2_STEREOSURFACELEFT 0x00080000 + +typedef struct _DDSCAPS2 { + DWORD dwCaps; /* capabilities of surface wanted */ + DWORD dwCaps2; /* additional capabilities */ + DWORD dwCaps3; /* reserved capabilities */ + DWORD dwCaps4; /* more reserved capabilities */ +} DDSCAPS2,*LPDDSCAPS2; + #define DD_ROP_SPACE (256/32) /* space required to store ROP array */ + +typedef struct _DDCAPS_DX7 /* DirectX 7 version of caps struct */ +{ + DWORD dwSize; /* size of the DDDRIVERCAPS structure */ + DWORD dwCaps; /* driver specific capabilities */ + DWORD dwCaps2; /* more driver specific capabilites */ + DWORD dwCKeyCaps; /* color key capabilities of the surface */ + DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ + DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ + DWORD dwPalCaps; /* palette capabilities */ + DWORD dwSVCaps; /* stereo vision capabilities */ + DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ + DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ + DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ + DWORD dwVidMemTotal; /* total amount of video memory */ + DWORD dwVidMemFree; /* amount of free video memory */ + DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ + DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ + DWORD dwNumFourCCCodes; /* number of four cc codes */ + DWORD dwAlignBoundarySrc; /* source rectangle alignment */ + DWORD dwAlignSizeSrc; /* source rectangle byte size */ + DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ + DWORD dwAlignSizeDest; /* dest rectangle byte size */ + DWORD dwAlignStrideAlign; /* stride alignment */ + DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ + DDSCAPS ddsOldCaps; /* old DDSCAPS - superceded for DirectX6+ */ + DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwReserved1; + DWORD dwReserved2; + DWORD dwReserved3; + DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ + DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ + DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ + DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */ + DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ + DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ + DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ + DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */ + DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ + DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ + DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ + DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */ + DWORD dwMaxVideoPorts; /* maximum number of usable video ports */ + DWORD dwCurrVideoPorts; /* current number of video ports used */ + DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ + DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ + DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ + DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ + DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ + DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */ + DDSCAPS2 ddsCaps; /* surface capabilities */ +} DDCAPS_DX7,*LPDDCAPS_DX7; + +typedef struct _DDCAPS_DX6 /* DirectX 6 version of caps struct */ +{ + DWORD dwSize; /* size of the DDDRIVERCAPS structure */ + DWORD dwCaps; /* driver specific capabilities */ + DWORD dwCaps2; /* more driver specific capabilites */ + DWORD dwCKeyCaps; /* color key capabilities of the surface */ + DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ + DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ + DWORD dwPalCaps; /* palette capabilities */ + DWORD dwSVCaps; /* stereo vision capabilities */ + DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ + DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ + DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ + DWORD dwVidMemTotal; /* total amount of video memory */ + DWORD dwVidMemFree; /* amount of free video memory */ + DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ + DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ + DWORD dwNumFourCCCodes; /* number of four cc codes */ + DWORD dwAlignBoundarySrc; /* source rectangle alignment */ + DWORD dwAlignSizeSrc; /* source rectangle byte size */ + DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ + DWORD dwAlignSizeDest; /* dest rectangle byte size */ + DWORD dwAlignStrideAlign; /* stride alignment */ + DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ + DDSCAPS ddsOldCaps; /* old DDSCAPS - superceded for DirectX6+ */ + DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwReserved1; + DWORD dwReserved2; + DWORD dwReserved3; + DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ + DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ + DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ + DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */ + DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ + DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ + DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ + DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */ + DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ + DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ + DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ + DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */ + DWORD dwMaxVideoPorts; /* maximum number of usable video ports */ + DWORD dwCurrVideoPorts; /* current number of video ports used */ + DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ + DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ + DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ + DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ + DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ + DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */ + /* and one new member for DirectX 6 */ + DDSCAPS2 ddsCaps; /* surface capabilities */ +} DDCAPS_DX6,*LPDDCAPS_DX6; + +typedef struct _DDCAPS_DX5 /* DirectX5 version of caps struct */ +{ + DWORD dwSize; /* size of the DDDRIVERCAPS structure */ + DWORD dwCaps; /* driver specific capabilities */ + DWORD dwCaps2; /* more driver specific capabilites */ + DWORD dwCKeyCaps; /* color key capabilities of the surface */ + DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ + DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ + DWORD dwPalCaps; /* palette capabilities */ + DWORD dwSVCaps; /* stereo vision capabilities */ + DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ + DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ + DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ + DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ + DWORD dwVidMemTotal; /* total amount of video memory */ + DWORD dwVidMemFree; /* amount of free video memory */ + DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ + DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ + DWORD dwNumFourCCCodes; /* number of four cc codes */ + DWORD dwAlignBoundarySrc; /* source rectangle alignment */ + DWORD dwAlignSizeSrc; /* source rectangle byte size */ + DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ + DWORD dwAlignSizeDest; /* dest rectangle byte size */ + DWORD dwAlignStrideAlign; /* stride alignment */ + DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ + DDSCAPS ddsCaps; /* DDSCAPS structure has all the general capabilities */ + DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ + DWORD dwReserved1; + DWORD dwReserved2; + DWORD dwReserved3; + DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ + DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ + DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ + DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */ + DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ + DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ + DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ + DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */ + DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ + DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ + DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ + DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */ + /* the following are the new DirectX 5 members */ + DWORD dwMaxVideoPorts; /* maximum number of usable video ports */ + DWORD dwCurrVideoPorts; /* current number of video ports used */ + DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ + DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ + DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ + DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ + DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ + DWORD dwNLVBRops[DD_ROP_SPACE]; /* ROPS supported for non-local->local blts */ +} DDCAPS_DX5,*LPDDCAPS_DX5; -typedef struct _DDCAPS_DX3 +typedef struct _DDCAPS_DX3 /* DirectX3 version of caps struct */ { DWORD dwSize; /* size of the DDDRIVERCAPS structure */ DWORD dwCaps; /* driver specific capabilities */ @@ -326,73 +589,20 @@ DWORD dwReserved6; } DDCAPS_DX3,*LPDDCAPS_DX3; -typedef struct _DDCAPS -{ -/* 0*/ DWORD dwSize; /* size of the DDDRIVERCAPS structure */ -/* 4*/ DWORD dwCaps; /* driver specific capabilities */ -/* 8*/ DWORD dwCaps2; /* more driver specific capabilites */ -/* c*/ DWORD dwCKeyCaps; /* color key capabilities of the surface */ -/* 10*/ DWORD dwFXCaps; /* driver specific stretching and effects capabilites */ -/* 14*/ DWORD dwFXAlphaCaps; /* alpha driver specific capabilities */ -/* 18*/ DWORD dwPalCaps; /* palette capabilities */ -/* 1c*/ DWORD dwSVCaps; /* stereo vision capabilities */ -/* 20*/ DWORD dwAlphaBltConstBitDepths; /* DDBD_2,4,8 */ -/* 24*/ DWORD dwAlphaBltPixelBitDepths; /* DDBD_1,2,4,8 */ -/* 28*/ DWORD dwAlphaBltSurfaceBitDepths; /* DDBD_1,2,4,8 */ -/* 2c*/ DWORD dwAlphaOverlayConstBitDepths; /* DDBD_2,4,8 */ -/* 30*/ DWORD dwAlphaOverlayPixelBitDepths; /* DDBD_1,2,4,8 */ -/* 34*/ DWORD dwAlphaOverlaySurfaceBitDepths; /* DDBD_1,2,4,8 */ -/* 38*/ DWORD dwZBufferBitDepths; /* DDBD_8,16,24,32 */ -/* 3c*/ DWORD dwVidMemTotal; /* total amount of video memory */ -/* 40*/ DWORD dwVidMemFree; /* amount of free video memory */ -/* 44*/ DWORD dwMaxVisibleOverlays; /* maximum number of visible overlays */ -/* 48*/ DWORD dwCurrVisibleOverlays; /* current number of visible overlays */ -/* 4c*/ DWORD dwNumFourCCCodes; /* number of four cc codes */ -/* 50*/ DWORD dwAlignBoundarySrc; /* source rectangle alignment */ -/* 54*/ DWORD dwAlignSizeSrc; /* source rectangle byte size */ -/* 58*/ DWORD dwAlignBoundaryDest; /* dest rectangle alignment */ -/* 5c*/ DWORD dwAlignSizeDest; /* dest rectangle byte size */ -/* 60*/ DWORD dwAlignStrideAlign; /* stride alignment */ -/* 64*/ DWORD dwRops[DD_ROP_SPACE]; /* ROPS supported */ -/* 84*/ DDSCAPS ddsCaps; /* DDSCAPS structure has all the general capabilities */ -/* 88*/ DWORD dwMinOverlayStretch; /* minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ -/* 8c*/ DWORD dwMaxOverlayStretch; /* maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ -/* 90*/ DWORD dwMinLiveVideoStretch; /* minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ -/* 94*/ DWORD dwMaxLiveVideoStretch; /* maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ -/* 98*/ DWORD dwMinHwCodecStretch; /* minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ -/* 9c*/ DWORD dwMaxHwCodecStretch; /* maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 */ -/* a0*/ DWORD dwReserved1; -/* a4*/ DWORD dwReserved2; -/* a8*/ DWORD dwReserved3; -/* ac*/ DWORD dwSVBCaps; /* driver specific capabilities for System->Vmem blts */ -/* b0*/ DWORD dwSVBCKeyCaps; /* driver color key capabilities for System->Vmem blts */ -/* b4*/ DWORD dwSVBFXCaps; /* driver FX capabilities for System->Vmem blts */ -/* b8*/ DWORD dwSVBRops[DD_ROP_SPACE];/* ROPS supported for System->Vmem blts */ -/* d8*/ DWORD dwVSBCaps; /* driver specific capabilities for Vmem->System blts */ -/* dc*/ DWORD dwVSBCKeyCaps; /* driver color key capabilities for Vmem->System blts */ -/* e0*/ DWORD dwVSBFXCaps; /* driver FX capabilities for Vmem->System blts */ -/* e4*/ DWORD dwVSBRops[DD_ROP_SPACE];/* ROPS supported for Vmem->System blts */ -/*104*/ DWORD dwSSBCaps; /* driver specific capabilities for System->System blts */ -/*108*/ DWORD dwSSBCKeyCaps; /* driver color key capabilities for System->System blts */ -/*10c*/ DWORD dwSSBFXCaps; /* driver FX capabilities for System->System blts */ -/*110*/ DWORD dwSSBRops[DD_ROP_SPACE];/* ROPS supported for System->System blts */ -#if DIRECTDRAW_VERSION >= 0x0500 -/*130*/ DWORD dwMaxVideoPorts; /* maximum number of usable video ports */ -/*134*/ DWORD dwCurrVideoPorts;/* current number of video ports used */ -/*138*/ DWORD dwSVBCaps2; /* more driver specific capabilities for System->Vmem blts */ -/*13c*/ DWORD dwNLVBCaps; /* driver specific capabilities for non-local->local vidmem blts */ -/*140*/ DWORD dwNLVBCaps2; /* more driver specific capabilities non-local->local vidmem blts */ -/*144*/ DWORD dwNLVBCKeyCaps; /* driver color key capabilities for non-local->local vidmem blts */ -/*148*/ DWORD dwNLVBFXCaps; /* driver FX capabilities for non-local->local blts */ -/*14c*/ DWORD dwNLVBRops[DD_ROP_SPACE];/* ROPS supported for non-local->local blts */ -#else /* DIRECTDRAW_VERSION >= 0x0500 */ -/*130*/ DWORD dwReserved4; -/*134*/ DWORD dwReserved5; -/*138*/ DWORD dwReserved6; -#endif /* DIRECTDRAW_VERSION >= 0x0500 */ -} DDCAPS,*LPDDCAPS; +/* set caps struct according to DIRECTDRAW_VERSION */ +#if DIRECTDRAW_VERSION <= 0x300 +typedef DDCAPS_DX3 DDCAPS; +#elif DIRECTDRAW_VERSION <= 0x500 +typedef DDCAPS_DX5 DDCAPS; +#elif DIRECTDRAW_VERSION <= 0x600 +typedef DDCAPS_DX6 DDCAPS; +#else +typedef DDCAPS_DX7 DDCAPS; +#endif +typedef DDCAPS *LPDDCAPS; + /* DDCAPS.dwCaps */ #define DDCAPS_3D 0x00000001 #define DDCAPS_ALIGNBOUNDARYDEST 0x00000002 @@ -443,6 +653,16 @@ #define DDCAPS2_WIDESURFACES 0x00001000 #define DDCAPS2_CANFLIPODDEVEN 0x00002000 #define DDCAPS2_CANBOBHARDWARE 0x00004000 +#define DDCAPS2_COPYFOURCC 0x00008000 +#define DDCAPS2_PRIMARYGAMMA 0x00020000 +#define DDCAPS2_CANRENDERWINDOWED 0x00080000 +#define DDCAPS2_CANCALIBRATEGAMMA 0x00100000 +#define DDCAPS2_FLIPINTERVAL 0x00200000 +#define DDCAPS2_FLIPNOVSYNC 0x00400000 +#define DDCAPS2_CANMANAGETEXTURE 0x00800000 +#define DDCAPS2_TEXMANINNONLOCALVIDMEM 0x01000000 +#define DDCAPS2_STEREO 0x02000000 +#define DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL 0x04000000 /* Set/Get Colour Key Flags */ @@ -492,31 +712,33 @@ DWORD dwYUVBitCount; /* C: how many bits per pixel */ DWORD dwZBufferBitDepth; /* C: how many bits for z buffers */ DWORD dwAlphaBitDepth; /* C: how many bits for alpha channels*/ - } x; + } DUMMYUNIONNAME; union { DWORD dwRBitMask; /* 10: mask for red bit*/ DWORD dwYBitMask; /* 10: mask for Y bits*/ - } y; + } DUMMYUNIONNAME2; union { DWORD dwGBitMask; /* 14: mask for green bits*/ DWORD dwUBitMask; /* 14: mask for U bits*/ - } z; + } DUMMYUNIONNAME3; union { DWORD dwBBitMask; /* 18: mask for blue bits*/ DWORD dwVBitMask; /* 18: mask for V bits*/ - } xx; + } DUMMYUNIONNAME4; union { DWORD dwRGBAlphaBitMask; /* 1C: mask for alpha channel */ DWORD dwYUVAlphaBitMask; /* 1C: mask for alpha channel */ DWORD dwRGBZBitMask; /* 1C: mask for Z channel */ DWORD dwYUVZBitMask; /* 1C: mask for Z channel */ - } xy; + } DUMMYUNIONNAME5; /* 20: next structure */ } DDPIXELFORMAT,*LPDDPIXELFORMAT; /* DDCAPS.dwFXCaps */ -#define DDFXCAPS_BLTARITHSTRETCHY 0x00000020 +#define DDFXCAPS_BLTALPHA 0x00000001 +#define DDFXCAPS_OVERLAYALPHA 0x00000004 #define DDFXCAPS_BLTARITHSTRETCHYN 0x00000010 +#define DDFXCAPS_BLTARITHSTRETCHY 0x00000020 #define DDFXCAPS_BLTMIRRORLEFTRIGHT 0x00000040 #define DDFXCAPS_BLTMIRRORUPDOWN 0x00000080 #define DDFXCAPS_BLTROTATION 0x00000100 @@ -542,6 +764,8 @@ #define DDFXCAPS_OVERLAYMIRRORLEFTRIGHT 0x08000000 #define DDFXCAPS_OVERLAYMIRRORUPDOWN 0x10000000 +#define DDFXCAPS_OVERLAYFILTER DDFXCAPS_OVERLAYARITHSTRETCHY + /* DDCAPS.dwFXAlphaCaps */ #define DDFXALPHACAPS_BLTALPHAEDGEBLEND 0x00000001 #define DDFXALPHACAPS_BLTALPHAPIXELS 0x00000002 @@ -568,10 +792,19 @@ #define DDPCAPS_ALPHA 0x00000400 /* DDCAPS.dwSVCaps */ -#define DDSVCAPS_ENIGMA 0x00000001l -#define DDSVCAPS_FLICKER 0x00000002l -#define DDSVCAPS_REDBLUE 0x00000004l -#define DDSVCAPS_SPLIT 0x00000008l +/* the first 4 of these are now obsolete */ +#if DIRECTDRAW_VERSION >= 0x700 /* FIXME: I'm not sure when this switch occured */ +#define DDSVCAPS_RESERVED1 0x00000001 +#define DDSVCAPS_RESERVED2 0x00000002 +#define DDSVCAPS_RESERVED3 0x00000004 +#define DDSVCAPS_RESERVED4 0x00000008 +#else +#define DDSVCAPS_ENIGMA 0x00000001 +#define DDSVCAPS_FLICKER 0x00000002 +#define DDSVCAPS_REDBLUE 0x00000004 +#define DDSVCAPS_SPLIT 0x00000008 +#endif +#define DDSVCAPS_STEREOSEQUENTIAL 0x00000010 /* BitDepths */ #define DDBD_1 0x00004000 @@ -587,6 +820,31 @@ #define DDOVERFX_MIRRORLEFTRIGHT 0x00000002 #define DDOVERFX_MIRRORUPDOWN 0x00000004 +/* UpdateOverlay flags */ +#define DDOVER_ALPHADEST 0x00000001 +#define DDOVER_ALPHADESTCONSTOVERRIDE 0x00000002 +#define DDOVER_ALPHADESTNEG 0x00000004 +#define DDOVER_ALPHADESTSURFACEOVERRIDE 0x00000008 +#define DDOVER_ALPHAEDGEBLEND 0x00000010 +#define DDOVER_ALPHASRC 0x00000020 +#define DDOVER_ALPHASRCCONSTOVERRIDE 0x00000040 +#define DDOVER_ALPHASRCNEG 0x00000080 +#define DDOVER_ALPHASRCSURFACEOVERRIDE 0x00000100 +#define DDOVER_HIDE 0x00000200 +#define DDOVER_KEYDEST 0x00000400 +#define DDOVER_KEYDESTOVERRIDE 0x00000800 +#define DDOVER_KEYSRC 0x00001000 +#define DDOVER_KEYSRCOVERRIDE 0x00002000 +#define DDOVER_SHOW 0x00004000 +#define DDOVER_ADDDIRTYRECT 0x00008000 +#define DDOVER_REFRESHDIRTYRECTS 0x00010000 +#define DDOVER_REFRESHALL 0x00020000 +#define DDOVER_DDFX 0x00080000 +#define DDOVER_AUTOFLIP 0x00100000 +#define DDOVER_BOB 0x00200000 +#define DDOVER_OVERRIDEBOBWEAVE 0x00400000 +#define DDOVER_INTERLEAVED 0x00800000 + /* DDCOLORKEY.dwFlags */ #define DDPF_ALPHAPIXELS 0x00000001 #define DDPF_ALPHA 0x00000002 @@ -602,6 +860,11 @@ #define DDPF_PALETTEINDEXED1 0x00000800 #define DDPF_PALETTEINDEXED2 0x00001000 #define DDPF_ZPIXELS 0x00002000 +#define DDPF_STENCILBUFFER 0x00004000 +#define DDPF_ALPHAPREMULT 0x00008000 +#define DDPF_LUMINANCE 0x00020000 +#define DDPF_BUMPLUMINANCE 0x00040000 +#define DDPF_BUMPDUDV 0x00080000 /* SetCooperativeLevel dwFlags */ #define DDSCL_FULLSCREEN 0x00000001 @@ -613,6 +876,9 @@ #define DDSCL_SETFOCUSWINDOW 0x00000080 #define DDSCL_SETDEVICEWINDOW 0x00000100 #define DDSCL_CREATEDEVICEWINDOW 0x00000200 +#define DDSCL_MULTITHREADED 0x00000400 +#define DDSCL_FPUSETUP 0x00000800 +#define DDSCL_FPUPRESERVE 0x00001000 /* DDSURFACEDESC.dwFlags */ @@ -632,7 +898,10 @@ #define DDSD_MIPMAPCOUNT 0x00020000 #define DDSD_REFRESHRATE 0x00040000 #define DDSD_LINEARSIZE 0x00080000 -#define DDSD_ALL 0x000ff9ee +#define DDSD_TEXTURESTAGE 0x00100000 +#define DDSD_FVF 0x00200000 +#define DDSD_SRCVBHANDLE 0x00400000 +#define DDSD_ALL 0x007ff9ee /* EnumSurfaces flags */ #define DDENUMSURFACES_ALL 0x00000001 @@ -648,26 +917,32 @@ #define DDEDM_REFRESHRATES 0x00000001 #define DDEDM_STANDARDVGAMODES 0x00000002 +/* WaitForVerticalDisplay flags */ +#define DDWAITVB_BLOCKBEGIN 0x00000001 +#define DDWAITVB_BLOCKBEGINEVENT 0x00000002 +#define DDWAITVB_BLOCKEND 0x00000004 + +#if 0 typedef struct _DDSURFACEDESC { DWORD dwSize; /* 0: size of the DDSURFACEDESC structure*/ DWORD dwFlags; /* 4: determines what fields are valid*/ DWORD dwHeight; /* 8: height of surface to be created*/ DWORD dwWidth; /* C: width of input surface*/ - LONG lPitch; /*10: distance to start of next line (return value only)*/ - DWORD dwBackBufferCount;/* 14: number of back buffers requested*/ + LONG lPitch; /*10: distance to start of next line (return value only)*/ + DWORD dwBackBufferCount;/* 14: number of back buffers requested*/ union { DWORD dwMipMapCount;/* 18:number of mip-map levels requested*/ DWORD dwZBufferBitDepth;/*18: depth of Z buffer requested*/ DWORD dwRefreshRate;/* 18:refresh rate (used when display mode is described)*/ - } x; + } DUMMYUNIONNAME; DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/ DWORD dwReserved; /* 20:reserved*/ - union { - LPVOID lpSurface; /* 24:pointer to the associated surface memory*/ - DWORD dwLinearSize; /* 24:Formless late-allocated optimized surface size*/ - } y; + union { + DWORD dwLinearSize; + LPVOID lpSurface; /* 24:pointer to the associated surface memory*/ + } DUMMYUNIONNAME2; DDCOLORKEY ddckCKDestOverlay;/* 28: CK for dest overlay use*/ DDCOLORKEY ddckCKDestBlt; /* 30: CK for destination blt use*/ DDCOLORKEY ddckCKSrcOverlay;/* 38: CK for source overlay use*/ @@ -675,7 +950,67 @@ DDPIXELFORMAT ddpfPixelFormat;/* 48: pixel format description of the surface*/ DDSCAPS ddsCaps; /* 68: direct draw surface caps */ } DDSURFACEDESC,*LPDDSURFACEDESC; +#endif +typedef struct _DDSURFACEDESC +{ + DWORD dwSize; + DWORD dwFlags; + DWORD dwHeight; + DWORD dwWidth; + union + { + LONG lPitch; + DWORD dwLinearSize; + } DUMMYUNIONNAME; + DWORD dwBackBufferCount; + union + { + DWORD dwMipMapCount; + DWORD dwZBufferBitDepth; + DWORD dwRefreshRate; + } DUMMYUNIONNAME2; + DWORD dwAlphaBitDepth; + DWORD dwReserved; + LPVOID lpSurface; + DDCOLORKEY ddckCKDestOverlay; + DDCOLORKEY ddckCKDestBlt; + DDCOLORKEY ddckCKSrcOverlay; + DDCOLORKEY ddckCKSrcBlt; + DDPIXELFORMAT ddpfPixelFormat; + DDSCAPS ddsCaps; +} DDSURFACEDESC, FAR* LPDDSURFACEDESC; + +typedef struct _DDSURFACEDESC2 +{ + DWORD dwSize; /* 0: size of the DDSURFACEDESC structure*/ + DWORD dwFlags; /* 4: determines what fields are valid*/ + DWORD dwHeight; /* 8: height of surface to be created*/ + DWORD dwWidth; /* C: width of input surface*/ + union { + LONG lPitch; /*10: distance to start of next line (return value only)*/ + DWORD dwLinearSize; /*10: formless late-allocated optimized surface size */ + } DUMMYUNIONNAME; + DWORD dwBackBufferCount;/* 14: number of back buffers requested*/ + union { + DWORD dwMipMapCount;/* 18:number of mip-map levels requested*/ + DWORD dwRefreshRate;/* 18:refresh rate (used when display mode is described)*/ + } DUMMYUNIONNAME2; + DWORD dwAlphaBitDepth;/* 1C:depth of alpha buffer requested*/ + DWORD dwReserved; /* 20:reserved*/ + LPVOID lpSurface; /* 24:pointer to the associated surface memory*/ + union { + DDCOLORKEY ddckCKDestOverlay; /* 28: CK for dest overlay use*/ + DWORD dwEmptyFaceColor; /* 28: color for empty cubemap faces */ + } DUMMYUNIONNAME3; + DDCOLORKEY ddckCKDestBlt; /* 2C: CK for destination blt use*/ + DDCOLORKEY ddckCKSrcOverlay;/* 30: CK for source overlay use*/ + DDCOLORKEY ddckCKSrcBlt; /* 34: CK for source blt use*/ + DDPIXELFORMAT ddpfPixelFormat;/* 38: pixel format description of the surface*/ + DDSCAPS2 ddsCaps; /* 3C: DDraw surface caps */ + DWORD dwTextureStage; /* 40: stage in multitexture cascade */ +} DDSURFACEDESC2,*LPDDSURFACEDESC2; + /* DDCOLORCONTROL.dwFlags */ #define DDCOLOR_BRIGHTNESS 0x00000001 #define DDCOLOR_CONTRAST 0x00000002 @@ -698,19 +1033,22 @@ DWORD dwReserved1; } DDCOLORCONTROL,*LPDDCOLORCONTROL; -typedef BOOL (CALLBACK * LPDDENUMCALLBACKA)(GUID *, LPSTR, LPSTR, LPVOID); -typedef BOOL (CALLBACK * LPDDENUMCALLBACKW)(GUID *, LPWSTR, LPWSTR, LPVOID); +typedef BOOL CALLBACK (*LPDDENUMCALLBACKA)(GUID *, LPSTR, LPSTR, LPVOID); +typedef BOOL CALLBACK (*LPDDENUMCALLBACKW)(GUID *, LPWSTR, LPWSTR, LPVOID); DECL_WINELIB_TYPE_AW(LPDDENUMCALLBACK) -typedef HRESULT (CALLBACK * LPDDENUMMODESCALLBACK)(LPDDSURFACEDESC, LPVOID); -typedef HRESULT (CALLBACK * LPDDENUMSURFACESCALLBACK)(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID); +typedef HRESULT CALLBACK (*LPDDENUMMODESCALLBACK)(LPDDSURFACEDESC, LPVOID); +typedef HRESULT CALLBACK (*LPDDENUMMODESCALLBACK7)(LPDDSURFACEDESC2, LPVOID); +typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK)(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID); +typedef HRESULT CALLBACK (*LPDDENUMSURFACESCALLBACK7)(LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID); -typedef BOOL (CALLBACK * LPDDENUMCALLBACKEXA)(GUID *, LPSTR, LPSTR, LPVOID, HMONITOR); -typedef BOOL (CALLBACK * LPDDENUMCALLBACKEXW)(GUID *, LPWSTR, LPWSTR, LPVOID, HMONITOR); +typedef BOOL CALLBACK (*LPDDENUMCALLBACKEXA)(GUID *, LPSTR, LPSTR, LPVOID, HMONITOR); +typedef BOOL CALLBACK (*LPDDENUMCALLBACKEXW)(GUID *, LPWSTR, LPWSTR, LPVOID, HMONITOR); DECL_WINELIB_TYPE_AW(LPDDENUMCALLBACKEX) HRESULT WINAPI DirectDrawEnumerateExA( LPDDENUMCALLBACKEXA lpCallback, LPVOID lpContext, DWORD dwFlags); HRESULT WINAPI DirectDrawEnumerateExW( LPDDENUMCALLBACKEXW lpCallback, LPVOID lpContext, DWORD dwFlags); +#define DirectDrawEnumerateEx WINELIB_NAME_AW(DirectDrawEnumerateEx) /* flags for DirectDrawEnumerateEx */ #define DDENUM_ATTACHEDSECONDARYDEVICES 0x00000001 @@ -733,13 +1071,13 @@ { DWORD dwZDestConst; /* Constant to use as Z buffer for dest */ LPDIRECTDRAWSURFACE lpDDSZBufferDest; /* Surface to use as Z buffer for dest */ - } x; + } DUMMYUNIONNAME; DWORD dwZSrcConstBitDepth; /* Bit depth used to specify Z constant for source */ union { DWORD dwZSrcConst; /* Constant to use as Z buffer for src */ LPDIRECTDRAWSURFACE lpDDSZBufferSrc; /* Surface to use as Z buffer for src */ - } y; + } DUMMYUNIONNAME2; DWORD dwAlphaEdgeBlendBitDepth; /* Bit depth used to specify constant for alpha edge blend */ DWORD dwAlphaEdgeBlend; /* Alpha for edge blending */ DWORD dwReserved; @@ -748,20 +1086,20 @@ { DWORD dwAlphaDestConst; /* Constant to use as Alpha Channel */ LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as Alpha Channel */ - } z; + } DUMMYUNIONNAME3; DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ union { DWORD dwAlphaSrcConst; /* Constant to use as Alpha Channel */ LPDIRECTDRAWSURFACE lpDDSAlphaSrc; /* Surface to use as Alpha Channel */ - } a; + } DUMMYUNIONNAME4; union { DWORD dwFillColor; /* color in RGB or Palettized */ DWORD dwFillDepth; /* depth value for z-buffer */ DWORD dwFillPixel; /* pixel val for RGBA or RGBZ */ LPDIRECTDRAWSURFACE lpDDSPattern; /* Surface to use as pattern */ - } b; + } DUMMYUNIONNAME5; DDCOLORKEY ddckDestColorkey; /* DestColorkey override */ DDCOLORKEY ddckSrcColorkey; /* SrcColorkey override */ } DDBLTFX,*LPDDBLTFX; @@ -797,13 +1135,13 @@ { DWORD dwAlphaDestConst; /* Constant to use as alpha channel for dest */ LPDIRECTDRAWSURFACE lpDDSAlphaDest; /* Surface to use as alpha channel for dest */ - } x; + } DUMMYUNIONNAME; DWORD dwAlphaSrcConstBitDepth; /* Bit depth used to specify alpha constant for source */ union { DWORD dwAlphaSrcConst; /* Constant to use as alpha channel for src */ LPDIRECTDRAWSURFACE lpDDSAlphaSrc; /* Surface to use as alpha channel for src */ - } y; + } DUMMYUNIONNAME2; DDCOLORKEY dckDestColorkey; /* DestColorkey override */ DDCOLORKEY dckSrcColorkey; /* DestColorkey override */ DWORD dwDDFX; /* Overlay FX */ @@ -832,6 +1170,17 @@ GUID guidDeviceIdentifier; } DDDEVICEIDENTIFIER, * LPDDDEVICEIDENTIFIER; +typedef struct tagDDDEVICEIDENTIFIER2 { + char szDriver[MAX_DDDEVICEID_STRING]; /* user readable driver name */ + char szDescription[MAX_DDDEVICEID_STRING]; /* user readable description */ + LARGE_INTEGER liDriverVersion; /* driver version */ + DWORD dwVendorId; /* vendor ID, zero if unknown */ + DWORD dwDeviceId; /* chipset ID, zero if unknown */ + DWORD dwSubSysId; /* board ID, zero if unknown */ + DWORD dwRevision; /* chipset version, zero if unknown */ + GUID guidDeviceIdentifier; /* unique ID for this driver/chipset combination */ + DWORD dwWHQLLevel; /* Windows Hardware Quality Lab certification level */ +} DDDEVICEIDENTIFIER2, * LPDDDEVICEIDENTIFIER2; /***************************************************************************** * IDirectDrawPalette interface @@ -848,7 +1197,6 @@ ICOM_DEFINE(IDirectDrawPalette,IUnknown) #undef ICOM_INTERFACE -#ifdef ICOM_CINTERFACE /*** IUnknown methods ***/ #define IDirectDrawPalette_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) #define IDirectDrawPalette_AddRef(p) ICOM_CALL (AddRef,p) @@ -858,7 +1206,6 @@ #define IDirectDrawPalette_GetEntries(p,a,b,c,d) ICOM_CALL4(GetEntries,p,a,b,c,d) #define IDirectDrawPalette_Initialize(p,a,b,c) ICOM_CALL3(Initialize,p,a,b,c) #define IDirectDrawPalette_SetEntries(p,a,b,c,d) ICOM_CALL4(SetEntries,p,a,b,c,d) -#endif /***************************************************************************** @@ -878,7 +1225,6 @@ ICOM_DEFINE(IDirectDrawClipper,IUnknown) #undef ICOM_INTERFACE -#ifdef ICOM_CINTERFACE /*** IUnknown methods ***/ #define IDirectDrawClipper_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) #define IDirectDrawClipper_AddRef(p) ICOM_CALL (AddRef,p) @@ -890,7 +1236,6 @@ #define IDirectDrawClipper_IsClipListChanged(p,a) ICOM_CALL1(IsClipListChanged,p,a) #define IDirectDrawClipper_SetClipList(p,a,b) ICOM_CALL2(SetClipList,p,a,b) #define IDirectDrawClipper_SetHWnd(p,a,b) ICOM_CALL2(SetHWnd,p,a,b) -#endif /***************************************************************************** @@ -924,7 +1269,6 @@ ICOM_DEFINE(IDirectDraw,IUnknown) #undef ICOM_INTERFACE -#ifdef ICOM_CINTERFACE /*** IUnknown methods ***/ #define IDirectDraw_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) #define IDirectDraw_AddRef(p) ICOM_CALL (AddRef,p) @@ -950,7 +1294,6 @@ #define IDirectDraw_SetCooperativeLevel(p,a,b) ICOM_CALL2(SetCooperativeLevel,p,a,b) #define IDirectDraw_SetDisplayMode(p,a,b,c) ICOM_CALL3(SetDisplayMode,p,a,b,c) #define IDirectDraw_WaitForVerticalBlank(p,a,b) ICOM_CALL2(WaitForVerticalBlank,p,a,b) -#endif /* flags for Lock() */ @@ -970,35 +1313,34 @@ */ #define ICOM_INTERFACE IDirectDraw2 #define IDirectDraw2_METHODS \ - ICOM_METHOD (HRESULT,Compact) \ - ICOM_METHOD3(HRESULT,CreateClipper, DWORD,dwFlags, LPDIRECTDRAWCLIPPER*,lplpDDClipper, IUnknown*,pUnkOuter) \ - ICOM_METHOD4(HRESULT,CreatePalette, DWORD,dwFlags, LPPALETTEENTRY,lpColorTable, LPDIRECTDRAWPALETTE*,lplpDDPalette, IUnknown*,pUnkOuter) \ - ICOM_METHOD3(HRESULT,CreateSurface, LPDDSURFACEDESC,lpDDSurfaceDesc, LPDIRECTDRAWSURFACE*,lplpDDSurface, IUnknown*,pUnkOuter) \ - ICOM_METHOD2(HRESULT,DuplicateSurface, LPDIRECTDRAWSURFACE,lpDDSurface, LPDIRECTDRAWSURFACE*,lplpDupDDSurface) \ - ICOM_METHOD4(HRESULT,EnumDisplayModes, DWORD,dwFlags, LPDDSURFACEDESC,lpDDSurfaceDesc, LPVOID,lpContext, LPDDENUMMODESCALLBACK,lpEnumModesCallback) \ - ICOM_METHOD4(HRESULT,EnumSurfaces, DWORD,dwFlags, LPDDSURFACEDESC,lpDDSD, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ - ICOM_METHOD (HRESULT,FlipToGDISurface) \ - ICOM_METHOD2(HRESULT,GetCaps, LPDDCAPS,lpDDDriverCaps, LPDDCAPS,lpDDHELCaps) \ - ICOM_METHOD1(HRESULT,GetDisplayMode, LPDDSURFACEDESC,lpDDSurfaceDesc) \ - ICOM_METHOD2(HRESULT,GetFourCCCodes, LPDWORD,lpNumCodes, LPDWORD,lpCodes) \ - ICOM_METHOD1(HRESULT,GetGDISurface, LPDIRECTDRAWSURFACE*,lplpGDIDDSurface) \ - ICOM_METHOD1(HRESULT,GetMonitorFrequency, LPDWORD,lpdwFrequency) \ - ICOM_METHOD1(HRESULT,GetScanLine, LPDWORD,lpdwScanLine) \ - ICOM_METHOD1(HRESULT,GetVerticalBlankStatus, BOOL*,lpbIsInVB) \ - ICOM_METHOD1(HRESULT,Initialize, GUID*,lpGUID) \ - ICOM_METHOD (HRESULT,RestoreDisplayMode) \ - ICOM_METHOD2(HRESULT,SetCooperativeLevel, HWND,hWnd, DWORD,dwFlags) \ - ICOM_METHOD5(HRESULT,SetDisplayMode, DWORD,dwWidth, DWORD,dwHeight, DWORD,dwBPP, DWORD,dwRefreshRate, DWORD,dwFlags) \ - ICOM_METHOD2(HRESULT,WaitForVerticalBlank, DWORD,dwFlags, HANDLE,hEvent) \ - /* added in v2 */ \ - ICOM_METHOD3(HRESULT,GetAvailableVidMem, LPDDSCAPS,lpDDCaps, LPDWORD,lpdwTotal, LPDWORD,lpdwFree) +/*0c*/ ICOM_METHOD (HRESULT,Compact) \ +/*10*/ ICOM_METHOD3(HRESULT,CreateClipper, DWORD,dwFlags, LPDIRECTDRAWCLIPPER*,lplpDDClipper, IUnknown*,pUnkOuter) \ +/*14*/ ICOM_METHOD4(HRESULT,CreatePalette, DWORD,dwFlags, LPPALETTEENTRY,lpColorTable, LPDIRECTDRAWPALETTE*,lplpDDPalette, IUnknown*,pUnkOuter) \ +/*18*/ ICOM_METHOD3(HRESULT,CreateSurface, LPDDSURFACEDESC,lpDDSurfaceDesc, LPDIRECTDRAWSURFACE*,lplpDDSurface, IUnknown*,pUnkOuter) \ +/*1c*/ ICOM_METHOD2(HRESULT,DuplicateSurface, LPDIRECTDRAWSURFACE,lpDDSurface, LPDIRECTDRAWSURFACE*,lplpDupDDSurface) \ +/*20*/ ICOM_METHOD4(HRESULT,EnumDisplayModes, DWORD,dwFlags, LPDDSURFACEDESC,lpDDSurfaceDesc, LPVOID,lpContext, LPDDENUMMODESCALLBACK,lpEnumModesCallback) \ +/*24*/ ICOM_METHOD4(HRESULT,EnumSurfaces, DWORD,dwFlags, LPDDSURFACEDESC,lpDDSD, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ +/*28*/ ICOM_METHOD (HRESULT,FlipToGDISurface) \ +/*2c*/ ICOM_METHOD2(HRESULT,GetCaps, LPDDCAPS,lpDDDriverCaps, LPDDCAPS,lpDDHELCaps) \ +/*30*/ ICOM_METHOD1(HRESULT,GetDisplayMode, LPDDSURFACEDESC,lpDDSurfaceDesc) \ +/*34*/ ICOM_METHOD2(HRESULT,GetFourCCCodes, LPDWORD,lpNumCodes, LPDWORD,lpCodes) \ +/*38*/ ICOM_METHOD1(HRESULT,GetGDISurface, LPDIRECTDRAWSURFACE*,lplpGDIDDSurface) \ +/*3c*/ ICOM_METHOD1(HRESULT,GetMonitorFrequency, LPDWORD,lpdwFrequency) \ +/*40*/ ICOM_METHOD1(HRESULT,GetScanLine, LPDWORD,lpdwScanLine) \ +/*44*/ ICOM_METHOD1(HRESULT,GetVerticalBlankStatus, BOOL*,lpbIsInVB) \ +/*48*/ ICOM_METHOD1(HRESULT,Initialize, GUID*,lpGUID) \ +/*4c*/ ICOM_METHOD (HRESULT,RestoreDisplayMode) \ +/*50*/ ICOM_METHOD2(HRESULT,SetCooperativeLevel, HWND,hWnd, DWORD,dwFlags) \ +/*54*/ ICOM_METHOD5(HRESULT,SetDisplayMode, DWORD,dwWidth, DWORD,dwHeight, DWORD,dwBPP, DWORD,dwRefreshRate, DWORD,dwFlags) \ +/*58*/ ICOM_METHOD2(HRESULT,WaitForVerticalBlank, DWORD,dwFlags, HANDLE,hEvent) \ + /* added in v2 */ \ +/*5c*/ ICOM_METHOD3(HRESULT,GetAvailableVidMem, LPDDSCAPS,lpDDCaps, LPDWORD,lpdwTotal, LPDWORD,lpdwFree) #define IDirectDraw2_IMETHODS \ IUnknown_IMETHODS \ IDirectDraw2_METHODS ICOM_DEFINE(IDirectDraw2,IUnknown) #undef ICOM_INTERFACE -#ifdef ICOM_CINTERFACE /*** IUnknown methods ***/ #define IDirectDraw2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) #define IDirectDraw2_AddRef(p) ICOM_CALL (AddRef,p) @@ -1026,7 +1368,6 @@ #define IDirectDraw2_WaitForVerticalBlank(p,a,b) ICOM_CALL2(WaitForVerticalBlank,p,a,b) /*** IDirectDraw2 methods ***/ #define IDirectDraw2_GetAvailableVidMem(p,a,b,c) ICOM_CALL3(GetAvailableVidMem,p,a,b,c) -#endif /***************************************************************************** @@ -1044,7 +1385,6 @@ ICOM_DEFINE(IDirectDraw4,IDirectDraw2) #undef ICOM_INTERFACE -#ifdef ICOM_CINTERFACE /*** IUnknown methods ***/ #define IDirectDraw4_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) #define IDirectDraw4_AddRef(p) ICOM_CALL (AddRef,p) @@ -1068,7 +1408,7 @@ #define IDirectDraw4_Initialize(p,a) ICOM_CALL1(Initialize,p,a) #define IDirectDraw4_RestoreDisplayMode(p) ICOM_CALL (RestoreDisplayMode,p) #define IDirectDraw4_SetCooperativeLevel(p,a,b) ICOM_CALL2(SetCooperativeLevel,p,a,b) -#define IDirectDraw4_SetDisplayMode(p,a,b,c) ICOM_CALL3(SetDisplayMode,p,a,b,c) +#define IDirectDraw4_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL5(SetDisplayMode,p,a,b,c,d,e) #define IDirectDraw4_WaitForVerticalBlank(p,a,b) ICOM_CALL2(WaitForVerticalBlank,p,a,b) /*** IDirectDraw2 methods ***/ #define IDirectDraw4_GetAvailableVidMem(p,a,b,c) ICOM_CALL3(GetAvailableVidMem,p,a,b,c) @@ -1077,54 +1417,133 @@ #define IDirectDraw4_RestoreAllSurfaces(pc) ICOM_CALL (RestoreAllSurfaces,p) #define IDirectDraw4_TestCooperativeLevel(p) ICOM_CALL (TestCooperativeLevel,p) #define IDirectDraw4_GetDeviceIdentifier(p,a,b) ICOM_CALL2(GetDeviceIdentifier,p,a,b) -#endif /***************************************************************************** + * IDirectDraw7 interface + */ +/* Note: IDirectDraw7 cannot derive from IDirectDraw4; it is even documented + * as not interchangeable with earlier DirectDraw interfaces. + */ +#define ICOM_INTERFACE IDirectDraw7 +#define IDirectDraw7_METHODS \ +/*0c*/ ICOM_METHOD (HRESULT,Compact) \ +/*10*/ ICOM_METHOD3(HRESULT,CreateClipper, DWORD,dwFlags, LPDIRECTDRAWCLIPPER*,lplpDDClipper, IUnknown*,pUnkOuter) \ +/*14*/ ICOM_METHOD4(HRESULT,CreatePalette, DWORD,dwFlags, LPPALETTEENTRY,lpColorTable, LPDIRECTDRAWPALETTE*,lplpDDPalette, IUnknown*,pUnkOuter) \ +/*18*/ ICOM_METHOD3(HRESULT,CreateSurface, LPDDSURFACEDESC2,lpDDSurfaceDesc, LPDIRECTDRAWSURFACE7*,lplpDDSurface, IUnknown*,pUnkOuter) \ +/*1c*/ ICOM_METHOD2(HRESULT,DuplicateSurface, LPDIRECTDRAWSURFACE7,lpDDSurface, LPDIRECTDRAWSURFACE7*,lplpDupDDSurface) \ +/*20*/ ICOM_METHOD4(HRESULT,EnumDisplayModes, DWORD,dwFlags, LPDDSURFACEDESC2,lpDDSurfaceDesc, LPVOID,lpContext, LPDDENUMMODESCALLBACK7,lpEnumModesCallback) \ +/*24*/ ICOM_METHOD4(HRESULT,EnumSurfaces, DWORD,dwFlags, LPDDSURFACEDESC2,lpDDSD, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK7,lpEnumSurfacesCallback) \ +/*28*/ ICOM_METHOD (HRESULT,FlipToGDISurface) \ +/*2c*/ ICOM_METHOD2(HRESULT,GetCaps, LPDDCAPS,lpDDDriverCaps, LPDDCAPS,lpDDHELCaps) \ +/*30*/ ICOM_METHOD1(HRESULT,GetDisplayMode, LPDDSURFACEDESC2,lpDDSurfaceDesc) \ +/*34*/ ICOM_METHOD2(HRESULT,GetFourCCCodes, LPDWORD,lpNumCodes, LPDWORD,lpCodes) \ +/*38*/ ICOM_METHOD1(HRESULT,GetGDISurface, LPDIRECTDRAWSURFACE7*,lplpGDIDDSurface) \ +/*3c*/ ICOM_METHOD1(HRESULT,GetMonitorFrequency, LPDWORD,lpdwFrequency) \ +/*40*/ ICOM_METHOD1(HRESULT,GetScanLine, LPDWORD,lpdwScanLine) \ +/*44*/ ICOM_METHOD1(HRESULT,GetVerticalBlankStatus, BOOL*,lpbIsInVB) \ +/*48*/ ICOM_METHOD1(HRESULT,Initialize, GUID*,lpGUID) \ +/*4c*/ ICOM_METHOD (HRESULT,RestoreDisplayMode) \ +/*50*/ ICOM_METHOD2(HRESULT,SetCooperativeLevel, HWND,hWnd, DWORD,dwFlags) \ +/*54*/ ICOM_METHOD5(HRESULT,SetDisplayMode, DWORD,dwWidth, DWORD,dwHeight, DWORD,dwBPP, DWORD,dwRefreshRate, DWORD,dwFlags) \ +/*58*/ ICOM_METHOD2(HRESULT,WaitForVerticalBlank, DWORD,dwFlags, HANDLE,hEvent) \ + /* added in v2 */ \ +/*5c*/ ICOM_METHOD3(HRESULT,GetAvailableVidMem, LPDDSCAPS2,lpDDCaps, LPDWORD,lpdwTotal, LPDWORD,lpdwFree) \ + /* added in v4 */ \ +/*60*/ ICOM_METHOD2(HRESULT,GetSurfaceFromDC, HDC,, LPDIRECTDRAWSURFACE7*,) \ +/*64*/ ICOM_METHOD (HRESULT,RestoreAllSurfaces) \ +/*68*/ ICOM_METHOD (HRESULT,TestCooperativeLevel) \ +/*6c*/ ICOM_METHOD2(HRESULT,GetDeviceIdentifier, LPDDDEVICEIDENTIFIER,, DWORD,) \ + /* added in v7 */ \ +/*70*/ ICOM_METHOD3(HRESULT,StartModeTest, LPSIZE,, DWORD,, DWORD,) \ +/*74*/ ICOM_METHOD2(HRESULT,EvaluateMode, DWORD,, DWORD *,) +#define IDirectDraw7_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDraw7_METHODS +ICOM_DEFINE(IDirectDraw7,IUnknown) +#undef ICOM_INTERFACE + + /*** IUnknown methods ***/ +#define IDirectDraw7_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IDirectDraw7_AddRef(p) ICOM_CALL (AddRef,p) +#define IDirectDraw7_Release(p) ICOM_CALL (Release,p) + /*** IDirectDraw methods ***/ +#define IDirectDraw7_Compact(p) ICOM_CALL (Compact,p) +#define IDirectDraw7_CreateClipper(p,a,b,c) ICOM_CALL3(CreateClipper,p,a,b,c) +#define IDirectDraw7_CreatePalette(p,a,b,c,d) ICOM_CALL4(CreatePalette,p,a,b,c,d) +#define IDirectDraw7_CreateSurface(p,a,b,c) ICOM_CALL3(CreateSurface,p,a,b,c) +#define IDirectDraw7_DuplicateSurface(p,a,b) ICOM_CALL2(DuplicateSurface,p,a,b) +#define IDirectDraw7_EnumDisplayModes(p,a,b,c,d) ICOM_CALL4(EnumDisplayModes,p,a,b,c,d) +#define IDirectDraw7_EnumSurfaces(p,a,b,c,d) ICOM_CALL4(EnumSurfaces,p,a,b,c,d) +#define IDirectDraw7_FlipToGDISurface(p) ICOM_CALL (FlipToGDISurface,p) +#define IDirectDraw7_GetCaps(p,a,b) ICOM_CALL2(GetCaps,p,a,b) +#define IDirectDraw7_GetDisplayMode(p,a) ICOM_CALL1(GetDisplayMode,p,a) +#define IDirectDraw7_GetFourCCCodes(p,a,b) ICOM_CALL2(GetFourCCCodes,p,a,b) +#define IDirectDraw7_GetGDISurface(p,a) ICOM_CALL1(GetGDISurface,p,a) +#define IDirectDraw7_GetMonitorFrequency(p,a) ICOM_CALL1(GetMonitorFrequency,p,a) +#define IDirectDraw7_GetScanLine(p,a) ICOM_CALL1(GetScanLine,p,a) +#define IDirectDraw7_GetVerticalBlankStatus(p,a) ICOM_CALL1(GetVerticalBlankStatus,p,a) +#define IDirectDraw7_Initialize(p,a) ICOM_CALL1(Initialize,p,a) +#define IDirectDraw7_RestoreDisplayMode(p) ICOM_CALL (RestoreDisplayMode,p) +#define IDirectDraw7_SetCooperativeLevel(p,a,b) ICOM_CALL2(SetCooperativeLevel,p,a,b) +#define IDirectDraw7_SetDisplayMode(p,a,b,c,d,e) ICOM_CALL5(SetDisplayMode,p,a,b,c,d,e) +#define IDirectDraw7_WaitForVerticalBlank(p,a,b) ICOM_CALL2(WaitForVerticalBlank,p,a,b) +/*** added in IDirectDraw2 ***/ +#define IDirectDraw7_GetAvailableVidMem(p,a,b,c) ICOM_CALL3(GetAvailableVidMem,p,a,b,c) +/*** added in IDirectDraw4 ***/ +#define IDirectDraw7_GetSurfaceFromDC(p,a,b) ICOM_CALL2(GetSurfaceFromDC,p,a,b,c) +#define IDirectDraw7_RestoreAllSurfaces(pc) ICOM_CALL (RestoreAllSurfaces,p) +#define IDirectDraw7_TestCooperativeLevel(p) ICOM_CALL (TestCooperativeLevel,p) +#define IDirectDraw7_GetDeviceIdentifier(p,a,b) ICOM_CALL2(GetDeviceIdentifier,p,a,b) +/*** added in IDirectDraw 7 ***/ +#define IDirectDraw7_StartModeTest(p,a,b,c) ICOM_CALL3(StartModeTest,p,a,b,c) +#define IDirectDraw7_EvaluateMode(p,a,b) ICOM_CALL2(EvaluateMode,p,a,b) + + +/***************************************************************************** * IDirectDrawSurface interface */ #define ICOM_INTERFACE IDirectDrawSurface #define IDirectDrawSurface_METHODS \ - ICOM_METHOD1(HRESULT,AddAttachedSurface, LPDIRECTDRAWSURFACE,lpDDSAttachedSurface) \ - ICOM_METHOD1(HRESULT,AddOverlayDirtyRect, LPRECT,lpRect) \ - ICOM_METHOD5(HRESULT,Blt, LPRECT,lpDestRect, LPDIRECTDRAWSURFACE,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwFlags, LPDDBLTFX,lpDDBltFx) \ - ICOM_METHOD3(HRESULT,BltBatch, LPDDBLTBATCH,lpDDBltBatch, DWORD,dwCount, DWORD,dwFlags) \ - ICOM_METHOD5(HRESULT,BltFast, DWORD,dwX, DWORD,dwY, LPDIRECTDRAWSURFACE,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwTrans) \ - ICOM_METHOD2(HRESULT,DeleteAttachedSurface, DWORD,dwFlags, LPDIRECTDRAWSURFACE,lpDDSAttachedSurface) \ - ICOM_METHOD2(HRESULT,EnumAttachedSurfaces, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ - ICOM_METHOD3(HRESULT,EnumOverlayZOrders, DWORD,dwFlags, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpfnCallback) \ - ICOM_METHOD2(HRESULT,Flip, LPDIRECTDRAWSURFACE,lpDDSurfaceTargetOverride, DWORD,dwFlags) \ - ICOM_METHOD2(HRESULT,GetAttachedSurface, LPDDSCAPS,lpDDSCaps, LPDIRECTDRAWSURFACE*,lplpDDAttachedSurface) \ - ICOM_METHOD1(HRESULT,GetBltStatus, DWORD,dwFlags) \ - ICOM_METHOD1(HRESULT,GetCaps, LPDDSCAPS,lpDDSCaps) \ - ICOM_METHOD1(HRESULT,GetClipper, LPDIRECTDRAWCLIPPER*,lplpDDClipper) \ - ICOM_METHOD2(HRESULT,GetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ - ICOM_METHOD1(HRESULT,GetDC, HDC*,lphDC) \ - ICOM_METHOD1(HRESULT,GetFlipStatus, DWORD,dwFlags) \ - ICOM_METHOD2(HRESULT,GetOverlayPosition, LPLONG,lplX, LPLONG,lplY) \ - ICOM_METHOD1(HRESULT,GetPalette, LPDIRECTDRAWPALETTE*,lplpDDPalette) \ - ICOM_METHOD1(HRESULT,GetPixelFormat, LPDDPIXELFORMAT,lpDDPixelFormat) \ - ICOM_METHOD1(HRESULT,GetSurfaceDesc, LPDDSURFACEDESC,lpDDSurfaceDesc) \ - ICOM_METHOD2(HRESULT,Initialize, LPDIRECTDRAW,lpDD, LPDDSURFACEDESC,lpDDSurfaceDesc) \ - ICOM_METHOD (HRESULT,IsLost) \ - ICOM_METHOD4(HRESULT,Lock, LPRECT,lpDestRect, LPDDSURFACEDESC,lpDDSurfaceDesc, DWORD,dwFlags, HANDLE,hEvent) \ - ICOM_METHOD1(HRESULT,ReleaseDC, HDC,hDC) \ - ICOM_METHOD (HRESULT,Restore) \ - ICOM_METHOD1(HRESULT,SetClipper, LPDIRECTDRAWCLIPPER,lpDDClipper) \ - ICOM_METHOD2(HRESULT,SetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ - ICOM_METHOD2(HRESULT,SetOverlayPosition, LONG,lX, LONG,lY) \ - ICOM_METHOD1(HRESULT,SetPalette, LPDIRECTDRAWPALETTE,lpDDPalette) \ - ICOM_METHOD1(HRESULT,Unlock, LPVOID,lpSurfaceData) \ - ICOM_METHOD5(HRESULT,UpdateOverlay, LPRECT,lpSrcRect, LPDIRECTDRAWSURFACE,lpDDDestSurface, LPRECT,lpDestRect, DWORD,dwFlags, LPDDOVERLAYFX,lpDDOverlayFx) \ - ICOM_METHOD1(HRESULT,UpdateOverlayDisplay, DWORD,dwFlags) \ - ICOM_METHOD2(HRESULT,UpdateOverlayZOrder, DWORD,dwFlags, LPDIRECTDRAWSURFACE,lpDDSReference) +/*0c*/ ICOM_METHOD1(HRESULT,AddAttachedSurface, LPDIRECTDRAWSURFACE,lpDDSAttachedSurface) \ +/*10*/ ICOM_METHOD1(HRESULT,AddOverlayDirtyRect, LPRECT,lpRect) \ +/*14*/ ICOM_METHOD5(HRESULT,Blt, LPRECT,lpDestRect, LPDIRECTDRAWSURFACE,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwFlags, LPDDBLTFX,lpDDBltFx) \ +/*18*/ ICOM_METHOD3(HRESULT,BltBatch, LPDDBLTBATCH,lpDDBltBatch, DWORD,dwCount, DWORD,dwFlags) \ +/*1c*/ ICOM_METHOD5(HRESULT,BltFast, DWORD,dwX, DWORD,dwY, LPDIRECTDRAWSURFACE,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwTrans) \ +/*20*/ ICOM_METHOD2(HRESULT,DeleteAttachedSurface, DWORD,dwFlags, LPDIRECTDRAWSURFACE,lpDDSAttachedSurface) \ +/*24*/ ICOM_METHOD2(HRESULT,EnumAttachedSurfaces, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ +/*28*/ ICOM_METHOD3(HRESULT,EnumOverlayZOrders, DWORD,dwFlags, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpfnCallback) \ +/*2c*/ ICOM_METHOD2(HRESULT,Flip, LPDIRECTDRAWSURFACE,lpDDSurfaceTargetOverride, DWORD,dwFlags) \ +/*30*/ ICOM_METHOD2(HRESULT,GetAttachedSurface, LPDDSCAPS,lpDDSCaps, LPDIRECTDRAWSURFACE*,lplpDDAttachedSurface) \ +/*34*/ ICOM_METHOD1(HRESULT,GetBltStatus, DWORD,dwFlags) \ +/*38*/ ICOM_METHOD1(HRESULT,GetCaps, LPDDSCAPS,lpDDSCaps) \ +/*3c*/ ICOM_METHOD1(HRESULT,GetClipper, LPDIRECTDRAWCLIPPER*,lplpDDClipper) \ +/*40*/ ICOM_METHOD2(HRESULT,GetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ +/*44*/ ICOM_METHOD1(HRESULT,GetDC, HDC*,lphDC) \ +/*48*/ ICOM_METHOD1(HRESULT,GetFlipStatus, DWORD,dwFlags) \ +/*4c*/ ICOM_METHOD2(HRESULT,GetOverlayPosition, LPLONG,lplX, LPLONG,lplY) \ +/*50*/ ICOM_METHOD1(HRESULT,GetPalette, LPDIRECTDRAWPALETTE*,lplpDDPalette) \ +/*54*/ ICOM_METHOD1(HRESULT,GetPixelFormat, LPDDPIXELFORMAT,lpDDPixelFormat) \ +/*58*/ ICOM_METHOD1(HRESULT,GetSurfaceDesc, LPDDSURFACEDESC,lpDDSurfaceDesc) \ +/*5c*/ ICOM_METHOD2(HRESULT,Initialize, LPDIRECTDRAW,lpDD, LPDDSURFACEDESC,lpDDSurfaceDesc) \ +/*60*/ ICOM_METHOD (HRESULT,IsLost) \ +/*64*/ ICOM_METHOD4(HRESULT,Lock, LPRECT,lpDestRect, LPDDSURFACEDESC,lpDDSurfaceDesc, DWORD,dwFlags, HANDLE,hEvent) \ +/*68*/ ICOM_METHOD1(HRESULT,ReleaseDC, HDC,hDC) \ +/*6c*/ ICOM_METHOD (HRESULT,Restore) \ +/*70*/ ICOM_METHOD1(HRESULT,SetClipper, LPDIRECTDRAWCLIPPER,lpDDClipper) \ +/*74*/ ICOM_METHOD2(HRESULT,SetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ +/*78*/ ICOM_METHOD2(HRESULT,SetOverlayPosition, LONG,lX, LONG,lY) \ +/*7c*/ ICOM_METHOD1(HRESULT,SetPalette, LPDIRECTDRAWPALETTE,lpDDPalette) \ +/*80*/ ICOM_METHOD1(HRESULT,Unlock, LPVOID,lpSurfaceData) \ +/*84*/ ICOM_METHOD5(HRESULT,UpdateOverlay, LPRECT,lpSrcRect, LPDIRECTDRAWSURFACE,lpDDDestSurface, LPRECT,lpDestRect, DWORD,dwFlags, LPDDOVERLAYFX,lpDDOverlayFx) \ +/*88*/ ICOM_METHOD1(HRESULT,UpdateOverlayDisplay, DWORD,dwFlags) \ +/*8c*/ ICOM_METHOD2(HRESULT,UpdateOverlayZOrder, DWORD,dwFlags, LPDIRECTDRAWSURFACE,lpDDSReference) #define IDirectDrawSurface_IMETHODS \ IUnknown_IMETHODS \ IDirectDrawSurface_METHODS ICOM_DEFINE(IDirectDrawSurface,IUnknown) #undef ICOM_INTERFACE -#ifdef ICOM_CINTERFACE /*** IUnknown methods ***/ #define IDirectDrawSurface_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) #define IDirectDrawSurface_AddRef(p) ICOM_CALL (AddRef,p) @@ -1154,8 +1573,8 @@ #define IDirectDrawSurface_IsLost(p) ICOM_CALL (IsLost,p) #define IDirectDrawSurface_Lock(p,a,b,c,d) ICOM_CALL4(Lock,p,a,b,c,d) #define IDirectDrawSurface_ReleaseDC(p,a) ICOM_CALL1(ReleaseDC,p,a) -#define IDirectDrawSurface_Restore(p,a,b) ICOM_CALL (Restore,p,a,b) -#define IDirectDrawSurface_SetClipper(p,a,b) ICOM_CALL1(SetClipper,p,a,b) +#define IDirectDrawSurface_Restore(p) ICOM_CALL (Restore,p) +#define IDirectDrawSurface_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) #define IDirectDrawSurface_SetColorKey(p,a,b) ICOM_CALL2(SetColorKey,p,a,b) #define IDirectDrawSurface_SetOverlayPosition(p,a,b) ICOM_CALL2(SetOverlayPosition,p,a,b) #define IDirectDrawSurface_SetPalette(p,a) ICOM_CALL1(SetPalette,p,a) @@ -1163,7 +1582,6 @@ #define IDirectDrawSurface_UpdateOverlay(p,a,b,c,d,e) ICOM_CALL5(UpdateOverlay,p,a,b,c,d,e) #define IDirectDrawSurface_UpdateOverlayDisplay(p,a) ICOM_CALL1(UpdateOverlayDisplay,p,a) #define IDirectDrawSurface_UpdateOverlayZOrder(p,a,b) ICOM_CALL2(UpdateOverlayZOrder,p,a,b) -#endif /***************************************************************************** @@ -1217,7 +1635,6 @@ ICOM_DEFINE(IDirectDrawSurface2,IUnknown) #undef ICOM_INTERFACE -#ifdef ICOM_CINTERFACE /*** IUnknown methods ***/ #define IDirectDrawSurface2_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) #define IDirectDrawSurface2_AddRef(p) ICOM_CALL (AddRef,p) @@ -1248,7 +1665,7 @@ #define IDirectDrawSurface2_Lock(p,a,b,c,d) ICOM_CALL4(Lock,p,a,b,c,d) #define IDirectDrawSurface2_ReleaseDC(p,a) ICOM_CALL1(ReleaseDC,p,a) #define IDirectDrawSurface2_Restore(p,a,b) ICOM_CALL (Restore,p,a,b) -#define IDirectDrawSurface2_SetClipper(p,a,b) ICOM_CALL1(SetClipper,p,a,b) +#define IDirectDrawSurface2_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) #define IDirectDrawSurface2_SetColorKey(p,a,b) ICOM_CALL2(SetColorKey,p,a,b) #define IDirectDrawSurface2_SetOverlayPosition(p,a,b) ICOM_CALL2(SetOverlayPosition,p,a,b) #define IDirectDrawSurface2_SetPalette(p,a) ICOM_CALL1(SetPalette,p,a) @@ -1260,7 +1677,6 @@ #define IDirectDrawSurface2_GetDDInterface(p,a) ICOM_CALL1(GetDDInterface,p,a) #define IDirectDrawSurface2_PageLock(p,a) ICOM_CALL1(PageLock,p,a) #define IDirectDrawSurface2_PageUnlock(p,a) ICOM_CALL1(PageUnlock,p,a) -#endif /***************************************************************************** @@ -1316,7 +1732,6 @@ ICOM_DEFINE(IDirectDrawSurface3,IUnknown) #undef ICOM_INTERFACE -#ifdef ICOM_CINTERFACE /*** IUnknown methods ***/ #define IDirectDrawSurface3_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) #define IDirectDrawSurface3_AddRef(p) ICOM_CALL (AddRef,p) @@ -1347,7 +1762,7 @@ #define IDirectDrawSurface3_Lock(p,a,b,c,d) ICOM_CALL4(Lock,p,a,b,c,d) #define IDirectDrawSurface3_ReleaseDC(p,a) ICOM_CALL1(ReleaseDC,p,a) #define IDirectDrawSurface3_Restore(p,a,b) ICOM_CALL (Restore,p,a,b) -#define IDirectDrawSurface3_SetClipper(p,a,b) ICOM_CALL1(SetClipper,p,a,b) +#define IDirectDrawSurface3_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) #define IDirectDrawSurface3_SetColorKey(p,a,b) ICOM_CALL2(SetColorKey,p,a,b) #define IDirectDrawSurface3_SetOverlayPosition(p,a,b) ICOM_CALL2(SetOverlayPosition,p,a,b) #define IDirectDrawSurface3_SetPalette(p,a) ICOM_CALL1(SetPalette,p,a) @@ -1361,7 +1776,6 @@ #define IDirectDrawSurface3_PageUnlock(p,a) ICOM_CALL1(PageUnlock,p,a) /*** IDirectDrawSurface3 methods ***/ #define IDirectDrawSurface3_SetSurfaceDesc(p,a,b) ICOM_CALL2(SetSurfaceDesc,p,a,b) -#endif /***************************************************************************** @@ -1427,7 +1841,6 @@ ICOM_DEFINE(IDirectDrawSurface4,IUnknown) #undef ICOM_INTERFACE -#ifdef ICOM_CINTERFACE /*** IUnknown methods ***/ #define IDirectDrawSurface4_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) #define IDirectDrawSurface4_AddRef(p) ICOM_CALL (AddRef,p) @@ -1458,7 +1871,7 @@ #define IDirectDrawSurface4_Lock(p,a,b,c,d) ICOM_CALL4(Lock,p,a,b,c,d) #define IDirectDrawSurface4_ReleaseDC(p,a) ICOM_CALL1(ReleaseDC,p,a) #define IDirectDrawSurface4_Restore(p,a,b) ICOM_CALL (Restore,p,a,b) -#define IDirectDrawSurface4_SetClipper(p,a,b) ICOM_CALL1(SetClipper,p,a,b) +#define IDirectDrawSurface4_SetClipper(p,a) ICOM_CALL1(SetClipper,p,a) #define IDirectDrawSurface4_SetColorKey(p,a,b) ICOM_CALL2(SetColorKey,p,a,b) #define IDirectDrawSurface4_SetOverlayPosition(p,a,b) ICOM_CALL2(SetOverlayPosition,p,a,b) #define IDirectDrawSurface4_SetPalette(p,a) ICOM_CALL1(SetPalette,p,a) @@ -1478,7 +1891,68 @@ #define IDirectDrawSurface4_FreePrivateData(p,a) ICOM_CALL1(FreePrivateData,p,a) #define IDirectDrawSurface4_GetUniquenessValue(p,a) ICOM_CALL1(GetUniquenessValue,p,a) #define IDirectDrawSurface4_ChangeUniquenessValue(p) ICOM_CALL (ChangeUniquenessValue,p) -#endif + + +/***************************************************************************** + * IDirectDrawSurface7 interface + */ +#define ICOM_INTERFACE IDirectDrawSurface7 +#define IDirectDrawSurface7_METHODS \ + ICOM_METHOD1(HRESULT,AddAttachedSurface, LPDIRECTDRAWSURFACE7,lpDDSAttachedSurface) \ + ICOM_METHOD1(HRESULT,AddOverlayDirtyRect, LPRECT,lpRect) \ + ICOM_METHOD5(HRESULT,Blt, LPRECT,lpDestRect, LPDIRECTDRAWSURFACE7,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwFlags, LPDDBLTFX,lpDDBltFx) \ + ICOM_METHOD3(HRESULT,BltBatch, LPDDBLTBATCH,lpDDBltBatch, DWORD,dwCount, DWORD,dwFlags) \ + ICOM_METHOD5(HRESULT,BltFast, DWORD,dwX, DWORD,dwY, LPDIRECTDRAWSURFACE7,lpDDSrcSurface, LPRECT,lpSrcRect, DWORD,dwTrans) \ + ICOM_METHOD2(HRESULT,DeleteAttachedSurface, DWORD,dwFlags, LPDIRECTDRAWSURFACE7,lpDDSAttachedSurface) \ + ICOM_METHOD2(HRESULT,EnumAttachedSurfaces, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpEnumSurfacesCallback) \ + ICOM_METHOD3(HRESULT,EnumOverlayZOrders, DWORD,dwFlags, LPVOID,lpContext, LPDDENUMSURFACESCALLBACK,lpfnCallback) \ + ICOM_METHOD2(HRESULT,Flip, LPDIRECTDRAWSURFACE7,lpDDSurfaceTargetOverride, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,GetAttachedSurface, LPDDSCAPS2,lpDDSCaps, LPDIRECTDRAWSURFACE7*,lplpDDAttachedSurface) \ + ICOM_METHOD1(HRESULT,GetBltStatus, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,GetCaps, LPDDSCAPS2,lpDDSCaps) \ + ICOM_METHOD1(HRESULT,GetClipper, LPDIRECTDRAWCLIPPER*,lplpDDClipper) \ + ICOM_METHOD2(HRESULT,GetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ + ICOM_METHOD1(HRESULT,GetDC, HDC*,lphDC) \ + ICOM_METHOD1(HRESULT,GetFlipStatus, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,GetOverlayPosition, LPLONG,lplX, LPLONG,lplY) \ + ICOM_METHOD1(HRESULT,GetPalette, LPDIRECTDRAWPALETTE*,lplpDDPalette) \ + ICOM_METHOD1(HRESULT,GetPixelFormat, LPDDPIXELFORMAT,lpDDPixelFormat) \ + ICOM_METHOD1(HRESULT,GetSurfaceDesc, LPDDSURFACEDESC2,lpDDSurfaceDesc) \ + ICOM_METHOD2(HRESULT,Initialize, LPDIRECTDRAW,lpDD, LPDDSURFACEDESC2,lpDDSurfaceDesc) \ + ICOM_METHOD (HRESULT,IsLost) \ + ICOM_METHOD4(HRESULT,Lock, LPRECT,lpDestRect, LPDDSURFACEDESC2,lpDDSurfaceDesc, DWORD,dwFlags, HANDLE,hEvent) \ + ICOM_METHOD1(HRESULT,ReleaseDC, HDC,hDC) \ + ICOM_METHOD (HRESULT,Restore) \ + ICOM_METHOD1(HRESULT,SetClipper, LPDIRECTDRAWCLIPPER,lpDDClipper) \ + ICOM_METHOD2(HRESULT,SetColorKey, DWORD,dwFlags, LPDDCOLORKEY,lpDDColorKey) \ + ICOM_METHOD2(HRESULT,SetOverlayPosition, LONG,lX, LONG,lY) \ + ICOM_METHOD1(HRESULT,SetPalette, LPDIRECTDRAWPALETTE,lpDDPalette) \ + ICOM_METHOD1(HRESULT,Unlock, LPVOID,lpSurfaceData) \ + ICOM_METHOD5(HRESULT,UpdateOverlay, LPRECT,lpSrcRect, LPDIRECTDRAWSURFACE7,lpDDDestSurface, LPRECT,lpDestRect, DWORD,dwFlags, LPDDOVERLAYFX,lpDDOverlayFx) \ + ICOM_METHOD1(HRESULT,UpdateOverlayDisplay, DWORD,dwFlags) \ + ICOM_METHOD2(HRESULT,UpdateOverlayZOrder, DWORD,dwFlags, LPDIRECTDRAWSURFACE7,lpDDSReference) \ + /* added in v2 */ \ + ICOM_METHOD1(HRESULT,GetDDInterface, LPVOID*,lplpDD) \ + ICOM_METHOD1(HRESULT,PageLock, DWORD,dwFlags) \ + ICOM_METHOD1(HRESULT,PageUnlock, DWORD,dwFlags) \ + /* added in v3 */ \ + ICOM_METHOD2(HRESULT,SetSurfaceDesc, LPDDSURFACEDESC2,lpDDSD, DWORD,dwFlags) \ + /* added in v4 */ \ + ICOM_METHOD4(HRESULT,SetPrivateData, REFGUID,, LPVOID,, DWORD,, DWORD,) \ + ICOM_METHOD3(HRESULT,GetPrivateData, REFGUID,, LPVOID,, LPDWORD,) \ + ICOM_METHOD1(HRESULT,FreePrivateData, REFGUID,) \ + ICOM_METHOD1(HRESULT,GetUniquenessValue, LPDWORD,) \ + ICOM_METHOD (HRESULT,ChangeUniquenessValue) \ + /* added in v7 */ \ + ICOM_METHOD1(HRESULT,SetPriority, DWORD,prio) \ + ICOM_METHOD1(HRESULT,GetPriority, LPDWORD,prio) \ + ICOM_METHOD1(HRESULT,SetLOD, DWORD,lod) \ + ICOM_METHOD1(HRESULT,GetLOD, LPDWORD,lod) +#define IDirectDrawSurface7_IMETHODS \ + IUnknown_IMETHODS \ + IDirectDrawSurface7_METHODS +ICOM_DEFINE(IDirectDrawSurface7,IUnknown) +#undef ICOM_INTERFACE /***************************************************************************** @@ -1494,7 +1968,6 @@ ICOM_DEFINE(IDirectDrawColorControl,IUnknown) #undef ICOM_INTERFACE -#ifdef ICOM_CINTERFACE /*** IUnknown methods ***/ #define IDirectDrawColorControl_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) #define IDirectDrawColorControl_AddRef(p) ICOM_CALL (AddRef,p) @@ -1502,13 +1975,17 @@ /*** IDirectDrawColorControl methods ***/ #define IDirectDrawColorControl_GetColorControls(p,a) ICOM_CALL(GetColorControls,p,a) #define IDirectDrawColorControl_SetColorControls(p,a) ICOM_CALL(SetColorControls,p,a) -#endif HRESULT WINAPI DirectDrawCreate(LPGUID,LPDIRECTDRAW*,LPUNKNOWN); +HRESULT WINAPI DirectDrawCreateEx(LPGUID,LPVOID*,REFIID,LPUNKNOWN); HRESULT WINAPI DirectDrawEnumerateA(LPDDENUMCALLBACKA,LPVOID); HRESULT WINAPI DirectDrawEnumerateW(LPDDENUMCALLBACKW,LPVOID); #define DirectDrawEnumerate WINELIB_NAME_AW(DirectDrawEnumerate) HRESULT WINAPI DirectDrawCreateClipper(DWORD,LPDIRECTDRAWCLIPPER*,LPUNKNOWN); + +#ifdef __cplusplus +} /* extern "C" */ +#endif /* defined(__cplusplus) */ #endif /* __WINE_DDRAW_H */ Index: xc/programs/Xserver/hw/xwin/directx.c diff -u xc/programs/Xserver/hw/xwin/directx.c:1.1 xc/programs/Xserver/hw/xwin/directx.c:removed --- xc/programs/Xserver/hw/xwin/directx.c:1.1 Thu Aug 10 13:40:37 2000 +++ xc/programs/Xserver/hw/xwin/directx.c Mon Jun 4 12:42:43 2001 @@ -1,174 +0,0 @@ -/* - * (c) Copyright 2000 by Peter Busch - * <pbusch@dfki.de> - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PETER BUSCH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Peter Busch shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Peter Busch. - * -*/ -/* $XFree86: xc/programs/Xserver/hw/xwin/directx.c,v 1.1 2000/08/10 17:40:37 dawes Exp $ */ - - -#include <windows.h> -#include <stdio.h> -#include "xf_dx_xwin.h" - -/* external references to funcs in InitInput.c and InitOutput.c */ -extern SwitchFramebuffer( void * ptr ); -extern GenerateInputEvent( type, ix, iy, button ); - -typedef BOOL (__cdecl *_DIInitKeyboard)(); -typedef BOOL (__cdecl *_DIInitMouse)(); -typedef void (__cdecl *_DITermKeyboard)(); -typedef void (__cdecl *_DITermMouse)(); -typedef BOOL (__cdecl *_DXStoreColors)(int i, int r, int g, int b); -typedef void (__cdecl *_ListModes)(void); -typedef void (__cdecl *_set_fn)( __SwitchFramebuffer switch_fb, __GenerateInputEvent gen_inp ); -typedef char*( __cdecl *_winDXAllocateFramebufferMemory) - ( - int* width, - int* height, - int* depth, - int* pitch - ); -typedef void (__cdecl *_winfbBlockHandler)(); -typedef int (__cdecl *_winfbWakeupHandler)(); - - -_DIInitKeyboard xf_DIInitKeyboard = NULL; -_DIInitMouse xf_DIInitMouse = NULL; -_DITermKeyboard xf_DITermKeyboard = NULL; -_DITermMouse xf_DITermMouse = NULL; -_DXStoreColors xf_DXStoreColors = NULL; -_ListModes xf_ListModes = NULL; -_set_fn xf_set_fn = NULL; -_winDXAllocateFramebufferMemory xf_winDXAllocateFramebufferMemory = NULL; -_winfbBlockHandler xf_winfbBlockHandler = NULL; -_winfbWakeupHandler xf_winfbWakeupHandler = NULL; -HINSTANCE h_xf_dx = NULL; - -static BOOL initialized = FALSE; - - -void enable_xf_dx( ) -{ - h_xf_dx = LoadLibrary( "xf_dx.dll" ); - if( h_xf_dx == NULL ) - { - fprintf( stderr, "cannot load xf_dx.dll\n" ); - exit( 1 ); - } - - xf_DIInitKeyboard = - (_DIInitKeyboard)GetProcAddress( h_xf_dx, "DIInitKeyboard" ); - xf_DIInitMouse = - (_DIInitMouse)GetProcAddress( h_xf_dx, "DIInitMouse" ); - xf_DITermKeyboard = - (_DITermKeyboard)GetProcAddress( h_xf_dx, "DITermKeyboard" ); - xf_DITermMouse = - (_DITermMouse)GetProcAddress( h_xf_dx, "DITermMouse" ); - xf_DXStoreColors = - (_DXStoreColors)GetProcAddress( h_xf_dx, "DXStoreColors" ); - xf_ListModes = - (_ListModes)GetProcAddress( h_xf_dx, "ListModes" ); - xf_set_fn = - (_set_fn)GetProcAddress( h_xf_dx, "set_fn" ); - xf_winDXAllocateFramebufferMemory = - (_winDXAllocateFramebufferMemory)GetProcAddress( h_xf_dx, "winDXAllocateFramebufferMemory" ); - xf_winfbBlockHandler = - (_winfbBlockHandler)GetProcAddress( h_xf_dx, "winfbBlockHandler" ); - xf_winfbWakeupHandler = - (_winfbWakeupHandler)GetProcAddress( h_xf_dx, "winfbWakeupHandler" ); - - xf_set_fn( - (__SwitchFramebuffer)SwitchFramebuffer, - (__GenerateInputEvent)GenerateInputEvent - ); - initialized = TRUE; -} - - -/* DX stubs */ - - -BOOL DIInitKeyboard() -{ - return xf_DIInitKeyboard(); -} - -BOOL DIInitMouse() -{ - return xf_DIInitMouse(); - -} - -void DITermKeyboard() -{ - xf_DITermKeyboard(); -} - -void DITermMouse() -{ - xf_DITermMouse(); - -} - -BOOL DXStoreColors(int i, int r, int g, int b) -{ - return xf_DXStoreColors( i, r, g, b ); - -} - -void ListModes(void) -{ - enable_xf_dx(); - xf_ListModes(); -} - -void set_fn( __SwitchFramebuffer switch_fb, __GenerateInputEvent gen_inp ) -{ - return xf_set_fn( switch_fb, gen_inp ); -} - -char* winDXAllocateFramebufferMemory - ( - int* width, - int* height, - int* depth, - int* pitch - ) -{ - enable_xf_dx(); - return xf_winDXAllocateFramebufferMemory( width, height, depth, pitch ); -} - -void winfbBlockHandler() -{ - xf_winfbBlockHandler(); -} - -int winfbWakeupHandler() -{ - return xf_winfbWakeupHandler(); -} - Index: xc/programs/Xserver/hw/xwin/ntux_ddx.h diff -u xc/programs/Xserver/hw/xwin/ntux_ddx.h:1.1 xc/programs/Xserver/hw/xwin/ntux_ddx.h:removed --- xc/programs/Xserver/hw/xwin/ntux_ddx.h:1.1 Thu Aug 10 13:40:37 2000 +++ xc/programs/Xserver/hw/xwin/ntux_ddx.h Mon Jun 4 12:42:43 2001 @@ -1,150 +0,0 @@ -/* -* Copyright 2000 (C) Peter Busch -* All rights reserved. -NO WARRANTY; NO LIABILITY FOR DAMAGES: THE MATERIALS ARE PROVIDED "AS IS" -WITHOUT ANY EXPRESS OR IMPLIED WARRANTY OF ANY KIND INCLUDING WARRANTIES -OF SATISFACTORY QUALITY, MERCHANTABILITY, NONINFRINGEMENT OF THIRD-PARTY -INTELLECTUAL PROPERTY, OR FITNESS FOR ANY PARTICULAR PURPOSE. -IN NO EVENT SHALL Peter Busch BE LIABLE FOR ANY DAMAGES WHATSOEVER -(INCLUDING, WITHOUT LIMITATION, DIRECT OR INDIRECT DAMAGES, DAMAGES FOR -LOSS OF PROFITS, BUSINESS INTERRUPTION, LOSS OF INFORMATION) ARISING OUT -OF THE USE OF OR INABILITY TO USE THE MATERIALS, EVEN IF -Peter Busch HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. -Without limiting the generality of the foregoing, no warranty is made -that the enclosed software will generate computer programs with the -characteristics or specifications desired by you or that the demo -software will be error-free. -THESE DISCLAIMERS OF WARRANTY CONSTITUTE AN ESSENTIAL PART OF THIS -AGREEMENT. -*/ -/* $XFree86: xc/programs/Xserver/hw/xwin/ntux_ddx.h,v 1.1 2000/08/10 17:40:37 dawes Exp $ */ - -/* -* ntux_ddx.h -* public header file for the ntux_ddx frame buffer library -* Copyright 2000 (C) Peter Busch -* All rights reserved. -* The above copyright notice and this permission notice shall be included in -* all copies or substantial portions of the Software. -* This code is BETA and will be part of the CYGWIN/XFREE Project. -* It may not be used for purposes other than to contribute to the -* CYGWIN/XFree project without prior written notice from the -* author. -* Any commercial use of this code will be permitted -* provided you contact Peter Busch at pbusch@dfki.de -*/ - - -/* -* for use with the gcc compiler the exported get_surface routine -* is exported with the __cdecl calling convention -*/ - -#ifdef MSC_VER -char *__cdecl get_surface( unsigned long size ); -#else -char *get_surface( unsigned long size ); -#endif - - -#ifdef MSC_VER -char *__cdecl map_dx_fb( char *adr, unsigned long size ); -#else -char *map_dx_fb( char *adr, unsigned long size ); -#endif -/* -* definitions from xfddx_escape.h -* (didn't want include the X-Server specific headers -* needed to to include xfddx_escape.h) -*/ -#define XFDDX_MAP_VIDEO_MEM (0x1998120E) -#define XFDDX_UNMAP_VIDEO_MEM (0x1998120F) -#define XFDDX_KMAP_VIDEO_MEM (0x1998120B) -#define XFDDX_KUNMAP_VIDEO_MEM (0x1998120C) - - -#define FILE_DEVICE_XFMAP (0x00008383) -#define XFMAP_IOCTL_INDEX (0x830) - - -typedef enum { - NOTMAPPED, - XFMAP_XFMAP, - XFMAP_XFDDX_2, - XFMAP_DX, -} xf_mapped; - -/* define IOCTL codes */ -#define XFMAP_MAP ( ULONG) CTL_CODE( FILE_DEVICE_XFMAP,XFMAP_IOCTL_INDEX + 0, METHOD_NEITHER, FILE_ANY_ACCESS ) - -#define XFMAP_UNMAP ( ULONG) CTL_CODE( FILE_DEVICE_XFMAP, XFMAP_IOCTL_INDEX + 1,METHOD_NEITHER, FILE_ANY_ACCESS ) - - -#define XFMAP_PMAP ( ULONG) CTL_CODE( FILE_DEVICE_XFMAP, XFMAP_IOCTL_INDEX + 3,METHOD_NEITHER, FILE_ANY_ACCESS ) - - -#define XFMAP_V2P ( ULONG) CTL_CODE( FILE_DEVICE_XFMAP,XFMAP_IOCTL_INDEX + 4, METHOD_NEITHER, FILE_ANY_ACCESS ) - - - -#ifndef PAGE_SIZE -#define PAGE_SIZE 4096 -#endif - -#define XFMAP_SYS "xfmap" -#define XFMAP_IMG "xfmap.sys" - - - -#ifndef __BUILD_XFDDX__ - -#ifndef _VIDEO_SHARE_MEMORY -typedef struct _VIDEO_SHARE_MEMORY -{ - HANDLE ProcessHandle; - ULONG ViewOffset; - ULONG ViewSize; - PVOID RequestedVirtualAddress; -} VIDEO_SHARE_MEMORY, *PVIDEO_SHARE_MEMORY; -#endif - -#ifndef _VIDEO_SHARE_MEMORY_INFORMATION -typedef struct _VIDEO_SHARE_MEMORY_INFORMATION -{ - ULONG SharedViewOffset; - ULONG SharedViewSize; - PVOID VirtualAddress; -} VIDEO_SHARE_MEMORY_INFORMATION, *PVIDEO_SHARE_MEMORY_INFORMATION; -#endif - - -#ifndef _VIDEO_MEMORY -typedef struct _VIDEO_MEMORY -{ - PVOID RequestedVirtualAddress; -} VIDEO_MEMORY, *PVIDEO_MEMORY; -#endif - -#ifndef _VIDEO_MEMORY_INFORMATION -typedef struct _VIDEO_MEMORY_INFORMATION -{ - PVOID VideoRamBase; - ULONG VideoRamLength; - PVOID FrameBufferBase; - ULONG FrameBufferLength; -} VIDEO_MEMORY_INFORMATION, *PVIDEO_MEMORY_INFORMATION; -#endif -#endif /* __BUILD_XFDDX__ */ - -/* prototypes */ -HANDLE WINAPI load_driver( - char *driver_name, /* driver name, example "xfmap" */ - char *driver_bin /* driver binary, example "xfmap.sys" */ - ); - -BOOL WINAPI unload_driver( - HANDLE h_driver, /* handle to loaded driver */ - char *driver_name /* driver name, example : "xfmap" */ - ); - -BOOL UnloadDeviceDriver( const char * Name ); Index: xc/programs/Xserver/hw/xwin/ntux_xf.c diff -u xc/programs/Xserver/hw/xwin/ntux_xf.c:1.1 xc/programs/Xserver/hw/xwin/ntux_xf.c:removed --- xc/programs/Xserver/hw/xwin/ntux_xf.c:1.1 Thu Aug 10 13:40:38 2000 +++ xc/programs/Xserver/hw/xwin/ntux_xf.c Mon Jun 4 12:42:43 2001 @@ -1,267 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xwin/ntux_xf.c,v 1.1 2000/08/10 17:40:38 dawes Exp $ */ - -#include <windows.h> -#include <winioctl.h> -#include <winsvc.h> -#include <memory.h> -#include "stdio.h" -#include "ntux_ddx.h" - -/* #define TEST_STANDALONE 0 */ -static HANDLE h_xfmap = NULL; - - -char *map_dx_fb( char *adr, unsigned long size ) -{ - char *retval = NULL; - unsigned long cb; - - VIDEO_SHARE_MEMORY vsm = {0}; - vsm.RequestedVirtualAddress = adr; - vsm.ViewSize = size; - - if( h_xfmap == NULL ) - { - h_xfmap = load_driver( XFMAP_SYS, XFMAP_IMG ); - if( h_xfmap == NULL ) - return NULL; - } - - if( DeviceIoControl( h_xfmap, - XFMAP_PMAP, - (LPVOID)&vsm, - sizeof(vsm), - (LPVOID)&vsm, - sizeof(vsm), - &cb, - NULL - ) - ) - { - retval = (char*)vsm.RequestedVirtualAddress; - } - return retval; -} - -#ifndef TEST_STANDALONE -static -#endif -int main( int argc, char **argv ) -{ - char *buf = NULL; - char *buf2 = NULL; - - UnloadDeviceDriver( XFMAP_SYS ); - h_xfmap = load_driver( XFMAP_SYS, XFMAP_IMG ); - - fprintf( stderr, "h_xfmap = %08x\n", h_xfmap ); - - buf = (char*)malloc( 100000 ); - if( buf ) - { - buf2 = map_dx_fb( buf, 100000 ); - free( buf ); - } - - - if( h_xfmap ) - unload_driver( h_xfmap, XFMAP_SYS ); -} - - - - -/* -* driver load/unload routines -*/ -BOOL InstallDriver( SC_HANDLE SchSCManager, LPCSTR DriverName, LPCSTR ServiceExe ) -{ - SC_HANDLE schService; - - - schService = CreateService( SchSCManager, // SCManager database - DriverName, // name of service - DriverName, // name to display - SERVICE_ALL_ACCESS, // desired access - SERVICE_KERNEL_DRIVER, // service type - SERVICE_DEMAND_START, // start type - SERVICE_ERROR_NORMAL, // error control type - ServiceExe, // service's binary - NULL, // no load ordering group - NULL, // no tag identifier - NULL, // no dependencies - NULL, // LocalSystem account - NULL // no password - ); - - if ( schService == NULL ) - return FALSE; - - CloseServiceHandle( schService ); - return TRUE; -} - -BOOL StartDriver( SC_HANDLE SchSCManager, LPCSTR DriverName ) -{ - SC_HANDLE schService; - BOOL ret; - - schService = OpenService( SchSCManager, - DriverName, - SERVICE_ALL_ACCESS - ); - if ( schService == NULL ) - return FALSE; - - ret = StartService( schService, 0, NULL ) - || GetLastError() == ERROR_SERVICE_ALREADY_RUNNING; - - CloseServiceHandle( schService ); - - return ret; -} - -BOOL OpenDevice( LPCSTR DriverName, HANDLE * lphDevice ) -{ - char completeDeviceName[64]; - HANDLE hDevice; - - - sprintf( completeDeviceName, TEXT("\\\\.\\%s"), DriverName ); - - hDevice = CreateFile( completeDeviceName, - GENERIC_READ | GENERIC_WRITE, - 0, - NULL, - OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, - NULL - ); - if ( hDevice == ((HANDLE)-1) ) - return FALSE; - - /* If user wants handle, give it to them. Otherwise, just close it. */ - if ( lphDevice ) - *lphDevice = hDevice; - else - CloseHandle( hDevice ); - return TRUE; -} - -BOOL StopDriver( SC_HANDLE SchSCManager, LPCSTR DriverName ) -{ - SC_HANDLE schService; - BOOL ret; - SERVICE_STATUS serviceStatus; - - schService = OpenService( SchSCManager, DriverName, SERVICE_ALL_ACCESS ); - if ( schService == NULL ) - return FALSE; - - ret = ControlService( schService, SERVICE_CONTROL_STOP, &serviceStatus ); - - CloseServiceHandle( schService ); - - return ret; -} - -BOOL RemoveDriver( SC_HANDLE SchSCManager, LPCSTR DriverName ) -{ - SC_HANDLE schService; - BOOL ret; - - schService = OpenService( SchSCManager, - DriverName, - SERVICE_ALL_ACCESS - ); - - if ( schService == NULL ) - return FALSE; - - ret = DeleteService( schService ); - - CloseServiceHandle( schService ); - - return ret; -} - -BOOL LoadDeviceDriver( const char * Name, const char * Path, HANDLE * lphDevice ) -{ - SC_HANDLE schSCManager; - BOOL okay; - - schSCManager = OpenSCManager( NULL, NULL, SC_MANAGER_ALL_ACCESS ); - - // Ignore success of installation: it may already be installed. - InstallDriver( schSCManager, Name, Path ); - - // Ignore success of start: it may already be started. - StartDriver( schSCManager, Name ); - - // Do make sure we can open it. - okay = OpenDevice( Name, lphDevice ); - - CloseServiceHandle( schSCManager ); - - return okay; -} - -BOOL UnloadDeviceDriver( const char * Name ) -{ - BOOL bResult = TRUE; - SC_HANDLE schSCManager; - - schSCManager = OpenSCManager( NULL, // machine (NULL == local) - NULL, // database (NULL == default) - SC_MANAGER_ALL_ACCESS // access required - ); - - if( !schSCManager ) - return FALSE; - - bResult &= StopDriver( schSCManager, Name ); - bResult &= RemoveDriver( schSCManager, Name ); - - bResult &= CloseServiceHandle( schSCManager ); - - return bResult; -} - -HANDLE WINAPI LoadDriver( LPCSTR szPath, LPCSTR Name ) -{ - HANDLE sys_handle; - - - - if( !LoadDeviceDriver( Name, szPath, &sys_handle ) ) - return NULL; - else - return sys_handle; -} - -BOOL WINAPI UnloadDriver( HANDLE hDriver, LPCSTR szName ) -{ - if( !CloseHandle( hDriver ) ) - return FALSE; - return UnloadDeviceDriver( szName ); -} - -HANDLE WINAPI load_driver( - char *driver_name, /* driver name, example "xfmap" */ - char *driver_bin /* driver binary, example "xfmap.sys" */ - ) -{ - char Path[ MAX_PATH ]; - GetCurrentDirectory( sizeof Path, Path ); - - sprintf( Path+lstrlen(Path), TEXT("\\%s"), driver_bin ); - return LoadDriver( Path, driver_name ); -} - -BOOL WINAPI unload_driver( - HANDLE h_driver, /* handle to loaded driver */ - char *driver_name /* driver name, example : "xfmap" */ - ) -{ - return UnloadDriver( h_driver, driver_name ); -} Index: xc/programs/Xserver/hw/xwin/obj_base.h diff -u /dev/null xc/programs/Xserver/hw/xwin/obj_base.h:1.1 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/obj_base.h Thu Apr 5 16:13:49 2001 @@ -0,0 +1,781 @@ +/* $XFree86: xc/programs/Xserver/hw/xwin/obj_base.h,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ +/* + * This file defines the macros and types necessary to define COM interfaces, + * and the three most basic COM interfaces: IUnknown, IMalloc and IClassFactory. + */ + +#ifndef __WINE_WINE_OBJ_BASE_H +#define __WINE_WINE_OBJ_BASE_H + +/***************************************************************************** + * define ICOM_MSVTABLE_COMPAT + * to implement the microsoft com vtable compatibility workaround for g++. + * + * NOTE: Turning this option on will produce a winelib that is incompatible + * with the binary emulator. + * + * If the compiler supports the com_interface attribute, leave this off, and + * define the ICOM_USE_COM_INTERFACE_ATTRIBUTE macro below. This may also + * require the addition of the -vtable-thunks option for g++. + * + * If you aren't interested in WineLib C++ compatability at all, leave both + * options off. + * + * The preferable method for using ICOM_USE_COM_INTERFACE_ATTRIBUTE macro + * would be to define it only for your WineLib application. This allows you + * to have both binary and WineLib compatibility for C and C++ at the same + * time :) + */ +/* #define ICOM_MSVTABLE_COMPAT 1 */ +/* #define ICOM_USE_COM_INTERFACE_ATTRIBUTE 1 */ + +/***************************************************************************** + * Defines the basic types + */ +#include <wtypes.h> +/*#include "guiddef.h"*/ + +typedef CHAR OLECHAR16; +typedef LPSTR LPOLESTR16; +typedef LPCSTR LPCOLESTR16; +typedef OLECHAR16 *BSTR16; +typedef BSTR16 *LPBSTR16; +#define OLESTR16(x) x + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef NONAMELESSSTRUCT +#define LISet32(li, v) ((li).HighPart = (v) < 0 ? -1 : 0, (li).LowPart = (v)) +#define ULISet32(li, v) ((li).HighPart = 0, (li).LowPart = (v)) +#else +#define LISet32(li, v) ((li).s.HighPart = (v) < 0 ? -1 : 0, (li).s.LowPart = (v)) +#define ULISet32(li, v) ((li).s.HighPart = 0, (li).s.LowPart = (v)) +#endif + +/***************************************************************************** + * GUID API + */ +HRESULT WINAPI StringFromCLSID16(REFCLSID id, LPOLESTR16*); +HRESULT WINAPI StringFromCLSID(REFCLSID id, LPOLESTR*); + +HRESULT WINAPI CLSIDFromString16(LPCOLESTR16, CLSID *); +HRESULT WINAPI CLSIDFromString(LPCOLESTR, CLSID *); + +HRESULT WINAPI CLSIDFromProgID16(LPCOLESTR16 progid, LPCLSID riid); +HRESULT WINAPI CLSIDFromProgID(LPCOLESTR progid, LPCLSID riid); + +HRESULT WINAPI ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID); + + +INT WINAPI StringFromGUID2(REFGUID id, LPOLESTR str, INT cmax); + + +/***************************************************************************** + * Macros to define a COM interface + */ +/* + * The goal of the following set of definitions is to provide a way to use the same + * header file definitions to provide both a C interface and a C++ object oriented + * interface to COM interfaces. The type of interface is selected automatically + * depending on the language but it is always possible to get the C interface in C++ + * by defining CINTERFACE. + * + * It is based on the following assumptions: + * - all COM interfaces derive from IUnknown, this should not be a problem. + * - the header file only defines the interface, the actual fields are defined + * separately in the C file implementing the interface. + * + * The natural approach to this problem would be to make sure we get a C++ class and + * virtual methods in C++ and a structure with a table of pointer to functions in C. + * Unfortunately the layout of the virtual table is compiler specific, the layout of + * g++ virtual tables is not the same as that of an egcs virtual table which is not the + * same as that generated by Visual C+. There are workarounds to make the virtual tables + * compatible via padding but unfortunately the one which is imposed to the WINE emulator + * by the Windows binaries, i.e. the Visual C++ one, is the most compact of all. + * + * So the solution I finally adopted does not use virtual tables. Instead I use inline + * non virtual methods that dereference the method pointer themselves and perform the call. + * + * Let's take Direct3D as an example: + * + * #define ICOM_INTERFACE IDirect3D + * #define IDirect3D_METHODS \ + * ICOM_METHOD1(HRESULT,Initialize, REFIID,) \ + * ICOM_METHOD2(HRESULT,EnumDevices, LPD3DENUMDEVICESCALLBACK,, LPVOID,) \ + * ICOM_METHOD2(HRESULT,CreateLight, LPDIRECT3DLIGHT*,, IUnknown*,) \ + * ICOM_METHOD2(HRESULT,CreateMaterial,LPDIRECT3DMATERIAL*,, IUnknown*,) \ + * ICOM_METHOD2(HRESULT,CreateViewport,LPDIRECT3DVIEWPORT*,, IUnknown*,) \ + * ICOM_METHOD2(HRESULT,FindDevice, LPD3DFINDDEVICESEARCH,, LPD3DFINDDEVICERESULT,) + * #define IDirect3D_IMETHODS \ + * IUnknown_IMETHODS \ + * IDirect3D_METHODS + * ICOM_DEFINE(IDirect3D,IUnknown) + * #undef ICOM_INTERFACE + * + * #ifdef ICOM_CINTERFACE + * // *** IUnknown methods *** // + * #define IDirect3D_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) + * #define IDirect3D_AddRef(p) ICOM_CALL (AddRef,p) + * #define IDirect3D_Release(p) ICOM_CALL (Release,p) + * // *** IDirect3D methods *** // + * #define IDirect3D_Initialize(p,a) ICOM_CALL1(Initialize,p,a) + * #define IDirect3D_EnumDevices(p,a,b) ICOM_CALL2(EnumDevice,p,a,b) + * #define IDirect3D_CreateLight(p,a,b) ICOM_CALL2(CreateLight,p,a,b) + * #define IDirect3D_CreateMaterial(p,a,b) ICOM_CALL2(CreateMaterial,p,a,b) + * #define IDirect3D_CreateViewport(p,a,b) ICOM_CALL2(CreateViewport,p,a,b) + * #define IDirect3D_FindDevice(p,a,b) ICOM_CALL2(FindDevice,p,a,b) + * #endif + * + * Comments: + * - The ICOM_INTERFACE macro is used in the ICOM_METHOD macros to define the type of the 'this' + * pointer. Defining this macro here saves us the trouble of having to repeat the interface + * name everywhere. Note however that because of the way macros work, a macro like ICOM_METHOD1 + * cannot use 'ICOM_INTERFACE##_VTABLE' because this would give 'ICOM_INTERFACE_VTABLE' and not + * 'IDirect3D_VTABLE'. + * - ICOM_METHODS defines the methods specific to this interface. It is then aggregated with the + * inherited methods to form ICOM_IMETHODS. + * - ICOM_IMETHODS defines the list of methods that are inheritable from this interface. It must + * be written manually (rather than using a macro to generate the equivalent code) to avoid + * macro recursion (which compilers don't like). + * - The ICOM_DEFINE finally declares all the structures necessary for the interface. We have to + * explicitly use the interface name for macro expansion reasons again. + * Inherited methods are inherited in C by using the IDirect3D_METHODS macro and the parent's + * Xxx_IMETHODS macro. In C++ we need only use the IDirect3D_METHODS since method inheritance + * is taken care of by the language. + * - In C++ the ICOM_METHOD macros generate a function prototype and a call to a function pointer + * method. This means using once 't1 p1, t2 p2, ...' and once 'p1, p2' without the types. The + * only way I found to handle this is to have one ICOM_METHOD macro per number of parameters and + * to have it take only the type information (with const if necessary) as parameters. + * The 'undef ICOM_INTERFACE' is here to remind you that using ICOM_INTERFACE in the following + * macros will not work. This time it's because the ICOM_CALL macro expansion is done only once + * the 'IDirect3D_Xxx' macro is expanded. And by that time ICOM_INTERFACE will be long gone + * anyway. + * - You may have noticed the double commas after each parameter type. This allows you to put the + * name of that parameter which I think is good for documentation. It is not required and since + * I did not know what to put there for this example (I could only find doc about IDirect3D2), + * I left them blank. + * - Finally the set of 'IDirect3D_Xxx' macros is a standard set of macros defined to ease access + * to the interface methods in C. Unfortunately I don't see any way to avoid having to duplicate + * the inherited method definitions there. This time I could have used a trick to use only one + * macro whatever the number of parameters but I prefered to have it work the same way as above. + * - You probably have noticed that we don't define the fields we need to actually implement this + * interface: reference count, pointer to other resources and miscellaneous fields. That's + * because these interfaces are just that: interfaces. They may be implemented more than once, in + * different contexts and sometimes not even in Wine. Thus it would not make sense to impose + * that the interface contains some specific fields. + * + * + * In C this gives: + * typedef struct IDirect3DVtbl IDirect3DVtbl; + * struct IDirect3D { + * IDirect3DVtbl* lpVtbl; + * }; + * struct IDirect3DVtbl { + * HRESULT (*fnQueryInterface)(IDirect3D* me, REFIID riid, LPVOID* ppvObj); + * ULONG (*fnQueryInterface)(IDirect3D* me); + * ULONG (*fnQueryInterface)(IDirect3D* me); + * HRESULT (*fnInitialize)(IDirect3D* me, REFIID a); + * HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b); + * HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b); + * HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b); + * HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b); + * HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b); + * }; + * + * #ifdef ICOM_CINTERFACE + * // *** IUnknown methods *** // + * #define IDirect3D_QueryInterface(p,a,b) (p)->lpVtbl->fnQueryInterface(p,a,b) + * #define IDirect3D_AddRef(p) (p)->lpVtbl->fnAddRef(p) + * #define IDirect3D_Release(p) (p)->lpVtbl->fnRelease(p) + * // *** IDirect3D methods *** // + * #define IDirect3D_Initialize(p,a) (p)->lpVtbl->fnInitialize(p,a) + * #define IDirect3D_EnumDevices(p,a,b) (p)->lpVtbl->fnEnumDevice(p,a,b) + * #define IDirect3D_CreateLight(p,a,b) (p)->lpVtbl->fnCreateLight(p,a,b) + * #define IDirect3D_CreateMaterial(p,a,b) (p)->lpVtbl->fnCreateMaterial(p,a,b) + * #define IDirect3D_CreateViewport(p,a,b) (p)->lpVtbl->fnCreateViewport(p,a,b) + * #define IDirect3D_FindDevice(p,a,b) (p)->lpVtbl->fnFindDevice(p,a,b) + * #endif + * + * Comments: + * - IDirect3D only contains a pointer to the IDirect3D virtual/jump table. This is the only thing + * the user needs to know to use the interface. Of course the structure we will define to + * implement this interface will have more fields but the first one will match this pointer. + * - The code generated by ICOM_DEFINE defines both the structure representing the interface and + * the structure for the jump table. ICOM_DEFINE uses the parent's Xxx_IMETHODS macro to + * automatically repeat the prototypes of all the inherited methods and then uses IDirect3D_METHODS + * to define the IDirect3D methods. + * - Each method is declared as a pointer to function field in the jump table. The implementation + * will fill this jump table with appropriate values, probably using a static variable, and + * initialize the lpVtbl field to point to this variable. + * - The IDirect3D_Xxx macros then just derefence the lpVtbl pointer and use the function pointer + * corresponding to the macro name. This emulates the behavior of a virtual table and should be + * just as fast. + * - This C code should be quite compatible with the Windows headers both for code that uses COM + * interfaces and for code implementing a COM interface. + * + * + * And in C++ (with gcc's g++): + * + * typedef struct IDirect3D: public IUnknown { + * private: HRESULT (*fnInitialize)(IDirect3D* me, REFIID a); + * public: inline HRESULT Initialize(REFIID a) { return ((IDirect3D*)t.lpVtbl)->fnInitialize(this,a); }; + * private: HRESULT (*fnEnumDevices)(IDirect3D* me, LPD3DENUMDEVICESCALLBACK a, LPVOID b); + * public: inline HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK a, LPVOID b) + * { return ((IDirect3D*)t.lpVtbl)->fnEnumDevices(this,a,b); }; + * private: HRESULT (*fnCreateLight)(IDirect3D* me, LPDIRECT3DLIGHT* a, IUnknown* b); + * public: inline HRESULT CreateLight(LPDIRECT3DLIGHT* a, IUnknown* b) + * { return ((IDirect3D*)t.lpVtbl)->fnCreateLight(this,a,b); }; + * private: HRESULT (*fnCreateMaterial)(IDirect3D* me, LPDIRECT3DMATERIAL* a, IUnknown* b); + * public: inline HRESULT CreateMaterial(LPDIRECT3DMATERIAL* a, IUnknown* b) + * { return ((IDirect3D*)t.lpVtbl)->fnCreateMaterial(this,a,b); }; + * private: HRESULT (*fnCreateViewport)(IDirect3D* me, LPDIRECT3DVIEWPORT* a, IUnknown* b); + * public: inline HRESULT CreateViewport(LPDIRECT3DVIEWPORT* a, IUnknown* b) + * { return ((IDirect3D*)t.lpVtbl)->fnCreateViewport(this,a,b); }; + * private: HRESULT (*fnFindDevice)(IDirect3D* me, LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b); + * public: inline HRESULT FindDevice(LPD3DFINDDEVICESEARCH a, LPD3DFINDDEVICERESULT b) + * { return ((IDirect3D*)t.lpVtbl)->fnFindDevice(this,a,b); }; + * }; + * + * Comments: + * - In C++ IDirect3D does double duty as both the virtual/jump table and as the interface + * definition. The reason for this is to avoid having to duplicate the mehod definitions: once + * to have the function pointers in the jump table and once to have the methods in the interface + * class. Here one macro can generate both. This means though that the first pointer, t.lpVtbl + * defined in IUnknown, must be interpreted as the jump table pointer if we interpret the + * structure as the the interface class, and as the function pointer to the QueryInterface + * method, t.fnQueryInterface, if we interpret the structure as the jump table. Fortunately this + * gymnastic is entirely taken care of in the header of IUnknown. + * - Of course in C++ we use inheritance so that we don't have to duplicate the method definitions. + * - Since IDirect3D does double duty, each ICOM_METHOD macro defines both a function pointer and + * a non-vritual inline method which dereferences it and calls it. This way this method behaves + * just like a virtual method but does not create a true C++ virtual table which would break the + * structure layout. If you look at the implementation of these methods you'll notice that they + * would not work for void functions. We have to return something and fortunately this seems to + * be what all the COM methods do (otherwise we would need another set of macros). + * - Note how the ICOM_METHOD generates both function prototypes mixing types and formal parameter + * names and the method invocation using only the formal parameter name. This is the reason why + * we need different macros to handle different numbers of parameters. + * - Finally there is no IDirect3D_Xxx macro. These are not needed in C++ unless the CINTERFACE + * macro is defined in which case we would not be here. + * - This C++ code works well for code that just uses COM interfaces. But it will not work with + * C++ code implement a COM interface. That's because such code assumes the interface methods + * are declared as virtual C++ methods which is not the case here. + * + * + * Implementing a COM interface. + * + * This continues the above example. This example assumes that the implementation is in C. + * + * typedef struct _IDirect3D { + * void* lpVtbl; + * // ... + * + * } _IDirect3D; + * + * static ICOM_VTABLE(IDirect3D) d3dvt; + * + * // implement the IDirect3D methods here + * + * int IDirect3D_fnQueryInterface(IDirect3D* me) + * { + * ICOM_THIS(IDirect3D,me); + * // ... + * } + * + * // ... + * + * static ICOM_VTABLE(IDirect3D) d3dvt = { + * ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE + * IDirect3D_fnQueryInterface, + * IDirect3D_fnAdd, + * IDirect3D_fnAdd2, + * IDirect3D_fnInitialize, + * IDirect3D_fnSetWidth + * }; + * + * Comments: + * - We first define what the interface really contains. This is th e_IDirect3D structure. The + * first field must of course be the virtual table pointer. Everything else is free. + * - Then we predeclare our static virtual table variable, we will need its address in some + * methods to initialize the virtual table pointer of the returned interface objects. + * - Then we implement the interface methods. To match what has been declared in the header file + * they must take a pointer to a IDirect3D structure and we must cast it to an _IDirect3D so that + * we can manipulate the fields. This is performed by the ICOM_THIS macro. + * - Finally we initialize the virtual table. + */ + + +#define ICOM_VTABLE(iface) iface##Vtbl +#define ICOM_VFIELD(iface) ICOM_VTABLE(iface)* lpVtbl +#define ICOM_VTBL(iface) (iface)->lpVtbl + + +#if !defined(__cplusplus) || defined(CINTERFACE) +#define ICOM_CINTERFACE 1 +#endif + +#ifndef ICOM_CINTERFACE +/* C++ interface */ + +#define ICOM_METHOD(ret,xfn) \ + public: virtual ret CALLBACK (xfn)(void) = 0; +#define ICOM_METHOD1(ret,xfn,ta,na) \ + public: virtual ret CALLBACK (xfn)(ta a) = 0; +#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b) = 0; +#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c) = 0; +#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d) = 0; +#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e) = 0; +#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0; +#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0; +#define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0; +#define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i) = 0; +#define ICOM_METHOD10(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j) = 0; +#define ICOM_METHOD11(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ + public: virtual ret CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k) = 0; + + +#define ICOM_VMETHOD(xfn) \ + public: virtual void CALLBACK (xfn)(void) = 0; +#define ICOM_VMETHOD1(xfn,ta,na) \ + public: virtual void CALLBACK (xfn)(ta a) = 0; +#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \ + public: virtual void CALLBACK (xfn)(ta a,tb b) = 0; +#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c) = 0; +#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d) = 0; +#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e) = 0; +#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f) = 0; +#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g) = 0; +#define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h) = 0; +#define ICOM_VMETHOD9(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i) = 0; +#define ICOM_VMETHOD10(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i, tj j) = 0; +#define ICOM_VMETHOD11(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ + public: virtual void CALLBACK (xfn)(ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i, tj j, tk k) = 0; + + +#ifdef ICOM_USE_COM_INTERFACE_ATTRIBUTE + +#define ICOM_DEFINE(iface,ibase) \ + typedef struct iface: public ibase { \ + iface##_METHODS \ + } __attribute__ ((com_interface)); + +#else + +#define ICOM_DEFINE(iface,ibase) \ + typedef struct iface: public ibase { \ + iface##_METHODS \ + }; + +#endif /* ICOM_USE_COM_INTERFACE_ATTRIBUTE */ + +#define ICOM_CALL(xfn, p) (p)->xfn() +#define ICOM_CALL1(xfn, p,a) (p)->xfn(a) +#define ICOM_CALL2(xfn, p,a,b) (p)->xfn(a,b) +#define ICOM_CALL3(xfn, p,a,b,c) (p)->xfn(a,b,c) +#define ICOM_CALL4(xfn, p,a,b,c,d) (p)->xfn(a,b,c,d) +#define ICOM_CALL5(xfn, p,a,b,c,d,e) (p)->xfn(a,b,c,d,e) +#define ICOM_CALL6(xfn, p,a,b,c,d,e,f) (p)->xfn(a,b,c,d,e,f) +#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) (p)->xfn(a,b,c,d,e,f,g) +#define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) (p)->xfn(a,b,c,d,e,f,g,h) +#define ICOM_CALL9(xfn, p,a,b,c,d,e,f,g,h,i) (p)->xfn(a,b,c,d,e,f,g,h,i) +#define ICOM_CALL10(xfn, p,a,b,c,d,e,f,g,h,i,j) (p)->xfn(a,b,c,d,e,f,g,h,i,j) +#define ICOM_CALL11(xfn, p,a,b,c,d,e,f,g,h,i,j,k) (p)->xfn(a,b,c,d,e,f,g,h,i,j,k) + + +#else +/* C interface */ + + +#ifdef __WINE__ + +#define ICOM_METHOD(ret,xfn) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me); +#define ICOM_METHOD1(ret,xfn,ta,na) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a); +#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b); +#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); +#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); +#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); +#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); +#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); +#define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h); +#define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i); +#define ICOM_METHOD10(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j); +#define ICOM_METHOD11(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ + ret CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k); + +#define ICOM_VMETHOD(xfn) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me); +#define ICOM_VMETHOD1(xfn,ta,na) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a); +#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b); +#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); +#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); +#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); +#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); +#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); +#define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,nh) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h); +#define ICOM_VMETHOD9(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ni) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i); +#define ICOM_VMETHOD10(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,nj) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j); +#define ICOM_VMETHOD11(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,nk) \ + void CALLBACK (*fn##xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k); + +#define ICOM_CALL(xfn, p) ICOM_VTBL(p)->fn##xfn(p) +#define ICOM_CALL1(xfn, p,a) ICOM_VTBL(p)->fn##xfn(p,a) +#define ICOM_CALL2(xfn, p,a,b) ICOM_VTBL(p)->fn##xfn(p,a,b) +#define ICOM_CALL3(xfn, p,a,b,c) ICOM_VTBL(p)->fn##xfn(p,a,b,c) +#define ICOM_CALL4(xfn, p,a,b,c,d) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d) +#define ICOM_CALL5(xfn, p,a,b,c,d,e) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e) +#define ICOM_CALL6(xfn, p,a,b,c,d,e,f) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f) +#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g) +#define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g,h) +#define ICOM_CALL9(xfn, p,a,b,c,d,e,f,g,h,i) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g,h,i) +#define ICOM_CALL10(xfn, p,a,b,c,d,e,f,g,h,i,j) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g,h,i,j) +#define ICOM_CALL11(xfn, p,a,b,c,d,e,f,g,h,i,j,k) ICOM_VTBL(p)->fn##xfn(p,a,b,c,d,e,f,g,h,i,j,k) + +#else + +/* WINELIB case */ + +#define ICOM_METHOD(ret,xfn) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me); +#define ICOM_METHOD1(ret,xfn,ta,na) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a); +#define ICOM_METHOD2(ret,xfn,ta,na,tb,nb) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b); +#define ICOM_METHOD3(ret,xfn,ta,na,tb,nb,tc,nc) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); +#define ICOM_METHOD4(ret,xfn,ta,na,tb,nb,tc,nc,td,nd) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); +#define ICOM_METHOD5(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); +#define ICOM_METHOD6(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); +#define ICOM_METHOD7(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); +#define ICOM_METHOD8(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h); +#define ICOM_METHOD9(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i); +#define ICOM_METHOD10(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j); +#define ICOM_METHOD11(ret,xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ + ret CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k); + +#define ICOM_VMETHOD(xfn) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me); +#define ICOM_VMETHOD1(xfn,ta,na) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a); +#define ICOM_VMETHOD2(xfn,ta,na,tb,nb) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b); +#define ICOM_VMETHOD3(xfn,ta,na,tb,nb,tc,nc) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c); +#define ICOM_VMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d); +#define ICOM_VMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); +#define ICOM_VMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); +#define ICOM_VMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); +#define ICOM_VMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,nh) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h); +#define ICOM_VMETHOD9(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ni) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i); +#define ICOM_VMETHOD10(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,nj) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j); +#define ICOM_VMETHOD11(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,nk) \ + void CALLBACK (*xfn)(ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k); + +#define ICOM_CVMETHOD(xfn) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me); +#define ICOM_CVMETHOD1(xfn,ta,na) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a); +#define ICOM_CVMETHOD2(xfn,ta,na,tb,nb) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b); +#define ICOM_CVMETHOD3(xfn,ta,na,tb,nb,tc,nc) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c); +#define ICOM_CVMETHOD4(xfn,ta,na,tb,nb,tc,nc,td,nd) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d); +#define ICOM_CVMETHOD5(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e); +#define ICOM_CVMETHOD6(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f); +#define ICOM_CVMETHOD7(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g); +#define ICOM_CVMETHOD8(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h); + +#define ICOM_CVMETHOD9(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i); +#define ICOM_CVMETHOD10(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j); +#define ICOM_CVMETHOD11(xfn,ta,na,tb,nb,tc,nc,td,nd,te,ne,tf,nf,tg,ng,th,nh,ti,ni,tj,nj,tk,nk) \ + void CALLBACK (*xfn)(const ICOM_INTERFACE* me,ta a,tb b,tc c,td d,te e,tf f,tg g,th h,ti i,tj j,tk k); + +#define ICOM_CALL(xfn, p) ICOM_VTBL(p)->xfn(p) +#define ICOM_CALL1(xfn, p,a) ICOM_VTBL(p)->xfn(p,a) +#define ICOM_CALL2(xfn, p,a,b) ICOM_VTBL(p)->xfn(p,a,b) +#define ICOM_CALL3(xfn, p,a,b,c) ICOM_VTBL(p)->xfn(p,a,b,c) +#define ICOM_CALL4(xfn, p,a,b,c,d) ICOM_VTBL(p)->xfn(p,a,b,c,d) +#define ICOM_CALL5(xfn, p,a,b,c,d,e) ICOM_VTBL(p)->xfn(p,a,b,c,d,e) +#define ICOM_CALL6(xfn, p,a,b,c,d,e,f) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f) +#define ICOM_CALL7(xfn, p,a,b,c,d,e,f,g) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g) +#define ICOM_CALL8(xfn, p,a,b,c,d,e,f,g,h) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h) +#define ICOM_CALL9(xfn, p,a,b,c,d,e,f,g,h,i) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h,i) +#define ICOM_CALL10(xfn, p,a,b,c,d,e,f,g,h,i,j) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h,i,j) +#define ICOM_CALL11(xfn, p,a,b,c,d,e,f,g,h,i,j,k) ICOM_VTBL(p)->xfn(p,a,b,c,d,e,f,g,h,i,j,k) + +#endif /* __WINE__ */ + +#ifdef ICOM_MSVTABLE_COMPAT +#define ICOM_DEFINE(iface,ibase) \ + typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \ + struct iface { \ + const ICOM_VFIELD(iface); \ + }; \ + struct ICOM_VTABLE(iface) { \ + long dummyRTTI1; \ + long dummyRTTI2; \ + ibase##_IMETHODS \ + iface##_METHODS \ + }; +#define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 0,0, + +#else +#define ICOM_DEFINE(iface,ibase) \ + typedef struct ICOM_VTABLE(iface) ICOM_VTABLE(iface); \ + struct iface { \ + const ICOM_VFIELD(iface); \ + }; \ + struct ICOM_VTABLE(iface) { \ + ibase##_IMETHODS \ + iface##_METHODS \ + }; +#define ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE +#endif /* ICOM_MSVTABLE_COMPAT */ + + +#define ICOM_THIS(impl,iface) impl* const This=(impl*)iface +#define ICOM_CTHIS(impl,iface) const impl* const This=(const impl*)iface + +#endif + + +/***************************************************************************** + * Predeclare the interfaces + */ +DEFINE_OLEGUID(IID_IClassFactory, 0x00000001L, 0, 0); +typedef struct IClassFactory IClassFactory, *LPCLASSFACTORY; + +DEFINE_OLEGUID(IID_IMalloc, 0x00000002L, 0, 0); +typedef struct IMalloc IMalloc; /* ,*LPMALLOC; */ + +DEFINE_OLEGUID(IID_IUnknown, 0x00000000L, 0, 0); +typedef struct IUnknown IUnknown, *LPUNKNOWN; + +/***************************************************************************** + * IUnknown interface + */ +#define ICOM_INTERFACE IUnknown +#define IUnknown_IMETHODS \ + ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj) \ + ICOM_METHOD (ULONG,AddRef) \ + ICOM_METHOD (ULONG,Release) +#ifdef ICOM_CINTERFACE +typedef struct ICOM_VTABLE(IUnknown) ICOM_VTABLE(IUnknown); +struct IUnknown { + ICOM_VFIELD(IUnknown); +#if defined(ICOM_USE_COM_INTERFACE_ATTRIBUTE) +} __attribute__ ((com_interface)); +#else +}; +#endif /* ICOM_US_COM_INTERFACE_ATTRIBUTE */ + +struct ICOM_VTABLE(IUnknown) { +#ifdef ICOM_MSVTABLE_COMPAT + long dummyRTTI1; + long dummyRTTI2; +#endif /* ICOM_MSVTABLE_COMPAT */ + +#else /* ICOM_CINTERFACE */ +struct IUnknown { + +#endif /* ICOM_CINTERFACE */ + + ICOM_METHOD2(HRESULT,QueryInterface,REFIID,riid, LPVOID*,ppvObj) + ICOM_METHOD (ULONG,AddRef) + ICOM_METHOD (ULONG,Release) +#if defined(ICOM_USE_COM_INTERFACE_ATTRIBUTE) +} __attribute__ ((com_interface)); +#else +}; +#endif /* ICOM_US_COM_INTERFACE_ATTRIBUTE */ + +#undef ICOM_INTERFACE + +/*** IUnknown methods ***/ +#define IUnknown_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IUnknown_AddRef(p) ICOM_CALL (AddRef,p) +#define IUnknown_Release(p) ICOM_CALL (Release,p) + +/***************************************************************************** + * IClassFactory interface + */ +#define ICOM_INTERFACE IClassFactory +#define IClassFactory_METHODS \ + ICOM_METHOD3(HRESULT,CreateInstance, LPUNKNOWN,pUnkOuter, REFIID,riid, LPVOID*,ppvObject) \ + ICOM_METHOD1(HRESULT,LockServer, BOOL,fLock) +#define IClassFactory_IMETHODS \ + IUnknown_IMETHODS \ + IClassFactory_METHODS +ICOM_DEFINE(IClassFactory,IUnknown) +#undef ICOM_INTERFACE + +/*** IUnknown methods ***/ +#define IClassFactory_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IClassFactory_AddRef(p) ICOM_CALL (AddRef,p) +#define IClassFactory_Release(p) ICOM_CALL (Release,p) +/*** IClassFactory methods ***/ +#define IClassFactory_CreateInstance(p,a,b,c) ICOM_CALL3(CreateInstance,p,a,b,c) +#define IClassFactory_LockServer(p,a) ICOM_CALL1(LockServer,p,a) + + +/***************************************************************************** + * IMalloc interface + */ +#define ICOM_INTERFACE IMalloc +#define IMalloc_METHODS \ + ICOM_METHOD1 (LPVOID,Alloc, DWORD,cb) \ + ICOM_METHOD2 (LPVOID,Realloc, LPVOID,pv, DWORD,cb) \ + ICOM_VMETHOD1( Free, LPVOID,pv) \ + ICOM_METHOD1(DWORD, GetSize, LPVOID,pv) \ + ICOM_METHOD1(INT, DidAlloc, LPVOID,pv) \ + ICOM_METHOD (VOID, HeapMinimize) +#define IMalloc_IMETHODS \ + IUnknown_IMETHODS \ + IMalloc_METHODS +ICOM_DEFINE(IMalloc,IUnknown) +#undef ICOM_INTERFACE + +/*** IUnknown methods ***/ +#define IMalloc_QueryInterface(p,a,b) ICOM_CALL2(QueryInterface,p,a,b) +#define IMalloc_AddRef(p) ICOM_CALL (AddRef,p) +#define IMalloc_Release(p) ICOM_CALL (Release,p) +/*** IMalloc32 methods ***/ +#define IMalloc_Alloc(p,a) ICOM_CALL1(Alloc,p,a) +#define IMalloc_Realloc(p,a,b) ICOM_CALL2(Realloc,p,a,b) +#define IMalloc_Free(p,a) ICOM_CALL1(Free,p,a) +#define IMalloc_GetSize(p,a) ICOM_CALL1(GetSize,p,a) +#define IMalloc_DidAlloc(p,a) ICOM_CALL1(DidAlloc,p,a) +#define IMalloc_HeapMinimize(p) ICOM_CALL (HeapMinimize,p) + + +HRESULT WINAPI CoGetMalloc(DWORD dwMemContext,LPMALLOC* lpMalloc); + +LPVOID WINAPI CoTaskMemAlloc(ULONG size); + +void WINAPI CoTaskMemFree(LPVOID ptr); + +/* FIXME: unimplemented */ +LPVOID WINAPI CoTaskMemRealloc(LPVOID ptr, ULONG size); + + +/***************************************************************************** + * Additional API + */ + +HRESULT WINAPI CoCreateGuid(GUID* pguid); + +HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree); + +void WINAPI CoFreeAllLibraries(void); + +void WINAPI CoFreeLibrary(HINSTANCE hLibrary); + +void WINAPI CoFreeUnusedLibraries(void); + +HRESULT WINAPI CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv); + +HRESULT WINAPI CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, LPVOID pvReserved, REFIID iid, LPVOID *ppv); + +HRESULT WINAPI CoInitialize(LPVOID lpReserved); +HRESULT WINAPI CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit); + +void WINAPI CoUninitialize(void); + +typedef enum tagCOINIT +{ + COINIT_APARTMENTTHREADED = 0x2, /* Apartment model */ + COINIT_MULTITHREADED = 0x0, /* OLE calls objects on any thread */ + COINIT_DISABLE_OLE1DDE = 0x4, /* Don't use DDE for Ole1 support */ + COINIT_SPEED_OVER_MEMORY = 0x8 /* Trade memory for speed */ +} COINIT; + + +/* FIXME: not implemented */ +BOOL WINAPI CoIsOle1Class(REFCLSID rclsid); + +HRESULT WINAPI CoLockObjectExternal(LPUNKNOWN pUnk, BOOL fLock, BOOL fLastUnlockReleases); + +/* class registration flags; passed to CoRegisterClassObject */ +typedef enum tagREGCLS +{ + REGCLS_SINGLEUSE = 0, + REGCLS_MULTIPLEUSE = 1, + REGCLS_MULTI_SEPARATE = 2, + REGCLS_SUSPENDED = 4 +} REGCLS; + +HRESULT WINAPI CoRegisterClassObject(REFCLSID rclsid,LPUNKNOWN pUnk,DWORD dwClsContext,DWORD flags,LPDWORD lpdwRegister); + +HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister); + +/***************************************************************************** + * COM Server dll - exports + */ +HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID * ppv); +HRESULT WINAPI DllCanUnloadNow(void); + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __WINE_WINE_OBJ_BASE_H */ Index: xc/programs/Xserver/hw/xwin/win.h diff -u /dev/null xc/programs/Xserver/hw/xwin/win.h:1.6 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/win.h Tue May 8 04:14:09 2001 @@ -0,0 +1,856 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/win.h,v 1.6 2001/05/08 08:14:09 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 NO + +/* Debugging macros */ +#if CYGDEBUG +#define DEBUG_MSG(str) if (fDebugProcMsg == TRUE) MessageBox(NULL, str, szFunctionName, MB_OK ) +#else +#define DEBUG_MSG(str) +#endif + +#if CYGDEBUG +#define DEBUG_FN_NAME(str) PTSTR szFunctionName = str +#else +#define DEBUG_FN_NAME(str) +#endif + +#if CYGDEBUG +#define DEBUGVARS BOOL fDebugProcCon = FALSE, fDebugProcMsg = FALSE +#else +#define DEBUGVARS +#endif + +#if CYGDEBUG +#define DEBUGPROC_CON fDebugProcCon = TRUE +#define DEBUGPROC_MSG fDebugProcMsg = TRUE +#else +#define DEBUGPROC_CON +#define DEBUGPROC_MSG +#endif + +/* Constant strings */ +#define WINDOW_CLASS "cygwin/xfree86" +#define WINDOW_TITLE "Cygwin/XFree86" +#define WIN_SCR_PROP "cyg_screen_prop" +#define WIN_MSG_QUEUE_FNAME "/dev/windows" + +#define NEED_EVENTS + +#define WIN_DEFAULT_WIDTH 640 +#define WIN_DEFAULT_HEIGHT 480 +#define WIN_DEFAULT_DEPTH 16 +#define WIN_DEFAULT_WHITEPIXEL 255 +#define WIN_DEFAULT_BLACKPIXEL 0 +#define WIN_DEFAULT_LINEBIAS 0 +#define WIN_DEFAULT_E3B_TIME 50 /* milliseconds */ + +#define WIN_E3B_OFF -1 +#define WIN_E3B_TIMER_ID 1 +#define WIN_FD_INVALID -1 + +#define WIN_SERVER_NONE 0x0L /* 0 */ +#define WIN_SERVER_SHADOW_GDI 0x1L /* 1 */ +#define WIN_SERVER_SHADOW_DD 0x2L /* 2 */ +#define WIN_SERVER_SHADOW_DDNL 0x4L /* 4 */ +#define WIN_SERVER_PRIMARY_DD 0x8L /* 8 */ + +#define AltMapIndex Mod1MapIndex +#define NumLockMapIndex Mod2MapIndex +#define AltLangMapIndex Mod3MapIndex +#define KanaMapIndex Mod4MapIndex +#define ScrollLockMapIndex Mod5MapIndex + +#define WIN_24BPP_MASK_RED 0x00FF0000 +#define WIN_24BPP_MASK_GREEN 0x0000FF00 +#define WIN_24BPP_MASK_BLUE 0x000000FF + +/* + * We need symbols for the scan codes of keys. + */ +#include "../xfree86/common/atKeynames.h" + +#include <sys/types.h> +#include <sys/stat.h> +#include <stdio.h> +#include <errno.h> + +#include <X11/XWDFile.h> + +#ifdef HAS_MMAP +#include <sys/mman.h> +#ifndef MAP_FILE +#define MAP_FILE 0 +#endif /* MAP_FILE */ +#endif /* HAS_MMAP */ + +#include "X.h" +#include "Xproto.h" +#include "Xos.h" +#include "Xprotostr.h" +#include "scrnintstr.h" +#include "pixmapstr.h" +#include "pixmap.h" +#include "region.h" +#include "regionstr.h" +#include "gcstruct.h" +#include "colormap.h" +#include "colormapst.h" +#include "miscstruct.h" +#include "servermd.h" +#include "windowstr.h" +#include "mi.h" +#include "micmap.h" +#include "migc.h" +#include "mifillarc.h" +#include "mifpoly.h" +#include "mibstore.h" +#include "input.h" +#include "mipointer.h" +#include "keysym.h" +#include "mibstore.h" +#include "micoord.h" +#include "dix.h" +#include "miline.h" +#include "shadow.h" +#include "fb.h" + +#ifdef RENDER +#include "mipict.h" +#include "picturestr.h" +#endif + +/* + * 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 + +#include <stdio.h> + +/* + * Typedefs for engine dependent function pointers + */ + +typedef Bool (*winAllocateFBProcPtr)(ScreenPtr); + +typedef void (*winShadowUpdateProcPtr)(ScreenPtr, PixmapPtr, RegionPtr); + +typedef void *(*winShadowWindowProcPtr)(ScreenPtr, + CARD32, CARD32, + int, CARD32*); + +typedef Bool (*winCloseScreenProcPtr)(int, ScreenPtr); + +typedef Bool (*winInitVisualsProcPtr)(ScreenPtr); + +typedef Bool (*winAdjustVideoModeProcPtr)(ScreenPtr); + +typedef void (*winCreateBoundingWindowProcPtr)(ScreenPtr); + +typedef Bool (*winFinishScreenInitProcPtr)(int, ScreenPtr, int, char **); + +typedef Bool (*winBltExposedRegionsProcPtr)(ScreenPtr); + +typedef Bool (*winActivateAppProcPtr)(ScreenPtr); + +/* + * Privates structures + */ + +typedef struct { + DWORD dwDummy; +} winPrivWin; + +typedef struct { + DWORD dwDummy; +} winPrivGC; + +typedef struct +{ + ScreenPtr pScreen; + DWORD dwScreen; + DWORD dwWidth; + DWORD dwPaddedWidth; + DWORD dwHeight; + DWORD dwDepth; + DWORD dwDPIx; + DWORD dwDPIy; + DWORD dwStrideBytes; + DWORD dwStride; + DWORD dwBPP; + char *pfb; + XWDColor *pXWDCmap; + XWDFileHeader *pXWDHeader; + Pixel pixelBlack; + Pixel pixelWhite; + DWORD dwLineBias; + DWORD dwEngine; + DWORD dwEnginePreferred; + DWORD dwEnginesSupported; + Bool fFullScreen; + int iE3BTimeout; +} winScreenInfo, *winScreenInfoPtr; + +typedef struct +{ + winScreenInfoPtr pScreenInfo; + + Bool fEnabled; + Bool fClosed; + Bool fActive; + Bool fCursor; + + int iDeltaZ; + + CloseScreenProcPtr CloseScreen; + + DWORD dwRedMask; + DWORD dwGreenMask; + DWORD dwBlueMask; + DWORD dwBitsPerRGB; + + DWORD dwModeKeyStates; + + /* 3 button emulation variables */ + int iE3BCachedPress; + Bool fE3BFakeButton2Sent; + + /* Privates used by shadow fb GDI server */ + HBITMAP hbmpShadow; + HDC hdcScreen; + HDC hdcShadow; + HWND hwndScreen; + + /* Privates used by shadow fb and primary fb DirectDraw servers */ + LPDIRECTDRAW pdd; + LPDIRECTDRAWSURFACE pddsPrimary; + + /* Privates used by shadow fb DirectDraw server */ + LPDIRECTDRAWSURFACE pddsShadow; + LPDDSURFACEDESC pddsdShadow; + + /* Privates used by primary fb DirectDraw server */ + LPDIRECTDRAWSURFACE pddsOffscreen; + LPDDSURFACEDESC pddsdOffscreen; + LPDDSURFACEDESC pddsdPrimary; + + /* Privates used by shadow fb DirectDraw Nonlocking server */ + LPDIRECTDRAW4 pdd4; + LPDIRECTDRAWSURFACE4 pddsShadow4; + LPDIRECTDRAWSURFACE4 pddsPrimary4; + + /* Privates used by both shadow fb DirectDraw servers */ + LPDIRECTDRAWCLIPPER pddcPrimary; + + /* Engine specific functions */ + winAllocateFBProcPtr pwinAllocateFB; + winShadowUpdateProcPtr pwinShadowUpdate; + winShadowWindowProcPtr pwinShadowWindow; + winCloseScreenProcPtr pwinCloseScreen; + winInitVisualsProcPtr pwinInitVisuals; + winAdjustVideoModeProcPtr pwinAdjustVideoMode; + winCreateBoundingWindowProcPtr pwinCreateBoundingWindow; + winFinishScreenInitProcPtr pwinFinishScreenInit; + winBltExposedRegionsProcPtr pwinBltExposedRegions; + winActivateAppProcPtr pwinActivateApp; +} winPrivScreenRec, *winPrivScreenPtr; + +extern ColormapPtr g_cmInstalledMaps[]; +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; +extern CARD32 g_c32LastInputEventTime; + +/* + * Screen privates macros + */ +#define winGetScreenPriv(pScreen) ((winPrivScreenPtr) \ + (pScreen)->devPrivates[g_winScreenPrivateIndex].ptr) + +#define winSetScreenPriv(pScreen,v) ((pScreen)->devPrivates[g_winScreenPrivateIndex].ptr = \ + (pointer) v) + +#define winScreenPriv(pScreen) winPrivScreenPtr pScreenPriv = winGetScreenPriv(pScreen) + +/* + * Window privates macros + */ +#define winGetWindowPrivate(_pWin) ((winPrivWin *)\ + (_pWin)->devPrivates[winWindowPrivateIndex].ptr) + +/* + * FIXME: Windows mouse wheel macro; should be in Cygwin w32api headers. + * Has been fixed after May 05, 2001. Remove this section after the + * fixed headers are in distribution. + */ +#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 + */ + +/* + * InitOutput.c + */ + +DWORD +winBitsPerPixel (DWORD dwDepth); + +/* + * winallpriv.c + */ + +Bool +winAllocatePrivates (ScreenPtr pScreen); + +/* + * winblock.c + */ + +void +winBlockHandler (pointer pBlockData, + OSTimePtr pptv, + pointer pReadMask); + +/* + * winclip.c + */ + +RegionPtr +winPixmapToRegionNativeGDI (PixmapPtr pPix); + +/* + * wincmap.c + */ + +int +winListInstalledColormapsNativeGDI (ScreenPtr pScreen, Colormap *pmaps); + +Bool +winInitVisualsNativeGDI (ScreenPtr pScreen); + +void +winStoreColorsNativeGDI (ColormapPtr pmap, int ndef, xColorItem *pdefs); + +void +winInstallColormapNativeGDI (ColormapPtr pmap); + +void +winUninstallColormapNativeGDI (ColormapPtr pmap); + +void +winResolveColorNativeGDI (unsigned short *pred, + unsigned short *pgreen, + unsigned short *pblue, + VisualPtr pVisual); + +Bool +winInitializeColormapNativeGDI (ColormapPtr pmap); + +int +winExpandDirectColorsNativeGDI (ColormapPtr pmap, int ndef, + xColorItem *indefs, xColorItem *outdefs); + +Bool +winCreateDefColormapNativeGDI (ScreenPtr pScreen); + +Bool +winSetVisualTypesNativeGDI (int nDepth, int nVisuals, int nBitsPerRGB); + +void +winClearVisualTypes (void); + +/* + * wincursor.c + */ + +Bool +winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y); + +void +winCrossScreen (ScreenPtr pScreen, Bool fEntering); + +/* + * winfillsp.c + */ + +void +winFillSpansNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + int nSpans, + DDXPointPtr pPoints, + int *pWidths, + int fSorted); + +/* + * winfont.c + */ + +Bool +winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont); + +Bool +winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont); + +/* + * wingc.c + */ + +Bool +winCreateGCNativeGDI (GCPtr pGC); + +void +winChangeGCNativeGDI (GCPtr pGC, unsigned long ulChanges); + +void +winPadPixmapNativdGDI (PixmapPtr pPixmap); + +void +winValidateGCNativeGDI (GCPtr pGC, + unsigned long changes, + DrawablePtr pDrawable); + +void +winCopyGCNativeGDI (GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst); + +void +winDestroyGCNativeGDI (GCPtr pGC); + +void +winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects); + +void +winDestroyClipNativeGDI (GCPtr pGC); + +void +winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc); + +/* + * wingetsp.c + */ + +void +winGetSpansNativeGDI (DrawablePtr pDrawable, + int wMax, + DDXPointPtr pPoints, + int *pWidths, + int nSpans, + char *pDst); + +/* + * 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); + +Bool +winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam); + +/* + * winmisc.c + */ + +void +winQueryBestSizeNativeGDI (int class, unsigned short *pWidth, + unsigned short *pHeight, ScreenPtr pScreen); + +CARD8 +winCountBits (DWORD dw); + +Bool +winUpdateFBPointer (ScreenPtr pScreen, void *pbits); + +/* + * winmouse.c + */ + +void +winMouseCtrl (DeviceIntPtr pDevice, PtrCtrl *pCtrl); + +int +winMouseProc (DeviceIntPtr pDeviceInt, int iState); + +int +winMouseWheel (ScreenPtr pScreen, int iDeltaZ); + +void +winMouseButtonsSendEvent (int iEventType, int iButton); + +int +winMouseButtonsHandle (ScreenPtr pScreen, + int iEventType, int iButton, + WPARAM wParam); + +/* + * winpfbddd.c + */ + +Bool +winAllocateFBPrimaryDD (ScreenPtr pScreen); + +Bool +winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen); + +Bool +winInitVisualsPrimaryDD (ScreenPtr pScreen); + +Bool +winAdjustVideoModePrimaryDD (ScreenPtr pScreen); + +Bool +winActivateAppPrimaryDD (ScreenPtr pScreen); + +Bool +winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen); + +/* + * winpixmap.c + */ + +PixmapPtr +winCreatePixmapNativeGDI (ScreenPtr pScreen, int width, int height, int depth); + +Bool +winDestroyPixmapNativeGDI (PixmapPtr pPixmap); + +void +winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw); + +void +winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh); + +void +winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix, + int xrot, int yrot); + +/* + * winpntwin.c + */ + +void +winPaintWindowNativeGDI (WindowPtr pWin, RegionPtr pRegion, int what); + +/* + * winpolyline.c + */ + +void +winPolyLineNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + int mode, + int npt, + DDXPointPtr ppt); + +/* + * winscrinit.c + */ + +Bool +winScreenInit (int index, + ScreenPtr pScreen, + int argc, char **argv); + +Bool +winFinishScreenInitFB (int index, + ScreenPtr pScreen, + int argc, char **argv); + +Bool +winFinishScreenInitNativeGDI (int index, + ScreenPtr pScreen, + int argc, char **argv); + +Bool +winSaveScreen (ScreenPtr pScreen, int on); + +PixmapPtr +winGetWindowPixmap (WindowPtr pWin); + +void +winSetWindowPixmap (WindowPtr pWin, PixmapPtr pPix); + +Bool +winDetectSupportedEngines (ScreenPtr pScreen); + +Bool +winSetEngine (ScreenPtr pScreen); + +void +winCreateBoundingWindowFullScreen (ScreenPtr pScreen); + +void +winCreateBoundingWindowWindowed (ScreenPtr pScreen); + +/* + * winsetsp.c + */ + +void +winSetSpansNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + char *pSrc, + DDXPointPtr pPoints, + int *pWidth, + int nSpans, + int fSorted); + +/* + * winshaddd.c + */ + +Bool +winAllocateFBShadowDD (ScreenPtr pScreen); + +void +winShadowUpdateDD (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage); + +void * +winShadowSetWindowLinearDD (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize); + +void * +winShadowWindowDD (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size); + +Bool +winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen); + +Bool +winInitVisualsShadowDD (ScreenPtr pScreen); + +Bool +winAdjustVideoModeShadowDD (ScreenPtr pScreen); + +Bool +winBltExposedRegionsShadowDD (ScreenPtr pScreen); + +Bool +winActivateAppShadowDD (ScreenPtr pScreen); + +Bool +winSetEngineFunctionsShadowDD (ScreenPtr pScreen); + +/* + * winshadddnl.c + */ + +Bool +winAllocateFBShadowDDNL (ScreenPtr pScreen); + +void +winShadowUpdateDDNL (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage); + +void * +winShadowSetWindowLinearDDNL (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize); + +void * +winShadowWindowDDNL (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size); + +Bool +winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen); + +Bool +winInitVisualsShadowDDNL (ScreenPtr pScreen); + +Bool +winAdjustVideoModeShadowDDNL (ScreenPtr pScreen); + +Bool +winBltExposedRegionsShadowDDNL (ScreenPtr pScreen); + +Bool +winActivateAppShadowDDNL (ScreenPtr pScreen); + +Bool +winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen); + +/* + * winshadgdi.c + */ + +Bool +winAllocateFBShadowGDI (ScreenPtr pScreen); + +void +winShadowUpdateGDI (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage); + +void * +winShadowSetWindowLinearGDI (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize); + +void * +winShadowWindowGDI (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size); + +Bool +winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen); + +Bool +winInitVisualsShadowGDI (ScreenPtr pScreen); + +Bool +winAdjustVideoModeShadowGDI (ScreenPtr pScreen); + +Bool +winActivateAppShadowGDI (ScreenPtr pScreen); + +Bool +winSetEngineFunctionsShadowGDI (ScreenPtr pScreen); + +/* + * winwakeup.c + */ + +void +winWakeupHandler (pointer pWakeupData, + int err, + pointer pReadmask); + +/* + * winwindow.c + */ + +Bool +winCreateWindowNativeGDI (WindowPtr pWin); + +Bool +winDestroyWindowNativeGDI (WindowPtr pWin); + +Bool +winPositionWindowNativeGDI (WindowPtr pWin, int x, int y); + +void +winCopyWindowNativeGDI (WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc); + +Bool +winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask); + +Bool +winUnmapWindowNativeGDI (WindowPtr pWindow); + +Bool +winMapWindowNativeGDI (WindowPtr pWindow); + +/* + * winwndproc.c + */ + +LRESULT CALLBACK +winWindowProc (HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam); + +void +winRestoreModeKeyStates (ScreenPtr pScreen); + +/* + * END DDX and DIX Function Prototypes + */ + +#endif /* _WIN_H_ */ + Index: xc/programs/Xserver/hw/xwin/winallpriv.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winallpriv.c:1.3 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winallpriv.c Mon May 14 12:52:33 2001 @@ -0,0 +1,68 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Keith Packard, MIT X Consortium + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winallpriv.c,v 1.3 2001/05/14 16:52:33 alanh Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 58 */ +Bool +winAllocatePrivates (ScreenPtr pScreen) +{ + winPrivScreenPtr pScreenPriv; + + /* We need a new slot for our privates if the screen gen has changed */ + if (g_winGeneration != serverGeneration) + { + /* Get an index that we can store our privates at */ + g_winScreenPrivateIndex = AllocateScreenPrivateIndex (); + g_winGeneration = serverGeneration; + } + + /* Allocate memory for our private structure */ + pScreenPriv = (winPrivScreenPtr) xalloc (sizeof (*pScreenPriv)); + if (!pScreenPriv) + { + ErrorF ("winAllocatePrivates () - xalloc () failed\n"); + return FALSE; + } + + /* Initialize the memory of the private structure */ + ZeroMemory (pScreenPriv, sizeof (winPrivScreenRec)); + + /* Intialize private structure members */ + pScreenPriv->fActive = TRUE; + pScreenPriv->fCursor = TRUE; + + /* Save the screen private pointer */ + winSetScreenPriv (pScreen, pScreenPriv); + + return TRUE; +} Index: xc/programs/Xserver/hw/xwin/winblock.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winblock.c:1.2 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winblock.c Wed Apr 18 13:14:06 2001 @@ -0,0 +1,40 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winblock.c,v 1.2 2001/04/18 17:14:06 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 6 */ +void +winBlockHandler (pointer pBlockData, + OSTimePtr pptv, + pointer pReadMask) +{ +} Index: xc/programs/Xserver/hw/xwin/winclip.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winclip.c:1.1 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winclip.c Thu Apr 5 16:13:49 2001 @@ -0,0 +1,40 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winclip.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +/* Look at mfb/mfbclip.c for sample implementation */ +RegionPtr +winPixmapToRegionNativeGDI (PixmapPtr pPix) +{ + fprintf (stderr, "winPixmapToRegion()\n"); + return NULL; +} Index: xc/programs/Xserver/hw/xwin/wincmap.c diff -u /dev/null xc/programs/Xserver/hw/xwin/wincmap.c:1.4 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/wincmap.c Mon May 14 12:52:33 2001 @@ -0,0 +1,432 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wincmap.c,v 1.4 2001/05/14 16:52:33 alanh Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 30 */ +int +winListInstalledColormapsNativeGDI (ScreenPtr pScreen, Colormap *pmaps) +{ + /* + * By the time we are processing requests, we can guarantee that there + * is always a colormap installed + */ + + ErrorF ("\nwinListInstalledColormaps ()\n"); + return miListInstalledColormaps (pScreen, pmaps); +} + +/* See Porting Layer Definition - p. 30 */ +/* See Programming Windows - p. 663 */ +void +winInstallColormapNativeGDI (ColormapPtr pmap) +{ + ErrorF ("\nwinInstallColormap ()\n"); + miInstallColormap (pmap); +} + +/* See Porting Layer Definition - p. 30 */ +void +winUninstallColormapNativeGDI (ColormapPtr pmap) +{ + ErrorF ("\nwinUninstallColormap ()\n"); + miUninstallColormap (pmap); +} + +/* See Porting Layer Definition - p. 30 */ +void +winStoreColorsNativeGDI (ColormapPtr pmap, int ndef, xColorItem *pdefs) +{ + ErrorF ("winStoreColors ()\n"); +#if 0 + miStoreColors (pmap, ndef, pdefs); +#endif +} + +/* See Porting Layer Definition - p. 30 */ +void +winResolveColorNativeGDI (unsigned short *pred, + unsigned short *pgreen, + unsigned short *pblue, + VisualPtr pVisual) +{ + ErrorF ("\nwinResolveColor ()\n"); + miResolveColor (pred, pgreen, pblue, pVisual); +} + +/* See Porting Layer Definition - p. 29 */ +/* Also refered to as CreateColormap */ +Bool +winInitializeColormapNativeGDI (ColormapPtr pmap) +{ + ErrorF ("\nwinInitializeColormap ()\n"); +#if 0 + return miInitializeColormap (pmap); +#endif + return TRUE; +} + +int +winExpandDirectColorsNativeGDI (ColormapPtr pmap, int ndef, + xColorItem *indefs, xColorItem *outdefs) +{ + ErrorF ("\nwinExpandDirectColors ()\n"); + return miExpandDirectColors (pmap, ndef, indefs, outdefs); +} + +Bool +winCreateDefColormapNativeGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + Bool fReturn = TRUE; + VisualPtr pVisual; + ColormapPtr pcmap = NULL; + int i; + Pixel pixel; + unsigned short nRed, nGreen, nBlue; + UINT uiSystemPaletteEntries; + PALETTEENTRY *ppeColors = NULL; + + /* Find the root visual */ + for (pVisual = pScreen->visuals; + pVisual->vid != pScreen->rootVisual; + pVisual++); + + /* + * AllocNone for Dynamic visual classes, + * AllocAll for non-Dynamic visual classes. + */ + + /* Allocate an X colormap, owned by client 0 */ + if (CreateColormap(pScreen->defColormap, pScreen, pVisual, &pcmap, + AllocNone, 0) != Success) + { + ErrorF ("winCreateDefColormapNativeGDI () - CreateColormap failed\n"); + return FALSE; + } + if (pcmap == NULL) + { + ErrorF ("winCreateDefColormap () - Colormap could not be created\n"); + return FALSE; + } + ErrorF ("winCreateDefColormap () - Created a colormap\n"); + + /* Get the number of entries in the system palette */ + uiSystemPaletteEntries = GetSystemPaletteEntries (pScreenPriv->hdcScreen, + 0, 0, NULL); + ErrorF ("winCreateDefColormap () - uiSystemPaletteEntries %d\n", + uiSystemPaletteEntries); + + /* Allocate palette entries structure */ + ppeColors = xalloc (uiSystemPaletteEntries * sizeof (PALETTEENTRY)); + + /* Get system palette entries */ + GetSystemPaletteEntries (pScreenPriv->hdcScreen, + 0, uiSystemPaletteEntries, ppeColors); + + /* Allocate an X colormap entry for every system palette entry */ + for (i = 0; i < uiSystemPaletteEntries; ++i) + { + pixel = i; + + /* Extract the color values for current palette entry */ + nRed = ppeColors[i].peRed << 8; + nGreen = ppeColors[i].peGreen << 8; + nBlue = ppeColors[i].peBlue << 8; + +#if 0 + ErrorF ("winCreateDefColormap () - Allocating a color: %d; "\ + "%d %d %d ", + pixel, nRed, nGreen, nBlue); + if (AllocColor (pcmap, + &nRed, + &nGreen, + &nBlue, + &pixel, + 0) != Success) + break; +#endif + + pcmap->red[i].co.local.red = nRed; + pcmap->red[i].co.local.green = nGreen; + pcmap->red[i].co.local.blue = nBlue; + } + + if (uiSystemPaletteEntries == 0) + { + fbInitializeColormap (pcmap); + } + else + { + /* Set the black and white pixel indices */ + pScreen->whitePixel = uiSystemPaletteEntries - 1; + pScreen->blackPixel = 0; + } + + /* Free colormap */ + free (ppeColors); + + /* Install the created colormap */ + (*pScreen->InstallColormap)(pcmap); + + return fReturn; +} + +void +winClearVisualTypes (void) +{ +#if CYGDEBUG + ErrorF ("winClearVisualTypes ()\n"); +#endif + miClearVisualTypes (); +} + +Bool +winSetVisualTypesNativeGDI (int nDepth, int nVisuals, int nBitsPerRGB) +{ +#if CYGDEBUG + ErrorF ("winSetVisualTypes ()\n"); +#endif + return miSetVisualTypes (nDepth, nVisuals, nBitsPerRGB, -1); +} + +Bool +winInitVisualsNativeGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HBITMAP hbmp; + BITMAPINFO *pbmi = xalloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + BITMAPV4HEADER *pbmih = (BITMAPV4HEADER*) pbmi; + HDC hdc = GetDC (NULL); + + /* Exit if we could not allocate a bitmapinfo structure */ + if (pbmi == NULL) + { + ErrorF ("winInitVisuals () - Could not allocate a "\ + "bitmapinfo structure\n"); + return FALSE; + } + + /* Create a bitmap compatible with the primary display */ + hbmp = CreateCompatibleBitmap (hdc, 1, 1); + + ZeroMemory (pbmi, sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); + pbmi->bmiHeader.biSize = sizeof (BITMAPINFOHEADER); + + /* Call GetDIBits for the first time; doesn't do much */ + /* + * NOTE: This doesn't actually return the bits, because our + * data pointer is NULL; therefore, we don't have to free + * memory later. + */ + GetDIBits (hdc, hbmp, + 0, 0, + NULL, + pbmi, + 0); + +#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) + && (pbmih->bV4RedMask == 0x0 + || pbmih->bV4GreenMask == 0x0 + || pbmih->bV4BlueMask == 0x0)) + { + GetDIBits (hdc, hbmp, + 0, 0, + NULL, + pbmi, + 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) + { + case 32: + case 24: + if (pbmih->bV4RedMask != 0x00FF0000) + { + pbmih->bV4RedMask = 0x00FF0000; + } + if (pbmih->bV4GreenMask != 0x0000FF00) + { + pbmih->bV4GreenMask = 0x0000FF00; + } + if (pbmih->bV4BlueMask != 0x000000FF) + { + pbmih->bV4BlueMask = 0x000000FF; + } + break; + + case 16: + if (pbmih->bV4RedMask != 0x0000F800 && pbmih->bV4RedMask != 0x00007C00) + { + pbmih->bV4RedMask = 0x0000F800; + } + if (pbmih->bV4GreenMask != 0x00007E0 + && pbmih->bV4GreenMask != 0x000003E0) + { + pbmih->bV4GreenMask = 0x000007E0; + } + if (pbmih->bV4BlueMask != 0x0000001F) + { + pbmih->bV4BlueMask = 0x0000001F; + } + break; + } + +#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; + pScreenPriv->dwGreenMask = pbmih->bV4GreenMask; + pScreenPriv->dwBlueMask = pbmih->bV4BlueMask; + + /* Release the DC and the bitmap that were used for querying */ + ReleaseDC (NULL, hdc); + DeleteObject (hbmp); + + /* Set the significant bits per red, green, and blue */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + pScreenPriv->dwBitsPerRGB = 8; + break; + + case 16: + if (pScreenPriv->dwRedMask == 0xF800) + { + pScreenPriv->dwBitsPerRGB = 6; + } + else + { + pScreenPriv->dwBitsPerRGB = 5; + } + break; + + case 15: + pScreenPriv->dwBitsPerRGB = 5; + break; + + case 8: + pScreenPriv->dwBitsPerRGB = 8; + pScreenPriv->dwRedMask = 0; + pScreenPriv->dwGreenMask = 0; + pScreenPriv->dwBlueMask = 0; + break; + + default: + pScreenPriv->dwBitsPerRGB = 0; + break; + } + + /* Tell the user how many bits per RGB we are using */ + ErrorF ("winInitVisuals () - Using dwBitsPerRGB: %d\n", + pScreenPriv->dwBitsPerRGB); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + case 16: + case 15: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); + return FALSE; + } + break; + + case 8: + ErrorF ("winInitVisuals () - Calling miSetVisualTypesAndMasks\n"); + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + PseudoColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisuals () - miSetVisualTypesAndMasks failed\n"); + return FALSE; + } +#if CYGDEBUG + ErrorF ("winInitVisuals () - Returned from miSetVisualTypesAndMasks\n"); +#endif + break; + + default: + break; + } + + /* Free memory */ + xfree (pbmi); + +#if CYGDEBUG + ErrorF ("winInitVisuals () - Returning\n"); +#endif + + return TRUE; +} Index: xc/programs/Xserver/hw/xwin/wincursor.c diff -u /dev/null xc/programs/Xserver/hw/xwin/wincursor.c:1.2 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/wincursor.c Mon May 14 12:52:33 2001 @@ -0,0 +1,55 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wincursor.c,v 1.2 2001/05/14 16:52:33 alanh Exp $ */ + +#include "win.h" + +miPointerScreenFuncRec g_winPointerCursorFuncs = +{ + winCursorOffScreen, + winCrossScreen, + miPointerWarpCursor +}; + +Bool +winCursorOffScreen (ScreenPtr *ppScreen, int *x, int *y) +{ + ErrorF ("winCursorOffScreen () - hmm...\n"); + return FALSE; +} + +void +winCrossScreen (ScreenPtr pScreen, Bool fEntering) +{ +} + Index: xc/programs/Xserver/hw/xwin/winfillsp.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winfillsp.c:1.1 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winfillsp.c Thu Apr 5 16:13:49 2001 @@ -0,0 +1,262 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winfillsp.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 54 */ +void +winFillSpansNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + int nSpans, + DDXPointPtr pPoints, + int *pWidths, + int fSorted) +{ +#if 0 + int iIdx = 0, i, iX; + DDXPointPtr pPoint = NULL; + int *pnWidth = 0; + PixmapPtr pPixmap = NULL; + HDC hdcStipple; + HBITMAP hbmpFilledStipple; + HBITMAP hbmpMaskedForeground; + HBITMAP hbmpDrawable; + HBRUSH hbrushStipple; + HBRUSH hBrush; + DEBUG_FN_NAME("winFillSpans"); + DEBUGVARS; + //DEBUGPROC_MSG; + + fprintf (stderr, "winFillSpans () - pDrawable: %08x\n", + pDrawable); + + /* Branch on the fill type */ + switch (pGC->fillStyle) + { + case FillSolid: + BitBlt (g_hdc, pDrawable->width, pDrawable->height, + pDrawable->width, pDrawable->height, + g_hdcMem, 0, 0, SRCCOPY); + DEBUG_MSG("Solid fill - original drawable"); + + /* Enumerate spans */ + for (iIdx = 0; iIdx < nSpans; ++iIdx) + { + /* Get pointers to the current span location and width */ + pPoint = pPoints + iIdx; + pnWidth = pWidths + iIdx; + + /* Draw the requested line */ + MoveToEx (g_hdcMem, pPoint->x, pPoint->y, NULL); + LineTo (g_hdcMem, pPoint->x + *pnWidth, pPoint->y); + + fprintf (stderr, + "(%dx%dx%d) from: (%d,%d) to: (%d,%d), color: %08x\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, pPoint->x + *pnWidth, pPoint->y, + pGC->fgPixel); + } + + BitBlt (g_hdc, pDrawable->width * 2, pDrawable->height, + pDrawable->width, pDrawable->height, + g_hdcMem, 0, 0, SRCCOPY); + DEBUG_MSG("Solid Fill - Filled"); + break; + case FillStippled: + /* TODO: Construct the correct stipple, store it in hdcStipple */ + fprintf (stderr, "winFillSpans () - Stipple bitmap: %08x (%dx%d)\n", + pGC->stipple->devPrivate.ptr, + pGC->stipple->drawable.width, + pGC->stipple->drawable.height); + SelectObject (hdcStipple, (HBITMAP)pGC->stipple->devPrivate.ptr); + BitBlt (g_hdc, 0, 0, + pGC->stipple->drawable.width, + pGC->stipple->drawable.height, + hdcStipple, + 0, 0, + SRCCOPY); + DEBUG_MSG("Blitted original stipple to screen"); + + /* Create a memory DC to hold the stipple */ + hdcStipple = CreateCompatibleDC (g_hdc); + + /* Create a destination sized compatible bitmap */ + hbmpFilledStipple = CreateCompatibleBitmap (g_hdc, + pDrawable->width, + pDrawable->height); + + /* Select the stipple bitmap into the stipple DC */ + SelectObject (hdcStipple, hbmpFilledStipple); + + /* Set foreground and background to white and black */ + SetTextColor (hdcStipple, RGB(0xFF, 0xFF, 0xFF)); + SetBkColor (hdcStipple, RGB (0x00, 0x00, 0x00)); + + /* Create a pattern brush from the original stipple */ + hbrushStipple = CreatePatternBrush (pGC->stipple->devPrivate.ptr); + + /* Select the original stipple brush into the stipple DC */ + SelectObject (hdcStipple, hbrushStipple); + + /* PatBlt the original stipple to the filled stipple */ + PatBlt (hdcStipple, 0, 0, pDrawable->width, pDrawable->height, PATCOPY); + BitBlt (g_hdc, pDrawable->width, 0, + pDrawable->width, pDrawable->height, + hdcStipple, 0, 0, SRCCOPY); + DEBUG_MSG("Filled a drawable-sized stipple"); + + /* Mask out the bits from the drawable that are being preserved; + hbmpFilledStipple now contains the preserved original bits */ + BitBlt (hdcStipple, 0, 0, pDrawable->width, pDrawable->height, + g_hdcMem, 0, 0, SRCERASE); + BitBlt (g_hdc, pDrawable->width * 2, 0, + pDrawable->width, pDrawable->height, + hdcStipple, 0, 0, SRCCOPY); + DEBUG_MSG("Preserved original bits"); + + /* Create a destination sized compatible bitmap to hold + the masked foreground color */ + hbmpMaskedForeground = CreateCompatibleBitmap (g_hdc, + pDrawable->width, + pDrawable->height); + + /* TODO: This code chunk can move to winValidateGC () */ + /* Set the foreground color for the stipple fill */ + if (pGC->fgPixel == 0x1) + { + SetTextColor (g_hdcMem, RGB(0x00, 0x00, 0x00)); + DEBUG_MSG("Grey fill"); + } + else if (pGC->fgPixel == 0xFFFF) + { + SetTextColor (g_hdcMem, RGB(0xFF, 0xFF, 0xFF)); + DEBUG_MSG("White fill"); + } + else + { + SetTextColor (g_hdcMem, RGB(0x00, 0x00, 0x00)); + DEBUG_MSG("Black fill"); + } + SetBkColor (g_hdcMem, RGB(0x00, 0x00, 0x00)); + + /* Select the masked foreground bitmap into the default memory DC; + this should pop the drawable bitmap out of the default DC */ + hbmpDrawable = SelectObject (g_hdcMem, hbmpMaskedForeground); + + /* Free the original drawable */ + DeleteObject (hbmpDrawable); + hbmpDrawable = NULL; + + /* Select the stipple brush into the default memory DC */ + SelectObject (g_hdcMem, hbrushStipple); + + /* Create the masked foreground bitmap using the original stipple */ + PatBlt (g_hdcMem, 0, 0, pDrawable->width, pDrawable->height, PATCOPY); + BitBlt (g_hdc, pDrawable->width * 3, 0, + pDrawable->width, pDrawable->height, + g_hdcMem, 0, 0, SRCCOPY); + DEBUG_MSG("Masked foreground bitmap"); + + /* Combine the masked foreground with the masked drawable; + hbmpFilledStipple will contain the drawable stipple filled + with the current foreground color */ + BitBlt (hdcStipple, 0, 0, pDrawable->width, pDrawable->height, + g_hdcMem, 0, 0, SRCPAINT); + BitBlt (g_hdc, pDrawable->width * 4, 0, + pDrawable->width, pDrawable->height, + hdcStipple, 0, 0, SRCCOPY); + DEBUG_MSG("Completed stipple"); + + /* Release the stipple DC */ + DeleteDC (hdcStipple); + + /* Pop the stipple pattern brush out of the default mem DC */ + SelectObject (g_hdcMem, GetStockObject (WHITE_BRUSH)); + + /* Destroy the original stipple pattern brush */ + DeleteObject (hbrushStipple); + + /* Select the result into the default memory DC */ + SelectObject (g_hdcMem, hbmpFilledStipple); + + /* Free the masked foreground bitmap */ + DeleteObject (hbmpMaskedForeground); + + /* Point the drawable to the new bitmap */ + ((PixmapPtr)pDrawable)->devPrivate.ptr = hbmpFilledStipple; + break; + case FillOpaqueStippled: + fprintf (stderr, "\n\nwinFillSpans () - OpaqueStippled\n\n"); + break; + case FillTiled: + /* Assumes that the drawable is the screen and the tile has been + selected into the default memory DC */ +#if 0 + hBrush = CreatePatternBrush (pGC->tile.pixmap->devPrivate.ptr); + hBrush = SelectObject (g_hdc, hBrush); + + PatBlt (g_hdc, 0, 0, pDrawable->width, pDrawable->height, PATCOPY); + + hBrush = SelectObject (g_hdc, hBrush); + + DeleteObject (hBrush); +#endif + + /* Enumerate spans */ + for (iIdx = 0; iIdx < nSpans; ++iIdx) + { + /* Get pointers to the current span location and width */ + pPoint = pPoints + iIdx; + pnWidth = pWidths + iIdx; + + for (iX = 0; iX < *pnWidth; iX += pGC->tile.pixmap->drawable.width) + { + /* Blit the tile to the screen, + one line at a time */ + BitBlt (g_hdc, + pPoint->x + iX, + pPoint->y, + pGC->tile.pixmap->drawable.width, + 1, + g_hdcMem, + 0, + pPoint->y % pGC->tile.pixmap->drawable.height, + SRCCOPY); + } + } + break; + default: + fprintf (stderr, "winFillSpans () - Unknown fillStyle\n"); + exit (1); + break; + } +#endif +} Index: xc/programs/Xserver/hw/xwin/winfont.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winfont.c:1.1 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winfont.c Thu Apr 5 16:13:49 2001 @@ -0,0 +1,50 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winfont.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 32 */ +/* See mfb/mfbfont.c - mfbRealizeFont() - which is empty :) */ +Bool +winRealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont) +{ + fprintf (stderr, "winRealizeFont()\n"); + return TRUE; +} + +/* See Porting Layer Definition - p. 32 */ +/* See mfb/mfbfont.c - mfbUnrealizeFont() - which is empty :) */ +Bool +winUnrealizeFontNativeGDI (ScreenPtr pScreen, FontPtr pFont) +{ + fprintf (stderr, "winUnrealizeFont()\n"); + return TRUE; +} Index: xc/programs/Xserver/hw/xwin/wingc.c diff -u /dev/null xc/programs/Xserver/hw/xwin/wingc.c:1.2 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/wingc.c Thu Apr 19 08:56:03 2001 @@ -0,0 +1,319 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wingc.c,v 1.2 2001/04/19 12:56:03 alanh Exp $ */ + +#include "win.h" + +/* GC Handling Routines */ +const GCFuncs winGCFuncs = { + winValidateGCNativeGDI, + winChangeGCNativeGDI, + winCopyGCNativeGDI, + winDestroyGCNativeGDI, + winChangeClipNativeGDI, + winDestroyClipNativeGDI, + winCopyClipNativeGDI, +}; + +/* Drawing Primitives */ +const GCOps winGCOps = { + winFillSpansNativeGDI, + winSetSpansNativeGDI, + miPutImage, + miCopyArea, + miCopyPlane, + miPolyPoint, + winPolyLineNativeGDI, + miPolySegment, + miPolyRectangle, + miPolyArc, + miFillPolygon, + miPolyFillRect, + miPolyFillArc, + miPolyText8, + miPolyText16, + miImageText8, + miImageText16, + miImageGlyphBlt, + miPolyGlyphBlt, + miPushPixels +#ifdef NEED_LINEHELPER + ,NULL +#endif +}; + +/* See Porting Layer Definition - p. 45 */ +/* See mfb/mfbgc.c - mfbCreateGC() */ +/* See Strategies for Porting - pp. 15, 16 */ +Bool +winCreateGCNativeGDI (GCPtr pGC) +{ + fprintf (stderr, "\nwinCreateGC () depth: %d\n\n", + pGC->depth); + + pGC->clientClip = NULL; + pGC->clientClipType = CT_NONE; + + pGC->ops = (GCOps *) &winGCOps; + pGC->funcs = (GCFuncs *) &winGCFuncs; + + pGC->miTranslate = 0; + + /* + winGetRotatedPixmapNativeGDI(pGC) = 0; + winGetExposeNativeGDI(pGC) = 1; + winGetFreeCompClipNativeGDI(pGC) = 0; + winGetCompositeClipNativeGDI(pGC) = 0; + winGetGCPrivateNativeGDI(pGC)->bpp = BitsPerPixel (pGC->depth); + */ + return TRUE; +} + +/* See Porting Layer Definition - p. 45 */ +void +winChangeGCNativeGDI (GCPtr pGC, unsigned long ulChanges) +{ + +} + +/* See Porting Layer Definition - pp. 45-46 */ +/* See mfb/mfbgc.c - mfbValidateGC() */ +/* See Strategies for Porting - pp. 15, 16 */ +void +winValidateGCNativeGDI (GCPtr pGC, + unsigned long dwChanges, + DrawablePtr pDrawable) +{ +#if 0 + PixmapPtr pPixmap; + int nIndex, iResult; + unsigned long dwMask = dwChanges; + HPEN hPen; + HBRUSH hBrush; + HBITMAP hBitmap; + DEBUG_FN_NAME("winValidateGC"); + DEBUGVARS; + //DEBUGPROC_MSG; + + fprintf (stderr, "winValidateGC - pDrawable: %08x, pGC: %08x\n", + pDrawable, pGC); + + switch (pDrawable->type) + { + case DRAWABLE_PIXMAP: + /* I can handle drawable pixmaps, no problem */ + pPixmap = (PixmapPtr) pDrawable; + + fprintf (stderr, "winValidateGC - pPixmap->devPrivate.ptr: %08x\n", + pPixmap->devPrivate.ptr); + + /* Select the bitmap into the memory device context. + NOTE: A bitmap can only be selected into a single + memory device context at a time. + */ + SelectObject (g_hdcMem, pPixmap->devPrivate.ptr); + + /* Sync the DC settings with the GC settings */ + switch (pGC->fillStyle) + { + case FillSolid: + /* Select a stock pen */ + if (pDrawable->depth == 1 && pGC->fgPixel) + { + SelectObject (g_hdcMem, GetStockObject (WHITE_PEN)); + } + else if (pDrawable->depth == 1 && !pGC->fgPixel) + { + SelectObject (g_hdcMem, GetStockObject (BLACK_PEN)); + } + else if (pGC->fgPixel) + { + SelectObject (g_hdcMem, CreatePen (PS_SOLID, 0, pGC->fgPixel)); + } + else + { + SelectObject (g_hdcMem, GetStockObject (BLACK_PEN)); + } + break; + case FillStippled: + break; + default: + break; + } + + break; + case DRAWABLE_WINDOW: + switch (pGC->fillStyle) + { + case FillTiled: + /* Need to select the tile into the memory DC */ + SelectObject (g_hdcMem, pGC->tile.pixmap->devPrivate.ptr); + + /* Blit the tile to a remote area of the screen */ + BitBlt (g_hdc, 64, 64, + pGC->tile.pixmap->drawable.width, + pGC->tile.pixmap->drawable.height, + g_hdcMem, + 0, 0, SRCCOPY); + DEBUG_MSG("Blitted the tile to a remote area of the screen"); + break; + case FillStippled: + case FillSolid: + default: + break; + } + break; + case UNDRAWABLE_WINDOW: + break; + case DRAWABLE_BUFFER: + break; + default: + break; + } + +#if 0 + /* Inspect changes to the GC */ + while (dwMask) + { + /* This peels off one change at a time */ + nIndex = lowbit (dwMask); + dwMask &= ~nIndex; + + switch (nIndex) + { + case GCFunction: + /* mfb falls through to GCForeground */ + fprintf (stderr, "winValidateGC - GCFunction\n"); + break; + case GCForeground: + fprintf (stderr, "winValidateGC - GCForeground\n"); + break; + case GCPlaneMask: + fprintf (stderr, "winValidateGC - GCPlaneMask\n"); + break; + case GCBackground: + fprintf (stderr, "winValidateGC - GCBackground\n"); + break; + case GCLineStyle: + case GCLineWidth: + case GCJoinStyle: + fprintf (stderr, "winValidateGC - GCLineStyle, etc.\n"); + break; + case GCCapStyle: + fprintf (stderr, "winValidateGC - GCCapStyle\n"); + break; + case GCFillStyle: + fprintf (stderr, "winValidateGC - GCFillStyle\n"); + break; + case GCFillRule: + fprintf (stderr, "winValidateGC - GCFillRule\n"); + break; + case GCTile: + fprintf (stderr, "winValidateGC - GCTile\n"); + break; + case GCStipple: + fprintf (stderr, "winValidateGC - GCStipple\n"); + break; + case GCTileStipXOrigin: + fprintf (stderr, "winValidateGC - GCTileStipXOrigin\n"); + break; + case GCTileStipYOrigin: + fprintf (stderr, "winValidateGC - GCTileStipYOrigin\n"); + break; + case GCFont: + fprintf (stderr, "winValidateGC - GCFont\n"); + break; + case GCSubwindowMode: + fprintf (stderr, "winValidateGC - GCSubwindowMode\n"); + break; + case GCGraphicsExposures: + fprintf (stderr, "winValidateGC - GCGraphicsExposures\n"); + break; + case GCClipXOrigin: + fprintf (stderr, "winValidateGC - GCClipXOrigin\n"); + break; + case GCClipYOrigin: + fprintf (stderr, "winValidateGC - GCClipYOrigin\n"); + break; + case GCClipMask: + fprintf (stderr, "winValidateGC - GCClipMask\n"); + break; + case GCDashOffset: + fprintf (stderr, "winValidateGC - GCDashOffset\n"); + break; + case GCDashList: + fprintf (stderr, "winValidateGC - GCDashList\n"); + break; + case GCArcMode: + fprintf (stderr, "winValidateGC - GCArcMode\n"); + break; + default: + fprintf (stderr, "winValidateGC - default\n"); + break; + } + } +#endif +#endif +} + +/* See Porting Layer Definition - p. 46 */ +void +winCopyGCNativeGDI (GCPtr pGCsrc, unsigned long ulMask, GCPtr pGCdst) +{ + +} + +/* See Porting Layer Definition - p. 46 */ +void +winDestroyGCNativeGDI (GCPtr pGC) +{ + +} + +/* See Porting Layer Definition - p. 46 */ +void +winChangeClipNativeGDI (GCPtr pGC, int nType, pointer pValue, int nRects) +{ + +} + +/* See Porting Layer Definition - p. 47 */ +void +winDestroyClipNativeGDI (GCPtr pGC) +{ + +} + +/* See Porting Layer Definition - p. 47 */ +void +winCopyClipNativeGDI (GCPtr pGCdst, GCPtr pGCsrc) +{ + +} Index: xc/programs/Xserver/hw/xwin/wingetsp.c diff -u /dev/null xc/programs/Xserver/hw/xwin/wingetsp.c:1.1 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/wingetsp.c Thu Apr 5 16:13:49 2001 @@ -0,0 +1,100 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/wingetsp.c,v 1.1 2001/04/05 20:13:49 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 55 */ +void +winGetSpansNativeGDI (DrawablePtr pDrawable, + int nMax, + DDXPointPtr pPoints, + int *pWidths, + int nSpans, + char *pDsts) +{ +#if 0 + int iIdx; + DDXPointPtr pPoint = NULL; + int *pWidth = NULL; + char *pDst = pDsts; + int iScanlineBytes; + int iBitmapBytes; + BITMAPINFOHEADER bmih; + DEBUG_FN_NAME("winGetSpans"); + DEBUGVARS; + DEBUGPROC_MSG; + + /* Setup the bitmap header info */ + bmih.biSize = sizeof (bmih); + bmih.biWidth = pDrawable->width; + bmih.biHeight = pDrawable->height; + bmih.biPlanes = 1; + bmih.biBitCount = pDrawable->depth; + bmih.biCompression = BI_RGB; + bmih.biSizeImage = 0; + bmih.biXPelsPerMeter = 0; + bmih.biYPelsPerMeter = 0; + bmih.biClrUsed = 0; + bmih.biClrImportant = 0; + + fprintf (stderr, "winGetSpans () - pDrawable: %08x\n", + pDrawable); + + /* Calculate the number of bytes in each scanline */ + iScanlineBytes = 4 * ((pDrawable->width * pDrawable->depth + 31) / 32); + + /* Calculate the number of bytes in the bitmap */ + iBitmapBytes = iScanlineBytes * pDrawable->height; + + /* + fprintf (stderr, "winGetSpans () - iBitmapBytes: %d\n", + iBitmapBytes); + */ + + /* Loop through spans */ + for (iIdx = 0; iIdx < nSpans; ++iIdx) + { + pPoint = pPoints + iIdx; + pWidth = pWidths + iIdx; + + /* Drawable should be in g_hdcMem */ + GetDIBits (hdcMem, ((PixmapPtr)pDrawable)->devPrivate.ptr, + pPoint->y, 1, pDst, &bmih, 0); + + fprintf (stderr, "(%dx%dx%d) (%d,%d) w: %d\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, *pWidth); + + /* Calculate offset of next bit destination */ + pDst += 4 * ((*pWidth + 31) / 32); + } +#endif +} Index: xc/programs/Xserver/hw/xwin/winkeybd.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winkeybd.c:1.2 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winkeybd.c Tue May 1 20:45:26 2001 @@ -0,0 +1,551 @@ +/* + *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.2 2001/05/02 00:45:26 alanh 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) +{ + /* + * Window 95 and later ignore the parameters to Beep. + * Systems with sound cards will play the default sound event; + * systems without sound cards will play the standard system beep. + */ + Beep (0, 0); +} + +/* 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 ((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 ((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 ((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 ((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); + } +} + +/* + * Look for the lovely fake Control_L press/release generated by Windows + * when AltGr is pressed/released on a non-U.S. keyboard. + */ +Bool +winIsFakeCtrl_L (UINT message, WPARAM wParam, LPARAM lParam) +{ + MSG msgNext; + LONG lTime; + Bool fReturn; + + /* + * Fake Ctrl_L presses will be followed by an Alt_R keypress + * with the same timestamp as the Ctrl_L press. + */ + if (message == WM_KEYDOWN + && wParam == VK_CONTROL + && (HIWORD (lParam) & KF_EXTENDED) == 0) + { + /* Got a Ctrl_L press */ + + /* Get time of current message */ + lTime = GetMessageTime (); + + /* Look for fake Ctrl_L preceeding an Alt_R press. */ + fReturn = PeekMessage (&msgNext, NULL, + WM_KEYDOWN, WM_KEYDOWN, + PM_NOREMOVE); + + /* Is next press an Alt_R with the same timestamp? */ + if (fReturn && msgNext.wParam == VK_MENU + && msgNext.time == lTime + && (HIWORD (msgNext.lParam) & KF_EXTENDED)) + { + /* + * Next key press is Alt_R with same timestamp as current + * Ctrl_L message. Therefore, this Ctrl_L press is a fake + * event, so discard it. + */ + return TRUE; + } + } + + /* + * Fake Ctrl_L releases will be followed by an Alt_R release + * with the same timestamp as the Ctrl_L press. + */ + if ((message == WM_KEYUP || message == WM_SYSKEYUP) + && wParam == VK_CONTROL + && (HIWORD (lParam) & KF_EXTENDED) == 0) + { + /* Got a Ctrl_L release */ + + /* Get time of current message */ + lTime = GetMessageTime (); + + /* Look for fake Ctrl_L release preceeding an Alt_R release. */ + fReturn = PeekMessage (&msgNext, NULL, + WM_KEYUP, WM_SYSKEYUP, + PM_NOREMOVE); + + /* Is next press an Alt_R with the same timestamp? */ + if (fReturn + && (msgNext.message == WM_KEYUP + || msgNext.message == WM_SYSKEYUP) + && msgNext.wParam == VK_MENU + && msgNext.time == lTime + && (HIWORD (msgNext.lParam) & KF_EXTENDED)) + { + /* + * Next key release is Alt_R with same timestamp as current + * Ctrl_L message. Therefore, this Ctrl_L release is a fake + * event, so discard it. + */ + return TRUE; + } + } + + /* Not a fake control left press/release */ + return FALSE; +} + + Index: xc/programs/Xserver/hw/xwin/winkeymap.h diff -u xc/programs/Xserver/hw/xwin/winkeymap.h:1.1 xc/programs/Xserver/hw/xwin/winkeymap.h:removed --- xc/programs/Xserver/hw/xwin/winkeymap.h:1.1 Thu Aug 10 13:40:38 2000 +++ xc/programs/Xserver/hw/xwin/winkeymap.h Mon Jun 4 12:42:43 2001 @@ -1,163 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xwin/winkeymap.h,v 1.1 2000/08/10 17:40:38 dawes Exp $ */ -/* - * - * For Scancodes see notes in atKeynames.h !!!! - * - */ -/* $TOG: xf86Keymap.h /main/15 1997/07/19 10:02:01 kaleb $ */ - -static KeySym map[NUM_KEYCODES * GLYPHS_PER_KEY] = { - /* 0x00 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x01 */ XK_Escape, NoSymbol, NoSymbol, NoSymbol, - /* 0x02 */ XK_1, XK_exclam, NoSymbol, NoSymbol, - /* 0x03 */ XK_2, XK_at, NoSymbol, NoSymbol, - /* 0x04 */ XK_3, XK_numbersign, NoSymbol, NoSymbol, - /* 0x05 */ XK_4, XK_dollar, NoSymbol, NoSymbol, - /* 0x06 */ XK_5, XK_percent, NoSymbol, NoSymbol, - /* 0x07 */ XK_6, XK_asciicircum, NoSymbol, NoSymbol, - /* 0x08 */ XK_7, XK_ampersand, NoSymbol, NoSymbol, - /* 0x09 */ XK_8, XK_asterisk, NoSymbol, NoSymbol, - /* 0x0a */ XK_9, XK_parenleft, NoSymbol, NoSymbol, - /* 0x0b */ XK_0, XK_parenright, NoSymbol, NoSymbol, - /* 0x0c */ XK_minus, XK_underscore, NoSymbol, NoSymbol, - /* 0x0d */ XK_equal, XK_plus, NoSymbol, NoSymbol, - /* 0x0e */ XK_BackSpace, NoSymbol, NoSymbol, NoSymbol, - /* 0x0f */ XK_Tab, NoSymbol, NoSymbol, NoSymbol, - /* 0x10 */ XK_Q, NoSymbol, NoSymbol, NoSymbol, - /* 0x11 */ XK_W, NoSymbol, NoSymbol, NoSymbol, - /* 0x12 */ XK_E, NoSymbol, NoSymbol, NoSymbol, - /* 0x13 */ XK_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x14 */ XK_T, NoSymbol, NoSymbol, NoSymbol, - /* 0x15 */ XK_Y, NoSymbol, NoSymbol, NoSymbol, - /* 0x16 */ XK_U, NoSymbol, NoSymbol, NoSymbol, - /* 0x17 */ XK_I, NoSymbol, NoSymbol, NoSymbol, - /* 0x18 */ XK_O, NoSymbol, NoSymbol, NoSymbol, - /* 0x19 */ XK_P, NoSymbol, NoSymbol, NoSymbol, - /* 0x1a */ XK_bracketleft, XK_braceleft, NoSymbol, NoSymbol, - /* 0x1b */ XK_bracketright,XK_braceright, NoSymbol, NoSymbol, - /* 0x1c */ XK_Return, NoSymbol, NoSymbol, NoSymbol, - /* 0x1d */ XK_Control_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x1e */ XK_A, NoSymbol, NoSymbol, NoSymbol, - /* 0x1f */ XK_S, NoSymbol, NoSymbol, NoSymbol, - /* 0x20 */ XK_D, NoSymbol, NoSymbol, NoSymbol, - /* 0x21 */ XK_F, NoSymbol, NoSymbol, NoSymbol, - /* 0x22 */ XK_G, NoSymbol, NoSymbol, NoSymbol, - /* 0x23 */ XK_H, NoSymbol, NoSymbol, NoSymbol, - /* 0x24 */ XK_J, NoSymbol, NoSymbol, NoSymbol, - /* 0x25 */ XK_K, NoSymbol, NoSymbol, NoSymbol, - /* 0x26 */ XK_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x27 */ XK_semicolon, XK_colon, NoSymbol, NoSymbol, - /* 0x28 */ XK_quoteright, XK_quotedbl, NoSymbol, NoSymbol, - /* 0x29 */ XK_quoteleft, XK_asciitilde, NoSymbol, NoSymbol, - /* 0x2a */ XK_Shift_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x2b */ XK_backslash, XK_bar, NoSymbol, NoSymbol, - /* 0x2c */ XK_Z, NoSymbol, NoSymbol, NoSymbol, - /* 0x2d */ XK_X, NoSymbol, NoSymbol, NoSymbol, - /* 0x2e */ XK_C, NoSymbol, NoSymbol, NoSymbol, - /* 0x2f */ XK_V, NoSymbol, NoSymbol, NoSymbol, - /* 0x30 */ XK_B, NoSymbol, NoSymbol, NoSymbol, - /* 0x31 */ XK_N, NoSymbol, NoSymbol, NoSymbol, - /* 0x32 */ XK_M, NoSymbol, NoSymbol, NoSymbol, - /* 0x33 */ XK_comma, XK_less, NoSymbol, NoSymbol, - /* 0x34 */ XK_period, XK_greater, NoSymbol, NoSymbol, - /* 0x35 */ XK_slash, XK_question, NoSymbol, NoSymbol, - /* 0x36 */ XK_Shift_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x37 */ XK_KP_Multiply, NoSymbol, NoSymbol, NoSymbol, - /* 0x38 */ XK_Alt_L, XK_Meta_L, NoSymbol, NoSymbol, - /* 0x39 */ XK_space, NoSymbol, NoSymbol, NoSymbol, - /* 0x3a */ XK_Caps_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x3b */ XK_F1, NoSymbol, NoSymbol, NoSymbol, - /* 0x3c */ XK_F2, NoSymbol, NoSymbol, NoSymbol, - /* 0x3d */ XK_F3, NoSymbol, NoSymbol, NoSymbol, - /* 0x3e */ XK_F4, NoSymbol, NoSymbol, NoSymbol, - /* 0x3f */ XK_F5, NoSymbol, NoSymbol, NoSymbol, - /* 0x40 */ XK_F6, NoSymbol, NoSymbol, NoSymbol, - /* 0x41 */ XK_F7, NoSymbol, NoSymbol, NoSymbol, - /* 0x42 */ XK_F8, NoSymbol, NoSymbol, NoSymbol, - /* 0x43 */ XK_F9, NoSymbol, NoSymbol, NoSymbol, - /* 0x44 */ XK_F10, NoSymbol, NoSymbol, NoSymbol, - /* 0x45 */ XK_Num_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x46 */ XK_Scroll_Lock, NoSymbol, NoSymbol, NoSymbol, - /* 0x47 */ XK_KP_Home, XK_KP_7, NoSymbol, NoSymbol, - /* 0x48 */ XK_KP_Up, XK_KP_8, NoSymbol, NoSymbol, - /* 0x49 */ XK_KP_Prior, XK_KP_9, NoSymbol, NoSymbol, - /* 0x4a */ XK_KP_Subtract, NoSymbol, NoSymbol, NoSymbol, - /* 0x4b */ XK_KP_Left, XK_KP_4, NoSymbol, NoSymbol, - /* 0x4c */ NoSymbol, XK_KP_5, NoSymbol, NoSymbol, - /* 0x4d */ XK_KP_Right, XK_KP_6, NoSymbol, NoSymbol, - /* 0x4e */ XK_KP_Add, NoSymbol, NoSymbol, NoSymbol, - /* 0x4f */ XK_KP_End, XK_KP_1, NoSymbol, NoSymbol, - /* 0x50 */ XK_KP_Down, XK_KP_2, NoSymbol, NoSymbol, - /* 0x51 */ XK_KP_Next, XK_KP_3, NoSymbol, NoSymbol, - /* 0x52 */ XK_KP_Insert, XK_KP_0, NoSymbol, NoSymbol, - /* 0x53 */ XK_KP_Delete, XK_KP_Decimal, NoSymbol, NoSymbol, - /* 0x54 */ XK_Sys_Req, NoSymbol, NoSymbol, NoSymbol, - /* 0x55 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x56 */ XK_less, XK_greater, NoSymbol, NoSymbol, - /* 0x57 */ XK_F11, NoSymbol, NoSymbol, NoSymbol, - /* 0x58 */ XK_F12, NoSymbol, NoSymbol, NoSymbol, - - /* 0x59 */ XK_Home, NoSymbol, NoSymbol, NoSymbol, - /* 0x5a */ XK_Up, NoSymbol, NoSymbol, NoSymbol, - /* 0x5b */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, - /* 0x5c */ XK_Left, NoSymbol, NoSymbol, NoSymbol, - /* 0x5d */ XK_Begin, NoSymbol, NoSymbol, NoSymbol, - /* 0x5e */ XK_Right, NoSymbol, NoSymbol, NoSymbol, - /* 0x5f */ XK_End, NoSymbol, NoSymbol, NoSymbol, - /* 0x60 */ XK_Down, NoSymbol, NoSymbol, NoSymbol, - /* 0x61 */ XK_Next, NoSymbol, NoSymbol, NoSymbol, - /* 0x62 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, - /* 0x63 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, - /* 0x64 */ XK_KP_Enter, NoSymbol, NoSymbol, NoSymbol, - /* 0x65 */ XK_Control_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x66 */ XK_Pause, NoSymbol, NoSymbol, NoSymbol, - /* 0x67 */ XK_Print, NoSymbol, NoSymbol, NoSymbol, - /* 0x68 */ XK_KP_Divide, NoSymbol, NoSymbol, NoSymbol, - /* 0x69 */ XK_Alt_R, XK_Meta_R, NoSymbol, NoSymbol, - /* 0x6a */ XK_Break, NoSymbol, NoSymbol, NoSymbol, - /* 0x6b */ XK_Meta_L, NoSymbol, NoSymbol, NoSymbol, - /* 0x6c */ XK_Meta_R, NoSymbol, NoSymbol, NoSymbol, - /* 0x6d */ XK_Menu, NoSymbol, NoSymbol, NoSymbol, - /* 0x6e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x6f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x70 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x71 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x72 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x73 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x74 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x75 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x76 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x77 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x78 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x79 */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7a */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7b */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7c */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7d */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7e */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - /* 0x7f */ NoSymbol, NoSymbol, NoSymbol, NoSymbol, - - /* These are for ServerNumLock handling */ - /* 0x80 */ XK_KP_7, NoSymbol, NoSymbol, NoSymbol, - /* 0x81 */ XK_KP_8, NoSymbol, NoSymbol, NoSymbol, - /* 0x82 */ XK_KP_9, NoSymbol, NoSymbol, NoSymbol, - /* 0x83 */ XK_KP_4, NoSymbol, NoSymbol, NoSymbol, - /* 0x84 */ XK_KP_5, NoSymbol, NoSymbol, NoSymbol, - /* 0x85 */ XK_KP_6, NoSymbol, NoSymbol, NoSymbol, - /* 0x86 */ XK_KP_1, NoSymbol, NoSymbol, NoSymbol, - /* 0x87 */ XK_KP_2, NoSymbol, NoSymbol, NoSymbol, - /* 0x88 */ XK_KP_3, NoSymbol, NoSymbol, NoSymbol, - /* 0x89 */ XK_KP_0, NoSymbol, NoSymbol, NoSymbol, - /* 0x8a */ XK_KP_Decimal, NoSymbol, NoSymbol, NoSymbol, - /* 0x8b */ XK_Home, NoSymbol, NoSymbol, NoSymbol, - /* 0x8c */ XK_Up, NoSymbol, NoSymbol, NoSymbol, - /* 0x8d */ XK_Prior, NoSymbol, NoSymbol, NoSymbol, - /* 0x8e */ XK_Left, NoSymbol, NoSymbol, NoSymbol, - /* 0x8f */ XK_Begin, NoSymbol, NoSymbol, NoSymbol, - /* 0x90 */ XK_Right, NoSymbol, NoSymbol, NoSymbol, - /* 0x91 */ XK_End, NoSymbol, NoSymbol, NoSymbol, - /* 0x92 */ XK_Down, NoSymbol, NoSymbol, NoSymbol, - /* 0x93 */ XK_Next, NoSymbol, NoSymbol, NoSymbol, - /* 0x94 */ XK_Insert, NoSymbol, NoSymbol, NoSymbol, - /* 0x95 */ XK_Delete, NoSymbol, NoSymbol, NoSymbol, -}; Index: xc/programs/Xserver/hw/xwin/winkeynames.h diff -u xc/programs/Xserver/hw/xwin/winkeynames.h:1.1 xc/programs/Xserver/hw/xwin/winkeynames.h:removed --- xc/programs/Xserver/hw/xwin/winkeynames.h:1.1 Thu Aug 10 13:40:38 2000 +++ xc/programs/Xserver/hw/xwin/winkeynames.h Mon Jun 4 12:42:43 2001 @@ -1,335 +0,0 @@ -/* $XFree86: xc/programs/Xserver/hw/xwin/winkeynames.h,v 1.1 2000/08/10 17:40:38 dawes Exp $ */ -/* - * Copyright 1990,91 by Thomas Roell, Dinkelscherben, Germany. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the name of Thomas Roell not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Thomas Roell makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * THOMAS ROELL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THOMAS ROELL BE LIABLE FOR ANY SPECIAL, INDIRECT OR - * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, - * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER - * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - */ -/* $TOG: atKeynames.h /main/12 1997/07/19 10:00:17 kaleb $ */ - -#ifndef _ATKEYNAMES_H -#define _ATKEYNAMES_H - -#define XK_TECHNICAL -#define XK_KATAKANA -#include "keysym.h" - -#define GLYPHS_PER_KEY 4 -#define NUM_KEYCODES 150 -#define NUM_STD_KEYCODES 127 -#define MIN_KEYCODE 8 -#define MAX_KEYCODE (NUM_KEYCODES + MIN_KEYCODE - 1) -#define MAX_STD_KEYCODE (NUM_STD_KEYCODES + MIN_KEYCODE - 1) - -#define AltMask Mod1Mask -#define NumLockMask Mod2Mask -#define AltLangMask Mod3Mask -#define KanaMask Mod4Mask -#define ScrollLockMask Mod5Mask - -#define KeyPressed(k) (keyc->down[k >> 3] & (1 << (k & 7))) -#define ModifierDown(k) ((keyc->state & (k)) == (k)) - -#define XF86XK_ModeLock 0x1008FF01 /* Mode Switch Lock */ - -/* - * NOTE: The AT/MF keyboards can generate (via the 8042) two (MF: three) - * sets of scancodes. Set3 can only be generated by a MF keyboard. - * Set2 sends a makecode for keypress, and the same code prefixed by a - * F0 for keyrelease. This is a little bit ugly to handle. Thus we use - * here for X386 the PC/XT compatible Set1. This set uses 8bit scancodes. - * Bit 7 ist set if the key is released. The code E0 switches to a - * different meaning to add the new MF cursorkeys, while not breaking old - * applications. E1 is another special prefix. Since I assume that there - * will be further versions of PC/XT scancode compatible keyboards, we - * may be in trouble one day. - * - * IDEA: 1) Use Set2 on AT84 keyboards and translate it to MF Set3. - * 2) Use the keyboards native set and translate it to common keysyms. - */ - -/* - * definition of the AT84/MF101/MF102 Keyboard: - * ============================================================ - * Defined Key Cap Glyphs Pressed value - * Key Name Main Also (hex) (dec) - * ---------------- ---------- ------- ------ ------ - */ - -#ifndef PC98 - -#define KEY_Escape /* Escape 0x01 */ 1 -#define KEY_1 /* 1 ! 0x02 */ 2 -#define KEY_2 /* 2 @ 0x03 */ 3 -#define KEY_3 /* 3 # 0x04 */ 4 -#define KEY_4 /* 4 $ 0x05 */ 5 -#define KEY_5 /* 5 % 0x06 */ 6 -#define KEY_6 /* 6 ^ 0x07 */ 7 -#define KEY_7 /* 7 & 0x08 */ 8 -#define KEY_8 /* 8 * 0x09 */ 9 -#define KEY_9 /* 9 ( 0x0a */ 10 -#define KEY_0 /* 0 ) 0x0b */ 11 -#define KEY_Minus /* - (Minus) _ (Under) 0x0c */ 12 -#define KEY_Equal /* = (Equal) + 0x0d */ 13 -#define KEY_BackSpace /* Back Space 0x0e */ 14 -#define KEY_Tab /* Tab 0x0f */ 15 -#define KEY_Q /* Q 0x10 */ 16 -#define KEY_W /* W 0x11 */ 17 -#define KEY_E /* E 0x12 */ 18 -#define KEY_R /* R 0x13 */ 19 -#define KEY_T /* T 0x14 */ 20 -#define KEY_Y /* Y 0x15 */ 21 -#define KEY_U /* U 0x16 */ 22 -#define KEY_I /* I 0x17 */ 23 -#define KEY_O /* O 0x18 */ 24 -#define KEY_P /* P 0x19 */ 25 -#define KEY_LBrace /* [ { 0x1a */ 26 -#define KEY_RBrace /* ] } 0x1b */ 27 -#define KEY_Enter /* Enter 0x1c */ 28 -#define KEY_LCtrl /* Ctrl(left) 0x1d */ 29 -#define KEY_A /* A 0x1e */ 30 -#define KEY_S /* S 0x1f */ 31 -#define KEY_D /* D 0x20 */ 32 -#define KEY_F /* F 0x21 */ 33 -#define KEY_G /* G 0x22 */ 34 -#define KEY_H /* H 0x23 */ 35 -#define KEY_J /* J 0x24 */ 36 -#define KEY_K /* K 0x25 */ 37 -#define KEY_L /* L 0x26 */ 38 -#define KEY_SemiColon /* ;(SemiColon) :(Colon) 0x27 */ 39 -#define KEY_Quote /* ' (Apostr) " (Quote) 0x28 */ 40 -#define KEY_Tilde /* ` (Accent) ~ (Tilde) 0x29 */ 41 -#define KEY_ShiftL /* Shift(left) 0x2a */ 42 -#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 43 -#define KEY_Z /* Z 0x2c */ 44 -#define KEY_X /* X 0x2d */ 45 -#define KEY_C /* C 0x2e */ 46 -#define KEY_V /* V 0x2f */ 47 -#define KEY_B /* B 0x30 */ 48 -#define KEY_N /* N 0x31 */ 49 -#define KEY_M /* M 0x32 */ 50 -#define KEY_Comma /* , (Comma) < (Less) 0x33 */ 51 -#define KEY_Period /* . (Period) >(Greater)0x34 */ 52 -#define KEY_Slash /* / (Slash) ? 0x35 */ 53 -#define KEY_ShiftR /* Shift(right) 0x36 */ 54 -#define KEY_KP_Multiply /* * 0x37 */ 55 -#define KEY_Alt /* Alt(left) 0x38 */ 56 -#define KEY_Space /* (SpaceBar) 0x39 */ 57 -#define KEY_CapsLock /* CapsLock 0x3a */ 58 -#define KEY_F1 /* F1 0x3b */ 59 -#define KEY_F2 /* F2 0x3c */ 60 -#define KEY_F3 /* F3 0x3d */ 61 -#define KEY_F4 /* F4 0x3e */ 62 -#define KEY_F5 /* F5 0x3f */ 63 -#define KEY_F6 /* F6 0x40 */ 64 -#define KEY_F7 /* F7 0x41 */ 65 -#define KEY_F8 /* F8 0x42 */ 66 -#define KEY_F9 /* F9 0x43 */ 67 -#define KEY_F10 /* F10 0x44 */ 68 -#define KEY_NumLock /* NumLock 0x45 */ 69 -#define KEY_ScrollLock /* ScrollLock 0x46 */ 70 -#define KEY_KP_7 /* 7 Home 0x47 */ 71 -#define KEY_KP_8 /* 8 Up 0x48 */ 72 -#define KEY_KP_9 /* 9 PgUp 0x49 */ 73 -#define KEY_KP_Minus /* - (Minus) 0x4a */ 74 -#define KEY_KP_4 /* 4 Left 0x4b */ 75 -#define KEY_KP_5 /* 5 0x4c */ 76 -#define KEY_KP_6 /* 6 Right 0x4d */ 77 -#define KEY_KP_Plus /* + (Plus) 0x4e */ 78 -#define KEY_KP_1 /* 1 End 0x4f */ 79 -#define KEY_KP_2 /* 2 Down 0x50 */ 80 -#define KEY_KP_3 /* 3 PgDown 0x51 */ 81 -#define KEY_KP_0 /* 0 Insert 0x52 */ 82 -#define KEY_KP_Decimal /* . (Decimal) Delete 0x53 */ 83 -#define KEY_SysReqest /* SysReqest 0x54 */ 84 - /* NOTUSED 0x55 */ -#define KEY_Less /* < (Less) >(Greater) 0x56 */ 86 -#define KEY_F11 /* F11 0x57 */ 87 -#define KEY_F12 /* F12 0x58 */ 88 - -#define KEY_Prefix0 /* special 0x60 */ 96 -#define KEY_Prefix1 /* specail 0x61 */ 97 - -/* - * The 'scancodes' below are generated by the server, because the MF101/102 - * keyboard sends them as sequence of other scancodes - */ -#define KEY_Home /* Home 0x59 */ 89 -#define KEY_Up /* Up 0x5a */ 90 -#define KEY_PgUp /* PgUp 0x5b */ 91 -#define KEY_Left /* Left 0x5c */ 92 -#define KEY_Begin /* Begin 0x5d */ 93 -#define KEY_Right /* Right 0x5e */ 94 -#define KEY_End /* End 0x5f */ 95 -#define KEY_Down /* Down 0x60 */ 96 -#define KEY_PgDown /* PgDown 0x61 */ 97 -#define KEY_Insert /* Insert 0x62 */ 98 -#define KEY_Delete /* Delete 0x63 */ 99 -#define KEY_KP_Enter /* Enter 0x64 */ 100 -#define KEY_RCtrl /* Ctrl(right) 0x65 */ 101 -#define KEY_Pause /* Pause 0x66 */ 102 -#define KEY_Print /* Print 0x67 */ 103 -#define KEY_KP_Divide /* Didive 0x68 */ 104 -#define KEY_AltLang /* AtlLang(right) 0x69 */ 105 -#define KEY_Break /* Break 0x6a */ 106 -#define KEY_LMeta /* Left Meta 0x6b */ 107 -#define KEY_RMeta /* Right Meta 0x6c */ 108 -#define KEY_Menu /* Menu 0x6d */ 109 -#define KEY_F13 /* F13 0x6e */ 110 -#define KEY_F14 /* F14 0x6f */ 111 -#define KEY_F15 /* F15 0x70 */ 112 -#define KEY_F16 /* F16 0x71 */ 113 -#define KEY_F17 /* F17 0x72 */ 114 -#define KEY_KP_DEC /* KP_DEC 0x73 */ 115 -#define KEY_SN_KP_7 /* ServerNumLock 7 0x80 */ 128 -#define KEY_SN_KP_8 /* ServerNumLock 8 0x81 */ 129 -#define KEY_SN_KP_9 /* ServerNumLock 9 0x82 */ 130 -#define KEY_SN_KP_4 /* ServerNumLock 4 0x83 */ 131 -#define KEY_SN_KP_5 /* ServerNumLock 5 0x84 */ 132 -#define KEY_SN_KP_6 /* ServerNumLock 6 0x85 */ 133 -#define KEY_SN_KP_1 /* ServerNumLock 1 0x86 */ 134 -#define KEY_SN_KP_2 /* ServerNumLock 2 0x87 */ 135 -#define KEY_SN_KP_3 /* ServerNumLock 4 0x88 */ 136 -#define KEY_SN_KP_0 /* ServerNumLock 0 0x89 */ 137 -#define KEY_SN_KP_Dec /* ServerNumLock Decimal 0x8a */ 138 -#define KEY_SN_KP_Home /* ServerNumLock Home 0x8b */ 139 -#define KEY_SN_KP_Up /* ServerNumLock Up 0x8c */ 140 -#define KEY_SN_KP_Prior /* ServerNumLock Prior 0x8d */ 141 -#define KEY_SN_KP_Left /* ServerNumLock Left 0x8e */ 142 -#define KEY_SN_KP_Begin /* ServerNumLock Begin 0x8f */ 143 -#define KEY_SN_KP_Right /* ServerNumLock Right 0x90 */ 144 -#define KEY_SN_KP_End /* ServerNumLock End 0x91 */ 145 -#define KEY_SN_KP_Down /* ServerNumLock Down 0x92 */ 146 -#define KEY_SN_KP_Next /* ServerNumLock Next 0x93 */ 147 -#define KEY_SN_KP_Ins /* ServerNumLock Ins 0x94 */ 148 -#define KEY_SN_KP_Del /* ServerNumLock Del 0x95 */ 149 - -#else - -#define KEY_Escape /* Escape 0x01 */ 0 -#define KEY_1 /* 1 ! 0x02 */ 1 -#define KEY_2 /* 2 " 0x03 */ 2 -#define KEY_3 /* 3 # 0x04 */ 3 -#define KEY_4 /* 4 $ 0x05 */ 4 -#define KEY_5 /* 5 % 0x06 */ 5 -#define KEY_6 /* 6 & 0x07 */ 6 -#define KEY_7 /* 7 ' 0x08 */ 7 -#define KEY_8 /* 8 ( 0x09 */ 8 -#define KEY_9 /* 9 ) 0x0a */ 9 -#define KEY_0 /* 0 0x0b */ 10 -#define KEY_Minus /* - (Minus) = (Equal) 0x0c */ 11 -#define KEY_Hat /* ^ (Hat) ` 0x0d */ 12 -#define KEY_BSlash /* \(BckSlash) |(VertBar)0x2b */ 13 -#define KEY_BackSpace /* Back Space 0x0e */ 14 -#define KEY_Tab /* Tab 0x0f */ 15 -#define KEY_Q /* Q 0x10 */ 16 -#define KEY_W /* W 0x11 */ 17 -#define KEY_E /* E 0x12 */ 18 -#define KEY_R /* R 0x13 */ 19 -#define KEY_T /* T 0x14 */ 20 -#define KEY_Y /* Y 0x15 */ 21 -#define KEY_U /* U 0x16 */ 22 -#define KEY_I /* I 0x17 */ 23 -#define KEY_O /* O 0x18 */ 24 -#define KEY_P /* P 0x19 */ 25 -#define KEY_At /* @ ~ 0x1a */ 26 -#define KEY_LBrace /* [ { 0x1b */ 27 -#define KEY_Enter /* Enter 0x1c */ 28 -#define KEY_A /* A 0x1d */ 29 -#define KEY_S /* S 0x1e */ 30 -#define KEY_D /* D 0x1f */ 31 -#define KEY_F /* F 0x20 */ 32 -#define KEY_G /* G 0x21 */ 33 -#define KEY_H /* H 0x22 */ 34 -#define KEY_J /* J 0x23 */ 35 -#define KEY_K /* K 0x24 */ 36 -#define KEY_L /* L 0x25 */ 37 -#define KEY_SemiColon /* ;(SemiColon) +(Plus) 0x26 */ 38 -#define KEY_Colon /* :(Colon) *(Quote) 0x27 */ 39 -#define KEY_RBrace /* ] } 0x28 */ 40 -#define KEY_Z /* Z 0x29 */ 41 -#define KEY_X /* X 0x2a */ 42 -#define KEY_C /* C 0x2b */ 43 -#define KEY_V /* V 0x2c */ 44 -#define KEY_B /* B 0x2d */ 45 -#define KEY_N /* N 0x2e */ 46 -#define KEY_M /* M 0x2f */ 47 -#define KEY_Comma /* , (Comma) < (Less) 0x30 */ 48 -#define KEY_Period /* . (Period) >(Greater)0x31 */ 49 -#define KEY_Slash /* / (Slash) ? 0x32 */ 50 -#define KEY_Under /* _ 0x33 */ 51 -#define KEY_Space /* (SpaceBar) 0x34 */ 52 -#define KEY_Xfer /* (XFER) 0x35 */ 53 -#define KEY_PgUp /* PgUp 0x36 */ 54 -#define KEY_Pgdown /* (Roll Down) 0x37 */ 55 -#define KEY_Insert /* Insert 0x38 */ 56 -#define KEY_Delete /* Delete 0x39 */ 57 -#define KEY_Up /* Up 0x3a */ 58 -#define KEY_Left /* Left 0x3b */ 59 -#define KEY_Right /* Right 0x3c */ 60 -#define KEY_Down /* Down 0x3d */ 61 -#define KEY_Home /* Home 0x3e */ 62 -#define KEY_Help /* Help 0x3f */ 63 -#define KEY_KP_Subtract /* - (Minus) 0x40 */ 64 -#define KEY_KP_Minus /* - */ 64 -#define KEY_KP_Divide /* / (Slash) 0x41 */ 65 -#define KEY_KP_7 /* 7 0x42 */ 66 -#define KEY_KP_8 /* 8 0x43 */ 67 -#define KEY_KP_9 /* 9 0x44 */ 68 -#define KEY_KP_Multiply /* * 0x45 */ 69 -#define KEY_KP_4 /* 4 0x46 */ 70 -#define KEY_KP_5 /* 5 0x47 */ 71 -#define KEY_KP_6 /* 6 0x48 */ 72 -#define KEY_KP_Add /* + (Plus) 0x49 */ 73 -#define KEY_KP_Plus /* + */ 73 -#define KEY_KP_1 /* 1 0x4a */ 74 -#define KEY_KP_2 /* 2 0x4b */ 75 -#define KEY_KP_3 /* 3 0x4c */ 76 -#define KEY_KP_Equal /* = 0x4d */ 77 -#define KEY_KP_0 /* 0 0x4e */ 78 -#define KEY_KP_Separator /* , 0x4f */ 79 -#define KEY_KP_Decimal /* . (Decimal) 0x50 */ 80 -#define KEY_Nfer /* (NFER) 0x51 */ 81 -#define KEY_F11 /* F11 0x52 */ 82 -#define KEY_F12 /* F12 0x53 */ 83 -#define KEY_F13 /* F13 0x54 */ 84 -#define KEY_F14 /* F14 0x55 */ 85 -#define KEY_F15 /* F15 0x56 */ 86 -#define KEY_Break /* (Stop) 0x60 */ 96 -#define KEY_Copy /* (Copy) 0x61 */ 97 -#define KEY_Begin /* Begin ?? */ 97 -#define KEY_F1 /* F1 0x62 */ 98 -#define KEY_F2 /* F2 0x63 */ 99 -#define KEY_F3 /* F3 0x64 */ 100 -#define KEY_F4 /* F4 0x65 */ 101 -#define KEY_F5 /* F5 0x66 */ 102 -#define KEY_F6 /* F6 0x67 */ 103 -#define KEY_F7 /* F7 0x68 */ 104 -#define KEY_F8 /* F8 0x69 */ 105 -#define KEY_F9 /* F9 0x6a */ 106 -#define KEY_F10 /* F10 0x6b */ 107 -#define KEY_ShiftL /* Shift(left) 0x70 */ 112 -#define KEY_CapsLock /* CapsLock 0x71 */ 113 -#define KEY_KanaLock /* Kana 0x72 */ 114 -#define KEY_Alt /* Alt(left) 0x73 */ 115 -#define KEY_LCtrl /* Ctrl(left) 0x74 */ 116 - -#endif /* PC98 */ - -#endif /* _ATKEYNAMES_H */ Index: xc/programs/Xserver/hw/xwin/winmisc.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winmisc.c:1.3 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winmisc.c Tue May 1 20:45:26 2001 @@ -0,0 +1,90 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winmisc.c,v 1.3 2001/05/02 00:45:26 alanh Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 33 */ +/* + * Called by clients, returns the best size for a cursor, tile, or + * stipple, specified by class (sometimes called kind) + */ +void +winQueryBestSizeNativeGDI (int class, unsigned short *pWidth, + unsigned short *pHeight, ScreenPtr pScreen) +{ + ErrorF ("winQueryBestSize()\n"); +} + +/* + * Count the number of one bits in a color mask. + */ +CARD8 +winCountBits (DWORD dw) +{ + DWORD dwBits = 0; + + while (dw) + { + dwBits += (dw & 1); + dw >>= 1; + } + + return dwBits; +} + +/* + * 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; +} Index: xc/programs/Xserver/hw/xwin/winmouse.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winmouse.c:1.3 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winmouse.c Tue May 8 04:14:09 2001 @@ -0,0 +1,288 @@ +/* + *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.3 2001/05/08 08:14:09 alanh 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; +} + +/* Handle the mouse wheel */ +int +winMouseWheel (ScreenPtr pScreen, int iDeltaZ) +{ + winScreenPriv(pScreen); + xEvent xCurrentEvent; + + /* Button4 = WheelUp */ + /* Button5 = WheelDown */ + + /* Do we have any previous delta stored? */ + if ((pScreenPriv->iDeltaZ > 0 + && iDeltaZ > 0) + || (pScreenPriv->iDeltaZ < 0 + && iDeltaZ < 0)) + { + /* Previous delta and of same sign as current delta */ + iDeltaZ += pScreenPriv->iDeltaZ; + pScreenPriv->iDeltaZ = 0; + } + else + { + /* + * Previous delta of different sign, or zero. + * We will set it to zero for either case, + * as blindly setting takes just as much time + * as checking, then setting if necessary :) + */ + pScreenPriv->iDeltaZ = 0; + } + + /* + * Only process this message if the wheel has moved further than + * WHEEL_DELTA + */ + if (iDeltaZ >= WHEEL_DELTA || (-1 * iDeltaZ) >= WHEEL_DELTA) + { + pScreenPriv->iDeltaZ = 0; + + /* Figure out how many whole deltas of the wheel we have */ + iDeltaZ /= WHEEL_DELTA; + } + else + { + /* + * Wheel has not moved past WHEEL_DELTA threshold; + * we will store the wheel delta until the threshold + * has been reached. + */ + pScreenPriv->iDeltaZ = iDeltaZ; + return 0; + } + + /* Set the button to indicate up or down wheel delta */ + if (iDeltaZ > 0) + { + xCurrentEvent.u.u.detail = Button4; + } + else + { + xCurrentEvent.u.u.detail = Button5; + } + + /* + * Flip iDeltaZ to positive, if negative, + * because always need to generate a *positive* number of + * button clicks for the Z axis. + */ + if (iDeltaZ < 0) + { + iDeltaZ *= -1; + } + + /* Generate X input messages for each wheel delta we have seen */ + while (iDeltaZ--) + { + /* Push the wheel button */ + xCurrentEvent.u.u.type = ButtonPress; + xCurrentEvent.u.keyButtonPointer.time + = g_c32LastInputEventTime = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + + /* Release the wheel button */ + xCurrentEvent.u.u.type = ButtonRelease; + xCurrentEvent.u.keyButtonPointer.time + = g_c32LastInputEventTime = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + } + + return 0; +} + +/* + * Enqueue a mouse button event + */ +void +winMouseButtonsSendEvent (int iEventType, int iButton) +{ + xEvent xCurrentEvent; + + /* Load an xEvent and enqueue the event */ + xCurrentEvent.u.u.type = iEventType; + xCurrentEvent.u.u.detail = iButton; + xCurrentEvent.u.keyButtonPointer.time + = g_c32LastInputEventTime = GetTickCount (); + mieqEnqueue (&xCurrentEvent); +} + +/* + * Decide what to do with a Windows mouse message + */ +int +winMouseButtonsHandle (ScreenPtr pScreen, + int iEventType, int iButton, + WPARAM wParam) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Send button events right away if emulate 3 buttons is off */ + if (pScreenInfo->iE3BTimeout == WIN_E3B_OFF) + { + /* Emulate 3 buttons is off, send the button event */ + winMouseButtonsSendEvent (iEventType, iButton); + return 0; + } + + /* Emulate 3 buttons is on, let the fun begin */ + if (iEventType == ButtonPress + && pScreenPriv->iE3BCachedPress == 0 + && !pScreenPriv->fE3BFakeButton2Sent) + { + /* + * Button was pressed, no press is cached, + * and there is no fake button 2 release pending. + */ + + /* Store button press type */ + pScreenPriv->iE3BCachedPress = iButton; + + /* + * Set a timer to send this button press if the other button + * is not pressed within the timeout time. + */ + SetTimer (pScreenPriv->hwndScreen, + WIN_E3B_TIMER_ID, + pScreenInfo->iE3BTimeout, + NULL); + } + else if (iEventType == ButtonPress + && pScreenPriv->iE3BCachedPress != 0 + && pScreenPriv->iE3BCachedPress != iButton + && !pScreenPriv->fE3BFakeButton2Sent) + { + /* + * Button press is cached, other button was pressed, + * and there is no fake button 2 release pending. + */ + + /* Mouse button was cached and other button was pressed */ + KillTimer (pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID); + pScreenPriv->iE3BCachedPress = 0; + + /* Send fake middle button */ + winMouseButtonsSendEvent (ButtonPress, Button2); + + /* Indicate that a fake middle button event was sent */ + pScreenPriv->fE3BFakeButton2Sent = TRUE; + } + else if (iEventType == ButtonRelease + && pScreenPriv->iE3BCachedPress == iButton) + { + /* + * Cached button was released before timer ran out, + * and before the other mouse button was pressed. + */ + KillTimer (pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID); + pScreenPriv->iE3BCachedPress = 0; + + /* Send cached press, then send release */ + winMouseButtonsSendEvent (ButtonPress, iButton); + winMouseButtonsSendEvent (ButtonRelease, iButton); + } + else if (iEventType == ButtonRelease + && pScreenPriv->fE3BFakeButton2Sent + && !(wParam & MK_LBUTTON) + && !(wParam & MK_RBUTTON)) + { + /* + * Fake button 2 was sent and both mouse buttons have now been released + */ + pScreenPriv->fE3BFakeButton2Sent = FALSE; + + /* Send middle mouse button release */ + winMouseButtonsSendEvent (ButtonRelease, Button2); + } + else if (iEventType == ButtonRelease + && pScreenPriv->iE3BCachedPress == 0 + && !pScreenPriv->fE3BFakeButton2Sent) + { + /* + * Button was release, no button is cached, + * and there is no fake button 2 release is pending. + */ + winMouseButtonsSendEvent (ButtonRelease, iButton); + } + + return 0; +} Index: xc/programs/Xserver/hw/xwin/winms.h diff -u /dev/null xc/programs/Xserver/hw/xwin/winms.h:1.2 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winms.h Wed Apr 18 13:14:06 2001 @@ -0,0 +1,61 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winms.h,v 1.2 2001/04/18 17:14:06 dawes Exp $ */ + +#ifndef _WINMS_H_ +#define _WINMS_H_ + +#undef MINSHORT +#undef MAXSHORT +#undef CARD8 +#undef INT32 +#undef ATOM + +#define NONAMELESSUNION +#define DIRECTDRAW_VERSION 0x0300 +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif + +#include <windows.h> +#include <windowsx.h> + +#include "obj_base.h" +#include "ddraw.h" + +/* + * Undefine unneeded Windows symbols that conflict + * with X symbols + */ + +#undef CreateWindow +#undef FreeResource + +#endif /* _WINMS_H_ */ Index: xc/programs/Xserver/hw/xwin/winpfbdd.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winpfbdd.c:1.5 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winpfbdd.c Mon May 14 12:52:33 2001 @@ -0,0 +1,507 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpfbdd.c,v 1.5 2001/05/14 16:52:33 alanh Exp $ */ + +#include "win.h" + +/* + * Create a DirectDraw primary surface + */ +Bool +winAllocateFBPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + DDSURFACEDESC ddsd; + DDSURFACEDESC *pddsdPrimary = NULL; + DDSURFACEDESC *pddsdOffscreen = NULL; + RECT rcClient; + + ErrorF ("winAllocateFBPrimaryDD ()\n"); + + /* Get client area location in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Create a DirectDraw object, store the address at lpdd */ + ddrval = DirectDrawCreate (NULL, &pScreenPriv->pdd, NULL); + if (ddrval != DD_OK) + FatalError ("winAllocateFBPrimaryDD () - Could not start DirectDraw\n"); + + ErrorF ("winAllocateFBPrimaryDD () - Created and initialized DD\n"); + + /* Are we windowed or fullscreen? */ + if (pScreenInfo->fFullScreen) + { + /* Full screen mode */ + ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd, + pScreenPriv->hwndScreen, + DDSCL_FULLSCREEN + | DDSCL_EXCLUSIVE); + if (FAILED (ddrval)) + FatalError ("winAllocateFBPrimaryDD () - Could not set "\ + "cooperative level\n"); + + /* Change the video mode to the mode requested */ + ddrval = IDirectDraw_SetDisplayMode (pScreenPriv->pdd, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwDepth); + if (FAILED (ddrval)) + FatalError ("winAllocateFBPrimaryDD () - Could not set "\ + "full screen display mode\n"); + } + else + { + /* Windowed mode */ + ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd, + pScreenPriv->hwndScreen, + DDSCL_NORMAL); + if (FAILED (ddrval)) + FatalError ("winAllocateFBPrimaryDD () - Could not set "\ + "cooperative level\n"); + } + + /* Describe the primary surface */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + /* Create the primary surface */ + ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd, + &ddsd, + &pScreenPriv->pddsPrimary, + NULL); + if (FAILED (ddrval)) + FatalError ("winAllocateFBPrimaryDD () - Could not create primary "\ + "surface %08x\n", ddrval); + + ErrorF ("winAllocateFBPrimaryDD () - Created primary\n"); + + /* Allocate a DD surface description for our screen privates */ + pddsdPrimary = pScreenPriv->pddsdPrimary + = xalloc (sizeof (DDSURFACEDESC)); + if (pddsdPrimary == NULL) + FatalError ("winAllocateFBPrimaryDD () - Could not allocate surface "\ + "description memory\n"); + ZeroMemory (pddsdPrimary, sizeof (*pddsdPrimary)); + pddsdPrimary->dwSize = sizeof (*pddsdPrimary); + + /* Describe the offscreen surface to be created */ + /* + * NOTE: Do not use a DDSCAPS_VIDEOMEMORY surface, + * as drawing, locking, and unlocking take forever + * with video memory surfaces. In addition, + * video memory is a somewhat scarce resource, + * so you shouldn't be allocating video memory when + * you have the option of using system memory instead. + */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + ddsd.dwHeight = pScreenInfo->dwHeight; + ddsd.dwWidth = pScreenInfo->dwWidth; + + /* Create the shadow surface */ + ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd, + &ddsd, + &pScreenPriv->pddsOffscreen, + NULL); + if (ddrval != DD_OK) + FatalError ("winAllocateFBPrimaryDD () - Could not create shadow "\ + "surface\n"); + + ErrorF ("winAllocateFBPrimaryDD () - Created offscreen\n"); + + /* Allocate a DD surface description for our screen privates */ + pddsdOffscreen = pScreenPriv->pddsdOffscreen + = xalloc (sizeof (DDSURFACEDESC)); + if (pddsdOffscreen == NULL) + FatalError ("winAllocateFBPrimaryDD () - Could not allocate surface "\ + "description memory\n"); + ZeroMemory (pddsdOffscreen, sizeof (*pddsdOffscreen)); + pddsdOffscreen->dwSize = sizeof (*pddsdOffscreen); + + ErrorF ("winAllocateFBPrimaryDD () - Locking primary\n"); + + /* Lock the primary surface */ + ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsPrimary, + pScreenInfo->fFullScreen ? NULL:&rcClient, + pddsdPrimary, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK || pddsdPrimary->lpSurface == NULL) + FatalError ("winAllocateFBPrimaryDD () - Could not lock "\ + "primary surface\n"); + + ErrorF ("winAllocateFBPrimaryDD () - Locked primary\n"); + + /* We don't know how to deal with anything other than RGB */ + if (!(pddsdPrimary->ddpfPixelFormat.dwFlags & DDPF_RGB)) + FatalError ("winAllocateFBPrimaryDD () - Color format other than RGB\n"); + + /* Grab the pitch, and memory pointer from the surface desc */ + pScreenInfo->dwStrideBytes = pddsdPrimary->u.lPitch; + pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) + / pScreenInfo->dwDepth; + pScreenInfo->pfb = pddsdPrimary->lpSurface; + + /* Grab the color depth and masks from the surface description */ + pScreenInfo->dwDepth = pddsdPrimary->ddpfPixelFormat.u.dwRGBBitCount; + pScreenPriv->dwRedMask = pddsdPrimary->ddpfPixelFormat.u2.dwRBitMask; + pScreenPriv->dwGreenMask = pddsdPrimary->ddpfPixelFormat.u3.dwGBitMask; + pScreenPriv->dwBlueMask = pddsdPrimary->ddpfPixelFormat.u4.dwBBitMask; + + ErrorF ("winAllocateFBPrimaryDD () - Returning\n"); + + return TRUE; +} + +/* + * Call the wrapped CloseScreen function. + * + * Free our resources and private structures. + */ +Bool +winCloseScreenPrimaryDD (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn; + + ErrorF ("winCloseScreenPrimaryDD () - Freeing screen resources\n"); + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* Call the wrapped CloseScreen procedure */ + pScreen->CloseScreen = pScreenPriv->CloseScreen; + fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + /* Free the offscreen surface, if there is one */ + if (pScreenPriv->pddsOffscreen) + { + IDirectDrawSurface_Unlock (pScreenPriv->pddsOffscreen, NULL); + IDirectDrawSurface_Release (pScreenPriv->pddsOffscreen); + pScreenPriv->pddsOffscreen = NULL; + } + + /* Release the primary surface, if there is one */ + if (pScreenPriv->pddsPrimary) + { + IDirectDrawSurface_Unlock (pScreenPriv->pddsPrimary, NULL); + IDirectDrawSurface_Release (pScreenPriv->pddsPrimary); + pScreenPriv->pddsPrimary = NULL; + } + + /* Free the DirectDraw object, if there is one */ + if (pScreenPriv->pdd) + { + IDirectDraw_RestoreDisplayMode (pScreenPriv->pdd); + IDirectDraw_Release (pScreenPriv->pdd); + pScreenPriv->pdd = NULL; + } + + /* Redisplay the Windows cursor */ + if (!pScreenPriv->fCursor) + ShowCursor (TRUE); + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + + /* Kill our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; + + /* Free the screen privates for this screen */ + xfree ((pointer) pScreenPriv); + + return fReturn; +} + +/* + * Tell mi what sort of visuals we need. + * + * Generally we only need one visual, as our screen can only + * handle one format at a time, I believe. You may want + * to verify that last sentence. + */ +Bool +winInitVisualsPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + DWORD dwRedBits, dwGreenBits, dwBlueBits; + + /* Count the number of ones in each color mask */ + dwRedBits = winCountBits (pScreenPriv->dwRedMask); + dwGreenBits = winCountBits (pScreenPriv->dwGreenMask); + dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); + + /* Store the maximum number of ones in a color mask as the bitsPerRGB */ + if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwRedBits; + else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwGreenBits; + else + pScreenPriv->dwBitsPerRGB = dwBlueBits; + + ErrorF ("winInitVisualsPrimaryDD () - Masks: %08x %08x %08x bpRGB: %d\n", + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask, + pScreenPriv->dwBitsPerRGB); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + case 16: + case 15: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsPrimaryDD () - " \ + "miSetVisualTypesAndMasks failed\n"); + return FALSE; + } + break; + + case 8: +#if CYGDEBUG + ErrorF ("winInitVisuals () - Calling miSetVisualTypesAndMasks\n"); +#endif /* CYGDEBUG */ + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + PseudoColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsPrimaryDD () - "\ + "miSetVisualTypesAndMasks failed\n"); + return FALSE; + } +#if CYGDEBUG + ErrorF ("winInitVisualsPrimaryDD () - Returned from "\ + "miSetVisualTypesAndMasks\n"); +#endif /* CYGDEBUG */ + break; + + default: + ErrorF ("winInitVisualsPrimaryDD () - Unknown screen depth\n"); + return FALSE; + } + + /* Set DPI info */ + pScreenInfo->dwDPIx = 100; + pScreenInfo->dwDPIy = 100; + + ErrorF ("winInitVisualsPrimaryDD () - Returning\n"); + + return TRUE; +} + +Bool +winAdjustVideoModePrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc = NULL; + DWORD dwDepth; + + /* Are we fullscreen? */ + if (pScreenInfo->fFullScreen) + { + /* We don't need to adjust the video mode for fullscreen */ + return TRUE; + } + + /* We're in serious trouble if we can't get a DC */ + hdc = GetDC (NULL); + if (hdc == NULL) + { + ErrorF ("winAdjustVideoModePrimaryDD () - GetDC failed\n"); + return FALSE; + } + + /* Query GDI for current display depth */ + dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + + /* Is GDI using a depth different than command line parameter? */ + if (dwDepth != pScreenInfo->dwDepth) + { + /* Warn user if GDI depth is different than depth specified */ + ErrorF ("winAdjustVideoModePrimaryDD () - Command line depth: %d, "\ + "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + + /* We'll use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + + /* Release our DC */ + ReleaseDC (NULL, hdc); + + return TRUE; +} + +Bool +winActivateAppPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RECT rcSrc, rcClient; + HRESULT ddrval = DD_OK; + + /* + * We need to blit our offscreen fb to + * the screen when we are activated, and we need to point + * the fb code back to the primary surface memory. + */ + if (pScreenPriv != NULL + && pScreenPriv->pddsPrimary != NULL + && pScreenPriv->pddsOffscreen != NULL + && pScreenPriv->fActive) + { + /* We are activating */ + ddrval = IDirectDrawSurface_IsLost (pScreenPriv->pddsOffscreen); + if (ddrval == DD_OK) + { + IDirectDrawSurface_Unlock (pScreenPriv->pddsOffscreen, + NULL); + /* + * We don't check for an error from Unlock, because it + * doesn't matter if the Unlock failed. + */ + } + + /* Restore both surfaces, just cause I like it that way */ + IDirectDrawSurface_Restore (pScreenPriv->pddsOffscreen); + IDirectDrawSurface_Restore (pScreenPriv->pddsPrimary); + + /* Get client area in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Setup a source rectangle */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsPrimary, + &rcClient, + pScreenPriv->pddsOffscreen, + &rcSrc, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + FatalError ("winWindowProc () - Failed blitting offscreen "\ + "surface to primary surface %08x\n", ddrval); + + /* Lock the primary surface */ + ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsPrimary, + &rcClient, + pScreenPriv->pddsdPrimary, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK + || pScreenPriv->pddsdPrimary->lpSurface == NULL) + FatalError ("winWindowProc () - Could not lock "\ + "primary surface\n"); + + /* Notify FB of the new memory pointer */ + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdPrimary->lpSurface); + + /* + * Register the Alt-Tab combo as a hotkey so we can copy + * the primary framebuffer before the display mode changes + */ + RegisterHotKey (pScreenPriv->hwndScreen, 1, MOD_ALT, 9); + } + + return TRUE; +} + +/* Set engine specific functions */ +Bool +winSetEngineFunctionsPrimaryDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBPrimaryDD; + pScreenPriv->pwinShadowUpdate + = (winShadowUpdateProcPtr) (void (*)())NoopDDA; + pScreenPriv->pwinShadowWindow + = (winShadowWindowProcPtr) (void (*)())NoopDDA; + pScreenPriv->pwinCloseScreen = winCloseScreenPrimaryDD; + pScreenPriv->pwinInitVisuals = winInitVisualsPrimaryDD; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModePrimaryDD; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; + pScreenPriv->pwinBltExposedRegions + = (winBltExposedRegionsProcPtr) (void (*)())NoopDDA; + pScreenPriv->pwinActivateApp = winActivateAppPrimaryDD; + + return TRUE; +} Index: xc/programs/Xserver/hw/xwin/winpixmap.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winpixmap.c:1.3 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winpixmap.c Tue May 1 20:45:26 2001 @@ -0,0 +1,163 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: drewry, september 1986 + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpixmap.c,v 1.3 2001/05/02 00:45:26 alanh Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 34 */ +/* See mfb/mfbpixmap.c - mfbCreatePixmap() */ +PixmapPtr +winCreatePixmapNativeGDI (ScreenPtr pScreen, + int nWidth, int nHeight, + int nDepth) +{ +#ifdef CYGX_GDI + PixmapPtr pPixmap; + HBITMAP hBitmap; + BITMAPINFOHEADER bmih; + + fprintf (stderr, "winCreatePixmap()\n"); + + /* FIXME: For now we create all pixmaps in system memory. Pixmaps + with the same depth as the screen depth can be created in offscreen + video memory. It is a simple optimization, but an easy one to + screw up, so I'm leaving it out in this first implementation + */ + + /* Setup the bitmap header info */ + bmih.biSize = sizeof (bmih); + bmih.biWidth = nWidth; + bmih.biHeight = nHeight; + bmih.biPlanes = 1; + bmih.biBitCount = nDepth; + bmih.biCompression = BI_RGB; + bmih.biSizeImage = 0; + bmih.biXPelsPerMeter = 0; + bmih.biYPelsPerMeter = 0; + bmih.biClrUsed = 0; + bmih.biClrImportant = 0; + + /* Create the bitmap */ + if (nDepth == 1) + { + hBitmap = CreateDIBitmap (NULL, &bmih, 0, NULL, NULL, 0); + } + else + { + hBitmap = CreateDIBitmap (g_hdcMem, &bmih, 0, NULL, NULL, 0); + } + + /* Allocate a pixmap structure */ + pPixmap = (PixmapPtr) xalloc (sizeof (PixmapRec)); + if (!pPixmap) + return NullPixmap; + + /* Set other fields of the pixmap, all fields must be set to + valid values */ + pPixmap->drawable.type = DRAWABLE_PIXMAP; + pPixmap->drawable.class = 0; + pPixmap->drawable.pScreen = pScreen; + pPixmap->drawable.depth = nDepth; + pPixmap->drawable.bitsPerPixel = BitsPerPixel (nDepth); + pPixmap->drawable.id = 0; + pPixmap->drawable.serialNumber = NEXT_SERIAL_NUMBER; + pPixmap->drawable.x = 0; + pPixmap->drawable.y = 0; + pPixmap->drawable.width = nWidth; + pPixmap->drawable.height = nHeight; + pPixmap->devKind = nWidth; // Was paddedWidth in mfb + pPixmap->refcnt = 1; + + /* We will use devPrivate to point to our bitmap */ + pPixmap->devPrivate.ptr = hBitmap; + + fprintf (stderr, "winCreatePixmap () - Created a pixmap %08x, %dx%dx%d, for screen: %08x\n", + hBitmap, nWidth, nHeight, nDepth, pScreen); + + return pPixmap; +#else /* CYGX_GDI */ + return NULL; +#endif /* CYGX_GDI */ +} + +/* See Porting Layer Definition - p. 35 */ +/* See mfb/mfbpixmap.c - mfbDestroyPixmap() */ +Bool +winDestroyPixmapNativeGDI (PixmapPtr pPixmap) +{ + HBITMAP hBitmap; + + fprintf (stderr, "winDestroyPixmap - pPixmap->devPrivate.ptr: %08x\n", + (UINT) pPixmap->devPrivate.ptr); + + /* Decrement reference count, and, if zero, free the pixmap */ + --(pPixmap->refcnt); + + /* Are there any more references to this pixmap? */ + if (pPixmap->refcnt == 0) + { + /* Free GDI bitmap */ + hBitmap = pPixmap->devPrivate.ptr; + if (hBitmap) DeleteObject (hBitmap); + hBitmap = NULL; + + /* Free the PixmapRec */ + xfree (pPixmap); + pPixmap = NULL; + } + + return TRUE; +} + +/* See cfb/cfbpixmap.c */ +void +winXRotatePixmapNativeGDI (PixmapPtr pPix, int rw) +{ + fprintf (stderr, "winXRotatePixmap()\n"); + /* fill in this function, look at CFB */ +} + +/* See cfb/cfbpixmap.c */ +void +winYRotatePixmapNativeGDI (PixmapPtr pPix, int rh) +{ + fprintf (stderr, "winYRotatePixmap()\n"); + /* fill in this function, look at CFB */ +} + +/* See cfb/cfbpixmap.c */ +void +winCopyRotatePixmapNativeGDI (PixmapPtr psrcPix, PixmapPtr *ppdstPix, + int xrot, int yrot) +{ + fprintf (stderr, "winCopyRotatePixmap()\n"); + /* fill in this function, look at CFB */ +} Index: xc/programs/Xserver/hw/xwin/winpntwin.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winpntwin.c:1.1 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winpntwin.c Thu Apr 5 16:13:50 2001 @@ -0,0 +1,45 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpntwin.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 39 + * Sometimes implemented as two functions: + * PaintWindowBackground (nKind = PW_BACKGROUND) + * PaintWindowBorder (nKind = PW_BORDER) + */ +void +winPaintWindowNativeGDI (WindowPtr pWin, + RegionPtr pRegion, + int nKind) +{ + fprintf (stderr, "winPaintWindow()\n"); +} Index: xc/programs/Xserver/hw/xwin/winpolyline.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winpolyline.c:1.1 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winpolyline.c Thu Apr 5 16:13:50 2001 @@ -0,0 +1,43 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winpolyline.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 50 */ +void +winPolyLineNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + int mode, + int npt, + DDXPointPtr ppt) +{ + fprintf (stderr, "winPolyLine()\n"); +} Index: xc/programs/Xserver/hw/xwin/winscrinit.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winscrinit.c:1.7 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winscrinit.c Mon May 14 12:52:33 2001 @@ -0,0 +1,839 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winscrinit.c,v 1.7 2001/05/14 16:52:33 alanh Exp $ */ + +#include "win.h" + +/* + * Create a full screen window + */ +void +winCreateBoundingWindowFullScreen (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + int iWidth = pScreenInfo->dwWidth; + int iHeight = pScreenInfo->dwHeight; + HWND *phwnd = &pScreenPriv->hwndScreen; + WNDCLASS wc; + +#if CYGDEBUG + ErrorF ("winCreateBoundingWindowFullScreen ()\n"); +#endif + + /* Setup our window class */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = winWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = GetModuleHandle (NULL); + wc.hIcon = 0; + wc.hCursor = 0; + wc.hbrBackground = 0; + wc.lpszMenuName = NULL; + wc.lpszClassName = WINDOW_CLASS; + RegisterClass (&wc); + + /* Create the window */ + *phwnd = CreateWindowExA (WS_EX_TOPMOST, /* Extended styles */ + WINDOW_CLASS, /* Class name */ + WINDOW_TITLE, /* Window name */ + WS_POPUP, + 0, /* Horizontal position */ + 0, /* Vertical position */ + iWidth, /* Right edge */ + iHeight, /* Bottom edge */ + (HWND) NULL, /* No parent or owner window */ + (HMENU) NULL, /* No menu */ + GetModuleHandle (NULL),/* Instance handle */ + pScreenPriv); /* ScreenPrivates */ + + /* Branch on the server engine */ + switch (pScreenInfo->dwEngine) + { + case WIN_SERVER_SHADOW_GDI: + /* Show the window */ + ShowWindow (*phwnd, SW_SHOWMAXIMIZED); + break; + + default: + /* Hide the window */ + ShowWindow (*phwnd, SW_HIDE); + break; + } + + /* Send first paint message */ + UpdateWindow (*phwnd); + + /* Attempt to bring our window to the top of the display */ + BringWindowToTop (*phwnd); +} + +/* + * Create our primary Windows display window + */ +void +winCreateBoundingWindowWindowed (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + int iWidth = pScreenInfo->dwWidth; + int iHeight = pScreenInfo->dwHeight; + HWND *phwnd = &pScreenPriv->hwndScreen; + WNDCLASS wc; + RECT rcClient, rcWorkArea; + + /* Setup our window class */ + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.lpfnWndProc = winWindowProc; + wc.cbClsExtra = 0; + wc.cbWndExtra = 0; + wc.hInstance = GetModuleHandle (NULL); + wc.hIcon = 0; + wc.hCursor = 0; + wc.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH); + wc.lpszMenuName = NULL; + wc.lpszClassName = WINDOW_CLASS; + RegisterClass (&wc); + + /* Get size of work area */ + SystemParametersInfo (SPI_GETWORKAREA, 0, &rcWorkArea, 0); + +#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); + iHeight += 2 * GetSystemMetrics (SM_CYFIXEDFRAME) + + GetSystemMetrics (SM_CYCAPTION); + + /* Trim window width to fit work area */ + if (iWidth > (rcWorkArea.right - rcWorkArea.left)) + { + iWidth = rcWorkArea.right - rcWorkArea.left; + pScreenInfo->dwWidth = iWidth - + 2 * GetSystemMetrics (SM_CXFIXEDFRAME); + } + + /* Trim window height to fit work area */ + if (iHeight >= (rcWorkArea.bottom - rcWorkArea.top)) + { + /* + * FIXME: Currently chopping 1 off the maximum height + * to allow hidden start bars to pop up when the mouse + * reaches the bottom of the screen. + * + * This only works if the start menu is at the bottom + * of the screen. + */ + iHeight = rcWorkArea.bottom - rcWorkArea.top - 1; + pScreenInfo->dwHeight = iHeight + - 2 * GetSystemMetrics (SM_CYFIXEDFRAME) + - GetSystemMetrics (SM_CYCAPTION); + } + +#if CYGDEBUG + ErrorF ("winCreateBoundingWindowWindowed () - Adjusted width: %d "\ + "height: %d\n", + pScreenInfo->dwWidth, pScreenInfo->dwHeight); +#endif + + /* Create the window */ + *phwnd = CreateWindowExA (0, /* Extended styles */ + WINDOW_CLASS, /* Class name */ + WINDOW_TITLE, /* Window name */ + WS_OVERLAPPED + | WS_CAPTION + | WS_SYSMENU + | WS_MINIMIZEBOX, /* Almost an OverlappedWindow */ + 0, /* Horizontal position */ + 0, /* Vertical position */ + iWidth, /* Right edge */ + iHeight, /* Bottom edge */ + (HWND) NULL, /* No parent or owner window */ + (HMENU) NULL, /* No menu */ + GetModuleHandle (NULL),/* Instance handle */ + pScreenPriv); /* ScreenPrivates */ + + /* Get the client area coordinates */ + GetClientRect (*phwnd, &rcClient); + ErrorF ("winCreateBoundingWindowWindowed () - WindowClient "\ + "width %d height %d\n", + rcClient.right - rcClient.left, + rcClient.bottom - rcClient.top); + MapWindowPoints (*phwnd, HWND_DESKTOP, (LPPOINT)&rcClient, 2); + + /* Show the window */ + ShowWindow (*phwnd, SW_SHOW); + UpdateWindow (*phwnd); + + /* Attempt to bring our window to the top of the display */ + BringWindowToTop (*phwnd); +} + +/* + * Determine what type of screen we are initializing + * and call the appropriate procedure to intiailize + * that type of screen. + */ +Bool +winScreenInit (int index, + ScreenPtr pScreen, + int argc, char **argv) +{ + winScreenInfoPtr pScreenInfo = &g_winScreens[index]; + winPrivScreenPtr pScreenPriv; + + /* Allocate privates for this screen */ + winAllocatePrivates (pScreen); + + /* Get a pointer to the privates structure that was allocated */ + pScreenPriv = winGetScreenPriv (pScreen); + + /* Save a pointer to this screen in the screen info structure */ + pScreenInfo->pScreen = pScreen; + + /* Save a pointer to the screen info in the screen privates structure */ + /* This allows us to get back to the screen info from a sceen pointer */ + pScreenPriv->pScreenInfo = pScreenInfo; + + /* Detect which engines are supported */ + winDetectSupportedEngines (pScreen); + + /* Determine which engine to use */ + if (!winSetEngine (pScreen)) + { + ErrorF ("winScreenInit () - winSetEngine () failed\n"); + return FALSE; + } + + /* Adjust the video mode for our engine type */ + if (!(*pScreenPriv->pwinAdjustVideoMode) (pScreen)) + { + ErrorF ("winScreenInit () - winAdjustVideoMode () failed\n"); + return FALSE; + } + + /* Call the engine dependent screen initialization procedure */ + if (!((*pScreenPriv->pwinFinishScreenInit) (index, pScreen, argc, argv))) + { + ErrorF ("winScreenInit () - winFinishScreenInit () failed\n"); + return FALSE; + } + + return TRUE; +} + +/* See Porting Layer Definition - p. 20 */ +Bool +winFinishScreenInitFB (int index, + ScreenPtr pScreen, + int argc, char **argv) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn = TRUE; + char *pbits = NULL; + + /* Initial display parameters */ + pScreenInfo->dwBPP = winBitsPerPixel (pScreenInfo->dwDepth); + +#if CYGDEBUG + ErrorF ("winFinishScreenInitFB () - dwBPP: %d\n", pScreenInfo->dwBPP); +#endif + + /* Create display window */ + (*pScreenPriv->pwinCreateBoundingWindow) (pScreen); + + /* Set the padded screen width */ + pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth, + pScreenInfo->dwDepth); + + /* Clear the visuals list */ + winClearVisualTypes (); + + /* Create framebuffer */ + fReturn = (*pScreenPriv->pwinAllocateFB) (pScreen); + if (!fReturn) + { + ErrorF ("winFinishScreenInitFB () - Could not allocate framebuffer\n"); + return FALSE; + } + + /* Init visuals */ + fReturn = (*pScreenPriv->pwinInitVisuals) (pScreen); + if (!fReturn) + { + ErrorF ("winFinishScreenInitFB () - winInitVisuals failed\n"); + return FALSE; + } + + /* Setup a local variable to point to the framebuffer */ + pbits = pScreenInfo->pfb; + + /* Apparently we need this for the render extension */ + miSetPixmapDepths (); + + /* Initialize the fb code */ + if (!fbScreenInit (pScreen, + pScreenInfo->pfb, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + pScreenInfo->dwDPIx, pScreenInfo->dwDPIy, + pScreenInfo->dwStride, + pScreenInfo->dwBPP)) + { + ErrorF ("winFinishScreenInitFB () - fbScreenInit failed\n"); + return FALSE; + } + + pScreen->GetWindowPixmap = winGetWindowPixmap; + pScreen->SetWindowPixmap = winSetWindowPixmap; + +#ifdef RENDER + /* Render extension initialization, calls miPictureInit */ + fbPictureInit (pScreen, NULL, 0); +#endif + + /* Setup the cursor routines */ + miDCInitialize (pScreen, &g_winPointerCursorFuncs); + + /* Create a default colormap */ + fReturn = fbCreateDefColormap (pScreen); + if (!fReturn) + { + ErrorF ("winFinishScreenInitFB () - Could not create colormap\n"); + return FALSE; + } + + /* Initialize the shadow framebuffer layer */ + if (pScreenInfo->dwEngine == WIN_SERVER_SHADOW_GDI + || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DD + || pScreenInfo->dwEngine == WIN_SERVER_SHADOW_DDNL) + { + shadowInit (pScreen, + 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 (winBlockHandler, + 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 screen savers */ + /* Our SaveScreen () does nothing */ + pScreen->SaveScreen = winSaveScreen; + + /* Tell the server that we are enabled */ + pScreenPriv->fEnabled = TRUE; + + return fReturn; +} + +/* + * Detect engines supported by current Windows version + * DirectDraw version and hardware + */ +Bool +winDetectSupportedEngines (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + OSVERSIONINFO osvi; + HMODULE hmodDirectDraw = NULL; + + /* Initialize the engine support flags */ + pScreenInfo->dwEnginesSupported = WIN_SERVER_SHADOW_GDI; + + /* Get operating system version information */ + ZeroMemory (&osvi, sizeof (osvi)); + osvi.dwOSVersionInfoSize = sizeof (osvi); + GetVersionEx (&osvi); + + /* Branch on platform ID */ + switch (osvi.dwPlatformId) + { + case VER_PLATFORM_WIN32_NT: + /* Engine 4 is supported on NT only */ + ErrorF ("winDetectSupportedEngines () - Windows NT/2000\n"); + break; + + case VER_PLATFORM_WIN32_WINDOWS: + /* Engine 4 is supported on NT only */ + ErrorF ("winDetectSupportedEngines () - Windows 95/98/Me\n"); + break; + } + + /* Determine if DirectDraw is installed */ + hmodDirectDraw = LoadLibraryEx ("ddraw.dll", NULL, 0); + + /* Do we have DirectDraw? */ + if (hmodDirectDraw != NULL) + { + FARPROC fpDirectDrawCreate = NULL; + LPDIRECTDRAW lpdd = NULL; + LPDIRECTDRAW4 lpdd4 = NULL; + HRESULT ddrval; + + /* Try to get the DirectDrawCreate address */ + fpDirectDrawCreate = GetProcAddress (hmodDirectDraw, + "DirectDrawCreate"); + + /* Did the proc name exist? */ + if (fpDirectDrawCreate == NULL) + { + /* No DirectDraw support */ + return TRUE; + } + + /* DirectDrawCreate exists, try to call it */ + /* Create a DirectDraw object, store the address at lpdd */ + ddrval = (*fpDirectDrawCreate) (NULL, + (void**) &lpdd, + NULL); + if (FAILED (ddrval)) + { + /* No DirectDraw support */ + ErrorF ("winDetectSupportedEngines () - DirectDraw not installed\n"); + return TRUE; + } + else + { + /* We have DirectDraw */ + /* FIXME: Assuming we have DirectDraw3+ */ + ErrorF ("winDetectSupportedEngines () - DirectDraw installed\n"); + pScreenInfo->dwEnginesSupported |= WIN_SERVER_SHADOW_DD; + + /* Allow PrimaryDD engine if NT */ + if (osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) + { + pScreenInfo->dwEnginesSupported |= WIN_SERVER_PRIMARY_DD; + ErrorF ("winDetectSupportedEngines () - Allowing PrimaryDD\n"); + } + } + + /* Try to query for DirectDraw4 interface */ + ddrval = IDirectDraw_QueryInterface (lpdd, + &IID_IDirectDraw4, + (LPVOID*) &lpdd4); + if (SUCCEEDED (ddrval)) + { + /* We have DirectDraw4 */ + ErrorF ("winDetectSupportedEngines () - DirectDraw4 installed\n"); + pScreenInfo->dwEnginesSupported |= WIN_SERVER_SHADOW_DDNL; + } + + /* Cleanup DirectDraw interfaces */ + if (lpdd4 != NULL) + IDirectDraw_Release (lpdd4); + if (lpdd != NULL) + IDirectDraw_Release (lpdd); + + /* Unload the DirectDraw library */ + FreeLibrary (hmodDirectDraw); + hmodDirectDraw = NULL; + } + + ErrorF ("winDetectSupportedEngines () - Returning, supported engines %08x\n", + pScreenInfo->dwEnginesSupported); + + return TRUE; +} + +/* + * Set the engine type, depending on the engines + * supported for this screen, and whether the user + * suggested an engine type + */ +Bool +winSetEngine (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* If the user's choice is supported, we'll use that */ + if (pScreenInfo->dwEnginesSupported & pScreenInfo->dwEnginePreferred) + { + ErrorF ("winSetEngine () - Using user's preference: %d\n", + pScreenInfo->dwEnginePreferred); + pScreenInfo->dwEngine = pScreenInfo->dwEnginePreferred; + + /* Setup engine function pointers */ + switch (pScreenInfo->dwEngine) + { + case WIN_SERVER_SHADOW_GDI: + winSetEngineFunctionsShadowGDI (pScreen); + break; + case WIN_SERVER_SHADOW_DD: + winSetEngineFunctionsShadowDD (pScreen); + break; + case WIN_SERVER_SHADOW_DDNL: + winSetEngineFunctionsShadowDDNL (pScreen); + break; + case WIN_SERVER_PRIMARY_DD: + winSetEngineFunctionsPrimaryDD (pScreen); + break; + default: + FatalError ("winSetEngine () - Invalid engine type\n"); + } + return TRUE; + } + + /* ShadowDDNL has good performance, so why not */ + if (pScreenInfo->dwEnginesSupported & WIN_SERVER_SHADOW_DDNL) + { + ErrorF ("winSetEngine () - Using Shadow DirectDraw NonLocking\n"); + pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DDNL; + + /* Set engine function pointers */ + winSetEngineFunctionsShadowDDNL (pScreen); + return TRUE; + } + + /* ShadowDD is next in line */ + if (pScreenInfo->dwEnginesSupported & WIN_SERVER_SHADOW_DD) + { + ErrorF ("winSetEngine () - Using Shadow DirectDraw\n"); + pScreenInfo->dwEngine = WIN_SERVER_SHADOW_DD; + + /* Set engine function pointers */ + winSetEngineFunctionsShadowDD (pScreen); + return TRUE; + } + + /* ShadowGDI is next in line */ + if (pScreenInfo->dwEnginesSupported & WIN_SERVER_SHADOW_GDI) + { + ErrorF ("winSetEngine () - Using Shadow GDI DIB\n"); + pScreenInfo->dwEngine = WIN_SERVER_SHADOW_GDI; + + /* Set engine function pointers */ + winSetEngineFunctionsShadowGDI (pScreen); + return TRUE; + } + + return TRUE; +} + +/* See Porting Layer Definition - p. 33 */ +Bool +winSaveScreen (ScreenPtr pScreen, int on) +{ + return TRUE; +} + +/* + * + * + * + * + * TEST CODE BELOW - NOT USED IN NORMAL COMPILATION + * + * + * + * + * + */ + +/* See Porting Layer Definition - p. 20 */ +Bool +winFinishScreenInitNativeGDI (int index, + ScreenPtr pScreen, + int argc, char **argv) +{ + winScreenInfoPtr pScreenInfo = &g_winScreens[index]; + PictFormatPtr formats = NULL; + int nformats = 0; + Bool fReturn = FALSE; + int xsize, ysize; + int dpix = 75, dpiy = 75; + char *pbits = NULL; + VisualPtr pVisuals = NULL; + DepthPtr pDepths = NULL; + VisualID rootVisual = 0; + int nVisuals = 0, nDepths = 0, nRootDepth = 0; + winPrivScreenPtr pScreenPriv = NULL; + + ErrorF ("winScreenInit ()\n"); + + if (!winAllocatePrivates (pScreen)) + { + ErrorF ("winFinishScreenInitNativeGDI () winAllocatePrivates failed\n"); + return FALSE; + } + + /* Get a pointer to the privates structure that was allocated */ + pScreenPriv = winGetScreenPriv (pScreen); + + /* Save a pointer to this screen in the screen info structure */ + pScreenInfo->pScreen = pScreen; + + /* Save a pointer to the screen info in the sceen privates structure */ + /* This allows us to get back to the screen info from a sceen pointer */ + pScreenPriv->pScreenInfo = pScreenInfo; + + /* Initial display parameters */ + pScreenInfo->dwPaddedWidth = PixmapBytePad (pScreenInfo->dwWidth, + pScreenInfo->dwDepth); + pScreenInfo->dwBPP = winBitsPerPixel (pScreenInfo->dwDepth); + ErrorF ("winScreenInit () - screen (%dx%dx%d)\n", + pScreenInfo->dwWidth, pScreenInfo->dwHeight, pScreenInfo->dwDepth); + + /* Copy the width and height into local variables */ + xsize = pScreenInfo->dwWidth; + ysize = pScreenInfo->dwHeight; + + /* Create primary display window */ + winCreateBoundingWindowWindowed (pScreen); + + /* Simple screen information */ + pScreen->width = xsize; + pScreen->height = ysize; + pScreen->mmWidth = (xsize * 254 + dpix * 5) / (dpix * 10); + pScreen->mmHeight = (ysize * 254 + dpiy * 5) / (dpiy * 10); + pScreen->defColormap = FakeClientID (0); + pScreen->minInstalledCmaps = 1; + pScreen->maxInstalledCmaps = 1; + pScreen->backingStoreSupport = NotUseful; + pScreen->saveUnderSupport = NotUseful; + + pScreen->GetScreenPixmap = miGetScreenPixmap; + pScreen->SetScreenPixmap = miSetScreenPixmap; + + /* Region Routines */ +#ifdef NEED_SCREEN_REGIONS + pScreen->RegionCreate = miRegionCreate; + pScreen->RegionInit = miRegionInit; + pScreen->RegionCopy = miRegionCopy; + pScreen->RegionDestroy = miRegionDestroy; + pScreen->RegionUninit = miRegionUninit; + pScreen->Intersect = miIntersect; + pScreen->Union = miUnion; + pScreen->Subtract = miSubtract; + pScreen->Inverse = miInverse; + pScreen->RegionReset = miRegionReset; + pScreen->TranslateRegion = miTranslateRegion; + pScreen->RectIn = miRectIn; + pScreen->PointInRegion = miPointInRegion; + pScreen->RegionNotEmpty = miRegionNotEmpty; + pScreen->RegionBroken = miRegionBroken; + pScreen->RegionBreak = miRegionBreak; + pScreen->RegionEmpty = miRegionEmpty; + pScreen->RegionExtents = miRegionExtents; + pScreen->RegionAppend = miRegionAppend; + pScreen->RegionValidate = miRegionValidate; +#endif /* NEED_SCREEN_REGIONS */ + pScreen->BitmapToRegion = winPixmapToRegionNativeGDI; +#ifdef NEED_SCREEN_REGIONS + pScreen->RectsToRegion = miRectsToRegion; +#endif /* NEED_SCREEN_REGIONS */ + + /* Cursor Routines for a Screen */ + /* See mi/midispcur.c - miDCInitialize() */ + /* See Porting Layer Definition - pp. 25-26 */ + pScreen->PointerNonInterestBox = (PointerNonInterestBoxProcPtr) 0; + + /* Colormap Routines */ + pScreen->CreateColormap = winInitializeColormapNativeGDI; + pScreen->DestroyColormap = (void (*)())NoopDDA; + pScreen->InstallColormap = winInstallColormapNativeGDI; + pScreen->UninstallColormap = winUninstallColormapNativeGDI; + pScreen->ListInstalledColormaps = winListInstalledColormapsNativeGDI; + pScreen->StoreColors = (void (*)())NoopDDA; + pScreen->ResolveColor = winResolveColorNativeGDI; + + /* Fonts */ + pScreen->RealizeFont = winRealizeFontNativeGDI; + pScreen->UnrealizeFont = winUnrealizeFontNativeGDI; + + /* Other Screen Routines */ + pScreen->GetImage = miGetImage; + pScreen->GetSpans = winGetSpansNativeGDI; + pScreen->QueryBestSize = winQueryBestSizeNativeGDI; + pScreen->SourceValidate = (SourceValidateProcPtr) 0; + pScreen->SaveScreen = winSaveScreen; + pScreen->CloseScreen = miCloseScreen; + pScreen->CreateScreenResources = miCreateScreenResources; + + /* Pixmaps */ + pScreen->CreatePixmap = winCreatePixmapNativeGDI; + pScreen->DestroyPixmap = winDestroyPixmapNativeGDI; + pScreen->ModifyPixmapHeader = miModifyPixmapHeader; + + /* Window Procedures */ + pScreen->CreateWindow = winCreateWindowNativeGDI; + pScreen->DestroyWindow = winDestroyWindowNativeGDI; + pScreen->PositionWindow = winPositionWindowNativeGDI; + pScreen->ChangeWindowAttributes = winChangeWindowAttributesNativeGDI; + pScreen->RealizeWindow = winMapWindowNativeGDI; + pScreen->UnrealizeWindow = winUnmapWindowNativeGDI; + pScreen->ValidateTree = miValidateTree; + pScreen->PostValidateTree = (PostValidateTreeProcPtr) 0; + pScreen->WindowExposures = miWindowExposures; + pScreen->ClipNotify = (ClipNotifyProcPtr) 0; + + /* Window Painting Procedures */ + pScreen->ClearToBackground = miClearToBackground; + pScreen->CopyWindow = winCopyWindowNativeGDI; + pScreen->PaintWindowBackground = miPaintWindow; + pScreen->PaintWindowBorder = miPaintWindow; + + /* Screen Operation for Backing Store */ + pScreen->SaveDoomedAreas = 0; + pScreen->RestoreAreas = 0; + pScreen->TranslateBackingStore = 0; + pScreen->ExposeCopy = 0; + pScreen->ClearBackingStore = 0; + pScreen->DrawGuarantee = 0; + + /* Screen Operations for Multi-Layered Framebuffers */ + pScreen->MarkWindow = miMarkWindow; + pScreen->MarkOverlappedWindows = miMarkOverlappedWindows; + pScreen->ChangeSaveUnder = miChangeSaveUnder; + pScreen->PostChangeSaveUnder = miPostChangeSaveUnder; + pScreen->MoveWindow = miMoveWindow; + pScreen->ResizeWindow = miSlideAndSizeWindow; + pScreen->GetLayerWindow = miGetLayerWindow; + pScreen->HandleExposures = miHandleValidateExposures; + pScreen->ReparentWindow = (ReparentWindowProcPtr) 0; +#ifdef SHAPE + pScreen->SetShape = miSetShape; +#endif + pScreen->ChangeBorderWidth = miChangeBorderWidth; + pScreen->MarkUnrealizedWindow = miMarkUnrealizedWindow; + + /* GC Handling Routines */ + /* + * All other GC handling routines are pointed to through + * pScreen->gcfuncs + */ + /* See Porting Layer Definition pp. 43-46 */ + pScreen->CreateGC = winCreateGCNativeGDI; + + pScreen->RestackWindow = (RestackWindowProcPtr) 0; + + pScreen->SendGraphicsExpose = miSendGraphicsExpose; + + /* Block and Wakeup Handlers */ + pScreen->BlockHandler = (ScreenBlockHandlerProcPtr) NoopDDA; + pScreen->WakeupHandler = (ScreenWakeupHandlerProcPtr) NoopDDA; + pScreen->blockData = (pointer) 0; + pScreen->wakeupData = (pointer) 0; + + fprintf (stderr, "winScreenInit () - calling miInitVisuals()\n"); + if (!winInitVisualsNativeGDI (pScreen)) + { + ErrorF ("winScreenInit () - winInitVisuals returned FALSE\n"); + return FALSE; + } + else + { + ErrorF ("winScreenInit () - winInitVisuals returned TRUE\n"); + } + + /* Visuals */ + pScreen->numDepths = nDepths; + pScreen->rootDepth = nRootDepth; + pScreen->allowedDepths = pDepths; + pScreen->rootVisual = rootVisual; + pScreen->numVisuals = nVisuals; + pScreen->visuals = pVisuals; + + ErrorF ("winScreenInit () - nDepths: %d, nRootDepth: %d, nVisuals: %d\n", + nDepths, nRootDepth, nVisuals); + + fprintf (stderr, "winScreenInit () - calling miSetZeroLineBias()\n"); + miSetZeroLineBias (pScreen, pScreenInfo->dwLineBias); + + miPointerSetNewScreen (pScreenInfo->dwScreen, 0, 0); + + ErrorF ("winScreenInit () - calling miDCInitialize()\n"); + if (!miDCInitialize (pScreen, &g_winPointerCursorFuncs)) + { + ErrorF ("winScreenInit () - miDCInitialize failed\n"); + return FALSE; + } + else + { + ErrorF ("winScreenInit () - miDCInitialize succeeded\n"); + } + + ErrorF ("winScreenInit () - calling winCreateDefColormap()\n"); + fReturn = winCreateDefColormapNativeGDI (pScreen); + +#ifdef RENDER + ErrorF ("winScreenInit () - calling miPictureInit()\n"); + miPictureInit (pScreen, formats, nformats); +#endif + + if (fReturn) + { + RegisterBlockAndWakeupHandlers (winBlockHandler, + winWakeupHandler, + NULL); + } + pScreenInfo->pScreen = pScreen; + + miScreenDevPrivateInit (pScreen, xsize, pbits); + + ErrorF ("winScreenInit () - Successful addition of Screen %p %p\n", + pScreen->devPrivate, + pScreen); + + return fReturn; +} + +PixmapPtr +winGetWindowPixmap (WindowPtr pwin) +{ + ErrorF ("winGetWindowPixmap ()\n"); + return NULL; +} + +void +winSetWindowPixmap (WindowPtr pwin, PixmapPtr pPix) +{ + ErrorF ("winSetWindowPixmap ()\n"); +} Index: xc/programs/Xserver/hw/xwin/winsetsp.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winsetsp.c:1.1 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winsetsp.c Thu Apr 5 16:13:50 2001 @@ -0,0 +1,201 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winsetsp.c,v 1.1 2001/04/05 20:13:50 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 55 */ +void +winSetSpansNativeGDI (DrawablePtr pDrawable, + GCPtr pGC, + char *pSrcs, + DDXPointPtr pPoints, + int *pWidths, + int nSpans, + int fSorted) +{ +#if 0 + int iIdx = 0; + static int iCount = 0; + HBITMAP hBitmap = NULL; + char *pSrc = pSrcs; + int *pWidth = NULL; + DDXPointPtr pPoint = NULL; + HDC hdcMem; + BITMAPINFOHEADER bmih, bmihNew; + + /* Setup the bitmap header info */ + bmih.biSize = sizeof (bmih); + bmih.biWidth = pDrawable->width; + bmih.biHeight = pDrawable->height; + bmih.biPlanes = 1; + bmih.biBitCount = pDrawable->depth; + bmih.biCompression = BI_RGB; + bmih.biSizeImage = 0; + bmih.biXPelsPerMeter = 0; + bmih.biYPelsPerMeter = 0; + bmih.biClrUsed = 0; + bmih.biClrImportant = 0; + + fprintf (stderr, "\nwinSetSpans () - pDrawable: %08x\n", + pDrawable); + + /* What kind of raster op have we got here? */ + switch (pGC->alu) + { + case GXclear: + fprintf (stderr, "winSetSpans () - GXclear\n"); + break; + case GXand: + fprintf (stderr, "winSetSpans () - GXand:\n"); + break; + case GXandReverse: + fprintf (stderr, "winSetSpans () - GXandReverse\n"); + break; + case GXcopy: + fprintf (stderr, "winSetSpans () - GXcopy\n"); + + /* Loop through spans */ + for (iIdx = 0; iIdx < nSpans; ++iIdx) + { + pWidth = pWidths + iIdx; + pPoint = pPoints + iIdx; + + /* Blast the bits to the drawable */ + SetDIBits (g_hdcMem, ((PixmapPtr)pDrawable)->devPrivate.ptr, + pPoint->y, 1, pSrc, &bmih, 0); + + /* Display some useful information */ + fprintf (stderr, "(%dx%dx%d) (%d,%d) w: %d ps: %08x\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, *pWidth, pSrc); + + /* Calculate offset of next bit source */ + pSrc += 4 * ((*pWidth + 31) / 32); + } + break; + case GXandInverted: + fprintf (stderr, "winSetSpans () - GXandInverted\n"); + break; + case GXnoop: + fprintf (stderr, "winSetSpans () - GXnoop\n"); + break; + case GXxor: + fprintf (stderr, "winSetSpans () - GXxor\n"); + break; + case GXor: + fprintf (stderr, "winSetSpans () - GXor\n"); + break; + case GXnor: + fprintf (stderr, "winSetSpans () - GXnor\n"); + break; + case GXequiv: + fprintf (stderr, "winSetSpans () - GXequiv\n"); + break; + case GXinvert: + fprintf (stderr, "winSetSpans () - GXinvert\n"); + + hdcMem = CreateCompatibleDC (g_hdc); + + /* Loop through spans */ + for (iIdx = 0; iIdx < nSpans; ++iIdx) + { + pWidth = pWidths + iIdx; + pPoint = pPoints + iIdx; + + /* Setup the bitmap header info */ + bmihNew.biSize = sizeof (bmihNew); + bmihNew.biWidth = *pWidth; + bmihNew.biHeight = 1; + bmihNew.biPlanes = 1; + bmihNew.biBitCount = pDrawable->depth; + bmihNew.biCompression = BI_RGB; + bmihNew.biSizeImage = 0; + bmihNew.biXPelsPerMeter = 0; + bmihNew.biYPelsPerMeter = 0; + bmihNew.biClrUsed = 0; + bmihNew.biClrImportant = 0; + + /* Create a DIB from span line */ + if (pDrawable->depth == 1) + { + hBitmap = CreateDIBitmap (NULL, &bmih, 0, pSrc, NULL, 0); + } + else + { + hBitmap = CreateDIBitmap (g_hdcMem, &bmih, 0, pSrc, NULL, 0); + } + hBitmap = SelectObject (hdcMem, hBitmap); + + /* Blit the span line to the drawable */ + BitBlt (g_hdcMem, pPoint->x, pPoint->y, + *pWidth / pDrawable->depth, 1, + hdcMem, 0, 0, NOTSRCCOPY); + + /* Display some useful information */ + fprintf (stderr, "(%dx%dx%d) (%d,%d) w: %d ps: %08x\n", + pDrawable->width, pDrawable->height, pDrawable->depth, + pPoint->x, pPoint->y, *pWidth, pSrc); + + /* Calculate offset of next bit source */ + pSrc += 4 * ((*pWidth + 31) / 32); + + /* Pop the bitmap out of the memory DC */ + SelectObject (hdcMem, hBitmap); + + /* Free the temporary bitmap */ + DeleteObject (hBitmap); + hBitmap = NULL; + } + + /* Release the scratch DC */ + DeleteDC (hdcMem); + + break; + case GXorReverse: + fprintf (stderr, "winSetSpans () - GXorReverse\n"); + break; + case GXcopyInverted: + fprintf (stderr, "winSetSpans () - GXcopyInverted\n"); + break; + case GXorInverted: + fprintf (stderr, "winSetSpans () - GXorInverted\n"); + break; + case GXnand: + fprintf (stderr, "winSetSpans () - GXnand\n"); + break; + case GXset: + fprintf (stderr, "winSetSpans () - GXset\n"); + default: + fprintf (stderr, "winSetSpans () - Unknown ROP\n"); + break; + } +#endif +} Index: xc/programs/Xserver/hw/xwin/winshaddd.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winshaddd.c:1.5 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winshaddd.c Mon May 14 12:52:33 2001 @@ -0,0 +1,719 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshaddd.c,v 1.5 2001/05/14 16:52:33 alanh Exp $ */ + +#include "win.h" + +/* + * Create a DirectDraw surface for the shadow framebuffer; also create + * a primary surface object so we can blit to the display. + * + * Install a DirectDraw clipper on our primary surface object + * that clips our blits to the unobscured client area of our display window. + */ +Bool +winAllocateFBShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + DDSURFACEDESC ddsd; + DDSURFACEDESC *pddsdShadow = NULL; + +#if CYGDEBUG + ErrorF ("winAllocateFBShadowDD ()\n"); +#endif + + /* Create a clipper */ + ddrval = DirectDrawCreateClipper (0, + &pScreenPriv->pddcPrimary, + NULL); + if (FAILED (ddrval)) + { + 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)) + { + 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) + { + 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) + { + /* Set the cooperative level to full screen */ + ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd, + pScreenPriv->hwndScreen, + DDSCL_EXCLUSIVE + | DDSCL_FULLSCREEN); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "cooperative level\n"); + return FALSE; + } + + /* Change the video mode to the mode requested */ + ddrval = IDirectDraw_SetDisplayMode (pScreenPriv->pdd, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwDepth); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "full screen display mode\n"); + return FALSE; + } + } + else + { + /* Set the cooperative level for windowed mode */ + ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd, + pScreenPriv->hwndScreen, + DDSCL_NORMAL); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "cooperative level\n"); + return FALSE; + } + } + + /* Describe the primary surface */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS; + ddsd.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + /* Create the primary surface */ + ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd, + &ddsd, + &pScreenPriv->pddsPrimary, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDD () - Could not create primary "\ + "surface %08x\n", ddrval); + return FALSE; + } + +#if CYGDEBUG + ErrorF ("winAllocateFBShadowDD () - Created primary\n"); +#endif + + /* + * Attach a clipper to the primary surface that will clip our blits to our + * display window. + */ + ddrval = IDirectDrawSurface_SetClipper (pScreenPriv->pddsPrimary, + pScreenPriv->pddcPrimary); + if (FAILED (ddrval)) + { + 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, + * as drawing, locking, and unlocking take forever + * with video memory surfaces. In addition, + * video memory is a somewhat scarce resource, + * so you shouldn't be allocating video memory when + * you have the option of using system memory instead. + */ + ZeroMemory (&ddsd, sizeof (ddsd)); + ddsd.dwSize = sizeof (ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH; + ddsd.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + ddsd.dwHeight = pScreenInfo->dwHeight; + ddsd.dwWidth = pScreenInfo->dwWidth; + + /* Create the shadow surface */ + ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd, + &ddsd, + &pScreenPriv->pddsShadow, + NULL); + if (ddrval != DD_OK) + { + 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) + { + 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, + NULL, + pddsdShadow, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK || pddsdShadow->lpSurface == NULL) + { + 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)) + { + 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; + pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) + / pScreenInfo->dwDepth; + pScreenInfo->pfb = pddsdShadow->lpSurface; + + /* Grab the color depth and masks from the surface description */ + pScreenInfo->dwDepth = pddsdShadow->ddpfPixelFormat.u.dwRGBBitCount; + pScreenPriv->dwRedMask = pddsdShadow->ddpfPixelFormat.u2.dwRBitMask; + pScreenPriv->dwGreenMask = pddsdShadow->ddpfPixelFormat.u3.dwGBitMask; + pScreenPriv->dwBlueMask = pddsdShadow->ddpfPixelFormat.u4.dwBBitMask; + +#if CYGDEBUG + ErrorF ("winAllocateFBShadowDD () - Returning\n"); +#endif + + return TRUE; +} + +/* + * Transfer the damaged regions of the shadow framebuffer to the display. + */ +void +winShadowUpdateDD (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + RECT rcClient, rcDest, rcSrc; + DWORD dwBox = REGION_NUM_RECTS (damage); + BoxPtr pBox = REGION_RECTS (damage); + + /* Return immediately if the app is not active and we are fullscreen */ + if (!pScreenPriv->fActive && pScreenInfo->fFullScreen) return; + + /* Get location of display window's client area, in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Unlock the shadow surface, so we can blit */ + ddrval = IDirectDrawSurface_Unlock (pScreenPriv->pddsShadow, NULL); + if (FAILED (ddrval)) + { + ErrorF ("winShadowUpdateProcDD () - Unlock failed\n"); + return; + } + + /* Loop through all boxes in the damaged region */ + while (dwBox--) + { + /* Assign damage box to source rectangle */ + rcSrc.left = pBox->x1; + rcSrc.top = pBox->y1; + rcSrc.right = pBox->x2; + rcSrc.bottom = pBox->y2; + + /* Calculate destination rectange */ + rcDest.left = rcClient.left + rcSrc.left; + rcDest.top = rcClient.top + rcSrc.top; + rcDest.right = rcClient.left + rcSrc.right; + rcDest.bottom = rcClient.top + rcSrc.bottom; + + /* Blit the damaged areas */ + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsPrimary, + &rcDest, + pScreenPriv->pddsShadow, + &rcSrc, + DDBLT_WAIT, + NULL); + + /* Get a pointer to the next box */ + ++pBox; + } + + /* Relock the shadow surface */ + ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsShadow, + NULL, + pScreenPriv->pddsdShadow, + DDLOCK_WAIT, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winShadowUpdateProcDD () - Lock failed\n"); + return; + } + + /* Has our memory pointer changed? */ + if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) + { + /* Location of shadow framebuffer has changed */ + pScreenInfo->pfb = pScreenPriv->pddsdShadow->lpSurface; + + /* Update the screen pixmap */ + if (!(*pScreen->ModifyPixmapHeader)(pScreen->devPrivate, + pScreen->width, + pScreen->height, + pScreen->rootDepth, + BitsPerPixel (pScreen->rootDepth), + PixmapBytePad (pScreenInfo->dwStride, + pScreenInfo->dwDepth), + pScreenInfo->pfb)) + { + ErrorF ("winShadowUpdateProcDD () - Bits changed, could not "\ + "notify fb.\n"); + return; + } + } +} + +/* + * Return a pointer to some part of the shadow framebuffer. + * + * NOTE: I have not seen this function get called, yet. + */ +void * +winShadowSetWindowLinearDD (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + *pdwSize = pScreenInfo->dwPaddedWidth; + + return (CARD8 *) pScreenInfo->pfb + + dwRow * pScreenInfo->dwPaddedWidth + dwOffset; +} + +/* + * Return a pointer to some part of the shadow framebuffer. + * + * NOTE: I have not seen this function get called, yet. + * + * We call winShadowSetWindowLinearDD because there could, + * theoretically, be other framebuffer styles that + * required a different calculation. + */ +void * +winShadowWindowDD (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size) +{ + return winShadowSetWindowLinearDD (pScreen, row, offset, mode, size); +} + +/* + * Call the wrapped CloseScreen function. + * + * Free our resources and private structures. + */ +Bool +winCloseScreenShadowDD (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn; + +#if CYGDEBUG + ErrorF ("winCloseScreenShadowDD () - Freeing screen resources\n"); +#endif + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* Call the wrapped CloseScreen procedure */ + pScreen->CloseScreen = pScreenPriv->CloseScreen; + fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + /* Free the shadow surface, if there is one */ + if (pScreenPriv->pddsShadow) + { + IDirectDrawSurface_Unlock (pScreenPriv->pddsShadow, NULL); + IDirectDrawSurface_Release (pScreenPriv->pddsShadow); + pScreenPriv->pddsShadow = NULL; + } + + /* Release the primary surface, if there is one */ + if (pScreenPriv->pddsPrimary) + { + IDirectDrawSurface_Release (pScreenPriv->pddsPrimary); + pScreenPriv->pddsPrimary = NULL; + } + + /* Free the DirectDraw object, if there is one */ + if (pScreenPriv->pdd) + { + IDirectDraw_RestoreDisplayMode (pScreenPriv->pdd); + IDirectDraw_Release (pScreenPriv->pdd); + pScreenPriv->pdd = NULL; + } + + /* Redisplay the Windows cursor */ + if (!pScreenPriv->fCursor) + ShowCursor (TRUE); + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + + /* Kill our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; + + /* Free the screen privates for this screen */ + xfree ((pointer) pScreenPriv); + + return fReturn; +} + +/* + * Tell mi what sort of visuals we need. + * + * Generally we only need one visual, as our screen can only + * handle one format at a time, I believe. You may want + * to verify that last sentence. + */ +Bool +winInitVisualsShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + DWORD dwRedBits, dwGreenBits, dwBlueBits; + + /* Count the number of ones in each color mask */ + dwRedBits = winCountBits (pScreenPriv->dwRedMask); + dwGreenBits = winCountBits (pScreenPriv->dwGreenMask); + dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); + + /* Store the maximum number of ones in a color mask as the bitsPerRGB */ + if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwRedBits; + else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwGreenBits; + else + pScreenPriv->dwBitsPerRGB = dwBlueBits; + + ErrorF ("winInitVisualsShadowDD () - Masks: %08x %08x %08x bpRGB: %d\n", + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask, + pScreenPriv->dwBitsPerRGB); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + case 16: + case 15: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowDD () - miSetVisualTypesAndMasks "\ + "failed\n"); + return FALSE; + } + break; + + case 8: +#if CYGDEBUG + ErrorF ("winInitVisualsShadowDD () - Calling "\ + "miSetVisualTypesAndMasks\n"); +#endif /* CYGDEBUG */ + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + PseudoColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowDD () - miSetVisualTypesAndMasks "\ + "failed\n"); + return FALSE; + } +#if CYGDEBUG + ErrorF ("winInitVisualsShadowDD () - Returned from "\ + "miSetVisualTypesAndMasks\n"); +#endif /* CYGDEBUG */ + break; + + default: + ErrorF ("winInitVisualsDD () - Unknown screen depth\n"); + return FALSE; + } + + /* Set DPI info */ + pScreenInfo->dwDPIx = 100; + pScreenInfo->dwDPIy = 100; + + ErrorF ("winInitVisualsShadowDD () - Returning\n"); + + return TRUE; +} + +Bool +winAdjustVideoModeShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc = NULL; + DWORD dwDepth; + + /* Are we fullscreen? */ + if (pScreenInfo->fFullScreen) + { + /* We don't need to adjust the video mode for fullscreen */ + return TRUE; + } + + /* We're in serious trouble if we can't get a DC */ + hdc = GetDC (NULL); + if (hdc == NULL) + { + ErrorF ("winAdjustVideoModeShadowDD () - GetDC () failed\n"); + return FALSE; + } + + /* Query GDI for current display depth */ + dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + + /* Is GDI using a depth different than command line parameter? */ + if (dwDepth != pScreenInfo->dwDepth) + { + /* Warn user if GDI depth is different than depth specified */ + ErrorF ("winAdjustVideoModeShadowDD () - Command line depth: %d, "\ + "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + + /* We'll use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + + /* Release our DC */ + ReleaseDC (NULL, hdc); + return TRUE; +} + +/* Blt exposed regions to the screen */ +Bool +winBltExposedRegionsShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RECT rcClient, rcSrc; + HDC hdcUpdate = NULL; + PAINTSTRUCT ps; + HRESULT ddrval = DD_OK; + Bool fReturn = TRUE; + + /* BeginPaint gives us an hdc that clips to the invalidated region */ + hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); + + /* Unlock the shadow surface, so we can blit */ + ddrval = IDirectDrawSurface_Unlock (pScreenPriv->pddsShadow, NULL); + if (FAILED (ddrval)) + { + fReturn = FALSE; + goto winBltExposedRegionsShadowDD_Exit; + } + + /* Get client area in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Source can be enter shadow surface, as Blt should clip */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Our Blt should be clipped to the invalidated region */ + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsPrimary, + &rcClient, + pScreenPriv->pddsShadow, + &rcSrc, + DDBLT_WAIT, + NULL); + + /* Relock the shadow surface */ + ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsShadow, + NULL, + pScreenPriv->pddsdShadow, + DDLOCK_WAIT, + NULL); + if (FAILED (ddrval)) + { + fReturn = FALSE; + goto winBltExposedRegionsShadowDD_Exit; + } + + /* Has our memory pointer changed? */ + if (pScreenInfo->pfb != pScreenPriv->pddsdShadow->lpSurface) + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdShadow->lpSurface); + + winBltExposedRegionsShadowDD_Exit: + /* EndPaint frees the DC */ + if (hdcUpdate != NULL) + EndPaint (pScreenPriv->hwndScreen, &ps); + return fReturn; +} + +Bool +winActivateAppShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* + * Do we have a surface? + * Are we active? + * Are we fullscreen? + */ + if (pScreenPriv != NULL + && pScreenPriv->pddsPrimary != NULL + && pScreenPriv->fActive + ) + { + /* Primary surface was lost, restore it */ + IDirectDrawSurface_Restore (pScreenPriv->pddsPrimary); + } + + return TRUE; +} + +/* Set engine specific functions */ +Bool +winSetEngineFunctionsShadowDD (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBShadowDD; + pScreenPriv->pwinShadowUpdate = winShadowUpdateDD; + pScreenPriv->pwinShadowWindow = winShadowWindowDD; + pScreenPriv->pwinCloseScreen = winCloseScreenShadowDD; + pScreenPriv->pwinInitVisuals = winInitVisualsShadowDD; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDD; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; + pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDD; + pScreenPriv->pwinActivateApp = winActivateAppShadowDD; + + return TRUE; +} + + Index: xc/programs/Xserver/hw/xwin/winshadddnl.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winshadddnl.c:1.5 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winshadddnl.c Mon May 14 12:52:33 2001 @@ -0,0 +1,693 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshadddnl.c,v 1.5 2001/05/14 16:52:33 alanh Exp $ */ + +#include "win.h" + +/* + * FIXME: Headers are broken, DEFINE_GUID doesn't work correctly, + * so we have to redefine it here. + */ +#ifdef DEFINE_GUID +#undef DEFINE_GUID +#define DEFINE_GUID(n,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) GUID_EXT const GUID n GUID_SECT = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}} +#endif /* DEFINE_GUID */ + +/* + * FIXME: Headers are broken, IID_IDirectDraw4 has to be defined + * here manually. Should be handled by ddraw.h + */ +#ifndef IID_IDirectDraw4 +DEFINE_GUID( IID_IDirectDraw4, 0x9c59509a,0x39bd,0x11d1,0x8c,0x4a,0x00,0xc0,0x4f,0xd9,0x30,0xc5 ); +#endif /* IID_IDirectDraw4 */ + +/* + * Create a DirectDraw surface for the shadow framebuffer; also create + * a primary surface object so we can blit to the display. + * + * Install a DirectDraw clipper on our primary surface object + * that clips our blits to the unobscured client area of our display window. + */ +Bool +winAllocateFBShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + DDSURFACEDESC2 ddsdPrimary; + DDSURFACEDESC2 ddsdShadow; + char *lpSurface = NULL; + DDPIXELFORMAT ddpfPrimary; + +#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); + if (lpSurface == NULL) + { + ErrorF ("winAllocateFBShadowDDNL () - Could not allocate bits\n"); + return FALSE; + } + + /* + * Initialize the framebuffer memory so we don't get a + * strange display at startup + */ + ZeroMemory (lpSurface, pScreenInfo->dwPaddedWidth * pScreenInfo->dwHeight); + + /* Create a clipper */ + ddrval = DirectDrawCreateClipper (0, + &pScreenPriv->pddcPrimary, + NULL); + if (FAILED (ddrval)) + { + 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)) + { + 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, + (LPDIRECTDRAW*) &pScreenPriv->pdd, + NULL); + if (ddrval != DD_OK) + { + 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)) + { + 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 */ + if (pScreenInfo->fFullScreen) + { + /* Set the cooperative level to full screen */ + ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd4, + pScreenPriv->hwndScreen, + DDSCL_EXCLUSIVE + | DDSCL_FULLSCREEN); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "cooperative level\n"); + return FALSE; + } + + /* Change the video mode to the mode requested */ + ddrval = IDirectDraw_SetDisplayMode (pScreenPriv->pdd, + pScreenInfo->dwWidth, + pScreenInfo->dwHeight, + pScreenInfo->dwDepth); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "full screen display mode\n"); + return FALSE; + } + } + else + { + /* Set the cooperative level for windowed mode */ + ddrval = IDirectDraw_SetCooperativeLevel (pScreenPriv->pdd4, + pScreenPriv->hwndScreen, + DDSCL_NORMAL); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL () - Could not set "\ + "cooperative level\n"); + return FALSE; + } + } + + /* Describe the primary surface */ + ZeroMemory (&ddsdPrimary, sizeof (ddsdPrimary)); + ddsdPrimary.dwSize = sizeof (ddsdPrimary); + ddsdPrimary.dwFlags = DDSD_CAPS; + ddsdPrimary.ddsCaps.dwCaps = DDSCAPS_PRIMARYSURFACE; + + /* Create the primary surface */ + ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd4, + (LPDDSURFACEDESC)&ddsdPrimary, + (LPDIRECTDRAWSURFACE*) + &pScreenPriv->pddsPrimary4, + NULL); + if (FAILED (ddrval)) + { + ErrorF ("winAllocateFBShadowDDNL () - Could not create primary "\ + "surface %08x\n", ddrval); + return FALSE; + } + +#if CYGDEBUG + ErrorF ("winAllocateFBShadowDDNL () - Created primary\n"); +#endif + + /* Get primary surface's pixel format */ + ZeroMemory (&ddpfPrimary, sizeof (ddpfPrimary)); + ddpfPrimary.dwSize = sizeof (ddpfPrimary); + ddrval = IDirectDrawSurface_GetPixelFormat (pScreenPriv->pddsPrimary4, + &ddpfPrimary); + if (FAILED (ddrval)) + { + 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)) + { + 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, + * as drawing, locking, and unlocking take forever + * with video memory surfaces. In addition, + * video memory is a somewhat scarce resource, + * so you shouldn't be allocating video memory when + * you have the option of using system memory instead. + */ + ZeroMemory (&ddsdShadow, sizeof (ddsdShadow)); + ddsdShadow.dwSize = sizeof (ddsdShadow); + ddsdShadow.dwFlags = DDSD_CAPS | DDSD_HEIGHT | DDSD_WIDTH + | DDSD_LPSURFACE | DDSD_PITCH | DDSD_PIXELFORMAT; + ddsdShadow.ddsCaps.dwCaps = DDSCAPS_OFFSCREENPLAIN | DDSCAPS_SYSTEMMEMORY; + ddsdShadow.dwHeight = pScreenInfo->dwHeight; + ddsdShadow.dwWidth = pScreenInfo->dwWidth; + ddsdShadow.u.lPitch = pScreenInfo->dwPaddedWidth; + ddsdShadow.lpSurface = lpSurface; + ddsdShadow.ddpfPixelFormat = ddpfPrimary; + + /* Create the shadow surface */ + ddrval = IDirectDraw_CreateSurface (pScreenPriv->pdd4, + (LPDDSURFACEDESC)&ddsdShadow, + (LPDIRECTDRAWSURFACE*) + &pScreenPriv->pddsShadow4, + NULL); + if (ddrval != DD_OK) + { + 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; + pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) + / pScreenInfo->dwDepth; + pScreenInfo->pfb = lpSurface; + + /* Grab the color depth and masks from the surface description */ + pScreenInfo->dwDepth = ddsdShadow.ddpfPixelFormat.u.dwRGBBitCount; + pScreenPriv->dwRedMask = ddsdShadow.ddpfPixelFormat.u2.dwRBitMask; + pScreenPriv->dwGreenMask = ddsdShadow.ddpfPixelFormat.u3.dwGBitMask; + pScreenPriv->dwBlueMask = ddsdShadow.ddpfPixelFormat.u4.dwBBitMask; + +#if CYGDEBUG + ErrorF ("winAllocateFBShadowDDNL () - Returning\n"); +#endif + + return TRUE; +} + +/* + * Transfer the damaged regions of the shadow framebuffer to the display. + */ +void +winShadowUpdateDDNL (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HRESULT ddrval = DD_OK; + RECT rcClient, rcDest, rcSrc; + DWORD dwBox = REGION_NUM_RECTS (damage); + BoxPtr pBox = REGION_RECTS (damage); + + /* Return immediately if the app is not active and we are fullscreen */ + if (!pScreenPriv->fActive && pScreenInfo->fFullScreen) return; + + /* Get location of display window's client area, in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Loop through all boxes in the damaged region */ + while (dwBox--) + { + /* Assign damage box to source rectangle */ + rcSrc.left = pBox->x1; + rcSrc.top = pBox->y1; + rcSrc.right = pBox->x2; + rcSrc.bottom = pBox->y2; + + /* Calculate destination rectange */ + rcDest.left = rcClient.left + rcSrc.left; + rcDest.top = rcClient.top + rcSrc.top; + rcDest.right = rcClient.left + rcSrc.right; + rcDest.bottom = rcClient.top + rcSrc.bottom; + + /* Blit the damaged areas */ + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsPrimary4, + &rcDest, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + + /* Get a pointer to the next box */ + ++pBox; + } +} + +/* + * Return a pointer to some part of the shadow framebuffer. + * + * NOTE: I have not seen this function get called, yet. + */ +void * +winShadowSetWindowLinearDDNL (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + *pdwSize = pScreenInfo->dwPaddedWidth; + return (CARD8 *) pScreenInfo->pfb + + dwRow * pScreenInfo->dwPaddedWidth + dwOffset; +} + +/* + * Return a pointer to some part of the shadow framebuffer. + * + * NOTE: I have not seen this function get called, yet. + * + * We call winShadowSetWindowLinearDD because there could, + * theoretically, be other framebuffer styles that + * required a different calculation. + */ +void * +winShadowWindowDDNL (ScreenPtr pScreen, + CARD32 row, + CARD32 offset, + int mode, + CARD32 *size) +{ + FatalError ("winShadowWindowProcDDNL () - Hmm... this function has never "\ + "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); +} + +/* + * Call the wrapped CloseScreen function. + * + * Free our resources and private structures. + */ +Bool +winCloseScreenShadowDDNL (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn; + +#if CYGDEBUG + ErrorF ("winCloseScreenShadowDDNL () - Freeing screen resources\n"); +#endif + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* Call the wrapped CloseScreen procedure */ + pScreen->CloseScreen = pScreenPriv->CloseScreen; + fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + /* Free the shadow surface, if there is one */ + if (pScreenPriv->pddsShadow4) + { + IDirectDrawSurface_Release (pScreenPriv->pddsShadow4); + xfree (pScreenInfo->pfb); + pScreenInfo->pfb = NULL; + pScreenPriv->pddsShadow4 = NULL; + } + + /* Release the primary surface, if there is one */ + if (pScreenPriv->pddsPrimary4) + { + IDirectDrawSurface_Release (pScreenPriv->pddsPrimary4); + pScreenPriv->pddsPrimary4 = NULL; + } + + /* Free the DirectDraw object, if there is one */ + if (pScreenPriv->pdd) + { + IDirectDraw_RestoreDisplayMode (pScreenPriv->pdd); + IDirectDraw_Release (pScreenPriv->pdd); + pScreenPriv->pdd = NULL; + } + + /* Free the DirectDraw4 object, if there is one */ + if (pScreenPriv->pdd4) + { + IDirectDraw_Release (pScreenPriv->pdd4); + pScreenPriv->pdd4 = NULL; + } + + /* Redisplay the Windows cursor */ + if (!pScreenPriv->fCursor) + ShowCursor (TRUE); + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + + /* Kill our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Free the screen privates for this screen */ + xfree ((pointer) pScreenPriv); + + return fReturn; +} + +/* + * Tell mi what sort of visuals we need. + * + * Generally we only need one visual, as our screen can only + * handle one format at a time, I believe. You may want + * to verify that last sentence. + */ +Bool +winInitVisualsShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + DWORD dwRedBits, dwGreenBits, dwBlueBits; + + /* Count the number of ones in each color mask */ + dwRedBits = winCountBits (pScreenPriv->dwRedMask); + dwGreenBits = winCountBits (pScreenPriv->dwGreenMask); + dwBlueBits = winCountBits (pScreenPriv->dwBlueMask); + + /* Store the maximum number of ones in a color mask as the bitsPerRGB */ + if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwRedBits; + else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwGreenBits; + else + pScreenPriv->dwBitsPerRGB = dwBlueBits; + + ErrorF ("winInitVisualsShadowDDNL () - Masks %08x %08x %08x RGB %d d %d\n", + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask, + pScreenPriv->dwBitsPerRGB, + pScreenInfo->dwDepth); + + /* Create a single visual according to the Windows screen depth */ + switch (pScreenInfo->dwDepth) + { + case 32: + case 24: + case 16: + case 15: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowDDNL () - "\ + "miSetVisualTypesAndMasks failed\n"); + return FALSE; + } + break; + + case 8: +#if CYGDEBUG + ErrorF ("winInitVisualsShadowDDNL () - Calling "\ + "miSetVisualTypesAndMasks\n"); +#endif /* CYGDEBUG */ + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + PseudoColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsShadowDDNL () - "\ + "miSetVisualTypesAndMasks failed\n"); + return FALSE; + } + break; + + default: + ErrorF ("winInitVisualsDDNL () - Unknown screen depth\n"); + return FALSE; + } + + /* Set DPI info */ + pScreenInfo->dwDPIx = 100; + pScreenInfo->dwDPIy = 100; + + ErrorF ("winInitVisualsShadowDDNL () - Returning\n"); + + return TRUE; +} + +Bool +winAdjustVideoModeShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc = NULL; + DWORD dwDepth; + + /* Are we fullscreen? */ + if (pScreenInfo->fFullScreen) + { + /* We don't need to adjust the video mode for fullscreen */ + return TRUE; + } + + /* We're in serious trouble if we can't get a DC */ + hdc = GetDC (NULL); + if (hdc == NULL) + { + ErrorF ("winAdjustVideoModeShadowDDNL () - GetDC () failed\n"); + return FALSE; + } + + /* Query GDI for current display depth */ + dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + + /* Is GDI using a depth different than command line parameter? */ + if (dwDepth != pScreenInfo->dwDepth) + { + /* Warn user if GDI depth is different than depth specified */ + ErrorF ("winAdjustVideoModeShadowDDNL () - Command line depth: %d, "\ + "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + + /* We'll use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + + /* Release our DC */ + ReleaseDC (NULL, hdc); + + return TRUE; +} + +/* Blt exposed regions to the screen */ +Bool +winBltExposedRegionsShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + RECT rcClient, rcSrc; + HDC hdcUpdate; + PAINTSTRUCT ps; + HRESULT ddrval = DD_OK; + + /* BeginPaint gives us an hdc that clips to the invalidated region */ + hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); + + /* Get client area in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Source can be enter shadow surface, as Blt should clip */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Our Blt should be clipped to the invalidated region */ + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsPrimary4, + &rcClient, + pScreenPriv->pddsShadow4, + &rcSrc, + DDBLT_WAIT, + NULL); + + /* EndPaint frees the DC */ + EndPaint (pScreenPriv->hwndScreen, &ps); + + return TRUE; +} + +Bool +winActivateAppShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + + /* + * Do we have a surface? + * Are we active? + * Are we full screen? + */ + if (pScreenPriv != NULL + && pScreenPriv->pddsPrimary4 != NULL + && pScreenPriv->fActive + ) + { + /* Primary surface was lost, restore it */ + IDirectDrawSurface_Restore (pScreenPriv->pddsPrimary4); + } + + return TRUE; +} + +/* Set pointers to our engine specific functions */ +Bool +winSetEngineFunctionsShadowDDNL (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBShadowDDNL; + pScreenPriv->pwinShadowUpdate = winShadowUpdateDDNL; + pScreenPriv->pwinShadowWindow = winShadowWindowDDNL; + pScreenPriv->pwinCloseScreen = winCloseScreenShadowDDNL; + pScreenPriv->pwinInitVisuals = winInitVisualsShadowDDNL; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowDDNL; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; + pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowDDNL; + pScreenPriv->pwinActivateApp = winActivateAppShadowDDNL; + + return TRUE; +} + + Index: xc/programs/Xserver/hw/xwin/winshadgdi.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winshadgdi.c:1.6 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winshadgdi.c Mon May 14 12:52:33 2001 @@ -0,0 +1,604 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winshadgdi.c,v 1.6 2001/05/14 16:52:33 alanh Exp $ */ + +#include "win.h" + +static +Bool +winQueryScreenDIBFormat (ScreenPtr pScreen, BITMAPINFOHEADER *pbmih) +{ + winScreenPriv(pScreen); + HBITMAP hbmp; +#if CYGDEBUG + LPDWORD pdw = NULL; +#endif + + /* Create a memory bitmap compatible with the screen */ + hbmp = CreateCompatibleBitmap (pScreenPriv->hdcScreen, 1, 1); + if (hbmp == NULL) + { + ErrorF ("winQueryScreenDIBFormat () - CreateCompatibleBitmap failed\n"); + return FALSE; + } + + /* Initialize our bitmap info header */ + ZeroMemory (pbmih, sizeof (BITMAPINFOHEADER) + 256 * sizeof (RGBQUAD)); + pbmih->biSize = sizeof (BITMAPINFOHEADER); + + /* Get the biBitCount */ + if (!GetDIBits (pScreenPriv->hdcScreen, + hbmp, + 0, 1, + NULL, + (BITMAPINFO*) pbmih, + DIB_RGB_COLORS)) + { + ErrorF ("winQueryScreenDIBFormat () - First call to GetDIBits failed\n"); + DeleteObject (hbmp); + return FALSE; + } + +#if CYGDEBUG + /* Get a pointer to bitfields */ + pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER)); + + ErrorF ("winQueryScreenDIBFormat () - First call masks: %08x %08x %08x\n", + pdw[0], pdw[1], pdw[2]); +#endif + + /* Get optimal color table, or the optimal bitfields */ + if (!GetDIBits (pScreenPriv->hdcScreen, + hbmp, + 0, 1, + NULL, + (BITMAPINFO*)pbmih, + DIB_RGB_COLORS)) + { + ErrorF ("winQueryScreenDIBFormat () - Second call to GetDIBits "\ + "failed\n"); + DeleteObject (hbmp); + return FALSE; + } + + /* Free memory */ + DeleteObject (hbmp); + + return TRUE; +} + +static +Bool +winQueryRGBBitsAndMasks (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + BITMAPINFOHEADER *pbmih = NULL; + Bool fReturn = TRUE; + LPDWORD pdw = NULL; + DWORD dwRedBits, dwGreenBits, dwBlueBits; + + /* RGB BPP for 8 bit palletes is always 8 bits per pixel */ + if (GetDeviceCaps (pScreenPriv->hdcScreen, RASTERCAPS) & RC_PALETTE) + { + /* + * FIXME: 8bpp doesn't work. + */ + pScreenPriv->dwBitsPerRGB = 8; + pScreenPriv->dwRedMask = 0x0L; + pScreenPriv->dwGreenMask = 0x0L; + pScreenPriv->dwBlueMask = 0x0L; + return TRUE; + } + + /* Color masks for 24 bpp are standardized */ + if (GetDeviceCaps (pScreenPriv->hdcScreen, PLANES) + * GetDeviceCaps (pScreenPriv->hdcScreen, BITSPIXEL) == 24) + { + /* 8 bits per primary color */ + pScreenPriv->dwBitsPerRGB = 8; + + /* Set screen privates masks */ + pScreenPriv->dwRedMask = WIN_24BPP_MASK_RED; + pScreenPriv->dwGreenMask = WIN_24BPP_MASK_GREEN; + pScreenPriv->dwBlueMask = WIN_24BPP_MASK_BLUE; + + return TRUE; + } + + /* Allocate a bitmap header and color table */ + pbmih = (BITMAPINFOHEADER*) xalloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + if (pbmih == NULL) + { + ErrorF ("winQueryRGBBitsAndMasks () - xalloc failed\n"); + return FALSE; + } + + /* Get screen description */ + if (winQueryScreenDIBFormat (pScreen, pbmih)) + { + /* Get a pointer to bitfields */ + pdw = (DWORD*) ((CARD8*)pbmih + sizeof (BITMAPINFOHEADER)); + +#if CYGDEBUG + ErrorF ("winQueryRGBBitsAndMasks () - Masks: %08x %08x %08x\n", + pdw[0], pdw[1], pdw[2]); +#endif + + /* Count the number of bits in each mask */ + dwRedBits = winCountBits (pdw[0]); + dwGreenBits = winCountBits (pdw[1]); + dwBlueBits = winCountBits (pdw[2]); + + /* Find maximum bits per red, green, blue */ + if (dwRedBits > dwGreenBits && dwRedBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwRedBits; + else if (dwGreenBits > dwRedBits && dwGreenBits > dwBlueBits) + pScreenPriv->dwBitsPerRGB = dwGreenBits; + else + pScreenPriv->dwBitsPerRGB = dwBlueBits; + + /* Set screen privates masks */ + pScreenPriv->dwRedMask = pdw[0]; + pScreenPriv->dwGreenMask = pdw[1]; + pScreenPriv->dwBlueMask = pdw[2]; + } + else + { + ErrorF ("winQueryRGBBitsAndMasks () - winQueryScreenDIBFormat failed\n"); + xfree (pbmih); + fReturn = FALSE; + } + + /* Free memory */ + xfree (pbmih); + + return fReturn; +} + +/* Allocate a DIB for the shadow framebuffer GDI server */ +Bool +winAllocateFBShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + BITMAPINFOHEADER *pbmih = NULL; + DIBSECTION dibsection; + Bool fReturn = TRUE; + + /* Get device contexts for the screen and shadow bitmap */ + pScreenPriv->hdcScreen = GetDC (pScreenPriv->hwndScreen); + pScreenPriv->hdcShadow = CreateCompatibleDC (pScreenPriv->hdcScreen); + + /* Allocate bitmap info header */ + pbmih = (BITMAPINFOHEADER*) xalloc (sizeof (BITMAPINFOHEADER) + + 256 * sizeof (RGBQUAD)); + if (pbmih == NULL) + { + ErrorF ("winAllocateFBShadowGDI - xalloc () failed\n"); + return FALSE; + } + + /* Query the screen format */ + fReturn = winQueryScreenDIBFormat (pScreen, pbmih); + + /* Describe shadow bitmap to be created */ + pbmih->biWidth = pScreenInfo->dwWidth; + pbmih->biHeight = -pScreenInfo->dwHeight; + + /* Create a DI shadow bitmap with a bit pointer */ + pScreenPriv->hbmpShadow = CreateDIBSection (pScreenPriv->hdcScreen, + (BITMAPINFO *) pbmih, + 0, + (VOID**) &pScreenInfo->pfb, + NULL, + 0); + if (pScreenPriv->hbmpShadow == NULL || pScreenInfo->pfb == NULL) + { + ErrorF ("winAllocateFBShadowGDI () - CreateDIBSection failed\n"); + 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 + + fReturn = BitBlt (pScreenPriv->hdcScreen, + 0, 0, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + pScreenPriv->hdcShadow, + 0, 0, + SRCCOPY); + if (fReturn) + { +#if CYGDEBUG + ErrorF ("winAllocateFBShadowGDI () - Shadow blit success\n"); +#endif + } + else + { + ErrorF ("winAllocateFBShadowGDI () - Shadow blit failure\n"); + return FALSE; + } + + /* Set screeninfo stride */ + pScreenInfo->dwStrideBytes = pScreenInfo->dwPaddedWidth; + pScreenInfo->dwStride = (pScreenInfo->dwStrideBytes * 8) + / pScreenInfo->dwDepth; + + return fReturn; +} + +/* Blit the damaged regions of the shadow fb to the screen */ +void +winShadowUpdateGDI (ScreenPtr pScreen, + PixmapPtr pShadow, + RegionPtr damage) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + DWORD dwBox = REGION_NUM_RECTS (damage); + BoxPtr pBox = REGION_RECTS (damage); + int x, y, w, h; + + /* Return immediately if the app is not active and we are fullscreen */ + if (!pScreenPriv->fActive && pScreenInfo->fFullScreen) return; + + /* Loop through all boxes in the damaged region */ + while (dwBox--) + { + /* Calculate x offset, y offset, width, and height for + current damage box + */ + x = pBox->x1; + y = pBox->y1; + w = pBox->x2 - pBox->x1; + h = pBox->y2 - pBox->y1; + + BitBlt (pScreenPriv->hdcScreen, + x, y, + w, h, + pScreenPriv->hdcShadow, + x, y, + SRCCOPY); + + /* Get a pointer to the next box */ + ++pBox; + } +} + +void * +winShadowSetWindowLinearGDI (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + *pdwSize = pScreenInfo->dwPaddedWidth; + return (CARD8 *) pScreenInfo->pfb + + dwRow * pScreenInfo->dwPaddedWidth + dwOffset; +} + +void * +winShadowWindowGDI (ScreenPtr pScreen, + CARD32 dwRow, + CARD32 dwOffset, + int mode, + CARD32 *pdwSize) +{ + return winShadowSetWindowLinearGDI (pScreen, dwRow, dwOffset, mode, pdwSize); +} + +/* See Porting Layer Definition - p. 33 */ +/* We wrap whatever CloseScreen procedure was specified by fb; + a pointer to said procedure is stored in our devPrivate +*/ +Bool +winCloseScreenShadowGDI (int nIndex, ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + Bool fReturn; + +#if CYGDEBUG + ErrorF ("winCloseScreenShadowGDI () - Freeing screen resources\n"); +#endif + + /* Flag that the screen is closed */ + pScreenPriv->fClosed = TRUE; + pScreenPriv->fActive = FALSE; + + /* Call the wrapped CloseScreen procedure */ + pScreen->CloseScreen = pScreenPriv->CloseScreen; + fReturn = (*pScreen->CloseScreen) (nIndex, pScreen); + + /* Delete the window property */ + RemoveProp (pScreenPriv->hwndScreen, WIN_SCR_PROP); + + /* Free the shadow DC; which allows the bitmap to be freed */ + DeleteDC (pScreenPriv->hdcShadow); + + /* Free the shadow bitmap */ + DeleteObject (pScreenPriv->hbmpShadow); + + /* Free the screen DC */ + ReleaseDC (pScreenPriv->hwndScreen, pScreenPriv->hdcScreen); + + /* Redisplay the Windows cursor */ + if (!pScreenPriv->fCursor) + ShowCursor (TRUE); + + /* Kill our window */ + if (pScreenPriv->hwndScreen) + { + DestroyWindow (pScreenPriv->hwndScreen); + pScreenPriv->hwndScreen = NULL; + } + + /* Kill our screeninfo's pointer to the screen */ + pScreenInfo->pScreen = NULL; + + /* Invalidate the ScreenInfo's fb pointer */ + pScreenInfo->pfb = NULL; + + /* Free the screen privates for this screen */ + xfree ((pointer) pScreenPriv); + + return fReturn; +} + +Bool +winInitVisualsShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Determine our color masks */ + if (!winQueryRGBBitsAndMasks (pScreen)) + { + 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) + { + case 32: + case 24: + case 16: + case 15: + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + TrueColorMask, + pScreenPriv->dwBitsPerRGB, + TrueColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsGDI () - miSetVisualTypesAndMasks failed\n"); + return FALSE; + } + break; + + case 8: +#if CYGDEBUG + ErrorF ("winInitVisualsGDI () - Calling miSetVisualTypesAndMasks\n"); +#endif /* CYGDEBUG */ + if (!miSetVisualTypesAndMasks (pScreenInfo->dwDepth, + PseudoColorMask, + pScreenPriv->dwBitsPerRGB, + PseudoColor, + pScreenPriv->dwRedMask, + pScreenPriv->dwGreenMask, + pScreenPriv->dwBlueMask)) + { + ErrorF ("winInitVisualsGDI () - miSetVisualTypesAndMasks failed\n"); + return FALSE; + } + 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); + +#if CYGDEBUG + ErrorF ("winInitVisualsGDI () - Returning\n"); +#endif + + return TRUE; +} + +/* Adjust the video mode */ +Bool +winAdjustVideoModeShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdc; + DWORD dwDepth; + + hdc = GetDC (NULL); + + /* We're in serious trouble if we can't get a DC */ + if (hdc == NULL) + { + ErrorF ("winAdjustVideoModeShadowGDI () - GetDC () failed\n"); + return FALSE; + } + + /* Query GDI for current display depth */ + dwDepth = GetDeviceCaps (hdc, BITSPIXEL); + + /* Is GDI using a depth different than command line parameter? */ + if (dwDepth != pScreenInfo->dwDepth) + { + /* Warn user if GDI depth is different than depth specified */ + ErrorF ("winAdjustVideoModeShadowGDI () - Command line depth: %d, "\ + "using depth: %d\n", pScreenInfo->dwDepth, dwDepth); + + /* We'll use GDI's depth */ + pScreenInfo->dwDepth = dwDepth; + } + + /* Release our DC */ + ReleaseDC (NULL, hdc); + + return TRUE; +} + +/* Blt exposed regions to the screen */ +Bool +winBltExposedRegionsShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + HDC hdcUpdate; + PAINTSTRUCT ps; + + /* BeginPaint gives us an hdc that clips to the invalidated region */ + hdcUpdate = BeginPaint (pScreenPriv->hwndScreen, &ps); + + /* Our BitBlt will be clipped to the invalidated region */ + BitBlt (hdcUpdate, + 0, 0, + pScreenInfo->dwWidth, pScreenInfo->dwHeight, + pScreenPriv->hdcShadow, + 0, 0, + SRCCOPY); + + /* EndPaint frees the DC */ + EndPaint (pScreenPriv->hwndScreen, &ps); + + return TRUE; +} + +Bool +winActivateAppShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* + * Are we active? + * Are we fullscreen? + */ + if (pScreenPriv != NULL + && pScreenPriv->fActive + && pScreenInfo->fFullScreen) + { + /* + * Activating, attempt to bring our window + * to the top of the display + */ + ShowWindow (pScreenPriv->hwndScreen, SW_RESTORE); + } + + /* + * Are we inactive? + * Are we fullscreen? + */ + if (pScreenPriv != NULL + && !pScreenPriv->fActive + && pScreenInfo->fFullScreen) + { + /* + * Deactivating, stuff our window onto the + * task bar. + */ + ShowWindow (pScreenPriv->hwndScreen, SW_MINIMIZE); + } + + return TRUE; +} + +/* Set engine specific funtions */ +Bool +winSetEngineFunctionsShadowGDI (ScreenPtr pScreen) +{ + winScreenPriv(pScreen); + winScreenInfo *pScreenInfo = pScreenPriv->pScreenInfo; + + /* Set our pointers */ + pScreenPriv->pwinAllocateFB = winAllocateFBShadowGDI; + pScreenPriv->pwinShadowUpdate = winShadowUpdateGDI; + pScreenPriv->pwinShadowWindow = winShadowWindowGDI; + pScreenPriv->pwinCloseScreen = winCloseScreenShadowGDI; + pScreenPriv->pwinInitVisuals = winInitVisualsShadowGDI; + pScreenPriv->pwinAdjustVideoMode = winAdjustVideoModeShadowGDI; + if (pScreenInfo->fFullScreen) + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowFullScreen; + else + pScreenPriv->pwinCreateBoundingWindow = winCreateBoundingWindowWindowed; + pScreenPriv->pwinFinishScreenInit = winFinishScreenInitFB; + pScreenPriv->pwinBltExposedRegions = winBltExposedRegionsShadowGDI; + pScreenPriv->pwinActivateApp = winActivateAppShadowGDI; + + return TRUE; +} Index: xc/programs/Xserver/hw/xwin/winwakeup.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winwakeup.c:1.3 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winwakeup.c Tue May 1 20:45:26 2001 @@ -0,0 +1,53 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwakeup.c,v 1.3 2001/05/02 00:45:26 alanh Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 7 */ +void +winWakeupHandler (pointer pWakeupData, + int err, + pointer pReadmask) +{ + winScreenPriv((ScreenPtr)pWakeupData); + MSG msg; + + /* Process all message on our queue */ + while (PeekMessage (&msg, pScreenPriv->hwndScreen, 0, 0, PM_REMOVE)) + { + DispatchMessage (&msg); + } +} + + Index: xc/programs/Xserver/hw/xwin/winwindow.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winwindow.c:1.1 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winwindow.c Thu Apr 5 16:13:51 2001 @@ -0,0 +1,104 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwindow.c,v 1.1 2001/04/05 20:13:51 dawes Exp $ */ + +#include "win.h" + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbCreateWindow() */ +Bool +winCreateWindowNativeGDI (WindowPtr pWin) +{ + fprintf (stderr, "winCreateWindow()\n"); + return TRUE; +} + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbDestroyWindow() */ +Bool +winDestroyWindowNativeGDI (WindowPtr pWin) +{ + fprintf (stderr, "winDestroyWindow()\n"); + return TRUE; +} + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbPositionWindow() */ +Bool +winPositionWindowNativeGDI (WindowPtr pWin, int x, int y) +{ + fprintf (stderr, "winPositionWindow()\n"); + return TRUE; +} + +/* See Porting Layer Definition - p. 39 */ +/* See mfb/mfbwindow.c - mfbCopyWindow() */ +void +winCopyWindowNativeGDI (WindowPtr pWin, + DDXPointRec ptOldOrg, + RegionPtr prgnSrc) +{ + fprintf (stderr, "winCopyWindow()\n"); +} + +/* See Porting Layer Definition - p. 37 */ +/* See mfb/mfbwindow.c - mfbChangeWindowAttributes() */ +Bool +winChangeWindowAttributesNativeGDI (WindowPtr pWin, unsigned long mask) +{ + fprintf (stderr, "winChangeWindowAttributes()\n"); + return TRUE; +} + +/* See Porting Layer Definition - p. 37 + * Also referred to as UnrealizeWindow + */ +Bool +winUnmapWindowNativeGDI (WindowPtr pWindow) +{ + fprintf (stderr, "winUnmapWindow()\n"); + /* This functions is empty in the CFB, + * we probably won't need to do anything + */ + return TRUE; +} + +/* See Porting Layer Definition - p. 37 + * Also referred to as RealizeWindow + */ +Bool +winMapWindowNativeGDI (WindowPtr pWindow) +{ + fprintf (stderr, "winMapWindow()\n"); + /* This function is empty in the CFB, + * we probably won't need to do anything + */ + return TRUE; +} Index: xc/programs/Xserver/hw/xwin/winwndproc.c diff -u /dev/null xc/programs/Xserver/hw/xwin/winwndproc.c:1.4 --- /dev/null Mon Jun 4 12:42:43 2001 +++ xc/programs/Xserver/hw/xwin/winwndproc.c Tue May 8 04:14:09 2001 @@ -0,0 +1,392 @@ +/* + *Copyright (C) 1994-2000 The XFree86 Project, Inc. All Rights Reserved. + * + *Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + *"Software"), to deal in the Software without restriction, including + *without limitation the rights to use, copy, modify, merge, publish, + *distribute, sublicense, and/or sell copies of the Software, and to + *permit persons to whom the Software is furnished to do so, subject to + *the following conditions: + * + *The above copyright notice and this permission notice shall be + *included in all copies or substantial portions of the Software. + * + *THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + *EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + *MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + *NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR + *ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF + *CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION + *WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + *Except as contained in this notice, the name of the XFree86 Project + *shall not be used in advertising or otherwise to promote the sale, use + *or other dealings in this Software without prior written authorization + *from the XFree86 Project. + * + * Authors: Dakshinamurthy Karra + * Suhaib M Siddiqi + * Peter Busch + * Harold L Hunt II + */ +/* $XFree86: xc/programs/Xserver/hw/xwin/winwndproc.c,v 1.4 2001/05/08 08:14:09 alanh Exp $ */ + +#include "win.h" + +/* + * Called by winWakeupHandler + * Processes current Windows message + */ +LRESULT CALLBACK +winWindowProc (HWND hWnd, UINT message, + WPARAM wParam, LPARAM lParam) +{ + winPrivScreenPtr pScreenPriv = NULL; + winScreenInfo *pScreenInfo = NULL; + ScreenPtr pScreen = NULL; + xEvent xCurrentEvent; + LPCREATESTRUCT pcs; + HRESULT ddrval; + RECT rcClient, rcSrc; + int iScanCode; + + /* Initialize our event structure */ + ZeroMemory (&xCurrentEvent, sizeof (xCurrentEvent)); + + /* Retrieve screen privates pointers for this window */ + pScreenPriv = GetProp (hWnd, WIN_SCR_PROP); + if (pScreenPriv != NULL) + { + pScreenInfo = pScreenPriv->pScreenInfo; + pScreen = pScreenInfo->pScreen; + } + + /* Branch on message type */ + switch (message) + { + case WM_CREATE: + /* + * Add a property to our display window that references + * this screens' privates. + * + * This allows the window procedure to refer to the + * appropriate window DC and shadow DC for the window that + * it is processing. We use this to repaint exposed + * areas of our display window. + */ + pcs = (LPCREATESTRUCT) lParam; + pScreenPriv = pcs->lpCreateParams; + pScreen = pScreenPriv->pScreenInfo->pScreen; + SetProp (hWnd, + WIN_SCR_PROP, + pScreenPriv); + + /* Store the mode key states so restore doesn't try to restore them */ + winStoreModeKeyStates (pScreen); + return 0; + + case WM_PAINT: + /* Only paint if we have privates and the server is enabled */ + if (pScreenPriv == NULL + || !pScreenPriv->fEnabled + || (pScreenInfo->fFullScreen && !pScreenPriv->fActive)) + { + /* We don't want to paint */ + break; + } + + /* Call the engine dependent repainter */ + (*pScreenPriv->pwinBltExposedRegions) (pScreen); + return 0; + + case WM_MOUSEMOVE: + /* We can't do anything without privates */ + if (pScreenPriv == NULL) + break; + + /* Sometimes we hide, sometimes we show */ + if (pScreenPriv->fActive + && pScreenPriv->fCursor) + { + /* Hide Windows cursor */ + pScreenPriv->fCursor = FALSE; + ShowCursor (FALSE); + } + else if (!pScreenPriv->fActive + && !pScreenPriv->fCursor) + { + /* Show Windows cursor */ + pScreenPriv->fCursor = TRUE; + ShowCursor (TRUE); + } + + /* Deliver absolute cursor position to X Server */ + miPointerAbsoluteCursor (GET_X_LPARAM(lParam), + GET_Y_LPARAM(lParam), + g_c32LastInputEventTime = GetTickCount ()); + return 0; + + case WM_NCMOUSEMOVE: + /* Non-client mouse movement, show Windows cursor */ + if (!pScreenPriv->fCursor) + { + pScreenPriv->fCursor = TRUE; + ShowCursor (TRUE); + } + return 0; + + case WM_LBUTTONDBLCLK: + case WM_LBUTTONDOWN: + return winMouseButtonsHandle (pScreen, ButtonPress, Button1, wParam); + + case WM_LBUTTONUP: + return winMouseButtonsHandle (pScreen, ButtonRelease, Button1, wParam); + + case WM_MBUTTONDBLCLK: + case WM_MBUTTONDOWN: + return winMouseButtonsHandle (pScreen, ButtonPress, Button2, wParam); + + case WM_MBUTTONUP: + return winMouseButtonsHandle (pScreen, ButtonRelease, Button2, wParam); + + case WM_RBUTTONDBLCLK: + case WM_RBUTTONDOWN: + return winMouseButtonsHandle (pScreen, ButtonPress, Button3, wParam); + + case WM_RBUTTONUP: + return winMouseButtonsHandle (pScreen, ButtonRelease, Button3, wParam); + + case WM_TIMER: + switch (wParam) + { + case WIN_E3B_TIMER_ID: + /* Send delayed button press */ + winMouseButtonsSendEvent (ButtonPress, + pScreenPriv->iE3BCachedPress); + + /* Kill this timer */ + KillTimer (pScreenPriv->hwndScreen, WIN_E3B_TIMER_ID); + + /* Clear screen privates flags */ + pScreenPriv->iE3BCachedPress = 0; + break; + } + return 0; + + case WM_MOUSEWHEEL: + return winMouseWheel (pScreen, GET_WHEEL_DELTA_WPARAM(wParam)); + + case WM_SYSKEYDOWN: + case WM_KEYDOWN: + if (winIsFakeCtrl_L (message, wParam, lParam)) + return 0; + winTranslateKey (wParam, lParam, &iScanCode); + xCurrentEvent.u.u.type = KeyPress; + xCurrentEvent.u.u.detail = iScanCode; + xCurrentEvent.u.keyButtonPointer.time + = g_c32LastInputEventTime = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + return 0; + + case WM_SYSKEYUP: + case WM_KEYUP: + if (winIsFakeCtrl_L (message, wParam, lParam)) + return 0; + winTranslateKey (wParam, lParam, &iScanCode); + xCurrentEvent.u.u.type = KeyRelease; + xCurrentEvent.u.u.detail = iScanCode; + xCurrentEvent.u.keyButtonPointer.time + = g_c32LastInputEventTime = GetTickCount (); + mieqEnqueue (&xCurrentEvent); + return 0; + + case WM_HOTKEY: + if (pScreenPriv == NULL) + break; + + /* Handle each engine type */ + switch (pScreenInfo->dwEngine) + { + case WIN_SERVER_PRIMARY_DD: + /* Alt+Tab was pressed, we will lose focus very soon */ + pScreenPriv->fActive = FALSE; + + /* + * We need to save the primary fb to an offscreen fb when + * we get deactivated, and point the fb code at the offscreen + * fb for the duration of the deactivation. + */ + if (pScreenPriv != NULL + && pScreenPriv->pddsPrimary != NULL + && pScreenPriv->pddsPrimary != NULL) + { + /* We are deactivating */ + + /* Get client area in screen coords */ + GetClientRect (pScreenPriv->hwndScreen, &rcClient); + MapWindowPoints (pScreenPriv->hwndScreen, + HWND_DESKTOP, + (LPPOINT)&rcClient, 2); + + /* Did we loose the primary surface? */ + ddrval = IDirectDrawSurface_IsLost (pScreenPriv->pddsPrimary); + if (ddrval == DD_OK) + { + ddrval = IDirectDrawSurface_Unlock (pScreenPriv->pddsPrimary, + NULL); + if (FAILED (ddrval)) + FatalError ("winWindowProc () - Failed unlocking primary "\ + "surface\n"); + } + + /* Setup a source rectangle */ + rcSrc.left = 0; + rcSrc.top = 0; + rcSrc.right = pScreenInfo->dwWidth; + rcSrc.bottom = pScreenInfo->dwHeight; + + /* Blit the primary surface to the offscreen surface */ + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsOffscreen, + NULL, /* should be rcDest */ + pScreenPriv->pddsPrimary, + NULL, + DDBLT_WAIT, + NULL); + if (ddrval == DDERR_SURFACELOST) + { + IDirectDrawSurface_Restore (pScreenPriv->pddsOffscreen); + IDirectDrawSurface_Restore (pScreenPriv->pddsPrimary); + + /* Blit the primary surface to the offscreen surface */ + ddrval = IDirectDrawSurface_Blt (pScreenPriv->pddsOffscreen, + NULL, /* should be rcDest */ + pScreenPriv->pddsPrimary, + NULL, + DDBLT_WAIT, + NULL); + if (FAILED (ddrval)) + FatalError ("winWindowProc () - Failed blitting primary "\ + "surface to offscreen surface: %08x\n", + ddrval); + } + else + { + FatalError ("winWindowProc() - Unknown error from "\ + "Blt: %08dx\n", ddrval); + } + + /* Lock the offscreen surface */ + ddrval = IDirectDrawSurface_Lock (pScreenPriv->pddsOffscreen, + NULL, + pScreenPriv->pddsdOffscreen, + DDLOCK_WAIT, + NULL); + if (ddrval != DD_OK + || pScreenPriv->pddsdPrimary->lpSurface == NULL) + FatalError ("winWindowProc () - Could not lock "\ + "offscreen surface\n"); + + /* Notify FB of the new memory pointer */ + winUpdateFBPointer (pScreen, + pScreenPriv->pddsdOffscreen->lpSurface); + + /* Unregister our hotkey */ + UnregisterHotKey (hWnd, 1); + return 0; + } + } + break; + + case WM_ACTIVATE: + /* + * Focus is being changed to another window. + * The other window may or may not belong to + * our process. + */ + + /* We can't do anything if we don't have screen privates */ + if (pScreenPriv == NULL) + break; + + /* Clear any lingering wheel delta */ + pScreenPriv->iDeltaZ = 0; + + /* Activating or deactivating? */ + if (LOWORD (wParam) == WA_ACTIVE || LOWORD (wParam) == WA_CLICKACTIVE) + { + /* Restore the state of all mode keys */ + winRestoreModeKeyStates (pScreen); + + /* Have we changed input screens? */ + if (pScreenPriv->fEnabled + && pScreen != miPointerCurrentScreen ()) + { + /* + * Tell mi that we are changing the screen that receives + * mouse input events. + */ + miPointerSetNewScreen (pScreenInfo->dwScreen, + 0, 0); + } + } + else + { + /* Store the state of all mode keys */ + winStoreModeKeyStates (pScreen); + } + + /* Are we activating or deactivating? */ + if ((LOWORD(wParam) == WA_ACTIVE + || LOWORD(wParam) == WA_CLICKACTIVE) + && pScreenPriv->fCursor) + { + /* Hide Windows cursor */ + pScreenPriv->fCursor = FALSE; + ShowCursor (FALSE); + } + else if (LOWORD(wParam) == WA_INACTIVE + && !pScreenPriv->fCursor) + { + /* Show Windows cursor */ + pScreenPriv->fCursor = TRUE; + ShowCursor (TRUE); + } + return 0; + + case WM_ACTIVATEAPP: + /* We can't do anything if we don't have screen privates */ + if (pScreenPriv == NULL) + break; + + /* Activate or deactivate */ + pScreenPriv->fActive = wParam; + + /* Are we activating or deactivating? */ + if (pScreenPriv->fActive + && pScreenPriv->fCursor) + { + /* Hide Windows cursor */ + pScreenPriv->fCursor = FALSE; + ShowCursor (FALSE); + } + else if (!pScreenPriv->fActive + && !pScreenPriv->fCursor) + { + /* Show Windows cursor */ + pScreenPriv->fCursor = TRUE; + ShowCursor (TRUE); + } + + /* Call engine specific screen activation/deactivation function */ + (*pScreenPriv->pwinActivateApp) (pScreen); + return 0; + + case WM_CLOSE: + /* Tell X that we are giving up */ + GiveUp (0); + return 0; + } + + return DefWindowProc (hWnd, message, wParam, lParam); +} Index: xc/programs/Xserver/hw/xwin/xf_dx.h diff -u xc/programs/Xserver/hw/xwin/xf_dx.h:1.1 xc/programs/Xserver/hw/xwin/xf_dx.h:removed --- xc/programs/Xserver/hw/xwin/xf_dx.h:1.1 Thu Aug 10 13:40:38 2000 +++ xc/programs/Xserver/hw/xwin/xf_dx.h Mon Jun 4 12:42:43 2001 @@ -1,106 +0,0 @@ -/* - * (c) Copyright 2000 by Peter Busch - * <pbusch@dfki.de> - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PETER BUSCH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Peter Busch shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Peter Busch. - * -*/ -/* $XFree86: xc/programs/Xserver/hw/xwin/xf_dx.h,v 1.1 2000/08/10 17:40:38 dawes Exp $ */ - -#ifndef __XF_DX_H__ -#define __XF_DX_H__ - -#ifdef __cplusplus -extern "C" { -#endif - - -typedef BOOL (__cdecl *_DIInitKeyboard)(); - -typedef BOOL (__cdecl *_DIInitMouse)(); - -typedef void (__cdecl *_DITermKeyboard)(); - -typedef void (__cdecl *_DITermMouse)(); - -typedef BOOL (__cdecl *_DXStoreColors)( int i, int r, int g, int b ); - -typedef void (__cdecl *_ListModes)(); - -typedef char*( __cdecl *_AllocateFramebuffer) - ( - int* width, - int* height, - int* depth, - int* pitch - ); - -typedef void (__cdecl *_winfbBlockHandler)(); - -typedef int (__cdecl *_winfbWakeupHandler)(); - -typedef void (__cdecl *_SwitchFramebuffer)( void * ptr ); - -typedef void (__cdecl *_GenerateInputEvent)( - unsigned long type, - int ix, - int iy, - int button - ); - -typedef void (__cdecl *_set_fn)( - _SwitchFramebuffer switch_fb, - _GenerateInputEvent gen_inp - ); - - -/* -* interface of the xf_dx_library -*/ - -typedef struct _xf_dx_rec -{ - _DIInitKeyboard xf_dx_init_keybd; - _DIInitMouse xf_dx_init_mouse; - _DITermKeyboard xf_dx_term_keybd; - _DITermMouse xf_dx_term_mouse; - _DXStoreColors xf_dx_store_colors; - _ListModes xf_dx_list_modes; - _AllocateFramebuffer xf_dx_alloc_fb; - _winfbBlockHandler xf_dx_block_proc; - _winfbWakeupHandler xf_dx_wakeup_proc; - _SwitchFramebuffer xf_dx_switch_buffer; - _GenerateInputEvent xf_dx_gen_input; - _set_fn xf_dx_set_fn; -} xf_dx_rec, *xf_dx_ptr; - -int __cdecl xf_dx_init( xf_dx_ptr *dx_ptr ); - - -#ifdef __cplusplus -} /* extern "C" { */ -#endif - - -#endif /* __XF_DX_H__ */ Index: xc/programs/Xserver/hw/xwin/xf_dx_xwin.h diff -u xc/programs/Xserver/hw/xwin/xf_dx_xwin.h:1.1 xc/programs/Xserver/hw/xwin/xf_dx_xwin.h:removed --- xc/programs/Xserver/hw/xwin/xf_dx_xwin.h:1.1 Thu Aug 10 13:40:38 2000 +++ xc/programs/Xserver/hw/xwin/xf_dx_xwin.h Mon Jun 4 12:42:43 2001 @@ -1,40 +0,0 @@ -/* - * (c) Copyright 2000 by Peter Busch - * <pbusch@dfki.de> - * - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * PETER BUSCH BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF - * OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - * SOFTWARE. - * - * Except as contained in this notice, the name of Peter Busch shall not be - * used in advertising or otherwise to promote the sale, use or other dealings - * in this Software without prior written authorization from Peter Busch. - * -*/ -/* $XFree86: xc/programs/Xserver/hw/xwin/xf_dx_xwin.h,v 1.1 2000/08/10 17:40:38 dawes Exp $ */ - -#ifndef __XF_DX_CALLBACK_H__ -#define __XF_DX_CALLBACK_H__ - - -typedef void (__cdecl *__SwitchFramebuffer)( void * ptr ); -typedef void (__cdecl *__GenerateInputEvent)( type, ix, iy, button ); - - - -#endif Index: xc/programs/Xserver/include/Imakefile diff -u xc/programs/Xserver/include/Imakefile:3.20 xc/programs/Xserver/include/Imakefile:3.21 --- xc/programs/Xserver/include/Imakefile:3.20 Tue Oct 24 14:07:52 2000 +++ xc/programs/Xserver/include/Imakefile Wed Jan 17 17:36:56 2001 @@ -1,5 +1,9 @@ -XCOMM $XConsortium: Imakefile,v 1.2 95/01/13 20:28:14 kaleb Exp $ -XCOMM $XFree86: xc/programs/Xserver/include/Imakefile,v 3.20 2000/10/24 18:07:52 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/Xserver/include/Imakefile,v 3.21 2001/01/17 22:36:56 dawes Exp $ #if defined(XFree86Version) || defined(BSDOSArchitecture) #if DoLoadableServer Index: xc/programs/Xserver/include/bstore.h diff -u xc/programs/Xserver/include/bstore.h:1.1 xc/programs/Xserver/include/bstore.h:1.2 --- xc/programs/Xserver/include/bstore.h:1.1 Sun Apr 5 12:44:25 1998 +++ xc/programs/Xserver/include/bstore.h Sat Jan 6 15:58:12 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/bstore.h,v 1.1 1998/04/05 16:44:25 robin Exp $*/ +/* $XFree86: xc/programs/Xserver/include/bstore.h,v 1.2 2001/01/06 20:58:12 tsi Exp $*/ /* * Copyright (c) 1987 by the Regents of the University of California * @@ -12,7 +12,7 @@ /* * Moved here from mi to allow wrapping of lower level backing store functions. - * -- 1997.10.27 Marc Aurele La France (tsi@ualberta.ca) + * -- 1997.10.27 Marc Aurele La France (tsi@xfree86.org) */ #ifndef _BSTORE_H_ Index: xc/programs/Xserver/include/bstorestr.h diff -u xc/programs/Xserver/include/bstorestr.h:1.1 xc/programs/Xserver/include/bstorestr.h:1.2 --- xc/programs/Xserver/include/bstorestr.h:1.1 Sun Apr 5 12:44:25 1998 +++ xc/programs/Xserver/include/bstorestr.h Sat Jan 6 15:58:12 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/bstorestr.h,v 1.1 1998/04/05 16:44:25 robin Exp $*/ +/* $XFree86: xc/programs/Xserver/include/bstorestr.h,v 1.2 2001/01/06 20:58:12 tsi Exp $*/ /* * Copyright (c) 1987 by the Regents of the University of California * @@ -12,7 +12,7 @@ /* * Moved here from mi to allow wrapping of lower level backing store functions. - * -- 1997.10.27 Marc Aurele La France (tsi@ualberta.ca) + * -- 1997.10.27 Marc Aurele La France (tsi@xfree86.org) */ #ifndef _BSTORESTR_H_ Index: xc/programs/Xserver/include/closestr.h diff -u xc/programs/Xserver/include/closestr.h:3.2 xc/programs/Xserver/include/closestr.h:3.3 --- xc/programs/Xserver/include/closestr.h:3.2 Sun Oct 4 05:38:54 1998 +++ xc/programs/Xserver/include/closestr.h Wed Jan 17 17:36:56 2001 @@ -1,4 +1,4 @@ -/* $TOG: closestr.h /main/12 1998/03/26 17:26:54 kaleb $ */ +/* $Xorg: closestr.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /* Copyright 1991, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/include/closestr.h,v 3.2 1998/10/04 09:38:54 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/closestr.h,v 3.3 2001/01/17 22:36:56 dawes Exp $ */ #ifndef CLOSESTR_H Index: xc/programs/Xserver/include/closure.h diff -u xc/programs/Xserver/include/closure.h:1.1.1.2 xc/programs/Xserver/include/closure.h:1.1.1.3 --- xc/programs/Xserver/include/closure.h:1.1.1.2 Sun Sep 27 04:02:44 1998 +++ xc/programs/Xserver/include/closure.h Tue Jan 16 17:43:56 2001 @@ -1,4 +1,4 @@ -/* $TOG: closure.h /main/4 1998/02/09 14:27:54 kaleb $ */ +/* $Xorg: closure.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group Index: xc/programs/Xserver/include/colormap.h diff -u xc/programs/Xserver/include/colormap.h:1.3 xc/programs/Xserver/include/colormap.h:1.4 --- xc/programs/Xserver/include/colormap.h:1.3 Sun Oct 4 05:38:55 1998 +++ xc/programs/Xserver/include/colormap.h Wed Jan 17 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: colormap.h /main/15 1998/02/09 14:28:04 kaleb $ */ +/* $XFree86: xc/programs/Xserver/include/colormap.h,v 1.4 2001/01/17 22:36:57 dawes Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -41,7 +41,8 @@ SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/include/colormap.h,v 1.3 1998/10/04 09:38:55 dawes Exp $ */ +/* $Xorg: colormap.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ + #ifndef CMAP_H #define CMAP_H 1 Index: xc/programs/Xserver/include/colormapst.h diff -u xc/programs/Xserver/include/colormapst.h:1.1.1.3 xc/programs/Xserver/include/colormapst.h:1.1.1.4 --- xc/programs/Xserver/include/colormapst.h:1.1.1.3 Sun Sep 27 04:02:45 1998 +++ xc/programs/Xserver/include/colormapst.h Tue Jan 16 17:43:56 2001 @@ -40,7 +40,7 @@ SOFTWARE. */ -/* $TOG: colormapst.h /main/5 1998/02/09 14:27:59 kaleb $ */ +/* $Xorg: colormapst.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ #ifndef CMAPSTRUCT_H #define CMAPSTRUCT_H 1 Index: xc/programs/Xserver/include/cursor.h diff -u xc/programs/Xserver/include/cursor.h:1.1.1.2 xc/programs/Xserver/include/cursor.h:1.2 --- xc/programs/Xserver/include/cursor.h:1.1.1.2 Sun Sep 27 04:02:46 1998 +++ xc/programs/Xserver/include/cursor.h Fri Feb 2 16:39:02 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: cursor.h /main/8 1998/02/09 14:28:12 kaleb $ */ +/* $Xorg: cursor.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ #ifndef CURSOR_H #define CURSOR_H @@ -62,6 +62,11 @@ #endif ); +/* Quartz support on Mac OS X pulls in the QuickDraw + framework whose AllocCursor function conflicts here. */ +#ifdef __DARWIN__ +#define AllocCursor Darwin_X_AllocCursor +#endif extern CursorPtr AllocCursor( #if NeedFunctionPrototypes unsigned char* /*psrcbits*/, Index: xc/programs/Xserver/include/cursorstr.h diff -u xc/programs/Xserver/include/cursorstr.h:1.4 xc/programs/Xserver/include/cursorstr.h:1.5 --- xc/programs/Xserver/include/cursorstr.h:1.4 Sun Oct 4 05:38:55 1998 +++ xc/programs/Xserver/include/cursorstr.h Wed Jan 17 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: cursorstr.h /main/9 1998/02/09 14:28:08 kaleb $ */ +/* $Xorg: cursorstr.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/cursorstr.h,v 1.4 1998/10/04 09:38:55 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/cursorstr.h,v 1.5 2001/01/17 22:36:57 dawes Exp $ */ #ifndef CURSORSTRUCT_H #define CURSORSTRUCT_H Index: xc/programs/Xserver/include/dix.h diff -u xc/programs/Xserver/include/dix.h:3.14 xc/programs/Xserver/include/dix.h:3.16 --- xc/programs/Xserver/include/dix.h:3.14 Thu Aug 31 15:03:59 2000 +++ xc/programs/Xserver/include/dix.h Fri Feb 16 08:24:09 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/dix.h,v 3.14 2000/08/31 19:03:59 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/include/dix.h,v 3.16 2001/02/16 13:24:09 eich Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: dix.h /main/45 1998/02/09 14:28:31 kaleb $ */ +/* $Xorg: dix.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ #ifndef DIX_H #define DIX_H @@ -890,6 +890,8 @@ void #endif ); + +extern void CloseDownEvents(void); extern void DeleteWindowFromAnyEvents( #if NeedFunctionPrototypes Index: xc/programs/Xserver/include/dixfont.h diff -u xc/programs/Xserver/include/dixfont.h:3.5 xc/programs/Xserver/include/dixfont.h:3.8 --- xc/programs/Xserver/include/dixfont.h:3.5 Sat Aug 21 09:48:44 1999 +++ xc/programs/Xserver/include/dixfont.h Thu Apr 5 13:42:35 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: dixfont.h /main/21 1996/09/28 17:14:16 rws $ */ +/* $Xorg: dixfont.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/dixfont.h,v 3.5 1999/08/21 13:48:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/dixfont.h,v 3.8 2001/04/05 17:42:35 dawes Exp $ */ #ifndef DIXFONT_H #define DIXFONT_H 1 @@ -118,22 +118,17 @@ extern void DeleteClientFontStuff(ClientPtr /*client*/); +/* Quartz support on Mac OS X pulls in the QuickDraw + framework whose InitFonts function conflicts here. */ +#ifdef __DARWIN__ +#define InitFonts Darwin_X_InitFonts +#endif extern void InitFonts(void); -extern int GetDefaultPointSize(void); - extern void FreeFonts(void); extern FontPtr find_old_font(XID /*id*/); -extern Font GetNewFontClientID(void); - -extern int StoreFontClientFont(FontPtr /*pfont*/, - Font /*id*/); - -extern void DeleteFontClientID(Font /*id*/); - - extern void GetGlyphs(FontPtr /*font*/, unsigned long /*count*/, unsigned char * /*chars*/, @@ -156,8 +151,5 @@ extern void InitGlyphCaching(void); extern void SetGlyphCachingMode(int /*newmode*/); - -extern void -ResetFontPrivateIndex(void); #endif /* DIXFONT_H */ Index: xc/programs/Xserver/include/dixfontstr.h diff -u xc/programs/Xserver/include/dixfontstr.h:1.1.1.1 xc/programs/Xserver/include/dixfontstr.h:1.1.1.2 --- xc/programs/Xserver/include/dixfontstr.h:1.1.1.1 Wed Apr 27 03:13:26 1994 +++ xc/programs/Xserver/include/dixfontstr.h Tue Jan 16 17:43:59 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: dixfontstr.h,v 1.15 94/04/17 20:25:39 dpw Exp $ */ +/* $Xorg: dixfontstr.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. Index: xc/programs/Xserver/include/dixstruct.h diff -u xc/programs/Xserver/include/dixstruct.h:3.11 xc/programs/Xserver/include/dixstruct.h:3.12 --- xc/programs/Xserver/include/dixstruct.h:3.11 Fri May 5 13:53:52 2000 +++ xc/programs/Xserver/include/dixstruct.h Wed Jan 17 17:36:57 2001 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/include/dixstruct.h,v 3.12 2001/01/17 22:36:57 dawes Exp $ */ /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -20,8 +21,7 @@ SOFTWARE. ******************************************************************/ -/* $XConsortium: dixstruct.h /main/43 1996/12/15 21:25:06 rws $ */ -/* $XFree86: xc/programs/Xserver/include/dixstruct.h,v 3.11 2000/05/05 17:53:52 keithp Exp $ */ +/* $Xorg: dixstruct.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ #ifndef DIXSTRUCT_H #define DIXSTRUCT_H Index: xc/programs/Xserver/include/extension.h diff -u xc/programs/Xserver/include/extension.h:1.3 xc/programs/Xserver/include/extension.h:1.4 --- xc/programs/Xserver/include/extension.h:1.3 Sun Apr 11 11:28:09 1999 +++ xc/programs/Xserver/include/extension.h Wed Jan 17 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: extension.h /main/10 1998/02/09 14:28:37 kaleb $ */ +/* $Xorg: extension.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/extension.h,v 1.3 1999/04/11 15:28:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/extension.h,v 1.4 2001/01/17 22:36:57 dawes Exp $ */ #ifndef EXTENSION_H #define EXTENSION_H Index: xc/programs/Xserver/include/extnsionst.h diff -u xc/programs/Xserver/include/extnsionst.h:3.4 xc/programs/Xserver/include/extnsionst.h:3.5 --- xc/programs/Xserver/include/extnsionst.h:3.4 Sat Jan 29 12:17:06 2000 +++ xc/programs/Xserver/include/extnsionst.h Wed Jan 17 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: extnsionst.h /main/16 1998/02/09 14:28:41 kaleb $ */ +/* $Xorg: extnsionst.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/extnsionst.h,v 3.4 2000/01/29 17:17:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/extnsionst.h,v 3.5 2001/01/17 22:36:57 dawes Exp $ */ #ifndef EXTENSIONSTRUCT_H #define EXTENSIONSTRUCT_H Index: xc/programs/Xserver/include/gc.h diff -u xc/programs/Xserver/include/gc.h:1.3 xc/programs/Xserver/include/gc.h:1.4 --- xc/programs/Xserver/include/gc.h:1.3 Sun Aug 22 04:59:01 1999 +++ xc/programs/Xserver/include/gc.h Wed Jan 17 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/gc.h,v 1.3 1999/08/22 08:59:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/gc.h,v 1.4 2001/01/17 22:36:57 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: gc.h /main/17 1998/02/09 14:28:50 kaleb $ */ +/* $Xorg: gc.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ #ifndef GC_H #define GC_H Index: xc/programs/Xserver/include/gcstruct.h diff -u xc/programs/Xserver/include/gcstruct.h:1.3 xc/programs/Xserver/include/gcstruct.h:1.5 --- xc/programs/Xserver/include/gcstruct.h:1.3 Sun Oct 4 05:38:57 1998 +++ xc/programs/Xserver/include/gcstruct.h Wed Jan 17 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: gcstruct.h /main/19 1998/02/09 14:28:45 kaleb $ */ +/* $Xorg: gcstruct.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -43,7 +43,7 @@ ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/gcstruct.h,v 1.3 1998/10/04 09:38:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/gcstruct.h,v 1.5 2001/01/17 22:36:57 dawes Exp $ */ #ifndef GCSTRUCT_H #define GCSTRUCT_H @@ -395,7 +395,7 @@ /* * The following were moved here from private storage to allow device- * independent access to them from screen wrappers. - * --- 1997.11.03 Marc Aurele La France (tsi@ualberta.ca) + * --- 1997.11.03 Marc Aurele La France (tsi@xfree86.org) */ PixmapPtr pRotatedPixmap; /* tile/stipple rotated for alignment */ RegionPtr pCompositeClip; Index: xc/programs/Xserver/include/input.h diff -u xc/programs/Xserver/include/input.h:3.5 xc/programs/Xserver/include/input.h:3.6 --- xc/programs/Xserver/include/input.h:3.5 Sun Oct 4 05:38:57 1998 +++ xc/programs/Xserver/include/input.h Wed Jan 17 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: input.h /main/23 1998/02/09 14:28:58 kaleb $ */ +/* $Xorg: input.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /************************************************************ Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/include/input.h,v 3.5 1998/10/04 09:38:57 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/input.h,v 3.6 2001/01/17 22:36:57 dawes Exp $ */ #ifndef INPUT_H #define INPUT_H Index: xc/programs/Xserver/include/inputstr.h diff -u xc/programs/Xserver/include/inputstr.h:1.3 xc/programs/Xserver/include/inputstr.h:1.4 --- xc/programs/Xserver/include/inputstr.h:1.3 Sun Dec 20 17:18:58 1998 +++ xc/programs/Xserver/include/inputstr.h Wed Jan 17 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/inputstr.h,v 1.3 1998/12/20 22:18:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/inputstr.h,v 1.4 2001/01/17 22:36:57 dawes Exp $ */ /************************************************************ Copyright 1987, 1998 The Open Group @@ -42,7 +42,7 @@ ********************************************************/ -/* $TOG: inputstr.h /main/29 1998/02/09 14:28:54 kaleb $ */ +/* $Xorg: inputstr.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ #ifndef INPUTSTRUCT_H #define INPUTSTRUCT_H Index: xc/programs/Xserver/include/misc.h diff -u xc/programs/Xserver/include/misc.h:3.24 xc/programs/Xserver/include/misc.h:3.26 --- xc/programs/Xserver/include/misc.h:3.24 Wed Aug 23 18:10:15 2000 +++ xc/programs/Xserver/include/misc.h Sun May 6 02:28:46 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/misc.h,v 3.24 2000/08/23 22:10:15 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/include/misc.h,v 3.26 2001/05/06 06:28:46 alanh Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -62,7 +62,7 @@ OF THIS SOFTWARE. ******************************************************************/ -/* $TOG: misc.h /main/29 1998/02/09 14:29:08 kaleb $ */ +/* $Xorg: misc.h,v 1.4 2000/08/17 19:53:29 cpqbld Exp $ */ #ifndef MISC_H #define MISC_H 1 /* @@ -181,11 +181,6 @@ * Some implementations #define these through <math.h>, so preclude * #include'ing it later. */ - -#ifdef __CYGWIN__ -/* needed to avoid INFINITY redeclarations from CYGWIN math.h */ -#define __STRICT_ANSI__ -#endif #include <math.h> #endif Index: xc/programs/Xserver/include/miscstruct.h diff -u xc/programs/Xserver/include/miscstruct.h:3.1 xc/programs/Xserver/include/miscstruct.h:3.2 --- xc/programs/Xserver/include/miscstruct.h:3.1 Sun Oct 4 05:38:58 1998 +++ xc/programs/Xserver/include/miscstruct.h Wed Jan 17 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: miscstruct.h /main/11 1998/02/09 14:29:04 kaleb $ */ +/* $Xorg: miscstruct.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/miscstruct.h,v 3.1 1998/10/04 09:38:58 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/miscstruct.h,v 3.2 2001/01/17 22:36:57 dawes Exp $ */ #ifndef MISCSTRUCT_H #define MISCSTRUCT_H 1 Index: xc/programs/Xserver/include/opaque.h diff -u xc/programs/Xserver/include/opaque.h:1.7 xc/programs/Xserver/include/opaque.h:1.9 --- xc/programs/Xserver/include/opaque.h:1.7 Sat Mar 20 03:59:33 1999 +++ xc/programs/Xserver/include/opaque.h Fri May 4 15:05:52 2001 @@ -1,4 +1,4 @@ -/* $TOG: opaque.h /main/20 1998/02/09 14:29:12 kaleb $ */ +/* $Xorg: opaque.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/include/opaque.h,v 1.7 1999/03/20 08:59:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/opaque.h,v 1.9 2001/05/04 19:05:52 dawes Exp $ */ #ifndef OPAQUE_H #define OPAQUE_H @@ -70,9 +70,6 @@ #endif extern Bool permitOldBugs; extern Bool defeatAccessControl; -#ifdef SERVER_LOCK -static Bool nolock = FALSE; -#endif extern char* protNoListen; Index: xc/programs/Xserver/include/os.h diff -u xc/programs/Xserver/include/os.h:3.36 xc/programs/Xserver/include/os.h:3.37 --- xc/programs/Xserver/include/os.h:3.36 Thu Nov 30 18:30:06 2000 +++ xc/programs/Xserver/include/os.h Wed Jan 17 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/os.h,v 3.36 2000/11/30 23:30:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/os.h,v 3.37 2001/01/17 22:36:57 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -42,7 +42,7 @@ ******************************************************************/ -/* $TOG: os.h /main/62 1998/02/09 14:29:17 kaleb $ */ +/* $Xorg: os.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ #ifndef OS_H #define OS_H Index: xc/programs/Xserver/include/pixmap.h diff -u xc/programs/Xserver/include/pixmap.h:1.1.1.2 xc/programs/Xserver/include/pixmap.h:1.1.1.3 --- xc/programs/Xserver/include/pixmap.h:1.1.1.2 Sun Sep 27 04:03:01 1998 +++ xc/programs/Xserver/include/pixmap.h Tue Jan 16 17:44:03 2001 @@ -1,4 +1,4 @@ -/* $TOG: pixmap.h /main/12 1998/02/09 14:29:25 kaleb $ */ +/* $Xorg: pixmap.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group Index: xc/programs/Xserver/include/pixmapstr.h diff -u xc/programs/Xserver/include/pixmapstr.h:1.1.1.2 xc/programs/Xserver/include/pixmapstr.h:1.1.1.3 --- xc/programs/Xserver/include/pixmapstr.h:1.1.1.2 Sun Sep 27 04:03:02 1998 +++ xc/programs/Xserver/include/pixmapstr.h Tue Jan 16 17:44:03 2001 @@ -1,4 +1,4 @@ -/* $TOG: pixmapstr.h /main/11 1998/02/09 14:29:22 kaleb $ */ +/* $Xorg: pixmapstr.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group Index: xc/programs/Xserver/include/property.h diff -u xc/programs/Xserver/include/property.h:1.1.1.2 xc/programs/Xserver/include/property.h:1.1.1.3 --- xc/programs/Xserver/include/property.h:1.1.1.2 Sun Sep 27 04:03:02 1998 +++ xc/programs/Xserver/include/property.h Tue Jan 16 17:44:03 2001 @@ -1,4 +1,4 @@ -/* $TOG: property.h /main/6 1998/02/09 14:29:34 kaleb $ */ +/* $Xorg: property.h,v 1.3 2000/08/17 19:53:29 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group Index: xc/programs/Xserver/include/propertyst.h diff -u xc/programs/Xserver/include/propertyst.h:3.1 xc/programs/Xserver/include/propertyst.h:3.2 --- xc/programs/Xserver/include/propertyst.h:3.1 Sun Oct 4 05:39:00 1998 +++ xc/programs/Xserver/include/propertyst.h Wed Jan 17 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: propertyst.h /main/6 1998/02/09 14:29:30 kaleb $ */ +/* $Xorg: propertyst.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/propertyst.h,v 3.1 1998/10/04 09:39:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/propertyst.h,v 3.2 2001/01/17 22:36:57 dawes Exp $ */ #ifndef PROPERTYSTRUCT_H #define PROPERTYSTRUCT_H Index: xc/programs/Xserver/include/region.h diff -u xc/programs/Xserver/include/region.h:1.1.1.2 xc/programs/Xserver/include/region.h:1.1.1.3 --- xc/programs/Xserver/include/region.h:1.1.1.2 Sun Sep 27 04:03:03 1998 +++ xc/programs/Xserver/include/region.h Tue Jan 16 17:44:04 2001 @@ -1,4 +1,4 @@ -/* $TOG: region.h /main/6 1998/02/09 14:29:42 kaleb $ */ +/* $Xorg: region.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group Index: xc/programs/Xserver/include/regionstr.h diff -u xc/programs/Xserver/include/regionstr.h:1.3 xc/programs/Xserver/include/regionstr.h:1.5 --- xc/programs/Xserver/include/regionstr.h:1.3 Thu Oct 14 00:43:15 1999 +++ xc/programs/Xserver/include/regionstr.h Thu Mar 29 21:15:23 2001 @@ -1,4 +1,4 @@ -/* $TOG: regionstr.h /main/9 1998/02/09 14:29:38 kaleb $ */ +/* $Xorg: regionstr.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/regionstr.h,v 1.3 1999/10/14 04:43:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/regionstr.h,v 1.5 2001/03/30 02:15:23 keithp Exp $ */ #ifndef REGIONSTRUCT_H #define REGIONSTRUCT_H @@ -391,6 +391,12 @@ #if NeedFunctionPrototypes RegionPtr /*pReg*/, BoxPtr /*pBox*/ +#endif +); + +extern Bool miRegionBreak( +#if NeedFunctionPrototypes + RegionPtr /*pReg*/ #endif ); Index: xc/programs/Xserver/include/resource.h diff -u xc/programs/Xserver/include/resource.h:1.5 xc/programs/Xserver/include/resource.h:1.9 --- xc/programs/Xserver/include/resource.h:1.5 Thu Aug 10 13:40:39 2000 +++ xc/programs/Xserver/include/resource.h Fri Feb 2 16:39:02 2001 @@ -1,6 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/resource.h,v 1.5 2000/08/10 17:40:39 dawes Exp $ */ - -/* $TOG: resource.h /main/24 1998/02/09 14:29:47 kaleb $ */ +/* $Xorg: resource.h,v 1.4 2000/08/17 19:53:30 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1989, 1998 The Open Group @@ -43,6 +41,8 @@ SOFTWARE. ******************************************************************/ +/* $XFree86: xc/programs/Xserver/include/resource.h,v 1.9 2001/02/02 21:39:02 herrb Exp $ */ + #ifndef RESOURCE_H #define RESOURCE_H 1 #include "misc.h" @@ -107,7 +107,7 @@ #define CLIENT_BITS(id) ((id) & RESOURCE_CLIENT_MASK) /* extract the client id from an XID */ #define CLIENT_ID(id) ((int)(CLIENT_BITS(id) >> CLIENTOFFSET)) -#define SERVER_BIT 0x20000000 /* use illegal bit */ +#define SERVER_BIT (Mask)0x40000000 /* use illegal bit */ #ifdef INVALID #undef INVALID /* needed on HP/UX */ @@ -165,6 +165,11 @@ #endif ); +/* Quartz support on Mac OS X uses the CarbonCore + framework whose AddResource function conflicts here. */ +#ifdef __DARWIN__ +#define AddResource Darwin_X_AddResource +#endif extern Bool AddResource( #if NeedFunctionPrototypes XID /*id*/, Index: xc/programs/Xserver/include/rgb.h diff -u xc/programs/Xserver/include/rgb.h:1.1.1.2 xc/programs/Xserver/include/rgb.h:1.1.1.3 --- xc/programs/Xserver/include/rgb.h:1.1.1.2 Sun Sep 27 04:03:05 1998 +++ xc/programs/Xserver/include/rgb.h Tue Jan 16 17:44:06 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: rgb.h /main/5 1998/02/09 14:29:51 kaleb $ */ +/* $Xorg: rgb.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ #ifndef RGB_H #define RGB_H Index: xc/programs/Xserver/include/screenint.h diff -u xc/programs/Xserver/include/screenint.h:1.3 xc/programs/Xserver/include/screenint.h:1.4 --- xc/programs/Xserver/include/screenint.h:1.3 Sun Oct 4 05:39:00 1998 +++ xc/programs/Xserver/include/screenint.h Wed Jan 17 17:36:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: screenint.h /main/7 1998/02/09 14:29:55 kaleb $ */ +/* $Xorg: screenint.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/screenint.h,v 1.3 1998/10/04 09:39:00 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/screenint.h,v 1.4 2001/01/17 22:36:57 dawes Exp $ */ #ifndef SCREENINT_H #define SCREENINT_H Index: xc/programs/Xserver/include/scrnintstr.h diff -u xc/programs/Xserver/include/scrnintstr.h:1.8 xc/programs/Xserver/include/scrnintstr.h:1.9 --- xc/programs/Xserver/include/scrnintstr.h:1.8 Thu Apr 27 12:26:49 2000 +++ xc/programs/Xserver/include/scrnintstr.h Wed Jan 17 17:36:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: scrnintstr.h /main/33 1998/02/09 14:29:59 kaleb $ */ +/* $Xorg: scrnintstr.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/scrnintstr.h,v 1.8 2000/04/27 16:26:49 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/include/scrnintstr.h,v 1.9 2001/01/17 22:36:58 dawes Exp $ */ #ifndef SCREENINTSTRUCT_H #define SCREENINTSTRUCT_H Index: xc/programs/Xserver/include/selection.h diff -u xc/programs/Xserver/include/selection.h:1.1.1.2 xc/programs/Xserver/include/selection.h:1.1.1.3 --- xc/programs/Xserver/include/selection.h:1.1.1.2 Sun Sep 27 04:03:06 1998 +++ xc/programs/Xserver/include/selection.h Tue Jan 16 17:44:07 2001 @@ -1,4 +1,4 @@ -/* $TOG: selection.h /main/4 1998/02/09 14:30:04 kaleb $ */ +/* $Xorg: selection.h,v 1.3 2000/08/17 19:53:30 cpqbld Exp $ */ #ifndef SELECTION_H #define SELECTION_H 1 Index: xc/programs/Xserver/include/servermd.h diff -u xc/programs/Xserver/include/servermd.h:3.42 xc/programs/Xserver/include/servermd.h:3.44 --- xc/programs/Xserver/include/servermd.h:3.42 Mon Nov 6 14:24:09 2000 +++ xc/programs/Xserver/include/servermd.h Thu Apr 12 16:10:00 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/servermd.h,v 3.42 2000/11/06 19:24:09 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 @@ -41,11 +41,11 @@ SOFTWARE. ******************************************************************/ +/* $Xorg: servermd.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ + #ifndef SERVERMD_H #define SERVERMD_H 1 -/* $TOG: servermd.h /main/60 1998/02/09 14:30:08 kaleb $ */ - /* * Machine dependent values: * GLYPHPADBYTES should be chosen with consideration for the space-time @@ -148,21 +148,6 @@ #define AVOID_MEMORY_READ #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__) Index: xc/programs/Xserver/include/site.h diff -u xc/programs/Xserver/include/site.h:1.5 xc/programs/Xserver/include/site.h:1.6 --- xc/programs/Xserver/include/site.h:1.5 Thu May 18 12:30:02 2000 +++ xc/programs/Xserver/include/site.h Wed Jan 17 17:36:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: site.h /main/29 1998/02/09 14:30:13 kaleb $ */ +/* $Xorg: site.h,v 1.4 2000/08/17 19:53:31 cpqbld Exp $ */ /************************************************************ Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/include/site.h,v 1.5 2000/05/18 16:30:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/site.h,v 1.6 2001/01/17 22:36:58 dawes Exp $ */ #ifndef SITE_H #define SITE_H @@ -50,7 +50,7 @@ * server executable. */ #ifndef VENDOR_STRING -#define VENDOR_STRING "The Open Group" +#define VENDOR_STRING "The X.Org Group" #endif /* @@ -59,7 +59,7 @@ * by the vendor. */ #ifndef VENDOR_RELEASE -#define VENDOR_RELEASE 6400 +#define VENDOR_RELEASE 6510 #endif /* Index: xc/programs/Xserver/include/swapreq.h diff -u xc/programs/Xserver/include/swapreq.h:1.1 xc/programs/Xserver/include/swapreq.h:1.2 --- xc/programs/Xserver/include/swapreq.h:1.1 Tue Oct 6 02:59:38 1998 +++ xc/programs/Xserver/include/swapreq.h Thu Apr 5 13:42:35 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/include/swapreq.h,v 1.1 1998/10/06 06:59:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/swapreq.h,v 1.2 2001/04/05 17:42:35 dawes Exp $ */ /************************************************************ Copyright 1996 by Thomas E. Dickey <dickey@clark.net> @@ -27,6 +27,8 @@ #ifndef SWAPREQ_H #define SWAPREQ_H 1 +/* The first two are in misc.h */ +#if 0 void SwapLongs ( #if NeedFunctionPrototypes @@ -42,6 +44,7 @@ unsigned long /* count */ #endif ); +#endif void SwapColorItem( Index: xc/programs/Xserver/include/validate.h diff -u xc/programs/Xserver/include/validate.h:1.3 xc/programs/Xserver/include/validate.h:1.4 --- xc/programs/Xserver/include/validate.h:1.3 Thu Oct 14 00:43:15 1999 +++ xc/programs/Xserver/include/validate.h Wed Jan 17 17:36:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: validate.h /main/6 1998/02/09 14:30:17 kaleb $ */ +/* $Xorg: validate.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* @@ -20,7 +20,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/include/validate.h,v 1.3 1999/10/14 04:43:15 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/validate.h,v 1.4 2001/01/17 22:36:58 dawes Exp $ */ #ifndef VALIDATE_H #define VALIDATE_H Index: xc/programs/Xserver/include/window.h diff -u xc/programs/Xserver/include/window.h:1.1.1.3 xc/programs/Xserver/include/window.h:1.3 --- xc/programs/Xserver/include/window.h:1.1.1.3 Sun Sep 27 04:03:08 1998 +++ xc/programs/Xserver/include/window.h Fri Feb 2 17:36:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: window.h /main/9 1998/02/09 14:30:26 kaleb $ */ +/* $Xorg: window.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -157,6 +157,11 @@ #endif ); +/* Quartz support on Mac OS X uses the HIToolbox + framework whose ChangeWindowAttributes function conflicts here. */ +#ifdef __DARWIN__ +#define ChangeWindowAttributes Darwin_X_ChangeWindowAttributes +#endif extern int ChangeWindowAttributes( #if NeedFunctionPrototypes WindowPtr /*pWin*/, @@ -166,7 +171,14 @@ #endif ); +/* Quartz support on Mac OS X uses the HIToolbox + framework whose GetWindowAttributes function conflicts here. */ +#ifdef __DARWIN__ +#define GetWindowAttributes(w,c,x) Darwin_X_GetWindowAttributes(w,c,x) +extern void Darwin_X_GetWindowAttributes( +#else extern void GetWindowAttributes( +#endif #if NeedFunctionPrototypes WindowPtr /*pWin*/, ClientPtr /*client*/, Index: xc/programs/Xserver/include/windowstr.h diff -u xc/programs/Xserver/include/windowstr.h:1.3 xc/programs/Xserver/include/windowstr.h:1.4 --- xc/programs/Xserver/include/windowstr.h:1.3 Fri Aug 11 19:59:48 2000 +++ xc/programs/Xserver/include/windowstr.h Wed Jan 17 17:36:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: windowstr.h /main/37 1998/02/09 14:30:21 kaleb $ */ +/* $Xorg: windowstr.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/include/windowstr.h,v 1.3 2000/08/11 23:59:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/include/windowstr.h,v 1.4 2001/01/17 22:36:58 dawes Exp $ */ #ifndef WINDOWSTRUCT_H #define WINDOWSTRUCT_H Index: xc/programs/Xserver/iplan2p4/ipl.h diff -u xc/programs/Xserver/iplan2p4/ipl.h:3.4 xc/programs/Xserver/iplan2p4/ipl.h:3.5 --- xc/programs/Xserver/iplan2p4/ipl.h:3.4 Sun Jan 31 07:22:18 1999 +++ xc/programs/Xserver/iplan2p4/ipl.h Tue Jan 30 17:06:21 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/iplan2p4/ipl.h,v 3.4 1999/01/31 12:22:18 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/iplan2p4/ipl.h,v 3.5 2001/01/30 22:06:21 tsi Exp $ */ /* $XConsortium: ipl.h,v 5.37 94/04/17 20:28:38 dpw Exp $ */ /************************************************************ Copyright 1987 by Sun Microsystems, Inc. Mountain View, CA. @@ -1408,7 +1408,7 @@ /* Common macros for extracting drawing information */ -#if !defined(SINGLEDEPTH) && PSZ != 8 || defined(FORCE_SEPARATE_PRIVATE) +#if (!defined(SINGLEDEPTH) && PSZ != 8) || defined(FORCE_SEPARATE_PRIVATE) #define CFB_NEED_SCREEN_PRIVATE Index: xc/programs/Xserver/lbx/Imakefile diff -u xc/programs/Xserver/lbx/Imakefile:1.3 xc/programs/Xserver/lbx/Imakefile:1.4 --- xc/programs/Xserver/lbx/Imakefile:1.3 Sat Apr 17 05:08:48 1999 +++ xc/programs/Xserver/lbx/Imakefile Wed Jan 17 17:36:59 2001 @@ -1,6 +1,6 @@ -/* $XConsortium: Imakefile /main/11 1996/09/28 17:14:46 rws $ */ +/* $Xorg: Imakefile,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ /* - * $NCDId: @(#)Imakefile,v 1.16 1994/11/18 20:32:34 lemke Exp $ + * $NCDXorg: @(#)Imakefile,v 1.16 1994/11/18 20:32:34 lemke Exp $ * * Copyright 1992 Network Computing Devices * @@ -23,7 +23,7 @@ * * Author: Keith Packard, Network Computing Devices */ -/* $XFree86: xc/programs/Xserver/lbx/Imakefile,v 1.3 1999/04/17 09:08:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/Imakefile,v 1.4 2001/01/17 22:36:59 dawes Exp $ */ #include <Server.tmpl> Index: xc/programs/Xserver/lbx/lbxcmap.c diff -u xc/programs/Xserver/lbx/lbxcmap.c:1.6 xc/programs/Xserver/lbx/lbxcmap.c:1.8 --- xc/programs/Xserver/lbx/lbxcmap.c:1.6 Thu May 18 19:46:23 2000 +++ xc/programs/Xserver/lbx/lbxcmap.c Fri Feb 16 08:24:10 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxcmap.c /main/13 1998/03/11 16:28:54 barstow $ */ +/* $Xorg: lbxcmap.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -21,7 +21,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/lbx/lbxcmap.c,v 1.6 2000/05/18 23:46:23 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxcmap.c,v 1.8 2001/02/16 13:24:10 eich Exp $ */ #include <sys/types.h> #define NEED_REPLIES @@ -48,6 +48,7 @@ typedef struct { /* lbx screen private */ CreateColormapProcPtr CreateColormap; DestroyColormapProcPtr DestroyColormap; + CloseScreenProcPtr CloseScreen; } LbxScreenPriv; typedef struct _LbxStalled { @@ -140,6 +141,20 @@ pScreen->DestroyColormap = LbxDestroyColormap; } +static Bool +LbxCloseScreen(int i, ScreenPtr pScreen) +{ + LbxScreenPriv* pLbxScrPriv = ((LbxScreenPriv *) + (pScreen->devPrivates[lbxScreenPrivIndex].ptr)); + + pScreen->CloseScreen = pLbxScrPriv->CloseScreen; + + xfree(pScreen->devPrivates[lbxScreenPrivIndex].ptr); + pScreen->devPrivates[lbxScreenPrivIndex].ptr = NULL; + + return pScreen->CloseScreen(i, pScreen); +} + /* * Initialize LBX colormap private. */ @@ -181,12 +196,13 @@ pScreen->CreateColormap = LbxCreateColormap; pScreenPriv->DestroyColormap = pScreen->DestroyColormap; pScreen->DestroyColormap = LbxDestroyColormap; + pScreenPriv->CloseScreen = pScreen->CloseScreen; + pScreen->CloseScreen = LbxCloseScreen; pScreen->devPrivates[lbxScreenPrivIndex].ptr = (pointer) pScreenPriv; } return 1; } - /* * Return the number of allocated cells in the PSEUDO colormap. Index: xc/programs/Xserver/lbx/lbxdata.h diff -u xc/programs/Xserver/lbx/lbxdata.h:1.1.1.1 xc/programs/Xserver/lbx/lbxdata.h:1.1.1.2 --- xc/programs/Xserver/lbx/lbxdata.h:1.1.1.1 Sat Dec 21 23:07:18 1996 +++ xc/programs/Xserver/lbx/lbxdata.h Tue Jan 16 17:44:10 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: lbxdata.h /main/6 1996/11/15 21:15:42 rws $ */ +/* $Xorg: lbxdata.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* * Copyright 1994 Network Computing Devices, Inc. * Index: xc/programs/Xserver/lbx/lbxdix.c diff -u xc/programs/Xserver/lbx/lbxdix.c:1.4 xc/programs/Xserver/lbx/lbxdix.c:1.6 --- xc/programs/Xserver/lbx/lbxdix.c:1.4 Thu May 18 19:46:24 2000 +++ xc/programs/Xserver/lbx/lbxdix.c Tue May 15 06:19:43 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxdix.c /main/30 1998/05/15 10:29:37 msr $ */ +/* $Xorg: lbxdix.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* Copyright 1998 The Open Group @@ -42,7 +42,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxdix.c,v 1.4 2000/05/18 23:46:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxdix.c,v 1.6 2001/05/15 10:19:43 eich Exp $ */ /* various bits of DIX-level mangling */ @@ -72,8 +72,8 @@ #ifdef XAPPGROUP #include "Xagsrv.h" #endif +#include "swaprep.h" -extern ReplySwapPtr CopySwap32Write; extern int (*ProcVector[256]) (ClientPtr); extern int (*SwappedProcVector[256]) (ClientPtr); @@ -312,7 +312,7 @@ WriteToClient(client, sizeof(xLbxGetKeyboardMappingReply), (char *)&rep); if (send_data) { - client->pSwapReplyFunc = CopySwap32Write; + client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; WriteSwappedDataToClient(client, curKeySyms->mapWidth * stuff->count * sizeof(KeySym), &curKeySyms->map[(stuff->firstKeyCode - curKeySyms->minKeyCode) * Index: xc/programs/Xserver/lbx/lbxexts.c diff -u xc/programs/Xserver/lbx/lbxexts.c:1.2 xc/programs/Xserver/lbx/lbxexts.c:1.4 --- xc/programs/Xserver/lbx/lbxexts.c:1.2 Thu May 18 19:46:24 2000 +++ xc/programs/Xserver/lbx/lbxexts.c Fri Feb 16 08:24:10 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: lbxexts.c /main/9 1996/12/15 21:25:42 rws $ */ +/* $Xorg: lbxexts.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* * Copyright 1994 Network Computing Devices, Inc. * @@ -21,7 +21,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxexts.c,v 1.2 2000/05/18 23:46:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxexts.c,v 1.4 2001/02/16 13:24:10 eich Exp $ */ #include "X.h" #include "Xproto.h" @@ -238,10 +238,12 @@ void LbxCloseDownExtensions(void) { - int i; + int i,j; for (i = 0; i < num_exts; i++) { xfree(lbx_extensions[i]->name); + for (j = 0; j < lbx_extensions[i]->num_aliases; j++) + xfree(lbx_extensions[i]->aliases[j]); xfree(lbx_extensions[i]->aliases); xfree(lbx_extensions[i]->rep_mask); xfree(lbx_extensions[i]->ev_mask); @@ -250,6 +252,7 @@ xfree(lbx_extensions); lbx_extensions = NULL; num_exts = 0; + } void Index: xc/programs/Xserver/lbx/lbxgfx.c diff -u xc/programs/Xserver/lbx/lbxgfx.c:1.2 xc/programs/Xserver/lbx/lbxgfx.c:1.3 --- xc/programs/Xserver/lbx/lbxgfx.c:1.2 Thu May 18 19:46:24 2000 +++ xc/programs/Xserver/lbx/lbxgfx.c Wed Jan 17 17:36:59 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: lbxgfx.c /main/27 1996/12/15 21:25:50 rws $ */ +/* $Xorg: lbxgfx.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* * Copyright 1993 Network Computing Devices, Inc. * @@ -21,7 +21,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxgfx.c,v 1.2 2000/05/18 23:46:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxgfx.c,v 1.3 2001/01/17 22:36:59 dawes Exp $ */ /* various bits of DIX-level mangling */ Index: xc/programs/Xserver/lbx/lbxmain.c diff -u xc/programs/Xserver/lbx/lbxmain.c:1.8 xc/programs/Xserver/lbx/lbxmain.c:1.9 --- xc/programs/Xserver/lbx/lbxmain.c:1.8 Wed Jun 7 18:03:14 2000 +++ xc/programs/Xserver/lbx/lbxmain.c Wed Jan 17 17:36:59 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxmain.c /main/74 1998/02/09 14:32:18 kaleb $ */ +/* $Xorg: lbxmain.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -41,7 +41,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxmain.c,v 1.8 2000/06/07 22:03:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxmain.c,v 1.9 2001/01/17 22:36:59 dawes Exp $ */ #include <sys/types.h> #define NEED_REPLIES Index: xc/programs/Xserver/lbx/lbxopts.c diff -u xc/programs/Xserver/lbx/lbxopts.c:1.4 xc/programs/Xserver/lbx/lbxopts.c:1.5 --- xc/programs/Xserver/lbx/lbxopts.c:1.4 Wed Jun 7 18:03:14 2000 +++ xc/programs/Xserver/lbx/lbxopts.c Wed Jan 17 17:37:00 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: lbxopts.c /main/8 1996/11/15 21:14:56 rws $ */ +/* $Xorg: lbxopts.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* * Copyright 1994 Network Computing Devices, Inc. * @@ -21,7 +21,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxopts.c,v 1.4 2000/06/07 22:03:14 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxopts.c,v 1.5 2001/01/17 22:37:00 dawes Exp $ */ #ifdef OPTDEBUG #include <stdio.h> Index: xc/programs/Xserver/lbx/lbxprop.c diff -u xc/programs/Xserver/lbx/lbxprop.c:1.2 xc/programs/Xserver/lbx/lbxprop.c:1.4 --- xc/programs/Xserver/lbx/lbxprop.c:1.2 Thu May 18 19:46:24 2000 +++ xc/programs/Xserver/lbx/lbxprop.c Tue May 15 06:19:43 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxprop.c /main/24 1998/02/09 14:32:29 kaleb $ */ +/* $Xorg: lbxprop.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* Copyright 1986, 1998 The Open Group @@ -42,7 +42,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxprop.c,v 1.2 2000/05/18 23:46:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxprop.c,v 1.4 2001/05/15 10:19:43 eich Exp $ */ /* various bits of DIX-level mangling */ @@ -69,9 +69,8 @@ #define _SECURITY_SERVER #include "extensions/security.h" #endif +#include "swaprep.h" -extern ReplySwapPtr CopySwap16Write, CopySwap32Write, Swap32Write; - void LbxStallPropRequest(ClientPtr client, PropertyPtr pProp) @@ -515,10 +514,10 @@ if (len) { switch (reply.format) { case 32: - client->pSwapReplyFunc = CopySwap32Write; + client->pSwapReplyFunc = (ReplySwapPtr)CopySwap32Write; break; case 16: - client->pSwapReplyFunc = CopySwap16Write; + client->pSwapReplyFunc = (ReplySwapPtr)CopySwap16Write; break; default: client->pSwapReplyFunc = (ReplySwapPtr) WriteToClient; Index: xc/programs/Xserver/lbx/lbxserve.h diff -u xc/programs/Xserver/lbx/lbxserve.h:1.2 xc/programs/Xserver/lbx/lbxserve.h:1.3 --- xc/programs/Xserver/lbx/lbxserve.h:1.2 Thu May 18 19:46:24 2000 +++ xc/programs/Xserver/lbx/lbxserve.h Wed Jan 17 17:37:00 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxserve.h /main/15 1998/02/09 14:32:34 kaleb $ */ +/* $Xorg: lbxserve.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -41,7 +41,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxserve.h,v 1.2 2000/05/18 23:46:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxserve.h,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ #ifndef _LBXSERVE_H_ #define _LBXSERVE_H_ Index: xc/programs/Xserver/lbx/lbxsquish.c diff -u xc/programs/Xserver/lbx/lbxsquish.c:1.2 xc/programs/Xserver/lbx/lbxsquish.c:1.3 --- xc/programs/Xserver/lbx/lbxsquish.c:1.2 Thu May 18 19:46:24 2000 +++ xc/programs/Xserver/lbx/lbxsquish.c Wed Jan 17 17:37:00 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxsquish.c /main/6 1998/02/09 14:32:39 kaleb $ */ +/* $Xorg: lbxsquish.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -42,7 +42,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxsquish.c,v 1.2 2000/05/18 23:46:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxsquish.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ #define NEED_REPLIES #define NEED_EVENTS #include "X.h" Index: xc/programs/Xserver/lbx/lbxsrvopts.h diff -u xc/programs/Xserver/lbx/lbxsrvopts.h:1.2 xc/programs/Xserver/lbx/lbxsrvopts.h:1.3 --- xc/programs/Xserver/lbx/lbxsrvopts.h:1.2 Thu May 18 19:46:24 2000 +++ xc/programs/Xserver/lbx/lbxsrvopts.h Wed Jan 17 17:37:00 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: lbxsrvopts.h /main/6 1996/11/15 21:14:37 rws $ */ +/* $Xorg: lbxsrvopts.h,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* * Copyright 1994 Network Computing Devices, Inc. * @@ -21,7 +21,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxsrvopts.h,v 1.2 2000/05/18 23:46:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxsrvopts.h,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ #ifndef _LBX_SRVOPTS_H_ #define _LBX_SRVOPTS_H_ Index: xc/programs/Xserver/lbx/lbxswap.c diff -u xc/programs/Xserver/lbx/lbxswap.c:1.2 xc/programs/Xserver/lbx/lbxswap.c:1.3 --- xc/programs/Xserver/lbx/lbxswap.c:1.2 Thu May 18 19:46:24 2000 +++ xc/programs/Xserver/lbx/lbxswap.c Wed Jan 17 17:37:00 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxswap.c /main/17 1998/02/09 14:32:52 kaleb $ */ +/* $Xorg: lbxswap.c,v 1.3 2000/08/17 19:53:31 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -41,7 +41,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxswap.c,v 1.2 2000/05/18 23:46:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxswap.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ #include <sys/types.h> #define NEED_REPLIES Index: xc/programs/Xserver/lbx/lbxtables.c diff -u xc/programs/Xserver/lbx/lbxtables.c:1.2 xc/programs/Xserver/lbx/lbxtables.c:1.3 --- xc/programs/Xserver/lbx/lbxtables.c:1.2 Thu May 18 19:46:24 2000 +++ xc/programs/Xserver/lbx/lbxtables.c Wed Jan 17 17:37:00 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: lbxtables.c /main/4 1996/11/15 21:14:28 rws $ */ +/* $Xorg: lbxtables.c,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */ /* * Copyright 1993 Network Computing Devices, Inc. * @@ -21,7 +21,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxtables.c,v 1.2 2000/05/18 23:46:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxtables.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ #include "dix.h" extern int ProcInitialConnection(ClientPtr client); Index: xc/programs/Xserver/lbx/lbxtags.c diff -u xc/programs/Xserver/lbx/lbxtags.c:1.2 xc/programs/Xserver/lbx/lbxtags.c:1.3 --- xc/programs/Xserver/lbx/lbxtags.c:1.2 Thu May 18 19:46:24 2000 +++ xc/programs/Xserver/lbx/lbxtags.c Wed Jan 17 17:37:00 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxtags.c /main/13 1998/05/15 10:29:43 msr $ */ +/* $Xorg: lbxtags.c,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -42,7 +42,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxtags.c,v 1.2 2000/05/18 23:46:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxtags.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ #include "X.h" #include "misc.h" Index: xc/programs/Xserver/lbx/lbxtags.h diff -u xc/programs/Xserver/lbx/lbxtags.h:1.2 xc/programs/Xserver/lbx/lbxtags.h:1.3 --- xc/programs/Xserver/lbx/lbxtags.h:1.2 Thu May 18 19:46:25 2000 +++ xc/programs/Xserver/lbx/lbxtags.h Wed Jan 17 17:37:00 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxtags.h /main/8 1998/02/09 14:33:05 kaleb $ */ +/* $Xorg: lbxtags.h,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -42,7 +42,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/Xserver/lbx/lbxtags.h,v 1.2 2000/05/18 23:46:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxtags.h,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ #ifndef _LBXTAGS_H_ #define _LBXTAGS_H_ Index: xc/programs/Xserver/lbx/lbxzerorep.c diff -u xc/programs/Xserver/lbx/lbxzerorep.c:1.2 xc/programs/Xserver/lbx/lbxzerorep.c:1.3 --- xc/programs/Xserver/lbx/lbxzerorep.c:1.2 Thu May 18 19:46:25 2000 +++ xc/programs/Xserver/lbx/lbxzerorep.c Wed Jan 17 17:37:00 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxzerorep.c /main/3 1998/02/09 14:33:09 kaleb $ */ +/* $Xorg: lbxzerorep.c,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */ /* @@ -23,7 +23,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/lbx/lbxzerorep.c,v 1.2 2000/05/18 23:46:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/lbx/lbxzerorep.c,v 1.3 2001/01/17 22:37:00 dawes Exp $ */ /* * This module handles zeroing out unused pad bytes in core X replies. Index: xc/programs/Xserver/lmfcfb/Imakefile diff -u xc/programs/Xserver/lmfcfb/Imakefile:1.3 xc/programs/Xserver/lmfcfb/Imakefile:1.4 --- xc/programs/Xserver/lmfcfb/Imakefile:1.3 Sun Apr 18 10:52:37 1999 +++ xc/programs/Xserver/lmfcfb/Imakefile Wed Jan 17 17:37:01 2001 @@ -1,5 +1,9 @@ -XCOMM $TOG: Imakefile /main/2 1997/11/17 10:57:31 msr $ -XCOMM $XFree86: xc/programs/Xserver/lmfcfb/Imakefile,v 1.3 1999/04/18 14:52:37 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/Xserver/lmfcfb/Imakefile,v 1.4 2001/01/17 22:37:01 dawes Exp $ #include <Server.tmpl> Index: xc/programs/Xserver/mfb/Imakefile diff -u xc/programs/Xserver/mfb/Imakefile:3.14 xc/programs/Xserver/mfb/Imakefile:3.15 --- xc/programs/Xserver/mfb/Imakefile:3.14 Sat Aug 14 06:50:19 1999 +++ xc/programs/Xserver/mfb/Imakefile Wed Jan 17 17:37:01 2001 @@ -1,5 +1,9 @@ -XCOMM $TOG: Imakefile /main/43 1997/11/15 12:10:58 msr $ -XCOMM $XFree86: xc/programs/Xserver/mfb/Imakefile,v 3.14 1999/08/14 10:50:19 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/Xserver/mfb/Imakefile,v 3.15 2001/01/17 22:37:01 dawes Exp $ #define IHaveModules #include <Server.tmpl> Index: xc/programs/Xserver/mfb/fastblt.h diff -u xc/programs/Xserver/mfb/fastblt.h:1.3 xc/programs/Xserver/mfb/fastblt.h:1.4 --- xc/programs/Xserver/mfb/fastblt.h:1.3 Sat Feb 12 00:43:25 2000 +++ xc/programs/Xserver/mfb/fastblt.h Wed Jan 17 17:37:01 2001 @@ -1,4 +1,4 @@ -/* $TOG: fastblt.h /main/8 1998/02/09 14:37:36 kaleb $ */ +/* $Xorg: fastblt.h,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mfb/fastblt.h,v 1.3 2000/02/12 05:43:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/fastblt.h,v 1.4 2001/01/17 22:37:01 dawes Exp $ */ /* * Fast bitblt macros for certain hardware. If your machine has an addressing Index: xc/programs/Xserver/mfb/maskbits.c diff -u xc/programs/Xserver/mfb/maskbits.c:1.4 xc/programs/Xserver/mfb/maskbits.c:1.5 --- xc/programs/Xserver/mfb/maskbits.c:1.4 Fri Feb 11 22:39:59 2000 +++ xc/programs/Xserver/mfb/maskbits.c Wed Jan 17 17:37:01 2001 @@ -1,4 +1,4 @@ -/* $TOG: maskbits.c /main/18 1998/02/09 14:37:41 kaleb $ */ +/* $Xorg: maskbits.c,v 1.3 2000/08/17 19:53:32 cpqbld Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /* @@ -44,7 +44,7 @@ SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/mfb/maskbits.c,v 1.4 2000/02/12 03:39:59 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/maskbits.c,v 1.5 2001/01/17 22:37:01 dawes Exp $ */ #include "maskbits.h" #include "servermd.h" Index: xc/programs/Xserver/mfb/maskbits.h diff -u xc/programs/Xserver/mfb/maskbits.h:3.7 xc/programs/Xserver/mfb/maskbits.h:3.8 --- xc/programs/Xserver/mfb/maskbits.h:3.7 Tue Nov 21 19:58:13 2000 +++ xc/programs/Xserver/mfb/maskbits.h Wed Jan 17 17:37:02 2001 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/Xserver/mfb/maskbits.h,v 3.8 2001/01/17 22:37:02 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.1, 1/24/89 */ /*********************************************************** Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,8 +22,8 @@ SOFTWARE. ******************************************************************/ -/* $XConsortium: maskbits.h,v 1.33 94/04/17 20:28:13 dpw Exp $ */ -/* $XFree86: xc/programs/Xserver/mfb/maskbits.h,v 3.7 2000/11/22 00:58:13 tsi Exp $ */ +/* $Xorg: maskbits.h,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ + #include "X.h" #include "Xmd.h" #include "servermd.h" Index: xc/programs/Xserver/mfb/mergerop.h diff -u xc/programs/Xserver/mfb/mergerop.h:3.10 xc/programs/Xserver/mfb/mergerop.h:3.11 --- xc/programs/Xserver/mfb/mergerop.h:3.10 Tue Oct 17 12:53:20 2000 +++ xc/programs/Xserver/mfb/mergerop.h Wed Jan 17 17:37:02 2001 @@ -1,5 +1,5 @@ /* - * $TOG: mergerop.h /main/12 1998/02/09 14:38:03 kaleb $ + * $Xorg: mergerop.h,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -21,7 +21,7 @@ * * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/Xserver/mfb/mergerop.h,v 3.10 2000/10/17 16:53:20 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mergerop.h,v 3.11 2001/01/17 22:37:02 dawes Exp $ */ #ifndef _MERGEROP_H_ #define _MERGEROP_H_ Index: xc/programs/Xserver/mfb/mfb.h diff -u xc/programs/Xserver/mfb/mfb.h:1.16 xc/programs/Xserver/mfb/mfb.h:1.17 --- xc/programs/Xserver/mfb/mfb.h:1.16 Fri Feb 11 22:40:01 2000 +++ xc/programs/Xserver/mfb/mfb.h Wed Jan 17 17:37:02 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfb.h,v 1.16 2000/02/12 03:40:01 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfb.h,v 1.17 2001/01/17 22:37:02 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -42,14 +42,12 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfb.h /main/43 1998/02/09 14:40:38 kaleb $ */ +/* $Xorg: mfb.h,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ - #if !defined(_MFB_H_) || defined(MFB_PROTOTYPES_ONLY) #ifndef MFB_PROTOTYPES_ONLY #define _MFB_H_ #endif - /* Monochrome Frame Buffer definitions written by drewry, september 1986 Index: xc/programs/Xserver/mfb/mfbbitblt.c diff -u xc/programs/Xserver/mfb/mfbbitblt.c:1.3 xc/programs/Xserver/mfb/mfbbitblt.c:1.4 --- xc/programs/Xserver/mfb/mfbbitblt.c:1.3 Sun Oct 4 05:39:07 1998 +++ xc/programs/Xserver/mfb/mfbbitblt.c Wed Jan 17 17:37:02 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbbitblt.c,v 1.3 1998/10/04 09:39:07 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbbitblt.c,v 1.4 2001/01/17 22:37:02 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -42,7 +42,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbbitblt.c /main/47 1998/02/09 14:38:09 kaleb $ */ +/* $Xorg: mfbbitblt.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ #include "X.h" #include "Xprotostr.h" Index: xc/programs/Xserver/mfb/mfbblt.c diff -u xc/programs/Xserver/mfb/mfbblt.c:3.1 xc/programs/Xserver/mfb/mfbblt.c:3.2 --- xc/programs/Xserver/mfb/mfbblt.c:3.1 Sun Oct 4 05:39:08 1998 +++ xc/programs/Xserver/mfb/mfbblt.c Wed Jan 17 17:37:02 2001 @@ -1,7 +1,7 @@ /* * mfb copy area */ -/* $XFree86: xc/programs/Xserver/mfb/mfbblt.c,v 3.1 1998/10/04 09:39:08 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbblt.c,v 3.2 2001/01/17 22:37:02 dawes Exp $ */ /* @@ -26,7 +26,7 @@ Author: Keith Packard */ -/* $TOG: mfbblt.c /main/12 1998/02/09 14:38:17 kaleb $ */ +/* $Xorg: mfbblt.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ #include "X.h" #include "Xmd.h" Index: xc/programs/Xserver/mfb/mfbbres.c diff -u xc/programs/Xserver/mfb/mfbbres.c:1.3 xc/programs/Xserver/mfb/mfbbres.c:1.4 --- xc/programs/Xserver/mfb/mfbbres.c:1.3 Sat Feb 12 00:43:25 2000 +++ xc/programs/Xserver/mfb/mfbbres.c Wed Jan 17 17:37:02 2001 @@ -1,5 +1,5 @@ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ -/* $XFree86: xc/programs/Xserver/mfb/mfbbres.c,v 1.3 2000/02/12 05:43:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbbres.c,v 1.4 2001/01/17 22:37:02 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -42,7 +42,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbbres.c /main/13 1998/02/09 14:38:29 kaleb $ */ +/* $Xorg: mfbbres.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ #include "X.h" #include "misc.h" #include "mfb.h" Index: xc/programs/Xserver/mfb/mfbbresd.c diff -u xc/programs/Xserver/mfb/mfbbresd.c:1.3 xc/programs/Xserver/mfb/mfbbresd.c:1.4 --- xc/programs/Xserver/mfb/mfbbresd.c:1.3 Sat Feb 12 00:43:25 2000 +++ xc/programs/Xserver/mfb/mfbbresd.c Wed Jan 17 17:37:02 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbbresd.c,v 1.3 2000/02/12 05:43:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbbresd.c,v 1.4 2001/01/17 22:37:02 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbbresd.c /main/11 1998/02/09 14:38:23 kaleb $ */ +/* $Xorg: mfbbresd.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ #include "X.h" #include "misc.h" #include "mfb.h" Index: xc/programs/Xserver/mfb/mfbbstore.c diff -u xc/programs/Xserver/mfb/mfbbstore.c:1.1.1.2 xc/programs/Xserver/mfb/mfbbstore.c:1.1.1.3 --- xc/programs/Xserver/mfb/mfbbstore.c:1.1.1.2 Sun Sep 27 04:04:43 1998 +++ xc/programs/Xserver/mfb/mfbbstore.c Tue Jan 16 17:44:19 2001 @@ -1,4 +1,4 @@ -/* $TOG: mfbbstore.c /main/14 1998/02/09 14:38:34 kaleb $ */ +/* $Xorg: mfbbstore.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /* Index: xc/programs/Xserver/mfb/mfbclip.c diff -u xc/programs/Xserver/mfb/mfbclip.c:1.3 xc/programs/Xserver/mfb/mfbclip.c:1.4 --- xc/programs/Xserver/mfb/mfbclip.c:1.3 Sun Apr 11 09:11:12 1999 +++ xc/programs/Xserver/mfb/mfbclip.c Wed Jan 17 17:37:02 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbclip.c,v 1.3 1999/04/11 13:11:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbclip.c,v 1.4 2001/01/17 22:37:02 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbclip.c /main/15 1998/02/09 14:38:38 kaleb $ */ +/* $Xorg: mfbclip.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ #include "X.h" #include "miscstruct.h" #include "pixmapstr.h" Index: xc/programs/Xserver/mfb/mfbcmap.c diff -u xc/programs/Xserver/mfb/mfbcmap.c:1.5 xc/programs/Xserver/mfb/mfbcmap.c:1.6 --- xc/programs/Xserver/mfb/mfbcmap.c:1.5 Sun Nov 22 05:37:42 1998 +++ xc/programs/Xserver/mfb/mfbcmap.c Wed Jan 17 17:37:02 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbcmap.c,v 1.5 1998/11/22 10:37:42 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbcmap.c,v 1.6 2001/01/17 22:37:02 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbcmap.c /main/13 1998/02/09 14:38:42 kaleb $ */ +/* $Xorg: mfbcmap.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ #include "X.h" #include "scrnintstr.h" #include "colormapst.h" Index: xc/programs/Xserver/mfb/mfbfillarc.c diff -u xc/programs/Xserver/mfb/mfbfillarc.c:1.3 xc/programs/Xserver/mfb/mfbfillarc.c:1.4 --- xc/programs/Xserver/mfb/mfbfillarc.c:1.3 Sun Oct 4 05:39:09 1998 +++ xc/programs/Xserver/mfb/mfbfillarc.c Wed Jan 17 17:37:02 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbfillarc.c,v 1.3 1998/10/04 09:39:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbfillarc.c,v 1.4 2001/01/17 22:37:02 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group @@ -21,7 +21,7 @@ ********************************************************/ -/* $TOG: mfbfillarc.c /main/17 1998/02/09 14:38:46 kaleb $ */ +/* $Xorg: mfbfillarc.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ #include "X.h" #include "Xprotostr.h" Index: xc/programs/Xserver/mfb/mfbfillrct.c diff -u xc/programs/Xserver/mfb/mfbfillrct.c:1.3 xc/programs/Xserver/mfb/mfbfillrct.c:1.4 --- xc/programs/Xserver/mfb/mfbfillrct.c:1.3 Sun Oct 4 05:39:09 1998 +++ xc/programs/Xserver/mfb/mfbfillrct.c Wed Jan 17 17:37:02 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbfillrct.c,v 1.3 1998/10/04 09:39:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbfillrct.c,v 1.4 2001/01/17 22:37:02 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -42,7 +42,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbfillrct.c /main/19 1998/02/09 14:38:50 kaleb $ */ +/* $Xorg: mfbfillrct.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ #include "X.h" #include "Xprotostr.h" #include "pixmapstr.h" Index: xc/programs/Xserver/mfb/mfbfillsp.c diff -u xc/programs/Xserver/mfb/mfbfillsp.c:1.7 xc/programs/Xserver/mfb/mfbfillsp.c:1.8 --- xc/programs/Xserver/mfb/mfbfillsp.c:1.7 Wed Aug 23 18:10:17 2000 +++ xc/programs/Xserver/mfb/mfbfillsp.c Wed Jan 17 17:37:02 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbfillsp.c,v 1.7 2000/08/23 22:10:17 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbfillsp.c,v 1.8 2001/01/17 22:37:02 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -42,7 +42,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbfillsp.c /main/26 1998/02/09 14:38:54 kaleb $ */ +/* $Xorg: mfbfillsp.c,v 1.3 2000/08/17 19:53:34 cpqbld Exp $ */ #include "X.h" #include "Xmd.h" #include "gcstruct.h" Index: xc/programs/Xserver/mfb/mfbfont.c diff -u xc/programs/Xserver/mfb/mfbfont.c:1.1.1.2 xc/programs/Xserver/mfb/mfbfont.c:1.1.1.3 --- xc/programs/Xserver/mfb/mfbfont.c:1.1.1.2 Sun Sep 27 04:04:49 1998 +++ xc/programs/Xserver/mfb/mfbfont.c Tue Jan 16 17:44:23 2001 @@ -40,7 +40,7 @@ SOFTWARE. */ -/* $TOG: mfbfont.c /main/7 1998/02/09 14:38:59 kaleb $ */ +/* $Xorg: mfbfont.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" Index: xc/programs/Xserver/mfb/mfbgc.c diff -u xc/programs/Xserver/mfb/mfbgc.c:1.5 xc/programs/Xserver/mfb/mfbgc.c:1.6 --- xc/programs/Xserver/mfb/mfbgc.c:1.5 Sun Apr 11 09:11:13 1999 +++ xc/programs/Xserver/mfb/mfbgc.c Wed Jan 17 17:37:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbgc.c,v 1.5 1999/04/11 13:11:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbgc.c,v 1.6 2001/01/17 22:37:03 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbgc.c /main/56 1998/02/09 14:39:04 kaleb $ */ +/* $Xorg: mfbgc.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" Index: xc/programs/Xserver/mfb/mfbgetsp.c diff -u xc/programs/Xserver/mfb/mfbgetsp.c:1.1.1.2 xc/programs/Xserver/mfb/mfbgetsp.c:1.1.1.3 --- xc/programs/Xserver/mfb/mfbgetsp.c:1.1.1.2 Sun Sep 27 04:04:50 1998 +++ xc/programs/Xserver/mfb/mfbgetsp.c Tue Jan 16 17:44:24 2001 @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbgetsp.c /main/19 1998/02/09 14:39:09 kaleb $ */ +/* $Xorg: mfbgetsp.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "Xmd.h" Index: xc/programs/Xserver/mfb/mfbhrzvert.c diff -u xc/programs/Xserver/mfb/mfbhrzvert.c:1.3 xc/programs/Xserver/mfb/mfbhrzvert.c:1.4 --- xc/programs/Xserver/mfb/mfbhrzvert.c:1.3 Sun Apr 11 11:28:10 1999 +++ xc/programs/Xserver/mfb/mfbhrzvert.c Wed Jan 17 17:37:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbhrzvert.c,v 1.3 1999/04/11 15:28:10 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbhrzvert.c,v 1.4 2001/01/17 22:37:03 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -42,7 +42,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbhrzvert.c /main/9 1998/02/09 14:39:14 kaleb $ */ +/* $Xorg: mfbhrzvert.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "gc.h" Index: xc/programs/Xserver/mfb/mfbimage.c diff -u xc/programs/Xserver/mfb/mfbimage.c:1.4 xc/programs/Xserver/mfb/mfbimage.c:1.5 --- xc/programs/Xserver/mfb/mfbimage.c:1.4 Sun Apr 11 09:11:14 1999 +++ xc/programs/Xserver/mfb/mfbimage.c Wed Jan 17 17:37:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbimage.c,v 1.4 1999/04/11 13:11:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbimage.c,v 1.5 2001/01/17 22:37:03 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbimage.c /main/19 1998/02/09 14:39:19 kaleb $ */ +/* $Xorg: mfbimage.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" Index: xc/programs/Xserver/mfb/mfbimggblt.c diff -u xc/programs/Xserver/mfb/mfbimggblt.c:3.2 xc/programs/Xserver/mfb/mfbimggblt.c:3.3 --- xc/programs/Xserver/mfb/mfbimggblt.c:3.2 Sun Oct 4 05:39:11 1998 +++ xc/programs/Xserver/mfb/mfbimggblt.c Wed Jan 17 17:37:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbimggblt.c,v 3.2 1998/10/04 09:39:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbimggblt.c,v 3.3 2001/01/17 22:37:03 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -42,7 +42,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbimggblt.c /main/27 1998/02/09 14:39:23 kaleb $ */ +/* $Xorg: mfbimggblt.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "Xmd.h" #include "Xproto.h" Index: xc/programs/Xserver/mfb/mfbline.c diff -u xc/programs/Xserver/mfb/mfbline.c:1.5 xc/programs/Xserver/mfb/mfbline.c:1.6 --- xc/programs/Xserver/mfb/mfbline.c:1.5 Fri Feb 11 22:40:02 2000 +++ xc/programs/Xserver/mfb/mfbline.c Wed Jan 17 17:37:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbline.c,v 1.5 2000/02/12 03:40:02 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbline.c,v 1.6 2001/01/17 22:37:03 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbline.c /main/28 1998/02/09 14:39:27 kaleb $ */ +/* $Xorg: mfbline.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "gcstruct.h" Index: xc/programs/Xserver/mfb/mfbmisc.c diff -u xc/programs/Xserver/mfb/mfbmisc.c:1.1.1.2 xc/programs/Xserver/mfb/mfbmisc.c:1.1.1.3 --- xc/programs/Xserver/mfb/mfbmisc.c:1.1.1.2 Sun Sep 27 04:04:55 1998 +++ xc/programs/Xserver/mfb/mfbmisc.c Tue Jan 16 17:44:25 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbmisc.c /main/8 1998/02/09 14:39:32 kaleb $ */ +/* $Xorg: mfbmisc.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "misc.h" #include "cursor.h" Index: xc/programs/Xserver/mfb/mfbpixmap.c diff -u xc/programs/Xserver/mfb/mfbpixmap.c:1.1.1.2 xc/programs/Xserver/mfb/mfbpixmap.c:1.1.1.3 --- xc/programs/Xserver/mfb/mfbpixmap.c:1.1.1.2 Sun Sep 27 04:04:56 1998 +++ xc/programs/Xserver/mfb/mfbpixmap.c Tue Jan 16 17:44:26 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbpixmap.c /main/22 1998/02/09 14:39:36 kaleb $ */ +/* $Xorg: mfbpixmap.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ /* pixmap management written by drewry, september 1986 Index: xc/programs/Xserver/mfb/mfbply1rct.c diff -u xc/programs/Xserver/mfb/mfbply1rct.c:1.4 xc/programs/Xserver/mfb/mfbply1rct.c:1.5 --- xc/programs/Xserver/mfb/mfbply1rct.c:1.4 Sat Mar 6 08:12:49 1999 +++ xc/programs/Xserver/mfb/mfbply1rct.c Wed Jan 17 17:37:03 2001 @@ -1,5 +1,5 @@ /* - * $TOG: mfbply1rct.c /main/11 1998/02/09 14:39:41 kaleb $ + * $Xorg: mfbply1rct.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ * Copyright 1990, 1998 The Open Group @@ -22,7 +22,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/Xserver/mfb/mfbply1rct.c,v 1.4 1999/03/06 13:12:49 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbply1rct.c,v 1.5 2001/01/17 22:37:03 dawes Exp $ */ #include "X.h" Index: xc/programs/Xserver/mfb/mfbplygblt.c diff -u xc/programs/Xserver/mfb/mfbplygblt.c:3.2 xc/programs/Xserver/mfb/mfbplygblt.c:3.3 --- xc/programs/Xserver/mfb/mfbplygblt.c:3.2 Sun Oct 4 05:39:13 1998 +++ xc/programs/Xserver/mfb/mfbplygblt.c Wed Jan 17 17:37:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbplygblt.c,v 3.2 1998/10/04 09:39:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbplygblt.c,v 3.3 2001/01/17 22:37:03 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbplygblt.c /main/21 1998/02/09 14:39:46 kaleb $ */ +/* $Xorg: mfbplygblt.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "Xmd.h" Index: xc/programs/Xserver/mfb/mfbpntarea.c diff -u xc/programs/Xserver/mfb/mfbpntarea.c:1.1.1.2 xc/programs/Xserver/mfb/mfbpntarea.c:1.1.1.3 --- xc/programs/Xserver/mfb/mfbpntarea.c:1.1.1.2 Sun Sep 27 04:04:58 1998 +++ xc/programs/Xserver/mfb/mfbpntarea.c Tue Jan 16 17:44:27 2001 @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbpntarea.c /main/13 1998/02/09 14:39:50 kaleb $ */ +/* $Xorg: mfbpntarea.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "windowstr.h" Index: xc/programs/Xserver/mfb/mfbpntwin.c diff -u xc/programs/Xserver/mfb/mfbpntwin.c:1.1.1.2 xc/programs/Xserver/mfb/mfbpntwin.c:1.1.1.3 --- xc/programs/Xserver/mfb/mfbpntwin.c:1.1.1.2 Sun Sep 27 04:04:58 1998 +++ xc/programs/Xserver/mfb/mfbpntwin.c Tue Jan 16 17:44:27 2001 @@ -1,4 +1,4 @@ -/* $TOG: mfbpntwin.c /main/20 1998/02/09 14:39:55 kaleb $ */ +/* $Xorg: mfbpntwin.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Index: xc/programs/Xserver/mfb/mfbpolypnt.c diff -u xc/programs/Xserver/mfb/mfbpolypnt.c:1.3 xc/programs/Xserver/mfb/mfbpolypnt.c:1.4 --- xc/programs/Xserver/mfb/mfbpolypnt.c:1.3 Sun Oct 4 05:39:13 1998 +++ xc/programs/Xserver/mfb/mfbpolypnt.c Wed Jan 17 17:37:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbpolypnt.c,v 1.3 1998/10/04 09:39:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbpolypnt.c,v 1.4 2001/01/17 22:37:03 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -42,7 +42,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbpolypnt.c /main/11 1998/02/09 14:39:59 kaleb $ */ +/* $Xorg: mfbpolypnt.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "Xprotostr.h" Index: xc/programs/Xserver/mfb/mfbpushpxl.c diff -u xc/programs/Xserver/mfb/mfbpushpxl.c:1.3 xc/programs/Xserver/mfb/mfbpushpxl.c:1.4 --- xc/programs/Xserver/mfb/mfbpushpxl.c:1.3 Sun Oct 4 05:39:14 1998 +++ xc/programs/Xserver/mfb/mfbpushpxl.c Wed Jan 17 17:37:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbpushpxl.c,v 1.3 1998/10/04 09:39:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbpushpxl.c,v 1.4 2001/01/17 22:37:03 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbpushpxl.c /main/11 1998/02/09 14:40:03 kaleb $ */ +/* $Xorg: mfbpushpxl.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "gcstruct.h" Index: xc/programs/Xserver/mfb/mfbscrclse.c diff -u xc/programs/Xserver/mfb/mfbscrclse.c:1.1.1.2 xc/programs/Xserver/mfb/mfbscrclse.c:1.1.1.3 --- xc/programs/Xserver/mfb/mfbscrclse.c:1.1.1.2 Sun Sep 27 04:05:01 1998 +++ xc/programs/Xserver/mfb/mfbscrclse.c Tue Jan 16 17:44:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: mfbscrclse.c /main/9 1998/02/09 14:40:07 kaleb $ */ +/* $Xorg: mfbscrclse.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group Index: xc/programs/Xserver/mfb/mfbscrinit.c diff -u xc/programs/Xserver/mfb/mfbscrinit.c:3.6 xc/programs/Xserver/mfb/mfbscrinit.c:3.7 --- xc/programs/Xserver/mfb/mfbscrinit.c:3.6 Sun Oct 4 05:39:14 1998 +++ xc/programs/Xserver/mfb/mfbscrinit.c Wed Jan 17 17:37:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbscrinit.c,v 3.6 1998/10/04 09:39:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbscrinit.c,v 3.7 2001/01/17 22:37:03 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbscrinit.c /main/28 1998/02/09 14:40:11 kaleb $ */ +/* $Xorg: mfbscrinit.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "Xproto.h" /* for xColorItem */ Index: xc/programs/Xserver/mfb/mfbsetsp.c diff -u xc/programs/Xserver/mfb/mfbsetsp.c:1.4 xc/programs/Xserver/mfb/mfbsetsp.c:1.5 --- xc/programs/Xserver/mfb/mfbsetsp.c:1.4 Sun Apr 11 09:11:14 1999 +++ xc/programs/Xserver/mfb/mfbsetsp.c Wed Jan 17 17:37:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbsetsp.c,v 1.4 1999/04/11 13:11:14 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbsetsp.c,v 1.5 2001/01/17 22:37:03 dawes Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -42,7 +42,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbsetsp.c /main/15 1998/02/09 14:40:16 kaleb $ */ +/* $Xorg: mfbsetsp.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ #include "X.h" #include "Xmd.h" Index: xc/programs/Xserver/mfb/mfbtegblt.c diff -u xc/programs/Xserver/mfb/mfbtegblt.c:1.6 xc/programs/Xserver/mfb/mfbtegblt.c:1.7 --- xc/programs/Xserver/mfb/mfbtegblt.c:1.6 Fri Feb 11 22:40:03 2000 +++ xc/programs/Xserver/mfb/mfbtegblt.c Wed Jan 17 17:37:03 2001 @@ -1,4 +1,4 @@ -/* $TOG: mfbtegblt.c /main/19 1998/02/09 14:40:20 kaleb $ */ +/* $Xorg: mfbtegblt.c,v 1.3 2000/08/17 19:53:35 cpqbld Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** @@ -43,7 +43,7 @@ ******************************************************************/ -/* $XFree86: xc/programs/Xserver/mfb/mfbtegblt.c,v 1.6 2000/02/12 03:40:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbtegblt.c,v 1.7 2001/01/17 22:37:03 dawes Exp $ */ #include "X.h" #include "Xmd.h" Index: xc/programs/Xserver/mfb/mfbtile.c diff -u xc/programs/Xserver/mfb/mfbtile.c:1.1.1.2 xc/programs/Xserver/mfb/mfbtile.c:1.1.1.3 --- xc/programs/Xserver/mfb/mfbtile.c:1.1.1.2 Sun Sep 27 04:05:04 1998 +++ xc/programs/Xserver/mfb/mfbtile.c Tue Jan 16 17:44:30 2001 @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mfbtile.c /main/13 1998/02/09 14:40:25 kaleb $ */ +/* $Xorg: mfbtile.c,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ #include "X.h" #include "windowstr.h" Index: xc/programs/Xserver/mfb/mfbwindow.c diff -u xc/programs/Xserver/mfb/mfbwindow.c:1.1.1.2 xc/programs/Xserver/mfb/mfbwindow.c:1.1.1.3 --- xc/programs/Xserver/mfb/mfbwindow.c:1.1.1.2 Sun Sep 27 04:05:05 1998 +++ xc/programs/Xserver/mfb/mfbwindow.c Tue Jan 16 17:44:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: mfbwindow.c /main/33 1998/02/09 14:40:29 kaleb $ */ +/* $Xorg: mfbwindow.c,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ /* Combined Purdue/PurduePlus patches, level 2.0, 1/17/89 */ /*********************************************************** Index: xc/programs/Xserver/mfb/mfbzerarc.c diff -u xc/programs/Xserver/mfb/mfbzerarc.c:3.4 xc/programs/Xserver/mfb/mfbzerarc.c:3.5 --- xc/programs/Xserver/mfb/mfbzerarc.c:3.4 Fri Feb 11 22:40:03 2000 +++ xc/programs/Xserver/mfb/mfbzerarc.c Wed Jan 17 17:37:03 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mfb/mfbzerarc.c,v 3.4 2000/02/12 03:40:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mfb/mfbzerarc.c,v 3.5 2001/01/17 22:37:03 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group @@ -21,7 +21,7 @@ ********************************************************/ -/* $TOG: mfbzerarc.c /main/22 1998/02/09 14:40:34 kaleb $ */ +/* $Xorg: mfbzerarc.c,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ /* Derived from: * "Algorithm for drawing ellipses or hyperbolae with a digital plotter" Index: xc/programs/Xserver/mi/Imakefile diff -u xc/programs/Xserver/mi/Imakefile:3.31 xc/programs/Xserver/mi/Imakefile:3.33 --- xc/programs/Xserver/mi/Imakefile:3.31 Mon Oct 2 18:54:35 2000 +++ xc/programs/Xserver/mi/Imakefile Mon Apr 23 12:17:12 2001 @@ -1,5 +1,10 @@ -XCOMM $XConsortium: Imakefile /main/44 1996/12/02 10:22:16 lehors $ -XCOMM $XFree86: xc/programs/Xserver/mi/Imakefile,v 3.31 2000/10/02 22:54:35 keithp Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/Xserver/mi/Imakefile,v 3.33 2001/04/23 16:17:12 tsi Exp $ + #include <Server.tmpl> #if ! HasCbrt @@ -43,8 +48,6 @@ */ EXT_DEFINES = ExtensionDefines -UXINPUT -UXF86VIDMODE -UXFreeXDGA -UXF86MISC \ -UXFree86LOADER -#else -EXT_DEFINES = ExtensionDefines #endif INCLUDES = -I. -I../include -I../../../include/fonts -I../render \ Index: xc/programs/Xserver/mi/cbrt.c diff -u xc/programs/Xserver/mi/cbrt.c:3.1 xc/programs/Xserver/mi/cbrt.c:3.2 --- xc/programs/Xserver/mi/cbrt.c:3.1 Sun Oct 4 05:39:22 1998 +++ xc/programs/Xserver/mi/cbrt.c Wed Jan 17 17:37:05 2001 @@ -1,4 +1,4 @@ -/* $TOG: cbrt.c /main/4 1998/02/09 14:45:52 kaleb $ */ +/* $Xorg: cbrt.c,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/cbrt.c,v 3.1 1998/10/04 09:39:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/cbrt.c,v 3.2 2001/01/17 22:37:05 dawes Exp $ */ /* simple cbrt, in case your math library doesn't have a good one */ Index: xc/programs/Xserver/mi/mi.h diff -u xc/programs/Xserver/mi/mi.h:3.6 xc/programs/Xserver/mi/mi.h:3.7.2.1 --- xc/programs/Xserver/mi/mi.h:3.6 Fri Feb 11 22:40:06 2000 +++ xc/programs/Xserver/mi/mi.h Fri May 25 14:50:12 2001 @@ -1,4 +1,4 @@ -/* $TOG: mi.h /main/18 1998/02/09 14:49:50 kaleb $ */ +/* $Xorg: mi.h,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/mi/mi.h,v 3.6 2000/02/12 03:40:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mi.h,v 3.7.2.1 2001/05/25 18:50:12 dawes Exp $ */ #ifndef MI_H #define MI_H @@ -218,7 +218,7 @@ #endif ); -extern int mieqProcessInputEvents( +extern void mieqProcessInputEvents( #if NeedFunctionPrototypes void #endif Index: xc/programs/Xserver/mi/miarc.c diff -u xc/programs/Xserver/mi/miarc.c:3.7 xc/programs/Xserver/mi/miarc.c:3.8 --- xc/programs/Xserver/mi/miarc.c:3.7 Sun Dec 26 19:39:56 1999 +++ xc/programs/Xserver/mi/miarc.c Wed Jan 17 17:37:05 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/miarc.c,v 3.7 1999/12/27 00:39:56 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miarc.c,v 3.8 2001/01/17 22:37:05 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: miarc.c /main/91 1998/02/09 14:45:57 kaleb $ */ +/* $Xorg: miarc.c,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ /* Author: Keith Packard and Bob Scheifler */ /* Warning: this code is toxic, do not dally very long here. */ Index: xc/programs/Xserver/mi/mibank.c diff -u xc/programs/Xserver/mi/mibank.c:1.8 xc/programs/Xserver/mi/mibank.c:1.9 --- xc/programs/Xserver/mi/mibank.c:1.8 Fri Feb 18 07:20:10 2000 +++ xc/programs/Xserver/mi/mibank.c Sat Jan 6 15:58:12 2001 @@ -1,5 +1,5 @@ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -44,7 +44,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/mi/mibank.c,v 1.8 2000/02/18 12:20:10 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibank.c,v 1.9 2001/01/06 20:58:12 tsi Exp $ */ /* * This thing originated from an idea of Edwin Goei and his bank switching @@ -53,7 +53,7 @@ /* * Heavily modified for the XFree86 Project to turn this into an mi wrapper. - * --- Marc Aurele La France (tsi@ualberta.ca) + * --- Marc Aurele La France (tsi@xfree86.org) */ /* Index: xc/programs/Xserver/mi/mibank.h diff -u xc/programs/Xserver/mi/mibank.h:1.6 xc/programs/Xserver/mi/mibank.h:1.7 --- xc/programs/Xserver/mi/mibank.h:1.6 Fri Feb 18 07:20:12 2000 +++ xc/programs/Xserver/mi/mibank.h Sat Jan 6 15:58:12 2001 @@ -1,5 +1,5 @@ /* - * Copyright 1997 through 2000 by Marc Aurele La France (TSI @ UQV), tsi@ualberta.ca + * Copyright 1997 through 2001 by Marc Aurele La France (TSI @ UQV), tsi@xfree86.org * * Permission to use, copy, modify, distribute, and sell this software and its * documentation for any purpose is hereby granted without fee, provided that @@ -20,7 +20,7 @@ * PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/mi/mibank.h,v 1.6 2000/02/18 12:20:12 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibank.h,v 1.7 2001/01/06 20:58:12 tsi Exp $ */ #ifndef __MIBANK_H__ #define __MIBANK_H__ 1 Index: xc/programs/Xserver/mi/mibitblt.c diff -u xc/programs/Xserver/mi/mibitblt.c:3.8 xc/programs/Xserver/mi/mibitblt.c:3.9 --- xc/programs/Xserver/mi/mibitblt.c:3.8 Fri Feb 11 22:40:06 2000 +++ xc/programs/Xserver/mi/mibitblt.c Wed Jan 17 17:37:05 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/mibitblt.c,v 3.8 2000/02/12 03:40:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibitblt.c,v 3.9 2001/01/17 22:37:05 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mibitblt.c /main/56 1998/02/09 14:46:05 kaleb $ */ +/* $Xorg: mibitblt.c,v 1.4 2000/08/17 19:53:36 cpqbld Exp $ */ /* Author: Todd Newman (aided and abetted by Mr. Drewry) */ #include "X.h" @@ -669,6 +669,7 @@ */ ValidateGC((DrawablePtr)pPixmap, pGC); pt.x = pt.y = 0; + width = w; (*pGC->ops->FillSpans)((DrawablePtr)pPixmap, pGC, 1, &pt, &width, TRUE); Index: xc/programs/Xserver/mi/mibstore.c diff -u xc/programs/Xserver/mi/mibstore.c:1.5 xc/programs/Xserver/mi/mibstore.c:1.6 --- xc/programs/Xserver/mi/mibstore.c:1.5 Wed Oct 13 18:33:11 1999 +++ xc/programs/Xserver/mi/mibstore.c Wed Jan 17 17:37:05 2001 @@ -1,4 +1,4 @@ -/* $TOG: mibstore.c /main/95 1998/02/09 14:46:13 kaleb $ */ +/* $Xorg: mibstore.c,v 1.3 2000/08/17 19:53:36 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -38,7 +38,7 @@ ******************************************************************/ -/* $XFree86: xc/programs/Xserver/mi/mibstore.c,v 1.5 1999/10/13 22:33:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibstore.c,v 1.6 2001/01/17 22:37:05 dawes Exp $ */ #define NEED_EVENTS #include "X.h" Index: xc/programs/Xserver/mi/mibstore.h diff -u xc/programs/Xserver/mi/mibstore.h:1.3 xc/programs/Xserver/mi/mibstore.h:1.4 --- xc/programs/Xserver/mi/mibstore.h:1.3 Sun Apr 5 12:42:31 1998 +++ xc/programs/Xserver/mi/mibstore.h Wed Jan 17 17:37:06 2001 @@ -12,11 +12,11 @@ * software for any purpose. It is provided "as is" without * express or implied warranty. * - * "$XConsortium: mibstore.h,v 5.2 93/10/12 11:41:12 dpw Exp $ SPRITE (Berkeley)" + * "$Xorg: mibstore.h,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ -/* $XFree86: xc/programs/Xserver/mi/mibstore.h,v 1.3 1998/04/05 16:42:31 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibstore.h,v 1.4 2001/01/17 22:37:06 dawes Exp $ */ #ifndef _MIBSTORE_H #define _MIBSTORE_H Index: xc/programs/Xserver/mi/mibstorest.h diff -u xc/programs/Xserver/mi/mibstorest.h:1.3 xc/programs/Xserver/mi/mibstorest.h:1.4 --- xc/programs/Xserver/mi/mibstorest.h:1.3 Sun Oct 4 05:39:25 1998 +++ xc/programs/Xserver/mi/mibstorest.h Wed Jan 17 17:37:06 2001 @@ -4,7 +4,7 @@ * internal structure definitions for mi backing store */ -/* $TOG: mibstorest.h /main/13 1998/02/09 14:46:10 kaleb $ */ +/* $Xorg: mibstorest.h,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ /* @@ -27,7 +27,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/mibstorest.h,v 1.3 1998/10/04 09:39:25 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mibstorest.h,v 1.4 2001/01/17 22:37:06 dawes Exp $ */ #include "mibstore.h" #include "regionstr.h" Index: xc/programs/Xserver/mi/miclipn.c diff -u xc/programs/Xserver/mi/miclipn.c:1.1.1.2 xc/programs/Xserver/mi/miclipn.c:1.1.1.3 --- xc/programs/Xserver/mi/miclipn.c:1.1.1.2 Sun Sep 27 04:03:49 1998 +++ xc/programs/Xserver/mi/miclipn.c Tue Jan 16 17:44:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: miclipn.c /main/3 1998/02/09 14:46:26 kaleb $ */ +/* $Xorg: miclipn.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group Index: xc/programs/Xserver/mi/micmap.c diff -u xc/programs/Xserver/mi/micmap.c:1.10 xc/programs/Xserver/mi/micmap.c:1.10.4.1 --- xc/programs/Xserver/mi/micmap.c:1.10 Tue Sep 19 20:09:14 2000 +++ xc/programs/Xserver/mi/micmap.c Tue May 29 18:28:23 2001 @@ -27,7 +27,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/mi/micmap.c,v 1.10 2000/09/20 00:09:14 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/micmap.c,v 1.10.4.1 2001/05/29 22:28:23 dawes Exp $ */ /* * This is based on cfbcmap.c. The functions here are useful independently @@ -447,7 +447,7 @@ return SMALL_VISUALS; } -Bool +static Bool miVisualTypesSet (int depth) { miVisualsPtr visuals; @@ -473,6 +473,7 @@ return FALSE; } } + return TRUE; } Bool Index: xc/programs/Xserver/mi/micursor.c diff -u xc/programs/Xserver/mi/micursor.c:1.1.1.2 xc/programs/Xserver/mi/micursor.c:1.1.1.3 --- xc/programs/Xserver/mi/micursor.c:1.1.1.2 Sun Sep 27 04:03:50 1998 +++ xc/programs/Xserver/mi/micursor.c Tue Jan 16 17:44:38 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: micursor.c /main/5 1998/02/09 14:46:31 kaleb $ */ +/* $Xorg: micursor.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ #include "scrnintstr.h" #include "cursor.h" #include "misc.h" Index: xc/programs/Xserver/mi/midash.c diff -u xc/programs/Xserver/mi/midash.c:1.1.1.2 xc/programs/Xserver/mi/midash.c:1.1.1.3 --- xc/programs/Xserver/mi/midash.c:1.1.1.2 Sun Sep 27 04:03:50 1998 +++ xc/programs/Xserver/mi/midash.c Tue Jan 16 17:44:39 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: midash.c /main/14 1998/02/09 14:46:34 kaleb $ */ +/* $Xorg: midash.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ #include "miscstruct.h" #include "mistruct.h" #include "mifpoly.h" Index: xc/programs/Xserver/mi/midispcur.c diff -u xc/programs/Xserver/mi/midispcur.c:1.3 xc/programs/Xserver/mi/midispcur.c:1.4 --- xc/programs/Xserver/mi/midispcur.c:1.3 Fri Nov 19 09:59:19 1999 +++ xc/programs/Xserver/mi/midispcur.c Wed Jan 17 17:37:06 2001 @@ -3,9 +3,9 @@ * * machine independent cursor display routines */ -/* $XFree86: xc/programs/Xserver/mi/midispcur.c,v 1.3 1999/11/19 14:59:19 hohndel Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/midispcur.c,v 1.4 2001/01/17 22:37:06 dawes Exp $ */ -/* $TOG: midispcur.c /main/16 1998/02/09 14:46:39 kaleb $ */ +/* $Xorg: midispcur.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ /* Index: xc/programs/Xserver/mi/mieq.c diff -u xc/programs/Xserver/mi/mieq.c:1.1.1.3 xc/programs/Xserver/mi/mieq.c:1.1.1.4.2.1 --- xc/programs/Xserver/mi/mieq.c:1.1.1.3 Sun Sep 27 04:03:51 1998 +++ xc/programs/Xserver/mi/mieq.c Fri May 25 14:50:12 2001 @@ -1,5 +1,5 @@ /* - * $TOG: mieq.c /main/9 1998/02/09 14:46:43 kaleb $ + * $Xorg: mieq.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ * Copyright 1990, 1998 The Open Group @@ -21,6 +21,7 @@ * * Author: Keith Packard, MIT X Consortium */ +/* $XFree86: xc/programs/Xserver/mi/mieq.c,v 1.1.1.4.2.1 2001/05/25 18:50:12 dawes Exp $ */ /* * mieq.c @@ -85,7 +86,7 @@ mieqEnqueue (e) xEvent *e; { - HWEventQueueType oldtail, newtail, prevtail; + HWEventQueueType oldtail, newtail; Bool isMotion; oldtail = miEventQueue.tail; @@ -135,7 +136,7 @@ * Call this from ProcessInputEvents() */ -mieqProcessInputEvents () +void mieqProcessInputEvents () { EventRec *e; int x, y; @@ -143,8 +144,6 @@ while (miEventQueue.head != miEventQueue.tail) { - extern int screenIsSaved; - if (screenIsSaved == SCREEN_SAVER_ON) SaveScreens (SCREEN_SAVER_OFF, ScreenSaverReset); Index: xc/programs/Xserver/mi/miexpose.c diff -u xc/programs/Xserver/mi/miexpose.c:3.6 xc/programs/Xserver/mi/miexpose.c:3.7 --- xc/programs/Xserver/mi/miexpose.c:3.6 Sat Jan 1 19:25:57 2000 +++ xc/programs/Xserver/mi/miexpose.c Wed Jan 17 17:37:06 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/miexpose.c,v 3.6 2000/01/02 00:25:57 mvojkovi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miexpose.c,v 3.7 2001/01/17 22:37:06 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -42,30 +42,7 @@ ******************************************************************/ -/* The panoramix components contained the following notice */ -/**************************************************************** -* * -* Copyright (c) Digital Equipment Corporation, 1991, 1997 * -* * -* All Rights Reserved. Unpublished rights reserved under * -* the copyright laws of the United States. * -* * -* The software contained on this media is proprietary to * -* and embodies the confidential technology of Digital * -* Equipment Corporation. Possession, use, duplication or * -* dissemination of the software and media is authorized only * -* pursuant to a valid written license from Digital Equipment * -* Corporation. * -* * -* RESTRICTED RIGHTS LEGEND Use, duplication, or disclosure * -* by the U.S. Government is subject to restrictions as set * -* forth in Subparagraph (c)(1)(ii) of DFARS 252.227-7013, * -* or in FAR 52.227-19, as applicable. * -* * -*****************************************************************/ - - -/* $TOG: miexpose.c /main/44 1998/02/09 14:46:47 kaleb $ */ +/* $Xorg: miexpose.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ #include "X.h" #define NEED_EVENTS Index: xc/programs/Xserver/mi/mifillarc.c diff -u xc/programs/Xserver/mi/mifillarc.c:3.4 xc/programs/Xserver/mi/mifillarc.c:3.5 --- xc/programs/Xserver/mi/mifillarc.c:3.4 Sun Apr 11 09:11:20 1999 +++ xc/programs/Xserver/mi/mifillarc.c Wed Jan 17 17:37:06 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/mifillarc.c,v 3.4 1999/04/11 13:11:20 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mifillarc.c,v 3.5 2001/01/17 22:37:06 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group @@ -23,7 +23,7 @@ ********************************************************/ -/* $TOG: mifillarc.c /main/20 1998/02/09 14:46:52 kaleb $ */ +/* $Xorg: mifillarc.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ #include <math.h> #include "X.h" Index: xc/programs/Xserver/mi/mifillarc.h diff -u xc/programs/Xserver/mi/mifillarc.h:3.3 xc/programs/Xserver/mi/mifillarc.h:3.4 --- xc/programs/Xserver/mi/mifillarc.h:3.3 Sun Oct 4 05:39:27 1998 +++ xc/programs/Xserver/mi/mifillarc.h Wed Jan 17 17:37:06 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/mifillarc.h,v 3.3 1998/10/04 09:39:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mifillarc.h,v 3.4 2001/01/17 22:37:06 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group @@ -21,7 +21,7 @@ ********************************************************/ -/* $TOG: mifillarc.h /main/11 1998/02/09 14:46:57 kaleb $ */ +/* $Xorg: mifillarc.h,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ #define FULLCIRCLE (360 * 64) Index: xc/programs/Xserver/mi/mifillrct.c diff -u xc/programs/Xserver/mi/mifillrct.c:1.1.1.2 xc/programs/Xserver/mi/mifillrct.c:1.1.1.3 --- xc/programs/Xserver/mi/mifillrct.c:1.1.1.2 Sun Sep 27 04:03:56 1998 +++ xc/programs/Xserver/mi/mifillrct.c Tue Jan 16 17:44:40 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mifillrct.c /main/6 1998/02/09 14:47:01 kaleb $ */ +/* $Xorg: mifillrct.c,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ #include "X.h" #include "Xprotostr.h" Index: xc/programs/Xserver/mi/mifpoly.h diff -u xc/programs/Xserver/mi/mifpoly.h:1.1.1.2 xc/programs/Xserver/mi/mifpoly.h:1.1.1.3 --- xc/programs/Xserver/mi/mifpoly.h:1.1.1.2 Sun Sep 27 04:03:57 1998 +++ xc/programs/Xserver/mi/mifpoly.h Tue Jan 16 17:44:41 2001 @@ -1,4 +1,4 @@ -/* $TOG: mifpoly.h /main/10 1998/02/09 14:47:09 kaleb $ */ +/* $Xorg: mifpoly.h,v 1.3 2000/08/17 19:53:37 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group Index: xc/programs/Xserver/mi/mifpolycon.c diff -u xc/programs/Xserver/mi/mifpolycon.c:1.1.1.2 xc/programs/Xserver/mi/mifpolycon.c:1.1.1.3 --- xc/programs/Xserver/mi/mifpolycon.c:1.1.1.2 Sun Sep 27 04:03:57 1998 +++ xc/programs/Xserver/mi/mifpolycon.c Tue Jan 16 17:44:41 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mifpolycon.c /main/13 1998/02/09 14:47:05 kaleb $ */ +/* $Xorg: mifpolycon.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ #include <math.h> #include "X.h" #include "gcstruct.h" Index: xc/programs/Xserver/mi/migc.c diff -u xc/programs/Xserver/mi/migc.c:1.6 xc/programs/Xserver/mi/migc.c:1.7 --- xc/programs/Xserver/mi/migc.c:1.6 Sun Dec 6 01:08:47 1998 +++ xc/programs/Xserver/mi/migc.c Wed Jan 17 17:37:06 2001 @@ -1,4 +1,4 @@ -/* $TOG: migc.c /main/6 1998/02/09 14:47:13 kaleb $ */ +/* $Xorg: migc.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ /* Copyright 1993, 1998 The Open Group @@ -23,7 +23,7 @@ */ -/* $XFree86: xc/programs/Xserver/mi/migc.c,v 1.6 1998/12/06 06:08:47 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/migc.c,v 1.7 2001/01/17 22:37:06 dawes Exp $ */ #include "scrnintstr.h" #include "gcstruct.h" Index: xc/programs/Xserver/mi/migc.h diff -u xc/programs/Xserver/mi/migc.h:1.5 xc/programs/Xserver/mi/migc.h:1.6 --- xc/programs/Xserver/mi/migc.h:1.5 Sun Oct 4 05:39:28 1998 +++ xc/programs/Xserver/mi/migc.h Wed Jan 17 17:37:06 2001 @@ -1,4 +1,4 @@ -/* $TOG: migc.h /main/5 1998/02/09 14:47:18 kaleb $ */ +/* $Xorg: migc.h,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ /* Copyright 1993, 1998 The Open Group @@ -23,7 +23,7 @@ */ -/* $XFree86: xc/programs/Xserver/mi/migc.h,v 1.5 1998/10/04 09:39:28 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/migc.h,v 1.6 2001/01/17 22:37:06 dawes Exp $ */ extern void miChangeGC( #if NeedFunctionPrototypes Index: xc/programs/Xserver/mi/miglblt.c diff -u xc/programs/Xserver/mi/miglblt.c:1.3 xc/programs/Xserver/mi/miglblt.c:1.4 --- xc/programs/Xserver/mi/miglblt.c:1.3 Sun Oct 4 05:39:29 1998 +++ xc/programs/Xserver/mi/miglblt.c Wed Jan 17 17:37:06 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/miglblt.c,v 1.3 1998/10/04 09:39:29 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miglblt.c,v 1.4 2001/01/17 22:37:06 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -42,7 +42,7 @@ ******************************************************************/ -/* $TOG: miglblt.c /main/19 1998/02/09 14:47:22 kaleb $ */ +/* $Xorg: miglblt.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ #include "X.h" #include "Xmd.h" Index: xc/programs/Xserver/mi/miinitext.c diff -u xc/programs/Xserver/mi/miinitext.c:3.53.2.1 xc/programs/Xserver/mi/miinitext.c:3.57 --- xc/programs/Xserver/mi/miinitext.c:3.53.2.1 Thu Mar 15 23:58:42 2001 +++ xc/programs/Xserver/mi/miinitext.c Thu May 10 06:17:39 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.53.2.1 2001/03/16 04:58:42 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miinitext.c,v 3.57 2001/05/10 10:17:39 alanh Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: miinitext.c /main/47 1998/02/09 14:47:26 kaleb $ */ +/* $Xorg: miinitext.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ #include "misc.h" #include "extension.h" @@ -153,6 +153,7 @@ #endif #ifdef XV extern void XvExtensionInit(INITARGS); +extern void XvMCExtensionInit(INITARGS); #endif #ifdef XIE extern void XieInit(INITARGS); @@ -276,6 +277,7 @@ #endif #ifdef XV XvExtensionInit(); + XvMCExtensionInit(); #endif #ifdef XIE XieInit(); @@ -474,8 +476,8 @@ int argc; char *argv[]; { - int i, j, k, numExts, ii; - ExtensionModule *ext, *newList; + int i; + ExtensionModule *ext; static Bool listInitialised = FALSE; if (!listInitialised) { Index: xc/programs/Xserver/mi/miline.h diff -u xc/programs/Xserver/mi/miline.h:1.4 xc/programs/Xserver/mi/miline.h:1.5 --- xc/programs/Xserver/mi/miline.h:1.4 Wed Oct 13 18:33:11 1999 +++ xc/programs/Xserver/mi/miline.h Wed Jan 17 17:37:06 2001 @@ -1,4 +1,4 @@ -/* $TOG: miline.h /main/7 1998/02/09 14:47:30 kaleb $ */ +/* $Xorg: miline.h,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ /* @@ -21,7 +21,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/miline.h,v 1.4 1999/10/13 22:33:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miline.h,v 1.5 2001/01/17 22:37:06 dawes Exp $ */ #ifndef MILINE_H Index: xc/programs/Xserver/mi/mioverlay.c diff -u xc/programs/Xserver/mi/mioverlay.c:3.8 xc/programs/Xserver/mi/mioverlay.c:3.10 --- xc/programs/Xserver/mi/mioverlay.c:3.8 Wed Jun 7 18:03:15 2000 +++ xc/programs/Xserver/mi/mioverlay.c Sat Apr 14 17:15:26 2001 @@ -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 @@ UnrealizeWindowProcPtr UnrealizeWindow; RealizeWindowProcPtr RealizeWindow; miOverlayTransFunc MakeTransparent; - int overlayDepth; + miOverlayInOverlayFunc InOverlay; Bool underlayMarked; Bool copyUnderlay; } miOverlayScreenRec, *miOverlayScreenPtr; @@ -90,9 +90,6 @@ #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 @@ 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 @@ pScreen->devPrivates[miOverlayScreenIndex].ptr = (pointer)pScreenPriv; - pScreenPriv->overlayDepth = overlayDepth; + pScreenPriv->InOverlay = inOverlayFunc; pScreenPriv->MakeTransparent = transFunc; pScreenPriv->underlayMarked = FALSE; @@ -169,10 +166,10 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ 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 @@ /* 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 Index: xc/programs/Xserver/mi/mioverlay.h diff -u xc/programs/Xserver/mi/mioverlay.h:3.3 xc/programs/Xserver/mi/mioverlay.h:3.4 --- xc/programs/Xserver/mi/mioverlay.h:3.3 Mon Feb 28 19:16:03 2000 +++ xc/programs/Xserver/mi/mioverlay.h Sat Apr 14 17:15:26 2001 @@ -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 ); Index: xc/programs/Xserver/mi/mipointer.c diff -u xc/programs/Xserver/mi/mipointer.c:3.5 xc/programs/Xserver/mi/mipointer.c:3.7 --- xc/programs/Xserver/mi/mipointer.c:3.5 Sat Dec 5 09:40:28 1998 +++ xc/programs/Xserver/mi/mipointer.c Thu Apr 19 10:14:07 2001 @@ -2,7 +2,7 @@ * mipointer.c */ -/* $TOG: mipointer.c /main/26 1998/02/09 14:47:34 kaleb $ */ +/* $Xorg: mipointer.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ /* @@ -24,7 +24,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/mipointer.c,v 3.5 1998/12/05 14:40:28 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 @@ 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 @@ { ScreenPtr pScreen; miPointerScreenPtr pScreenPriv; + CursorPtr pCursor; int x, y, devx, devy; pScreen = miPointer.pScreen; @@ -344,9 +346,10 @@ */ 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; Index: xc/programs/Xserver/mi/mipointer.h diff -u xc/programs/Xserver/mi/mipointer.h:3.5 xc/programs/Xserver/mi/mipointer.h:3.7 --- xc/programs/Xserver/mi/mipointer.h:3.5 Sat Dec 5 09:40:28 1998 +++ xc/programs/Xserver/mi/mipointer.h Sun Mar 25 00:32:15 2001 @@ -3,7 +3,7 @@ * */ -/* $TOG: mipointer.h /main/10 1998/02/09 14:47:38 kaleb $ */ +/* $Xorg: mipointer.h,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ /* @@ -25,10 +25,13 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/mipointer.h,v 3.5 1998/12/05 14:40:28 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mipointer.h,v 3.7 2001/03/25 05:32:15 tsi Exp $ */ #ifndef MIPOINTER_H #define MIPOINTER_H + +#include "cursor.h" +#include "input.h" typedef struct _miPointerSpriteFuncRec { Bool (*RealizeCursor)( Index: xc/programs/Xserver/mi/mipointrst.h diff -u xc/programs/Xserver/mi/mipointrst.h:1.1.1.2 xc/programs/Xserver/mi/mipointrst.h:1.3 --- xc/programs/Xserver/mi/mipointrst.h:1.1.1.2 Sun Sep 27 04:04:02 1998 +++ xc/programs/Xserver/mi/mipointrst.h Thu Apr 19 10:14:07 2001 @@ -3,7 +3,7 @@ * */ -/* $TOG: mipointrst.h /main/10 1998/02/09 14:47:42 kaleb $ */ +/* $Xorg: mipointrst.h,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ /* @@ -25,9 +25,10 @@ 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.3 2001/04/19 14:14:07 tsi Exp $ */ -# include <mipointer.h> -# include <input.h> +#include "mipointer.h" +#include "scrnintstr.h" #define MOTION_SIZE 256 @@ -55,4 +56,5 @@ miPointerScreenFuncPtr screenFuncs; /* screen-specific methods */ CloseScreenProcPtr CloseScreen; Bool waitForUpdate; /* don't move cursor in SIGIO */ + Bool showTransparent; /* show empty cursors */ } miPointerScreenRec, *miPointerScreenPtr; Index: xc/programs/Xserver/mi/mipoly.c diff -u xc/programs/Xserver/mi/mipoly.c:1.1.1.2 xc/programs/Xserver/mi/mipoly.c:1.1.1.3 --- xc/programs/Xserver/mi/mipoly.c:1.1.1.2 Sun Sep 27 04:04:03 1998 +++ xc/programs/Xserver/mi/mipoly.c Tue Jan 16 17:44:43 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mipoly.c /main/5 1998/02/09 14:48:16 kaleb $ */ +/* $Xorg: mipoly.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ /* * mipoly.c * Index: xc/programs/Xserver/mi/mipoly.h diff -u xc/programs/Xserver/mi/mipoly.h:1.1.1.2 xc/programs/Xserver/mi/mipoly.h:1.1.1.3 --- xc/programs/Xserver/mi/mipoly.h:1.1.1.2 Sun Sep 27 04:04:03 1998 +++ xc/programs/Xserver/mi/mipoly.h Tue Jan 16 17:44:43 2001 @@ -1,4 +1,4 @@ -/* $TOG: mipoly.h /main/6 1998/02/09 14:48:20 kaleb $ */ +/* $Xorg: mipoly.h,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group Index: xc/programs/Xserver/mi/mipolycon.c diff -u xc/programs/Xserver/mi/mipolycon.c:1.1.1.2 xc/programs/Xserver/mi/mipolycon.c:1.1.1.3 --- xc/programs/Xserver/mi/mipolycon.c:1.1.1.2 Sun Sep 27 04:04:04 1998 +++ xc/programs/Xserver/mi/mipolycon.c Tue Jan 16 17:44:44 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mipolycon.c /main/8 1998/02/09 14:47:47 kaleb $ */ +/* $Xorg: mipolycon.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ #include "gcstruct.h" #include "pixmap.h" #include "miscanfill.h" Index: xc/programs/Xserver/mi/mipolygen.c diff -u xc/programs/Xserver/mi/mipolygen.c:1.1.1.2 xc/programs/Xserver/mi/mipolygen.c:1.1.1.3 --- xc/programs/Xserver/mi/mipolygen.c:1.1.1.2 Sun Sep 27 04:04:04 1998 +++ xc/programs/Xserver/mi/mipolygen.c Tue Jan 16 17:44:44 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mipolygen.c /main/9 1998/02/09 14:47:51 kaleb $ */ +/* $Xorg: mipolygen.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ #include "X.h" #include "gcstruct.h" #include "miscanfill.h" Index: xc/programs/Xserver/mi/mipolypnt.c diff -u xc/programs/Xserver/mi/mipolypnt.c:1.1.1.2 xc/programs/Xserver/mi/mipolypnt.c:1.1.1.3 --- xc/programs/Xserver/mi/mipolypnt.c:1.1.1.2 Sun Sep 27 04:04:05 1998 +++ xc/programs/Xserver/mi/mipolypnt.c Tue Jan 16 17:44:44 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mipolypnt.c /main/7 1998/02/09 14:47:55 kaleb $ */ +/* $Xorg: mipolypnt.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ #include "X.h" #include "Xprotostr.h" #include "pixmapstr.h" Index: xc/programs/Xserver/mi/mipolyrect.c diff -u xc/programs/Xserver/mi/mipolyrect.c:1.1.1.2 xc/programs/Xserver/mi/mipolyrect.c:1.1.1.3 --- xc/programs/Xserver/mi/mipolyrect.c:1.1.1.2 Sun Sep 27 04:04:05 1998 +++ xc/programs/Xserver/mi/mipolyrect.c Tue Jan 16 17:44:44 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mipolyrect.c /main/12 1998/02/09 14:47:59 kaleb $ */ +/* $Xorg: mipolyrect.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" Index: xc/programs/Xserver/mi/mipolyseg.c diff -u xc/programs/Xserver/mi/mipolyseg.c:1.1.1.2 xc/programs/Xserver/mi/mipolyseg.c:1.1.1.3 --- xc/programs/Xserver/mi/mipolyseg.c:1.1.1.2 Sun Sep 27 04:04:06 1998 +++ xc/programs/Xserver/mi/mipolyseg.c Tue Jan 16 17:44:44 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mipolyseg.c /main/5 1998/02/09 14:48:03 kaleb $ */ +/* $Xorg: mipolyseg.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ #include "X.h" #include "Xprotostr.h" #include "miscstruct.h" Index: xc/programs/Xserver/mi/mipolytext.c diff -u xc/programs/Xserver/mi/mipolytext.c:1.1.1.2 xc/programs/Xserver/mi/mipolytext.c:1.1.1.3 --- xc/programs/Xserver/mi/mipolytext.c:1.1.1.2 Sun Sep 27 04:04:06 1998 +++ xc/programs/Xserver/mi/mipolytext.c Tue Jan 16 17:44:45 2001 @@ -40,7 +40,7 @@ SOFTWARE. ************************************************************************/ -/* $TOG: mipolytext.c /main/13 1998/02/09 14:48:08 kaleb $ */ +/* $Xorg: mipolytext.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ /* * mipolytext.c - text routines * Index: xc/programs/Xserver/mi/mipolyutil.c diff -u xc/programs/Xserver/mi/mipolyutil.c:1.7 xc/programs/Xserver/mi/mipolyutil.c:1.8 --- xc/programs/Xserver/mi/mipolyutil.c:1.7 Sun Oct 4 05:39:31 1998 +++ xc/programs/Xserver/mi/mipolyutil.c Wed Jan 17 17:37:07 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/mipolyutil.c,v 1.7 1998/10/04 09:39:31 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mipolyutil.c,v 1.8 2001/01/17 22:37:07 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mipolyutil.c /main/6 1998/02/09 14:48:12 kaleb $ */ +/* $Xorg: mipolyutil.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ #include "miscstruct.h" #include "gc.h" #include "miscanfill.h" Index: xc/programs/Xserver/mi/mipushpxl.c diff -u xc/programs/Xserver/mi/mipushpxl.c:3.10 xc/programs/Xserver/mi/mipushpxl.c:3.11 --- xc/programs/Xserver/mi/mipushpxl.c:3.10 Fri Feb 11 22:40:06 2000 +++ xc/programs/Xserver/mi/mipushpxl.c Wed Jan 17 17:37:07 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/mipushpxl.c,v 3.10 2000/02/12 03:40:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mipushpxl.c,v 3.11 2001/01/17 22:37:07 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mipushpxl.c /main/12 1998/02/09 14:48:25 kaleb $ */ +/* $Xorg: mipushpxl.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ #include "X.h" #include "gcstruct.h" #include "scrnintstr.h" Index: xc/programs/Xserver/mi/miregion.c diff -u xc/programs/Xserver/mi/miregion.c:1.5 xc/programs/Xserver/mi/miregion.c:1.6 --- xc/programs/Xserver/mi/miregion.c:1.5 Wed Oct 13 18:33:11 1999 +++ xc/programs/Xserver/mi/miregion.c Wed Jan 17 17:37:07 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/miregion.c,v 1.5 1999/10/13 22:33:11 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miregion.c,v 1.6 2001/01/17 22:37:07 dawes Exp $ */ /*********************************************************** Copyright 1987, 1988, 1989, 1998 The Open Group @@ -42,6 +42,7 @@ SOFTWARE. ******************************************************************/ +/* $Xorg: miregion.c,v 1.3 2000/08/17 19:53:38 cpqbld Exp $ */ /* The panoramix components contained the following notice */ /**************************************************************** @@ -64,8 +65,6 @@ * or in FAR 52.227-19, as applicable. * * * *****************************************************************/ - -/* $TOG: miregion.c /main/40 1998/02/09 14:48:29 kaleb $ */ #include "miscstruct.h" #include "regionstr.h" Index: xc/programs/Xserver/mi/miscanfill.h diff -u xc/programs/Xserver/mi/miscanfill.h:1.1.1.2 xc/programs/Xserver/mi/miscanfill.h:1.1.1.3 --- xc/programs/Xserver/mi/miscanfill.h:1.1.1.2 Sun Sep 27 04:04:09 1998 +++ xc/programs/Xserver/mi/miscanfill.h Tue Jan 16 17:44:46 2001 @@ -1,4 +1,4 @@ -/* $TOG: miscanfill.h /main/6 1998/02/09 14:48:35 kaleb $ */ +/* $Xorg: miscanfill.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group Index: xc/programs/Xserver/mi/miscrinit.c diff -u xc/programs/Xserver/mi/miscrinit.c:3.12 xc/programs/Xserver/mi/miscrinit.c:3.13 --- xc/programs/Xserver/mi/miscrinit.c:3.12 Fri Aug 25 20:23:19 2000 +++ xc/programs/Xserver/mi/miscrinit.c Wed Jan 17 17:37:07 2001 @@ -1,4 +1,4 @@ -/* $TOG: miscrinit.c /main/14 1998/02/09 14:48:39 kaleb $ */ +/* $Xorg: miscrinit.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/miscrinit.c,v 3.12 2000/08/26 00:23:19 keithp Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miscrinit.c,v 3.13 2001/01/17 22:37:07 dawes Exp $ */ #include "X.h" #include "servermd.h" Index: xc/programs/Xserver/mi/mispans.c diff -u xc/programs/Xserver/mi/mispans.c:3.1 xc/programs/Xserver/mi/mispans.c:3.2 --- xc/programs/Xserver/mi/mispans.c:3.1 Sun Oct 4 05:39:33 1998 +++ xc/programs/Xserver/mi/mispans.c Wed Jan 17 17:37:07 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/mispans.c,v 3.1 1998/10/04 09:39:33 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mispans.c,v 3.2 2001/01/17 22:37:07 dawes Exp $ */ /*********************************************************** Copyright 1989, 1998 The Open Group @@ -42,7 +42,7 @@ ******************************************************************/ -/* $TOG: mispans.c /main/7 1998/02/09 14:48:44 kaleb $ */ +/* $Xorg: mispans.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ #include "misc.h" #include "pixmapstr.h" Index: xc/programs/Xserver/mi/mispans.h diff -u xc/programs/Xserver/mi/mispans.h:1.1.1.2 xc/programs/Xserver/mi/mispans.h:1.1.1.3 --- xc/programs/Xserver/mi/mispans.h:1.1.1.2 Sun Sep 27 04:04:11 1998 +++ xc/programs/Xserver/mi/mispans.h Tue Jan 16 17:44:47 2001 @@ -41,7 +41,7 @@ ******************************************************************/ -/* $TOG: mispans.h /main/5 1998/02/09 14:48:48 kaleb $ */ +/* $Xorg: mispans.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ typedef struct { int count; /* number of spans */ Index: xc/programs/Xserver/mi/misprite.c diff -u xc/programs/Xserver/mi/misprite.c:3.5 xc/programs/Xserver/mi/misprite.c:3.6 --- xc/programs/Xserver/mi/misprite.c:3.5 Thu Nov 16 14:45:06 2000 +++ xc/programs/Xserver/mi/misprite.c Wed Jan 17 17:37:07 2001 @@ -4,7 +4,7 @@ * machine independent software sprite routines */ -/* $TOG: misprite.c /main/49 1998/02/09 14:48:56 kaleb $ */ +/* $Xorg: misprite.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ /* @@ -26,7 +26,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/misprite.c,v 3.5 2000/11/16 19:45:06 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/misprite.c,v 3.6 2001/01/17 22:37:07 dawes Exp $ */ # include "X.h" # include "Xproto.h" Index: xc/programs/Xserver/mi/misprite.h diff -u xc/programs/Xserver/mi/misprite.h:1.1.1.2 xc/programs/Xserver/mi/misprite.h:1.1.1.3 --- xc/programs/Xserver/mi/misprite.h:1.1.1.2 Sun Sep 27 04:04:12 1998 +++ xc/programs/Xserver/mi/misprite.h Tue Jan 16 17:44:48 2001 @@ -6,7 +6,7 @@ * mi versions of these routines exist. */ -/* $TOG: misprite.h /main/8 1998/02/09 14:49:03 kaleb $ */ +/* $Xorg: misprite.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ /* Index: xc/programs/Xserver/mi/mispritest.h diff -u xc/programs/Xserver/mi/mispritest.h:1.3 xc/programs/Xserver/mi/mispritest.h:1.4 --- xc/programs/Xserver/mi/mispritest.h:1.3 Tue Oct 10 10:05:49 2000 +++ xc/programs/Xserver/mi/mispritest.h Wed Jan 17 17:37:07 2001 @@ -4,7 +4,7 @@ * mi sprite structures */ -/* $TOG: mispritest.h /main/17 1998/02/09 14:48:52 kaleb $ */ +/* $Xorg: mispritest.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ /* @@ -26,7 +26,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/mispritest.h,v 1.3 2000/10/10 14:05:49 tsi Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mispritest.h,v 1.4 2001/01/17 22:37:07 dawes Exp $ */ # include "misprite.h" #ifdef RENDER Index: xc/programs/Xserver/mi/mistruct.h diff -u xc/programs/Xserver/mi/mistruct.h:1.1.1.2 xc/programs/Xserver/mi/mistruct.h:1.1.1.3 --- xc/programs/Xserver/mi/mistruct.h:1.1.1.2 Sun Sep 27 04:04:13 1998 +++ xc/programs/Xserver/mi/mistruct.h Tue Jan 16 17:44:48 2001 @@ -1,4 +1,4 @@ -/* $TOG: mistruct.h /main/4 1998/02/09 14:49:07 kaleb $ */ +/* $Xorg: mistruct.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group Index: xc/programs/Xserver/mi/mivalidate.h diff -u xc/programs/Xserver/mi/mivalidate.h:1.1.1.2 xc/programs/Xserver/mi/mivalidate.h:1.1.1.3 --- xc/programs/Xserver/mi/mivalidate.h:1.1.1.2 Sun Sep 27 04:04:14 1998 +++ xc/programs/Xserver/mi/mivalidate.h Tue Jan 16 17:44:48 2001 @@ -1,4 +1,4 @@ -/* $TOG: mivalidate.h /main/4 1998/02/09 14:49:11 kaleb $ */ +/* $Xorg: mivalidate.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ /* Copyright 1993, 1998 The Open Group Index: xc/programs/Xserver/mi/mivaltree.c diff -u xc/programs/Xserver/mi/mivaltree.c:1.6 xc/programs/Xserver/mi/mivaltree.c:1.7 --- xc/programs/Xserver/mi/mivaltree.c:1.6 Wed Oct 13 18:33:12 1999 +++ xc/programs/Xserver/mi/mivaltree.c Wed Jan 17 17:37:07 2001 @@ -1,4 +1,4 @@ -/* $TOG: mivaltree.c /main/52 1998/02/09 14:49:15 kaleb $ */ +/* $Xorg: mivaltree.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ /* * mivaltree.c -- * Functions for recalculating window clip lists. Main function @@ -69,7 +69,7 @@ * * *****************************************************************/ -/* $XFree86: xc/programs/Xserver/mi/mivaltree.c,v 1.6 1999/10/13 22:33:12 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mivaltree.c,v 1.7 2001/01/17 22:37:07 dawes Exp $ */ /* * Aug '86: Susan Angebranndt -- original code Index: xc/programs/Xserver/mi/miwideline.c diff -u xc/programs/Xserver/mi/miwideline.c:1.7 xc/programs/Xserver/mi/miwideline.c:1.8 --- xc/programs/Xserver/mi/miwideline.c:1.7 Wed Oct 13 18:33:13 1999 +++ xc/programs/Xserver/mi/miwideline.c Wed Jan 17 17:37:07 2001 @@ -1,4 +1,4 @@ -/* $TOG: miwideline.c /main/60 1998/03/07 17:40:23 kaleb $ */ +/* $Xorg: miwideline.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/miwideline.c,v 1.7 1999/10/13 22:33:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miwideline.c,v 1.8 2001/01/17 22:37:07 dawes Exp $ */ /* Author: Keith Packard, MIT X Consortium */ Index: xc/programs/Xserver/mi/miwideline.h diff -u xc/programs/Xserver/mi/miwideline.h:1.7 xc/programs/Xserver/mi/miwideline.h:1.9 --- xc/programs/Xserver/mi/miwideline.h:1.7 Sun Oct 4 05:39:35 1998 +++ xc/programs/Xserver/mi/miwideline.h Thu Apr 5 13:42:35 2001 @@ -1,4 +1,4 @@ -/* $TOG: miwideline.h /main/12 1998/02/09 14:49:26 kaleb $ */ +/* $Xorg: miwideline.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/mi/miwideline.h,v 1.7 1998/10/04 09:39:35 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miwideline.h,v 1.9 2001/04/05 17:42:35 dawes Exp $ */ /* Author: Keith Packard, MIT X Consortium */ @@ -154,8 +154,7 @@ #define ICEIL(x) ((int)ceil(x)) #else #ifdef __GNUC__ -static __inline int ICEIL(x) - double x; +static __inline int ICEIL(double x) { int _cTmp = x; return ((x == _cTmp) || (x < 0.0)) ? _cTmp : _cTmp+1; Index: xc/programs/Xserver/mi/miwindow.c diff -u xc/programs/Xserver/mi/miwindow.c:1.3 xc/programs/Xserver/mi/miwindow.c:1.4 --- xc/programs/Xserver/mi/miwindow.c:1.3 Wed Oct 13 18:33:13 1999 +++ xc/programs/Xserver/mi/miwindow.c Wed Jan 17 17:37:07 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/miwindow.c,v 1.3 1999/10/13 22:33:13 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/miwindow.c,v 1.4 2001/01/17 22:37:07 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: miwindow.c /main/23 1998/02/09 14:49:30 kaleb $ */ +/* $Xorg: miwindow.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ #include "X.h" #include "miscstruct.h" #include "region.h" Index: xc/programs/Xserver/mi/mizerarc.c diff -u xc/programs/Xserver/mi/mizerarc.c:1.3 xc/programs/Xserver/mi/mizerarc.c:1.4 --- xc/programs/Xserver/mi/mizerarc.c:1.3 Tue Feb 29 20:04:22 2000 +++ xc/programs/Xserver/mi/mizerarc.c Wed Jan 17 17:37:08 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/mizerarc.c,v 1.3 2000/03/01 01:04:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mizerarc.c,v 1.4 2001/01/17 22:37:08 dawes Exp $ */ /************************************************************ Copyright 1989, 1998 The Open Group @@ -23,7 +23,7 @@ ********************************************************/ -/* $TOG: mizerarc.c /main/38 1998/02/09 14:49:36 kaleb $ */ +/* $Xorg: mizerarc.c,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ /* Derived from: * "Algorithm for drawing ellipses or hyperbolae with a digital plotter" Index: xc/programs/Xserver/mi/mizerarc.h diff -u xc/programs/Xserver/mi/mizerarc.h:1.1.1.2 xc/programs/Xserver/mi/mizerarc.h:1.1.1.3 --- xc/programs/Xserver/mi/mizerarc.h:1.1.1.2 Sun Sep 27 04:04:25 1998 +++ xc/programs/Xserver/mi/mizerarc.h Tue Jan 16 17:44:52 2001 @@ -20,7 +20,7 @@ ********************************************************/ -/* $TOG: mizerarc.h /main/15 1998/02/09 14:49:41 kaleb $ */ +/* $Xorg: mizerarc.h,v 1.3 2000/08/17 19:53:39 cpqbld Exp $ */ typedef struct { int x; Index: xc/programs/Xserver/mi/mizerline.c diff -u xc/programs/Xserver/mi/mizerline.c:3.4 xc/programs/Xserver/mi/mizerline.c:3.5 --- xc/programs/Xserver/mi/mizerline.c:3.4 Thu Oct 14 00:43:16 1999 +++ xc/programs/Xserver/mi/mizerline.c Wed Jan 17 17:37:08 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/mi/mizerline.c,v 3.4 1999/10/14 04:43:16 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/mi/mizerline.c,v 3.5 2001/01/17 22:37:08 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: mizerline.c /main/18 1998/02/09 14:49:45 kaleb $ */ +/* $Xorg: mizerline.c,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ */ #include "X.h" #include "misc.h" Index: xc/programs/Xserver/miext/shadow/Imakefile diff -u xc/programs/Xserver/miext/shadow/Imakefile:1.3 xc/programs/Xserver/miext/shadow/Imakefile:1.4 --- xc/programs/Xserver/miext/shadow/Imakefile:1.3 Tue Sep 12 15:40:13 2000 +++ xc/programs/Xserver/miext/shadow/Imakefile Sun Jan 21 16:19:39 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/miext/shadow/Imakefile,v 1.3 2000/09/12 19:40:13 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/miext/shadow/Imakefile,v 1.4 2001/01/21 21:19:39 tsi Exp $ XCOMM XCOMM @@ -32,13 +32,9 @@ shrot16pack.o \ shrot32pack.o -#if BuildRender -RENDERINCS=-I../../render -I$(EXTINCSRC) -#endif - INCLUDES = -I. -I../../mi -I../../fb -I../../include -I$(XINCLUDESRC) \ -I$(FONTINCSRC) -I$(XF86SRC)/common $(EXTRAINCLUDES) \ - $(RENDERINCS) + -I../../render -I$(EXTINCSRC) LINTLIBS = ../../dix/llib-ldix.ln ../../os/llib-los.ln \ ../../mi/llib-lmi.ln Index: xc/programs/Xserver/miext/shadow/shadow.c diff -u xc/programs/Xserver/miext/shadow/shadow.c:1.4 xc/programs/Xserver/miext/shadow/shadow.c:1.5 --- xc/programs/Xserver/miext/shadow/shadow.c:1.4 Fri Dec 8 16:42:04 2000 +++ xc/programs/Xserver/miext/shadow/shadow.c Sun Jan 21 16:19:39 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/miext/shadow/shadow.c,v 1.4 2000/12/08 21:42:04 keithp Exp $ + * $XFree86: xc/programs/Xserver/miext/shadow/shadow.c,v 1.5 2001/01/21 21:19:39 tsi Exp $ * * Copyright © 2000 Keith Packard * @@ -34,9 +34,6 @@ #include "globals.h" #include "gcstruct.h" #include "shadow.h" -#ifdef RENDER -#include "picturestr.h" -#endif typedef struct _shadowGCPriv { GCOps *ops; Index: xc/programs/Xserver/os/Imakefile diff -u xc/programs/Xserver/os/Imakefile:3.28 xc/programs/Xserver/os/Imakefile:3.31 --- xc/programs/Xserver/os/Imakefile:3.28 Thu Nov 30 18:30:06 2000 +++ xc/programs/Xserver/os/Imakefile Mon Apr 23 12:17:12 2001 @@ -1,5 +1,10 @@ -XCOMM $TOG: Imakefile /main/85 1997/12/07 18:26:23 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.28 2000/11/30 23:30:06 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/Xserver/os/Imakefile,v 3.31 2001/04/23 16:17:12 tsi Exp $ + #include <Server.tmpl> /* @@ -102,9 +107,7 @@ #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 @@ -113,7 +116,7 @@ #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 Index: xc/programs/Xserver/os/WaitFor.c diff -u xc/programs/Xserver/os/WaitFor.c:3.26 xc/programs/Xserver/os/WaitFor.c:3.30 --- xc/programs/Xserver/os/WaitFor.c:3.26 Thu Aug 31 15:03:59 2000 +++ xc/programs/Xserver/os/WaitFor.c Fri Apr 27 08:51:07 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/WaitFor.c,v 3.26 2000/08/31 19:03:59 tsi 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 @@ -42,7 +42,7 @@ ******************************************************************/ -/* $TOG: WaitFor.c /main/58 1998/02/09 15:13:07 kaleb $ */ +/* $Xorg: WaitFor.c,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ */ /***************************************************************** * OS Dependent input routines: @@ -73,8 +73,8 @@ #ifdef __EMX__ #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) #endif -#include <X11/Xpoll.h> #include "osdep.h" +#include <X11/Xpoll.h> #include "dixstruct.h" #include "opaque.h" @@ -144,9 +144,6 @@ { int i; struct timeval waittime, *wt; -#ifdef __CYGWIN__ - struct timeval waittime0, *wt0; -#endif INT32 timeout; #ifdef DPMSExtension INT32 standbyTimeout, suspendTimeout, offTimeout; @@ -242,11 +239,7 @@ #endif /* DPMSExtension */ if ( -#ifndef __CYGWIN__ timeout <= 0 -#else - timeout = 0 -#endif #ifdef DPMSExtension && ScreenSaverTime > 0 #endif /* DPMSExtension */ @@ -346,10 +339,6 @@ #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); } @@ -364,14 +353,7 @@ } 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); Index: xc/programs/Xserver/os/access.c diff -u xc/programs/Xserver/os/access.c:3.31 xc/programs/Xserver/os/access.c:3.32 --- xc/programs/Xserver/os/access.c:3.31 Sun Dec 26 19:39:57 1999 +++ xc/programs/Xserver/os/access.c Wed Jan 17 17:37:10 2001 @@ -1,4 +1,4 @@ -/* $TOG: access.c /main/72 1998/04/22 16:31:03 msr $ */ +/* $Xorg: access.c,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/os/access.c,v 3.31 1999/12/27 00:39:57 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/os/access.c,v 3.32 2001/01/17 22:37:10 dawes Exp $ */ #ifdef WIN32 #include <X11/Xwinsock.h> Index: xc/programs/Xserver/os/auth.c diff -u xc/programs/Xserver/os/auth.c:1.5 xc/programs/Xserver/os/auth.c:1.6 --- xc/programs/Xserver/os/auth.c:1.5 Fri Aug 4 12:13:44 2000 +++ xc/programs/Xserver/os/auth.c Wed Jan 17 17:37:10 2001 @@ -1,4 +1,4 @@ -/* $TOG: auth.c /main/28 1998/02/09 15:11:49 kaleb $ */ +/* $Xorg: auth.c,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/auth.c,v 1.5 2000/08/04 16:13:44 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/os/auth.c,v 1.6 2001/01/17 22:37:10 dawes Exp $ */ /* * authorization hooks for the server Index: xc/programs/Xserver/os/connection.c diff -u xc/programs/Xserver/os/connection.c:3.43 xc/programs/Xserver/os/connection.c:3.46 --- xc/programs/Xserver/os/connection.c:3.43 Tue Sep 19 08:46:22 2000 +++ xc/programs/Xserver/os/connection.c Fri Apr 27 08:51:07 2001 @@ -1,4 +1,4 @@ -/* $TOG: connection.c /main/159 1998/02/09 15:11:54 kaleb $ */ +/* $Xorg: connection.c,v 1.5 2000/08/17 19:53:40 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1989, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/Xserver/os/connection.c,v 3.43 2000/09/19 12:46:22 eich 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 @@ #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 @@ #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 @@ #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 @@ -148,8 +146,8 @@ #endif #endif /* WIN32 */ #include "misc.h" /* for typedef of pointer */ -#include <X11/Xpoll.h> #include "osdep.h" +#include <X11/Xpoll.h> #include "opaque.h" #include "dixstruct.h" #ifdef XAPPGROUP @@ -205,7 +203,7 @@ 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 @@ 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 @@ 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 @@ 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 @@ * 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 @@ /* * See above in CreateWellKnownSockets about SIGUSR1 */ -#if !defined(WIN32) && !defined(__CYGWIN__) +#if !defined(WIN32) if (RunFromSmartParent) { if (ParentProcess > 0) { kill (ParentProcess, SIGUSR1); @@ -923,6 +921,14 @@ continue; newconn = _XSERVTransGetConnectionNumber (new_trans_conn); + + if (newconn < lastfdesc) + { + int clientid; + clientid = ConnectionTranslation[newconn]; + if(clientid && (client = clients[clientid])) + CloseDownClient(client); + } _XSERVTransSetOption(new_trans_conn, TRANS_NONBLOCKING, 1); Index: xc/programs/Xserver/os/decompress.c diff -u xc/programs/Xserver/os/decompress.c:1.3 xc/programs/Xserver/os/decompress.c:1.4 --- xc/programs/Xserver/os/decompress.c:1.3 Tue Sep 19 08:46:23 2000 +++ xc/programs/Xserver/os/decompress.c Wed Jan 17 17:37:10 2001 @@ -1,4 +1,4 @@ -/* $TOG: decompress.c /main/6 1998/02/09 15:12:01 kaleb $ */ +/* $Xorg: decompress.c,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/decompress.c,v 1.3 2000/09/19 12:46:23 eich Exp $ */ +/* $XFree86: xc/programs/Xserver/os/decompress.c,v 1.4 2001/01/17 22:37:10 dawes Exp $ */ /* * decompress - cat a compressed file Index: xc/programs/Xserver/os/hpsocket.c diff -u xc/programs/Xserver/os/hpsocket.c:1.1.1.2 xc/programs/Xserver/os/hpsocket.c:1.1.1.3 --- xc/programs/Xserver/os/hpsocket.c:1.1.1.2 Sun Sep 27 04:03:36 1998 +++ xc/programs/Xserver/os/hpsocket.c Tue Jan 16 17:44:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: hpsocket.c /main/4 1998/02/09 15:12:11 kaleb $ */ +/* $Xorg: hpsocket.c,v 1.3 2000/08/17 19:53:40 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group Index: xc/programs/Xserver/os/io.c diff -u xc/programs/Xserver/os/io.c:3.23 xc/programs/Xserver/os/io.c:3.26 --- xc/programs/Xserver/os/io.c:3.23 Thu Aug 10 13:40:40 2000 +++ xc/programs/Xserver/os/io.c Fri Apr 27 08:51:07 2001 @@ -40,7 +40,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: io.c /main/74 1998/02/09 15:12:19 kaleb $ */ +/* $Xorg: io.c,v 1.4 2000/08/17 19:53:41 cpqbld Exp $ */ /***************************************************************** * i/o functions * @@ -48,7 +48,7 @@ * InsertFakeRequest, ResetCurrentRequest * *****************************************************************/ -/* $XFree86: xc/programs/Xserver/os/io.c,v 3.23 2000/08/10 17:40:40 dawes 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> @@ -71,8 +71,8 @@ #define NEED_REPLIES #include "Xproto.h" #include "os.h" -#include "Xpoll.h" #include "osdep.h" +#include "Xpoll.h" #include "opaque.h" #include "dixstruct.h" #include "misc.h" @@ -213,7 +213,7 @@ OsCommPtr oc = (OsCommPtr)client->osPrivate; register ConnectionInputPtr oci = oc->input; int fd = oc->fd; - register int gotnow, needed; + register unsigned int gotnow, needed; int result; register xReq *request; Bool need_header; @@ -804,7 +804,7 @@ OsCommPtr oc; register ClientPtr client; Bool newoutput = NewOutputPending; -#if defined(WIN32) || defined(__CYGWIN__) +#if defined(WIN32) fd_set newOutputPending; #endif Index: xc/programs/Xserver/os/iopreader.c diff -u xc/programs/Xserver/os/iopreader.c:1.1.1.1 xc/programs/Xserver/os/iopreader.c:1.1.1.2 --- xc/programs/Xserver/os/iopreader.c:1.1.1.1 Wed Apr 27 03:13:44 1994 +++ xc/programs/Xserver/os/iopreader.c Tue Jan 16 17:44:56 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: iopreader.c,v 1.2 94/04/12 17:24:33 dpw Exp $ */ +/* $Xorg: iopreader.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ /* Copyright (c) 1987 by the Regents of the University of California * Copyright (c) 1994 by the Vrije Universiteit, Amsterdam. Index: xc/programs/Xserver/os/k5auth.c diff -u xc/programs/Xserver/os/k5auth.c:3.3 xc/programs/Xserver/os/k5auth.c:3.4 --- xc/programs/Xserver/os/k5auth.c:3.3 Sun Oct 4 05:39:43 1998 +++ xc/programs/Xserver/os/k5auth.c Wed Jan 17 17:37:10 2001 @@ -1,4 +1,4 @@ -/* $TOG: k5auth.c /main/10 1998/02/09 15:12:25 kaleb $ */ +/* $Xorg: k5auth.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ /* Copyright 1993, 1994, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/k5auth.c,v 3.3 1998/10/04 09:39:43 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/k5auth.c,v 3.4 2001/01/17 22:37:10 dawes Exp $ */ /* * Kerberos V5 authentication scheme Index: xc/programs/Xserver/os/lbxio.c diff -u xc/programs/Xserver/os/lbxio.c:3.11 xc/programs/Xserver/os/lbxio.c:3.12 --- xc/programs/Xserver/os/lbxio.c:3.11 Thu May 18 19:46:26 2000 +++ xc/programs/Xserver/os/lbxio.c Wed Jan 17 17:37:10 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/lbxio.c,v 3.11 2000/05/18 23:46:26 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/lbxio.c,v 3.12 2001/01/17 22:37:10 dawes Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -43,7 +43,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: lbxio.c /main/11 1998/02/09 15:12:30 kaleb $ */ +/* $Xorg: lbxio.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ #include <stdio.h> #include <X11/Xtrans.h> Index: xc/programs/Xserver/os/mitauth.c diff -u xc/programs/Xserver/os/mitauth.c:1.3 xc/programs/Xserver/os/mitauth.c:1.4 --- xc/programs/Xserver/os/mitauth.c:1.3 Sun Oct 11 07:23:44 1998 +++ xc/programs/Xserver/os/mitauth.c Wed Jan 17 17:37:11 2001 @@ -1,4 +1,4 @@ -/* $TOG: mitauth.c /main/12 1998/02/09 15:12:34 kaleb $ */ +/* $Xorg: mitauth.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/mitauth.c,v 1.3 1998/10/11 11:23:44 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/mitauth.c,v 1.4 2001/01/17 22:37:11 dawes Exp $ */ /* * MIT-MAGIC-COOKIE-1 authorization scheme Index: xc/programs/Xserver/os/oscolor.c diff -u xc/programs/Xserver/os/oscolor.c:3.4 xc/programs/Xserver/os/oscolor.c:3.5 --- xc/programs/Xserver/os/oscolor.c:3.4 Sun Oct 4 05:39:45 1998 +++ xc/programs/Xserver/os/oscolor.c Wed Jan 17 17:37:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/oscolor.c,v 3.4 1998/10/04 09:39:45 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/oscolor.c,v 3.5 2001/01/17 22:37:11 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: oscolor.c /main/17 1998/02/09 15:12:39 kaleb $ */ +/* $Xorg: oscolor.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ #ifndef USE_RGB_TXT Index: xc/programs/Xserver/os/osdep.h diff -u xc/programs/Xserver/os/osdep.h:3.10 xc/programs/Xserver/os/osdep.h:3.11 --- xc/programs/Xserver/os/osdep.h:3.10 Sun Dec 26 19:39:58 1999 +++ xc/programs/Xserver/os/osdep.h Wed Jan 17 17:37:11 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/osdep.h,v 3.10 1999/12/27 00:39:58 robin Exp $ */ +/* $XFree86: xc/programs/Xserver/os/osdep.h,v 3.11 2001/01/17 22:37:11 dawes Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: osdep.h /main/43 1998/02/09 15:12:43 kaleb $ */ +/* $Xorg: osdep.h,v 1.4 2000/08/17 19:53:41 cpqbld Exp $ */ #ifndef _OSDEP_H_ #define _OSDEP_H_ 1 @@ -94,7 +94,7 @@ #endif #ifndef OPEN_MAX #ifdef SVR4 -#define OPEN_MAX 128 +#define OPEN_MAX 256 #else #include <sys/param.h> #ifndef OPEN_MAX @@ -118,10 +118,10 @@ * like sysconf(_SC_OPEN_MAX) is not supported. */ -#if OPEN_MAX <= 128 +#if OPEN_MAX <= 256 #define MAXSOCKS (OPEN_MAX - 1) #else -#define MAXSOCKS 128 +#define MAXSOCKS 256 #endif /* MAXSELECT is the number of fds that select() can handle */ Index: xc/programs/Xserver/os/osinit.c diff -u xc/programs/Xserver/os/osinit.c:3.20 xc/programs/Xserver/os/osinit.c:3.22 --- xc/programs/Xserver/os/osinit.c:3.20 Thu Aug 10 13:40:40 2000 +++ xc/programs/Xserver/os/osinit.c Fri May 11 04:16:55 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.20 2000/08/10 17:40:40 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/osinit.c,v 3.22 2001/05/11 08:16:55 alanh Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $TOG: osinit.c /main/47 1998/02/09 15:12:48 kaleb $ */ +/* $Xorg: osinit.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ #include <stdio.h> #include "X.h" @@ -59,6 +59,10 @@ #else #define PATH_MAX 1024 #endif +#endif + +#if defined(Lynx) +#include <sys/wait.h> #endif #if !defined(SYSV) && !defined(AMOEBA) && !defined(_MINIX) && !defined(WIN32) && !defined(Lynx) && !defined(QNX4) Index: xc/programs/Xserver/os/rpcauth.c diff -u xc/programs/Xserver/os/rpcauth.c:3.2 xc/programs/Xserver/os/rpcauth.c:3.4 --- xc/programs/Xserver/os/rpcauth.c:3.2 Sun Dec 13 02:37:48 1998 +++ xc/programs/Xserver/os/rpcauth.c Tue Jan 30 17:06:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: rpcauth.c /main/10 1998/02/09 15:12:52 kaleb $ */ +/* $Xorg: rpcauth.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ /* Copyright 1991, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/rpcauth.c,v 3.2 1998/12/13 07:37:48 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/rpcauth.c,v 3.4 2001/01/30 22:06:21 tsi Exp $ */ /* * SUN-DES-1 authentication mechanism @@ -114,10 +114,11 @@ static XID rpc_id = (XID) ~0L; static Bool -CheckNetName (addr, len, closure) - unsigned char *addr; - int len; - pointer closure; +CheckNetName ( + unsigned char *addr, + short len, + pointer closure +) { return (len == strlen ((char *) closure) && strncmp ((char *) addr, (char *) closure, len) == 0); @@ -142,14 +143,11 @@ sprintf(rpc_error, "Unable to authenticate secure RPC client (why=%d)", why); *reason = rpc_error; } else { - if (ForEachHostInFamily (FamilyNetname, CheckNetName, - (pointer) fullname)) + if (ForEachHostInFamily (FamilyNetname, CheckNetName, fullname)) return rpc_id; - else { - sprintf(rpc_error, "Principal \"%s\" is not authorized to connect", + sprintf(rpc_error, "Principal \"%s\" is not authorized to connect", fullname); - *reason = rpc_error; - } + *reason = rpc_error; } } return (XID) ~0L; Index: xc/programs/Xserver/os/secauth.c diff -u xc/programs/Xserver/os/secauth.c:1.8 xc/programs/Xserver/os/secauth.c:1.9 --- xc/programs/Xserver/os/secauth.c:1.8 Thu Jun 15 18:10:41 2000 +++ xc/programs/Xserver/os/secauth.c Wed Jan 17 17:37:12 2001 @@ -1,4 +1,4 @@ -/* $TOG: secauth.c /main/6 1998/02/09 15:12:57 kaleb $ */ +/* $Xorg: secauth.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -20,7 +20,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/Xserver/os/secauth.c,v 1.8 2000/06/15 22:10:41 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/secauth.c,v 1.9 2001/01/17 22:37:12 dawes Exp $ */ #include "X.h" #include "os.h" Index: xc/programs/Xserver/os/utils.c diff -u xc/programs/Xserver/os/utils.c:3.67 xc/programs/Xserver/os/utils.c:3.69 --- xc/programs/Xserver/os/utils.c:3.67 Thu Nov 30 18:30:06 2000 +++ xc/programs/Xserver/os/utils.c Fri May 4 15:05:52 2001 @@ -1,4 +1,4 @@ -/* $TOG: utils.c /main/138 1998/04/22 16:32:51 msr $ */ +/* $Xorg: utils.c,v 1.3 2000/08/17 19:53:41 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -45,7 +45,7 @@ OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.67 2000/11/30 23:30:06 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/os/utils.c,v 3.69 2001/05/04 19:05:52 dawes Exp $ */ #ifdef __CYGWIN__ #include <stdlib.h> #include <signal.h> @@ -234,6 +234,7 @@ static Bool StillLocking = FALSE; static char LockFile[PATH_MAX]; +static Bool nolock = FALSE; /* * LockServer -- Index: xc/programs/Xserver/os/xdmauth.c diff -u xc/programs/Xserver/os/xdmauth.c:1.3 xc/programs/Xserver/os/xdmauth.c:1.4 --- xc/programs/Xserver/os/xdmauth.c:1.3 Sun Oct 4 05:39:50 1998 +++ xc/programs/Xserver/os/xdmauth.c Wed Jan 17 17:37:13 2001 @@ -1,4 +1,4 @@ -/* $TOG: xdmauth.c /main/16 1998/02/09 15:13:11 kaleb $ */ +/* $Xorg: xdmauth.c,v 1.3 2000/08/17 19:53:42 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group Index: xc/programs/Xserver/os/xdmcp.c diff -u xc/programs/Xserver/os/xdmcp.c:3.13 xc/programs/Xserver/os/xdmcp.c:3.15 --- xc/programs/Xserver/os/xdmcp.c:3.13 Tue Feb 8 12:19:26 2000 +++ xc/programs/Xserver/os/xdmcp.c Tue May 1 03:53:47 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: xdmcp.c /main/34 1996/12/02 10:23:29 lehors $ */ -/* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.13 2000/02/08 17:19:26 dawes Exp $ */ +/* $Xorg: xdmcp.c,v 1.3 2000/08/17 19:53:42 cpqbld Exp $ */ /* * Copyright 1989 Network Computing Devices, Inc., Mountain View, California. * @@ -14,6 +13,7 @@ * without express or implied warranty. * */ +/* $XFree86: xc/programs/Xserver/os/xdmcp.c,v 3.15 2001/05/01 07:53:47 alanh Exp $ */ #ifdef WIN32 /* avoid conflicting definitions */ @@ -324,7 +324,6 @@ return (i + 1); } if (strcmp(argv[i], "-class") == 0) { - ++i; if (++i == argc) { ErrorF("Xserver: missing class name in command line\n"); exit(1); Index: xc/programs/Xserver/record/Imakefile diff -u xc/programs/Xserver/record/Imakefile:1.10 xc/programs/Xserver/record/Imakefile:1.11 --- xc/programs/Xserver/record/Imakefile:1.10 Thu Apr 6 11:27:26 2000 +++ xc/programs/Xserver/record/Imakefile Wed Jan 17 17:37:14 2001 @@ -1,7 +1,9 @@ -XCOMM $XFree86: xc/programs/Xserver/record/Imakefile,v 1.10 2000/04/06 15:27:26 dawes Exp $ -XCOMM -XCOMM -XCOMM $XConsortium: Imakefile /main/3 1996/09/28 17:15:43 rws $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/Xserver/record/Imakefile,v 1.11 2001/01/17 22:37:14 dawes Exp $ #if DoLoadableServer #define IHaveSubdirs Index: xc/programs/Xserver/record/record.c diff -u xc/programs/Xserver/record/record.c:1.6 xc/programs/Xserver/record/record.c:1.7 --- xc/programs/Xserver/record/record.c:1.6 Sun Oct 4 05:39:53 1998 +++ xc/programs/Xserver/record/record.c Wed Jan 17 17:37:14 2001 @@ -1,4 +1,4 @@ -/* $TOG: record.c /main/9 1998/02/09 15:17:09 kaleb $ */ +/* $Xorg: record.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ /* @@ -28,7 +28,7 @@ and Jim Haggerty of Metheus. */ -/* $XFree86: xc/programs/Xserver/record/record.c,v 1.6 1998/10/04 09:39:53 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/record/record.c,v 1.7 2001/01/17 22:37:14 dawes Exp $ */ #define NEED_EVENTS #include "dixstruct.h" Index: xc/programs/Xserver/record/set.c diff -u xc/programs/Xserver/record/set.c:1.5 xc/programs/Xserver/record/set.c:1.6 --- xc/programs/Xserver/record/set.c:1.5 Sun Dec 20 06:58:03 1998 +++ xc/programs/Xserver/record/set.c Wed Jan 17 17:37:14 2001 @@ -1,4 +1,4 @@ -/* $TOG: set.c /main/3 1998/02/09 15:17:17 kaleb $ */ +/* $Xorg: set.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ /* @@ -23,7 +23,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/Xserver/record/set.c,v 1.5 1998/12/20 11:58:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/record/set.c,v 1.6 2001/01/17 22:37:14 dawes Exp $ */ /* Index: xc/programs/Xserver/record/set.h diff -u xc/programs/Xserver/record/set.h:1.1.1.2 xc/programs/Xserver/record/set.h:1.1.1.3 --- xc/programs/Xserver/record/set.h:1.1.1.2 Sun Sep 27 04:45:28 1998 +++ xc/programs/Xserver/record/set.h Tue Jan 16 17:45:18 2001 @@ -1,4 +1,4 @@ -/* $TOG: set.h /main/2 1998/02/09 15:17:23 kaleb $ */ +/* $Xorg: set.h,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ /* Index: xc/programs/Xserver/render/Imakefile diff -u xc/programs/Xserver/render/Imakefile:1.4.2.1 xc/programs/Xserver/render/Imakefile:1.6 --- xc/programs/Xserver/render/Imakefile:1.4.2.1 Thu Mar 8 21:26:51 2001 +++ xc/programs/Xserver/render/Imakefile Sun Jan 21 16:19:39 2001 @@ -1,4 +1,4 @@ -XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.4.2.1 2001/03/09 02:26:51 keithp Exp $ +XCOMM $XFree86: xc/programs/Xserver/render/Imakefile,v 1.6 2001/01/21 21:19:39 tsi Exp $ #include <Server.tmpl> SRCS = glyph.c \ Index: xc/programs/Xserver/render/glyph.c diff -u xc/programs/Xserver/render/glyph.c:1.4.2.1 xc/programs/Xserver/render/glyph.c:1.5 --- xc/programs/Xserver/render/glyph.c:1.4.2.1 Thu Mar 8 21:26:51 2001 +++ xc/programs/Xserver/render/glyph.c Tue Jan 30 02:01:22 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/glyph.c,v 1.4.2.1 2001/03/09 02:26:51 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/glyph.c,v 1.5 2001/01/30 07:01:22 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * Index: xc/programs/Xserver/render/glyphstr.h diff -u xc/programs/Xserver/render/glyphstr.h:1.3.2.1 xc/programs/Xserver/render/glyphstr.h:1.4 --- xc/programs/Xserver/render/glyphstr.h:1.3.2.1 Thu Mar 8 21:26:51 2001 +++ xc/programs/Xserver/render/glyphstr.h Sun Jan 21 16:19:39 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/glyphstr.h,v 1.3.2.1 2001/03/09 02:26:51 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/glyphstr.h,v 1.4 2001/01/21 21:19:39 tsi Exp $ * * Copyright © 2000 SuSE, Inc. * Index: xc/programs/Xserver/render/mipict.c diff -u xc/programs/Xserver/render/mipict.c:1.5.2.1 xc/programs/Xserver/render/mipict.c:1.6.2.1 --- xc/programs/Xserver/render/mipict.c:1.5.2.1 Thu Mar 8 21:26:51 2001 +++ xc/programs/Xserver/render/mipict.c Thu May 31 21:06:35 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/mipict.c,v 1.5.2.1 2001/03/09 02:26:51 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/mipict.c,v 1.6.2.1 2001/06/01 01:06:35 dawes Exp $ * * Copyright © 1999 Keith Packard * @@ -29,6 +29,10 @@ #include "mi.h" #include "picturestr.h" #include "mipict.h" + +#ifndef __GNUC__ +#define __inline +#endif int miCreatePicture (PicturePtr pPicture) Index: xc/programs/Xserver/render/mipict.h diff -u xc/programs/Xserver/render/mipict.h:1.4.2.1 xc/programs/Xserver/render/mipict.h:1.5 --- xc/programs/Xserver/render/mipict.h:1.4.2.1 Thu Mar 8 21:26:51 2001 +++ xc/programs/Xserver/render/mipict.h Sun Jan 21 16:19:39 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/mipict.h,v 1.4.2.1 2001/03/09 02:26:51 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/mipict.h,v 1.5 2001/01/21 21:19:39 tsi Exp $ * * Copyright © 2000 SuSE, Inc. * Index: xc/programs/Xserver/render/picture.h diff -u xc/programs/Xserver/render/picture.h:1.5.2.1 xc/programs/Xserver/render/picture.h:1.5 --- xc/programs/Xserver/render/picture.h:1.5.2.1 Thu Mar 8 21:26:51 2001 +++ xc/programs/Xserver/render/picture.h Mon Nov 20 23:11:42 2000 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/picture.h,v 1.5.2.1 2001/03/09 02:26:51 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/picture.h,v 1.5 2000/11/21 04:11:42 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * Index: xc/programs/Xserver/render/picturestr.h diff -u xc/programs/Xserver/render/picturestr.h:1.10.2.1 xc/programs/Xserver/render/picturestr.h:1.13 --- xc/programs/Xserver/render/picturestr.h:1.10.2.1 Thu Mar 8 21:26:52 2001 +++ xc/programs/Xserver/render/picturestr.h Thu Apr 5 13:42:35 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/picturestr.h,v 1.10.2.1 2001/03/09 02:26:52 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/picturestr.h,v 1.13 2001/04/05 17:42:35 dawes Exp $ * * Copyright © 2000 SuSE, Inc. * @@ -199,8 +199,10 @@ PicturePtr AllocatePicture (ScreenPtr pScreen); +#if 0 Bool miPictureInit (ScreenPtr pScreen, PictFormatPtr formats, int nformats); +#endif PicturePtr Index: xc/programs/Xserver/render/render.c diff -u xc/programs/Xserver/render/render.c:1.8.2.1 xc/programs/Xserver/render/render.c:1.10 --- xc/programs/Xserver/render/render.c:1.8.2.1 Thu Mar 8 21:26:52 2001 +++ xc/programs/Xserver/render/render.c Wed Mar 7 22:48:44 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/Xserver/render/render.c,v 1.8.2.1 2001/03/09 02:26:52 keithp Exp $ + * $XFree86: xc/programs/Xserver/render/render.c,v 1.10 2001/03/08 03:48:44 keithp Exp $ * * Copyright © 2000 SuSE, Inc. * Index: xc/programs/Xserver/xkb/Imakefile diff -u xc/programs/Xserver/xkb/Imakefile:3.14.2.1 xc/programs/Xserver/xkb/Imakefile:3.16 --- xc/programs/Xserver/xkb/Imakefile:3.14.2.1 Mon Jan 22 14:49:33 2001 +++ xc/programs/Xserver/xkb/Imakefile Wed Jan 17 17:37:14 2001 @@ -1,5 +1,10 @@ -XCOMM $TOG: Imakefile /main/12 1997/07/16 14:51:50 kaleb $ -XCOMM $XFree86: xc/programs/Xserver/xkb/Imakefile,v 3.14.2.1 2001/01/22 19:49:33 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/Xserver/xkb/Imakefile,v 3.16 2001/01/17 22:37:14 dawes Exp $ + #define SGIHyperOpt #include <Server.tmpl> Index: xc/programs/Xserver/xkb/ddxBeep.c diff -u xc/programs/Xserver/xkb/ddxBeep.c:3.3 xc/programs/Xserver/xkb/ddxBeep.c:3.4 --- xc/programs/Xserver/xkb/ddxBeep.c:3.3 Sun Jun 22 06:16:58 1997 +++ xc/programs/Xserver/xkb/ddxBeep.c Wed Jan 17 17:37:14 2001 @@ -1,4 +1,4 @@ -/* $TOG: ddxBeep.c /main/5 1997/06/10 06:53:42 kaleb $ */ +/* $Xorg: ddxBeep.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/Xserver/xkb/ddxConfig.c diff -u xc/programs/Xserver/xkb/ddxConfig.c:3.3 xc/programs/Xserver/xkb/ddxConfig.c:3.4 --- xc/programs/Xserver/xkb/ddxConfig.c:3.3 Mon Dec 23 02:10:06 1996 +++ xc/programs/Xserver/xkb/ddxConfig.c Wed Jan 17 17:37:14 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: ddxConfig.c /main/8 1996/09/28 17:15:56 rws $ */ -/* $XFree86: xc/programs/Xserver/xkb/ddxConfig.c,v 3.3 1996/12/23 07:10:06 dawes Exp $ */ +/* $Xorg: ddxConfig.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -25,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/Xserver/xkb/ddxConfig.c,v 3.4 2001/01/17 22:37:14 dawes Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 Index: xc/programs/Xserver/xkb/ddxCtrls.c diff -u xc/programs/Xserver/xkb/ddxCtrls.c:1.2 xc/programs/Xserver/xkb/ddxCtrls.c:1.3 --- xc/programs/Xserver/xkb/ddxCtrls.c:1.2 Sat Aug 26 11:11:27 2000 +++ xc/programs/Xserver/xkb/ddxCtrls.c Wed Jan 17 17:37:14 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: ddxCtrls.c /main/4 1996/02/02 14:39:24 kaleb $ */ +/* $Xorg: ddxCtrls.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/ddxCtrls.c,v 1.2 2000/08/26 15:11:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/ddxCtrls.c,v 1.3 2001/01/17 22:37:14 dawes Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 Index: xc/programs/Xserver/xkb/ddxDevBtn.c diff -u xc/programs/Xserver/xkb/ddxDevBtn.c:3.0 xc/programs/Xserver/xkb/ddxDevBtn.c:3.1 --- xc/programs/Xserver/xkb/ddxDevBtn.c:3.0 Mon Mar 4 00:24:23 1996 +++ xc/programs/Xserver/xkb/ddxDevBtn.c Wed Jan 17 17:37:14 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: ddxDevBtn.c /main/2 1996/03/01 14:30:47 kaleb $ */ +/* $Xorg: ddxDevBtn.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/Xserver/xkb/ddxFakeBtn.c diff -u xc/programs/Xserver/xkb/ddxFakeBtn.c:1.1.1.2 xc/programs/Xserver/xkb/ddxFakeBtn.c:1.1.1.3 --- xc/programs/Xserver/xkb/ddxFakeBtn.c:1.1.1.2 Sat Jan 6 21:36:54 1996 +++ xc/programs/Xserver/xkb/ddxFakeBtn.c Tue Jan 16 17:45:01 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: ddxFakeBtn.c /main/2 1996/01/01 10:55:09 kaleb $ */ +/* $Xorg: ddxFakeBtn.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/Xserver/xkb/ddxFakeMtn.c diff -u xc/programs/Xserver/xkb/ddxFakeMtn.c:1.3 xc/programs/Xserver/xkb/ddxFakeMtn.c:1.4 --- xc/programs/Xserver/xkb/ddxFakeMtn.c:1.3 Wed Jun 14 14:20:34 2000 +++ xc/programs/Xserver/xkb/ddxFakeMtn.c Wed Jan 17 17:37:14 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: ddxFakeMtn.c /main/2 1996/01/01 10:55:18 kaleb $ */ +/* $Xorg: ddxFakeMtn.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/ddxFakeMtn.c,v 1.3 2000/06/14 18:20:34 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/ddxFakeMtn.c,v 1.4 2001/01/17 22:37:14 dawes Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 Index: xc/programs/Xserver/xkb/ddxInit.c diff -u xc/programs/Xserver/xkb/ddxInit.c:1.1.1.2 xc/programs/Xserver/xkb/ddxInit.c:1.1.1.3 --- xc/programs/Xserver/xkb/ddxInit.c:1.1.1.2 Sat Jan 6 21:36:56 1996 +++ xc/programs/Xserver/xkb/ddxInit.c Tue Jan 16 17:45:02 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: ddxInit.c /main/2 1996/01/01 10:55:27 kaleb $ */ +/* $Xorg: ddxInit.c,v 1.3 2000/08/17 19:53:45 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/Xserver/xkb/ddxKeyClick.c diff -u xc/programs/Xserver/xkb/ddxKeyClick.c:1.1.1.2 xc/programs/Xserver/xkb/ddxKeyClick.c:1.1.1.3 --- xc/programs/Xserver/xkb/ddxKeyClick.c:1.1.1.2 Sat Jan 6 21:36:57 1996 +++ xc/programs/Xserver/xkb/ddxKeyClick.c Tue Jan 16 17:45:02 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: ddxKeyClick.c /main/2 1996/01/01 10:55:36 kaleb $ */ +/* $Xorg: ddxKeyClick.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/Xserver/xkb/ddxKillSrv.c diff -u xc/programs/Xserver/xkb/ddxKillSrv.c:1.1.1.2 xc/programs/Xserver/xkb/ddxKillSrv.c:1.1.1.3 --- xc/programs/Xserver/xkb/ddxKillSrv.c:1.1.1.2 Sat Jan 6 21:36:58 1996 +++ xc/programs/Xserver/xkb/ddxKillSrv.c Tue Jan 16 17:45:02 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: ddxKillSrv.c /main/2 1996/01/01 10:55:46 kaleb $ */ +/* $Xorg: ddxKillSrv.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/Xserver/xkb/ddxLEDs.c diff -u xc/programs/Xserver/xkb/ddxLEDs.c:1.1.1.3 xc/programs/Xserver/xkb/ddxLEDs.c:1.1.1.4 --- xc/programs/Xserver/xkb/ddxLEDs.c:1.1.1.3 Mon Jan 15 02:03:44 1996 +++ xc/programs/Xserver/xkb/ddxLEDs.c Tue Jan 16 17:45:02 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: ddxLEDs.c /main/3 1996/01/14 16:45:52 kaleb $ */ +/* $Xorg: ddxLEDs.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/Xserver/xkb/ddxList.c diff -u xc/programs/Xserver/xkb/ddxList.c:3.5 xc/programs/Xserver/xkb/ddxList.c:3.6 --- xc/programs/Xserver/xkb/ddxList.c:3.5 Sun Sep 14 09:15:09 1997 +++ xc/programs/Xserver/xkb/ddxList.c Wed Jan 17 17:37:14 2001 @@ -1,4 +1,4 @@ -/* $TOG: ddxList.c /main/6 1997/06/10 06:53:45 kaleb $ */ +/* $Xorg: ddxList.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/ddxList.c,v 3.5 1997/09/14 13:15:09 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/ddxList.c,v 3.6 2001/01/17 22:37:14 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/Xserver/xkb/ddxLoad.c diff -u xc/programs/Xserver/xkb/ddxLoad.c:3.26 xc/programs/Xserver/xkb/ddxLoad.c:3.27 --- xc/programs/Xserver/xkb/ddxLoad.c:3.26 Tue Nov 14 13:20:38 2000 +++ xc/programs/Xserver/xkb/ddxLoad.c Wed Jan 17 17:37:14 2001 @@ -1,4 +1,4 @@ -/* $TOG: ddxLoad.c /main/21 1997/06/18 07:33:24 kaleb $ */ +/* $Xorg: ddxLoad.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/ddxLoad.c,v 3.26 2000/11/14 18:20:38 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/ddxLoad.c,v 3.27 2001/01/17 22:37:14 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/Xserver/xkb/ddxVT.c diff -u xc/programs/Xserver/xkb/ddxVT.c:1.1.1.2 xc/programs/Xserver/xkb/ddxVT.c:1.1.1.3 --- xc/programs/Xserver/xkb/ddxVT.c:1.1.1.2 Sat Jan 6 21:37:01 1996 +++ xc/programs/Xserver/xkb/ddxVT.c Tue Jan 16 17:45:04 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: ddxVT.c /main/2 1996/01/01 10:56:13 kaleb $ */ +/* $Xorg: ddxVT.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/Xserver/xkb/xkb.c diff -u xc/programs/Xserver/xkb/xkb.c:3.13 xc/programs/Xserver/xkb/xkb.c:3.14 --- xc/programs/Xserver/xkb/xkb.c:3.13 Tue Apr 4 15:25:22 2000 +++ xc/programs/Xserver/xkb/xkb.c Wed Jan 17 17:37:14 2001 @@ -1,4 +1,4 @@ -/* $TOG: xkb.c /main/22 1997/06/10 06:53:48 kaleb $ */ +/* $Xorg: xkb.c,v 1.3 2000/08/17 19:53:46 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkb.c,v 3.13 2000/04/04 19:25:22 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkb.c,v 3.14 2001/01/17 22:37:14 dawes Exp $ */ #include <stdio.h> #include "X.h" Index: xc/programs/Xserver/xkb/xkbAccessX.c diff -u xc/programs/Xserver/xkb/xkbAccessX.c:1.5 xc/programs/Xserver/xkb/xkbAccessX.c:1.7 --- xc/programs/Xserver/xkb/xkbAccessX.c:1.5 Sat Aug 26 11:11:27 2000 +++ xc/programs/Xserver/xkb/xkbAccessX.c Mon Feb 12 13:26:00 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: xkbAccessX.c /main/13 1996/12/02 10:24:00 lehors $ */ +/* $Xorg: xkbAccessX.c,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkbAccessX.c,v 1.5 2000/08/26 15:11:27 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbAccessX.c,v 1.7 2001/02/12 18:26:00 paulo Exp $ */ #include <stdio.h> #include <math.h> @@ -609,11 +609,6 @@ if (XkbAX_NeedFeedback(ctrls,XkbAX_BKRejectFBMask)) XkbDDXAccessXBeep(keybd,_BEEP_BOUNCE_REJECT,XkbBounceKeysMask); ignoreKeyEvent = TRUE; - } - - if ((ctrls->enabled_ctrls & XkbMouseKeysAccelMask) && - (key == xkbi->mouseKey)) { - ignoreKeyEvent = TRUE; } /* Start repeating if necessary. Stop autorepeating if the user Index: xc/programs/Xserver/xkb/xkbActions.c diff -u xc/programs/Xserver/xkb/xkbActions.c:3.3.2.1 xc/programs/Xserver/xkb/xkbActions.c:3.6 --- xc/programs/Xserver/xkb/xkbActions.c:3.3.2.1 Fri Feb 9 15:45:15 2001 +++ xc/programs/Xserver/xkb/xkbActions.c Mon Feb 12 13:26:00 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: xkbActions.c /main/3 1996/03/01 14:31:12 kaleb $ */ +/* $Xorg: xkbActions.c,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkbActions.c,v 3.3.2.1 2001/02/09 20:45:15 paulo Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbActions.c,v 3.6 2001/02/12 18:26:00 paulo Exp $ */ #include <stdio.h> #include <math.h> @@ -621,14 +621,12 @@ AccessXCancelRepeatKey(xkbi,keycode); xkbi->mouseKeysAccel= accel&& (xkbi->desc->ctrls->enabled_ctrls&XkbMouseKeysAccelMask); - if (xkbi->mouseKeysAccel) { - xkbi->mouseKeysFlags= pAction->ptr.flags; - xkbi->mouseKeysDX= XkbPtrActionX(&pAction->ptr); - xkbi->mouseKeysDY= XkbPtrActionY(&pAction->ptr); - xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0, + xkbi->mouseKeysFlags= pAction->ptr.flags; + xkbi->mouseKeysDX= XkbPtrActionX(&pAction->ptr); + xkbi->mouseKeysDY= XkbPtrActionY(&pAction->ptr); + xkbi->mouseKeyTimer= TimerSet(xkbi->mouseKeyTimer, 0, xkbi->desc->ctrls->mk_delay, _XkbPtrAccelExpire,(pointer)xkbi); - } } else if (filter->keycode==keycode) { filter->active = 0; Index: xc/programs/Xserver/xkb/xkbDflts.h diff -u xc/programs/Xserver/xkb/xkbDflts.h:1.1.1.3 xc/programs/Xserver/xkb/xkbDflts.h:1.1.1.4 --- xc/programs/Xserver/xkb/xkbDflts.h:1.1.1.3 Wed Jan 3 02:35:30 1996 +++ xc/programs/Xserver/xkb/xkbDflts.h Tue Jan 16 17:45:07 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: xkbDflts.h /main/6 1995/12/07 21:22:44 kaleb $ */ +/* $Xorg: xkbDflts.h,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */ /* This file generated automatically by xkbcomp */ /* DO NOT EDIT */ #ifndef DEFAULT_H Index: xc/programs/Xserver/xkb/xkbEvents.c diff -u xc/programs/Xserver/xkb/xkbEvents.c:3.6 xc/programs/Xserver/xkb/xkbEvents.c:3.8 --- xc/programs/Xserver/xkb/xkbEvents.c:3.6 Sat Aug 26 11:11:28 2000 +++ xc/programs/Xserver/xkb/xkbEvents.c Tue Feb 20 11:43:14 2001 @@ -1,4 +1,4 @@ -/* $TOG: xkbEvents.c /main/21 1997/11/25 12:31:37 kaleb $ */ +/* $Xorg: xkbEvents.c,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkbEvents.c,v 3.6 2000/08/26 15:11:28 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbEvents.c,v 3.8 2001/02/20 16:43:14 paulo Exp $ */ #include <stdio.h> #define NEED_EVENTS 1 @@ -925,7 +925,7 @@ (_XkbIsReleaseEvent(xE[0].u.u.type)) ) { return False; } - if ((pXDev->grab != NullGrab) && + if ((pXDev->grab != NullGrab) && pXDev->fromPassiveGrab && ((xE[0].u.u.type==KeyPress)||(xE[0].u.u.type==KeyRelease))) { register unsigned state,flags; Index: xc/programs/Xserver/xkb/xkbInit.c diff -u xc/programs/Xserver/xkb/xkbInit.c:3.17 xc/programs/Xserver/xkb/xkbInit.c:3.18 --- xc/programs/Xserver/xkb/xkbInit.c:3.17 Thu Jun 15 16:50:03 2000 +++ xc/programs/Xserver/xkb/xkbInit.c Wed Jan 17 17:37:15 2001 @@ -1,4 +1,4 @@ -/* $TOG: xkbInit.c /main/25 1997/09/26 14:26:56 kaleb $ */ +/* $Xorg: xkbInit.c,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkbInit.c,v 3.17 2000/06/15 20:50:03 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbInit.c,v 3.18 2001/01/17 22:37:15 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> Index: xc/programs/Xserver/xkb/xkbLEDs.c diff -u xc/programs/Xserver/xkb/xkbLEDs.c:3.1 xc/programs/Xserver/xkb/xkbLEDs.c:3.2 --- xc/programs/Xserver/xkb/xkbLEDs.c:3.1 Mon Dec 23 02:10:14 1996 +++ xc/programs/Xserver/xkb/xkbLEDs.c Wed Jan 17 17:37:15 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: xkbLEDs.c /main/3 1996/08/31 12:44:48 kaleb $ */ +/* $Xorg: xkbLEDs.c,v 1.3 2000/08/17 19:53:47 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/Xserver/xkb/xkbPrKeyEv.c diff -u xc/programs/Xserver/xkb/xkbPrKeyEv.c:3.7 xc/programs/Xserver/xkb/xkbPrKeyEv.c:3.8 --- xc/programs/Xserver/xkb/xkbPrKeyEv.c:3.7 Tue Apr 4 15:25:24 2000 +++ xc/programs/Xserver/xkb/xkbPrKeyEv.c Wed Jan 17 17:37:15 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: xkbPrKeyEv.c /main/6 1996/02/05 10:18:46 kaleb $ */ +/* $Xorg: xkbPrKeyEv.c,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/Xserver/xkb/xkbPrKeyEv.c,v 3.7 2000/04/04 19:25:24 dawes Exp $ */ +/* $XFree86: xc/programs/Xserver/xkb/xkbPrKeyEv.c,v 3.8 2001/01/17 22:37:15 dawes Exp $ */ #include <stdio.h> #include <math.h> Index: xc/programs/Xserver/xkb/xkbPrOtherEv.c diff -u xc/programs/Xserver/xkb/xkbPrOtherEv.c:1.1.1.1 xc/programs/Xserver/xkb/xkbPrOtherEv.c:1.1.1.2 --- xc/programs/Xserver/xkb/xkbPrOtherEv.c:1.1.1.1 Tue Jan 16 05:20:09 1996 +++ xc/programs/Xserver/xkb/xkbPrOtherEv.c Tue Jan 16 17:45:09 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: xkbPrOtherEv.c /main/1 1996/01/14 16:46:43 kaleb $ */ +/* $Xorg: xkbPrOtherEv.c,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/Xserver/xkb/xkbSwap.c diff -u xc/programs/Xserver/xkb/xkbSwap.c:3.0 xc/programs/Xserver/xkb/xkbSwap.c:3.1 --- xc/programs/Xserver/xkb/xkbSwap.c:3.0 Sun Aug 25 10:14:04 1996 +++ xc/programs/Xserver/xkb/xkbSwap.c Wed Jan 17 17:37:15 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: xkbSwap.c /main/9 1996/02/02 14:39:39 kaleb $ */ -/* $XFree86: xc/programs/Xserver/xkb/xkbSwap.c,v 3.0 1996/08/25 14:14:04 dawes Exp $ */ +/* $Xorg: xkbSwap.c,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -25,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/Xserver/xkb/xkbSwap.c,v 3.1 2001/01/17 22:37:15 dawes Exp $ */ #include "stdio.h" #include "X.h" Index: xc/programs/Xserver/xkb/xkbUtils.c diff -u xc/programs/Xserver/xkb/xkbUtils.c:3.11 xc/programs/Xserver/xkb/xkbUtils.c:3.12 --- xc/programs/Xserver/xkb/xkbUtils.c:3.11 Tue Oct 24 18:45:14 2000 +++ xc/programs/Xserver/xkb/xkbUtils.c Wed Jan 17 17:37:15 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: xkbUtils.c /main/24 1996/09/28 17:16:26 rws $ */ -/* $XFree86: xc/programs/Xserver/xkb/xkbUtils.c,v 3.11 2000/10/24 22:45:14 dawes Exp $ */ +/* $Xorg: xkbUtils.c,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -25,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/Xserver/xkb/xkbUtils.c,v 3.12 2001/01/17 22:37:15 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/appres/Imakefile diff -u xc/programs/appres/Imakefile:1.1.1.1 xc/programs/appres/Imakefile:1.1.1.2 --- xc/programs/appres/Imakefile:1.1.1.1 Wed Apr 27 03:20:26 1994 +++ xc/programs/appres/Imakefile Tue Jan 16 17:45:18 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile,v 1.3 91/07/17 16:07:46 gildea Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ DEPLIBS = $(DEPXTOOLLIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XTOOLLIB) $(XLIB) SRCS = appres.c Index: xc/programs/appres/appres.c diff -u xc/programs/appres/appres.c:1.2 xc/programs/appres/appres.c:1.3 --- xc/programs/appres/appres.c:1.2 Mon Feb 1 06:56:03 1999 +++ xc/programs/appres/appres.c Wed Jan 17 18:44:49 2001 @@ -1,5 +1,5 @@ /* - * $TOG: appres.c /main/13 1998/02/09 13:39:32 kaleb $ + * $Xorg: appres.c,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ * * Copyright 1989, 1998 The Open Group @@ -23,7 +23,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/appres/appres.c,v 1.2 1999/02/01 11:56:03 dawes Exp $ */ +/* $XFree86: xc/programs/appres/appres.c,v 1.3 2001/01/17 23:44:49 dawes Exp $ */ #include <X11/Intrinsic.h> #include <stdio.h> Index: xc/programs/appres/appres.man diff -u xc/programs/appres/appres.man:1.4 xc/programs/appres/appres.man:1.7 --- xc/programs/appres/appres.man:1.4 Sun Oct 4 05:39:56 1998 +++ xc/programs/appres/appres.man Sat Jan 27 13:21:00 2001 @@ -1,4 +1,4 @@ -.\" $TOG: appres.man /main/16 1998/02/09 13:39:38 kaleb $ +.\" $Xorg: appres.man,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH APPRES 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/appres/appres.man,v 1.7 2001/01/27 18:21:00 dawes Exp $ +.\" +.TH APPRES 1 __xorgversion__ .SH NAME appres \- list X application resource database .SH SYNOPSIS @@ -80,6 +83,6 @@ will list the resources matching the \fIxterm\fP vt100 widget. .SH "SEE ALSO" .PP -X(1), xrdb(1), listres(1) +X(__miscmansuffix__), xrdb(1), listres(1) .SH AUTHOR Jim Fulton, MIT X Consortium Index: xc/programs/bdftopcf/Imakefile diff -u xc/programs/bdftopcf/Imakefile:3.8 xc/programs/bdftopcf/Imakefile:3.9 --- xc/programs/bdftopcf/Imakefile:3.8 Mon Jan 11 04:39:27 1999 +++ xc/programs/bdftopcf/Imakefile Wed Jan 17 18:44:49 2001 @@ -1,5 +1,9 @@ -XCOMM $TOG: Imakefile /main/10 1997/05/25 15:12:03 kaleb $ -XCOMM $XFree86: xc/programs/bdftopcf/Imakefile,v 3.8 1999/01/11 09:39:27 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:48 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/bdftopcf/Imakefile,v 3.9 2001/01/17 23:44:49 dawes Exp $ #if GzipFontCompression ZLIB = GzipLibrary Index: xc/programs/bdftopcf/bdftopcf.c diff -u xc/programs/bdftopcf/bdftopcf.c:1.2 xc/programs/bdftopcf/bdftopcf.c:1.3 --- xc/programs/bdftopcf/bdftopcf.c:1.2 Mon Feb 1 06:56:04 1999 +++ xc/programs/bdftopcf/bdftopcf.c Wed Jan 17 18:44:49 2001 @@ -1,4 +1,4 @@ -/* $TOG: bdftopcf.c /main/10 1998/04/29 15:45:50 barstow $ */ +/* $Xorg: bdftopcf.c,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ /* Copyright 1991, 1993, 1998 The Open Group @@ -23,7 +23,7 @@ */ -/* $XFree86: xc/programs/bdftopcf/bdftopcf.c,v 1.2 1999/02/01 11:56:04 dawes Exp $ */ +/* $XFree86: xc/programs/bdftopcf/bdftopcf.c,v 1.3 2001/01/17 23:44:49 dawes Exp $ */ #include <X11/X.h> #include <X11/Xproto.h> Index: xc/programs/bdftopcf/bdftopcf.man diff -u xc/programs/bdftopcf/bdftopcf.man:1.4 xc/programs/bdftopcf/bdftopcf.man:1.7 --- xc/programs/bdftopcf/bdftopcf.man:1.4 Sun Oct 4 05:39:57 1998 +++ xc/programs/bdftopcf/bdftopcf.man Sat Jan 27 13:21:00 2001 @@ -1,4 +1,4 @@ -.\" $TOG: bdftopcf.man /main/10 1998/02/09 13:39:47 kaleb $ +.\" $Xorg: bdftopcf.man,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH BDFTOPCF 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/bdftopcf/bdftopcf.man,v 1.7 2001/01/27 18:21:00 dawes Exp $ +.\" +.TH BDFTOPCF 1 __xorgversion__ .SH NAME bdftopcf \- convert X font from Bitmap Distribution Format to Portable Compiled Format @@ -103,6 +106,6 @@ writes the pcf file to standard output; this option gives the name of a file to be used instead. .SH "SEE ALSO" -X(1) +X(__miscmansuffix__) .SH AUTHOR Keith Packard, MIT X Consortium Index: xc/programs/beforelight/b4light.man diff -u xc/programs/beforelight/b4light.man:3.0 xc/programs/beforelight/b4light.man:3.2 --- xc/programs/beforelight/b4light.man:3.0 Fri Jul 15 03:05:57 1994 +++ xc/programs/beforelight/b4light.man Thu Feb 8 22:47:56 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/beforelight/b4light.man,v 3.0 1994/07/15 07:05:57 dawes Exp $ +.\" .\" 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 @@ -22,7 +22,10 @@ .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from the X Consortium. -.TH beforelight 1 "Release 6" "X Version 11" +.\" +.\" $XFree86: xc/programs/beforelight/b4light.man,v 3.2 2001/02/09 03:47:56 tsi Exp $ +.\" +.TH beforelight 1 __xorgversion__ .SH NAME beforelight \- screen saver .SH SYNOPSIS Index: xc/programs/bitmap/BitEdit.c diff -u xc/programs/bitmap/BitEdit.c:1.3 xc/programs/bitmap/BitEdit.c:1.4 --- xc/programs/bitmap/BitEdit.c:1.3 Mon Feb 1 06:56:05 1999 +++ xc/programs/bitmap/BitEdit.c Wed Jan 17 18:44:50 2001 @@ -1,4 +1,4 @@ -/* $TOG: BitEdit.c /main/29 1998/02/09 13:39:56 kaleb $ */ +/* $Xorg: BitEdit.c,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/BitEdit.c,v 1.3 1999/02/01 11:56:05 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/BitEdit.c,v 1.4 2001/01/17 23:44:50 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Bitmap-co.ad diff -u xc/programs/bitmap/Bitmap-co.ad:1.1.1.1 xc/programs/bitmap/Bitmap-co.ad:1.1.1.2 --- xc/programs/bitmap/Bitmap-co.ad:1.1.1.1 Wed Apr 27 03:12:42 1994 +++ xc/programs/bitmap/Bitmap-co.ad Tue Jan 16 17:45:20 2001 @@ -1,4 +1,4 @@ -! $XConsortium: Bitmap-co.ad,v 1.4 94/02/09 19:43:56 gildea Exp $ +! $Xorg: Bitmap-co.ad,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ ! The App-defaults file for Bitmap on a color screen. #include "Bitmap" Index: xc/programs/bitmap/Bitmap.ad diff -u xc/programs/bitmap/Bitmap.ad:3.0 xc/programs/bitmap/Bitmap.ad:3.1 --- xc/programs/bitmap/Bitmap.ad:3.0 Sat Jul 1 06:51:03 1995 +++ xc/programs/bitmap/Bitmap.ad Wed Jan 17 18:44:50 2001 @@ -1,4 +1,4 @@ -! $XConsortium: Bitmap.ad,v 1.19 95/06/29 19:25:34 kaleb Exp $ +! $Xorg: Bitmap.ad,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ ! The App-defaults file for Bitmap. *TransientShell.allowShellResize: True Index: xc/programs/bitmap/Bitmap.c diff -u xc/programs/bitmap/Bitmap.c:1.2 xc/programs/bitmap/Bitmap.c:1.3 --- xc/programs/bitmap/Bitmap.c:1.2 Mon Feb 1 06:56:05 1999 +++ xc/programs/bitmap/Bitmap.c Wed Jan 17 18:44:50 2001 @@ -1,4 +1,4 @@ -/* $TOG: Bitmap.c /main/48 1998/02/09 13:40:15 kaleb $ */ +/* $Xorg: Bitmap.c,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Bitmap.c,v 1.2 1999/02/01 11:56:05 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Bitmap.c,v 1.3 2001/01/17 23:44:50 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Bitmap.h diff -u xc/programs/bitmap/Bitmap.h:1.2 xc/programs/bitmap/Bitmap.h:1.3 --- xc/programs/bitmap/Bitmap.h:1.2 Mon Feb 1 06:56:06 1999 +++ xc/programs/bitmap/Bitmap.h Wed Jan 17 18:44:51 2001 @@ -1,4 +1,4 @@ -/* $TOG: Bitmap.h /main/13 1998/02/09 13:40:22 kaleb $ */ +/* $Xorg: Bitmap.h,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Bitmap.h,v 1.2 1999/02/01 11:56:06 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Bitmap.h,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/BitmapP.h diff -u xc/programs/bitmap/BitmapP.h:1.2 xc/programs/bitmap/BitmapP.h:1.3 --- xc/programs/bitmap/BitmapP.h:1.2 Mon Feb 1 06:56:06 1999 +++ xc/programs/bitmap/BitmapP.h Wed Jan 17 18:44:51 2001 @@ -1,4 +1,4 @@ -/* $TOG: BitmapP.h /main/14 1998/02/09 13:40:01 kaleb $ */ +/* $Xorg: BitmapP.h,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/BitmapP.h,v 1.2 1999/02/01 11:56:06 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/BitmapP.h,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/CutPaste.c diff -u xc/programs/bitmap/CutPaste.c:1.2 xc/programs/bitmap/CutPaste.c:1.3 --- xc/programs/bitmap/CutPaste.c:1.2 Mon Feb 1 06:56:07 1999 +++ xc/programs/bitmap/CutPaste.c Wed Jan 17 18:44:51 2001 @@ -1,4 +1,4 @@ -/* $TOG: CutPaste.c /main/10 1998/02/09 13:40:39 kaleb $ */ +/* $Xorg: CutPaste.c,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/CutPaste.c,v 1.2 1999/02/01 11:56:07 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/CutPaste.c,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Dialog.c diff -u xc/programs/bitmap/Dialog.c:1.2 xc/programs/bitmap/Dialog.c:1.3 --- xc/programs/bitmap/Dialog.c:1.2 Mon Feb 1 06:56:07 1999 +++ xc/programs/bitmap/Dialog.c Wed Jan 17 18:44:51 2001 @@ -1,4 +1,4 @@ -/* $TOG: Dialog.c /main/12 1998/02/09 13:40:47 kaleb $ */ +/* $Xorg: Dialog.c,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Dialog.c,v 1.2 1999/02/01 11:56:07 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Dialog.c,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Dialog.h diff -u xc/programs/bitmap/Dialog.h:1.2 xc/programs/bitmap/Dialog.h:1.3 --- xc/programs/bitmap/Dialog.h:1.2 Mon Feb 1 06:56:08 1999 +++ xc/programs/bitmap/Dialog.h Wed Jan 17 18:44:51 2001 @@ -1,4 +1,4 @@ -/* $TOG: Dialog.h /main/7 1998/02/09 13:40:51 kaleb $ */ +/* $Xorg: Dialog.h,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Dialog.h,v 1.2 1999/02/01 11:56:08 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Dialog.h,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Graphics.c diff -u xc/programs/bitmap/Graphics.c:1.4 xc/programs/bitmap/Graphics.c:1.5 --- xc/programs/bitmap/Graphics.c:1.4 Mon Feb 1 06:56:08 1999 +++ xc/programs/bitmap/Graphics.c Wed Jan 17 18:44:51 2001 @@ -1,4 +1,4 @@ -/* $TOG: Graphics.c /main/19 1998/02/09 13:41:11 kaleb $ */ +/* $Xorg: Graphics.c,v 1.3 2000/08/17 19:53:49 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Graphics.c,v 1.4 1999/02/01 11:56:08 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Graphics.c,v 1.5 2001/01/17 23:44:51 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Handlers.c diff -u xc/programs/bitmap/Handlers.c:1.2 xc/programs/bitmap/Handlers.c:1.3 --- xc/programs/bitmap/Handlers.c:1.2 Mon Feb 1 06:56:08 1999 +++ xc/programs/bitmap/Handlers.c Wed Jan 17 18:44:51 2001 @@ -1,4 +1,4 @@ -/* $TOG: Handlers.c /main/15 1998/02/09 13:41:17 kaleb $ */ +/* $Xorg: Handlers.c,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Handlers.c,v 1.2 1999/02/01 11:56:08 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/Handlers.c,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Imakefile diff -u xc/programs/bitmap/Imakefile:3.4 xc/programs/bitmap/Imakefile:3.5 --- xc/programs/bitmap/Imakefile:3.4 Tue May 13 11:08:14 1997 +++ xc/programs/bitmap/Imakefile Wed Jan 17 18:44:51 2001 @@ -1,5 +1,9 @@ -XCOMM $XConsortium: Imakefile /main/22 1996/09/28 17:16:44 rws $ -XCOMM $XFree86: xc/programs/bitmap/Imakefile,v 3.4 1997/05/13 15:08:14 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/bitmap/Imakefile,v 3.5 2001/01/17 23:44:51 dawes Exp $ BUTTONPICTURES = \ Dashes \ Index: xc/programs/bitmap/ReqMach.c diff -u xc/programs/bitmap/ReqMach.c:1.2 xc/programs/bitmap/ReqMach.c:1.3 --- xc/programs/bitmap/ReqMach.c:1.2 Mon Feb 1 06:56:09 1999 +++ xc/programs/bitmap/ReqMach.c Wed Jan 17 18:44:51 2001 @@ -1,4 +1,4 @@ -/* $TOG: ReqMach.c /main/15 1998/02/09 13:41:25 kaleb $ */ +/* $Xorg: ReqMach.c,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/ReqMach.c,v 1.2 1999/02/01 11:56:09 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/ReqMach.c,v 1.3 2001/01/17 23:44:51 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/Requests.h diff -u xc/programs/bitmap/Requests.h:1.3 xc/programs/bitmap/Requests.h:1.4 --- xc/programs/bitmap/Requests.h:1.3 Fri Feb 19 16:27:07 1999 +++ xc/programs/bitmap/Requests.h Wed Jan 17 18:44:51 2001 @@ -1,4 +1,4 @@ -/* $TOG: Requests.h /main/8 1998/02/09 13:41:30 kaleb $ */ +/* $Xorg: Requests.h,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/Requests.h,v 1.3 1999/02/19 21:27:07 hohndel Exp $ */ +/* $XFree86: xc/programs/bitmap/Requests.h,v 1.4 2001/01/17 23:44:51 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/bitmap/atobm.c diff -u xc/programs/bitmap/atobm.c:3.2 xc/programs/bitmap/atobm.c:3.3 --- xc/programs/bitmap/atobm.c:3.2 Mon Feb 1 06:56:09 1999 +++ xc/programs/bitmap/atobm.c Wed Jan 17 18:44:51 2001 @@ -1,4 +1,4 @@ -/* $TOG: atobm.c /main/6 1998/02/09 13:39:52 kaleb $ */ +/* $Xorg: atobm.c,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ */ /* Copyright 1988, 1993, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/atobm.c,v 3.2 1999/02/01 11:56:09 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/atobm.c,v 3.3 2001/01/17 23:44:51 dawes Exp $ */ /* * atobm - ascii to bitmap filter Index: xc/programs/bitmap/bitmap.man diff -u xc/programs/bitmap/bitmap.man:1.4 xc/programs/bitmap/bitmap.man:1.6 --- xc/programs/bitmap/bitmap.man:1.4 Sun Oct 4 05:39:59 1998 +++ xc/programs/bitmap/bitmap.man Sat Jan 27 13:21:01 2001 @@ -1,4 +1,4 @@ -.\" $TOG: bitmap.man /main/20 1998/02/09 13:40:30 kaleb $ +.\" $Xorg: bitmap.man,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ .\" Copyright 1993, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH BITMAP 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/bitmap/bitmap.man,v 1.6 2001/01/27 18:21:01 dawes Exp $ +.\" +.TH BITMAP 1 __xorgversion__ .SH NAME bitmap, bmtoa, atobm \- bitmap editor and converter utilities for the X Window System .SH SYNOPSIS Index: xc/programs/bitmap/bmtoa.c diff -u xc/programs/bitmap/bmtoa.c:3.4 xc/programs/bitmap/bmtoa.c:3.5 --- xc/programs/bitmap/bmtoa.c:3.4 Mon Feb 1 06:56:10 1999 +++ xc/programs/bitmap/bmtoa.c Wed Jan 17 18:44:51 2001 @@ -1,4 +1,4 @@ -/* $TOG: bmtoa.c /main/7 1998/02/09 13:40:35 kaleb $ */ +/* $Xorg: bmtoa.c,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ */ /* Copyright 1988, 1993, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/bitmap/bmtoa.c,v 3.4 1999/02/01 11:56:10 dawes Exp $ */ +/* $XFree86: xc/programs/bitmap/bmtoa.c,v 3.5 2001/01/17 23:44:51 dawes Exp $ */ /* * bmtoa - bitmap to ascii filter Index: xc/programs/dpsexec/Imakefile diff -u /dev/null xc/programs/dpsexec/Imakefile:1.2 --- /dev/null Mon Jun 4 12:42:47 2001 +++ xc/programs/dpsexec/Imakefile Sun Mar 11 10:27:36 2001 @@ -0,0 +1,12 @@ +XCOMM $XFree86: xc/programs/dpsexec/Imakefile,v 1.2 2001/03/11 15:27:36 herrb Exp $ +XCOMM XTOOLLIB is currently needed by our version of DPSLIB + + DEPLIBS = $(DEPDPSLIB) $(DEPXTOOLLIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(DPSLIB) $(XTOOLLIB) $(XLIB) + SYS_LIBRARIES = MathLibrary + +SRCS = dpsexec.c + +OBJS = dpsexec.o + +ComplexProgramTarget(dpsexec) Index: xc/programs/dpsexec/dpsexec.c diff -u /dev/null xc/programs/dpsexec/dpsexec.c:1.4 --- /dev/null Mon Jun 4 12:42:47 2001 +++ xc/programs/dpsexec/dpsexec.c Sun Apr 1 10:00:16 2001 @@ -0,0 +1,231 @@ +/* dpsexec.c + * + * (c) Copyright 1990-1994 Adobe Systems Incorporated. + * All rights reserved. + * + * Permission to use, copy, modify, distribute, and sublicense this software + * and its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notices appear in all copies and that + * both those copyright notices and this permission notice appear in + * supporting documentation and that the name of Adobe Systems Incorporated + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. No trademark license + * to use the Adobe trademarks is hereby granted. If the Adobe trademark + * "Display PostScript"(tm) is used to describe this software, its + * functionality or for any other purpose, such use shall be limited to a + * statement that this software works in conjunction with the Display + * PostScript system. Proper trademark attribution to reflect Adobe's + * ownership of the trademark shall be given whenever any such reference to + * the Display PostScript system is made. + * + * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. + * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE + * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT + * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE. + * + * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems + * Incorporated which may be registered in certain jurisdictions + * + * Author: Adobe Systems Incorporated + */ +/* $XFree86: xc/programs/dpsexec/dpsexec.c,v 1.4 2001/04/01 14:00:16 tsi Exp $ */ + +#include <errno.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <signal.h> +#include <sys/time.h> +#include <X11/X.h> +#include <DPS/XDPS.h> +#include <X11/Xlib.h> +#include <DPS/XDPSlib.h> +#include <DPS/dpsXclient.h> + +#define W_HEIGHT 512 +#define W_WIDTH 512 + +#ifdef _NO_PROTO +#define ARGCAST int +#else +#define ARGCAST void * +#endif + +static void MyStatusProc (ctxt, code) + DPSContext ctxt; + int code; +{ + if (code == PSZOMBIE) { + /* Zombie event means context died */ + exit(0); + } +} + +int main(argc, argv) + int argc; + char **argv; +{ + char *displayname = ""; + Display *dpy; + int i; + char buf[1000]; + XEvent ev; + GC gc; + long mask; + int sync = 0; + int backingStore = 0; + int exe = 1; + int c; + Window win; + XSetWindowAttributes xswa; + char *wh; + DPSContext ctxt; + XStandardColormap ccube, gramp; + XWMHints *hints; + int root = 0; + int width = W_WIDTH; + int height = W_HEIGHT; + Drawable drawable = None; + + for (i = 1; i < argc; i++) { + if (strncmp(argv[i], "-display", strlen(argv[i])) == 0) { + i++; + displayname = argv[i]; + } else if (strncmp(argv[i], "-sync", strlen(argv[i])) == 0) + sync = 1; + else if (strncmp(argv[i], "-backup", strlen(argv[i])) == 0) + backingStore = 1; + else if (strncmp(argv[i], "-noexec", strlen(argv[i])) == 0) + exe = 0; + else if (strncmp(argv[i], "-root", strlen(argv[i])) == 0) + root = 1; + else if (strncmp(argv[i], "-width", strlen(argv[i])) == 0) + width = atoi(argv[++i]); + else if (strncmp(argv[i], "-height", strlen(argv[i])) == 0) + height = atoi(argv[++i]); + else if (strncmp(argv[i], "-drawable", strlen(argv[i])) == 0) + drawable = (Drawable) atoi(argv[++i]); + else { + fprintf(stderr, + "usage: %s [-display displayname][-sync][-backup][-noexec]\n", + argv[0]); + fprintf(stderr, + " [-root][-width w][-height h][-drawable xid]\n"); + exit(1); + } + } + + dpy = XOpenDisplay(displayname); + if (dpy == NULL) { + fprintf(stderr, "%s: Can't open display %s!\n", argv[0], displayname); + exit(1); + } + + if (sync) (void) XSynchronize(dpy, True); + + gc = XCreateGC(dpy, drawable != None ? drawable : + RootWindow (dpy, DefaultScreen (dpy)), 0, NULL); + XSetForeground(dpy, gc, BlackPixel (dpy, DefaultScreen (dpy))); + XSetBackground(dpy, gc, WhitePixel (dpy, DefaultScreen (dpy))); + + if (root) { + win = DefaultRootWindow(dpy); + height = DisplayHeight(dpy, DefaultScreen(dpy)); + } else if (drawable != None) { + Window root; + int x, y; + unsigned int wwidth, wheight, border, depth; + win = drawable; + (void) XGetGeometry(dpy, win, &root, &x, &y, &wwidth, + &wheight, &border, &depth); + height = wheight; + } else { + win = XCreateSimpleWindow(dpy, DefaultRootWindow(dpy), + 3, 385, width, height, 1, + BlackPixel(dpy, DefaultScreen(dpy)), + WhitePixel(dpy, DefaultScreen(dpy))); + + hints = XAllocWMHints(); + if (hints != NULL) { + hints->flags = InputHint; + hints->input = False; + XSetWMHints(dpy, win, hints); + XFree((char *) hints); + } + + XStoreName(dpy, win, "Display PostScript Executive"); + XSetIconName(dpy, win, "DPS Exec"); + + xswa.bit_gravity = SouthWestGravity; + if (backingStore) xswa.backing_store = WhenMapped; + else xswa.backing_store = NotUseful; + xswa.event_mask = 0x0; + mask = CWBitGravity | CWBackingStore | CWEventMask; + XChangeWindowAttributes(dpy, win, mask, &xswa); + + XMapWindow(dpy, win); + } + + /* Make it possible for this client to start a DPS NX agent, + if "dpsnx.agent" is on the executable search path. */ + + (void) XDPSNXSetClientArg(XDPSNX_AUTO_LAUNCH, (ARGCAST) True); + + ctxt = XDPSCreateSimpleContext(dpy, win, gc, 0, height, + DPSDefaultTextBackstop, + DPSDefaultErrorProc, NULL); + + if (ctxt == NULL) { + fprintf (stderr, "\ndpsexec: DPS is not available\n"); + fprintf (stderr, + "You need an X server with the DPS extension, or a DPS NX agent.\n"); + exit (1); + } + + DPSSetContext(ctxt); + + /* Allow zombie events to be delivered so application can exit + if context dies. Detach context so it doesn't wait for a join + if it dies */ + + XDPSRegisterStatusProc(ctxt, MyStatusProc); + XDPSSetStatusMask(ctxt, PSZOMBIEMASK, 0, 0); + DPSPrintf(ctxt, "currentcontext detach "); + + if (exe) DPSPrintf(ctxt, "executive"); + DPSPrintf(ctxt, "\n"); + DPSFlushContext(ctxt); + DPSSuppressBinaryConversion(ctxt, True); + + while (1) { + fd_set fdmask; + FD_ZERO(&fdmask); + FD_SET(0, &fdmask); + FD_SET(ConnectionNumber(dpy), &fdmask); + DPSFlushContext(ctxt); + if (select(ConnectionNumber(dpy)+1, &fdmask, NULL, NULL, NULL) < 0) + fprintf(stderr, "select() error %d\n", errno); + else if (FD_ISSET(0, &fdmask)) { + /* Read from command line, send to context */ + if (fgets(buf, 1000, stdin) == NULL) break; + DPSWriteData(ctxt, buf, strlen(buf)); + } + + while (XPending(dpy) > 0) { + /* No special event handling - just throw them away. + Must call XNextEvent to allow DPS status events to + be dispatched. */ + XNextEvent(dpy, &ev); + } + } + + DPSDestroySpace(DPSSpaceFromContext(ctxt)); + XFlush(dpy); + return 0; +} Index: xc/programs/dpsexec/dpsexec.man diff -u /dev/null xc/programs/dpsexec/dpsexec.man:1.1 --- /dev/null Mon Jun 4 12:42:47 2001 +++ xc/programs/dpsexec/dpsexec.man Wed Feb 28 20:23:58 2001 @@ -0,0 +1,115 @@ +.\" Id: dpsexec.man,v 6.1 1994/05/18 23:21:36 asente Exp $ +.\" $XFree86: xc/programs/dpsexec/dpsexec.man,v 1.1 2001/03/01 01:23:58 dawes Exp $ +.TH DPSEXEC 1 __vendorversion__ +.SH NAME +dpsexec \- Display PostScript Executive + +.SH SYNOPSIS +.B dpsexec +[ +.B \-display \fIname\fR +][ +.B \-sync +][ +.B \-backup +][ +.B \-noexec +][ +.B \-root +][ +.B \-drawable \fIwindowId\fR +][ +.B \-height \fIn\fR +][ +.B \-width \fIn\fR +] + +.SH DESCRIPTION +.LP +.B dpsexec +is a Display PostScript program that +allows the user to interact directly with the PostScript +interpreter through a command interface. +.B dpsexec +reads lines of text from standard input and passes each line to +the PostScript interpreter for execution. +It creates a window that displays the results of graphics operations as +they are executed. +.B dpsexec +exits when end of file is reached on standard input, or when +the user types "quit<return>", which executes +the PostScript +.B quit +operator. +.LP +By default, +.B dpsexec +executes the PostScript +.B executive +operator before it accepts any user input. +This operator puts the PostScript interpreter in "interactive +executive" mode so that the user can control the interpreter +directly. +In this mode, the PostScript interpreter supports certain line-editing +functions and prompts the user when it is ready to execute more input. +See section 2.4.4, "Using the Interpreter Interactively," +of the \fIPostScript Language Reference Manual, Second Edition,\fR +for detailed information on this mode of operation. + +.SH OPTIONS +.TP +.BI \-display " name" +specifies the display on which to open a connection to the Display +PostScript system. If no display is specified, the +DISPLAY environment variable is used. +.TP +.B \-sync +establishes a synchronous connection with the specified X display. +.TP +.B \-backup +uses backing store for the window in which graphics are +displayed, if possible. This is generally only effective with +the DPS NX system. +.TP +.B \-noexec +prevents +.B dpsexec +from entering "interactive executive" mode. The primary effect +of this option is to +inhibit printing the +.B PS> +prompt before each line of input is accepted. +This option is useful when +.B dpsexec +is run with standard input redirected from a file or a pipe. +.TP +.B \-root +tells +.B dpsexec +to draw into the root window instead of into a window that it creates. +.TP +.BI \-drawable " windowId" +tells +.B dpsexec +to draw into the specified window instead of into a window that it creates. +.TP +.BI \-height " n" +sets the height of the created window. +.TP +.BI \-width " n" +sets the width of the created window. + +.SH DIAGNOSTICS +PostScript language error messages are printed to standard output. + +.SH AUTHOR +Adobe Systems Incorporated + +.SH NOTES +PostScript and Display PostScript are trademarks +of Adobe Systems Incorporated which may be registered +in certain jurisdictions. + +.LP +Copyright (c) 1990-1994 Adobe Systems Incorporated. All rights reserved. + Index: xc/programs/dpsinfo/Imakefile diff -u /dev/null xc/programs/dpsinfo/Imakefile:1.3 --- /dev/null Mon Jun 4 12:42:47 2001 +++ xc/programs/dpsinfo/Imakefile Sun Mar 11 10:27:35 2001 @@ -0,0 +1,28 @@ +XCOMM $XFree86: xc/programs/dpsinfo/Imakefile,v 1.3 2001/03/11 15:27:35 herrb Exp $ +XCOMM XTOOLLIB is currently needed by our version of DPSLIB + + DEPLIBS = $(DEPDPSLIB) $(DEPXTOOLLIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(DPSLIB) $(XTOOLLIB) $(XLIB) + SYS_LIBRARIES = MathLibrary + PSWRAP = PsWrap + +SRCS = iwraps.psw dpsinfo.c + +OBJS = iwraps.o dpsinfo.o + +DERIVED_FILES = iwraps.h iwraps.c + +.SUFFIXES: .psw .h + +.psw.c : ProgramTargetName($(PSWRAP)) + RunProgram(PSWRAP,-a -o $*.c -h $*.h $<) + +.psw.h : ProgramTargetName($(PSWRAP)) + RunProgram(PSWRAP,-a -h $*.h $< > /dev/null) + +depend:: $(DERIVED_FILES) + +ComplexProgramTarget(dpsinfo) + +clean :: + $(RM) $(DERIVED_FILES) Index: xc/programs/dpsinfo/dpsinfo.c diff -u /dev/null xc/programs/dpsinfo/dpsinfo.c:1.3 --- /dev/null Mon Jun 4 12:42:47 2001 +++ xc/programs/dpsinfo/dpsinfo.c Thu Apr 26 17:09:46 2001 @@ -0,0 +1,130 @@ +/* +Copyright (c) 2001 by Juliusz Chroboczek + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. +*/ +/* $XFree86: xc/programs/dpsinfo/dpsinfo.c,v 1.3 2001/04/26 21:09:46 dawes Exp $ */ + +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <X11/X.h> +#include <DPS/XDPS.h> +#include <X11/Xlib.h> +#include <DPS/XDPSlib.h> +#include <DPS/dpsXclient.h> +#include <DPS/psops.h> + +#include "iwraps.h" + +char *ProgramName; + +#define BUFSIZE 512 +char buf[BUFSIZE + 1]; +#define NUMFONTTYPES 64 +int fonttypes[NUMFONTTYPES]; + +static void +usage(void) +{ + fprintf(stderr, "Usage: %s [-display dpy] [-debug]\n", + ProgramName); + exit(1); +} + +int +main(int argc, char *argv[]) +{ + Display *dpy; + GC gc; + DPSContext ctx, tctx; + char *displayname = NULL; + int debug = 0; + int i; + + ProgramName = argv[0]; + buf[BUFSIZE] = '\0'; + + for(i = 1; i < argc; i++) { + if (!strcmp("-display", argv[i])) { + if (++i >= argc) usage(); + displayname = argv[i]; + }else if (!strcmp("-debug", argv[i])) { + debug = 1; + } else { + usage(); + } + } + + dpy = XOpenDisplay(displayname); + if (dpy == NULL) { + fprintf(stderr, "%s: Can't open display.\n", + ProgramName); + exit(1); + } + + gc = XCreateGC(dpy, RootWindow (dpy, DefaultScreen (dpy)), 0, NULL); + + XDPSNXSetClientArg(XDPSNX_AUTO_LAUNCH, (void*)True); + + ctx = XDPSCreateSimpleContext(dpy, RootWindow(dpy, DefaultScreen(dpy)), + gc, 0, 0, + DPSDefaultTextBackstop, + DPSDefaultErrorProc, NULL); + + if (ctx == NULL) { + fprintf (stderr, "%s: no DPS extension or agent found.\n", + ProgramName); + exit(1); + } + + if(debug) { + tctx = DPSCreateTextContext(DPSDefaultTextBackstop, + DPSDefaultErrorProc); + DPSChainContext(ctx, tctx); + } + + DPSSetContext(ctx); + + printf("DPS protocol version: %d\n", XDPSGetProtocolVersion(dpy)); + PSlanguagelevel(&i); + printf("Interpreter language level: %d\n", i); + memset(buf, 0, BUFSIZE); + PSproductReturn(BUFSIZE, buf); + printf("Product: %s, ", buf); + memset(buf, 0, BUFSIZE); + PSversion(BUFSIZE, buf); + printf("version %s, ", buf); + PSserialnumber(&i); + printf("serial number: %d\n", i); + PSfonttypes(NUMFONTTYPES, fonttypes); + printf("Supported font types: "); + for(i=0; i<NUMFONTTYPES; i++) { + if(fonttypes[i] < 0) { + break; + } else { + printf("%d ", fonttypes[i]); + } + } + printf("\n"); + return 0; +} + + + Index: xc/programs/dpsinfo/dpsinfo.man diff -u /dev/null xc/programs/dpsinfo/dpsinfo.man:1.1 --- /dev/null Mon Jun 4 12:42:47 2001 +++ xc/programs/dpsinfo/dpsinfo.man Wed Feb 28 20:23:59 2001 @@ -0,0 +1,40 @@ +.\" $XFree86: xc/programs/dpsinfo/dpsinfo.man,v 1.1 2001/03/01 01:23:59 dawes Exp $ +.TH DPSINFO 1 __vendorversion__ +.SH NAME +dpsinfo \- Display PostScript Information + +.SH SYNOPSIS +.B dpsinfo +[ +.B \-display +.I name +] [ +.B -debug +] + +.SH DESCRIPTION + +.B Dpsinfo +is a utility for displaying information about the DPS extension +present in an X server or provided by a client-side DPS agent. +.B Dpsinfo +will print out the version of the DPS protocol used, the language +level and version of the underlying PS interpreter, as well as the set +of font formats supported. + +If +.B \-debug +is specified, +.B dpsinfo +will print out all the PS code sent to the server. + +.SH SEE ALSO +X(1), xdpyinfo(1), dpsexec(1) + +.SH AUTHOR +Juliusz Chroboczek + +.SH NOTES +PostScript and Display PostScript are trademarks +of Adobe Systems Incorporated which may be registered +in certain jurisdictions. Index: xc/programs/dpsinfo/iwraps.psw diff -u /dev/null xc/programs/dpsinfo/iwraps.psw:1.1 --- /dev/null Mon Jun 4 12:42:47 2001 +++ xc/programs/dpsinfo/iwraps.psw Wed Feb 28 20:23:59 2001 @@ -0,0 +1,14 @@ +/* $XFree86: xc/programs/dpsinfo/iwraps.psw,v 1.1 2001/03/01 01:23:59 dawes Exp $ */ + +defineps PSproductReturn(int bufsize | char buf[bufsize]) + product buf +endps + +defineps PSfonttypes(int maxsize | int fonttypes[maxsize]) + (*) + { + fonttypes + } null /FontType resourceforall + -1 fonttypes +endps + Index: xc/programs/editres/Edit-col.ad diff -u xc/programs/editres/Edit-col.ad:1.2 xc/programs/editres/Edit-col.ad:1.3 --- xc/programs/editres/Edit-col.ad:1.2 Sun May 16 06:13:06 1999 +++ xc/programs/editres/Edit-col.ad Wed Jan 17 18:44:52 2001 @@ -1,7 +1,7 @@ -! $XConsortium: Edit-col.ad,v 1.6 93/04/28 14:26:45 dave Exp $ +! $Xorg: Edit-col.ad,v 1.3 2000/08/17 19:53:50 cpqbld Exp $ ! Here are some suggested resources if you are using a color workstation. ! They look pretty good on my display, your mileage may vary. -! $XFree86: xc/programs/editres/Edit-col.ad,v 1.2 1999/05/16 10:13:06 dawes Exp $ +! $XFree86: xc/programs/editres/Edit-col.ad,v 1.3 2001/01/17 23:44:52 dawes Exp $ #include "Editres" Index: xc/programs/editres/Editres.ad diff -u xc/programs/editres/Editres.ad:1.2 xc/programs/editres/Editres.ad:1.3 --- xc/programs/editres/Editres.ad:1.2 Sun May 9 06:52:00 1999 +++ xc/programs/editres/Editres.ad Wed Jan 17 18:44:52 2001 @@ -1,5 +1,10 @@ -! $XConsortium: Editres.ad,v 1.16 93/04/28 14:26:57 dave Exp $ -! $XFree86: xc/programs/editres/Editres.ad,v 1.2 1999/05/09 10:52:00 dawes Exp $ +! $Xorg: Editres.ad,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ +! +! +! +! +! $XFree86: xc/programs/editres/Editres.ad,v 1.3 2001/01/17 23:44:52 dawes Exp $ +! ! The App-defaults file for Editres. Editres.Geometry: 500x568 Index: xc/programs/editres/Imakefile diff -u xc/programs/editres/Imakefile:1.1.1.2 xc/programs/editres/Imakefile:1.1.1.3 --- xc/programs/editres/Imakefile:1.1.1.2 Tue Jan 16 05:22:53 1996 +++ xc/programs/editres/Imakefile Tue Jan 16 17:45:28 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/9 1996/01/14 16:49:44 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ DEPLIBS = XawClientDepLibs XkbClientDepLibs LOCAL_LIBRARIES = XawClientLibs XkbClientLibs SRCS = actions.c comm.c editres.c geometry.c handler.c setvalues.c \ Index: xc/programs/editres/actions.c diff -u xc/programs/editres/actions.c:1.3 xc/programs/editres/actions.c:1.5 --- xc/programs/editres/actions.c:1.3 Mon Feb 1 07:52:24 1999 +++ xc/programs/editres/actions.c Sun Apr 1 10:00:17 2001 @@ -1,5 +1,5 @@ /* - * $TOG: actions.c /main/17 1998/02/09 13:41:54 kaleb $ + * $Xorg: actions.c,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -19,9 +19,10 @@ 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/editres/actions.c,v 1.3 1999/02/01 12:52:24 dawes Exp $ */ +/* $XFree86: xc/programs/editres/actions.c,v 1.5 2001/04/01 14:00:17 tsi Exp $ */ #include <stdio.h> +#include <stdlib.h> #include <X11/Intrinsic.h> #include <X11/Xutil.h> Index: xc/programs/editres/comm.c diff -u xc/programs/editres/comm.c:1.3 xc/programs/editres/comm.c:1.4 --- xc/programs/editres/comm.c:1.3 Mon Feb 1 07:52:25 1999 +++ xc/programs/editres/comm.c Wed Jan 17 18:44:52 2001 @@ -1,4 +1,4 @@ -/* $TOG: comm.c /main/24 1998/02/09 13:41:59 kaleb $ */ +/* $Xorg: comm.c,v 1.4 2000/08/17 19:53:51 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/editres/comm.c,v 1.3 1999/02/01 12:52:25 dawes Exp $ */ +/* $XFree86: xc/programs/editres/comm.c,v 1.4 2001/01/17 23:44:52 dawes Exp $ */ /* Index: xc/programs/editres/editres.c diff -u xc/programs/editres/editres.c:1.4 xc/programs/editres/editres.c:1.6 --- xc/programs/editres/editres.c:1.4 Mon Feb 1 06:56:13 1999 +++ xc/programs/editres/editres.c Sun Apr 1 10:00:17 2001 @@ -1,5 +1,5 @@ /* - * $TOG: editres.c /main/19 1998/02/09 13:42:14 kaleb $ + * $Xorg: editres.c,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -19,9 +19,10 @@ 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/editres/editres.c,v 1.4 1999/02/01 11:56:13 dawes Exp $ */ +/* $XFree86: xc/programs/editres/editres.c,v 1.6 2001/04/01 14:00:17 tsi Exp $ */ #include <stdio.h> +#include <stdlib.h> #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Xaw/Cardinals.h> Index: xc/programs/editres/editres.man diff -u xc/programs/editres/editres.man:1.4 xc/programs/editres/editres.man:1.7 --- xc/programs/editres/editres.man:1.4 Sun Oct 4 05:40:01 1998 +++ xc/programs/editres/editres.man Sat Jan 27 13:21:01 2001 @@ -1,4 +1,4 @@ -.\" $TOG: editres.man /main/16 1998/02/09 13:42:19 kaleb $ +.\" $Xorg: editres.man,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH EDITRES 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/editres/editres.man,v 1.7 2001/01/27 18:21:01 dawes Exp $ +.\" +.TH EDITRES 1 __xorgversion__ .SH NAME editres \- a dynamic resource editor for X Toolkit applications .SH SYNTAX @@ -26,7 +29,7 @@ .SH OPTIONS .I Editres accepts all of the standard X Toolkit command line -options (see \fIX(1)\fP). The order of the command line options is +options (see \fIX(__miscmansuffix__)\fP). The order of the command line options is not important. .SH DESCRIPTION Editres is a tool that allows users and application developers to view @@ -419,7 +422,7 @@ .SH FILES <XRoot>/lib/X11/app-defaults/Editres - specifies required resources .SH SEE ALSO -X(1), xrdb(1), Athena Widget Set +X(__miscmansuffix__), xrdb(1), Athena Widget Set .SH RESTRICTIONS This is a prototype, there are lots of nifty features I would love to add, but I hope this will give you some ideas about what a resource editor Index: xc/programs/editres/editresP.h diff -u xc/programs/editres/editresP.h:1.4 xc/programs/editres/editresP.h:1.5 --- xc/programs/editres/editresP.h:1.4 Mon Feb 1 07:52:25 1999 +++ xc/programs/editres/editresP.h Wed Jan 17 18:44:52 2001 @@ -1,6 +1,6 @@ /* - * $TOG: editresP.h /main/15 1998/02/09 13:42:05 kaleb $ + * $Xorg: editresP.h,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ * * Author: Chris D. Peterson, MIT X Consortium */ -/* $XFree86: xc/programs/editres/editresP.h,v 1.4 1999/02/01 12:52:25 dawes Exp $ */ +/* $XFree86: xc/programs/editres/editresP.h,v 1.5 2001/01/17 23:44:52 dawes Exp $ */ #include <X11/Xmu/EditresP.h> #include <X11/Xresource.h> Index: xc/programs/editres/geometry.c diff -u xc/programs/editres/geometry.c:1.3 xc/programs/editres/geometry.c:1.4 --- xc/programs/editres/geometry.c:1.3 Mon Feb 1 07:52:25 1999 +++ xc/programs/editres/geometry.c Wed Jan 17 18:44:52 2001 @@ -1,5 +1,5 @@ /* - * $TOG: geometry.c /main/17 1998/02/09 13:42:28 kaleb $ + * $Xorg: geometry.c,v 1.3 2000/08/17 19:53:51 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -21,7 +21,7 @@ * * Author: Chris D. Peterson, MIT X Consortium */ -/* $XFree86: xc/programs/editres/geometry.c,v 1.3 1999/02/01 12:52:25 dawes Exp $ */ +/* $XFree86: xc/programs/editres/geometry.c,v 1.4 2001/01/17 23:44:52 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> Index: xc/programs/editres/handler.c diff -u xc/programs/editres/handler.c:1.4 xc/programs/editres/handler.c:1.6 --- xc/programs/editres/handler.c:1.4 Mon Feb 1 06:56:16 1999 +++ xc/programs/editres/handler.c Sun Apr 1 10:00:17 2001 @@ -1,5 +1,5 @@ /* - * $TOG: handler.c /main/31 1998/02/09 13:42:34 kaleb $ + * $Xorg: handler.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -20,7 +20,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/editres/handler.c,v 1.4 1999/02/01 11:56:16 dawes Exp $ */ +/* $XFree86: xc/programs/editres/handler.c,v 1.6 2001/04/01 14:00:17 tsi Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> @@ -33,6 +33,7 @@ #include <X11/Xos.h> /* for W_OK def */ #include <stdio.h> +#include <stdlib.h> #include "editresP.h" Index: xc/programs/editres/setvalues.c diff -u xc/programs/editres/setvalues.c:1.3 xc/programs/editres/setvalues.c:1.4 --- xc/programs/editres/setvalues.c:1.3 Mon Feb 1 07:52:26 1999 +++ xc/programs/editres/setvalues.c Wed Jan 17 18:44:52 2001 @@ -1,5 +1,5 @@ /* - * $TOG: setvalues.c /main/7 1998/02/09 13:42:42 kaleb $ + * $Xorg: setvalues.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -21,7 +21,7 @@ * * Author: Chris D. Peterson, MIT X Consortium */ -/* $XFree86: xc/programs/editres/setvalues.c,v 1.3 1999/02/01 12:52:26 dawes Exp $ */ +/* $XFree86: xc/programs/editres/setvalues.c,v 1.4 2001/01/17 23:44:52 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> Index: xc/programs/editres/svpopup.c diff -u xc/programs/editres/svpopup.c:1.4 xc/programs/editres/svpopup.c:1.5 --- xc/programs/editres/svpopup.c:1.4 Sat Mar 13 22:22:21 1999 +++ xc/programs/editres/svpopup.c Wed Jan 17 18:44:52 2001 @@ -1,5 +1,5 @@ /* - * $TOG: svpopup.c /main/19 1998/02/09 13:42:47 kaleb $ + * $Xorg: svpopup.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -21,7 +21,7 @@ * * Author: Chris D. Peterson, MIT X Consortium */ -/* $XFree86: xc/programs/editres/svpopup.c,v 1.4 1999/03/14 03:22:21 dawes Exp $ */ +/* $XFree86: xc/programs/editres/svpopup.c,v 1.5 2001/01/17 23:44:52 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> /* Get standard string definations. */ Index: xc/programs/editres/utils.c diff -u xc/programs/editres/utils.c:1.3 xc/programs/editres/utils.c:1.5 --- xc/programs/editres/utils.c:1.3 Mon Feb 1 07:52:26 1999 +++ xc/programs/editres/utils.c Sun Apr 1 10:00:17 2001 @@ -1,5 +1,5 @@ /* - * $TOG: utils.c /main/24 1998/02/09 13:42:52 kaleb $ + * $Xorg: utils.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/editres/utils.c,v 1.3 1999/02/01 12:52:26 dawes Exp $ */ +/* $XFree86: xc/programs/editres/utils.c,v 1.5 2001/04/01 14:00:17 tsi Exp $ */ #include <X11/Intrinsic.h> #include <X11/Xutil.h> @@ -31,9 +31,8 @@ #include <X11/Xaw/Dialog.h> #include <stdio.h> +#include <stdlib.h> #include <X11/Xmu/Error.h> - -#include <stdio.h> #include "editresP.h" Index: xc/programs/editres/widgets.c diff -u xc/programs/editres/widgets.c:1.4 xc/programs/editres/widgets.c:1.5 --- xc/programs/editres/widgets.c:1.4 Sun May 9 06:52:01 1999 +++ xc/programs/editres/widgets.c Wed Jan 17 18:44:52 2001 @@ -1,5 +1,5 @@ /* - * $TOG: widgets.c /main/23 1998/02/09 13:42:57 kaleb $ + * $Xorg: widgets.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/editres/widgets.c,v 1.4 1999/05/09 10:52:01 dawes Exp $ */ +/* $XFree86: xc/programs/editres/widgets.c,v 1.5 2001/01/17 23:44:52 dawes Exp $ */ /* * Code for creating all widgets used by EditRes. Index: xc/programs/editres/wtree.c diff -u xc/programs/editres/wtree.c:1.3 xc/programs/editres/wtree.c:1.4 --- xc/programs/editres/wtree.c:1.3 Mon Feb 1 07:52:27 1999 +++ xc/programs/editres/wtree.c Wed Jan 17 18:44:53 2001 @@ -1,5 +1,5 @@ /* - * $TOG: wtree.c /main/20 1998/02/09 13:43:02 kaleb $ + * $Xorg: wtree.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/editres/wtree.c,v 1.3 1999/02/01 12:52:27 dawes Exp $ */ +/* $XFree86: xc/programs/editres/wtree.c,v 1.4 2001/01/17 23:44:53 dawes Exp $ */ #include <stdio.h> #include <X11/Intrinsic.h> Index: xc/programs/fsinfo/Imakefile diff -u xc/programs/fsinfo/Imakefile:1.1.1.2 xc/programs/fsinfo/Imakefile:removed --- xc/programs/fsinfo/Imakefile:1.1.1.2 Sat Dec 21 22:31:28 1996 +++ xc/programs/fsinfo/Imakefile Mon Jun 4 12:42:48 2001 @@ -1,9 +0,0 @@ -XCOMM $XConsortium: Imakefile /main/8 1996/09/28 17:16:50 rws $ -LOCAL_LIBRARIES = $(FSLIB) -DEPLIBS = $(DEPFSLIB) -SRCS = fsinfo.c -OBJS = fsinfo.o -INCLUDES = -I$(XBUILDINCDIR)/fonts -I$(FONTINCSRC) - -ComplexProgramTarget(fsinfo) - Index: xc/programs/fsinfo/fsinfo.c diff -u xc/programs/fsinfo/fsinfo.c:3.3 xc/programs/fsinfo/fsinfo.c:removed --- xc/programs/fsinfo/fsinfo.c:3.3 Fri Feb 19 16:27:07 1999 +++ xc/programs/fsinfo/fsinfo.c Mon Jun 4 12:42:48 2001 @@ -1,172 +0,0 @@ -/* - * fsinfo -- report info about a font server - */ - -/* $TOG: fsinfo.c /main/7 1998/02/09 13:43:08 kaleb $ */ -/* - -Portions Copyright 1987, 1998 The Open Group - -All Rights Reserved. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ -/* $XFree86: xc/programs/fsinfo/fsinfo.c,v 3.3 1999/02/19 21:27:07 hohndel Exp $ */ - -/* - * Copyright 1990 Network Computing Devices; - * Portions Copyright 1987 by Digital Equipment Corporation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * documentation for any purpose is hereby granted without fee, provided that - * the above copyright notice appear in all copies and that both that - * copyright notice and this permission notice appear in supporting - * documentation, and that the names of Network Computing Devices - * or Digital not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. Network Computing Devices and Digital - * make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH - * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES OR DIGITAL BE - * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES - * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION - * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN - * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - */ - -#include <stdio.h> -#include <X11/Xos.h> -#include "FSlib.h" - -static void print_server_info(FSServer *svr); -static void print_catalogue_info(FSServer *svr); -static void print_extension_info(FSServer *svr); -static void print_alternate_info(FSServer *svr); - -char *progname; - -static void -usage(void) -{ - fprintf(stderr, "usage: %s [-server server_name]\n", progname); - exit(-1); -} - -int -main(int argc, char *argv[]) -{ - FSServer *svr; - char *servername = NULL; - int i; - - progname = argv[0]; - - for (i = 1; i < argc; i++) { - if (strncmp(argv[i], "-s", 2) == 0) { - if (++i > argc) - usage(); - servername = argv[i]; - } else { - usage(); - } - } - - svr = FSOpenServer(servername); - - if (!svr) { - if (FSServerName(servername) == NULL) { - fprintf(stderr, "%s: no font server defined\n", progname); - exit(1); - } - fprintf(stderr, "%s: unable to open server \"%s\"\n", - progname, FSServerName(servername)); - exit(1); - } - print_server_info(svr); - FSCloseServer(svr); - exit(0); -} - -static void -print_server_info(FSServer *svr) -{ - printf("name of server: %s\n", FSServerString(svr)); - printf("version number: %d\n", FSProtocolVersion(svr)); - printf("vendor string: %s\n", FSServerVendor(svr)); - printf("vendor release number: %d\n", FSVendorRelease(svr)); - printf("maximum request size: %ld longwords (%ld bytes)\n", - FSMaxRequestSize(svr), FSMaxRequestSize(svr) * sizeof(long)); - print_catalogue_info(svr); - print_alternate_info(svr); - print_extension_info(svr); -} - -static void -print_catalogue_info(FSServer *svr) -{ - int n = 0; - char **cats = FSListCatalogues(svr, "*", 1000, &n); - - printf("number of catalogues: %d\n", n); - if (cats) { - int i; - - for (i = 0; i < n; i++) { - printf(" %s\n", cats[i]); - } - } -} - -static void -print_extension_info(FSServer *svr) -{ - int n = 0; - char **extlist = FSListExtensions(svr, &n); - - printf("number of extensions: %d\n", n); - if (extlist) { - int i; - - for (i = 0; i < n; i++) { - printf(" %s\n", extlist[i]); - } - } -} - -static void -print_alternate_info(FSServer *svr) -{ - AlternateServer *alts; - int i, - num; - - num = FSNumAlternateServers(svr); - printf("Number of alternate servers: %d\n", num); - if (num) { - alts = FSAlternateServers(svr); - for (i = 0; i < num; i++) { - printf(" #%1d\t%s%s\n", i, alts[i].name, - (alts[i].subset) ? "(subset)" : ""); - } - } -} Index: xc/programs/fsinfo/fsinfo.man diff -u xc/programs/fsinfo/fsinfo.man:1.4 xc/programs/fsinfo/fsinfo.man:removed --- xc/programs/fsinfo/fsinfo.man:1.4 Sun Oct 4 05:40:03 1998 +++ xc/programs/fsinfo/fsinfo.man Mon Jun 4 12:42:48 2001 @@ -1,63 +0,0 @@ -.\" $TOG: fsinfo.man /main/10 1998/02/09 13:43:12 kaleb $ -.\" Copyright 1991, Network Computing Devices, Inc -.\" Copyright 1993, 1998 The Open Group -.\" -.\" All Rights Reserved. -.\" -.\" The above copyright notice and this permission notice shall be included -.\" in all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -.\" OTHER DEALINGS IN THE SOFTWARE. -.\" -.\" Except as contained in this notice, the name of The Open Group shall -.\" not be used in advertising or otherwise to promote the sale, use or -.\" other dealings in this Software without prior written authorization -.\" from The Open Group. -.TH FSINFO 1 "Release 6.4" "X Version 11" -.SH NAME -fsinfo \- X font server information utility -.SH SYNOPSIS -.B "fsinfo" -[\-server \fIservername\fP] -.SH DESCRIPTION -.PP -.I Fsinfo -is a utility for displaying information about an X font server. It is used to -examine the -capabilities of a server, the predefined values for various parameters used -in communicating between clients and the server, and the font catalogues -and alternate servers that are available. -.SH EXAMPLE -.PP -The following shows a sample produced by -.I fsinfo. -.PP -.nf -name of server: hansen:7100 -version number: 1 -vendor string: Font Server Prototype -vendor release number: 17 -maximum request size: 16384 longwords (65536 bytes) -number of catalogues: 1 - all -Number of alternate servers: 2 - #0 hansen:7101 - #1 hansen:7102 -number of extensions: 0 -.fi - -.SH ENVIRONMENT -.PP -.TP 8 -.B FONTSERVER -To get the default fontserver. -.SH "SEE ALSO" -xfs(1), fslsfonts(1) -.SH AUTHOR -Dave Lemke, Network Computing Devices, Inc Index: xc/programs/fslsfonts/Imakefile diff -u xc/programs/fslsfonts/Imakefile:1.1.1.2 xc/programs/fslsfonts/Imakefile:1.1.1.3 --- xc/programs/fslsfonts/Imakefile:1.1.1.2 Sat Dec 21 23:10:17 1996 +++ xc/programs/fslsfonts/Imakefile Tue Jan 16 17:45:42 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/8 1996/09/28 17:17:00 rws $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ LOCAL_LIBRARIES = $(FSLIB) DEPLIBS = $(DEPFSLIB) SRCS = fslsfonts.c Index: xc/programs/fslsfonts/fslsfonts.c diff -u xc/programs/fslsfonts/fslsfonts.c:3.4 xc/programs/fslsfonts/fslsfonts.c:3.5 --- xc/programs/fslsfonts/fslsfonts.c:3.4 Sun Dec 26 19:40:00 1999 +++ xc/programs/fslsfonts/fslsfonts.c Wed Jan 17 18:44:53 2001 @@ -1,4 +1,4 @@ -/* $TOG: fslsfonts.c /main/8 1998/02/09 13:43:17 kaleb $ */ +/* $Xorg: fslsfonts.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group @@ -39,7 +39,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/fslsfonts/fslsfonts.c,v 3.4 1999/12/27 00:40:00 robin Exp $ */ +/* $XFree86: xc/programs/fslsfonts/fslsfonts.c,v 3.5 2001/01/17 23:44:53 dawes Exp $ */ #include "FSlib.h" #include <stdio.h> Index: xc/programs/fslsfonts/fslsfonts.man diff -u xc/programs/fslsfonts/fslsfonts.man:1.4 xc/programs/fslsfonts/fslsfonts.man:1.6 --- xc/programs/fslsfonts/fslsfonts.man:1.4 Sun Oct 4 05:40:04 1998 +++ xc/programs/fslsfonts/fslsfonts.man Sat Jan 27 13:21:01 2001 @@ -1,4 +1,4 @@ -.\" $TOG: fslsfonts.man /main/10 1998/02/09 13:43:22 kaleb $ +.\" $Xorg: fslsfonts.man,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ .\" Copyright 1991, Network Computing Devices, Inc .\" Copyright 1993, 1994, 1998 The Open Group .\" @@ -19,7 +19,10 @@ .\" 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. -.TH FSLSFONTS 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/fslsfonts/fslsfonts.man,v 1.6 2001/01/27 18:21:01 dawes Exp $ +.\" +.TH FSLSFONTS 1 __xorgversion__ .SH NAME fslsfonts \- list fonts served by X font server .SH SYNOPSIS Index: xc/programs/fstobdf/Imakefile diff -u xc/programs/fstobdf/Imakefile:1.1.1.2 xc/programs/fstobdf/Imakefile:1.1.1.3 --- xc/programs/fstobdf/Imakefile:1.1.1.2 Sat Dec 21 22:31:35 1996 +++ xc/programs/fstobdf/Imakefile Tue Jan 16 17:45:46 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/10 1996/09/28 17:17:07 rws $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ LOCAL_LIBRARIES = $(FSLIB) $(XLIB) DEPLIBS = $(DEPFSLIB) $(DEPXLIB) INCLUDES = -I$(XBUILDINCDIR)/fonts -I$(FONTINCSRC) Index: xc/programs/fstobdf/chars.c diff -u xc/programs/fstobdf/chars.c:3.5 xc/programs/fstobdf/chars.c:3.7 --- xc/programs/fstobdf/chars.c:3.5 Thu Jun 15 16:50:03 2000 +++ xc/programs/fstobdf/chars.c Sat Mar 3 19:16:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: chars.c /main/5 1998/02/09 13:43:27 kaleb $ */ +/* $Xorg: chars.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group @@ -39,7 +39,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/fstobdf/chars.c,v 3.5 2000/06/15 20:50:03 dawes Exp $ */ +/* $XFree86: xc/programs/fstobdf/chars.c,v 3.7 2001/03/04 00:16:31 tsi Exp $ */ /* Morten Storgaard Nielsen: chars.c,v 3.2-1 2000/01/30 14:11:19 kat Exp */ @@ -115,7 +115,7 @@ charInfo->left, -charInfo->descent); if (charInfo->attributes) - fprintf(outFile, "ATTRIBUTES 0x%04x\n", charInfo->attributes); + fprintf(outFile, "ATTRIBUTES %04x\n", charInfo->attributes); /* * emit the bitmap Index: xc/programs/fstobdf/fstobdf.c diff -u xc/programs/fstobdf/fstobdf.c:1.3 xc/programs/fstobdf/fstobdf.c:1.5 --- xc/programs/fstobdf/fstobdf.c:1.3 Sat Feb 20 10:07:15 1999 +++ xc/programs/fstobdf/fstobdf.c Sun Apr 1 10:00:18 2001 @@ -1,4 +1,4 @@ -/* $TOG: fstobdf.c /main/6 1998/02/09 13:43:32 kaleb $ */ +/* $Xorg: fstobdf.c,v 1.3 2000/08/17 19:53:52 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group @@ -39,9 +39,10 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/fstobdf/fstobdf.c,v 1.3 1999/02/20 15:07:15 hohndel Exp $ */ +/* $XFree86: xc/programs/fstobdf/fstobdf.c,v 1.5 2001/04/01 14:00:18 tsi Exp $ */ #include <stdio.h> +#include <stdlib.h> #include <string.h> #include "fstobdf.h" static void Index: xc/programs/fstobdf/fstobdf.man diff -u xc/programs/fstobdf/fstobdf.man:1.4 xc/programs/fstobdf/fstobdf.man:1.6 --- xc/programs/fstobdf/fstobdf.man:1.4 Sun Oct 4 05:40:06 1998 +++ xc/programs/fstobdf/fstobdf.man Sat Jan 27 13:21:02 2001 @@ -1,4 +1,4 @@ -.\" $TOG: fstobdf.man /main/10 1998/02/09 13:43:42 kaleb $ +.\" $Xorg: fstobdf.man,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ .\" Copyright 1990, Network Computing Devices .\" Copyright 1990, 1998 The Open Group .\" @@ -19,7 +19,10 @@ .\" 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. -.TH FSTOBDF 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/fstobdf/fstobdf.man,v 1.6 2001/01/27 18:21:02 dawes Exp $ +.\" +.TH FSTOBDF 1 __xorgversion__ .SH NAME fstobdf \- generate BDF font from X font server .SH SYNOPSIS Index: xc/programs/fstobdf/header.c diff -u xc/programs/fstobdf/header.c:3.4 xc/programs/fstobdf/header.c:3.5 --- xc/programs/fstobdf/header.c:3.4 Thu Feb 25 01:01:01 1999 +++ xc/programs/fstobdf/header.c Wed Jan 17 18:44:54 2001 @@ -1,4 +1,4 @@ -/* $TOG: header.c /main/6 1998/02/09 13:43:52 kaleb $ */ +/* $Xorg: header.c,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group @@ -39,7 +39,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/fstobdf/header.c,v 3.4 1999/02/25 06:01:01 dawes Exp $ */ +/* $XFree86: xc/programs/fstobdf/header.c,v 3.5 2001/01/17 23:44:54 dawes Exp $ */ #include <stdio.h> #include <X11/Xosdefs.h> Index: xc/programs/fstobdf/props.c diff -u xc/programs/fstobdf/props.c:1.4 xc/programs/fstobdf/props.c:1.5 --- xc/programs/fstobdf/props.c:1.4 Thu Feb 25 01:01:01 1999 +++ xc/programs/fstobdf/props.c Wed Jan 17 18:44:54 2001 @@ -1,4 +1,4 @@ -/* $TOG: props.c /main/5 1998/02/09 13:43:57 kaleb $ */ +/* $Xorg: props.c,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ */ /* Copyright 1990, 1991, 1998 The Open Group @@ -39,7 +39,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/fstobdf/props.c,v 1.4 1999/02/25 06:01:01 dawes Exp $ */ +/* $XFree86: xc/programs/fstobdf/props.c,v 1.5 2001/01/17 23:44:54 dawes Exp $ */ #include <stdio.h> #include <string.h> Index: xc/programs/glxgears/Imakefile diff -u /dev/null xc/programs/glxgears/Imakefile:1.1 --- /dev/null Mon Jun 4 12:42:48 2001 +++ xc/programs/glxgears/Imakefile Mon Apr 2 17:12:11 2001 @@ -0,0 +1,8 @@ +XCOMM $XConsortium: Imakefile /main/7 1995/12/04 15:10:00 dpw $ +XCOMM $XFree86: xc/programs/glxgears/Imakefile,v 1.1 2001/04/02 21:12:11 dawes Exp $ +#include <Threads.tmpl> + DEPLIBS = $(DEPGLXLIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(GLXLIB) $(XLIB) + SYS_LIBRARIES = MathLibrary + +SimpleProgramTarget(glxgears) Index: xc/programs/glxgears/glxgears.c diff -u /dev/null xc/programs/glxgears/glxgears.c:1.2 --- /dev/null Mon Jun 4 12:42:48 2001 +++ xc/programs/glxgears/glxgears.c Tue Apr 3 11:56:26 2001 @@ -0,0 +1,498 @@ +/* + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ +/* $XFree86: xc/programs/glxgears/glxgears.c,v 1.2 2001/04/03 15:56:26 dawes Exp $ */ + +/* + * This is a port of the infamous "gears" demo to straight GLX (i.e. no GLUT) + * Port by Brian Paul 23 March 2001 + * + * Command line options: + * -info print GL implementation information + * + */ + + +#include <math.h> +#include <stdlib.h> +#include <stdio.h> +#include <string.h> +#include <X11/Xlib.h> +#include <X11/keysym.h> +#include <GL/gl.h> +#include <GL/glx.h> + + +#define BENCHMARK + +#ifdef BENCHMARK + +/* XXX this probably isn't very portable */ + +#include <sys/time.h> +#include <unistd.h> + +/* return current time (in seconds) */ +static int +current_time(void) +{ + struct timeval tv; + struct timezone tz; + (void) gettimeofday(&tv, &tz); + return (int) tv.tv_sec; +} + +#else /*BENCHMARK*/ + +/* dummy */ +static int +current_time(void) +{ + return 0; +} + +#endif /*BENCHMARK*/ + + + +#ifndef M_PI +#define M_PI 3.14159265 +#endif + + +static GLfloat view_rotx = 20.0, view_roty = 30.0, view_rotz = 0.0; +static GLint gear1, gear2, gear3; +static GLfloat angle = 0.0; + + +/* + * + * Draw a gear wheel. You'll probably want to call this function when + * building a display list since we do a lot of trig here. + * + * Input: inner_radius - radius of hole at center + * outer_radius - radius at center of teeth + * width - width of gear + * teeth - number of teeth + * tooth_depth - depth of tooth + */ +static void +gear(GLfloat inner_radius, GLfloat outer_radius, GLfloat width, + GLint teeth, GLfloat tooth_depth) +{ + GLint i; + GLfloat r0, r1, r2; + GLfloat angle, da; + GLfloat u, v, len; + + r0 = inner_radius; + r1 = outer_radius - tooth_depth / 2.0; + r2 = outer_radius + tooth_depth / 2.0; + + da = 2.0 * M_PI / teeth / 4.0; + + glShadeModel(GL_FLAT); + + glNormal3f(0.0, 0.0, 1.0); + + /* draw front face */ + glBegin(GL_QUAD_STRIP); + for (i = 0; i <= teeth; i++) { + angle = i * 2.0 * M_PI / teeth; + glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); + glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); + if (i < teeth) { + glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), + width * 0.5); + } + } + glEnd(); + + /* draw front sides of teeth */ + glBegin(GL_QUADS); + da = 2.0 * M_PI / teeth / 4.0; + for (i = 0; i < teeth; i++) { + angle = i * 2.0 * M_PI / teeth; + + glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5); + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), + width * 0.5); + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), + width * 0.5); + } + glEnd(); + + glNormal3f(0.0, 0.0, -1.0); + + /* draw back face */ + glBegin(GL_QUAD_STRIP); + for (i = 0; i <= teeth; i++) { + angle = i * 2.0 * M_PI / teeth; + glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); + glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); + if (i < teeth) { + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), + -width * 0.5); + glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); + } + } + glEnd(); + + /* draw back sides of teeth */ + glBegin(GL_QUADS); + da = 2.0 * M_PI / teeth / 4.0; + for (i = 0; i < teeth; i++) { + angle = i * 2.0 * M_PI / teeth; + + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), + -width * 0.5); + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), + -width * 0.5); + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5); + glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); + } + glEnd(); + + /* draw outward faces of teeth */ + glBegin(GL_QUAD_STRIP); + for (i = 0; i < teeth; i++) { + angle = i * 2.0 * M_PI / teeth; + + glVertex3f(r1 * cos(angle), r1 * sin(angle), width * 0.5); + glVertex3f(r1 * cos(angle), r1 * sin(angle), -width * 0.5); + u = r2 * cos(angle + da) - r1 * cos(angle); + v = r2 * sin(angle + da) - r1 * sin(angle); + len = sqrt(u * u + v * v); + u /= len; + v /= len; + glNormal3f(v, -u, 0.0); + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), width * 0.5); + glVertex3f(r2 * cos(angle + da), r2 * sin(angle + da), -width * 0.5); + glNormal3f(cos(angle), sin(angle), 0.0); + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), + width * 0.5); + glVertex3f(r2 * cos(angle + 2 * da), r2 * sin(angle + 2 * da), + -width * 0.5); + u = r1 * cos(angle + 3 * da) - r2 * cos(angle + 2 * da); + v = r1 * sin(angle + 3 * da) - r2 * sin(angle + 2 * da); + glNormal3f(v, -u, 0.0); + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), + width * 0.5); + glVertex3f(r1 * cos(angle + 3 * da), r1 * sin(angle + 3 * da), + -width * 0.5); + glNormal3f(cos(angle), sin(angle), 0.0); + } + + glVertex3f(r1 * cos(0), r1 * sin(0), width * 0.5); + glVertex3f(r1 * cos(0), r1 * sin(0), -width * 0.5); + + glEnd(); + + glShadeModel(GL_SMOOTH); + + /* draw inside radius cylinder */ + glBegin(GL_QUAD_STRIP); + for (i = 0; i <= teeth; i++) { + angle = i * 2.0 * M_PI / teeth; + glNormal3f(-cos(angle), -sin(angle), 0.0); + glVertex3f(r0 * cos(angle), r0 * sin(angle), -width * 0.5); + glVertex3f(r0 * cos(angle), r0 * sin(angle), width * 0.5); + } + glEnd(); +} + + +static void +draw(void) +{ + glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); + + glPushMatrix(); + glRotatef(view_rotx, 1.0, 0.0, 0.0); + glRotatef(view_roty, 0.0, 1.0, 0.0); + glRotatef(view_rotz, 0.0, 0.0, 1.0); + + glPushMatrix(); + glTranslatef(-3.0, -2.0, 0.0); + glRotatef(angle, 0.0, 0.0, 1.0); + glCallList(gear1); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(3.1, -2.0, 0.0); + glRotatef(-2.0 * angle - 9.0, 0.0, 0.0, 1.0); + glCallList(gear2); + glPopMatrix(); + + glPushMatrix(); + glTranslatef(-3.1, 4.2, 0.0); + glRotatef(-2.0 * angle - 25.0, 0.0, 0.0, 1.0); + glCallList(gear3); + glPopMatrix(); + + glPopMatrix(); +} + + +/* new window size or exposure */ +static void +reshape(int width, int height) +{ + GLfloat h = (GLfloat) height / (GLfloat) width; + + glViewport(0, 0, (GLint) width, (GLint) height); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + glFrustum(-1.0, 1.0, -h, h, 5.0, 60.0); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + glTranslatef(0.0, 0.0, -40.0); +} + + +static void +init(void) +{ + static GLfloat pos[4] = { 5.0, 5.0, 10.0, 0.0 }; + static GLfloat red[4] = { 0.8, 0.1, 0.0, 1.0 }; + static GLfloat green[4] = { 0.0, 0.8, 0.2, 1.0 }; + static GLfloat blue[4] = { 0.2, 0.2, 1.0, 1.0 }; + + glLightfv(GL_LIGHT0, GL_POSITION, pos); + glEnable(GL_CULL_FACE); + glEnable(GL_LIGHTING); + glEnable(GL_LIGHT0); + glEnable(GL_DEPTH_TEST); + + /* make the gears */ + gear1 = glGenLists(1); + glNewList(gear1, GL_COMPILE); + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red); + gear(1.0, 4.0, 1.0, 20, 0.7); + glEndList(); + + gear2 = glGenLists(1); + glNewList(gear2, GL_COMPILE); + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, green); + gear(0.5, 2.0, 2.0, 10, 0.7); + glEndList(); + + gear3 = glGenLists(1); + glNewList(gear3, GL_COMPILE); + glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, blue); + gear(1.3, 2.0, 0.5, 10, 0.7); + glEndList(); + + glEnable(GL_NORMALIZE); +} + + +/* + * Create an RGB, double-buffered window. + * Return the window and context handles. + */ +static void +make_window( Display *dpy, const char *name, + int x, int y, int width, int height, + Window *winRet, GLXContext *ctxRet) +{ + int attrib[] = { GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DOUBLEBUFFER, + GLX_DEPTH_SIZE, 1, + None }; + int scrnum; + XSetWindowAttributes attr; + unsigned long mask; + Window root; + Window win; + GLXContext ctx; + XVisualInfo *visinfo; + + scrnum = DefaultScreen( dpy ); + root = RootWindow( dpy, scrnum ); + + visinfo = glXChooseVisual( dpy, scrnum, attrib ); + if (!visinfo) { + printf("Error: couldn't get an RGB, Double-buffered visual\n"); + exit(1); + } + + /* window attributes */ + attr.background_pixel = 0; + attr.border_pixel = 0; + attr.colormap = XCreateColormap( dpy, root, visinfo->visual, AllocNone); + attr.event_mask = StructureNotifyMask | ExposureMask | KeyPressMask; + mask = CWBackPixel | CWBorderPixel | CWColormap | CWEventMask; + + win = XCreateWindow( dpy, root, 0, 0, width, height, + 0, visinfo->depth, InputOutput, + visinfo->visual, mask, &attr ); + + /* set hints and properties */ + { + XSizeHints sizehints; + sizehints.x = x; + sizehints.y = y; + sizehints.width = width; + sizehints.height = height; + sizehints.flags = USSize | USPosition; + XSetNormalHints(dpy, win, &sizehints); + XSetStandardProperties(dpy, win, name, name, + None, (char **)NULL, 0, &sizehints); + } + + ctx = glXCreateContext( dpy, visinfo, NULL, True ); + if (!ctx) { + printf("Error: glXCreateContext failed\n"); + exit(1); + } + + XFree(visinfo); + + *winRet = win; + *ctxRet = ctx; +} + + +static void +event_loop(Display *dpy, Window win) +{ + while (1) { + while (XPending(dpy) > 0) { + XEvent event; + XNextEvent(dpy, &event); + switch (event.type) { + case Expose: + /* we'll redraw below */ + break; + case ConfigureNotify: + reshape(event.xconfigure.width, event.xconfigure.height); + break; + case KeyPress: + { + char buffer[10]; + int r, code; + code = XLookupKeysym(&event.xkey, 0); + if (code == XK_Left) { + view_roty += 5.0; + } + else if (code == XK_Right) { + view_roty -= 5.0; + } + else if (code == XK_Up) { + view_rotx += 5.0; + } + else if (code == XK_Down) { + view_rotx -= 5.0; + } + else { + r = XLookupString(&event.xkey, buffer, sizeof(buffer), + NULL, NULL); + if (buffer[0] == 27) { + /* escape */ + return; + } + } + } + } + } + + /* next frame */ + angle += 2.0; + + draw(); + glXSwapBuffers(dpy, win); + + /* calc framerate */ + { + static int t0 = -1; + static int frames = 0; + int t = current_time(); + + if (t0 < 0) + t0 = t; + + frames++; + + if (t - t0 >= 5.0) { + GLfloat seconds = t - t0; + GLfloat fps = frames / seconds; + printf("%d frames in %3.1f seconds = %6.3f FPS\n", frames, seconds, + fps); + t0 = t; + frames = 0; + } + } + } +} + + +int +main(int argc, char *argv[]) +{ + Display *dpy; + Window win; + GLXContext ctx; + char *dpyName = NULL; + GLboolean printInfo = GL_FALSE; + int i; + + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-display") == 0) { + dpyName = argv[i+1]; + i++; + } + else if (strcmp(argv[i], "-info") == 0) { + printInfo = GL_TRUE; + } + } + + dpy = XOpenDisplay(dpyName); + if (!dpy) { + printf("Error: couldn't open display %s\n", dpyName); + return -1; + } + + make_window(dpy, "glxgears", 0, 0, 300, 300, &win, &ctx); + XMapWindow(dpy, win); + glXMakeCurrent(dpy, win, ctx); + + if (printInfo) { + printf("GL_RENDERER = %s\n", (char *) glGetString(GL_RENDERER)); + printf("GL_VERSION = %s\n", (char *) glGetString(GL_VERSION)); + printf("GL_VENDOR = %s\n", (char *) glGetString(GL_VENDOR)); + printf("GL_EXTENSIONS = %s\n", (char *) glGetString(GL_EXTENSIONS)); + } + + init(); + + event_loop(dpy, win); + + glXDestroyContext(dpy, ctx); + XDestroyWindow(dpy, win); + XCloseDisplay(dpy); + + return 0; +} Index: xc/programs/glxgears/glxgears.man diff -u /dev/null xc/programs/glxgears/glxgears.man:1.1 --- /dev/null Mon Jun 4 12:42:48 2001 +++ xc/programs/glxgears/glxgears.man Mon Apr 2 17:12:11 2001 @@ -0,0 +1,30 @@ +.\" $XFree86: xc/programs/glxgears/glxgears.man,v 1.1 2001/04/02 21:12:11 dawes Exp $ +.\" +.TH GLXGEARS 1 __vendorversion__ +.SH NAME +glxgears \- GLX version of the infamous "gears" GL demo. +.SH SYNOPSIS +.B "glxgears" +[\-info] +[\-display \fIdisplayname\fP] +.SH DESCRIPTION +.PP +.I glxgears +is a GLX demo that draws three rotating gears, and prints out framerate +information to stdout. +Command line options include: +.TP 8 +.B \-info +Print out GL implementation information before running the demo. +.TP 8 +.BI "\-display " displayname +Specify the display to query. +.SH ENVIRONMENT +.PP +.TP 8 +.B DISPLAY +To get the default host, display number, and screen. +.SH "SEE ALSO" +glxinfo(1) +.SH AUTHOR +Ported to straight GLX by Brian Paul. Index: xc/programs/glxinfo/Imakefile diff -u xc/programs/glxinfo/Imakefile:1.1 xc/programs/glxinfo/Imakefile:1.4 --- xc/programs/glxinfo/Imakefile:1.1 Fri Sep 22 07:35:46 2000 +++ xc/programs/glxinfo/Imakefile Mon Apr 2 16:58:45 2001 @@ -1,57 +1,8 @@ -XCOMM $XConsortium: Imakefile /main/7 1995/12/04 15:10:00 dpw $ -XCOMM $XFree86: xc/programs/glxinfo/Imakefile,v 1.1 2000/09/22 11:35:46 alanh Exp $ - DEPLIBS = $(DEPXTESTLIB) $(DEPXIELIB) $(DEPXLIB) $(DEPXKBFILELIB) $(DEPXF86LIBS) $(DEPXILIB) -#ifndef OS2Architecture -LOCAL_LIBRARIES = $(GLXLIB) $(XLIB) -#else -LOCAL_LIBRARIES = $(GLXLIB) $(XLIB) -#endif - SYS_LIBRARIES = MathLibrary - - -#if HasShm - SHMDEFINES = -DMITSHM -#endif - -#if BuildXF86VidModeExt - VIDMODEDEFINES = -DXF86VIDMODE - VIDMODEDEPLIBS = $(DEPXXF86VMLIB) - VIDMODELIBS = $(XXF86VMLIB) -#endif - -#if BuildXF86DGA - DGADEFINES = -DXFreeXDGA - DGADEPLIBS = $(DEPXXF86DGALIB) - DGALIBS = $(XXF86DGALIB) -#endif - -#if BuildXF86MiscExt - XF86MISCDEFINES = -DXF86MISC - XF86MISCDEPLIBS = $(DEPXXF86MISCLIB) - XF86MISCLIBS = $(XXF86MISCLIB) -#endif +XCOMM $XFree86: xc/programs/glxinfo/Imakefile,v 1.4 2001/04/02 20:58:45 dawes Exp $ -#if BuildXInputExt - XINPUTDEFINES = -DXINPUT - XINPUTDEPLIBS = $(DEPXILIB) - XINPUTLIBS = $(XILIB) -#endif - - XF86DEFINES = $(VIDMODEDEFINES) $(DGADEFINES) $(XF86MISCDEFINES) - DEPXF86LIBS = $(VIDMODEDEPLIBS) $(DGADEPLIBS) $(XF86MISCDEPLIBS) - XF86LIBS = $(VIDMODELIBS) $(DGALIBS) $(XF86MISCLIBS) - -#if BuildMultibuffer - MULTIBUFDEFINES = -DMULTIBUFFER -#endif - -#if BuildXKB - XKBDEFINES = -DXKB -#endif - - OTHERDEFINES = $(SHMDEFINES) $(XKBDEFINES) $(XINPUTDEFINES) \ - $(MULTIBUFDEFINES) - - DEFINES = $(OTHERDEFINES) $(XF86DEFINES) +#include <Threads.tmpl> + DEPLIBS = $(DEPGLULIB) $(DEPGLXLIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(GLULIB) $(GLXLIB) $(XLIB) + SYS_LIBRARIES = MathLibrary SimpleProgramTarget(glxinfo) Index: xc/programs/glxinfo/glxinfo.c diff -u xc/programs/glxinfo/glxinfo.c:1.2 xc/programs/glxinfo/glxinfo.c:1.6 --- xc/programs/glxinfo/glxinfo.c:1.2 Tue Sep 26 11:57:23 2000 +++ xc/programs/glxinfo/glxinfo.c Mon Apr 2 18:13:18 2001 @@ -1,7 +1,7 @@ -/* $Id: glxinfo.c,v 1.10 2000/05/08 14:53:57 brianp Exp $ */ +/* Id: glxinfo.c,v 1.12 2001/03/23 21:41:44 brianp Exp $ */ /* - * Copyright (C) 1999 Brian Paul All Rights Reserved. + * Copyright (C) 1999-2001 Brian Paul All Rights Reserved. * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -20,7 +20,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/programs/glxinfo/glxinfo.c,v 1.2 2000/09/26 15:57:23 tsi Exp $ */ +/* $XFree86: xc/programs/glxinfo/glxinfo.c,v 1.6 2001/04/02 22:13:18 dawes Exp $ */ /* * This program is a work-alike of the IRIX glxinfo program. @@ -28,25 +28,29 @@ * -t print wide table * -v print verbose information * -display DisplayName specify the X display to interogate + * -b only print ID of "best" visual on screen 0 * * Brian Paul 26 January 2000 - * Mark Paton 09 September 2000 - Minor mods for XFree86 */ +#define DO_GLU #include <X11/Xlib.h> #include <X11/Xutil.h> #include <GL/gl.h> - -/* This is commented out because at this time the GLU library - * is not part of XFree86. - * #include <GL/glu.h> - * */ - +#ifdef DO_GLU +#include <GL/glu.h> +#endif #include <GL/glx.h> #include <stdio.h> #include <string.h> +#include <stdlib.h> + +#ifndef GLX_NONE_EXT +#define GLX_NONE_EXT 0x8000 +#endif + typedef enum { @@ -137,6 +141,13 @@ static void +print_display_info(Display *dpy) +{ + printf("name of display: %s\n", DisplayString(dpy)); +} + + +static void print_screen_info(Display *dpy, int scrnum) { Window win; @@ -200,11 +211,26 @@ const char *glRenderer = (const char *) glGetString(GL_RENDERER); const char *glVersion = (const char *) glGetString(GL_VERSION); const char *glExtensions = (const char *) glGetString(GL_EXTENSIONS); -/*MP - Commented out glu stuff as the library is not currently part of XF86 + char *displayName = NULL; + char *colon = NULL, *period = NULL; +#ifdef DO_GLU const char *gluVersion = (const char *) gluGetString(GLU_VERSION); const char *gluExtensions = (const char *) gluGetString(GLU_EXTENSIONS); -*/ - printf("display: %s screen:%d\n", DisplayString(dpy), scrnum); +#endif + /* Strip the screen number from the display name, if present. */ + if (!(displayName = malloc(strlen(DisplayString(dpy)) + 1))) { + fprintf(stderr, "Error: malloc() failed\n"); + exit(1); + } + strcpy(displayName, DisplayString(dpy)); + colon = strrchr(displayName, ':'); + if (colon) { + period = strchr(colon, '.'); + if (period) + *period = '\0'; + } + printf("display: %s screen: %d\n", displayName, scrnum); + free(displayName); printf("direct rendering: %s\n", glXIsDirect(dpy, ctx) ? "Yes" : "No"); printf("server glx vendor string: %s\n", serverVendor); printf("server glx version string: %s\n", serverVersion); @@ -221,11 +247,11 @@ printf("OpenGL version string: %s\n", glVersion); printf("OpenGL extensions:\n"); print_extension_list(glExtensions); -/* +#ifdef DO_GLU printf("glu version: %s\n", gluVersion); printf("glu extensions:\n"); print_extension_list(gluExtensions); -*/ +#endif } else { fprintf(stderr, "Error: glXMakeCurrent failed\n"); @@ -390,6 +416,8 @@ caveat = "Slow"; else if (attribs->visualCaveat == GLX_NON_CONFORMANT_VISUAL_EXT) caveat = "Ncon"; + else + caveat = "None"; #else caveat = "None"; #endif @@ -499,13 +527,106 @@ } +/* + * Stand-alone Mesa doesn't really implement the GLX protocol so it + * doesn't really know the GLX attributes associated with an X visual. + * The first time a visual is presented to Mesa's pseudo-GLX it + * attaches ancilliary buffers to it (like depth and stencil). + * But that usually only works if glXChooseVisual is used. + * This function calls glXChooseVisual() to sort of "prime the pump" + * for Mesa's GLX so that the visuals that get reported actually + * reflect what applications will see. + * This has no effect when using true GLX. + */ +static void +mesa_hack(Display *dpy, int scrnum) +{ + static int attribs[] = { + GLX_RGBA, + GLX_RED_SIZE, 1, + GLX_GREEN_SIZE, 1, + GLX_BLUE_SIZE, 1, + GLX_DEPTH_SIZE, 1, + GLX_STENCIL_SIZE, 1, + GLX_ACCUM_RED_SIZE, 1, + GLX_ACCUM_GREEN_SIZE, 1, + GLX_ACCUM_BLUE_SIZE, 1, + GLX_ACCUM_ALPHA_SIZE, 1, + GLX_DOUBLEBUFFER, + None + }; + XVisualInfo *visinfo; + + visinfo = glXChooseVisual(dpy, scrnum, attribs); + if (visinfo) + XFree(visinfo); +} + + +/* + * Examine all visuals to find the so-called best one. + * We prefer deepest RGBA buffer with depth, stencil and accum + * that has no caveats. + */ +static int +find_best_visual(Display *dpy, int scrnum) +{ + XVisualInfo template; + XVisualInfo *visuals; + int numVisuals; + long mask; + int i; + struct visual_attribs bestVis; + + /* get list of all visuals on this screen */ + template.screen = scrnum; + mask = VisualScreenMask; + visuals = XGetVisualInfo(dpy, mask, &template, &numVisuals); + + /* init bestVis with first visual info */ + get_visual_attribs(dpy, &visuals[0], &bestVis); + + /* try to find a "better" visual */ + for (i = 1; i < numVisuals; i++) { + struct visual_attribs vis; + + get_visual_attribs(dpy, &visuals[i], &vis); + + /* always skip visuals with caveats */ + if (vis.visualCaveat != GLX_NONE_EXT) + continue; + + /* see if this vis is better than bestVis */ + if ((!bestVis.supportsGL && vis.supportsGL) || + (bestVis.visualCaveat != GLX_NONE_EXT) || + (!bestVis.rgba && vis.rgba) || + (!bestVis.doubleBuffer && vis.doubleBuffer) || + (bestVis.redSize < vis.redSize) || + (bestVis.greenSize < vis.greenSize) || + (bestVis.blueSize < vis.blueSize) || + (bestVis.alphaSize < vis.alphaSize) || + (bestVis.depthSize < vis.depthSize) || + (bestVis.stencilSize < vis.stencilSize) || + (bestVis.accumRedSize < vis.accumRedSize)) { + /* found a better visual */ + bestVis = vis; + } + } + + XFree(visuals); + + return bestVis.id; +} + + int main(int argc, char *argv[]) { - char *displayName = ":0"; + char *displayName = NULL; Display *dpy; int numScreens, scrnum; InfoMode mode = Normal; + GLboolean findBest = GL_FALSE; int i; for (i = 1; i < argc; i++) { @@ -519,6 +640,9 @@ else if (strcmp(argv[i], "-v") == 0) { mode = Verbose; } + else if (strcmp(argv[i], "-b") == 0) { + findBest = GL_TRUE; + } } dpy = XOpenDisplay(displayName); @@ -527,13 +651,23 @@ return -1; } - numScreens = ScreenCount(dpy); - for (scrnum = 0; scrnum < numScreens; scrnum++) { - print_screen_info(dpy, scrnum); - printf("\n"); - print_visual_info(dpy, scrnum, mode); - if (scrnum + 1 < numScreens) - printf("\n\n"); + if (findBest) { + int b; + mesa_hack(dpy, 0); + b = find_best_visual(dpy, 0); + printf("%d\n", b); + } + else { + numScreens = ScreenCount(dpy); + print_display_info(dpy); + for (scrnum = 0; scrnum < numScreens; scrnum++) { + mesa_hack(dpy, scrnum); + print_screen_info(dpy, scrnum); + printf("\n"); + print_visual_info(dpy, scrnum, mode); + if (scrnum + 1 < numScreens) + printf("\n\n"); + } } XCloseDisplay(dpy); Index: xc/programs/glxinfo/glxinfo.man diff -u xc/programs/glxinfo/glxinfo.man:1.1 xc/programs/glxinfo/glxinfo.man:1.4 --- xc/programs/glxinfo/glxinfo.man:1.1 Fri Sep 22 07:35:46 2000 +++ xc/programs/glxinfo/glxinfo.man Mon Apr 2 17:22:05 2001 @@ -19,15 +19,16 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/glxinfo/glxinfo.man,v 1.1 2000/09/22 11:35:46 alanh Exp $ +.\" $XFree86: xc/programs/glxinfo/glxinfo.man,v 1.4 2001/04/02 21:22:05 dawes Exp $ .\" -.TH GLXINFO 1 "Release 6.4" "X Version 11" +.TH GLXINFO 1 __vendorversion__ .SH NAME glxinfo \- display info about a GLX extension and OpenGL renderer. .SH SYNOPSIS .B "glxinfo" [\-t] [\-v] +[\-b] [\-display \fIdisplayname\fP] .SH DESCRIPTION .PP @@ -39,15 +40,21 @@ buffered, the component sizes, Z-buffering depth, etc). .PP Command line options include: -.PP -\fB-t\fP By default the visual info is presented in a conccise 80 character wide +.TP 8 +.B \-t +By default the visual info is presented in a concise 80 character wide tabular format. The -t option directs glxinfo to produce a wider, more readable tabular format. -.PP -\fB-v\fP Directs glxinfo to generate a verbose format output style for +.TP 8 +.B \-v +Directs glxinfo to generate a verbose format output style for the visual list similar to the info of xdpyinfo. -.PP - \fB-display displayName\fP Specify the display to query. +.TP 8 +.B \-b +Print the ID of the "best" visual on screen 0. +.TP 8 +.BI "\-display " "displayname" +Specify the display to query. .PP .SH ENVIRONMENT .PP Index: xc/programs/iceauth/Imakefile diff -u xc/programs/iceauth/Imakefile:1.3 xc/programs/iceauth/Imakefile:1.4 --- xc/programs/iceauth/Imakefile:1.3 Sun Dec 20 17:18:59 1998 +++ xc/programs/iceauth/Imakefile Wed Jan 17 18:44:54 2001 @@ -1,5 +1,10 @@ -XCOMM $XConsortium: Imakefile,v 1.2 94/02/04 15:39:29 mor Exp $ -XCOMM $XFree86: xc/programs/iceauth/Imakefile,v 1.3 1998/12/20 22:18:59 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/iceauth/Imakefile,v 1.4 2001/01/17 23:44:54 dawes Exp $ + DEPLIBS = $(DEPICELIB) LOCAL_LIBRARIES = $(ICELIB) SRCS = iceauth.c process.c Index: xc/programs/iceauth/iceauth.c diff -u xc/programs/iceauth/iceauth.c:1.3 xc/programs/iceauth/iceauth.c:1.4 --- xc/programs/iceauth/iceauth.c:1.3 Sat Feb 20 10:07:16 1999 +++ xc/programs/iceauth/iceauth.c Wed Jan 17 18:44:54 2001 @@ -1,5 +1,5 @@ /* - * $TOG: iceauth.c /main/3 1998/02/09 13:44:01 kaleb $ + * $Xorg: iceauth.c,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ * * xauth - manipulate authorization file * @@ -25,7 +25,7 @@ * Original Author of "xauth" : Jim Fulton, MIT X Consortium * Modified into "iceauth" : Ralph Mor, X Consortium */ -/* $XFree86: xc/programs/iceauth/iceauth.c,v 1.3 1999/02/20 15:07:16 hohndel Exp $ */ +/* $XFree86: xc/programs/iceauth/iceauth.c,v 1.4 2001/01/17 23:44:54 dawes Exp $ */ #include "iceauth.h" Index: xc/programs/iceauth/iceauth.h diff -u xc/programs/iceauth/iceauth.h:3.2 xc/programs/iceauth/iceauth.h:3.3 --- xc/programs/iceauth/iceauth.h:3.2 Fri Feb 19 16:27:10 1999 +++ xc/programs/iceauth/iceauth.h Wed Jan 17 18:44:54 2001 @@ -1,5 +1,5 @@ /* - * $TOG: iceauth.h /main/4 1998/02/09 13:44:06 kaleb $ + * $Xorg: iceauth.h,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ * * Copyright 1989, 1998 The Open Group @@ -23,7 +23,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/iceauth/iceauth.h,v 3.2 1999/02/19 21:27:10 hohndel Exp $ */ +/* $XFree86: xc/programs/iceauth/iceauth.h,v 3.3 2001/01/17 23:44:54 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> Index: xc/programs/iceauth/iceauth.man diff -u xc/programs/iceauth/iceauth.man:3.4 xc/programs/iceauth/iceauth.man:3.6 --- xc/programs/iceauth/iceauth.man:3.4 Sun Oct 4 05:40:07 1998 +++ xc/programs/iceauth/iceauth.man Sat Jan 27 13:21:03 2001 @@ -1,4 +1,4 @@ -.\" $TOG: iceauth.man /main/8 1998/02/09 13:44:11 kaleb $ +.\" $Xorg: iceauth.man,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ .\" Copyright 1994, 1998 The Open Group .\" @@ -19,7 +19,10 @@ .\" be used in advertising or otherwise to promote the sale, use or other .\" dealing in this Software without prior written authorization from the .\" The Open Group. -.TH ICEAUTH 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/iceauth/iceauth.man,v 3.6 2001/01/27 18:21:03 dawes Exp $ +.\" +.TH ICEAUTH 1 __xorgversion__ .SH NAME iceauth \- ICE authority file utility .SH SYNOPSIS Index: xc/programs/iceauth/process.c diff -u xc/programs/iceauth/process.c:3.2 xc/programs/iceauth/process.c:3.3 --- xc/programs/iceauth/process.c:3.2 Fri Feb 19 16:27:11 1999 +++ xc/programs/iceauth/process.c Wed Jan 17 18:44:54 2001 @@ -1,5 +1,5 @@ /* - * $TOG: process.c /main/8 1998/02/09 13:44:16 kaleb $ + * $Xorg: process.c,v 1.4 2000/08/17 19:53:53 cpqbld Exp $ * * Copyright 1989, 1998 The Open Group @@ -24,7 +24,7 @@ * Modified into "iceauth" : Ralph Mor, X Consortium */ -/* $XFree86: xc/programs/iceauth/process.c,v 3.2 1999/02/19 21:27:11 hohndel Exp $ */ +/* $XFree86: xc/programs/iceauth/process.c,v 3.3 2001/01/17 23:44:54 dawes Exp $ */ #include "iceauth.h" #include <ctype.h> Index: xc/programs/ico/ico.man diff -u xc/programs/ico/ico.man:1.1 xc/programs/ico/ico.man:1.3 --- xc/programs/ico/ico.man:1.1 Sat Feb 12 22:26:13 2000 +++ xc/programs/ico/ico.man Sat Jan 27 13:21:03 2001 @@ -1,6 +1,6 @@ .\" $XConsortium: ico.man,v 1.14 94/04/17 20:45:16 gildea Exp $ -.\" $XFree86: xc/programs/ico/ico.man,v 1.1 2000/02/13 03:26:13 dawes Exp $ -.TH ICO 1 "Release 6" "X Version 11" +.\" $XFree86: xc/programs/ico/ico.man,v 1.3 2001/01/27 18:21:03 dawes Exp $ +.TH ICO 1 __xorgversion__ .SH NAME ico \- animate an icosahedron or other polyhedron .SH SYNOPSIS @@ -78,7 +78,7 @@ files. Doing a 'make' after this will rebuild ico with the new object information. .SH "SEE ALSO" -X(1) +X(__miscmansuffix__) .SH BUGS .LP Pyramids and tetrahedrons with filled faces do not display correctly. @@ -89,4 +89,4 @@ .SH COPYRIGHT Copyright ([\d,\s]*) X Consortium .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. Index: xc/programs/lbxproxy/Imakefile diff -u xc/programs/lbxproxy/Imakefile:1.13 xc/programs/lbxproxy/Imakefile:1.14 --- xc/programs/lbxproxy/Imakefile:1.13 Mon Jan 31 14:33:40 2000 +++ xc/programs/lbxproxy/Imakefile Wed Jan 17 18:44:55 2001 @@ -1,10 +1,10 @@ -XCOMM $TOG: Imakefile /main/17 1997/08/05 09:00:04 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ -XCOMM $XFree86: xc/programs/lbxproxy/Imakefile,v 1.13 2000/01/31 19:33:40 dawes Exp $ +XCOMM $XFree86: xc/programs/lbxproxy/Imakefile,v 1.14 2001/01/17 23:44:55 dawes Exp $ #include <Server.tmpl> #define IHaveSubdirs Index: xc/programs/lbxproxy/design diff -u xc/programs/lbxproxy/design:1.2 xc/programs/lbxproxy/design:1.3 --- xc/programs/lbxproxy/design:1.2 Thu Dec 26 05:33:40 1996 +++ xc/programs/lbxproxy/design Wed Jan 17 18:44:55 2001 @@ -262,5 +262,5 @@ -------- -$NCDId: @(#)design,v 1.4 1994/04/11 18:17:03 lemke Exp $ -$XConsortium: design,v 1.1 94/04/11 15:36:00 dpw Exp $ +$NCDXorg: @(#)design,v 1.4 1994/04/11 18:17:03 lemke Exp $ +$Xorg: design,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ Index: xc/programs/lbxproxy/lbxproxy.man diff -u xc/programs/lbxproxy/lbxproxy.man:1.5 xc/programs/lbxproxy/lbxproxy.man:1.7 --- xc/programs/lbxproxy/lbxproxy.man:1.5 Sun Oct 4 05:40:09 1998 +++ xc/programs/lbxproxy/lbxproxy.man Sat Jan 27 13:21:03 2001 @@ -1,4 +1,4 @@ -.\" $TOG: lbxproxy.man /main/14 1998/02/09 13:44:25 kaleb $ +.\" $Xorg: lbxproxy.man,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ .\" Copyright 1996, 1998 The Open Group .\" .\" All Rights Reserved. @@ -19,7 +19,10 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.TH LBXPROXY 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/lbxproxy/lbxproxy.man,v 1.7 2001/01/27 18:21:03 dawes Exp $ +.\" +.TH LBXPROXY 1 __xorgversion__ .SH NAME lbxproxy - Low BandWidth X proxy .SH SYNOPSIS Index: xc/programs/lbxproxy/config/AtomControl diff -u xc/programs/lbxproxy/config/AtomControl:1.1.1.1 xc/programs/lbxproxy/config/AtomControl:1.1.1.2 --- xc/programs/lbxproxy/config/AtomControl:1.1.1.1 Sat Dec 21 23:16:37 1996 +++ xc/programs/lbxproxy/config/AtomControl Tue Jan 16 17:46:08 2001 @@ -1,4 +1,4 @@ -! $XConsortium: AtomControl /main/4 1996/11/19 14:23:29 rws $ +! $Xorg: AtomControl,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ ! ! z <number> ! means do not cache property data smaller than this many bytes Index: xc/programs/lbxproxy/config/Imakefile diff -u xc/programs/lbxproxy/config/Imakefile:1.1.1.1 xc/programs/lbxproxy/config/Imakefile:1.1.1.2 --- xc/programs/lbxproxy/config/Imakefile:1.1.1.1 Sat Dec 21 23:16:37 1996 +++ xc/programs/lbxproxy/config/Imakefile Tue Jan 16 17:46:09 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/2 1996/11/18 20:15:50 rws $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:53 cpqbld Exp $ all:: Index: xc/programs/lbxproxy/di/Imakefile diff -u xc/programs/lbxproxy/di/Imakefile:1.1.1.1 xc/programs/lbxproxy/di/Imakefile:1.2 --- xc/programs/lbxproxy/di/Imakefile:1.1.1.1 Sat Dec 21 23:16:32 1996 +++ xc/programs/lbxproxy/di/Imakefile Mon Apr 23 12:17:12 2001 @@ -1,5 +1,10 @@ -XCOMM $XConsortium: Imakefile /main/19 1996/12/01 00:38:54 swick $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:54 cpqbld Exp $ + + + +XCOMM $XFree86: xc/programs/lbxproxy/di/Imakefile,v 1.2 2001/04/23 16:17:12 tsi Exp $ + #include <Server.tmpl> INCLUDES = -I../include -I$(TOP)/include -I$(EXTINCSRC) \ @@ -27,7 +32,7 @@ UTIL_DEFINES = '-DDEF_ATOMS_FILE="$(LBXPROXYDIR)/AtomControl"' $(SITE_RGB_DB) -DEPEND_DEFINES = $(PROXYMNGR_INCLUDES) $(UTIL_DEFINES) +DEPEND_DEFINES = $(PROXYMNGR_INCLUDES) $(UTIL_DEFINES) DependDefines NormalLibraryObjectRule() NormalLibraryTarget(dilbx,$(OBJS)) Index: xc/programs/lbxproxy/di/atomcache.c diff -u xc/programs/lbxproxy/di/atomcache.c:1.3 xc/programs/lbxproxy/di/atomcache.c:1.4 --- xc/programs/lbxproxy/di/atomcache.c:1.3 Sun Oct 4 05:40:10 1998 +++ xc/programs/lbxproxy/di/atomcache.c Wed Jan 17 18:44:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: atomcache.c /main/11 1998/02/11 09:51:55 kaleb $ */ +/* $Xorg: atomcache.c,v 1.3 2000/08/17 19:53:54 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/di/cache.c diff -u xc/programs/lbxproxy/di/cache.c:1.3 xc/programs/lbxproxy/di/cache.c:1.4 --- xc/programs/lbxproxy/di/cache.c:1.3 Sun Oct 4 05:40:10 1998 +++ xc/programs/lbxproxy/di/cache.c Wed Jan 17 18:44:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: cache.c /main/13 1998/02/11 09:47:25 kaleb $ */ +/* $Xorg: cache.c,v 1.4 2000/08/17 19:53:54 cpqbld Exp $ */ /* Copyright 1994, 1998 The Open Group @@ -130,7 +130,7 @@ CacheEntryPtr cp; for (i = 0; i < cache->buckets; i++) { - while (cp = cache->entries[i]) { + while ((cp = cache->entries[i])) { cache->entries[i] = cp->next; (*cp->free_func) (cp->id, cp->client, cp->data, CacheWasReset); xfree(cp); @@ -228,7 +228,7 @@ oldest = NULL; /* find oldest */ for (i = 0; i < cache->buckets; i++) { - for (prev = &cache->entries[i]; cp = *prev; prev = &cp->next) { + for (prev = &cache->entries[i]; (cp = *prev); prev = &cp->next) { if (!oldest || (cp->timestamp < oldest->timestamp)) { oldest = cp; oldprev = prev; @@ -334,7 +334,7 @@ CacheEntryPtr cp, *prev; for (prev = &cache->entries[hash(server, cacheid, cid)]; - cp = *prev; + (cp = *prev); prev = &cp->next) { if (cp->id == cid) { *prev = cp->next; Index: xc/programs/lbxproxy/di/cmap.c diff -u xc/programs/lbxproxy/di/cmap.c:1.3 xc/programs/lbxproxy/di/cmap.c:1.4 --- xc/programs/lbxproxy/di/cmap.c:1.3 Sun Oct 4 05:40:11 1998 +++ xc/programs/lbxproxy/di/cmap.c Wed Jan 17 18:44:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: cmap.c /main/22 1998/02/11 09:47:55 kaleb $ */ +/* $Xorg: cmap.c,v 1.4 2000/08/17 19:53:54 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -379,7 +379,7 @@ pent[i].status = PIXEL_FREE; } - while (code = *data++) + while ((code = *data++)) { if (code == LBX_PIXEL_PRIVATE) { Index: xc/programs/lbxproxy/di/cmaputil.c diff -u xc/programs/lbxproxy/di/cmaputil.c:1.6 xc/programs/lbxproxy/di/cmaputil.c:1.7 --- xc/programs/lbxproxy/di/cmaputil.c:1.6 Sun May 14 16:27:58 2000 +++ xc/programs/lbxproxy/di/cmaputil.c Wed Jan 17 18:44:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: cmaputil.c /main/9 1998/02/11 09:47:49 kaleb $ */ +/* $Xorg: cmaputil.c,v 1.4 2000/08/17 19:53:54 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -44,7 +44,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/lbxproxy/di/cmaputil.c,v 1.6 2000/05/14 20:27:58 alanh Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/cmaputil.c,v 1.7 2001/01/17 23:44:55 dawes Exp $ */ #include <stdio.h> #include "misc.h" @@ -202,7 +202,7 @@ } h %= HASHSIZE; - if ( entry = hashTab[h] ) + if (( entry = hashTab[h] )) { for( ; entry; prev = (dbEntryPtr*)entry, entry = entry->link ) if (! strcmp(name, entry->name) ) break; @@ -263,7 +263,7 @@ green >= 0 && green <= 0xff && blue >= 0 && blue <= 0xff) { - if (entry = lookup(name, strlen(name), TRUE)) + if ((entry = lookup(name, strlen(name), TRUE))) { entry->red = (red * 65535) / 255; entry->green = (green * 65535) / 255; @@ -298,7 +298,7 @@ { dbEntryPtr entry; - if (entry = lookup(name, len, FALSE)) + if ((entry = lookup(name, len, FALSE))) { *pred = entry->red; *pgreen = entry->green; Index: xc/programs/lbxproxy/di/dispatch.c diff -u xc/programs/lbxproxy/di/dispatch.c:1.4 xc/programs/lbxproxy/di/dispatch.c:1.5 --- xc/programs/lbxproxy/di/dispatch.c:1.4 Sun Oct 4 05:40:12 1998 +++ xc/programs/lbxproxy/di/dispatch.c Wed Jan 17 18:44:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: dispatch.c /main/42 1998/02/23 09:14:20 barstow $ */ +/* $Xorg: dispatch.c,v 1.3 2000/08/17 19:53:55 cpqbld Exp $ */ /* * Copyright 1992 Network Computing Devices * Copyright 1996 X Consortium, Inc. Index: xc/programs/lbxproxy/di/extensions.c diff -u xc/programs/lbxproxy/di/extensions.c:1.3 xc/programs/lbxproxy/di/extensions.c:1.4 --- xc/programs/lbxproxy/di/extensions.c:1.3 Sun Oct 4 05:40:12 1998 +++ xc/programs/lbxproxy/di/extensions.c Wed Jan 17 18:44:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: extensions.c /main/12 1998/02/11 09:48:08 kaleb $ */ +/* $Xorg: extensions.c,v 1.4 2000/08/17 19:53:55 cpqbld Exp $ */ /* Copyright 1998 The Open Group @@ -119,7 +119,7 @@ { ExtensionInfoPtr eip; - while (eip = server->extensions) { + while ((eip = server->extensions)) { server->extensions = eip->next; xfree(eip->name); xfree(eip->rep_mask); Index: xc/programs/lbxproxy/di/gfx.c diff -u xc/programs/lbxproxy/di/gfx.c:1.3 xc/programs/lbxproxy/di/gfx.c:1.4 --- xc/programs/lbxproxy/di/gfx.c:1.3 Sun Oct 4 05:40:13 1998 +++ xc/programs/lbxproxy/di/gfx.c Wed Jan 17 18:44:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: gfx.c /main/30 1998/02/11 09:48:12 kaleb $ */ +/* $Xorg: gfx.c,v 1.3 2000/08/17 19:53:55 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/di/globals.c diff -u xc/programs/lbxproxy/di/globals.c:1.3 xc/programs/lbxproxy/di/globals.c:1.4 --- xc/programs/lbxproxy/di/globals.c:1.3 Sun Oct 4 05:40:13 1998 +++ xc/programs/lbxproxy/di/globals.c Wed Jan 17 18:44:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: globals.c /main/13 1998/02/11 09:48:18 kaleb $ */ +/* $Xorg: globals.c,v 1.3 2000/08/17 19:53:55 cpqbld Exp $ */ /************************************************************ Copyright 1987, 1998 The Open Group Index: xc/programs/lbxproxy/di/init.c diff -u xc/programs/lbxproxy/di/init.c:1.3 xc/programs/lbxproxy/di/init.c:1.4 --- xc/programs/lbxproxy/di/init.c:1.3 Sun Oct 4 05:40:14 1998 +++ xc/programs/lbxproxy/di/init.c Wed Jan 17 18:44:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: init.c /main/17 1998/02/11 09:48:23 kaleb $ */ +/* $Xorg: init.c,v 1.3 2000/08/17 19:53:55 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/di/lbxfuncs.c diff -u xc/programs/lbxproxy/di/lbxfuncs.c:1.3 xc/programs/lbxproxy/di/lbxfuncs.c:1.4 --- xc/programs/lbxproxy/di/lbxfuncs.c:1.3 Sun Oct 4 05:40:14 1998 +++ xc/programs/lbxproxy/di/lbxfuncs.c Wed Jan 17 18:44:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxfuncs.c /main/49 1998/02/23 09:14:27 barstow $ */ +/* $Xorg: lbxfuncs.c,v 1.3 2000/08/17 19:53:55 cpqbld Exp $ */ /* * Copyright 1994 Network Computing Devices, Inc. * Copyright 1996 X Consortium, Inc. Index: xc/programs/lbxproxy/di/lbxutil.c diff -u xc/programs/lbxproxy/di/lbxutil.c:1.3 xc/programs/lbxproxy/di/lbxutil.c:1.4 --- xc/programs/lbxproxy/di/lbxutil.c:1.3 Sun Oct 4 05:40:15 1998 +++ xc/programs/lbxproxy/di/lbxutil.c Wed Jan 17 18:44:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxutil.c /main/28 1998/02/23 09:14:38 barstow $ */ +/* $Xorg: lbxutil.c,v 1.4 2000/08/17 19:53:55 cpqbld Exp $ */ /* * Copyright 1994 Network Computing Devices, Inc. * @@ -224,7 +224,7 @@ #ifdef SEQ_DEBUG fprintf(stderr, "flushing replies seq 0x%x:", LBXLastResponse(client)); #endif - for (prev = &LBXReplyData(client); cur = *prev; ) { + for (prev = &LBXReplyData(client); (cur = *prev); ) { #ifdef SEQ_DEBUG fprintf(stderr, " 0x%x", cur->delay_seq_no); #endif Index: xc/programs/lbxproxy/di/main.c diff -u xc/programs/lbxproxy/di/main.c:1.6 xc/programs/lbxproxy/di/main.c:1.8 --- xc/programs/lbxproxy/di/main.c:1.6 Sun Dec 20 06:58:06 1998 +++ xc/programs/lbxproxy/di/main.c Sun Jan 21 16:19:39 2001 @@ -1,4 +1,4 @@ -/* $TOG: main.c /main/24 1998/02/11 09:48:42 kaleb $ */ +/* $Xorg: main.c,v 1.4 2000/08/17 19:53:55 cpqbld Exp $ */ /* Copyright 1998 The Open Group @@ -41,8 +41,9 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/lbxproxy/di/main.c,v 1.6 1998/12/20 11:58:06 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/main.c,v 1.8 2001/01/21 21:19:39 tsi Exp $ */ +#include <stdlib.h> #include "lbx.h" #include "wire.h" #include "atomcache.h" @@ -101,10 +102,18 @@ if (!proxyMngr && !ConnectToServer (display_name)) { - char msg[100]; - - (void) sprintf (msg, "could not connect to '%s'", display_name); - FatalError(msg); + /* + * If no display name was given on the command line, the + * DISPLAY variable is used. + */ + if(!display_name) + display_name = getenv("DISPLAY"); + + if(display_name) { + FatalError("could not connect to display '%s'", display_name); + } else { + FatalError("no display specified"); + } } if (!InitClientResources(clients[0])) Index: xc/programs/lbxproxy/di/options.c diff -u xc/programs/lbxproxy/di/options.c:1.5 xc/programs/lbxproxy/di/options.c:1.6 --- xc/programs/lbxproxy/di/options.c:1.5 Wed Jun 7 18:03:15 2000 +++ xc/programs/lbxproxy/di/options.c Wed Jan 17 18:44:56 2001 @@ -1,4 +1,4 @@ -/* $TOG: options.c /main/15 1998/02/11 09:48:46 kaleb $ */ +/* $Xorg: options.c,v 1.3 2000/08/17 19:53:55 cpqbld Exp $ */ /* Copyright 1998 The Open Group @@ -42,7 +42,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/lbxproxy/di/options.c,v 1.5 2000/06/07 22:03:15 tsi Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/options.c,v 1.6 2001/01/17 23:44:56 dawes Exp $ */ #include <stdio.h> #include "X.h" Index: xc/programs/lbxproxy/di/pm.c diff -u xc/programs/lbxproxy/di/pm.c:1.4 xc/programs/lbxproxy/di/pm.c:1.5 --- xc/programs/lbxproxy/di/pm.c:1.4 Sun Oct 4 05:40:16 1998 +++ xc/programs/lbxproxy/di/pm.c Wed Jan 17 18:44:56 2001 @@ -1,4 +1,4 @@ -/* $TOG: pm.c /main/25 1998/02/11 09:48:51 kaleb $ */ +/* $Xorg: pm.c,v 1.4 2000/08/17 19:53:56 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -270,7 +270,7 @@ char c, *s; register int n; - for (n=0, s = buf1; c = *str1++; n++) { + for (n=0, s = buf1; (c = *str1++); n++) { if (isupper(c)) c = tolower(c); if (n>510) @@ -278,7 +278,7 @@ *s++ = c; } *s = '\0'; - for (n=0, s = buf2; c = *str2++; n++) { + for (n=0, s = buf2; (c = *str2++); n++) { if (isupper(c)) c = tolower(c); if (n>510) Index: xc/programs/lbxproxy/di/props.c diff -u xc/programs/lbxproxy/di/props.c:1.3 xc/programs/lbxproxy/di/props.c:1.4 --- xc/programs/lbxproxy/di/props.c:1.3 Sun Oct 4 05:40:17 1998 +++ xc/programs/lbxproxy/di/props.c Wed Jan 17 18:44:56 2001 @@ -1,4 +1,4 @@ -/* $TOG: props.c /main/20 1998/02/11 09:48:55 kaleb $ */ +/* $Xorg: props.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/di/reqtype.c diff -u xc/programs/lbxproxy/di/reqtype.c:1.1.1.1 xc/programs/lbxproxy/di/reqtype.c:1.1.1.2 --- xc/programs/lbxproxy/di/reqtype.c:1.1.1.1 Sat Dec 21 23:16:33 1996 +++ xc/programs/lbxproxy/di/reqtype.c Tue Jan 16 17:46:25 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: reqtype.c /main/10 1996/12/19 19:16:03 rws $ */ +/* $Xorg: reqtype.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ /* * Copyright 1994 Network Computing Devices, Inc. * Index: xc/programs/lbxproxy/di/resource.c diff -u xc/programs/lbxproxy/di/resource.c:1.3 xc/programs/lbxproxy/di/resource.c:1.4 --- xc/programs/lbxproxy/di/resource.c:1.3 Sun Oct 4 05:40:17 1998 +++ xc/programs/lbxproxy/di/resource.c Wed Jan 17 18:44:56 2001 @@ -1,4 +1,4 @@ -/* $TOG: resource.c /main/14 1998/02/11 09:49:00 kaleb $ */ +/* $Xorg: resource.c,v 1.4 2000/08/17 19:53:56 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -365,7 +365,7 @@ eltptr = &clients[cid]->server->clientTable[cid].elements; prev = head; - while (res = *prev) + while ((res = *prev)) { if (res->id == id) { Index: xc/programs/lbxproxy/di/swaprep.c diff -u xc/programs/lbxproxy/di/swaprep.c:1.3 xc/programs/lbxproxy/di/swaprep.c:1.4 --- xc/programs/lbxproxy/di/swaprep.c:1.3 Sun Oct 4 05:40:19 1998 +++ xc/programs/lbxproxy/di/swaprep.c Wed Jan 17 18:44:56 2001 @@ -1,4 +1,4 @@ -/* $TOG: swaprep.c /main/12 1998/02/11 09:49:04 kaleb $ */ +/* $Xorg: swaprep.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/di/swapreq.c diff -u xc/programs/lbxproxy/di/swapreq.c:1.3 xc/programs/lbxproxy/di/swapreq.c:1.4 --- xc/programs/lbxproxy/di/swapreq.c:1.3 Sun Oct 4 05:40:20 1998 +++ xc/programs/lbxproxy/di/swapreq.c Wed Jan 17 18:44:56 2001 @@ -1,4 +1,4 @@ -/* $TOG: swapreq.c /main/14 1998/02/11 09:49:08 kaleb $ */ +/* $Xorg: swapreq.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/di/tables.c diff -u xc/programs/lbxproxy/di/tables.c:1.1.1.1 xc/programs/lbxproxy/di/tables.c:1.1.1.2 --- xc/programs/lbxproxy/di/tables.c:1.1.1.1 Sat Dec 21 23:16:34 1996 +++ xc/programs/lbxproxy/di/tables.c Tue Jan 16 17:46:27 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: tables.c /main/12 1996/11/18 20:20:06 rws $ */ +/* $Xorg: tables.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ /* * Copyright 1992 Network Computing Devices * Index: xc/programs/lbxproxy/di/tags.c diff -u xc/programs/lbxproxy/di/tags.c:1.3 xc/programs/lbxproxy/di/tags.c:1.4 --- xc/programs/lbxproxy/di/tags.c:1.3 Sun Oct 4 05:40:20 1998 +++ xc/programs/lbxproxy/di/tags.c Wed Jan 17 18:44:56 2001 @@ -1,4 +1,4 @@ -/* $TOG: tags.c /main/13 1998/02/11 09:49:13 kaleb $ */ +/* $Xorg: tags.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/di/unsquish.c diff -u xc/programs/lbxproxy/di/unsquish.c:1.3 xc/programs/lbxproxy/di/unsquish.c:1.4 --- xc/programs/lbxproxy/di/unsquish.c:1.3 Sun Oct 4 05:40:20 1998 +++ xc/programs/lbxproxy/di/unsquish.c Wed Jan 17 18:44:56 2001 @@ -1,4 +1,4 @@ -/* $TOG: unsquish.c /main/5 1998/02/11 09:49:17 kaleb $ */ +/* $Xorg: unsquish.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group Index: xc/programs/lbxproxy/di/utils.c diff -u xc/programs/lbxproxy/di/utils.c:1.9 xc/programs/lbxproxy/di/utils.c:1.10 --- xc/programs/lbxproxy/di/utils.c:1.9 Sun Dec 26 19:40:01 1999 +++ xc/programs/lbxproxy/di/utils.c Wed Jan 17 18:44:56 2001 @@ -1,4 +1,4 @@ -/* $TOG: utils.c /main/44 1998/02/23 10:36:34 barstow $ */ +/* $Xorg: utils.c,v 1.4 2000/08/17 19:53:56 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1996, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/lbxproxy/di/utils.c,v 1.9 1999/12/27 00:40:01 robin Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/utils.c,v 1.10 2001/01/17 23:44:56 dawes Exp $ */ #include "lbx.h" #include <stdio.h> @@ -466,13 +466,13 @@ * However, if this is the case, the command line options will * take precedence so check the environment first. */ - if (env = getenv ("LBXPROXY_MAXSERVERS")) + if ((env = getenv ("LBXPROXY_MAXSERVERS"))) lbxMaxServers = atoi (env); for ( i = 1; i < argc; i++ ) { /* do proxy-specific stuff first */ - if(skip = proxyProcessArgument(argc, argv, i)) + if((skip = proxyProcessArgument(argc, argv, i))) { i += (skip - 1); } @@ -560,7 +560,7 @@ ((random() % MEM_FAIL_SCALE) < Memory_fail)) return (unsigned long *)NULL; #endif - if (ptr = (pointer)malloc(amount)) + if ((ptr = (pointer)malloc(amount))) return (unsigned long *)ptr; if (Must_have_memory) FatalError("Out of memory"); @@ -896,7 +896,7 @@ SleepQueuePtr q, *prev; prev = &sleepQueue; - while (q = *prev) + while ((q = *prev)) { if (q->client == client) { Index: xc/programs/lbxproxy/di/wire.c diff -u xc/programs/lbxproxy/di/wire.c:1.9 xc/programs/lbxproxy/di/wire.c:1.10 --- xc/programs/lbxproxy/di/wire.c:1.9 Wed Jun 7 18:03:15 2000 +++ xc/programs/lbxproxy/di/wire.c Wed Jan 17 18:44:56 2001 @@ -1,4 +1,4 @@ -/* $TOG: wire.c /main/52 1998/02/11 09:49:26 kaleb $ */ +/* $Xorg: wire.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ /* Copyright 1998 The Open Group @@ -41,7 +41,7 @@ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * */ -/* $XFree86: xc/programs/lbxproxy/di/wire.c,v 1.9 2000/06/07 22:03:15 tsi Exp $ */ +/* $XFree86: xc/programs/lbxproxy/di/wire.c,v 1.10 2001/01/17 23:44:56 dawes Exp $ */ #include "lbx.h" #include <stdio.h> Index: xc/programs/lbxproxy/di/zeropad.c diff -u xc/programs/lbxproxy/di/zeropad.c:1.1.1.2 xc/programs/lbxproxy/di/zeropad.c:1.1.1.3 --- xc/programs/lbxproxy/di/zeropad.c:1.1.1.2 Sun Sep 27 04:59:12 1998 +++ xc/programs/lbxproxy/di/zeropad.c Tue Jan 16 17:46:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: zeropad.c /main/3 1998/02/11 09:49:36 kaleb $ */ +/* $Xorg: zeropad.c,v 1.3 2000/08/17 19:53:56 cpqbld Exp $ */ /* Index: xc/programs/lbxproxy/include/assert.h diff -u xc/programs/lbxproxy/include/assert.h:1.1.1.1 xc/programs/lbxproxy/include/assert.h:1.1.1.2 --- xc/programs/lbxproxy/include/assert.h:1.1.1.1 Sat Dec 21 23:16:35 1996 +++ xc/programs/lbxproxy/include/assert.h Tue Jan 16 17:46:30 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: assert.h,v 1.3 94/02/20 11:12:26 dpw Exp $ */ +/* $Xorg: assert.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ /* * Copyright 1994 Network Computing Devices, Inc. * Index: xc/programs/lbxproxy/include/atomcache.h diff -u xc/programs/lbxproxy/include/atomcache.h:1.3 xc/programs/lbxproxy/include/atomcache.h:1.4 --- xc/programs/lbxproxy/include/atomcache.h:1.3 Sun Oct 4 05:40:24 1998 +++ xc/programs/lbxproxy/include/atomcache.h Wed Jan 17 18:44:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: atomcache.h /main/10 1998/02/10 18:17:02 kaleb $ */ +/* $Xorg: atomcache.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/include/cache.h diff -u xc/programs/lbxproxy/include/cache.h:1.4 xc/programs/lbxproxy/include/cache.h:1.5 --- xc/programs/lbxproxy/include/cache.h:1.4 Sun Oct 4 08:28:38 1998 +++ xc/programs/lbxproxy/include/cache.h Wed Jan 17 18:44:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: cache.h /main/10 1998/02/10 18:17:09 kaleb $ */ +/* $Xorg: cache.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ /* Copyright 1994, 1998 The Open Group Index: xc/programs/lbxproxy/include/colormap.h diff -u xc/programs/lbxproxy/include/colormap.h:1.3 xc/programs/lbxproxy/include/colormap.h:1.4 --- xc/programs/lbxproxy/include/colormap.h:1.3 Sun Oct 4 05:40:24 1998 +++ xc/programs/lbxproxy/include/colormap.h Wed Jan 17 18:44:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: colormap.h /main/13 1998/02/10 18:17:14 kaleb $ */ +/* $Xorg: colormap.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/include/init.h diff -u xc/programs/lbxproxy/include/init.h:1.1.1.2 xc/programs/lbxproxy/include/init.h:1.1.1.3 --- xc/programs/lbxproxy/include/init.h:1.1.1.2 Sun Sep 27 04:59:24 1998 +++ xc/programs/lbxproxy/include/init.h Tue Jan 16 17:46:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: init.h /main/4 1998/02/10 18:17:21 kaleb $ */ +/* $Xorg: init.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/lbxproxy/include/lbx.h diff -u xc/programs/lbxproxy/include/lbx.h:1.3 xc/programs/lbxproxy/include/lbx.h:1.4 --- xc/programs/lbxproxy/include/lbx.h:1.3 Sun Oct 4 05:40:24 1998 +++ xc/programs/lbxproxy/include/lbx.h Wed Jan 17 18:44:57 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbx.h /main/24 1998/02/23 09:34:13 barstow $ */ +/* $Xorg: lbx.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/lbxproxy/include/lbxext.h diff -u xc/programs/lbxproxy/include/lbxext.h:1.1.1.2 xc/programs/lbxproxy/include/lbxext.h:1.1.1.3 --- xc/programs/lbxproxy/include/lbxext.h:1.1.1.2 Sun Sep 27 04:59:18 1998 +++ xc/programs/lbxproxy/include/lbxext.h Tue Jan 16 17:46:32 2001 @@ -1,4 +1,4 @@ -/* $TOG: lbxext.h /main/6 1998/02/10 18:17:27 kaleb $ */ +/* $Xorg: lbxext.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/lbxproxy/include/misc.h diff -u xc/programs/lbxproxy/include/misc.h:1.3 xc/programs/lbxproxy/include/misc.h:1.4 --- xc/programs/lbxproxy/include/misc.h:1.3 Sun Oct 4 05:40:25 1998 +++ xc/programs/lbxproxy/include/misc.h Wed Jan 17 18:44:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: misc.h /main/5 1998/02/10 18:17:40 kaleb $ */ +/* $Xorg: misc.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ /* Index: xc/programs/lbxproxy/include/os.h diff -u xc/programs/lbxproxy/include/os.h:1.4 xc/programs/lbxproxy/include/os.h:1.5 --- xc/programs/lbxproxy/include/os.h:1.4 Sun Oct 4 05:40:25 1998 +++ xc/programs/lbxproxy/include/os.h Wed Jan 17 18:44:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: os.h /main/9 1998/02/10 18:17:46 kaleb $ */ +/* $Xorg: os.h,v 1.3 2000/08/17 19:53:57 cpqbld Exp $ */ /* Index: xc/programs/lbxproxy/include/pm.h diff -u xc/programs/lbxproxy/include/pm.h:1.2 xc/programs/lbxproxy/include/pm.h:1.3 --- xc/programs/lbxproxy/include/pm.h:1.2 Thu Jun 22 20:44:36 2000 +++ xc/programs/lbxproxy/include/pm.h Wed Jan 17 18:44:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: pm.h /main/2 1998/02/10 18:17:58 kaleb $ */ +/* $Xorg: pm.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/lbxproxy/include/pmP.h diff -u xc/programs/lbxproxy/include/pmP.h:1.2 xc/programs/lbxproxy/include/pmP.h:1.3 --- xc/programs/lbxproxy/include/pmP.h:1.2 Thu Jun 22 20:44:36 2000 +++ xc/programs/lbxproxy/include/pmP.h Wed Jan 17 18:44:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: pmP.h /main/3 1998/02/10 18:17:52 kaleb $ */ +/* $Xorg: pmP.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/lbxproxy/include/proxyopts.h diff -u xc/programs/lbxproxy/include/proxyopts.h:1.3 xc/programs/lbxproxy/include/proxyopts.h:1.4 --- xc/programs/lbxproxy/include/proxyopts.h:1.3 Sun Oct 4 05:40:25 1998 +++ xc/programs/lbxproxy/include/proxyopts.h Wed Jan 17 18:44:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: proxyopts.h /main/8 1998/02/10 18:18:03 kaleb $ */ +/* $Xorg: proxyopts.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/include/reqtype.h diff -u xc/programs/lbxproxy/include/reqtype.h:1.3 xc/programs/lbxproxy/include/reqtype.h:1.4 --- xc/programs/lbxproxy/include/reqtype.h:1.3 Sun Oct 4 05:40:25 1998 +++ xc/programs/lbxproxy/include/reqtype.h Wed Jan 17 18:44:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: reqtype.h /main/9 1998/02/10 18:18:09 kaleb $ */ +/* $Xorg: reqtype.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/include/resource.h diff -u xc/programs/lbxproxy/include/resource.h:1.3 xc/programs/lbxproxy/include/resource.h:1.4 --- xc/programs/lbxproxy/include/resource.h:1.3 Sun Oct 4 05:40:25 1998 +++ xc/programs/lbxproxy/include/resource.h Wed Jan 17 18:44:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: resource.h /main/5 1998/02/10 18:18:14 kaleb $ */ +/* $Xorg: resource.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ /* Index: xc/programs/lbxproxy/include/swap.h diff -u xc/programs/lbxproxy/include/swap.h:1.1.1.1 xc/programs/lbxproxy/include/swap.h:1.1.1.2 --- xc/programs/lbxproxy/include/swap.h:1.1.1.1 Sat Dec 21 23:16:36 1996 +++ xc/programs/lbxproxy/include/swap.h Tue Jan 16 17:46:34 2001 @@ -1,5 +1,5 @@ /* - * $XConsortium: swap.h /main/8 1996/11/17 22:26:32 rws $ + * $Xorg: swap.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ * * Copyright 1994 Network Computing Devices, Inc. * Index: xc/programs/lbxproxy/include/tags.h diff -u xc/programs/lbxproxy/include/tags.h:1.3 xc/programs/lbxproxy/include/tags.h:1.4 --- xc/programs/lbxproxy/include/tags.h:1.3 Sun Oct 4 05:40:26 1998 +++ xc/programs/lbxproxy/include/tags.h Wed Jan 17 18:44:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: tags.h /main/11 1998/02/10 18:18:26 kaleb $ */ +/* $Xorg: tags.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/include/util.h diff -u xc/programs/lbxproxy/include/util.h:1.3 xc/programs/lbxproxy/include/util.h:1.4 --- xc/programs/lbxproxy/include/util.h:1.3 Sun Oct 4 05:40:26 1998 +++ xc/programs/lbxproxy/include/util.h Wed Jan 17 18:44:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: util.h /main/7 1998/02/10 18:18:31 kaleb $ */ +/* $Xorg: util.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/include/wire.h diff -u xc/programs/lbxproxy/include/wire.h:1.4 xc/programs/lbxproxy/include/wire.h:1.5 --- xc/programs/lbxproxy/include/wire.h:1.4 Sun Oct 4 05:40:26 1998 +++ xc/programs/lbxproxy/include/wire.h Wed Jan 17 18:44:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: wire.h /main/19 1998/02/10 18:18:36 kaleb $ */ +/* $Xorg: wire.h,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ /* Copyright 1998 The Open Group Index: xc/programs/lbxproxy/os/Imakefile diff -u xc/programs/lbxproxy/os/Imakefile:1.6 xc/programs/lbxproxy/os/Imakefile:1.8 --- xc/programs/lbxproxy/os/Imakefile:1.6 Sun Dec 20 17:19:00 1998 +++ xc/programs/lbxproxy/os/Imakefile Mon Apr 23 12:17:13 2001 @@ -1,11 +1,15 @@ -XCOMM $TOG: Imakefile /main/11 1997/12/11 11:54:43 barstow $ -XCOMM $XFree86: xc/programs/lbxproxy/os/Imakefile,v 1.6 1998/12/20 22:19:00 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ + + + +XCOMM $XFree86: xc/programs/lbxproxy/os/Imakefile,v 1.8 2001/04/23 16:17:13 tsi Exp $ + #include <Server.tmpl> DEFINES = $(CONNECTION_FLAGS) $(RPC_DEFINES) \ AllocateLocalDefines ServerOSDefines $(SIGNAL_DEFINES) -DEPEND_DEFINES = $(TRANS_INCLUDES) +DEPEND_DEFINES = $(TRANS_INCLUDES) DependDefines INCLUDES = -I../include -I$(TOP)/include -I$(EXTINCSRC) \ -I../../../include/extensions Index: xc/programs/lbxproxy/os/WaitFor.c diff -u xc/programs/lbxproxy/os/WaitFor.c:1.5 xc/programs/lbxproxy/os/WaitFor.c:1.6 --- xc/programs/lbxproxy/os/WaitFor.c:1.5 Sun Oct 4 05:40:28 1998 +++ xc/programs/lbxproxy/os/WaitFor.c Wed Jan 17 18:44:59 2001 @@ -1,4 +1,4 @@ -/* $TOG: WaitFor.c /main/15 1998/02/11 09:54:39 kaleb $ */ +/* $Xorg: WaitFor.c,v 1.3 2000/08/17 19:53:58 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/lbxproxy/os/WaitFor.c,v 1.5 1998/10/04 09:40:28 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/os/WaitFor.c,v 1.6 2001/01/17 23:44:59 dawes Exp $ */ /***************************************************************** * OS Dependent input routines: Index: xc/programs/lbxproxy/os/connection.c diff -u xc/programs/lbxproxy/os/connection.c:1.13 xc/programs/lbxproxy/os/connection.c:1.14 --- xc/programs/lbxproxy/os/connection.c:1.13 Thu Aug 10 13:40:40 2000 +++ xc/programs/lbxproxy/os/connection.c Wed Jan 17 18:44:59 2001 @@ -1,4 +1,4 @@ -/* $TOG: connection.c /main/32 1998/02/11 09:54:17 kaleb $ */ +/* $Xorg: connection.c,v 1.4 2000/08/17 19:53:58 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1989, 1998 The Open Group @@ -56,7 +56,7 @@ * socket ids aren't small nums (0 - 2^8) * *****************************************************************/ -/* $XFree86: xc/programs/lbxproxy/os/connection.c,v 1.13 2000/08/10 17:40:40 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/os/connection.c,v 1.14 2001/01/17 23:44:59 dawes Exp $ */ #include "misc.h" #include <X11/Xtrans.h> @@ -253,7 +253,6 @@ int done = 0; int partial; int tmp_trans_count; - int *tmp_trans_fds; XtransConnInfo *tmp_trans_conns; while (!done) @@ -313,7 +312,7 @@ for (i = 0, num_fds = 0; i < tmp_trans_count; i++, num_fds++) { - int fd, num_fds = 0; + int fd; fd = _LBXPROXYTransGetConnectionNumber ( ListenTransConns[i + ListenTransCount]); Index: xc/programs/lbxproxy/os/io.c diff -u xc/programs/lbxproxy/os/io.c:1.6 xc/programs/lbxproxy/os/io.c:1.7 --- xc/programs/lbxproxy/os/io.c:1.6 Sun Oct 4 05:40:29 1998 +++ xc/programs/lbxproxy/os/io.c Wed Jan 17 18:44:59 2001 @@ -1,4 +1,4 @@ -/* $TOG: io.c /main/17 1998/02/11 09:54:23 kaleb $ */ +/* $Xorg: io.c,v 1.5 2000/08/17 19:53:58 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1989, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/lbxproxy/os/io.c,v 1.6 1998/10/04 09:40:29 dawes Exp $ */ +/* $XFree86: xc/programs/lbxproxy/os/io.c,v 1.7 2001/01/17 23:44:59 dawes Exp $ */ /***************************************************************** * i/o functions * @@ -255,7 +255,7 @@ if (!oci) { - if (oci = FreeInputs) + if ((oci = FreeInputs)) { FreeInputs = oci->next; } @@ -570,7 +570,7 @@ } if (!oci) { - if (oci = FreeInputs) + if ((oci = FreeInputs)) FreeInputs = oci->next; else if (!(oci = AllocateInputBuffer())) return FALSE; @@ -861,11 +861,10 @@ int extraCount; /* do not modify... returned below */ { ConnectionOutputPtr obuf; - XtransConnInfo trans_conn = oc->trans_conn; register ConnectionOutputPtr oco; int retval; - if (oco = oc->ofirst) { + if ((oco = oc->ofirst)) { obuf = oc->output; do { Bool nocomp = oco->nocompress; @@ -902,7 +901,7 @@ oc->output = obuf; return extraCount; } - } while (oc->ofirst = oco); + } while ((oc->ofirst = oco)); oc->output = obuf; } retval = StandardFlushClient(who, oc, extraBuf, extraCount); @@ -995,7 +994,7 @@ if (!oco) { - if (oco = FreeOutputs) + if ((oco = FreeOutputs)) { FreeOutputs = oco->next; } @@ -1042,14 +1041,13 @@ int count; { OsCommPtr oc = (OsCommPtr)who->osPrivate; - XtransConnInfo trans_conn = oc->trans_conn; register ConnectionOutputPtr oco; int paddedLen = count + padlength[count & 3]; if (!count) return(0); - if (oco = oc->output) { + if ((oco = oc->output)) { /* * we're currently filling a buffer, and it must be compressible, * so put it on the queue @@ -1193,7 +1191,7 @@ if (AvailableInput == oc) AvailableInput = (OsCommPtr)NULL; - if (oci = oc->input) + if ((oci = oc->input)) { if (FreeInputs) { @@ -1209,7 +1207,7 @@ oci->lenLastReq = 0; } } - if (oco = oc->output) + if ((oco = oc->output)) { if (FreeOutputs) { @@ -1223,7 +1221,7 @@ oco->count = 0; } } - if (oco = oc->ofirst) { + if ((oco = oc->ofirst)) { ConnectionOutputPtr nextoco; do { nextoco = oco->next; Index: xc/programs/lbxproxy/os/osdep.h diff -u xc/programs/lbxproxy/os/osdep.h:1.7 xc/programs/lbxproxy/os/osdep.h:1.8 --- xc/programs/lbxproxy/os/osdep.h:1.7 Sun Dec 26 19:40:06 1999 +++ xc/programs/lbxproxy/os/osdep.h Wed Jan 17 18:44:59 2001 @@ -1,4 +1,4 @@ -/* $TOG: osdep.h /main/10 1998/02/11 09:54:28 kaleb $ */ +/* $Xorg: osdep.h,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group @@ -41,7 +41,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/lbxproxy/os/osdep.h,v 1.7 1999/12/27 00:40:06 robin Exp $ */ +/* $XFree86: xc/programs/lbxproxy/os/osdep.h,v 1.8 2001/01/17 23:44:59 dawes Exp $ */ #define BOTIMEOUT 200 /* in milliseconds */ #define BUFSIZE 4096 Index: xc/programs/lbxproxy/os/osinit.c diff -u xc/programs/lbxproxy/os/osinit.c:1.3 xc/programs/lbxproxy/os/osinit.c:1.4 --- xc/programs/lbxproxy/os/osinit.c:1.3 Sun Oct 4 05:40:29 1998 +++ xc/programs/lbxproxy/os/osinit.c Wed Jan 17 18:44:59 2001 @@ -1,4 +1,4 @@ -/* $TOG: osinit.c /main/8 1998/02/11 09:54:33 kaleb $ */ +/* $Xorg: osinit.c,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ */ /*********************************************************** Copyright 1987, 1998 The Open Group Index: xc/programs/listres/listres.c diff -u xc/programs/listres/listres.c:1.3 xc/programs/listres/listres.c:1.4 --- xc/programs/listres/listres.c:1.3 Thu Feb 17 09:00:32 2000 +++ xc/programs/listres/listres.c Sun Apr 1 10:00:18 2001 @@ -27,9 +27,10 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/listres/listres.c,v 1.3 2000/02/17 14:00:32 dawes Exp $ */ +/* $XFree86: xc/programs/listres/listres.c,v 1.4 2001/04/01 14:00:18 tsi Exp $ */ #include <stdio.h> +#include <stdlib.h> #include <X11/Xos.h> #include <X11/StringDefs.h> #include <X11/IntrinsicP.h> Index: xc/programs/listres/listres.man diff -u xc/programs/listres/listres.man:1.1 xc/programs/listres/listres.man:1.3 --- xc/programs/listres/listres.man:1.1 Sat Feb 12 22:26:14 2000 +++ xc/programs/listres/listres.man Sat Jan 27 13:21:04 2001 @@ -24,7 +24,10 @@ .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from the X Consortium. -.TH LISTRES 1 "Release 6" "X Version 11" +.\" +.\" $XFree86: xc/programs/listres/listres.man,v 1.3 2001/01/27 18:21:04 dawes Exp $ +.\" +.TH LISTRES 1 __xorgversion__ .SH NAME listres - list resources in widgets .SH SYNOPSIS @@ -67,7 +70,7 @@ .SH "X DEFAULTS" To be written. .SH "SEE ALSO" -X(1), xrdb(1), appropriate widget documents +X(__miscmansuffix__), xrdb(1), appropriate widget documents .SH "BUGS" On operating systems that do not support dynamic linking of run-time routines, this program must have all of its known widgets compiled in. The sources @@ -75,6 +78,6 @@ .SH COPYRIGHT Copyright ([\d,\s]*) X Consortium .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHOR Jim Fulton, MIT X Consortium Index: xc/programs/mkfontdir/Imakefile diff -u xc/programs/mkfontdir/Imakefile:3.9 xc/programs/mkfontdir/Imakefile:3.10 --- xc/programs/mkfontdir/Imakefile:3.9 Sun May 23 11:18:53 1999 +++ xc/programs/mkfontdir/Imakefile Wed Jan 17 18:45:00 2001 @@ -1,5 +1,10 @@ -XCOMM $TOG: Imakefile /main/11 1997/05/25 15:12:09 kaleb $ -XCOMM $XFree86: xc/programs/mkfontdir/Imakefile,v 3.9 1999/05/23 15:18:53 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/mkfontdir/Imakefile,v 3.10 2001/01/17 23:45:00 dawes Exp $ + LOCAL_LIBRARIES = $(FONTLIB) DEPLIBS = $(DEPFONTLIB) INCLUDES = -I$(FONTINCSRC) -I$(FONTLIBSRC)/include Index: xc/programs/mkfontdir/mkfontdir.c diff -u xc/programs/mkfontdir/mkfontdir.c:3.11 xc/programs/mkfontdir/mkfontdir.c:3.12 --- xc/programs/mkfontdir/mkfontdir.c:3.11 Wed Nov 8 20:35:50 2000 +++ xc/programs/mkfontdir/mkfontdir.c Wed Jan 17 18:45:00 2001 @@ -1,3 +1,4 @@ +/* $XFree86: xc/programs/mkfontdir/mkfontdir.c,v 3.12 2001/01/17 23:45:00 dawes Exp $ */ /*********************************************************** Copyright (c) 1988 X Consortium @@ -46,8 +47,7 @@ ******************************************************************/ -/* $XConsortium: mkfontdir.c /main/13 1996/09/28 17:17:17 rws $ */ -/* $XFree86: xc/programs/mkfontdir/mkfontdir.c,v 3.11 2000/11/09 01:35:50 dawes Exp $ */ +/* $Xorg: mkfontdir.c,v 1.5 2000/08/17 19:53:59 cpqbld Exp $ */ #ifdef WIN32 #define _WILLWINSOCK_ @@ -324,7 +324,7 @@ CopyISOLatin1Lowered (font_name, font_name, strlen(font_name)); - if ((existing = FontNameExists (table, font_name)) != 0) + if ((existing = FontNameExists (table, font_name))) { fprintf (stderr, "%s: Duplicate font names %s\n", progName, font_name); fprintf (stderr, "\t%s %s\n", existing, fileName); @@ -362,7 +362,7 @@ char c; i = 0; - while ((c = *name++) != 0) + while ((c = *name++)) i = (i << 1) ^ c; return i & (HASH_SIZE - 1); } Index: xc/programs/mkfontdir/mkfontdir.man diff -u xc/programs/mkfontdir/mkfontdir.man:1.9 xc/programs/mkfontdir/mkfontdir.man:1.12 --- xc/programs/mkfontdir/mkfontdir.man:1.9 Wed Nov 8 20:35:51 2000 +++ xc/programs/mkfontdir/mkfontdir.man Sat Jan 27 13:21:04 2001 @@ -1,4 +1,4 @@ -.\" $TOG: mkfontdir.man /main/15 1998/02/09 13:44:34 kaleb $ +.\" $Xorg: mkfontdir.man,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -19,9 +19,9 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/mkfontdir/mkfontdir.man,v 1.9 2000/11/09 01:35:51 dawes Exp $ +.\" $XFree86: xc/programs/mkfontdir/mkfontdir.man,v 1.12 2001/01/27 18:21:04 dawes Exp $ .\" -.TH MKFONTDIR 1 "Release 6.4" "X Version 11" +.TH MKFONTDIR 1 __xorgversion__ .SH NAME mkfontdir, fonts.dir, fonts.scale, fonts.alias, encodings.dir \- create an index of X font files in a directory .SH SYNOPSIS @@ -162,4 +162,4 @@ Created by \fImkfontdir\fP. Read by the X server and font server each time a font with an unknown charset is opened. .SH "SEE ALSO" -X(1), Xserver(1), xfs(1), xset(1) +X(__miscmansuffix__), Xserver(1), xfs(1), xset(1) Index: xc/programs/oclock/Clock-col.ad diff -u xc/programs/oclock/Clock-col.ad:1.1.1.1 xc/programs/oclock/Clock-col.ad:1.1.1.2 --- xc/programs/oclock/Clock-col.ad:1.1.1.1 Wed Apr 27 03:20:07 1994 +++ xc/programs/oclock/Clock-col.ad Tue Jan 16 17:46:39 2001 @@ -1,4 +1,4 @@ -! $XConsortium: Clock-col.ad,v 1.3 94/02/09 19:43:58 gildea Exp $ +! $Xorg: Clock-col.ad,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ Clock*Background: grey Clock*BorderColor: light blue Clock*hour: yellow Index: xc/programs/oclock/Clock.c diff -u xc/programs/oclock/Clock.c:1.3 xc/programs/oclock/Clock.c:1.5 --- xc/programs/oclock/Clock.c:1.3 Sat Feb 20 10:07:16 1999 +++ xc/programs/oclock/Clock.c Sun Apr 1 10:00:18 2001 @@ -1,5 +1,5 @@ /* - * $TOG: Clock.c /main/29 1998/02/09 13:44:48 kaleb $ + * $Xorg: Clock.c,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/oclock/Clock.c,v 1.3 1999/02/20 15:07:16 hohndel Exp $ */ +/* $XFree86: xc/programs/oclock/Clock.c,v 1.5 2001/04/01 14:00:18 tsi Exp $ */ /* * Clock.c @@ -33,6 +33,7 @@ #include "ClockP.h" #include <X11/Xos.h> #include <stdio.h> +#include <stdlib.h> #include <math.h> #include <X11/extensions/shape.h> Index: xc/programs/oclock/Clock.h diff -u xc/programs/oclock/Clock.h:1.3 xc/programs/oclock/Clock.h:1.4 --- xc/programs/oclock/Clock.h:1.3 Sat Feb 20 10:07:16 1999 +++ xc/programs/oclock/Clock.h Wed Jan 17 18:45:01 2001 @@ -1,4 +1,4 @@ -/* $TOG: Clock.h /main/10 1998/02/09 13:44:53 kaleb $ */ +/* $Xorg: Clock.h,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ */ /* Copyright 1993, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/oclock/Clock.h,v 1.3 1999/02/20 15:07:16 hohndel Exp $ */ +/* $XFree86: xc/programs/oclock/Clock.h,v 1.4 2001/01/17 23:45:01 dawes Exp $ */ #ifndef _XtClock_h #define _XtClock_h Index: xc/programs/oclock/ClockP.h diff -u xc/programs/oclock/ClockP.h:1.3 xc/programs/oclock/ClockP.h:1.4 --- xc/programs/oclock/ClockP.h:1.3 Sat Feb 20 10:07:17 1999 +++ xc/programs/oclock/ClockP.h Wed Jan 17 18:45:01 2001 @@ -1,4 +1,4 @@ -/* $TOG: ClockP.h /main/11 1998/02/09 13:44:39 kaleb $ */ +/* $Xorg: ClockP.h,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ */ /* Copyright 1993, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/oclock/ClockP.h,v 1.3 1999/02/20 15:07:17 hohndel Exp $ */ +/* $XFree86: xc/programs/oclock/ClockP.h,v 1.4 2001/01/17 23:45:01 dawes Exp $ */ #ifndef _ClockP_h Index: xc/programs/oclock/Imakefile diff -u xc/programs/oclock/Imakefile:1.1.1.2 xc/programs/oclock/Imakefile:1.1.1.3 --- xc/programs/oclock/Imakefile:1.1.1.2 Tue Jan 16 05:23:10 1996 +++ xc/programs/oclock/Imakefile Tue Jan 16 17:46:41 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/15 1996/01/14 16:49:52 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ SYS_LIBRARIES = MathLibrary DEPLIBS = $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) XkbClientDepLibs LOCAL_LIBRARIES = $(XMULIB) $(XTOOLLIB) $(XLIB) XkbClientLibs Index: xc/programs/oclock/oclock.c diff -u xc/programs/oclock/oclock.c:1.4 xc/programs/oclock/oclock.c:1.6 --- xc/programs/oclock/oclock.c:1.4 Fri Feb 19 16:27:13 1999 +++ xc/programs/oclock/oclock.c Sun Apr 1 10:00:18 2001 @@ -1,5 +1,5 @@ /* - * $TOG: oclock.c /main/19 1998/02/09 13:45:04 kaleb $ + * $Xorg: oclock.c,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/oclock/oclock.c,v 1.4 1999/02/19 21:27:13 hohndel Exp $ */ +/* $XFree86: xc/programs/oclock/oclock.c,v 1.6 2001/04/01 14:00:18 tsi Exp $ */ #include <X11/Intrinsic.h> #include <X11/Xatom.h> @@ -28,6 +28,7 @@ #include <X11/Xmu/Editres.h> #include "Clock.h" #include <stdio.h> +#include <stdlib.h> #ifdef XKB #include <X11/extensions/XKBbells.h> Index: xc/programs/oclock/oclock.man diff -u xc/programs/oclock/oclock.man:1.4 xc/programs/oclock/oclock.man:1.7 --- xc/programs/oclock/oclock.man:1.4 Sun Oct 4 05:40:31 1998 +++ xc/programs/oclock/oclock.man Sat Jan 27 13:21:04 2001 @@ -1,4 +1,4 @@ -.\" $TOG: oclock.man /main/19 1998/02/09 13:45:09 kaleb $ +.\" $Xorg: oclock.man,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ .\" Copyright 1989, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH OCLOCK 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/oclock/oclock.man,v 1.7 2001/01/27 18:21:04 dawes Exp $ +.\" +.TH OCLOCK 1 __xorgversion__ .SH NAME oclock \- round X clock .SH SYNOPSIS @@ -48,10 +51,10 @@ selects an appropriate level of backing store. .TP 8 .B \-geometry \fIgeometry\fB -define the initial window geometry; see \fIX(1)\fP. +define the initial window geometry; see \fIX(__miscmansuffix__)\fP. .TP 8 .B \-display \fIdisplay\fB -specify the display to use; see \fIX(1)\fP. +specify the display to use; see \fIX(__miscmansuffix__)\fP. .TP 8 .B \-bd \fIcolor\fB choose a different color for the window border. @@ -92,6 +95,6 @@ .br Clock*minute: yellow .SH "SEE ALSO" -X(1), X Toolkit documentation +X(__miscmansuffix__), X Toolkit documentation .SH AUTHOR Keith Packard, MIT X Consortium Index: xc/programs/oclock/transform.c diff -u xc/programs/oclock/transform.c:3.2 xc/programs/oclock/transform.c:3.3 --- xc/programs/oclock/transform.c:3.2 Fri Feb 19 16:27:14 1999 +++ xc/programs/oclock/transform.c Wed Jan 17 18:45:01 2001 @@ -1,4 +1,4 @@ -/* $TOG: transform.c /main/5 1998/02/09 13:45:13 kaleb $ */ +/* $Xorg: transform.c,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ */ /* Copyright 1993, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/oclock/transform.c,v 3.2 1999/02/19 21:27:14 hohndel Exp $ */ +/* $XFree86: xc/programs/oclock/transform.c,v 3.3 2001/01/17 23:45:01 dawes Exp $ */ /* Index: xc/programs/oclock/transform.h diff -u xc/programs/oclock/transform.h:1.3 xc/programs/oclock/transform.h:1.4 --- xc/programs/oclock/transform.h:1.3 Sat Feb 20 10:07:17 1999 +++ xc/programs/oclock/transform.h Wed Jan 17 18:45:01 2001 @@ -1,4 +1,4 @@ -/* $TOG: transform.h /main/5 1998/02/09 13:45:17 kaleb $ */ +/* $Xorg: transform.h,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ */ /* Copyright 1993, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/oclock/transform.h,v 1.3 1999/02/20 15:07:17 hohndel Exp $ */ +/* $XFree86: xc/programs/oclock/transform.h,v 1.4 2001/01/17 23:45:01 dawes Exp $ */ /* Index: xc/programs/proxymngr/Imakefile diff -u xc/programs/proxymngr/Imakefile:1.7 xc/programs/proxymngr/Imakefile:1.8 --- xc/programs/proxymngr/Imakefile:1.7 Thu Mar 23 12:42:40 2000 +++ xc/programs/proxymngr/Imakefile Wed Jan 17 18:45:02 2001 @@ -1,5 +1,9 @@ -XCOMM $TOG: Imakefile /main/12 1997/08/05 09:00:09 kaleb $ -XCOMM $XFree86: xc/programs/proxymngr/Imakefile,v 1.7 2000/03/23 17:42:40 tsi Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:53:59 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/proxymngr/Imakefile,v 1.8 2001/01/17 23:45:02 dawes Exp $ DEFINES = StrcasecmpDefines Index: xc/programs/proxymngr/PM.h diff -u xc/programs/proxymngr/PM.h:1.1.1.2 xc/programs/proxymngr/PM.h:1.1.1.3 --- xc/programs/proxymngr/PM.h:1.1.1.2 Sun Sep 27 04:59:34 1998 +++ xc/programs/proxymngr/PM.h Tue Jan 16 17:46:43 2001 @@ -1,4 +1,4 @@ -/* $TOG: PM.h /main/2 1998/02/09 13:45:58 kaleb $ */ +/* $Xorg: PM.h,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/proxymngr/PMproto.h diff -u xc/programs/proxymngr/PMproto.h:1.1.1.2 xc/programs/proxymngr/PMproto.h:1.1.1.3 --- xc/programs/proxymngr/PMproto.h:1.1.1.2 Sun Sep 27 04:59:35 1998 +++ xc/programs/proxymngr/PMproto.h Tue Jan 16 17:46:43 2001 @@ -1,4 +1,4 @@ -/* $TOG: PMproto.h /main/2 1998/02/09 13:45:54 kaleb $ */ +/* $Xorg: PMproto.h,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/proxymngr/config.c diff -u xc/programs/proxymngr/config.c:1.5 xc/programs/proxymngr/config.c:1.6 --- xc/programs/proxymngr/config.c:1.5 Tue Sep 26 11:57:23 2000 +++ xc/programs/proxymngr/config.c Wed Jan 17 18:45:02 2001 @@ -1,4 +1,4 @@ -/* $TOG: config.c /main/12 1998/02/09 13:45:22 kaleb $ */ +/* $Xorg: config.c,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -21,7 +21,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/proxymngr/config.c,v 1.5 2000/09/26 15:57:23 tsi Exp $ */ +/* $XFree86: xc/programs/proxymngr/config.c,v 1.6 2001/01/17 23:45:02 dawes Exp $ */ #include <stdlib.h> Index: xc/programs/proxymngr/config.h diff -u xc/programs/proxymngr/config.h:1.1.1.2 xc/programs/proxymngr/config.h:1.1.1.3 --- xc/programs/proxymngr/config.h:1.1.1.2 Sun Sep 27 04:59:30 1998 +++ xc/programs/proxymngr/config.h Tue Jan 16 17:46:43 2001 @@ -1,4 +1,4 @@ -/* $TOG: config.h /main/5 1998/02/09 13:45:26 kaleb $ */ +/* $Xorg: config.h,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/proxymngr/main.c diff -u xc/programs/proxymngr/main.c:1.4 xc/programs/proxymngr/main.c:1.5 --- xc/programs/proxymngr/main.c:1.4 Thu May 11 14:14:40 2000 +++ xc/programs/proxymngr/main.c Wed Jan 17 18:45:02 2001 @@ -1,4 +1,4 @@ -/* $TOG: main.c /main/36 1998/03/04 11:30:05 barstow $ */ +/* $Xorg: main.c,v 1.4 2000/08/17 19:54:00 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -21,7 +21,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/proxymngr/main.c,v 1.4 2000/05/11 18:14:40 tsi Exp $ */ +/* $XFree86: xc/programs/proxymngr/main.c,v 1.5 2001/01/17 23:45:02 dawes Exp $ */ #include <stdlib.h> #include "pmint.h" @@ -58,8 +58,8 @@ IcePoVersionRec PMSetupVersions[] = {{PM_MAJOR_VERSION, PM_MINOR_VERSION, PMSetupProcessMessages}}; -char *PM_VENDOR_STRING = "The Open Group, Inc."; -char *PM_VENDOR_RELEASE = "Release 6.4"; +char *PM_VENDOR_STRING = "The X.Org Group"; +char *PM_VENDOR_RELEASE = "Release 6.5.1"; int verbose = 0; Index: xc/programs/proxymngr/pmconfig.cpp diff -u xc/programs/proxymngr/pmconfig.cpp:1.1.1.1 xc/programs/proxymngr/pmconfig.cpp:1.1.1.2 --- xc/programs/proxymngr/pmconfig.cpp:1.1.1.1 Sun Sep 27 04:59:36 1998 +++ xc/programs/proxymngr/pmconfig.cpp Tue Jan 16 17:46:44 2001 @@ -1,4 +1,4 @@ -! $TOG: pmconfig.cpp /main/6 1997/07/21 08:35:31 barstow $ +! $Xorg: pmconfig.cpp,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ ! proxy manager config file ! ! Each line has the format: Index: xc/programs/proxymngr/pmdb.c diff -u xc/programs/proxymngr/pmdb.c:1.4 xc/programs/proxymngr/pmdb.c:1.5 --- xc/programs/proxymngr/pmdb.c:1.4 Sat Mar 13 22:22:22 1999 +++ xc/programs/proxymngr/pmdb.c Wed Jan 17 18:45:02 2001 @@ -1,4 +1,4 @@ -/* $TOG: pmdb.c /main/25 1998/03/04 11:30:12 barstow $ */ +/* $Xorg: pmdb.c,v 1.4 2000/08/17 19:54:00 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -21,7 +21,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/proxymngr/pmdb.c,v 1.4 1999/03/14 03:22:22 dawes Exp $ */ +/* $XFree86: xc/programs/proxymngr/pmdb.c,v 1.5 2001/01/17 23:45:02 dawes Exp $ */ #include "pmint.h" #include "pmdb.h" Index: xc/programs/proxymngr/pmdb.h diff -u xc/programs/proxymngr/pmdb.h:1.1.1.2 xc/programs/proxymngr/pmdb.h:1.1.1.3 --- xc/programs/proxymngr/pmdb.h:1.1.1.2 Sun Sep 27 04:59:32 1998 +++ xc/programs/proxymngr/pmdb.h Tue Jan 16 17:46:45 2001 @@ -1,4 +1,4 @@ -/* $TOG: pmdb.h /main/10 1998/02/09 13:45:44 kaleb $ */ +/* $Xorg: pmdb.h,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/proxymngr/pmint.h diff -u xc/programs/proxymngr/pmint.h:1.3 xc/programs/proxymngr/pmint.h:1.4 --- xc/programs/proxymngr/pmint.h:1.3 Sat Feb 20 10:07:18 1999 +++ xc/programs/proxymngr/pmint.h Wed Jan 17 18:45:02 2001 @@ -1,4 +1,4 @@ -/* $TOG: pmint.h /main/9 1998/02/09 13:45:49 kaleb $ */ +/* $Xorg: pmint.h,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -21,7 +21,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/proxymngr/pmint.h,v 1.3 1999/02/20 15:07:18 hohndel Exp $ */ +/* $XFree86: xc/programs/proxymngr/pmint.h,v 1.4 2001/01/17 23:45:02 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> Index: xc/programs/proxymngr/proxymngr.man diff -u xc/programs/proxymngr/proxymngr.man:1.4 xc/programs/proxymngr/proxymngr.man:1.6 --- xc/programs/proxymngr/proxymngr.man:1.4 Sun Oct 4 05:40:32 1998 +++ xc/programs/proxymngr/proxymngr.man Sat Jan 27 13:21:04 2001 @@ -1,4 +1,4 @@ -.\" $TOG: proxymngr.man /main/5 1998/02/09 13:46:03 kaleb $ +.\" $Xorg: proxymngr.man,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ .\" Copyright 1996, 1998 The Open Group .\" .\" All Rights Reserved. @@ -19,7 +19,10 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.TH PROXYMNGR 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/proxymngr/proxymngr.man,v 1.6 2001/01/27 18:21:04 dawes Exp $ +.\" +.TH PROXYMNGR 1 __xorgversion__ .SH NAME proxymngr - proxy manager service .SH SYNOPSIS Index: xc/programs/rgb/Imakefile diff -u xc/programs/rgb/Imakefile:3.9 xc/programs/rgb/Imakefile:3.10 --- xc/programs/rgb/Imakefile:3.9 Fri Jun 30 13:15:19 2000 +++ xc/programs/rgb/Imakefile Wed Jan 17 18:45:02 2001 @@ -1,5 +1,9 @@ -XCOMM $XConsortium: Imakefile /main/34 1996/11/13 14:45:44 lehors $ -XCOMM $XFree86: xc/programs/rgb/Imakefile,v 3.9 2000/06/30 17:15:19 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/rgb/Imakefile,v 3.10 2001/01/17 23:45:02 dawes Exp $ #if UseRgbTxt RGB_DEFINES = -DUSE_RGB_TXT Index: xc/programs/rgb/rgb.c diff -u xc/programs/rgb/rgb.c:3.4 xc/programs/rgb/rgb.c:3.5 --- xc/programs/rgb/rgb.c:3.4 Sun Oct 4 05:40:33 1998 +++ xc/programs/rgb/rgb.c Wed Jan 17 18:45:03 2001 @@ -1,4 +1,4 @@ -/* $TOG: rgb.c /main/29 1998/02/09 13:46:07 kaleb $ */ +/* $Xorg: rgb.c,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ */ /* Copyright 1985, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/rgb/rgb.c,v 3.4 1998/10/04 09:40:33 dawes Exp $ */ +/* $XFree86: xc/programs/rgb/rgb.c,v 3.5 2001/01/17 23:45:03 dawes Exp $ */ /* reads from standard input lines of the form: Index: xc/programs/rgb/rgb.txt diff -u xc/programs/rgb/rgb.txt:1.1.1.1 xc/programs/rgb/rgb.txt:1.1.1.2 --- xc/programs/rgb/rgb.txt:1.1.1.1 Wed Apr 27 03:13:14 1994 +++ xc/programs/rgb/rgb.txt Tue Jan 16 17:46:46 2001 @@ -1,4 +1,4 @@ -! $XConsortium: rgb.txt,v 10.41 94/02/20 18:39:36 rws Exp $ +! $Xorg: rgb.txt,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ 255 250 250 snow 248 248 255 ghost white 248 248 255 GhostWhite Index: xc/programs/rgb/showrgb.c diff -u xc/programs/rgb/showrgb.c:3.5 xc/programs/rgb/showrgb.c:3.6 --- xc/programs/rgb/showrgb.c:3.5 Fri Feb 19 16:27:19 1999 +++ xc/programs/rgb/showrgb.c Wed Jan 17 18:45:03 2001 @@ -1,5 +1,5 @@ /* - * $TOG: showrgb.c /main/12 1998/02/09 13:46:17 kaleb $ + * $Xorg: showrgb.c,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/rgb/showrgb.c,v 3.5 1999/02/19 21:27:19 hohndel Exp $ */ +/* $XFree86: xc/programs/rgb/showrgb.c,v 3.6 2001/01/17 23:45:03 dawes Exp $ */ #ifndef USE_RGB_TXT #ifdef NDBM Index: xc/programs/rgb/showrgb.man diff -u xc/programs/rgb/showrgb.man:1.4 xc/programs/rgb/showrgb.man:1.6 --- xc/programs/rgb/showrgb.man:1.4 Sun Oct 4 05:40:33 1998 +++ xc/programs/rgb/showrgb.man Sat Jan 27 13:21:05 2001 @@ -1,4 +1,4 @@ -.\" $TOG: showrgb.man /main/9 1998/02/09 13:46:21 kaleb $ +.\" $Xorg: showrgb.man,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ .\" Copyright 1993, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH SHOWRGB 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/rgb/showrgb.man,v 1.6 2001/01/27 18:21:05 dawes Exp $ +.\" +.TH SHOWRGB 1 __xorgversion__ .SH NAME showrgb \- uncompile an rgb color-name database .SH SYNOPSIS Index: xc/programs/rstart/Imakefile diff -u xc/programs/rstart/Imakefile:3.9 xc/programs/rstart/Imakefile:3.10 --- xc/programs/rstart/Imakefile:3.9 Sat Aug 26 00:30:57 2000 +++ xc/programs/rstart/Imakefile Wed Jan 17 18:45:03 2001 @@ -1,6 +1,10 @@ -XCOMM $XConsortium: Imakefile,v 1.12 94/12/01 20:16:44 kaleb Exp $ -XCOMM $XFree86: xc/programs/rstart/Imakefile,v 3.9 2000/08/26 04:30:57 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.4 2000/08/17 19:54:01 cpqbld Exp $ XCOMM +XCOMM +XCOMM +XCOMM +XCOMM $XFree86: xc/programs/rstart/Imakefile,v 3.10 2001/01/17 23:45:03 dawes Exp $ +XCOMM XCOMM Copyright (c) 1993 Quarterdeck Office Systems XCOMM XCOMM Permission to use, copy, modify, distribute, and sell this software @@ -112,7 +116,7 @@ @*) \@@\ ;; \@@\ *) \@@\ - chmod +x dest ;; \@@\ + chmod a+x dest ;; \@@\ esac #define Recurse(src, dest, filefunc) set -x; \@@\ Index: xc/programs/rstart/auth.c diff -u xc/programs/rstart/auth.c:1.3 xc/programs/rstart/auth.c:1.4 --- xc/programs/rstart/auth.c:1.3 Sat Feb 20 10:07:19 1999 +++ xc/programs/rstart/auth.c Wed Jan 17 18:45:03 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: auth.c,v 1.4 94/02/06 16:16:13 mor Exp $ */ +/* $Xorg: auth.c,v 1.4 2000/08/17 19:54:01 cpqbld Exp $ */ /************************************************************************/ /* Copyright (c) 1993 Quarterdeck Office Systems */ @@ -23,7 +23,7 @@ /* OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT */ /* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /************************************************************************/ -/* $XFree86: xc/programs/rstart/auth.c,v 1.3 1999/02/20 15:07:19 hohndel Exp $ */ +/* $XFree86: xc/programs/rstart/auth.c,v 1.4 2001/01/17 23:45:03 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> Index: xc/programs/rstart/c diff -u xc/programs/rstart/c:1.1.1.1 xc/programs/rstart/c:1.1.1.2 --- xc/programs/rstart/c:1.1.1.1 Wed Apr 27 03:21:57 1994 +++ xc/programs/rstart/c Tue Jan 16 17:46:49 2001 @@ -1,4 +1,4 @@ -# $XConsortium: c,v 1.2 94/02/06 16:24:52 mor Exp $ +# $Xorg: c,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems # Index: xc/programs/rstart/client.cpp diff -u xc/programs/rstart/client.cpp:1.1.1.1 xc/programs/rstart/client.cpp:1.1.1.2 --- xc/programs/rstart/client.cpp:1.1.1.1 Wed Apr 27 03:21:58 1994 +++ xc/programs/rstart/client.cpp Tue Jan 16 17:46:49 2001 @@ -1,5 +1,5 @@ XCOMM! /bin/sh -XCOMM $XConsortium: client.cpp,v 1.5 94/03/29 19:43:44 mor Exp $ +XCOMM $Xorg: client.cpp,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ XCOMM XCOMM Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/config.cpp diff -u xc/programs/rstart/config.cpp:1.1.1.1 xc/programs/rstart/config.cpp:1.1.1.2 --- xc/programs/rstart/config.cpp:1.1.1.1 Wed Apr 27 03:21:57 1994 +++ xc/programs/rstart/config.cpp Tue Jan 16 17:46:49 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: config.cpp,v 1.3 94/02/06 19:52:04 mor Exp $ +XCOMM $Xorg: config.cpp,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ XCOMM XCOMM Copyright (c) 1993 Quarterdeck Office Systems XCOMM Index: xc/programs/rstart/rstart.man diff -u xc/programs/rstart/rstart.man:1.4 xc/programs/rstart/rstart.man:1.6 --- xc/programs/rstart/rstart.man:1.4 Sun Oct 4 05:40:34 1998 +++ xc/programs/rstart/rstart.man Sat Jan 27 13:21:05 2001 @@ -1,4 +1,4 @@ -.\" $TOG: rstart.man /main/7 1997/11/04 20:55:41 kaleb $ +.\" $Xorg: rstart.man,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ .\" Copyright (c) 1993 Quarterdeck Office Systems .\" .\" Permission to use, copy, modify, distribute, and sell this software and @@ -18,6 +18,9 @@ .\" DATA, OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND .\" REGARDLESS OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $XFree86: xc/programs/rstart/rstart.man,v 1.6 2001/01/27 18:21:05 dawes Exp $ +.\" .hy 0 \" I hate hyphenation. .de EX \"Begin example .ne 5 @@ -33,7 +36,7 @@ .if t .sp .5 .. .ta .3i .6i .9i 1.2i 1.5i 1.8i -.TH RSTART 1 "Release 6.4" "X Version 11" +.TH RSTART 1 __xorgversion__ .SH NAME rstart - a sample implementation of a Remote Start client .SH SYNOPSIS Index: xc/programs/rstart/rstartd.man diff -u xc/programs/rstart/rstartd.man:1.4 xc/programs/rstart/rstartd.man:1.6 --- xc/programs/rstart/rstartd.man:1.4 Sun Oct 4 05:40:34 1998 +++ xc/programs/rstart/rstartd.man Sat Jan 27 13:21:05 2001 @@ -1,4 +1,4 @@ -.\" $TOG: rstartd.man /main/6 1997/11/04 20:55:38 kaleb $ +.\" $Xorg: rstartd.man,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ .\" Copyright (c) 1993 Quarterdeck Office Systems .\" .\" Permission to use, copy, modify, distribute, and sell this software and @@ -18,6 +18,9 @@ .\" DATA, OR PROFITS, EVEN IF ADVISED OF THE POSSIBILITY THEREOF, AND .\" REGARDLESS OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING .\" OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +.\" +.\" $XFree86: xc/programs/rstart/rstartd.man,v 1.6 2001/01/27 18:21:05 dawes Exp $ +.\" .hy 0 \" I hate hyphenation. .de EX \"Begin example .ne 5 @@ -33,7 +36,7 @@ .if t .sp .5 .. .ta .3i .6i .9i 1.2i 1.5i 1.8i -.TH RSTARTD 1 "Release 6.4" "X Version 11" +.TH RSTARTD 1 __xorgversion__ .SH NAME rstartd - a sample implementation of a Remote Start rsh helper .SH SYNOPSIS Index: xc/programs/rstart/server.c diff -u xc/programs/rstart/server.c:1.3 xc/programs/rstart/server.c:1.4 --- xc/programs/rstart/server.c:1.3 Sat Feb 20 10:07:19 1999 +++ xc/programs/rstart/server.c Wed Jan 17 18:45:03 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: server.c /main/14 1996/12/09 17:58:29 kaleb $ */ +/* $Xorg: server.c,v 1.5 2000/08/17 19:54:01 cpqbld Exp $ */ /************************************************************************/ /* Copyright (c) 1993 Quarterdeck Office Systems */ @@ -23,7 +23,7 @@ /* OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT */ /* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ /************************************************************************/ -/* $XFree86: xc/programs/rstart/server.c,v 1.3 1999/02/20 15:07:19 hohndel Exp $ */ +/* $XFree86: xc/programs/rstart/server.c,v 1.4 2001/01/17 23:45:03 dawes Exp $ */ /* Extended rsh "helper" program */ #include <stdio.h> Index: xc/programs/rstart/server.cpp diff -u xc/programs/rstart/server.cpp:3.1 xc/programs/rstart/server.cpp:3.2 --- xc/programs/rstart/server.cpp:3.1 Sat Aug 26 00:30:57 2000 +++ xc/programs/rstart/server.cpp Wed Jan 17 18:45:03 2001 @@ -1,5 +1,5 @@ XCOMM! /bin/sh -XCOMM $XConsortium: server.cpp,v 1.4 94/02/06 19:52:05 mor Exp $ +XCOMM $Xorg: server.cpp,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ XCOMM XCOMM Copyright (c) 1993 Quarterdeck Office Systems @@ -24,6 +24,6 @@ XCOMM OF WHETHER IN AN ACTION IN CONTRACT, TORT OR NEGLIGENCE, ARISING OUT XCOMM OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. XCOMM -XCOMM $XFree86: xc/programs/rstart/server.cpp,v 3.1 2000/08/26 04:30:57 dawes Exp $ +XCOMM $XFree86: xc/programs/rstart/server.cpp,v 3.2 2001/01/17 23:45:03 dawes Exp $ exec LIBDIR/SERVERNAME.real -c LIBDIR/config Index: xc/programs/rstart/commands/@List diff -u xc/programs/rstart/commands/@List:1.1.1.1 xc/programs/rstart/commands/@List:1.1.1.2 --- xc/programs/rstart/commands/@List:1.1.1.1 Wed Apr 27 03:21:59 1994 +++ xc/programs/rstart/commands/@List Tue Jan 16 17:46:52 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @List,v 1.2 94/02/06 16:25:19 mor Exp $ +# $Xorg: @List,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems # Index: xc/programs/rstart/commands/ListContexts diff -u xc/programs/rstart/commands/ListContexts:1.1.1.1 xc/programs/rstart/commands/ListContexts:1.1.1.2 --- xc/programs/rstart/commands/ListContexts:1.1.1.1 Wed Apr 27 03:21:59 1994 +++ xc/programs/rstart/commands/ListContexts Tue Jan 16 17:46:52 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: ListContexts,v 1.3 94/02/06 16:34:31 mor Exp $ +# $Xorg: ListContexts,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/commands/ListGenericCommands diff -u xc/programs/rstart/commands/ListGenericCommands:1.1.1.1 xc/programs/rstart/commands/ListGenericCommands:1.1.1.2 --- xc/programs/rstart/commands/ListGenericCommands:1.1.1.1 Wed Apr 27 03:21:59 1994 +++ xc/programs/rstart/commands/ListGenericCommands Tue Jan 16 17:46:52 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: ListGenericCommands,v 1.4 94/03/29 19:44:03 mor Exp $ +# $Xorg: ListGenericCommands,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/commands/x11r6/@List diff -u xc/programs/rstart/commands/x11r6/@List:1.1.1.1 xc/programs/rstart/commands/x11r6/@List:1.1.1.2 --- xc/programs/rstart/commands/x11r6/@List:1.1.1.1 Wed Apr 27 03:22:00 1994 +++ xc/programs/rstart/commands/x11r6/@List Tue Jan 16 17:46:53 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @List,v 1.2 94/02/06 16:25:50 mor Exp $ +# $Xorg: @List,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems # Index: xc/programs/rstart/commands/x11r6/LoadMonitor diff -u xc/programs/rstart/commands/x11r6/LoadMonitor:1.1.1.1 xc/programs/rstart/commands/x11r6/LoadMonitor:1.1.1.2 --- xc/programs/rstart/commands/x11r6/LoadMonitor:1.1.1.1 Wed Apr 27 03:22:00 1994 +++ xc/programs/rstart/commands/x11r6/LoadMonitor Tue Jan 16 17:46:53 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: LoadMonitor,v 1.3 94/02/06 16:35:45 mor Exp $ +# $Xorg: LoadMonitor,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/commands/x11r6/Terminal diff -u xc/programs/rstart/commands/x11r6/Terminal:1.1.1.1 xc/programs/rstart/commands/x11r6/Terminal:1.1.1.2 --- xc/programs/rstart/commands/x11r6/Terminal:1.1.1.1 Wed Apr 27 03:22:00 1994 +++ xc/programs/rstart/commands/x11r6/Terminal Tue Jan 16 17:46:54 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: Terminal,v 1.3 94/02/06 16:35:49 mor Exp $ +# $Xorg: Terminal,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/contexts/@Aliases diff -u xc/programs/rstart/contexts/@Aliases:1.1.1.1 xc/programs/rstart/contexts/@Aliases:1.1.1.2 --- xc/programs/rstart/contexts/@Aliases:1.1.1.1 Wed Apr 27 03:22:00 1994 +++ xc/programs/rstart/contexts/@Aliases Tue Jan 16 17:46:56 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @Aliases,v 1.2 94/02/06 16:27:10 mor Exp $ +# $Xorg: @Aliases,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems # Index: xc/programs/rstart/contexts/@List diff -u xc/programs/rstart/contexts/@List:1.1.1.1 xc/programs/rstart/contexts/@List:1.1.1.2 --- xc/programs/rstart/contexts/@List:1.1.1.1 Wed Apr 27 03:22:01 1994 +++ xc/programs/rstart/contexts/@List Tue Jan 16 17:46:56 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @List,v 1.2 94/02/06 16:27:14 mor Exp $ +# $Xorg: @List,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems # Index: xc/programs/rstart/contexts/default diff -u xc/programs/rstart/contexts/default:1.1.1.1 xc/programs/rstart/contexts/default:1.1.1.2 --- xc/programs/rstart/contexts/default:1.1.1.1 Wed Apr 27 03:22:01 1994 +++ xc/programs/rstart/contexts/default Tue Jan 16 17:46:57 2001 @@ -1,4 +1,4 @@ -# $XConsortium: default,v 1.2 94/02/06 16:27:15 mor Exp $ +# $Xorg: default,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ # # Null context Index: xc/programs/rstart/contexts/x11r6 diff -u xc/programs/rstart/contexts/x11r6:1.1.1.1 xc/programs/rstart/contexts/x11r6:1.1.1.2 --- xc/programs/rstart/contexts/x11r6:1.1.1.1 Wed Apr 27 03:22:01 1994 +++ xc/programs/rstart/contexts/x11r6 Tue Jan 16 17:46:57 2001 @@ -1,4 +1,4 @@ -# $XConsortium: x11r6,v 1.3 94/02/23 12:00:41 mor Exp $ +# $Xorg: x11r6,v 1.3 2000/08/17 19:54:01 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems # Index: xc/programs/rstart/samples/commands/@List diff -u xc/programs/rstart/samples/commands/@List:1.1.1.1 xc/programs/rstart/samples/commands/@List:1.1.1.2 --- xc/programs/rstart/samples/commands/@List:1.1.1.1 Wed Apr 27 03:22:04 1994 +++ xc/programs/rstart/samples/commands/@List Tue Jan 16 17:46:58 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @List,v 1.2 94/02/06 16:41:29 mor Exp $ +# $Xorg: @List,v 1.3 2000/08/17 19:54:02 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems # Index: xc/programs/rstart/samples/commands/ListContexts diff -u xc/programs/rstart/samples/commands/ListContexts:1.1.1.1 xc/programs/rstart/samples/commands/ListContexts:1.1.1.2 --- xc/programs/rstart/samples/commands/ListContexts:1.1.1.1 Wed Apr 27 03:22:05 1994 +++ xc/programs/rstart/samples/commands/ListContexts Tue Jan 16 17:46:57 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: ListContexts,v 1.2 94/02/06 16:41:32 mor Exp $ +# $Xorg: ListContexts,v 1.3 2000/08/17 19:54:03 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/commands/ListGenericCommands diff -u xc/programs/rstart/samples/commands/ListGenericCommands:1.1.1.1 xc/programs/rstart/samples/commands/ListGenericCommands:1.1.1.2 --- xc/programs/rstart/samples/commands/ListGenericCommands:1.1.1.1 Wed Apr 27 03:22:04 1994 +++ xc/programs/rstart/samples/commands/ListGenericCommands Tue Jan 16 17:46:58 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: ListGenericCommands,v 1.2 94/02/06 16:41:33 mor Exp $ +# $Xorg: ListGenericCommands,v 1.3 2000/08/17 19:54:03 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/commands/odt1/@List diff -u xc/programs/rstart/samples/commands/odt1/@List:1.1.1.1 xc/programs/rstart/samples/commands/odt1/@List:1.1.1.2 --- xc/programs/rstart/samples/commands/odt1/@List:1.1.1.1 Wed Apr 27 03:22:07 1994 +++ xc/programs/rstart/samples/commands/odt1/@List Tue Jan 16 17:46:59 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @List,v 1.2 94/02/06 16:44:19 mor Exp $ +# $Xorg: @List,v 1.3 2000/08/17 19:54:03 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems # Index: xc/programs/rstart/samples/commands/odt1/LoadMonitor diff -u xc/programs/rstart/samples/commands/odt1/LoadMonitor:1.1.1.1 xc/programs/rstart/samples/commands/odt1/LoadMonitor:1.1.1.2 --- xc/programs/rstart/samples/commands/odt1/LoadMonitor:1.1.1.1 Wed Apr 27 03:22:07 1994 +++ xc/programs/rstart/samples/commands/odt1/LoadMonitor Tue Jan 16 17:46:59 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: LoadMonitor,v 1.2 94/02/06 16:44:23 mor Exp $ +# $Xorg: LoadMonitor,v 1.3 2000/08/17 19:54:03 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/commands/odt1/Terminal diff -u xc/programs/rstart/samples/commands/odt1/Terminal:1.1.1.1 xc/programs/rstart/samples/commands/odt1/Terminal:1.1.1.2 --- xc/programs/rstart/samples/commands/odt1/Terminal:1.1.1.1 Wed Apr 27 03:22:08 1994 +++ xc/programs/rstart/samples/commands/odt1/Terminal Tue Jan 16 17:46:59 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: Terminal,v 1.2 94/02/06 16:44:24 mor Exp $ +# $Xorg: Terminal,v 1.3 2000/08/17 19:54:03 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/commands/openwindows2/@List diff -u xc/programs/rstart/samples/commands/openwindows2/@List:1.1.1.1 xc/programs/rstart/samples/commands/openwindows2/@List:1.1.1.2 --- xc/programs/rstart/samples/commands/openwindows2/@List:1.1.1.1 Wed Apr 27 03:22:07 1994 +++ xc/programs/rstart/samples/commands/openwindows2/@List Tue Jan 16 17:47:00 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @List,v 1.2 94/02/06 16:44:46 mor Exp $ +# $Xorg: @List,v 1.3 2000/08/17 19:54:03 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/commands/openwindows2/LoadMonitor diff -u xc/programs/rstart/samples/commands/openwindows2/LoadMonitor:1.1.1.1 xc/programs/rstart/samples/commands/openwindows2/LoadMonitor:1.1.1.2 --- xc/programs/rstart/samples/commands/openwindows2/LoadMonitor:1.1.1.1 Wed Apr 27 03:22:07 1994 +++ xc/programs/rstart/samples/commands/openwindows2/LoadMonitor Tue Jan 16 17:47:00 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: LoadMonitor,v 1.2 94/02/06 16:44:51 mor Exp $ +# $Xorg: LoadMonitor,v 1.3 2000/08/17 19:54:03 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/commands/openwindows2/Terminal diff -u xc/programs/rstart/samples/commands/openwindows2/Terminal:1.1.1.1 xc/programs/rstart/samples/commands/openwindows2/Terminal:1.1.1.2 --- xc/programs/rstart/samples/commands/openwindows2/Terminal:1.1.1.1 Wed Apr 27 03:22:07 1994 +++ xc/programs/rstart/samples/commands/openwindows2/Terminal Tue Jan 16 17:47:00 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: Terminal,v 1.2 94/02/06 16:44:52 mor Exp $ +# $Xorg: Terminal,v 1.3 2000/08/17 19:54:03 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/commands/openwindows3/@List diff -u xc/programs/rstart/samples/commands/openwindows3/@List:1.1.1.1 xc/programs/rstart/samples/commands/openwindows3/@List:1.1.1.2 --- xc/programs/rstart/samples/commands/openwindows3/@List:1.1.1.1 Wed Apr 27 03:22:06 1994 +++ xc/programs/rstart/samples/commands/openwindows3/@List Tue Jan 16 17:47:01 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @List,v 1.2 94/02/06 16:45:16 mor Exp $ +# $Xorg: @List,v 1.3 2000/08/17 19:54:03 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/commands/openwindows3/LoadMonitor diff -u xc/programs/rstart/samples/commands/openwindows3/LoadMonitor:1.1.1.1 xc/programs/rstart/samples/commands/openwindows3/LoadMonitor:1.1.1.2 --- xc/programs/rstart/samples/commands/openwindows3/LoadMonitor:1.1.1.1 Wed Apr 27 03:22:06 1994 +++ xc/programs/rstart/samples/commands/openwindows3/LoadMonitor Tue Jan 16 17:47:01 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: LoadMonitor,v 1.2 94/02/06 16:45:20 mor Exp $ +# $Xorg: LoadMonitor,v 1.3 2000/08/17 19:54:03 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/commands/openwindows3/Terminal diff -u xc/programs/rstart/samples/commands/openwindows3/Terminal:1.1.1.1 xc/programs/rstart/samples/commands/openwindows3/Terminal:1.1.1.2 --- xc/programs/rstart/samples/commands/openwindows3/Terminal:1.1.1.1 Wed Apr 27 03:22:06 1994 +++ xc/programs/rstart/samples/commands/openwindows3/Terminal Tue Jan 16 17:47:01 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: Terminal,v 1.2 94/02/06 16:45:21 mor Exp $ +# $Xorg: Terminal,v 1.3 2000/08/17 19:54:03 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/commands/x11r5/@List diff -u xc/programs/rstart/samples/commands/x11r5/@List:1.1.1.1 xc/programs/rstart/samples/commands/x11r5/@List:1.1.1.2 --- xc/programs/rstart/samples/commands/x11r5/@List:1.1.1.1 Wed Apr 27 03:22:05 1994 +++ xc/programs/rstart/samples/commands/x11r5/@List Tue Jan 16 17:47:02 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @List,v 1.2 94/02/06 16:45:32 mor Exp $ +# $Xorg: @List,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/commands/x11r5/LoadMonitor diff -u xc/programs/rstart/samples/commands/x11r5/LoadMonitor:1.1.1.1 xc/programs/rstart/samples/commands/x11r5/LoadMonitor:1.1.1.2 --- xc/programs/rstart/samples/commands/x11r5/LoadMonitor:1.1.1.1 Wed Apr 27 03:22:05 1994 +++ xc/programs/rstart/samples/commands/x11r5/LoadMonitor Tue Jan 16 17:47:02 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: LoadMonitor,v 1.2 94/02/06 16:45:35 mor Exp $ +# $Xorg: LoadMonitor,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/commands/x11r5/Terminal diff -u xc/programs/rstart/samples/commands/x11r5/Terminal:1.1.1.1 xc/programs/rstart/samples/commands/x11r5/Terminal:1.1.1.2 --- xc/programs/rstart/samples/commands/x11r5/Terminal:1.1.1.1 Wed Apr 27 03:22:05 1994 +++ xc/programs/rstart/samples/commands/x11r5/Terminal Tue Jan 16 17:47:02 2001 @@ -1,5 +1,5 @@ #! /bin/sh -# $XConsortium: Terminal,v 1.2 94/02/06 16:45:37 mor Exp $ +# $Xorg: Terminal,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/contexts.odt1/@Aliases diff -u xc/programs/rstart/samples/contexts.odt1/@Aliases:1.1.1.1 xc/programs/rstart/samples/contexts.odt1/@Aliases:1.1.1.2 --- xc/programs/rstart/samples/contexts.odt1/@Aliases:1.1.1.1 Wed Apr 27 03:22:02 1994 +++ xc/programs/rstart/samples/contexts.odt1/@Aliases Tue Jan 16 17:47:03 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @Aliases,v 1.2 94/02/06 16:49:46 mor Exp $ +# $Xorg: @Aliases,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/contexts.odt1/@List diff -u xc/programs/rstart/samples/contexts.odt1/@List:1.1.1.1 xc/programs/rstart/samples/contexts.odt1/@List:1.1.1.2 --- xc/programs/rstart/samples/contexts.odt1/@List:1.1.1.1 Wed Apr 27 03:22:02 1994 +++ xc/programs/rstart/samples/contexts.odt1/@List Tue Jan 16 17:47:03 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @List,v 1.2 94/02/06 16:49:54 mor Exp $ +# $Xorg: @List,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/contexts.odt1/default diff -u xc/programs/rstart/samples/contexts.odt1/default:1.1.1.1 xc/programs/rstart/samples/contexts.odt1/default:1.1.1.2 --- xc/programs/rstart/samples/contexts.odt1/default:1.1.1.1 Wed Apr 27 03:22:02 1994 +++ xc/programs/rstart/samples/contexts.odt1/default Tue Jan 16 17:47:03 2001 @@ -1,4 +1,4 @@ -# $XConsortium: default,v 1.2 94/02/06 16:49:55 mor Exp $ +# $Xorg: default,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Null context Index: xc/programs/rstart/samples/contexts.odt1/odt1 diff -u xc/programs/rstart/samples/contexts.odt1/odt1:1.1.1.1 xc/programs/rstart/samples/contexts.odt1/odt1:1.1.1.2 --- xc/programs/rstart/samples/contexts.odt1/odt1:1.1.1.1 Wed Apr 27 03:22:02 1994 +++ xc/programs/rstart/samples/contexts.odt1/odt1 Tue Jan 16 17:47:03 2001 @@ -1,4 +1,4 @@ -# $XConsortium: odt1,v 1.2 94/02/06 16:49:56 mor Exp $ +# $Xorg: odt1,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/contexts.sun/@Aliases diff -u xc/programs/rstart/samples/contexts.sun/@Aliases:1.1.1.1 xc/programs/rstart/samples/contexts.sun/@Aliases:1.1.1.2 --- xc/programs/rstart/samples/contexts.sun/@Aliases:1.1.1.1 Wed Apr 27 03:22:03 1994 +++ xc/programs/rstart/samples/contexts.sun/@Aliases Tue Jan 16 17:47:04 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @Aliases,v 1.2 94/02/06 16:51:10 mor Exp $ +# $Xorg: @Aliases,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/contexts.sun/@List diff -u xc/programs/rstart/samples/contexts.sun/@List:1.1.1.1 xc/programs/rstart/samples/contexts.sun/@List:1.1.1.2 --- xc/programs/rstart/samples/contexts.sun/@List:1.1.1.1 Wed Apr 27 03:22:03 1994 +++ xc/programs/rstart/samples/contexts.sun/@List Tue Jan 16 17:47:05 2001 @@ -1,4 +1,4 @@ -# $XConsortium: @List,v 1.2 94/02/06 16:51:16 mor Exp $ +# $Xorg: @List,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/contexts.sun/default diff -u xc/programs/rstart/samples/contexts.sun/default:1.1.1.1 xc/programs/rstart/samples/contexts.sun/default:1.1.1.2 --- xc/programs/rstart/samples/contexts.sun/default:1.1.1.1 Wed Apr 27 03:22:03 1994 +++ xc/programs/rstart/samples/contexts.sun/default Tue Jan 16 17:47:05 2001 @@ -1,4 +1,4 @@ -# $XConsortium: default,v 1.2 94/02/06 16:51:17 mor Exp $ +# $Xorg: default,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Null context Index: xc/programs/rstart/samples/contexts.sun/openwindows2 diff -u xc/programs/rstart/samples/contexts.sun/openwindows2:1.1.1.1 xc/programs/rstart/samples/contexts.sun/openwindows2:1.1.1.2 --- xc/programs/rstart/samples/contexts.sun/openwindows2:1.1.1.1 Wed Apr 27 03:22:04 1994 +++ xc/programs/rstart/samples/contexts.sun/openwindows2 Tue Jan 16 17:47:05 2001 @@ -1,4 +1,4 @@ -# $XConsortium: openwindows2,v 1.2 94/02/06 16:51:18 mor Exp $ +# $Xorg: openwindows2,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/contexts.sun/openwindows3 diff -u xc/programs/rstart/samples/contexts.sun/openwindows3:1.1.1.1 xc/programs/rstart/samples/contexts.sun/openwindows3:1.1.1.2 --- xc/programs/rstart/samples/contexts.sun/openwindows3:1.1.1.1 Wed Apr 27 03:22:03 1994 +++ xc/programs/rstart/samples/contexts.sun/openwindows3 Tue Jan 16 17:47:05 2001 @@ -1,4 +1,4 @@ -# $XConsortium: openwindows3,v 1.2 94/02/06 16:51:19 mor Exp $ +# $Xorg: openwindows3,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/contexts.sun/x11r5 diff -u xc/programs/rstart/samples/contexts.sun/x11r5:1.1.1.1 xc/programs/rstart/samples/contexts.sun/x11r5:1.1.1.2 --- xc/programs/rstart/samples/contexts.sun/x11r5:1.1.1.1 Wed Apr 27 03:22:03 1994 +++ xc/programs/rstart/samples/contexts.sun/x11r5 Tue Jan 16 17:47:06 2001 @@ -1,4 +1,4 @@ -# $XConsortium: x11r5,v 1.2 94/02/06 16:51:20 mor Exp $ +# $Xorg: x11r5,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/rstart/samples/contexts.sun/x11r6 diff -u xc/programs/rstart/samples/contexts.sun/x11r6:1.1.1.1 xc/programs/rstart/samples/contexts.sun/x11r6:1.1.1.2 --- xc/programs/rstart/samples/contexts.sun/x11r6:1.1.1.1 Wed Apr 27 03:22:04 1994 +++ xc/programs/rstart/samples/contexts.sun/x11r6 Tue Jan 16 17:47:06 2001 @@ -1,4 +1,4 @@ -# $XConsortium: x11r6,v 1.2 94/02/06 16:51:21 mor Exp $ +# $Xorg: x11r6,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # # Copyright (c) 1993 Quarterdeck Office Systems Index: xc/programs/scripts/Imakefile diff -u xc/programs/scripts/Imakefile:3.0 xc/programs/scripts/Imakefile:3.1 --- xc/programs/scripts/Imakefile:3.0 Fri Feb 9 03:22:38 1996 +++ xc/programs/scripts/Imakefile Wed Jan 17 18:45:04 2001 @@ -1,5 +1,9 @@ -XCOMM $XConsortium: Imakefile,v 1.27 94/02/10 16:55:34 rws Exp $ -XCOMM $XFree86: xc/programs/scripts/Imakefile,v 3.0 1996/02/09 08:22:38 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/scripts/Imakefile,v 3.1 2001/01/17 23:45:04 dawes Exp $ all:: Index: xc/programs/scripts/xon.man diff -u xc/programs/scripts/xon.man:1.4 xc/programs/scripts/xon.man:1.6 --- xc/programs/scripts/xon.man:1.4 Sun Oct 4 05:40:35 1998 +++ xc/programs/scripts/xon.man Sat Jan 27 13:21:05 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xon.man /main/10 1998/02/09 13:47:07 kaleb $ +.\" $Xorg: xon.man,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ .\" Copyright 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" be used in advertising or otherwise to promote the sale, use or other .\" dealing in this Software without prior written authorization from the .\" The Open Group. -.TH XON 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/scripts/xon.man,v 1.6 2001/01/27 18:21:05 dawes Exp $ +.\" +.TH XON 1 __xorgversion__ .SH NAME xon \- start an X program on a remote machine .SH SYNOPSIS Index: xc/programs/scripts/xon.sh diff -u xc/programs/scripts/xon.sh:1.2 xc/programs/scripts/xon.sh:1.3 --- xc/programs/scripts/xon.sh:1.2 Tue Jun 3 10:12:37 1997 +++ xc/programs/scripts/xon.sh Wed Jan 17 18:45:04 2001 @@ -1,5 +1,5 @@ #!/bin/sh -# $XConsortium: xon.sh,v 1.10 94/12/09 22:53:55 gildea Exp $ +# $Xorg: xon.sh,v 1.3 2000/08/17 19:54:04 cpqbld Exp $ # start up xterm (or any other X command) on the specified host # Usage: xon host [arguments] [command] case $# in Index: xc/programs/setxkbmap/Imakefile diff -u xc/programs/setxkbmap/Imakefile:3.0 xc/programs/setxkbmap/Imakefile:3.2 --- xc/programs/setxkbmap/Imakefile:3.0 Tue Aug 13 07:32:42 1996 +++ xc/programs/setxkbmap/Imakefile Sun Apr 1 10:00:18 2001 @@ -1,5 +1,10 @@ XCOMM $XConsortium: Imakefile /main/1 1995/11/30 19:18:08 kaleb $ + + + +XCOMM $XFree86: xc/programs/setxkbmap/Imakefile,v 3.2 2001/04/01 14:00:18 tsi Exp $ + SRCS = setxkbmap.c OBJS = setxkbmap.o DEPLIBS = $(DEPXKBFILELIB) $(DEPXLIBONLY) @@ -14,4 +19,6 @@ clean:: RemoveFiles(test.h *.xkm *.xkb) +#if BuildXKBlib ComplexProgramTarget(setxkbmap) +#endif Index: xc/programs/setxkbmap/setxkbmap.c diff -u xc/programs/setxkbmap/setxkbmap.c:3.3 xc/programs/setxkbmap/setxkbmap.c:3.5 --- xc/programs/setxkbmap/setxkbmap.c:3.3 Sat Feb 20 10:07:20 1999 +++ xc/programs/setxkbmap/setxkbmap.c Tue May 8 18:05:17 2001 @@ -23,7 +23,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/setxkbmap/setxkbmap.c,v 3.3 1999/02/20 15:07:20 hohndel Exp $ */ +/* $XFree86: xc/programs/setxkbmap/setxkbmap.c,v 3.5 2001/05/08 22:05:17 paulo Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -46,11 +46,17 @@ #endif #ifndef DFLT_XKB_CONFIG_ROOT -#define DFLT_XKB_CONFIG_ROOT "/usr/X11R6.1/lib/X11/xkb" +#define DFLT_XKB_CONFIG_ROOT "/usr/X11R6/lib/X11/xkb" #endif #ifndef DFLT_XKB_RULES_FILE -#define DFLT_XKB_RULES_FILE "rules" +#define DFLT_XKB_RULES_FILE "xfree86" #endif +#ifndef DFLT_XKB_LAYOUT +#define DFLT_XKB_LAYOUT "us" +#endif +#ifndef DFLT_XKB_MODEL +#define DFLT_XKB_MODEL "pc101" +#endif #define UNDEFINED 0 #define FROM_SERVER 1 @@ -237,10 +243,14 @@ #endif { if (wantRules) { - if (cfgResult.model) MSG1("model: %s\n",cfgResult.model); - if (cfgResult.layout) MSG1("layout: %s\n",cfgResult.layout); - if (cfgResult.variant) MSG1("variant: %s\n",cfgResult.variant); - if (cfgResult.options) MSG1("options: %s\n",cfgResult.options); + if (svValue[MODEL_NDX]) MSG1("model: %s\n",svValue[MODEL_NDX]); + if (svValue[LAYOUT_NDX]) MSG1("layout: %s\n",svValue[LAYOUT_NDX]); + if (svValue[VARIANT_NDX]) MSG1("variant: %s\n",svValue[VARIANT_NDX]); + if (options) { + char *opt_str=stringFromOptions(NULL, numOptions, options); + MSG1("options: %s\n", opt_str); + free(opt_str); + } } if (wantCNames) { if (svValue[KEYMAP_NDX]) @@ -314,6 +324,7 @@ return True; } ndx++; + *arg= ndx; if (svValue[which]!=NULL) { if (svSrc[which]==src) { VMSG2(0,"More than one %s on %s\n",svName[which],srcName[src]); @@ -329,7 +340,6 @@ } svSrc[which]= src; svValue[which]= argv[ndx]; - *arg= ndx; return True; } @@ -346,6 +356,7 @@ { int i; Bool ok; +unsigned present; ok= True; addToList(&szInclPath,&numInclPath,&inclPath,"."); @@ -384,6 +395,8 @@ if ((i>=argc-1)||(argv[i+1][0]=='\0')||(argv[i+1][0]=='-')) { clearOptions= True; ok= addToList(&szOptions,&numOptions,&options,""); + if (argv[i+1][0]=='\0') + i++; } else { ok= addToList(&szOptions,&numOptions,&options,argv[++i]); @@ -418,6 +431,21 @@ ok= False; } } + + present= 0; + if (svValue[TYPES_NDX]) present++; + if (svValue[COMPAT_NDX]) present++; + if (svValue[SYMBOLS_NDX]) present++; + if (svValue[KEYCODES_NDX]) present++; + if (svValue[GEOMETRY_NDX]) present++; + if (svValue[CONFIG_NDX]) present++; + if (svValue[MODEL_NDX]) present++; + if (svValue[LAYOUT_NDX]) present++; + if (svValue[VARIANT_NDX]) present++; + if (svValue[KEYMAP_NDX] && present) { + ERR("No other components can be specified when a keymap is present\n"); + return False; + } return ok; } @@ -482,9 +510,13 @@ XkbRF_VarDefsRec vd; char * tmp= NULL; - if (!XkbRF_GetNamesProp(dpy,&tmp,&vd)) { + if (!XkbRF_GetNamesProp(dpy,&tmp,&vd) || !tmp) { VMSG1(3,"Couldn't interpret %s property\n",_XKB_RF_NAMES_PROP_ATOM); - return False; + tmp = DFLT_XKB_RULES_FILE; + vd.model = DFLT_XKB_MODEL; + vd.layout = DFLT_XKB_LAYOUT; + VMSG3(3,"Use defaults: rules - '%s' model - '%s' layout - '%s'\n", + tmp, vd.model, vd.layout); } if (tmp) trySetString(RULES_NDX,tmp,FROM_SERVER); @@ -698,6 +730,8 @@ char buf[PATH_MAX]; XkbComponentNamesRec rnames; + if(svSrc[VARIANT_NDX] < svSrc[LAYOUT_NDX]) + svValue[VARIANT_NDX] = NULL; rdefs.model= svValue[MODEL_NDX]; rdefs.layout= svValue[LAYOUT_NDX]; @@ -754,7 +788,7 @@ } if (verbose>6) { MSG1("Applied rules from %s:\n",svValue[RULES_NDX]); - dumpNames(False,True); + dumpNames(True,False); } } else if (verbose>6) { @@ -763,7 +797,55 @@ return True; } -#define ALL_NAMES (XkbGBN_TypesMask|XkbGBN_CompatMapMask|XkbGBN_SymbolsMask|XkbGBN_KeyNamesMask|XkbGBN_GeometryMask) +/* Primitive sanity check - filter out 'map names' (inside parenthesis) */ +/* that can confuse xkbcomp parser */ +Bool +#if NeedFunctionPrototypes +checkName(char *name, char* string) +#else +checkName() + char *name; + char *string; +#endif +{ + char *i = name, *opar = NULL; + Bool ret = True; + + if(!name) + return True; + + while (*i){ + if (opar == NULL) { + if (*i == '(') + opar = i; + } else { + if ((*i == '(') || (*i == '|') || (*i == '+')) { + ret = False; + break; + } + if (*i == ')') + opar = NULL; + } + i++; + } + if (opar) + ret = False; + if (!ret) { + char c; + int n = 1; + for(i = opar+1; *i && n; i++) { + if (*i == '(') n++; + if (*i == ')') n--; + } + if (*i) i++; + c = *i; + *i = '\0'; + ERR1("Illegal map name '%s' ", opar); + *i = c; + ERR2("in %s name '%s'\n", string, name); + } + return ret; +} Bool #if NeedFunctionPrototypes @@ -772,25 +854,22 @@ applyComponentNames() #endif { -unsigned present; - - present= 0; - if (svValue[TYPES_NDX]) present|= XkbGBN_TypesMask; - if (svValue[COMPAT_NDX]) present|= XkbGBN_CompatMapMask; - if (svValue[SYMBOLS_NDX]) present|= XkbGBN_SymbolsMask; - if (svValue[KEYCODES_NDX]) present|= XkbGBN_KeyNamesMask; - if (svValue[GEOMETRY_NDX]) present|= XkbGBN_GeometryMask; - if (svValue[KEYMAP_NDX] && present) { - ERR("No other components can be specified when a keymap is present\n"); + if(!checkName(svValue[TYPES_NDX], "types")) return False; - } - if ((!dpy)&&((present&ALL_NAMES)!=ALL_NAMES)) { - ERR("All components must be specified for -t flag\n"); + if(!checkName(svValue[COMPAT_NDX], "compat")) return False; - } + if(!checkName(svValue[SYMBOLS_NDX], "symbols")) + return False; + if(!checkName(svValue[KEYCODES_NDX], "keycodes")) + return False; + if(!checkName(svValue[GEOMETRY_NDX], "geometry")) + return False; + if(!checkName(svValue[KEYMAP_NDX], "keymap")) + return False; + if (verbose>5) { MSG("Trying to build keymap using the following components:\n"); - dumpNames(True,True); + dumpNames(False,True); } if (dpy) { XkbComponentNamesRec cmdNames; @@ -832,8 +911,8 @@ svValue[LOCALE_NDX]= setlocale(LC_ALL,svValue[LOCALE_NDX]); svSrc[LOCALE_NDX]= FROM_SERVER; VMSG1(7,"locale is %s\n",svValue[LOCALE_NDX]); - if (dpy && (!getServerValues())) - exit(-2); + if (dpy) + getServerValues(); if (svValue[CONFIG_NDX] && (!applyConfig(svValue[CONFIG_NDX]))) exit(-3); if (!applyRules()) Index: xc/programs/setxkbmap/setxkbmap.man diff -u xc/programs/setxkbmap/setxkbmap.man:3.2 xc/programs/setxkbmap/setxkbmap.man:3.4 --- xc/programs/setxkbmap/setxkbmap.man:3.2 Tue Mar 21 16:08:10 2000 +++ xc/programs/setxkbmap/setxkbmap.man Wed Feb 28 19:56:55 2001 @@ -1,4 +1,7 @@ -.TH SETXKBMAP 1 "" "Silicon Graphics" +.\" +.\" $XFree86: xc/programs/setxkbmap/setxkbmap.man,v 3.4 2001/03/01 00:56:55 dawes Exp $ +.\" +.TH SETXKBMAP 1 __xorgversion__ .SH NAME setxkbmap \- set the keyboard using the X Keyboard Extension @@ -58,7 +61,12 @@ .B \-option \fIname\fP Specifies the name of an option to determine the components which make up the keyboard description; multiple options may be specified, one per -\fI-option\fP flag. +\fI-option\fP flag. Note that +.B setxkbmap +summarize options specified in command +line with options setted before (saved in root window properties). If you +want only specified options will be setted use \fI-option\fP flag with +empty argument first. .TP 8 .B \-rules \fIfile\fP Specifies the name of the rules file used to resolve the request layout Index: xc/programs/showfont/showfont.man diff -u xc/programs/showfont/showfont.man:1.3 xc/programs/showfont/showfont.man:1.4 --- xc/programs/showfont/showfont.man:1.3 Thu Feb 17 09:00:33 2000 +++ xc/programs/showfont/showfont.man Sat Jan 27 13:21:06 2001 @@ -1,6 +1,6 @@ .\" $XConsortium: showfont.man,v 1.3 94/04/11 14:29:57 gildea Exp $ -.\" $XFree86: xc/programs/showfont/showfont.man,v 1.3 2000/02/17 14:00:33 dawes Exp $ -.TH SHOWFONT 1 "Release 6" "X Version 11" +.\" $XFree86: xc/programs/showfont/showfont.man,v 1.4 2001/01/27 18:21:06 dawes Exp $ +.TH SHOWFONT 1 __xorgversion__ .SH NAME showfont \- font dumper for X font server .SH SYNOPSIS Index: xc/programs/smproxy/Imakefile diff -u xc/programs/smproxy/Imakefile:1.3 xc/programs/smproxy/Imakefile:1.4 --- xc/programs/smproxy/Imakefile:1.3 Tue May 13 11:08:14 1997 +++ xc/programs/smproxy/Imakefile Wed Jan 17 18:45:04 2001 @@ -1,7 +1,14 @@ -XCOMM $XConsortium: Imakefile,v 1.2 94/07/06 16:26:46 mor Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:05 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/smproxy/Imakefile,v 1.4 2001/01/17 23:45:04 dawes Exp $ + #if HasMkstemp DEFINES = -DHAS_MKSTEMP #endif + DEPLIBS = $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XMULIB) $(XTOOLLIB) $(XLIB) SRCS = smproxy.c save.c Index: xc/programs/smproxy/save.c diff -u xc/programs/smproxy/save.c:1.6 xc/programs/smproxy/save.c:1.7 --- xc/programs/smproxy/save.c:1.6 Thu Feb 25 01:01:01 1999 +++ xc/programs/smproxy/save.c Wed Jan 17 18:45:04 2001 @@ -1,4 +1,4 @@ -/* $TOG: save.c /main/6 1998/02/09 13:47:15 kaleb $ */ +/* $Xorg: save.c,v 1.3 2000/08/17 19:54:05 cpqbld Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group @@ -21,7 +21,7 @@ Author: Ralph Mor, X Consortium ******************************************************************************/ -/* $XFree86: xc/programs/smproxy/save.c,v 1.6 1999/02/25 06:01:01 dawes Exp $ */ +/* $XFree86: xc/programs/smproxy/save.c,v 1.7 2001/01/17 23:45:04 dawes Exp $ */ #include "smproxy.h" #ifdef HAS_MKSTEMP Index: xc/programs/smproxy/smproxy.c diff -u xc/programs/smproxy/smproxy.c:3.5 xc/programs/smproxy/smproxy.c:3.6 --- xc/programs/smproxy/smproxy.c:3.5 Sat Feb 20 10:07:20 1999 +++ xc/programs/smproxy/smproxy.c Wed Jan 17 18:45:05 2001 @@ -1,4 +1,4 @@ -/* $TOG: smproxy.c /main/30 1998/02/09 13:47:20 kaleb $ */ +/* $Xorg: smproxy.c,v 1.5 2000/08/17 19:54:05 cpqbld Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group @@ -21,7 +21,7 @@ Author: Ralph Mor, X Consortium ******************************************************************************/ -/* $XFree86: xc/programs/smproxy/smproxy.c,v 3.5 1999/02/20 15:07:20 hohndel Exp $ */ +/* $XFree86: xc/programs/smproxy/smproxy.c,v 3.6 2001/01/17 23:45:05 dawes Exp $ */ #include "smproxy.h" #include <unistd.h> @@ -572,7 +572,6 @@ -int MyErrorHandler (display, event) Display *display; Index: xc/programs/smproxy/smproxy.h diff -u xc/programs/smproxy/smproxy.h:1.3 xc/programs/smproxy/smproxy.h:1.4 --- xc/programs/smproxy/smproxy.h:1.3 Sat Feb 20 10:07:21 1999 +++ xc/programs/smproxy/smproxy.h Wed Jan 17 18:45:05 2001 @@ -1,4 +1,4 @@ -/* $TOG: smproxy.h /main/8 1998/02/09 13:47:25 kaleb $ */ +/* $Xorg: smproxy.h,v 1.3 2000/08/17 19:54:05 cpqbld Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group @@ -21,7 +21,7 @@ Author: Ralph Mor, X Consortium ******************************************************************************/ -/* $XFree86: xc/programs/smproxy/smproxy.h,v 1.3 1999/02/20 15:07:21 hohndel Exp $ */ +/* $XFree86: xc/programs/smproxy/smproxy.h,v 1.4 2001/01/17 23:45:05 dawes Exp $ */ #include <X11/Xosdefs.h> #include <X11/Xfuncs.h> Index: xc/programs/smproxy/smproxy.man diff -u xc/programs/smproxy/smproxy.man:1.4 xc/programs/smproxy/smproxy.man:1.6 --- xc/programs/smproxy/smproxy.man:1.4 Sun Oct 4 05:40:36 1998 +++ xc/programs/smproxy/smproxy.man Sat Jan 27 13:21:06 2001 @@ -1,4 +1,4 @@ -.\" $TOG: smproxy.man /main/5 1998/02/09 13:47:29 kaleb $ +.\" $Xorg: smproxy.man,v 1.3 2000/08/17 19:54:05 cpqbld Exp $ .\" Copyright 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XSM 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/smproxy/smproxy.man,v 1.6 2001/01/27 18:21:06 dawes Exp $ +.\" +.TH XSM 1 __xorgversion__ .SH NAME smproxy \- Session Manager Proxy .SH SYNOPSIS Index: xc/programs/texteroids/Imakefile diff -u /dev/null xc/programs/texteroids/Imakefile:1.3 --- /dev/null Mon Jun 4 12:42:50 2001 +++ xc/programs/texteroids/Imakefile Sun Mar 11 10:27:36 2001 @@ -0,0 +1,27 @@ +XCOMM $XFree86: xc/programs/texteroids/Imakefile,v 1.3 2001/03/11 15:27:36 herrb Exp $ + + DEPLIBS = $(DEPDPSLIB) $(DEPXTOOLLIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XTOOLLIB) $(DPSLIB) $(XLIB) + SYS_LIBRARIES = MathLibrary + PSWRAP = PsWrap + +SRCS = twraps.psw texteroids.c + +OBJS = twraps.o texteroids.o + +DERIVED_FILES = twraps.h twraps.c + +.SUFFIXES: .psw .h + +.psw.c : ProgramTargetName($(PSWRAP)) + RunProgram(PSWRAP,-a -o $*.c -h $*.h $<) + +.psw.h : ProgramTargetName($(PSWRAP)) + RunProgram(PSWRAP,-a -h $*.h $< > /dev/null) + +depend:: $(DERIVED_FILES) + +ComplexProgramTarget(texteroids) + +clean :: + $(RM) $(DERIVED_FILES) Index: xc/programs/texteroids/texteroids.c diff -u /dev/null xc/programs/texteroids/texteroids.c:1.4 --- /dev/null Mon Jun 4 12:42:50 2001 +++ xc/programs/texteroids/texteroids.c Sun Apr 1 10:00:18 2001 @@ -0,0 +1,719 @@ +/* texteroids.c + * + * (c) Copyright 1990-1994 Adobe Systems Incorporated. + * All rights reserved. + * + * Permission to use, copy, modify, distribute, and sublicense this software + * and its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notices appear in all copies and that + * both those copyright notices and this permission notice appear in + * supporting documentation and that the name of Adobe Systems Incorporated + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. No trademark license + * to use the Adobe trademarks is hereby granted. If the Adobe trademark + * "Display PostScript"(tm) is used to describe this software, its + * functionality or for any other purpose, such use shall be limited to a + * statement that this software works in conjunction with the Display + * PostScript system. Proper trademark attribution to reflect Adobe's + * ownership of the trademark shall be given whenever any such reference to + * the Display PostScript system is made. + * + * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. + * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE + * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT + * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE. + * + * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems + * Incorporated which may be registered in certain jurisdictions + * + * Author: Adobe Systems Incorporated + */ +/* $XFree86: xc/programs/texteroids/texteroids.c,v 1.4 2001/04/01 14:00:18 tsi Exp $ */ + +#include <X11/Intrinsic.h> +#include <X11/StringDefs.h> +#include <DPS/psops.h> +#include <DPS/dpsXclient.h> +#include <math.h> +#include <stdio.h> +#include <stdlib.h> +#include "twraps.h" + +int CheckForAHit(), ExplodeString(); +void PrepareSubject(), DrawSubject(), UpdatePosition(); + +#undef PI +#define PI 3.14159 +#define COLORINCR (1.0/200.0) +#define EPSILON 0.001 +#define ABS(x) ((x) >= 0 ? (x) : -(x)) + +typedef struct { + char *text_font; + int text_size; + Boolean rv; + Boolean debug; +} OptionsRec, *Options; + +OptionsRec options; + +XtResource app_resources[] = { + {"font", "Font", XtRString, sizeof(String), + XtOffset(Options, text_font), XtRString, (caddr_t) "Times-Italic"}, + {"textSize", "TextSize", XtRInt, sizeof(int), + XtOffset(Options, text_size), XtRImmediate, (caddr_t) 36}, + {"reverseVideo", "ReverseVideo", XtRBoolean, sizeof(Boolean), + XtOffset(Options, rv), XtRImmediate, (caddr_t) False}, + {"debug", "Debug", XtRBoolean, sizeof(Boolean), + XtOffset(Options, debug), XtRImmediate, (caddr_t) False}, +}; + +XrmOptionDescRec cmdOptions[] = { + {"-size", "*textSize", XrmoptionSepArg, NULL}, + {"-debug", "*debug", XrmoptionNoArg, (caddr_t)"True"}, +}; + +XtAppContext app; +DPSContext ctx, tctx; +Boolean resized = FALSE; +Boolean go_to_sleep = FALSE; +Boolean mapped = TRUE; +float hitx = -1.0, hity = -1.0; + +#ifdef _NO_PROTO +#define ARGCAST int +#else +#define ARGCAST void * +#endif + +Widget w; +Pixmap pix; +GC window_gc, drawing_gc; +Dimension width, height; +int depth; +float uwidth, uheight, old_uheight; +String *subject; +float *twidth, *theight; +float *charwidth; +float *textdx, *textdy, *dx, *dy; +float *vx, *vy; +float *dirx, *diry; +float *centerx, *centery; +float *r, *theta; +float *red, *green, *blue; +typedef enum {Rup, Rdown, Gup, Gdown, Bup, Bdown} Change; +Change *changing; +Boolean *live; +int count, total; + +float invctm[6]; + +void ITransform(x, y, ux, uy) + int x, y; + float *ux, *uy; +{ + *ux = invctm[0] * x + invctm[2] * y + invctm[4]; + *uy = invctm[1] * x + invctm[3] * y + invctm[5]; +} + +void CheckHit(w, event, params, num) + Widget w; + XEvent *event; + String *params; + Cardinal *num; +{ + if (event->type != ButtonPress) return; + ITransform(event->xbutton.x, event->xbutton.y - height, + &hitx, &hity); +} + +void MaybePause(w, event, params, num) + Widget w; + XEvent *event; + String *params; + Cardinal *num; +{ + switch (event->type) { + case VisibilityNotify: + go_to_sleep = + (event->xvisibility.state == VisibilityFullyObscured); + break; + } +} + +void MapHandler(w, client_data, event, cont) + Widget w; + XtPointer client_data; + XEvent *event; + Boolean *cont; +{ + switch (event->type) { + case UnmapNotify: + mapped = FALSE; + break; + case MapNotify: + mapped = TRUE; + break; + } +} + +void NewSize(w, event, params, num) + Widget w; + XEvent *event; + String *params; + Cardinal *num; +{ + if (event->type != ConfigureNotify) return; + if (event->xconfigure.width == width && event->xconfigure.height == height) + return; + width = event->xconfigure.width; + height = event->xconfigure.height; + resized = TRUE; +} + +String translations = + "<BtnDown> : CheckHit() \n\ + <Visible> : MaybePause() \n\ + <Configure> : NewSize()"; + +XtActionsRec actions[] = { + {"CheckHit", CheckHit}, + {"MaybePause", MaybePause}, + {"NewSize", NewSize} +}; + +int main(argc, argv) + int argc; + char **argv; +{ + Widget shell; + Arg args[10]; + int i, angle, start_angle; + int n; + String text; + XGCValues v; + int hit; + Pixel bg; + XSetWindowAttributes att; + float llx, lly, urx, ury; + + shell = XtAppInitialize(&app, "Texteroids", + cmdOptions, XtNumber(cmdOptions), + &argc, argv, + (String *) NULL, (ArgList) NULL, 0); + + XtAppAddActions(app, actions, XtNumber(actions)); + + XtGetApplicationResources(shell, &options, + app_resources, XtNumber(app_resources), + (ArgList) NULL, 0); + if (argc <= 1) text = "Adobe"; + else text = argv[1]; + text = XtNewString(text); /* Make sure it's writable */ + n = strlen(text); + + /* Don't use a translation for this; we don't want to get in the way + of what the shell might be doing */ + + XtAddEventHandler(shell, StructureNotifyMask, FALSE, MapHandler, NULL); + + i = 0; + XtSetArg(args[i], XtNwidth, 400); i++; + XtSetArg(args[i], XtNheight, 400); i++; + XtSetArg(args[i], XtNtranslations, + XtParseTranslationTable(translations)); i++; + if (options.rv) { + XtSetArg(args[i], XtNbackground, + WhitePixelOfScreen(XtScreen(shell))); i++; + } else { + XtSetArg(args[i], XtNbackground, + BlackPixelOfScreen(XtScreen(shell))); i++; + } + + w = XtCreateManagedWidget("main", widgetClass, shell, args, i); + XtRealizeWidget(shell); + + att.bit_gravity = StaticGravity; + XChangeWindowAttributes(XtDisplay(w), XtWindow(w), CWBitGravity, &att); + + i = 0; + XtSetArg(args[i], XtNwidth, &width); i++; + XtSetArg(args[i], XtNheight, &height); i++; + XtSetArg(args[i], XtNdepth, &depth); i++; + XtSetArg(args[i], XtNbackground, &bg); i++; + XtGetValues(w, args, i); + + /* window_gc is used for copying the off-screen pixmap to the window */ + v.function = GXcopy; + v.background = bg; + v.foreground = WhitePixelOfScreen(XtScreen(shell)); + window_gc = XCreateGC(XtDisplay(w), XtWindow(w), + GCFunction | GCForeground | GCBackground, &v); + + /* drawing_gc is used for drawing into the pixmap */ + drawing_gc = XtGetGC(w, 0, &v); + + pix = XCreatePixmap(XtDisplay(w), RootWindowOfScreen(XtScreen(w)), + width, height, depth); + + /* Make it possible for this client to start a DPS NX agent, + if "dpsnx.agent" is on the executable search path. */ + + (void) XDPSNXSetClientArg(XDPSNX_AUTO_LAUNCH, (ARGCAST) True); + + ctx = XDPSCreateSimpleContext(XtDisplay(w), pix, + drawing_gc, 0, height, + DPSDefaultTextBackstop, + DPSDefaultErrorProc, (DPSSpace) NULL); + if (ctx == NULL) { + fprintf(stderr, "\ntexteroids: DPS is not available.\n"); + fprintf(stderr, + "You need an X server with the DPS extension, or a DPS NX agent.\n"); + exit(1); + } + + if (options.debug) { + tctx = DPSCreateTextContext(DPSDefaultTextBackstop, + DPSDefaultErrorProc); + DPSChainContext(ctx, tctx); + } + + DPSSetContext(ctx); + GetInvCTM(invctm); + ITransform(width, -height, &uwidth, &uheight); + + subject = (String *) XtCalloc(n, sizeof(String)); + twidth = (float *) XtCalloc(n, sizeof(float)); + theight = (float *) XtCalloc(n, sizeof(float)); + charwidth = (float *) XtCalloc(n, sizeof(float)); + textdx = (float *) XtCalloc(n, sizeof(float)); + textdy = (float *) XtCalloc(n, sizeof(float)); + dx = (float *) XtCalloc(n, sizeof(float)); + dy = (float *) XtCalloc(n, sizeof(float)); + vx = (float *) XtCalloc(n, sizeof(float)); + vy = (float *) XtCalloc(n, sizeof(float)); + dirx = (float *) XtCalloc(n, sizeof(float)); + diry = (float *) XtCalloc(n, sizeof(float)); + centerx = (float *) XtCalloc(n, sizeof(float)); + centery = (float *) XtCalloc(n, sizeof(float)); + r = (float *) XtCalloc(n, sizeof(float)); + theta = (float *) XtCalloc(n, sizeof(float)); + red = (float *) XtCalloc(n, sizeof(float)); + blue = (float *) XtCalloc(n, sizeof(float)); + green = (float *) XtCalloc(n, sizeof(float)); + changing = (Change *) XtCalloc(n, sizeof(Change)); + live = (Boolean *) XtCalloc(n, sizeof(Boolean)); + + CreateFont(options.text_size, options.text_font); + vx[0] = 2.0; + vy[0] = 1.0; + dirx[0] = 1.0; + diry[0] = 1.0; + red[0] = 1.0; + green[0] = 0.0; + blue[0] = 0.0; + changing[0] = Gup; + + GetSize(text, &llx, &lly, &urx, &ury, &charwidth[i]); + llx--; lly--; urx++; ury++; + + PrepareSubject(0, text, uwidth/2, uheight/2, llx, lly, urx, ury); + count = total = 1; + + PrepareExplodedArrays(text, n); + + Clear(uwidth, uheight, (int) !options.rv); + + while (1) { + for (angle = 0; angle < 360; angle += 10) { + XSetClipMask(XtDisplay(w), drawing_gc, None); + DrawSubject(0, angle); + SyncAndCheck(angle); + Clear(uwidth, uheight, (int) !options.rv); + hit = CheckForAHit(angle); + UpdatePosition(0, angle); + if (hit != -1) goto EXPLODE; + } + } + +EXPLODE: if (n == 1) exit(0); + n = count = total = ExplodeString(text, angle + 10, n); + + Clear(uwidth, uheight, (int) !options.rv); + start_angle = angle + 10; + while(count > 0) { + for (angle = start_angle; angle < 360; angle += 10) { + XSetClipMask(XtDisplay(w), drawing_gc, None); + for (i = 0; i < n; i++) DrawSubject(i, angle); + SyncAndCheck(angle); + Clear(uwidth, uheight, (int) !options.rv); + hit = CheckForAHit(angle); + if (hit != -1) { + live[hit] = FALSE; + count--; + } + for (i = 0; i < n; i++) UpdatePosition(i, angle); + } + start_angle = 0; + } + return 0; +} + +float *llx, *lly, *urx, *ury, *altwidths; + +PrepareExplodedArrays(str, n) + char *str; +{ + char *altstr = (char *) XtNewString(str); + int i, texti; + + llx = (float *) XtCalloc(n, sizeof(float)); + lly = (float *) XtCalloc(n, sizeof(float)); + urx = (float *) XtCalloc(n, sizeof(float)); + ury = (float *) XtCalloc(n, sizeof(float)); + altwidths = (float *) XtCalloc(n, sizeof(float)); + + i = 0; + for (texti = 0; texti < n; texti++) { + if (str[texti] == ' ') continue; + altstr[i] = str[texti]; + i++; + } + altstr[i] = '\0'; + + GetAllSizes(altstr, i, llx, lly, urx, ury, altwidths); + XtFree(altstr); +} + +int ExplodeString(str, angle, n) + String str; + int angle, n; +{ + int i, texti, num; + float total_width = 0; + float startx, starty; + float temp_r, temp_theta; + float x, y; + float cx = centerx[0], cy = centery[0]; + + temp_r = r[0]; + temp_theta = PI + theta[0]; + startx = temp_r * cos(temp_theta); + starty = temp_r * sin(temp_theta); + + i = 0; + for (texti = 0; texti < n; texti++) { + if (str[texti] == ' ') continue; + + subject[i] = (char *) XtNewString("a"); + subject[i][0] = str[texti]; + str[i] = str[texti]; + i++; + } + str[i] = '\0'; + num = i; + + XtFree((XtPointer) charwidth); + charwidth = altwidths; + + for (i = 0; i < num; i++) { + llx[i]--; lly[i]--; urx[i]++; ury[i]++; + PrepareSubject(i, subject[i], 0.0, 0.0, + llx[i], lly[i], urx[i], ury[i]); + x = startx + total_width + llx[i] + twidth[i]/2; + y = starty + lly[i] + theight[i]/2; + + temp_r = sqrt(x*x + y*y); + temp_theta = atan2(y, x) + (angle) * PI / 180; + centerx[i] = temp_r * cos(temp_theta) + cx; + centery[i] = temp_r * sin(temp_theta) + cy; + + vx[i] *= dirx[i]; + vy[i] *= diry[i]; + vx[i] += 2.0 * cos(i * 2*PI / n); + vy[i] += 2.0 * sin(i * 2*PI / n); + + if (vx[i] < 0) {vx[i] = -vx[i]; dirx[i] = -1.0;} + else dirx[i] = 1.0; + if (vy[i] < 0) {vy[i] = -vy[i]; diry[i] = -1.0;} + else diry[i] = 1.0; + + total_width += charwidth[i]; + } + XtFree((XtPointer) llx); + XtFree((XtPointer) lly); + XtFree((XtPointer) urx); + XtFree((XtPointer) ury); + return num; +} + +void PrepareSubject(i, str, initx, inity, llx, lly, urx, ury) + int i; + String str; + float initx, inity; + float llx, lly, urx, ury; +{ + subject[i] = str; + centerx[i] = initx; + centery[i] = inity; + twidth[i] = urx - llx; + theight[i] = ury - lly; + textdx[i] = -(twidth[i]/2 + llx); + textdy[i] = -(theight[i]/2 + lly); + dx[i] = -twidth[i]/2; + dy[i] = -theight[i]/2; + r[i] = sqrt(twidth[i] * twidth[i]/4 + theight[i] * theight[i]/4); + theta[i] = atan(theight[i] / twidth[i]); + live[i] = TRUE; + if (i == 0) return; + vx[i] = vx[0]; + vy[i] = vy[0]; + dirx[i] = dirx[0]; + diry[i] = diry[0]; + red[i] = red[0]; + green[i] = green[0]; + blue[i] = blue[0]; + changing[i] = changing[0]; +} + +void DrawSubject(i, angle) + int i, angle; +{ + if (!live[i]) return; + RenderString(centerx[i], centery[i], textdx[i], textdy[i], (float) angle, + subject[i], red[i], green[i], blue[i]); +} + +Region empty = NULL; + +SyncAndCheck(angle) + int angle; +{ + int i; + static Region r1 = NULL, r2 = NULL; + static int which_region = 1; + static Region reg = NULL; + + DPSWaitContext(ctx); + XSync(XtDisplay(w), FALSE); + + if (empty == NULL) { + empty = XCreateRegion(); + reg = XCreateRegion(); + r1 = XCreateRegion(); + r2 = XCreateRegion(); + } + + if (which_region == 1) CreateRegionForClipping(r1, angle); + else CreateRegionForClipping(r2, angle); + + which_region = 3 - which_region; + + XUnionRegion(r1, r2, reg); + + XSetRegion(XtDisplay(w), window_gc, reg); + XSetRegion(XtDisplay(w), drawing_gc, reg); + + XCopyArea(XtDisplay(w), pix, XtWindow(w), window_gc, 0, 0, + width, height, 0, 0); + + while (XtAppPending(app)) { + XtAppProcessEvent(app, XtIMAll); + while (go_to_sleep || !mapped) { + XtAppProcessEvent(app, XtIMAll); + } + } + + if (resized) { + XFreePixmap(XtDisplay(w), pix); + pix = XCreatePixmap(XtDisplay(w), RootWindowOfScreen(XtScreen(w)), + width, height, depth); + + SetXDrawable(pix, height); + /* Make next Clear clear everything */ + XSetClipMask(XtDisplay(w), drawing_gc, None); + old_uheight = uheight; + GetInvCTM(invctm); + ITransform(width, -height, &uwidth, &uheight); + + for (i = 0; i < total; i++) { + if (centerx[i] > uwidth + r[i]) centerx[i] = uwidth - r[i]; + centery[i] += uheight - old_uheight; + if (centery[i] > uheight + r[i]) centery[i] = uheight - r[i]; + if (centery[i] < -r[i]) centery[i] = r[i]; + } + + resized = FALSE; + } +} + +void UpdatePosition(i, angle) + int i, angle; +{ + float incr; + + if (!live[i]) return; + + centerx[i] += vx[i] * dirx[i]; + centery[i] += vy[i] * diry[i]; + { + float c1x, c1y, c2x, c2y; + c1x = r[i] * cos(angle * PI / 180 + theta[i]); + c1y = r[i] * sin(angle * PI / 180 + theta[i]); + c2x = r[i] * cos(angle * PI / 180 - theta[i]); + c2y = r[i] * sin(angle * PI / 180 - theta[i]); + + if (c1x + centerx[i] > uwidth) dirx[i] = -1.0; + else if (c2x + centerx[i] > uwidth) dirx[i] = -1.0; + else if (-c1x + centerx[i] > uwidth) dirx[i] = -1.0; + else if (-c2x + centerx[i] > uwidth) dirx[i] = -1.0; + else if (c1x + centerx[i] < 0) dirx[i] = 1.0; + else if (c2x + centerx[i] < 0) dirx[i] = 1.0; + else if (-c1x + centerx[i] < 0) dirx[i] = 1.0; + else if (-c2x + centerx[i] < 0) dirx[i] = 1.0; + + if (c1y + centery[i] > uheight) diry[i] = -1.0; + else if (c2y + centery[i] > uheight) diry[i] = -1.0; + else if (-c1y + centery[i] > uheight) diry[i] = -1.0; + else if (-c2y + centery[i] > uheight) diry[i] = -1.0; + else if (c1y + centery[i] < 0) diry[i] = 1.0; + else if (c2y + centery[i] < 0) diry[i] = 1.0; + else if (-c1y + centery[i] < 0) diry[i] = 1.0; + else if (-c2y + centery[i] < 0) diry[i] = 1.0; + } + incr = 4.0 * ((float) i) / (((float) total) + 1.0); + incr += 1.0; + incr *= COLORINCR; + switch (changing[i]) { + case Gup: + green[i] += incr; + if (green[i] >= 1.0 - EPSILON) { + green[i] = 1.0; + changing[i] = Rdown; + } + break; + case Rup: + red[i] += incr; + if (red[i] >= 1.0 - EPSILON) { + red[i] = 1.0; + changing[i] = Bdown; + } + break; + case Bup: + blue[i] += incr; + if (blue[i] >= 1.0 - EPSILON) { + blue[i] = 1.0; + changing[i] = Gdown; + } + break; + + case Gdown: + green[i] -= incr; + if (green[i] < EPSILON) { + green[i] = 0.0; + changing[i] = Rup; + } + break; + case Rdown: + red[i] -= incr; + if (red[i] < EPSILON) { + red[i] = 0.0; + changing[i] = Bup; + } + break; + case Bdown: + blue[i] -= incr; + if (blue[i] < EPSILON) { + blue[i] = 0.0; + changing[i] = Gup; + } + break; + + } +} + +int CheckForAHit(angle) + int angle; +{ + int i; + float transx, transy; + float point_angle; + float point_r; + + if (hitx == -1 && hity == -1) return -1; + + for (i = 0; i < total; i++) { + if (!live[i]) continue; + point_angle = atan2(hity - centery[i], hitx - centerx[i]); + point_angle -= angle * PI / 180; + point_r = sqrt((hity - centery[i]) * (hity - centery[i]) + + (hitx - centerx[i]) * (hitx - centerx[i])); + transx = point_r * cos(point_angle); + transy = point_r * sin(point_angle); + if (transx >= -twidth[i]/2 && transx <= twidth[i]/2 && + transy >= -theight[i]/2 && transy <= theight[i]/2) { + hitx = hity = -1; + return i; + } + } + hitx = hity = -1; + return -1; +} + +CreateRegionForClipping(reg, angle) + Region reg; + int angle; +{ + int i; + XRectangle rec; + float c1x, c1y, c2x, c2y; + float left, bottom, wid, hgt; + + XIntersectRegion(reg, empty, reg); + + for (i = 0; i < total; i++) { + c1x = r[i] * cos(angle * PI / 180 + theta[i]); + c1y = r[i] * sin(angle * PI / 180 + theta[i]); + c2x = r[i] * cos(angle * PI / 180 - theta[i]); + c2y = r[i] * sin(angle * PI / 180 - theta[i]); + + left = centerx[i] - c1x; + if (centerx[i] - c2x < left) left = centerx[i] - c2x; + if (centerx[i] + c1x < left) left = centerx[i] + c1x; + if (centerx[i] + c2x < left) left = centerx[i] + c2x; + bottom = centery[i] - c1y; + if (centery[i] - c2y < bottom) bottom = centery[i] - c2y; + if (centery[i] + c1y < bottom) bottom = centery[i] + c1y; + if (centery[i] + c2y < bottom) bottom = centery[i] + c2y; + + c1x = ABS(c1x); + c2x = ABS(c2x); + c1y = ABS(c1y); + c2y = ABS(c2y); + + if (c1x > c2x) wid = 2*c1x; + else wid = 2*c2x; + if (c1y > c2y) hgt = 2*c1y; + else hgt = 2*c2y; + + left = left * ((float) width) / uwidth; + bottom = ((float) height) - bottom * ((float) height) / uheight; + wid = wid * ((float) width) / uwidth; + hgt = hgt * ((float) height) / uheight; + + rec.x = (int) floor(left) - 1; + if (rec.x < 0) rec.x = 0; + rec.y = (int) floor(bottom - hgt) - 1; + if (rec.y < 0) rec.y = 0; + rec.width = (int) ceil(wid) + 2; + rec.height = (int) ceil(hgt) + 2; + + XUnionRectWithRegion(&rec, reg, reg); + } +} Index: xc/programs/texteroids/texteroids.man diff -u /dev/null xc/programs/texteroids/texteroids.man:1.1 --- /dev/null Mon Jun 4 12:42:50 2001 +++ xc/programs/texteroids/texteroids.man Wed Feb 28 20:23:59 2001 @@ -0,0 +1,60 @@ +.\" Id: texteroids.man,v 6.1 1994/05/18 23:21:41 asente Exp $ +.\" $XFree86: xc/programs/texteroids/texteroids.man,v 1.1 2001/03/01 01:23:59 dawes Exp $ +.TH TEXTEROIDS 1 __vendorversion__ +.SH NAME +texteroids \- test your mousing skills on spinning text + +.SH SYNOPSIS +.B texteroids +[ +.B \-display \fIname\fR +][ +.B \-fn \fIfont\fR +][ +.B \-size \fIsize\fR +][ +.I text_string +] + +.SH DESCRIPTION +.LP +.B texteroids +spins the specified text string in a window. If you click on the text with +the mouse, the string splits up into individual letters, each of which you +may then click on. + +.SH OPTIONS +.TP +.BI \-display " name" +specifies the display on which to open a connection to the Display +PostScript System. If no display is specified, the +DISPLAY environment variable is used. +.TP +.BI \-fn " font" +specifies the name of the PostScript language font +software to use. +The default is Times-Italic. +.TP +.BI \-size " size" +specifies the size, in points, of the text. The default is 36. +.TP +.B \-debug +specifies debugging mode. In debugging mode, all PostScript code sent +to the server is printed out. +.TP +.I text_string +specifies the text to display. If the text has spaces it must be enclosed in +quotation marks. The default text string is "Adobe". + +.SH AUTHOR +.LP +Adobe Systems Incorporated + +.SH NOTES +.LP +PostScript and Display PostScript are trademarks +of Adobe Systems Incorporated which may be registered +in certain jurisdictions. +.LP +Copyright (c) 1990-1994 Adobe Systems Incorporated. All rights reserved. + Index: xc/programs/texteroids/twraps.psw diff -u /dev/null xc/programs/texteroids/twraps.psw:1.1 --- /dev/null Mon Jun 4 12:42:50 2001 +++ xc/programs/texteroids/twraps.psw Wed Feb 28 20:23:59 2001 @@ -0,0 +1,84 @@ +/* twraps.psw + * + * (c) Copyright 1990-1994 Adobe Systems Incorporated. + * All rights reserved. + * + * Permission to use, copy, modify, distribute, and sublicense this software + * and its documentation for any purpose and without fee is hereby granted, + * provided that the above copyright notices appear in all copies and that + * both those copyright notices and this permission notice appear in + * supporting documentation and that the name of Adobe Systems Incorporated + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. No trademark license + * to use the Adobe trademarks is hereby granted. If the Adobe trademark + * "Display PostScript"(tm) is used to describe this software, its + * functionality or for any other purpose, such use shall be limited to a + * statement that this software works in conjunction with the Display + * PostScript system. Proper trademark attribution to reflect Adobe's + * ownership of the trademark shall be given whenever any such reference to + * the Display PostScript system is made. + * + * ADOBE MAKES NO REPRESENTATIONS ABOUT THE SUITABILITY OF THE SOFTWARE FOR + * ANY PURPOSE. IT IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY. + * ADOBE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL + * IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NON- INFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL ADOBE BE LIABLE + * TO YOU OR ANY OTHER PARTY FOR ANY SPECIAL, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER WHETHER IN AN ACTION OF CONTRACT, + * NEGLIGENCE, STRICT LIABILITY OR ANY OTHER ACTION ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ADOBE WILL NOT + * PROVIDE ANY TRAINING OR OTHER SUPPORT FOR THE SOFTWARE. + * + * Adobe, PostScript, and Display PostScript are trademarks of Adobe Systems + * Incorporated which may be registered in certain jurisdictions + * + * Author: Adobe Systems Incorporated + */ +/* $XFree86: xc/programs/texteroids/twraps.psw,v 1.1 2001/03/01 01:23:59 dawes Exp $ */ + +defineps Clear(float w, h; boolean rv) + rv {0 setgray} {1 setgray} ifelse + 0 0 w h rectfill +endps + +defineps CreateFont(int size; char *name) + /name findfont size scalefont setfont +endps + +defineps GetAllSizes(char *text; int n | + float llx[n], lly[n], urx[n], ury[n], wid[n]) + (text) { + newpath + 0 0 moveto + (a) dup 0 4 -1 roll put % make character into string + dup true charpath flattenpath pathbbox ury urx lly llx + stringwidth pop wid + } forall +endps + +defineps GetSize(char *text | float *llx, *lly, *urx, *ury, *wid) + newpath + 0 0 moveto + (text) true charpath flattenpath pathbbox ury urx lly llx + (text) stringwidth pop wid +endps + +defineps RenderString(float x, y, dx, dy, angle; char *string; + float red, green, blue) + gsave + red green blue setrgbcolor + x y translate angle rotate + dx dy moveto + (string) show + grestore +endps + +defineps SetXDrawable(int drawable, height) + currentXgcdrawable pop height + 3 -1 roll pop drawable 3 1 roll + setXgcdrawable +endps + +defineps GetInvCTM(| float invctm[6]) + matrix currentmatrix matrix invertmatrix invctm +endps Index: xc/programs/twm/Imakefile diff -u xc/programs/twm/Imakefile:3.11 xc/programs/twm/Imakefile:3.12 --- xc/programs/twm/Imakefile:3.11 Sun Oct 29 09:24:13 2000 +++ xc/programs/twm/Imakefile Wed Jan 17 18:45:05 2001 @@ -1,7 +1,9 @@ -XCOMM $XConsortium: Imakefile /main/42 1996/01/14 16:50:01 kaleb $ -XCOMM $XFree86: xc/programs/twm/Imakefile,v 3.11 2000/10/29 14:24:13 tsi Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:05 cpqbld Exp $ + + +XCOMM $XFree86: xc/programs/twm/Imakefile,v 3.12 2001/01/17 23:45:05 dawes Exp $ #if HasMkstemp MKTMP_DEFINES = -DHAS_MKSTEMP Index: xc/programs/twm/add_window.c diff -u xc/programs/twm/add_window.c:1.7 xc/programs/twm/add_window.c:1.8 --- xc/programs/twm/add_window.c:1.7 Tue Oct 24 18:45:14 2000 +++ xc/programs/twm/add_window.c Wed Jan 17 18:45:05 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/add_window.c,v 1.7 2000/10/24 22:45:14 dawes Exp $ */ +/* $XFree86: xc/programs/twm/add_window.c,v 1.8 2001/01/17 23:45:05 dawes Exp $ */ /*****************************************************************************/ /* @@ -49,7 +49,7 @@ /********************************************************************** * - * $TOG: add_window.c /main/133 1998/02/09 13:47:33 kaleb $ + * $Xorg: add_window.c,v 1.4 2000/08/17 19:54:05 cpqbld Exp $ * * Add a new window, put the titlbar and other stuff around * the window Index: xc/programs/twm/add_window.h diff -u xc/programs/twm/add_window.h:1.3 xc/programs/twm/add_window.h:1.4 --- xc/programs/twm/add_window.h:1.3 Sat Feb 20 10:07:21 1999 +++ xc/programs/twm/add_window.h Wed Jan 17 18:45:05 2001 @@ -44,12 +44,12 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/add_window.h,v 1.3 1999/02/20 15:07:21 hohndel Exp $ */ +/* $XFree86: xc/programs/twm/add_window.h,v 1.4 2001/01/17 23:45:05 dawes Exp $ */ /********************************************************************** * - * $TOG: add_window.h /main/8 1998/02/09 13:47:40 kaleb $ + * $Xorg: add_window.h,v 1.3 2000/08/17 19:54:05 cpqbld Exp $ * * AddWindow include file * Index: xc/programs/twm/cursor.c diff -u xc/programs/twm/cursor.c:1.3 xc/programs/twm/cursor.c:1.4 --- xc/programs/twm/cursor.c:1.3 Sat Feb 20 10:07:22 1999 +++ xc/programs/twm/cursor.c Wed Jan 17 18:45:05 2001 @@ -18,11 +18,11 @@ 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/twm/cursor.c,v 1.3 1999/02/20 15:07:22 hohndel Exp $ */ +/* $XFree86: xc/programs/twm/cursor.c,v 1.4 2001/01/17 23:45:05 dawes Exp $ */ /*********************************************************************** * - * $TOG: cursor.c /main/12 1998/02/09 13:47:44 kaleb $ + * $Xorg: cursor.c,v 1.4 2000/08/17 19:54:05 cpqbld Exp $ * * cursor creation code * Index: xc/programs/twm/events.c diff -u xc/programs/twm/events.c:1.7.2.1 xc/programs/twm/events.c:1.9 --- xc/programs/twm/events.c:1.7.2.1 Wed Feb 28 15:06:22 2001 +++ xc/programs/twm/events.c Mon Jan 22 16:32:37 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/events.c,v 1.7.2.1 2001/02/28 20:06:22 dawes Exp $ */ +/* $XFree86: xc/programs/twm/events.c,v 1.9 2001/01/22 21:32:37 dawes Exp $ */ /*****************************************************************************/ /* @@ -49,7 +49,7 @@ /*********************************************************************** * - * $TOG: events.c /main/145 1998/02/09 13:47:49 kaleb $ + * $Xorg: events.c,v 1.3 2000/08/17 19:54:05 cpqbld Exp $ * * twm event handling * Index: xc/programs/twm/events.h diff -u xc/programs/twm/events.h:1.3 xc/programs/twm/events.h:1.4 --- xc/programs/twm/events.h:1.3 Sat Feb 20 10:07:22 1999 +++ xc/programs/twm/events.h Wed Jan 17 18:45:06 2001 @@ -44,12 +44,12 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/events.h,v 1.3 1999/02/20 15:07:22 hohndel Exp $ */ +/* $XFree86: xc/programs/twm/events.h,v 1.4 2001/01/17 23:45:06 dawes Exp $ */ /*********************************************************************** * - * $TOG: events.h /main/14 1998/02/09 13:47:57 kaleb $ + * $Xorg: events.h,v 1.3 2000/08/17 19:54:06 cpqbld Exp $ * * twm event handler include file * Index: xc/programs/twm/gc.c diff -u xc/programs/twm/gc.c:1.4 xc/programs/twm/gc.c:1.5 --- xc/programs/twm/gc.c:1.4 Tue Oct 24 18:45:15 2000 +++ xc/programs/twm/gc.c Wed Jan 17 18:45:06 2001 @@ -44,12 +44,12 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/gc.c,v 1.4 2000/10/24 22:45:15 dawes Exp $ */ +/* $XFree86: xc/programs/twm/gc.c,v 1.5 2001/01/17 23:45:06 dawes Exp $ */ /********************************************************************** * - * $TOG: gc.c /main/14 1998/02/09 13:48:01 kaleb $ + * $Xorg: gc.c,v 1.3 2000/08/17 19:54:06 cpqbld Exp $ * * Open the fonts and create the GCs * Index: xc/programs/twm/gc.h diff -u xc/programs/twm/gc.h:1.3 xc/programs/twm/gc.h:1.4 --- xc/programs/twm/gc.h:1.3 Sat Feb 20 10:07:22 1999 +++ xc/programs/twm/gc.h Wed Jan 17 18:45:06 2001 @@ -44,12 +44,12 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/gc.h,v 1.3 1999/02/20 15:07:22 hohndel Exp $ */ +/* $XFree86: xc/programs/twm/gc.h,v 1.4 2001/01/17 23:45:06 dawes Exp $ */ /********************************************************************** * - * $TOG: gc.h /main/6 1998/02/09 13:48:05 kaleb $ + * $Xorg: gc.h,v 1.3 2000/08/17 19:54:06 cpqbld Exp $ * * GC related externs * Index: xc/programs/twm/gram.y diff -u xc/programs/twm/gram.y:3.4 xc/programs/twm/gram.y:3.5 --- xc/programs/twm/gram.y:3.4 Fri Feb 19 16:27:26 1999 +++ xc/programs/twm/gram.y Wed Jan 17 18:45:06 2001 @@ -48,7 +48,7 @@ /*********************************************************************** * - * $TOG: gram.y /main/67 1998/02/09 13:48:09 kaleb $ + * $Xorg: gram.y,v 1.3 2000/08/17 19:54:06 cpqbld Exp $ * * .twmrc command grammer * @@ -56,7 +56,7 @@ * 11-Nov-90 Dave Sternlicht Adding SaveColors * 10-Oct-90 David M. Sternlicht Storing saved colors on root * - * $XFree86: xc/programs/twm/gram.y,v 3.4 1999/02/19 21:27:26 hohndel Exp $ + * $XFree86: xc/programs/twm/gram.y,v 3.5 2001/01/17 23:45:06 dawes Exp $ * ***********************************************************************/ Index: xc/programs/twm/iconmgr.c diff -u xc/programs/twm/iconmgr.c:1.4 xc/programs/twm/iconmgr.c:1.5 --- xc/programs/twm/iconmgr.c:1.4 Wed Nov 1 21:51:24 2000 +++ xc/programs/twm/iconmgr.c Wed Jan 17 18:45:06 2001 @@ -18,18 +18,18 @@ 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/twm/iconmgr.c,v 1.4 2000/11/02 02:51:24 dawes Exp $ */ +/* $XFree86: xc/programs/twm/iconmgr.c,v 1.5 2001/01/17 23:45:06 dawes Exp $ */ /*********************************************************************** * - * $TOG: iconmgr.c /main/32 1998/02/09 13:48:14 kaleb $ + * $Xorg: iconmgr.c,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ * * Icon Manager routines * * 09-Mar-89 Tom LaStrange File Created * ***********************************************************************/ -/* $XFree86: xc/programs/twm/iconmgr.c,v 1.4 2000/11/02 02:51:24 dawes Exp $ */ +/* $XFree86: xc/programs/twm/iconmgr.c,v 1.5 2001/01/17 23:45:06 dawes Exp $ */ #include <stdio.h> #include "twm.h" Index: xc/programs/twm/iconmgr.h diff -u xc/programs/twm/iconmgr.h:1.3 xc/programs/twm/iconmgr.h:1.4 --- xc/programs/twm/iconmgr.h:1.3 Sat Feb 20 10:07:23 1999 +++ xc/programs/twm/iconmgr.h Wed Jan 17 18:45:06 2001 @@ -18,11 +18,11 @@ 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/twm/iconmgr.h,v 1.3 1999/02/20 15:07:23 hohndel Exp $ */ +/* $XFree86: xc/programs/twm/iconmgr.h,v 1.4 2001/01/17 23:45:06 dawes Exp $ */ /*********************************************************************** * - * $TOG: iconmgr.h /main/6 1998/02/09 13:48:19 kaleb $ + * $Xorg: iconmgr.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ * * Icon Manager includes * Index: xc/programs/twm/icons.c diff -u xc/programs/twm/icons.c:1.4 xc/programs/twm/icons.c:1.5 --- xc/programs/twm/icons.c:1.4 Tue Oct 24 18:45:15 2000 +++ xc/programs/twm/icons.c Wed Jan 17 18:45:06 2001 @@ -18,11 +18,11 @@ 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/twm/icons.c,v 1.4 2000/10/24 22:45:15 dawes Exp $ */ +/* $XFree86: xc/programs/twm/icons.c,v 1.5 2001/01/17 23:45:06 dawes Exp $ */ /********************************************************************** * - * $TOG: icons.c /main/22 1998/02/09 13:48:24 kaleb $ + * $Xorg: icons.c,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ * * Icon releated routines * Index: xc/programs/twm/icons.h diff -u xc/programs/twm/icons.h:1.3 xc/programs/twm/icons.h:1.4 --- xc/programs/twm/icons.h:1.3 Sat Feb 20 10:07:24 1999 +++ xc/programs/twm/icons.h Wed Jan 17 18:45:06 2001 @@ -18,11 +18,11 @@ 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/twm/icons.h,v 1.3 1999/02/20 15:07:24 hohndel Exp $ */ +/* $XFree86: xc/programs/twm/icons.h,v 1.4 2001/01/17 23:45:06 dawes Exp $ */ /********************************************************************** * - * $TOG: icons.h /main/6 1998/02/09 13:48:29 kaleb $ + * $Xorg: icons.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ * * Icon releated definitions * Index: xc/programs/twm/lex.l diff -u xc/programs/twm/lex.l:3.11 xc/programs/twm/lex.l:3.12 --- xc/programs/twm/lex.l:3.11 Thu Feb 25 01:01:02 1999 +++ xc/programs/twm/lex.l Wed Jan 17 18:45:06 2001 @@ -48,14 +48,14 @@ /*********************************************************************** * - * $TOG: lex.l /main/48 1998/02/09 13:48:34 kaleb $ + * $Xorg: lex.l,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ * * .twmrc lex file * * 12-Nov-87 Thomas E. LaStrange File created * ***********************************************************************/ -/* $XFree86: xc/programs/twm/lex.l,v 3.11 1999/02/25 06:01:02 dawes Exp $ */ +/* $XFree86: xc/programs/twm/lex.l,v 3.12 2001/01/17 23:45:06 dawes Exp $ */ /* #include <stdio.h> */ /* lex already includes stdio.h */ #include "twm.h" Index: xc/programs/twm/list.c diff -u xc/programs/twm/list.c:1.3 xc/programs/twm/list.c:1.4 --- xc/programs/twm/list.c:1.3 Sat Feb 20 10:07:24 1999 +++ xc/programs/twm/list.c Wed Jan 17 18:45:07 2001 @@ -44,12 +44,12 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/list.c,v 1.3 1999/02/20 15:07:24 hohndel Exp $ */ +/* $XFree86: xc/programs/twm/list.c,v 1.4 2001/01/17 23:45:07 dawes Exp $ */ /********************************************************************** * - * $TOG: list.c /main/12 1998/02/09 13:48:38 kaleb $ + * $Xorg: list.c,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ * * TWM code to deal with the name lists for the NoTitle list and * the AutoRaise list Index: xc/programs/twm/list.h diff -u xc/programs/twm/list.h:1.3 xc/programs/twm/list.h:1.4 --- xc/programs/twm/list.h:1.3 Sat Feb 20 10:07:24 1999 +++ xc/programs/twm/list.h Wed Jan 17 18:45:07 2001 @@ -44,12 +44,12 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/list.h,v 1.3 1999/02/20 15:07:24 hohndel Exp $ */ +/* $XFree86: xc/programs/twm/list.h,v 1.4 2001/01/17 23:45:07 dawes Exp $ */ /********************************************************************** * - * $TOG: list.h /main/7 1998/02/09 13:48:42 kaleb $ + * $Xorg: list.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ * * TWM list handling external definitions * Index: xc/programs/twm/menus.c diff -u xc/programs/twm/menus.c:1.8 xc/programs/twm/menus.c:1.9 --- xc/programs/twm/menus.c:1.8 Tue Oct 24 18:45:15 2000 +++ xc/programs/twm/menus.c Wed Jan 17 18:45:07 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/menus.c,v 1.8 2000/10/24 22:45:15 dawes Exp $ */ +/* $XFree86: xc/programs/twm/menus.c,v 1.9 2001/01/17 23:45:07 dawes Exp $ */ /*****************************************************************************/ /* @@ -49,7 +49,7 @@ /*********************************************************************** * - * $TOG: menus.c /main/153 1998/02/09 13:48:47 kaleb $ + * $Xorg: menus.c,v 1.5 2000/08/17 19:54:07 cpqbld Exp $ * * twm menu code * Index: xc/programs/twm/menus.h diff -u xc/programs/twm/menus.h:1.3 xc/programs/twm/menus.h:1.4 --- xc/programs/twm/menus.h:1.3 Sat Feb 20 10:07:24 1999 +++ xc/programs/twm/menus.h Wed Jan 17 18:45:07 2001 @@ -44,12 +44,12 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/menus.h,v 1.3 1999/02/20 15:07:24 hohndel Exp $ */ +/* $XFree86: xc/programs/twm/menus.h,v 1.4 2001/01/17 23:45:07 dawes Exp $ */ /*********************************************************************** * - * $TOG: menus.h /main/16 1998/02/09 13:48:55 kaleb $ + * $Xorg: menus.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ * * twm menus include file * Index: xc/programs/twm/parse.c diff -u xc/programs/twm/parse.c:1.7 xc/programs/twm/parse.c:1.9 --- xc/programs/twm/parse.c:1.7 Sun Oct 29 09:24:13 2000 +++ xc/programs/twm/parse.c Mon Apr 23 16:31:08 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/parse.c,v 1.7 2000/10/29 14:24:13 tsi Exp $ */ +/* $XFree86: xc/programs/twm/parse.c,v 1.9 2001/04/23 20:31:08 dawes Exp $ */ /*****************************************************************************/ /* @@ -49,7 +49,7 @@ /*********************************************************************** * - * $TOG: parse.c /main/55 1998/02/09 13:48:59 kaleb $ + * $Xorg: parse.c,v 1.4 2000/08/17 19:54:07 cpqbld Exp $ * * parse the .twmrc file * @@ -262,8 +262,6 @@ { if (fgets(buff, BUF_LEN, twmrc) == NULL) return 0; - - yylineno++; ptr = 0; len = strlen(buff); Index: xc/programs/twm/parse.h diff -u xc/programs/twm/parse.h:1.7 xc/programs/twm/parse.h:1.8 --- xc/programs/twm/parse.h:1.7 Sun Oct 29 09:24:14 2000 +++ xc/programs/twm/parse.h Wed Jan 17 18:45:07 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/twm/parse.h,v 1.7 2000/10/29 14:24:14 tsi Exp $ */ +/* $XFree86: xc/programs/twm/parse.h,v 1.8 2001/01/17 23:45:07 dawes Exp $ */ /*****************************************************************************/ /* @@ -49,7 +49,7 @@ /********************************************************************** * - * $TOG: parse.h /main/16 1998/02/09 13:49:05 kaleb $ + * $Xorg: parse.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ * * .twmrc parsing externs * Index: xc/programs/twm/resize.c diff -u xc/programs/twm/resize.c:1.6 xc/programs/twm/resize.c:1.7 --- xc/programs/twm/resize.c:1.6 Tue Oct 24 18:45:15 2000 +++ xc/programs/twm/resize.c Wed Jan 17 18:45:07 2001 @@ -48,7 +48,7 @@ /*********************************************************************** * - * $TOG: resize.c /main/70 1998/02/09 13:49:10 kaleb $ + * $Xorg: resize.c,v 1.4 2000/08/17 19:54:07 cpqbld Exp $ * * window resizing borrowed from the "wm" window manager * @@ -56,7 +56,7 @@ * ***********************************************************************/ -/* $XFree86: xc/programs/twm/resize.c,v 1.6 2000/10/24 22:45:15 dawes Exp $ */ +/* $XFree86: xc/programs/twm/resize.c,v 1.7 2001/01/17 23:45:07 dawes Exp $ */ #include <stdio.h> #include "twm.h" Index: xc/programs/twm/resize.h diff -u xc/programs/twm/resize.h:1.3 xc/programs/twm/resize.h:1.4 --- xc/programs/twm/resize.h:1.3 Sat Feb 20 10:07:25 1999 +++ xc/programs/twm/resize.h Wed Jan 17 18:45:08 2001 @@ -44,12 +44,12 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/resize.h,v 1.3 1999/02/20 15:07:25 hohndel Exp $ */ +/* $XFree86: xc/programs/twm/resize.h,v 1.4 2001/01/17 23:45:08 dawes Exp $ */ /********************************************************************** * - * $TOG: resize.h /main/8 1998/02/09 13:49:16 kaleb $ + * $Xorg: resize.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ * * resize function externs * Index: xc/programs/twm/screen.h diff -u xc/programs/twm/screen.h:1.3 xc/programs/twm/screen.h:1.4 --- xc/programs/twm/screen.h:1.3 Tue Mar 2 06:49:28 1999 +++ xc/programs/twm/screen.h Wed Jan 17 18:45:08 2001 @@ -21,14 +21,14 @@ /*********************************************************************** * - * $TOG: screen.h /main/44 1998/02/09 13:49:21 kaleb $ + * $Xorg: screen.h,v 1.3 2000/08/17 19:54:07 cpqbld Exp $ * * twm per-screen data include file * * 11-3-88 Dave Payne, Apple Computer File created * ***********************************************************************/ -/* $XFree86: xc/programs/twm/screen.h,v 1.3 1999/03/02 11:49:28 dawes Exp $ */ +/* $XFree86: xc/programs/twm/screen.h,v 1.4 2001/01/17 23:45:08 dawes Exp $ */ #ifndef _SCREEN_ #define _SCREEN_ Index: xc/programs/twm/session.c diff -u xc/programs/twm/session.c:3.5 xc/programs/twm/session.c:3.6 --- xc/programs/twm/session.c:3.5 Thu Feb 25 01:01:03 1999 +++ xc/programs/twm/session.c Wed Jan 17 18:45:08 2001 @@ -1,4 +1,4 @@ -/* $TOG: session.c /main/20 1998/02/09 13:49:25 kaleb $ */ +/* $Xorg: session.c,v 1.4 2000/08/17 19:54:07 cpqbld Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group @@ -21,7 +21,7 @@ Author: Ralph Mor, X Consortium ******************************************************************************/ -/* $XFree86: xc/programs/twm/session.c,v 3.5 1999/02/25 06:01:03 dawes Exp $ */ +/* $XFree86: xc/programs/twm/session.c,v 3.6 2001/01/17 23:45:08 dawes Exp $ */ #include <X11/Xos.h> Index: xc/programs/twm/system.twmrc diff -u xc/programs/twm/system.twmrc:1.3 xc/programs/twm/system.twmrc:1.4 --- xc/programs/twm/system.twmrc:1.3 Fri Jan 21 13:41:50 2000 +++ xc/programs/twm/system.twmrc Wed Jan 17 18:45:08 2001 @@ -1,5 +1,5 @@ # -# $XConsortium: system.twmrc /main/9 1996/10/16 16:14:38 kaleb $ +# $Xorg: system.twmrc,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ # # Default twm configuration file; needs to be kept small to conserve string # space in systems whose compilers don't handle medium-sized strings. @@ -9,7 +9,7 @@ # users were accustomed to uwm, the defaults could be set up not to decorate # any windows and to use meta-keys. # -# $XFree86: xc/programs/twm/system.twmrc,v 1.3 2000/01/21 18:41:50 dawes Exp $ +# $XFree86: xc/programs/twm/system.twmrc,v 1.4 2001/01/17 23:45:08 dawes Exp $ # NoGrabServer Index: xc/programs/twm/twm.c diff -u xc/programs/twm/twm.c:3.6 xc/programs/twm/twm.c:3.7 --- xc/programs/twm/twm.c:3.6 Tue Oct 24 18:45:15 2000 +++ xc/programs/twm/twm.c Wed Jan 17 18:45:08 2001 @@ -48,14 +48,14 @@ /*********************************************************************** * - * $TOG: twm.c /main/101 1998/02/09 13:49:38 kaleb $ + * $Xorg: twm.c,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ * * twm - "Tom's Window Manager" * * 27-Oct-87 Thomas E. LaStrange File created * 10-Oct-90 David M. Sternlicht Storing saved colors on root ***********************************************************************/ -/* $XFree86: xc/programs/twm/twm.c,v 3.6 2000/10/24 22:45:15 dawes Exp $ */ +/* $XFree86: xc/programs/twm/twm.c,v 3.7 2001/01/17 23:45:08 dawes Exp $ */ #include <stdio.h> #include <signal.h> Index: xc/programs/twm/twm.h diff -u xc/programs/twm/twm.h:3.5 xc/programs/twm/twm.h:3.6 --- xc/programs/twm/twm.h:3.5 Tue Oct 24 18:45:15 2000 +++ xc/programs/twm/twm.h Wed Jan 17 18:45:08 2001 @@ -49,14 +49,14 @@ /*********************************************************************** * - * $TOG: twm.h /main/65 1998/02/09 13:49:43 kaleb $ + * $Xorg: twm.h,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ * * twm include file * * 28-Oct-87 Thomas E. LaStrange File created * 10-Oct-90 David M. Sternlicht Storeing saved colors on root ***********************************************************************/ -/* $XFree86: xc/programs/twm/twm.h,v 3.5 2000/10/24 22:45:15 dawes Exp $ */ +/* $XFree86: xc/programs/twm/twm.h,v 3.6 2001/01/17 23:45:08 dawes Exp $ */ #ifndef _TWM_ #define _TWM_ Index: xc/programs/twm/twm.man diff -u xc/programs/twm/twm.man:1.4 xc/programs/twm/twm.man:1.7 --- xc/programs/twm/twm.man:1.4 Sun Oct 4 05:40:41 1998 +++ xc/programs/twm/twm.man Sat Jan 27 13:21:06 2001 @@ -1,4 +1,4 @@ -.\" $TOG: twm.man /main/67 1998/02/09 13:49:48 kaleb $ +.\" $Xorg: twm.man,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" Portions copyright 1988 Evans & Sutherland Computer Corporation. .\" Portions copyright 1989 Hewlett-Packard Company @@ -20,6 +20,9 @@ .\" 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/twm/twm.man,v 1.7 2001/01/27 18:21:06 dawes Exp $ +.\" .de EX \"Begin example .ne 5 .if n .sp 1 @@ -34,7 +37,7 @@ .if t .sp .5 .. .ta .3i .6i .9i 1.2i 1.5i 1.8i -.TH TWM 1 "Release 6.4" "X Version 11" +.TH TWM 1 __xorgversion__ .SH NAME twm \- Tab Window Manager for the X Window System .SH SYNTAX @@ -1261,7 +1264,7 @@ for locating the \fItwm\fP startup file. .SH "SEE ALSO" .PP -X(1), Xserver(1), xdm(1), xrdb(1) +X(__miscmansuffix__), Xserver(1), xdm(1), xrdb(1) .SH AUTHORS Tom LaStrange, Solbourne Computer; Jim Fulton, MIT X Consortium; Steve Pitschke, Stardent Computer; Keith Packard, MIT X Consortium; Index: xc/programs/twm/util.c diff -u xc/programs/twm/util.c:1.6 xc/programs/twm/util.c:1.8 --- xc/programs/twm/util.c:1.6 Sat Nov 18 14:37:26 2000 +++ xc/programs/twm/util.c Thu Apr 26 17:09:47 2001 @@ -44,12 +44,12 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/util.c,v 1.6 2000/11/18 19:37:26 tsi Exp $ */ +/* $XFree86: xc/programs/twm/util.c,v 1.8 2001/04/26 21:09:47 dawes Exp $ */ /*********************************************************************** * - * $TOG: util.c /main/38 1998/02/09 13:49:55 kaleb $ + * $Xorg: util.c,v 1.4 2000/08/17 19:54:08 cpqbld Exp $ * * utility routines for twm * @@ -786,24 +786,17 @@ { int status; XTextProperty text_prop; + char **list; + int num; status = XGetWMName(dpy, w, &text_prop); if (!status || !text_prop.value || !text_prop.nitems) return 0; - if (text_prop.encoding == XA_STRING) { - if (!text_prop.value) {*winname = NULL; return 0;} - *winname = (char *)strdup((char *)text_prop.value); - XFree(text_prop.value); - return 1; - } else { - char **list; - int num; - status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); - if (!num || !*list) return 0; - XFree(text_prop.value); - *winname = (char *)strdup(*list); - XFreeStringList(list); - return 1; - } + status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); + if (status < Success || !num || !*list) return 0; + XFree(text_prop.value); + *winname = (char *)strdup(*list); + XFreeStringList(list); + return 1; } Status @@ -814,24 +807,17 @@ { int status; XTextProperty text_prop; + char **list; + int num; status = XGetWMIconName(dpy, w, &text_prop); if (!status || !text_prop.value || !text_prop.nitems) return 0; - if (text_prop.encoding == XA_STRING) { - if (!text_prop.value) {*iconname = NULL; return 0;} - *iconname = (char *)strdup((char *)text_prop.value); - XFree(text_prop.value); - return 1; - } else { - char **list; - int num; - status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); - if (!num || !*list) return 0; - XFree(text_prop.value); - *iconname = (char *)strdup(*list); - XFreeStringList(list); - return 1; - } + status = XmbTextPropertyToTextList(dpy, &text_prop, &list, &num); + if (status < Success || !num || !*list) return 0; + XFree(text_prop.value); + *iconname = (char *)strdup(*list); + XFreeStringList(list); + return 1; } /* Index: xc/programs/twm/util.h diff -u xc/programs/twm/util.h:1.5 xc/programs/twm/util.h:1.6 --- xc/programs/twm/util.h:1.5 Tue Oct 24 18:45:15 2000 +++ xc/programs/twm/util.h Wed Jan 17 18:45:08 2001 @@ -44,12 +44,12 @@ /** TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE **/ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $XFree86: xc/programs/twm/util.h,v 1.5 2000/10/24 22:45:15 dawes Exp $ */ +/* $XFree86: xc/programs/twm/util.h,v 1.6 2001/01/17 23:45:08 dawes Exp $ */ /*********************************************************************** * - * $TOG: util.h /main/10 1998/02/09 13:50:00 kaleb $ + * $Xorg: util.h,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ * * utility routines header file * Index: xc/programs/twm/version.c diff -u xc/programs/twm/version.c:1.1.1.4 xc/programs/twm/version.c:1.1.1.5 --- xc/programs/twm/version.c:1.1.1.4 Sun Sep 27 04:49:57 1998 +++ xc/programs/twm/version.c Tue Jan 16 17:47:24 2001 @@ -45,6 +45,6 @@ /** OR PERFORMANCE OF THIS SOFTWARE. **/ /*****************************************************************************/ -/* $TOG: version.c /main/14 1998/02/09 13:50:04 kaleb $ */ +/* $Xorg: version.c,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ */ char *Version = "The Open Group, R6.3"; Index: xc/programs/twm/version.h diff -u xc/programs/twm/version.h:1.1.1.2 xc/programs/twm/version.h:1.1.1.3 --- xc/programs/twm/version.h:1.1.1.2 Sun Sep 27 04:49:59 1998 +++ xc/programs/twm/version.h Tue Jan 16 17:47:24 2001 @@ -47,7 +47,7 @@ /********************************************************************** * - * $TOG: version.h /main/8 1998/02/09 13:50:08 kaleb $ + * $Xorg: version.h,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ * * TWM version externs * Index: xc/programs/viewres/viewres.man diff -u xc/programs/viewres/viewres.man:1.1 xc/programs/viewres/viewres.man:1.3 --- xc/programs/viewres/viewres.man:1.1 Sat Feb 12 22:26:16 2000 +++ xc/programs/viewres/viewres.man Sat Jan 27 13:21:07 2001 @@ -24,7 +24,10 @@ .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from the X Consortium. -.TH VIEWRES 1 "Release 6" "X Version 11" +.\" +.\" $XFree86: xc/programs/viewres/viewres.man,v 1.3 2001/01/27 18:21:07 dawes Exp $ +.\" +.TH VIEWRES 1 __xorgversion__ .SH NAME viewres - graphical class browser for Xt .SH SYNOPSIS @@ -204,10 +207,10 @@ .sp where \fIvariable-name\fP is the widget variable name of each node. .SH "SEE ALSO" -X(1), xrdb(1), listres(1), editres(1), appres(1), appropriate widget documents +X(__miscmansuffix__), xrdb(1), listres(1), editres(1), appres(1), appropriate widget documents .SH COPYRIGHT Copyright ([\d,\s]*) X Consortium .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHOR Jim Fulton, MIT X Consortium Index: xc/programs/x11perf/Imakefile diff -u xc/programs/x11perf/Imakefile:3.3 xc/programs/x11perf/Imakefile:3.6 --- xc/programs/x11perf/Imakefile:3.3 Thu Nov 30 12:07:20 2000 +++ xc/programs/x11perf/Imakefile Tue May 1 13:23:27 2001 @@ -1,5 +1,10 @@ -XCOMM $XConsortium: Imakefile,v 2.31 93/09/04 19:58:26 rws Exp $ -XCOMM $XFree86: xc/programs/x11perf/Imakefile,v 3.3 2000/11/30 17:07:20 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/x11perf/Imakefile,v 3.6 2001/05/01 17:23:27 alanh Exp $ + #ifndef X11perfcompLib #define X11perfcompLib $(LIBDIR)/x11perfcomp #endif @@ -27,9 +32,13 @@ do_dots.o do_windows.o do_movewin.o do_text.o \ do_blt.o do_arcs.o \ do_tris.o do_complex.o do_traps.o -LOCAL_LIBRARIES = $(XFTLIBS) $(XMULIB) $(XLIB) - DEPLIBS = $(XFTDEPS) $(DEPXMULIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XFTLIBS) $(XMUULIB) $(XLIB) + DEPLIBS = $(XFTDEPS) $(DEPXMUULIB) $(DEPXLIB) SYS_LIBRARIES = MathLibrary + +#if UseCygIPC +EXTRA_LIBRARIES = -lcygipc +#endif #ifndef OS2Architecture ComplexProgramTarget(x11perf) Index: xc/programs/x11perf/Xmark.man diff -u xc/programs/x11perf/Xmark.man:1.1 xc/programs/x11perf/Xmark.man:1.3 --- xc/programs/x11perf/Xmark.man:1.1 Sat Aug 26 00:30:59 2000 +++ xc/programs/x11perf/Xmark.man Sat Jan 27 13:21:07 2001 @@ -1,7 +1,7 @@ .\" This manpage was written by Richard Braakman and is licensed under the .\" XFree86 license. -.\" $XFree86: xc/programs/x11perf/Xmark.man,v 1.1 2000/08/26 04:30:59 dawes Exp $ -.TH Xmark 1 "Release 6.4" "X Version 11" +.\" $XFree86: xc/programs/x11perf/Xmark.man,v 1.3 2001/01/27 18:21:07 dawes Exp $ +.TH Xmark 1 __xorgversion__ .SH NAME Xmark \- summarize x11perf results .SH SYNTAX @@ -66,4 +66,4 @@ .BR "Diagnostic: ERROR: sum of weights =" nnn ", not equal to 4566.0;" There is an internal error in Xmark. .SH "SEE ALSO" -X(1), x11perf(1), x11perfcomp(1) +X(__miscmansuffix__), x11perf(1), x11perfcomp(1) Index: xc/programs/x11perf/Xmark.sh diff -u xc/programs/x11perf/Xmark.sh:1.2 xc/programs/x11perf/Xmark.sh:1.3 --- xc/programs/x11perf/Xmark.sh:1.2 Sat Jan 4 07:20:20 1997 +++ xc/programs/x11perf/Xmark.sh Wed Jan 17 18:45:10 2001 @@ -1,5 +1,5 @@ #! /bin/sh -#$XConsortium: Xmark.sh,v 1.6 94/12/09 22:52:57 gildea Exp $ +#$Xorg: Xmark.sh,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ #XPC Header: Xmark,v 1.15 93/04/12 10:10:07 hmgr Exp # ############################################################ @@ -8,7 +8,7 @@ # Usage: Xmark datafile # ############################################################ -# $XFree86: xc/programs/x11perf/Xmark.sh,v 1.2 1997/01/04 12:20:20 dawes Exp $ +# $XFree86: xc/programs/x11perf/Xmark.sh,v 1.3 2001/01/17 23:45:10 dawes Exp $ # # # CHANGE HISTORY: Index: xc/programs/x11perf/bitmaps.c diff -u xc/programs/x11perf/bitmaps.c:1.1.1.1 xc/programs/x11perf/bitmaps.c:1.1.1.2 --- xc/programs/x11perf/bitmaps.c:1.1.1.1 Wed Apr 27 03:20:24 1994 +++ xc/programs/x11perf/bitmaps.c Tue Jan 16 17:47:27 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: bitmaps.c,v 1.6 92/11/11 17:02:11 rws Exp $ */ +/* $Xorg: bitmaps.c,v 1.3 2000/08/17 19:54:08 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. Index: xc/programs/x11perf/bitmaps.h diff -u xc/programs/x11perf/bitmaps.h:1.3 xc/programs/x11perf/bitmaps.h:1.4 --- xc/programs/x11perf/bitmaps.h:1.3 Tue Mar 2 06:49:28 1999 +++ xc/programs/x11perf/bitmaps.h Wed Jan 17 18:45:11 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: bitmaps.h,v 1.2 94/02/06 20:17:23 rws Exp $ */ +/* $Xorg: bitmaps.h,v 1.3 2000/08/17 19:54:09 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/bitmaps.h,v 1.3 1999/03/02 11:49:28 dawes Exp $ */ +/* $XFree86: xc/programs/x11perf/bitmaps.h,v 1.4 2001/01/17 23:45:11 dawes Exp $ */ /* Set fill style (if any) to a bitmap or tile */ Index: xc/programs/x11perf/do_arcs.c diff -u xc/programs/x11perf/do_arcs.c:1.4 xc/programs/x11perf/do_arcs.c:1.5 --- xc/programs/x11perf/do_arcs.c:1.4 Wed Nov 29 03:58:19 2000 +++ xc/programs/x11perf/do_arcs.c Wed Jan 17 18:45:11 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_arcs.c,v 2.12 92/11/11 17:01:12 rws Exp $ */ +/* $Xorg: do_arcs.c,v 1.3 2000/08/17 19:54:09 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_arcs.c,v 1.4 2000/11/29 08:58:19 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_arcs.c,v 1.5 2001/01/17 23:45:11 dawes Exp $ */ #include "x11perf.h" Index: xc/programs/x11perf/do_blt.c diff -u xc/programs/x11perf/do_blt.c:1.6 xc/programs/x11perf/do_blt.c:1.8 --- xc/programs/x11perf/do_blt.c:1.6 Wed Nov 29 03:58:19 2000 +++ xc/programs/x11perf/do_blt.c Tue May 1 12:19:16 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_blt.c,v 2.17 94/03/17 20:23:46 dpw Exp $ */ +/* $Xorg: do_blt.c,v 1.3 2000/08/17 19:54:09 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_blt.c,v 1.6 2000/11/29 08:58:19 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_blt.c,v 1.8 2001/05/01 16:19:16 alanh Exp $ */ #include "x11perf.h" #include <stdio.h> @@ -341,11 +341,7 @@ #include <sys/types.h> #ifndef Lynx -#ifndef __CYGWIN__ #include <sys/ipc.h> -#else -#include <sys/cygipc.h> -#endif #include <sys/shm.h> #else #include <ipc.h> Index: xc/programs/x11perf/do_complex.c diff -u xc/programs/x11perf/do_complex.c:1.5 xc/programs/x11perf/do_complex.c:1.7 --- xc/programs/x11perf/do_complex.c:1.5 Wed Nov 29 03:58:19 2000 +++ xc/programs/x11perf/do_complex.c Wed May 9 05:12:22 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_complex.c,v 2.7 92/07/31 17:02:47 rws Exp $ */ +/* $Xorg: do_complex.c,v 1.3 2000/08/17 19:54:09 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_complex.c,v 1.5 2000/11/29 08:58:19 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_complex.c,v 1.7 2001/05/09 09:12:22 alanh Exp $ */ #include "x11perf.h" @@ -32,7 +32,7 @@ #ifndef X_NOT_STDC_ENV #include <math.h> -#ifdef QNX4 +#if defined(QNX4) || defined(__CYGWIN__) #define PI 3.14159265358979323846 #else #define PI M_PI Index: xc/programs/x11perf/do_dots.c diff -u xc/programs/x11perf/do_dots.c:1.4 xc/programs/x11perf/do_dots.c:1.5 --- xc/programs/x11perf/do_dots.c:1.4 Wed Nov 29 03:58:19 2000 +++ xc/programs/x11perf/do_dots.c Wed Jan 17 18:45:11 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_dots.c,v 2.5 94/02/06 20:17:34 rws Exp $ */ +/* $Xorg: do_dots.c,v 1.3 2000/08/17 19:54:09 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_dots.c,v 1.4 2000/11/29 08:58:19 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_dots.c,v 1.5 2001/01/17 23:45:11 dawes Exp $ */ #include "x11perf.h" Index: xc/programs/x11perf/do_lines.c diff -u xc/programs/x11perf/do_lines.c:1.4 xc/programs/x11perf/do_lines.c:1.5 --- xc/programs/x11perf/do_lines.c:1.4 Wed Nov 29 03:58:19 2000 +++ xc/programs/x11perf/do_lines.c Wed Jan 17 18:45:11 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_lines.c,v 2.11 92/11/11 16:58:34 rws Exp $ */ +/* $Xorg: do_lines.c,v 1.3 2000/08/17 19:54:09 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_lines.c,v 1.4 2000/11/29 08:58:19 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_lines.c,v 1.5 2001/01/17 23:45:11 dawes Exp $ */ #include "x11perf.h" Index: xc/programs/x11perf/do_movewin.c diff -u xc/programs/x11perf/do_movewin.c:1.4 xc/programs/x11perf/do_movewin.c:1.5 --- xc/programs/x11perf/do_movewin.c:1.4 Wed Nov 29 03:58:19 2000 +++ xc/programs/x11perf/do_movewin.c Wed Jan 17 18:45:11 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_movewin.c,v 2.5 94/02/06 20:17:39 rws Exp $ */ +/* $Xorg: do_movewin.c,v 1.4 2000/08/17 19:54:09 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_movewin.c,v 1.4 2000/11/29 08:58:19 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_movewin.c,v 1.5 2001/01/17 23:45:11 dawes Exp $ */ #include "x11perf.h" Index: xc/programs/x11perf/do_rects.c diff -u xc/programs/x11perf/do_rects.c:1.4 xc/programs/x11perf/do_rects.c:1.5 --- xc/programs/x11perf/do_rects.c:1.4 Wed Nov 29 03:58:19 2000 +++ xc/programs/x11perf/do_rects.c Wed Jan 17 18:45:11 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_rects.c,v 2.10 94/02/06 20:17:29 rws Exp $ */ +/* $Xorg: do_rects.c,v 1.4 2000/08/17 19:54:09 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_rects.c,v 1.4 2000/11/29 08:58:19 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_rects.c,v 1.5 2001/01/17 23:45:11 dawes Exp $ */ #include "x11perf.h" #include "bitmaps.h" Index: xc/programs/x11perf/do_segs.c diff -u xc/programs/x11perf/do_segs.c:1.4 xc/programs/x11perf/do_segs.c:1.5 --- xc/programs/x11perf/do_segs.c:1.4 Wed Nov 29 03:58:20 2000 +++ xc/programs/x11perf/do_segs.c Wed Jan 17 18:45:11 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_segs.c,v 2.15 92/11/11 17:01:50 rws Exp $ */ +/* $Xorg: do_segs.c,v 1.3 2000/08/17 19:54:09 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_segs.c,v 1.4 2000/11/29 08:58:20 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_segs.c,v 1.5 2001/01/17 23:45:11 dawes Exp $ */ #include "x11perf.h" Index: xc/programs/x11perf/do_simple.c diff -u xc/programs/x11perf/do_simple.c:1.4 xc/programs/x11perf/do_simple.c:1.5 --- xc/programs/x11perf/do_simple.c:1.4 Wed Nov 29 03:58:20 2000 +++ xc/programs/x11perf/do_simple.c Wed Jan 17 18:45:12 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_simple.c /main/14 1996/08/01 19:32:37 dpw $ */ +/* $Xorg: do_simple.c,v 1.4 2000/08/17 19:54:09 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_simple.c,v 1.4 2000/11/29 08:58:20 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_simple.c,v 1.5 2001/01/17 23:45:12 dawes Exp $ */ #ifndef VMS #include <X11/Xatom.h> Index: xc/programs/x11perf/do_tests.c diff -u xc/programs/x11perf/do_tests.c:1.6 xc/programs/x11perf/do_tests.c:1.7 --- xc/programs/x11perf/do_tests.c:1.6 Fri Dec 8 04:51:03 2000 +++ xc/programs/x11perf/do_tests.c Wed Jan 17 18:45:12 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_tests.c,v 2.33 94/03/17 20:25:31 dpw Exp $ */ +/* $Xorg: do_tests.c,v 1.3 2000/08/17 19:54:10 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_tests.c,v 1.6 2000/12/08 09:51:03 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_tests.c,v 1.7 2001/01/17 23:45:12 dawes Exp $ */ #include "x11perf.h" Index: xc/programs/x11perf/do_text.c diff -u xc/programs/x11perf/do_text.c:1.6 xc/programs/x11perf/do_text.c:1.7 --- xc/programs/x11perf/do_text.c:1.6 Fri Dec 8 23:48:45 2000 +++ xc/programs/x11perf/do_text.c Wed Jan 17 18:45:12 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_text.c,v 2.7 92/11/11 16:59:23 rws Exp $ */ +/* $Xorg: do_text.c,v 1.4 2000/08/17 19:54:10 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_text.c,v 1.6 2000/12/09 04:48:45 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_text.c,v 1.7 2001/01/17 23:45:12 dawes Exp $ */ #include "x11perf.h" #include <stdio.h> Index: xc/programs/x11perf/do_traps.c diff -u xc/programs/x11perf/do_traps.c:1.4 xc/programs/x11perf/do_traps.c:1.5 --- xc/programs/x11perf/do_traps.c:1.4 Wed Nov 29 03:58:20 2000 +++ xc/programs/x11perf/do_traps.c Wed Jan 17 18:45:12 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_traps.c,v 2.6 94/02/06 20:17:41 rws Exp $ */ +/* $Xorg: do_traps.c,v 1.3 2000/08/17 19:54:10 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_traps.c,v 1.4 2000/11/29 08:58:20 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_traps.c,v 1.5 2001/01/17 23:45:12 dawes Exp $ */ #include "x11perf.h" #include "bitmaps.h" Index: xc/programs/x11perf/do_tris.c diff -u xc/programs/x11perf/do_tris.c:1.4 xc/programs/x11perf/do_tris.c:1.5 --- xc/programs/x11perf/do_tris.c:1.4 Wed Nov 29 03:58:20 2000 +++ xc/programs/x11perf/do_tris.c Wed Jan 17 18:45:12 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_tris.c,v 2.8 94/02/06 20:17:44 rws Exp $ */ +/* $Xorg: do_tris.c,v 1.3 2000/08/17 19:54:10 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_tris.c,v 1.4 2000/11/29 08:58:20 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_tris.c,v 1.5 2001/01/17 23:45:12 dawes Exp $ */ #undef POLYTRIANGLE_HACK /* don't use this code */ Index: xc/programs/x11perf/do_valgc.c diff -u xc/programs/x11perf/do_valgc.c:1.4 xc/programs/x11perf/do_valgc.c:1.5 --- xc/programs/x11perf/do_valgc.c:1.4 Wed Nov 29 03:58:20 2000 +++ xc/programs/x11perf/do_valgc.c Wed Jan 17 18:45:12 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_valgc.c,v 2.5 94/02/06 20:17:32 rws Exp $ */ +/* $Xorg: do_valgc.c,v 1.3 2000/08/17 19:54:10 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_valgc.c,v 1.4 2000/11/29 08:58:20 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_valgc.c,v 1.5 2001/01/17 23:45:12 dawes Exp $ */ #ifndef VMS #include <X11/Xatom.h> Index: xc/programs/x11perf/do_windows.c diff -u xc/programs/x11perf/do_windows.c:1.4 xc/programs/x11perf/do_windows.c:1.5 --- xc/programs/x11perf/do_windows.c:1.4 Wed Nov 29 03:58:20 2000 +++ xc/programs/x11perf/do_windows.c Wed Jan 17 18:45:12 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: do_windows.c,v 2.7 94/02/06 20:17:37 rws Exp $ */ +/* $Xorg: do_windows.c,v 1.4 2000/08/17 19:54:10 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -21,7 +21,7 @@ SOFTWARE. ******************************************************************************/ -/* $XFree86: xc/programs/x11perf/do_windows.c,v 1.4 2000/11/29 08:58:20 keithp Exp $ */ +/* $XFree86: xc/programs/x11perf/do_windows.c,v 1.5 2001/01/17 23:45:12 dawes Exp $ */ #include "x11perf.h" Index: xc/programs/x11perf/x11pcomp.cpp diff -u xc/programs/x11perf/x11pcomp.cpp:1.2 xc/programs/x11perf/x11pcomp.cpp:1.4 --- xc/programs/x11perf/x11pcomp.cpp:1.2 Sat May 3 05:20:00 1997 +++ xc/programs/x11perf/x11pcomp.cpp Fri May 18 19:35:33 2001 @@ -1,4 +1,7 @@ XCOMM! /bin/sh +XCOMM +XCOMM $XFree86: xc/programs/x11perf/x11pcomp.cpp,v 1.4 2001/05/18 23:35:33 dawes Exp $ +XCOMM XCOMM Collects multiple outputs of x11perf. Just feed it a list of files, each XCOMM containing the output from an x11perf run, and this shell will extract the XCOMM object/second information and show it in tabular form. An 80-column line @@ -16,13 +19,13 @@ XCOMM Mark Moraes, University of Toronto <moraes@csri.toronto.edu> XCOMM Joel McCormack, DEC Western Research Lab <joel@decwrl.dec.com> XCOMM -XCOMM $TOG: x11pcomp.cpp /main/7 1997/04/14 09:15:45 barstow $ +XCOMM $Xorg: x11pcomp.cpp,v 1.3 2000/08/17 19:54:10 cpqbld Exp $ PATH=LIBPATH:.:$PATH export PATH set -e -tmp=/tmp/rates.$$ +tmp=`pwd`/_rates.$$ trap "rm -rf $tmp" 0 1 2 15 mkdir $tmp $tmp/rates ratio= Index: xc/programs/x11perf/x11pcomp.man diff -u xc/programs/x11perf/x11pcomp.man:1.4 xc/programs/x11perf/x11pcomp.man:1.7 --- xc/programs/x11perf/x11pcomp.man:1.4 Sun Oct 4 05:40:43 1998 +++ xc/programs/x11perf/x11pcomp.man Sat Jan 27 13:21:07 2001 @@ -1,4 +1,4 @@ -.\" $TOG: x11pcomp.man /main/10 1998/02/09 13:51:48 kaleb $ +.\" $Xorg: x11pcomp.man,v 1.3 2000/08/17 19:54:10 cpqbld Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH X11PERFCOMP 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/x11perf/x11pcomp.man,v 1.7 2001/01/27 18:21:07 dawes Exp $ +.\" +.TH X11PERFCOMP 1 __xorgversion__ .SH NAME x11perfcomp \- X11 server performance comparison program .SH SYNTAX @@ -68,7 +71,7 @@ .SH X DEFAULTS There are no X defaults used by this program. .SH "SEE ALSO" -X(1), x11perf(1) +X(__miscmansuffix__), x11perf(1) .SH AUTHORS Mark Moraes wrote the original scripts to compare servers. .br Index: xc/programs/x11perf/x11perf.c diff -u xc/programs/x11perf/x11perf.c:3.3 xc/programs/x11perf/x11perf.c:3.4 --- xc/programs/x11perf/x11perf.c:3.3 Wed Nov 29 03:58:20 2000 +++ xc/programs/x11perf/x11perf.c Wed Jan 17 18:45:12 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: x11perf.c,v 2.54 94/03/30 19:40:27 gildea Exp $ */ -/* $XFree86: xc/programs/x11perf/x11perf.c,v 3.3 2000/11/29 08:58:20 keithp Exp $ */ +/* $Xorg: x11perf.c,v 1.4 2000/08/17 19:54:10 cpqbld Exp $ */ /**************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -22,6 +21,7 @@ SOFTWARE. ****************************************************************************/ +/* $XFree86: xc/programs/x11perf/x11perf.c,v 3.4 2001/01/17 23:45:12 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/x11perf/x11perf.h diff -u xc/programs/x11perf/x11perf.h:3.2 xc/programs/x11perf/x11perf.h:3.3 --- xc/programs/x11perf/x11perf.h:3.2 Wed Nov 29 03:58:20 2000 +++ xc/programs/x11perf/x11perf.h Wed Jan 17 18:45:13 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: x11perf.h,v 2.13 94/03/17 20:25:53 dpw Exp $ */ -/* $XFree86: xc/programs/x11perf/x11perf.h,v 3.2 2000/11/29 08:58:20 keithp Exp $ */ +/* $Xorg: x11perf.h,v 1.3 2000/08/17 19:54:10 cpqbld Exp $ */ /***************************************************************************** Copyright 1988, 1989 by Digital Equipment Corporation, Maynard, Massachusetts. @@ -22,6 +21,7 @@ SOFTWARE. ******************************************************************************/ +/* $XFree86: xc/programs/x11perf/x11perf.h,v 3.3 2001/01/17 23:45:13 dawes Exp $ */ #ifndef VMS #include <X11/Xlib.h> Index: xc/programs/x11perf/x11perf.man diff -u xc/programs/x11perf/x11perf.man:1.4 xc/programs/x11perf/x11perf.man:1.7 --- xc/programs/x11perf/x11perf.man:1.4 Sun Oct 4 05:40:44 1998 +++ xc/programs/x11perf/x11perf.man Sat Jan 27 13:21:07 2001 @@ -1,4 +1,4 @@ -.\" $TOG: x11perf.man /main/28 1998/02/09 13:52:03 kaleb $ +.\" $Xorg: x11perf.man,v 1.3 2000/08/17 19:54:10 cpqbld Exp $ .\" Copyright 1988, 1989 Digital Equipment Corporation. .\" Copyright 1989, 1994, 1998 The Open Group .\" @@ -19,7 +19,10 @@ .\" 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. -.TH X11PERF 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/x11perf/x11perf.man,v 1.7 2001/01/27 18:21:07 dawes Exp $ +.\" +.TH X11PERF 1 __xorgversion__ .SH NAME x11perf \- X11 server performance test program .SH SYNTAX @@ -996,7 +999,7 @@ .SH X DEFAULTS There are no X defaults used by this program. .SH "SEE ALSO" -X(1), xbench(1), x11perfcomp(1) +X(__miscmansuffix__), xbench(1), x11perfcomp(1) .SH AUTHORS Joel McCormack .br Index: xc/programs/xauth/Imakefile diff -u xc/programs/xauth/Imakefile:3.3 xc/programs/xauth/Imakefile:3.5 --- xc/programs/xauth/Imakefile:3.3 Sun Dec 20 06:58:12 1998 +++ xc/programs/xauth/Imakefile Thu Mar 29 21:15:23 2001 @@ -1,7 +1,12 @@ -XCOMM $XConsortium: Imakefile /main/17 1996/09/25 00:58:20 dpw $ -XCOMM $XFree86: xc/programs/xauth/Imakefile,v 3.3 1998/12/20 11:58:12 dawes Exp $ -DEPLIBS = $(DEPXAUTHLIB) $(DEPXMULIB) $(DEPXLIB) -LOCAL_LIBRARIES = $(XAUTHLIB) $(XMULIB) $(XLIB) +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:11 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xauth/Imakefile,v 3.5 2001/03/30 02:15:23 keithp Exp $ + +DEPLIBS = $(DEPXAUTHLIB) $(DEPXMUULIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XAUTHLIB) $(XMUULIB) $(XLIB) SRCS = xauth.c gethost.c process.c parsedpy.c OBJS = xauth.o gethost.o process.o parsedpy.o CONN_DEFINES = $(CONNECTION_FLAGS) Index: xc/programs/xauth/gethost.c diff -u xc/programs/xauth/gethost.c:3.12 xc/programs/xauth/gethost.c:3.13 --- xc/programs/xauth/gethost.c:3.12 Sun Mar 7 06:40:49 1999 +++ xc/programs/xauth/gethost.c Wed Jan 17 18:45:14 2001 @@ -1,5 +1,5 @@ /* - * $TOG: gethost.c /main/26 1998/02/09 13:52:14 kaleb $ + * $Xorg: gethost.c,v 1.4 2000/08/17 19:54:11 cpqbld Exp $ * * Copyright 1989, 1998 The Open Group @@ -23,7 +23,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xauth/gethost.c,v 3.12 1999/03/07 11:40:49 dawes Exp $ */ +/* $XFree86: xc/programs/xauth/gethost.c,v 3.13 2001/01/17 23:45:14 dawes Exp $ */ /* sorry, streams support does not really work yet */ #if defined(STREAMSCONN) && defined(SVR4) Index: xc/programs/xauth/parsedpy.c diff -u xc/programs/xauth/parsedpy.c:3.3 xc/programs/xauth/parsedpy.c:3.4 --- xc/programs/xauth/parsedpy.c:3.3 Sun Feb 28 06:20:04 1999 +++ xc/programs/xauth/parsedpy.c Wed Jan 17 18:45:14 2001 @@ -1,5 +1,5 @@ /* - * $TOG: parsedpy.c /main/10 1998/02/09 13:52:19 kaleb $ + * $Xorg: parsedpy.c,v 1.3 2000/08/17 19:54:11 cpqbld Exp $ * * parse_displayname - utility routine for splitting up display name strings * @@ -25,7 +25,7 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xauth/parsedpy.c,v 3.3 1999/02/28 11:20:04 dawes Exp $ */ +/* $XFree86: xc/programs/xauth/parsedpy.c,v 3.4 2001/01/17 23:45:14 dawes Exp $ */ #include <stdio.h> /* for NULL */ #include <ctype.h> /* for isascii() and isdigit() */ Index: xc/programs/xauth/process.c diff -u xc/programs/xauth/process.c:3.7 xc/programs/xauth/process.c:3.9 --- xc/programs/xauth/process.c:3.7 Mon Feb 14 14:20:57 2000 +++ xc/programs/xauth/process.c Mon Apr 23 16:31:09 2001 @@ -1,4 +1,4 @@ -/* $TOG: process.c /main/52 1998/02/09 13:52:23 kaleb $ */ +/* $Xorg: process.c,v 1.5 2000/08/17 19:54:11 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xauth/process.c,v 3.7 2000/02/14 19:20:57 dawes Exp $ */ +/* $XFree86: xc/programs/xauth/process.c,v 3.9 2001/04/23 20:31:09 dawes Exp $ */ /* * Author: Jim Fulton, MIT X Consortium @@ -634,7 +634,15 @@ #ifdef SYSV if (sig > 0) signal (sig, die); /* re-establish signal handler */ #endif - if (verbose && xauth_modified) WRITES(fileno(stdout), "\r\n"); + /* + * fileno() might not be reentrant, avoid it if possible, and use + * stderr instead of stdout + */ +#ifdef STDERR_FILENO + if (verbose && xauth_modified) WRITES(STDERR_FILENO, "\r\n"); +#else + if (verbose && xauth_modified) WRITES(fileno(stderr), "\r\n"); +#endif die (sig); /* NOTREACHED */ #ifdef SIGNALRETURNSINT @@ -818,10 +826,20 @@ if (xauth_modified) { if (dieing) { if (verbose) { - /* called from a signal handler -- printf is *not* reentrant */ - WRITES(fileno(stdout), "\nAborting changes to authority file "); - WRITES(fileno(stdout), xauth_filename); - WRITES(fileno(stdout), "\n"); + /* + * called from a signal handler -- printf is *not* reentrant; also + * fileno() might not be reentrant, avoid it if possible, and use + * stderr instead of stdout + */ +#ifdef STDERR_FILENO + WRITES(STDERR_FILENO, "\nAborting changes to authority file "); + WRITES(STDERR_FILENO, xauth_filename); + WRITES(STDERR_FILENO, "\n"); +#else + WRITES(fileno(stderr), "\nAborting changes to authority file "); + WRITES(fileno(stderr), xauth_filename); + WRITES(fileno(stderr), "\n"); +#endif } } else if (!xauth_allowed) { fprintf (stderr, Index: xc/programs/xauth/xauth.c diff -u xc/programs/xauth/xauth.c:1.3 xc/programs/xauth/xauth.c:1.4 --- xc/programs/xauth/xauth.c:1.3 Tue Mar 2 06:49:35 1999 +++ xc/programs/xauth/xauth.c Wed Jan 17 18:45:16 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xauth.c /main/19 1998/02/09 13:52:29 kaleb $ + * $Xorg: xauth.c,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ * * xauth - manipulate authorization file * @@ -24,7 +24,7 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xauth/xauth.c,v 1.3 1999/03/02 11:49:35 dawes Exp $ */ +/* $XFree86: xc/programs/xauth/xauth.c,v 1.4 2001/01/17 23:45:16 dawes Exp $ */ #include "xauth.h" Index: xc/programs/xauth/xauth.h diff -u xc/programs/xauth/xauth.h:1.3 xc/programs/xauth/xauth.h:1.4 --- xc/programs/xauth/xauth.h:1.3 Tue Mar 2 06:49:35 1999 +++ xc/programs/xauth/xauth.h Wed Jan 17 18:45:16 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xauth.h /main/15 1998/02/09 13:52:34 kaleb $ + * $Xorg: xauth.h,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ * * Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xauth/xauth.h,v 1.3 1999/03/02 11:49:35 dawes Exp $ */ +/* $XFree86: xc/programs/xauth/xauth.h,v 1.4 2001/01/17 23:45:16 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> Index: xc/programs/xauth/xauth.man diff -u xc/programs/xauth/xauth.man:1.4 xc/programs/xauth/xauth.man:1.6 --- xc/programs/xauth/xauth.man:1.4 Sun Oct 4 05:40:46 1998 +++ xc/programs/xauth/xauth.man Sat Jan 27 13:21:07 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xauth.man /main/17 1998/02/09 13:52:38 kaleb $ +.\" $Xorg: xauth.man,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ .\" Copyright 1993, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XAUTH 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xauth/xauth.man,v 1.6 2001/01/27 18:21:07 dawes Exp $ +.\" +.TH XAUTH 1 __xorgversion__ .SH NAME xauth \- X authority file utility .SH SYNOPSIS Index: xc/programs/xbiff/Mailbox.c diff -u xc/programs/xbiff/Mailbox.c:1.1 xc/programs/xbiff/Mailbox.c:1.3 --- xc/programs/xbiff/Mailbox.c:1.1 Sat Feb 12 22:56:12 2000 +++ xc/programs/xbiff/Mailbox.c Thu Apr 19 15:54:51 2001 @@ -28,6 +28,7 @@ from the X Consortium. */ +/* $XFree86: xc/programs/xbiff/Mailbox.c,v 1.3 2001/04/19 19:54:51 dawes Exp $ */ /* * Author: Jim Fulton, MIT X Consortium @@ -43,8 +44,8 @@ #include <X11/StringDefs.h> /* for useful atom names */ #include <X11/cursorfont.h> /* for cursor constants */ #include <X11/Xosdefs.h> /* for X_NOT_POSIX def */ -#ifdef WIN32 #include <stdlib.h> +#ifdef WIN32 #include <X11/Xw32defs.h> #else #include <pwd.h> /* for getting username */ @@ -543,6 +544,7 @@ MailboxWidget w; { char *username; + char *mailpath; #ifdef WIN32 if (!(username = getenv("USERNAME"))) { fprintf (stderr, "%s: unable to find a username for you.\n", @@ -564,11 +566,16 @@ username = pw->pw_name; } #endif - w->mailbox.filename = (String) XtMalloc (strlen (MAILBOX_DIRECTORY) + 1 + - strlen (username) + 1); - strcpy (w->mailbox.filename, MAILBOX_DIRECTORY); - strcat (w->mailbox.filename, "/"); - strcat (w->mailbox.filename, username); + if (mailpath = getenv("MAIL")) { + w->mailbox.filename = (String) XtMalloc (strlen (mailpath) + 1); + strcpy (w->mailbox.filename, mailpath); + } else { + w->mailbox.filename = (String) XtMalloc (strlen (MAILBOX_DIRECTORY) + 1 + + strlen (username) + 1); + strcpy (w->mailbox.filename, MAILBOX_DIRECTORY); + strcat (w->mailbox.filename, "/"); + strcat (w->mailbox.filename, username); + } return; } Index: xc/programs/xbiff/MailboxP.h diff -u xc/programs/xbiff/MailboxP.h:1.1 xc/programs/xbiff/MailboxP.h:1.2 --- xc/programs/xbiff/MailboxP.h:1.1 Sat Feb 12 22:56:12 2000 +++ xc/programs/xbiff/MailboxP.h Thu Apr 19 15:54:51 2001 @@ -1,5 +1,4 @@ /* $XConsortium: MailboxP.h,v 1.22 94/04/17 20:43:27 rws Exp $ */ -/* $XFree86: xc/programs/xbiff/MailboxP.h,v 1.1 2000/02/13 03:56:12 dawes Exp $ */ /* Copyright (c) 1988 X Consortium @@ -29,6 +28,7 @@ from the X Consortium. */ +/* $XFree86: xc/programs/xbiff/MailboxP.h,v 1.2 2001/04/19 19:54:51 dawes Exp $ */ #ifndef _XawMailboxP_h #define _XawMailboxP_h @@ -36,17 +36,17 @@ #include "Mailbox.h" #include <X11/Xaw/SimpleP.h> -#ifdef SYSV +#if defined(SYSV) #define MAILBOX_DIRECTORY "/usr/mail" -#endif -#ifdef SVR4 +#elif defined(SVR4) #define MAILBOX_DIRECTORY "/var/mail" -#endif -#ifdef CSRG_BASED +#elif defined(CSRG_BASED) #include <paths.h> #ifdef _PATH_MAILDIR #define MAILBOX_DIRECTORY _PATH_MAILDIR #endif +#elif defined(__linux__) +#define MAILBOX_DIRECTORY "/var/spool/mail" #endif #ifndef MAILBOX_DIRECTORY Index: xc/programs/xbiff/xbiff.man diff -u xc/programs/xbiff/xbiff.man:1.1 xc/programs/xbiff/xbiff.man:1.4 --- xc/programs/xbiff/xbiff.man:1.1 Sat Feb 12 22:56:13 2000 +++ xc/programs/xbiff/xbiff.man Thu Apr 19 15:54:51 2001 @@ -24,7 +24,10 @@ .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from the X Consortium. -.TH XBIFF 1 "Release 6" "X Version 11" +.\" +.\" $XFree86: xc/programs/xbiff/xbiff.man,v 1.4 2001/04/19 19:54:51 dawes Exp $ +.\" +.TH XBIFF 1 __xorgversion__ .SH NAME xbiff \- mailbox flag for X .SH SYNOPSIS @@ -33,12 +36,11 @@ .SH DESCRIPTION The .I xbiff -program displays a little image of a mailbox. When there is no mail, the flag -on the mailbox is down. When mail arrives, the flag goes up and the mailbox beeps. -By default, -pressing any mouse button in the image forces \fIxbiff\fP to remember the -current size of the mail file as being the ``empty'' size and to lower -the flag. +program displays a little image of a mailbox. When there is no mail, +the flag on the mailbox is down. When mail arrives, the flag goes up +and the mailbox beeps. By default, pressing any mouse button in the +image forces \fIxbiff\fP to remember the current size of the mail file +as being the ``empty'' size and to lower the flag. .SH OPTIONS .I Xbiff accepts all of the standard X Toolkit command line options along with the @@ -55,8 +57,15 @@ .TP 8 .B \-file \fIfilename\fP This option specifies the name of the file which should be monitored. By -default, it watches /usr/spool/mail/\fIusername\fP, where \fIusername\fP -is your login name. +default it watches your inbox in the default location for your +system (some examples are +.RI /var/mail/ username , +.RI /usr/spool/mail/ username , +.RI /var/spool/mail/ username +(where +.I username +is your login name). If the MAIL environment variable is set, +the file specified by it will be monitored. .TP 8 .B \-volume \fIpercentage\fP This option specifies how loud the bell should be rung when new mail comes in. @@ -113,8 +122,10 @@ By default, no shell command is provided. .TP 8 .B file (\fPclass\fB File) -Specifies the name of the file to monitor. The default is to watch -/usr/spool/mail/\fIusername\fP, where \fIusername\fP is your login name. +Specifies the name of the file to monitor. The default is as described +above for the +.B \-file +command line option. .TP 8 .B onceOnly (\fPclass\fB Boolean) Specifies that the bell is only rung the first time new mail is found @@ -194,7 +205,7 @@ to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH "SEE ALSO" -X(1), +X(__miscmansuffix__), xrdb(1), stat(2) .SH BUGS Index: xc/programs/xcalc/xcalc.man diff -u xc/programs/xcalc/xcalc.man:1.1 xc/programs/xcalc/xcalc.man:1.3 --- xc/programs/xcalc/xcalc.man:1.1 Sat Feb 12 22:26:19 2000 +++ xc/programs/xcalc/xcalc.man Sat Jan 27 13:21:08 2001 @@ -24,6 +24,9 @@ .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from the X Consortium. +.\" +.\" $XFree86: xc/programs/xcalc/xcalc.man,v 1.3 2001/01/27 18:21:08 dawes Exp $ +.\" .de EX \"Begin example .ne 5 .if n .sp 1 @@ -37,7 +40,7 @@ .if n .sp 1 .if t .sp .5 .. -.TH XCALC 1 "Release 6" "X Version 11" +.TH XCALC 1 __xorgversion__ .SH NAME xcalc \- scientific calculator for X .SH SYNOPSIS @@ -419,7 +422,7 @@ <XRoot>/lib/X11/app-defaults/XCalc-color. .fi .SH "SEE ALSO" -X(1), xrdb(1), the Athena Widget Set +X(__miscmansuffix__), xrdb(1), the Athena Widget Set .SH BUGS .PP HP mode: A bug report claims that the sequence of keys 5, ENTER, <- @@ -427,7 +430,7 @@ .SH COPYRIGHT Copyright ([\d,\s]*) X Consortium .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHORS John Bradley, University of Pennsylvania .br Index: xc/programs/xclipboard/Imakefile diff -u xc/programs/xclipboard/Imakefile:1.1.1.2 xc/programs/xclipboard/Imakefile:1.1.1.3 --- xc/programs/xclipboard/Imakefile:1.1.1.2 Tue Jan 16 05:23:47 1996 +++ xc/programs/xclipboard/Imakefile Tue Jan 16 17:47:44 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/9 1996/01/14 16:50:36 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ SRCS1 = xclipboard.c OBJS1 = xclipboard.o SRCS2 = xcutsel.c Index: xc/programs/xclipboard/XClipboard.ad diff -u xc/programs/xclipboard/XClipboard.ad:1.1.1.1 xc/programs/xclipboard/XClipboard.ad:1.1.1.2 --- xc/programs/xclipboard/XClipboard.ad:1.1.1.1 Wed Apr 27 03:13:22 1994 +++ xc/programs/xclipboard/XClipboard.ad Tue Jan 16 17:47:44 2001 @@ -1,4 +1,4 @@ -! $XConsortium: XClipboard.ad,v 1.13 94/02/09 19:43:59 gildea Exp $ +! $Xorg: XClipboard.ad,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ *Command*Font: -*-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1 *Label*Font: -*-helvetica-bold-r-normal--*-120-*-*-*-*-iso8859-1 *Text*Font: -*-courier-medium-r-normal--*-120-*-*-*-*-iso8859-1 Index: xc/programs/xclipboard/xclipboard.c diff -u xc/programs/xclipboard/xclipboard.c:1.5 xc/programs/xclipboard/xclipboard.c:1.6 --- xc/programs/xclipboard/xclipboard.c:1.5 Sun Mar 21 02:35:36 1999 +++ xc/programs/xclipboard/xclipboard.c Wed Jan 17 18:45:17 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xclipboard.c /main/31 1998/02/09 13:52:46 kaleb $ + * $Xorg: xclipboard.c,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ * * Copyright 1989, 1998 The Open Group @@ -24,7 +24,7 @@ * Updated for R4: Chris D. Peterson, MIT X Consortium. * Reauthored by: Keith Packard, MIT X Consortium. */ -/* $XFree86: xc/programs/xclipboard/xclipboard.c,v 1.5 1999/03/21 07:35:36 dawes Exp $ */ +/* $XFree86: xc/programs/xclipboard/xclipboard.c,v 1.6 2001/01/17 23:45:17 dawes Exp $ */ #include <stdio.h> #include <X11/Intrinsic.h> Index: xc/programs/xclipboard/xclipboard.man diff -u xc/programs/xclipboard/xclipboard.man:1.4 xc/programs/xclipboard/xclipboard.man:1.7 --- xc/programs/xclipboard/xclipboard.man:1.4 Sun Oct 4 05:40:46 1998 +++ xc/programs/xclipboard/xclipboard.man Sat Jan 27 13:21:08 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xclipboard.man /main/17 1998/02/09 13:52:51 kaleb $ +.\" $Xorg: xclipboard.man,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XCLIPBOARD 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xclipboard/xclipboard.man,v 1.7 2001/01/27 18:21:08 dawes Exp $ +.\" +.TH XCLIPBOARD 1 __xorgversion__ .SH NAME xclipboard \- X clipboard client .SH SYNOPSIS @@ -123,7 +126,7 @@ .fi .sp .SH "SEE ALSO" -X(1), xcutsel(1), xterm(1), individual client documentation for how to make a +X(__miscmansuffix__), xcutsel(1), xterm(1), individual client documentation for how to make a selection and send it to the CLIPBOARD. .SH ENVIRONMENT .PP Index: xc/programs/xclipboard/xcutsel.c diff -u xc/programs/xclipboard/xcutsel.c:1.5 xc/programs/xclipboard/xcutsel.c:1.7 --- xc/programs/xclipboard/xcutsel.c:1.5 Sun Mar 21 02:35:37 1999 +++ xc/programs/xclipboard/xcutsel.c Sun Apr 1 10:00:19 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xcutsel.c /main/22 1998/02/09 13:52:55 kaleb $ + * $Xorg: xcutsel.c,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ * * Copyright 1989, 1998 The Open Group @@ -22,9 +22,10 @@ * * * Author: Ralph Swick, DEC/Project Athena */ -/* $XFree86: xc/programs/xclipboard/xcutsel.c,v 1.5 1999/03/21 07:35:37 dawes Exp $ */ +/* $XFree86: xc/programs/xclipboard/xcutsel.c,v 1.7 2001/04/01 14:00:19 tsi Exp $ */ #include <stdio.h> +#include <stdlib.h> #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Xatom.h> Index: xc/programs/xclipboard/xcutsel.man diff -u xc/programs/xclipboard/xcutsel.man:1.4 xc/programs/xclipboard/xcutsel.man:1.7 --- xc/programs/xclipboard/xcutsel.man:1.4 Sun Oct 4 05:40:47 1998 +++ xc/programs/xclipboard/xcutsel.man Sat Jan 27 13:21:09 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xcutsel.man /main/16 1998/02/09 13:52:59 kaleb $ +.\" $Xorg: xcutsel.man,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ .\" Copyright 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XCUTSEL 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xclipboard/xcutsel.man,v 1.7 2001/01/27 18:21:09 dawes Exp $ +.\" +.TH XCUTSEL 1 __xorgversion__ .SH NAME xcutsel - interchange between cut buffer and selection .SH SYNOPSIS @@ -92,7 +95,7 @@ .B "quit (\fPclass\fB Command)" This is the ``quit'' button. .SH "SEE ALSO" -X(1), xclipboard(1), xterm(1), text widget documentation, individual client +X(__miscmansuffix__), xclipboard(1), xterm(1), text widget documentation, individual client documentation for how to make a selection. .SH BUGS There is no way to change the name of the selection or the number of the Index: xc/programs/xclock/Clock.c diff -u xc/programs/xclock/Clock.c:3.8 xc/programs/xclock/Clock.c:3.9 --- xc/programs/xclock/Clock.c:3.8 Wed Nov 1 21:51:24 2000 +++ xc/programs/xclock/Clock.c Wed Jan 17 18:45:18 2001 @@ -1,4 +1,4 @@ -/* $TOG: Clock.c /main/76 1998/02/09 13:53:14 kaleb $ */ +/* $Xorg: Clock.c,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ */ /*********************************************************** @@ -42,7 +42,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xclock/Clock.c,v 3.8 2000/11/02 02:51:24 dawes Exp $ */ +/* $XFree86: xc/programs/xclock/Clock.c,v 3.9 2001/01/17 23:45:18 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/StringDefs.h> Index: xc/programs/xclock/Clock.h diff -u xc/programs/xclock/Clock.h:1.4 xc/programs/xclock/Clock.h:1.5 --- xc/programs/xclock/Clock.h:1.4 Wed Nov 1 21:51:24 2000 +++ xc/programs/xclock/Clock.h Wed Jan 17 18:45:18 2001 @@ -1,5 +1,5 @@ /* -* $TOG: Clock.h /main/29 1998/02/09 13:53:20 kaleb $ +* $Xorg: Clock.h,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ */ @@ -45,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xclock/Clock.h,v 1.4 2000/11/02 02:51:24 dawes Exp $ */ +/* $XFree86: xc/programs/xclock/Clock.h,v 1.5 2001/01/17 23:45:18 dawes Exp $ */ #ifndef _XawClock_h #define _XawClock_h Index: xc/programs/xclock/ClockP.h diff -u xc/programs/xclock/ClockP.h:1.4 xc/programs/xclock/ClockP.h:1.5 --- xc/programs/xclock/ClockP.h:1.4 Wed Nov 1 21:51:24 2000 +++ xc/programs/xclock/ClockP.h Wed Jan 17 18:45:18 2001 @@ -1,5 +1,5 @@ /* -* $TOG: ClockP.h /main/24 1998/02/09 13:53:06 kaleb $ +* $Xorg: ClockP.h,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ */ @@ -45,7 +45,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xclock/ClockP.h,v 1.4 2000/11/02 02:51:24 dawes Exp $ */ +/* $XFree86: xc/programs/xclock/ClockP.h,v 1.5 2001/01/17 23:45:18 dawes Exp $ */ #ifndef _XawClockP_h #define _XawClockP_h Index: xc/programs/xclock/Imakefile diff -u xc/programs/xclock/Imakefile:1.1.1.2 xc/programs/xclock/Imakefile:1.1.1.3 --- xc/programs/xclock/Imakefile:1.1.1.2 Tue Jan 16 05:24:08 1996 +++ xc/programs/xclock/Imakefile Tue Jan 16 17:47:49 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/17 1996/01/14 16:50:54 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ DEPLIBS = XkbClientDepLibs XawClientDepLibs LOCAL_LIBRARIES = XkbClientLibs XawClientLibs SRCS = xclock.c Clock.c Index: xc/programs/xclock/xclock.c diff -u xc/programs/xclock/xclock.c:1.5 xc/programs/xclock/xclock.c:1.7 --- xc/programs/xclock/xclock.c:1.5 Wed Nov 1 21:51:24 2000 +++ xc/programs/xclock/xclock.c Sun Apr 1 10:00:19 2001 @@ -1,4 +1,4 @@ -/* $TOG: xclock.c /main/41 1998/02/09 13:53:27 kaleb $ */ +/* $Xorg: xclock.c,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ */ /* * xclock -- Hacked from Tony Della Fera's much hacked clock program. @@ -23,9 +23,10 @@ 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/xclock/xclock.c,v 1.5 2000/11/02 02:51:24 dawes Exp $ */ +/* $XFree86: xc/programs/xclock/xclock.c,v 1.7 2001/04/01 14:00:19 tsi Exp $ */ #include <stdio.h> +#include <stdlib.h> #include <X11/Xatom.h> #include <X11/Intrinsic.h> #include <X11/StringDefs.h> Index: xc/programs/xclock/xclock.man diff -u xc/programs/xclock/xclock.man:1.6 xc/programs/xclock/xclock.man:1.9 --- xc/programs/xclock/xclock.man:1.6 Wed Nov 1 21:51:25 2000 +++ xc/programs/xclock/xclock.man Sat Jan 27 13:21:09 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xclock.man /main/29 1998/02/09 13:53:31 kaleb $ +.\" $Xorg: xclock.man,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -19,9 +19,9 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xclock/xclock.man,v 1.6 2000/11/02 02:51:25 dawes Exp $ +.\" $XFree86: xc/programs/xclock/xclock.man,v 1.9 2001/01/27 18:21:09 dawes Exp $ .\" -.TH XCLOCK 1 "Release 6.4" "X Version 11" +.TH XCLOCK 1 __xorgversion__ .SH NAME xclock \- analog / digital clock for X .SH SYNOPSIS @@ -158,7 +158,7 @@ .SH FILES <XRoot>/lib/X11/app-defaults/XClock - specifies required resources .SH "SEE ALSO" -X(1), xrdb(1), time(3C) +X(__miscmansuffix__), xrdb(1), time(3C) .SH BUGS .I Xclock believes the system clock. Index: xc/programs/xcmsdb/Imakefile diff -u xc/programs/xcmsdb/Imakefile:1.1.1.1 xc/programs/xcmsdb/Imakefile:1.1.1.2 --- xc/programs/xcmsdb/Imakefile:1.1.1.1 Wed Apr 27 03:20:35 1994 +++ xc/programs/xcmsdb/Imakefile Tue Jan 16 17:47:51 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile,v 1.7 93/08/19 09:32:11 rws Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:12 cpqbld Exp $ SRCS = xcmsdb.c loadData.c OBJS = xcmsdb.o loadData.o INCLUDES = -I$(XLIBSRC) Index: xc/programs/xcmsdb/SCCDFile.h diff -u xc/programs/xcmsdb/SCCDFile.h:1.3 xc/programs/xcmsdb/SCCDFile.h:1.4 --- xc/programs/xcmsdb/SCCDFile.h:1.3 Tue Mar 2 06:49:36 1999 +++ xc/programs/xcmsdb/SCCDFile.h Wed Jan 17 18:45:19 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: SCCDFile.h,v 1.5 94/02/07 23:20:33 rws Exp $ */ +/* $Xorg: SCCDFile.h,v 1.3 2000/08/17 19:54:13 cpqbld Exp $ */ /* * (c) Copyright 1990 Tektronix Inc. * All Rights Reserved @@ -28,7 +28,7 @@ * X Device Color Characterization Convention (XDCCC). * */ -/* $XFree86: xc/programs/xcmsdb/SCCDFile.h,v 1.3 1999/03/02 11:49:36 dawes Exp $ */ +/* $XFree86: xc/programs/xcmsdb/SCCDFile.h,v 1.4 2001/01/17 23:45:19 dawes Exp $ */ #ifndef SCCDFILE_H #define SCCDFILE_H Index: xc/programs/xcmsdb/loadData.c diff -u xc/programs/xcmsdb/loadData.c:3.1 xc/programs/xcmsdb/loadData.c:3.2 --- xc/programs/xcmsdb/loadData.c:3.1 Sun Feb 28 06:20:10 1999 +++ xc/programs/xcmsdb/loadData.c Wed Jan 17 18:45:19 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: loadData.c,v 1.12 94/02/07 23:28:48 rws Exp $ */ -/* $XFree86: xc/programs/xcmsdb/loadData.c,v 3.1 1999/02/28 11:20:10 dawes Exp $ */ +/* $Xorg: loadData.c,v 1.4 2000/08/17 19:54:13 cpqbld Exp $ */ /* * (c) Copyright 1990 Tektronix Inc. @@ -32,6 +31,7 @@ * * */ +/* $XFree86: xc/programs/xcmsdb/loadData.c,v 3.2 2001/01/17 23:45:19 dawes Exp $ */ /* * INCLUDES Index: xc/programs/xcmsdb/xcmsdb.c diff -u xc/programs/xcmsdb/xcmsdb.c:1.4 xc/programs/xcmsdb/xcmsdb.c:1.6 --- xc/programs/xcmsdb/xcmsdb.c:1.4 Tue Mar 2 06:49:36 1999 +++ xc/programs/xcmsdb/xcmsdb.c Sun Apr 1 10:00:19 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: xcmsdb.c,v 1.12 94/02/07 23:29:38 rws Exp $ */ +/* $Xorg: xcmsdb.c,v 1.3 2000/08/17 19:54:13 cpqbld Exp $ */ /* * (c) Copyright 1990 Tektronix Inc. @@ -29,13 +29,14 @@ * Characterization Data from the root window of the screen. * */ -/* $XFree86: xc/programs/xcmsdb/xcmsdb.c,v 1.4 1999/03/02 11:49:36 dawes Exp $ */ +/* $XFree86: xc/programs/xcmsdb/xcmsdb.c,v 1.6 2001/04/01 14:00:19 tsi Exp $ */ /* * INCLUDES */ #include <stdio.h> +#include <stdlib.h> #include <X11/Xlib.h> #include <X11/Xatom.h> #include <X11/Xos.h> Index: xc/programs/xcmsdb/xcmsdb.man diff -u xc/programs/xcmsdb/xcmsdb.man:1.4 xc/programs/xcmsdb/xcmsdb.man:1.6 --- xc/programs/xcmsdb/xcmsdb.man:1.4 Sun Oct 4 05:40:48 1998 +++ xc/programs/xcmsdb/xcmsdb.man Sat Jan 27 13:21:09 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xcmsdb.man /main/13 1998/02/09 13:53:54 kaleb $ +.\" $Xorg: xcmsdb.man,v 1.3 2000/08/17 19:54:13 cpqbld Exp $ .\" Copyright 1990, Tektronix Inc. .\" Copyright 1993, 1998 The Open Group .\" @@ -19,7 +19,10 @@ .\" be used in advertising or otherwise to promote the sale, use or other .\" dealing in this Software without prior written authorization from the .\" The Open Group. -.TH XCMSDB 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xcmsdb/xcmsdb.man,v 1.6 2001/01/27 18:21:09 dawes Exp $ +.\" +.TH XCMSDB 1 __xorgversion__ .SH NAME xcmsdb \- Device Color Characterization utility for X Color Management System .SH SYNOPSIS Index: xc/programs/xconsole/Imakefile diff -u xc/programs/xconsole/Imakefile:3.1 xc/programs/xconsole/Imakefile:3.2 --- xc/programs/xconsole/Imakefile:3.1 Fri Sep 22 21:18:17 1995 +++ xc/programs/xconsole/Imakefile Wed Jan 17 18:45:19 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile,v 1.3 91/07/16 23:07:10 gildea Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:13 cpqbld Exp $ SRCS = xconsole.c OBJS = xconsole.o PROGRAMS = xconsole Index: xc/programs/xconsole/XConsole.ad diff -u xc/programs/xconsole/XConsole.ad:1.2 xc/programs/xconsole/XConsole.ad:1.3 --- xc/programs/xconsole/XConsole.ad:1.2 Fri Mar 31 17:55:55 2000 +++ xc/programs/xconsole/XConsole.ad Wed Jan 17 18:45:19 2001 @@ -1,5 +1,10 @@ -! $XConsortium: XConsole.ad,v 1.3 94/02/09 19:44:01 gildea Exp $ -! $XFree86: xc/programs/xconsole/XConsole.ad,v 1.2 2000/03/31 22:55:55 dawes Exp $ +! $Xorg: XConsole.ad,v 1.3 2000/08/17 19:54:13 cpqbld Exp $ +! +! +! +! +! $XFree86: xc/programs/xconsole/XConsole.ad,v 1.3 2001/01/17 23:45:19 dawes Exp $ + *allowShellResize: true XConsole.translations: #override\ <MapNotify>: Deiconified() \n\ Index: xc/programs/xconsole/xconsole.c diff -u xc/programs/xconsole/xconsole.c:3.23 xc/programs/xconsole/xconsole.c:3.25 --- xc/programs/xconsole/xconsole.c:3.23 Sun Mar 21 02:35:37 1999 +++ xc/programs/xconsole/xconsole.c Mon Apr 23 17:41:46 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xconsole.c /main/23 1998/02/09 13:54:04 kaleb $ + * $Xorg: xconsole.c,v 1.4 2000/08/17 19:54:13 cpqbld Exp $ * Copyright 1990, 1998 The Open Group @@ -22,7 +22,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xconsole/xconsole.c,v 3.23 1999/03/21 07:35:37 dawes Exp $ */ +/* $XFree86: xc/programs/xconsole/xconsole.c,v 3.25 2001/04/23 21:41:46 dawes Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> @@ -478,6 +478,13 @@ #endif fclose (input); XtRemoveInput (*id); + + /* try to reopen if pipe; this can be caused by syslog restart */ + if (app_resources.file && !regularFile && n == 0) + { + OpenConsole(); + } + } Notify (); buffer[n] = '\0'; Index: xc/programs/xconsole/xconsole.man diff -u xc/programs/xconsole/xconsole.man:1.4 xc/programs/xconsole/xconsole.man:1.7 --- xc/programs/xconsole/xconsole.man:1.4 Sun Oct 4 05:40:51 1998 +++ xc/programs/xconsole/xconsole.man Sat Jan 27 13:21:09 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xconsole.man /main/12 1998/02/09 13:54:09 kaleb $ +.\" $Xorg: xconsole.man,v 1.3 2000/08/17 19:54:13 cpqbld Exp $ .\" Copyright 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" be used in advertising or otherwise to promote the sale, use or other .\" dealing in this Software without prior written authorization from the .\" The Open Group. -.TH XCONSOLE 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xconsole/xconsole.man,v 1.7 2001/01/27 18:21:09 dawes Exp $ +.\" +.TH XCONSOLE 1 __xorgversion__ .SH NAME xconsole \- monitor system console messages with X .SH SYNOPSIS @@ -88,6 +91,6 @@ .SH FILES <XRoot>/lib/X11/app-defaults/XConsole - specifies required resources .SH "SEE ALSO" -X(1), xrdb(1), Athena Text widget +X(__miscmansuffix__), xrdb(1), Athena Text widget .SH AUTHOR Keith Packard (MIT X Consortium) Index: xc/programs/xditview/xditview.man diff -u xc/programs/xditview/xditview.man:1.1 xc/programs/xditview/xditview.man:1.3 --- xc/programs/xditview/xditview.man:1.1 Wed Feb 23 15:35:32 2000 +++ xc/programs/xditview/xditview.man Sat Jan 27 13:21:10 2001 @@ -1,5 +1,8 @@ .\" $XConsortium: xditview.man,v 1.10 94/04/17 20:43:37 gildea Exp $ -.TH XDITVIEW 1 "Release 6" "X Version 11" +.\" +.\" $XFree86: xc/programs/xditview/xditview.man,v 1.3 2001/01/27 18:21:10 dawes Exp $ +.\" +.TH XDITVIEW 1 __xorgversion__ .SH NAME xditview \- display ditroff output .SH SYNOPSIS @@ -149,7 +152,7 @@ .I xditview will use the closest font from the same family. .SH "SEE ALSO" -.IR X (1), +.IR X (__miscmansuffix__), .IR xrdb (1), .IR ditroff (1), .I "X Logical Font Description Conventions" Index: xc/programs/xdm/Chooser.ad diff -u xc/programs/xdm/Chooser.ad:1.1.1.1 xc/programs/xdm/Chooser.ad:1.2 --- xc/programs/xdm/Chooser.ad:1.1.1.1 Wed Apr 27 03:20:01 1994 +++ xc/programs/xdm/Chooser.ad Thu Apr 5 22:16:25 2001 @@ -1,3 +1,5 @@ +! $XFree86: xc/programs/xdm/Chooser.ad,v 1.2 2001/04/06 02:16:25 dawes Exp $ +! *ShapeStyle: Oval *cursor: left_ptr *allowShellResize: true @@ -18,7 +20,7 @@ <BtnDown>: Set() CheckWilling() \n\ <BtnUp>(2): Accept() *list.defaultColumns: 1 -*list.forceFolumns: true +*list.forceColumns: true *box.skipAdjust: true *cancel.fromHoriz: viewport Index: xc/programs/xdm/Imakefile diff -u xc/programs/xdm/Imakefile:3.38.2.3 xc/programs/xdm/Imakefile:3.43 --- xc/programs/xdm/Imakefile:3.38.2.3 Wed Feb 28 10:59:16 2001 +++ xc/programs/xdm/Imakefile Tue Mar 6 12:31:39 2001 @@ -1,8 +1,10 @@ -XCOMM $TOG: Imakefile /main/83 1997/10/05 20:42:43 kaleb $ -XCOMM -XCOMM -XCOMM -XCOMM $XFree86: xc/programs/xdm/Imakefile,v 3.38.2.3 2001/02/28 15:59:16 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:14 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xdm/Imakefile,v 3.43 2001/03/06 17:31:39 dawes Exp $ + #define IHaveSubdirs #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' @@ -66,6 +68,12 @@ #endif #endif +#if BuildXineramaLibrary +XINERAMA_DEFINES = -DUSE_XINERAMA +XINDEPLIBS = $(DEPXINERAMALIB) +XINLIBS = $(XINERAMALIB) +#endif + XPM_DEFINES = -DXPM /* This is correct for Linux and FreeBSD */ @@ -142,10 +150,11 @@ SUBDIRS = $(GREET_DIR) $(XDMCONFIGDIR) INCLUDES = $(KRB5_INCLUDE) -DEPLIBS = $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) $(DEPXAUTHLIB) $(DEPXDMCPLIB) +DEPLIBS = $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) $(DEPXAUTHLIB) \ + $(DEPXDMCPLIB) $(XINDEPLIBS) LOCAL_LIBRARIES = $(XPMLIB) $(XMULIB) $(XTOOLLIB) $(XLIB) $(XAUTHLIB) \ $(XDMCPLIB) $(RPCLIB) $(PAM_LIBRARIES) $(DLLIBRARY) \ - $(CRYPT_LIBRARIES) $(KRBIVLIB) + $(CRYPT_LIBRARIES) $(KRBIVLIB) $(XINLIBS) SRCS1 = auth.c daemon.c server.c dpylist.c dm.c error.c file.c \ netaddr.c reset.c resource.c protodpy.c policy.c \ @@ -164,8 +173,9 @@ #if BuildChooser SRCS3 = chooser.c OBJS3 = chooser.o - DEPLIBS3 = XawClientDepLibs XkbClientDepLibs $(DEPXDMCPLIB) - LIBS3 = XawClientLibs XkbClientLibs $(XDMCPLIB) + DEPLIBS3 = XawClientDepLibs XkbClientDepLibs $(DEPXDMCPLIB) \ + $(DEPXINERAMALIB) + LIBS3 = XawClientLibs XkbClientLibs $(XDMCPLIB) $(XINERAMALIB) #endif SRCS4 = sessreg.c @@ -202,7 +212,7 @@ -DOSMAJORVERSION=$(OSMAJORVERSION) \ -DOSMINORVERSION=$(OSMINORVERSION) \ $(XKB_CLIENT_DEFINES) $(USER_CONTEXT_DEFINES) \ - $(XPM_DEFINES) + $(XPM_DEFINES) $(XINERAMA_DEFINES) XCOMM XCOMM Special definitions for compiling default resources; these parameters Index: xc/programs/xdm/access.c diff -u xc/programs/xdm/access.c:3.5 xc/programs/xdm/access.c:3.6 --- xc/programs/xdm/access.c:3.5 Sat Oct 10 11:25:30 1998 +++ xc/programs/xdm/access.c Wed Jan 17 18:45:20 2001 @@ -1,5 +1,5 @@ /* - * $TOG: access.c /main/17 1998/02/09 13:54:13 kaleb $ + * $Xorg: access.c,v 1.4 2000/08/17 19:54:14 cpqbld Exp $ * Copyright 1990, 1998 The Open Group @@ -22,7 +22,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/access.c,v 3.5 1998/10/10 15:25:30 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/access.c,v 3.6 2001/01/17 23:45:20 dawes Exp $ */ /* * Access control for XDMCP - keep a database of allowable display addresses @@ -378,7 +378,7 @@ } } prev = &d->hosts; - while ((h = ReadHostEntry (file)) != 0) + while ((h = ReadHostEntry (file))) { if (h->type == HOST_CHOOSER) { @@ -402,7 +402,7 @@ DisplayEntry *d, **prev; prev = &database; - while ((d = ReadDisplayEntry (file)) != 0) + while ((d = ReadDisplayEntry (file))) { *prev = d; prev = &d->next; Index: xc/programs/xdm/auth.c diff -u xc/programs/xdm/auth.c:3.20 xc/programs/xdm/auth.c:3.21 --- xc/programs/xdm/auth.c:3.20 Sun Dec 26 19:40:08 1999 +++ xc/programs/xdm/auth.c Wed Jan 17 18:45:20 2001 @@ -1,4 +1,4 @@ -/* $TOG: auth.c /main/64 1998/02/26 10:02:22 barstow $ */ +/* $Xorg: auth.c,v 1.4 2000/08/17 19:54:14 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/auth.c,v 3.20 1999/12/27 00:40:08 robin Exp $ */ +/* $XFree86: xc/programs/xdm/auth.c,v 3.21 2001/01/17 23:45:20 dawes Exp $ */ /* * xdm - display manager daemon @@ -1192,7 +1192,7 @@ if (fstat (fileno (old), &statb) != -1) chmod (new_name, (int) (statb.st_mode & 0777)); /*SUPPRESS 560*/ - while ((entry = XauReadAuth (old)) != 0) { + while ((entry = XauReadAuth (old))) { if (!checkEntry (entry)) { Debug ("Writing an entry\n"); @@ -1273,7 +1273,7 @@ if (fstat (fileno (old), &statb) != -1) chmod (new_name, (int) (statb.st_mode & 0777)); /*SUPPRESS 560*/ - while ((entry = XauReadAuth (old)) != 0) { + while ((entry = XauReadAuth (old))) { if (!checkEntry (entry)) { Debug ("Writing an entry\n"); Index: xc/programs/xdm/choose.c diff -u xc/programs/xdm/choose.c:3.10 xc/programs/xdm/choose.c:3.11 --- xc/programs/xdm/choose.c:3.10 Mon Nov 27 12:45:57 2000 +++ xc/programs/xdm/choose.c Wed Jan 17 18:45:20 2001 @@ -1,5 +1,5 @@ /* - * $TOG: choose.c /main/18 1998/02/09 13:54:39 kaleb $ + * $Xorg: choose.c,v 1.4 2000/08/17 19:54:14 cpqbld Exp $ * Copyright 1990, 1998 The Open Group @@ -22,7 +22,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/choose.c,v 3.10 2000/11/27 17:45:57 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/choose.c,v 3.11 2001/01/17 23:45:20 dawes Exp $ */ /* * choose.c Index: xc/programs/xdm/chooser.c diff -u xc/programs/xdm/chooser.c:3.20 xc/programs/xdm/chooser.c:3.22 --- xc/programs/xdm/chooser.c:3.20 Thu Jun 15 16:50:04 2000 +++ xc/programs/xdm/chooser.c Tue Mar 6 12:31:39 2001 @@ -1,5 +1,5 @@ /* - * $TOG: chooser.c /main/28 1998/02/09 13:54:31 kaleb $ + * $Xorg: chooser.c,v 1.3 2000/08/17 19:54:14 cpqbld Exp $ * Copyright 1990, 1998 The Open Group @@ -22,7 +22,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/chooser.c,v 3.20 2000/06/15 20:50:04 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/chooser.c,v 3.22 2001/03/06 17:31:39 dawes Exp $ */ /* * Chooser - display a menu of names and let the user select one @@ -66,6 +66,10 @@ #include <stdio.h> #include <ctype.h> +#ifdef USE_XINERAMA +#include <X11/extensions/Xinerama.h> +#endif + #if defined(SVR4) && !defined(SCO325) #include <sys/sockio.h> #endif @@ -1135,7 +1139,12 @@ Arg position[3]; Dimension width, height; Position x, y; +#ifdef USE_XINERAMA + XineramaScreenInfo *screens; + int s_num; +#endif + toplevel = XtInitialize (argv[0], "Chooser", options, XtNumber(options), &argc, argv); XtAddConverter(XtRString, XtRARRAY8, CvtStringToARRAY8, NULL, 0); @@ -1162,8 +1171,23 @@ XtSetArg (position[0], XtNwidth, &width); XtSetArg (position[1], XtNheight, &height); XtGetValues (toplevel, position, (Cardinal) 2); - x = (Position)(WidthOfScreen (XtScreen (toplevel)) - width) / 2; - y = (Position)(HeightOfScreen (XtScreen (toplevel)) - height) / 3; +#ifdef USE_XINERAMA + if ( + XineramaIsActive(XtDisplay(toplevel)) && + (screens = XineramaQueryScreens(XtDisplay(toplevel), &s_num)) != NULL + ) + { + x = (Position)(screens[0].x_org + (screens[0].width - width) / 2); + y = (Position)(screens[0].y_org + (screens[0].height - height) / 3); + + XFree(screens); + } + else +#endif + { + x = (Position)(WidthOfScreen (XtScreen (toplevel)) - width) / 2; + y = (Position)(HeightOfScreen (XtScreen (toplevel)) - height) / 3; + } XtSetArg (position[0], XtNx, x); XtSetArg (position[1], XtNy, y); XtSetValues (toplevel, position, (Cardinal) 2); Index: xc/programs/xdm/daemon.c diff -u xc/programs/xdm/daemon.c:3.12 xc/programs/xdm/daemon.c:3.14 --- xc/programs/xdm/daemon.c:3.12 Tue Nov 14 13:20:39 2000 +++ xc/programs/xdm/daemon.c Thu Apr 26 16:26:30 2001 @@ -1,4 +1,4 @@ -/* $TOG: daemon.c /main/17 1998/02/09 13:54:47 kaleb $ */ +/* $Xorg: daemon.c,v 1.3 2000/08/17 19:54:14 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/daemon.c,v 3.12 2000/11/14 18:20:39 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/daemon.c,v 3.14 2001/04/26 20:26:30 alanh Exp $ */ /* * xdm - display manager daemon @@ -36,7 +36,7 @@ #else #include <sys/ioctl.h> #endif -#if defined(__osf__) || defined(linux) || defined(MINIX) || defined(__GNU__) +#if defined(__osf__) || defined(linux) || defined(MINIX) || defined(__GNU__) || defined(__CYGWIN__) #define setpgrp setpgid #endif #ifdef hpux Index: xc/programs/xdm/dm.c diff -u xc/programs/xdm/dm.c:3.10 xc/programs/xdm/dm.c:3.11 --- xc/programs/xdm/dm.c:3.10 Thu Apr 27 12:26:50 2000 +++ xc/programs/xdm/dm.c Wed Jan 17 18:45:20 2001 @@ -1,4 +1,4 @@ -/* $TOG: dm.c /main/73 1998/04/09 15:12:03 barstow $ */ +/* $Xorg: dm.c,v 1.4 2000/08/17 19:54:14 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/dm.c,v 3.10 2000/04/27 16:26:50 eich Exp $ */ +/* $XFree86: xc/programs/xdm/dm.c,v 3.11 2001/01/17 23:45:20 dawes Exp $ */ /* * xdm - display manager daemon @@ -139,7 +139,7 @@ if (debugLevel == 0 && daemonMode) BecomeDaemon (); /* SUPPRESS 560 */ - if ((oldpid = StorePid ()) != 0) + if ((oldpid = StorePid ())) { if (oldpid == -1) LogError ("Can't create/lock pid file %s\n", pidFile); @@ -447,7 +447,7 @@ if (autoRescan) RescanIfMod (); /* SUPPRESS 560 */ - if ((d = FindDisplayByPid (pid)) != 0) { + if ((d = FindDisplayByPid (pid))) { d->pid = -1; switch (waitVal (status)) { case UNMANAGE_DISPLAY: @@ -524,7 +524,7 @@ } } /* SUPPRESS 560 */ - else if ((d = FindDisplayByServerPid (pid)) != 0) + else if ((d = FindDisplayByServerPid (pid))) { d->serverPid = -1; switch (d->status) Index: xc/programs/xdm/dm.h diff -u xc/programs/xdm/dm.h:3.21 xc/programs/xdm/dm.h:3.23 --- xc/programs/xdm/dm.h:3.21 Tue Nov 14 16:59:25 2000 +++ xc/programs/xdm/dm.h Fri Feb 16 08:24:10 2001 @@ -1,4 +1,4 @@ -/* $TOG: dm.h /main/67 1998/02/09 13:55:01 kaleb $ */ +/* $Xorg: dm.h,v 1.3 2000/08/17 19:54:14 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/dm.h,v 3.21 2000/11/14 21:59:25 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/dm.h,v 3.23 2001/02/16 13:24:10 eich Exp $ */ /* * xdm - display manager daemon @@ -245,8 +245,8 @@ #ifdef XDMCP #define PROTO_TIMEOUT (30 * 60) /* 30 minutes should be long enough */ -#define XDM_BROKEN_INTERVAL (60) /* server crashing more than once a */ - /* minute is assumed to be broken! */ +#define XDM_BROKEN_INTERVAL (120) /* server crashing more than once within */ + /* two minutes is assumed to be broken! */ struct protoDisplay { struct protoDisplay *next; XdmcpNetaddr address; /* UDP address */ Index: xc/programs/xdm/dpylist.c diff -u xc/programs/xdm/dpylist.c:1.3 xc/programs/xdm/dpylist.c:1.4 --- xc/programs/xdm/dpylist.c:1.3 Thu Apr 27 12:26:50 2000 +++ xc/programs/xdm/dpylist.c Wed Jan 17 18:45:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: dpylist.c /main/30 1998/02/09 13:55:07 kaleb $ */ +/* $Xorg: dpylist.c,v 1.3 2000/08/17 19:54:14 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/dpylist.c,v 1.3 2000/04/27 16:26:50 eich Exp $ */ +/* $XFree86: xc/programs/xdm/dpylist.c,v 1.4 2001/01/17 23:45:21 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/error.c diff -u xc/programs/xdm/error.c:1.2 xc/programs/xdm/error.c:1.3 --- xc/programs/xdm/error.c:1.2 Sat Oct 10 11:25:34 1998 +++ xc/programs/xdm/error.c Wed Jan 17 18:45:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: error.c /main/17 1998/02/09 13:55:13 kaleb $ */ +/* $Xorg: error.c,v 1.3 2000/08/17 19:54:14 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/error.c,v 1.2 1998/10/10 15:25:34 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/error.c,v 1.3 2001/01/17 23:45:21 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/file.c diff -u xc/programs/xdm/file.c:1.4 xc/programs/xdm/file.c:1.5 --- xc/programs/xdm/file.c:1.4 Sat Oct 10 11:25:34 1998 +++ xc/programs/xdm/file.c Wed Jan 17 18:45:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: file.c /main/18 1998/02/09 13:55:19 kaleb $ */ +/* $Xorg: file.c,v 1.4 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/file.c,v 1.4 1998/10/10 15:25:34 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/file.c,v 1.5 2001/01/17 23:45:21 dawes Exp $ */ /* * xdm - display manager daemon @@ -117,7 +117,7 @@ n = new; a = args; /* SUPPRESS 560 */ - while ((*n++ = *a++) != 0) + while ((*n++ = *a++)) /* SUPPRESS 530 */ ; return new; Index: xc/programs/xdm/genauth.c diff -u xc/programs/xdm/genauth.c:3.9 xc/programs/xdm/genauth.c:3.11 --- xc/programs/xdm/genauth.c:3.9 Wed May 31 03:15:11 2000 +++ xc/programs/xdm/genauth.c Sat Jan 20 09:11:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: genauth.c /main/24 1998/02/09 13:55:23 kaleb $ */ +/* $Xorg: genauth.c,v 1.4 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/genauth.c,v 3.9 2000/05/31 07:15:11 eich Exp $ */ +/* $XFree86: xc/programs/xdm/genauth.c,v 3.11 2001/01/20 14:11:55 herrb Exp $ */ /* * xdm - display manager daemon @@ -66,10 +66,11 @@ c[3] = l & 0xff; } +#endif # define FILE_LIMIT 1024 /* no more than this many buffers */ -#ifndef ARC4_RANDOM +#if !defined(ARC4_RANDOM) && !defined(DEV_RANDOM) static int sumFile (char *name, long sum[2]) { @@ -107,6 +108,7 @@ } #endif +#ifdef HASXDMAUTH static void InitXdmcpWrapper (void) { @@ -225,8 +227,31 @@ int seed; int value; int i; + static long localkey[2] = {0,0}; - seed = (ldata[0]) + (ldata[1] << 16); + if ( (localkey[0] == 0) && (localkey[1] == 0) ) { +#ifdef ARC4_RANDOM + localkey[0] = arc4random(); + localkey[1] = arc4random(); +#elif defined(DEV_RANDOM) + int fd; + + if ((fd = open(DEV_RANDOM, O_RDONLY)) >= 0) { + if (read(fd, (char *)localkey, 8) != 8) { + localkey[0] = 1; + } + close(fd); + } else { + localkey[0] = 1; + } +#else + if (!sumFile (randomFile, localkey)) { + localkey[0] = 1; /* To keep from continually calling sumFile() */ + } +#endif + } + + seed = (ldata[0]+localkey[0]) + ((ldata[1]+localkey[1]) << 16); xdm_srand (seed); for (i = 0; i < len; i++) { Index: xc/programs/xdm/greet.h diff -u xc/programs/xdm/greet.h:1.6 xc/programs/xdm/greet.h:1.7 --- xc/programs/xdm/greet.h:1.6 Tue Nov 14 16:59:25 2000 +++ xc/programs/xdm/greet.h Wed Jan 17 18:45:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: greet.h /main/5 1998/02/09 13:55:28 kaleb $ */ +/* $Xorg: greet.h,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1994, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greet.h,v 1.6 2000/11/14 21:59:25 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greet.h,v 1.7 2001/01/17 23:45:21 dawes Exp $ */ /* * greet.h - interface to xdm's dynamically-loadable modular greeter Index: xc/programs/xdm/krb5auth.c diff -u xc/programs/xdm/krb5auth.c:1.2 xc/programs/xdm/krb5auth.c:1.3 --- xc/programs/xdm/krb5auth.c:1.2 Sat Oct 10 11:25:35 1998 +++ xc/programs/xdm/krb5auth.c Wed Jan 17 18:45:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: krb5auth.c /main/5 1998/02/09 13:55:32 kaleb $ */ +/* $Xorg: krb5auth.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1994, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/krb5auth.c,v 1.2 1998/10/10 15:25:35 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/krb5auth.c,v 1.3 2001/01/17 23:45:21 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/mitauth.c diff -u xc/programs/xdm/mitauth.c:1.2 xc/programs/xdm/mitauth.c:1.3 --- xc/programs/xdm/mitauth.c:1.2 Sat Oct 10 11:25:36 1998 +++ xc/programs/xdm/mitauth.c Wed Jan 17 18:45:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: mitauth.c /main/13 1998/02/09 13:55:37 kaleb $ */ +/* $Xorg: mitauth.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/mitauth.c,v 1.2 1998/10/10 15:25:36 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/mitauth.c,v 1.3 2001/01/17 23:45:21 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/netaddr.c diff -u xc/programs/xdm/netaddr.c:3.4 xc/programs/xdm/netaddr.c:3.5 --- xc/programs/xdm/netaddr.c:3.4 Sat Oct 10 11:25:36 1998 +++ xc/programs/xdm/netaddr.c Wed Jan 17 18:45:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: netaddr.c /main/9 1998/02/09 13:55:43 kaleb $ */ +/* $Xorg: netaddr.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1991, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/netaddr.c,v 3.4 1998/10/10 15:25:36 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/netaddr.c,v 3.5 2001/01/17 23:45:21 dawes Exp $ */ /* * xdm - X display manager Index: xc/programs/xdm/policy.c diff -u xc/programs/xdm/policy.c:3.4 xc/programs/xdm/policy.c:3.5 --- xc/programs/xdm/policy.c:3.4 Sun Dec 6 01:08:48 1998 +++ xc/programs/xdm/policy.c Wed Jan 17 18:45:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: policy.c /main/13 1998/02/09 13:55:49 kaleb $ */ +/* $Xorg: policy.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -29,7 +29,7 @@ * * policy.c. Implement site-dependent policy for XDMCP connections */ -/* $XFree86: xc/programs/xdm/policy.c,v 3.4 1998/12/06 06:08:48 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/policy.c,v 3.5 2001/01/17 23:45:21 dawes Exp $ */ # include "dm.h" # include "dm_auth.h" Index: xc/programs/xdm/protodpy.c diff -u xc/programs/xdm/protodpy.c:1.2 xc/programs/xdm/protodpy.c:1.3 --- xc/programs/xdm/protodpy.c:1.2 Sat Oct 10 11:25:37 1998 +++ xc/programs/xdm/protodpy.c Wed Jan 17 18:45:21 2001 @@ -1,5 +1,5 @@ /* - * $TOG: protodpy.c /main/16 1998/02/09 13:55:55 kaleb $ + * $Xorg: protodpy.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -21,7 +21,7 @@ * * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/programs/xdm/protodpy.c,v 1.2 1998/10/10 15:25:37 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/protodpy.c,v 1.3 2001/01/17 23:45:21 dawes Exp $ */ /* * protodpy.c Index: xc/programs/xdm/reset.c diff -u xc/programs/xdm/reset.c:1.2 xc/programs/xdm/reset.c:1.3 --- xc/programs/xdm/reset.c:1.2 Sat Oct 10 11:25:37 1998 +++ xc/programs/xdm/reset.c Wed Jan 17 18:45:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: reset.c /main/12 1998/02/09 13:56:00 kaleb $ */ +/* $Xorg: reset.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/reset.c,v 1.2 1998/10/10 15:25:37 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/reset.c,v 1.3 2001/01/17 23:45:21 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/resource.c diff -u xc/programs/xdm/resource.c:3.5 xc/programs/xdm/resource.c:3.6 --- xc/programs/xdm/resource.c:3.5 Sun Dec 6 01:08:49 1998 +++ xc/programs/xdm/resource.c Wed Jan 17 18:45:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: resource.c /main/48 1998/02/09 13:56:04 kaleb $ */ +/* $Xorg: resource.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/resource.c,v 3.5 1998/12/06 06:08:49 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/resource.c,v 3.6 2001/01/17 23:45:21 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/rpcauth.c diff -u xc/programs/xdm/rpcauth.c:1.2 xc/programs/xdm/rpcauth.c:1.3 --- xc/programs/xdm/rpcauth.c:1.2 Sat Oct 10 11:25:38 1998 +++ xc/programs/xdm/rpcauth.c Wed Jan 17 18:45:22 2001 @@ -1,4 +1,4 @@ -/* $TOG: rpcauth.c /main/5 1998/02/09 13:56:09 kaleb $ */ +/* $Xorg: rpcauth.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/rpcauth.c,v 1.2 1998/10/10 15:25:38 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/rpcauth.c,v 1.3 2001/01/17 23:45:22 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/server.c diff -u xc/programs/xdm/server.c:3.8 xc/programs/xdm/server.c:3.9 --- xc/programs/xdm/server.c:3.8 Thu May 11 14:14:42 2000 +++ xc/programs/xdm/server.c Wed Jan 17 18:45:22 2001 @@ -1,4 +1,4 @@ -/* $TOG: server.c /main/21 1998/02/09 13:56:13 kaleb $ */ +/* $Xorg: server.c,v 1.4 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/server.c,v 3.8 2000/05/11 18:14:42 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/server.c,v 3.9 2001/01/17 23:45:22 dawes Exp $ */ /* * xdm - display manager daemon @@ -40,6 +40,7 @@ # include <stdio.h> # include <signal.h> # include <errno.h> +# include <sys/socket.h> #ifdef MINIX #include <sys/ioctl.h> Index: xc/programs/xdm/session.c diff -u xc/programs/xdm/session.c:3.26 xc/programs/xdm/session.c:3.27.2.1 --- xc/programs/xdm/session.c:3.26 Thu Nov 30 18:30:07 2000 +++ xc/programs/xdm/session.c Fri May 25 14:50:13 2001 @@ -1,4 +1,4 @@ -/* $TOG: session.c /main/79 1998/02/09 13:56:17 kaleb $ */ +/* $Xorg: session.c,v 1.7 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/session.c,v 3.26 2000/11/30 23:30:07 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/session.c,v 3.27.2.1 2001/05/25 18:50:13 dawes Exp $ */ /* * xdm - display manager daemon @@ -324,6 +324,12 @@ */ if (StartClient (&verify, d, &clientPid, greet.name, greet.password)) { Debug ("Client Started\n"); + +#ifndef GREET_USER_STATIC + /* Save memory; close library */ + dlclose(greet_lib_handle); +#endif + /* * Wait for session to end, */ @@ -598,6 +604,14 @@ return (0); } #endif /* QNX4 doesn't support multi-groups, no initgroups() */ +#ifdef USE_PAM + if (thepamh()) { + int i; + char **pam_env; + + pam_setcred(thepamh(), PAM_ESTABLISH_CRED); + } +#endif if (setuid(verify->uid) < 0) { LogError("setuid %d (user \"%s\") failed, errno=%d\n", @@ -877,7 +891,7 @@ if (optarg) *av++ = optarg; /* SUPPRESS 560 */ - while ((*av++ = *argv++) != 0) + while ((*av++ = *argv++)) /* SUPPRESS 530 */ ; execve (newargv[0], newargv, environ); Index: xc/programs/xdm/sessreg.c diff -u xc/programs/xdm/sessreg.c:3.15 xc/programs/xdm/sessreg.c:3.16 --- xc/programs/xdm/sessreg.c:3.15 Tue Nov 28 12:25:13 2000 +++ xc/programs/xdm/sessreg.c Wed Jan 17 18:45:22 2001 @@ -1,5 +1,5 @@ /* - * $TOG: sessreg.c /main/19 1998/02/09 13:56:23 kaleb $ + * $Xorg: sessreg.c,v 1.5 2000/08/17 19:54:15 cpqbld Exp $ * * Copyright 1990, 1998 The Open Group * @@ -26,7 +26,7 @@ * by Andreas Stolcke <stolcke@icsi.berkeley.edu> */ -/* $XFree86: xc/programs/xdm/sessreg.c,v 3.15 2000/11/28 17:25:13 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/sessreg.c,v 3.16 2001/01/17 23:45:22 dawes Exp $ */ /* * sessreg @@ -51,7 +51,7 @@ # include <stdio.h> # include <utmp.h> -#if defined(SYSV) || defined(SVR4) || defined(Lynx) || defined(__QNX__) || defined(__DARWIN__) +#if defined(SYSV) || defined(SVR4) || defined(Lynx) || defined(__QNX__) || defined(__DARWIN__) || defined(_SEQUENT_) #define NO_LASTLOG #endif Index: xc/programs/xdm/sessreg.man diff -u xc/programs/xdm/sessreg.man:1.4 xc/programs/xdm/sessreg.man:1.7 --- xc/programs/xdm/sessreg.man:1.4 Sun Oct 4 05:40:57 1998 +++ xc/programs/xdm/sessreg.man Mon Apr 23 16:31:09 2001 @@ -1,4 +1,4 @@ -.\" $TOG: sessreg.man /main/17 1998/02/09 13:56:27 kaleb $ +.\" $Xorg: sessreg.man,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ .\" Copyright 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH SESSREG 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xdm/sessreg.man,v 1.7 2001/04/23 20:31:09 dawes Exp $ +.\" +.TH SESSREG 1 __xorgversion__ .SH NAME sessreg \- manage utmp/wtmp entries for non-init clients .SH SYNOPSIS @@ -58,8 +61,8 @@ \fIsessreg\fP accepts the BSD-specific flags in the System V environment and ignores them. .PP -BSD also has a host-name field in the utmp file which doesn't exist in -System V. This option is also ignored by the System V version of +BSD and Linux also have a host-name field in the utmp file which doesn't +exist in System V. This option is also ignored by the System V version of \fIsessreg\fP. .SH USAGE .PP Index: xc/programs/xdm/socket.c diff -u xc/programs/xdm/socket.c:3.6 xc/programs/xdm/socket.c:3.7 --- xc/programs/xdm/socket.c:3.6 Thu May 11 14:14:43 2000 +++ xc/programs/xdm/socket.c Wed Jan 17 18:45:22 2001 @@ -1,4 +1,4 @@ -/* $TOG: socket.c /main/37 1998/02/09 13:56:31 kaleb $ */ +/* $Xorg: socket.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/socket.c,v 3.6 2000/05/11 18:14:43 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/socket.c,v 3.7 2001/01/17 23:45:22 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/streams.c diff -u xc/programs/xdm/streams.c:3.4 xc/programs/xdm/streams.c:3.5 --- xc/programs/xdm/streams.c:3.4 Sun Dec 6 01:08:49 1998 +++ xc/programs/xdm/streams.c Wed Jan 17 18:45:22 2001 @@ -1,4 +1,4 @@ -/* $TOG: streams.c /main/6 1998/02/09 13:56:36 kaleb $ */ +/* $Xorg: streams.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/streams.c,v 3.4 1998/12/06 06:08:49 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/streams.c,v 3.5 2001/01/17 23:45:22 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/util.c diff -u xc/programs/xdm/util.c:3.15.2.1 xc/programs/xdm/util.c:3.17 --- xc/programs/xdm/util.c:3.15.2.1 Wed Feb 28 10:59:16 2001 +++ xc/programs/xdm/util.c Wed Feb 28 13:58:54 2001 @@ -1,4 +1,4 @@ -/* $TOG: util.c /main/19 1998/02/09 13:56:40 kaleb $ */ +/* $Xorg: util.c,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/util.c,v 3.15.2.1 2001/02/28 15:59:16 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/util.c,v 3.17 2001/02/28 18:58:54 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/xdm.man diff -u xc/programs/xdm/xdm.man:3.14 xc/programs/xdm/xdm.man:3.20 --- xc/programs/xdm/xdm.man:3.14 Tue Jun 13 20:16:14 2000 +++ xc/programs/xdm/xdm.man Mon Apr 23 16:31:09 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xdm.man /main/46 1998/02/09 13:56:58 kaleb $ +.\" $Xorg: xdm.man,v 1.3 2000/08/17 19:54:15 cpqbld Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -19,9 +19,9 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xdm/xdm.man,v 3.14 2000/06/14 00:16:14 dawes Exp $ +.\" $XFree86: xc/programs/xdm/xdm.man,v 3.20 2001/04/23 20:31:09 dawes Exp $ .\" -.TH XDM 1 "Release 6.4" "X Version 11" +.TH XDM 1 __xorgversion__ .SH NAME xdm \- X Display Manager with support for XDMCP, host chooser .SH SYNOPSIS @@ -657,13 +657,13 @@ .LP .ta 2i 4i .nf -# -# Xaccess \- XDMCP access control file -# - -# -# Direct/Broadcast query entries -# +XCOMM +XCOMM Xaccess \- XDMCP access control file +XCOMM + +XCOMM +XCOMM Direct/Broadcast query entries +XCOMM !xtra.lcs.mit.edu # disallow direct/broadcast service for xtra bambi.ogi.edu # allow access from this particular display @@ -672,9 +672,9 @@ *.deshaw.com NOBROADCAST # allow only direct access *.gw.com # allow direct and broadcast -# -# Indirect query entries -# +XCOMM +XCOMM Indirect query entries +XCOMM %HOSTS expo.lcs.mit.edu xenon.lcs.mit.edu \\ excess.lcs.mit.edu kanga.lcs.mit.edu @@ -721,15 +721,6 @@ \fIxdm\fP remembers the user's choice (for \fBDisplayManager.choiceTimeout\fP seconds) and forwards the request to the chosen host, which starts a session on that display. - -When the user selects a host, \fIchooser\fP prints the host chosen, -which is read by the parent \fIxdm\fP, and exits. -\fIxdm\fP closes its connection to the X server, and the server resets -and sends another \fBIndirect\fP XDMCP request. -\fIxdm\fP remembers the user's choice (for -\fBDisplayManager.choiceTimeout\fP seconds) and forwards the request -to the chosen host, which starts a session on that display. - .\" .SH "LOCAL SERVER SPECIFICATION" .PP @@ -802,17 +793,17 @@ <Key>Return: set-session-argument() finish-field() xlogin*borderWidth: 3 xlogin*greeting: CLIENTHOST - #ifdef COLOR +\& #ifdef COLOR xlogin*greetColor: CadetBlue xlogin*failColor: red - #endif +\& #endif .fi .PP Please note the translations entry; it specifies a few new translations for the widget which allow users to escape from the default session (and avoid troubles that may occur in it). Note that if -#override is not specified, the default translations are removed and replaced +\&#override is not specified, the default translations are removed and replaced by the new value, not a very useful result as some of the default translations are quite useful (such as ``<Key>: insert-char ()'' which responds to normal typing). @@ -850,8 +841,8 @@ Here is a sample \fIXsetup\fP script: .nf - #!/bin/sh - # Xsetup_0 \- setup script for one workstation +\& #!/bin/sh +\& # Xsetup_0 \- setup script for one workstation xcmsdb < /usr/X11R6/lib/monitors/alex.0 xconsole\0\-geometry\0480x130\-0\-0\0\-notify\0\-verbose\0\-exitOnFail & @@ -1039,12 +1030,12 @@ .nf .ta .5i 1i - #!/bin/sh - # - # Xstartup - # - # This program is run as root after the user is verified - # +\& #!/bin/sh +\& # +\& # Xstartup +\& # +\& # This program is run as root after the user is verified +\& # if [ \-f /etc/nologin ]; then xmessage\0\-file /etc/nologin\0\-timeout 30\0\-center exit 1 @@ -1100,12 +1091,12 @@ .nf .ta .5i 1i 1.5i - #!/bin/sh - # - # Xsession - # - # This is the program that is run as the client - # for the display manager. +\& #!/bin/sh +\& # +\& # Xsession +\& # +\& # This is the program that is run as the client +\& # for the display manager. case $# in 1) @@ -1135,8 +1126,8 @@ The user's \fI.xsession\fP file might look something like this example. Don't forget that the file must have execute permission. .nf - #! /bin/csh - # no \-f in the previous line so .cshrc gets run to set $PATH +\& #! /bin/csh +\& # no \-f in the previous line so .cshrc gets run to set $PATH twm & xrdb \-merge "$HOME/.Xresources" emacs \-geometry +0+50 & @@ -1157,12 +1148,12 @@ A sample \fIXreset\fP script: .nf .ta .5i 1i - #!/bin/sh - # - # Xreset - # - # This program is run as root after the session ends - # +\& #!/bin/sh +\& # +\& # Xreset +\& # +\& # This program is run as root after the session ends +\& # sessreg\0\-d\0\-l $DISPLAY\0\-x /usr/X11R6/lib/xdm/Xservers $LOGNAME /usr/X11R6/lib/xdm/TakeConsole exit 0 @@ -1293,10 +1284,10 @@ .LP Note: <XRoot> refers to the root of the X11 install tree. .SH "SEE ALSO" -.IR X (1), +.IR X (__miscmansuffix__), .IR xinit (1), .IR xauth (1), -.IR Xsecurity (1), +.IR Xsecurity (__miscmansuffix__), .IR sessreg (1), .IR Xserver (1), .\" .IR chooser (1), \" except that there isn't a manual for it yet Index: xc/programs/xdm/xdmauth.c diff -u xc/programs/xdm/xdmauth.c:1.3 xc/programs/xdm/xdmauth.c:1.4 --- xc/programs/xdm/xdmauth.c:1.3 Wed Jun 7 18:03:16 2000 +++ xc/programs/xdm/xdmauth.c Wed Jan 17 18:45:22 2001 @@ -1,4 +1,4 @@ -/* $TOG: xdmauth.c /main/14 1998/02/09 13:56:44 kaleb $ */ +/* $Xorg: xdmauth.c,v 1.3 2000/08/17 19:54:16 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/xdmauth.c,v 1.3 2000/06/07 22:03:16 tsi Exp $ */ +/* $XFree86: xc/programs/xdm/xdmauth.c,v 1.4 2001/01/17 23:45:22 dawes Exp $ */ /* * xdm - display manager daemon * Author: Keith Packard, MIT X Consortium Index: xc/programs/xdm/xdmcp.c diff -u xc/programs/xdm/xdmcp.c:3.11.2.2 xc/programs/xdm/xdmcp.c:3.14 --- xc/programs/xdm/xdmcp.c:3.11.2.2 Mon Feb 26 18:04:05 2001 +++ xc/programs/xdm/xdmcp.c Mon Feb 26 18:04:22 2001 @@ -1,4 +1,4 @@ -/* $TOG: xdmcp.c /main/18 1998/06/04 11:50:41 barstow $ */ +/* $Xorg: xdmcp.c,v 1.3 2000/08/17 19:54:16 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.11.2.2 2001/02/26 23:04:05 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/xdmcp.c,v 3.14 2001/02/26 23:04:22 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/xdmshell.c diff -u xc/programs/xdm/xdmshell.c:3.4 xc/programs/xdm/xdmshell.c:3.5 --- xc/programs/xdm/xdmshell.c:3.4 Sat Oct 10 11:25:40 1998 +++ xc/programs/xdm/xdmshell.c Wed Jan 17 18:45:23 2001 @@ -1,4 +1,4 @@ -/* $TOG: xdmshell.c /main/17 1998/02/09 13:56:54 kaleb $ */ +/* $Xorg: xdmshell.c,v 1.3 2000/08/17 19:54:16 cpqbld Exp $ */ /* * xdmshell - simple program for running xdm from login * @@ -32,7 +32,7 @@ * bring down X when you are finished. */ -/* $XFree86: xc/programs/xdm/xdmshell.c,v 3.4 1998/10/10 15:25:40 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/xdmshell.c,v 3.5 2001/01/17 23:45:23 dawes Exp $ */ #include <stdio.h> #include "dm.h" Index: xc/programs/xdm/config/GiveConsole diff -u xc/programs/xdm/config/GiveConsole:1.1.1.1 xc/programs/xdm/config/GiveConsole:1.1.1.2 --- xc/programs/xdm/config/GiveConsole:1.1.1.1 Wed Apr 27 03:20:02 1994 +++ xc/programs/xdm/config/GiveConsole Tue Jan 16 17:48:49 2001 @@ -1,6 +1,6 @@ #!/bin/sh # Assign ownership of the console to the invoking user -# $XConsortium: GiveConsole,v 1.2 93/09/28 14:29:20 gildea Exp $ +# $Xorg: GiveConsole,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ # # By convention, both xconsole and xterm -C check that the # console is owned by the invoking user and is readable before attaching Index: xc/programs/xdm/config/Imakefile diff -u xc/programs/xdm/config/Imakefile:1.7 xc/programs/xdm/config/Imakefile:1.8 --- xc/programs/xdm/config/Imakefile:1.7 Mon Jan 31 14:33:43 2000 +++ xc/programs/xdm/config/Imakefile Wed Jan 17 18:45:24 2001 @@ -1,6 +1,10 @@ -XCOMM $XConsortium: Imakefile /main/17 1996/01/15 12:19:32 gildea $ -XCOMM $XFree86: xc/programs/xdm/config/Imakefile,v 1.7 2000/01/31 19:33:43 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.4 2000/08/17 19:54:17 cpqbld Exp $ + + + +XCOMM $XFree86: xc/programs/xdm/config/Imakefile,v 1.8 2001/01/17 23:45:24 dawes Exp $ + SERVERSTYPE = XdmServersType all:: Xservers.ws xdm-config Xservers Xresources @@ -59,3 +63,25 @@ InstallNonExecFileNoClobber(XdmPixmap,$(XDMDIR)/pixmaps) InstallNonExecFileNoClobber(XdmbwPixmap,$(XDMDIR)/pixmaps) #endif + +#ifdef SequentArchitecture + +CppFileTarget(windows.sh,windows.sh.cpp,"-DBINDIR=$(BINDIR)" "-DXDMDIR=$(XDMDIR)",NullParameter) + +InstallNamedProg(windows.sh,windows,/etc/init.d) +InstallNamedProg(system.xsession.sequent,.xsession,$(ADMINBASEDIR)) +InstallNamedNonExec(system.Xdefaults.sequent,.Xresources,$(ADMINBASEDIR)) +InstallNamedNonExec(system.Xdefaults.sequent,system.Xdefaults,$(LIBDIR)) + +/* force a hard link from S81windows to windows */ + +MakeDirectories(install,/etc/rc2.d) +install:: + $(RM) $(DESTDIR)/etc/rc2.d/S81windows + ln $(DESTDIR)/etc/init.d/windows $(DESTDIR)/etc/rc2.d/S81windows + AddToPrototype f /etc/rc2.d/S81windows 0555 bin bin + +clean:: + $(RM) windows.sh + +#endif /* SequentArchitecture */ Index: xc/programs/xdm/config/README diff -u xc/programs/xdm/config/README:1.1.1.1 xc/programs/xdm/config/README:1.1.1.2 --- xc/programs/xdm/config/README:1.1.1.1 Wed Apr 27 03:20:02 1994 +++ xc/programs/xdm/config/README Tue Jan 16 17:48:52 2001 @@ -1,4 +1,4 @@ -$XConsortium: README,v 1.3 93/09/28 14:30:28 gildea Exp $ +$Xorg: README,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ Xdm Sample Configuration Index: xc/programs/xdm/config/TakeConsole diff -u xc/programs/xdm/config/TakeConsole:1.1.1.1 xc/programs/xdm/config/TakeConsole:1.1.1.2 --- xc/programs/xdm/config/TakeConsole:1.1.1.1 Wed Apr 27 03:20:03 1994 +++ xc/programs/xdm/config/TakeConsole Tue Jan 16 17:48:53 2001 @@ -1,7 +1,7 @@ #!/bin/sh # Reassign ownership of the console to root, this should disallow # assignment of console output to any random users's xterm -# $XConsortium: TakeConsole,v 1.2 93/09/28 14:30:29 gildea Exp $ +# $Xorg: TakeConsole,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ # chmod 622 /dev/console chown root /dev/console Index: xc/programs/xdm/config/Xaccess diff -u xc/programs/xdm/config/Xaccess:1.2 xc/programs/xdm/config/Xaccess:1.3 --- xc/programs/xdm/config/Xaccess:1.2 Sun Nov 26 19:10:06 2000 +++ xc/programs/xdm/config/Xaccess Wed Jan 17 18:45:24 2001 @@ -1,6 +1,6 @@ -# $XConsortium: Xaccess,v 1.5 91/08/26 11:52:51 rws Exp $ +# $Xorg: Xaccess,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ # -# $XFree86: xc/programs/xdm/config/Xaccess,v 1.2 2000/11/27 00:10:06 dawes Exp $ +# $XFree86: xc/programs/xdm/config/Xaccess,v 1.3 2001/01/17 23:45:24 dawes Exp $ # # Access control file for XDMCP connections # Index: xc/programs/xdm/config/Xres.cpp diff -u xc/programs/xdm/config/Xres.cpp:1.3 xc/programs/xdm/config/Xres.cpp:1.4 --- xc/programs/xdm/config/Xres.cpp:1.3 Mon Nov 27 00:06:46 2000 +++ xc/programs/xdm/config/Xres.cpp Mon Jan 22 17:32:34 2001 @@ -1,5 +1,10 @@ -! $XConsortium: Xresources /main/8 1996/11/11 09:24:46 swick $ -! $XFree86: xc/programs/xdm/config/Xres.cpp,v 1.3 2000/11/27 05:06:46 dawes Exp $ +! $Xorg: Xresources,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ +! +! +! +! +! $XFree86: xc/programs/xdm/config/Xres.cpp,v 1.4 2001/01/22 22:32:34 dawes Exp $ +! #define BS \ /* cpp can be trickier than m4 */ #define NLBS \n\ /* don't remove these comments */ xlogin*login.translations: #override BS Index: xc/programs/xdm/config/Xserv.ws.cpp diff -u xc/programs/xdm/config/Xserv.ws.cpp:1.2 xc/programs/xdm/config/Xserv.ws.cpp:1.3 --- xc/programs/xdm/config/Xserv.ws.cpp:1.2 Fri Jan 23 20:53:27 1998 +++ xc/programs/xdm/config/Xserv.ws.cpp Wed Jan 17 18:45:24 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Xserv.ws.cpp,v 1.3 93/09/28 14:30:30 gildea Exp $ +XCOMM $Xorg: Xserv.ws.cpp,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ XCOMM XCOMM Xservers file, workstation prototype XCOMM Index: xc/programs/xdm/config/Xservers.fs diff -u xc/programs/xdm/config/Xservers.fs:1.1.1.1 xc/programs/xdm/config/Xservers.fs:1.1.1.2 --- xc/programs/xdm/config/Xservers.fs:1.1.1.1 Wed Apr 27 03:20:02 1994 +++ xc/programs/xdm/config/Xservers.fs Tue Jan 16 17:48:59 2001 @@ -1,4 +1,4 @@ -# $XConsortium: Xservers.fs,v 1.3 93/09/28 14:30:31 gildea Exp $ +# $Xorg: Xservers.fs,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ # # Xservers file, fileserver prototype (any machine without a display) # Index: xc/programs/xdm/config/Xsession diff -u xc/programs/xdm/config/Xsession:1.2 xc/programs/xdm/config/Xsession:1.3 --- xc/programs/xdm/config/Xsession:1.2 Sat Jan 10 22:48:32 1998 +++ xc/programs/xdm/config/Xsession Wed Jan 17 18:45:24 2001 @@ -1,8 +1,11 @@ #!/bin/sh -# $XConsortium: Xsession /main/10 1995/12/18 18:21:28 gildea $ # +# $Xorg: Xsession,v 1.4 2000/08/17 19:54:17 cpqbld Exp $ # -# $XFree86: xc/programs/xdm/config/Xsession,v 1.2 1998/01/11 03:48:32 dawes Exp $ +# +# +# +# $XFree86: xc/programs/xdm/config/Xsession,v 1.3 2001/01/17 23:45:24 dawes Exp $ # redirect errors to a file in user's home directory if we can for errfile in "$HOME/.xsession-errors" "${TMPDIR-/tmp}/xses-$USER" "/tmp/xses-$USER" @@ -24,11 +27,17 @@ esac esac +# The startup script is not intended to have arguments. + startup=$HOME/.xsession resources=$HOME/.Xresources -if [ -s "$startup" -a -x "$startup" ]; then - exec "$startup" +if [ -s "$startup" ]; then + if [ -x "$startup" ]; then + exec "$startup" + else + exec /bin/sh "$startup" + fi else if [ -r "$resources" ]; then xrdb -load "$resources" Index: xc/programs/xdm/config/Xsetup_0 diff -u xc/programs/xdm/config/Xsetup_0:1.1.1.1 xc/programs/xdm/config/Xsetup_0:1.1.1.2 --- xc/programs/xdm/config/Xsetup_0:1.1.1.1 Wed Apr 27 03:20:03 1994 +++ xc/programs/xdm/config/Xsetup_0 Tue Jan 16 17:49:04 2001 @@ -1,3 +1,3 @@ #!/bin/sh -# $XConsortium: Xsetup_0,v 1.3 93/09/28 14:30:31 gildea Exp $ +# $Xorg: Xsetup_0,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed -exitOnFail Index: xc/programs/xdm/config/system.Xdefaults.sequent diff -u /dev/null xc/programs/xdm/config/system.Xdefaults.sequent:1.1.1.1 --- /dev/null Mon Jun 4 12:42:53 2001 +++ xc/programs/xdm/config/system.Xdefaults.sequent Tue Jan 16 17:49:05 2001 @@ -0,0 +1,52 @@ +! +! Sequent Computer Systems default system and user .Xresources file. +! This file is stored in two locations. +! +! Sequent Computer Systems default system X resources file. +! /usr/lib/X11/system.Xdefaults +! +! Sequent Computer Systems default user X resources file. +! (Replaces previous name of $HOME/.Xdefaults file.) +! $HOME/.Xresources +! +! The user can edit the file below to personalize their X resources. +! +! Typically the user $HOME/.xsession will invoke xrdb to load +! the first file found in the following list. +! If the user $HOME/.xsession does not exist, then the generic +! Sequent xdm default /usr/lib/X11/xdm/Xsession will load +! the first file found in the following list. +! +! $HOME/.Xresources User's personalized defaults +! $HOME/.Xdefaults (obsolete previous filename) +! /usr/lib/X11/system.Xdefaults Sequent system defaults +! + +! +! Defaults for all clients +! +! Increase multiClickTime from the standard 200ms to 500ms to +! allow the user enough time to complete a double click. +*multiClickTime: 500 + +! +! xbiff - electronic mail arrival notification (the little mailbox) +! +XBiff*update: 60 +XBiff*onceOnly: on +XBiff*volume: 0 + +! +! xterm - a terminal emulation window +! +XTerm*reverseWrap: on +XTerm*scrollBar: on +XTerm*saveLines: 300 + +! +! mwm - the Motif Window Manager +! +#if (defined(COLOR)) +Mwm*menu*background: cadetBlue +Mwm*XmMessageBox*background: cadetBlue +#endif Index: xc/programs/xdm/config/system.xsession.sequent diff -u /dev/null xc/programs/xdm/config/system.xsession.sequent:1.1.1.1 --- /dev/null Mon Jun 4 12:42:53 2001 +++ xc/programs/xdm/config/system.xsession.sequent Tue Jan 16 17:49:05 2001 @@ -0,0 +1,78 @@ +#!/bin/sh +# +# SEQUENT DEFAULT user $HOME/.xsession script. +# +# The user can customize this file to personalize their initial login session. +# +# Add a line between "Start of User Applications" and "End of User Applications" +# below for each application you want to start up automatically each time +# you login. For all applications except 'xrdb', you should end the +# line with "&" so the application will run "in the background", allowing +# this .xsession script to continue on to the next application. +# +# A special note: +# Don't add a "&" to the final line in this file ("mwm"), +# since it should not be run in the background. +# When you eventually exit your 'mwm' via the Root Menu "Quit" menu item, +# that will cause this .xsession script to exit and automatically log you out. +# +# Make sure the PATH contains all of the directories needed to locate +# the initial applications started in this .xsession script. + +PATH=/bin:/usr/bin:/usr/bin/X11 +export PATH + +if test `basename $SHELL` = ksh +then +ENV=$HOME/.kshrc +export ENV +fi + +# ________________________ Load the User X Resources _____________________ +# +# Use 'xrdb' to load the X server (desktop) resource database. + +if [ -f $HOME/.Xresources ] + then + xrdb -retain -load $HOME/.Xresources + else + if [ -f $HOME/.Xdefaults ] + then + xrdb -retain -load $HOME/.Xdefaults + else + xrdb -retain -load /usr/lib/X11/system.Xdefaults + fi +fi + +# ________________________ Start of User Applications ____________________ +# +# Note that the commands started in the background are run in a subshell +# (denoted by surrounding parenthesis). If not run in a subshell, a +# background process will become a child of the program exec'ed at the end +# of this file. When such a child dies it may become a zombie (remain +# a defunct process). +# +# start 'xbiff' for electronic mail arrival notification +# start 'xclock' for a display of the time. +# start two 'xterm' windows, one in the upper right and one below that. + +# 'sleep 1' is added to avoid all X11 programs running in parallel +# attempting to connect to the desktop X server at the same time. + +(xbiff -display $DISPLAY -geometry +0+140 &) +sleep 1 +(xclock -display $DISPLAY -geometry 100x100+0+0 &) +sleep 1 +(xterm -display $DISPLAY -geometry 80x24-5+5 &) +sleep 1 +(xterm -display $DISPLAY -geometry 80x24-5+375 &) +sleep 1 + +# _________________________ End of User Applications _____________________ +# +# Finally, start the Motif window manager ('mwm'). Again note that this +# line should not end with "&". This way this user session will continue +# until the user selects the 'mwm' Root Menu item "Quit" which will +# cause 'mwm' to exit, and then this .xsession script will exit thereby +# terminating this xdm user session. +exec mwm Index: xc/programs/xdm/config/xdm-conf.cpp diff -u xc/programs/xdm/config/xdm-conf.cpp:1.6 xc/programs/xdm/config/xdm-conf.cpp:1.7 --- xc/programs/xdm/config/xdm-conf.cpp:1.6 Mon Jan 31 14:33:43 2000 +++ xc/programs/xdm/config/xdm-conf.cpp Wed Jan 17 18:45:24 2001 @@ -1,5 +1,10 @@ -! $XConsortium: xdm-conf.cpp /main/3 1996/01/15 15:17:26 gildea $ -! $XFree86: xc/programs/xdm/config/xdm-conf.cpp,v 1.6 2000/01/31 19:33:43 dawes Exp $ +! $Xorg: xdm-conf.cpp,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ +! +! +! +! +! $XFree86: xc/programs/xdm/config/xdm-conf.cpp,v 1.7 2001/01/17 23:45:24 dawes Exp $ +! DisplayManager.errorLogFile: XDMLOGDIR/xdm-errors DisplayManager.pidFile: XDMPIDDIR/xdm-pid DisplayManager.keyFile: XDMDIR/xdm-keys Index: xc/programs/xdm/greeter/Imakefile diff -u xc/programs/xdm/greeter/Imakefile:1.4 xc/programs/xdm/greeter/Imakefile:1.6 --- xc/programs/xdm/greeter/Imakefile:1.4 Tue Jun 13 20:16:15 2000 +++ xc/programs/xdm/greeter/Imakefile Thu Mar 29 21:15:24 2001 @@ -1,10 +1,10 @@ -XCOMM $XConsortium: Imakefile /main/7 1996/09/28 17:17:38 rws $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ +XCOMM $XFree86: xc/programs/xdm/greeter/Imakefile,v 1.6 2001/03/30 02:15:24 keithp Exp $ -XCOMM $XFree86: xc/programs/xdm/greeter/Imakefile,v 1.4 2000/06/14 00:16:15 dawes Exp $ #define DoNormalLib NO #define DoSharedLib YES #define DoDebugLib NO @@ -14,6 +14,10 @@ SOXDMGREETREV = 1.0 #define SoRev SOXDMGREETREV +#if UseXKBInClients +XKB_CLIENT_DEFINES = XkbClientDefines +#endif + #if HasXdmAuth XDMAUTH_DEFINES = -DHASXDMAUTH #endif @@ -75,7 +79,8 @@ INCLUDES = -I.. $(KRBIV_INCLUDES) $(KRB5_INCLUDE) DEFINES = $(GREETER_DEFINES) $(XDMAUTH_DEFINES) $(RPC_DEFINES) \ - $(KRBIV_DEFINES) $(KRB5_DEFINES) $(PWD_DEFINES) $(PAM_DEFINES) + $(KRBIV_DEFINES) $(KRB5_DEFINES) $(PWD_DEFINES) $(PAM_DEFINES) \ + $(XKB_CLIENT_DEFINES) SHLIBDIR = $(XDMDIR) Index: xc/programs/xdm/greeter/Login.c diff -u xc/programs/xdm/greeter/Login.c:3.11 xc/programs/xdm/greeter/Login.c:3.13 --- xc/programs/xdm/greeter/Login.c:3.11 Tue Sep 19 08:46:23 2000 +++ xc/programs/xdm/greeter/Login.c Tue Mar 6 12:31:39 2001 @@ -1,4 +1,4 @@ -/* $TOG: Login.c /main/43 1998/02/11 10:00:37 kaleb $ */ +/* $Xorg: Login.c,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/Login.c,v 3.11 2000/09/19 12:46:23 eich Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/Login.c,v 3.13 2001/03/06 17:31:39 dawes Exp $ */ /* * xdm - display manager daemon @@ -56,6 +56,10 @@ #include <X11/cursorfont.h> #endif /* XPM */ +#ifdef USE_XINERAMA +#include <X11/extensions/Xinerama.h> +#endif + static void RedrawFail (LoginWidget w); static void ResetLogin (LoginWidget w); static void failTimeout (XtPointer client_data, XtIntervalId * id); @@ -1014,6 +1018,10 @@ XGCValues myXGCV; Arg position[2]; Position x, y; +#ifdef USE_XINERAMA + XineramaScreenInfo *screens; + int s_num; +#endif #ifdef XPM myXGCV.foreground = w->login.hipixel; @@ -1151,11 +1159,28 @@ (w->login.logoHeight + (2*w->login.logoPadding)) + pady); #endif /* XPM */ + } +#ifdef USE_XINERAMA + if ( + XineramaIsActive(XtDisplay(w)) && + (screens = XineramaQueryScreens(XtDisplay(w), &s_num)) != NULL + ) + { + if ((x = w->core.x) == -1) + x = screens[0].x_org + (int)(screens[0].width - w->core.width) / 2; + if ((y = w->core.y) == -1) + y = screens[0].y_org + (int)(screens[0].height - w->core.height) / 3; + + XFree(screens); + } + else +#endif + { + if ((x = w->core.x) == -1) + x = (int)(XWidthOfScreen (XtScreen (w)) - w->core.width) / 2; + if ((y = w->core.y) == -1) + y = (int)(XHeightOfScreen (XtScreen (w)) - w->core.height) / 3; } - if ((x = w->core.x) == -1) - x = (int)(XWidthOfScreen (XtScreen (w)) - w->core.width) / 2; - if ((y = w->core.y) == -1) - y = (int)(XHeightOfScreen (XtScreen (w)) - w->core.height) / 3; XtSetArg (position[0], XtNx, x); XtSetArg (position[1], XtNy, y); XtSetValues (XtParent (w), position, (Cardinal) 2); Index: xc/programs/xdm/greeter/Login.h diff -u xc/programs/xdm/greeter/Login.h:3.4 xc/programs/xdm/greeter/Login.h:3.5 --- xc/programs/xdm/greeter/Login.h:3.4 Tue Jun 13 20:16:15 2000 +++ xc/programs/xdm/greeter/Login.h Wed Jan 17 18:45:25 2001 @@ -1,4 +1,4 @@ -/* $TOG: Login.h /main/10 1998/02/11 10:00:41 kaleb $ */ +/* $Xorg: Login.h,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/Login.h,v 3.4 2000/06/14 00:16:15 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/Login.h,v 3.5 2001/01/17 23:45:25 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/greeter/LoginP.h diff -u xc/programs/xdm/greeter/LoginP.h:3.6 xc/programs/xdm/greeter/LoginP.h:3.7 --- xc/programs/xdm/greeter/LoginP.h:3.6 Tue Jun 13 20:16:15 2000 +++ xc/programs/xdm/greeter/LoginP.h Wed Jan 17 18:45:25 2001 @@ -1,4 +1,4 @@ -/* $TOG: LoginP.h /main/8 1998/02/11 10:00:33 kaleb $ */ +/* $Xorg: LoginP.h,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/LoginP.h,v 3.6 2000/06/14 00:16:15 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/LoginP.h,v 3.7 2001/01/17 23:45:25 dawes Exp $ */ /* * xdm - display manager daemon Index: xc/programs/xdm/greeter/greet.c diff -u xc/programs/xdm/greeter/greet.c:3.9 xc/programs/xdm/greeter/greet.c:3.13 --- xc/programs/xdm/greeter/greet.c:3.9 Thu Nov 30 19:24:36 2000 +++ xc/programs/xdm/greeter/greet.c Fri May 11 05:03:07 2001 @@ -1,4 +1,4 @@ -/* $TOG: greet.c /main/44 1998/02/11 10:00:26 kaleb $ */ +/* $Xorg: greet.c,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/greet.c,v 3.9 2000/12/01 00:24:36 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/greet.c,v 3.13 2001/05/11 09:03:07 alanh Exp $ */ /* * xdm - display manager daemon @@ -37,6 +37,10 @@ #include <X11/Shell.h> #include <X11/XKBlib.h> +#ifdef USE_XINERAMA +#include <X11/extensions/Xinerama.h> +#endif + #include "dm.h" #include "dm_error.h" #include "greet.h" @@ -165,6 +169,10 @@ Screen *scrn; static char *argv[] = { "xlogin", 0 }; Display *dpy; +#ifdef USE_XINERAMA + XineramaScreenInfo *screens; + int s_num; +#endif Debug ("greet %s\n", d->name); argc = 1; @@ -176,6 +184,7 @@ if (!dpy) return 0; +#ifdef XKB { int opcode, evbase, errbase, majret, minret; unsigned int value = XkbPCF_GrabsUseXKBStateMask; @@ -184,7 +193,7 @@ LogError ("%s\n", "SetPerClientControls failed"); } } - +#endif RegisterCloseOnFork (ConnectionNumber (dpy)); SecureDisplay (d, dpy); @@ -208,6 +217,21 @@ arglist, i); XtRealizeWidget (toplevel); +#ifdef USE_XINERAMA + if ( + XineramaIsActive(dpy) && + (screens = XineramaQueryScreens(dpy, &s_num)) != NULL + ) + { + XWarpPointer(dpy, None, XRootWindowOfScreen (scrn), + 0, 0, 0, 0, + screens[0].x_org + screens[0].width / 2, + screens[0].y_org + screens[0].height / 2); + + XFree(screens); + } + else +#endif XWarpPointer(dpy, None, XRootWindowOfScreen (scrn), 0, 0, 0, 0, XWidthOfScreen(scrn) / 2, @@ -346,7 +370,7 @@ #endif __xdm_crypt = dlfuncs->_crypt; #ifdef USE_PAM - __xdm_thepamh = dlfuncs->_thepamh; + __xdm_thepamhp = dlfuncs->_thepamhp; #endif #endif Index: xc/programs/xdm/greeter/verify.c diff -u xc/programs/xdm/greeter/verify.c:3.10 xc/programs/xdm/greeter/verify.c:3.13.2.1 --- xc/programs/xdm/greeter/verify.c:3.10 Tue Nov 14 16:59:25 2000 +++ xc/programs/xdm/greeter/verify.c Fri May 25 14:50:14 2001 @@ -1,4 +1,4 @@ -/* $TOG: verify.c /main/37 1998/02/11 10:00:45 kaleb $ */ +/* $Xorg: verify.c,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.10 2000/11/14 21:59:25 dawes Exp $ */ +/* $XFree86: xc/programs/xdm/greeter/verify.c,v 3.13.2.1 2001/05/25 18:50:14 dawes Exp $ */ /* * xdm - display manager daemon @@ -117,7 +117,11 @@ static int pam_error; static int PAM_conv (int num_msg, +#ifdef sun + struct pam_message **msg, +#else const struct pam_message **msg, +#endif struct pam_response **resp, void *appdata_ptr) { int replies = 0; @@ -153,7 +157,7 @@ } static struct pam_conv PAM_conversation = { - &PAM_conv, + PAM_conv, NULL }; #endif /* USE_PAM */ @@ -186,6 +190,7 @@ bzero(greet->password, strlen(greet->password)); return 0; } else { +#ifndef USE_PAM #ifdef linux if (p->pw_passwd[0] == '!' || p->pw_passwd[0] == '*') { Debug ("The account is locked, no login allowed.\n"); @@ -193,6 +198,7 @@ return 0; } #endif +#endif user_pass = p->pw_passwd; } #ifdef KERBEROS @@ -318,6 +324,8 @@ pam_error = pam_start("xdm", p->pw_name, &PAM_conversation, pamhp); PAM_BAIL; pam_error = pam_set_item(*pamhp, PAM_TTY, d->name); + PAM_BAIL; + pam_error = pam_set_item(*pamhp, PAM_RHOST, ""); PAM_BAIL; pam_error = pam_authenticate(*pamhp, 0); PAM_BAIL; Index: xc/programs/xdpyinfo/Imakefile diff -u xc/programs/xdpyinfo/Imakefile:3.10 xc/programs/xdpyinfo/Imakefile:3.13 --- xc/programs/xdpyinfo/Imakefile:3.10 Mon Mar 4 00:29:08 1996 +++ xc/programs/xdpyinfo/Imakefile Tue Apr 3 18:37:02 2001 @@ -1,37 +1,40 @@ -XCOMM $XConsortium: Imakefile /main/7 1995/12/04 15:10:00 dpw $ -XCOMM $XFree86: xc/programs/xdpyinfo/Imakefile,v 3.10 1996/03/04 05:29:08 dawes Exp $ - DEPLIBS = $(DEPXTESTLIB) $(DEPXIELIB) $(DEPXLIB) $(DEPXKBFILELIB) $(DEPXF86LIBS) $(DEPXILIB) -#ifndef OS2Architecture -LOCAL_LIBRARIES = $(XTESTLIB) $(XIELIB) $(XKBFILELIB) $(XF86LIBS) $(XILIB) $(XLIB) -#else -LOCAL_LIBRARIES = $(XTESTLIB) $(XIELIB) $(XKBFILELIB) $(XF86LIBS) $(XILIB) $(XLIB) -#endif - SYS_LIBRARIES = MathLibrary +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:17 cpqbld Exp $ + + + +XCOMM $XFree86: xc/programs/xdpyinfo/Imakefile,v 3.13 2001/04/03 22:37:02 dawes Exp $ + #if HasShm SHMDEFINES = -DMITSHM #endif + +#if BuildXIElib + XIEDEFINES = -DXIE + XIEDEPLIBS = $(DEPXIELIB) + XIELIBS = $(XIELIB) +#endif -#if BuildXF86VidModeExt +#if BuildXF86VidModeLibrary VIDMODEDEFINES = -DXF86VIDMODE VIDMODEDEPLIBS = $(DEPXXF86VMLIB) VIDMODELIBS = $(XXF86VMLIB) #endif -#if BuildXF86DGA +#if BuildXF86DGALibrary DGADEFINES = -DXFreeXDGA DGADEPLIBS = $(DEPXXF86DGALIB) DGALIBS = $(XXF86DGALIB) #endif -#if BuildXF86MiscExt +#if BuildXF86MiscLibrary XF86MISCDEFINES = -DXF86MISC XF86MISCDEPLIBS = $(DEPXXF86MISCLIB) XF86MISCLIBS = $(XXF86MISCLIB) #endif -#if BuildXInputExt +#if BuildXInputLib XINPUTDEFINES = -DXINPUT XINPUTDEPLIBS = $(DEPXILIB) XINPUTLIBS = $(XILIB) @@ -49,9 +52,17 @@ XKBDEFINES = -DXKB #endif - OTHERDEFINES = $(SHMDEFINES) $(XKBDEFINES) $(XINPUTDEFINES) \ - $(MULTIBUFDEFINES) + OTHERDEFINES = $(SHMDEFINES) $(XKBDEFINES) $(XINPUTDEFINES) \ + $(MULTIBUFDEFINES) $(XIEDEFINES) + OTHERDEPLIBS = $(XINPUTDEPLIBS) $(XIEDEPLIBS) + OTHERLIBS = $(XINPUTLIBS) $(XIELIBS) DEFINES = $(OTHERDEFINES) $(XF86DEFINES) + DEPLIBS = $(DEPXTESTLIB) XkbClientDepLibs $(OTHERDEPLIBS) \ + $(DEPXF86LIBS) $(DEPXLIB) +LOCAL_LIBRARIES = $(XTESTLIB) XkbClientLibs $(OTHERLIBS) \ + $(XF86LIBS) $(XLIB) + SYS_LIBRARIES = MathLibrary + SimpleProgramTarget(xdpyinfo) Index: xc/programs/xdpyinfo/xdpyinfo.c diff -u xc/programs/xdpyinfo/xdpyinfo.c:3.18 xc/programs/xdpyinfo/xdpyinfo.c:3.23 --- xc/programs/xdpyinfo/xdpyinfo.c:3.18 Sun May 14 16:43:59 2000 +++ xc/programs/xdpyinfo/xdpyinfo.c Tue Apr 3 18:37:02 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xdpyinfo.c /main/35 1998/02/09 13:57:05 kaleb $ + * $Xorg: xdpyinfo.c,v 1.4 2000/08/17 19:54:18 cpqbld Exp $ * * xdpyinfo - print information about X display connecton * @@ -25,14 +25,16 @@ * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xdpyinfo/xdpyinfo.c,v 3.18 2000/05/14 20:43:59 alanh Exp $ */ +/* $XFree86: xc/programs/xdpyinfo/xdpyinfo.c,v 3.23 2001/04/03 22:37:02 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/Xutil.h> #ifdef MULTIBUFFER #include <X11/extensions/multibuf.h> #endif +#ifdef XIE #include <X11/extensions/XIElib.h> +#endif #include <X11/extensions/XTest.h> #include <X11/extensions/sync.h> #include <X11/Xproto.h> @@ -123,6 +125,48 @@ ProtocolVersion (dpy), ProtocolRevision (dpy)); printf ("vendor string: %s\n", ServerVendor (dpy)); printf ("vendor release number: %d\n", VendorRelease (dpy)); + + if (strstr(ServerVendor (dpy), "XFree86")) { + int vendrel = VendorRelease(dpy); + + printf("XFree86 version: "); + if (vendrel < 336) { + /* + * vendrel was set incorrectly for 3.3.4 and 3.3.5, so handle + * those cases here. + */ + printf("%d.%d.%d", vendrel / 100, + (vendrel / 10) % 10, + vendrel % 10); + } else if (vendrel < 3900) { + /* 3.3.x versions, other than the exceptions handled above */ + printf("%d.%d", vendrel / 1000, + (vendrel / 100) % 10); + if (((vendrel / 10) % 10) || (vendrel % 10)) { + printf(".%d", (vendrel / 10) % 10); + if (vendrel % 10) { + printf(".%d", vendrel % 10); + } + } + } else if (vendrel < 40000000) { + /* 4.0.x versions */ + printf("%d.%d", vendrel / 1000, + (vendrel / 10) % 10); + if (vendrel % 10) { + printf(".%d", vendrel % 10); + } + } else { + /* post-4.0.2 */ + printf("%d.%d.%d", vendrel / 10000000, + (vendrel / 100000) % 100, + (vendrel / 1000) % 100); + if (vendrel % 1000) { + printf(".%d", vendrel % 1000); + } + } + printf("\n"); + } + req_size = XExtendedMaxRequestSize (dpy); if (!req_size) req_size = XMaxRequestSize (dpy); printf ("maximum request size: %ld bytes\n", req_size * 4); @@ -458,6 +502,7 @@ #endif +#ifdef XIE /* XIE stuff */ char *subset_names[] = { NULL, "FULL", "DIS" }; @@ -521,6 +566,7 @@ } return 1; } /* end print_xie_info */ +#endif static int print_xtest_info(Display *dpy, char *extname) @@ -912,7 +958,9 @@ #ifdef XF86MISC {XF86MISCNAME, print_XF86Misc_info, False}, #endif /* XF86MISC */ +#ifdef XIE {xieExtName, print_xie_info, False}, +#endif {XTestExtensionName, print_xtest_info, False}, {"DOUBLE-BUFFER", print_dbe_info, False}, {"RECORD", print_record_info, False}, Index: xc/programs/xdpyinfo/xdpyinfo.man diff -u xc/programs/xdpyinfo/xdpyinfo.man:3.4 xc/programs/xdpyinfo/xdpyinfo.man:3.7 --- xc/programs/xdpyinfo/xdpyinfo.man:3.4 Sun Oct 4 05:41:05 1998 +++ xc/programs/xdpyinfo/xdpyinfo.man Sat Jan 27 13:21:11 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xdpyinfo.man /main/22 1998/02/09 13:57:10 kaleb $ +.\" $Xorg: xdpyinfo.man,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ .\" Copyright 1988, 1989, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -19,9 +19,9 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xdpyinfo/xdpyinfo.man,v 3.4 1998/10/04 09:41:05 dawes Exp $ +.\" $XFree86: xc/programs/xdpyinfo/xdpyinfo.man,v 3.7 2001/01/27 18:21:11 dawes Exp $ .\" -.TH XDPYINFO 1 "Release 6.4" "X Version 11" +.TH XDPYINFO 1 __xorgversion__ .SH NAME xdpyinfo \- display information utility for X .SH SYNOPSIS @@ -54,7 +54,7 @@ .B DISPLAY To get the default host, display number, and screen. .SH "SEE ALSO" -X(1), xwininfo(1), xprop(1), xrdb(1) +X(__miscmansuffix__), xwininfo(1), xprop(1), xrdb(1) .SH AUTHOR Jim Fulton, MIT X Consortium .br Index: xc/programs/xedit/Xedit.ad diff -u xc/programs/xedit/Xedit.ad:1.18 xc/programs/xedit/Xedit.ad:1.19 --- xc/programs/xedit/Xedit.ad:1.18 Mon Sep 27 02:30:08 1999 +++ xc/programs/xedit/Xedit.ad Mon Feb 5 17:38:04 2001 @@ -1,4 +1,4 @@ -! $XFree86: xc/programs/xedit/Xedit.ad,v 1.18 1999/09/27 06:30:08 dawes Exp $ +! $XFree86: xc/programs/xedit/Xedit.ad,v 1.19 2001/02/05 22:38:04 paulo Exp $ *geometry: 590x440 *input: TRUE @@ -153,12 +153,12 @@ *search.translations: #override \ <Create>:get-values(my, $w, width, $h, height)\ - set-values(1, minWidth, $w, minHeight, $h, maxHeight, $h) + set-values(1, minWidth, $w, minHeight, $h, maxHeight, $h, allowShellResize, False) *insertFile.title: Insert File *insertFile.translations: #override \ <Create>:get-values(my, $w, width, $h, height)\ - set-values(1, minWidth, $w, minHeight, $h, maxHeight, $h) + set-values(1, minWidth, $w, minHeight, $h, maxHeight, $h, allowShellResize, False) *baseTranslations: #override \ <Ctrl>X,<Ctrl>C:quit()\n\ Index: xc/programs/xedit/c-mode.c diff -u xc/programs/xedit/c-mode.c:1.4.2.1 xc/programs/xedit/c-mode.c:1.5 --- xc/programs/xedit/c-mode.c:1.4.2.1 Fri Feb 9 15:45:21 2001 +++ xc/programs/xedit/c-mode.c Tue Jan 30 10:03:33 2001 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/c-mode.c,v 1.4.2.1 2001/02/09 20:45:21 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/c-mode.c,v 1.5 2001/01/30 15:03:33 paulo Exp $ */ #include "xedit.h" #include <X11/IntrinsicP.h> Index: xc/programs/xedit/ispell.c diff -u xc/programs/xedit/ispell.c:1.14.2.1 xc/programs/xedit/ispell.c:1.15 --- xc/programs/xedit/ispell.c:1.14.2.1 Fri Feb 9 16:48:14 2001 +++ xc/programs/xedit/ispell.c Wed Feb 7 11:36:29 2001 @@ -27,7 +27,7 @@ * Author: Paulo César Pereira de Andrade */ -/* $XFree86: xc/programs/xedit/ispell.c,v 1.14.2.1 2001/02/09 21:48:14 paulo Exp $ */ +/* $XFree86: xc/programs/xedit/ispell.c,v 1.15 2001/02/07 16:36:29 paulo Exp $ */ #include "xedit.h" #ifndef X_NOT_STDC_ENV Index: xc/programs/xedit/xedit.man diff -u xc/programs/xedit/xedit.man:1.13 xc/programs/xedit/xedit.man:1.15 --- xc/programs/xedit/xedit.man:1.13 Sun Jul 4 02:40:09 1999 +++ xc/programs/xedit/xedit.man Sat Jan 27 13:21:11 2001 @@ -25,9 +25,9 @@ .\" other dealings in this Software without prior written authorization .\" from the X Consortium. .\" -.\" $XFree86: xc/programs/xedit/xedit.man,v 1.13 1999/07/04 06:40:09 dawes Exp $ +.\" $XFree86: xc/programs/xedit/xedit.man,v 1.15 2001/01/27 18:21:11 dawes Exp $ .\" -.TH XEDIT 1 "Release 6" "X Version 11" +.TH XEDIT 1 __vendorversion__ .SH NAME xedit \- simple text editor for X .SH SYNTAX @@ -55,7 +55,7 @@ .I Xedit accepts all of the standard X Toolkit command line options (see -.IR X (1)). +.IR X (__miscmansuffix__)). The order of the command line options is not important. .TP 8 .I filename @@ -307,7 +307,7 @@ .I <XRoot>/lib/X11/app-defaults/Xedit specifies required resources .SH "SEE ALSO" -.IR X (1), +.IR X (__miscmansuffix__), .IR xrdb (1), .I "Athena Widget Set" .SH RESTRICTIONS @@ -320,7 +320,7 @@ Copyright 1998, The XFree86 Project .br See -.IR X (1) +.IR X (__miscmansuffix__) for a full statement of rights and permissions. .SH AUTHORS Chris D. Peterson, MIT X Consortium Index: xc/programs/xev/xev.c diff -u xc/programs/xev/xev.c:1.3 xc/programs/xev/xev.c:1.4 --- xc/programs/xev/xev.c:1.3 Thu Feb 17 09:00:34 2000 +++ xc/programs/xev/xev.c Wed Mar 7 10:54:15 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xev/xev.c,v 1.3 2000/02/17 14:00:34 dawes Exp $ */ +/* $XFree86: xc/programs/xev/xev.c,v 1.4 2001/03/07 15:54:15 dawes Exp $ */ /* * Author: Jim Fulton, MIT X Consortium @@ -36,11 +36,12 @@ #include <stdio.h> #include <stdlib.h> +#include <ctype.h> +#include <X11/Xlocale.h> #include <X11/Xos.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/Xproto.h> -#include <ctype.h> #define INNER_WINDOW_WIDTH 50 #define INNER_WINDOW_HEIGHT 50 @@ -700,8 +701,14 @@ Bool reverse = False; unsigned long back, fore; - w = 0; ProgramName = argv[0]; + + if (setlocale(LC_ALL,"") == NULL) { + fprintf(stderr, "%s: warning: could not set default locale\n", + ProgramName); + } + + w = 0; for (i = 1; i < argc; i++) { char *arg = argv[i]; Index: xc/programs/xev/xev.man diff -u xc/programs/xev/xev.man:1.1 xc/programs/xev/xev.man:1.3 --- xc/programs/xev/xev.man:1.1 Sat Feb 12 22:26:20 2000 +++ xc/programs/xev/xev.man Sat Jan 27 13:21:11 2001 @@ -1,5 +1,8 @@ .\" $XConsortium: xev.man,v 1.10 94/04/17 20:45:20 gildea Exp $ -.TH XEV 1 "Release 6" "X Version 11" +.\" +.\" $XFree86: xc/programs/xev/xev.man,v 1.3 2001/01/27 18:21:11 dawes Exp $ +.\" +.TH XEV 1 __xorgversion__ .SH NAME xev - print contents of X events .SH SYNOPSIS @@ -42,9 +45,9 @@ .B \-rv This option specifies that the window should be in reverse video. .SH "SEE ALSO" -X(1), xwininfo(1), xdpyinfo(1), Xlib Programmers Manual, X Protocol +X(__miscmansuffix__), xwininfo(1), xdpyinfo(1), Xlib Programmers Manual, X Protocol Specification .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHOR Jim Fulton, MIT X Consortium Index: xc/programs/xeyes/xeyes.man diff -u xc/programs/xeyes/xeyes.man:1.1 xc/programs/xeyes/xeyes.man:1.3 --- xc/programs/xeyes/xeyes.man:1.1 Sat Feb 12 22:26:23 2000 +++ xc/programs/xeyes/xeyes.man Sat Jan 27 13:21:12 2001 @@ -1,5 +1,8 @@ .\" $XConsortium: xeyes.man,v 1.12 94/04/17 20:45:24 gildea Exp $ -.TH XEYES 1 "Release 6" "X Version 11" +.\" +.\" $XFree86: xc/programs/xeyes/xeyes.man,v 1.3 2001/01/27 18:21:12 dawes Exp $ +.\" +.TH XEYES 1 __xorgversion__ .SH NAME xeyes \- a follow the mouse X demo .SH SYNOPSIS @@ -26,10 +29,10 @@ selects an appropriate level of backing store. .TP 8 .B \-geometry \fIgeometry\fB -define the initial window geometry; see \fIX(1)\fP. +define the initial window geometry; see \fIX(__miscmansuffix__)\fP. .TP 8 .B \-display \fIdisplay\fB -specify the display to use; see \fIX(1)\fP. +specify the display to use; see \fIX(__miscmansuffix__)\fP. .TP 8 .B \-bd \fIborder color\fB choose a different color for the window border. @@ -43,9 +46,9 @@ .B \+shape Disables uses the SHAPE extension to shape the window. .SH "SEE ALSO" -X(1), X Toolkit documentation +X(__miscmansuffix__), X Toolkit documentation .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHOR Keith Packard, MIT X Consortium .br Index: xc/programs/xf86dga/dga.man diff -u xc/programs/xf86dga/dga.man:3.4 xc/programs/xf86dga/dga.man:3.5 --- xc/programs/xf86dga/dga.man:3.4 Sat Nov 8 11:24:37 1997 +++ xc/programs/xf86dga/dga.man Sat Jan 27 13:21:12 2001 @@ -1,6 +1,6 @@ -.\" $XFree86: xc/programs/xf86dga/dga.man,v 3.4 1997/11/08 16:24:37 hohndel Exp $ +.\" $XFree86: xc/programs/xf86dga/dga.man,v 3.5 2001/01/27 18:21:12 dawes Exp $ .\" -.TH dga 1 "4.0" "XFree86" +.TH dga 1 __vendorversion__ .SH NAME dga \- test program for the XFree86-DGA extension .SH SYNOPSIS Index: xc/programs/xfd/Imakefile diff -u xc/programs/xfd/Imakefile:1.1.1.2 xc/programs/xfd/Imakefile:1.1.1.3 --- xc/programs/xfd/Imakefile:1.1.1.2 Tue Jan 16 05:25:05 1996 +++ xc/programs/xfd/Imakefile Tue Jan 16 17:49:28 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/10 1996/01/14 16:51:13 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ DEPLIBS = XawClientDepLibs XkbClientDepLibs LOCAL_LIBRARIES = XawClientLibs XkbClientLibs SRCS = xfd.c grid.c Index: xc/programs/xfd/Xfd.ad diff -u xc/programs/xfd/Xfd.ad:1.1.1.1 xc/programs/xfd/Xfd.ad:1.1.1.2 --- xc/programs/xfd/Xfd.ad:1.1.1.1 Wed Apr 27 03:12:58 1994 +++ xc/programs/xfd/Xfd.ad Tue Jan 16 17:49:31 2001 @@ -1,4 +1,4 @@ -! $XConsortium: Xfd.ad,v 1.9 94/02/09 19:44:03 gildea Exp $ +! $Xorg: Xfd.ad,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ *internalBorderWidth: 0 *showGrip: false Index: xc/programs/xfd/grid.c diff -u xc/programs/xfd/grid.c:1.3 xc/programs/xfd/grid.c:1.4 --- xc/programs/xfd/grid.c:1.3 Tue Mar 2 06:49:38 1999 +++ xc/programs/xfd/grid.c Wed Jan 17 18:45:26 2001 @@ -1,5 +1,5 @@ /* - * $TOG: grid.c /main/31 1998/02/09 13:57:18 kaleb $ + * $Xorg: grid.c,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ * * Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xfd/grid.c,v 1.3 1999/03/02 11:49:38 dawes Exp $ */ +/* $XFree86: xc/programs/xfd/grid.c,v 1.4 2001/01/17 23:45:26 dawes Exp $ */ #include <X11/IntrinsicP.h> Index: xc/programs/xfd/grid.h diff -u xc/programs/xfd/grid.h:1.1.1.2 xc/programs/xfd/grid.h:1.1.1.3 --- xc/programs/xfd/grid.h:1.1.1.2 Sun Sep 27 04:01:57 1998 +++ xc/programs/xfd/grid.h Tue Jan 16 17:49:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: grid.h /main/12 1998/02/09 13:57:23 kaleb $ */ +/* $Xorg: grid.h,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ */ /* Copyright 1993, 1998 The Open Group Index: xc/programs/xfd/gridP.h diff -u xc/programs/xfd/gridP.h:1.1.1.2 xc/programs/xfd/gridP.h:1.1.1.3 --- xc/programs/xfd/gridP.h:1.1.1.2 Sun Sep 27 04:01:57 1998 +++ xc/programs/xfd/gridP.h Tue Jan 16 17:49:43 2001 @@ -1,4 +1,4 @@ -/* $TOG: gridP.h /main/14 1998/02/09 13:57:14 kaleb $ */ +/* $Xorg: gridP.h,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ */ /* Copyright 1993, 1998 The Open Group Index: xc/programs/xfd/xfd.c diff -u xc/programs/xfd/xfd.c:1.3 xc/programs/xfd/xfd.c:1.5 --- xc/programs/xfd/xfd.c:1.3 Tue Mar 2 06:49:38 1999 +++ xc/programs/xfd/xfd.c Sun Apr 1 10:00:20 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xfd.c /main/34 1998/02/09 13:57:31 kaleb $ + * $Xorg: xfd.c,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ * * Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xfd/xfd.c,v 1.3 1999/03/02 11:49:38 dawes Exp $ */ +/* $XFree86: xc/programs/xfd/xfd.c,v 1.5 2001/04/01 14:00:20 tsi Exp $ */ #include <X11/Intrinsic.h> #include <X11/StringDefs.h> @@ -35,6 +35,7 @@ #include <X11/Xaw/Form.h> #include <X11/Xaw/Command.h> #include <stdio.h> +#include <stdlib.h> #include "grid.h" char *ProgramName; Index: xc/programs/xfd/xfd.man diff -u xc/programs/xfd/xfd.man:1.4 xc/programs/xfd/xfd.man:1.7 --- xc/programs/xfd/xfd.man:1.4 Sun Oct 4 05:41:06 1998 +++ xc/programs/xfd/xfd.man Sat Jan 27 13:21:12 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xfd.man /main/30 1998/02/09 13:57:36 kaleb $ +.\" $Xorg: xfd.man,v 1.3 2000/08/17 19:54:18 cpqbld Exp $ .\" Copyright 1989, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XFD 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xfd/xfd.man,v 1.7 2001/01/27 18:21:12 dawes Exp $ +.\" +.TH XFD 1 __xorgversion__ .SH NAME xfd \- display all the characters in an X font .SH SYNOPSIS @@ -173,7 +176,7 @@ 0x%02x%02x (%u,%u) (%#o,%#o)". The arguments that will come after the format string are the same as for the \fBselectFormat\fP resource. .SH "SEE ALSO" -X(1), xlsfonts(1), xrdb(1), xfontsel(1), +X(__miscmansuffix__), xlsfonts(1), xrdb(1), xfontsel(1), .I "X Logical Font Description Conventions" .SH "BUGS" The program should skip over pages full of non-existent characters. Index: xc/programs/xfindproxy/Imakefile diff -u xc/programs/xfindproxy/Imakefile:1.2 xc/programs/xfindproxy/Imakefile:1.3 --- xc/programs/xfindproxy/Imakefile:1.2 Fri Feb 12 20:13:37 1999 +++ xc/programs/xfindproxy/Imakefile Wed Jan 17 18:45:27 2001 @@ -1,5 +1,9 @@ -XCOMM $XConsortium: Imakefile /main/5 1996/12/06 09:32:39 swick $ -XCOMM $XFree86: xc/programs/xfindproxy/Imakefile,v 1.2 1999/02/13 01:13:37 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xfindproxy/Imakefile,v 1.3 2001/01/17 23:45:27 dawes Exp $ DEPLIBS = $(DEPXTOOLLIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XTOOLLIB) $(XLIB) Index: xc/programs/xfindproxy/xfindproxy.c diff -u xc/programs/xfindproxy/xfindproxy.c:1.4 xc/programs/xfindproxy/xfindproxy.c:1.5 --- xc/programs/xfindproxy/xfindproxy.c:1.4 Mon Jun 26 19:00:33 2000 +++ xc/programs/xfindproxy/xfindproxy.c Wed Jan 17 18:45:27 2001 @@ -1,4 +1,4 @@ -/* $TOG: xfindproxy.c /main/10 1998/02/09 13:57:41 kaleb $ */ +/* $Xorg: xfindproxy.c,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -21,7 +21,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xfindproxy/xfindproxy.c,v 1.4 2000/06/26 23:00:33 dawes Exp $ */ +/* $XFree86: xc/programs/xfindproxy/xfindproxy.c,v 1.5 2001/01/17 23:45:27 dawes Exp $ */ #include <stdio.h> Index: xc/programs/xfindproxy/xfindproxy.h diff -u xc/programs/xfindproxy/xfindproxy.h:1.1.1.2 xc/programs/xfindproxy/xfindproxy.h:1.1.1.3 --- xc/programs/xfindproxy/xfindproxy.h:1.1.1.2 Sun Sep 27 04:59:38 1998 +++ xc/programs/xfindproxy/xfindproxy.h Tue Jan 16 17:49:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: xfindproxy.h /main/2 1998/02/09 13:57:46 kaleb $ */ +/* $Xorg: xfindproxy.h,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xfindproxy/xfindproxy.man diff -u xc/programs/xfindproxy/xfindproxy.man:1.4 xc/programs/xfindproxy/xfindproxy.man:1.6 --- xc/programs/xfindproxy/xfindproxy.man:1.4 Sun Oct 4 05:41:06 1998 +++ xc/programs/xfindproxy/xfindproxy.man Sat Jan 27 13:21:12 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xfindproxy.man /main/3 1998/02/09 13:57:50 kaleb $ +.\" $Xorg: xfindproxy.man,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ .\" Copyright 1996, 1998 The Open Group .\" .\" All Rights Reserved. @@ -19,7 +19,10 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.TH XFINDPROXY 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xfindproxy/xfindproxy.man,v 1.6 2001/01/27 18:21:12 dawes Exp $ +.\" +.TH XFINDPROXY 1 __xorgversion__ .SH NAME xfindproxy - locate proxy services .SH SYNOPSIS Index: xc/programs/xfontsel/xfontsel.c diff -u xc/programs/xfontsel/xfontsel.c:1.3 xc/programs/xfontsel/xfontsel.c:1.4 --- xc/programs/xfontsel/xfontsel.c:1.3 Tue Sep 26 11:57:24 2000 +++ xc/programs/xfontsel/xfontsel.c Sun Apr 1 10:00:20 2001 @@ -31,9 +31,10 @@ one weekend in November, 1989 Modified: Mark Leisher <mleisher@crl.nmsu.edu> to deal with UCS sample text. */ -/* $XFree86: xc/programs/xfontsel/xfontsel.c,v 1.3 2000/09/26 15:57:24 tsi Exp $ */ +/* $XFree86: xc/programs/xfontsel/xfontsel.c,v 1.4 2001/04/01 14:00:20 tsi Exp $ */ #include <stdio.h> +#include <stdlib.h> #include <X11/Intrinsic.h> #include <X11/StringDefs.h> #include <X11/Xatom.h> Index: xc/programs/xfontsel/xfontsel.man diff -u xc/programs/xfontsel/xfontsel.man:1.1 xc/programs/xfontsel/xfontsel.man:1.3 --- xc/programs/xfontsel/xfontsel.man:1.1 Sat Feb 12 22:26:25 2000 +++ xc/programs/xfontsel/xfontsel.man Sat Jan 27 13:21:12 2001 @@ -25,7 +25,7 @@ .\" other dealings in this Software without prior written authorization .\" from the X Consortium. .\" -.\" $XFree86: xc/programs/xfontsel/xfontsel.man,v 1.1 2000/02/13 03:26:25 dawes Exp $ +.\" $XFree86: xc/programs/xfontsel/xfontsel.man,v 1.3 2001/01/27 18:21:12 dawes Exp $ .de EX \"Begin example .ne 5 .if n .sp 1 @@ -39,7 +39,7 @@ .if n .sp 1 .if t .sp .5 .. -.TH XFONTSEL 1 "Release 6" "X Version 11" +.TH XFONTSEL 1 __xorgversion__ .SH NAME xfontsel \- point and click selection of X11 font names .SH SYNTAX @@ -220,7 +220,7 @@ .SH COPYRIGHT Copyright 1989, 1991, X Consortium .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHOR .PP Ralph R. Swick, Digital Equipment Corporation/MIT Project Athena Index: xc/programs/xfs/Imakefile diff -u xc/programs/xfs/Imakefile:3.21 xc/programs/xfs/Imakefile:3.22 --- xc/programs/xfs/Imakefile:3.21 Sun Feb 13 01:50:43 2000 +++ xc/programs/xfs/Imakefile Wed Jan 17 18:45:27 2001 @@ -1,5 +1,10 @@ -XCOMM $TOG: Imakefile /main/31 1998/06/16 15:16:14 msr $ -XCOMM $XFree86: xc/programs/xfs/Imakefile,v 3.21 2000/02/13 06:50:43 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xfs/Imakefile,v 3.22 2001/01/17 23:45:27 dawes Exp $ + #undef ServerDefines #include <Server.tmpl> #define IHaveSubdirs Index: xc/programs/xfs/README diff -u xc/programs/xfs/README:1.2 xc/programs/xfs/README:1.3 --- xc/programs/xfs/README:1.2 Wed Jun 11 08:24:49 1997 +++ xc/programs/xfs/README Wed Jan 17 18:45:27 2001 @@ -1,4 +1,4 @@ -/* $TOG: README /main/4 1997/06/09 16:57:45 barstow $ */ +/* $Xorg: README,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ */ Installation instructions for fontserver 1 - set DefaultFSConfigFile to point to the correct place, if the default Index: xc/programs/xfs/config.cpp diff -u xc/programs/xfs/config.cpp:1.2 xc/programs/xfs/config.cpp:1.3 --- xc/programs/xfs/config.cpp:1.2 Sun Feb 13 01:15:42 2000 +++ xc/programs/xfs/config.cpp Wed Jan 17 18:45:27 2001 @@ -1,5 +1,5 @@ XCOMM font server configuration file -XCOMM $XConsortium: config.cpp,v 1.7 91/08/22 11:39:59 rws Exp $ +XCOMM $Xorg: config.cpp,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ clone-self = on use-syslog = off Index: xc/programs/xfs/xfs.man diff -u xc/programs/xfs/xfs.man:3.11 xc/programs/xfs/xfs.man:3.15 --- xc/programs/xfs/xfs.man:3.11 Wed Dec 6 15:39:55 2000 +++ xc/programs/xfs/xfs.man Wed Apr 18 12:13:22 2001 @@ -1,3 +1,5 @@ +.\" $XFree86: xc/programs/xfs/xfs.man,v 3.15 2001/04/18 16:13:22 dawes Exp $ +.\" .\" Copyright 1991, 1998 The Open Group .\" .\" All Rights Reserved. @@ -30,9 +32,8 @@ .\" no representations about the .\" suitability of this software for any purpose. It is provided "as is" .\" without express or implied warranty. -.\" $TOG: xfs.man /main/16 1998/02/09 13:58:02 kaleb $ -.\" $XFree86: xc/programs/xfs/xfs.man,v 3.11 2000/12/06 20:39:55 dawes Exp $ -.TH XFS 1 "Release 6.4" "X Version 11" +.\" $Xorg: xfs.man,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ +.TH XFS 1 __xorgversion__ .SH NAME xfs \- X font server .SH SYNOPSIS @@ -78,10 +79,6 @@ .B \-droppriv If specified, xfs will attempt to run as user and group \fIxfs\fR (unless the -.TP 8 -.B \-nodaemon -When xfs is built to daemonize (run in the background) by default, -this prevents that and starts xfs up as a regular process. .B \-user option is used). This has been implemented for security reasons, as xfs may have undiscovered @@ -90,6 +87,10 @@ "no-listen = tcp" in the config file, which ensures that xfs will not to use a TCP port at all. .TP 8 +.B \-nodaemon +When xfs is built to daemonize (run in the background) by default, +this prevents that and starts xfs up as a regular process. +.TP 8 .B \-user username This is equivalent to .B \-droppriv @@ -164,31 +165,31 @@ .\" list means the server will talk to any client. .SH "EXAMPLE" .nf -# -# sample font server configuration file -# +XCOMM +XCOMM sample font server configuration file +XCOMM -# allow a max of 10 clients to connect to this font server +XCOMM allow a max of 10 clients to connect to this font server client-limit = 10 -# when a font server reaches its limit, start up a new one +XCOMM when a font server reaches its limit, start up a new one clone-self = on -# alternate font servers for clients to use +XCOMM alternate font servers for clients to use alternate-servers = hansen:7101,hansen:7102 -# where to look for fonts -# the first is a set of Speedo outlines, the second is a set of -# misc bitmaps and the last is a set of 100dpi bitmaps -# +XCOMM where to look for fonts +XCOMM the first is a set of Speedo outlines, the second is a set of +XCOMM misc bitmaps and the last is a set of 100dpi bitmaps +XCOMM catalogue = /usr/X11R6/lib/X11/fonts/speedo, /usr/X11R6/lib/X11/fonts/misc, /usr/X11R6/lib/X11/fonts/100dpi/ -# in 12 points, decipoints +XCOMM in 12 points, decipoints default-point-size = 120 -# 100 x 100 and 75 x 75 +XCOMM 100 x 100 and 75 x 75 default-resolutions = 100,100,75,75 use-syslog = off .fi @@ -226,7 +227,7 @@ .PP Examples: \fIDECnet/SRVNOD::FONT$DEFAULT\fP, \fIdecnet/44.70::font$special/symbols\fP. .SH "SEE ALSO" -X(1), \fIThe X Font Service Protocol\fP, +X(__miscmansuffix__), \fIThe X Font Service Protocol\fP, .br \fIFont server implementation overview\fP .SH BUGS Index: xc/programs/xfs/difs/Imakefile diff -u xc/programs/xfs/difs/Imakefile:1.4 xc/programs/xfs/difs/Imakefile:1.5 --- xc/programs/xfs/difs/Imakefile:1.4 Sun Feb 13 01:15:43 2000 +++ xc/programs/xfs/difs/Imakefile Wed Jan 17 18:45:28 2001 @@ -1,5 +1,10 @@ -XCOMM $TOG: Imakefile /main/15 1998/06/16 15:20:22 msr $ -XCOMM $XFree86: xc/programs/xfs/difs/Imakefile,v 1.4 2000/02/13 06:15:43 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:19 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xfs/difs/Imakefile,v 1.5 2001/01/17 23:45:28 dawes Exp $ + #undef ServerDefines #include <Server.tmpl> Index: xc/programs/xfs/difs/atom.c diff -u xc/programs/xfs/difs/atom.c:3.2 xc/programs/xfs/difs/atom.c:3.3 --- xc/programs/xfs/difs/atom.c:3.2 Sun Mar 7 06:40:51 1999 +++ xc/programs/xfs/difs/atom.c Wed Jan 17 18:45:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: atom.c /main/7 1998/02/11 10:02:07 kaleb $ */ +/* $Xorg: atom.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* * font server atom manipulations */ @@ -46,7 +46,7 @@ * @(#)atom.c 4.1 5/2/91 * */ -/* $XFree86: xc/programs/xfs/difs/atom.c,v 3.2 1999/03/07 11:40:51 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/atom.c,v 3.3 2001/01/17 23:45:28 dawes Exp $ */ #include "misc.h" #include "fsresource.h" Index: xc/programs/xfs/difs/cache.c diff -u xc/programs/xfs/difs/cache.c:1.4 xc/programs/xfs/difs/cache.c:1.5 --- xc/programs/xfs/difs/cache.c:1.4 Sun Mar 7 06:40:51 1999 +++ xc/programs/xfs/difs/cache.c Wed Jan 17 18:45:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: cache.c /main/8 1998/02/11 10:02:13 kaleb $ */ +/* $Xorg: cache.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -43,7 +43,7 @@ * @(#)cache.c 4.2 91/05/02 * */ -/* $XFree86: xc/programs/xfs/difs/cache.c,v 1.4 1999/03/07 11:40:51 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/cache.c,v 1.5 2001/01/17 23:45:28 dawes Exp $ */ #include "cachestr.h" #include "misc.h" Index: xc/programs/xfs/difs/charinfo.c diff -u xc/programs/xfs/difs/charinfo.c:1.8 xc/programs/xfs/difs/charinfo.c:1.9 --- xc/programs/xfs/difs/charinfo.c:1.8 Sun Feb 13 01:15:43 2000 +++ xc/programs/xfs/difs/charinfo.c Wed Jan 17 18:45:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: charinfo.c /main/18 1998/04/15 09:41:34 msr $ */ +/* $Xorg: charinfo.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* Copyright 1990, 1991, 1998 The Open Group @@ -45,7 +45,7 @@ * This file was once on the other side of * the font library interface as util/fsfuncs.c. */ -/* $XFree86: xc/programs/xfs/difs/charinfo.c,v 1.8 2000/02/13 06:15:43 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/charinfo.c,v 1.9 2001/01/17 23:45:28 dawes Exp $ */ #include <X11/Xos.h> #include "misc.h" Index: xc/programs/xfs/difs/difsutils.c diff -u xc/programs/xfs/difs/difsutils.c:1.5 xc/programs/xfs/difs/difsutils.c:1.6 --- xc/programs/xfs/difs/difsutils.c:1.5 Sat Aug 21 09:48:47 1999 +++ xc/programs/xfs/difs/difsutils.c Wed Jan 17 18:45:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: difsutils.c /main/14 1998/02/11 10:02:24 kaleb $ */ +/* $Xorg: difsutils.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* * misc utility routines */ @@ -42,7 +42,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/difsutils.c,v 1.5 1999/08/21 13:48:47 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/difsutils.c,v 1.6 2001/01/17 23:45:28 dawes Exp $ */ #define XK_LATIN1 Index: xc/programs/xfs/difs/dispatch.c diff -u xc/programs/xfs/difs/dispatch.c:3.7 xc/programs/xfs/difs/dispatch.c:3.9 --- xc/programs/xfs/difs/dispatch.c:3.7 Sun Dec 12 22:04:55 1999 +++ xc/programs/xfs/difs/dispatch.c Sun Apr 1 10:00:20 2001 @@ -1,4 +1,4 @@ -/* $TOG: dispatch.c /main/26 1998/02/11 10:02:29 kaleb $ */ +/* $Xorg: dispatch.c,v 1.5 2000/08/17 19:54:20 cpqbld Exp $ */ /* * protocol dispatcher */ @@ -42,11 +42,12 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/dispatch.c,v 3.7 1999/12/13 03:04:55 robin Exp $ */ +/* $XFree86: xc/programs/xfs/difs/dispatch.c,v 3.9 2001/04/01 14:00:20 tsi Exp $ */ -#include <dispatch.h> -#include <swapreq.h> -#include <swaprep.h> +#include <stdlib.h> +#include "dispatch.h" +#include "swapreq.h" +#include "swaprep.h" #include "FS.h" #include "FSproto.h" Index: xc/programs/xfs/difs/events.c diff -u xc/programs/xfs/difs/events.c:3.5 xc/programs/xfs/difs/events.c:3.6 --- xc/programs/xfs/difs/events.c:3.5 Sun Mar 7 06:40:52 1999 +++ xc/programs/xfs/difs/events.c Wed Jan 17 18:45:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: events.c /main/7 1998/02/11 10:02:35 kaleb $ */ +/* $Xorg: events.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* * event handling stuff */ @@ -42,7 +42,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/events.c,v 3.5 1999/03/07 11:40:52 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/events.c,v 3.6 2001/01/17 23:45:28 dawes Exp $ */ #include <swaprep.h> Index: xc/programs/xfs/difs/extensions.c diff -u xc/programs/xfs/difs/extensions.c:1.4 xc/programs/xfs/difs/extensions.c:1.5 --- xc/programs/xfs/difs/extensions.c:1.4 Sun Mar 7 06:40:52 1999 +++ xc/programs/xfs/difs/extensions.c Wed Jan 17 18:45:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: extensions.c /main/8 1998/02/11 10:02:40 kaleb $ */ +/* $Xorg: extensions.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* * font server extensions */ @@ -42,7 +42,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/extensions.c,v 1.4 1999/03/07 11:40:52 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/extensions.c,v 1.5 2001/01/17 23:45:29 dawes Exp $ */ #include "FSproto.h" #include "misc.h" Index: xc/programs/xfs/difs/fontinfo.c diff -u xc/programs/xfs/difs/fontinfo.c:1.7 xc/programs/xfs/difs/fontinfo.c:1.8 --- xc/programs/xfs/difs/fontinfo.c:1.7 Sun Feb 13 01:15:44 2000 +++ xc/programs/xfs/difs/fontinfo.c Wed Jan 17 18:45:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: fontinfo.c /main/14 1998/02/11 10:02:45 kaleb $ */ +/* $Xorg: fontinfo.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* * font data query */ @@ -42,7 +42,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/fontinfo.c,v 1.7 2000/02/13 06:15:44 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/fontinfo.c,v 1.8 2001/01/17 23:45:29 dawes Exp $ */ #include "FS.h" #include "FSproto.h" Index: xc/programs/xfs/difs/fonts.c diff -u xc/programs/xfs/difs/fonts.c:3.7 xc/programs/xfs/difs/fonts.c:3.9 --- xc/programs/xfs/difs/fonts.c:3.7 Thu Dec 14 11:52:50 2000 +++ xc/programs/xfs/difs/fonts.c Sun Apr 1 10:00:20 2001 @@ -1,4 +1,4 @@ -/* $TOG: fonts.c /main/30 1998/05/28 15:48:12 kaleb $ */ +/* $Xorg: fonts.c,v 1.4 2000/08/17 19:54:20 cpqbld Exp $ */ /* * font control */ @@ -42,11 +42,12 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/fonts.c,v 3.7 2000/12/14 16:52:50 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/fonts.c,v 3.9 2001/04/01 14:00:20 tsi Exp $ */ #include "FS.h" #include "FSproto.h" #include <stdio.h> +#include <stdlib.h> #include <X11/Xos.h> #include "clientstr.h" #include "fsresource.h" Index: xc/programs/xfs/difs/globals.c diff -u xc/programs/xfs/difs/globals.c:1.1.1.2 xc/programs/xfs/difs/globals.c:1.1.1.3 --- xc/programs/xfs/difs/globals.c:1.1.1.2 Sun Sep 27 04:52:15 1998 +++ xc/programs/xfs/difs/globals.c Tue Jan 16 17:50:34 2001 @@ -1,4 +1,4 @@ -/* $TOG: globals.c /main/6 1998/02/11 10:03:01 kaleb $ */ +/* $Xorg: globals.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* * various font server globals */ Index: xc/programs/xfs/difs/initfonts.c diff -u xc/programs/xfs/difs/initfonts.c:1.4 xc/programs/xfs/difs/initfonts.c:1.5 --- xc/programs/xfs/difs/initfonts.c:1.4 Sun Feb 13 01:15:44 2000 +++ xc/programs/xfs/difs/initfonts.c Wed Jan 17 18:45:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: initfonts.c /main/9 1998/06/16 15:20:49 msr $ */ +/* $Xorg: initfonts.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -43,7 +43,7 @@ * %W% %E% * */ -/* $XFree86: xc/programs/xfs/difs/initfonts.c,v 1.4 2000/02/13 06:15:44 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/initfonts.c,v 1.5 2001/01/17 23:45:29 dawes Exp $ */ #include "font.h" #include "difs.h" Index: xc/programs/xfs/difs/main.c diff -u xc/programs/xfs/difs/main.c:3.5 xc/programs/xfs/difs/main.c:3.7 --- xc/programs/xfs/difs/main.c:3.5 Thu Dec 7 15:26:26 2000 +++ xc/programs/xfs/difs/main.c Sun Apr 1 10:00:20 2001 @@ -1,4 +1,4 @@ -/* $TOG: main.c /main/16 1998/02/11 10:03:13 kaleb $ */ +/* $Xorg: main.c,v 1.4 2000/08/17 19:54:20 cpqbld Exp $ */ /* * Font server main routine */ @@ -42,8 +42,9 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/main.c,v 3.5 2000/12/07 20:26:26 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/main.c,v 3.7 2001/04/01 14:00:20 tsi Exp $ */ +#include <stdlib.h> #include "FS.h" #include "FSproto.h" #include "clientstr.h" Index: xc/programs/xfs/difs/resource.c diff -u xc/programs/xfs/difs/resource.c:3.4 xc/programs/xfs/difs/resource.c:3.5 --- xc/programs/xfs/difs/resource.c:3.4 Sun Mar 7 06:40:54 1999 +++ xc/programs/xfs/difs/resource.c Wed Jan 17 18:45:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: resource.c /main/9 1998/02/11 10:03:19 kaleb $ */ +/* $Xorg: resource.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -43,7 +43,7 @@ * %W% %G% * */ -/* $XFree86: xc/programs/xfs/difs/resource.c,v 3.4 1999/03/07 11:40:54 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/resource.c,v 3.5 2001/01/17 23:45:29 dawes Exp $ */ /* * a resource is a 32 bit quantity. the upper 12 bits are client id. * client provides a 19 bit resource id. this is "hashed" by me by Index: xc/programs/xfs/difs/swaprep.c diff -u xc/programs/xfs/difs/swaprep.c:1.3 xc/programs/xfs/difs/swaprep.c:1.4 --- xc/programs/xfs/difs/swaprep.c:1.3 Sun Oct 25 07:48:00 1998 +++ xc/programs/xfs/difs/swaprep.c Wed Jan 17 18:45:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: swaprep.c /main/12 1998/02/11 10:03:25 kaleb $ */ +/* $Xorg: swaprep.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* * font server reply swapping */ @@ -42,7 +42,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/swaprep.c,v 1.3 1998/10/25 12:48:00 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/swaprep.c,v 1.4 2001/01/17 23:45:29 dawes Exp $ */ #include <swaprep.h> #include <swapreq.h> Index: xc/programs/xfs/difs/swapreq.c diff -u xc/programs/xfs/difs/swapreq.c:1.4 xc/programs/xfs/difs/swapreq.c:1.5 --- xc/programs/xfs/difs/swapreq.c:1.4 Sat Aug 21 09:48:49 1999 +++ xc/programs/xfs/difs/swapreq.c Wed Jan 17 18:45:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: swapreq.c /main/9 1998/02/11 10:03:30 kaleb $ */ +/* $Xorg: swapreq.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* * swapped requests */ @@ -42,7 +42,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/swapreq.c,v 1.4 1999/08/21 13:48:49 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/swapreq.c,v 1.5 2001/01/17 23:45:29 dawes Exp $ */ #include <swapreq.h> Index: xc/programs/xfs/difs/tables.c diff -u xc/programs/xfs/difs/tables.c:1.4 xc/programs/xfs/difs/tables.c:1.5 --- xc/programs/xfs/difs/tables.c:1.4 Sun Mar 7 06:40:56 1999 +++ xc/programs/xfs/difs/tables.c Wed Jan 17 18:45:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: tables.c /main/7 1998/02/11 10:03:36 kaleb $ */ +/* $Xorg: tables.c,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* * all the dispatch, error, event and reply vectors */ @@ -42,7 +42,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/difs/tables.c,v 1.4 1999/03/07 11:40:56 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/difs/tables.c,v 1.5 2001/01/17 23:45:29 dawes Exp $ */ #include <dispatch.h> #include <swaprep.h> Index: xc/programs/xfs/include/access.h diff -u xc/programs/xfs/include/access.h:1.3 xc/programs/xfs/include/access.h:1.4 --- xc/programs/xfs/include/access.h:1.3 Sun Oct 25 07:48:01 1998 +++ xc/programs/xfs/include/access.h Wed Jan 17 18:45:30 2001 @@ -1,4 +1,4 @@ -/* $TOG: access.h /main/5 1998/02/11 10:02:39 kaleb $ */ +/* $Xorg: access.h,v 1.3 2000/08/17 19:54:20 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -43,7 +43,7 @@ * @(#)access.h 4.1 91/05/02 * */ -/* $XFree86: xc/programs/xfs/include/access.h,v 1.3 1998/10/25 12:48:01 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/access.h,v 1.4 2001/01/17 23:45:30 dawes Exp $ */ #ifndef _ACCESS_H_ #define _ACCESS_H_ Index: xc/programs/xfs/include/accstr.h diff -u xc/programs/xfs/include/accstr.h:1.4 xc/programs/xfs/include/accstr.h:1.5 --- xc/programs/xfs/include/accstr.h:1.4 Sun Mar 7 06:40:58 1999 +++ xc/programs/xfs/include/accstr.h Wed Jan 17 18:45:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: accstr.h /main/5 1998/02/11 10:02:44 kaleb $ */ +/* $Xorg: accstr.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -44,7 +44,7 @@ * @(#)accstr.h 4.1 91/05/02 * */ -/* $XFree86: xc/programs/xfs/include/accstr.h,v 1.4 1999/03/07 11:40:58 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/accstr.h,v 1.5 2001/01/17 23:45:31 dawes Exp $ */ #ifndef _ACCSTR_H_ #define _ACCSTR_H_ Index: xc/programs/xfs/include/assert.h diff -u xc/programs/xfs/include/assert.h:1.1.1.2 xc/programs/xfs/include/assert.h:1.1.1.3 --- xc/programs/xfs/include/assert.h:1.1.1.2 Sun Sep 27 04:51:34 1998 +++ xc/programs/xfs/include/assert.h Tue Jan 16 17:51:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: assert.h /main/5 1998/02/11 10:02:52 kaleb $ */ +/* $Xorg: assert.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group Index: xc/programs/xfs/include/auth.h diff -u xc/programs/xfs/include/auth.h:1.4 xc/programs/xfs/include/auth.h:1.5 --- xc/programs/xfs/include/auth.h:1.4 Sun Mar 7 06:40:58 1999 +++ xc/programs/xfs/include/auth.h Wed Jan 17 18:45:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: auth.h /main/5 1998/02/11 10:03:07 kaleb $ */ +/* $Xorg: auth.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -43,7 +43,7 @@ * @(#)auth.h 4.1 91/05/02 * */ -/* $XFree86: xc/programs/xfs/include/auth.h,v 1.4 1999/03/07 11:40:58 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/auth.h,v 1.5 2001/01/17 23:45:31 dawes Exp $ */ #ifndef _AUTH_H_ #define _AUTH_H_ Index: xc/programs/xfs/include/authstr.h diff -u xc/programs/xfs/include/authstr.h:1.1.1.2 xc/programs/xfs/include/authstr.h:1.1.1.3 --- xc/programs/xfs/include/authstr.h:1.1.1.2 Sun Sep 27 04:51:36 1998 +++ xc/programs/xfs/include/authstr.h Tue Jan 16 17:51:33 2001 @@ -1,4 +1,4 @@ -/* $TOG: authstr.h /main/6 1998/02/11 10:03:01 kaleb $ */ +/* $Xorg: authstr.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group Index: xc/programs/xfs/include/cache.h diff -u xc/programs/xfs/include/cache.h:1.3 xc/programs/xfs/include/cache.h:1.4 --- xc/programs/xfs/include/cache.h:1.3 Sun Oct 25 07:48:02 1998 +++ xc/programs/xfs/include/cache.h Wed Jan 17 18:45:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: cache.h /main/6 1998/02/11 10:03:18 kaleb $ */ +/* $Xorg: cache.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -43,7 +43,7 @@ * @(#)cache.h 4.1 91/05/02 * */ -/* $XFree86: xc/programs/xfs/include/cache.h,v 1.3 1998/10/25 12:48:02 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/cache.h,v 1.4 2001/01/17 23:45:31 dawes Exp $ */ #ifndef _CACHE_H_ #define _CACHE_H_ Index: xc/programs/xfs/include/cachestr.h diff -u xc/programs/xfs/include/cachestr.h:1.1.1.2 xc/programs/xfs/include/cachestr.h:1.1.1.3 --- xc/programs/xfs/include/cachestr.h:1.1.1.2 Sun Sep 27 04:51:38 1998 +++ xc/programs/xfs/include/cachestr.h Tue Jan 16 17:51:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: cachestr.h /main/5 1998/02/11 10:03:12 kaleb $ */ +/* $Xorg: cachestr.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group Index: xc/programs/xfs/include/client.h diff -u xc/programs/xfs/include/client.h:1.5 xc/programs/xfs/include/client.h:1.6 --- xc/programs/xfs/include/client.h:1.5 Sat Aug 21 09:48:50 1999 +++ xc/programs/xfs/include/client.h Wed Jan 17 18:45:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: client.h /main/6 1998/02/11 10:03:30 kaleb $ */ +/* $Xorg: client.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ /* Copyright 1990, 1991, 1998 The Open Group @@ -39,7 +39,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/include/client.h,v 1.5 1999/08/21 13:48:50 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/client.h,v 1.6 2001/01/17 23:45:31 dawes Exp $ */ #ifndef _CLIENT_H_ #define _CLIENT_H_ Index: xc/programs/xfs/include/clientstr.h diff -u xc/programs/xfs/include/clientstr.h:1.4 xc/programs/xfs/include/clientstr.h:1.5 --- xc/programs/xfs/include/clientstr.h:1.4 Sun Mar 7 06:40:59 1999 +++ xc/programs/xfs/include/clientstr.h Wed Jan 17 18:45:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: clientstr.h /main/8 1998/02/11 10:03:24 kaleb $ */ +/* $Xorg: clientstr.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -40,7 +40,7 @@ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/include/clientstr.h,v 1.4 1999/03/07 11:40:59 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/clientstr.h,v 1.5 2001/01/17 23:45:31 dawes Exp $ */ #ifndef _CLIENTSTR_H_ #define _CLIENTSTR_H_ Index: xc/programs/xfs/include/closestr.h diff -u xc/programs/xfs/include/closestr.h:1.1.1.4 xc/programs/xfs/include/closestr.h:1.1.1.5 --- xc/programs/xfs/include/closestr.h:1.1.1.4 Sun Sep 27 07:06:44 1998 +++ xc/programs/xfs/include/closestr.h Tue Jan 16 17:51:46 2001 @@ -1,4 +1,4 @@ -/* $TOG: closestr.h /main/9 1998/05/17 15:40:19 kaleb $ */ +/* $Xorg: closestr.h,v 1.3 2000/08/17 19:54:21 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -40,7 +40,7 @@ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $NCDId: @(#)closestr.h,v 4.1 1991/05/02 04:15:46 lemke Exp $ + * $NCDXorg: @(#)closestr.h,v 4.1 1991/05/02 04:15:46 lemke Exp $ * */ Index: xc/programs/xfs/include/closure.h diff -u xc/programs/xfs/include/closure.h:1.1.1.2 xc/programs/xfs/include/closure.h:1.1.1.3 --- xc/programs/xfs/include/closure.h:1.1.1.2 Sun Sep 27 04:51:41 1998 +++ xc/programs/xfs/include/closure.h Tue Jan 16 17:51:49 2001 @@ -1,4 +1,4 @@ -/* $TOG: closure.h /main/5 1998/02/11 10:03:41 kaleb $ */ +/* $Xorg: closure.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group Index: xc/programs/xfs/include/difsfn.h diff -u xc/programs/xfs/include/difsfn.h:1.3 xc/programs/xfs/include/difsfn.h:1.4 --- xc/programs/xfs/include/difsfn.h:1.3 Sun Oct 25 07:48:03 1998 +++ xc/programs/xfs/include/difsfn.h Wed Jan 17 18:45:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: difsfn.h /main/7 1998/02/11 10:03:50 kaleb $ */ +/* $Xorg: difsfn.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -40,7 +40,7 @@ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/include/difsfn.h,v 1.3 1998/10/25 12:48:03 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/difsfn.h,v 1.4 2001/01/17 23:45:31 dawes Exp $ */ #ifndef _DIFSFONT_H_ #define _DIFSFONT_H_ Index: xc/programs/xfs/include/difsfnst.h diff -u xc/programs/xfs/include/difsfnst.h:1.3 xc/programs/xfs/include/difsfnst.h:1.4 --- xc/programs/xfs/include/difsfnst.h:1.3 Sun Mar 7 09:23:32 1999 +++ xc/programs/xfs/include/difsfnst.h Wed Jan 17 18:45:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: difsfnst.h /main/7 1998/02/11 10:03:45 kaleb $ */ +/* $Xorg: difsfnst.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -40,7 +40,7 @@ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/include/difsfnst.h,v 1.3 1999/03/07 14:23:32 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/difsfnst.h,v 1.4 2001/01/17 23:45:31 dawes Exp $ */ #ifndef _DIFSFONTST_H_ #define _DIFSFONTST_H_ Index: xc/programs/xfs/include/extentst.h diff -u xc/programs/xfs/include/extentst.h:1.4 xc/programs/xfs/include/extentst.h:1.5 --- xc/programs/xfs/include/extentst.h:1.4 Sun Mar 7 06:41:00 1999 +++ xc/programs/xfs/include/extentst.h Wed Jan 17 18:45:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: extentst.h /main/5 1998/02/11 10:03:59 kaleb $ */ +/* $Xorg: extentst.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -43,7 +43,7 @@ * @(#)extentst.h 4.1 91/05/02 * */ -/* $XFree86: xc/programs/xfs/include/extentst.h,v 1.4 1999/03/07 11:41:00 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/extentst.h,v 1.5 2001/01/17 23:45:31 dawes Exp $ */ #ifndef _EXTENTST_H_ #define _EXTENTST_H_ Index: xc/programs/xfs/include/globals.h diff -u xc/programs/xfs/include/globals.h:1.1.1.2 xc/programs/xfs/include/globals.h:1.1.1.3 --- xc/programs/xfs/include/globals.h:1.1.1.2 Sun Sep 27 04:51:45 1998 +++ xc/programs/xfs/include/globals.h Tue Jan 16 17:51:59 2001 @@ -1,4 +1,4 @@ -/* $TOG: globals.h /main/6 1998/02/11 10:04:03 kaleb $ */ +/* $Xorg: globals.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group Index: xc/programs/xfs/include/misc.h diff -u xc/programs/xfs/include/misc.h:3.5 xc/programs/xfs/include/misc.h:3.6 --- xc/programs/xfs/include/misc.h:3.5 Sat Aug 21 09:48:51 1999 +++ xc/programs/xfs/include/misc.h Wed Jan 17 18:45:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: misc.h /main/10 1998/02/11 10:04:07 kaleb $ */ +/* $Xorg: misc.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1990, 1991, 1998 The Open Group @@ -39,7 +39,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/include/misc.h,v 3.5 1999/08/21 13:48:51 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/misc.h,v 3.6 2001/01/17 23:45:31 dawes Exp $ */ #ifndef _MISC_H_ #define _MISC_H_ Index: xc/programs/xfs/include/os.h diff -u xc/programs/xfs/include/os.h:3.9 xc/programs/xfs/include/os.h:3.10 --- xc/programs/xfs/include/os.h:3.9 Thu Nov 30 18:30:09 2000 +++ xc/programs/xfs/include/os.h Wed Jan 17 18:45:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: os.h /main/12 1998/02/11 10:04:16 kaleb $ */ +/* $Xorg: os.h,v 1.4 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -40,10 +40,10 @@ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $NCDId: @(#)os.h,v 4.2 1991/05/10 07:59:16 lemke Exp $ + * $NCDXorg: @(#)os.h,v 4.2 1991/05/10 07:59:16 lemke Exp $ * */ -/* $XFree86: xc/programs/xfs/include/os.h,v 3.9 2000/11/30 23:30:09 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/include/os.h,v 3.10 2001/01/17 23:45:31 dawes Exp $ */ #ifndef _OS_H_ #define _OS_H_ Index: xc/programs/xfs/include/osstruct.h diff -u xc/programs/xfs/include/osstruct.h:1.1.1.3 xc/programs/xfs/include/osstruct.h:1.1.1.4 --- xc/programs/xfs/include/osstruct.h:1.1.1.3 Sun Sep 27 04:51:50 1998 +++ xc/programs/xfs/include/osstruct.h Tue Jan 16 17:52:04 2001 @@ -1,4 +1,4 @@ -/* $TOG: osstruct.h /main/6 1998/02/11 10:04:12 kaleb $ */ +/* $Xorg: osstruct.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group Index: xc/programs/xfs/include/servermd.h diff -u xc/programs/xfs/include/servermd.h:1.1.1.4 xc/programs/xfs/include/servermd.h:1.1.1.5 --- xc/programs/xfs/include/servermd.h:1.1.1.4 Sun Sep 27 04:51:52 1998 +++ xc/programs/xfs/include/servermd.h Tue Jan 16 17:52:09 2001 @@ -1,4 +1,4 @@ -/* $TOG: servermd.h /main/12 1998/02/11 10:04:24 kaleb $ */ +/* $Xorg: servermd.h,v 1.4 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -44,11 +44,11 @@ #define _SERVERMD_H_ #ifndef VENDOR_RELEASE -#define VENDOR_RELEASE 6300 +#define VENDOR_RELEASE 6510 #endif #ifndef VENDOR_STRING -#define VENDOR_STRING "The Open Group" +#define VENDOR_STRING "The X.Org Group" #endif #ifndef DEFAULT_FS_PORT Index: xc/programs/xfs/include/site.h diff -u xc/programs/xfs/include/site.h:1.1.1.2 xc/programs/xfs/include/site.h:1.1.1.3 --- xc/programs/xfs/include/site.h:1.1.1.2 Sun Sep 27 04:51:53 1998 +++ xc/programs/xfs/include/site.h Tue Jan 16 17:52:11 2001 @@ -1,4 +1,4 @@ -/* $TOG: site.h /main/7 1998/02/11 10:04:27 kaleb $ */ +/* $Xorg: site.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group Index: xc/programs/xfs/os/Imakefile diff -u xc/programs/xfs/os/Imakefile:3.6 xc/programs/xfs/os/Imakefile:3.7 --- xc/programs/xfs/os/Imakefile:3.6 Thu Nov 30 18:30:09 2000 +++ xc/programs/xfs/os/Imakefile Wed Jan 17 18:45:32 2001 @@ -1,5 +1,10 @@ -XCOMM $XConsortium: Imakefile /main/17 1995/12/19 16:35:21 mor $ -XCOMM $XFree86: xc/programs/xfs/os/Imakefile,v 3.6 2000/11/30 23:30:09 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xfs/os/Imakefile,v 3.7 2001/01/17 23:45:32 dawes Exp $ + #undef ServerDefines #include <Server.tmpl> Index: xc/programs/xfs/os/access.c diff -u xc/programs/xfs/os/access.c:3.3 xc/programs/xfs/os/access.c:3.4 --- xc/programs/xfs/os/access.c:3.3 Sun Oct 25 02:12:34 1998 +++ xc/programs/xfs/os/access.c Wed Jan 17 18:45:32 2001 @@ -1,4 +1,4 @@ -/* $TOG: access.c /main/12 1998/02/11 10:06:16 kaleb $ */ +/* $Xorg: access.c,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1990, 1991, 1998 The Open Group @@ -39,7 +39,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/access.c,v 3.3 1998/10/25 07:12:34 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/access.c,v 3.4 2001/01/17 23:45:32 dawes Exp $ */ #include <X11/Xos.h> #ifndef MINIX Index: xc/programs/xfs/os/config.c diff -u xc/programs/xfs/os/config.c:3.9 xc/programs/xfs/os/config.c:3.10 --- xc/programs/xfs/os/config.c:3.9 Thu Nov 30 18:30:10 2000 +++ xc/programs/xfs/os/config.c Wed Jan 17 18:45:32 2001 @@ -1,4 +1,4 @@ -/* $TOG: config.c /main/16 1998/02/11 10:06:25 kaleb $ */ +/* $Xorg: config.c,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -40,10 +40,10 @@ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $NCDId: @(#)config.c,v 4.6 1991/07/09 14:08:09 lemke Exp $ + * $NCDXorg: @(#)config.c,v 4.6 1991/07/09 14:08:09 lemke Exp $ * */ -/* $XFree86: xc/programs/xfs/os/config.c,v 3.9 2000/11/30 23:30:10 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/config.c,v 3.10 2001/01/17 23:45:32 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/xfs/os/config.h diff -u xc/programs/xfs/os/config.h:1.1.1.2 xc/programs/xfs/os/config.h:1.1.1.3 --- xc/programs/xfs/os/config.h:1.1.1.2 Sun Sep 27 04:51:56 1998 +++ xc/programs/xfs/os/config.h Tue Jan 16 17:50:58 2001 @@ -1,4 +1,4 @@ -/* $TOG: config.h /main/5 1998/02/11 10:06:30 kaleb $ */ +/* $Xorg: config.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group Index: xc/programs/xfs/os/configstr.h diff -u xc/programs/xfs/os/configstr.h:1.3 xc/programs/xfs/os/configstr.h:1.4 --- xc/programs/xfs/os/configstr.h:1.3 Sun Mar 7 09:23:33 1999 +++ xc/programs/xfs/os/configstr.h Wed Jan 17 18:45:32 2001 @@ -1,4 +1,4 @@ -/* $TOG: configstr.h /main/5 1998/02/11 10:06:20 kaleb $ */ +/* $Xorg: configstr.h,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -43,7 +43,7 @@ * @(#)configstr.h 4.1 91/05/02 * */ -/* $XFree86: xc/programs/xfs/os/configstr.h,v 1.3 1999/03/07 14:23:33 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/configstr.h,v 1.4 2001/01/17 23:45:32 dawes Exp $ */ #ifndef _CONFIGSTR_H_ #define _CONFIGSTR_H_ #include "config.h" Index: xc/programs/xfs/os/connection.c diff -u xc/programs/xfs/os/connection.c:3.19 xc/programs/xfs/os/connection.c:3.20 --- xc/programs/xfs/os/connection.c:3.19 Thu Nov 30 18:30:10 2000 +++ xc/programs/xfs/os/connection.c Wed Jan 17 18:45:32 2001 @@ -1,4 +1,4 @@ -/* $TOG: connection.c /main/35 1998/02/11 10:06:34 kaleb $ */ +/* $Xorg: connection.c,v 1.4 2000/08/17 19:54:22 cpqbld Exp $ */ /* * handles connections */ @@ -63,7 +63,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/connection.c,v 3.19 2000/11/30 23:30:10 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/connection.c,v 3.20 2001/01/17 23:45:32 dawes Exp $ */ #include <X11/Xtrans.h> #include <stdlib.h> Index: xc/programs/xfs/os/daemon.c diff -u xc/programs/xfs/os/daemon.c:1.1.2.1 xc/programs/xfs/os/daemon.c:1.5 --- xc/programs/xfs/os/daemon.c:1.1.2.1 Wed Mar 7 11:04:19 2001 +++ xc/programs/xfs/os/daemon.c Thu Apr 26 16:26:31 2001 @@ -27,17 +27,18 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xfs/os/daemon.c,v 1.1.2.1 2001/03/07 16:04:19 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/daemon.c,v 1.5 2001/04/26 20:26:31 alanh Exp $ */ #include <X11/Xos.h> #include <stdio.h> +#include <stdlib.h> #if defined(SVR4) || defined(USG) #include <termios.h> #else #include <sys/ioctl.h> #endif -#if defined(__osf__) || defined(linux) || defined(MINIX) || defined(__GNU__) +#if defined(__osf__) || defined(linux) || defined(MINIX) || defined(__GNU__) || defined(__CYGWIN__) #define setpgrp setpgid #endif #ifdef hpux @@ -127,7 +128,7 @@ close (1); close (2); -#ifndef __EMX__ +#if !defined(__EMX__) && !defined(__CYGWIN__) #ifdef MINIX #if 0 /* Use setsid() to get rid of our controlling tty, this requires an extra Index: xc/programs/xfs/os/error.c diff -u xc/programs/xfs/os/error.c:1.6 xc/programs/xfs/os/error.c:1.8 --- xc/programs/xfs/os/error.c:1.6 Thu Nov 30 18:30:10 2000 +++ xc/programs/xfs/os/error.c Sun Apr 1 10:00:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: error.c /main/10 1998/02/11 10:06:39 kaleb $ */ +/* $Xorg: error.c,v 1.3 2000/08/17 19:54:22 cpqbld Exp $ */ /* * error message handling */ @@ -40,9 +40,10 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/error.c,v 1.6 2000/11/30 23:30:10 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/error.c,v 1.8 2001/04/01 14:00:21 tsi Exp $ */ #include <stdio.h> +#include <stdlib.h> #include <stdarg.h> #include <X11/Xos.h> Index: xc/programs/xfs/os/io.c diff -u xc/programs/xfs/os/io.c:3.11 xc/programs/xfs/os/io.c:3.12 --- xc/programs/xfs/os/io.c:3.11 Thu Nov 30 18:30:11 2000 +++ xc/programs/xfs/os/io.c Wed Jan 17 18:45:32 2001 @@ -1,4 +1,4 @@ -/* $TOG: io.c /main/19 1998/02/11 10:06:43 kaleb $ */ +/* $Xorg: io.c,v 1.4 2000/08/17 19:54:22 cpqbld Exp $ */ /* * i/o functions */ @@ -42,7 +42,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/io.c,v 3.11 2000/11/30 23:30:11 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/io.c,v 3.12 2001/01/17 23:45:32 dawes Exp $ */ #include <X11/Xtrans.h> #include <stdio.h> Index: xc/programs/xfs/os/osdep.h diff -u xc/programs/xfs/os/osdep.h:3.7 xc/programs/xfs/os/osdep.h:3.8 --- xc/programs/xfs/os/osdep.h:3.7 Sun Dec 26 19:40:12 1999 +++ xc/programs/xfs/os/osdep.h Wed Jan 17 18:45:32 2001 @@ -1,4 +1,4 @@ -/* $TOG: osdep.h /main/11 1998/02/11 10:06:49 kaleb $ */ +/* $Xorg: osdep.h,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -43,7 +43,7 @@ * @(#)osdep.h 4.1 5/2/91 * */ -/* $XFree86: xc/programs/xfs/os/osdep.h,v 3.7 1999/12/27 00:40:12 robin Exp $ */ +/* $XFree86: xc/programs/xfs/os/osdep.h,v 3.8 2001/01/17 23:45:32 dawes Exp $ */ #ifndef _OSDEP_H_ #define _OSDEP_H_ Index: xc/programs/xfs/os/osglue.c diff -u xc/programs/xfs/os/osglue.c:3.9 xc/programs/xfs/os/osglue.c:3.10 --- xc/programs/xfs/os/osglue.c:3.9 Sun Mar 7 06:41:07 1999 +++ xc/programs/xfs/os/osglue.c Wed Jan 17 18:45:33 2001 @@ -1,4 +1,4 @@ -/* $TOG: osglue.c /main/14 1998/02/11 10:06:54 kaleb $ */ +/* $Xorg: osglue.c,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -40,10 +40,10 @@ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $NCDId: @(#)osglue.c,v 4.6 1991/07/09 14:07:30 lemke Exp $ + * $NCDXorg: @(#)osglue.c,v 4.6 1991/07/09 14:07:30 lemke Exp $ * */ -/* $XFree86: xc/programs/xfs/os/osglue.c,v 3.9 1999/03/07 11:41:07 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/osglue.c,v 3.10 2001/01/17 23:45:33 dawes Exp $ */ /* * this is miscellaneous OS specific stuff. Index: xc/programs/xfs/os/osinit.c diff -u xc/programs/xfs/os/osinit.c:1.3 xc/programs/xfs/os/osinit.c:1.4 --- xc/programs/xfs/os/osinit.c:1.3 Sun Mar 7 09:23:34 1999 +++ xc/programs/xfs/os/osinit.c Wed Jan 17 18:45:33 2001 @@ -1,4 +1,4 @@ -/* $TOG: osinit.c /main/7 1998/02/11 10:07:02 kaleb $ */ +/* $Xorg: osinit.c,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ /* * os init code */ @@ -46,7 +46,7 @@ * @(#)osinit.c 4.3 5/7/91 * */ -/* $XFree86: xc/programs/xfs/os/osinit.c,v 1.3 1999/03/07 14:23:34 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/osinit.c,v 1.4 2001/01/17 23:45:33 dawes Exp $ */ #include "os.h" Index: xc/programs/xfs/os/utils.c diff -u xc/programs/xfs/os/utils.c:3.11 xc/programs/xfs/os/utils.c:3.13 --- xc/programs/xfs/os/utils.c:3.11 Thu Nov 30 18:30:11 2000 +++ xc/programs/xfs/os/utils.c Tue Feb 13 14:19:18 2001 @@ -1,4 +1,4 @@ -/* $TOG: utils.c /main/21 1998/02/11 10:07:08 kaleb $ */ +/* $Xorg: utils.c,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ /* * misc os utilities */ @@ -42,7 +42,7 @@ * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF * THIS SOFTWARE. */ -/* $XFree86: xc/programs/xfs/os/utils.c,v 3.11 2000/11/30 23:30:11 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/utils.c,v 3.13 2001/02/13 19:19:18 dawes Exp $ */ #include <stdio.h> #include <X11/Xos.h> @@ -474,10 +474,12 @@ ErrorF("fatal: couldn't set groupid to xfs user's group\n"); exit(1); } +#ifndef __CYGWIN__ if (setgroups(0, NULL)) { ErrorF("fatal: couldn't drop supplementary groups\n"); exit(1); } +#endif if (initgroups(user, pwent->pw_gid)) { ErrorF("fatal: couldn't init supplementary groups\n"); exit(1); Index: xc/programs/xfs/os/waitfor.c diff -u xc/programs/xfs/os/waitfor.c:3.11 xc/programs/xfs/os/waitfor.c:3.12 --- xc/programs/xfs/os/waitfor.c:3.11 Thu Jun 15 16:50:04 2000 +++ xc/programs/xfs/os/waitfor.c Wed Jan 17 18:45:33 2001 @@ -1,4 +1,4 @@ -/* $TOG: waitfor.c /main/16 1998/02/11 10:07:12 kaleb $ */ +/* $Xorg: waitfor.c,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ /* * waits for input */ @@ -43,10 +43,10 @@ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * - * $NCDId: @(#)waitfor.c,v 4.5 1991/06/24 11:59:20 lemke Exp $ + * $NCDXorg: @(#)waitfor.c,v 4.5 1991/06/24 11:59:20 lemke Exp $ * */ -/* $XFree86: xc/programs/xfs/os/waitfor.c,v 3.11 2000/06/15 20:50:04 dawes Exp $ */ +/* $XFree86: xc/programs/xfs/os/waitfor.c,v 3.12 2001/01/17 23:45:33 dawes Exp $ */ #include <X11/Xos.h> /* strings, time, etc */ Index: xc/programs/xfsinfo/Imakefile diff -u /dev/null xc/programs/xfsinfo/Imakefile:1.1 --- /dev/null Mon Jun 4 12:42:54 2001 +++ xc/programs/xfsinfo/Imakefile Sat Jan 6 16:58:28 2001 @@ -0,0 +1,9 @@ +XCOMM $XConsortium: Imakefile /main/8 1996/09/28 17:16:50 rws $ +LOCAL_LIBRARIES = $(FSLIB) +DEPLIBS = $(DEPFSLIB) +SRCS = xfsinfo.c +OBJS = xfsinfo.o +INCLUDES = -I$(XBUILDINCDIR)/fonts -I$(FONTINCSRC) + +ComplexProgramTarget(xfsinfo) + Index: xc/programs/xfsinfo/xfsinfo.c diff -u /dev/null xc/programs/xfsinfo/xfsinfo.c:1.2 --- /dev/null Mon Jun 4 12:42:54 2001 +++ xc/programs/xfsinfo/xfsinfo.c Sun Apr 1 10:00:21 2001 @@ -0,0 +1,173 @@ +/* + * xfsinfo -- report info about a font server + */ + +/* $TOG: fsinfo.c /main/7 1998/02/09 13:43:08 kaleb $ */ +/* + +Portions Copyright 1987, 1998 The Open Group + +All Rights Reserved. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* $XFree86: xc/programs/xfsinfo/xfsinfo.c,v 1.2 2001/04/01 14:00:21 tsi Exp $ */ + +/* + * Copyright 1990 Network Computing Devices; + * Portions Copyright 1987 by Digital Equipment Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * documentation for any purpose is hereby granted without fee, provided that + * the above copyright notice appear in all copies and that both that + * copyright notice and this permission notice appear in supporting + * documentation, and that the names of Network Computing Devices + * or Digital not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. Network Computing Devices and Digital + * make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NETWORK COMPUTING DEVICES AND DIGITAL DISCLAIM ALL WARRANTIES WITH + * REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL NETWORK COMPUTING DEVICES OR DIGITAL BE + * LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION + * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN + * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <X11/Xos.h> +#include "FSlib.h" + +static void print_server_info(FSServer *svr); +static void print_catalogue_info(FSServer *svr); +static void print_extension_info(FSServer *svr); +static void print_alternate_info(FSServer *svr); + +char *progname; + +static void +usage(void) +{ + fprintf(stderr, "usage: %s [-server server_name]\n", progname); + exit(-1); +} + +int +main(int argc, char *argv[]) +{ + FSServer *svr; + char *servername = NULL; + int i; + + progname = argv[0]; + + for (i = 1; i < argc; i++) { + if (strncmp(argv[i], "-s", 2) == 0) { + if (++i > argc) + usage(); + servername = argv[i]; + } else { + usage(); + } + } + + svr = FSOpenServer(servername); + + if (!svr) { + if (FSServerName(servername) == NULL) { + fprintf(stderr, "%s: no font server defined\n", progname); + exit(1); + } + fprintf(stderr, "%s: unable to open server \"%s\"\n", + progname, FSServerName(servername)); + exit(1); + } + print_server_info(svr); + FSCloseServer(svr); + exit(0); +} + +static void +print_server_info(FSServer *svr) +{ + printf("name of server: %s\n", FSServerString(svr)); + printf("version number: %d\n", FSProtocolVersion(svr)); + printf("vendor string: %s\n", FSServerVendor(svr)); + printf("vendor release number: %d\n", FSVendorRelease(svr)); + printf("maximum request size: %ld longwords (%ld bytes)\n", + FSMaxRequestSize(svr), FSMaxRequestSize(svr) * sizeof(long)); + print_catalogue_info(svr); + print_alternate_info(svr); + print_extension_info(svr); +} + +static void +print_catalogue_info(FSServer *svr) +{ + int n = 0; + char **cats = FSListCatalogues(svr, "*", 1000, &n); + + printf("number of catalogues: %d\n", n); + if (cats) { + int i; + + for (i = 0; i < n; i++) { + printf(" %s\n", cats[i]); + } + } +} + +static void +print_extension_info(FSServer *svr) +{ + int n = 0; + char **extlist = FSListExtensions(svr, &n); + + printf("number of extensions: %d\n", n); + if (extlist) { + int i; + + for (i = 0; i < n; i++) { + printf(" %s\n", extlist[i]); + } + } +} + +static void +print_alternate_info(FSServer *svr) +{ + AlternateServer *alts; + int i, + num; + + num = FSNumAlternateServers(svr); + printf("Number of alternate servers: %d\n", num); + if (num) { + alts = FSAlternateServers(svr); + for (i = 0; i < num; i++) { + printf(" #%1d\t%s%s\n", i, alts[i].name, + (alts[i].subset) ? "(subset)" : ""); + } + } +} Index: xc/programs/xfsinfo/xfsinfo.man diff -u /dev/null xc/programs/xfsinfo/xfsinfo.man:1.4 --- /dev/null Mon Jun 4 12:42:54 2001 +++ xc/programs/xfsinfo/xfsinfo.man Wed Apr 18 12:13:23 2001 @@ -0,0 +1,79 @@ +.\" $TOG: fsinfo.man /main/10 1998/02/09 13:43:12 kaleb $ +.\" Copyright 1991, Network Computing Devices, Inc +.\" Copyright 1993, 1998 The Open Group +.\" +.\" All Rights Reserved. +.\" +.\" The above copyright notice and this permission notice shall be included +.\" in all copies or substantial portions of the Software. +.\" +.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +.\" OTHER DEALINGS IN THE SOFTWARE. +.\" +.\" Except as contained in this notice, the name of The Open Group shall +.\" not be used in advertising or otherwise to promote the sale, use or +.\" other dealings in this Software without prior written authorization +.\" from The Open Group. +.\" +.\" $XFree86: xc/programs/xfsinfo/xfsinfo.man,v 1.4 2001/04/18 16:13:23 dawes Exp $ +.\" +.TH XFSINFO 1 __xorgversion__ +.SH NAME +xfsinfo \- X font server information utility +.SH SYNOPSIS +.B "xfsinfo" +[\-server \fIservername\fP] +.SH DESCRIPTION +.PP +.I Xfsinfo +is a utility for displaying information about an X font server. It is used to +examine the +capabilities of a server, the predefined values for various parameters used +in communicating between clients and the server, and the font catalogues +and alternate servers that are available. +.SH "OPTIONS" +.PP +.TP +.B \-server \fIhost\fP:\fIport\fP +This option specifies the X font server to contact. +.SH HISTORY +.I Xfsinfo +was originally called +.I fsinfo. +It was renamed to avoid a clash with the +.I fsinfo +utility from the Berkeley automounter +.I amd. +.SH EXAMPLE +.PP +The following shows a sample produced by +.I xfsinfo. +.PP +.nf +name of server: hansen:7100 +version number: 1 +vendor string: Font Server Prototype +vendor release number: 17 +maximum request size: 16384 longwords (65536 bytes) +number of catalogues: 1 + all +Number of alternate servers: 2 +\& #0 hansen:7101 +\& #1 hansen:7102 +number of extensions: 0 +.fi + +.SH ENVIRONMENT +.PP +.TP 8 +.B FONTSERVER +To get the default fontserver. +.SH "SEE ALSO" +xfs(1), fslsfonts(1) +.SH AUTHOR +Dave Lemke, Network Computing Devices, Inc Index: xc/programs/xftcache/Imakefile diff -u /dev/null xc/programs/xftcache/Imakefile:1.3 --- /dev/null Mon Jun 4 12:42:54 2001 +++ xc/programs/xftcache/Imakefile Sun Apr 1 10:00:21 2001 @@ -0,0 +1,15 @@ +XCOMM $XFree86: xc/programs/xftcache/Imakefile,v 1.3 2001/04/01 14:00:21 tsi Exp $ + + + +INCLUDES=$(FREETYPE2INCLUDES) +DEFINES=$(FREETYPE2DEFINES) $(RENDERDEFINES) +DEPLIBS=$(DEPXFTLIB) $(DEPXRENDERLIB) $(DEPXLIB) +LOCAL_LIBRARIES=$(XFTLIB) $(XRENDERLIB) $(XLIB) $(FREETYPE2LIB) + +SRCS=xftcache.c +OBJS=xftcache.o + +ComplexProgramTarget(xftcache) +LinkBuildBinary(ProgramTargetName(xftcache)) + Index: xc/programs/xftcache/xftcache.c diff -u /dev/null xc/programs/xftcache/xftcache.c:1.1 --- /dev/null Mon Jun 4 12:42:54 2001 +++ xc/programs/xftcache/xftcache.c Mon Jan 1 21:48:42 2001 @@ -0,0 +1,88 @@ +/* + * $XFree86: xc/programs/xftcache/xftcache.c,v 1.1 2001/01/02 02:48:42 keithp Exp $ + * + * Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. + * + * 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 Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR + * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, + * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER + * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + */ + +#include <X11/Xlib.h> +#include <X11/Xft/XftFreetype.h> +#include <stdio.h> + +extern char **XftConfigDirs; + +int +main (int argc, char **argv) +{ + int ret = 0; + XftFontSet *set; + char **dirs; + + if (!XftInit (0)) + { + fprintf (stderr, "Can't init Xft library\n"); + return -1; + } + /* + * This will scan all of the directories into a single database + * which is not useful here + */ + if (!XftInitFtLibrary()) + { + fprintf (stderr, "Can't init FreeType library\n"); + return -1; + } + if (argv[1]) + dirs = argv+1; + else + dirs = XftConfigDirs; + /* + * Now scan all of the directories into separate databases + * and write out the results + */ + while (*dirs) + { + set = XftFontSetCreate (); + if (!set) + { + fprintf (stderr, "Out of memory in \"%s\"\n", *dirs); + ret++; + } + else + { + if (!XftDirScan (set, *dirs, True)) + { + fprintf (stderr, "Can't scan directory \"%s\"\n", *dirs); + ret++; + } + else + { + if (!XftDirSave (set, *dirs)) + { + fprintf (stderr, "Can't save cache in \"%s\"\n", *dirs); + ret++; + } + } + XftFontSetDestroy (set); + } + ++dirs; + } + return ret; +} Index: xc/programs/xftcache/xftcache.man diff -u /dev/null xc/programs/xftcache/xftcache.man:1.3 --- /dev/null Mon Jun 4 12:42:54 2001 +++ xc/programs/xftcache/xftcache.man Thu Feb 8 22:47:56 2001 @@ -0,0 +1,45 @@ +.\" +.\" Copyright © 2000 Keith Packard, member of The XFree86 Project, Inc. +.\" +.\" 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 Keith Packard not be used in +.\" advertising or publicity pertaining to distribution of the software without +.\" specific, written prior permission. Keith Packard makes no +.\" representations about the suitability of this software for any purpose. It +.\" is provided "as is" without express or implied warranty. +.\" +.\" KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +.\" INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +.\" EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR +.\" CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, +.\" DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER +.\" TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +.\" PERFORMANCE OF THIS SOFTWARE. +.\" +.\" +.\" $XFree86: xc/programs/xftcache/xftcache.man,v 1.3 2001/02/09 03:47:56 tsi Exp $ +.\" +.TH XFTCACHE 1 __vendorversion__ +.SH NAME +xftcache, XftCache \- create an index of FreeType font files in a directory +.SH SYNOPSIS +.B "xftcache" +.RI [ directory-name +\|.\|.\|. ] +.SH DESCRIPTION +If directory arguments are not given, +.I xftcache +uses each directory in the current Xft configuration. Each directory is +scanned for font files readable by FreeType. A cache is created which +contains properties of each font and the associated filename. This cache is +used to speed application startup when using the Xft library. +.SH FILES +.TP 15 +.B XftCache +Maps file names to font properties. Read by the Xft library at application +startup to locate appropriate fonts. +.SH "SEE ALSO" +Xft(3), Xrender(3) Index: xc/programs/xfwp/Imakefile diff -u xc/programs/xfwp/Imakefile:1.5 xc/programs/xfwp/Imakefile:1.6 --- xc/programs/xfwp/Imakefile:1.5 Sat Dec 13 21:55:43 1997 +++ xc/programs/xfwp/Imakefile Wed Jan 17 18:45:34 2001 @@ -1,4 +1,4 @@ -XCOMM $TOG: Imakefile /main/11 1997/12/12 07:32:15 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ DEPLIBS = $(DEPICELIB) LOCAL_LIBRARIES = $(ICELIB) Index: xc/programs/xfwp/io.c diff -u xc/programs/xfwp/io.c:1.8 xc/programs/xfwp/io.c:1.9 --- xc/programs/xfwp/io.c:1.8 Mon Jun 26 19:00:33 2000 +++ xc/programs/xfwp/io.c Wed Jan 17 18:45:34 2001 @@ -1,4 +1,4 @@ -/* $TOG: io.c /main/13 1998/01/11 08:25:36 kaleb $ */ +/* $Xorg: io.c,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ /* Copyright "1986-1997 The Open Group All Rights Reserved @@ -32,7 +32,7 @@ X Window System is a trademark of The Open Group. */ -/* $XFree86: xc/programs/xfwp/io.c,v 1.8 2000/06/26 23:00:33 dawes Exp $ */ +/* $XFree86: xc/programs/xfwp/io.c,v 1.9 2001/01/17 23:45:34 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> Index: xc/programs/xfwp/io.h diff -u xc/programs/xfwp/io.h:1.2 xc/programs/xfwp/io.h:1.3 --- xc/programs/xfwp/io.h:1.2 Thu Jun 22 20:44:36 2000 +++ xc/programs/xfwp/io.h Wed Jan 17 18:45:34 2001 @@ -1,4 +1,4 @@ -/* $TOG: io.h /main/4 1998/02/09 13:58:12 kaleb $ */ +/* $Xorg: io.h,v 1.3 2000/08/17 19:54:23 cpqbld Exp $ */ /* Copyright "1986-1997, 1998 The Open Group Index: xc/programs/xfwp/misc.c diff -u xc/programs/xfwp/misc.c:1.5 xc/programs/xfwp/misc.c:1.6 --- xc/programs/xfwp/misc.c:1.5 Tue Mar 2 06:49:39 1999 +++ xc/programs/xfwp/misc.c Wed Jan 17 18:45:34 2001 @@ -1,4 +1,4 @@ -/* $TOG: misc.c /main/11 1997/12/04 13:14:03 barstow $ */ +/* $Xorg: misc.c,v 1.5 2000/08/17 19:54:23 cpqbld Exp $ */ /* Copyright "1986-1997 The Open Group All Rights Reserved @@ -31,7 +31,7 @@ X Window System is a trademark of The Open Group. */ -/* $XFree86: xc/programs/xfwp/misc.c,v 1.5 1999/03/02 11:49:39 dawes Exp $ */ +/* $XFree86: xc/programs/xfwp/misc.c,v 1.6 2001/01/17 23:45:34 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> @@ -407,7 +407,7 @@ if ((config_file_data[line_number]->operator = (char *) malloc (strlen(result) + 1)) == NULL) { - (void) fprintf(stderr, "malloc - config rule (operator)\n"); + (void) fprintf(stderr, "malloc - config rule (op)\n"); return 0; } strcpy(config_file_data[line_number]->operator, result); Index: xc/programs/xfwp/misc.h diff -u xc/programs/xfwp/misc.h:1.2 xc/programs/xfwp/misc.h:1.3 --- xc/programs/xfwp/misc.h:1.2 Thu Jun 22 20:44:36 2000 +++ xc/programs/xfwp/misc.h Wed Jan 17 18:45:34 2001 @@ -1,4 +1,4 @@ -/* $TOG: misc.h /main/5 1998/02/09 13:58:22 kaleb $ */ +/* $Xorg: misc.h,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ /* Copyright "1986-1997, 1998 The Open Group Index: xc/programs/xfwp/pm.c diff -u xc/programs/xfwp/pm.c:1.5 xc/programs/xfwp/pm.c:1.6 --- xc/programs/xfwp/pm.c:1.5 Tue Mar 2 06:49:40 1999 +++ xc/programs/xfwp/pm.c Wed Jan 17 18:45:34 2001 @@ -1,4 +1,4 @@ -/* $TOG: pm.c /main/8 1997/11/12 08:16:18 barstow $ */ +/* $Xorg: pm.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ /* Copyright "1986-1997 The Open Group All Rights Reserved @@ -32,7 +32,7 @@ X Window System is a trademark of The Open Group. */ -/* $XFree86: xc/programs/xfwp/pm.c,v 1.5 1999/03/02 11:49:40 dawes Exp $ */ +/* $XFree86: xc/programs/xfwp/pm.c,v 1.6 2001/01/17 23:45:34 dawes Exp $ */ #include <stdio.h> #include <stdlib.h> Index: xc/programs/xfwp/pm.h diff -u xc/programs/xfwp/pm.h:1.3 xc/programs/xfwp/pm.h:1.4 --- xc/programs/xfwp/pm.h:1.3 Tue Mar 2 06:49:40 1999 +++ xc/programs/xfwp/pm.h Wed Jan 17 18:45:34 2001 @@ -1,4 +1,4 @@ -/* $TOG: pm.h /main/2 1997/11/10 16:08:00 barstow $ */ +/* $Xorg: pm.h,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ /* Copyright "1986-1997 The Open Group All Rights Reserved @@ -32,7 +32,7 @@ X Window System is a trademark of The Open Group. */ -/* $XFree86: xc/programs/xfwp/pm.h,v 1.3 1999/03/02 11:49:40 dawes Exp $ */ +/* $XFree86: xc/programs/xfwp/pm.h,v 1.4 2001/01/17 23:45:34 dawes Exp $ */ #ifndef _PM_H #define _PM_H Index: xc/programs/xfwp/transport.c diff -u xc/programs/xfwp/transport.c:1.3 xc/programs/xfwp/transport.c:1.4 --- xc/programs/xfwp/transport.c:1.3 Sat Jan 10 22:48:33 1998 +++ xc/programs/xfwp/transport.c Wed Jan 17 18:45:34 2001 @@ -1,4 +1,4 @@ -/* $TOG: transport.c /main/6 1997/12/11 14:26:08 kaleb $ */ +/* $Xorg: transport.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ /* Copyright "1986-1997 The Open Group All Rights Reserved Index: xc/programs/xfwp/transport.h diff -u xc/programs/xfwp/transport.h:1.2 xc/programs/xfwp/transport.h:1.3 --- xc/programs/xfwp/transport.h:1.2 Thu Jun 22 20:44:36 2000 +++ xc/programs/xfwp/transport.h Wed Jan 17 18:45:34 2001 @@ -1,4 +1,4 @@ -/* $TOG: transport.h /main/3 1998/02/09 13:58:40 kaleb $ */ +/* $Xorg: transport.h,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ /* Copyright "1986-1997, 1998 The Open Group Index: xc/programs/xfwp/xfwp.c diff -u xc/programs/xfwp/xfwp.c:1.10 xc/programs/xfwp/xfwp.c:1.11 --- xc/programs/xfwp/xfwp.c:1.10 Sun Oct 4 05:41:16 1998 +++ xc/programs/xfwp/xfwp.c Wed Jan 17 18:45:34 2001 @@ -1,4 +1,4 @@ -/* $TOG: xfwp.c /main/57 1998/02/09 13:58:44 kaleb $ */ +/* $Xorg: xfwp.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xfwp/xfwp.h diff -u xc/programs/xfwp/xfwp.h:1.8 xc/programs/xfwp/xfwp.h:1.9 --- xc/programs/xfwp/xfwp.h:1.8 Sun Dec 26 19:40:13 1999 +++ xc/programs/xfwp/xfwp.h Wed Jan 17 18:45:35 2001 @@ -1,4 +1,4 @@ -/* $TOG: xfwp.h /main/29 1998/02/09 13:58:51 kaleb $ */ +/* $Xorg: xfwp.h,v 1.5 2000/08/17 19:54:24 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -21,7 +21,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xfwp/xfwp.h,v 1.8 1999/12/27 00:40:13 robin Exp $ */ +/* $XFree86: xc/programs/xfwp/xfwp.h,v 1.9 2001/01/17 23:45:35 dawes Exp $ */ #ifndef _XFWP_H #define _XFWP_H @@ -182,7 +182,11 @@ unsigned int dest_host; char * dest_netmask; unsigned int dest_net; +#if defined(__cplusplus) || defined(c_plusplus) + char * c_operator; +#else char * operator; +#endif char * service; int service_id; }; Index: xc/programs/xfwp/xfwp.man diff -u xc/programs/xfwp/xfwp.man:1.4 xc/programs/xfwp/xfwp.man:1.7 --- xc/programs/xfwp/xfwp.man:1.4 Sun Oct 4 05:41:17 1998 +++ xc/programs/xfwp/xfwp.man Wed Feb 7 17:35:23 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xfwp.man /main/13 1998/02/12 10:09:07 kaleb $ +.\" $Xorg: xfwp.man,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ .\" Copyright 1996, 1998 The Open Group .\" .\" All Rights Reserved. @@ -19,8 +19,11 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" +.\" +.\" $XFree86: xc/programs/xfwp/xfwp.man,v 1.7 2001/02/07 22:35:23 tsi Exp $ +.\" .nh -.TH XFWP 1 "Release 6.4" "X Version 11" +.TH XFWP 1 __xorgversion__ .SH NAME xfwp - X firewall proxy .SH SYNOPSIS @@ -344,27 +347,27 @@ .sp \fC .nf -# if and only if server supports one of these policies then authorize -# connections, but still subject to applicable rule matches -# +\&# if and only if server supports one of these policies then authorize +\&# connections, but still subject to applicable rule matches +\&# require sitepolicy policy1 require sitepolicy policy2 -# -# deny pm connections originating on 8.7.6.5 [NOTE: If pm service -# is explicitly qualified, line must include destination fields as -# shown.] -# +\&# +\&# deny pm connections originating on 8.7.6.5 [NOTE: If pm service +\&# is explicitly qualified, line must include destination fields as +\&# shown.] +\&# deny 8.7.6.5 0.0.0.0 0.0.0.0 255.255.255.255 eq pm -# -# permit xfindproxy X server connects to anywhere [NOTE: If -# fp service is explicitly qualified, line must include source fields -# as shown.] -# +\&# +\&# permit xfindproxy X server connects to anywhere [NOTE: If +\&# fp service is explicitly qualified, line must include source fields +\&# as shown.] +\&# permit 0.0.0.0 255.255.255.255 0.0.0.0 255.255.255.255 eq fp -# -# permit all connection types originating from the 192.0.0.0 -# IP domain only -# +\&# +\&# permit all connection types originating from the 192.0.0.0 +\&# IP domain only +\&# permit 192.0.0.0 0.255.255.255 .fi \fP Index: xc/programs/xgamma/xgamma.man diff -u xc/programs/xgamma/xgamma.man:1.5 xc/programs/xgamma/xgamma.man:1.7 --- xc/programs/xgamma/xgamma.man:1.5 Fri Nov 19 08:55:13 1999 +++ xc/programs/xgamma/xgamma.man Sat Jan 27 13:21:14 2001 @@ -18,9 +18,9 @@ .\" other dealings in this Software without prior written authorization .\" from The XFree86 Project. .\" -.\" $XFree86: xc/programs/xgamma/xgamma.man,v 1.5 1999/11/19 13:55:13 hohndel Exp $ +.\" $XFree86: xc/programs/xgamma/xgamma.man,v 1.7 2001/01/27 18:21:14 dawes Exp $ .\" -.TH xgamma 1 "Release 6.4" "X Version 11" +.TH xgamma 1 __vendorversion__ .SH NAME xgamma - Alter a monitor's gamma correction for XFree86 .SH SYNOPSIS @@ -36,7 +36,7 @@ .PP .TP 8 .B "-display \fIdisplay\fP" -This argument allows you to specify the server to connect to; see \fIX(1)\fP. +This argument allows you to specify the server to connect to; see \fIX(__miscmansuffix__)\fP. .PP .TP 8 .B "-screen \fIscreen\fP" Index: xc/programs/xgc/main.c diff -u xc/programs/xgc/main.c:1.3 xc/programs/xgc/main.c:1.4 --- xc/programs/xgc/main.c:1.3 Thu Feb 17 09:00:36 2000 +++ xc/programs/xgc/main.c Sun Apr 1 10:00:21 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xgc/main.c,v 1.3 2000/02/17 14:00:36 dawes Exp $ */ +/* $XFree86: xc/programs/xgc/main.c,v 1.4 2001/04/01 14:00:21 tsi Exp $ */ /* xgc ** @@ -44,6 +44,7 @@ #include <X11/Xaw/AsciiText.h> #include <X11/Shell.h> #include <stdio.h> +#include <stdlib.h> #include "xgc.h" #include "tile" Index: xc/programs/xgc/xgc.man diff -u xc/programs/xgc/xgc.man:1.1 xc/programs/xgc/xgc.man:1.3 --- xc/programs/xgc/xgc.man:1.1 Sat Feb 12 22:26:29 2000 +++ xc/programs/xgc/xgc.man Sat Jan 27 13:21:15 2001 @@ -1,5 +1,8 @@ .\" $XConsortium: xgc.man,v 1.6 94/04/17 20:45:31 gildea Exp $ -.TH XGC 1 "Release 6" "X Version 11" +.\" +.\" $XFree86: xc/programs/xgc/xgc.man,v 1.3 2001/01/27 18:21:15 dawes Exp $ +.\" +.TH XGC 1 __xorgversion__ .SH NAME xgc - X graphics demo .SH SYNOPSIS @@ -26,10 +29,10 @@ to get the name of a resource file that overrides the global resources stored in the RESOURCE_MANAGER property. .SH "SEE ALSO" -X(1) +X(__miscmansuffix__) .SH BUGS This program isn't really finished yet. .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHORS Dan Schmidt, MIT Index: xc/programs/xhost/Imakefile diff -u xc/programs/xhost/Imakefile:1.3 xc/programs/xhost/Imakefile:1.5 --- xc/programs/xhost/Imakefile:1.3 Sun Dec 20 17:19:00 1998 +++ xc/programs/xhost/Imakefile Thu Mar 29 21:15:24 2001 @@ -1,5 +1,10 @@ -XCOMM $XConsortium: Imakefile,v 1.13 94/02/06 10:50:53 rws Exp $ -XCOMM $XFree86: xc/programs/xhost/Imakefile,v 1.3 1998/12/20 22:19:00 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xhost/Imakefile,v 1.5 2001/03/30 02:15:24 keithp Exp $ + #if HasSecureRPC RPC_DEFINES = -DSECURE_RPC #else @@ -8,8 +13,8 @@ KRB5_DEFINES = Krb5Defines KRB5_INCLUDE = Krb5Includes INCLUDES = $(KRB5_INCLUDE) - DEPLIBS = $(DEPXMULIB) $(DEPXLIB) -LOCAL_LIBRARIES = $(XMULIB) $(XLIB) + DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XMUULIB) $(XLIB) SRCS = xhost.c OBJS = xhost.o DEFINES = $(CONNECTION_FLAGS) $(SIGNAL_DEFINES) $(RPC_DEFINES) $(KRB5_DEFINES) Index: xc/programs/xhost/xhost.c diff -u xc/programs/xhost/xhost.c:3.12 xc/programs/xhost/xhost.c:3.14 --- xc/programs/xhost/xhost.c:3.12 Thu Aug 10 13:40:41 2000 +++ xc/programs/xhost/xhost.c Tue Jan 30 17:06:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: xhost.c /main/57 1998/02/09 13:59:01 kaleb $ */ +/* $Xorg: xhost.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ /* Copyright 1985, 1986, 1987, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xhost/xhost.c,v 3.12 2000/08/10 17:40:41 dawes Exp $ */ +/* $XFree86: xc/programs/xhost/xhost.c,v 3.14 2001/01/30 22:06:21 tsi Exp $ */ #if defined(TCPCONN) || defined(STREAMSCONN) || defined(AMTCPCONN) #define NEEDSOCKETS @@ -595,7 +595,9 @@ static char netname[512]; int len; #ifdef SECURE_RPC - int uid, gid, gidlen, gidlist[NGROUPS_MAX]; + int gidlen; + uid_t uid; + gid_t gid, gidlist[NGROUPS_MAX]; #endif if (ha->length < sizeof(netname) - 1) Index: xc/programs/xhost/xhost.man diff -u xc/programs/xhost/xhost.man:1.4 xc/programs/xhost/xhost.man:1.7 --- xc/programs/xhost/xhost.man:1.4 Sun Oct 4 05:41:18 1998 +++ xc/programs/xhost/xhost.man Sat Jan 27 13:21:15 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xhost.man /main/22 1998/02/09 13:59:06 kaleb $ +.\" $Xorg: xhost.man,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ .\" Copyright 1988, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XHOST 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xhost/xhost.man,v 1.7 2001/01/27 18:21:15 dawes Exp $ +.\" +.TH XHOST 1 __xorgversion__ .SH NAME xhost \- server access control program for X .SH SYNOPSIS @@ -106,7 +109,7 @@ .SH FILES /etc/X*.hosts .SH "SEE ALSO" -X(1), Xsecurity(1), Xserver(1), xdm(1) +X(__miscmansuffix__), Xsecurity(__miscmansuffix__), Xserver(1), xdm(1) .SH ENVIRONMENT .TP 8 .B DISPLAY Index: xc/programs/xieperf/Imakefile diff -u xc/programs/xieperf/Imakefile:1.1.1.1 xc/programs/xieperf/Imakefile:1.1.1.2 --- xc/programs/xieperf/Imakefile:1.1.1.1 Wed Apr 27 03:20:37 1994 +++ xc/programs/xieperf/Imakefile Tue Jan 16 17:52:45 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile,v 1.8 94/01/12 20:44:41 rws Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ SRCS = abort.c arith.c await.c band.c blend.c cache.c compare.c complex.c \ constrain.c convolve.c creatdstry.c cvttoindex.c dither.c \ Index: xc/programs/xieperf/abort.c diff -u xc/programs/xieperf/abort.c:1.5 xc/programs/xieperf/abort.c:1.6 --- xc/programs/xieperf/abort.c:1.5 Sun Dec 26 19:40:13 1999 +++ xc/programs/xieperf/abort.c Wed Jan 17 18:45:36 2001 @@ -1,4 +1,4 @@ -/* $TOG: abort.c /main/9 1998/02/09 13:59:10 kaleb $ */ +/* $Xorg: abort.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ /**** module abort.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/abort.c,v 1.5 1999/12/27 00:40:13 robin Exp $ */ +/* $XFree86: xc/programs/xieperf/abort.c,v 1.6 2001/01/17 23:45:36 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/arith.c diff -u xc/programs/xieperf/arith.c:1.4 xc/programs/xieperf/arith.c:1.5 --- xc/programs/xieperf/arith.c:1.4 Tue Mar 2 06:49:41 1999 +++ xc/programs/xieperf/arith.c Wed Jan 17 18:45:36 2001 @@ -1,4 +1,4 @@ -/* $TOG: arith.c /main/7 1998/02/09 13:59:15 kaleb $ */ +/* $Xorg: arith.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ /**** module arith.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/arith.c,v 1.4 1999/03/02 11:49:41 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/arith.c,v 1.5 2001/01/17 23:45:36 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/await.c diff -u xc/programs/xieperf/await.c:3.3 xc/programs/xieperf/await.c:3.4 --- xc/programs/xieperf/await.c:3.3 Tue Mar 2 05:42:07 1999 +++ xc/programs/xieperf/await.c Wed Jan 17 18:45:36 2001 @@ -1,4 +1,4 @@ -/* $TOG: await.c /main/13 1998/02/09 13:59:20 kaleb $ */ +/* $Xorg: await.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ /**** module await.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/await.c,v 3.3 1999/03/02 10:42:07 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/await.c,v 3.4 2001/01/17 23:45:36 dawes Exp $ */ #ifdef WIN32 #include <X11/Xthreads.h> Index: xc/programs/xieperf/band.c diff -u xc/programs/xieperf/band.c:1.4 xc/programs/xieperf/band.c:1.5 --- xc/programs/xieperf/band.c:1.4 Tue Mar 2 06:49:42 1999 +++ xc/programs/xieperf/band.c Wed Jan 17 18:45:36 2001 @@ -1,4 +1,4 @@ -/* $TOG: band.c /main/7 1998/02/09 13:59:24 kaleb $ */ +/* $Xorg: band.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ /**** module band.c ****/ /****************************************************************************** @@ -66,7 +66,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/band.c,v 1.4 1999/03/02 11:49:42 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/band.c,v 1.5 2001/01/17 23:45:36 dawes Exp $ */ #include "xieperf.h" #include <X11/Xlib.h> Index: xc/programs/xieperf/blend.c diff -u xc/programs/xieperf/blend.c:1.4 xc/programs/xieperf/blend.c:1.5 --- xc/programs/xieperf/blend.c:1.4 Tue Mar 2 06:49:42 1999 +++ xc/programs/xieperf/blend.c Wed Jan 17 18:45:36 2001 @@ -1,4 +1,4 @@ -/* $TOG: blend.c /main/10 1998/02/09 13:59:29 kaleb $ */ +/* $Xorg: blend.c,v 1.3 2000/08/17 19:54:24 cpqbld Exp $ */ /**** module blend.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/blend.c,v 1.4 1999/03/02 11:49:42 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/blend.c,v 1.5 2001/01/17 23:45:36 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/cache.c diff -u xc/programs/xieperf/cache.c:1.4 xc/programs/xieperf/cache.c:1.5 --- xc/programs/xieperf/cache.c:1.4 Tue Mar 2 06:49:42 1999 +++ xc/programs/xieperf/cache.c Wed Jan 17 18:45:36 2001 @@ -1,4 +1,4 @@ -/* $TOG: cache.c /main/6 1998/02/09 13:59:34 kaleb $ */ +/* $Xorg: cache.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module cache.c ****/ /****************************************************************************** @@ -68,7 +68,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/cache.c,v 1.4 1999/03/02 11:49:42 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/cache.c,v 1.5 2001/01/17 23:45:36 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/compare.c diff -u xc/programs/xieperf/compare.c:1.4 xc/programs/xieperf/compare.c:1.5 --- xc/programs/xieperf/compare.c:1.4 Tue Mar 2 06:49:43 1999 +++ xc/programs/xieperf/compare.c Wed Jan 17 18:45:36 2001 @@ -1,4 +1,4 @@ -/* $TOG: compare.c /main/6 1998/02/09 13:59:38 kaleb $ */ +/* $Xorg: compare.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module compare.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/compare.c,v 1.4 1999/03/02 11:49:43 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/compare.c,v 1.5 2001/01/17 23:45:36 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/complex.c diff -u xc/programs/xieperf/complex.c:1.4 xc/programs/xieperf/complex.c:1.5 --- xc/programs/xieperf/complex.c:1.4 Tue Mar 2 06:49:43 1999 +++ xc/programs/xieperf/complex.c Wed Jan 17 18:45:37 2001 @@ -1,4 +1,4 @@ -/* $TOG: complex.c /main/5 1998/02/09 13:59:43 kaleb $ */ +/* $Xorg: complex.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module complex.c ****/ /****************************************************************************** @@ -66,7 +66,7 @@ Syd Logan -- AGE Logic, Inc. January 3, 1994 *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/complex.c,v 1.4 1999/03/02 11:49:43 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/complex.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ #include "xieperf.h" #include <X11/Xlib.h> Index: xc/programs/xieperf/constrain.c diff -u xc/programs/xieperf/constrain.c:1.4 xc/programs/xieperf/constrain.c:1.5 --- xc/programs/xieperf/constrain.c:1.4 Tue Mar 2 06:49:43 1999 +++ xc/programs/xieperf/constrain.c Wed Jan 17 18:45:37 2001 @@ -1,4 +1,4 @@ -/* $TOG: constrain.c /main/11 1998/02/09 13:59:48 kaleb $ */ +/* $Xorg: constrain.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module constrain.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/constrain.c,v 1.4 1999/03/02 11:49:43 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/constrain.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/convolve.c diff -u xc/programs/xieperf/convolve.c:1.4 xc/programs/xieperf/convolve.c:1.5 --- xc/programs/xieperf/convolve.c:1.4 Tue Mar 2 06:49:43 1999 +++ xc/programs/xieperf/convolve.c Wed Jan 17 18:45:37 2001 @@ -1,4 +1,4 @@ -/* $TOG: convolve.c /main/7 1998/02/09 13:59:53 kaleb $ */ +/* $Xorg: convolve.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module convolve.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/convolve.c,v 1.4 1999/03/02 11:49:43 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/convolve.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/creatdstry.c diff -u xc/programs/xieperf/creatdstry.c:1.4 xc/programs/xieperf/creatdstry.c:1.5 --- xc/programs/xieperf/creatdstry.c:1.4 Tue Mar 2 06:49:44 1999 +++ xc/programs/xieperf/creatdstry.c Wed Jan 17 18:45:37 2001 @@ -1,4 +1,4 @@ -/* $TOG: creatdstry.c /main/8 1998/02/09 13:59:57 kaleb $ */ +/* $Xorg: creatdstry.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module creatdstry.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/creatdstry.c,v 1.4 1999/03/02 11:49:44 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/creatdstry.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/cvttoindex.c diff -u xc/programs/xieperf/cvttoindex.c:1.4 xc/programs/xieperf/cvttoindex.c:1.5 --- xc/programs/xieperf/cvttoindex.c:1.4 Tue Mar 2 06:49:44 1999 +++ xc/programs/xieperf/cvttoindex.c Wed Jan 17 18:45:37 2001 @@ -1,4 +1,4 @@ -/* $TOG: cvttoindex.c /main/11 1998/02/09 14:00:01 kaleb $ */ +/* $Xorg: cvttoindex.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module cvttoindex.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/cvttoindex.c,v 1.4 1999/03/02 11:49:44 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/cvttoindex.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ #include "xieperf.h" #include <X11/Xlib.h> Index: xc/programs/xieperf/dither.c diff -u xc/programs/xieperf/dither.c:1.4 xc/programs/xieperf/dither.c:1.5 --- xc/programs/xieperf/dither.c:1.4 Tue Mar 2 06:49:44 1999 +++ xc/programs/xieperf/dither.c Wed Jan 17 18:45:37 2001 @@ -1,4 +1,4 @@ -/* $TOG: dither.c /main/10 1998/02/09 14:00:06 kaleb $ */ +/* $Xorg: dither.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module dither.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/dither.c,v 1.4 1999/03/02 11:49:44 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/dither.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/encode.c diff -u xc/programs/xieperf/encode.c:1.4 xc/programs/xieperf/encode.c:1.5 --- xc/programs/xieperf/encode.c:1.4 Tue Mar 2 06:49:45 1999 +++ xc/programs/xieperf/encode.c Wed Jan 17 18:45:37 2001 @@ -1,4 +1,4 @@ -/* $TOG: encode.c /main/9 1998/02/09 14:00:10 kaleb $ */ +/* $Xorg: encode.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module encode.c ****/ /****************************************************************************** @@ -66,7 +66,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/encode.c,v 1.4 1999/03/02 11:49:45 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/encode.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ #include "xieperf.h" #include <X11/Xlib.h> Index: xc/programs/xieperf/errors.c diff -u xc/programs/xieperf/errors.c:1.4 xc/programs/xieperf/errors.c:1.5 --- xc/programs/xieperf/errors.c:1.4 Tue Mar 2 06:49:45 1999 +++ xc/programs/xieperf/errors.c Wed Jan 17 18:45:37 2001 @@ -1,4 +1,4 @@ -/* $TOG: errors.c /main/12 1998/02/09 14:00:16 kaleb $ */ +/* $Xorg: errors.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module errors.c ****/ /****************************************************************************** @@ -66,7 +66,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/errors.c,v 1.4 1999/03/02 11:49:45 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/errors.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/xieperf/events.c diff -u xc/programs/xieperf/events.c:3.6 xc/programs/xieperf/events.c:3.7 --- xc/programs/xieperf/events.c:3.6 Sat Mar 13 22:22:30 1999 +++ xc/programs/xieperf/events.c Wed Jan 17 18:45:37 2001 @@ -1,4 +1,4 @@ -/* $TOG: events.c /main/13 1998/02/09 14:00:21 kaleb $ */ +/* $Xorg: events.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module events.c ****/ /****************************************************************************** @@ -66,7 +66,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/events.c,v 3.6 1999/03/14 03:22:30 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/events.c,v 3.7 2001/01/17 23:45:37 dawes Exp $ */ #ifdef WIN32 #define _WILLWINSOCK_ Index: xc/programs/xieperf/exportcl.c diff -u xc/programs/xieperf/exportcl.c:1.4 xc/programs/xieperf/exportcl.c:1.5 --- xc/programs/xieperf/exportcl.c:1.4 Tue Mar 2 06:49:45 1999 +++ xc/programs/xieperf/exportcl.c Wed Jan 17 18:45:37 2001 @@ -1,4 +1,4 @@ -/* $TOG: exportcl.c /main/15 1998/02/09 14:00:26 kaleb $ */ +/* $Xorg: exportcl.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module exportcl.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/exportcl.c,v 1.4 1999/03/02 11:49:45 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/exportcl.c,v 1.5 2001/01/17 23:45:37 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/funcode.c diff -u xc/programs/xieperf/funcode.c:1.4 xc/programs/xieperf/funcode.c:1.5 --- xc/programs/xieperf/funcode.c:1.4 Tue Mar 2 06:49:46 1999 +++ xc/programs/xieperf/funcode.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: funcode.c /main/7 1998/02/09 14:00:31 kaleb $ */ +/* $Xorg: funcode.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module funcode.c ****/ /****************************************************************************** @@ -69,7 +69,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/funcode.c,v 1.4 1999/03/02 11:49:46 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/funcode.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/geometry.c diff -u xc/programs/xieperf/geometry.c:1.4 xc/programs/xieperf/geometry.c:1.5 --- xc/programs/xieperf/geometry.c:1.4 Tue Mar 2 06:49:49 1999 +++ xc/programs/xieperf/geometry.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: geometry.c /main/13 1998/02/09 14:00:36 kaleb $ */ +/* $Xorg: geometry.c,v 1.3 2000/08/17 19:54:25 cpqbld Exp $ */ /**** module geometry.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/geometry.c,v 1.4 1999/03/02 11:49:49 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/geometry.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/getnext.c diff -u xc/programs/xieperf/getnext.c:1.3 xc/programs/xieperf/getnext.c:1.4 --- xc/programs/xieperf/getnext.c:1.3 Tue Mar 2 06:49:49 1999 +++ xc/programs/xieperf/getnext.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: getnext.c /main/8 1998/02/09 14:00:41 kaleb $ */ +/* $Xorg: getnext.c,v 1.3 2000/08/17 19:54:26 cpqbld Exp $ */ /**** module getnext.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/getnext.c,v 1.3 1999/03/02 11:49:49 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/getnext.c,v 1.4 2001/01/17 23:45:38 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/xieperf/import.c diff -u xc/programs/xieperf/import.c:1.4 xc/programs/xieperf/import.c:1.5 --- xc/programs/xieperf/import.c:1.4 Tue Mar 2 06:49:49 1999 +++ xc/programs/xieperf/import.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: import.c /main/9 1998/02/09 14:00:51 kaleb $ */ +/* $Xorg: import.c,v 1.3 2000/08/17 19:54:26 cpqbld Exp $ */ /**** module import.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/import.c,v 1.4 1999/03/02 11:49:49 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/import.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/importcl.c diff -u xc/programs/xieperf/importcl.c:1.4 xc/programs/xieperf/importcl.c:1.5 --- xc/programs/xieperf/importcl.c:1.4 Tue Mar 2 06:49:50 1999 +++ xc/programs/xieperf/importcl.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: importcl.c /main/12 1998/02/09 14:00:46 kaleb $ */ +/* $Xorg: importcl.c,v 1.3 2000/08/17 19:54:26 cpqbld Exp $ */ /**** module importcl.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/importcl.c,v 1.4 1999/03/02 11:49:50 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/importcl.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/logical.c diff -u xc/programs/xieperf/logical.c:1.4 xc/programs/xieperf/logical.c:1.5 --- xc/programs/xieperf/logical.c:1.4 Tue Mar 2 06:49:50 1999 +++ xc/programs/xieperf/logical.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: logical.c /main/9 1998/02/09 14:00:56 kaleb $ */ +/* $Xorg: logical.c,v 1.3 2000/08/17 19:54:26 cpqbld Exp $ */ /**** module logical.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/logical.c,v 1.4 1999/03/02 11:49:50 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/logical.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/math.c diff -u xc/programs/xieperf/math.c:1.4 xc/programs/xieperf/math.c:1.5 --- xc/programs/xieperf/math.c:1.4 Tue Mar 2 06:49:50 1999 +++ xc/programs/xieperf/math.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: math.c /main/7 1998/02/09 14:01:01 kaleb $ */ +/* $Xorg: math.c,v 1.3 2000/08/17 19:54:26 cpqbld Exp $ */ /**** module math.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/math.c,v 1.4 1999/03/02 11:49:50 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/math.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/modify.c diff -u xc/programs/xieperf/modify.c:3.6 xc/programs/xieperf/modify.c:3.7 --- xc/programs/xieperf/modify.c:3.6 Tue Mar 2 05:42:14 1999 +++ xc/programs/xieperf/modify.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: modify.c /main/15 1998/03/31 09:30:54 mgreess $ */ +/* $Xorg: modify.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ /**** module modify.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/modify.c,v 3.6 1999/03/02 10:42:14 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/modify.c,v 3.7 2001/01/17 23:45:38 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/mtchhist.c diff -u xc/programs/xieperf/mtchhist.c:1.4 xc/programs/xieperf/mtchhist.c:1.5 --- xc/programs/xieperf/mtchhist.c:1.4 Tue Mar 2 06:49:50 1999 +++ xc/programs/xieperf/mtchhist.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: mtchhist.c /main/7 1998/02/09 14:01:10 kaleb $ */ +/* $Xorg: mtchhist.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ /**** module mtchhist.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/mtchhist.c,v 1.4 1999/03/02 11:49:50 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/mtchhist.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ #include "xieperf.h" Index: xc/programs/xieperf/pasteup.c diff -u xc/programs/xieperf/pasteup.c:1.4 xc/programs/xieperf/pasteup.c:1.5 --- xc/programs/xieperf/pasteup.c:1.4 Tue Mar 2 06:49:51 1999 +++ xc/programs/xieperf/pasteup.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: pasteup.c /main/10 1998/02/09 14:01:15 kaleb $ */ +/* $Xorg: pasteup.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ /**** module pasteup.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/pasteup.c,v 1.4 1999/03/02 11:49:51 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/pasteup.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/point.c diff -u xc/programs/xieperf/point.c:1.4 xc/programs/xieperf/point.c:1.5 --- xc/programs/xieperf/point.c:1.4 Tue Mar 2 06:49:51 1999 +++ xc/programs/xieperf/point.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: point.c /main/11 1998/02/09 14:01:20 kaleb $ */ +/* $Xorg: point.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ /**** module point.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/point.c,v 1.4 1999/03/02 11:49:51 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/point.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ #include "xieperf.h" Index: xc/programs/xieperf/purgecolst.c diff -u xc/programs/xieperf/purgecolst.c:1.4 xc/programs/xieperf/purgecolst.c:1.5 --- xc/programs/xieperf/purgecolst.c:1.4 Tue Mar 2 06:49:51 1999 +++ xc/programs/xieperf/purgecolst.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: purgecolst.c /main/6 1998/02/09 14:01:24 kaleb $ */ +/* $Xorg: purgecolst.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ /**** module purgecolst.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/purgecolst.c,v 1.4 1999/03/02 11:49:51 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/purgecolst.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/query.c diff -u xc/programs/xieperf/query.c:1.4 xc/programs/xieperf/query.c:1.5 --- xc/programs/xieperf/query.c:1.4 Tue Mar 2 06:49:52 1999 +++ xc/programs/xieperf/query.c Wed Jan 17 18:45:38 2001 @@ -1,4 +1,4 @@ -/* $TOG: query.c /main/11 1998/02/09 14:01:28 kaleb $ */ +/* $Xorg: query.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ /**** module query.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/query.c,v 1.4 1999/03/02 11:49:52 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/query.c,v 1.5 2001/01/17 23:45:38 dawes Exp $ */ #include "xieperf.h" Index: xc/programs/xieperf/redefine.c diff -u xc/programs/xieperf/redefine.c:1.4 xc/programs/xieperf/redefine.c:1.5 --- xc/programs/xieperf/redefine.c:1.4 Tue Mar 2 06:49:52 1999 +++ xc/programs/xieperf/redefine.c Wed Jan 17 18:45:39 2001 @@ -1,4 +1,4 @@ -/* $TOG: redefine.c /main/9 1998/02/09 14:01:33 kaleb $ */ +/* $Xorg: redefine.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ /**** module redefine.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/redefine.c,v 1.4 1999/03/02 11:49:52 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/redefine.c,v 1.5 2001/01/17 23:45:39 dawes Exp $ */ #include "xieperf.h" #include <stdio.h> Index: xc/programs/xieperf/rgb.c diff -u xc/programs/xieperf/rgb.c:1.4 xc/programs/xieperf/rgb.c:1.5 --- xc/programs/xieperf/rgb.c:1.4 Tue Mar 2 06:49:52 1999 +++ xc/programs/xieperf/rgb.c Wed Jan 17 18:45:39 2001 @@ -1,4 +1,4 @@ -/* $TOG: rgb.c /main/8 1998/02/09 14:01:37 kaleb $ */ +/* $Xorg: rgb.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ /**** module rgb.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/rgb.c,v 1.4 1999/03/02 11:49:52 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/rgb.c,v 1.5 2001/01/17 23:45:39 dawes Exp $ */ #include "xieperf.h" #include <X11/Xlib.h> Index: xc/programs/xieperf/tests.c diff -u xc/programs/xieperf/tests.c:1.3 xc/programs/xieperf/tests.c:1.4 --- xc/programs/xieperf/tests.c:1.3 Tue Mar 2 06:49:53 1999 +++ xc/programs/xieperf/tests.c Wed Jan 17 18:45:39 2001 @@ -1,4 +1,4 @@ -/* $TOG: tests.c /main/15 1998/02/09 14:01:42 kaleb $ */ +/* $Xorg: tests.c,v 1.3 2000/08/17 19:54:27 cpqbld Exp $ */ /**** module tests.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/tests.c,v 1.3 1999/03/02 11:49:53 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/tests.c,v 1.4 2001/01/17 23:45:39 dawes Exp $ */ #include <stdio.h> /* for stderr */ #include "xieperf.h" Index: xc/programs/xieperf/uconstrain.c diff -u xc/programs/xieperf/uconstrain.c:1.4 xc/programs/xieperf/uconstrain.c:1.5 --- xc/programs/xieperf/uconstrain.c:1.4 Tue Mar 2 06:49:53 1999 +++ xc/programs/xieperf/uconstrain.c Wed Jan 17 18:45:39 2001 @@ -1,4 +1,4 @@ -/* $TOG: uconstrain.c /main/9 1998/02/09 14:01:53 kaleb $ */ +/* $Xorg: uconstrain.c,v 1.3 2000/08/17 19:54:28 cpqbld Exp $ */ /**** module uconstrain.c ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/uconstrain.c,v 1.4 1999/03/02 11:49:53 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/uconstrain.c,v 1.5 2001/01/17 23:45:39 dawes Exp $ */ #include "xieperf.h" Index: xc/programs/xieperf/xieperf.c diff -u xc/programs/xieperf/xieperf.c:3.3 xc/programs/xieperf/xieperf.c:3.6 --- xc/programs/xieperf/xieperf.c:3.3 Tue Mar 2 05:42:18 1999 +++ xc/programs/xieperf/xieperf.c Tue Jan 23 15:38:30 2001 @@ -1,4 +1,4 @@ -/* $TOG: xieperf.c /main/39 1998/02/09 14:01:58 kaleb $ */ +/* $Xorg: xieperf.c,v 1.3 2000/08/17 19:54:29 cpqbld Exp $ */ /**** module xieperf.c ****/ /**************************************************************************** @@ -67,15 +67,15 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/xieperf.c,v 3.3 1999/03/02 10:42:18 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/xieperf.c,v 3.6 2001/01/23 20:38:30 herrb Exp $ */ #include <X11/Xos.h> #include <stdio.h> #include <ctype.h> #include <signal.h> #include <math.h> -#include "xieperf.h" #include <errno.h> +#include "xieperf.h" #include <X11/Xmu/SysUtil.h> #include <X11/Xmu/StdCmap.h> #ifdef X_NOT_STDC_ENV Index: xc/programs/xieperf/xieperf.h diff -u xc/programs/xieperf/xieperf.h:1.3 xc/programs/xieperf/xieperf.h:1.4 --- xc/programs/xieperf/xieperf.h:1.3 Tue Mar 2 06:49:54 1999 +++ xc/programs/xieperf/xieperf.h Wed Jan 17 18:45:40 2001 @@ -1,4 +1,4 @@ -/* $TOG: xieperf.h /main/17 1998/02/09 14:02:07 kaleb $ */ +/* $Xorg: xieperf.h,v 1.3 2000/08/17 19:54:29 cpqbld Exp $ */ /**** module xieperf.h ****/ /****************************************************************************** @@ -67,7 +67,7 @@ Syd Logan -- AGE Logic, Inc. *****************************************************************************/ -/* $XFree86: xc/programs/xieperf/xieperf.h,v 1.3 1999/03/02 11:49:54 dawes Exp $ */ +/* $XFree86: xc/programs/xieperf/xieperf.h,v 1.4 2001/01/17 23:45:40 dawes Exp $ */ #include <stdio.h> #ifndef VMS Index: xc/programs/xieperf/xieperf.man diff -u xc/programs/xieperf/xieperf.man:1.4 xc/programs/xieperf/xieperf.man:1.7 --- xc/programs/xieperf/xieperf.man:1.4 Sun Oct 4 05:41:23 1998 +++ xc/programs/xieperf/xieperf.man Sat Jan 27 13:21:15 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xieperf.man /main/10 1998/02/09 14:02:11 kaleb $ +.\" $Xorg: xieperf.man,v 1.3 2000/08/17 19:54:29 cpqbld Exp $ .\" Copyright 1993, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -58,7 +58,10 @@ .\" .\" Title to this software shall at all times remain with AGE .\" Logic, Inc. -.TH xieperf 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xieperf/xieperf.man,v 1.7 2001/01/27 18:21:15 dawes Exp $ +.\" +.TH xieperf 1 __xorgversion__ .SH NAME xieperf - XIE server extension test and demo program .SH SYNTAX @@ -768,7 +771,7 @@ .SH X DEFAULTS There are no X defaults used by this program. .SH "SEE ALSO" -X(1), x11perf(1), x11perfcomp(1) +X(__miscmansuffix__), x11perf(1), x11perfcomp(1) .SH BUGS There should be a IMAGES environment variable to augment the -images option. .PP Index: xc/programs/xieperf/images/image.012 Index: xc/programs/xinit/Imakefile diff -u xc/programs/xinit/Imakefile:3.8 xc/programs/xinit/Imakefile:3.11 --- xc/programs/xinit/Imakefile:3.8 Sat Dec 2 14:06:58 2000 +++ xc/programs/xinit/Imakefile Thu Apr 19 11:08:32 2001 @@ -1,5 +1,10 @@ -XCOMM $XConsortium: Imakefile /main/25 1996/01/15 12:19:07 gildea $ -XCOMM $XFree86: xc/programs/xinit/Imakefile,v 3.8 2000/12/02 19:06:58 herrb Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:29 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xinit/Imakefile,v 3.11 2001/04/19 15:08:32 dawes Exp $ + #if HasVFork VFORK_DEFINES = -DHAS_VFORK #endif @@ -11,8 +16,8 @@ #endif DEFINES = $(CONNECTION_FLAGS) $(VFORK_DEFINES) $(SIGNAL_DEFINES) \ -DBINDIR=\"$(BINDIR)\" $(OS_DEFS) - DEPLIBS = $(DEPXMULIB) $(DEPXLIB) -LOCAL_LIBRARIES = $(XMULIB) $(XLIB) + DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XMUULIB) $(XLIB) SRCS1 = xinit.c OBJS1 = xinit.o SAMPLECONFIG = xinitrc @@ -32,6 +37,8 @@ #else MakeScriptFromCpp(startx, -DXINITDIR=$(XINITDIR) $(COOKIEDEFS)) #endif + +EXTRAMANDEFS=-D__xinitdir__=$(XINITDIR) #ifdef OS2Architecture InstallNamedProg(startx.cmd,startx.cmd,$(BINDIR)) Index: xc/programs/xinit/startx.cpp diff -u xc/programs/xinit/startx.cpp:3.5 xc/programs/xinit/startx.cpp:3.8 --- xc/programs/xinit/startx.cpp:3.5 Sat Dec 2 13:06:58 2000 +++ xc/programs/xinit/startx.cpp Fri Apr 27 07:04:53 2001 @@ -1,7 +1,6 @@ XCOMM!/bin/sh -XCOMM $XConsortium: startx.cpp,v 1.4 91/08/22 11:41:29 rws Exp $ -XCOMM $XFree86: xc/programs/xinit/startx.cpp,v 3.5 2000/12/02 18:06:58 herrb Exp $ +XCOMM $Xorg: startx.cpp,v 1.3 2000/08/17 19:54:29 cpqbld Exp $ XCOMM XCOMM This is just a sample implementation of a slightly less primitive XCOMM interface than xinit. It looks for user .xinitrc and .xserverrc @@ -12,6 +11,7 @@ XCOMM XCOMM Site administrators are STRONGLY urged to write nicer versions. XCOMM +XCOMM $XFree86: xc/programs/xinit/startx.cpp,v 3.8 2001/04/27 11:04:53 dawes Exp $ #ifdef SCO @@ -53,18 +53,20 @@ userserverrc=$HOME/.xserverrc sysclientrc=XINITDIR/xinitrc sysserverrc=XINITDIR/xserverrc +defaultclientargs="" +defaultserverargs="" clientargs="" serverargs="" #ifdef SCO if [ -f $scoclientrc ]; then - clientargs=$scoclientrc + defaultclientargs=$scoclientrc else #endif if [ -f $userclientrc ]; then - clientargs=$userclientrc + defaultclientargs=$userclientrc else if [ -f $sysclientrc ]; then - clientargs=$sysclientrc + defaultclientargs=$sysclientrc fi fi #ifdef SCO @@ -72,9 +74,9 @@ #endif if [ -f $userserverrc ]; then - serverargs=$userserverrc + defaultserverargs=$userserverrc else if [ -f $sysserverrc ]; then - serverargs=$sysserverrc + defaultserverargs=$sysserverrc fi fi @@ -82,32 +84,38 @@ whoseargs="client" while [ "x$1" != "x" ]; do case "$1" in - /''*|\.*) if [ "$whoseargs" = "client" ]; then - if [ "x$clientargs" = x ]; then - clientargs="$1" - else - clientargs="$clientargs $1" - fi - else - if [ "x$serverargs" = x ]; then - serverargs="$1" - else - serverargs="$serverargs $1" - fi - fi ;; - --) whoseargs="server" ;; - *) if [ "$whoseargs" = "client" ]; then - clientargs="$clientargs $1" - else - case "$1" in - :[0-9]*) display="$1"; serverargs="$serverargs $1";; - *) serverargs="$serverargs $1" ;; - esac - fi ;; + --) + whoseargs="server" + ;; + *) + if [ "$whoseargs" = "client" ]; then + clientargs="$clientargs $1" + else + serverargs="$serverargs $1" + case "$1" in + :[0-9]*) + display="$1" + ;; + esac + fi + ;; esac shift done +if [ x"$clientargs" = x ]; then + clientargs="$defaultclientargs" +fi +if [ x"$serverargs" = x ]; then + serverargs="$defaultserverargs" +fi + +if [ X"$XAUTHORITY" = X ]; then + export XAUTHORITY=$HOME/.Xauthority +fi + +removelist= + #if defined(HAS_COOKIE_MAKER) && defined(MK_COOKIE) XCOMM set up default Xauth info for this machine #ifndef HOSTNAME @@ -118,21 +126,29 @@ #endif #endif mcookie=`MK_COOKIE` -if [ X"$XAUTHORITY" = X ]; then - authfile="$HOME/.Xauthority" -else - authfile="$XAUTHORITY" -fi -serverargs="$serverargs -auth $authfile" -xauth add $display . $mcookie -xauth add `HOSTNAME`$display . $mcookie +for displayname in $display `HOSTNAME`$display; do + if ! xauth list "$displayname" | grep "$displayname " >/dev/null 2>&1; then + xauth add $displayname . $mcookie + removelist="$displayname $removelist" + fi +done #endif xinit $clientargs -- $serverargs +if [ x"$removelist" != x ]; then + xauth remove $removelist +fi + /* * various machines need special cleaning up */ +#ifdef __linux__ +if command -v deallocvt > /dev/null 2>&1; then + deallocvt +fi +#endif + #ifdef macII Xrepair screenrestore Index: xc/programs/xinit/startx.man diff -u xc/programs/xinit/startx.man:1.4 xc/programs/xinit/startx.man:1.7 --- xc/programs/xinit/startx.man:1.4 Sun Oct 4 05:41:24 1998 +++ xc/programs/xinit/startx.man Thu Apr 19 11:08:32 2001 @@ -1,11 +1,11 @@ -.\" $TOG: startx.man /main/10 1998/02/09 14:02:24 kaleb $ +.\" $Xorg: startx.man,v 1.3 2000/08/17 19:54:29 cpqbld Exp $ .\" Copyright 1993, 1998 The Open Group -.\" +.\" .\" All Rights Reserved. -.\" +.\" .\" The above copyright notice and this permission notice shall be included .\" in all copies or substantial portions of the Software. -.\" +.\" .\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS .\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF .\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -13,12 +13,15 @@ .\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, .\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR .\" OTHER DEALINGS IN THE SOFTWARE. -.\" +.\" .\" Except as contained in this notice, the name of The Open Group shall .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. -.TH STARTX 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xinit/startx.man,v 1.7 2001/04/19 15:08:32 dawes Exp $ +.\" +.TH STARTX 1 __xorgversion__ .SH NAME startx \- initialize an X session .SH SYNOPSIS @@ -35,15 +38,36 @@ .I options \&.\|.\|. ] .SH DESCRIPTION -NOTE: The \fIstartx\fP script supplied with the X11 distribution is a sample -designed more as a base for customization than as a -finished product. Site administrators are urged to customize it for -their site. And to update this manual page when they do! -.PP The \fIstartx\fP script is a front end to \fIxinit\fP that provides a somewhat nicer user interface for running a single session of the X -Window System. It is typically run with no arguments. +Window System. It is often run with no arguments. +.PP +Arguments immediately following the +.I startx +command are used to start a client in the same manner as +.IR xinit (1). +The special argument +.RB '--' +marks the end of client arguments and the beginning of server options. +It may be convenient to specify server options with startx to change on a +per-session basis the +default color depth, the server's notion of the number of dots-per-inch the +display device presents, or take advantage of a different server layout, as +permitted by the +.IR XFree86 (1) +server and specified in the +.IR XF86Config (__filemansuffix__) +file. Some examples of specifying server arguments follow; consult the +manual page for your X server to determine which arguments are legal. +.RS +.PP +startx -- -depth 16 +.PP +startx -- -dpi 100 .PP +startx -- -layout Multihead +.RE +.PP To determine the client to run, .I startx first looks for a file called @@ -55,6 +79,8 @@ .I xinit library directory. If command line client options are given, they override this +behavior and revert to the +.IR xinit (1) behavior. To determine the server to run, .I startx @@ -67,6 +93,8 @@ .I xinit library directory. If command line server options are given, they override this +behavior and revert to the +.IR xinit (1) behavior. Users rarely need to provide a .I .xserverrc file. @@ -74,35 +102,43 @@ .IR xinit (1) manual page for more details on the arguments. .PP +The system-wide +.I xinitrc +and +.I xserverrc +files are found in the +.I __xinitdir__ +directory. +.PP The .I .xinitrc is typically a shell script which starts many clients according to the user's preference. When this shell script exits, -.I startx +.I startx kills the server and performs any other session shutdown needed. Most of the clients started by .I .xinitrc should be run in the background. The last client should run in the foreground; when it exits, the session will exit. People often choose -a session manager, window manager, or \fIxterm\fP as the ``magic'' client. +a session manager, window manager, or \fIxterm\fP as the ''magic'' client. .SH EXAMPLE .PP Below is a sample \fI\.xinitrc\fP that starts several applications and -leaves the window manager running as the ``last'' application. Assuming that +leaves the window manager running as the ''last'' application. Assuming that the window manager has been configured properly, the user -then chooses the ``Exit'' menu item to shut down X. +then chooses the ''Exit'' menu item to shut down X. .sp .in +4 .nf -xrdb \-load $HOME/.Xresources -xsetroot \-solid gray & -xbiff \-geometry \-430+5 & -oclock \-geometry 75x75\-0\-0 & -xload \-geometry \-80\-0 & -xterm \-geometry +0+60 \-ls & -xterm \-geometry +0\-100 & -xconsole \-geometry \-0+0 \-fn 5x7 & -exec twm +xrdb \-load $HOME/.Xresources +xsetroot \-solid gray & +xbiff \-geometry \-430+5 & +oclock \-geometry 75x75\-0\-0 & +xload \-geometry \-80\-0 & +xterm \-geometry +0+60 \-ls & +xterm \-geometry +0\-100 & +xconsole \-geometry \-0+0 \-fn 5x7 & +exec twm .fi .in -4 .SH "ENVIRONMENT VARIABLES" @@ -110,8 +146,20 @@ DISPLAY This variable gets set to the name of the display to which clients should connect. Note that this gets -.I set, +.IR set , not read. +.TP 25 +XAUTHORITY +This variable, if not already defined, gets set to +.IR $(HOME)/.Xauthority . +This is to prevent the X server, if not given the +.I \-auth +argument, from automatically setting up insecure host-based authentication +for the local host. See the +.IR Xserver (1) +and +.IR Xsecurity (__miscmansuffix__) +manual pages for more information on X client/server authentication. .SH FILES .TP 25 .I $(HOME)/.xinitrc @@ -120,17 +168,18 @@ .TP 25 .I $(HOME)/.xserverrc Server to run. The default is -.I X. +.IR X . .TP 25 -.I <XRoot>/lib/X11/xinit/xinitrc +.I __xinitdir__/xinitrc Client to run if the user has no .I .xinitrc -file. <XRoot> refers to the root of the X11 install tree. +file. .TP 25 -.I <XRoot>/lib/X11/xinit/xserverrc -Client to run if the user has no +.I __xinitdir__/xserverrc +Server to run if the user has no .I .xserverrc -file. This is only needed if the server needs special arguments or is -not named. <XRoot> refers to the root of the X11 install tree. +file. .SH "SEE ALSO" -.IR xinit (1) +.IR xinit (1), +.IR Xserver (1), +.IR XFree86 (1) Index: xc/programs/xinit/xinit.c diff -u xc/programs/xinit/xinit.c:3.23 xc/programs/xinit/xinit.c:3.26 --- xc/programs/xinit/xinit.c:3.23 Wed Nov 1 21:51:25 2000 +++ xc/programs/xinit/xinit.c Mon Apr 16 02:51:46 2001 @@ -1,4 +1,4 @@ -/* $TOG: xinit.c /main/59 1998/02/09 14:02:32 kaleb $ */ +/* $Xorg: xinit.c,v 1.4 2000/08/17 19:54:30 cpqbld Exp $ */ /* @@ -21,11 +21,10 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xinit/xinit.c,v 3.23 2000/11/02 02:51:25 dawes Exp $ */ +/* $XFree86: xc/programs/xinit/xinit.c,v 3.26 2001/04/16 06:51:46 torrey Exp $ */ #include <X11/Xlib.h> #include <X11/Xos.h> -#include <X11/Xmu/SysUtil.h> #include <stdio.h> #include <ctype.h> @@ -127,7 +126,9 @@ "XFree86 XFree86 displays", #endif #ifdef __DARWIN__ - "Xdarwin Apple darwin / Mac OS/X", + "XDarwin Darwin/Mac OS X IOKit displays", + "XDarwinQuartz Mac OS X Quartz displays", + "XDarwinStartup Auto-select between XDarwin and XDarwinQuartz", #endif NULL}; Index: xc/programs/xinit/xinit.man diff -u xc/programs/xinit/xinit.man:3.5 xc/programs/xinit/xinit.man:3.9 --- xc/programs/xinit/xinit.man:3.5 Sun Oct 4 05:41:25 1998 +++ xc/programs/xinit/xinit.man Wed Feb 7 18:25:56 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xinit.man /main/26 1998/02/09 14:02:37 kaleb $ +.\" $Xorg: xinit.man,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ .\" Copyright 1988, 1998 The Open Group .\" .\" All Rights Reserved. @@ -19,9 +19,9 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xinit/xinit.man,v 3.5 1998/10/04 09:41:25 dawes Exp $ +.\" $XFree86: xc/programs/xinit/xinit.man,v 3.9 2001/02/07 23:25:56 dawes Exp $ .\" -.TH XINIT 1 "Release 6.4" "X Version 11" +.TH XINIT 1 __xorgversion__ .SH NAME xinit \- X Window System initializer .SH SYNOPSIS @@ -147,7 +147,7 @@ .sp .in +8 .nf -#!/bin/sh +\&#!/bin/sh \&. /usr/local/lib/site.xinitrc .fi .in -8 @@ -159,7 +159,7 @@ .sp .in +8 .nf -#!/bin/sh +\&#!/bin/sh xinit /usr/local/lib/site.xinitrc \-\^\- /usr/X11R6/bin/X bc .fi .in -8 @@ -188,7 +188,7 @@ .I X server to run if \fI.xserverrc\fP does not exist .SH "SEE ALSO" -.IR X (1), +.IR X (__miscmansuffix__), .IR startx (1), .IR Xserver (1), .IR xterm (1) Index: xc/programs/xinit/xinitrc.cpp diff -u xc/programs/xinit/xinitrc.cpp:1.1.1.1 xc/programs/xinit/xinitrc.cpp:1.1.1.2 --- xc/programs/xinit/xinitrc.cpp:1.1.1.1 Wed Apr 27 03:13:07 1994 +++ xc/programs/xinit/xinitrc.cpp Tue Jan 16 17:54:39 2001 @@ -1,5 +1,5 @@ XCOMM!/bin/sh -XCOMM $XConsortium: xinitrc.cpp,v 1.4 91/08/22 11:41:34 rws Exp $ +XCOMM $Xorg: xinitrc.cpp,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ userresources=$HOME/.Xresources usermodmap=$HOME/.Xmodmap Index: xc/programs/xkbcomp/Imakefile diff -u xc/programs/xkbcomp/Imakefile:3.15 xc/programs/xkbcomp/Imakefile:3.17 --- xc/programs/xkbcomp/Imakefile:3.15 Mon Jan 31 14:33:45 2000 +++ xc/programs/xkbcomp/Imakefile Sun Jan 21 16:19:40 2001 @@ -1,8 +1,10 @@ -XCOMM $TOG: Imakefile /main/16 1997/09/03 17:04:58 kaleb $ -XCOMM -XCOMM -XCOMM -XCOMM $XFree86: xc/programs/xkbcomp/Imakefile,v 3.15 2000/01/31 19:33:45 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xkbcomp/Imakefile,v 3.17 2001/01/21 21:19:40 tsi Exp $ + #define IHaveSubdirs #define PassCDebugFlags 'CDEBUGFLAGS=$(CDEBUGFLAGS)' @@ -49,6 +51,7 @@ LinkBuildBinary(ProgramTargetName(xkbcomp)) MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) #ifdef OS2Architecture all:: Index: xc/programs/xkbcomp/action.c diff -u xc/programs/xkbcomp/action.c:3.7 xc/programs/xkbcomp/action.c:3.8 --- xc/programs/xkbcomp/action.c:3.7 Tue Oct 24 18:45:16 2000 +++ xc/programs/xkbcomp/action.c Wed Jan 17 18:45:42 2001 @@ -1,4 +1,4 @@ -/* $TOG: action.c /main/12 1997/08/02 10:09:33 kaleb $ */ +/* $Xorg: action.c,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/action.c,v 3.7 2000/10/24 22:45:16 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/action.c,v 3.8 2001/01/17 23:45:42 dawes Exp $ */ #include "xkbcomp.h" #include "tokens.h" Index: xc/programs/xkbcomp/action.h diff -u xc/programs/xkbcomp/action.h:3.0 xc/programs/xkbcomp/action.h:3.1 --- xc/programs/xkbcomp/action.h:3.0 Mon Mar 4 00:29:21 1996 +++ xc/programs/xkbcomp/action.h Wed Jan 17 18:45:43 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: action.h /main/3 1996/03/01 14:31:55 kaleb $ */ +/* $Xorg: action.h,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/alias.c diff -u xc/programs/xkbcomp/alias.c:1.2 xc/programs/xkbcomp/alias.c:1.3 --- xc/programs/xkbcomp/alias.c:1.2 Sun Jun 22 06:17:01 1997 +++ xc/programs/xkbcomp/alias.c Wed Jan 17 18:45:43 2001 @@ -1,4 +1,4 @@ -/* $TOG: alias.c /main/8 1997/06/10 06:53:55 kaleb $ */ +/* $Xorg: alias.c,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/alias.h diff -u xc/programs/xkbcomp/alias.h:1.1.1.3 xc/programs/xkbcomp/alias.h:1.1.1.4 --- xc/programs/xkbcomp/alias.h:1.1.1.3 Sun Dec 29 05:43:11 1996 +++ xc/programs/xkbcomp/alias.h Tue Jan 16 17:54:50 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: alias.h /main/3 1996/12/27 21:16:25 kaleb $ */ +/* $Xorg: alias.h,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/compat.c diff -u xc/programs/xkbcomp/compat.c:3.2 xc/programs/xkbcomp/compat.c:3.3 --- xc/programs/xkbcomp/compat.c:3.2 Sun Aug 27 22:43:18 2000 +++ xc/programs/xkbcomp/compat.c Wed Jan 17 18:45:43 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: compat.c /main/8 1996/03/01 14:32:00 kaleb $ */ +/* $Xorg: compat.c,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/compat.c,v 3.2 2000/08/28 02:43:18 tsi Exp $ */ +/* $XFree86: xc/programs/xkbcomp/compat.c,v 3.3 2001/01/17 23:45:43 dawes Exp $ */ #include <X11/Xos.h> #include "xkbcomp.h" Index: xc/programs/xkbcomp/expr.c diff -u xc/programs/xkbcomp/expr.c:3.4 xc/programs/xkbcomp/expr.c:3.5 --- xc/programs/xkbcomp/expr.c:3.4 Tue Oct 24 18:45:16 2000 +++ xc/programs/xkbcomp/expr.c Wed Jan 17 18:45:43 2001 @@ -1,4 +1,4 @@ -/* $TOG: expr.c /main/11 1997/08/03 11:49:52 kaleb $ */ +/* $Xorg: expr.c,v 1.5 2000/08/17 19:54:30 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/expr.c,v 3.4 2000/10/24 22:45:16 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/expr.c,v 3.5 2001/01/17 23:45:43 dawes Exp $ */ #include "xkbcomp.h" #include "tokens.h" Index: xc/programs/xkbcomp/expr.h diff -u xc/programs/xkbcomp/expr.h:3.0 xc/programs/xkbcomp/expr.h:3.1 --- xc/programs/xkbcomp/expr.h:3.0 Mon Mar 4 00:29:26 1996 +++ xc/programs/xkbcomp/expr.h Wed Jan 17 18:45:43 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: expr.h /main/6 1996/03/01 14:32:09 kaleb $ */ +/* $Xorg: expr.h,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/geometry.c diff -u xc/programs/xkbcomp/geometry.c:1.1.1.5 xc/programs/xkbcomp/geometry.c:1.1.1.6 --- xc/programs/xkbcomp/geometry.c:1.1.1.5 Sun Dec 29 05:43:13 1996 +++ xc/programs/xkbcomp/geometry.c Tue Jan 16 17:54:59 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: geometry.c /main/7 1996/12/27 21:16:35 kaleb $ */ +/* $Xorg: geometry.c,v 1.3 2000/08/17 19:54:30 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/indicators.c diff -u xc/programs/xkbcomp/indicators.c:1.3 xc/programs/xkbcomp/indicators.c:1.4 --- xc/programs/xkbcomp/indicators.c:1.3 Fri Oct 27 20:34:04 2000 +++ xc/programs/xkbcomp/indicators.c Wed Jan 17 18:45:43 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: indicators.c /main/5 1996/01/14 16:47:34 kaleb $ */ +/* $Xorg: indicators.c,v 1.3 2000/08/17 19:54:31 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/indicators.c,v 1.3 2000/10/28 00:34:04 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/indicators.c,v 1.4 2001/01/17 23:45:43 dawes Exp $ */ #include "xkbcomp.h" #include "misc.h" Index: xc/programs/xkbcomp/indicators.h diff -u xc/programs/xkbcomp/indicators.h:1.1.1.2 xc/programs/xkbcomp/indicators.h:1.1.1.3 --- xc/programs/xkbcomp/indicators.h:1.1.1.2 Wed Jan 3 02:39:55 1996 +++ xc/programs/xkbcomp/indicators.h Tue Jan 16 17:55:04 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: indicators.h /main/2 1995/11/30 19:07:24 kaleb $ */ +/* $Xorg: indicators.h,v 1.3 2000/08/17 19:54:32 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/keycodes.c diff -u xc/programs/xkbcomp/keycodes.c:3.2 xc/programs/xkbcomp/keycodes.c:3.3 --- xc/programs/xkbcomp/keycodes.c:3.2 Sun Jun 22 06:17:01 1997 +++ xc/programs/xkbcomp/keycodes.c Wed Jan 17 18:45:43 2001 @@ -1,4 +1,4 @@ -/* $TOG: keycodes.c /main/13 1997/06/13 05:59:12 kaleb $ */ +/* $Xorg: keycodes.c,v 1.4 2000/08/17 19:54:32 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -402,7 +402,6 @@ return True; } else { - int old; if (reportCollisions) { WARN1("Multiple names for keycode %d\n",kc); ACTION2("Using <%s>, ignoring <%s>\n",name,buf); Index: xc/programs/xkbcomp/keycodes.h diff -u xc/programs/xkbcomp/keycodes.h:1.1.1.2 xc/programs/xkbcomp/keycodes.h:1.1.1.3 --- xc/programs/xkbcomp/keycodes.h:1.1.1.2 Wed Jan 3 02:39:57 1996 +++ xc/programs/xkbcomp/keycodes.h Tue Jan 16 17:55:07 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: keycodes.h /main/3 1995/11/30 19:07:32 kaleb $ */ +/* $Xorg: keycodes.h,v 1.3 2000/08/17 19:54:32 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/keymap.c diff -u xc/programs/xkbcomp/keymap.c:1.1.1.3 xc/programs/xkbcomp/keymap.c:1.1.1.4 --- xc/programs/xkbcomp/keymap.c:1.1.1.3 Tue Jan 16 05:20:40 1996 +++ xc/programs/xkbcomp/keymap.c Tue Jan 16 17:55:09 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: keymap.c /main/6 1996/01/14 16:47:51 kaleb $ */ +/* $Xorg: keymap.c,v 1.3 2000/08/17 19:54:32 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/keytypes.c diff -u xc/programs/xkbcomp/keytypes.c:1.3 xc/programs/xkbcomp/keytypes.c:1.4 --- xc/programs/xkbcomp/keytypes.c:1.3 Mon Nov 6 16:57:11 2000 +++ xc/programs/xkbcomp/keytypes.c Wed Jan 17 18:45:44 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: keytypes.c /main/8 1996/01/14 16:47:56 kaleb $ */ +/* $Xorg: keytypes.c,v 1.3 2000/08/17 19:54:32 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/keytypes.c,v 1.3 2000/11/06 21:57:11 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/keytypes.c,v 1.4 2001/01/17 23:45:44 dawes Exp $ */ #include "xkbcomp.h" #include "tokens.h" Index: xc/programs/xkbcomp/listing.c diff -u xc/programs/xkbcomp/listing.c:3.6 xc/programs/xkbcomp/listing.c:3.7 --- xc/programs/xkbcomp/listing.c:3.6 Tue Aug 1 16:05:44 2000 +++ xc/programs/xkbcomp/listing.c Wed Jan 17 18:45:44 2001 @@ -1,4 +1,4 @@ -/* $TOG: listing.c /main/5 1998/02/09 14:04:05 kaleb $ */ +/* $Xorg: listing.c,v 1.4 2000/08/17 19:54:32 cpqbld Exp $ */ /************************************************************ Copyright 1996 by Silicon Graphics Computer Systems, Inc. @@ -66,7 +66,7 @@ SOFTWARE. ******************************************************************/ -/* $XFree86: xc/programs/xkbcomp/listing.c,v 3.6 2000/08/01 20:05:44 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/listing.c,v 3.7 2001/01/17 23:45:44 dawes Exp $ */ #include <stdio.h> @@ -364,7 +364,6 @@ #endif { char *str,*head,*ptrn,*rest= NULL; -int len; if (head_in==NULL) return 0; Index: xc/programs/xkbcomp/misc.c diff -u xc/programs/xkbcomp/misc.c:3.3 xc/programs/xkbcomp/misc.c:3.4 --- xc/programs/xkbcomp/misc.c:3.3 Sun Oct 26 08:25:29 1997 +++ xc/programs/xkbcomp/misc.c Wed Jan 17 18:45:44 2001 @@ -1,4 +1,4 @@ -/* $TOG: misc.c /main/10 1997/08/02 10:09:58 kaleb $ */ +/* $Xorg: misc.c,v 1.3 2000/08/17 19:54:33 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/misc.c,v 3.3 1997/10/26 13:25:29 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/misc.c,v 3.4 2001/01/17 23:45:44 dawes Exp $ */ #include "xkbcomp.h" #include "xkbpath.h" Index: xc/programs/xkbcomp/misc.h diff -u xc/programs/xkbcomp/misc.h:1.2 xc/programs/xkbcomp/misc.h:1.3 --- xc/programs/xkbcomp/misc.h:1.2 Sun Jun 22 06:17:02 1997 +++ xc/programs/xkbcomp/misc.h Wed Jan 17 18:45:44 2001 @@ -1,4 +1,4 @@ -/* $TOG: misc.h /main/5 1997/06/10 06:54:04 kaleb $ */ +/* $Xorg: misc.h,v 1.3 2000/08/17 19:54:33 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/parseutils.c diff -u xc/programs/xkbcomp/parseutils.c:1.2 xc/programs/xkbcomp/parseutils.c:1.3 --- xc/programs/xkbcomp/parseutils.c:1.2 Sun Jun 22 06:17:02 1997 +++ xc/programs/xkbcomp/parseutils.c Wed Jan 17 18:45:44 2001 @@ -1,4 +1,4 @@ -/* $TOG: parseutils.c /main/8 1997/06/13 05:59:21 kaleb $ */ +/* $Xorg: parseutils.c,v 1.3 2000/08/17 19:54:33 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/parseutils.h diff -u xc/programs/xkbcomp/parseutils.h:1.2 xc/programs/xkbcomp/parseutils.h:1.3 --- xc/programs/xkbcomp/parseutils.h:1.2 Sun Jun 22 06:17:03 1997 +++ xc/programs/xkbcomp/parseutils.h Wed Jan 17 18:45:44 2001 @@ -1,4 +1,4 @@ -/* $TOG: parseutils.h /main/3 1997/06/13 05:59:24 kaleb $ */ +/* $Xorg: parseutils.h,v 1.3 2000/08/17 19:54:33 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/symbols.c diff -u xc/programs/xkbcomp/symbols.c:3.9 xc/programs/xkbcomp/symbols.c:3.11 --- xc/programs/xkbcomp/symbols.c:3.9 Mon Nov 6 13:21:57 2000 +++ xc/programs/xkbcomp/symbols.c Tue Feb 20 11:43:14 2001 @@ -1,4 +1,4 @@ -/* $TOG: symbols.c /main/16 1997/08/02 10:10:03 kaleb $ */ +/* $Xorg: symbols.c,v 1.3 2000/08/17 19:54:33 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/symbols.c,v 3.9 2000/11/06 18:21:57 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/symbols.c,v 3.11 2001/02/20 16:43:14 paulo Exp $ */ #include "xkbcomp.h" #include "tokens.h" @@ -1871,6 +1871,8 @@ info.dflt.defs.merge= merge; HandleSymbolsFile(file,xkb,merge,&info); + if (info.nKeys == 0) + return True; if (info.errorCount==0) { KeyInfo *key; if (XkbAllocNames(xkb,XkbSymbolsNameMask|XkbGroupNamesMask,0,0) Index: xc/programs/xkbcomp/tokens.h diff -u xc/programs/xkbcomp/tokens.h:3.2 xc/programs/xkbcomp/tokens.h:3.3 --- xc/programs/xkbcomp/tokens.h:3.2 Sun Jun 22 06:17:03 1997 +++ xc/programs/xkbcomp/tokens.h Wed Jan 17 18:45:44 2001 @@ -1,4 +1,4 @@ -/* $TOG: tokens.h /main/7 1997/06/10 06:54:16 kaleb $ */ +/* $Xorg: tokens.h,v 1.3 2000/08/17 19:54:33 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/utils.c diff -u xc/programs/xkbcomp/utils.c:3.4 xc/programs/xkbcomp/utils.c:3.5 --- xc/programs/xkbcomp/utils.c:3.4 Sat Dec 6 04:26:14 1997 +++ xc/programs/xkbcomp/utils.c Wed Jan 17 18:45:45 2001 @@ -1,7 +1,6 @@ /*\ - * $XConsortium: utils.c /main/3 1996/01/14 16:48:22 kaleb $ - * $XFree86: xc/programs/xkbcomp/utils.c,v 3.4 1997/12/06 09:26:14 hohndel Exp $ + * $Xorg: utils.c,v 1.4 2000/08/17 19:54:33 cpqbld Exp $ * * COPYRIGHT 1990 * DIGITAL EQUIPMENT CORPORATION @@ -26,6 +25,7 @@ * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. \*/ +/* $XFree86: xc/programs/xkbcomp/utils.c,v 3.5 2001/01/17 23:45:45 dawes Exp $ */ #include "utils.h" #include <ctype.h> @@ -608,7 +608,7 @@ char c, *s; register int n; - for (n=0, s = buf1; (c = *str1++) != '\0'; n++) { + for (n=0, s = buf1; (c = *str1++); n++) { if (isupper(c)) c = tolower(c); if (n>510) @@ -616,7 +616,7 @@ *s++ = c; } *s = '\0'; - for (n=0, s = buf2; (c = *str2++) != '\0'; n++) { + for (n=0, s = buf2; (c = *str2++); n++) { if (isupper(c)) c = tolower(c); if (n>510) Index: xc/programs/xkbcomp/utils.h diff -u xc/programs/xkbcomp/utils.h:3.2 xc/programs/xkbcomp/utils.h:3.3 --- xc/programs/xkbcomp/utils.h:3.2 Tue Oct 24 18:45:16 2000 +++ xc/programs/xkbcomp/utils.h Wed Jan 17 18:45:45 2001 @@ -2,8 +2,7 @@ #define UTILS_H 1 /*\ - * $XConsortium: utils.h /main/3 1996/01/14 16:48:26 kaleb $ - * $XFree86: xc/programs/xkbcomp/utils.h,v 3.2 2000/10/24 22:45:16 dawes Exp $ + * $Xorg: utils.h,v 1.3 2000/08/17 19:54:33 cpqbld Exp $ * * COPYRIGHT 1990 * DIGITAL EQUIPMENT CORPORATION @@ -28,6 +27,7 @@ * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. \*/ +/* $XFree86: xc/programs/xkbcomp/utils.h,v 3.3 2001/01/17 23:45:45 dawes Exp $ */ /***====================================================================***/ Index: xc/programs/xkbcomp/vmod.c diff -u xc/programs/xkbcomp/vmod.c:3.2 xc/programs/xkbcomp/vmod.c:3.3 --- xc/programs/xkbcomp/vmod.c:3.2 Sun Oct 26 08:25:30 1997 +++ xc/programs/xkbcomp/vmod.c Wed Jan 17 18:45:45 2001 @@ -1,4 +1,4 @@ -/* $TOG: vmod.c /main/7 1997/08/02 10:10:09 kaleb $ */ +/* $Xorg: vmod.c,v 1.3 2000/08/17 19:54:33 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/vmod.c,v 3.2 1997/10/26 13:25:30 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/vmod.c,v 3.3 2001/01/17 23:45:45 dawes Exp $ */ #define DEBUG_VAR_NOT_LOCAL #define DEBUG_VAR debugFlags Index: xc/programs/xkbcomp/vmod.h diff -u xc/programs/xkbcomp/vmod.h:1.1.1.2 xc/programs/xkbcomp/vmod.h:1.1.1.3 --- xc/programs/xkbcomp/vmod.h:1.1.1.2 Wed Jan 3 02:40:08 1996 +++ xc/programs/xkbcomp/vmod.h Tue Jan 16 17:55:32 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: vmod.h /main/3 1995/11/30 19:08:19 kaleb $ */ +/* $Xorg: vmod.h,v 1.3 2000/08/17 19:54:33 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbcomp/xkbcomp.c diff -u xc/programs/xkbcomp/xkbcomp.c:3.13 xc/programs/xkbcomp/xkbcomp.c:3.14 --- xc/programs/xkbcomp/xkbcomp.c:3.13 Sat Sep 4 05:14:23 1999 +++ xc/programs/xkbcomp/xkbcomp.c Wed Jan 17 18:45:45 2001 @@ -1,4 +1,4 @@ -/* $TOG: xkbcomp.c /main/13 1997/08/02 10:10:13 kaleb $ */ +/* $Xorg: xkbcomp.c,v 1.4 2000/08/17 19:54:33 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbcomp.c,v 3.13 1999/09/04 09:14:23 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbcomp.c,v 3.14 2001/01/17 23:45:45 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/xkbcomp/xkbcomp.h diff -u xc/programs/xkbcomp/xkbcomp.h:3.6 xc/programs/xkbcomp/xkbcomp.h:3.7 --- xc/programs/xkbcomp/xkbcomp.h:3.6 Tue Aug 1 16:05:44 2000 +++ xc/programs/xkbcomp/xkbcomp.h Wed Jan 17 18:45:45 2001 @@ -1,4 +1,4 @@ -/* $TOG: xkbcomp.h /main/13 1997/08/02 10:10:18 kaleb $ */ +/* $Xorg: xkbcomp.h,v 1.3 2000/08/17 19:54:33 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbcomp.h,v 3.6 2000/08/01 20:05:44 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbcomp.h,v 3.7 2001/01/17 23:45:45 dawes Exp $ */ #ifndef XKBCOMP_H #define XKBCOMP_H 1 Index: xc/programs/xkbcomp/xkbcomp.man diff -u xc/programs/xkbcomp/xkbcomp.man:1.6 xc/programs/xkbcomp/xkbcomp.man:1.9 --- xc/programs/xkbcomp/xkbcomp.man:1.6 Thu Aug 3 08:24:03 2000 +++ xc/programs/xkbcomp/xkbcomp.man Sat Jan 27 13:21:16 2001 @@ -1,6 +1,11 @@ -.\" $TOG: xkbcomp.man /main/5 1997/11/04 20:57:14 kaleb $ -.\" $XFree86: xc/programs/xkbcomp/xkbcomp.man,v 1.6 2000/08/03 12:24:03 dawes Exp $ -.TH XKBCOMP 1 "Release 6.4" "X Version 11" +.\" $Xorg: xkbcomp.man,v 1.3 2000/08/17 19:54:33 cpqbld Exp $ +.\" +.\" +.\" +.\" +.\" $XFree86: xc/programs/xkbcomp/xkbcomp.man,v 1.9 2001/01/27 18:21:16 dawes Exp $ +.\" +.TH XKBCOMP 1 __xorgversion__ .SH NAME xkbcomp \- compile XKB keyboard description .SH SYNOPSIS @@ -89,10 +94,10 @@ .B \-xkm Generate a compiled keymap file as output (.xkm extension). .SH "SEE ALSO" -X(1) +X(__miscmansuffix__) .SH COPYRIGHT Copyright 1994, Silicon Graphics Computer Systems and X Consortium, Inc. .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHOR Erik Fortune, Silicon Graphics Index: xc/programs/xkbcomp/xkbparse.y diff -u xc/programs/xkbcomp/xkbparse.y:3.8 xc/programs/xkbcomp/xkbparse.y:3.9 --- xc/programs/xkbcomp/xkbparse.y:3.8 Fri Oct 27 20:34:04 2000 +++ xc/programs/xkbcomp/xkbparse.y Wed Jan 17 18:45:45 2001 @@ -1,4 +1,4 @@ -/* $TOG: xkbparse.y /main/11 1997/06/13 05:59:27 kaleb $ */ +/* $Xorg: xkbparse.y,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbparse.y,v 3.8 2000/10/28 00:34:04 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbparse.y,v 3.9 2001/01/17 23:45:45 dawes Exp $ */ %token END_OF_FILE 0 Index: xc/programs/xkbcomp/xkbpath.c diff -u xc/programs/xkbcomp/xkbpath.c:3.3 xc/programs/xkbcomp/xkbpath.c:3.4 --- xc/programs/xkbcomp/xkbpath.c:3.3 Sun Oct 4 05:41:28 1998 +++ xc/programs/xkbcomp/xkbpath.c Wed Jan 17 18:45:45 2001 @@ -1,4 +1,4 @@ -/* $TOG: xkbpath.c /main/5 1997/08/02 10:10:22 kaleb $ */ +/* $Xorg: xkbpath.c,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbpath.c,v 3.3 1998/10/04 09:41:28 dawes Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbpath.c,v 3.4 2001/01/17 23:45:45 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/XKBlib.h> Index: xc/programs/xkbcomp/xkbscan.c diff -u xc/programs/xkbcomp/xkbscan.c:3.9 xc/programs/xkbcomp/xkbscan.c:3.10 --- xc/programs/xkbcomp/xkbscan.c:3.9 Sat Dec 6 04:26:14 1997 +++ xc/programs/xkbcomp/xkbscan.c Wed Jan 17 18:45:45 2001 @@ -1,4 +1,4 @@ -/* $TOG: xkbscan.c /main/11 1997/08/02 10:10:26 kaleb $ */ +/* $Xorg: xkbscan.c,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbcomp/xkbscan.c,v 3.9 1997/12/06 09:26:14 hohndel Exp $ */ +/* $XFree86: xc/programs/xkbcomp/xkbscan.c,v 3.10 2001/01/17 23:45:45 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/xkbcomp/compat/Imakefile diff -u xc/programs/xkbcomp/compat/Imakefile:3.7 xc/programs/xkbcomp/compat/Imakefile:3.8 --- xc/programs/xkbcomp/compat/Imakefile:3.7 Sat Aug 26 11:11:29 2000 +++ xc/programs/xkbcomp/compat/Imakefile Wed Jan 17 18:45:47 2001 @@ -1,5 +1,9 @@ -XCOMM $TOG: Imakefile /main/5 1997/08/02 10:10:30 kaleb $ -XCOMM $XFree86: xc/programs/xkbcomp/compat/Imakefile,v 3.7 2000/08/26 15:11:29 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xkbcomp/compat/Imakefile,v 3.8 2001/01/17 23:45:47 dawes Exp $ DATAFILES = accessx basic complete default group_led iso9995 japan \ keypad misc mousekeys norepeat pc pc98 xtest leds Index: xc/programs/xkbcomp/compat/accessx diff -u xc/programs/xkbcomp/compat/accessx:1.1.1.1 xc/programs/xkbcomp/compat/accessx:1.1.1.2 --- xc/programs/xkbcomp/compat/accessx:1.1.1.1 Wed Jan 3 02:40:25 1996 +++ xc/programs/xkbcomp/compat/accessx Tue Jan 16 17:55:53 2001 @@ -1,4 +1,4 @@ -// $XConsortium: accessx /main/2 1995/12/07 21:32:12 kaleb $ +// $Xorg: accessx,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ default partial xkb_compatibility "basic" { interpret AccessX_Enable { Index: xc/programs/xkbcomp/compat/basic diff -u xc/programs/xkbcomp/compat/basic:1.2 xc/programs/xkbcomp/compat/basic:1.3 --- xc/programs/xkbcomp/compat/basic:1.2 Mon Nov 6 14:24:10 2000 +++ xc/programs/xkbcomp/compat/basic Wed Jan 17 18:45:47 2001 @@ -1,11 +1,11 @@ -// $XConsortium: basic /main/5 1995/12/07 21:32:21 kaleb $ +// $Xorg: basic,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ // Minimal set of symbol interpretations to provide // reasonable default behavior (Num lock, shift and // caps lock and mode switch) and set up the // automatic updating of common keyboard LEDs. -// $XFree86: xc/programs/xkbcomp/compat/basic,v 1.2 2000/11/06 19:24:10 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/compat/basic,v 1.3 2001/01/17 23:45:47 dawes Exp $ default xkb_compatibility "basic" { virtual_modifiers NumLock,AltGr; Index: xc/programs/xkbcomp/compat/complete diff -u xc/programs/xkbcomp/compat/complete:1.1.1.2 xc/programs/xkbcomp/compat/complete:1.1.1.3 --- xc/programs/xkbcomp/compat/complete:1.1.1.2 Wed Jan 3 02:40:19 1996 +++ xc/programs/xkbcomp/compat/complete Tue Jan 16 17:55:58 2001 @@ -1,4 +1,4 @@ -// $XConsortium: complete /main/4 1995/12/07 21:32:28 kaleb $ +// $Xorg: complete,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ default xkb_compatibility "complete" { include "basic" augment "iso9995" Index: xc/programs/xkbcomp/compat/default diff -u xc/programs/xkbcomp/compat/default:1.1.1.2 xc/programs/xkbcomp/compat/default:1.1.1.3 --- xc/programs/xkbcomp/compat/default:1.1.1.2 Wed Jan 3 02:40:20 1996 +++ xc/programs/xkbcomp/compat/default Tue Jan 16 17:56:00 2001 @@ -1,4 +1,4 @@ -// $XConsortium: default /main/5 1995/12/07 21:32:35 kaleb $ +// $Xorg: default,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ default xkb_compatibility "default" { include "basic" augment "mousekeys" Index: xc/programs/xkbcomp/compat/iso9995 diff -u xc/programs/xkbcomp/compat/iso9995:1.1.1.2 xc/programs/xkbcomp/compat/iso9995:1.1.1.3 --- xc/programs/xkbcomp/compat/iso9995:1.1.1.2 Wed Jan 3 02:40:21 1996 +++ xc/programs/xkbcomp/compat/iso9995 Tue Jan 16 17:56:03 2001 @@ -1,4 +1,4 @@ -// $XConsortium: iso9995 /main/5 1995/12/07 21:32:43 kaleb $ +// $Xorg: iso9995,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ // Fairly complete set of symbol interpretations // to provide reasonable default behavior Index: xc/programs/xkbcomp/compat/japan diff -u xc/programs/xkbcomp/compat/japan:1.1.1.1 xc/programs/xkbcomp/compat/japan:1.1.1.2 --- xc/programs/xkbcomp/compat/japan:1.1.1.1 Wed Jan 3 02:40:25 1996 +++ xc/programs/xkbcomp/compat/japan Tue Jan 16 17:56:06 2001 @@ -1,4 +1,4 @@ -// $XConsortium: japan /main/2 1995/12/07 21:32:51 kaleb $ +// $Xorg: japan,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ // Japanese keyboards need Eisu and Kana shift and // lock keys, which are typically bound to the Index: xc/programs/xkbcomp/compat/keypad diff -u xc/programs/xkbcomp/compat/keypad:3.1 xc/programs/xkbcomp/compat/keypad:3.2 --- xc/programs/xkbcomp/compat/keypad:3.1 Sun Jun 22 06:17:06 1997 +++ xc/programs/xkbcomp/compat/keypad Wed Jan 17 18:45:47 2001 @@ -1,4 +1,4 @@ -// $TOG: keypad /main/1 1997/06/10 06:54:31 kaleb $ +// $Xorg: keypad,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ // Interpretations needed to implement the numeric keypad // as an overlay instead of a modifier. Index: xc/programs/xkbcomp/compat/misc diff -u xc/programs/xkbcomp/compat/misc:1.1.1.2 xc/programs/xkbcomp/compat/misc:1.1.1.3 --- xc/programs/xkbcomp/compat/misc:1.1.1.2 Wed Jan 3 02:40:22 1996 +++ xc/programs/xkbcomp/compat/misc Tue Jan 16 17:56:11 2001 @@ -1,4 +1,4 @@ -// $XConsortium: misc /main/4 1995/12/07 21:33:00 kaleb $ +// $Xorg: misc,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ default partial xkb_compatibility "misc" { virtual_modifiers Alt,ScrollLock; Index: xc/programs/xkbcomp/compat/mousekeys diff -u xc/programs/xkbcomp/compat/mousekeys:1.1.1.2 xc/programs/xkbcomp/compat/mousekeys:1.1.1.3 --- xc/programs/xkbcomp/compat/mousekeys:1.1.1.2 Wed Jan 3 02:40:24 1996 +++ xc/programs/xkbcomp/compat/mousekeys Tue Jan 16 17:56:13 2001 @@ -1,5 +1,5 @@ -// $XConsortium: mousekeys /main/4 1995/12/07 21:33:08 kaleb $ +// $Xorg: mousekeys,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ // Interpretations for arrow keys and a bunch of other // common keysyms which make it possible to bind "mouse" Index: xc/programs/xkbcomp/compat/norepeat diff -u xc/programs/xkbcomp/compat/norepeat:1.1.1.1 xc/programs/xkbcomp/compat/norepeat:1.1.1.2 --- xc/programs/xkbcomp/compat/norepeat:1.1.1.1 Wed Jan 3 02:40:25 1996 +++ xc/programs/xkbcomp/compat/norepeat Tue Jan 16 17:56:15 2001 @@ -1,4 +1,4 @@ -// $XConsortium: norepeat /main/2 1995/12/07 21:33:17 kaleb $ +// $Xorg: norepeat,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ // Put any otherwise normal keys that you don't want to repeat in // this file Index: xc/programs/xkbcomp/compat/pc diff -u xc/programs/xkbcomp/compat/pc:1.1.1.1 xc/programs/xkbcomp/compat/pc:1.1.1.2 --- xc/programs/xkbcomp/compat/pc:1.1.1.1 Wed Jan 3 02:40:25 1996 +++ xc/programs/xkbcomp/compat/pc Tue Jan 16 17:56:17 2001 @@ -1,4 +1,4 @@ -// $XConsortium: pc /main/2 1995/12/07 21:33:24 kaleb $ +// $Xorg: pc,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ default partial xkb_compatibility "pc" { // Sets the "Alt" virtual modifier Index: xc/programs/xkbcomp/compat/pc98 diff -u xc/programs/xkbcomp/compat/pc98:3.1 xc/programs/xkbcomp/compat/pc98:3.2 --- xc/programs/xkbcomp/compat/pc98:3.1 Sun Oct 26 08:25:33 1997 +++ xc/programs/xkbcomp/compat/pc98 Wed Jan 17 18:45:47 2001 @@ -1,9 +1,9 @@ -// $TOG: pc98 /main/1 1997/08/02 10:10:34 kaleb $ +// $Xorg: pc98,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ -// $XFree86: xc/programs/xkbcomp/compat/pc98,v 3.1 1997/10/26 13:25:33 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/compat/pc98,v 3.2 2001/01/17 23:45:47 dawes Exp $ // Minimal set of symbol interpretations to provide // reasonable default behavior (Num lock, shift and Index: xc/programs/xkbcomp/compat/xtest diff -u xc/programs/xkbcomp/compat/xtest:1.1.1.1 xc/programs/xkbcomp/compat/xtest:1.1.1.2 --- xc/programs/xkbcomp/compat/xtest:1.1.1.1 Wed Jan 3 02:40:25 1996 +++ xc/programs/xkbcomp/compat/xtest Tue Jan 16 17:56:20 2001 @@ -1,4 +1,4 @@ -// $XConsortium: xtest /main/2 1995/12/07 21:33:32 kaleb $ +// $Xorg: xtest,v 1.3 2000/08/17 19:54:34 cpqbld Exp $ default xkb_compatibility "xtest" { // Minimal set of symbol interpretations to provide Index: xc/programs/xkbcomp/compiled/Imakefile diff -u xc/programs/xkbcomp/compiled/Imakefile:1.1.1.1 xc/programs/xkbcomp/compiled/Imakefile:1.1.1.2 --- xc/programs/xkbcomp/compiled/Imakefile:1.1.1.1 Wed Jan 3 02:40:43 1996 +++ xc/programs/xkbcomp/compiled/Imakefile Tue Jan 16 17:57:33 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/1 1995/11/30 19:11:08 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ DATAFILES = README Index: xc/programs/xkbcomp/geometry/Imakefile diff -u xc/programs/xkbcomp/geometry/Imakefile:3.9 xc/programs/xkbcomp/geometry/Imakefile:3.11 --- xc/programs/xkbcomp/geometry/Imakefile:3.9 Sun May 23 01:27:50 1999 +++ xc/programs/xkbcomp/geometry/Imakefile Sun Jan 21 16:19:40 2001 @@ -1,5 +1,10 @@ -XCOMM $TOG: Imakefile /main/16 1997/08/02 10:10:37 kaleb $ -XCOMM $XFree86: xc/programs/xkbcomp/geometry/Imakefile,v 3.9 1999/05/23 05:27:50 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xkbcomp/geometry/Imakefile,v 3.11 2001/01/21 21:19:40 tsi Exp $ + #define IHaveSubdirs TESTDATA = @@ -12,4 +17,4 @@ MakeXkbDir($(LIBDIR)/xkb,geometry) InstallMultiple($(DATAFILES),$(LIBDIR)/xkb/geometry) -DependTarget() +DependSubdirs($(SUBDIRS)) Index: xc/programs/xkbcomp/geometry/amiga diff -u xc/programs/xkbcomp/geometry/amiga:3.2 xc/programs/xkbcomp/geometry/amiga:3.3 --- xc/programs/xkbcomp/geometry/amiga:3.2 Sun Oct 26 08:25:34 1997 +++ xc/programs/xkbcomp/geometry/amiga Wed Jan 17 18:45:49 2001 @@ -1,8 +1,9 @@ -// $TOG: amiga /main/1 1997/08/02 10:10:42 kaleb $ +// $Xorg: amiga,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ -// $XFree86: xc/programs/xkbcomp/geometry/amiga,v 3.2 1997/10/26 13:25:34 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/geometry/amiga,v 3.3 2001/01/17 23:45:49 dawes Exp $ + default xkb_geometry "usa1" { description= "Amiga (usa1)"; Index: xc/programs/xkbcomp/geometry/ataritt diff -u xc/programs/xkbcomp/geometry/ataritt:3.2 xc/programs/xkbcomp/geometry/ataritt:3.3 --- xc/programs/xkbcomp/geometry/ataritt:3.2 Sun Oct 26 08:25:34 1997 +++ xc/programs/xkbcomp/geometry/ataritt Wed Jan 17 18:45:49 2001 @@ -1,8 +1,9 @@ -// $TOG: ataritt /main/1 1997/08/02 10:10:46 kaleb $ +// $Xorg: ataritt,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ -// $XFree86: xc/programs/xkbcomp/geometry/ataritt,v 3.2 1997/10/26 13:25:34 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/geometry/ataritt,v 3.3 2001/01/17 23:45:49 dawes Exp $ + default xkb_geometry "us" { description= "Atari TT (us)"; Index: xc/programs/xkbcomp/geometry/dell diff -u xc/programs/xkbcomp/geometry/dell:3.3 xc/programs/xkbcomp/geometry/dell:3.4 --- xc/programs/xkbcomp/geometry/dell:3.3 Sun Oct 4 05:41:29 1998 +++ xc/programs/xkbcomp/geometry/dell Wed Jan 17 18:45:49 2001 @@ -1,4 +1,4 @@ -// $TOG: dell /main/3 1998/02/10 13:43:22 kaleb $ +// $Xorg: dell,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/geometry/everex diff -u xc/programs/xkbcomp/geometry/everex:1.1.1.1 xc/programs/xkbcomp/geometry/everex:1.1.1.2 --- xc/programs/xkbcomp/geometry/everex:1.1.1.1 Wed Jan 24 06:15:18 1996 +++ xc/programs/xkbcomp/geometry/everex Tue Jan 16 17:57:42 2001 @@ -1,4 +1,4 @@ -// $XConsortium: everex /main/4 1996/01/22 18:08:06 kaleb $ +// $Xorg: everex,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ default xkb_geometry "STEPnote" { description= "Everex STEPnote"; Index: xc/programs/xkbcomp/geometry/fujitsu diff -u xc/programs/xkbcomp/geometry/fujitsu:1.1.1.2 xc/programs/xkbcomp/geometry/fujitsu:1.1.1.3 --- xc/programs/xkbcomp/geometry/fujitsu:1.1.1.2 Sun Sep 27 04:54:12 1998 +++ xc/programs/xkbcomp/geometry/fujitsu Tue Jan 16 17:57:45 2001 @@ -1,4 +1,4 @@ -// $TOG: fujitsu /main/3 1998/02/10 13:43:29 kaleb $ +// $Xorg: fujitsu,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/geometry/hp diff -u xc/programs/xkbcomp/geometry/hp:1.3 xc/programs/xkbcomp/geometry/hp:1.4 --- xc/programs/xkbcomp/geometry/hp:1.3 Sun Oct 4 05:41:30 1998 +++ xc/programs/xkbcomp/geometry/hp Wed Jan 17 18:45:49 2001 @@ -1,4 +1,4 @@ -// $TOG: hp /main/4 1998/02/10 13:43:33 kaleb $ +// $Xorg: hp,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/geometry/keytronic diff -u xc/programs/xkbcomp/geometry/keytronic:1.1.1.3 xc/programs/xkbcomp/geometry/keytronic:1.1.1.4 --- xc/programs/xkbcomp/geometry/keytronic:1.1.1.3 Sun Sep 27 04:53:58 1998 +++ xc/programs/xkbcomp/geometry/keytronic Tue Jan 16 17:57:49 2001 @@ -1,4 +1,4 @@ -// $TOG: keytronic /main/6 1998/02/10 13:43:39 kaleb $ +// $Xorg: keytronic,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/geometry/kinesis diff -u xc/programs/xkbcomp/geometry/kinesis:3.1 xc/programs/xkbcomp/geometry/kinesis:3.2 --- xc/programs/xkbcomp/geometry/kinesis:3.1 Mon Dec 23 02:11:53 1996 +++ xc/programs/xkbcomp/geometry/kinesis Wed Jan 17 18:45:49 2001 @@ -1,4 +1,4 @@ -// $XConsortium: kinesis /main/5 1996/08/31 12:16:24 kaleb $ +// $Xorg: kinesis,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ default xkb_geometry "model100" { // This is an approximate layout for a Kinesis Ergonomic keyboard Index: xc/programs/xkbcomp/geometry/microsoft diff -u xc/programs/xkbcomp/geometry/microsoft:3.1 xc/programs/xkbcomp/geometry/microsoft:3.2 --- xc/programs/xkbcomp/geometry/microsoft:3.1 Mon Dec 23 02:11:54 1996 +++ xc/programs/xkbcomp/geometry/microsoft Wed Jan 17 18:45:49 2001 @@ -1,4 +1,4 @@ -// $XConsortium: microsoft /main/6 1996/08/31 12:16:27 kaleb $ +// $Xorg: microsoft,v 1.3 2000/08/17 19:54:35 cpqbld Exp $ default xkb_geometry "natural" { // Approximate layout for a Microsoft Natural Keyboard Index: xc/programs/xkbcomp/geometry/nec diff -u xc/programs/xkbcomp/geometry/nec:3.3 xc/programs/xkbcomp/geometry/nec:3.4 --- xc/programs/xkbcomp/geometry/nec:3.3 Sun Oct 4 05:41:30 1998 +++ xc/programs/xkbcomp/geometry/nec Wed Jan 17 18:45:49 2001 @@ -1,4 +1,4 @@ -// $TOG: nec /main/2 1998/02/10 13:43:45 kaleb $ +// $Xorg: nec,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // @@ -20,7 +20,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/geometry/nec,v 3.3 1998/10/04 09:41:30 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/geometry/nec,v 3.4 2001/01/17 23:45:49 dawes Exp $ default xkb_geometry "pc98" { Index: xc/programs/xkbcomp/geometry/northgate diff -u xc/programs/xkbcomp/geometry/northgate:1.1.1.1 xc/programs/xkbcomp/geometry/northgate:1.1.1.2 --- xc/programs/xkbcomp/geometry/northgate:1.1.1.1 Wed Jan 24 06:15:20 1996 +++ xc/programs/xkbcomp/geometry/northgate Tue Jan 16 17:57:57 2001 @@ -1,4 +1,4 @@ -// $XConsortium: northgate /main/6 1996/01/22 18:08:21 kaleb $ +// $Xorg: northgate,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ default xkb_geometry "omnikey101" { description= "North Gate Omnikey 101"; Index: xc/programs/xkbcomp/geometry/pc diff -u xc/programs/xkbcomp/geometry/pc:3.9 xc/programs/xkbcomp/geometry/pc:3.10 --- xc/programs/xkbcomp/geometry/pc:3.9 Sun Aug 29 22:34:21 1999 +++ xc/programs/xkbcomp/geometry/pc Wed Jan 17 18:45:49 2001 @@ -1,4 +1,4 @@ -// $TOG: pc /main/6 1998/02/10 13:43:50 kaleb $ +// $Xorg: pc,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // @@ -20,7 +20,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/geometry/pc,v 3.9 1999/08/30 02:34:21 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/geometry/pc,v 3.10 2001/01/17 23:45:49 dawes Exp $ default xkb_geometry "pc101" { Index: xc/programs/xkbcomp/geometry/sony diff -u xc/programs/xkbcomp/geometry/sony:1.1.1.2 xc/programs/xkbcomp/geometry/sony:1.1.1.3 --- xc/programs/xkbcomp/geometry/sony:1.1.1.2 Sun Sep 27 04:54:06 1998 +++ xc/programs/xkbcomp/geometry/sony Tue Jan 16 17:58:00 2001 @@ -1,4 +1,4 @@ -// $TOG: sony /main/2 1998/02/10 13:43:55 kaleb $ +// $Xorg: sony,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/geometry/sun diff -u xc/programs/xkbcomp/geometry/sun:1.4 xc/programs/xkbcomp/geometry/sun:1.5 --- xc/programs/xkbcomp/geometry/sun:1.4 Sun Dec 20 06:58:23 1998 +++ xc/programs/xkbcomp/geometry/sun Wed Jan 17 18:45:49 2001 @@ -1,4 +1,4 @@ -// $TOG: sun /main/8 1998/02/10 13:43:59 kaleb $ +// $Xorg: sun,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // @@ -20,7 +20,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/geometry/sun,v 1.4 1998/12/20 11:58:23 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/geometry/sun,v 1.5 2001/01/17 23:45:49 dawes Exp $ // xkb_geometry "type4" { Index: xc/programs/xkbcomp/geometry/winbook diff -u xc/programs/xkbcomp/geometry/winbook:1.1.1.1 xc/programs/xkbcomp/geometry/winbook:1.1.1.2 --- xc/programs/xkbcomp/geometry/winbook:1.1.1.1 Wed Jan 24 06:15:20 1996 +++ xc/programs/xkbcomp/geometry/winbook Tue Jan 16 17:58:04 2001 @@ -1,4 +1,4 @@ -// $XConsortium: winbook /main/1 1996/01/22 18:08:31 kaleb $ +// $Xorg: winbook,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ default xkb_geometry "XP5" { description= "WinBook XP5"; Index: xc/programs/xkbcomp/geometry/digital/Imakefile diff -u xc/programs/xkbcomp/geometry/digital/Imakefile:1.1.1.1 xc/programs/xkbcomp/geometry/digital/Imakefile:1.1.1.2 --- xc/programs/xkbcomp/geometry/digital/Imakefile:1.1.1.1 Wed Jan 24 06:15:20 1996 +++ xc/programs/xkbcomp/geometry/digital/Imakefile Tue Jan 16 17:58:06 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/1 1996/01/22 18:01:14 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ #undef lk #undef pc Index: xc/programs/xkbcomp/geometry/digital/lk diff -u xc/programs/xkbcomp/geometry/digital/lk:3.2 xc/programs/xkbcomp/geometry/digital/lk:3.3 --- xc/programs/xkbcomp/geometry/digital/lk:3.2 Mon Dec 23 02:12:08 1996 +++ xc/programs/xkbcomp/geometry/digital/lk Wed Jan 17 18:45:50 2001 @@ -1,4 +1,4 @@ -// $XConsortium: lk /main/3 1996/08/31 12:16:34 kaleb $ +// $Xorg: lk,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ // //Copyright (c) 1996 Digital Equipment Corporation // Index: xc/programs/xkbcomp/geometry/digital/pc diff -u xc/programs/xkbcomp/geometry/digital/pc:3.2 xc/programs/xkbcomp/geometry/digital/pc:3.3 --- xc/programs/xkbcomp/geometry/digital/pc:3.2 Mon Dec 23 02:12:09 1996 +++ xc/programs/xkbcomp/geometry/digital/pc Wed Jan 17 18:45:50 2001 @@ -1,4 +1,4 @@ -// $XConsortium: pc /main/4 1996/08/31 12:16:38 kaleb $ +// $Xorg: pc,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ // //Copyright (c) 1996 Digital Equipment Corporation // Index: xc/programs/xkbcomp/geometry/digital/unix diff -u xc/programs/xkbcomp/geometry/digital/unix:3.1 xc/programs/xkbcomp/geometry/digital/unix:3.2 --- xc/programs/xkbcomp/geometry/digital/unix:3.1 Mon Dec 23 02:12:10 1996 +++ xc/programs/xkbcomp/geometry/digital/unix Wed Jan 17 18:45:50 2001 @@ -1,4 +1,4 @@ -// $XConsortium: unix /main/3 1996/08/31 12:16:41 kaleb $ +// $Xorg: unix,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ // //Copyright (c) 1996 Digital Equipment Corporation // Index: xc/programs/xkbcomp/geometry/sgi/Imakefile diff -u xc/programs/xkbcomp/geometry/sgi/Imakefile:1.2 xc/programs/xkbcomp/geometry/sgi/Imakefile:1.3 --- xc/programs/xkbcomp/geometry/sgi/Imakefile:1.2 Sun Jun 22 06:17:07 1997 +++ xc/programs/xkbcomp/geometry/sgi/Imakefile Wed Jan 17 18:45:50 2001 @@ -1,4 +1,4 @@ -XCOMM $TOG: Imakefile /main/2 1997/06/10 06:54:34 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ DATAFILES = indy indigo O2 Index: xc/programs/xkbcomp/geometry/sgi/O2 diff -u xc/programs/xkbcomp/geometry/sgi/O2:3.1 xc/programs/xkbcomp/geometry/sgi/O2:3.2 --- xc/programs/xkbcomp/geometry/sgi/O2:3.1 Sun Jun 22 06:17:07 1997 +++ xc/programs/xkbcomp/geometry/sgi/O2 Wed Jan 17 18:45:51 2001 @@ -1,4 +1,4 @@ -// $TOG: O2 /main/1 1997/06/10 06:54:37 kaleb $ +// $Xorg: O2,v 1.3 2000/08/17 19:54:36 cpqbld Exp $ // // Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc. // Index: xc/programs/xkbcomp/geometry/sgi/indigo diff -u xc/programs/xkbcomp/geometry/sgi/indigo:3.1 xc/programs/xkbcomp/geometry/sgi/indigo:3.2 --- xc/programs/xkbcomp/geometry/sgi/indigo:3.1 Mon Dec 23 02:12:16 1996 +++ xc/programs/xkbcomp/geometry/sgi/indigo Wed Jan 17 18:45:51 2001 @@ -1,4 +1,4 @@ -// $XConsortium: indigo /main/2 1996/08/31 12:16:44 kaleb $ +// $Xorg: indigo,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ // // Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc. // Index: xc/programs/xkbcomp/geometry/sgi/indy diff -u xc/programs/xkbcomp/geometry/sgi/indy:3.2 xc/programs/xkbcomp/geometry/sgi/indy:3.3 --- xc/programs/xkbcomp/geometry/sgi/indy:3.2 Sun Jun 22 06:17:07 1997 +++ xc/programs/xkbcomp/geometry/sgi/indy Wed Jan 17 18:45:51 2001 @@ -1,4 +1,4 @@ -// $TOG: indy /main/3 1997/06/10 06:54:40 kaleb $ +// $Xorg: indy,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ // // Copyright (c) 1996 by Silicon Graphics Computer Systems, Inc. // Index: xc/programs/xkbcomp/keycodes/Imakefile diff -u xc/programs/xkbcomp/keycodes/Imakefile:3.10 xc/programs/xkbcomp/keycodes/Imakefile:3.12 --- xc/programs/xkbcomp/keycodes/Imakefile:3.10 Tue Sep 19 08:46:23 2000 +++ xc/programs/xkbcomp/keycodes/Imakefile Sun Jan 21 16:19:40 2001 @@ -1,5 +1,10 @@ -XCOMM $TOG: Imakefile /main/13 1997/08/02 10:10:54 kaleb $ -XCOMM $XFree86: xc/programs/xkbcomp/keycodes/Imakefile,v 3.10 2000/09/19 12:46:23 eich Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xkbcomp/keycodes/Imakefile,v 3.12 2001/01/21 21:19:40 tsi Exp $ + #define IHaveSubdirs DATAFILES = amiga ataritt fujitsu hp ibm macintosh sony sun xfree86 \ @@ -10,4 +15,4 @@ MakeXkbDir($(LIBDIR)/xkb,keycodes) InstallMultiple($(DATAFILES),$(LIBDIR)/xkb/keycodes) -DependTarget() +DependSubdirs($(SUBDIRS)) Index: xc/programs/xkbcomp/keycodes/amiga diff -u xc/programs/xkbcomp/keycodes/amiga:3.2 xc/programs/xkbcomp/keycodes/amiga:3.3 --- xc/programs/xkbcomp/keycodes/amiga:3.2 Sun Oct 26 08:25:35 1997 +++ xc/programs/xkbcomp/keycodes/amiga Wed Jan 17 18:45:51 2001 @@ -1,8 +1,9 @@ -// $TOG: amiga /main/1 1997/08/02 10:10:58 kaleb $ +// $Xorg: amiga,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ -// $XFree86: xc/programs/xkbcomp/keycodes/amiga,v 3.2 1997/10/26 13:25:35 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keycodes/amiga,v 3.3 2001/01/17 23:45:51 dawes Exp $ + default xkb_keycodes "usa1" { minimum= 8; Index: xc/programs/xkbcomp/keycodes/ataritt diff -u xc/programs/xkbcomp/keycodes/ataritt:3.1 xc/programs/xkbcomp/keycodes/ataritt:3.2 --- xc/programs/xkbcomp/keycodes/ataritt:3.1 Sun Oct 26 08:25:35 1997 +++ xc/programs/xkbcomp/keycodes/ataritt Wed Jan 17 18:45:51 2001 @@ -1,8 +1,9 @@ -// $TOG: ataritt /main/1 1997/08/02 10:11:01 kaleb $ +// $Xorg: ataritt,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ -// $XFree86: xc/programs/xkbcomp/keycodes/ataritt,v 3.1 1997/10/26 13:25:35 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keycodes/ataritt,v 3.2 2001/01/17 23:45:51 dawes Exp $ + default xkb_keycodes "us" { minimum= 8; Index: xc/programs/xkbcomp/keycodes/fujitsu diff -u xc/programs/xkbcomp/keycodes/fujitsu:1.1.1.2 xc/programs/xkbcomp/keycodes/fujitsu:1.1.1.3 --- xc/programs/xkbcomp/keycodes/fujitsu:1.1.1.2 Sun Sep 27 04:56:07 1998 +++ xc/programs/xkbcomp/keycodes/fujitsu Tue Jan 16 17:58:27 2001 @@ -1,4 +1,4 @@ -// $TOG: fujitsu /main/2 1998/02/10 13:44:03 kaleb $ +// $Xorg: fujitsu,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/keycodes/hp diff -u xc/programs/xkbcomp/keycodes/hp:1.3 xc/programs/xkbcomp/keycodes/hp:1.4 --- xc/programs/xkbcomp/keycodes/hp:1.3 Sun Oct 4 05:41:32 1998 +++ xc/programs/xkbcomp/keycodes/hp Wed Jan 17 18:45:51 2001 @@ -1,4 +1,4 @@ -// $TOG: hp /main/4 1998/02/10 13:44:07 kaleb $ +// $Xorg: hp,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/keycodes/ibm diff -u xc/programs/xkbcomp/keycodes/ibm:1.1.1.4 xc/programs/xkbcomp/keycodes/ibm:1.1.1.5 --- xc/programs/xkbcomp/keycodes/ibm:1.1.1.4 Sun Sep 27 04:56:03 1998 +++ xc/programs/xkbcomp/keycodes/ibm Tue Jan 16 17:58:31 2001 @@ -1,4 +1,4 @@ -// $TOG: ibm /main/6 1998/02/10 13:44:11 kaleb $ +// $Xorg: ibm,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/keycodes/sony diff -u xc/programs/xkbcomp/keycodes/sony:1.1.1.2 xc/programs/xkbcomp/keycodes/sony:1.1.1.3 --- xc/programs/xkbcomp/keycodes/sony:1.1.1.2 Sun Sep 27 04:56:04 1998 +++ xc/programs/xkbcomp/keycodes/sony Tue Jan 16 17:58:33 2001 @@ -1,4 +1,4 @@ -// $TOG: sony /main/2 1998/02/10 13:44:15 kaleb $ +// $Xorg: sony,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/keycodes/sun diff -u xc/programs/xkbcomp/keycodes/sun:3.3 xc/programs/xkbcomp/keycodes/sun:3.4 --- xc/programs/xkbcomp/keycodes/sun:3.3 Sun Dec 20 06:58:23 1998 +++ xc/programs/xkbcomp/keycodes/sun Wed Jan 17 18:45:51 2001 @@ -1,4 +1,4 @@ -// $TOG: sun /main/12 1998/02/10 13:44:20 kaleb $ +// $Xorg: sun,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // @@ -20,7 +20,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keycodes/sun,v 3.3 1998/12/20 11:58:23 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keycodes/sun,v 3.4 2001/01/17 23:45:51 dawes Exp $ // default xkb_keycodes "type4" { Index: xc/programs/xkbcomp/keycodes/xfree86 diff -u xc/programs/xkbcomp/keycodes/xfree86:3.14 xc/programs/xkbcomp/keycodes/xfree86:3.16 --- xc/programs/xkbcomp/keycodes/xfree86:3.14 Mon Aug 14 13:47:08 2000 +++ xc/programs/xkbcomp/keycodes/xfree86 Thu Mar 8 16:25:15 2001 @@ -1,7 +1,21 @@ -// $TOG: xfree86 /main/5 1997/08/02 10:11:05 kaleb $ -// $XFree86: xc/programs/xkbcomp/keycodes/xfree86,v 3.14 2000/08/14 17:47:08 dawes Exp $ +// $Xorg: xfree86,v 1.3 2000/08/17 19:54:37 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/keycodes/xfree86,v 3.16 2001/03/08 21:25:15 dawes Exp $ + +// "standard" XFree86 codes +// It seems that the "default" must be the first entry in the file. + default xkb_keycodes "xfree86" { + include "xfree86(basic)" + <BKSL> = 51; + <LSGT> = 94; +}; +xkb_keycodes "basic" { + minimum= 8; maximum= 255; @@ -60,8 +74,6 @@ <AB09> = 60; <AB10> = 61; <RTSH> = 62; - <BKSL> = 51; - <LSGT> = 94; <LALT> = 64; <LCTL> = 37; @@ -134,16 +146,28 @@ <FK17> = 122; <KPDC> = 123; + // Keys that are generated on Japanese keyboards + + alias <HZTG> = <TLDE>; // Hankaku_Zenkaku toggle + alias <HKTG> = <FK15>; // Hiragana_Katakana toggle + alias <AB11> = <KPDC>; // backslash/underscore + <XFER> = 129; // Henkan + <NFER> = 131; // Muhenkan + <AE13> = 133; // Yen + + // Keys that are generated on Japanese and Brazillian keyboards + alias <AC12> = <BKSL>; + // Extended keys that may be generated on "Internet" keyboards. // These are not standardised, hence the meaningless names. // The entries commented out are never generated because the raw codes // in those positions are already used for well-defined keys. - <I01> = 129; + alias <XFER> = <I01>; <I02> = 130; - <I03> = 131; + alias <NFER> = <I03>; <I04> = 132; - <I05> = 133; + alias <AE13> = <I05>; <I06> = 134; <I07> = 135; <I08> = 136; @@ -267,6 +291,16 @@ <I7E> = 254; <I7F> = 255; + // Other codes never generated. The XFree86 ddx never generates + // these codes. + + // <U5D> = 93; + // <U7C> = 124; + // <U7D> = 125; + // <U7E> = 126; + // <U7F> = 127; + // <U80> = 128; + indicator 1 = "Caps Lock"; indicator 2 = "Num Lock"; indicator 3 = "Scroll Lock"; @@ -274,91 +308,17 @@ alias <ALGR> = <RALT>; }; -xkb_keycodes "102" { +// What keyboard is this? - minimum= 8; - maximum= 135; - - <TLDE> = 49; - <AE01> = 10; - <AE02> = 11; - <AE03> = 12; - <AE04> = 13; - <AE05> = 14; - <AE06> = 15; - <AE07> = 16; - <AE08> = 17; - <AE09> = 18; - <AE10> = 19; - <AE11> = 20; - <AE12> = 21; - <BKSP> = 22; - - <TAB> = 23; - <AD01> = 24; - <AD02> = 25; - <AD03> = 26; - <AD04> = 27; - <AD05> = 28; - <AD06> = 29; - <AD07> = 30; - <AD08> = 31; - <AD09> = 32; - <AD10> = 33; - <AD11> = 34; - <AD12> = 35; - <BKSL> = 51; - - <CAPS> = 66; - <AC01> = 38; - <AC02> = 39; - <AC03> = 40; - <AC04> = 41; - <AC05> = 42; - <AC06> = 43; - <AC07> = 44; - <AC08> = 45; - <AC09> = 46; - <AC10> = 47; - <AC11> = 48; - <RTRN> = 36; +xkb_keycodes "102" { + include "xfree86(xfree86)" - <LFSH> = 50; - <LSGT> = 94; - <AB01> = 52; - <AB02> = 53; - <AB03> = 54; - <AB04> = 55; - <AB05> = 56; - <AB06> = 57; - <AB07> = 58; - <AB08> = 59; - <AB09> = 60; - <AB10> = 61; - <RTSH> = 62; + // There will be warnings from xkbcomp because of multiple definitions. - <LCTL> = 37; - <LALT> = 64; - <SPCE> = 65; <RALT> = 122; <RCTL> = 123; - <ESC> = 9; - <FK01> = 67; - <FK02> = 68; - <FK03> = 69; - <FK04> = 70; - <FK05> = 71; - <FK06> = 72; - <FK07> = 73; - <FK08> = 74; - <FK09> = 75; - <FK10> = 76; - <FK11> = 95; - <FK12> = 96; - <PRSC> = 121; - <SCLK> = 78; <PAUS> = 118; <INS> = 131; @@ -373,297 +333,25 @@ <DOWN> = 120; <RGHT> = 133; - <NMLK> = 77; <KPDV> = 125; - <KPMU> = 63; - <KPSU> = 82; - <KP7> = 79; - <KP8> = 80; - <KP9> = 81; - <KPAD> = 86; - - <KP4> = 83; - <KP5> = 84; - <KP6> = 85; - - <KP1> = 87; - <KP2> = 88; - <KP3> = 89; <KPEN> = 124; - - <KP0> = 90; - <KPDL> = 91; - - indicator 1 = "Caps Lock"; - indicator 2 = "Num Lock"; - indicator 3 = "Scroll Lock"; - - alias <ALGR> = <RALT>; }; // For japanese 106 keyboard. by tsuka(tsuka@kawalab.dnj.ynu.ac.jp) +// +// All of the keycodes here are now in the basic "xfree86" set. +// xkb_keycodes "jp106" { - - minimum= 8; - maximum= 134; - - <HZTG> = 49; // Hankaku_Zenkaku toggle - <AE01> = 10; - <AE02> = 11; - <AE03> = 12; - <AE04> = 13; - <AE05> = 14; - <AE06> = 15; - <AE07> = 16; - <AE08> = 17; - <AE09> = 18; - <AE10> = 19; - <AE11> = 20; - <AE12> = 21; - <AE13> = 133; - <BKSP> = 22; - - <TAB> = 23; - <AD01> = 24; - <AD02> = 25; - <AD03> = 26; - <AD04> = 27; - <AD05> = 28; - <AD06> = 29; - <AD07> = 30; - <AD08> = 31; - <AD09> = 32; - <AD10> = 33; - <AD11> = 34; - <AD12> = 35; - <RTRN> = 36; - - <CAPS> = 66; - <AC01> = 38; - <AC02> = 39; - <AC03> = 40; - <AC04> = 41; - <AC05> = 42; - <AC06> = 43; - <AC07> = 44; - <AC08> = 45; - <AC09> = 46; - <AC10> = 47; - <AC11> = 48; - <AC12> = 51; - - <LFSH> = 50; - <AB01> = 52; - <AB02> = 53; - <AB03> = 54; - <AB04> = 55; - <AB05> = 56; - <AB06> = 57; - <AB07> = 58; - <AB08> = 59; - <AB09> = 60; - <AB10> = 61; - <AB11> = 123; - <RTSH> = 62; - - <LALT> = 64; - <NFER> = 131; //Muhenkan - <LCTL> = 37; - <SPCE> = 65; - <XFER> = 129; //Henkan - <HKTG> = 120; //Hiragana_Katakana toggle - <RCTL> = 109; - <RALT> = 113; - - <ESC> = 9; - <FK01> = 67; - <FK02> = 68; - <FK03> = 69; - <FK04> = 70; - <FK05> = 71; - <FK06> = 72; - <FK07> = 73; - <FK08> = 74; - <FK09> = 75; - <FK10> = 76; - <FK11> = 95; - <FK12> = 96; - - <PRSC> = 111; - <SCLK> = 78; - <PAUS> = 110; - - <INS> = 106; - <HOME> = 97; - <PGUP> = 99; - <DELE> = 107; - <END> = 103; - <PGDN> = 105; - - <UP> = 98; - <LEFT> = 100; - <DOWN> = 104; - <RGHT> = 102; - - <NMLK> = 77; - <KPDV> = 112; - <KPMU> = 63; - <KPSU> = 82; - - <KP7> = 79; - <KP8> = 80; - <KP9> = 81; - <KPAD> = 86; - - <KP4> = 83; - <KP5> = 84; - <KP6> = 85; - - <KP1> = 87; - <KP2> = 88; - <KP3> = 89; - <KPEN> = 108; - - <KP0> = 90; - <KPDL> = 91; - - indicator 1 = "Caps Lock"; - indicator 2 = "Num Lock"; - indicator 3 = "Scroll Lock"; + include "xfree86(xfree86)" }; // For brazilian ABNT2 keyboard. by Ricardo Y. Igarashi(iga@that.com.br) xkb_keycodes "abnt2" { - - minimum= 8; - maximum= 136; - - <TLDE> = 49; - <AE01> = 10; - <AE02> = 11; - <AE03> = 12; - <AE04> = 13; - <AE05> = 14; - <AE06> = 15; - <AE07> = 16; - <AE08> = 17; - <AE09> = 18; - <AE10> = 19; - <AE11> = 20; - <AE12> = 21; - <BKSP> = 22; - - <TAB> = 23; - <AD01> = 24; - <AD02> = 25; - <AD03> = 26; - <AD04> = 27; - <AD05> = 28; - <AD06> = 29; - <AD07> = 30; - <AD08> = 31; - <AD09> = 32; - <AD10> = 33; - <AD11> = 34; - <AD12> = 35; - - <CAPS> = 66; - <AC01> = 38; - <AC02> = 39; - <AC03> = 40; - <AC04> = 41; - <AC05> = 42; - <AC06> = 43; - <AC07> = 44; - <AC08> = 45; - <AC09> = 46; - <AC10> = 47; - <AC11> = 48; - <AC12> = 51; - <RTRN> = 36; - - <LFSH> = 50; - <BKSL> = 94; - <AB01> = 52; - <AB02> = 53; - <AB03> = 54; - <AB04> = 55; - <AB05> = 56; - <AB06> = 57; - <AB07> = 58; - <AB08> = 59; - <AB09> = 60; - <AB10> = 61; - <AB11> = 123; - <RTSH> = 62; - - <LCTL> = 37; - <LALT> = 64; - <SPCE> = 65; - <RALT> = 113; - <RCTL> = 109; - - <ESC> = 9; - <FK01> = 67; - <FK02> = 68; - <FK03> = 69; - <FK04> = 70; - <FK05> = 71; - <FK06> = 72; - <FK07> = 73; - <FK08> = 74; - <FK09> = 75; - <FK10> = 76; - <FK11> = 95; - <FK12> = 96; - - <PRSC> = 111; - <SCLK> = 78; - <PAUS> = 110; - - <INS> = 106; - <HOME> = 97; - <PGUP> = 99; - <DELE> = 107; - <END> = 103; - <PGDN> = 105; - - <UP> = 98; - <LEFT> = 100; - <DOWN> = 104; - <RGHT> = 102; - - <NMLK> = 77; - <KPDV> = 112; - <KPMU> = 63; - <KPSU> = 82; - - <KP7> = 79; - <KP8> = 80; - <KP9> = 81; - <KPAD> = 86; - - <KP4> = 83; - <KP5> = 84; - <KP6> = 85; - <KPPT> = 134; - - <KP1> = 87; - <KP2> = 88; - <KP3> = 89; - <KPEN> = 108; - - <KP0> = 90; - <KPDL> = 91; - - indicator 1 = "Caps Lock"; - indicator 2 = "Num Lock"; - indicator 3 = "Scroll Lock"; - - alias <ALGR> = <RALT>; + include "xfree86(basic)" + <BKSL> = 94; }; Index: xc/programs/xkbcomp/keycodes/xfree98 diff -u xc/programs/xkbcomp/keycodes/xfree98:3.5 xc/programs/xkbcomp/keycodes/xfree98:3.6 --- xc/programs/xkbcomp/keycodes/xfree98:3.5 Sun Dec 13 07:23:41 1998 +++ xc/programs/xkbcomp/keycodes/xfree98 Wed Jan 17 18:45:51 2001 @@ -1,4 +1,4 @@ -// $TOG: xfree98 /main/4 1998/02/10 13:44:24 kaleb $ +// $Xorg: xfree98,v 1.3 2000/08/17 19:54:38 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // @@ -20,7 +20,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keycodes/xfree98,v 3.5 1998/12/13 12:23:41 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keycodes/xfree98,v 3.6 2001/01/17 23:45:51 dawes Exp $ // default xkb_keycodes "pc98" { Index: xc/programs/xkbcomp/keycodes/digital/Imakefile diff -u xc/programs/xkbcomp/keycodes/digital/Imakefile:1.1.1.1 xc/programs/xkbcomp/keycodes/digital/Imakefile:1.1.1.2 --- xc/programs/xkbcomp/keycodes/digital/Imakefile:1.1.1.1 Wed Jan 24 06:15:46 1996 +++ xc/programs/xkbcomp/keycodes/digital/Imakefile Tue Jan 16 17:58:40 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/1 1996/01/22 18:12:23 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:38 cpqbld Exp $ #undef lk #undef pc Index: xc/programs/xkbcomp/keycodes/digital/lk diff -u xc/programs/xkbcomp/keycodes/digital/lk:3.1 xc/programs/xkbcomp/keycodes/digital/lk:3.2 --- xc/programs/xkbcomp/keycodes/digital/lk:3.1 Mon Dec 23 02:12:28 1996 +++ xc/programs/xkbcomp/keycodes/digital/lk Wed Jan 17 18:45:52 2001 @@ -1,4 +1,4 @@ -// $XConsortium: lk /main/4 1996/08/31 12:17:02 kaleb $ +// $Xorg: lk,v 1.3 2000/08/17 19:54:38 cpqbld Exp $ // //Copyright (c) 1996 Digital Equipment Corporation // Index: xc/programs/xkbcomp/keycodes/digital/pc diff -u xc/programs/xkbcomp/keycodes/digital/pc:3.1 xc/programs/xkbcomp/keycodes/digital/pc:3.2 --- xc/programs/xkbcomp/keycodes/digital/pc:3.1 Mon Dec 23 02:12:29 1996 +++ xc/programs/xkbcomp/keycodes/digital/pc Wed Jan 17 18:45:52 2001 @@ -1,4 +1,4 @@ -// $XConsortium: pc /main/4 1996/08/31 12:17:05 kaleb $ +// $Xorg: pc,v 1.3 2000/08/17 19:54:38 cpqbld Exp $ // //Copyright (c) 1996 Digital Equipment Corporation // Index: xc/programs/xkbcomp/keycodes/sgi/Imakefile diff -u xc/programs/xkbcomp/keycodes/sgi/Imakefile:3.1 xc/programs/xkbcomp/keycodes/sgi/Imakefile:3.2 --- xc/programs/xkbcomp/keycodes/sgi/Imakefile:3.1 Fri Dec 27 02:08:11 1996 +++ xc/programs/xkbcomp/keycodes/sgi/Imakefile Wed Jan 17 18:45:52 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/1 1996/08/31 12:17:09 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:39 cpqbld Exp $ #undef indy #undef indigo Index: xc/programs/xkbcomp/keycodes/sgi/indigo diff -u xc/programs/xkbcomp/keycodes/sgi/indigo:3.1 xc/programs/xkbcomp/keycodes/sgi/indigo:3.2 --- xc/programs/xkbcomp/keycodes/sgi/indigo:3.1 Fri Dec 27 02:08:11 1996 +++ xc/programs/xkbcomp/keycodes/sgi/indigo Wed Jan 17 18:45:52 2001 @@ -1,4 +1,4 @@ -// $XConsortium: indigo /main/1 1996/08/31 12:17:12 kaleb $ +// $Xorg: indigo,v 1.3 2000/08/17 19:54:39 cpqbld Exp $ default xkb_keycodes "pc101" { minimum= 10; maximum= 118; Index: xc/programs/xkbcomp/keycodes/sgi/indy diff -u xc/programs/xkbcomp/keycodes/sgi/indy:3.2 xc/programs/xkbcomp/keycodes/sgi/indy:3.3 --- xc/programs/xkbcomp/keycodes/sgi/indy:3.2 Sun Jun 22 06:17:08 1997 +++ xc/programs/xkbcomp/keycodes/sgi/indy Wed Jan 17 18:45:52 2001 @@ -1,4 +1,4 @@ -// $TOG: indy /main/3 1997/06/13 05:59:09 kaleb $ +// $Xorg: indy,v 1.3 2000/08/17 19:54:39 cpqbld Exp $ default xkb_keycodes "universal" { minimum= 15; maximum= 149; Index: xc/programs/xkbcomp/keycodes/sgi/iris diff -u xc/programs/xkbcomp/keycodes/sgi/iris:3.1 xc/programs/xkbcomp/keycodes/sgi/iris:3.2 --- xc/programs/xkbcomp/keycodes/sgi/iris:3.1 Fri Dec 27 02:08:13 1996 +++ xc/programs/xkbcomp/keycodes/sgi/iris Wed Jan 17 18:45:52 2001 @@ -1,4 +1,4 @@ -// $XConsortium: iris /main/1 1996/09/13 16:54:19 kaleb $ +// $Xorg: iris,v 1.3 2000/08/17 19:54:39 cpqbld Exp $ default xkb_keycodes "iris" { include "sgi/indigo(pc101)" indicator 1 = "L1"; Index: xc/programs/xkbcomp/keymap/Imakefile diff -u xc/programs/xkbcomp/keymap/Imakefile:3.7 xc/programs/xkbcomp/keymap/Imakefile:3.9 --- xc/programs/xkbcomp/keymap/Imakefile:3.7 Sun May 23 01:27:51 1999 +++ xc/programs/xkbcomp/keymap/Imakefile Sun Jan 21 16:19:40 2001 @@ -1,5 +1,10 @@ -XCOMM $TOG: Imakefile /main/11 1997/08/02 10:11:09 kaleb $ -XCOMM $XFree86: xc/programs/xkbcomp/keymap/Imakefile,v 3.7 1999/05/23 05:27:51 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xkbcomp/keymap/Imakefile,v 3.9 2001/01/21 21:19:40 tsi Exp $ + #define IHaveSubdirs DATAFILES = amiga ataritt macintosh sony xfree86 xfree98 @@ -9,4 +14,4 @@ MakeXkbDir($(LIBDIR)/xkb,keymap) InstallMultiple($(DATAFILES),$(LIBDIR)/xkb/keymap) -DependTarget() +DependSubdirs($(SUBDIRS)) Index: xc/programs/xkbcomp/keymap/amiga diff -u xc/programs/xkbcomp/keymap/amiga:3.2 xc/programs/xkbcomp/keymap/amiga:3.3 --- xc/programs/xkbcomp/keymap/amiga:3.2 Sun Oct 26 08:25:36 1997 +++ xc/programs/xkbcomp/keymap/amiga Wed Jan 17 18:45:53 2001 @@ -1,8 +1,10 @@ -// $TOG: amiga /main/1 1997/08/02 10:11:13 kaleb $ +// $Xorg: amiga,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ -// $XFree86: xc/programs/xkbcomp/keymap/amiga,v 3.2 1997/10/26 13:25:36 dawes Exp $ + +// $XFree86: xc/programs/xkbcomp/keymap/amiga,v 3.3 2001/01/17 23:45:53 dawes Exp $ + default xkb_keymap "usa1" { xkb_keycodes { include "amiga(usa1)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/ataritt diff -u xc/programs/xkbcomp/keymap/ataritt:3.1 xc/programs/xkbcomp/keymap/ataritt:3.2 --- xc/programs/xkbcomp/keymap/ataritt:3.1 Sun Oct 26 08:25:37 1997 +++ xc/programs/xkbcomp/keymap/ataritt Wed Jan 17 18:45:53 2001 @@ -1,8 +1,10 @@ -// $TOG: ataritt /main/1 1997/08/02 10:11:17 kaleb $ +// $Xorg: ataritt,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ -// $XFree86: xc/programs/xkbcomp/keymap/ataritt,v 3.1 1997/10/26 13:25:37 dawes Exp $ + +// $XFree86: xc/programs/xkbcomp/keymap/ataritt,v 3.2 2001/01/17 23:45:53 dawes Exp $ + default xkb_keymap "us" { xkb_keycodes { include "ataritt(us)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/macintosh diff -u xc/programs/xkbcomp/keymap/macintosh:1.1 xc/programs/xkbcomp/keymap/macintosh:1.2 --- xc/programs/xkbcomp/keymap/macintosh:1.1 Sun May 23 01:27:51 1999 +++ xc/programs/xkbcomp/keymap/macintosh Mon Mar 5 15:18:25 2001 @@ -1,6 +1,14 @@ // $XConsortium: macintosh /main/11 1996/03/07 13:42:13 kaleb $ -// $XFree86: xc/programs/xkbcomp/keymap/macintosh,v 1.1 1999/05/23 05:27:51 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keymap/macintosh,v 1.2 2001/03/05 20:18:25 dawes Exp $ default xkb_keymap "macintosh" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "macintosh/us(extended)" }; + xkb_geometry { include "macintosh" }; +}; + +xkb_keymap "macintosh_old" { xkb_keycodes { include "macintosh" }; xkb_types { include "default" }; xkb_compatibility { include "default" }; Index: xc/programs/xkbcomp/keymap/sony diff -u xc/programs/xkbcomp/keymap/sony:3.2 xc/programs/xkbcomp/keymap/sony:3.3 --- xc/programs/xkbcomp/keymap/sony:3.2 Sun Oct 4 05:41:33 1998 +++ xc/programs/xkbcomp/keymap/sony Wed Jan 17 18:45:53 2001 @@ -1,4 +1,4 @@ -// $TOG: sony /main/3 1998/02/10 13:44:28 kaleb $ +// $Xorg: sony,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/keymap/xfree86 diff -u xc/programs/xkbcomp/keymap/xfree86:3.17 xc/programs/xkbcomp/keymap/xfree86:3.20.2.2 --- xc/programs/xkbcomp/keymap/xfree86:3.17 Wed Dec 6 15:18:07 2000 +++ xc/programs/xkbcomp/keymap/xfree86 Fri May 25 14:50:14 2001 @@ -1,5 +1,10 @@ -// $TOG: xfree86 /main/13 1997/08/02 10:11:21 kaleb $ -// $XFree86: xc/programs/xkbcomp/keymap/xfree86,v 3.17 2000/12/06 20:18:07 eich Exp $ +// $Xorg: xfree86,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/keymap/xfree86,v 3.20.2.2 2001/05/25 18:50:14 dawes Exp $ + default xkb_keymap "us" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -42,20 +47,6 @@ xkb_symbols { include "en_US(pc105)+bg" }; xkb_geometry { include "pc(pc102)" }; }; -xkb_keymap "cs" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+cs" }; - xkb_geometry { include "pc(pc102)" }; -}; -xkb_keymap "cs_qwerty" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+cs_qwerty" }; - xkb_geometry { include "pc(pc102)" }; -}; xkb_keymap "de" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -70,6 +61,13 @@ xkb_symbols { include "en_US(pc105)+dk" }; xkb_geometry { include "pc(pc102)" }; }; +xkb_keymap "dvorak" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+dvorak" }; + xkb_geometry { include "pc(pc102)" }; +}; xkb_keymap "es" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -98,6 +96,13 @@ xkb_symbols { include "en_US(pc105)+gb" }; xkb_geometry { include "pc(pc102)" }; }; +xkb_keymap "hr" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+hr" }; + xkb_geometry { include "pc(pc102)" }; +}; xkb_keymap "it" { xkb_keycodes { include "xfree86" }; xkb_types { include "default" }; @@ -126,12 +131,19 @@ xkb_symbols { include "en_US(pc105)+lt_p" }; xkb_geometry { include "pc(pc102)" }; }; +xkb_keymap "lv" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+lv" }; + xkb_geometry { include "pc(pc102)" }; +}; xkb_keymap "mk" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+mk" }; - xkb_geometry { include "pc(pc102)" }; + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+mk" }; + xkb_geometry { include "pc(pc102)" }; }; xkb_keymap "no" { xkb_keycodes { include "xfree86" }; @@ -242,126 +254,72 @@ xkb_geometry { include "pc(abnt2)" }; }; -xkb_keymap "us_cz_qwerty" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "group_led" }; - xkb_symbols { include "czsk(us_cz_qwerty)" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "us_cz_qwertz" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "group_led" }; - xkb_symbols { include "czsk(us_cz_qwertz)" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "us_cz_prog" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "group_led" }; - xkb_symbols { include "czsk(us_cz_prog)" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "cz_us_qwerty" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "group_led" }; - xkb_symbols { include "czsk(cz_us_qwerty)" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "cz_us_qwertz" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "group_led" }; - xkb_symbols { include "czsk(cz_us_qwertz)" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "cz_us_prog" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "group_led" }; - xkb_symbols { include "czsk(cz_us_prog)" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "us_sk_qwerty" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "group_led" }; - xkb_symbols { include "czsk(us_sk_qwerty)" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "us_sk_qwertz" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "group_led" }; - xkb_symbols { include "czsk(us_sk_qwertz)" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "us_sk_prog" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "group_led" }; - xkb_symbols { include "czsk(us_sk_prog)" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "sk_us_qwerty" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "group_led" }; - xkb_symbols { include "czsk(sk_us_qwerty)" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "sk_us_qwertz" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "group_led" }; - xkb_symbols { include "czsk(sk_us_qwertz)" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "sk_us_prog" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "group_led" }; - xkb_symbols { include "czsk(sk_us_prog)" }; - xkb_geometry { include "pc" }; -}; -xkb_keymap "sl" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+si" }; - xkb_geometry { include "pc(pc102)" }; -}; -xkb_keymap "sl_SI" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+si" }; - xkb_geometry { include "pc(pc102)" }; +// cz and sk keymaps by Kamil Toman (ktoman@email.cz) +// are designed to replace old czechoslovakian and czsk keyboards +// and their prog variants. Those are now obsolete and should not be used anymore. +xkb_keymap "cz" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+cz" }; + xkb_geometry { include "pc" }; +}; +xkb_keymap "cz_qwerty" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+cz_qwerty" }; + xkb_geometry { include "pc" }; +}; +xkb_keymap "sk" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+sk" }; + xkb_geometry { include "pc" }; +}; +xkb_keymap "sk_qwerty" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+sk_qwerty" }; + xkb_geometry { include "pc" }; +}; + +xkb_keymap "sl" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+si" }; + xkb_geometry { include "pc(pc102)" }; }; +xkb_keymap "sl_SI" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+si" }; + xkb_geometry { include "pc(pc102)" }; +}; // Additions by Cristian Gafton, <gafton@redhat.com> -xkb_keymap "ro" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc101)+ro(pc101)" - }; - xkb_geometry { include "pc(pc101)" }; -}; -xkb_keymap "ro_microsoft" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+ro(pc105)" - }; - xkb_geometry { include "pc(pc105)" }; -}; -xkb_keymap "tr" { - xkb_keycodes { include "xfree86" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "en_US(pc105)+tr" }; - xkb_geometry { include "pc(pc102)" }; +xkb_keymap "ro" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc101)+ro(pc101)" }; + xkb_geometry { include "pc(pc101)" }; +}; +xkb_keymap "ro_microsoft" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+ro(pc105)" }; + xkb_geometry { include "pc(pc105)" }; +}; +xkb_keymap "tr" { + xkb_keycodes { include "xfree86" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "en_US(pc105)+tr" }; + xkb_geometry { include "pc(pc102)" }; }; Index: xc/programs/xkbcomp/keymap/xfree98 diff -u xc/programs/xkbcomp/keymap/xfree98:3.5 xc/programs/xkbcomp/keymap/xfree98:3.6 --- xc/programs/xkbcomp/keymap/xfree98:3.5 Sun Oct 4 05:41:34 1998 +++ xc/programs/xkbcomp/keymap/xfree98 Wed Jan 17 18:45:53 2001 @@ -1,4 +1,4 @@ -// $TOG: xfree98 /main/2 1998/02/10 13:44:32 kaleb $ +// $Xorg: xfree98,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // @@ -20,7 +20,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/keymap/xfree98,v 3.5 1998/10/04 09:41:34 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/keymap/xfree98,v 3.6 2001/01/17 23:45:53 dawes Exp $ default xkb_keymap "jp" { xkb_keycodes { include "xfree98" }; Index: xc/programs/xkbcomp/keymap/digital/Imakefile diff -u xc/programs/xkbcomp/keymap/digital/Imakefile:1.1.1.1 xc/programs/xkbcomp/keymap/digital/Imakefile:1.1.1.2 --- xc/programs/xkbcomp/keymap/digital/Imakefile:1.1.1.1 Sun Feb 4 02:40:37 1996 +++ xc/programs/xkbcomp/keymap/digital/Imakefile Tue Jan 16 17:56:33 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/1 1996/02/02 14:21:11 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ DATAFILES = us Index: xc/programs/xkbcomp/keymap/digital/us diff -u xc/programs/xkbcomp/keymap/digital/us:3.2 xc/programs/xkbcomp/keymap/digital/us:3.3 --- xc/programs/xkbcomp/keymap/digital/us:3.2 Mon Dec 23 02:12:45 1996 +++ xc/programs/xkbcomp/keymap/digital/us Wed Jan 17 18:45:53 2001 @@ -1,4 +1,4 @@ -// $XConsortium: us /main/2 1996/08/31 12:17:33 kaleb $ +// $Xorg: us,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ // //Copyright (c) 1996 Digital Equipment Corporation // Index: xc/programs/xkbcomp/keymap/sgi/Imakefile diff -u xc/programs/xkbcomp/keymap/sgi/Imakefile:3.2 xc/programs/xkbcomp/keymap/sgi/Imakefile:3.5 --- xc/programs/xkbcomp/keymap/sgi/Imakefile:3.2 Sun Jun 22 06:17:08 1997 +++ xc/programs/xkbcomp/keymap/sgi/Imakefile Fri May 18 22:05:55 2001 @@ -1,7 +1,13 @@ -XCOMM $TOG: Imakefile /main/3 1997/06/10 06:54:46 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ - DATAFILES = be bg ca cs de de_CH dk dvorak en_US es fi fr fr_CH \ - gb hu it jp no pl pt ru se th us + + + + +XCOMM $XFree86: xc/programs/xkbcomp/keymap/sgi/Imakefile,v 3.5 2001/05/19 02:05:55 dawes Exp $ + + DATAFILES = be bg ca cz cz_qwerty de de_CH dk dvorak en_US es fi fr fr_CH \ + gb hu it jp no pl pt ru se sk sk_qwerty th us all:: Index: xc/programs/xkbcomp/keymap/sgi/be diff -u xc/programs/xkbcomp/keymap/sgi/be:3.2 xc/programs/xkbcomp/keymap/sgi/be:3.3 --- xc/programs/xkbcomp/keymap/sgi/be:3.2 Sun Jun 22 06:17:09 1997 +++ xc/programs/xkbcomp/keymap/sgi/be Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: be /main/4 1997/06/14 06:35:56 kaleb $ +// $Xorg: be,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/bg diff -u xc/programs/xkbcomp/keymap/sgi/bg:3.2 xc/programs/xkbcomp/keymap/sgi/bg:3.3 --- xc/programs/xkbcomp/keymap/sgi/bg:3.2 Sun Jun 22 06:17:09 1997 +++ xc/programs/xkbcomp/keymap/sgi/bg Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: bg /main/3 1997/06/14 06:35:58 kaleb $ +// $Xorg: bg,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/ca diff -u xc/programs/xkbcomp/keymap/sgi/ca:3.2 xc/programs/xkbcomp/keymap/sgi/ca:3.3 --- xc/programs/xkbcomp/keymap/sgi/ca:3.2 Sun Jun 22 06:17:09 1997 +++ xc/programs/xkbcomp/keymap/sgi/ca Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: ca /main/3 1997/06/14 06:36:02 kaleb $ +// $Xorg: ca,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/cs diff -u xc/programs/xkbcomp/keymap/sgi/cs:3.2 xc/programs/xkbcomp/keymap/sgi/cs:removed --- xc/programs/xkbcomp/keymap/sgi/cs:3.2 Sun Jun 22 06:17:09 1997 +++ xc/programs/xkbcomp/keymap/sgi/cs Mon Jun 4 12:42:57 2001 @@ -1,16 +0,0 @@ -// $TOG: cs /main/3 1997/06/14 06:36:05 kaleb $ -default xkb_keymap "indy" { - xkb_keycodes { include "sgi/indy(universal)" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "us(pc_universal)+cs" }; - xkb_geometry { include "sgi/indy(pc102)" }; -}; -xkb_keymap "indigo" { - xkb_keycodes { include "sgi/indigo(pc102)" }; - xkb_types { include "default" }; - xkb_compatibility { include "default" }; - xkb_symbols { include "us(pc102)+cs" }; - xkb_geometry { include "sgi/indigo(pc102)" }; -}; - Index: xc/programs/xkbcomp/keymap/sgi/cz diff -u /dev/null xc/programs/xkbcomp/keymap/sgi/cz:1.2 --- /dev/null Mon Jun 4 12:42:57 2001 +++ xc/programs/xkbcomp/keymap/sgi/cz Fri May 18 22:05:55 2001 @@ -0,0 +1,21 @@ +// $Xorg: cs,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ +// +// +// +// $XFree86: xc/programs/xkbcomp/keymap/sgi/cz,v 1.2 2001/05/19 02:05:55 dawes Exp $ + +default xkb_keymap "indy" { + xkb_keycodes { include "sgi/indy(universal)" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "us(pc_universal)+cz" }; + xkb_geometry { include "sgi/indy(pc102)" }; +}; +xkb_keymap "indigo" { + xkb_keycodes { include "sgi/indigo(pc102)" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "us(pc102)+cz" }; + xkb_geometry { include "sgi/indigo(pc102)" }; +}; + Index: xc/programs/xkbcomp/keymap/sgi/cz_qwerty diff -u /dev/null xc/programs/xkbcomp/keymap/sgi/cz_qwerty:1.2 --- /dev/null Mon Jun 4 12:42:57 2001 +++ xc/programs/xkbcomp/keymap/sgi/cz_qwerty Fri May 18 22:05:55 2001 @@ -0,0 +1,21 @@ +// $Xorg: cs,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ +// +// +// +// $XFree86: xc/programs/xkbcomp/keymap/sgi/cz_qwerty,v 1.2 2001/05/19 02:05:55 dawes Exp $ + +default xkb_keymap "indy" { + xkb_keycodes { include "sgi/indy(universal)" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "us(pc_universal)+cz_qwerty" }; + xkb_geometry { include "sgi/indy(pc102)" }; +}; +xkb_keymap "indigo" { + xkb_keycodes { include "sgi/indigo(pc102)" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "us(pc102)+cz_qwerty" }; + xkb_geometry { include "sgi/indigo(pc102)" }; +}; + Index: xc/programs/xkbcomp/keymap/sgi/de diff -u xc/programs/xkbcomp/keymap/sgi/de:3.2 xc/programs/xkbcomp/keymap/sgi/de:3.3 --- xc/programs/xkbcomp/keymap/sgi/de:3.2 Sun Jun 22 06:17:09 1997 +++ xc/programs/xkbcomp/keymap/sgi/de Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: de /main/4 1997/06/14 06:36:08 kaleb $ +// $Xorg: de,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/de_CH diff -u xc/programs/xkbcomp/keymap/sgi/de_CH:3.2 xc/programs/xkbcomp/keymap/sgi/de_CH:3.3 --- xc/programs/xkbcomp/keymap/sgi/de_CH:3.2 Sun Jun 22 06:17:10 1997 +++ xc/programs/xkbcomp/keymap/sgi/de_CH Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: de_CH /main/4 1997/06/14 06:36:10 kaleb $ +// $Xorg: de_CH,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/dk diff -u xc/programs/xkbcomp/keymap/sgi/dk:3.2 xc/programs/xkbcomp/keymap/sgi/dk:3.3 --- xc/programs/xkbcomp/keymap/sgi/dk:3.2 Sun Jun 22 06:17:10 1997 +++ xc/programs/xkbcomp/keymap/sgi/dk Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: dk /main/3 1997/06/14 06:36:13 kaleb $ +// $Xorg: dk,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/dvorak diff -u xc/programs/xkbcomp/keymap/sgi/dvorak:3.2 xc/programs/xkbcomp/keymap/sgi/dvorak:3.3 --- xc/programs/xkbcomp/keymap/sgi/dvorak:3.2 Sun Jun 22 06:17:10 1997 +++ xc/programs/xkbcomp/keymap/sgi/dvorak Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: dvorak /main/3 1997/06/14 06:36:16 kaleb $ +// $Xorg: dvorak,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/en_US diff -u xc/programs/xkbcomp/keymap/sgi/en_US:3.2 xc/programs/xkbcomp/keymap/sgi/en_US:3.3 --- xc/programs/xkbcomp/keymap/sgi/en_US:3.2 Sun Jun 22 06:17:10 1997 +++ xc/programs/xkbcomp/keymap/sgi/en_US Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: en_US /main/4 1997/06/14 06:36:18 kaleb $ +// $Xorg: en_US,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/es diff -u xc/programs/xkbcomp/keymap/sgi/es:3.2 xc/programs/xkbcomp/keymap/sgi/es:3.3 --- xc/programs/xkbcomp/keymap/sgi/es:3.2 Sun Jun 22 06:17:10 1997 +++ xc/programs/xkbcomp/keymap/sgi/es Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: es /main/3 1997/06/14 06:36:21 kaleb $ +// $Xorg: es,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/fi diff -u xc/programs/xkbcomp/keymap/sgi/fi:3.2 xc/programs/xkbcomp/keymap/sgi/fi:3.3 --- xc/programs/xkbcomp/keymap/sgi/fi:3.2 Sun Jun 22 06:17:11 1997 +++ xc/programs/xkbcomp/keymap/sgi/fi Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: fi /main/3 1997/06/14 06:36:24 kaleb $ +// $Xorg: fi,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/fr diff -u xc/programs/xkbcomp/keymap/sgi/fr:3.2 xc/programs/xkbcomp/keymap/sgi/fr:3.3 --- xc/programs/xkbcomp/keymap/sgi/fr:3.2 Sun Jun 22 06:17:11 1997 +++ xc/programs/xkbcomp/keymap/sgi/fr Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: fr /main/4 1997/06/14 06:36:26 kaleb $ +// $Xorg: fr,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/fr_CH diff -u xc/programs/xkbcomp/keymap/sgi/fr_CH:3.2 xc/programs/xkbcomp/keymap/sgi/fr_CH:3.3 --- xc/programs/xkbcomp/keymap/sgi/fr_CH:3.2 Sun Jun 22 06:17:11 1997 +++ xc/programs/xkbcomp/keymap/sgi/fr_CH Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: fr_CH /main/4 1997/06/14 06:36:29 kaleb $ +// $Xorg: fr_CH,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/gb diff -u xc/programs/xkbcomp/keymap/sgi/gb:3.2 xc/programs/xkbcomp/keymap/sgi/gb:3.3 --- xc/programs/xkbcomp/keymap/sgi/gb:3.2 Sun Jun 22 06:17:11 1997 +++ xc/programs/xkbcomp/keymap/sgi/gb Wed Jan 17 18:45:54 2001 @@ -1,4 +1,4 @@ -// $TOG: gb /main/3 1997/06/14 06:36:31 kaleb $ +// $Xorg: gb,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/hu diff -u xc/programs/xkbcomp/keymap/sgi/hu:1.1 xc/programs/xkbcomp/keymap/sgi/hu:1.2 --- xc/programs/xkbcomp/keymap/sgi/hu:1.1 Mon Jun 30 01:49:11 1997 +++ xc/programs/xkbcomp/keymap/sgi/hu Wed Jan 17 18:45:55 2001 @@ -1,4 +1,4 @@ -// $TOG: hu /main/2 1997/06/14 06:36:35 kaleb $ +// $Xorg: hu,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/it diff -u xc/programs/xkbcomp/keymap/sgi/it:3.2 xc/programs/xkbcomp/keymap/sgi/it:3.3 --- xc/programs/xkbcomp/keymap/sgi/it:3.2 Sun Jun 22 06:17:12 1997 +++ xc/programs/xkbcomp/keymap/sgi/it Wed Jan 17 18:45:55 2001 @@ -1,4 +1,4 @@ -// $TOG: it /main/3 1997/06/14 06:36:37 kaleb $ +// $Xorg: it,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/jp diff -u xc/programs/xkbcomp/keymap/sgi/jp:1.1 xc/programs/xkbcomp/keymap/sgi/jp:1.2 --- xc/programs/xkbcomp/keymap/sgi/jp:1.1 Mon Jun 30 01:49:12 1997 +++ xc/programs/xkbcomp/keymap/sgi/jp Wed Jan 17 18:45:55 2001 @@ -1,4 +1,4 @@ -// $TOG: jp /main/2 1997/06/14 06:36:40 kaleb $ +// $Xorg: jp,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(jp106)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/no diff -u xc/programs/xkbcomp/keymap/sgi/no:3.2 xc/programs/xkbcomp/keymap/sgi/no:3.3 --- xc/programs/xkbcomp/keymap/sgi/no:3.2 Sun Jun 22 06:17:12 1997 +++ xc/programs/xkbcomp/keymap/sgi/no Wed Jan 17 18:45:55 2001 @@ -1,4 +1,4 @@ -// $TOG: no /main/3 1997/06/14 06:36:42 kaleb $ +// $Xorg: no,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/pl diff -u xc/programs/xkbcomp/keymap/sgi/pl:3.2 xc/programs/xkbcomp/keymap/sgi/pl:3.3 --- xc/programs/xkbcomp/keymap/sgi/pl:3.2 Sun Jun 22 06:17:12 1997 +++ xc/programs/xkbcomp/keymap/sgi/pl Wed Jan 17 18:45:55 2001 @@ -1,4 +1,4 @@ -// $TOG: pl /main/3 1997/06/14 06:36:45 kaleb $ +// $Xorg: pl,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/pt diff -u xc/programs/xkbcomp/keymap/sgi/pt:3.2 xc/programs/xkbcomp/keymap/sgi/pt:3.3 --- xc/programs/xkbcomp/keymap/sgi/pt:3.2 Sun Jun 22 06:17:12 1997 +++ xc/programs/xkbcomp/keymap/sgi/pt Wed Jan 17 18:45:55 2001 @@ -1,4 +1,4 @@ -// $TOG: pt /main/3 1997/06/14 06:36:48 kaleb $ +// $Xorg: pt,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/ru diff -u xc/programs/xkbcomp/keymap/sgi/ru:3.2 xc/programs/xkbcomp/keymap/sgi/ru:3.3 --- xc/programs/xkbcomp/keymap/sgi/ru:3.2 Sun Jun 22 06:17:12 1997 +++ xc/programs/xkbcomp/keymap/sgi/ru Wed Jan 17 18:45:55 2001 @@ -1,4 +1,4 @@ -// $TOG: ru /main/3 1997/06/14 06:36:51 kaleb $ +// $Xorg: ru,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/se diff -u xc/programs/xkbcomp/keymap/sgi/se:3.2 xc/programs/xkbcomp/keymap/sgi/se:3.3 --- xc/programs/xkbcomp/keymap/sgi/se:3.2 Sun Jun 22 06:17:13 1997 +++ xc/programs/xkbcomp/keymap/sgi/se Wed Jan 17 18:45:55 2001 @@ -1,4 +1,4 @@ -// $TOG: se /main/4 1997/06/14 06:36:54 kaleb $ +// $Xorg: se,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/sk diff -u /dev/null xc/programs/xkbcomp/keymap/sgi/sk:1.2 --- /dev/null Mon Jun 4 12:42:57 2001 +++ xc/programs/xkbcomp/keymap/sgi/sk Fri May 18 22:05:55 2001 @@ -0,0 +1,21 @@ +// $Xorg: cs,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ +// +// +// +// $XFree86: xc/programs/xkbcomp/keymap/sgi/sk,v 1.2 2001/05/19 02:05:55 dawes Exp $ + +default xkb_keymap "indy" { + xkb_keycodes { include "sgi/indy(universal)" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "us(pc_universal)+sk" }; + xkb_geometry { include "sgi/indy(pc102)" }; +}; +xkb_keymap "indigo" { + xkb_keycodes { include "sgi/indigo(pc102)" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "us(pc102)+sk" }; + xkb_geometry { include "sgi/indigo(pc102)" }; +}; + Index: xc/programs/xkbcomp/keymap/sgi/sk_qwerty diff -u /dev/null xc/programs/xkbcomp/keymap/sgi/sk_qwerty:1.2 --- /dev/null Mon Jun 4 12:42:57 2001 +++ xc/programs/xkbcomp/keymap/sgi/sk_qwerty Fri May 18 22:05:55 2001 @@ -0,0 +1,21 @@ +// $Xorg: cs,v 1.3 2000/08/17 19:54:40 cpqbld Exp $ +// +// +// +// $XFree86: xc/programs/xkbcomp/keymap/sgi/sk_qwerty,v 1.2 2001/05/19 02:05:55 dawes Exp $ + +default xkb_keymap "indy" { + xkb_keycodes { include "sgi/indy(universal)" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "us(pc_universal)+sk_qwerty" }; + xkb_geometry { include "sgi/indy(pc102)" }; +}; +xkb_keymap "indigo" { + xkb_keycodes { include "sgi/indigo(pc102)" }; + xkb_types { include "default" }; + xkb_compatibility { include "default" }; + xkb_symbols { include "us(pc102)+sk_qwerty" }; + xkb_geometry { include "sgi/indigo(pc102)" }; +}; + Index: xc/programs/xkbcomp/keymap/sgi/th diff -u xc/programs/xkbcomp/keymap/sgi/th:3.2 xc/programs/xkbcomp/keymap/sgi/th:3.3 --- xc/programs/xkbcomp/keymap/sgi/th:3.2 Sun Jun 22 06:17:13 1997 +++ xc/programs/xkbcomp/keymap/sgi/th Wed Jan 17 18:45:55 2001 @@ -1,4 +1,4 @@ -// $TOG: th /main/4 1997/06/14 06:36:57 kaleb $ +// $Xorg: th,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sgi/us diff -u xc/programs/xkbcomp/keymap/sgi/us:3.2 xc/programs/xkbcomp/keymap/sgi/us:3.3 --- xc/programs/xkbcomp/keymap/sgi/us:3.2 Sun Jun 22 06:17:13 1997 +++ xc/programs/xkbcomp/keymap/sgi/us Wed Jan 17 18:45:55 2001 @@ -1,4 +1,4 @@ -// $TOG: us /main/5 1997/06/14 06:36:59 kaleb $ +// $Xorg: us,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ default xkb_keymap "indy" { xkb_keycodes { include "sgi/indy(universal)" }; xkb_types { include "default" }; Index: xc/programs/xkbcomp/keymap/sun/Imakefile diff -u xc/programs/xkbcomp/keymap/sun/Imakefile:3.4 xc/programs/xkbcomp/keymap/sun/Imakefile:3.5 --- xc/programs/xkbcomp/keymap/sun/Imakefile:3.4 Fri Oct 27 14:31:07 2000 +++ xc/programs/xkbcomp/keymap/sun/Imakefile Wed Jan 17 18:45:56 2001 @@ -1,5 +1,9 @@ -XCOMM $XConsortium: Imakefile /main/2 1996/08/31 12:18:50 kaleb $ -XCOMM $XFree86: xc/programs/xkbcomp/keymap/sun/Imakefile,v 3.4 2000/10/27 18:31:07 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xkbcomp/keymap/sun/Imakefile,v 3.5 2001/01/17 23:45:56 dawes Exp $ DATAFILES = de es fi fr no pl ru se uk us Index: xc/programs/xkbcomp/keymap/sun/de diff -u xc/programs/xkbcomp/keymap/sun/de:3.3 xc/programs/xkbcomp/keymap/sun/de:3.4 --- xc/programs/xkbcomp/keymap/sun/de:3.3 Sun Oct 4 05:41:34 1998 +++ xc/programs/xkbcomp/keymap/sun/de Wed Jan 17 18:45:56 2001 @@ -1,4 +1,4 @@ -// $TOG: de /main/3 1998/02/10 13:44:36 kaleb $ +// $Xorg: de,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/keymap/sun/us diff -u xc/programs/xkbcomp/keymap/sun/us:3.2 xc/programs/xkbcomp/keymap/sun/us:3.3 --- xc/programs/xkbcomp/keymap/sun/us:3.2 Sun Oct 4 05:41:34 1998 +++ xc/programs/xkbcomp/keymap/sun/us Wed Jan 17 18:45:56 2001 @@ -1,4 +1,4 @@ -// $TOG: us /main/3 1998/02/10 13:44:40 kaleb $ +// $Xorg: us,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/rules/Imakefile diff -u xc/programs/xkbcomp/rules/Imakefile:3.2 xc/programs/xkbcomp/rules/Imakefile:3.3 --- xc/programs/xkbcomp/rules/Imakefile:3.2 Thu May 18 19:21:43 2000 +++ xc/programs/xkbcomp/rules/Imakefile Wed Jan 17 18:45:56 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/3 1996/09/13 10:59:07 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ DATAFILES = sgi xfree86 sun LISTFILES = sgi.lst xfree86.lst xfree86-it.lst sun.lst Index: xc/programs/xkbcomp/rules/sgi diff -u xc/programs/xkbcomp/rules/sgi:3.1 xc/programs/xkbcomp/rules/sgi:3.2 --- xc/programs/xkbcomp/rules/sgi:3.1 Sun Jun 22 06:17:15 1997 +++ xc/programs/xkbcomp/rules/sgi Wed Jan 17 18:45:57 2001 @@ -1,4 +1,4 @@ -// $TOG: sgi /main/4 1997/06/14 06:37:02 kaleb $ +// $Xorg: sgi,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ ! option = symbols grp:switch = +group(switch) Index: xc/programs/xkbcomp/rules/sgi.lst diff -u xc/programs/xkbcomp/rules/sgi.lst:3.4 xc/programs/xkbcomp/rules/sgi.lst:3.6.2.1 --- xc/programs/xkbcomp/rules/sgi.lst:3.4 Fri Dec 8 11:45:16 2000 +++ xc/programs/xkbcomp/rules/sgi.lst Wed May 23 14:32:19 2001 @@ -1,6 +1,10 @@ -// $TOG: sgi.lst /main/3 1997/06/13 06:28:54 kaleb $ -// $XFree86: xc/programs/xkbcomp/rules/sgi.lst,v 3.4 2000/12/08 16:45:16 dawes Exp $ +// $Xorg: sgi.lst,v 1.3 2000/08/17 19:54:41 cpqbld Exp $ + + + +// $XFree86: xc/programs/xkbcomp/rules/sgi.lst,v 3.6.2.1 2001/05/23 18:32:19 dawes Exp $ + ! model indy SGI O2, Indigo^2 or Indy indy101 SGI O2, Indigo^2 or Indy (101-key US) @@ -22,7 +26,8 @@ be Belgian bg Bulgarian ca Canadian - cs Czechoslovakian + cz Czech + cz_qwerty Czech (qwerty) de German de_CH Swiss German dvorak Dvorak (US) @@ -39,9 +44,11 @@ jp Japanese no Norwegian pl Polish - pt Portugese + pt Portuguese ru Russian se Swedish + sk Slovak + sk_qwerty Slovak (qwerty) th Thai us US/ASCII tr Turkish Index: xc/programs/xkbcomp/rules/sun.lst diff -u xc/programs/xkbcomp/rules/sun.lst:3.3 xc/programs/xkbcomp/rules/sun.lst:3.4.2.1 --- xc/programs/xkbcomp/rules/sun.lst:3.3 Wed Dec 6 15:18:08 2000 +++ xc/programs/xkbcomp/rules/sun.lst Wed May 23 14:32:19 2001 @@ -1,4 +1,4 @@ -// $XFree86: xc/programs/xkbcomp/rules/sun.lst,v 3.3 2000/12/06 20:18:08 eich Exp $ +// $XFree86: xc/programs/xkbcomp/rules/sun.lst,v 3.4.2.1 2001/05/23 18:32:19 dawes Exp $ ! model type4 Sun Type4 @@ -10,7 +10,7 @@ be Belgian bg Bulgarian ca Canadian - cs Czechoslovakian + cz Czech de German de_CH Swiss German dvorak Dvorak (US) @@ -27,9 +27,10 @@ jp Japanese no Norwegian pl Polish - pt Portugese + pt Portuguese ru Russian se Swedish + sk Slovak th Thai us US/ASCII tr Turkish Index: xc/programs/xkbcomp/rules/xfree86 diff -u xc/programs/xkbcomp/rules/xfree86:3.26 xc/programs/xkbcomp/rules/xfree86:3.33 --- xc/programs/xkbcomp/rules/xfree86:3.26 Fri Dec 1 20:16:25 2000 +++ xc/programs/xkbcomp/rules/xfree86 Thu Apr 5 22:16:25 2001 @@ -1,10 +1,10 @@ -// $TOG: xfree86 /main/3 1997/08/02 10:11:25 kaleb $ +// $Xorg: xfree86,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ // // Rules for resolving XKB components for use with XFree86 // Copyright 1996 by Joseph Moss // -// $XFree86: xc/programs/xkbcomp/rules/xfree86,v 3.26 2000/12/02 01:16:25 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/rules/xfree86,v 3.33 2001/04/06 02:16:25 dawes Exp $ // ! model = keycodes geometry @@ -16,7 +16,7 @@ pc102 = xfree86 pc(pc102) pc104 = xfree86 pc(pc104) pc105 = xfree86 pc(pc105) - jp106 = xfree86(jp106) pc(jp106) + jp106 = xfree86 pc(jp106) everex = xfree86 everex(STEPnote) winbook = xfree86 winbook(XP5) pc98 = xfree98(pc98) nec(pc98) @@ -24,10 +24,16 @@ hp = xfree86 pc(pc104) itouch = xfree86 pc(pc104) logicordless = xfree86 pc(pc104) + logiinternet = xfree86 pc(pc104) compaq = xfree86 pc(pc104) microsoftpro = xfree86 microsoft(natural) + geniuscomfy = xfree86 pc(pc104) btc9000 = xfree86 pc(pc104) - macintosh = macintosh macintosh(macintosh) + rapidaccess = xfree86 pc(pc104) + rapidaccess2 = xfree86 pc(pc104) + chicony = xfree86 pc(pc104) + macintosh = xfree86 macintosh(macintosh) + macintosh_old = macintosh macintosh(macintosh) powerpcps2 = powerpcps2 pc(pc104) //! model layout = symbols @@ -89,14 +95,33 @@ logicordless us = us(pc104)+inet(logicordless) logicordless en_US = en_US(pc104)+inet(logicordless) logicordless * = en_US(pc104)+inet(logicordless)+%l%(v) + logiinternet us = us(pc104)+inet(logiinternet) + logiinternet en_US = en_US(pc104)+inet(logiinternet) + logiinternet * = en_US(pc104)+inet(logiinternet)+%l%(v) microsoftpro us = us(pc104)+inet(microsoftpro) microsoftpro en_US = en_US(pc104)+inet(microsoftpro) microsoftpro * = en_US(pc104)+inet(microsoftpro)+%l%(v) + geniuscomfy us = us(pc104)+inet(geniuscomfy) + geniuscomfy en_US = en_US(pc104)+inet(geniuscomfy) + geniuscomfy * = en_US(pc104)+inet(geniuscomfy)+%l%(v) btc9000 us = us(pc104)+inet(btc9000) btc9000 en_US = en_US(pc104)+inet(btc9000) btc9000 * = en_US(pc104)+inet(btc9000)+%l%(v) + rapidaccess us = us(pc104)+inet(rapidaccess) + rapidaccess en_US = en_US(pc104)+inet(rapidaccess) + rapidaccess * = en_US(pc104)+inet(rapidaccess)+%l%(v) + rapidaccess2 us = us(pc104)+inet(rapidaccess2) + rapidaccess2 en_US = en_US(pc104)+inet(rapidaccess2) + rapidaccess2 * = en_US(pc104)+inet(rapidaccess2)+%l%(v) + chicony us = us(pc104)+inet(chicony) + chicony en_US = en_US(pc104)+inet(chicony) + chicony * = en_US(pc104)+inet(chicony)+%l%(v) macintosh us = macintosh/us(extended) + macintosh en_US = macintosh/us(extended) macintosh * = macintosh/us(extended)+macintosh/%l%(v) + macintosh_old us = macintosh/us(extended) + macintosh_old en_US = macintosh/us(extended) + macintosh_old * = macintosh/us(extended)+macintosh/%l%(v) powerpcps2 us = us(pc104) powerpcps2 en_US = en_US(pc104) powerpcps2 * = en_US(pc104)+%l%(v) Index: xc/programs/xkbcomp/rules/xfree86-it.lst diff -u xc/programs/xkbcomp/rules/xfree86-it.lst:1.4 xc/programs/xkbcomp/rules/xfree86-it.lst:1.6 --- xc/programs/xkbcomp/rules/xfree86-it.lst:1.4 Sat Nov 14 23:30:46 1998 +++ xc/programs/xkbcomp/rules/xfree86-it.lst Fri May 18 19:35:34 2001 @@ -1,10 +1,10 @@ -// $TOG: xfree86-it.lst /main/2 1997/06/13 06:28:38 kaleb $ +// $Xorg: xfree86-it.lst,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ // // Elenco dei modelli e dei lingauggi // Copyright 1996 by Joseph Moss // -// $XFree86: xc/programs/xkbcomp/rules/xfree86-it.lst,v 1.4 1998/11/15 04:30:46 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/rules/xfree86-it.lst,v 1.6 2001/05/18 23:35:34 dawes Exp $ ! model microsoft Microsoft Natural @@ -26,7 +26,8 @@ be Belga bg Bulgaro ca Canadese - cs Cecoslovacco + cz Ceco + cz_qwerty Ceco (qwerty) de Tedesco de_CH Tedesco Svizzero dk Danese @@ -43,5 +44,7 @@ pt Portoghese ru Russo se Svedese + sk Slovacco + sk_qwerty Slovacco (qwerty) th Tailandese nec/jp nec/jp(pc98) Index: xc/programs/xkbcomp/rules/xfree86.lst diff -u xc/programs/xkbcomp/rules/xfree86.lst:3.20.2.1 xc/programs/xkbcomp/rules/xfree86.lst:3.30.2.2 --- xc/programs/xkbcomp/rules/xfree86.lst:3.20.2.1 Fri Feb 9 15:45:08 2001 +++ xc/programs/xkbcomp/rules/xfree86.lst Fri May 25 14:50:14 2001 @@ -1,10 +1,10 @@ -// $TOG: xfree86.lst /main/3 1997/08/02 10:11:28 kaleb $ +// $Xorg: xfree86.lst,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ // // Rules descriptions for XFree86 // Copyright 1996 by Joseph Moss // -// $XFree86: xc/programs/xkbcomp/rules/xfree86.lst,v 3.20.2.1 2001/02/09 20:45:08 paulo Exp $ +// $XFree86: xc/programs/xkbcomp/rules/xfree86.lst,v 3.30.2.2 2001/05/25 18:50:14 dawes Exp $ ! model pc101 Generic 101-key PC @@ -23,8 +23,13 @@ hp HP Internet itouch Logitech iTouch logicordless Logitech Cordless Desktop Pro + logiinternet Logitech Internet Keyboard compaq Compaq Internet microsoftpro Microsoft Natural Pro + geniuscomfy Genius Comfy KB-16M + rapidaccess IBM Rapid Access + rapidaccess2 IBM Rapid Access II + chicony Chicony Internet Keyboard ! layout us U.S. English @@ -32,11 +37,13 @@ us_intl U.S. English w/ deadkeys am Armenian az Azerbaidjani + by Belarusian be Belgian br Brazilian bg Bulgarian ca Canadian - cs Czechoslovakian + cz Czech + cz_qwerty Czech (qwerty) dk Danish dvorak Dvorak ee Estonian @@ -45,15 +52,17 @@ fr_CH Swiss French de German de_CH Swiss German - gr Greek + el Greek + hr Croatian hu Hungarian is Icelandic il Israeli it Italian jp Japanese - lt Lithuanian querty "numeric" + lt Lithuanian qwerty "numeric" lt_std Lithuanian azerty standard - lt_p Lithuanian querty "programmer's" + lt_p Lithuanian qwerty "programmer's" + lv Latvian mk Macedonian no Norwegian pl Polish @@ -62,6 +71,8 @@ ru Russian sr Serbian si Slovenian + sk Slovak + sk_qwerty Slovak (qwerty) es Spanish se Swedish th Thai Index: xc/programs/xkbcomp/semantics/Imakefile diff -u xc/programs/xkbcomp/semantics/Imakefile:1.1.1.1 xc/programs/xkbcomp/semantics/Imakefile:1.1.1.2 --- xc/programs/xkbcomp/semantics/Imakefile:1.1.1.1 Wed Jan 3 02:40:31 1996 +++ xc/programs/xkbcomp/semantics/Imakefile Tue Jan 16 17:59:02 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/1 1995/11/30 19:13:56 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ DATAFILES = basic complete default xtest Index: xc/programs/xkbcomp/semantics/basic diff -u xc/programs/xkbcomp/semantics/basic:1.1.1.2 xc/programs/xkbcomp/semantics/basic:1.1.1.3 --- xc/programs/xkbcomp/semantics/basic:1.1.1.2 Wed Jan 3 02:40:28 1996 +++ xc/programs/xkbcomp/semantics/basic Tue Jan 16 17:59:05 2001 @@ -1,4 +1,4 @@ -// $XConsortium: basic /main/4 1995/12/07 21:39:48 kaleb $ +// $Xorg: basic,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ default xkb_semantics "basic" { xkb_types { include "basic" }; Index: xc/programs/xkbcomp/semantics/complete diff -u xc/programs/xkbcomp/semantics/complete:1.1.1.2 xc/programs/xkbcomp/semantics/complete:1.1.1.3 --- xc/programs/xkbcomp/semantics/complete:1.1.1.2 Wed Jan 3 02:40:29 1996 +++ xc/programs/xkbcomp/semantics/complete Tue Jan 16 17:59:07 2001 @@ -1,4 +1,4 @@ -// $XConsortium: complete /main/4 1995/12/07 21:39:56 kaleb $ +// $Xorg: complete,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ default xkb_semantics "complete" { xkb_types { include "complete" }; Index: xc/programs/xkbcomp/semantics/default diff -u xc/programs/xkbcomp/semantics/default:1.1.1.2 xc/programs/xkbcomp/semantics/default:1.1.1.3 --- xc/programs/xkbcomp/semantics/default:1.1.1.2 Wed Jan 3 02:40:30 1996 +++ xc/programs/xkbcomp/semantics/default Tue Jan 16 17:59:09 2001 @@ -1,4 +1,4 @@ -// $XConsortium: default /main/5 1995/12/07 21:40:04 kaleb $ +// $Xorg: default,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ default xkb_semantics "default" { xkb_types { include "default" }; Index: xc/programs/xkbcomp/semantics/xtest diff -u xc/programs/xkbcomp/semantics/xtest:1.1.1.1 xc/programs/xkbcomp/semantics/xtest:1.1.1.2 --- xc/programs/xkbcomp/semantics/xtest:1.1.1.1 Wed Jan 3 02:40:31 1996 +++ xc/programs/xkbcomp/semantics/xtest Tue Jan 16 17:59:10 2001 @@ -1,4 +1,4 @@ -// $XConsortium: xtest /main/2 1995/12/07 21:40:12 kaleb $ +// $Xorg: xtest,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ default xkb_semantics "xtest" { xkb_types { include "basic" }; Index: xc/programs/xkbcomp/symbols/Imakefile diff -u xc/programs/xkbcomp/symbols/Imakefile:3.32 xc/programs/xkbcomp/symbols/Imakefile:3.38.2.1 --- xc/programs/xkbcomp/symbols/Imakefile:3.32 Thu Dec 7 04:04:19 2000 +++ xc/programs/xkbcomp/symbols/Imakefile Wed May 23 16:21:53 2001 @@ -1,16 +1,22 @@ -XCOMM $TOG: Imakefile /main/16 1997/10/24 14:30:46 kaleb $ -XCOMM $XFree86: xc/programs/xkbcomp/symbols/Imakefile,v 3.32 2000/12/07 09:04:19 alanh Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xkbcomp/symbols/Imakefile,v 3.38.2.1 2001/05/23 20:21:53 dawes Exp $ + #define IHaveSubdirs TESTDATA = - DATAFILES = am az be bg br ca ca_enhanced cs cs_qwerty czsk ctrl \ - de de_CH dk dvorak ee en_US es fi fr fr_CH \ - gb gr group hu hu_US il il_phonetic iso9995-3 inet is it jp \ - keypad lock lt lt_std lt_p mk no pc104 \ + DATAFILES = am az be bg br by ca ca_enhanced cz cz_qwerty ctrl \ + de de_CH dk dvorak ee el en_US es fi fr fr_CH \ + gb group hu hu_US hr il il_phonetic iso9995-3 inet is it jp \ + keypad lock lt lt_std lt_p lv mk no pc104 \ pl pt \ - ralt ro ru se si sr th ua us us_intl us_group3 vn tr + ralt ro ru se si sk sk_qwerty sr th ua us us_intl \ + us_group3 vn tr SUBDIRS = digital fujitsu hp macintosh nec sgi sony sun xfree68 MakeXkbDir($(LIBDIR)/xkb,symbols) InstallMultiple($(DATAFILES),$(LIBDIR)/xkb/symbols) -DependTarget() +DependSubdirs($(SUBDIRS)) Index: xc/programs/xkbcomp/symbols/be diff -u xc/programs/xkbcomp/symbols/be:3.4 xc/programs/xkbcomp/symbols/be:3.5 --- xc/programs/xkbcomp/symbols/be:3.4 Fri Oct 27 14:31:08 2000 +++ xc/programs/xkbcomp/symbols/be Wed Jan 17 18:45:57 2001 @@ -1,5 +1,10 @@ -// $XConsortium: be /main/3 1996/08/31 12:19:05 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/be,v 3.4 2000/10/27 18:31:08 dawes Exp $ +// $Xorg: be,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/be,v 3.5 2001/01/17 23:45:57 dawes Exp $ + partial default alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/bg diff -u xc/programs/xkbcomp/symbols/bg:3.2 xc/programs/xkbcomp/symbols/bg:3.3 --- xc/programs/xkbcomp/symbols/bg:3.2 Mon Nov 6 14:24:10 2000 +++ xc/programs/xkbcomp/symbols/bg Wed Jan 17 18:45:57 2001 @@ -1,3 +1,5 @@ +// $Xorg: ca,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ + ////////////////////////////////////////////////////////////////////////// // Copyright (C) 1999, 2000 by Anton Zinoviev <anton@lml.bas.bg> // @@ -10,7 +12,7 @@ // ////////////////////////////////////////////////////////////////////////// -// $XFree86: xc/programs/xkbcomp/symbols/bg,v 3.2 2000/11/06 19:24:10 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/bg,v 3.3 2001/01/17 23:45:57 dawes Exp $ // Version 1.6r1 Index: xc/programs/xkbcomp/symbols/by diff -u /dev/null xc/programs/xkbcomp/symbols/by:1.1 --- /dev/null Mon Jun 4 12:42:58 2001 +++ xc/programs/xkbcomp/symbols/by Mon Feb 12 13:25:59 2001 @@ -0,0 +1,142 @@ +// +// belarusian standard keyboard +// Alexander Mikhailian <mikhailian@altern.org> +// + +partial default alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a very simple Belarusian keybaord + + name[Group1]= "US/ASCII"; + name[Group2]= "Belarusian"; + + key <TLDE> { [ grave, asciitilde ], + [ Cyrillic_io, Cyrillic_IO ] }; + key <LSGT> { [ less, greater ], + [ bar, brokenbar ] }; + key <AD01> { [ q, Q ], + [ Cyrillic_shorti, Cyrillic_SHORTI ] }; + key <AE01> { [ 1, exclam ], + [ 1, exclam ] }; + key <AB01> { [ z, Z ], + [ Cyrillic_ya, Cyrillic_YA ] }; + key <AC02> { [ s, S ], + [ Cyrillic_yeru, Cyrillic_YERU ] }; + key <AC01> { [ a, A ], + [ Cyrillic_ef, Cyrillic_EF ] }; + key <AD02> { [ w, W ], + [ Cyrillic_tse, Cyrillic_TSE ] }; + key <AE02> { [ 2, at ], + [ 2, quotedbl ] }; + key <AB03> { [ c, C ], + [ Cyrillic_es, Cyrillic_ES ] }; + key <AB02> { [ x, X ], + [ Cyrillic_che, Cyrillic_CHE ] }; + key <AC03> { [ d, D ], + [ Cyrillic_ve, Cyrillic_VE ] }; + key <AD03> { [ e, E ], + [ Cyrillic_u, Cyrillic_U ] }; + key <AE04> { [ 4, dollar ], + [ 4, semicolon ] }; + key <AE03> { [ 3, numbersign ], + [ 3, numbersign ] }; + key <AB04> { [ v, V ], + [ Cyrillic_em, Cyrillic_EM ] }; + key <AC04> { [ f, F ], + [ Cyrillic_a, Cyrillic_A ] }; + key <AD05> { [ t, T ], + [ Cyrillic_ie, Cyrillic_IE ] }; + key <AD04> { [ r, R ], + [ Cyrillic_ka, Cyrillic_KA ] }; + key <AE05> { [ 5, percent ], + [ 5, percent ] }; + key <AB06> { [ n, N ], + [ Cyrillic_te, Cyrillic_TE ] }; + key <AB05> { [ b, B ], + [ Ukrainian_i, Ukrainian_I ] }; + key <AC06> { [ h, H ], + [ Cyrillic_er, Cyrillic_ER ] }; + key <AC05> { [ g, G ], + [ Cyrillic_pe, Cyrillic_PE ] }; + key <AD06> { [ y, Y ], + [ Cyrillic_en, Cyrillic_EN ] }; + key <AE06> { [ 6, asciicircum ], + [ 6, colon ] }; + key <AB07> { [ m, M ], + [Cyrillic_softsign,Cyrillic_SOFTSIGN ] }; + key <AC07> { [ j, J ], + [ Cyrillic_o, Cyrillic_O ] }; + key <AD07> { [ u, U ], + [ Cyrillic_ghe, Cyrillic_GHE ] }; + key <AE07> { [ 7, ampersand ], + [ 7, question ] }; + key <AE08> { [ 8, asterisk ], + [ 8, asterisk ] }; + key <AB08> { [ comma, less ], + [ Cyrillic_be, Cyrillic_BE ] }; + key <AC08> { [ k, K ], + [ Cyrillic_el, Cyrillic_EL ] }; + key <AD08> { [ i, I ], + [ Cyrillic_sha, Cyrillic_SHA ] }; + key <AD09> { [ o, O ], + [ Byelorussian_shortu, Byelorussian_SHORTU ] }; + key <AE10> { [ 0, parenright ], + [ 0, parenright ] }; + key <AE09> { [ 9, parenleft ], + [ 9, parenleft ] }; + key <AB09> { [ period, greater ], + [ Cyrillic_yu, Cyrillic_YU ] }; + key <AB10> { [ slash, question ], + [ period, comma ] }; + key <AC09> { [ l, L ], + [ Cyrillic_de, Cyrillic_DE ] }; + key <AC10> { [ semicolon, colon ], + [ Cyrillic_zhe, Cyrillic_ZHE ] }; + key <AD10> { [ p, P ], + [ Cyrillic_ze, Cyrillic_ZE ] }; + key <AE11> { [ minus, underscore ], + [ minus, underscore ] }; + key <AC11> { [ apostrophe, quotedbl ], + [ Cyrillic_e, Cyrillic_E ] }; + key <AD11> { [ bracketleft, braceleft ], + [ Cyrillic_ha, Cyrillic_HA ] }; + key <AE12> { [ equal, plus ], + [ equal, plus ] }; + key <AD12> { [ bracketright, braceright ], + [ apostrophe, apostrophe ] }; + key <BKSL> { [ backslash, bar ], + [ slash, bar ] }; + + // End alphanumeric section + + // Begin modifier mappings + + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock, ISO_Lock }; + modifier_map Control{ Control_L }; + modifier_map Mod3 { Mode_switch }; +}; + +partial alphanumeric_keys +xkb_symbols "winkeys" { + include "by(basic)" + key <AE04> { [ 4, dollar ], + [ 4, semicolon ] }; + key <AE03> { [ 3, numbersign ], + [ 3, numbersign ] }; + key <AE05> { [ 5, percent ], + [ 5, percent ] }; + key <AE06> { [ 6, asciicircum ], + [ 6, colon ] }; + key <AE07> { [ 7, ampersand ], + [ 7, question ] }; + key <AE08> { [ 8, asterisk ], + [ 8, asterisk ] }; + key <AB10> { [ slash, question ], + [ period, comma ] }; + key <BKSL> { [ backslash, bar ], + [ slash, bar ] }; +}; + Index: xc/programs/xkbcomp/symbols/ca diff -u xc/programs/xkbcomp/symbols/ca:3.6 xc/programs/xkbcomp/symbols/ca:3.8 --- xc/programs/xkbcomp/symbols/ca:3.6 Thu Dec 26 02:02:18 1996 +++ xc/programs/xkbcomp/symbols/ca Fri May 18 19:35:35 2001 @@ -1,5 +1,10 @@ -// $XConsortium: ca /main/5 1996/09/28 17:18:16 rws $ -// $XFree86: xc/programs/xkbcomp/symbols/ca,v 3.6 1996/12/26 07:02:18 dawes Exp $ +// $Xorg: ca,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/ca,v 3.8 2001/05/18 23:35:35 dawes Exp $ + default partial alphanumeric_keys xkb_symbols "basic" { @@ -121,6 +126,9 @@ key <AB10> { [ eacute, Eacute ], [ NoSymbol, dead_abovedot ] }; key <RCTL> { [ ISO_Level3_Shift ] }; + + modifier_map Mod5 { <RCTL> }; + }; partial alphanumeric_keys xkb_symbols "alternate" { Index: xc/programs/xkbcomp/symbols/cs diff -u xc/programs/xkbcomp/symbols/cs:3.3 xc/programs/xkbcomp/symbols/cs:removed --- xc/programs/xkbcomp/symbols/cs:3.3 Tue Sep 26 11:57:25 2000 +++ xc/programs/xkbcomp/symbols/cs Mon Jun 4 12:42:58 2001 @@ -1,115 +0,0 @@ - // $XConsortium: cs /main/3 1996/08/31 12:19:14 kaleb $ - // $XFree86: xc/programs/xkbcomp/symbols/cs,v 3.3 2000/09/26 15:57:25 tsi Exp $ -partial default alphanumeric_keys -xkb_symbols "basic" { - - // Describes the differences between a very simple en_US - // keyboard and a very simple Czech 'qwertz' keyboard - - name[Group1]= "Czech"; - - key <TLDE> { [ dead_diaeresis, dead_abovering ], - [ grave, asciitilde ] }; - key <AD01> { [ q, Q ], - [ q, Q ] }; - key <AE01> { [ plus, 1 ], - [ 1, exclam ] }; - key <AB01> { [ y, Y ], - [ z, Z ] }; - key <AC02> { [ s, S ], - [ s, S ] }; - key <AC01> { [ a, A ], - [ a, A ] }; - key <AD02> { [ w, W ], - [ w, W ] }; - key <AE02> { [ ecaron, 2 ], - [ 2, at ] }; - key <AB05> { [ b, B ], - [ b, B ] }; - key <AB04> { [ v, V ], - [ v, V ] }; - key <AB03> { [ c, C ], - [ c, C ] }; - key <AB02> { [ x, X ], - [ x, X ] }; - key <AC03> { [ d, D ], - [ d, D ] }; - key <AE04> { [ ccaron, 4 ], - [ 4, dollar ] }; - key <AE03> { [ scaron, 3 ], - [ 3, numbersign ] }; - key <AC04> { [ f, F ], - [ f, F ] }; - key <AD05> { [ t, T ], - [ t, T ] }; - key <AD04> { [ r, R ], - [ r, R ] }; - key <AE05> { [ rcaron, 5 ], - [ 5, percent ] }; - key <AC06> { [ h, H ], - [ h, H ] }; - key <AC05> { [ g, G ], - [ g, G ] }; - key <AD06> { [ z, Z ], - [ y, Y ] }; - key <AE06> { [ zcaron, 6 ], - [ 6, asciicircum ] }; - key <AB07> { [ m, M ], - [ m, M ] }; - key <AD07> { [ u, U ], - [ u, U ] }; - key <AE07> { [ yacute, 7 ], - [ 7, ampersand ] }; - key <AE08> { [ aacute, 8 ], - [ 8, asterisk ] }; - key <AB08> { [ comma, question ], - [ comma, less ] }; - key <AC08> { [ k, K ], - [ k, K ] }; - key <AC09> { [ l, L ], - [ l, L ] }; - key <AD08> { [ i, I ], - [ i, I ] }; - key <AD09> { [ o, O ], - [ o, O ] }; - key <AE10> { [ eacute, 0 ], - [ 0, parenright ] }; - key <AE09> { [ iacute, 9 ], - [ 9, parenleft ] }; - key <AB09> { [ period, colon ], - [ period, greater ] }; - key <AB10> { [ minus, underscore ], - [ slash, question ] }; - key <AC10> { [ uring, quotedbl ], - [ semicolon, colon ] }; - key <AD10> { [ p, P ], - [ p, P ] }; - key <AE11> { [ equal, percent ], - [ minus, underscore ] }; - key <AC11> { [ section, exclam ], - [ apostrophe, quotedbl ] }; - key <AD11> { [ uacute, slash ], - [ bracketleft, braceleft ] }; - key <AE12> { [ dead_acute, dead_caron ], - [ equal, plus ] }; - - key <BKSL> { [ backslash, bar ], - [ backslash, bar ] }; - key <LSGT> { [ less, greater ], - [ backslash, brokenbar ] }; - - key <AD12> { [ parenright, parenleft ], - [ bracketright, braceright ] }; - - key <SCLK> { [ Scroll_Lock ] }; - - // End alphanumeric section - - // begin modifier mappings - - modifier_map Shift { Shift_L }; - modifier_map Lock { Caps_Lock }; - modifier_map Control{ Control_L }; - modifier_map Mod3 { Mode_switch }; -}; - Index: xc/programs/xkbcomp/symbols/cs_qwerty diff -u xc/programs/xkbcomp/symbols/cs_qwerty:1.2 xc/programs/xkbcomp/symbols/cs_qwerty:removed --- xc/programs/xkbcomp/symbols/cs_qwerty:1.2 Tue Sep 26 11:57:25 2000 +++ xc/programs/xkbcomp/symbols/cs_qwerty Mon Jun 4 12:42:58 2001 @@ -1,117 +0,0 @@ - // $XConsortium: cs /main/3 1996/08/31 12:19:14 kaleb $ - // $XFree86: xc/programs/xkbcomp/symbols/cs_qwerty,v 1.2 2000/09/26 15:57:25 tsi Exp $ - // - -partial default alphanumeric_keys -xkb_symbols "basic" { - - // Describes the differences between a very simple en_US - // keyboard and a very simple Czech 'qwerty' keyboard - - name[Group1]= "Czech"; - - key <TLDE> { [ dead_diaeresis, dead_abovering ], - [ grave, asciitilde ] }; - key <AD01> { [ q, Q ], - [ q, Q ] }; - key <AE01> { [ plus, 1 ], - [ 1, exclam ] }; - key <AB01> { [ z, Z ], - [ z, Z ] }; - key <AC02> { [ s, S ], - [ s, S ] }; - key <AC01> { [ a, A ], - [ a, A ] }; - key <AD02> { [ w, W ], - [ w, W ] }; - key <AE02> { [ ecaron, 2 ], - [ 2, at ] }; - key <AB05> { [ b, B ], - [ b, B ] }; - key <AB04> { [ v, V ], - [ v, V ] }; - key <AB03> { [ c, C ], - [ c, C ] }; - key <AB02> { [ x, X ], - [ x, X ] }; - key <AC03> { [ d, D ], - [ d, D ] }; - key <AE04> { [ ccaron, 4 ], - [ 4, dollar ] }; - key <AE03> { [ scaron, 3 ], - [ 3, numbersign ] }; - key <AC04> { [ f, F ], - [ f, F ] }; - key <AD05> { [ t, T ], - [ t, T ] }; - key <AD04> { [ r, R ], - [ r, R ] }; - key <AE05> { [ rcaron, 5 ], - [ 5, percent ] }; - key <AC06> { [ h, H ], - [ h, H ] }; - key <AC05> { [ g, G ], - [ g, G ] }; - key <AD06> { [ y, Y ], - [ y, Y ] }; - key <AE06> { [ zcaron, 6 ], - [ 6, asciicircum ] }; - key <AB07> { [ m, M ], - [ m, M ] }; - key <AD07> { [ u, U ], - [ u, U ] }; - key <AE07> { [ yacute, 7 ], - [ 7, ampersand ] }; - key <AE08> { [ aacute, 8 ], - [ 8, asterisk ] }; - key <AB08> { [ comma, question ], - [ comma, less ] }; - key <AC08> { [ k, K ], - [ k, K ] }; - key <AC09> { [ l, L ], - [ l, L ] }; - key <AD08> { [ i, I ], - [ i, I ] }; - key <AD09> { [ o, O ], - [ o, O ] }; - key <AE10> { [ eacute, 0 ], - [ 0, parenright ] }; - key <AE09> { [ iacute, 9 ], - [ 9, parenleft ] }; - key <AB09> { [ period, colon ], - [ period, greater ] }; - key <AB10> { [ minus, underscore ], - [ slash, question ] }; - key <AC10> { [ uring, quotedbl ], - [ semicolon, colon ] }; - key <AD10> { [ p, P ], - [ p, P ] }; - key <AE11> { [ equal, percent ], - [ minus, underscore ] }; - key <AC11> { [ section, exclam ], - [ apostrophe, quotedbl ] }; - key <AD11> { [ uacute, slash ], - [ bracketleft, braceleft ] }; - key <AE12> { [ dead_acute, dead_caron ], - [ equal, plus ] }; - - key <BKSL> { [ backslash, bar ], - [ backslash, bar ] }; - key <LSGT> { [ less, greater ], - [ backslash, brokenbar ] }; - - key <AD12> { [ parenright, parenleft ], - [ bracketright, braceright ] }; - - key <SCLK> { [ Scroll_Lock ] }; - - // End alphanumeric section - - // begin modifier mappings - - modifier_map Shift { Shift_L }; - modifier_map Lock { Caps_Lock }; - modifier_map Control{ Control_L }; - modifier_map Mod3 { Mode_switch }; -}; - Index: xc/programs/xkbcomp/symbols/cz diff -u /dev/null xc/programs/xkbcomp/symbols/cz:1.1 --- /dev/null Mon Jun 4 12:42:58 2001 +++ xc/programs/xkbcomp/symbols/cz Fri May 18 19:35:35 2001 @@ -0,0 +1,132 @@ +// $XFree86: xc/programs/xkbcomp/symbols/cz,v 1.1 2001/05/18 23:35:35 dawes Exp $ + +partial alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a Czech keyboard + // This layout conforms to a new cz compromise standard designed + // to satisfy most unix, windows and mac users. + // 2001 by Kamil Toman <ktoman@email.cz> + + name[Group1]= "Czech"; + + key.type = "FOUR_LEVEL"; + + key <TLDE> { [ semicolon, dead_abovering, + grave, asciitilde ] }; + key <AE01> { [ plus, 1, + exclam, dead_tilde ] }; + key <AE02> { [ ecaron, 2, + at, dead_caron ] }; + key <AE03> { [ scaron, 3, + numbersign, dead_circumflex ] }; + key <AE04> { [ ccaron, 4, + dollar, dead_breve ] }; + key <AE05> { [ rcaron, 5, + percent, dead_abovering ] }; + key <AE06> { [ zcaron, 6, + asciicircum, dead_ogonek ] }; + key <AE07> { [ yacute, 7, + ampersand, dead_grave ] }; + key <AE08> { [ aacute, 8, + asterisk, dead_abovedot ] }; + key <AE09> { [ iacute, 9, + braceleft, dead_acute ] }; + key <AE10> { [ eacute, 0, + braceright, dead_doubleacute ] }; + key <AE11> { [ equal, percent, + NoSymbol, dead_diaeresis ] }; + key <AE12> { [ dead_acute, dead_caron, + dead_macron, dead_cedilla ] }; + + key <AD01> { [ q, Q, + backslash, NoSymbol ] }; + key <AD02> { [ w, W, + bar, Nosymbol ] }; + key <AD03> { [ e, E, + EuroSign, NoSymbol ] }; + key <AD04> { [ r, R, + NoSymbol, NoSymbol ] }; + key <AD05> { [ t, T, + NoSymbol, NoSymbol ] }; + key <AD06> { [ z, Z, + NoSymbol, NoSymbol ] }; + key <AD07> { [ u, U, + NoSymbol, NoSymbol ] }; + key <AD08> { [ i, I, + NoSymbol, NoSymbol ] }; + key <AD09> { [ o, O, + NoSymbol, NoSymbol ] }; + key <AD10> { [ p, P, + NoSymbol, NoSymbol ] }; + + key <AD11> { [ uacute, slash, + bracketleft, division ] }; + key <AD12> { [ parenright, parenleft, + bracketright, multiply ] }; + + key <AC01> { [ a, A, + asciitilde, NoSymbol ] }; + key <AC02> { [ s, S, + dstroke, NoSymbol ] }; + key <AC03> { [ d, D, + Dstroke, NoSymbol ] }; + key <AC04> { [ f, F, + bracketleft, NoSymbol ] }; + key <AC05> { [ g, G, + bracketright, NoSymbol ] }; + key <AC06> { [ h, H, + grave, NoSymbol ] }; + key <AC07> { [ j, J, + apostrophe, NoSymbol ] }; + key <AC08> { [ k, K, + lstroke, NoSymbol ] }; + key <AC09> { [ l, L, + Lstroke, NoSymbol ] }; + + key <AC10> { [ uring, quotedbl, + dollar, NoSymbol ] }; + key <AC11> { [ section, exclam, + apostrophe, ssharp ] }; + key <AC12> { [ EuroSign, dead_diaeresis, + NoSymbol, NoSymbol ] }; + key <BKSL> { [ dead_diaeresis, apostrophe, + backslash, bar ] }; + + key <LSGT> { [ backslash, bar, + slash, NoSymbol ] }; + key <AB01> { [ y, Y, + degree, NoSymbol ] }; + key <AB02> { [ x, X, + numbersign, Nosymbol ] }; + key <AB03> { [ c, C, + ampersand, NoSymbol ] }; + key <AB04> { [ v, V, + at, NoSymbol ] }; + key <AB05> { [ b, B, + braceleft, NoSymbol ] }; + key <AB06> { [ n, N, + braceright, NoSymbol ] }; + key <AB07> { [ m, M, + asciicircum, NoSymbol ] }; + key <AB08> { [ comma, question, + less, NoSymbol ] }; + key <AB09> { [ period, colon, + greater, NoSymbol ] }; + key <AB10> { [ minus, underscore, + asterisk, NoSymbol ] }; + + key <SPCE> { [ space, space, + nobreakspace, nobreakspace ] }; + + // This certainly shouldn't be 'comma'. Something like KP_DecimalComma + // would be better but there's no such definition in keysyms. + key <KPDL> { type="FOUR_LEVEL_KEYPAD", [ KP_Delete, comma, + KP_Delete, KP_Decimal] }; + + key <RALT> { type="TWO_LEVEL", [ ISO_Level3_Shift, ISO_Level3_Shift ] }; + modifier_map Mod5 { <RALT> }; + +}; + Index: xc/programs/xkbcomp/symbols/cz_qwerty diff -u /dev/null xc/programs/xkbcomp/symbols/cz_qwerty:1.1 --- /dev/null Mon Jun 4 12:42:58 2001 +++ xc/programs/xkbcomp/symbols/cz_qwerty Fri May 18 19:35:35 2001 @@ -0,0 +1,15 @@ +// $XFree86: xc/programs/xkbcomp/symbols/cz_qwerty,v 1.1 2001/05/18 23:35:35 dawes Exp $ + +partial alphanumeric_keys +xkb_symbols "basic" { + + // This layout should work exactly as a cz with the exception + // of 'X' and 'Y' keys, which are in the qwerty style (ie. swapped). + // 2001 by Kamil Toman <ktoman@email.cz> + + include "cz(basic)" + + key <AB01> { [ z, Z, + degree, NoSymbol ] }; + key <AD06> { [ y, Y, NoSymbol, NoSymbol ] }; +}; Index: xc/programs/xkbcomp/symbols/czsk diff -u xc/programs/xkbcomp/symbols/czsk:1.4 xc/programs/xkbcomp/symbols/czsk:removed --- xc/programs/xkbcomp/symbols/czsk:1.4 Thu Jun 15 16:34:13 2000 +++ xc/programs/xkbcomp/symbols/czsk Mon Jun 4 12:42:58 2001 @@ -1,737 +0,0 @@ -// Czech and Slovak keyboard symbols for XKB and PC keyboard -// -// (C) 1997,1999 Stanislav Meduna, stano@eunet.sk -// (C) 2000 Kamil Toman, ktoman@email.cz -// -// Permission is granted to anyone to use, distribute and modify -// this file in any way, provided that the above copyright notice -// is left intact and the author of the modification summarizes -// the changes in this header. -// -// This file is distributed without any expressed or implied warranty. -// -// $XFree86: xc/programs/xkbcomp/symbols/czsk,v 1.4 2000/06/15 20:34:13 dawes Exp $ - -partial default alphanumeric_keys -xkb_symbols "us_sk_qwerty" { - Name[Group1] = "US/ASCII"; - Name[Group2] = "Slovak"; - - include "czsk(def_qwerty)" - include "czsk(def_us_sk)" -}; - -partial alphanumeric_keys -xkb_symbols "us_sk_qwertz" { - Name[Group1] = "US/ASCII"; - Name[Group2] = "Slovak"; - - include "czsk(def_us_qwertz)" - include "czsk(def_us_sk)" -}; - -partial alphanumeric_keys -xkb_symbols "sk_us_qwerty" { - Name[Group1] = "Slovak"; - Name[Group2] = "US/ASCII"; - - include "czsk(def_qwerty)" - include "czsk(def_sk_us)" -}; - -partial alphanumeric_keys -xkb_symbols "sk_us_qwertz" { - Name[Group1] = "Slovak"; - Name[Group2] = "US/ASCII"; - - include "czsk(def_qwertz_us)" - include "czsk(def_sk_us)" -}; - -partial alphanumeric_keys -xkb_symbols "us_sk_prog" { - Name[Group1] = "US/ASCII"; - Name[Group2] = "Slovak"; - - include "czsk(def_basic)" - include "czsk(def_qwerty)" - include "czsk(def_us_sk_prog)" -}; - -partial alphanumeric_keys -xkb_symbols "sk_us_prog" { - Name[Group1] = "Slovak"; - Name[Group2] = "US/ASCII"; - - include "czsk(def_basic)" - include "czsk(def_qwerty)" - include "czsk(def_sk_us_prog)" -}; - -partial alphanumeric_keys -xkb_symbols "us_cz_qwerty" { - Name[Group1] = "US/ASCII"; - Name[Group2] = "Czech"; - - include "czsk(def_qwerty)" - include "czsk(def_us_cz)" -}; - -partial alphanumeric_keys -xkb_symbols "us_cz_qwertz" { - Name[Group1] = "US/ASCII"; - Name[Group2] = "Czech"; - - include "czsk(def_us_qwertz)" - include "czsk(def_us_cz)" -}; - -partial alphanumeric_keys -xkb_symbols "cz_us_qwerty" { - Name[Group1] = "Czech"; - Name[Group2] = "US/ASCII"; - - include "czsk(def_qwerty)" - include "czsk(def_cz_us)" -}; - -partial alphanumeric_keys -xkb_symbols "cz_us_qwertz" { - Name[Group1] = "Czech"; - Name[Group2] = "US/ASCII"; - - include "czsk(def_qwertz_us)" - include "czsk(def_cz_us)" -}; - -partial alphanumeric_keys -xkb_symbols "us_cz_prog" { - Name[Group1] = "US/ASCII"; - Name[Group2] = "Czech"; - - include "czsk(def_basic)" - include "czsk(def_qwerty)" - include "czsk(def_us_cz_prog)" -}; - -partial alphanumeric_keys -xkb_symbols "cz_us_prog" { - Name[Group1] = "Czech"; - Name[Group2] = "US/ASCII"; - - include "czsk(def_basic)" - include "czsk(def_qwerty)" - include "czsk(def_cz_us_prog)" -}; - -partial alphanumeric_keys -xkb_symbols "def_us_sk" { - include "czsk(def_basic)" - include "czsk(def_us_czsk)" - include "czsk(def_us_sk_prog)" - include "czsk(def_us_sk_rp)" -}; - -partial alphanumeric_keys -xkb_symbols "def_sk_us" { - include "czsk(def_basic)" - include "czsk(def_czsk_us)" - include "czsk(def_sk_us_prog)" - include "czsk(def_sk_us_rp)" -}; - -partial alphanumeric_keys -xkb_symbols "def_us_cz" { - include "czsk(def_basic)" - include "czsk(def_us_czsk)" - include "czsk(def_us_cz_prog)" - include "czsk(def_us_cz_rp)" -}; - -partial alphanumeric_keys -xkb_symbols "def_cz_us" { - include "czsk(def_basic)" - include "czsk(def_czsk_us)" - include "czsk(def_cz_us_prog)" - include "czsk(def_cz_us_rp)" -}; - -partial alphanumeric_keys -xkb_symbols "def_basic" { - - include "group(shift_toggle)" - - // Alphanumeric keys identical to US - key <ESC> { [ Escape ], - [ Escape ] }; - - key <BKSP> { [ BackSpace ], - [ BackSpace ] }; - key <TLDE> { [ grave, asciitilde ], - [ grave, asciitilde ] }; - - - key <TAB> { [ Tab, ISO_Left_Tab ], - [ Tab, ISO_Left_Tab ] }; - key <AD01> { [ q, Q ], - [ q, Q ] }; - key <AD02> { [ w, W ], - [ w, W ] }; - key <AD03> { [ e, E ], - [ e, E ] }; - key <AD04> { [ r, R ], - [ r, R ] }; - key <AD05> { [ t, T ], - [ t, T ] }; - key <AD07> { [ u, U ], - [ u, U ] }; - key <AD08> { [ i, I ], - [ i, I ] }; - key <AD09> { [ o, O ], - [ o, O ] }; - key <AD10> { [ p, P ], - [ p, P ] }; - key <RTRN> { [ Return ], - [ Return ] }; - - key <CAPS> { [ Caps_Lock ], - [ Caps_Lock ] }; - key <AC01> { [ a, A ], - [ a, A ] }; - key <AC02> { [ s, S ], - [ s, S ] }; - key <AC03> { [ d, D ], - [ d, D ] }; - key <AC04> { [ f, F ], - [ f, F ] }; - key <AC05> { [ g, G ], - [ g, G ] }; - key <AC06> { [ h, H ], - [ h, H ] }; - key <AC07> { [ j, J ], - [ j, J ] }; - key <AC08> { [ k, K ], - [ k, K ] }; - key <AC09> { [ l, L ], - [ l, L ] }; - - key <LFSH> { [ Shift_L ], - [ Shift_L ] }; - key <AB02> { [ x, X ], - [ x, X ] }; - key <AB03> { [ c, C ], - [ c, C ] }; - key <AB04> { [ v, V ], - [ v, V ] }; - key <AB05> { [ b, B ], - [ b, B ] }; - key <AB06> { [ n, N ], - [ n, N ] }; - key <AB07> { [ m, M ], - [ m, M ] }; - key <BKSL> { [ backslash, bar ], - [ backslash, bar ] }; - - key <LCTL> { [ Control_L ], - [ Control_L ] }; - key <SPCE> { [ space ], - [ space ] }; - - key <LSGT> { [ less, greater ], - [ less, greater ] }; - - key <LALT> { [ Alt_L ], - [ Meta_L ] }; - key <LWIN> { [ Meta_L ], - [ Meta_L ] }; - key <RWIN> { [ Meta_R ], - [ Meta_R ] }; - key <MENU> { [ Menu ], - [ Menu ] }; - // End alphanumeric section - - // begin modifier mappings - - modifier_map Shift { Shift_L, Shift_R }; - modifier_map Lock { Caps_Lock }; - modifier_map Control{ Control_L, Control_R }; - modifier_map Mod3 { Mode_switch }; - - // Begin "Function" section - key <FK01> { [ F1 ], - [ F1 ] }; - key <FK02> { [ F2 ], - [ F2 ] }; - key <FK03> { [ F3 ], - [ F3 ] }; - key <FK04> { [ F4 ], - [ F4 ] }; - key <FK05> { [ F5 ], - [ F5 ] }; - key <FK06> { [ F6 ], - [ F6 ] }; - key <FK07> { [ F7 ], - [ F7 ] }; - key <FK08> { [ F8 ], - [ F8 ] }; - key <FK09> { [ F9 ], - [ F9 ] }; - key <FK10> { [ F10 ], - [ F10 ] }; - key <FK11> { [ F11 ], - [ F11 ] }; - key <FK12> { [ F12 ], - [ F12 ] }; - // End "Function" section - - // Begin "Editing" section - key <PRSC> { - type= "PC_SYSRQ", - symbols[Group1]= [ Print, Sys_Req ] - }; - - key <SYRQ> { - type= "PC_SYSRQ", - symbols[Group1]= [ Print, Sys_Req ] - }; - - key <BRK> { - type= "PC_BREAK", - symbols[Group1]= [ Pause, Break ] - }; - - - key <PAUS> { [ Multi_key ] }; - key <RALT> { [ Mode_switch, Multi_key ] }; - key <SCLK> { [ ISO_Next_Group, ISO_Next_Group ] }; - - // Gray keys - - key <INS> { [ Insert ], - [ Insert ] }; - key <HOME> { [ Home ], - [ Home ] }; - key <PGUP> { [ Prior ], - [ Prior ] }; - key <DELE> { [ Delete ], - [ Delete ] }; - key <END> { [ End ], - [ End ] }; - key <PGDN> { [ Next ], - [ Next ] }; - - // Cursor keys - key <UP> { [ Up ], - [ Up ] }; - key <LEFT> { [ Left ], - [ Left ] }; - key <DOWN> { [ Down ], - [ Down ] }; - key <RGHT> { [ Right ], - [ Right ] }; - - - // Keypad keys - key <NMLK> { [ Num_Lock, Pointer_EnableKeys ], - [ Num_Lock, Pointer_EnableKeys ]}; - key <KPDV> { [ KP_Divide ], - [ KP_Divide ] }; - key <KPMU> { [ KP_Multiply ], - [ KP_Multiply ] }; - key <KPSU> { [ KP_Subtract ], - [ KP_Subtract ] }; - - key <KP7> { [ KP_Home, KP_7 ], - [ KP_Home, KP_7 ] }; - key <KP8> { [ KP_Up, KP_8 ], - [ KP_Up, KP_8 ] }; - key <KP9> { [ KP_Prior, KP_9 ], - [ KP_Prior, KP_9 ] }; - key <KPAD> { [ KP_Add ], - [ KP_Add ] }; - - key <KP4> { [ KP_Left, KP_4 ], - [ KP_Left, KP_4 ] }; - key <KP5> { [ KP_Begin, KP_5 ], - [ KP_Begin, KP_5 ] }; - key <KP6> { [ KP_Right, KP_6 ], - [ KP_Right, KP_6 ] }; - - key <KP1> { [ KP_End, KP_1 ], - [ KP_End, KP_1 ] }; - key <KP2> { [ KP_Down, KP_2 ], - [ KP_Down, KP_2 ] }; - key <KP3> { [ KP_Next, KP_3 ], - [ KP_Next, KP_3 ] }; - key <KPEN> { [ KP_Enter ], - [ KP_Enter ] }; - - key <KP0> { [ KP_Insert, KP_0 ], - [ KP_Insert, KP_0 ] }; - key <KPDL> { [ KP_Delete, KP_Decimal ], - [ KP_Delete, KP_Decimal ] }; -}; - -partial alphanumeric_keys -xkb_symbols "def_czsk_us" { - key <AE11> { - [ equal, percent ], - [ minus, underscore ] - }; - key <AD11> { - [ uacute, slash ], - [ bracketleft, braceleft ] - }; - key <AC11> { - [ section, exclam ], - [ apostrophe, quotedbl ] - }; - key <AB08> { - [ comma, question ], - [ comma, less ] - }; - key <AB09> { - [ period, colon ], - [ period, greater ] - }; - key <AB10> { - [ minus, underscore ], - [ slash, question ] - }; -}; - -partial alphanumeric_keys -xkb_symbols "def_us_czsk" { - key <AE11> { - [ minus, underscore ], - [ equal, percent ] - }; - key <AD11> { - [ bracketleft, braceleft ], - [ uacute, slash ] - }; - key <AC11> { - [ apostrophe, quotedbl ], - [ section, exclam ] - }; - key <AB08> { - [ comma, less ], - [ comma, question ] - }; - key <AB09> { - [ period, greater ], - [ period, colon ] - }; - key <AB10> { - [ slash, question ], - [ minus, underscore ] - }; -}; - -partial alphanumeric_keys -xkb_symbols "def_sk_us_rp" { - key <AC10> { - [ ocircumflex, quotedbl ], - [ semicolon, colon ] - }; - key <AD12> { - [ adiaeresis, parenleft ], - [ bracketright, braceright ] - }; - key <BKSL> { - [ ncaron, parenright ], - [ backslash, bar ] - }; -}; - -partial alphanumeric_keys -xkb_symbols "def_cz_us_rp" { - key <AC10> { - [ uring, quotedbl ], - [ semicolon, colon ] - }; - key <AD12> { - [ parenright, parenleft ], - [ bracketright, braceright ] - }; - key <BKSL> { - [ backslash, bar ], - [ backslash, bar ] - }; -}; - -partial alphanumeric_keys -xkb_symbols "def_us_sk_rp" { - key <AC10> { - [ semicolon, colon ], - [ ocircumflex, quotedbl ] - }; - key <AD12> { - [ bracketright, braceright ], - [ adiaeresis, parenleft ] - }; - key <BKSL> { - [ backslash, bar ], - [ ncaron, parenright ] - }; -}; - -partial alphanumeric_keys -xkb_symbols "def_us_cz_rp" { - key <AC10> { - [ semicolon, colon ], - [ uring, quotedbl ] - }; - key <AD12> { - [ bracketright, braceright ], - [ parenright, parenleft ] - }; - key <BKSL> { - [ backslash, bar ], - [ backslash, bar ] - }; -}; - -partial alphanumeric_keys -xkb_symbols "def_qwertz_us" { - key <AD06> { - [ z, Z ], - [ y, Y ] - }; - key <AB01> { - [ y, Y ], - [ z, Z ] - }; -}; - -partial alphanumeric_keys -xkb_symbols "def_us_qwertz" { - key <AD06> { - [ y, Y ], - [ z, Z ] - }; - key <AB01> { - [ z, Z ], - [ y, Y ] - }; -}; - -partial alphanumeric_keys -xkb_symbols "def_qwerty" { - key <AD06> { - [ y, Y ], - [ y, Y ] - }; - key <AB01> { - [ z, Z ], - [ z, Z ] - }; -}; - -partial alphanumeric_keys -xkb_symbols "def_us_sk_prog" { - key <TLDE> { - [ grave, asciitilde ], - [ dead_diaeresis, semicolon ] - }; - key <AE01> { - [ 1, exclam ], - [ plus, 1 ] - }; - key <AE02> { - [ 2, at ], - [ lcaron, 2 ] - }; - key <AE03> { - [ 3, numbersign ], - [ scaron, 3 ] - }; - key <AE04> { - [ 4, dollar ], - [ ccaron, 4 ] - }; - key <AE05> { - [ 5, percent ], - [ tcaron, 5 ] - }; - key <AE06> { - [ 6, asciicircum ], - [ zcaron, 6 ] - }; - key <AE07> { - [ 7, ampersand ], - [ yacute, 7 ] - }; - key <AE08> { - [ 8, asterisk ], - [ aacute, 8 ] - }; - key <AE09> { - [ 9, parenleft ], - [ iacute, 9 ] - }; - key <AE10> { - [ 0, parenright ], - [ eacute, 0 ] - }; - key <AE12> { - [ equal, plus ], - [ dead_acute, dead_caron ] - }; -}; - -partial alphanumeric_keys -xkb_symbols "def_us_cz_prog" { - key <TLDE> { - [ grave, asciitilde ], - [ dead_diaeresis, semicolon ] - }; - key <AE01> { - [ 1, exclam ], - [ plus, 1 ] - }; - key <AE02> { - [ 2, at ], - [ ecaron, 2 ] - }; - key <AE03> { - [ 3, numbersign ], - [ scaron, 3 ] - }; - key <AE04> { - [ 4, dollar ], - [ ccaron, 4 ] - }; - key <AE05> { - [ 5, percent ], - [ rcaron, 5 ] - }; - key <AE06> { - [ 6, asciicircum ], - [ zcaron, 6 ] - }; - key <AE07> { - [ 7, ampersand ], - [ yacute, 7 ] - }; - key <AE08> { - [ 8, asterisk ], - [ aacute, 8 ] - }; - key <AE09> { - [ 9, parenleft ], - [ iacute, 9 ] - }; - key <AE10> { - [ 0, parenright ], - [ eacute, 0 ] - }; - key <AE12> { - [ equal, plus ], - [ dead_acute, dead_caron ] - }; -}; - -partial alphanumeric_keys -xkb_symbols "def_sk_us_prog" { - key <TLDE> { - [ dead_diaeresis, semicolon ], - [ grave, asciitilde ] - }; - key <AE01> { - [ plus, 1 ], - [ 1, exclam ] - }; - key <AE02> { - [ lcaron, 2 ], - [ 2, at ] - }; - key <AE03> { - [ scaron, 3 ], - [ 3, numbersign ] - }; - key <AE04> { - [ ccaron, 4 ], - [ 4, dollar ] - }; - key <AE05> { - [ tcaron, 5 ], - [ 5, percent ] - }; - key <AE06> { - [ zcaron, 6 ], - [ 6, asciicircum ] - }; - key <AE07> { - [ yacute, 7 ], - [ 7, ampersand ] - }; - key <AE08> { - [ aacute, 8 ], - [ 8, asterisk ] - }; - key <AE09> { - [ iacute, 9 ], - [ 9, parenleft ] - }; - key <AE10> { - [ eacute, 0 ], - [ 0, parenright ] - }; - key <AE12> { - [ dead_acute, dead_caron ], - [ equal, plus ] - }; -}; - -partial alphanumeric_keys -xkb_symbols "def_cz_us_prog" { - key <TLDE> { - [ dead_diaeresis, semicolon ], - [ grave, asciitilde ] - }; - key <AE01> { - [ plus, 1 ], - [ 1, exclam ] - }; - key <AE02> { - [ ecaron, 2 ], - [ 2, at ] - }; - key <AE03> { - [ scaron, 3 ], - [ 3, numbersign ] - }; - key <AE04> { - [ ccaron, 4 ], - [ 4, dollar ] - }; - key <AE05> { - [ rcaron, 5 ], - [ 5, percent ] - }; - key <AE06> { - [ zcaron, 6 ], - [ 6, asciicircum ] - }; - key <AE07> { - [ yacute, 7 ], - [ 7, ampersand ] - }; - key <AE08> { - [ aacute, 8 ], - [ 8, asterisk ] - }; - key <AE09> { - [ iacute, 9 ], - [ 9, parenleft ] - }; - key <AE10> { - [ eacute, 0 ], - [ 0, parenright ] - }; - key <AE12> { - [ dead_acute, dead_caron ], - [ equal, plus ] - }; -}; Index: xc/programs/xkbcomp/symbols/de diff -u xc/programs/xkbcomp/symbols/de:3.8 xc/programs/xkbcomp/symbols/de:3.9 --- xc/programs/xkbcomp/symbols/de:3.8 Mon Jul 12 01:10:47 1999 +++ xc/programs/xkbcomp/symbols/de Wed Jan 17 18:45:57 2001 @@ -1,5 +1,10 @@ -// $XConsortium: de /main/4 1996/08/31 12:19:20 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/de,v 3.8 1999/07/12 05:10:47 dawes Exp $ +// $Xorg: de,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/de,v 3.9 2001/01/17 23:45:57 dawes Exp $ + default partial alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/de_CH diff -u xc/programs/xkbcomp/symbols/de_CH:3.4 xc/programs/xkbcomp/symbols/de_CH:3.5 --- xc/programs/xkbcomp/symbols/de_CH:3.4 Thu Jan 20 20:12:27 2000 +++ xc/programs/xkbcomp/symbols/de_CH Wed Jan 17 18:45:58 2001 @@ -1,5 +1,10 @@ -// $XConsortium: de_CH /main/3 1996/08/31 12:19:25 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/de_CH,v 3.4 2000/01/21 01:12:27 dawes Exp $ +// $Xorg: de_CH,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/de_CH,v 3.5 2001/01/17 23:45:58 dawes Exp $ + partial default alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/dk diff -u xc/programs/xkbcomp/symbols/dk:3.5 xc/programs/xkbcomp/symbols/dk:3.6 --- xc/programs/xkbcomp/symbols/dk:3.5 Fri Oct 27 14:31:08 2000 +++ xc/programs/xkbcomp/symbols/dk Wed Jan 17 18:45:58 2001 @@ -1,5 +1,10 @@ -// $XConsortium: dk /main/3 1996/08/31 12:19:29 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/dk,v 3.5 2000/10/27 18:31:08 dawes Exp $ +// $Xorg: dk,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/dk,v 3.6 2001/01/17 23:45:58 dawes Exp $ + partial alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/dvorak diff -u xc/programs/xkbcomp/symbols/dvorak:3.4 xc/programs/xkbcomp/symbols/dvorak:3.6 --- xc/programs/xkbcomp/symbols/dvorak:3.4 Mon Nov 27 00:06:46 2000 +++ xc/programs/xkbcomp/symbols/dvorak Mon Apr 23 16:31:09 2001 @@ -1,4 +1,4 @@ -// $XConsortium: dvorak /main/3 1996/08/31 12:19:32 kaleb $ +// $Xorg: dvorak,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ // symbols definition for a very simple dvorak layout. // It has basically the alphanumeric keys, punctuation, @@ -6,7 +6,7 @@ // uses the punctuation keys configurations common on PC // keyboards (e.g. key <ABO9> is { [ period greater ] }) -// $XFree86: xc/programs/xkbcomp/symbols/dvorak,v 3.4 2000/11/27 05:06:46 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/dvorak,v 3.6 2001/04/23 20:31:09 dawes Exp $ partial default alphanumeric_keys xkb_symbols "basic" { @@ -34,7 +34,7 @@ key <AE11> { [ bracketleft, braceleft ] }; key <AE12> { [ bracketright, braceright ], [ dead_tilde ] }; - key <BKSP> { [ BackSpace, Delete ] }; + key <BKSP> { [ BackSpace ] }; key <TAB> { [ Tab, ISO_Left_Tab ] }; key <AD01> { [ apostrophe, quotedbl ], Index: xc/programs/xkbcomp/symbols/el diff -u /dev/null xc/programs/xkbcomp/symbols/el:1.2 --- /dev/null Mon Jun 4 12:42:58 2001 +++ xc/programs/xkbcomp/symbols/el Fri Apr 6 13:44:58 2001 @@ -0,0 +1,96 @@ +// $XFree86: xc/programs/xkbcomp/symbols/el,v 1.2 2001/04/06 17:44:58 dawes Exp $ +// + +default partial alphanumeric_keys alternate_group +xkb_symbols "basic" { + + include "el(bare)" + + key <TLDE> { [], [ quoteleft, asciitilde ] }; + key <AE01> { [], [ 1, exclam ] }; + key <AE02> { [], [ 2, at ] }; + key <AE03> { [], [ 3, numbersign ] }; + key <AE04> { [], [ 4, dollar ] }; + key <AE05> { [], [ 5, percent ] }; + key <AE06> { [], [ 6, asciicircum ] }; + key <AE07> { [], [ 7, ampersand ] }; + key <AE08> { [], [ 8, asterisk ] }; + key <AE09> { [], [ 9, parenleft ] }; + key <AE10> { [], [ 0, parenright ] }; + key <AE11> { [], [ minus, underscore ] }; + key <AE12> { [], [ equal, plus ] }; + + key <AD11> { [], [ bracketleft, braceleft ] }; + key <AD12> { [], [ bracketright, braceright ] }; + + key <AC11> { [], [ quoteright, quotedbl ] }; + + key <AB08> { [], [ comma, less ] }; + key <AB09> { [], [ period, greater ] }; + key <AB10> { [], [ slash, question ] }; + key <BKSL> { [], [ backslash, bar ] }; + +}; + +hidden partial alphanumeric_keys alternate_group +xkb_symbols "bare" { + + name[Group2] = "ISO8859-7"; + + key <AD01> { [], [ semicolon, colon ] }; + key <AD02> { [], [ Greek_finalsmallsigma, Greek_SIGMA ] }; + key <AD03> { [], [ Greek_epsilon, Greek_EPSILON ] }; + key <AD04> { [], [ Greek_rho, Greek_RHO ] }; + key <AD05> { [], [ Greek_tau, Greek_TAU ] }; + key <AD06> { [], [ Greek_upsilon, Greek_UPSILON ] }; + key <AD07> { [], [ Greek_theta, Greek_THETA ] }; + key <AD08> { [], [ Greek_iota, Greek_IOTA ] }; + key <AD09> { [], [ Greek_omicron, Greek_OMICRON ] }; + key <AD10> { [], [ Greek_pi, Greek_PI ] }; + + key <AC01> { [], [ Greek_alpha, Greek_ALPHA ] }; + key <AC02> { [], [ Greek_sigma, Greek_SIGMA ] }; + key <AC03> { [], [ Greek_delta, Greek_DELTA ] }; + key <AC04> { [], [ Greek_phi, Greek_PHI ] }; + key <AC05> { [], [ Greek_gamma, Greek_GAMMA ] }; + key <AC06> { [], [ Greek_eta, Greek_ETA ] }; + key <AC07> { [], [ Greek_xi, Greek_XI ] }; + key <AC08> { [], [ Greek_kappa, Greek_KAPPA ] }; + key <AC09> { [], [ Greek_lamda, Greek_LAMDA ] }; + key <AC10> { [], [ dead_acute, dead_diaeresis ] }; + + key <AB01> { [], [ Greek_zeta, Greek_ZETA ] }; + key <AB02> { [], [ Greek_chi, Greek_CHI ] }; + key <AB03> { [], [ Greek_psi, Greek_PSI ] }; + key <AB04> { [], [ Greek_omega, Greek_OMEGA ] }; + key <AB05> { [], [ Greek_beta, Greek_BETA ] }; + key <AB06> { [], [ Greek_nu, Greek_NU ] }; + key <AB07> { [], [ Greek_mu, Greek_MU ] }; + + key <LSGT> { [], [ guillemotleft, guillemotright ] }; + +}; + +partial alphanumeric_keys alternate_group +xkb_symbols "Sundeadkeys" { + + include "el(basic)" + +}; + +partial alphanumeric_keys alternate_group +xkb_symbols "sundeadkeys" { + + include "el(Sundeadkeys)" + +}; + +partial alphanumeric_keys alternate_group +xkb_symbols "nodeadkeys" { + + include "el(basic)" + + key <AC10> { [], [ semicolon, colon ] }; + +}; + Index: xc/programs/xkbcomp/symbols/en_US diff -u xc/programs/xkbcomp/symbols/en_US:3.3 xc/programs/xkbcomp/symbols/en_US:3.4 --- xc/programs/xkbcomp/symbols/en_US:3.3 Sun Jun 22 05:53:19 1997 +++ xc/programs/xkbcomp/symbols/en_US Wed Jan 17 18:45:58 2001 @@ -1,4 +1,4 @@ -// $TOG: en_US /main/7 1997/06/14 06:37:05 kaleb $ +// $Xorg: en_US,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ partial hidden alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/es diff -u xc/programs/xkbcomp/symbols/es:3.4 xc/programs/xkbcomp/symbols/es:3.5 --- xc/programs/xkbcomp/symbols/es:3.4 Fri Oct 27 14:31:08 2000 +++ xc/programs/xkbcomp/symbols/es Wed Jan 17 18:45:58 2001 @@ -1,6 +1,10 @@ -// $XConsortium: es /main/3 1996/08/31 12:19:38 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/es,v 3.4 2000/10/27 18:31:08 dawes Exp $ +// $Xorg: es,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ + + + // Modified for a real Spanish Keyboard by Jon Tombs +// $XFree86: xc/programs/xkbcomp/symbols/es,v 3.5 2001/01/17 23:45:58 dawes Exp $ + partial default alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/fi diff -u xc/programs/xkbcomp/symbols/fi:3.5 xc/programs/xkbcomp/symbols/fi:3.6 --- xc/programs/xkbcomp/symbols/fi:3.5 Fri Oct 27 14:31:09 2000 +++ xc/programs/xkbcomp/symbols/fi Wed Jan 17 18:45:58 2001 @@ -1,5 +1,10 @@ -// $XConsortium: fi /main/3 1996/08/31 12:19:29 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/fi,v 3.5 2000/10/27 18:31:09 dawes Exp $ +// $Xorg: fi,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/fi,v 3.6 2001/01/17 23:45:58 dawes Exp $ + partial alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/fr diff -u xc/programs/xkbcomp/symbols/fr:3.5 xc/programs/xkbcomp/symbols/fr:3.6 --- xc/programs/xkbcomp/symbols/fr:3.5 Fri Oct 27 14:31:09 2000 +++ xc/programs/xkbcomp/symbols/fr Wed Jan 17 18:45:58 2001 @@ -1,5 +1,10 @@ -// $XConsortium: fr /main/3 1996/08/31 12:19:45 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/fr,v 3.5 2000/10/27 18:31:09 dawes Exp $ +// $Xorg: fr,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/fr,v 3.6 2001/01/17 23:45:58 dawes Exp $ + partial default alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/fr_CH diff -u xc/programs/xkbcomp/symbols/fr_CH:3.4 xc/programs/xkbcomp/symbols/fr_CH:3.5 --- xc/programs/xkbcomp/symbols/fr_CH:3.4 Thu Jan 20 20:12:27 2000 +++ xc/programs/xkbcomp/symbols/fr_CH Wed Jan 17 18:45:58 2001 @@ -1,5 +1,10 @@ -// $XConsortium: fr_CH /main/3 1996/08/31 12:19:48 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/fr_CH,v 3.4 2000/01/21 01:12:27 dawes Exp $ +// $Xorg: fr_CH,v 1.3 2000/08/17 19:54:42 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/fr_CH,v 3.5 2001/01/17 23:45:58 dawes Exp $ + partial default alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/gb diff -u xc/programs/xkbcomp/symbols/gb:3.3 xc/programs/xkbcomp/symbols/gb:3.4 --- xc/programs/xkbcomp/symbols/gb:3.3 Mon Dec 23 02:13:25 1996 +++ xc/programs/xkbcomp/symbols/gb Wed Jan 17 18:45:58 2001 @@ -1,5 +1,10 @@ -// $XConsortium: gb /main/3 1996/08/31 12:19:51 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/gb,v 3.3 1996/12/23 07:13:25 dawes Exp $ +// $Xorg: gb,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/gb,v 3.4 2001/01/17 23:45:58 dawes Exp $ + partial default alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/gr diff -u xc/programs/xkbcomp/symbols/gr:1.2 xc/programs/xkbcomp/symbols/gr:removed --- xc/programs/xkbcomp/symbols/gr:1.2 Fri Oct 27 20:34:06 2000 +++ xc/programs/xkbcomp/symbols/gr Mon Jun 4 12:42:58 2001 @@ -1,83 +0,0 @@ -// $XConsortium: gr /main/3 1997/12/18 12:40:12 rch $ -// -// $XFree86: xc/programs/xkbcomp/symbols/gr,v 1.2 2000/10/28 00:34:06 dawes Exp $ - -partial default alphanumeric_keys -xkb_symbols "basic" { - - // Describes the differences between a very simple en_US - // keyboard and a very simple Greek keyboard - - name[Group1]= "US/ASCII"; - name[Group2]= "Greek"; - - key <LSGT> { [ less, greater ], - [ bar, brokenbar ] }; - - key <AD01> { [ q, Q ], - [ semicolon, colon ] }; - key <AD02> { [ w, W ], - [ Greek_finalsmallsigma, dead_circumflex ]}; - key <AD03> { [ e, E ], - [ Greek_epsilon, Greek_EPSILON ] }; - key <AD04> { [ r, R ], - [ Greek_rho, Greek_rho ] }; - key <AD05> { [ t, T ], - [ Greek_tau, Greek_TAU ] }; - key <AD06> { [ y, Y ], - [ Greek_upsilon, Greek_UPSILON ] }; - key <AD07> { [ u, U ], - [ Greek_theta, Greek_THETA ] }; - key <AD08> { [ i, I ], - [ Greek_iota, Greek_IOTA ] }; - key <AD09> { [ o, O ], - [ Greek_omicron, Greek_OMICRON ] }; - key <AD10> { [ p, P ], - [ Greek_pi, Greek_PI ] }; - - key <AC01> { [ a, A ], - [ Greek_alpha, Greek_ALPHA ] }; - key <AC02> { [ s, S ], - [ Greek_sigma, Greek_SIGMA ] }; - key <AC03> { [ d, D ], - [ Greek_delta, Greek_DELTA ] }; - key <AC04> { [ f, F ], - [ Greek_phi, Greek_PHI ] }; - key <AC05> { [ g, G ], - [ Greek_gamma, Greek_GAMMA ] }; - key <AC06> { [ h, H ], - [ Greek_eta, Greek_ETA ] }; - key <AC07> { [ j, J ], - [ Greek_xi, Greek_XI ] }; - key <AC08> { [ k, K ], - [ Greek_kappa, Greek_KAPPA ] }; - key <AC09> { [ l, L ], - [ Greek_lamda, Greek_LAMDA ] }; - key <AC10> { [ semicolon, colon ], - [ dead_acute, dead_diaeresis ] }; - key <AC11> { [ apostrophe, quotedbl ] }; - - key <AB01> { [ z, Z ], - [ Greek_zeta, Greek_ZETA ] }; - key <AB02> { [ x, X ], - [ Greek_chi, Greek_CHI ] }; - key <AB03> { [ c, C ], - [ Greek_psi, Greek_PSI ] }; - key <AB04> { [ v, V ], - [ Greek_omega, Greek_OMEGA ] }; - key <AB05> { [ b, B ], - [ Greek_beta, Greek_BETA ] }; - key <AB06> { [ n, N ], - [ Greek_nu, Greek_NU ] }; - key <AB07> { [ m, M ], - [ Greek_mu, Greek_MU ] }; - - // Begin modifier mappings - - modifier_map Shift { Shift_L }; - modifier_map Lock { Caps_Lock, ISO_Lock }; - modifier_map Control{ Control_L }; - modifier_map Mod3 { Mode_switch }; -}; - - Index: xc/programs/xkbcomp/symbols/group diff -u xc/programs/xkbcomp/symbols/group:3.4 xc/programs/xkbcomp/symbols/group:3.5 --- xc/programs/xkbcomp/symbols/group:3.4 Mon Nov 6 14:24:10 2000 +++ xc/programs/xkbcomp/symbols/group Wed Jan 17 18:45:58 2001 @@ -1,8 +1,8 @@ -// $TOG: group /main/3 1997/06/13 06:25:02 kaleb $ +// $Xorg: group,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ // using the group(switch) map, the right alt key temporarily chooses // the second keyboard group (until it is released). // -// $XFree86: xc/programs/xkbcomp/symbols/group,v 3.4 2000/11/06 19:24:10 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/group,v 3.5 2001/01/17 23:45:58 dawes Exp $ partial modifier_keys xkb_symbols "switch" { key <RALT> { Index: xc/programs/xkbcomp/symbols/hr diff -u /dev/null xc/programs/xkbcomp/symbols/hr:1.1 --- /dev/null Mon Jun 4 12:42:58 2001 +++ xc/programs/xkbcomp/symbols/hr Fri May 11 04:50:19 2001 @@ -0,0 +1,97 @@ +// Croatian keyboards +// by Vlatko Kosturjak (kost@iname.com) +// Taken from Slovenian keyboards +// by Marko Samastur (markos@elite.org) and +// Primoz Peterlin (primoz.peterlin@biofiz.mf.uni-lj.si) +// Last change: 6.2.2000 +// xc/programs/xkbcomp/symbols/hr +// $XFree86: xc/programs/xkbcomp/symbols/hr,v 1.1 2001/05/11 08:50:19 alanh Exp $ + +default partial alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple US/ASCII + // keyboard and a Slovenian keybaord + // by Marko Samastur (markos@elite.org) + + // Alphanumeric section + name[Group1]= "Croatian"; + key <TLDE> { [ dead_cedilla, dead_diaeresis ] }; + key <AE01> { [ 1, exclam ], + [ asciitilde, dead_tilde ] }; + key <AE02> { [ 2, quotedbl ], + [ dead_caron, caron ] }; + key <AE03> { [ 3, numbersign ], + [ asciicircum, dead_circumflex ] }; + key <AE04> { [ 4, dollar ], + [ dead_breve, breve ] }; + key <AE05> { [ 5, percent ], + [ degree, dead_abovering ] }; + key <AE06> { [ 6, ampersand ], + [ dead_ogonek, ogonek ] }; + key <AE07> { [ 7, slash ], + [ quoteleft, dead_grave ] }; + key <AE08> { [ 8, parenleft ], + [ dead_abovedot, abovedot ] }; + key <AE09> { [ 9, parenright ], + [ dead_acute, quoteright ] }; + key <AE10> { [ 0, equal ], + [ dead_doubleacute, doubleacute ] }; + key <AE11> { [ apostrophe, question ], + [ dead_diaeresis, diaeresis ] }; + key <AE12> { [ plus, asterisk ], + [ dead_cedilla, cedilla ] }; + + key <AD01> { [ q, Q ], + [ backslash ] }; + key <AD02> { [ w, W ], + [ bar ] }; + key <AD03> { [ e, E ], + [ EuroSign ] }; + key <AD05> { [ t, T ] }; + key <AD06> { [ z, Z ] }; + key <AD07> { [ u, U ] }; + key <AD08> { [ i, I ] }; + key <AD11> { [ scaron, Scaron ], + [ division ] }; + key <AD12> { [ dstroke, Dstroke ], + [ multiply, dead_macron ] }; + key <AC04> { [ f, F ], + [ bracketleft ] }; + key <AC05> { [ g, G ], + [ bracketright ] }; + key <AC08> { [ k, K ], + [ lstroke ] }; + key <AC09> { [ l, L ], + [ Lstroke ] }; + key <AC10> { [ ccaron, Ccaron ] }; + key <AC11> { [ cacute, Cacute ], + [ ssharp ] }; + + key <LSGT> { [ less, greater ], + [ bar ] }; + key <AB01> { [ y, Y ] }; + key <AB04> { [ v, V ], + [ at ] }; + key <AB05> { [ b, B ], + [ braceleft ] }; + key <AB06> { [ n, N ], + [ braceright ] }; + key <AB07> { [ m, M ], + [ section ] }; + key <AB08> { [ comma, semicolon ] }; + key <AB09> { [ period, colon ], + [ periodcentered ] }; + key <AB10> { [ minus, underscore ] }; + key <BKSL> { [ zcaron, Zcaron ], + [ currency ] }; + key <RALT> { [ Mode_switch, Multi_key ] }; + + // End alphanumeric section + + // begin modifier mappings + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock }; + modifier_map Control{ Control_L }; + modifier_map Mod3 { Mode_switch }; +}; Index: xc/programs/xkbcomp/symbols/hu diff -u xc/programs/xkbcomp/symbols/hu:1.3 xc/programs/xkbcomp/symbols/hu:1.5 --- xc/programs/xkbcomp/symbols/hu:1.3 Mon Aug 28 11:29:24 2000 +++ xc/programs/xkbcomp/symbols/hu Thu Apr 26 12:23:13 2001 @@ -1,103 +1,432 @@ -// $XFree86: xc/programs/xkbcomp/symbols/hu,v 1.3 2000/08/28 15:29:24 dawes Exp $ +// Hungarian keyboard symbols for XKB and PC keyboard +// +// (C) 2001 Peter Soos <sp@osb.hu> +// +// Permission is granted to anyone to use, distribute and modify +// this file in any way, provided that the above copyright notice +// is left intact and the author of the modification summarizes +// the changes in this header. +// +// This file is distributed without any expressed or implied warranty. +// +// It describes the differences between a very simple US/ASCII keyboard +// layout and some widely used Hungarian keyboard layouts. +// Tested on Linux with XFree86 3.3.6 +// +// $XFree86: xc/programs/xkbcomp/symbols/hu,v 1.5 2001/04/26 16:23:13 dawes Exp $ + + +// Default layout +default partial +xkb_symbols "default" { + include "hu(uni_102_qwertz_comma)" +}; + +// Standard layout +partial +xkb_symbols "standard" { + include "hu(uni_102_qwertz_comma)" +}; + +// Main layouts -default partial alphanumeric_keys -xkb_symbols "basic" { +// l2_101_qwertz_comma: +// ISO-8859-2 (Latin 2) based 101 key qwertz layout with decimal comma on keypad +// You have to set your locale settings to ISO-8859-1 based settings +// or unset them. +partial +xkb_symbols "l2_101_qwertz_comma" { + name[Group1] = "Hungarian"; + include "hu(def_l2)" + include "hu(def_101)" + include "hu(def_qwertz)" + include "hu(def_comma)" + include "hu(def_common)" +}; + +// l2_101_qwertz_dot: +// ISO-8859-2 (Latin 2) based 101 key qwertz layout with decimal dot on keypad +// You have to set your locale settings to ISO-8859-1 based settings +// or unset them. +partial +xkb_symbols "l2_101_qwertz_dot" { + name[Group1] = "Hungarian"; + include "hu(def_l2)" + include "hu(def_101)" + include "hu(def_qwertz)" + include "hu(def_dot)" + include "hu(def_common)" +}; - // Describes the differences between a very simple US/ASCII - // keyboard and a very simple Hungarian keybaord using the - // (recommended) Hungarian locale (hu_HU). - // You have to set your locale settings (at least LC_CTYPE) - // to hu_HU. If you have to use another locale (eg. us) try - // the hu_US xkb file. - // Peter Soos <sp@osb.hu> +// l2_101_qwerty_comma: +// ISO-8859-2 (Latin 2) based 101 key qwerty layout with decimal comma on keypad +// You have to set your locale settings to ISO-8859-1 based settings +// or unset them. +partial +xkb_symbols "l2_101_qwerty_comma" { + name[Group1] = "Hungarian"; + include "hu(def_l2)" + include "hu(def_101)" + include "hu(def_qwerty)" + include "hu(def_comma)" + include "hu(def_common)" +}; +// l2_101_qwerty_dot: +// ISO-8859-2 (Latin 2) based 101 key qwerty layout with decimal dot on keypad +// You have to set your locale settings to ISO-8859-1 based settings +// or unset them. +partial +xkb_symbols "l2_101_qwerty_dot" { + name[Group1] = "Hungarian"; + include "hu(def_l2)" + include "hu(def_101)" + include "hu(def_qwerty)" + include "hu(def_dot)" + include "hu(def_common)" +}; + +// l2_102_qwertz_comma: +// ISO-8859-2 (Latin 2) based 102 key qwertz layout with decimal comma on keypad +// You have to set your locale settings to ISO-8859-1 based settings +// or unset them. +partial +xkb_symbols "l2_102_qwertz_comma" { + name[Group1] = "Hungarian"; + include "hu(def_l2)" + include "hu(def_102)" + include "hu(def_qwertz)" + include "hu(def_comma)" + include "hu(def_common)" +}; + +// l2_102_qwertz_dot: +// ISO-8859-2 (Latin 2) based 102 key qwertz layout with decimal dot on keypad +// You have to set your locale settings to ISO-8859-1 based settings +// or unset them. +partial +xkb_symbols "l2_102_qwertz_dot" { + name[Group1] = "Hungarian"; + include "hu(def_l2)" + include "hu(def_102)" + include "hu(def_qwertz)" + include "hu(def_dot)" + include "hu(def_common)" +}; + +// l2_102_qwerty_comma: +// ISO-8859-2 (Latin 2) based 102 key qwerty layout with decimal comma on keypad +// You have to set your locale settings to ISO-8859-1 based settings +// or unset them. +partial +xkb_symbols "l2_102_qwerty_comma" { + name[Group1] = "Hungarian"; + include "hu(def_l2)" + include "hu(def_102)" + include "hu(def_qwerty)" + include "hu(def_comma)" + include "hu(def_common)" +}; + +// l2_102_qwerty_dot: +// ISO-8859-2 (Latin 2) based 102 key qwerty layout with decimal dot on keypad +// You have to set your locale settings to ISO-8859-1 based settings +// or unset them. +partial +xkb_symbols "l2_102_qwerty_dot" { + name[Group1] = "Hungarian"; + include "hu(def_l2)" + include "hu(def_102)" + include "hu(def_qwerty)" + include "hu(def_dot)" + include "hu(def_common)" +}; + +// uni_101_qwertz_comma: +// Unicode based 101 key qwertz layout with decimal comma on keypad +// You have to set your locale settings (at least LC_CTYPE) to hu_HU. +partial +xkb_symbols "uni_101_qwertz_comma" { + name[Group1] = "Hungarian"; + include "hu(def_uni)" + include "hu(def_101)" + include "hu(def_qwertz)" + include "hu(def_comma)" + include "hu(def_common)" +}; + +// uni_101_qwertz_dot: +// Unicode based 101 key qwertz layout with decimal dot on keypad +// You have to set your locale settings (at least LC_CTYPE) to hu_HU. +partial +xkb_symbols "uni_101_qwertz_dot" { + name[Group1] = "Hungarian"; + include "hu(def_uni)" + include "hu(def_101)" + include "hu(def_qwertz)" + include "hu(def_dot)" + include "hu(def_common)" +}; + +// uni_101_qwerty_comma: +// Unicode based 101 key qwerty layout with decimal comma on keypad +// You have to set your locale settings (at least LC_CTYPE) to hu_HU. +partial +xkb_symbols "uni_101_qwerty_comma" { + name[Group1] = "Hungarian"; + include "hu(def_uni)" + include "hu(def_101)" + include "hu(def_qwerty)" + include "hu(def_comma)" + include "hu(def_common)" +}; + +// uni_101_qwerty_dot: +// Unicode based 101 key qwerty layout with decimal dot on keypad +// You have to set your locale settings (at least LC_CTYPE) to hu_HU. +partial +xkb_symbols "uni_101_qwerty_dot" { + name[Group1] = "Hungarian"; + include "hu(def_uni)" + include "hu(def_101)" + include "hu(def_qwerty)" + include "hu(def_dot)" + include "hu(def_common)" +}; + +// uni_102_qwertz_comma: +// Unicode based 102 key qwertz layout with decimal comma on keypad +// You have to set your locale settings (at least LC_CTYPE) to hu_HU. +partial +xkb_symbols "uni_102_qwertz_comma" { + name[Group1] = "Hungarian"; + include "hu(def_uni)" + include "hu(def_102)" + include "hu(def_qwertz)" + include "hu(def_comma)" + include "hu(def_common)" +}; + +// uni_102_qwertz_dot: +// Unicode based 102 key qwertz layout with decimal dot on keypad +// You have to set your locale settings (at least LC_CTYPE) to hu_HU. +partial +xkb_symbols "uni_102_qwertz_dot" { + name[Group1] = "Hungarian"; + include "hu(def_uni)" + include "hu(def_102)" + include "hu(def_qwertz)" + include "hu(def_dot)" + include "hu(def_common)" +}; + +// uni_102_qwerty_comma: +// Unicode based 102 key qwerty layout with decimal comma on keypad +// You have to set your locale settings (at least LC_CTYPE) to hu_HU. +partial +xkb_symbols "uni_102_qwerty_comma" { + name[Group1] = "Hungarian"; + include "hu(def_uni)" + include "hu(def_102)" + include "hu(def_qwerty)" + include "hu(def_comma)" + include "hu(def_common)" +}; + +// uni_102_qwerty_dot: +// Unicode based 102 key qwerty layout with decimal dot on keypad +// You have to set your locale settings (at least LC_CTYPE) to hu_HU. +partial +xkb_symbols "uni_102_qwerty_dot" { + name[Group1] = "Hungarian"; + include "hu(def_uni)" + include "hu(def_102)" + include "hu(def_qwerty)" + include "hu(def_dot)" + include "hu(def_common)" +}; + +// Partial layouts + +// def_uni: +// Unicode based Hungarian keybaord using the (recommended) Hungarian +// locale (hu_HU). +// This is the standard setting for Hungarian, but some applications +// (e.g. LyX, Applixware) does not support this setting. In this case try +// hu(l2_*_*). +// You have to set your locale settings (at least LC_CTYPE) to hu_HU. +// If you have to use another locale (eg. us) try the hu(l2_*_*). + +hidden partial alphanumeric_keys +xkb_symbols "def_uni" { + + key <AC02> { [ s, S ], + [ dstroke ] }; + key <AC03> { [ d, D ], + [ Dstroke ] }; + key <AC08> { [ k, K ], + [ lstroke ] }; + key <AC09> { [ l, L ], + [ Lstroke ] }; + key <AD11> { [ odoubleacute, Odoubleacute ], + [ division ] }; + key <BKSL> { [ udoubleacute, Udoubleacute ], + [ currency ] }; +}; + +// def_l2: +// Hungarian keybaord used with us or another ISO-8859-1 based locale +// settings resulting 8 bit compatible, ISO-8859-2 (Latin 2) compatible +// layout for some applications (e.g. LyX, Applixware) wich unable to +// handle Unicode based keysyms. +// If you use the standard Hungarian locale (hu_HU) use the hu(uni_*_*) +// instead. + +hidden partial alphanumeric_keys +xkb_symbols "def_l2" { + key <AC02> { [ s, S ], + [ eth ] }; + key <AC03> { [ d, D ], + [ Eth ] }; + key <AC08> { [ k, K ], + [ threesuperior ] }; + key <AC09> { [ l, L ], + [ sterling ] }; + key <AD11> { [ otilde, Otilde ], + [ division ] }; + key <BKSL> { [ ucircumflex, Ucircumflex ], + [ currency ] }; +}; + +// def_102: +// The standard Hungarian 102 key layout + +hidden partial alphanumeric_keys +xkb_symbols "def_102" { + key <TLDE> { [ 0, section ], + [ notsign ] }; + key <AB07> { [ m, M ] }; + key <AB09> { [ period, colon ] }; +}; + +// def_101: +// An alternative layout for 101 key keyboards + +hidden partial alphanumeric_keys +xkb_symbols "def_101" { + key <TLDE> { [ iacute, Iacute ], + [ 0, section ] }; + key <AB07> { [ m, M ], + [ less ] }; + key <AB09> { [ period, colon ], + [ greater ] }; +}; + +// def_qwertz: +// The standard Hungaryan qwertz layout + +hidden partial alphanumeric_keys +xkb_symbols "def_qwertz" { + key <AB01> { [ y, Y ], + [ greater ] }; + key <AD06> { [ z, Z ] }; +}; + +// def_qwerty: +// The qwerty layout for people who familiar with the standard US layout + +hidden partial alphanumeric_keys +xkb_symbols "def_qwerty" { + key <AB01> { [ z, Z ], + [ greater ] }; + key <AD06> { [ y, Y ] }; +}; + +// def_comma: +// The Hungarian standard is the comma on the keypad not decimal dot +hidden partial keypad_keys +xkb_symbols "def_comma" { + key <KPDL> { [ KP_Delete, comma ] }; +}; + +// def_dot: +// The Hungarian standard is the comma on the keypad not decimal dot, +// but programmers hate it +hidden partial keypad_keys +xkb_symbols "def_dot" { + key <KPDL> { [ KP_Delete, KP_Decimal ] }; +}; + +// def_common: +// The common part of all Hungarian layout above +hidden partial alphanumeric_keys modifier_keys +xkb_symbols "def_common" { + // Alphanumeric section - name[Group1]= "Hungarian"; - key <TLDE> { [ 0, section ], - [ notsign ] }; - key <AE01> { [ 1, apostrophe ], - [ asciitilde, dead_tilde ] }; - key <AE02> { [ 2, quotedbl ], - [ caron, dead_caron ] }; - key <AE03> { [ 3, plus ], - [ asciicircum, dead_circumflex ] }; - key <AE04> { [ 4, exclam ], - [ breve, dead_breve ] }; - key <AE05> { [ 5, percent ], - [ degree, dead_abovering ] }; - key <AE06> { [ 6, slash ], - [ ogonek, dead_ogonek ] }; - key <AE07> { [ 7, equal ], - [ grave, dead_grave ] }; - key <AE08> { [ 8, parenleft ], - [ abovedot, dead_abovedot ] }; - key <AE09> { [ 9, parenright ], - [ acute, dead_acute ] }; - key <AE10> { [ odiaeresis, Odiaeresis ], - [ doubleacute, dead_doubleacute ] }; - key <AE11> { [ udiaeresis, Udiaeresis ], - [ diaeresis, dead_diaeresis ] }; - key <AE12> { [ oacute, Oacute ], - [ cedilla, dead_cedilla ] }; - - key <AD01> { [ q, Q ], - [ backslash ] }; - key <AD02> { [ w, W ], - [ bar ] }; - key <AD06> { [ z, Z ] }; - key <AD08> { [ i, I ], - [ Iacute ] }; - key <AD11> { [ odoubleacute, Odoubleacute ], - [ division ] }; -// key <AD11> { [ otilde, Otilde ], -// [ division ] }; - key <AD12> { [ uacute, Uacute ], - [ multiply ] }; - - key <AC02> { [ s, S ], - [ dstroke ] }; - key <AC03> { [ d, D ], - [ Dstroke ] }; - key <AC04> { [ f, F ], - [ bracketleft ] }; - key <AC05> { [ g, G ], - [ bracketright ] }; - key <AC07> { [ j, J ], - [ iacute ] }; - key <AC08> { [ k, K ], - [ lstroke ] }; - key <AC09> { [ l, L ], - [ Lstroke ] }; - key <AC10> { [ eacute, Eacute ], - [ dollar ] }; - key <AC11> { [ aacute, Aacute ], - [ ssharp ] }; - - key <LSGT> { [ iacute, Iacute ], - [ less ] }; - key <AB01> { [ y, Y ], - [ greater ] }; - key <AB02> { [ x, X ], - [ numbersign ] }; - key <AB03> { [ c, C ], - [ ampersand ] }; - key <AB04> { [ v, V ], - [ at ] }; - key <AB05> { [ b, B ], - [ braceleft ] }; - key <AB06> { [ n, N ], - [ braceright ] }; - key <AB08> { [ comma, question ], - [ semicolon ] }; - key <AB09> { [ period, colon ] }; - key <AB10> { [ minus, underscore ], - [ asterisk ] }; -// key <BKSL> { [ ucircumflex, Ucircumflex ], -// [ currency ] }; - key <BKSL> { [ udoubleacute, Udoubleacute ], - [ currency ] }; - key <RALT> { [ Mode_switch, Multi_key ] }; - key <LALT> { [ Alt_L, Meta_L ] }; + key <AE01> { [ 1, apostrophe ], + [ asciitilde, dead_tilde ] }; + key <AE02> { [ 2, quotedbl ], + [ dead_caron, caron ] }; + key <AE03> { [ 3, plus ], + [ asciicircum, dead_circumflex ] }; + key <AE04> { [ 4, exclam ], + [ dead_breve, breve ] }; + key <AE05> { [ 5, percent ], + [ dead_abovering, degree ] }; + key <AE06> { [ 6, slash ], + [ dead_ogonek, ogonek ] }; + key <AE07> { [ 7, equal ], + [ grave, dead_grave ] }; + key <AE08> { [ 8, parenleft ], + [ dead_abovedot, degree ] }; + key <AE09> { [ 9, parenright ], + [ dead_acute, acute ] }; + key <AE10> { [ odiaeresis, Odiaeresis ], + [ dead_doubleacute, doubleacute ] }; + key <AE11> { [ udiaeresis, Udiaeresis ], + [ dead_diaeresis, diaeresis ] }; + key <AE12> { [ oacute, Oacute ], + [ dead_cedilla, cedilla ] }; + + key <AD01> { [ q, Q ], + [ backslash ] }; + key <AD02> { [ w, W ], + [ bar ] }; + key <AD08> { [ i, I ], + [ Iacute ] }; + key <AD12> { [ uacute, Uacute ], + [ multiply ] }; + + key <AC04> { [ f, F ], + [ bracketleft ] }; + key <AC05> { [ g, G ], + [ bracketright ] }; + key <AC07> { [ j, J ], + [ iacute ] }; + key <AC10> { [ eacute, Eacute ], + [ dollar ] }; + key <AC11> { [ aacute, Aacute ], + [ ssharp ] }; + + key <LSGT> { [ iacute, Iacute ], + [ less ] }; + key <AB02> { [ x, X ], + [ numbersign ] }; + key <AB03> { [ c, C ], + [ ampersand ] }; + key <AB04> { [ v, V ], + [ at ] }; + key <AB05> { [ b, B ], + [ braceleft ] }; + key <AB06> { [ n, N ], + [ braceright ] }; + key <AB08> { [ comma, question ], + [ semicolon ] }; + key <AB09> { [ period, colon ] }; + key <AB10> { [ minus, underscore ], + [ asterisk ] }; + key <RALT> { [ Mode_switch, Multi_key ] }; + key <LALT> { [ Alt_L, Meta_L ] }; // End alphanumeric section @@ -108,44 +437,43 @@ modifier_map Mod3 { Mode_switch }; }; -partial alphanumeric_keys +partial xkb_symbols "Sundeadkeys" { - include "hu(basic)" // for consistent naming + include "hu(default)" // for consistent naming }; -partial alphanumeric_keys +partial xkb_symbols "sundeadkeys" { include "hu(Sundeadkeys)" // for consistent naming }; -partial alphanumeric_keys +partial xkb_symbols "nodeadkeys" { // modify the default Hungarian layout to not have any dead keys - include "hu(basic)" - key <AE01> { [ 1, apostrophe ], - [ asciitilde ] }; - key <AE02> { [ 2, quotedbl ], - [ caron ] }; - key <AE03> { [ 3, plus ], - [ asciicircum ] }; - key <AE04> { [ 4, exclam ], - [ breve ] }; - key <AE05> { [ 5, percent ], - [ degree ] }; - key <AE06> { [ 6, slash ], - [ ogonek ] }; - key <AE07> { [ 7, equal ], - [ grave ] }; - key <AE08> { [ 8, parenleft ], - [ abovedot ] }; - key <AE09> { [ 9, parenright ], - [ acute ] }; - key <AE10> { [ odiaeresis, Odiaeresis ], - [ doubleacute ] }; - key <AE11> { [ udiaeresis, Udiaeresis ], - [ diaeresis ] }; - key <AE12> { [ oacute, Oacute ], - [ cedilla ] }; + include "hu(default)" + key <AE01> { [ 1, apostrophe ], + [ asciitilde ] }; + key <AE02> { [ 2, quotedbl ], + [ caron ] }; + key <AE03> { [ 3, plus ], + [ asciicircum ] }; + key <AE04> { [ 4, exclam ], + [ breve ] }; + key <AE05> { [ 5, percent ], + [ degree ] }; + key <AE06> { [ 6, slash ], + [ ogonek ] }; + key <AE07> { [ 7, equal ], + [ grave ] }; + key <AE08> { [ 8, parenleft ], + [ abovedot ] }; + key <AE09> { [ 9, parenright ], + [ acute ] }; + key <AE10> { [ odiaeresis, Odiaeresis ], + [ doubleacute ] }; + key <AE11> { [ udiaeresis, Udiaeresis ], + [ diaeresis ] }; + key <AE12> { [ oacute, Oacute ], + [ cedilla ] }; }; - Index: xc/programs/xkbcomp/symbols/il diff -u xc/programs/xkbcomp/symbols/il:1.2 xc/programs/xkbcomp/symbols/il:1.3 --- xc/programs/xkbcomp/symbols/il:1.2 Fri Oct 27 20:34:06 2000 +++ xc/programs/xkbcomp/symbols/il Mon Feb 12 13:25:59 2001 @@ -1,93 +1,75 @@ // $XConsortium: il /main/3 1997/12/18 12:40:12 rch $ // -// $XFree86: xc/programs/xkbcomp/symbols/il,v 1.2 2000/10/28 00:34:06 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/il,v 1.3 2001/02/12 18:25:59 paulo Exp $ + partial default alphanumeric_keys xkb_symbols "basic" { - // Describes the differences between a very simple en_US + // Describes the differences between a very simple us // keyboard and a very simple Israelian keyboard - // uses the kbd layout in use in Israel + // uses the kbd layout in use in Israel. - name[Group1]= "US/ASCII"; name[Group2]= "Israelian"; - key <TLDE> { [ grave, asciitilde ], - [ semicolon, asciitilde ] }; + key <TLDE> {[], [ semicolon, asciitilde ] }; - key <AD01> { [ q, Q ], - [ slash, Q ] }; - key <AD02> { [ w, W ], - [apostrophe, W ] }; - key <AD03> { [ e, E ], - [ hebrew_qoph, E ] }; - key <AD04> { [ r, R ], - [ hebrew_resh, R ] }; - key <AD05> { [ t, T ], - [ hebrew_aleph, T ] }; - key <AD06> { [ y, Y ], - [ hebrew_tet, Y ] }; - key <AD07> { [ u, U ], - [ hebrew_waw, U ] }; - key <AD08> { [ i, I ], - [ hebrew_finalnun, I ] }; - key <AD09> { [ o, O ], - [ hebrew_finalmem, O ] }; - key <AD10> { [ p, P ], - [ hebrew_pe, P ] }; - - key <AC01> { [ a, A ], - [ hebrew_shin, A ] }; - key <AC02> { [ s, S ], - [ hebrew_dalet, S ] }; - key <AC03> { [ d, D ], - [ hebrew_gimel, D ] }; - key <AC04> { [ f, F ], - [ hebrew_kaph, F ] }; - key <AC05> { [ g, G ], - [ hebrew_ayin, G ] }; - key <AC06> { [ h, H ], - [ hebrew_yod, H ] }; - key <AC07> { [ j, J ], - [ hebrew_chet, J ] }; - key <AC08> { [ k, K ], - [ hebrew_lamed, K ] }; - key <AC09> { [ l, L ], - [ hebrew_finalkaph, L ] }; - key <AC10> { [ semicolon, colon ], - [ hebrew_finalpe, colon ] }; - key <AC11> { [ apostrophe, quotedbl ], - [ comma, quotedbl ] }; - - key <AB01> { [ z, Z ], - [ hebrew_zain, Z ] }; - key <AB02> { [ x, X ], - [ hebrew_samech, X ] }; - key <AB03> { [ c, C ], - [ hebrew_bet, C ] }; - key <AB04> { [ v, V ], - [ hebrew_he, V ] }; - key <AB05> { [ b, B ], - [ hebrew_nun, B ] }; - key <AB06> { [ n, N ], - [ hebrew_mem, N ] }; - key <AB07> { [ m, M ], - [ hebrew_zade, M ] }; - key <AB08> { [ comma, less ], - [ hebrew_taw, less ] }; - key <AB09> { [ period, greater ], - [ hebrew_finalzade, greater ] }; - key <AB10> { [ slash, question ], - [ period, question ] }; - - // Begin modifier mappings - - modifier_map Shift { Shift_L }; - modifier_map Lock { Caps_Lock, ISO_Lock }; - modifier_map Control{ Control_L }; - modifier_map Mod3 { Mode_switch }; -}; + key <AD01> {[], [ slash, Q ] }; + key <AD02> {[], [ apostrophe, W ] }; + key <AD03> {[], [ hebrew_qoph, E ] }; + key <AD04> {[], [ hebrew_resh, R ] }; + key <AD05> {[], [ hebrew_aleph, T ] }; + key <AD06> {[], [ hebrew_tet, Y ] }; + key <AD07> {[], [ hebrew_waw, U ] }; + key <AD08> {[], [ hebrew_finalnun, I ] }; + key <AD09> {[], [ hebrew_finalmem, O ] }; + key <AD10> {[], [ hebrew_pe, P ] }; + + key <AC01> {[], [ hebrew_shin, A ] }; + key <AC02> {[], [ hebrew_dalet, S ] }; + key <AC03> {[], [ hebrew_gimel, D ] }; + key <AC04> {[], [ hebrew_kaph, F ] }; + key <AC05> {[], [ hebrew_ayin, G ] }; + key <AC06> {[], [ hebrew_yod, H ] }; + key <AC07> {[], [ hebrew_chet, J ] }; + key <AC08> {[], [ hebrew_lamed, K ] }; + key <AC09> {[], [ hebrew_finalkaph, L ] }; + key <AC10> {[], [ hebrew_finalpe, colon ] }; + key <AC11> {[], [ comma, quotedbl ] }; + + key <AB01> {[], [ hebrew_zain, Z ] }; + key <AB02> {[], [ hebrew_samech, X ] }; + key <AB03> {[], [ hebrew_bet, C ] }; + key <AB04> {[], [ hebrew_he, V ] }; + key <AB05> {[], [ hebrew_nun, B ] }; + key <AB06> {[], [ hebrew_mem, N ] }; + key <AB07> {[], [ hebrew_zade, M ] }; + key <AB08> {[], [ hebrew_taw, less ] }; + key <AB09> {[], [ hebrew_finalzade, greater ] }; + key <AB10> {[], [ period, question ] }; + + // The following may get overriden by the iso9995-3(basic101) symbols. + // therefore they are included here. + // Including them isn't a great idea (for instance: what if group 1 uses + // UK keyboard mapping, and maps shift-3 to sterling? This mapping won't + // preserve that, and I'm not sure that this is a good feature. + key <AE01> {[], [ 1, exclam ] }; + key <AE02> {[], [ 2, at ] }; + key <AE03> {[], [ 3, numbersign ] }; + key <AE04> {[], [ 4, dollar ] }; + key <AE05> {[], [ 5, percent ] }; + key <AE06> {[], [ 6, asciicircum ] }; + key <AE07> {[], [ 7, ampersand ] }; + key <AE08> {[], [ 8, asterisk ] }; + key <AE09> {[], [ 9, parenleft ] }; + key <AE10> {[], [ 0, parenright ] }; + key <AE11> {[], [ minus, underscore ] }; + key <AE12> {[], [ equal, plus ] }; + key <AD11> {[], [ bracketleft, braceleft ] }; + key <AD12> {[], [ bracketright, braceright ] }; + key <BKSL> {[], [ backslash, bar ] }; +}; Index: xc/programs/xkbcomp/symbols/inet diff -u xc/programs/xkbcomp/symbols/inet:1.8 xc/programs/xkbcomp/symbols/inet:1.13 --- xc/programs/xkbcomp/symbols/inet:1.8 Fri Dec 1 20:16:26 2000 +++ xc/programs/xkbcomp/symbols/inet Thu Apr 5 22:16:26 2001 @@ -1,4 +1,4 @@ -// $XFree86: xc/programs/xkbcomp/symbols/inet,v 1.8 2000/12/02 01:16:26 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/inet,v 1.13 2001/04/06 02:16:26 dawes Exp $ partial alphanumeric_keys xkb_symbols "hp" { @@ -55,20 +55,68 @@ // Describes the extra keys on a Logitech Desktop Pro keyboard. name[Group1]= "CordLess"; - key <I5F> { [ XF86Standby ] }; - key <I20> { [ XF86AudioMute ] }; - key <I2E> { [ XF86AudioLowerVolume ] }; - key <I30> { [ XF86AudioRaiseVolume ] }; - key <I22> { [ XF86AudioPlay ] }; - key <I24> { [ XF86AudioStop ] }; - key <I10> { [ XF86AudioPrev ] }; - key <I19> { [ XF86AudioNext ] }; - key <I32> { [ XF86HomePage ] }; - key <I6C> { [ XF86Mail ] }; - key <I65> { [ XF86Search ] }; - key <I66> { [ XF86Start ] }; + key <I5F> { [ XF86Standby ] }; + key <I20> { [ XF86AudioMute ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPlay ] }; + key <I24> { [ XF86AudioStop ] }; + key <I10> { [ XF86AudioPrev ] }; + key <I19> { [ XF86AudioNext ] }; + key <I32> { [ XF86HomePage ] }; + key <I6C> { [ XF86Mail ] }; + key <I65> { [ XF86Search ] }; + key <I66> { [ XF86Start ] }; +}; + +partial alphanumeric_keys +xkb_symbols "logiinternet" { + + // Describes the extra keys on a Logitech Internet Keyboard + + name[Group1]= "LogiInternet"; + key <I25> { [ XF86VendorHome ] }; + key <I10> { [ XF86Back ] }; + key <I22> { [ XF86Forward ] }; + key <I24> { [ XF86Stop ] }; + key <I19> { [ XF86Refresh ] }; + key <I1E> { [ XF86Search ] }; + key <I18> { [ XF86Favorites ] }; + key <I30> { [ XF86AudioRaiseVolume ] }; + key <I2E> { [ XF86AudioLowerVolume ] }; + key <I23> { [ XF86HomePage ] }; + key <I7A> { [ XF86WWW ] }; + key <I32> { [ XF86History ] }; + key <I21> { [ XF86OpenURL ] }; + key <I17> { [ Print ] }; + key <I12> { [ Find ] }; + key <I26> { [ XF86AddFavorite ] }; + key <I20> { [ XF86HotLinks ] }; }; +partial alphanumeric_keys +xkb_symbols "geniuscomfy" { + + // Describes the extra keys on a Genius Comfy KB-16M + + name[Group1]= "GeniusComfy16M"; + key <I23> { [ XF86AudioPrev ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I24> { [ XF86AudioStop ] }; + key <I21> { [ XF86AudioNext ] }; + key <I30> { [ XF86Eject ] }; + key <I19> { [ XF86AudioLowerVolume ] }; + key <I12> { [ XF86AudioRaiseVolume ] }; + key <I20> { [ XF86AudioMute ] }; + key <I26> { [ XF86ScreenSaver ] }; + key <I17> { [ XF86Calculator ] }; + key <I2E> { [ XF86Mail ] }; + key <I25> { [ XF86Back ] }; + key <I32> { [ XF86WWW ] }; + key <I1E> { [ XF86Forward ] }; + key <I5F> { [ XF86Sleep ] }; + key <I63> { [ XF86WakeUp ] }; +}; partial alphanumeric_keys xkb_symbols "microsoftpro" { @@ -118,5 +166,78 @@ key <I5F> { [ XF86Standby ] }; key <I5E> { [ XF86PowerOff ] }; key <I63> { [ XF86WakeUp ] }; +}; + + +partial alphanumeric_keys +xkb_symbols "rapidaccess" { + + // Describes the extra keys on an IBM Rapid Access keyboard + + name[Group1]= "RapidAccess"; + key <I22> { [ XF86AudioPause ] }; + key <I12> { [ XF86AudioMute ] }; + key <I1E> { [ XF86AudioLowerVolume ] }; + key <I20> { [ XF86AudioRaiseVolume ] }; + key <I19> { [ XF86AudioPlay ] }; + key <I24> { [ XF86AudioStop ] }; + key <I23> { [ XF86AudioPrev ] }; + key <I21> { [ XF86AudioNext ] }; + key <I25> { [ XF86Standby ] }; + key <I32> { [ XF86Launch1 ] }; + key <I17> { [ XF86Launch2 ] }; + key <I30> { [ XF86Launch3 ] }; + key <I2E> { [ XF86Launch4 ] }; + key <I26> { [ Help ] }; +}; + + +partial alphanumeric_keys +xkb_symbols "rapidaccess2" { + + // From <patrick@dcruze.org> + // Describes the extra keys on an IBM Rapid Access II keyboard + + name[Group1]= "RapidAccess2"; + key <I25> { [ XF86HomePage ] }; + key <I26> { [ XF86Shop ] }; + key <I32> { [ XF86VendorHome ] }; + key <I17> { [ XF86Favorites ] }; + key <I30> { [ XF86MyComputer ] }; + key <I2E> { [ XF86Search ] }; + key <I5F> { [ XF86Standby ] }; + key <I1E> { [ XF86AudioMute ] }; + key <I21> { [ XF86AudioLowerVolume ] }; + key <I23> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I20> { [ XF86AudioStop ] }; + key <I24> { [ XF86AudioPrev ] }; + key <I12> { [ XF86AudioNext ] }; +}; + + +partial alphanumeric_keys +xkb_symbols "chicony" { + + // Describes the extra keys on a Chicony internet keyboard + + name[Group1]= "Chicony"; + key <I19> { [ XF86AudioLowerVolume ] }; + key <I12> { [ XF86AudioMute ] }; + key <I23> { [ XF86AudioRaiseVolume ] }; + key <I22> { [ XF86AudioPrev ] }; + key <I24> { [ XF86AudioStop ] }; + key <I21> { [ XF86AudioPlay, XF86AudioPause ] }; + key <I20> { [ XF86AudioNext ] }; + key <I5E> { [ XF86PowerOff ] }; + key <I32> { [ XF86HomePage ] }; + key <I17> { [ XF86Mail ] }; + key <I25> { [ XF86Back ] }; + key <I1E> { [ XF86Forward ] }; + key <I5F> { [ XF86ContrastAdjust ] }; + key <I63> { [ XF86BrightnessAdjust ] }; + key <I30> { [ XF86LaunchA ] }; + key <I26> { [ XF86LaunchB ] }; + key <I2E> { [ XF86LaunchC ] }; }; Index: xc/programs/xkbcomp/symbols/is diff -u xc/programs/xkbcomp/symbols/is:3.4 xc/programs/xkbcomp/symbols/is:3.5 --- xc/programs/xkbcomp/symbols/is:3.4 Fri Oct 27 14:31:09 2000 +++ xc/programs/xkbcomp/symbols/is Wed Jan 17 18:45:58 2001 @@ -1,6 +1,6 @@ -// $TOG: is /main/1 1997/08/27 15:27:24 kaleb $ +// $Xorg: is,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ // XKB keyboard by Hrafnkell Eiriksson - hkelle@rhi.hi.is -// $XFree86: xc/programs/xkbcomp/symbols/is,v 3.4 2000/10/27 18:31:09 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/is,v 3.5 2001/01/17 23:45:58 dawes Exp $ default partial alphanumeric_keys xkb_symbols "default" { Index: xc/programs/xkbcomp/symbols/iso9995-3 diff -u xc/programs/xkbcomp/symbols/iso9995-3:3.1 xc/programs/xkbcomp/symbols/iso9995-3:3.2 --- xc/programs/xkbcomp/symbols/iso9995-3:3.1 Mon Dec 23 02:13:26 1996 +++ xc/programs/xkbcomp/symbols/iso9995-3 Wed Jan 17 18:45:58 2001 @@ -1,4 +1,4 @@ -// $XConsortium: iso9995-3 /main/5 1996/08/31 12:19:56 kaleb $ +// $Xorg: iso9995-3,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ partial alphanumeric_keys alternate_group xkb_symbols "basic101" { // Part 3 of ISO9995 specifies a common alternate character set Index: xc/programs/xkbcomp/symbols/it diff -u xc/programs/xkbcomp/symbols/it:3.4 xc/programs/xkbcomp/symbols/it:3.5 --- xc/programs/xkbcomp/symbols/it:3.4 Fri Oct 27 14:31:09 2000 +++ xc/programs/xkbcomp/symbols/it Wed Jan 17 18:45:58 2001 @@ -1,5 +1,10 @@ -// $XConsortium: it /main/3 1996/08/31 12:19:59 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/it,v 3.4 2000/10/27 18:31:09 dawes Exp $ +// $Xorg: it,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/it,v 3.5 2001/01/17 23:45:58 dawes Exp $ + partial default alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/jp diff -u xc/programs/xkbcomp/symbols/jp:3.5 xc/programs/xkbcomp/symbols/jp:3.6 --- xc/programs/xkbcomp/symbols/jp:3.5 Thu Jun 15 16:34:14 2000 +++ xc/programs/xkbcomp/symbols/jp Wed Jan 17 18:45:58 2001 @@ -1,10 +1,10 @@ -// $TOG: jp /main/1 1997/08/02 10:11:36 kaleb $ +// $Xorg: jp,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ - -// $XFree86: xc/programs/xkbcomp/symbols/jp,v 3.5 2000/06/15 20:34:14 dawes Exp $ -// // symbols for a Japanese 106 keyboard(by tsuka@kawalab.dnj.ynu.ac.jp) + +// $XFree86: xc/programs/xkbcomp/symbols/jp,v 3.6 2001/01/17 23:45:58 dawes Exp $ + default xkb_symbols "jp106" { key <ESC> { [ Escape ] }; Index: xc/programs/xkbcomp/symbols/keypad diff -u xc/programs/xkbcomp/symbols/keypad:3.1 xc/programs/xkbcomp/symbols/keypad:3.2 --- xc/programs/xkbcomp/symbols/keypad:3.1 Sun Jun 22 05:53:20 1997 +++ xc/programs/xkbcomp/symbols/keypad Wed Jan 17 18:45:59 2001 @@ -1,4 +1,4 @@ -// $TOG: keypad /main/2 1997/06/13 06:25:08 kaleb $ +// $Xorg: keypad,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ partial hidden keypad_keys xkb_symbols "overlay" { Index: xc/programs/xkbcomp/symbols/lock diff -u xc/programs/xkbcomp/symbols/lock:3.3 xc/programs/xkbcomp/symbols/lock:3.4 --- xc/programs/xkbcomp/symbols/lock:3.3 Thu Aug 3 08:24:03 2000 +++ xc/programs/xkbcomp/symbols/lock Wed Jan 17 18:45:59 2001 @@ -1,5 +1,9 @@ -// $TOG: lock /main/2 1997/06/13 06:25:10 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/lock,v 3.3 2000/08/03 12:24:03 dawes Exp $ +// $Xorg: lock,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/lock,v 3.4 2001/01/17 23:45:59 dawes Exp $ partial hidden modifier_keys xkb_symbols "shift" { Index: xc/programs/xkbcomp/symbols/lv diff -u /dev/null xc/programs/xkbcomp/symbols/lv:1.1.2.1 --- /dev/null Mon Jun 4 12:42:58 2001 +++ xc/programs/xkbcomp/symbols/lv Wed May 23 16:21:53 2001 @@ -0,0 +1,78 @@ +// Latvian keyboard map by Ilya Ketris <Ilya.Ketris@ipro.lv> +// +// $XFree86: xc/programs/xkbcomp/symbols/lv,v 1.1.2.1 2001/05/23 20:21:53 dawes Exp $ + +partial default alphanumeric_keys modifier_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a very simple Latvian keyboard + // Extentions: Euro on AltGr+4, nobreakspace on AltGr+Space, + // Rcedilla for diaspora Latvian, Omacron for Latgalian + + name[Group1]= "US/ASCII"; + name[Group2]= "Latvian"; + + key <RTRN> { [ Return, ISO_Next_Group ]}; + + key <AE04> { [ 4, dollar ], + [ EuroSign, cent ]}; + key <AD03> { [ e, E ], + [ emacron, Emacron ]}; + key <AD04> { [ r, R ], + [ rcedilla, Rcedilla ]}; + key <AD07> { [ u, U ], + [ umacron, Umacron ]}; + key <AD08> { [ i, I ], + [ imacron, Imacron ]}; + key <AD09> { [ o, O ], + [ omacron, Omacron ]}; + key <AC01> { [ a, A ], + [ amacron, Amacron ]}; + key <AC02> { [ s, S ], + [ scaron, Scaron ]}; + key <AC05> { [ g, G ], + [ gcedilla, Gcedilla ]}; + key <AC08> { [ k, K ], + [ kcedilla, Kcedilla ]}; + key <AC09> { [ l, L ], + [ lcedilla, Lcedilla ]}; + key <AC11> { [ quoteright, quotedbl ], + [ leftdoublequotemark, doublelowquotemark]}; + key <AB01> { [ z, Z ], + [ zcaron, Zcaron ]}; + key <AB03> { [ c, C ], + [ ccaron, Ccaron ]}; + key <AB06> { [ n, N ], + [ ncedilla, Ncedilla ]}; + key <SPCE> { [ space, space ], + [ nobreakspace, nobreakspace ]}; + + // End alphanumeric section + + // Begin modifier mappings + + modifier_map Shift { Shift_L }; + modifier_map Lock { Caps_Lock, ISO_Lock }; + modifier_map Control{ Control_L }; + modifier_map Mod3 { Mode_switch }; +}; + + + +partial alphanumeric_keys +xkb_symbols "Sundeadkeys" { + include "lv(basic)" // for consistent naming +}; + +partial alphanumeric_keys +xkb_symbols "sundeadkeys" { + include "lv(Sundeadkeys)" // for consistent naming +}; + +partial alphanumeric_keys +xkb_symbols "nodeadkeys" { + include "lv(basic)" // for consistent naming +}; + + Index: xc/programs/xkbcomp/symbols/no diff -u xc/programs/xkbcomp/symbols/no:3.8 xc/programs/xkbcomp/symbols/no:3.9 --- xc/programs/xkbcomp/symbols/no:3.8 Thu Nov 2 14:10:59 2000 +++ xc/programs/xkbcomp/symbols/no Wed Jan 17 18:45:59 2001 @@ -1,5 +1,10 @@ -// $XConsortium: no /main/3 1996/08/31 12:19:29 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/no,v 3.8 2000/11/02 19:10:59 dawes Exp $ +// $Xorg: no,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/no,v 3.9 2001/01/17 23:45:59 dawes Exp $ + partial alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/pc104 diff -u xc/programs/xkbcomp/symbols/pc104:3.3 xc/programs/xkbcomp/symbols/pc104:3.4 --- xc/programs/xkbcomp/symbols/pc104:3.3 Thu Aug 3 08:24:03 2000 +++ xc/programs/xkbcomp/symbols/pc104 Wed Jan 17 18:45:59 2001 @@ -1,5 +1,10 @@ -// $TOG: pc104 /main/2 1997/06/13 06:25:12 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/pc104,v 3.3 2000/08/03 12:24:03 dawes Exp $ +// $Xorg: pc104,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/pc104,v 3.4 2001/01/17 23:45:59 dawes Exp $ + // Use "Alt_*" for both alt keys, "Meta_*" for both windows keys, and Menu for // the menu key default partial modifier_keys Index: xc/programs/xkbcomp/symbols/pl diff -u xc/programs/xkbcomp/symbols/pl:3.4 xc/programs/xkbcomp/symbols/pl:3.5 --- xc/programs/xkbcomp/symbols/pl:3.4 Sun Aug 29 22:34:28 1999 +++ xc/programs/xkbcomp/symbols/pl Wed Jan 17 18:45:59 2001 @@ -1,5 +1,10 @@ -// $XConsortium: pl /main/3 1996/08/31 12:20:05 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/pl,v 3.4 1999/08/30 02:34:28 dawes Exp $ +// $Xorg: pl,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/pl,v 3.5 2001/01/17 23:45:59 dawes Exp $ + partial default alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/pt diff -u xc/programs/xkbcomp/symbols/pt:3.5 xc/programs/xkbcomp/symbols/pt:3.6 --- xc/programs/xkbcomp/symbols/pt:3.5 Fri Oct 27 14:31:09 2000 +++ xc/programs/xkbcomp/symbols/pt Wed Jan 17 18:45:59 2001 @@ -1,5 +1,10 @@ -// $XConsortium: pt /main/3 1996/08/31 12:20:08 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/pt,v 3.5 2000/10/27 18:31:09 dawes Exp $ +// $Xorg: pt,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/pt,v 3.6 2001/01/17 23:45:59 dawes Exp $ + partial default alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/ro diff -u xc/programs/xkbcomp/symbols/ro:3.1 xc/programs/xkbcomp/symbols/ro:3.1.6.1 --- xc/programs/xkbcomp/symbols/ro:3.1 Tue Aug 15 12:51:32 2000 +++ xc/programs/xkbcomp/symbols/ro Wed May 23 14:32:19 2001 @@ -5,7 +5,7 @@ // // Created by Cristian Gafton, <gafton@redhat.com> (C) 2000 // -// $XFree86: xc/programs/xkbcomp/symbols/ro,v 3.1 2000/08/15 16:51:32 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/ro,v 3.1.6.1 2001/05/23 18:32:19 dawes Exp $ partial hidden alphanumeric_keys modifier_keys xkb_symbols "basic" { @@ -13,7 +13,7 @@ key <TLDE> { [], [ acircumflex, acircumflex ] }; key <AC01> { [], [ atilde, acircumflex ] }; - key <AC02> { [], [ scedilla, Scedilla ] }; + key <AC02> { [], [ masculine, ordfeminine ] }; key <AD05> { [], [ thorn, Thorn ] }; key <AD08> { [], [ icircumflex, Icircumflex ] }; }; Index: xc/programs/xkbcomp/symbols/ru diff -u xc/programs/xkbcomp/symbols/ru:3.7 xc/programs/xkbcomp/symbols/ru:3.8 --- xc/programs/xkbcomp/symbols/ru:3.7 Sun Apr 25 06:02:58 1999 +++ xc/programs/xkbcomp/symbols/ru Wed Jan 17 18:45:59 2001 @@ -1,9 +1,9 @@ -// $TOG: ru /main/4 1997/06/10 06:56:17 kaleb $ +// $Xorg: ru,v 1.3 2000/08/17 19:54:43 cpqbld Exp $ // // russian standard keyboard // AEN <aen@logic.ru> // -// $XFree86: xc/programs/xkbcomp/symbols/ru,v 3.7 1999/04/25 10:02:58 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/ru,v 3.8 2001/01/17 23:45:59 dawes Exp $ partial default alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/se diff -u xc/programs/xkbcomp/symbols/se:3.6 xc/programs/xkbcomp/symbols/se:3.7 --- xc/programs/xkbcomp/symbols/se:3.6 Fri Oct 27 14:31:09 2000 +++ xc/programs/xkbcomp/symbols/se Wed Jan 17 18:45:59 2001 @@ -1,5 +1,10 @@ -// $XConsortium: se /main/3 1996/08/31 12:19:29 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/se,v 3.6 2000/10/27 18:31:09 dawes Exp $ +// $Xorg: se,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/se,v 3.7 2001/01/17 23:45:59 dawes Exp $ + partial alphanumeric_keys xkb_symbols "basic" { Index: xc/programs/xkbcomp/symbols/sk diff -u /dev/null xc/programs/xkbcomp/symbols/sk:1.1 --- /dev/null Mon Jun 4 12:42:58 2001 +++ xc/programs/xkbcomp/symbols/sk Fri May 18 19:35:35 2001 @@ -0,0 +1,132 @@ +// $XFree86: xc/programs/xkbcomp/symbols/sk,v 1.1 2001/05/18 23:35:35 dawes Exp $ + +partial alphanumeric_keys +xkb_symbols "basic" { + + // Describes the differences between a very simple en_US + // keyboard and a Slovak keyboard + // This layout conforms to a new sk compromise standard designed + // to satisfy most unix, windows and mac users. + // 2001 by Kamil Toman <ktoman@email.cz> + + name[Group1] = "Slovak"; + + key.type = "FOUR_LEVEL"; + + key <TLDE> { [ semicolon, dead_abovering, + grave, asciitilde ] }; + key <AE01> { [ plus, 1, + exclam, dead_tilde ] }; + key <AE02> { [ lacute, 2, + at, dead_caron ] }; + key <AE03> { [ scaron, 3, + numbersign, dead_circumflex ] }; + key <AE04> { [ ccaron, 4, + dollar, dead_breve ] }; + key <AE05> { [ tcaron, 5, + percent, dead_abovering ] }; + key <AE06> { [ zcaron, 6, + asciicircum, dead_ogonek ] }; + key <AE07> { [ yacute, 7, + ampersand, dead_grave ] }; + key <AE08> { [ aacute, 8, + asterisk, dead_abovedot ] }; + key <AE09> { [ iacute, 9, + braceleft, dead_acute ] }; + key <AE10> { [ eacute, 0, + braceright, dead_doubleacute ] }; + key <AE11> { [ equal, percent, + NoSymbol, dead_diaeresis ] }; + key <AE12> { [ dead_acute, dead_caron, + dead_macron, dead_cedilla ] }; + + key <AD01> { [ q, Q, + backslash, NoSymbol ] }; + key <AD02> { [ w, W, + bar, Nosymbol ] }; + key <AD03> { [ e, E, + EuroSign, NoSymbol ] }; + key <AD04> { [ r, R, + NoSymbol, NoSymbol ] }; + key <AD05> { [ t, T, + NoSymbol, NoSymbol ] }; + key <AD06> { [ z, Z, + NoSymbol, NoSymbol ] }; + key <AD07> { [ u, U, + NoSymbol, NoSymbol ] }; + key <AD08> { [ i, I, + NoSymbol, NoSymbol ] }; + key <AD09> { [ o, O, + NoSymbol, NoSymbol ] }; + key <AD10> { [ p, P, + NoSymbol, NoSymbol ] }; + + key <AD11> { [ uacute, slash, + bracketleft, division ] }; + key <AD12> { [ adiaeresis, parenleft, + bracketright, multiply ] }; + + key <AC01> { [ a, A, + asciitilde, NoSymbol ] }; + key <AC02> { [ s, S, + dstroke, NoSymbol ] }; + key <AC03> { [ d, D, + Dstroke, NoSymbol ] }; + key <AC04> { [ f, F, + bracketleft, NoSymbol ] }; + key <AC05> { [ g, G, + bracketright, NoSymbol ] }; + key <AC06> { [ h, H, + grave, NoSymbol ] }; + key <AC07> { [ j, J, + apostrophe, NoSymbol ] }; + key <AC08> { [ k, K, + lstroke, NoSymbol ] }; + key <AC09> { [ l, L, + Lstroke, NoSymbol ] }; + + key <AC10> { [ ocircumflex, quotedbl, + dollar, NoSymbol ] }; + key <AC11> { [ section, exclam, + apostrophe, ssharp ] }; + key <AC12> { [ EuroSign, dead_diaeresis, + NoSymbol, NoSymbol ] }; + key <BKSL> { [ ncaron, parenright, + backslash, bar ] }; + + key <LSGT> { [ backslash, bar, + slash, NoSymbol ] }; + key <AB01> { [ y, Y, + degree, NoSymbol ] }; + key <AB02> { [ x, X, + numbersign, Nosymbol ] }; + key <AB03> { [ c, C, + ampersand, NoSymbol ] }; + key <AB04> { [ v, V, + at, NoSymbol ] }; + key <AB05> { [ b, B, + braceleft, NoSymbol ] }; + key <AB06> { [ n, N, + braceright, NoSymbol ] }; + key <AB07> { [ m, M, + asciicircum, NoSymbol ] }; + key <AB08> { [ comma, question, + less, NoSymbol ] }; + key <AB09> { [ period, colon, + greater, NoSymbol ] }; + key <AB10> { [ minus, underscore, + asterisk, NoSymbol ] }; + + key <SPCE> { [ space, space, + nobreakspace, nobreakspace ] }; + + // This certainly shouldn't be 'comma'. Something like KP_DecimalComma + // would be better but there's no such definition in keysyms. + key <KPDL> { type="FOUR_LEVEL_KEYPAD", [ KP_Delete, comma, + KP_Delete, KP_Decimal] }; + + key <RALT> { type="TWO_LEVEL", [ ISO_Level3_Shift, ISO_Level3_Shift ] }; + modifier_map Mod5 { <RALT> }; + +}; + Index: xc/programs/xkbcomp/symbols/sk_qwerty diff -u /dev/null xc/programs/xkbcomp/symbols/sk_qwerty:1.1 --- /dev/null Mon Jun 4 12:42:58 2001 +++ xc/programs/xkbcomp/symbols/sk_qwerty Fri May 18 19:35:35 2001 @@ -0,0 +1,15 @@ +// $XFree86: xc/programs/xkbcomp/symbols/sk_qwerty,v 1.1 2001/05/18 23:35:35 dawes Exp $ + +partial alphanumeric_keys +xkb_symbols "basic" { + + // This layout should work exactly as a sk with the exception + // of 'X' and 'Y' keys, which are in the qwerty style (ie. swapped). + // 2001 by Kamil Toman <ktoman@email.cz> + + include "sk(basic)" + + key <AB01> { [ z, Z, + degree, NoSymbol ] }; + key <AD06> { [ y, Y, NoSymbol, NoSymbol ] }; +}; Index: xc/programs/xkbcomp/symbols/th diff -u xc/programs/xkbcomp/symbols/th:3.3 xc/programs/xkbcomp/symbols/th:3.4 --- xc/programs/xkbcomp/symbols/th:3.3 Fri Oct 27 14:31:09 2000 +++ xc/programs/xkbcomp/symbols/th Wed Jan 17 18:45:59 2001 @@ -1,5 +1,10 @@ -// $XConsortium: th /main/3 1996/08/31 12:20:18 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/th,v 3.3 2000/10/27 18:31:09 dawes Exp $ +// $Xorg: th,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ + + + + +// $XFree86: xc/programs/xkbcomp/symbols/th,v 3.4 2001/01/17 23:45:59 dawes Exp $ + partial default alphanumeric_keys xkb_symbols "basic" { name[Group2]= "Thai"; Index: xc/programs/xkbcomp/symbols/us diff -u xc/programs/xkbcomp/symbols/us:3.9.2.1 xc/programs/xkbcomp/symbols/us:3.10 --- xc/programs/xkbcomp/symbols/us:3.9.2.1 Mon Mar 12 11:19:54 2001 +++ xc/programs/xkbcomp/symbols/us Wed Jan 17 18:45:59 2001 @@ -1,4 +1,4 @@ -// $TOG: us /main/12 1997/06/14 06:37:07 kaleb $ +// $Xorg: us,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ // symbols definition for a very simple US/ASCII layout. // It has basically the alphanumeric keys, punctuation, @@ -6,7 +6,7 @@ // uses the punctuation keys configurations common on PC // keyboards (e.g. key <ABO9> is { [ period greater ] }) -// $XFree86: xc/programs/xkbcomp/symbols/us,v 3.9.2.1 2001/03/12 16:19:54 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/us,v 3.10 2001/01/17 23:45:59 dawes Exp $ partial hidden alphanumeric_keys modifier_keys xkb_symbols "basic" { @@ -223,7 +223,7 @@ key <LALT> { [ Alt_L ] }; key <RALT> { [ Alt_R ] }; key <LWIN> { [ Meta_L ] }; - key <RWIN> { [ Meta_R ] }; + key <RWIN> { [ Multi_key ] }; key <MENU> { [ Menu ] }; // modifier mappings Index: xc/programs/xkbcomp/symbols/digital/Imakefile diff -u xc/programs/xkbcomp/symbols/digital/Imakefile:1.1.1.1 xc/programs/xkbcomp/symbols/digital/Imakefile:1.1.1.2 --- xc/programs/xkbcomp/symbols/digital/Imakefile:1.1.1.1 Wed Jan 24 06:15:38 1996 +++ xc/programs/xkbcomp/symbols/digital/Imakefile Tue Jan 16 17:59:44 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/1 1996/01/23 06:59:48 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ #undef lk #undef pc Index: xc/programs/xkbcomp/symbols/digital/lk diff -u xc/programs/xkbcomp/symbols/digital/lk:3.1 xc/programs/xkbcomp/symbols/digital/lk:3.2 --- xc/programs/xkbcomp/symbols/digital/lk:3.1 Mon Dec 23 02:13:38 1996 +++ xc/programs/xkbcomp/symbols/digital/lk Wed Jan 17 18:46:01 2001 @@ -1,4 +1,4 @@ -// $XConsortium: lk /main/5 1996/08/31 12:20:25 kaleb $ +// $Xorg: lk,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ // //Copyright (c) 1996 Digital Equipment Corporation // Index: xc/programs/xkbcomp/symbols/digital/pc diff -u xc/programs/xkbcomp/symbols/digital/pc:3.1 xc/programs/xkbcomp/symbols/digital/pc:3.2 --- xc/programs/xkbcomp/symbols/digital/pc:3.1 Mon Dec 23 02:13:39 1996 +++ xc/programs/xkbcomp/symbols/digital/pc Wed Jan 17 18:46:01 2001 @@ -1,4 +1,4 @@ -// $XConsortium: pc /main/5 1996/08/31 12:20:29 kaleb $ +// $Xorg: pc,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ // //Copyright (c) 1996 Digital Equipment Corporation // Index: xc/programs/xkbcomp/symbols/digital/us diff -u xc/programs/xkbcomp/symbols/digital/us:3.1 xc/programs/xkbcomp/symbols/digital/us:3.2 --- xc/programs/xkbcomp/symbols/digital/us:3.1 Mon Dec 23 02:13:40 1996 +++ xc/programs/xkbcomp/symbols/digital/us Wed Jan 17 18:46:02 2001 @@ -1,4 +1,4 @@ -// $XConsortium: us /main/5 1996/08/31 12:20:32 kaleb $ +// $Xorg: us,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ // //Copyright (c) 1996 Digital Equipment Corporation // Index: xc/programs/xkbcomp/symbols/digital/vt diff -u xc/programs/xkbcomp/symbols/digital/vt:3.1 xc/programs/xkbcomp/symbols/digital/vt:3.2 --- xc/programs/xkbcomp/symbols/digital/vt:3.1 Mon Dec 23 02:13:41 1996 +++ xc/programs/xkbcomp/symbols/digital/vt Wed Jan 17 18:46:02 2001 @@ -1,4 +1,4 @@ -// $XConsortium: vt /main/4 1996/08/31 12:20:35 kaleb $ +// $Xorg: vt,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ // //Copyright (c) 1996 Digital Equipment Corporation // Index: xc/programs/xkbcomp/symbols/fujitsu/Imakefile diff -u xc/programs/xkbcomp/symbols/fujitsu/Imakefile:1.1.1.1 xc/programs/xkbcomp/symbols/fujitsu/Imakefile:1.1.1.2 --- xc/programs/xkbcomp/symbols/fujitsu/Imakefile:1.1.1.1 Sat Dec 21 23:15:01 1996 +++ xc/programs/xkbcomp/symbols/fujitsu/Imakefile Tue Jan 16 17:59:50 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/1 1996/06/25 17:35:40 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ DATAFILES = jp us Index: xc/programs/xkbcomp/symbols/fujitsu/jp diff -u xc/programs/xkbcomp/symbols/fujitsu/jp:1.1.1.2 xc/programs/xkbcomp/symbols/fujitsu/jp:1.1.1.3 --- xc/programs/xkbcomp/symbols/fujitsu/jp:1.1.1.2 Sun Sep 27 04:55:47 1998 +++ xc/programs/xkbcomp/symbols/fujitsu/jp Tue Jan 16 17:59:50 2001 @@ -1,4 +1,4 @@ -// $TOG: jp /main/2 1998/02/10 13:44:44 kaleb $ +// $Xorg: jp,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/symbols/fujitsu/us diff -u xc/programs/xkbcomp/symbols/fujitsu/us:1.1.1.2 xc/programs/xkbcomp/symbols/fujitsu/us:1.1.1.3 --- xc/programs/xkbcomp/symbols/fujitsu/us:1.1.1.2 Sun Sep 27 04:55:45 1998 +++ xc/programs/xkbcomp/symbols/fujitsu/us Tue Jan 16 17:59:51 2001 @@ -1,4 +1,4 @@ -// $TOG: us /main/2 1998/02/10 13:44:50 kaleb $ +// $Xorg: us,v 1.3 2000/08/17 19:54:44 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/symbols/hp/Imakefile diff -u xc/programs/xkbcomp/symbols/hp/Imakefile:1.1 xc/programs/xkbcomp/symbols/hp/Imakefile:1.2 --- xc/programs/xkbcomp/symbols/hp/Imakefile:1.1 Sun Nov 16 01:42:58 1997 +++ xc/programs/xkbcomp/symbols/hp/Imakefile Wed Jan 17 18:46:02 2001 @@ -1,4 +1,4 @@ -XCOMM $TOG: Imakefile /main/1 1997/10/24 14:30:52 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:45 cpqbld Exp $ DATAFILES = us Index: xc/programs/xkbcomp/symbols/hp/us diff -u xc/programs/xkbcomp/symbols/hp/us:1.2 xc/programs/xkbcomp/symbols/hp/us:1.3 --- xc/programs/xkbcomp/symbols/hp/us:1.2 Thu Jun 22 20:44:37 2000 +++ xc/programs/xkbcomp/symbols/hp/us Wed Jan 17 18:46:02 2001 @@ -1,4 +1,4 @@ -// $TOG: us /main/3 1998/02/10 13:44:54 kaleb $ +// $Xorg: us,v 1.3 2000/08/17 19:54:45 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/symbols/macintosh/it diff -u xc/programs/xkbcomp/symbols/macintosh/it:1.2 xc/programs/xkbcomp/symbols/macintosh/it:1.3 --- xc/programs/xkbcomp/symbols/macintosh/it:1.2 Tue Sep 26 11:57:25 2000 +++ xc/programs/xkbcomp/symbols/macintosh/it Fri Apr 6 12:51:20 2001 @@ -1,6 +1,4 @@ -// $XConsortium: macintosh /main/10 1996/01/29 19:54:54 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/macintosh/it,v 1.2 2000/09/26 15:57:25 tsi Exp $ -// +// $XFree86: xc/programs/xkbcomp/symbols/macintosh/it,v 1.3 2001/04/06 16:51:20 dawes Exp $ xkb_symbols "extended" { @@ -13,20 +11,20 @@ key <AE01> { [ ampersand, 1 ], [guillemotleft,guillemotright ] }; key <AE02> { [ quotedbl, 2 ] }; - key <AE03> { [ acute, 3 ] }; + key <AE03> { [ apostrophe, 3 ] }; key <AE04> { [ parenleft, 4 ], [ braceleft, bracketleft ] }; key <AE05> { [ ccedilla, 5 ], [ Ccedilla, Iacute ] }; - key <AE06> { [ eacute, 6 ], + key <AE06> { [ egrave, 6 ], [ paragraph, periodcentered] }; key <AE07> { [ parenright, 7 ], [ braceright, bracketright ] }; key <AE08> { [ sterling, 8 ], [ infinity ] }; - key <AE09> { [ aacute, 9 ], + key <AE09> { [ agrave, 9 ], [ acute, Ocircumflex ] }; - key <AE10> { [ egrave, 0 ], + key <AE10> { [ eacute, 0 ], [ grave, Oacute ] }; key <AE11> { [ minus, underscore ] }; key <AE12> { [ equal, plus ], @@ -45,7 +43,7 @@ [ icircumflex, idiaeresis ] }; key <AD09> { [ o, O ] }; key <AD10> { [ p, P ] }; - key <AD11> { [ iacute, dead_diaeresis ] }; + key <AD11> { [ igrave, asciicircum ] }; key <AD12> { [ dollar, asterisk ] }; key <BKSL> { [ section, degree ], [ at, numbersign ] }; @@ -83,7 +81,7 @@ key <AB08> { [ semicolon, period ] }; key <AB09> { [ colon, slash ], [ bar, backslash ] }; - key <AB10> { [ oacute, exclam ], + key <AB10> { [ ograve, exclam ], [ exclamdown ] }; // End alphanumeric section Index: xc/programs/xkbcomp/symbols/macintosh/us diff -u xc/programs/xkbcomp/symbols/macintosh/us:1.3 xc/programs/xkbcomp/symbols/macintosh/us:1.4 --- xc/programs/xkbcomp/symbols/macintosh/us:1.3 Fri Sep 29 04:59:49 2000 +++ xc/programs/xkbcomp/symbols/macintosh/us Mon Apr 23 16:31:09 2001 @@ -1,5 +1,5 @@ // $XConsortium: macintosh /main/10 1996/01/29 19:54:54 kaleb $ -// $XFree86: xc/programs/xkbcomp/symbols/macintosh/us,v 1.3 2000/09/29 08:59:49 eich Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/macintosh/us,v 1.4 2001/04/23 20:31:09 dawes Exp $ // some symbols need a special charset, most symbols not added yet @@ -35,7 +35,7 @@ key <AE11> { [ minus, underscore ] }; key <AE12> { [ equal, plus ], [ notequal, plusminus ] }; - key <BKSP> { [ BackSpace, Delete ] }; + key <BKSP> { [ BackSpace ] }; key <TAB> { [ Tab, ISO_Left_Tab ] }; key <AD01> { [ q, Q ], Index: xc/programs/xkbcomp/symbols/nec/Imakefile diff -u xc/programs/xkbcomp/symbols/nec/Imakefile:3.1 xc/programs/xkbcomp/symbols/nec/Imakefile:3.2 --- xc/programs/xkbcomp/symbols/nec/Imakefile:3.1 Tue Aug 13 07:36:18 1996 +++ xc/programs/xkbcomp/symbols/nec/Imakefile Wed Jan 17 18:46:03 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/1 1996/01/30 14:27:50 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:45 cpqbld Exp $ DATAFILES = jp Index: xc/programs/xkbcomp/symbols/nec/jp diff -u xc/programs/xkbcomp/symbols/nec/jp:3.8 xc/programs/xkbcomp/symbols/nec/jp:3.9 --- xc/programs/xkbcomp/symbols/nec/jp:3.8 Sun Dec 13 00:33:07 1998 +++ xc/programs/xkbcomp/symbols/nec/jp Wed Jan 17 18:46:03 2001 @@ -1,4 +1,4 @@ -// $TOG: jp /main/8 1998/02/10 13:44:58 kaleb $ +// $Xorg: jp,v 1.3 2000/08/17 19:54:45 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // @@ -20,7 +20,7 @@ //other dealings in this Software without prior written authorization //from The Open Group. // -// $XFree86: xc/programs/xkbcomp/symbols/nec/jp,v 3.8 1998/12/13 05:33:07 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/nec/jp,v 3.9 2001/01/17 23:46:03 dawes Exp $ // // symbols for a NEC PC98 keyboard default xkb_symbols "pc98" { Index: xc/programs/xkbcomp/symbols/sgi/Imakefile diff -u xc/programs/xkbcomp/symbols/sgi/Imakefile:1.1 xc/programs/xkbcomp/symbols/sgi/Imakefile:1.2 --- xc/programs/xkbcomp/symbols/sgi/Imakefile:1.1 Sun Jun 22 05:53:21 1997 +++ xc/programs/xkbcomp/symbols/sgi/Imakefile Wed Jan 17 18:46:04 2001 @@ -1,4 +1,4 @@ -XCOMM $TOG: Imakefile /main/1 1997/06/10 06:56:20 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:45 cpqbld Exp $ DATAFILES = jp Index: xc/programs/xkbcomp/symbols/sgi/jp diff -u xc/programs/xkbcomp/symbols/sgi/jp:1.1 xc/programs/xkbcomp/symbols/sgi/jp:1.2 --- xc/programs/xkbcomp/symbols/sgi/jp:1.1 Sun Jun 22 05:53:21 1997 +++ xc/programs/xkbcomp/symbols/sgi/jp Wed Jan 17 18:46:04 2001 @@ -1,4 +1,4 @@ -// $TOG: jp /main/1 1997/06/10 06:56:23 kaleb $ +// $Xorg: jp,v 1.3 2000/08/17 19:54:45 cpqbld Exp $ xkb_symbols "jp106" { name[group1]="Japan/ASCII"; Index: xc/programs/xkbcomp/symbols/sony/Imakefile diff -u xc/programs/xkbcomp/symbols/sony/Imakefile:1.1.1.1 xc/programs/xkbcomp/symbols/sony/Imakefile:1.1.1.2 --- xc/programs/xkbcomp/symbols/sony/Imakefile:1.1.1.1 Sun Feb 4 02:40:56 1996 +++ xc/programs/xkbcomp/symbols/sony/Imakefile Tue Jan 16 18:00:01 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/1 1996/01/29 17:23:46 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:45 cpqbld Exp $ DATAFILES = us Index: xc/programs/xkbcomp/symbols/sony/us diff -u xc/programs/xkbcomp/symbols/sony/us:1.1.1.2 xc/programs/xkbcomp/symbols/sony/us:1.1.1.3 --- xc/programs/xkbcomp/symbols/sony/us:1.1.1.2 Sun Sep 27 04:55:42 1998 +++ xc/programs/xkbcomp/symbols/sony/us Tue Jan 16 18:00:03 2001 @@ -1,4 +1,4 @@ -// $TOG: us /main/2 1998/02/10 13:45:02 kaleb $ +// $Xorg: us,v 1.3 2000/08/17 19:54:45 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/symbols/sun/Imakefile diff -u xc/programs/xkbcomp/symbols/sun/Imakefile:1.4 xc/programs/xkbcomp/symbols/sun/Imakefile:1.5 --- xc/programs/xkbcomp/symbols/sun/Imakefile:1.4 Sat Jan 2 22:58:58 1999 +++ xc/programs/xkbcomp/symbols/sun/Imakefile Wed Jan 17 18:46:04 2001 @@ -1,5 +1,9 @@ -XCOMM $XConsortium: Imakefile /main/1 1996/01/23 06:59:52 kaleb $ -XCOMM $XFree86: xc/programs/xkbcomp/symbols/sun/Imakefile,v 1.4 1999/01/03 03:58:58 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:46 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xkbcomp/symbols/sun/Imakefile,v 1.5 2001/01/17 23:46:04 dawes Exp $ DATAFILES = se us Index: xc/programs/xkbcomp/symbols/sun/us diff -u xc/programs/xkbcomp/symbols/sun/us:1.2 xc/programs/xkbcomp/symbols/sun/us:1.3 --- xc/programs/xkbcomp/symbols/sun/us:1.2 Tue May 23 00:47:49 2000 +++ xc/programs/xkbcomp/symbols/sun/us Wed Jan 17 18:46:04 2001 @@ -1,4 +1,4 @@ -// $TOG: us /main/5 1998/02/10 13:45:06 kaleb $ +// $Xorg: us,v 1.3 2000/08/17 19:54:46 cpqbld Exp $ // //Copyright 1996, 1998 The Open Group // Index: xc/programs/xkbcomp/symbols/xfree68/Imakefile diff -u xc/programs/xkbcomp/symbols/xfree68/Imakefile:1.1 xc/programs/xkbcomp/symbols/xfree68/Imakefile:1.2 --- xc/programs/xkbcomp/symbols/xfree68/Imakefile:1.1 Sun Oct 26 08:25:40 1997 +++ xc/programs/xkbcomp/symbols/xfree68/Imakefile Wed Jan 17 18:46:05 2001 @@ -1,4 +1,4 @@ -XCOMM $TOG: Imakefile /main/1 1997/08/02 10:11:42 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:46 cpqbld Exp $ DATAFILES = amiga ataritt Index: xc/programs/xkbcomp/symbols/xfree68/amiga diff -u xc/programs/xkbcomp/symbols/xfree68/amiga:1.2 xc/programs/xkbcomp/symbols/xfree68/amiga:1.3 --- xc/programs/xkbcomp/symbols/xfree68/amiga:1.2 Thu Jun 22 20:44:37 2000 +++ xc/programs/xkbcomp/symbols/xfree68/amiga Wed Jan 17 18:46:05 2001 @@ -1,8 +1,9 @@ -// $TOG: amiga /main/1 1997/08/02 10:11:45 kaleb $ +// $Xorg: amiga,v 1.3 2000/08/17 19:54:46 cpqbld Exp $ -// $XFree86: xc/programs/xkbcomp/symbols/xfree68/amiga,v 1.2 2000/06/23 00:44:37 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/xfree68/amiga,v 1.3 2001/01/17 23:46:05 dawes Exp $ + default xkb_symbols "usa1" { name[Group1]= "usa1"; Index: xc/programs/xkbcomp/symbols/xfree68/ataritt diff -u xc/programs/xkbcomp/symbols/xfree68/ataritt:1.2 xc/programs/xkbcomp/symbols/xfree68/ataritt:1.3 --- xc/programs/xkbcomp/symbols/xfree68/ataritt:1.2 Thu Jun 22 20:44:37 2000 +++ xc/programs/xkbcomp/symbols/xfree68/ataritt Wed Jan 17 18:46:05 2001 @@ -1,8 +1,9 @@ -// $TOG: ataritt /main/1 1997/08/02 10:11:49 kaleb $ +// $Xorg: ataritt,v 1.3 2000/08/17 19:54:46 cpqbld Exp $ -// $XFree86: xc/programs/xkbcomp/symbols/xfree68/ataritt,v 1.2 2000/06/23 00:44:37 dawes Exp $ +// $XFree86: xc/programs/xkbcomp/symbols/xfree68/ataritt,v 1.3 2001/01/17 23:46:05 dawes Exp $ + default xkb_symbols "us" { name[Group1]= "US/ASCII"; Index: xc/programs/xkbcomp/torture/indicator diff -u xc/programs/xkbcomp/torture/indicator:1.1.1.1 xc/programs/xkbcomp/torture/indicator:1.1.1.2 --- xc/programs/xkbcomp/torture/indicator:1.1.1.1 Wed Jan 3 02:40:43 1996 +++ xc/programs/xkbcomp/torture/indicator Tue Jan 16 18:00:10 2001 @@ -1,4 +1,4 @@ -// $XConsortium: indicator /main/1 1995/11/30 19:16:16 kaleb $ +// $Xorg: indicator,v 1.3 2000/08/17 19:54:46 cpqbld Exp $ xkb_compatibility "torture" virtual_modifiers NumLock,AltGr; Index: xc/programs/xkbcomp/torture/indicator1 diff -u xc/programs/xkbcomp/torture/indicator1:1.1.1.1 xc/programs/xkbcomp/torture/indicator1:1.1.1.2 --- xc/programs/xkbcomp/torture/indicator1:1.1.1.1 Wed Jan 3 02:40:43 1996 +++ xc/programs/xkbcomp/torture/indicator1 Tue Jan 16 18:00:11 2001 @@ -1,4 +1,4 @@ -// $XConsortium: indicator1 /main/1 1995/11/30 19:16:19 kaleb $ +// $Xorg: indicator1,v 1.3 2000/08/17 19:54:47 cpqbld Exp $ xkb_compatibility "torture1" indicator "Mod1" { Index: xc/programs/xkbcomp/torture/indicator2 diff -u xc/programs/xkbcomp/torture/indicator2:1.1.1.1 xc/programs/xkbcomp/torture/indicator2:1.1.1.2 --- xc/programs/xkbcomp/torture/indicator2:1.1.1.1 Wed Jan 3 02:40:44 1996 +++ xc/programs/xkbcomp/torture/indicator2 Tue Jan 16 18:00:11 2001 @@ -1,4 +1,4 @@ -// $XConsortium: indicator2 /main/1 1995/11/30 19:16:21 kaleb $ +// $Xorg: indicator2,v 1.3 2000/08/17 19:54:47 cpqbld Exp $ xkb_compatibility "torture2" indicator "Num Lock" { Index: xc/programs/xkbcomp/torture/indicator3 diff -u xc/programs/xkbcomp/torture/indicator3:1.1.1.1 xc/programs/xkbcomp/torture/indicator3:1.1.1.2 --- xc/programs/xkbcomp/torture/indicator3:1.1.1.1 Wed Jan 3 02:40:44 1996 +++ xc/programs/xkbcomp/torture/indicator3 Tue Jan 16 18:00:12 2001 @@ -1,4 +1,4 @@ -// $XConsortium: indicator3 /main/1 1995/11/30 19:16:24 kaleb $ +// $Xorg: indicator3,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ xkb_compatibility "torture3" indicator "Mouse Keys" { Index: xc/programs/xkbcomp/torture/mod_compat diff -u xc/programs/xkbcomp/torture/mod_compat:1.1.1.1 xc/programs/xkbcomp/torture/mod_compat:1.1.1.2 --- xc/programs/xkbcomp/torture/mod_compat:1.1.1.1 Wed Jan 3 02:40:44 1996 +++ xc/programs/xkbcomp/torture/mod_compat Tue Jan 16 18:00:13 2001 @@ -1,4 +1,4 @@ -// $XConsortium: mod_compat /main/1 1995/11/30 19:16:27 kaleb $ +// $Xorg: mod_compat,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ xkb_compatibility "torture" virtual_modifiers NumLock,AltGr; Index: xc/programs/xkbcomp/torture/mod_compat1 diff -u xc/programs/xkbcomp/torture/mod_compat1:1.1.1.1 xc/programs/xkbcomp/torture/mod_compat1:1.1.1.2 --- xc/programs/xkbcomp/torture/mod_compat1:1.1.1.1 Wed Jan 3 02:40:44 1996 +++ xc/programs/xkbcomp/torture/mod_compat1 Tue Jan 16 18:00:14 2001 @@ -1,4 +1,4 @@ -// $XConsortium: mod_compat1 /main/1 1995/11/30 19:16:30 kaleb $ +// $Xorg: mod_compat1,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ xkb_compatibility "torture1" modifier Shift { mods= Shift; }; Index: xc/programs/xkbcomp/torture/mod_compat2 diff -u xc/programs/xkbcomp/torture/mod_compat2:1.1.1.1 xc/programs/xkbcomp/torture/mod_compat2:1.1.1.2 --- xc/programs/xkbcomp/torture/mod_compat2:1.1.1.1 Wed Jan 3 02:40:44 1996 +++ xc/programs/xkbcomp/torture/mod_compat2 Tue Jan 16 18:00:16 2001 @@ -1,4 +1,4 @@ -// $XConsortium: mod_compat2 /main/1 1995/11/30 19:16:33 kaleb $ +// $Xorg: mod_compat2,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ xkb_compatibility "torture2" modifier Control { groups= 0x4; mods= Mod1; }; Index: xc/programs/xkbcomp/torture/mod_compat3 diff -u xc/programs/xkbcomp/torture/mod_compat3:1.1.1.1 xc/programs/xkbcomp/torture/mod_compat3:1.1.1.2 --- xc/programs/xkbcomp/torture/mod_compat3:1.1.1.1 Wed Jan 3 02:40:44 1996 +++ xc/programs/xkbcomp/torture/mod_compat3 Tue Jan 16 18:00:16 2001 @@ -1,4 +1,4 @@ -// $XConsortium: mod_compat3 /main/1 1995/11/30 19:16:36 kaleb $ +// $Xorg: mod_compat3,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ xkb_compatibility "torture3" modifier Mod2 { mods= Mod3; }; Index: xc/programs/xkbcomp/torture/mod_compat4 diff -u xc/programs/xkbcomp/torture/mod_compat4:1.1.1.1 xc/programs/xkbcomp/torture/mod_compat4:1.1.1.2 --- xc/programs/xkbcomp/torture/mod_compat4:1.1.1.1 Wed Jan 3 02:40:44 1996 +++ xc/programs/xkbcomp/torture/mod_compat4 Tue Jan 16 18:00:17 2001 @@ -1,4 +1,4 @@ -// $XConsortium: mod_compat4 /main/1 1995/11/30 19:16:38 kaleb $ +// $Xorg: mod_compat4,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ xkb_compatibility "torture4" modifier Mod4 { mods= Mod5; }; Index: xc/programs/xkbcomp/torture/sym_interp diff -u xc/programs/xkbcomp/torture/sym_interp:1.1.1.1 xc/programs/xkbcomp/torture/sym_interp:1.1.1.2 --- xc/programs/xkbcomp/torture/sym_interp:1.1.1.1 Wed Jan 3 02:40:44 1996 +++ xc/programs/xkbcomp/torture/sym_interp Tue Jan 16 18:00:18 2001 @@ -1,4 +1,4 @@ -// $XConsortium: sym_interp /main/1 1995/11/30 19:16:41 kaleb $ +// $Xorg: sym_interp,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ xkb_compatibility "torture" virtual_modifiers NumLock,AltGr; Index: xc/programs/xkbcomp/torture/sym_interp1 diff -u xc/programs/xkbcomp/torture/sym_interp1:1.1.1.1 xc/programs/xkbcomp/torture/sym_interp1:1.1.1.2 --- xc/programs/xkbcomp/torture/sym_interp1:1.1.1.1 Wed Jan 3 02:40:44 1996 +++ xc/programs/xkbcomp/torture/sym_interp1 Tue Jan 16 18:00:20 2001 @@ -1,4 +1,4 @@ -// $XConsortium: sym_interp1 /main/1 1995/11/30 19:16:44 kaleb $ +// $Xorg: sym_interp1,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ xkb_compatibility "torture1" interpret Control_L { Index: xc/programs/xkbcomp/torture/sym_interp2 diff -u xc/programs/xkbcomp/torture/sym_interp2:1.1.1.1 xc/programs/xkbcomp/torture/sym_interp2:1.1.1.2 --- xc/programs/xkbcomp/torture/sym_interp2:1.1.1.1 Wed Jan 3 02:40:44 1996 +++ xc/programs/xkbcomp/torture/sym_interp2 Tue Jan 16 18:00:21 2001 @@ -1,4 +1,4 @@ -// $XConsortium: sym_interp2 /main/1 1995/11/30 19:16:47 kaleb $ +// $Xorg: sym_interp2,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ xkb_compatibility "torture2" interpret ISO_Next_Group { Index: xc/programs/xkbcomp/torture/sym_interp3 diff -u xc/programs/xkbcomp/torture/sym_interp3:1.1.1.1 xc/programs/xkbcomp/torture/sym_interp3:1.1.1.2 --- xc/programs/xkbcomp/torture/sym_interp3:1.1.1.1 Wed Jan 3 02:40:44 1996 +++ xc/programs/xkbcomp/torture/sym_interp3 Tue Jan 16 18:00:23 2001 @@ -1,4 +1,4 @@ -// $XConsortium: sym_interp3 /main/1 1995/11/30 19:16:49 kaleb $ +// $Xorg: sym_interp3,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ xkb_compatibility "torture3" interpret ISO_Prev_Group { Index: xc/programs/xkbcomp/torture/sym_interp4 diff -u xc/programs/xkbcomp/torture/sym_interp4:1.1.1.1 xc/programs/xkbcomp/torture/sym_interp4:1.1.1.2 --- xc/programs/xkbcomp/torture/sym_interp4:1.1.1.1 Wed Jan 3 02:40:44 1996 +++ xc/programs/xkbcomp/torture/sym_interp4 Tue Jan 16 18:00:25 2001 @@ -1,4 +1,4 @@ -// $XConsortium: sym_interp4 /main/1 1995/11/30 19:16:53 kaleb $ +// $Xorg: sym_interp4,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ xkb_compatibility "torture4" virtual_modifiers NumLock,AltGr; Index: xc/programs/xkbcomp/types/Imakefile diff -u xc/programs/xkbcomp/types/Imakefile:3.2 xc/programs/xkbcomp/types/Imakefile:3.5 --- xc/programs/xkbcomp/types/Imakefile:3.2 Mon Dec 23 02:13:47 1996 +++ xc/programs/xkbcomp/types/Imakefile Fri May 18 22:05:56 2001 @@ -1,6 +1,12 @@ -XCOMM $XConsortium: Imakefile /main/2 1996/09/03 19:45:57 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ - DATAFILES = basic cancel nocancel complete default mousekeys iso9995 pc + + + +XCOMM $XFree86: xc/programs/xkbcomp/types/Imakefile,v 3.5 2001/05/19 02:05:56 dawes Exp $ + + + DATAFILES = basic cancel nocancel complete default mousekeys iso9995 pc extra all:: Index: xc/programs/xkbcomp/types/basic diff -u xc/programs/xkbcomp/types/basic:1.1.1.3 xc/programs/xkbcomp/types/basic:1.1.1.4 --- xc/programs/xkbcomp/types/basic:1.1.1.3 Sun Feb 4 02:40:57 1996 +++ xc/programs/xkbcomp/types/basic Tue Jan 16 18:00:29 2001 @@ -1,4 +1,4 @@ -// $XConsortium: basic /main/6 1996/01/27 18:06:50 kaleb $ +// $Xorg: basic,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ default xkb_types "basic" { // Fairly standard definitions for Index: xc/programs/xkbcomp/types/cancel diff -u xc/programs/xkbcomp/types/cancel:1.1.1.2 xc/programs/xkbcomp/types/cancel:1.1.1.3 --- xc/programs/xkbcomp/types/cancel:1.1.1.2 Sun Feb 4 02:41:04 1996 +++ xc/programs/xkbcomp/types/cancel Tue Jan 16 18:00:30 2001 @@ -1,4 +1,4 @@ -// $XConsortium: cancel /main/1 1996/02/02 14:22:30 kaleb $ +// $Xorg: cancel,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ partial default xkb_types "Shift_Cancels_Caps" { override type "TWO_LEVEL" { Index: xc/programs/xkbcomp/types/complete diff -u xc/programs/xkbcomp/types/complete:1.1.1.3 xc/programs/xkbcomp/types/complete:1.2 --- xc/programs/xkbcomp/types/complete:1.1.1.3 Sun Feb 4 02:40:58 1996 +++ xc/programs/xkbcomp/types/complete Fri May 18 19:35:35 2001 @@ -1,8 +1,15 @@ -// $XConsortium: complete /main/5 1996/01/27 18:06:55 kaleb $ +// $Xorg: complete,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ +// +// +// +// +// $XFree86: xc/programs/xkbcomp/types/complete,v 1.2 2001/05/18 23:35:35 dawes Exp $ + default xkb_types "complete" { include "basic" replace "nocancel" include "mousekeys" include "pc" include "iso9995" + include "extra" }; Index: xc/programs/xkbcomp/types/default diff -u xc/programs/xkbcomp/types/default:1.1.1.3 xc/programs/xkbcomp/types/default:1.2 --- xc/programs/xkbcomp/types/default:1.1.1.3 Sun Feb 4 02:40:59 1996 +++ xc/programs/xkbcomp/types/default Fri May 18 19:35:35 2001 @@ -1,7 +1,14 @@ -// $XConsortium: default /main/5 1996/01/27 18:06:59 kaleb $ +// $Xorg: default,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ +// +// +// +// +// $XFree86: xc/programs/xkbcomp/types/default,v 1.2 2001/05/18 23:35:35 dawes Exp $ + default xkb_types "default" { include "basic" include "pc" include "iso9995" + include "extra" include "mousekeys" }; Index: xc/programs/xkbcomp/types/extra diff -u /dev/null xc/programs/xkbcomp/types/extra:1.1 --- /dev/null Mon Jun 4 12:42:59 2001 +++ xc/programs/xkbcomp/types/extra Fri May 18 19:35:35 2001 @@ -0,0 +1,40 @@ +// $XFree86: xc/programs/xkbcomp/types/extra,v 1.1 2001/05/18 23:35:35 dawes Exp $ + +partial default xkb_types "default" { + // Definition for a key type used for the czech keymap, for instance. + // Defines style a with four level shift. It is similar to three_level + // type used for iso9995 but it lets the shift key behave "normally". + + virtual_modifiers LevelThree; + + type "FOUR_LEVEL" { + modifiers = Shift+LevelThree; + map[None] = Level1; + map[Shift] = Level2; + map[LevelThree] = Level3; + map[Shift+LevelThree] = Level4; + level_name[Level1] = "Base"; + level_name[Level2] = "Shift"; + level_name[Level3] = "Alt Base"; + level_name[Level4] = "Shift Alt"; + }; + + // This enables the four level shifting also for the keypad. + type "FOUR_LEVEL_KEYPAD" { + modifiers = Shift+NumLock+LevelThree; + map[None] = Level1; + map[Shift] = Level2; + map[NumLock] = Level2; + map[Shift+NumLock] = Level1; + map[LevelThree] = Level3; + map[Shift+LevelThree] = Level4; + map[NumLock+LevelThree] = Level4; + map[Shift+NumLock+LevelThree] = Level3; + level_name[Level1] = "Base"; + level_name[Level2] = "Number"; + level_name[Level3] = "Alt Base"; + level_name[Level4] = "Alt Number"; + }; + +}; + Index: xc/programs/xkbcomp/types/iso9995 diff -u xc/programs/xkbcomp/types/iso9995:1.1.1.3 xc/programs/xkbcomp/types/iso9995:1.1.1.4 --- xc/programs/xkbcomp/types/iso9995:1.1.1.3 Sun Feb 4 02:41:00 1996 +++ xc/programs/xkbcomp/types/iso9995 Tue Jan 16 18:00:35 2001 @@ -1,4 +1,4 @@ -// $XConsortium: iso9995 /main/5 1996/01/27 18:07:03 kaleb $ +// $Xorg: iso9995,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ partial default xkb_types "default" { // Definition for a key type which Index: xc/programs/xkbcomp/types/mousekeys diff -u xc/programs/xkbcomp/types/mousekeys:1.1.1.1 xc/programs/xkbcomp/types/mousekeys:1.1.1.2 --- xc/programs/xkbcomp/types/mousekeys:1.1.1.1 Wed Jan 3 02:40:41 1996 +++ xc/programs/xkbcomp/types/mousekeys Tue Jan 16 18:00:36 2001 @@ -1,4 +1,4 @@ -// $XConsortium: mousekeys /main/2 1995/12/07 21:44:51 kaleb $ +// $Xorg: mousekeys,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ // partial default xkb_types "default" { virtual_modifiers Alt; Index: xc/programs/xkbcomp/types/nocancel diff -u xc/programs/xkbcomp/types/nocancel:1.1.1.2 xc/programs/xkbcomp/types/nocancel:1.1.1.3 --- xc/programs/xkbcomp/types/nocancel:1.1.1.2 Sun Feb 4 02:41:01 1996 +++ xc/programs/xkbcomp/types/nocancel Tue Jan 16 18:00:39 2001 @@ -1,4 +1,4 @@ -// $XConsortium: nocancel /main/3 1996/01/27 18:07:06 kaleb $ +// $Xorg: nocancel,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ // partial default xkb_types "nocancel" { // alternate definition for the Index: xc/programs/xkbcomp/types/pc diff -u xc/programs/xkbcomp/types/pc:1.1.1.2 xc/programs/xkbcomp/types/pc:1.1.1.3 --- xc/programs/xkbcomp/types/pc:1.1.1.2 Sun Feb 4 02:41:02 1996 +++ xc/programs/xkbcomp/types/pc Tue Jan 16 18:00:40 2001 @@ -1,4 +1,4 @@ -// $XConsortium: pc /main/3 1996/01/27 18:07:10 kaleb $ +// $Xorg: pc,v 1.3 2000/08/17 19:54:48 cpqbld Exp $ // partial default xkb_types "default" { Index: xc/programs/xkbevd/Imakefile diff -u xc/programs/xkbevd/Imakefile:3.1 xc/programs/xkbevd/Imakefile:3.2 --- xc/programs/xkbevd/Imakefile:3.1 Mon Dec 23 02:13:52 1996 +++ xc/programs/xkbevd/Imakefile Wed Jan 17 18:46:07 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/3 1996/09/04 09:36:24 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:49 cpqbld Exp $ SRCS = xkbevd.c cfgscan.c cfgparse.c \ evargs.c printev.c utils.c Index: xc/programs/xkbevd/cfgparse.y diff -u xc/programs/xkbevd/cfgparse.y:1.3 xc/programs/xkbevd/cfgparse.y:1.4 --- xc/programs/xkbevd/cfgparse.y:1.3 Tue Mar 2 06:49:59 1999 +++ xc/programs/xkbevd/cfgparse.y Wed Jan 17 18:46:07 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: cfgparse.y /main/5 1996/01/14 16:49:02 kaleb $ */ +/* $Xorg: cfgparse.y,v 1.3 2000/08/17 19:54:49 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbevd/cfgparse.y,v 1.3 1999/03/02 11:49:59 dawes Exp $ */ +/* $XFree86: xc/programs/xkbevd/cfgparse.y,v 1.4 2001/01/17 23:46:07 dawes Exp $ */ %token END_OF_FILE 0 Index: xc/programs/xkbevd/cfgscan.c diff -u xc/programs/xkbevd/cfgscan.c:3.5 xc/programs/xkbevd/cfgscan.c:3.6 --- xc/programs/xkbevd/cfgscan.c:3.5 Tue Mar 2 05:42:25 1999 +++ xc/programs/xkbevd/cfgscan.c Wed Jan 17 18:46:07 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: cfgscan.c /main/2 1995/12/07 21:27:36 kaleb $ */ -/* $XFree86: xc/programs/xkbevd/cfgscan.c,v 3.5 1999/03/02 10:42:25 dawes Exp $ */ +/* $Xorg: cfgscan.c,v 1.3 2000/08/17 19:54:49 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. @@ -25,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbevd/cfgscan.c,v 3.6 2001/01/17 23:46:07 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/xkbevd/evargs.c diff -u xc/programs/xkbevd/evargs.c:1.3 xc/programs/xkbevd/evargs.c:1.4 --- xc/programs/xkbevd/evargs.c:1.3 Tue Mar 2 06:49:59 1999 +++ xc/programs/xkbevd/evargs.c Wed Jan 17 18:46:08 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: evargs.c /main/2 1995/12/07 21:27:46 kaleb $ */ +/* $Xorg: evargs.c,v 1.3 2000/08/17 19:54:49 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbevd/evargs.c,v 1.3 1999/03/02 11:49:59 dawes Exp $ */ +/* $XFree86: xc/programs/xkbevd/evargs.c,v 1.4 2001/01/17 23:46:08 dawes Exp $ */ #define DEBUG_VAR evargsDebug #include "xkbevd.h" Index: xc/programs/xkbevd/example.cf diff -u xc/programs/xkbevd/example.cf:1.1.1.1 xc/programs/xkbevd/example.cf:1.1.1.2 --- xc/programs/xkbevd/example.cf:1.1.1.1 Tue Jan 16 05:21:59 1996 +++ xc/programs/xkbevd/example.cf Tue Jan 16 18:00:46 2001 @@ -1,4 +1,4 @@ -//$XConsortium: example.cf /main/2 1996/01/14 19:32:28 kaleb $ +//$Xorg: example.cf,v 1.3 2000/08/17 19:54:49 cpqbld Exp $ soundDirectory = "/space/erik/.xkb/sounds/" Bell() "ss/08.ting.aifc" Index: xc/programs/xkbevd/printev.c diff -u xc/programs/xkbevd/printev.c:3.3 xc/programs/xkbevd/printev.c:3.4 --- xc/programs/xkbevd/printev.c:3.3 Tue Mar 2 06:49:59 1999 +++ xc/programs/xkbevd/printev.c Wed Jan 17 18:46:08 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: printev.c /main/6 1996/09/28 17:18:22 rws $ */ +/* $Xorg: printev.c,v 1.3 2000/08/17 19:54:49 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbevd/printev.c,v 3.3 1999/03/02 11:49:59 dawes Exp $ */ +/* $XFree86: xc/programs/xkbevd/printev.c,v 3.4 2001/01/17 23:46:08 dawes Exp $ */ #define DEBUG_VAR printevDebug #include "xkbevd.h" Index: xc/programs/xkbevd/tokens.h diff -u xc/programs/xkbevd/tokens.h:1.1.1.1 xc/programs/xkbevd/tokens.h:1.1.1.2 --- xc/programs/xkbevd/tokens.h:1.1.1.1 Wed Jan 3 02:41:15 1996 +++ xc/programs/xkbevd/tokens.h Tue Jan 16 18:00:49 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: tokens.h /main/2 1995/12/07 21:28:01 kaleb $ */ +/* $Xorg: tokens.h,v 1.3 2000/08/17 19:54:49 cpqbld Exp $ */ /************************************************************ Copyright (c) 1994 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbevd/utils.c diff -u xc/programs/xkbevd/utils.c:3.3 xc/programs/xkbevd/utils.c:3.4 --- xc/programs/xkbevd/utils.c:3.3 Tue Mar 2 05:42:26 1999 +++ xc/programs/xkbevd/utils.c Wed Jan 17 18:46:08 2001 @@ -1,7 +1,6 @@ /*\ - * $XConsortium: utils.c /main/2 1996/12/04 10:24:13 lehors $ - * $XFree86: xc/programs/xkbevd/utils.c,v 3.3 1999/03/02 10:42:26 dawes Exp $ + * $XFree86: xc/programs/xkbevd/utils.c,v 3.4 2001/01/17 23:46:08 dawes Exp $ * * COPYRIGHT 1990 * DIGITAL EQUIPMENT CORPORATION @@ -26,6 +25,7 @@ * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. \*/ +/* $Xorg: utils.c,v 1.5 2000/08/17 19:54:49 cpqbld Exp $ */ #include "utils.h" #include <ctype.h> Index: xc/programs/xkbevd/utils.h diff -u xc/programs/xkbevd/utils.h:1.3 xc/programs/xkbevd/utils.h:1.4 --- xc/programs/xkbevd/utils.h:1.3 Tue Mar 2 06:49:59 1999 +++ xc/programs/xkbevd/utils.h Wed Jan 17 18:46:09 2001 @@ -2,7 +2,7 @@ #define UTILS_H 1 /*\ - * $XConsortium: utils.h /main/1 1995/11/30 19:18:33 kaleb $ + * $Xorg: utils.h,v 1.3 2000/08/17 19:54:49 cpqbld Exp $ * * COPYRIGHT 1990 * DIGITAL EQUIPMENT CORPORATION @@ -27,7 +27,7 @@ * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. \*/ -/* $XFree86: xc/programs/xkbevd/utils.h,v 1.3 1999/03/02 11:49:59 dawes Exp $ */ +/* $XFree86: xc/programs/xkbevd/utils.h,v 1.4 2001/01/17 23:46:09 dawes Exp $ */ /***====================================================================***/ Index: xc/programs/xkbevd/xkbevd.c diff -u xc/programs/xkbevd/xkbevd.c:3.7 xc/programs/xkbevd/xkbevd.c:3.8 --- xc/programs/xkbevd/xkbevd.c:3.7 Tue Mar 2 05:42:27 1999 +++ xc/programs/xkbevd/xkbevd.c Wed Jan 17 18:46:09 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: xkbevd.c /main/6 1996/09/28 17:18:29 rws $ */ -/* $XFree86: xc/programs/xkbevd/xkbevd.c,v 3.7 1999/03/02 10:42:27 dawes Exp $ */ +/* $Xorg: xkbevd.c,v 1.4 2000/08/17 19:54:49 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -25,6 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbevd/xkbevd.c,v 3.8 2001/01/17 23:46:09 dawes Exp $ */ #define DEBUG_VAR xkbevdDebug #include <X11/Xosdefs.h> @@ -537,7 +537,6 @@ if (soundDir==NULL) soundDir= DFLT_SOUND_DIR; XkbStdBellEvent(dpy,None,0,XkbBI_ImAlive); while (1) { - XNextEvent(dpy,&ev.core); if ((!ProcessMatchingConfig(&ev))&&(ev.type==xkbEventCode)&& (ev.any.xkb_type==XkbBellNotify)) { Index: xc/programs/xkbevd/xkbevd.h diff -u xc/programs/xkbevd/xkbevd.h:3.3 xc/programs/xkbevd/xkbevd.h:3.4 --- xc/programs/xkbevd/xkbevd.h:3.3 Tue Mar 2 06:50:00 1999 +++ xc/programs/xkbevd/xkbevd.h Wed Jan 17 18:46:09 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: xkbevd.h /main/3 1996/09/28 17:18:35 rws $ */ +/* $Xorg: xkbevd.h,v 1.3 2000/08/17 19:54:49 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbevd/xkbevd.h,v 3.3 1999/03/02 11:50:00 dawes Exp $ */ +/* $XFree86: xc/programs/xkbevd/xkbevd.h,v 3.4 2001/01/17 23:46:09 dawes Exp $ */ #ifndef XKBEVD_H #define XKBEVD_H 1 Index: xc/programs/xkbevd/xkbevd.man diff -u xc/programs/xkbevd/xkbevd.man:1.4 xc/programs/xkbevd/xkbevd.man:1.7 --- xc/programs/xkbevd/xkbevd.man:1.4 Sun Oct 4 05:41:36 1998 +++ xc/programs/xkbevd/xkbevd.man Sat Jan 27 13:21:16 2001 @@ -1,5 +1,8 @@ -.\" $TOG: xkbevd.man /main/6 1998/02/12 09:34:24 kaleb $ -.TH XKBCOMP 1 "Release 6.4" "X Version 11" +.\" $Xorg: xkbevd.man,v 1.3 2000/08/17 19:54:49 cpqbld Exp $ +.\" +.\" $XFree86: xc/programs/xkbevd/xkbevd.man,v 1.7 2001/01/27 18:21:16 dawes Exp $ +.\" +.TH XKBCOMP 1 __xorgversion__ .SH NAME xkbevd \- XKB event daemon .SH SYNOPSIS @@ -86,11 +89,11 @@ Print more information, including debugging messages. Multiple specifications of \fI-v\fP cause more output, to a point. .SH "SEE ALSO" -X(1) +X(__miscmansuffix__) .SH COPYRIGHT Copyright 1995, Silicon Graphics Computer Systems Copyright 1995, 1998 The Open Group .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHOR Erik Fortune, Silicon Graphics Index: xc/programs/xkbprint/Imakefile diff -u xc/programs/xkbprint/Imakefile:1.1.1.1 xc/programs/xkbprint/Imakefile:1.1.1.2 --- xc/programs/xkbprint/Imakefile:1.1.1.1 Wed Jan 3 02:41:15 1996 +++ xc/programs/xkbprint/Imakefile Tue Jan 16 18:00:57 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/1 1995/11/30 19:19:15 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:49 cpqbld Exp $ SRCS = xkbprint.c utils.c psgeom.c OBJS = xkbprint.o utils.o psgeom.o Index: xc/programs/xkbprint/isokeys.h diff -u xc/programs/xkbprint/isokeys.h:1.1.1.1 xc/programs/xkbprint/isokeys.h:1.1.1.2 --- xc/programs/xkbprint/isokeys.h:1.1.1.1 Wed Jan 3 02:41:15 1996 +++ xc/programs/xkbprint/isokeys.h Tue Jan 16 18:00:59 2001 @@ -1,7 +1,7 @@ #ifndef _ISOKEYS_H_ #define _ISOKEYS_H_ 1 -/* $XConsortium: isokeys.h /main/1 1995/11/30 19:19:18 kaleb $ */ +/* $Xorg: isokeys.h,v 1.3 2000/08/17 19:54:49 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbprint/psgeom.c diff -u xc/programs/xkbprint/psgeom.c:1.3 xc/programs/xkbprint/psgeom.c:1.4 --- xc/programs/xkbprint/psgeom.c:1.3 Tue Mar 2 06:50:01 1999 +++ xc/programs/xkbprint/psgeom.c Wed Jan 17 18:46:10 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: psgeom.c /main/6 1996/02/02 14:27:20 kaleb $ */ +/* $Xorg: psgeom.c,v 1.4 2000/08/17 19:54:50 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbprint/psgeom.c,v 1.3 1999/03/02 11:50:01 dawes Exp $ */ +/* $XFree86: xc/programs/xkbprint/psgeom.c,v 1.4 2001/01/17 23:46:10 dawes Exp $ */ #define XK_TECHNICAL #define XK_PUBLISHING Index: xc/programs/xkbprint/utils.c diff -u xc/programs/xkbprint/utils.c:3.3 xc/programs/xkbprint/utils.c:3.4 --- xc/programs/xkbprint/utils.c:3.3 Tue Mar 2 05:42:29 1999 +++ xc/programs/xkbprint/utils.c Wed Jan 17 18:46:11 2001 @@ -1,7 +1,6 @@ /*\ - * $XConsortium: utils.c /main/2 1996/12/04 10:24:03 lehors $ - * $XFree86: xc/programs/xkbprint/utils.c,v 3.3 1999/03/02 10:42:29 dawes Exp $ + * $Xorg: utils.c,v 1.5 2000/08/17 19:54:50 cpqbld Exp $ * * COPYRIGHT 1990 * DIGITAL EQUIPMENT CORPORATION @@ -26,6 +25,7 @@ * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. \*/ +/* $XFree86: xc/programs/xkbprint/utils.c,v 3.4 2001/01/17 23:46:11 dawes Exp $ */ #include "utils.h" #include <ctype.h> Index: xc/programs/xkbprint/utils.h diff -u xc/programs/xkbprint/utils.h:1.3 xc/programs/xkbprint/utils.h:1.4 --- xc/programs/xkbprint/utils.h:1.3 Tue Mar 2 06:50:01 1999 +++ xc/programs/xkbprint/utils.h Wed Jan 17 18:46:11 2001 @@ -2,7 +2,7 @@ #define UTILS_H 1 /*\ - * $XConsortium: utils.h /main/1 1995/11/30 19:18:33 kaleb $ + * $Xorg: utils.h,v 1.3 2000/08/17 19:54:50 cpqbld Exp $ * * COPYRIGHT 1990 * DIGITAL EQUIPMENT CORPORATION @@ -27,7 +27,7 @@ * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. \*/ -/* $XFree86: xc/programs/xkbprint/utils.h,v 1.3 1999/03/02 11:50:01 dawes Exp $ */ +/* $XFree86: xc/programs/xkbprint/utils.h,v 1.4 2001/01/17 23:46:11 dawes Exp $ */ /***====================================================================***/ Index: xc/programs/xkbprint/xkbprint.c diff -u xc/programs/xkbprint/xkbprint.c:3.7 xc/programs/xkbprint/xkbprint.c:3.8 --- xc/programs/xkbprint/xkbprint.c:3.7 Tue Mar 2 05:42:29 1999 +++ xc/programs/xkbprint/xkbprint.c Wed Jan 17 18:46:11 2001 @@ -1,4 +1,4 @@ -/* $TOG: xkbprint.c /main/6 1997/06/10 06:56:25 kaleb $ */ +/* $Xorg: xkbprint.c,v 1.4 2000/08/17 19:54:50 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbprint/xkbprint.c,v 3.7 1999/03/02 10:42:29 dawes Exp $ */ +/* $XFree86: xc/programs/xkbprint/xkbprint.c,v 3.8 2001/01/17 23:46:11 dawes Exp $ */ #include <stdio.h> #include <ctype.h> Index: xc/programs/xkbprint/xkbprint.h diff -u xc/programs/xkbprint/xkbprint.h:1.1.1.2 xc/programs/xkbprint/xkbprint.h:1.1.1.3 --- xc/programs/xkbprint/xkbprint.h:1.1.1.2 Sat Jan 6 21:38:29 1996 +++ xc/programs/xkbprint/xkbprint.h Tue Jan 16 18:01:08 2001 @@ -1,7 +1,7 @@ #ifndef _XKBPRINT_H_ #define _XKBPRINT_H_ 1 -/* $XConsortium: xkbprint.h /main/2 1996/01/01 10:58:29 kaleb $ */ +/* $Xorg: xkbprint.h,v 1.3 2000/08/17 19:54:50 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbprint/xkbprint.man diff -u xc/programs/xkbprint/xkbprint.man:1.4 xc/programs/xkbprint/xkbprint.man:1.7 --- xc/programs/xkbprint/xkbprint.man:1.4 Sun Oct 4 05:41:36 1998 +++ xc/programs/xkbprint/xkbprint.man Sat Jan 27 13:21:16 2001 @@ -1,5 +1,8 @@ -.\" $TOG: xkbprint.man /main/7 1998/02/12 09:36:54 kaleb $ -.TH XKBPRINT 1 "Release 6.4" "X Version 11" +.\" $Xorg: xkbprint.man,v 1.3 2000/08/17 19:54:50 cpqbld Exp $ +.\" +.\" $XFree86: xc/programs/xkbprint/xkbprint.man,v 1.7 2001/01/27 18:21:16 dawes Exp $ +.\" +.TH XKBPRINT 1 __xorgversion__ .SH NAME xkbprint \- print an XKB keyboard description .SH SYNOPSIS @@ -100,11 +103,11 @@ .B -w\ \fIlevel\fP Sets warning level (0 for no warning, 10 for all warnings). .SH "SEE ALSO" -X(1),xkbcomp(1) +X(__miscmansuffix__),xkbcomp(1) .SH COPYRIGHT Copyright 1995, Silicon Graphics Computer Systems Copyright 1995, 1998 The Open Group .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHOR Erik Fortune, Silicon Graphics Index: xc/programs/xkbutils/Imakefile diff -u xc/programs/xkbutils/Imakefile:3.1 xc/programs/xkbutils/Imakefile:3.2 --- xc/programs/xkbutils/Imakefile:3.1 Fri Feb 9 05:18:30 1996 +++ xc/programs/xkbutils/Imakefile Wed Jan 17 18:46:12 2001 @@ -1,5 +1,9 @@ -XCOMM $XConsortium: Imakefile /main/3 1996/02/05 10:59:03 kaleb $ -XCOMM $XFree86: xc/programs/xkbutils/Imakefile,v 3.1 1996/02/09 10:18:30 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:51 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xkbutils/Imakefile,v 3.2 2001/01/17 23:46:12 dawes Exp $ VLED_SRCS = xkbvleds.c LED.c utils.c VLED_OBJS = xkbvleds.o LED.o utils.o Index: xc/programs/xkbutils/LED.c diff -u xc/programs/xkbutils/LED.c:1.3 xc/programs/xkbutils/LED.c:1.4 --- xc/programs/xkbutils/LED.c:1.3 Tue Mar 2 06:50:02 1999 +++ xc/programs/xkbutils/LED.c Wed Jan 17 18:46:13 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: LED.c /main/2 1995/12/07 21:31:02 kaleb $ */ +/* $Xorg: LED.c,v 1.3 2000/08/17 19:54:51 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -24,7 +24,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbutils/LED.c,v 1.3 1999/03/02 11:50:02 dawes Exp $ */ +/* $XFree86: xc/programs/xkbutils/LED.c,v 1.4 2001/01/17 23:46:13 dawes Exp $ */ #include <X11/IntrinsicP.h> #include <X11/StringDefs.h> Index: xc/programs/xkbutils/LED.h diff -u xc/programs/xkbutils/LED.h:1.1.1.1 xc/programs/xkbutils/LED.h:1.1.1.2 --- xc/programs/xkbutils/LED.h:1.1.1.1 Wed Jan 3 02:41:16 1996 +++ xc/programs/xkbutils/LED.h Tue Jan 16 18:01:13 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: LED.h /main/1 1995/11/30 19:20:18 kaleb $ */ +/* $Xorg: LED.h,v 1.3 2000/08/17 19:54:51 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbutils/LEDP.h diff -u xc/programs/xkbutils/LEDP.h:1.1.1.1 xc/programs/xkbutils/LEDP.h:1.1.1.2 --- xc/programs/xkbutils/LEDP.h:1.1.1.1 Wed Jan 3 02:41:16 1996 +++ xc/programs/xkbutils/LEDP.h Tue Jan 16 18:01:14 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: LEDP.h /main/1 1995/11/30 19:20:21 kaleb $ */ +/* $Xorg: LEDP.h,v 1.3 2000/08/17 19:54:51 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. Index: xc/programs/xkbutils/utils.c diff -u xc/programs/xkbutils/utils.c:3.3 xc/programs/xkbutils/utils.c:3.4 --- xc/programs/xkbutils/utils.c:3.3 Tue Mar 2 05:42:31 1999 +++ xc/programs/xkbutils/utils.c Wed Jan 17 18:46:13 2001 @@ -1,7 +1,6 @@ /*\ - * $XConsortium: utils.c /main/2 1996/12/04 10:24:08 lehors $ - * $XFree86: xc/programs/xkbutils/utils.c,v 3.3 1999/03/02 10:42:31 dawes Exp $ + * $Xorg: utils.c,v 1.6 2000/08/17 19:54:51 cpqbld Exp $ * * COPYRIGHT 1990 * DIGITAL EQUIPMENT CORPORATION @@ -26,6 +25,7 @@ * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. \*/ +/* $XFree86: xc/programs/xkbutils/utils.c,v 3.4 2001/01/17 23:46:13 dawes Exp $ */ #include "utils.h" #include <ctype.h> Index: xc/programs/xkbutils/utils.h diff -u xc/programs/xkbutils/utils.h:1.3 xc/programs/xkbutils/utils.h:1.4 --- xc/programs/xkbutils/utils.h:1.3 Tue Mar 2 06:50:02 1999 +++ xc/programs/xkbutils/utils.h Wed Jan 17 18:46:13 2001 @@ -2,7 +2,7 @@ #define UTILS_H 1 /*\ - * $XConsortium: utils.h /main/1 1995/11/30 19:18:33 kaleb $ + * $Xorg: utils.h,v 1.3 2000/08/17 19:54:51 cpqbld Exp $ * * COPYRIGHT 1990 * DIGITAL EQUIPMENT CORPORATION @@ -27,7 +27,7 @@ * used in advertising or publicity pertaining to distribution of the * software without specific, written prior permission. \*/ -/* $XFree86: xc/programs/xkbutils/utils.h,v 1.3 1999/03/02 11:50:02 dawes Exp $ */ +/* $XFree86: xc/programs/xkbutils/utils.h,v 1.4 2001/01/17 23:46:13 dawes Exp $ */ /***====================================================================***/ Index: xc/programs/xkbutils/xkbbell.c diff -u xc/programs/xkbutils/xkbbell.c:1.3 xc/programs/xkbutils/xkbbell.c:1.5 --- xc/programs/xkbutils/xkbbell.c:1.3 Tue Mar 2 06:50:02 1999 +++ xc/programs/xkbutils/xkbbell.c Sun Apr 1 10:00:22 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: xkbbell.c /main/2 1995/12/07 21:31:13 kaleb $ */ +/* $Xorg: xkbbell.c,v 1.4 2000/08/17 19:54:51 cpqbld Exp $ */ /************************************************************ Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. @@ -24,9 +24,10 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ -/* $XFree86: xc/programs/xkbutils/xkbbell.c,v 1.3 1999/03/02 11:50:02 dawes Exp $ */ +/* $XFree86: xc/programs/xkbutils/xkbbell.c,v 1.5 2001/04/01 14:00:22 tsi Exp $ */ #include <stdio.h> +#include <string.h> #include <X11/Xproto.h> #include <X11/Xlib.h> #include <X11/X.h> Index: xc/programs/xkbutils/xkbvleds.c diff -u xc/programs/xkbutils/xkbvleds.c:3.3 xc/programs/xkbutils/xkbvleds.c:3.5 --- xc/programs/xkbutils/xkbvleds.c:3.3 Tue Mar 2 05:42:32 1999 +++ xc/programs/xkbutils/xkbvleds.c Sun Apr 1 10:00:22 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: xkbvleds.c /main/5 1996/01/14 18:42:34 kaleb $ */ -/* $XFree86: xc/programs/xkbutils/xkbvleds.c,v 3.3 1999/03/02 10:42:32 dawes Exp $ */ +/* $Xorg: xkbvleds.c,v 1.4 2000/08/17 19:54:51 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -25,7 +24,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbutils/xkbvleds.c,v 3.5 2001/04/01 14:00:22 tsi Exp $ */ +#include <stdlib.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/XKBlib.h> Index: xc/programs/xkbutils/xkbwatch.c diff -u xc/programs/xkbutils/xkbwatch.c:3.3 xc/programs/xkbutils/xkbwatch.c:3.5 --- xc/programs/xkbutils/xkbwatch.c:3.3 Tue Mar 2 05:42:32 1999 +++ xc/programs/xkbutils/xkbwatch.c Sun Apr 1 10:00:22 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: xkbwatch.c /main/5 1996/01/14 18:53:12 kaleb $ */ -/* $XFree86: xc/programs/xkbutils/xkbwatch.c,v 3.3 1999/03/02 10:42:32 dawes Exp $ */ +/* $Xorg: xkbwatch.c,v 1.4 2000/08/17 19:54:51 cpqbld Exp $ */ /************************************************************ Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. @@ -25,7 +24,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. ********************************************************/ +/* $XFree86: xc/programs/xkbutils/xkbwatch.c,v 3.5 2001/04/01 14:00:22 tsi Exp $ */ +#include <stdlib.h> #include <X11/X.h> #include <X11/Xlib.h> #include <X11/XKBlib.h> Index: xc/programs/xkill/Imakefile diff -u xc/programs/xkill/Imakefile:1.1.1.1 xc/programs/xkill/Imakefile:1.3 --- xc/programs/xkill/Imakefile:1.1.1.1 Wed Apr 27 03:13:17 1994 +++ xc/programs/xkill/Imakefile Sun Apr 1 10:00:22 2001 @@ -1,5 +1,11 @@ -XCOMM $XConsortium: Imakefile,v 1.4 91/07/17 00:47:39 gildea Exp $ - DEPLIBS = $(DEPXMULIB) $(DEPXLIB) -LOCAL_LIBRARIES = $(XMULIB) $(XLIB) +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:51 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xkill/Imakefile,v 1.3 2001/04/01 14:00:22 tsi Exp $ + + DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XMUULIB) $(XLIB) SimpleProgramTarget(xkill) Index: xc/programs/xkill/xkill.c diff -u xc/programs/xkill/xkill.c:1.3 xc/programs/xkill/xkill.c:1.5 --- xc/programs/xkill/xkill.c:1.3 Tue Mar 2 06:50:03 1999 +++ xc/programs/xkill/xkill.c Sun Apr 1 10:00:22 2001 @@ -1,4 +1,4 @@ -/* $TOG: xkill.c /main/20 1998/02/09 14:09:10 kaleb $ */ +/* $Xorg: xkill.c,v 1.4 2000/08/17 19:54:51 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xkill/xkill.c,v 1.3 1999/03/02 11:50:03 dawes Exp $ */ +/* $XFree86: xc/programs/xkill/xkill.c,v 1.5 2001/04/01 14:00:22 tsi Exp $ */ /* * xkill - simple program for destroying unwanted clients @@ -34,6 +34,7 @@ */ #include <stdio.h> +#include <stdlib.h> #include <ctype.h> #include <X11/Xos.h> Index: xc/programs/xkill/xkill.man diff -u xc/programs/xkill/xkill.man:1.4 xc/programs/xkill/xkill.man:1.7 --- xc/programs/xkill/xkill.man:1.4 Sun Oct 4 05:41:37 1998 +++ xc/programs/xkill/xkill.man Sat Jan 27 13:21:17 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xkill.man /main/19 1998/02/09 14:09:15 kaleb $ +.\" $Xorg: xkill.man,v 1.3 2000/08/17 19:54:51 cpqbld Exp $ .\" Copyright 1988, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XKILL 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xkill/xkill.man,v 1.7 2001/01/27 18:21:17 dawes Exp $ +.\" +.TH XKILL 1 __xorgversion__ .SH NAME xkill - kill a client by its X resource .SH SYNOPSIS @@ -68,7 +71,7 @@ Specifies a specific pointer button number or the word "any" to use when selecting windows. .SH "SEE ALSO" -X(1), xwininfo(1), XKillClient and XGetPointerMapping in the Xlib Programmers +X(__miscmansuffix__), xwininfo(1), XKillClient and XGetPointerMapping in the Xlib Programmers Manual, KillClient in the X Protocol Specification .SH AUTHOR Jim Fulton, MIT X Consortium Index: xc/programs/xload/Imakefile diff -u xc/programs/xload/Imakefile:1.5.2.1 xc/programs/xload/Imakefile:1.6 --- xc/programs/xload/Imakefile:1.5.2.1 Mon Jan 22 14:49:35 2001 +++ xc/programs/xload/Imakefile Mon Jan 15 15:56:18 2001 @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile /main/30 1996/03/09 09:37:57 kaleb $ -XCOMM $XFree86: xc/programs/xload/Imakefile,v 1.5.2.1 2001/01/22 19:49:35 dawes Exp $ +XCOMM $XFree86: xc/programs/xload/Imakefile,v 1.6 2001/01/15 20:56:18 dawes Exp $ DEPLIBS = XawClientDepLibs LOCAL_LIBRARIES = XawClientLibs Index: xc/programs/xload/get_load.c diff -u xc/programs/xload/get_load.c:1.6 xc/programs/xload/get_load.c:1.8 --- xc/programs/xload/get_load.c:1.6 Tue Nov 14 20:36:17 2000 +++ xc/programs/xload/get_load.c Sun Apr 8 01:00:09 2001 @@ -1,5 +1,5 @@ /* $XConsortium: get_load.c /main/37 1996/03/09 09:38:04 kaleb $ */ -/* $XFree86: xc/programs/xload/get_load.c,v 1.6 2000/11/15 01:36:17 dawes Exp $ */ +/* $XFree86: xc/programs/xload/get_load.c,v 1.8 2001/04/08 05:00:09 torrey Exp $ */ /* Copyright (c) 1989 X Consortium @@ -499,6 +499,40 @@ #else /* __GNU__ */ +#ifdef __DARWIN__ + +#include <mach/mach.h> + +static mach_port_t host_priv_port; + +void InitLoadPoint() +{ + host_priv_port = mach_host_self(); +} + +/* ARGSUSED */ +void GetLoadPoint( w, closure, call_data ) + Widget w; /* unused */ + caddr_t closure; /* unused */ + caddr_t call_data; /* pointer to (double) return value */ +{ + double *loadavg = (double *)call_data; + + struct host_load_info load_data; + int host_count; + kern_return_t kr; + + host_count = sizeof(load_data)/sizeof(integer_t); + kr = host_statistics(host_priv_port, HOST_LOAD_INFO, + (host_info_t)&load_data, &host_count); + if (kr != KERN_SUCCESS) + xload_error("cannot get host statistics", ""); + *loadavg = (double)load_data.avenrun[0]/LOAD_SCALE; + return; +} + +#else /* __DARWIN__ */ + #ifdef LOADSTUB void InitLoadPoint() @@ -592,7 +626,7 @@ } #else /* not __bsdi__ */ -#if BSD >= 199306 +#if defined(BSD) && (BSD >= 199306) void InitLoadPoint() { @@ -707,7 +741,7 @@ #ifndef KERNEL_LOAD_VARIABLE -# if (BSD >= 199103) +# if defined(BSD) && (BSD >= 199103) # define KERNEL_LOAD_VARIABLE "_averunnable" # endif /* BSD >= 199103 */ @@ -849,7 +883,7 @@ } #else /* sun svr4 5.5 or later */ -#if (!defined(SVR4) || !defined(__STDC__)) && !defined(sgi) && !defined(MOTOROLA) && !(BSD >= 199103) && !defined(MINIX) && !defined(__DARWIN__) +#if (!defined(SVR4) || !defined(__STDC__)) && !defined(sgi) && !defined(MOTOROLA) && !(BSD >= 199103) && !defined(MINIX) extern void nlist(); #endif @@ -1070,6 +1104,7 @@ #endif /* __bsdi__ else */ #endif /* __osf__ else */ #endif /* LOADSTUB else */ +#endif /* __DARWIN__ else */ #endif /* __GNU__ else */ #endif /* linux else */ #endif /* AMOEBA else */ Index: xc/programs/xload/xload.man diff -u xc/programs/xload/xload.man:1.1 xc/programs/xload/xload.man:1.3 --- xc/programs/xload/xload.man:1.1 Sat Feb 12 22:26:32 2000 +++ xc/programs/xload/xload.man Sat Jan 27 13:21:17 2001 @@ -1,5 +1,8 @@ .\" $XConsortium: xload.man,v 1.29 94/04/17 20:43:44 matt Exp $ -.TH XLOAD 1 "Release 6" "X Version 11" +.\" +.\" $XFree86: xc/programs/xload/xload.man,v 1.3 2001/01/27 18:21:17 dawes Exp $ +.\" +.TH XLOAD 1 __xorgversion__ .SH NAME xload \- system load average display for X .SH SYNOPSIS @@ -14,7 +17,7 @@ .SH OPTIONS .PP .I Xload -accepts all of the standard X Toolkit command line options (see \fIX(1)\fP). +accepts all of the standard X Toolkit command line options (see \fIX(__miscmansuffix__)\fP). The order of the options in unimportant. \fIxload also accepts the following additional options: .PP @@ -84,7 +87,7 @@ .SH FILES <XRoot>/lib/X11/app-defaults/XLoad - specifies required resources .SH SEE ALSO -X(1), xrdb(1), mem(4), Athena StripChart Widget. +X(__miscmansuffix__), xrdb(1), mem(4), Athena StripChart Widget. .SH BUGS This program requires the ability to open and read the special system file \fI/dev/kmem\fP. Sites that do not allow general access to this file @@ -96,7 +99,7 @@ .SH COPYRIGHT Copyright \(co X Consortium .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHORS K. Shane Hartman (MIT-LCS) and Stuart A. Malone (MIT-LCS); .br Index: xc/programs/xlogo/Imakefile diff -u xc/programs/xlogo/Imakefile:1.1.1.2 xc/programs/xlogo/Imakefile:1.1.1.3 --- xc/programs/xlogo/Imakefile:1.1.1.2 Tue Jan 16 05:25:27 1996 +++ xc/programs/xlogo/Imakefile Tue Jan 16 18:01:24 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/10 1996/01/14 16:51:21 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ DEPLIBS = XawClientDepLibs XkbClientDepLibs LOCAL_LIBRARIES = XawClientLibs XkbClientLibs SRCS = xlogo.c Logo.c Index: xc/programs/xlogo/Logo.c diff -u xc/programs/xlogo/Logo.c:1.3 xc/programs/xlogo/Logo.c:1.4 --- xc/programs/xlogo/Logo.c:1.3 Tue Mar 2 06:50:03 1999 +++ xc/programs/xlogo/Logo.c Wed Jan 17 18:46:16 2001 @@ -1,4 +1,4 @@ -/* $TOG: Logo.c /main/31 1998/02/09 14:09:23 kaleb $ */ +/* $Xorg: Logo.c,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ */ /* Copyright 1988, 1994, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xlogo/Logo.c,v 1.3 1999/03/02 11:50:03 dawes Exp $ */ +/* $XFree86: xc/programs/xlogo/Logo.c,v 1.4 2001/01/17 23:46:16 dawes Exp $ */ #include <X11/StringDefs.h> #include <X11/IntrinsicP.h> Index: xc/programs/xlogo/Logo.h diff -u xc/programs/xlogo/Logo.h:1.1.1.3 xc/programs/xlogo/Logo.h:1.1.1.4 --- xc/programs/xlogo/Logo.h:1.1.1.3 Sun Sep 27 04:01:52 1998 +++ xc/programs/xlogo/Logo.h Tue Jan 16 18:01:26 2001 @@ -1,4 +1,4 @@ -/* $TOG: Logo.h /main/14 1998/02/09 14:09:28 kaleb $ */ +/* $Xorg: Logo.h,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ */ /* Copyright 1988, 1990, 1998 The Open Group Index: xc/programs/xlogo/LogoP.h diff -u xc/programs/xlogo/LogoP.h:1.1.1.2 xc/programs/xlogo/LogoP.h:1.1.1.3 --- xc/programs/xlogo/LogoP.h:1.1.1.2 Sun Sep 27 04:01:53 1998 +++ xc/programs/xlogo/LogoP.h Tue Jan 16 18:01:27 2001 @@ -1,4 +1,4 @@ -/* $TOG: LogoP.h /main/12 1998/02/09 14:09:19 kaleb $ */ +/* $Xorg: LogoP.h,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ */ /* Copyright 1988, 1993, 1998 The Open Group Index: xc/programs/xlogo/XLogo-co.ad diff -u xc/programs/xlogo/XLogo-co.ad:1.1.1.1 xc/programs/xlogo/XLogo-co.ad:1.1.1.2 --- xc/programs/xlogo/XLogo-co.ad:1.1.1.1 Wed Apr 27 03:12:56 1994 +++ xc/programs/xlogo/XLogo-co.ad Tue Jan 16 18:01:28 2001 @@ -1,4 +1,4 @@ -! $XConsortium: XLogo-co.ad,v 1.2 94/02/09 19:44:04 gildea Exp $ +! $Xorg: XLogo-co.ad,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ #include "XLogo" ! MIT colors are Cardinal Red (Pantone 201c) and Silver Grey (Pantone 421c) XLogo*background: rgb:d2/22/32 Index: xc/programs/xlogo/xlogo.c diff -u xc/programs/xlogo/xlogo.c:3.4 xc/programs/xlogo/xlogo.c:3.5 --- xc/programs/xlogo/xlogo.c:3.4 Tue Mar 2 05:42:36 1999 +++ xc/programs/xlogo/xlogo.c Wed Jan 17 18:46:16 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xlogo.c /main/22 1998/02/09 14:09:39 kaleb $ + * $Xorg: xlogo.c,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -21,7 +21,7 @@ * */ -/* $XFree86: xc/programs/xlogo/xlogo.c,v 3.4 1999/03/02 10:42:36 dawes Exp $ */ +/* $XFree86: xc/programs/xlogo/xlogo.c,v 3.5 2001/01/17 23:46:16 dawes Exp $ */ #include <stdio.h> #include <X11/Intrinsic.h> Index: xc/programs/xlogo/xlogo.man diff -u xc/programs/xlogo/xlogo.man:1.4 xc/programs/xlogo/xlogo.man:1.7 --- xc/programs/xlogo/xlogo.man:1.4 Sun Oct 4 05:41:38 1998 +++ xc/programs/xlogo/xlogo.man Sat Jan 27 13:21:17 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xlogo.man /main/28 1998/02/09 14:09:43 kaleb $ +.\" $Xorg: xlogo.man,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XLOGO 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xlogo/xlogo.man,v 1.7 2001/01/27 18:21:17 dawes Exp $ +.\" +.TH XLOGO 1 __xorgversion__ .SH NAME xlogo - X Window System logo .SH SYNOPSIS @@ -71,7 +74,7 @@ .SH FILES <XRoot>/lib/X11/app-defaults/XLogo - specifies required resources .SH SEE ALSO -X(1), xrdb(1) +X(__miscmansuffix__), xrdb(1) .SH AUTHORS Ollie Jones of Apollo Computer and Jim Fulton of the MIT X Consortium wrote the logo graphics routine, based on a graphic design by Danny Index: xc/programs/xlsatoms/Imakefile diff -u xc/programs/xlsatoms/Imakefile:1.1.1.1 xc/programs/xlsatoms/Imakefile:1.3 --- xc/programs/xlsatoms/Imakefile:1.1.1.1 Wed Apr 27 03:20:28 1994 +++ xc/programs/xlsatoms/Imakefile Sun Apr 1 10:00:22 2001 @@ -1,6 +1,12 @@ -XCOMM $XConsortium: Imakefile,v 1.2 91/07/16 23:06:53 gildea Exp $ - DEPLIBS = $(DEPXMULIB) $(DEPXLIB) -LOCAL_LIBRARIES = $(XMULIB) $(XLIB) +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xlsatoms/Imakefile,v 1.3 2001/04/01 14:00:22 tsi Exp $ + + DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XMUULIB) $(XLIB) SimpleProgramTarget(xlsatoms) Index: xc/programs/xlsatoms/xlsatoms.c diff -u xc/programs/xlsatoms/xlsatoms.c:1.3 xc/programs/xlsatoms/xlsatoms.c:1.5 --- xc/programs/xlsatoms/xlsatoms.c:1.3 Sun Mar 7 09:23:35 1999 +++ xc/programs/xlsatoms/xlsatoms.c Sun Apr 1 10:00:23 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xlsatoms.c /main/6 1998/02/09 14:09:48 kaleb $ + * $Xorg: xlsatoms.c,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ * Copyright 1989, 1998 The Open Group @@ -21,9 +21,10 @@ * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xlsatoms/xlsatoms.c,v 1.3 1999/03/07 14:23:35 dawes Exp $ */ +/* $XFree86: xc/programs/xlsatoms/xlsatoms.c,v 1.5 2001/04/01 14:00:23 tsi Exp $ */ #include <stdio.h> +#include <stdlib.h> #include <X11/Xos.h> #include <X11/Xlib.h> #include <X11/Xproto.h> Index: xc/programs/xlsatoms/xlsatoms.man diff -u xc/programs/xlsatoms/xlsatoms.man:1.4 xc/programs/xlsatoms/xlsatoms.man:1.7 --- xc/programs/xlsatoms/xlsatoms.man:1.4 Sun Oct 4 05:41:38 1998 +++ xc/programs/xlsatoms/xlsatoms.man Sat Jan 27 13:21:17 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xlsatoms.man /main/14 1998/02/09 14:09:53 kaleb $ +.\" $Xorg: xlsatoms.man,v 1.3 2000/08/17 19:54:52 cpqbld Exp $ .\" Copyright 1989, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XLSATOMS 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xlsatoms/xlsatoms.man,v 1.7 2001/01/27 18:21:17 dawes Exp $ +.\" +.TH XLSATOMS 1 __xorgversion__ .SH NAME xlsatoms - list interned atoms defined on server .SH SYNOPSIS @@ -52,7 +55,7 @@ exist, a message will be printed on the standard error. .PP .SH "SEE ALSO" -X(1), Xserver(1), xprop(1) +X(__miscmansuffix__), Xserver(1), xprop(1) .SH ENVIRONMENT .TP 8 .B DISPLAY Index: xc/programs/xlsclients/Imakefile diff -u xc/programs/xlsclients/Imakefile:1.1.1.1 xc/programs/xlsclients/Imakefile:1.3 --- xc/programs/xlsclients/Imakefile:1.1.1.1 Wed Apr 27 03:20:19 1994 +++ xc/programs/xlsclients/Imakefile Sun Apr 1 10:00:23 2001 @@ -1,6 +1,12 @@ -XCOMM $XConsortium: Imakefile,v 1.5 91/07/17 16:07:41 gildea Exp $ - DEPLIBS = $(DEPXMULIB) $(DEPXLIB) -LOCAL_LIBRARIES = $(XMULIB) $(XLIB) +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xlsclients/Imakefile,v 1.3 2001/04/01 14:00:23 tsi Exp $ + + DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XMUULIB) $(XLIB) SRCS = xlsclients.c OBJS = xlsclients.o Index: xc/programs/xlsclients/xlscli.man diff -u xc/programs/xlsclients/xlscli.man:1.4 xc/programs/xlsclients/xlscli.man:1.7 --- xc/programs/xlsclients/xlscli.man:1.4 Sun Oct 4 05:41:39 1998 +++ xc/programs/xlsclients/xlscli.man Sat Jan 27 13:21:18 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xlscli.man /main/12 1998/02/09 14:10:02 kaleb $ +.\" $Xorg: xlscli.man,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ .\" Copyright 1991, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XLSCLIENTS 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xlsclients/xlscli.man,v 1.7 2001/01/27 18:21:18 dawes Exp $ +.\" +.TH XLSCLIENTS 1 __xorgversion__ .SH NAME xlsclients - list client applications running on a display .SH SYNOPSIS @@ -53,6 +56,6 @@ .B DISPLAY To get the default host, display number, and screen. .SH "SEE ALSO" -X(1), xwininfo(1), xprop(1) +X(__miscmansuffix__), xwininfo(1), xprop(1) .SH AUTHOR Jim Fulton, MIT X Consortium Index: xc/programs/xlsclients/xlsclients.c diff -u xc/programs/xlsclients/xlsclients.c:1.3 xc/programs/xlsclients/xlsclients.c:1.5 --- xc/programs/xlsclients/xlsclients.c:1.3 Sun Mar 7 09:23:35 1999 +++ xc/programs/xlsclients/xlsclients.c Sun Apr 1 10:00:23 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xlsclients.c /main/8 1998/02/09 14:09:58 kaleb $ + * $Xorg: xlsclients.c,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ * * Copyright 1989, 1998 The Open Group @@ -22,9 +22,10 @@ * * * Author: Jim Fulton, MIT X Consortium */ -/* $XFree86: xc/programs/xlsclients/xlsclients.c,v 1.3 1999/03/07 14:23:35 dawes Exp $ */ +/* $XFree86: xc/programs/xlsclients/xlsclients.c,v 1.5 2001/04/01 14:00:23 tsi Exp $ */ #include <stdio.h> +#include <stdlib.h> #include <ctype.h> #include <X11/Xos.h> #include <X11/Xlib.h> Index: xc/programs/xlsfonts/Imakefile diff -u xc/programs/xlsfonts/Imakefile:1.1.1.1 xc/programs/xlsfonts/Imakefile:1.1.1.2 --- xc/programs/xlsfonts/Imakefile:1.1.1.1 Wed Apr 27 03:13:10 1994 +++ xc/programs/xlsfonts/Imakefile Tue Jan 16 18:01:35 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile,v 1.8 91/07/17 00:47:23 gildea Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ DEPLIBS = $(DEPXLIB) LOCAL_LIBRARIES = $(XLIB) SRCS = xlsfonts.c dsimple.c Index: xc/programs/xlsfonts/dsimple.c diff -u xc/programs/xlsfonts/dsimple.c:3.3 xc/programs/xlsfonts/dsimple.c:3.4 --- xc/programs/xlsfonts/dsimple.c:3.3 Sun Mar 7 06:41:11 1999 +++ xc/programs/xlsfonts/dsimple.c Wed Jan 17 18:46:19 2001 @@ -1,4 +1,4 @@ -/* $TOG: dsimple.c /main/17 1998/02/09 14:10:07 kaleb $ */ +/* $Xorg: dsimple.c,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ */ /* Copyright 1993, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xlsfonts/dsimple.c,v 3.3 1999/03/07 11:41:11 dawes Exp $ */ +/* $XFree86: xc/programs/xlsfonts/dsimple.c,v 3.4 2001/01/17 23:46:19 dawes Exp $ */ #include <X11/Xos.h> #include <X11/Xlib.h> Index: xc/programs/xlsfonts/dsimple.h diff -u xc/programs/xlsfonts/dsimple.h:1.3 xc/programs/xlsfonts/dsimple.h:1.4 --- xc/programs/xlsfonts/dsimple.h:1.3 Sun Oct 4 05:41:39 1998 +++ xc/programs/xlsfonts/dsimple.h Wed Jan 17 18:46:19 2001 @@ -1,4 +1,4 @@ -/* $TOG: dsimple.h /main/5 1998/02/09 14:10:11 kaleb $ */ +/* $Xorg: dsimple.h,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ */ /* Copyright 1993, 1998 The Open Group Index: xc/programs/xlsfonts/xlsfonts.c diff -u xc/programs/xlsfonts/xlsfonts.c:1.4 xc/programs/xlsfonts/xlsfonts.c:1.7 --- xc/programs/xlsfonts/xlsfonts.c:1.4 Sun Dec 26 19:40:14 1999 +++ xc/programs/xlsfonts/xlsfonts.c Fri Apr 27 08:58:28 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xlsfonts.c /main/35 1998/02/09 14:10:16 kaleb $ + * $Xorg: xlsfonts.c,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ * * Copyright 1989, 1998 The Open Group @@ -20,6 +20,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. * */ +/* $XFree86: xc/programs/xlsfonts/xlsfonts.c,v 1.7 2001/04/27 12:58:28 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -450,27 +451,37 @@ static char* stringValued [] = { /* values are atoms */ - "FAMILY_NAME", + /* font name components (see section 3.2 of the XLFD) */ "FOUNDRY", - "STYLE", - "MONOSPACED", - "RELATIVE_WEIGHT", - "RELATIVE_SET", - "CLASSIFICATION", - "CHARSET_REGISTRY", - "CHARSET_ENCODING", - "QUALITY", - "CHARSET_COLLECTIONS", - "FULL_NAME", - "COPYRIGHT", + "FAMILY_NAME", "WEIGHT_NAME", - "SETWIDTH_NAME", "SLANT", - "SPACING", + "SETWIDTH_NAME", "ADD_STYLE_NAME", - "FONTNAME_REGISTRY", + "SPACING", + "CHARSET_REGISTRY", + "CHARSET_ENCODING", + + /* other standard X font properties (see section 3.2 of the XLFD) */ "FONT", + "FACE_NAME", + "FULL_NAME", /* deprecated */ + "COPYRIGHT", + "NOTICE", + "FONT_TYPE", + "FONT_VERSION", + "RASTERIZER_NAME", + "RASTERIZER_VERSION", + + /* unregistered font properties */ + "CHARSET_COLLECTIONS", + "CLASSIFICATION", "DEVICE_FONT_NAME", + "FONTNAME_REGISTRY", + "MONOSPACED", + "QUALITY", + "RELATIVE_SET", + "STYLE", NULL }; Index: xc/programs/xlsfonts/xlsfonts.man diff -u xc/programs/xlsfonts/xlsfonts.man:1.4 xc/programs/xlsfonts/xlsfonts.man:1.7 --- xc/programs/xlsfonts/xlsfonts.man:1.4 Sun Oct 4 05:41:40 1998 +++ xc/programs/xlsfonts/xlsfonts.man Sat Jan 27 13:21:18 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xlsfonts.man /main/23 1998/02/09 14:10:21 kaleb $ +.\" $Xorg: xlsfonts.man,v 1.3 2000/08/17 19:54:53 cpqbld Exp $ .\" Copyright 1988, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XLSFONTS 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xlsfonts/xlsfonts.man,v 1.7 2001/01/27 18:21:18 dawes Exp $ +.\" +.TH XLSFONTS 1 __xorgversion__ .SH NAME xlsfonts \- server font list displayer for X .SH SYNOPSIS @@ -83,7 +86,7 @@ This option specifies the font name pattern to match. .PP .SH "SEE ALSO" -X(1), Xserver(1), xset(1), xfd(1), +X(__miscmansuffix__), Xserver(1), xset(1), xfd(1), .I "X Logical Font Description Conventions" .SH ENVIRONMENT .TP 8 Index: xc/programs/xmag/CutPaste.c diff -u xc/programs/xmag/CutPaste.c:1.4 xc/programs/xmag/CutPaste.c:1.5 --- xc/programs/xmag/CutPaste.c:1.4 Sun Mar 21 02:35:39 1999 +++ xc/programs/xmag/CutPaste.c Wed Jan 17 18:46:19 2001 @@ -1,4 +1,4 @@ -/* $TOG: CutPaste.c /main/9 1998/02/09 14:10:25 kaleb $ */ +/* $Xorg: CutPaste.c,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmag/CutPaste.c,v 1.4 1999/03/21 07:35:39 dawes Exp $ */ +/* $XFree86: xc/programs/xmag/CutPaste.c,v 1.5 2001/01/17 23:46:19 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium */ Index: xc/programs/xmag/Imakefile diff -u xc/programs/xmag/Imakefile:1.1.1.1 xc/programs/xmag/Imakefile:1.1.1.2 --- xc/programs/xmag/Imakefile:1.1.1.1 Wed Apr 27 03:13:20 1994 +++ xc/programs/xmag/Imakefile Tue Jan 16 18:01:41 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile,v 1.11 93/09/04 19:55:44 rws Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ DEFINES = $(IEEE_DEFS) $(SIGNAL_DEFINES) DEPLIBS = XawClientDepLibs LOCAL_LIBRARIES = XawClientLibs Index: xc/programs/xmag/RootWin.c diff -u xc/programs/xmag/RootWin.c:1.3 xc/programs/xmag/RootWin.c:1.4 --- xc/programs/xmag/RootWin.c:1.3 Sun Mar 7 09:23:36 1999 +++ xc/programs/xmag/RootWin.c Wed Jan 17 18:46:20 2001 @@ -1,4 +1,4 @@ -/* $TOG: RootWin.c /main/4 1998/02/09 14:10:34 kaleb $ */ +/* $Xorg: RootWin.c,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmag/RootWin.c,v 1.3 1999/03/07 14:23:36 dawes Exp $ */ +/* $XFree86: xc/programs/xmag/RootWin.c,v 1.4 2001/01/17 23:46:20 dawes Exp $ */ #include <X11/IntrinsicP.h> Index: xc/programs/xmag/RootWin.h diff -u xc/programs/xmag/RootWin.h:1.1.1.2 xc/programs/xmag/RootWin.h:1.1.1.3 --- xc/programs/xmag/RootWin.h:1.1.1.2 Sun Sep 27 04:02:31 1998 +++ xc/programs/xmag/RootWin.h Tue Jan 16 18:01:41 2001 @@ -1,4 +1,4 @@ -/* $TOG: RootWin.h /main/3 1998/02/09 14:10:38 kaleb $ */ +/* $Xorg: RootWin.h,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group Index: xc/programs/xmag/RootWinP.h diff -u xc/programs/xmag/RootWinP.h:1.1.1.2 xc/programs/xmag/RootWinP.h:1.1.1.3 --- xc/programs/xmag/RootWinP.h:1.1.1.2 Sun Sep 27 04:02:31 1998 +++ xc/programs/xmag/RootWinP.h Tue Jan 16 18:01:42 2001 @@ -1,4 +1,4 @@ -/* $TOG: RootWinP.h /main/4 1998/02/09 14:10:30 kaleb $ */ +/* $Xorg: RootWinP.h,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group Index: xc/programs/xmag/Scale.c diff -u xc/programs/xmag/Scale.c:3.6 xc/programs/xmag/Scale.c:3.7 --- xc/programs/xmag/Scale.c:3.6 Sun Mar 21 02:35:39 1999 +++ xc/programs/xmag/Scale.c Wed Jan 17 18:46:20 2001 @@ -1,4 +1,4 @@ -/* $TOG: Scale.c /main/21 1998/02/09 14:10:46 kaleb $ */ +/* $Xorg: Scale.c,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmag/Scale.c,v 3.6 1999/03/21 07:35:39 dawes Exp $ */ +/* $XFree86: xc/programs/xmag/Scale.c,v 3.7 2001/01/17 23:46:20 dawes Exp $ */ /* * Author: Davor Matic, MIT X Consortium Index: xc/programs/xmag/Scale.h diff -u xc/programs/xmag/Scale.h:1.3 xc/programs/xmag/Scale.h:1.4 --- xc/programs/xmag/Scale.h:1.3 Sun Mar 7 09:23:36 1999 +++ xc/programs/xmag/Scale.h Wed Jan 17 18:46:20 2001 @@ -1,4 +1,4 @@ -/* $TOG: Scale.h /main/7 1998/02/09 14:10:55 kaleb $ */ +/* $Xorg: Scale.h,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ /* Copyright 1993, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmag/Scale.h,v 1.3 1999/03/07 14:23:36 dawes Exp $ */ +/* $XFree86: xc/programs/xmag/Scale.h,v 1.4 2001/01/17 23:46:20 dawes Exp $ */ #ifndef _XawScale_h #define _XawScale_h Index: xc/programs/xmag/ScaleP.h diff -u xc/programs/xmag/ScaleP.h:1.1.1.2 xc/programs/xmag/ScaleP.h:1.1.1.3 --- xc/programs/xmag/ScaleP.h:1.1.1.2 Sun Sep 27 04:02:33 1998 +++ xc/programs/xmag/ScaleP.h Tue Jan 16 18:01:44 2001 @@ -1,4 +1,4 @@ -/* $TOG: ScaleP.h /main/4 1998/02/09 14:10:41 kaleb $ */ +/* $Xorg: ScaleP.h,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ /* Copyright 1989, 1998 The Open Group Index: xc/programs/xmag/Xmag.ad diff -u xc/programs/xmag/Xmag.ad:1.1.1.1 xc/programs/xmag/Xmag.ad:1.1.1.2 --- xc/programs/xmag/Xmag.ad:1.1.1.1 Wed Apr 27 03:13:18 1994 +++ xc/programs/xmag/Xmag.ad Tue Jan 16 18:01:44 2001 @@ -1,4 +1,4 @@ -.\ "$XConsortium: Xmag.ad,v 1.14 92/05/19 09:43:26 dave Exp $ +.\ "$Xorg: Xmag.ad,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ *Font: fixed *pane2*orientation: horizontal *pane2*showGrip: False Index: xc/programs/xmag/xmag.c diff -u xc/programs/xmag/xmag.c:1.7 xc/programs/xmag/xmag.c:1.8 --- xc/programs/xmag/xmag.c:1.7 Sun Mar 7 06:41:13 1999 +++ xc/programs/xmag/xmag.c Wed Jan 17 18:46:20 2001 @@ -1,4 +1,4 @@ -/* $TOG: xmag.c /main/30 1998/02/09 14:11:03 kaleb $ */ +/* $Xorg: xmag.c,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ /* Copyright 1991, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmag/xmag.c,v 1.7 1999/03/07 11:41:13 dawes Exp $ */ +/* $XFree86: xc/programs/xmag/xmag.c,v 1.8 2001/01/17 23:46:20 dawes Exp $ */ #ifndef X_NOT_STDC_ENV Index: xc/programs/xmag/xmag.man diff -u xc/programs/xmag/xmag.man:1.4 xc/programs/xmag/xmag.man:1.6 --- xc/programs/xmag/xmag.man:1.4 Sun Oct 4 05:41:42 1998 +++ xc/programs/xmag/xmag.man Sat Jan 27 13:21:18 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xmag.man /main/13 1998/02/09 14:11:11 kaleb $ +.\" $Xorg: xmag.man,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ .\" Copyright 1991, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XMAG 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xmag/xmag.man,v 1.6 2001/01/27 18:21:18 dawes Exp $ +.\" +.TH XMAG 1 __xorgversion__ .SH NAME xmag \- magnify parts of the screen .SH SYNOPSIS Index: xc/programs/xman/Imakefile diff -u xc/programs/xman/Imakefile:1.1.2.1 xc/programs/xman/Imakefile:1.3 --- xc/programs/xman/Imakefile:1.1.2.1 Sat Jan 27 15:09:05 2001 +++ xc/programs/xman/Imakefile Thu Apr 19 15:54:51 2001 @@ -1,5 +1,5 @@ XCOMM $XConsortium: Imakefile,v 1.22 91/09/09 16:02:18 rws Exp $ -XCOMM $XFree86: xc/programs/xman/Imakefile,v 1.1.2.1 2001/01/27 20:09:05 herrb Exp $ +XCOMM $XFree86: xc/programs/xman/Imakefile,v 1.3 2001/04/19 19:54:51 dawes Exp $ #ifdef XmanSearchPath XMANSYSPATH = XmanSearchPath @@ -15,9 +15,22 @@ MKSTEMP = -DHAS_MKSTEMP #endif +#if HasGroff +GROFF = -DHAS_GROFF +#endif + +#if HasSnprintf +SNPDEFINES = -DHAS_SNPRINTF +#else +SNPINCLUDES = $(LIBSRC)/misc +#endif + OSMAJORVERSION = OSMajorVersion OSMINORVERSION = OSMinorVersion - DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) -DOSMINORVERSION=$(OSMINORVERSION) $(HELPFILE) $(MANPATHS) $(MKSTEMP) + DEFINES = -DOSMAJORVERSION=$(OSMAJORVERSION) \ + -DOSMINORVERSION=$(OSMINORVERSION) \ + $(SNPDEFINES) $(HELPFILE) $(MANPATHS) $(MKSTEMP) $(GROFF) + INCLUDES = $(SNPINCLUDES) DEPLIBS = XawClientDepLibs LOCAL_LIBRARIES = XawClientLibs SRCS = ScrollByL.c handler.c man.c buttons.c help.c \ Index: xc/programs/xman/defs.h diff -u xc/programs/xman/defs.h:1.2 xc/programs/xman/defs.h:1.3 --- xc/programs/xman/defs.h:1.2 Fri Mar 3 18:16:26 2000 +++ xc/programs/xman/defs.h Thu Apr 19 15:54:51 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/defs.h,v 1.2 2000/03/03 23:16:26 dawes Exp $ */ +/* $XFree86: xc/programs/xman/defs.h,v 1.3 2001/04/19 19:54:51 dawes Exp $ */ /* * xman - X window system manual page display program. @@ -98,12 +98,16 @@ #define NO_SECTION_DEFAULTS ("no default sections") -#if !defined(linux) -# define TBL "tbl" -#else -# define TBL "gtbl" +/* + * Define HANDLE_ROFFSEQ to enable parsing of '\" <string> + * sequences in source files to set the format pipeline. + * This is necessary because the default pipeline causes incorrect + * display of ascii(7) on Linux. + * This depends on GNU roff. + */ +#ifdef HAS_GROFF +#define HANDLE_ROFFSEQ #endif - #define DEFAULT_WIDTH 500 /* The default width of xman. */ #define SECTALLOC 8 /* The number of entries allocated Index: xc/programs/xman/misc.c diff -u xc/programs/xman/misc.c:1.4.2.1 xc/programs/xman/misc.c:1.6 --- xc/programs/xman/misc.c:1.4.2.1 Sat Jan 27 15:09:06 2001 +++ xc/programs/xman/misc.c Thu Apr 19 15:54:51 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/misc.c,v 1.4.2.1 2001/01/27 20:09:06 herrb Exp $ */ +/* $XFree86: xc/programs/xman/misc.c,v 1.6 2001/04/19 19:54:51 dawes Exp $ */ /* * xman - X window system manual page display program. @@ -44,19 +44,28 @@ #include <X11/Xaw/Dialog.h> #include <X11/Shell.h> +#ifndef HAS_SNPRINTF +#undef SCOPE +#define SCOPE static +#include "snprintf.c" +#endif + static FILE * Uncompress(ManpageGlobals * man_globals, char * filename); #ifndef HAS_MKSTEMP -static Boolean UncompressNamed(ManpageGlobals * man_globals, char * filename, +static Boolean UncompressNamed(ManpageGlobals * man_globals, char * filename, char * output); -static Boolean UncompressUnformatted(ManpageGlobals * man_globals, +static Boolean UncompressUnformatted(ManpageGlobals * man_globals, char * entry, char * filename); #else -static Boolean UncompressNamed(ManpageGlobals * man_globals, char * filename, +static Boolean UncompressNamed(ManpageGlobals * man_globals, char * filename, char * output, FILE ** output_fd); -static Boolean UncompressUnformatted(ManpageGlobals * man_globals, - char * entry, char * filename, +static Boolean UncompressUnformatted(ManpageGlobals * man_globals, + char * entry, char * filename, FILE **file); #endif +#ifdef HANDLE_ROFFSEQ +static Boolean ConstructCommand(char * cmdbuf, char * path, char * filename, char * tempfile); +#endif #if defined(ISC) || defined(SCO) static char *uncompress_format = NULL; @@ -76,7 +85,7 @@ extern Widget top; static Widget warnShell, warnDialog; -static void +static void PopdownWarning(Widget w, XtPointer client, XtPointer call) { XtPopdown((Widget)client); @@ -107,7 +116,7 @@ hasPosition = TRUE; } - if (man_globals != NULL) + if (man_globals != NULL) ChangeLabel(man_globals->label, buffer); if (man_globals->label == NULL) { n=0; @@ -117,12 +126,12 @@ XtSetArg(wargs[n], XtNy, topY); n++; } XtSetArg(wargs[n], XtNtransientFor, top); n++; - warnShell = XtCreatePopupShell("warnShell", transientShellWidgetClass, + warnShell = XtCreatePopupShell("warnShell", transientShellWidgetClass, initial_widget, wargs, n); - XtSetArg(wargs[0], XtNlabel, buffer); - warnDialog = XtCreateManagedWidget("warnDialog", dialogWidgetClass, + XtSetArg(wargs[0], XtNlabel, buffer); + warnDialog = XtCreateManagedWidget("warnDialog", dialogWidgetClass, warnShell, wargs, 1); - XawDialogAddButton(warnDialog, "dismiss", PopdownWarning, + XawDialogAddButton(warnDialog, "dismiss", PopdownWarning, (XtPointer)warnShell); XtRealizeWidget(warnShell); Popup(warnShell, XtGrabNone); @@ -169,11 +178,11 @@ * * NOTES: * - * If there is a uncompressed section it will look there for uncompresed - * manual pages first and then for individually comressed file in the + * If there is a uncompressed section it will look there for uncompresed + * manual pages first and then for individually comressed file in the * uncompressed section. - * - * If there is a compressed directory then it will also look there for + * + * If there is a compressed directory then it will also look there for * the manual pages. * * If both of these fail then it will attempt to format the manual page. @@ -202,12 +211,12 @@ */ #if defined(__OpenBSD__) || defined(__NetBSD__) /* look in machine subdir first */ - sprintf(filename, "%s/%s%s/%s/%s", path, CAT, + sprintf(filename, "%s/%s%s/%s/%s", path, CAT, section + len_cat, MACHINE, page); if ( (file = fopen(filename,"r")) != NULL) return(file); #endif - + sprintf(filename, "%s/%s%s/%s", path, CAT, section + len_cat, page); if ( (file = fopen(filename,"r")) != NULL) return(file); @@ -219,27 +228,27 @@ #if !defined(ISC) && !defined(SCO) #if defined(__OpenBSD__) || defined(__NetBSD__) /* look in machine subdir first */ - sprintf(filename, "%s/%s%s/%s/%s.%s", path, CAT, + sprintf(filename, "%s/%s%s/%s/%s.%s", path, CAT, section + len_cat, MACHINE, page, COMPRESSION_EXTENSION); if ( (file = Uncompress(man_globals, filename)) != NULL) return(file); #endif - sprintf(filename, "%s/%s%s/%s.%s", path, CAT, + sprintf(filename, "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, COMPRESSION_EXTENSION); - if ( (file = Uncompress(man_globals, filename)) != NULL) + if ( (file = Uncompress(man_globals, filename)) != NULL) return(file); #ifdef GZIP_EXTENSION else { #if defined(__OpenBSD__) || defined(__NetBSD__) /* look in machine subdir first */ - sprintf(filename, "%s/%s%s/%s/%s.%s", path, CAT, + sprintf(filename, "%s/%s%s/%s/%s.%s", path, CAT, section + len_cat, MACHINE, page, GZIP_EXTENSION); if ( (file = Uncompress(man_globals, filename)) != NULL) return(file); #endif sprintf(filename, "%s/%s%s/%s.%s", path, CAT, section + len_cat, page, GZIP_EXTENSION); - if ( (file = Uncompress(man_globals, filename)) != NULL) + if ( (file = Uncompress(man_globals, filename)) != NULL) return(file); } #endif @@ -251,7 +260,7 @@ #ifdef DEBUG printf("Trying .%c ...\n", COMPRESSION_EXTENSIONS[i]); #endif - if ( (file = Uncompress(man_globals, filename)) != NULL) + if ( (file = Uncompress(man_globals, filename)) != NULL) return(file); } #endif @@ -293,7 +302,7 @@ if ( !UncompressNamed(man_globals, filename, tmp_file) ) return(NULL); - else if ((file = fopen(tmp_file, "r")) == NULL) { + else if ((file = fopen(tmp_file, "r")) == NULL) { sprintf(error_buf, "Something went wrong in retrieving the %s", "uncompressed manual page try cleaning up /tmp."); PopupWarning(man_globals, error_buf); @@ -384,7 +393,7 @@ * Arguments: man_globals - the psuedo globals * file - the file pointer to use and return * entry - the current entry struct. - * current_box - The current directory being displayed. + * current_box - The current directory being displayed. * Returns: none. */ @@ -449,8 +458,8 @@ } Popup(XtParent(man_globals->standby), XtGrabExclusive); - while ( !XCheckTypedWindowEvent(XtDisplay(man_globals->standby), - XtWindow(man_globals->standby), + while ( !XCheckTypedWindowEvent(XtDisplay(man_globals->standby), + XtWindow(man_globals->standby), Expose, &event) ); XtDispatchEvent( &event ); XFlush(XtDisplay(man_globals->standby)); @@ -466,13 +475,23 @@ ParseEntry(entry, path, NULL, NULL); +#ifndef HANDLE_ROFFSEQ #ifndef HAS_MKSTEMP sprintf(cmdbuf,"cd %s ; %s %s %s > %s %s", path, TBL, filename, FORMAT, man_globals->tempfile, "2> /dev/null"); #else sprintf(cmdbuf,"cd %s ; %s %s %s >> %s %s", path, TBL, filename, FORMAT, man_globals->tempfile, "2> /dev/null"); -#endif +#endif +#else + /* Handle more flexible way of specifying the formatting pipeline */ + if (! ConstructCommand(cmdbuf, path, filename, man_globals->tempfile)) { + sprintf(error_buf, "Constructed command was too long!"); + PopupWarning(man_globals, error_buf); + file = NULL; + } + else +#endif /* HANDLE_ROFFSEQ */ if(system(cmdbuf) != 0) { /* execute search. */ sprintf(error_buf, @@ -482,7 +501,7 @@ } else { #ifndef HAS_MKSTEMP - if ((file = fopen(man_globals->tempfile,"r")) == NULL) { + if ((file = fopen(man_globals->tempfile,"r")) == NULL) { sprintf(error_buf, "Something went wrong in retrieving the %s", "temp file, try cleaning up /tmp"); PopupWarning(man_globals, error_buf); @@ -491,16 +510,16 @@ #endif XtPopdown( XtParent(man_globals->standby) ); - + if ( (man_globals->save == NULL) || - (man_globals->manpagewidgets.manpage == NULL) ) + (man_globals->manpagewidgets.manpage == NULL) ) unlink(man_globals->tempfile); else { char * ptr, catdir[BUFSIZ]; /* * If the catdir is writeable then ask the user if he/she wants to - * write the man page to it. + * write the man page to it. */ strcpy(catdir, man_globals->save_file); @@ -517,7 +536,7 @@ XtPopup( man_globals->save, XtGrabExclusive); } } - else + else unlink(man_globals->tempfile); } #ifndef HAS_MKSTEMP @@ -527,13 +546,164 @@ if (man_globals->compress || man_globals->gzip) /* If the original was compressed - then this is a tempory + then this is a tempory file. */ unlink(filename); - + return(file); } +#ifdef HANDLE_ROFFSEQ +/* Function Name: ConstructCommand + * Description: Constructs the pipeline of commands necessary to format + * a manual page. + * Arguments: cmdbuf - the buffer into which to write the command + * path - the directory in which the original man page resides + * filename - the (uncompressed) manpage source file + * tempfile - the name of a temporary file to direct the final + * output of the pipeline into + * Returns: TRUE if the command fit into the buffer, FALSE if it would + * be too long (more than BUFSIZ characters) + */ +static Boolean +ConstructCommand(cmdbuf, path, filename, tempfile) + char *cmdbuf, *path, *filename, *tempfile; +{ + /* The original code did the following to produce a command line: + * sprintf(cmdbuf,"cd %s ; %s %s %s > %s %s", path, TBL, + * filename, FORMAT, man_globals->tempfile, "2> /dev/null"); + * We are more flexible and follow more or less the algorithm used + * by the Linux man command: + * + Obtain a string of letters from the following sources in order + * of preference: + * + a command line option (not implemented in xman; it's probably not + * useful) + * + the first line of the manpage source, if it is of the form: + * '\" <string> + * + the MANROFFSEQ environment variable + * + a default string; this is "". + * + Interpret the string as a pipeline of filters: + * + e = eqn g = grap p = pic t = tbl v = vgrind r = refer + * + zsoelim is always run as the first preprocessor in any case. + * + * Strictly speaking we should save a catpage iff the string comes + * from the file or is the default. + * + * You'll notice that we format a man page into ASCII text output and then + * attempt to interpret things like L^HL as bold and so forth. This + * is so obviously the Wrong Thing it's untrue. + */ + char *c = cmdbuf; /* current posn in buffer */ + int left = BUFSIZ; /* space left in buffer */ + int used; + char *fmt; + FILE *file; + char fmtbuf[128]; + int gotfmt = 0; /* set to 1 if we got a directive from source */ + char *fname = NULL; + + fmt = NULL; + /* If you have a command line option that gives a setting for fmt, + set it here. */ + + if (!fmt) { + /* This is the tricky bit: extract a format string from the source file + * Annoyingly, filename might be relative or absolute. We cheat and + * use system to get the thing to a known absoute filename. + */ + if (filename[0] == '/') { + fname = filename; + } else { + fname = malloc(strlen(path) + 1 + strlen(filename) + 1); + if (!fname) + return FALSE; + sprintf(fname, "%s/%s", path, filename); + } + if ((file = fopen(fname, "r")) && + (fgets(fmtbuf, sizeof(fmtbuf), file)) && + (!memcmp(fmtbuf, "'\\\" ", 4))) { + /* that's squote-backslash-dquote-space */ + int len; + fmt = fmtbuf + 3; + len = strlen(fmt); + if (len && (fmt[len-1] == '\n')) { + fmt[len-1] = 0; + gotfmt++; + } + } + if (fname && fname != filename) + free(fname); + if (!gotfmt) /* not there or some error */ + { + fmt = getenv("MANROFFSEQ"); + } + } + + if (!fmt) + { + fmt = DEFAULT_MANROFFSEQ; + } + + + /* Start with the first fixed part of the command line */ + used = snprintf(c, left, "cd %s; %s %s ", path, ZSOELIM, filename); + left -= used; + c += used; + if (left <= 1) + return (FALSE); + + /* Now add preprocessors of the form '| processor' */ + for ( ; *fmt; fmt++) + { + char *filter; + switch (*fmt) + { + case 'e': + filter = EQN; + break; + case 'g': + filter = GRAP; + break; + case 'p': + filter = PIC; + break; + case 't': + filter = TBL; + break; + case 'v': + filter = VGRIND; + break; + case 'r': + filter = REFER; + break; + default: + filter = NULL; + break; + } + if (filter) + { + used = snprintf(c, left, " | %s ", filter); + left -= used; + c += used; + if (left <= 1) + return (FALSE); + } + } + + /* Now add the fixed trailing part 'formatprog > tempfile 2> /dev/null' */ +#ifndef HAS_MKSTEMP + used = snprintf(c, left, " | %s > %s 2>/dev/null", FORMAT, tempfile); +#else + used = snprintf(c, left, " | %s >> %s 2>/dev/null", FORMAT, tempfile); +#endif + left -= used; + if (left <= 1) + return (FALSE); + + return (TRUE); +} +#endif /* HANDLE_ROFFSEQ */ + /* Function Name: UncompressUnformatted * Description: Finds an uncompressed unformatted manual page. * Arguments: man_globals - the psuedo global structure. @@ -544,10 +714,10 @@ static Boolean #ifndef HAS_MKSTEMP -UncompressUnformatted(ManpageGlobals * man_globals, char * entry, +UncompressUnformatted(ManpageGlobals * man_globals, char * entry, char * filename) #else -UncompressUnformatted(ManpageGlobals * man_globals, char * entry, +UncompressUnformatted(ManpageGlobals * man_globals, char * entry, char * filename, FILE **file) #endif { @@ -557,10 +727,10 @@ ParseEntry(entry, path, section, page); #if defined(__OpenBSD__) || defined(__NetBSD__) - /* - * look for uncomressed file in machine subdir first + /* + * look for uncomressed file in machine subdir first */ - sprintf(filename, "%s/%s%s/%s/%s", path, MAN, + sprintf(filename, "%s/%s%s/%s/%s", path, MAN, section + len_cat, MACHINE, page); if ( access( filename, R_OK ) == 0 ) { man_globals->compress = FALSE; @@ -648,7 +818,7 @@ * And lastly files in a compressed directory. */ - sprintf(input, "%s/%s%s.%s/%s", path, + sprintf(input, "%s/%s%s.%s/%s", path, MAN, section + len_man, COMPRESSION_EXTENSION, page); #ifndef HAS_MKSTEMP if ( UncompressNamed(man_globals, input, filename) ) { @@ -656,13 +826,13 @@ if ( UncompressNamed(man_globals, input, filename, file) ) { #endif man_globals->compress = TRUE; - sprintf(man_globals->save_file, "%s/%s%s.%s/%s", path, + sprintf(man_globals->save_file, "%s/%s%s.%s/%s", path, CAT, section + len_cat, COMPRESSION_EXTENSION, page); return(TRUE); } return(FALSE); } - + /* Function Name: AddCursor * Description: This function adds the cursor to the window. * Arguments: w - the widget to add the cursor to. @@ -677,7 +847,7 @@ Arg args[10]; Cardinal num_args = 0; Colormap c_map; - + if (!XtIsRealized(w)) { PopupWarning(NULL, "Widget is not realized, no cursor added.\n"); return; @@ -756,21 +926,21 @@ * root window, and if not then force them to be. */ - if (x_temp < h_space) + if (x_temp < h_space) x_temp = v_space; if (y_temp < v_space) (y_temp = 2); if ( y_temp + Height(widget) + v_space > parent_height ) - y_temp = parent_height - Height(widget) - v_space; + y_temp = parent_height - Height(widget) - v_space; if ( x_temp + Width(widget) + h_space > parent_width ) - x_temp = parent_width - Width(widget) - h_space; + x_temp = parent_width - Width(widget) - h_space; - XtSetArg(wargs[0], XtNx, x_temp); - XtSetArg(wargs[1], XtNy, y_temp); + XtSetArg(wargs[0], XtNx, x_temp); + XtSetArg(wargs[1], XtNy, y_temp); XtSetValues(widget, wargs, 2); -} +} /* Function Name: ParseEntry(entry, path, sect, page) * Description: Parses the manual pages entry filenames. @@ -782,32 +952,32 @@ */ void -ParseEntry(char *entry, char *path, char *sect, char *page) +ParseEntry(char *entry, char *path, char *sect, char *page) { char *c, temp[BUFSIZ]; strcpy(temp, entry); c = rindex(temp, '/'); - if (c == NULL) + if (c == NULL) PrintError("index failure in ParseEntry."); *c++ = '\0'; if (page != NULL) strcpy(page, c); c = rindex(temp, '/'); - if (c == NULL) + if (c == NULL) PrintError("index failure in ParseEntry."); *c++ = '\0'; #if defined(__OpenBSD__) || defined(__NetBSD__) /* Skip machine subdirectory if present */ if (strcmp(c, MACHINE) == 0) { c = rindex(temp, '/'); - if (c == NULL) + if (c == NULL) PrintError("index failure in ParseEntry."); *c++ = '\0'; } -#endif +#endif if (sect != NULL) strcpy(sect, c); @@ -833,18 +1003,18 @@ while ( (temp = XtParent(w)) != initial_widget && (temp != NULL)) w = temp; - if (temp == NULL) - XtAppError(XtWidgetToApplicationContext(w), + if (temp == NULL) + XtAppError(XtWidgetToApplicationContext(w), "Xman: Could not locate widget in tree, exiting"); if (XFindContext(XtDisplay(w), XtWindow(w), manglobals_context, &data) != XCSUCCESS) - XtAppError(XtWidgetToApplicationContext(w), + XtAppError(XtWidgetToApplicationContext(w), "Xman: Could not find global data, exiting"); return( (ManpageGlobals *) data); } - + /* Function Name: SaveGlobals * Description: Saves the psuedo globals on the widget passed * to this function, although GetGlobals assumes that @@ -861,7 +1031,7 @@ { if (XSaveContext(XtDisplay(w), XtWindow(w), manglobals_context, (caddr_t) globals) != XCSUCCESS) - XtAppError(XtWidgetToApplicationContext(w), + XtAppError(XtWidgetToApplicationContext(w), "Xman: Could not save global data, are you out of memory?"); } @@ -877,8 +1047,8 @@ void RemoveGlobals(Widget w) { - if (XDeleteContext(XtDisplay(w), XtWindow(w), + if (XDeleteContext(XtDisplay(w), XtWindow(w), manglobals_context) != XCSUCCESS) - XtAppError(XtWidgetToApplicationContext(w), + XtAppError(XtWidgetToApplicationContext(w), "Xman: Could not remove global data?"); } Index: xc/programs/xman/search.c diff -u xc/programs/xman/search.c:1.4.2.1 xc/programs/xman/search.c:1.5 --- xc/programs/xman/search.c:1.4.2.1 Sat Jan 27 15:09:06 2001 +++ xc/programs/xman/search.c Sat Jan 27 12:24:27 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/search.c,v 1.4.2.1 2001/01/27 20:09:06 herrb Exp $ */ +/* $XFree86: xc/programs/xman/search.c,v 1.5 2001/01/27 17:24:27 herrb Exp $ */ #include "globals.h" Index: xc/programs/xman/vendor.h diff -u xc/programs/xman/vendor.h:1.5.2.1 xc/programs/xman/vendor.h:1.7 --- xc/programs/xman/vendor.h:1.5.2.1 Sat Jan 27 15:09:07 2001 +++ xc/programs/xman/vendor.h Thu Apr 19 15:54:51 2001 @@ -28,7 +28,7 @@ from the X Consortium. */ -/* $XFree86: xc/programs/xman/vendor.h,v 1.5.2.1 2001/01/27 20:09:07 herrb Exp $ */ +/* $XFree86: xc/programs/xman/vendor.h,v 1.7 2001/04/19 19:54:51 dawes Exp $ */ /* Vendor-specific definitions */ @@ -61,10 +61,8 @@ #if defined(__FreeBSD__) # define MANCONF "/etc/manpath.config" -#else -# if (defined(BSD) && (BSD >= 199103)) || defined(linux) -# define MANCONF "/etc/man.conf" -# endif +#elif (defined(BSD) && (BSD >= 199103)) || defined(linux) +# define MANCONF "/etc/man.conf" #endif /* @@ -75,30 +73,21 @@ #ifndef SYSMANPATH -#ifdef macII +#if defined(macII) # define SYSMANPATH "/usr/catman/u_man:/usr/catman/a_man" -#endif /* macII */ -#if defined(SVR4) || defined(__osf__) || (defined(BSD) && (BSD >= 199103)) +#elif defined(__bsdi__) +# define SYSMANPATH "/usr/share/man:/usr/contrib/man:/usr/contrib/isode/man:/usr/local/man" +#elif defined(__OpenBSD__) +# define SYSMANPATH "/usr/share/man:/usr/local/man:/usr/X11R6/man" +#elif defined(SVR4) || defined(__osf__) || (defined(BSD) && (BSD >= 199103)) # define SYSMANPATH "/usr/share/man" -#endif /* SVR4 || __osf__ || (BSD >= 199103) */ -#ifdef hcx +#elif defined(hcx) # define SYSMANPATH "/usr/catman/local_man:/usr/catman/u_man:/usr/catman/a_man:/usr/catman/p_man:/usr/catman/ada_man" -#endif /* hcx */ -#if defined(SYSV) && defined(i386) && !defined(SCO) +#elif defined(SYSV) && defined(i386) && !defined(SCO) # define SYSMANPATH "/usr/catman/u_man:/usr/catman/p_man" -#endif /* SYSV386 */ -#ifdef sgi +#elif defined(sgi) # define SYSMANPATH "/usr/catman/a_man:/usr/catman/g_man:/usr/catman/p_man:/usr/catman/u_man:/usr/man/p_man:/usr/man/u_man:/usr/man" -#endif /* sgi */ -#ifdef __bsdi__ -# define SYSMANPATH "/usr/share/man:/usr/contrib/man:/usr/contrib/isode/man:/usr/local/man" -#endif /* __bsdi__ */ -#ifdef __OpenBSD__ -# ifdef SYSMANPATH -# undef SYSMANPATH -# endif -# define SYSMANPATH "/usr/share/man:/usr/local/man:/usr/X11R6/man" -#endif /* __OpenBSD__ */ +#endif #ifndef SYSMANPATH # define SYSMANPATH "/usr/man" @@ -110,47 +99,45 @@ * Compression Definitions. */ -#if defined( macII ) || defined( hcx ) || (defined(SYSV) && defined(i386) && !defined(ISC) && !defined(SCO)) || defined(sgi) +#if defined( macII ) || defined( hcx ) || \ + (defined(SYSV) && defined(i386) && !defined(ISC) && !defined(SCO)) || \ + defined(sgi) # define COMPRESSION_EXTENSION "z" # define UNCOMPRESS_FORMAT "pcat %s > %s" # define NO_COMPRESS /* mac can't handle using pack as a filter and xman needs it to be done that way. */ -#else -# ifdef UTEK -# define COMPRESSION_EXTENSION "C" -# define UNCOMPRESS_FORMAT "ccat < %s > %s" -# define COMPRESS "compact" +#elif defined(UTEK) +# define COMPRESSION_EXTENSION "C" +# define UNCOMPRESS_FORMAT "ccat < %s > %s" +# define COMPRESS "compact" +#elif defined (ISC) || defined(SCO) +# define COMPRESSION_EXTENSION "Z" /* dummy */ +# ifndef SCO +# define COMPRESSION_EXTENSIONS "zZF" /* pack, compress, freeze */ # else -# if defined (ISC) || defined(SCO) -# define COMPRESSION_EXTENSION "Z" /* dummy */ -# ifndef SCO -# define COMPRESSION_EXTENSIONS "zZF" /* pack, compress, freeze */ -# else -# define COMPRESSION_EXTENSIONS "zZ" /* pack, compress */ -# endif -# define UNCOMPRESS_FORMAT uncompress_format -# define UNCOMPRESS_FORMAT_1 "pcat %s > %s" -# define UNCOMPRESS_FORMAT_2 "zcat < %s > %s" -# define UNCOMPRESS_FORMAT_3 "fcat < %s > %s" -# define NO_COMPRESS -# else -# define COMPRESSION_EXTENSION "Z" -# ifndef HAS_MKSTEMP -# define UNCOMPRESS_FORMAT "zcat < %s > %s" -# else -# define UNCOMPRESS_FORMAT "zcat < %s >> %s" -# endif -# define COMPRESS "compress" -# define GZIP_EXTENSION "gz" -# ifndef HAS_MKSTEMP -# define GUNZIP_FORMAT "gzip -c -d < %s > %s" -# else -# define GUNZIP_FORMAT "gzip -c -d < %s >> %s" -# endif -# define GZIP_COMPRESS "gzip" -# endif /* ISC */ -# endif /* UTEK */ -#endif /* macII, hcx, SYSV386, sgi */ +# define COMPRESSION_EXTENSIONS "zZ" /* pack, compress */ +# endif +# define UNCOMPRESS_FORMAT uncompress_format +# define UNCOMPRESS_FORMAT_1 "pcat %s > %s" +# define UNCOMPRESS_FORMAT_2 "zcat < %s > %s" +# define UNCOMPRESS_FORMAT_3 "fcat < %s > %s" +# define NO_COMPRESS +#else +# define COMPRESSION_EXTENSION "Z" +# ifndef HAS_MKSTEMP +# define UNCOMPRESS_FORMAT "zcat < %s > %s" +# else +# define UNCOMPRESS_FORMAT "zcat < %s >> %s" +# endif +# define COMPRESS "compress" +# define GZIP_EXTENSION "gz" +# ifndef HAS_MKSTEMP +# define GUNZIP_FORMAT "gzip -c -d < %s > %s" +# else +# define GUNZIP_FORMAT "gzip -c -d < %s >> %s" +# endif +# define GZIP_COMPRESS "gzip" +#endif @@ -158,7 +145,8 @@ * The command filters for the manual and apropos searches. */ -#if ( defined(hpux) || defined(macII) || defined(CRAY) || defined(ultrix) || defined(hcx) ) +#if (defined(hpux) || defined(macII) || defined(CRAY) || defined(ultrix) || \ + defined(hcx) ) # define NO_MANPATH_SUPPORT #endif @@ -177,22 +165,46 @@ # endif #endif -#ifdef ultrix +#ifndef HANDLE_ROFFSEQ +# if defined(ultrix) # define FORMAT "| nroff -man" /* The format command. */ -#else -# if defined(BSD) && (BSD >= 199103) -# define FORMAT "| eqn | tbl | nroff -man" -# else -# ifdef linux -# define linux_GROFF /* undef this to use nroff instead */ -# endif /* linux */ -# ifdef linux_GROFF -# define FORMAT "| geqn | gtbl | groff -Tlatin1 -mandoc" -# else -# define FORMAT "| neqn | nroff -man" /* The format command. */ -# endif /* linux_GROFF */ -# endif -#endif +# elif defined(CSRG_BASED) +# define FORMAT "| eqn | tbl | nroff -mandoc" +# elif defined(BSD) && (BSD >= 199103) +# define FORMAT "| eqn | tbl | nroff -man" +# elif defined(linux) +# define FORMAT "| geqn | gtbl | groff -Tlatin1 -mandoc" +# else +# define FORMAT "| neqn | nroff -man" /* The format command. */ +# endif +# if defined(linux) +# define TBL "gtbl" +# else +# define TBL "tbl" +# endif +#else /* HANDLE_ROFFSEQ */ +# if defined(linux) +# define ZSOELIM "zsoelim" +# define EQN "geqn" +# define TBL "gtbl" +# else +# define ZSOELIM "soelim" +# define EQN "eqn" +# define TBL "tbl" +#endif +# define GRAP "grap" +# define PIC "pic" +# define VGRIND "vgrind" +# define REFER "refer" +# if defined(CSRG_BASED) +# define FORMAT "nroff -mandoc" +# elif defined(linux) +# define FORMAT "groff -Tlatin1 -mandoc" +# else +# define FORMAT "groff -man" +# endif +# define DEFAULT_MANROFFSEQ "et" +#endif /*HANDLE_ROFFSEQ */ /* * Names of the man and cat dirs. @@ -204,16 +216,15 @@ #define MAN "man" #endif -#if ( defined(macII) || defined(CRAY) || defined(hcx) || (defined(SYSV) && defined(i386)) ) /* * The Apple, Cray,, SYSV386, and HCX folks put the preformatted pages in the * "man" directories. */ -# ifdef SCO -# define CAT "cat." -# else -# define CAT MAN -# endif +#if (defined(macII) || defined(CRAY) || defined(hcx) || \ + (defined(SYSV) && defined(i386))) && !defined(SCO) +# define CAT MAN +#elif defined(SCO) +# define CAT "cat." #else # define CAT "cat" #endif Index: xc/programs/xman/xman.man diff -u xc/programs/xman/xman.man:1.1 xc/programs/xman/xman.man:1.3 --- xc/programs/xman/xman.man:1.1 Fri Feb 11 22:55:19 2000 +++ xc/programs/xman/xman.man Sat Jan 27 13:21:18 2001 @@ -1,5 +1,8 @@ .\" $XConsortium: xman.man,v 1.23 94/04/17 20:44:02 matt Exp $ -.TH XMAN 1 "Release 6" "X Version 11" +.\" +.\" $XFree86: xc/programs/xman/xman.man,v 1.3 2001/01/27 18:21:18 dawes Exp $ +.\" +.TH XMAN 1 __xorgversion__ .SH NAME xman \- Manual page display program for the X Window System .SH SYNOPSIS @@ -354,7 +357,7 @@ creates temporary files in /tmp for all unformatted man pages and all apropos searches. .SH "SEE ALSO" -.IR X (1), +.IR X (__miscmansuffix__), .IR man (1), .IR apropos (1), .IR catman (8), @@ -378,7 +381,7 @@ resource database after the system app-defaults file, and before the resources that are attached to the display. .br -See \fIX(1)\fP for a full statement of rights and permissions. +See \fIX(__miscmansuffix__)\fP for a full statement of rights and permissions. .SH AUTHORS Chris Peterson, MIT X Consortium from the V10 version written by Barry Shein formerly of Boston University. Index: xc/programs/xmessage/xmessage.man diff -u xc/programs/xmessage/xmessage.man:1.1 xc/programs/xmessage/xmessage.man:1.3 --- xc/programs/xmessage/xmessage.man:1.1 Sat Feb 12 22:26:36 2000 +++ xc/programs/xmessage/xmessage.man Sat Jan 27 13:21:19 2001 @@ -1,5 +1,8 @@ .\" $XConsortium: xmessage.man,v 1.8 95/03/08 22:28:48 gildea Exp $ -.TH XMESSAGE 1 "26 July 1994" "X Version 11" +.\" +.\" $XFree86: xc/programs/xmessage/xmessage.man,v 1.3 2001/01/27 18:21:19 dawes Exp $ +.\" +.TH XMESSAGE 1 __xorgversion__ .SH NAME xmessage \- display a message or query in a window (X-based /bin/echo) .SH SYNOPSIS @@ -165,7 +168,7 @@ If it detects an error, \fIxmessage\fP returns 1, so this value should not be used with a button. .SH "SEE ALSO" -.IR X (1), +.IR X (__miscmansuffix__), .IR echo (1), .IR cat (1) .br Index: xc/programs/xmh/init.c diff -u xc/programs/xmh/init.c:1.1.1.3 xc/programs/xmh/init.c:1.1.1.3.18.1 --- xc/programs/xmh/init.c:1.1.1.3 Sat Jul 8 02:49:31 1995 +++ xc/programs/xmh/init.c Fri May 25 14:50:15 2001 @@ -25,6 +25,7 @@ * without specific, written prior permission. * */ +/* $XFree86: xc/programs/xmh/init.c,v 1.1.1.3.18.1 2001/05/25 18:50:15 dawes Exp $ */ /* Init.c - Handle start-up initialization. */ @@ -384,7 +385,8 @@ theDisplay = XtDisplay(toplevel); - homeDir = XtNewString(getenv("HOME")); + homeDir = getenv("HOME"); + homeDir = XtNewString(homeDir); XtGetApplicationResources( toplevel, (XtPointer)&app_resources, resources, XtNumber(resources), Index: xc/programs/xmh/xmh.man diff -u xc/programs/xmh/xmh.man:1.1.1.4 xc/programs/xmh/xmh.man:1.3 --- xc/programs/xmh/xmh.man:1.1.1.4 Sat Dec 21 22:31:12 1996 +++ xc/programs/xmh/xmh.man Sat Jan 27 13:21:19 2001 @@ -25,7 +25,10 @@ .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from the X Consortium. -.TH XMH 1 "Release 6.3" "X Version 11" +.\" +.\" $XFree86: xc/programs/xmh/xmh.man,v 1.3 2001/01/27 18:21:19 dawes Exp $ +.\" +.TH XMH 1 __xorgversion__ .SH NAME xmh \- send and read mail with an X interface to MH .SH SYNOPSIS @@ -70,7 +73,7 @@ \fBMailPath\fR, \fBInitialFolder\fR, and \fBMailWaitingFlag\fR, which can be specified in a resource file. .PP -The standard toolkit command line options are given in \fIX(1)\fP. +The standard toolkit command line options are given in \fIX(__miscmansuffix__)\fP. .SH INSTALLATION .PP @@ -1490,7 +1493,7 @@ .br /tmp - temporary files, see \fBtempDir\fP. .SH SEE ALSO -X(1), xrdb(1), X Toolkit Intrinsics, Athena Widget Set, mh(1), enscript(1) +X(__miscmansuffix__), xrdb(1), X Toolkit Intrinsics, Athena Widget Set, mh(1), enscript(1) .br At least one book has been published about \fIMH\fP and \fIxmh\fP. .SH BUGS Index: xc/programs/xmodmap/Imakefile diff -u xc/programs/xmodmap/Imakefile:1.1.1.1 xc/programs/xmodmap/Imakefile:1.1.1.2 --- xc/programs/xmodmap/Imakefile:1.1.1.1 Wed Apr 27 03:13:04 1994 +++ xc/programs/xmodmap/Imakefile Tue Jan 16 18:01:47 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile,v 1.9 93/08/17 20:55:09 rws Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ DEPLIBS = $(DEPXONLYLIB) LOCAL_LIBRARIES = $(XONLYLIB) LINTLIBS = $(LINTXLIB) Index: xc/programs/xmodmap/exec.c diff -u xc/programs/xmodmap/exec.c:1.3 xc/programs/xmodmap/exec.c:1.4 --- xc/programs/xmodmap/exec.c:1.3 Sun Mar 7 09:23:37 1999 +++ xc/programs/xmodmap/exec.c Wed Jan 17 18:46:20 2001 @@ -1,4 +1,4 @@ -/* $TOG: exec.c /main/14 1998/02/09 14:11:16 kaleb $ */ +/* $Xorg: exec.c,v 1.3 2000/08/17 19:54:54 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -52,7 +52,7 @@ * Author: Jim Fulton, MIT X Consortium; derived from parts of the * original xmodmap, written by David Rosenthal, of Sun Microsystems. */ -/* $XFree86: xc/programs/xmodmap/exec.c,v 1.3 1999/03/07 14:23:37 dawes Exp $ */ +/* $XFree86: xc/programs/xmodmap/exec.c,v 1.4 2001/01/17 23:46:20 dawes Exp $ */ #include <X11/Xos.h> #include <X11/Xlib.h> Index: xc/programs/xmodmap/handle.c diff -u xc/programs/xmodmap/handle.c:3.3 xc/programs/xmodmap/handle.c:3.5 --- xc/programs/xmodmap/handle.c:3.3 Sun Mar 7 06:41:15 1999 +++ xc/programs/xmodmap/handle.c Mon Apr 23 17:41:47 2001 @@ -1,4 +1,4 @@ -/* $TOG: handle.c /main/29 1998/02/09 14:11:20 kaleb $ */ +/* $Xorg: handle.c,v 1.5 2000/08/17 19:54:54 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmodmap/handle.c,v 3.3 1999/03/07 11:41:15 dawes Exp $ */ +/* $XFree86: xc/programs/xmodmap/handle.c,v 3.5 2001/04/23 21:41:47 dawes Exp $ */ #include <X11/Xos.h> #include <X11/Xlib.h> @@ -357,9 +357,13 @@ return; } + /* + * We need not bother to advance line/len past the + * number (or the string 'any') as finish_keycodes() will + * first advance past the '='. + */ if (!strncmp("any", line, 3)) { keycode = 0; - len += 3; } else { if (*line == '0') line++, len--, fmt = "%o"; if (*line == 'x' || *line == 'X') line++, len--, fmt = "%x"; Index: xc/programs/xmodmap/pf.c diff -u xc/programs/xmodmap/pf.c:1.1.1.2 xc/programs/xmodmap/pf.c:1.1.1.3 --- xc/programs/xmodmap/pf.c:1.1.1.2 Sun Sep 27 04:02:03 1998 +++ xc/programs/xmodmap/pf.c Tue Jan 16 18:01:49 2001 @@ -1,4 +1,4 @@ -/* $TOG: pf.c /main/6 1998/02/09 14:11:26 kaleb $ */ +/* $Xorg: pf.c,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group Index: xc/programs/xmodmap/wq.h diff -u xc/programs/xmodmap/wq.h:1.3 xc/programs/xmodmap/wq.h:1.4 --- xc/programs/xmodmap/wq.h:1.3 Sun Mar 7 09:23:37 1999 +++ xc/programs/xmodmap/wq.h Wed Jan 17 18:46:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: wq.h /main/6 1998/02/09 14:11:33 kaleb $ */ +/* $Xorg: wq.h,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmodmap/wq.h,v 1.3 1999/03/07 14:23:37 dawes Exp $ */ +/* $XFree86: xc/programs/xmodmap/wq.h,v 1.4 2001/01/17 23:46:21 dawes Exp $ */ #ifndef _WQ_H #define _WQ_H Index: xc/programs/xmodmap/xmodmap.c diff -u xc/programs/xmodmap/xmodmap.c:1.4 xc/programs/xmodmap/xmodmap.c:1.6 --- xc/programs/xmodmap/xmodmap.c:1.4 Sun Jun 27 10:08:34 1999 +++ xc/programs/xmodmap/xmodmap.c Sun Apr 1 10:00:23 2001 @@ -1,4 +1,4 @@ -/* $TOG: xmodmap.c /main/25 1998/02/09 14:11:38 kaleb $ */ +/* $Xorg: xmodmap.c,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,11 +22,12 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmodmap/xmodmap.c,v 1.4 1999/06/27 14:08:34 dawes Exp $ */ +/* $XFree86: xc/programs/xmodmap/xmodmap.c,v 1.6 2001/04/01 14:00:23 tsi Exp $ */ #include <X11/Xos.h> #include <X11/Xlib.h> #include <stdio.h> +#include <stdlib.h> #include <ctype.h> #include "xmodmap.h" Index: xc/programs/xmodmap/xmodmap.h diff -u xc/programs/xmodmap/xmodmap.h:1.3 xc/programs/xmodmap/xmodmap.h:1.4 --- xc/programs/xmodmap/xmodmap.h:1.3 Sun Mar 7 09:23:38 1999 +++ xc/programs/xmodmap/xmodmap.h Wed Jan 17 18:46:21 2001 @@ -1,4 +1,4 @@ -/* $TOG: xmodmap.h /main/9 1998/02/09 14:11:42 kaleb $ */ +/* $Xorg: xmodmap.h,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ */ /* Copyright 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xmodmap/xmodmap.h,v 1.3 1999/03/07 14:23:38 dawes Exp $ */ +/* $XFree86: xc/programs/xmodmap/xmodmap.h,v 1.4 2001/01/17 23:46:21 dawes Exp $ */ extern char *ProgramName; extern Display *dpy; Index: xc/programs/xmodmap/xmodmap.man diff -u xc/programs/xmodmap/xmodmap.man:1.6 xc/programs/xmodmap/xmodmap.man:1.9 --- xc/programs/xmodmap/xmodmap.man:1.6 Sun Oct 4 05:41:43 1998 +++ xc/programs/xmodmap/xmodmap.man Sat Jan 27 13:21:21 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xmodmap.man /main/29 1998/02/09 14:11:47 kaleb $ +.\" $Xorg: xmodmap.man,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ .\" Copyright 1988, 1989, 1990, 1998 The Open Group .\" Copyright 1987 Sun Microsystems, Inc. .\" @@ -20,7 +20,7 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xmodmap/xmodmap.man,v 1.6 1998/10/04 09:41:43 dawes Exp $ +.\" $XFree86: xc/programs/xmodmap/xmodmap.man,v 1.9 2001/01/27 18:21:21 dawes Exp $ .\" .de EX \"Begin example .ne 5 @@ -35,7 +35,7 @@ .if n .sp 1 .if t .sp .5 .. -.TH XMODMAP 1 "Release 6.4" "X Version 11" +.TH XMODMAP 1 __xorgversion__ .SH NAME xmodmap - utility for modifying keymaps and pointer button mappings in X .SH SYNOPSIS @@ -278,7 +278,7 @@ .B DISPLAY to get default host and display number. .SH SEE ALSO -X(1), xev(1), \fIXlib\fP documentation on key and pointer events +X(__miscmansuffix__), xev(1), \fIXlib\fP documentation on key and pointer events .SH BUGS .PP Every time a \fBkeycode\fP expression is evaluated, the server generates Index: xc/programs/xprop/Imakefile diff -u xc/programs/xprop/Imakefile:1.2 xc/programs/xprop/Imakefile:1.5 --- xc/programs/xprop/Imakefile:1.2 Fri Mar 20 16:08:30 1998 +++ xc/programs/xprop/Imakefile Thu Mar 29 21:15:26 2001 @@ -1,8 +1,16 @@ -XCOMM $XConsortium: Imakefile,v 1.7 91/07/16 23:05:51 gildea Exp $ - DEPLIBS = $(DEPXMULIB) $(DEPXLIB) -LOCAL_LIBRARIES = $(XMULIB) $(XLIB) +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xprop/Imakefile,v 1.5 2001/03/30 02:15:26 keithp Exp $ + + DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XMUULIB) $(XLIB) SRCS = xprop.c dsimple.c OBJS = xprop.o dsimple.o + + DEFINES = XawI18nDefines LinkSourceFile(dsimple.c,../xlsfonts) LinkSourceFile(dsimple.h,../xlsfonts) Index: xc/programs/xprop/xprop.c diff -u xc/programs/xprop/xprop.c:1.7 xc/programs/xprop/xprop.c:1.10 --- xc/programs/xprop/xprop.c:1.7 Sun Dec 26 19:40:14 1999 +++ xc/programs/xprop/xprop.c Tue Jan 23 15:22:19 2001 @@ -1,7 +1,8 @@ -/* $TOG: xprop.c /main/44 1998/02/09 14:12:01 kaleb $*/ +/* $Xorg: xprop.c,v 1.5 2000/08/17 19:54:55 cpqbld Exp $ */ /* Copyright 1990, 1998 The Open Group +Copyright (c) 2000 The XFree86 Project, Inc. All Rights Reserved. @@ -22,33 +23,42 @@ from The Open Group. */ -/* $XFree86: xc/programs/xprop/xprop.c,v 1.7 1999/12/27 00:40:14 robin Exp $ */ +/* $XFree86: xc/programs/xprop/xprop.c,v 1.10 2001/01/23 20:22:19 dawes Exp $ */ #include <X11/Xlib.h> #include <X11/Xos.h> #include <X11/Xfuncs.h> #include <X11/Xutil.h> +#include <stdlib.h> #include <stdio.h> #include <ctype.h> +#ifdef HAS_WCHAR_H +#include <wchar.h> +#endif +#ifdef HAS_WCTYPE_H +#include <wctype.h> +#endif +#include <locale.h> +#ifndef HAS_WCTYPE_H +#define iswprint(x) isprint(x) +#endif + #include <X11/Xatom.h> #include <X11/Xmu/WinUtil.h> #include "dsimple.h" -#ifndef X_NOT_STDC_ENV -#include <stdlib.h> -#else -char *getenv(); -#endif - #define MAXSTR 10000 #ifndef min #define min(a,b) ((a) < (b) ? (a) : (b)) #endif +/* isprint() in "C" locale */ +#define c_isprint(c) ((c) >= 0x20 && (c) < 0x7f) + /* * * The Thunk Manager - routines to create, add to, and free thunk lists @@ -57,183 +67,192 @@ typedef struct { int thunk_count; + const char *propname; long value; - char *extra_value; - char *format; - char *dformat; + Atom extra_encoding; + const char *extra_value; + const char *format; + const char *dformat; } thunk; - -#if NeedFunctionPrototypes -static Atom Parse_Atom(char *, int); -extern thunk *Create_Thunk_List(void); -extern void Free_Thunk_List(thunk *); -extern thunk *Add_Thunk(thunk *, thunk); -extern char *Copy_String(char *); -extern int Read_Char(FILE *); -extern void Read_White_Space(FILE *); -extern char *Read_Quoted(FILE *); -extern void Apply_Default_Formats(char **, char **); -extern void Lookup_Formats(Atom, char **, char **); -extern void Add_Mapping(Atom, char *, char *); -extern void Setup_Mapping(void); -extern char *GetAtomName(Atom); -extern void Read_Mappings(FILE *); -extern char *Format_Hex(long); -extern char *Format_Unsigned(long); -extern char *Format_Signed(long); -extern int ignore_errors(Display *, XErrorEvent *); -extern char *Format_Atom(Atom); -extern char *Format_Mask_Word(long); -extern char *Format_Bool(long); -extern void _put_char(char); -extern void _format_char(char); -extern char *Format_String(char *); -extern char *Format_Len_String(char *, int); -extern char *Skip_Digits(char *); -extern char *Scan_Long(char *, long *); -extern char *Scan_Octal(char *, long *); -extern char *Skip_Past_Right_Paran(char *); -extern int Is_A_Format(char *); -extern int Get_Format_Size(char *); -extern char Get_Format_Char(char *, int); -extern char *Format_Thunk(thunk, char); -extern char *Format_Thunk_I(thunk *, char *, int); -extern long Mask_Word(thunk *, char *); -extern int Is_A_DFormat(char *); -extern char *Handle_Backslash(char *); -extern char *Handle_Dollar_sign(char *, thunk *, char *); -extern int Mask_Bit_I(thunk *, char *, int); -extern char *Scan_Term(char *, thunk *, char *, long *); -extern char *Scan_Exp(char *, thunk *, char *, long *); -extern char *Handle_Question_Mark(char *, thunk *, char *); -extern void Display_Property(thunk *, char *, char *); -extern long Extract_Value(char **, int *, int, int); -extern long Extract_Len_String(char **, int *, int, char **); -extern thunk *Break_Down_Property(char *, int, char *, int); -extern void grammar(void); -extern void Parse_Format_Mapping(int *, char ***); -extern int main(int, char **); -extern void remove_property(Display *, Window, char *); -extern thunk *Handle_Prop_Requests(int, char **); -extern void Show_All_Props(void); -extern void Set_Prop(char *, char *, char *, char, char *); -extern char *Get_Font_Property_Data_And_Type(Atom, long *, Atom *, int *); -extern char *Get_Window_Property_Data_And_Type(Atom, long *, Atom *, int *); -extern char *Get_Property_Data_And_Type(Atom, long *, Atom *, int *); -extern void Show_Prop(char *, char *, char *); -#endif - -thunk *Create_Thunk_List() +static thunk * +Create_Thunk_List (void) { - thunk *tptr; + thunk *tptr; - tptr = (thunk *) Malloc( sizeof(thunk) ); + tptr = (thunk *) Malloc(sizeof(thunk)); - tptr->thunk_count = 0; + tptr->thunk_count = 0; - return(tptr); + return tptr; } -void -Free_Thunk_List(list) -thunk *list; +#ifdef notused +static void +Free_Thunk_List (thunk *list) { - free(list); + free(list); } +#endif -thunk *Add_Thunk(list, t) -thunk *list; -thunk t; +static thunk * +Add_Thunk (thunk *list, thunk t) { - int i; + int i; - i = list->thunk_count; + i = list->thunk_count; - list = (thunk *) realloc(list, (i+1)*sizeof(thunk) ); - if (!list) - Fatal_Error("Out of memory!"); + list = (thunk *) realloc(list, (i+1)*sizeof(thunk)); + if (!list) + Fatal_Error("Out of memory!"); - list[i++] = t; - list->thunk_count = i; + list[i++] = t; + list->thunk_count = i; - return(list); + return list; } /* * Misc. routines */ -char *Copy_String(string) - char *string; +static char * +Copy_String (const char *string) { - char *new; - int length; + char *new; + int length; - length = strlen(string) + 1; + length = strlen(string) + 1; - new = (char *) Malloc(length); - memmove( new, string, length); + new = (char *) Malloc(length); + memcpy(new, string, length); - return(new); + return new; } -int Read_Char(stream) - FILE *stream; +static int +Read_Char (FILE *stream) { - int c; + int c; - c = getc(stream); - if (c==EOF) - Fatal_Error("Bad format file: Unexpected EOF."); - return(c); + c = getc(stream); + if (c == EOF) + Fatal_Error("Bad format file: Unexpected EOF."); + return c; } -void -Read_White_Space(stream) - FILE *stream; +static void +Read_White_Space (FILE *stream) { - int c; + int c; - while ((c=getc(stream))==' ' || c=='\n' || c=='\t'); - ungetc(c, stream); + while ((c = getc(stream)) == ' ' || c == '\n' || c == '\t'); + ungetc(c, stream); } static char _large_buffer[MAXSTR+10]; -char *Read_Quoted(stream) - FILE *stream; +static char * +Read_Quoted (FILE *stream) { - char *ptr; - int c, length; - - Read_White_Space(stream); - if (Read_Char(stream)!='\'') - Fatal_Error("Bad format file format: missing dformat."); + char *ptr; + int c, length; - ptr = _large_buffer; length=MAXSTR; - for (;;) { - if (length<0) - Fatal_Error("Bad format file format: dformat too long."); - c = Read_Char(stream); - if (c==(int) '\'') - break; - ptr++[0]=c; length--; - if (c== (int) '\\') { - c=Read_Char(stream); - if (c=='\n') { - ptr--; length++; - } else - ptr++[0]=c; length--; - } + Read_White_Space(stream); + if (Read_Char(stream)!='\'') + Fatal_Error("Bad format file format: missing dformat."); + + ptr = _large_buffer; length = MAXSTR; + for (;;) { + if (length < 0) + Fatal_Error("Bad format file format: dformat too long."); + c = Read_Char(stream); + if (c == (int) '\'') + break; + ptr++[0] = c; length--; + if (c == (int) '\\') { + c = Read_Char(stream); + if (c == '\n') { + ptr--; length++; + } else + ptr++[0] = c; length--; } - ptr++[0]='\0'; + } + ptr++[0] = '\0'; - return(Copy_String(_large_buffer)); + return Copy_String(_large_buffer); } /* * + * Parsing Routines: a group of routines to parse strings into values + * + * Routines: Parse_Atom, Scan_Long, Skip_Past_Right_Paren, Scan_Octal + * + * Routines of the form Parse_XXX take a string which is parsed to a value. + * Routines of the form Scan_XXX take a string, parse the beginning to a value, + * and return the rest of the string. The value is returned via. the last + * parameter. All numeric values are longs! + * + */ + +static const char * +Skip_Digits (const char *string) +{ + while (isdigit((unsigned char) string[0])) string++; + return string; +} + +static const char * +Scan_Long (const char *string, long *value) +{ + if (!isdigit((unsigned char) *string)) + Fatal_Error("Bad number: %s.", string); + + *value = atol(string); + return Skip_Digits(string); +} + +static const char * +Scan_Octal (const char *string, long *value) +{ + if (sscanf(string, "%lo", value)!=1) + Fatal_Error("Bad octal number: %s.", string); + return Skip_Digits(string); +} + +static Atom +Parse_Atom (const char *name, int only_if_exists) +{ + /* may return None = 0 */ + return XInternAtom(dpy, name, only_if_exists); +} + +static const char * +Skip_Past_Right_Paren (const char *string) +{ + char c; + int nesting = 0; + + while (c = string++[0], c != ')' || nesting) + switch (c) { + case '\0': + Fatal_Error("Missing ')'."); + case '(': + nesting++; + break; + case ')': + nesting--; + break; + case '\\': + string++; + break; + } + return string; +} + +/* + * * Atom to format, dformat mapping Manager * */ @@ -241,54 +260,46 @@ #define D_FORMAT "0x" /* Default format for properties */ #define D_DFORMAT " = $0+\n" /* Default display pattern for properties */ -static thunk *_property_formats = 0; /* Holds mapping */ +static thunk *_property_formats = NULL; /* Holds mapping */ -void -Apply_Default_Formats(format, dformat) - char **format; - char **dformat; -{ - if (!*format) - *format = D_FORMAT; - if (!*dformat) - *dformat = D_DFORMAT; +static void +Apply_Default_Formats (const char **format, const char **dformat) +{ + if (!*format) + *format = D_FORMAT; + if (!*dformat) + *dformat = D_DFORMAT; } -void -Lookup_Formats(atom, format, dformat) - Atom atom; - char **format; - char **dformat; -{ - int i; - - if (_property_formats) - for (i=_property_formats->thunk_count-1; i>=0; i--) - if (_property_formats[i].value==atom) { - if (!*format) - *format = _property_formats[i].format; - if (!*dformat) - *dformat = _property_formats[i].dformat; - break; - } +static void +Lookup_Formats (Atom atom, const char **format, const char **dformat) +{ + int i; + + if (_property_formats) + for (i = _property_formats->thunk_count-1; i >= 0; i--) + if (_property_formats[i].value == atom) { + if (!*format) + *format = _property_formats[i].format; + if (!*dformat) + *dformat = _property_formats[i].dformat; + break; + } } -void -Add_Mapping(atom, format, dformat) - Atom atom; - char *format; - char *dformat; +static void +Add_Mapping (Atom atom, const char *format, const char *dformat) { - thunk t; + thunk t; - if (!_property_formats) - _property_formats = Create_Thunk_List(); + if (!_property_formats) + _property_formats = Create_Thunk_List(); - t.value=atom; - t.format=format; - t.dformat=dformat; + t.value = atom; + t.format = format; + t.dformat = dformat; - _property_formats = Add_Thunk(_property_formats, t); + _property_formats = Add_Thunk(_property_formats, t); } /* @@ -298,10 +309,10 @@ */ typedef struct _propertyRec { - char * name; - Atom atom; - char * format; - char * dformat; + const char * name; + Atom atom; + const char * format; + const char * dformat; } propertyRec; #define ARC_DFORMAT ":\n"\ @@ -375,7 +386,7 @@ "\t\twindow state: ?$0=0(Withdrawn)?$0=1(Normal)?$0=3(Iconic)\n"\ "\t\ticon window: $1\n" -propertyRec windowPropTable[] = { +static propertyRec windowPropTable[] = { {"ARC", XA_ARC, "16iiccii", ARC_DFORMAT }, {"ATOM", XA_ATOM, "32a", 0 }, {"BITMAP", XA_BITMAP, "32x", ": bitmap id # $0\n" }, @@ -395,7 +406,9 @@ {"WM_COLORMAP_WINDOWS", 0, "32x", ": window id # $0+\n"}, {"WM_COMMAND", XA_WM_COMMAND, "8s", " = { $0+ }\n" }, {"WM_HINTS", XA_WM_HINTS, "32mbcxxiixx", WM_HINTS_DFORMAT }, - {"WM_ICON_SIZE", XA_WM_ICON_SIZE, "32cccccc", WM_ICON_SIZE_DFORMAT}, + {"WM_ICON_NAME", XA_WM_ICON_NAME, "8t", 0 }, + {"WM_ICON_SIZE", XA_WM_ICON_SIZE, "32cccccc", WM_ICON_SIZE_DFORMAT}, + {"WM_NAME", XA_WM_NAME, "8t", 0 }, {"WM_PROTOCOLS", 0, "32a", ": protocols $0+\n"}, {"WM_SIZE_HINTS", XA_WM_SIZE_HINTS,"32mii", WM_SIZE_HINTS_DFORMAT }, {"WM_STATE", 0, "32cx", WM_STATE_DFORMAT} @@ -411,7 +424,7 @@ /* * Font-specific mapping of property names to types: */ -propertyRec fontPropTable[] = { +static propertyRec fontPropTable[] = { /* XLFD name properties */ @@ -473,8 +486,8 @@ #define XpropWindowProperties 0 #define XpropFontProperties 1 -void -Setup_Mapping() +static void +Setup_Mapping (void) { int n; propertyRec *p; @@ -496,12 +509,12 @@ } } -char *GetAtomName(atom) - Atom atom; +static const char * +GetAtomName (Atom atom) { int n; propertyRec *p; - + if (XpropMode == XpropWindowProperties) { n = sizeof(windowPropTable) / sizeof(propertyRec); p = windowPropTable; @@ -513,7 +526,7 @@ if (p->atom == atom) return p->name; - return (char *) NULL; + return NULL; } /* @@ -521,31 +534,30 @@ * already open for reading. */ -void -Read_Mappings(stream) - FILE *stream; +static void +Read_Mappings (FILE *stream) { - char format_buffer[100]; - char name[1000], *dformat, *format; - int count, c; - Atom atom; - - while ((count=fscanf(stream," %990s %90s ",name,format_buffer))!=EOF) { - if (count != 2) - Fatal_Error("Bad format file format."); - - atom = Parse_Atom(name, False); - format = Copy_String(format_buffer); - - Read_White_Space(stream); - dformat = D_DFORMAT; - c = getc(stream); - ungetc(c, stream); - if (c==(int)'\'') - dformat = Read_Quoted(stream); + char format_buffer[100]; + char name[1000], *dformat, *format; + int count, c; + Atom atom; - Add_Mapping(atom, format, dformat); - } + while ((count = fscanf(stream," %990s %90s ",name,format_buffer)) != EOF) { + if (count != 2) + Fatal_Error("Bad format file format."); + + atom = Parse_Atom(name, False); + format = Copy_String(format_buffer); + + Read_White_Space(stream); + dformat = D_DFORMAT; + c = getc(stream); + ungetc(c, stream); + if (c == (int) '\'') + dformat = Read_Quoted(stream); + + Add_Mapping(atom, format, dformat); + } } /* @@ -561,350 +573,308 @@ * */ static char _formatting_buffer[MAXSTR+100]; -static char _formatting_buffer2[10]; +static char _formatting_buffer2[21]; -char *Format_Hex(wrd) - long wrd; +static const char * +Format_Hex (long wrd) { - sprintf(_formatting_buffer2, "0x%lx", wrd); - return(_formatting_buffer2); + sprintf(_formatting_buffer2, "0x%lx", wrd); + return _formatting_buffer2; } -char *Format_Unsigned(wrd) - long wrd; +static const char * +Format_Unsigned (long wrd) { - sprintf(_formatting_buffer2, "%lu", wrd); - return(_formatting_buffer2); + sprintf(_formatting_buffer2, "%lu", wrd); + return _formatting_buffer2; } -char *Format_Signed(wrd) - long wrd; +static const char * +Format_Signed (long wrd) { - sprintf(_formatting_buffer2, "%ld", wrd); - return(_formatting_buffer2); + sprintf(_formatting_buffer2, "%ld", wrd); + return _formatting_buffer2; } /*ARGSUSED*/ -int ignore_errors (dpy, ev) - Display *dpy; - XErrorEvent *ev; +static int +ignore_errors (Display *dpy, XErrorEvent *ev) { return 0; } + +static const char * +Format_Atom (Atom atom) +{ + const char *found; + char *name; + XErrorHandler handler; + + if ((found = GetAtomName(atom)) != NULL) + return found; + + handler = XSetErrorHandler (ignore_errors); + name = XGetAtomName(dpy, atom); + XSetErrorHandler(handler); + if (! name) + sprintf(_formatting_buffer, "undefined atom # 0x%lx", atom); + else { + int namelen = strlen(name); + if (namelen > MAXSTR) namelen = MAXSTR; + memcpy(_formatting_buffer, name, namelen); + _formatting_buffer[namelen] = '\0'; + XFree(name); + } + return _formatting_buffer; +} -char *Format_Atom(atom) - Atom atom; +static const char * +Format_Mask_Word (long wrd) { - char *name; - XErrorHandler handler; + long bit_mask, bit; + int seen = 0; - if ((name = GetAtomName(atom))) { - strncpy(_formatting_buffer, name, MAXSTR); - return(_formatting_buffer); - } - - handler = XSetErrorHandler (ignore_errors); - name=XGetAtomName(dpy, atom); - XSetErrorHandler(handler); - if (! name) - sprintf(_formatting_buffer, "undefined atom # 0x%lx", atom); - else { - strncpy(_formatting_buffer, name, MAXSTR); - XFree(name); - } - return(_formatting_buffer); -} - -char *Format_Mask_Word(wrd) - long wrd; -{ - long bit_mask, bit; - int seen = 0; - - strcpy(_formatting_buffer, "{MASK: "); - for (bit=0, bit_mask=1; bit<=sizeof(long)*8; bit++, bit_mask<<=1) { - if (bit_mask & wrd) { - if (seen) { - strcat(_formatting_buffer, ", "); - } - seen=1; - strcat(_formatting_buffer, Format_Unsigned(bit)); + strcpy(_formatting_buffer, "{MASK: "); + for (bit=0, bit_mask=1; bit <= sizeof(long)*8; bit++, bit_mask<<=1) { + if (bit_mask & wrd) { + if (seen) { + strcat(_formatting_buffer, ", "); + } + seen = 1; + strcat(_formatting_buffer, Format_Unsigned(bit)); + } } - } - strcat(_formatting_buffer, "}"); + strcat(_formatting_buffer, "}"); - return(_formatting_buffer); + return _formatting_buffer; } -char *Format_Bool(value) - long value; +static const char * +Format_Bool (long value) { - if (!value) - return("False"); + if (!value) + return "False"; - return("True"); + return "True"; } static char *_buf_ptr; static int _buf_len; -#if NeedFunctionPrototypes -void -_put_char(char c) -#else -void -_put_char(c) - char c; -#endif +static void +_put_char (char c) { - if (--_buf_len<0) { - _buf_ptr[0]='\0'; - return; - } - _buf_ptr++[0] = c; + if (--_buf_len < 0) { + _buf_ptr[0] = '\0'; + return; + } + _buf_ptr++[0] = c; } -#if NeedFunctionPrototypes -void -_format_char(char c) -#else -void -_format_char(c) - char c; -#endif +static void +_format_char (char c) { - switch (c) { - case '\\': - case '\"': - _put_char('\\'); - _put_char(c); - break; - case '\n': - _put_char('\\'); - _put_char('n'); - break; - case '\t': - _put_char('\\'); - _put_char('t'); - break; - default: - if (!isprint (c)) { - _put_char('\\'); - sprintf(_buf_ptr, "%o", (int) c & 0xff); - _buf_ptr += strlen(_buf_ptr); - _buf_len -= strlen(_buf_ptr); - } else - _put_char(c); - } + switch (c) { + case '\\': + case '\"': + _put_char('\\'); + _put_char(c); + break; + case '\n': + _put_char('\\'); + _put_char('n'); + break; + case '\t': + _put_char('\\'); + _put_char('t'); + break; + default: + if (!c_isprint(c)) { + _put_char('\\'); + sprintf(_buf_ptr, "%03o", (unsigned char) c); + _buf_ptr += 3; + _buf_len -= 3; + } else + _put_char(c); + } } -char *Format_String(string) - char *string; +static const char * +Format_String (const char *string) { - char c; + char c; - _buf_ptr = _formatting_buffer; - _buf_len = MAXSTR; - _put_char('\"'); + _buf_ptr = _formatting_buffer; + _buf_len = MAXSTR; + _put_char('\"'); - while ((c = string++[0])) - _format_char(c); + while ((c = string++[0])) + _format_char(c); - _buf_len += 3; - _put_char('\"'); - _put_char('\0'); - return(_formatting_buffer); + *_buf_ptr++ = '"'; + *_buf_ptr++ = '\0'; + return _formatting_buffer; } -char *Format_Len_String(string, len) - char *string; - int len; +static const char * +Format_Len_String (const char *string, int len) { - char *data, *result; + char *data; + const char *result; - data = (char *) Malloc(len+1); + data = (char *) Malloc(len+1); - memmove( data, string, len); - data[len]='\0'; + memcpy(data, string, len); + data[len] = '\0'; - result = Format_String(data); - free(data); + result = Format_String(data); + free(data); - return(result); + return result; } +static const char * +Format_Len_Text (const char *string, int len, Atom encoding) +{ + XTextProperty textprop; + char **list; + int count; + + /* Try to convert to local encoding. */ + textprop.encoding = encoding; + textprop.format = 8; + textprop.value = (unsigned char *) string; + textprop.nitems = len; + if (XmbTextPropertyToTextList(dpy, &textprop, &list, &count) == Success) { + _buf_ptr = _formatting_buffer; + _buf_len = MAXSTR; + *_buf_ptr++ = '"'; + while (count > 0) { + string = *list++; + len = strlen(string); + while (len > 0) { + wchar_t wc; + int n = mbtowc(&wc, string, len); + if (n > 0 && iswprint(wc)) { + if (_buf_len >= n) { + memcpy(_buf_ptr, string, n); + _buf_ptr += n; + _buf_len -= n; + } + string += n; + len -= n; + } else { + _put_char('\\'); + sprintf(_buf_ptr, "%03o", (unsigned char) *string); + _buf_ptr += 3; + _buf_len -= 3; + string++; + len--; + } + } + count--; + if (count > 0) { + sprintf(_buf_ptr, "\\000"); + _buf_ptr += 4; + _buf_len -= 4; + } + } + *_buf_ptr++ = '"'; + *_buf_ptr++ = '\0'; + return _formatting_buffer; + } else + return Format_Len_String(string, len); +} + /* - * - * Parsing Routines: a group of routines to parse strings into values * - * Routines: Parse_Atom, Scan_Long, Skip_Past_Right_Paran, Scan_Octal - * - * Routines of the form Parse_XXX take a string which is parsed to a value. - * Routines of the form Scan_XXX take a string, parse the beginning to a value, - * and return the rest of the string. The value is returned via. the last - * parameter. All numeric values are longs! + * The Format Manager: a group of routines to manage "formats" * */ - -char *Skip_Digits(string) - char *string; -{ - while (isdigit(string[0])) string++; - return(string); -} -char *Scan_Long(string, value) - char *string; - long *value; +static int +Is_A_Format (const char *string) { - if (!isdigit(*string)) - Fatal_Error("Bad number: %s.", string); - - *value = atol(string); - return(Skip_Digits(string)); + return isdigit((unsigned char) string[0]); } -char *Scan_Octal(string, value) - char *string; - long *value; +static int +Get_Format_Size (const char *format) { - if (sscanf(string, "%lo", value)!=1) - Fatal_Error("Bad octal number: %s.", string); - return(Skip_Digits(string)); -} + long size; -Atom Parse_Atom(name, only_if_exists) - char *name; - int only_if_exists; -{ - Atom atom; + Scan_Long(format, &size); - if ((atom = XInternAtom(dpy, name, only_if_exists))==None) - return(0); + /* Check for legal sizes */ + if (size != 0 && size != 8 && size != 16 && size != 32) + Fatal_Error("bad format: %s", format); - return(atom); + return (int) size; } -char *Skip_Past_Right_Paran(string) - char *string; +static char +Get_Format_Char (const char *format, int i) { - char c; - int nesting=0; + long size; - while (c=string++[0], c!=')' || nesting) - switch (c) { - case '\0': - Fatal_Error("Missing ')'."); - case '(': - nesting++; - break; - case ')': - nesting--; - break; - case '\\': - string++; - break; - } - return(string); -} + /* Remove # at front of format */ + format = Scan_Long(format, &size); + if (!*format) + Fatal_Error("bad format: %s", format); -/* - * - * The Format Manager: a group of routines to manage "formats" - * - */ + /* Last character repeats forever... */ + if (i >= (int)strlen(format)) + i = strlen(format)-1; -int Is_A_Format(string) -char *string; -{ - return(isdigit(string[0])); + return format[i]; } -int Get_Format_Size(format) - char *format; +static const char * +Format_Thunk (thunk t, char format_char) { - long size; - - Scan_Long(format, &size); - - /* Check for legal sizes */ - if (size != 0 && size != 8 && size != 16 && size != 32) - Fatal_Error("bad format: %s", format); + long value; + value = t.value; - return((int) size); + switch (format_char) { + case 's': + return Format_Len_String(t.extra_value, (int)t.value); + case 't': + return Format_Len_Text(t.extra_value, (int)t.value, t.extra_encoding); + case 'x': + return Format_Hex(value); + case 'c': + return Format_Unsigned(value); + case 'i': + return Format_Signed(value); + case 'b': + return Format_Bool(value); + case 'm': + return Format_Mask_Word(value); + case 'a': + return Format_Atom(value); + default: + Fatal_Error("bad format character: %c", format_char); + } } -char Get_Format_Char(format, i) - char *format; - int i; +static const char * +Format_Thunk_I (thunk *thunks, const char *format, int i) { - long size; - - /* Remove # at front of format */ - format = Scan_Long(format, &size); - if (!*format) - Fatal_Error("bad format: %s", format); - - /* Last character repeats forever... */ - if (i >= (int)strlen(format)) - i=strlen(format)-1; + if (i >= thunks->thunk_count) + return "<field not available>"; - return(format[i]); + return Format_Thunk(thunks[i], Get_Format_Char(format, i)); } -#if NeedFunctionPrototypes -char * -Format_Thunk(thunk t, char format_char) -#else -char *Format_Thunk(t, format_char) - thunk t; - char format_char; -#endif +static long +Mask_Word (thunk *thunks, const char *format) { - long value; - value = t.value; + int j; - switch (format_char) { - case 's': - return(Format_Len_String(t.extra_value, (int)t.value)); - case 'x': - return(Format_Hex(value)); - case 'c': - return(Format_Unsigned(value)); - case 'i': - return(Format_Signed(value)); - case 'b': - return(Format_Bool(value)); - case 'm': - return(Format_Mask_Word(value)); - case 'a': - return(Format_Atom(value)); - default: - Fatal_Error("bad format character: %c", format_char); - } -} - -char *Format_Thunk_I(thunks, format, i) - thunk *thunks; - char *format; - int i; -{ - if (i >= thunks->thunk_count) - return("<field not available>"); - - return(Format_Thunk(thunks[i], Get_Format_Char(format, i))); -} - -long Mask_Word(thunks, format) - thunk *thunks; - char *format; -{ - int j; - - for (j=0; j<(int)strlen(format); j++) - if (Get_Format_Char(format, j) == 'm') - return(thunks[j].value); - return(0L); + for (j = 0; j < (int)strlen(format); j++) + if (Get_Format_Char(format, j) == 'm') + return thunks[j].value; + return 0; } /* @@ -913,167 +883,156 @@ * */ -int Is_A_DFormat(string) - char *string; +static int +Is_A_DFormat (const char *string) { - return( string[0] && string[0] != '-' && - !(isalpha(string[0]) || string[0] == '_') ); + return string[0] && string[0] != '-' + && !(isalpha((unsigned char) string[0]) || string[0] == '_'); } -char *Handle_Backslash(dformat) - char *dformat; +static const char * +Handle_Backslash (const char *dformat) { - char c; - long i; + char c; + long i; - if (!(c = *(dformat++))) - return(dformat); + if (!(c = *(dformat++))) + return dformat; - switch (c) { - case 'n': - putchar('\n'); - break; - case 't': - putchar('\t'); - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - dformat = Scan_Octal(dformat, &i); - putchar((int) i); - break; - default: - putchar(c); - break; - } - return(dformat); + switch (c) { + case 'n': + putchar('\n'); + break; + case 't': + putchar('\t'); + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + dformat = Scan_Octal(dformat, &i); + putchar((int) i); + break; + default: + putchar(c); + break; + } + return dformat; } -char *Handle_Dollar_sign(dformat, thunks, format) - char *dformat; - thunk *thunks; - char *format; -{ - long i; - - dformat = Scan_Long(dformat, &i); - - if (dformat[0]=='+') { - int seen=0; - dformat++; - for (; i<thunks->thunk_count; i++) { - if (seen) - printf(", "); - seen = 1; - printf("%s", Format_Thunk_I(thunks, format, (int) i)); - } - } else - printf("%s", Format_Thunk_I(thunks, format, (int) i)); +static const char * +Handle_Dollar_sign (const char *dformat, thunk *thunks, const char *format) +{ + long i; + + dformat = Scan_Long(dformat, &i); + + if (dformat[0] == '+') { + int seen = 0; + dformat++; + for (; i < thunks->thunk_count; i++) { + if (seen) + printf(", "); + seen = 1; + printf("%s", Format_Thunk_I(thunks, format, (int) i)); + } + } else + printf("%s", Format_Thunk_I(thunks, format, (int) i)); - return(dformat); + return dformat; } -int Mask_Bit_I(thunks, format, i) - thunk *thunks; - char *format; - int i; +static int +Mask_Bit_I (thunk *thunks, const char *format, int i) { - long value; + long value; - value = Mask_Word(thunks, format); + value = Mask_Word(thunks, format); - value = value & (1L<<i); - if (value) - value=1; - return(value); + value = value & (1L<<i); + if (value) + value = 1; + return value; } -char *Scan_Term(string, thunks, format, value) - thunk *thunks; - char *string, *format; - long *value; +static const char * +Scan_Term (const char *string, thunk *thunks, const char *format, long *value) { - long i; + long i; - *value=0; + *value = 0; - if (isdigit(*string)) - string = Scan_Long(string, value); - else if (*string=='$') { - string = Scan_Long(++string, &i); - if (i>=thunks->thunk_count) - i=thunks->thunk_count; - *value = thunks[i].value; - } else if (*string=='m') { - string = Scan_Long(++string, &i); - *value = Mask_Bit_I(thunks, format, (int) i); - } else - Fatal_Error("Bad term: %s.", string); + if (isdigit((unsigned char) *string)) + string = Scan_Long(string, value); + else if (*string == '$') { + string = Scan_Long(++string, &i); + if (i >= thunks->thunk_count) + i = thunks->thunk_count; + *value = thunks[i].value; + } else if (*string == 'm') { + string = Scan_Long(++string, &i); + *value = Mask_Bit_I(thunks, format, (int) i); + } else + Fatal_Error("Bad term: %s.", string); - return(string); + return string; } -char *Scan_Exp(string, thunks, format, value) - thunk *thunks; - char *string, *format; - long *value; +static const char * +Scan_Exp (const char *string, thunk *thunks, const char *format, long *value) { - long temp; + long temp; - if (string[0]=='(') { - string = Scan_Exp(++string, thunks, format, value); - if (string[0]!=')') - Fatal_Error("Missing ')'"); - return(++string); - } - if (string[0]=='!') { - string = Scan_Exp(++string, thunks, format, value); - *value = !*value; - return(string); - } + if (string[0] == '(') { + string = Scan_Exp(++string, thunks, format, value); + if (string[0]!=')') + Fatal_Error("Missing ')'"); + return ++string; + } + if (string[0] == '!') { + string = Scan_Exp(++string, thunks, format, value); + *value = !*value; + return string; + } - string = Scan_Term(string, thunks, format, value); + string = Scan_Term(string, thunks, format, value); - if (string[0]=='=') { - string = Scan_Exp(++string, thunks, format, &temp); - *value = *value == temp; - } + if (string[0] == '=') { + string = Scan_Exp(++string, thunks, format, &temp); + *value = *value == temp; + } - return(string); + return string; } -char *Handle_Question_Mark(dformat, thunks, format) - thunk *thunks; - char *dformat, *format; +static const char * +Handle_Question_Mark (const char *dformat, thunk *thunks, const char *format) { - long true; + long true; - dformat = Scan_Exp(dformat, thunks, format, &true); + dformat = Scan_Exp(dformat, thunks, format, &true); - if (*dformat!='(') - Fatal_Error("Bad conditional: '(' expected: %s.", dformat); - ++dformat; + if (*dformat != '(') + Fatal_Error("Bad conditional: '(' expected: %s.", dformat); + ++dformat; - if (!true) - dformat = Skip_Past_Right_Paran(dformat); + if (!true) + dformat = Skip_Past_Right_Paren(dformat); - return(dformat); + return dformat; } -void -Display_Property(thunks, dformat, format) - thunk *thunks; - char *dformat, *format; +static void +Display_Property (thunk *thunks, const char *dformat, const char *format) { - char c; + char c; - while ((c = *(dformat++))) - switch (c) { + while ((c = *(dformat++))) + switch (c) { case ')': continue; case '\\': @@ -1088,88 +1047,408 @@ default: putchar(c); continue; + } +} + +/* + * + * Routines to convert property data to thunks + * + */ + +static long +Extract_Value (const char **pointer, int *length, int size, int signedp) +{ + long value; + + switch (size) { + case 8: + if (signedp) + value = * (const signed char *) *pointer; + else + value = * (const unsigned char *) *pointer; + *pointer += 1; + *length -= 1; + break; + case 16: + if (signedp) + value = * (const short *) *pointer; + else + value = * (const unsigned short *) *pointer; + *pointer += sizeof(short); + *length -= sizeof(short); + break; + case 32: + if (signedp) + value = * (const long *) *pointer; + else + value = * (const unsigned long *) *pointer & 0xffffffff; + *pointer += sizeof(long); + *length -= sizeof(long); + break; + default: + abort(); + } + return value; +} + +static long +Extract_Len_String (const char **pointer, int *length, int size, const char **string) +{ + int len; + + if (size != 8) + Fatal_Error("can't use format character 's' with any size except 8."); + len = 0; *string = *pointer; + while ((len++, --*length, *((*pointer)++)) && *length>0); + + return len; +} + +static thunk * +Break_Down_Property (const char *pointer, int length, Atom type, const char *format, int size) +{ + thunk *thunks; + thunk t; + int i; + char format_char; + + thunks = Create_Thunk_List(); + i = 0; + + while (length >= size/8) { + format_char = Get_Format_Char(format, i); + if (format_char == 's') + t.value = Extract_Len_String(&pointer,&length,size,&t.extra_value); + else if (format_char == 't') { + t.extra_encoding = type; + t.value = Extract_Len_String(&pointer,&length,size,&t.extra_value); + } else + t.value = Extract_Value(&pointer,&length,size,format_char=='i'); + thunks = Add_Thunk(thunks, t); + i++; } + + return thunks; } /* + * Variables set by main() + */ + +static Window target_win = 0; +static int notype = 0; +static int max_len = MAXSTR; +static XFontStruct *font; +static unsigned long _font_prop; + +/* * - * Routines to convert property data to and from thunks + * Other Stuff (temp.): * */ -long Extract_Value(pointer, length, size, signedp) - char **pointer; - int *length; - int size; +static const char * +Get_Font_Property_Data_And_Type (Atom atom, + long *length, Atom *type, int *size) { - long value, mask; + int i; + + *type = None; + + for (i = 0; i < font->n_properties; i++) + if (atom == font->properties[i].name) { + _font_prop = font->properties[i].card32; + *length = sizeof(long); + *size = 32; + return (const char *) &_font_prop; + } + *size = 0; + return NULL; +} - switch (size) { - case 8: - value = (long) * (char *) *pointer; - *pointer += 1; - *length -= 1; - mask = 0xff; - break; - case 16: - value = (long) * (short *) *pointer; - *pointer += sizeof(short); - *length -= sizeof(short); - mask = 0xffff; - break; - default: - /* Error */ - case 32: - value = (long) * (long *) *pointer; - *pointer += sizeof(long); - *length -= sizeof(long); - mask = 0xffffffff; - break; +static const char * +Get_Window_Property_Data_And_Type (Atom atom, + long *length, Atom *type, int *size) +{ + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long nbytes; + unsigned long bytes_after; + unsigned char *prop; + int status; + + status = XGetWindowProperty(dpy, target_win, atom, 0, (max_len+3)/4, + False, AnyPropertyType, &actual_type, + &actual_format, &nitems, &bytes_after, + &prop); + if (status == BadWindow) + Fatal_Error("window id # 0x%lx does not exists!", target_win); + if (status != Success) + Fatal_Error("XGetWindowProperty failed!"); + + if (actual_format == 32) + nbytes = sizeof(long); + else if (actual_format == 16) + nbytes = sizeof(short); + else if (actual_format == 8) + nbytes = 1; + else + abort(); + *length = min(nitems * nbytes, max_len); + *type = actual_type; + *size = actual_format; + return (const char *)prop; +} + +static const char * +Get_Property_Data_And_Type (Atom atom, long *length, Atom *type, int *size) +{ + if (target_win == -1) + return Get_Font_Property_Data_And_Type(atom, length, type, size); + else + return Get_Window_Property_Data_And_Type(atom, length, type, size); +} + +static void +Show_Prop (const char *format, const char *dformat, const char *prop) +{ + const char *data; + long length; + Atom atom, type; + thunk *thunks; + int size, fsize; + + printf("%s", prop); + atom = Parse_Atom(prop, True); + if (atom == None) { + printf(": no such atom on any window.\n"); + return; + } + + data = Get_Property_Data_And_Type(atom, &length, &type, &size); + if (!size) { + puts(": not found."); + return; + } + + if (!notype && type != None) + printf("(%s)", Format_Atom(type)); + + Lookup_Formats(atom, &format, &dformat); + if (type != None) + Lookup_Formats(type, &format, &dformat); + Apply_Default_Formats(&format, &dformat); + + fsize = Get_Format_Size(format); + if (fsize != size && fsize != 0) { + printf(": Type mismatch: assumed size %d bits, actual size %d bits.\n", + fsize, size); + return; + } + + thunks = Break_Down_Property(data, (int)length, type, format, size); + + Display_Property(thunks, dformat, format); +} + +static void +Show_All_Props (void) +{ + Atom *atoms, atom; + const char *name; + int count, i; + + if (target_win != -1) { + atoms = XListProperties(dpy, target_win, &count); + for (i = 0; i < count; i++) { + name = Format_Atom(atoms[i]); + Show_Prop(NULL, NULL, name); } - if (!signedp) - value &= mask; - return(value); + } else + for (i = 0; i < font->n_properties; i++) { + atom = font->properties[i].name; + name = Format_Atom(atom); + Show_Prop(NULL, NULL, name); + } } -long Extract_Len_String(pointer, length, size, string) - char **pointer; - int *length; - int size; - char **string; +static thunk * +Handle_Prop_Requests (int argc, char **argv) { - int len; + char *format, *dformat, *prop; + thunk *thunks, t; - if (size!=8) - Fatal_Error("can't use format character 's' with any size except 8."); - len=0; *string = *pointer; - while ((len++, --*length, *((*pointer)++)) && *length>0); + thunks = Create_Thunk_List(); - return(len); + /* if no prop referenced, by default list all properties for given window */ + if (!argc) { + Show_All_Props(); + return NULL; + } + + while (argc > 0) { + format = NULL; + dformat = NULL; + + /* Get overriding formats, if any */ + if (Is_A_Format(argv[0])) { + format = argv++[0]; argc--; + if (!argc) usage(); + } + if (Is_A_DFormat(argv[0])) { + dformat = argv++[0]; argc--; + if (!argc) usage(); + } + + /* Get property name */ + prop = argv++[0]; argc--; + + t.propname = prop; + t.value = Parse_Atom(prop, True); + t.format = format; + t.dformat = dformat; + if (t.value) + thunks = Add_Thunk(thunks, t); + Show_Prop(format, dformat, prop); + } + return thunks; } -thunk *Break_Down_Property(pointer, length, format, size) - char *pointer, *format; - int length, size; +static void +Remove_Property (Display *dpy, Window w, const char *propname) { - thunk *thunks; - thunk t; - int i; - char format_char; + Atom id = XInternAtom (dpy, propname, True); - thunks = Create_Thunk_List(); - i=0; + if (id == None) { + fprintf (stderr, "%s: no such property \"%s\"\n", + program_name, propname); + return; + } + XDeleteProperty (dpy, w, id); +} - while (length>=(size/8)) { - format_char = Get_Format_Char(format, i); - if (format_char=='s') - t.value=Extract_Len_String(&pointer,&length,size,&t.extra_value); - else - t.value=Extract_Value(&pointer,&length,size,format_char=='i'); - thunks = Add_Thunk(thunks, t); - i++; - } +static void +Set_Property (Display *dpy, Window w, const char *propname, const char *value) +{ + Atom atom; + const char *format; + const char *dformat; + int size; + char format_char; + Atom type; + unsigned char *data; + int nelements; + + atom = Parse_Atom(propname, False); + + format = dformat = NULL; + Lookup_Formats(atom, &format, &dformat); + if (format == NULL) + Fatal_Error("unsupported conversion for %s", propname); + + size = Get_Format_Size(format); + + format_char = Get_Format_Char(format, 0); + switch (format_char) { + case 's': + if (size != 8) + Fatal_Error("can't use format character 's' with any size except 8."); + type = XA_STRING; + data = (unsigned char *) value; + nelements = strlen(value); + break; + case 't': { + XTextProperty textprop; + if (size != 8) + Fatal_Error("can't use format character 't' with any size except 8."); + if (XmbTextListToTextProperty(dpy, (char **) &value, 1, + XStdICCTextStyle, &textprop) != Success) { + fprintf(stderr, "cannot convert %s argument to STRING or COMPOUND_TEXT.\n", propname); + return; + } + type = textprop.encoding; + data = textprop.value; + nelements = textprop.nitems; + break; + } + case 'x': + case 'c': { + unsigned long intvalue = strtoul(value, NULL, 0); + static unsigned char data8; + static unsigned short data16; + static unsigned long data32; + type = XA_INTEGER; + switch (size) { + case 8: + data8 = intvalue; data = (unsigned char *) &data8; break; + case 16: + data16 = intvalue; data = (unsigned char *) &data16; break; + case 32: default: + data32 = intvalue; data = (unsigned char *) &data32; break; + } + nelements = 1; + break; + } + case 'i': { + long intvalue = strtol(value, NULL, 0); + static signed char data8; + static short data16; + static long data32; + type = XA_INTEGER; + switch (size) { + case 8: + data8 = intvalue; data = (unsigned char *) &data8; break; + case 16: + data16 = intvalue; data = (unsigned char *) &data16; break; + case 32: default: + data32 = intvalue; data = (unsigned char *) &data32; break; + } + nelements = 1; + break; + } + case 'b': { + unsigned long boolvalue; + static unsigned char data8; + static unsigned short data16; + static unsigned long data32; + if (!strcmp(value, "True")) + boolvalue = 1; + else if (!strcmp(value, "False")) + boolvalue = 0; + else { + fprintf(stderr, "cannot convert %s argument to Bool\n", propname); + return; + } + type = XA_INTEGER; + switch (size) { + case 8: + data8 = boolvalue; data = (unsigned char *) &data8; break; + case 16: + data16 = boolvalue; data = (unsigned char *) &data16; break; + case 32: default: + data32 = boolvalue; data = (unsigned char *) &data32; break; + } + nelements = 1; + break; + } + case 'a': { + static Atom avalue; + avalue = Parse_Atom(value, False); + type = XA_ATOM; + data = (unsigned char *) &avalue; + nelements = 1; + break; + } + case 'm': + /* NYI */ + default: + Fatal_Error("bad format character: %c", format_char); + } - return(thunks); + XChangeProperty(dpy, target_win, atom, type, size, PropModeReplace, + data, nelements); } /* @@ -1179,7 +1458,7 @@ */ void -usage() +usage (void) { char **cpp; static char *help_message[] = { @@ -1189,7 +1468,8 @@ " -id id resource id of window to examine", " -name name name of window to examine", " -font name name of font to examine", -" -remove propname name of property to remove", +" -remove propname remove a property", +" -set propname value set a property to a given value", " -root examine the root window", " -len n display at most n bytes of any property", " -notype do not display the type field", @@ -1200,7 +1480,8 @@ NULL}; fflush (stdout); - fprintf (stderr, "usage: %s [-options ...] [[format [dformat]] atom]\n\n", + fprintf (stderr, + "usage: %s [-options ...] [[format [dformat]] atom] ...\n\n", program_name); for (cpp = help_message; *cpp; cpp++) { fprintf (stderr, "%s\n", *cpp); @@ -1209,18 +1490,20 @@ exit (1); } -void -grammar () +static void +grammar (void) { - printf ("Grammar for xprop:\n\n"); - printf("\t%s [<disp>] [<select option>] <option>* <mapping>* <spec>*", - program_name); - printf("\n\n\tdisp ::= -display host:dpy\ + printf ("Grammar for xprop:\n\n"); + printf("\t%s [<disp>] [<select option>] <option>* <mapping>* <spec>*", + program_name); + printf("\n\n\tdisp ::= -display host:dpy\ \n\tselect option ::= -root | -id <id> | -font <font> | -name <name>\ \n\toption ::= -len <n> | -notype | -spy | {-formats|-fs} <format file>\ -\n\tmapping ::= {-f|-format} <atom> <format> [<dformat>] | -remove <propname>\ +\n\tmapping ::= {-f|-format} <atom> <format> [<dformat>]\ +\n\t | -remove <propname>\ +\n\t | -set <propname> <value>\ \n\tspec ::= [<format> [<dformat>]] <atom>\ -\n\tformat ::= {0|8|16|32}{a|b|c|i|m|s|x}*\ +\n\tformat ::= {0|8|16|32}{a|b|c|i|m|s|t|x}*\ \n\tdformat ::= <unit><unit>* (can't start with a letter or '-')\ \n\tunit ::= ?<exp>(<unit>*) | $<n> | <display char>\ \n\texp ::= <term> | <term>=<exp> | !<exp>\ @@ -1228,32 +1511,30 @@ \n\tdisplay char ::= <normal char> | \\<non digit char> | \\<octal number>\ \n\tnormal char ::= <any char except a digit, $, ?, \\, or )>\ \n\n"); - exit(0); + exit(0); } -void -Parse_Format_Mapping(argc, argv) - int *argc; - char ***argv; +static void +Parse_Format_Mapping (int *argc, char ***argv) +{ #define ARGC (*argc) #define ARGV (*argv) #define OPTION ARGV[0] #define NXTOPT if (++ARGV, --ARGC==0) usage() -{ - char *type_name, *format, *dformat; + char *type_name, *format, *dformat; - NXTOPT; type_name = OPTION; + NXTOPT; type_name = OPTION; - NXTOPT; format = OPTION; - if (!Is_A_Format(format)) - Fatal_Error("Bad format: %s.", format); - - dformat=0; - if (ARGC>0 && Is_A_DFormat(ARGV[1])) { - ARGV++; ARGC--; dformat=OPTION; - } + NXTOPT; format = OPTION; + if (!Is_A_Format(format)) + Fatal_Error("Bad format: %s.", format); + + dformat = NULL; + if (ARGC>0 && Is_A_DFormat(ARGV[1])) { + ARGV++; ARGC--; dformat = OPTION; + } - Add_Mapping( Parse_Atom(type_name, False), format, dformat); + Add_Mapping(Parse_Atom(type_name, False), format, dformat); } /* @@ -1262,352 +1543,177 @@ * */ -Window target_win=0; -int notype=0; -int spy=0; -int max_len=MAXSTR; -XFontStruct *font; +static int spy = 0; int -main(argc, argv) -int argc; -char **argv; -{ - FILE *stream; - char *name; - thunk *props; - char *remove_propname = NULL; - Bool frame_only = False; - int n; - char **nargv; - - INIT_NAME; - - /* Handle display name, opening the display */ - Setup_Display_And_Screen(&argc, argv); - - /* Handle selecting the window to display properties for */ - target_win = Select_Window_Args(&argc, argv); - - /* Set up default atom to format, dformat mapping */ - XpropMode = XpropWindowProperties; - for (n=argc, nargv=argv; n; nargv++, n--) - if (! strcmp(nargv[0], "-font")) { - XpropMode = XpropFontProperties; - break; - } - Setup_Mapping(); - if ((name = getenv("XPROPFORMATS"))) { - if (!(stream=fopen(name, "r"))) +main (int argc, char **argv) +{ + FILE *stream; + char *name; + thunk *props; + thunk *remove_props = NULL; + thunk *set_props = NULL; + Bool frame_only = False; + int n; + char **nargv; + + INIT_NAME; + + /* Set locale for XmbTextProptertyToTextList and iswprint(). */ + setlocale(LC_CTYPE, ""); + + /* Handle display name, opening the display */ + Setup_Display_And_Screen(&argc, argv); + + /* Handle selecting the window to display properties for */ + target_win = Select_Window_Args(&argc, argv); + + /* Set up default atom to format, dformat mapping */ + XpropMode = XpropWindowProperties; + for (n = argc, nargv = argv; n; nargv++, n--) + if (! strcmp(nargv[0], "-font")) { + XpropMode = XpropFontProperties; + break; + } + Setup_Mapping(); + if ((name = getenv("XPROPFORMATS"))) { + if (!(stream = fopen(name, "r"))) Fatal_Error("unable to open file %s for reading.", name); - Read_Mappings(stream); - fclose(stream); - } - - /* Handle '-' options to setup xprop, select window to work on */ - while (argv++, --argc>0 && **argv=='-') { - if (!strcmp(argv[0], "-")) - continue; - if (!strcmp(argv[0], "-grammar")) { - grammar (); - /* NOTREACHED */ - } - if (!strcmp(argv[0], "-notype")) { - notype=1; - continue; + Read_Mappings(stream); + fclose(stream); } - if (!strcmp(argv[0], "-spy")) { - spy=1; + + /* Handle '-' options to setup xprop, select window to work on */ + while (argv++, --argc>0 && **argv == '-') { + if (!strcmp(argv[0], "-")) continue; - } - if (!strcmp(argv[0], "-len")) { - if (++argv, --argc==0) usage(); + if (!strcmp(argv[0], "-grammar")) { + grammar (); + /* NOTREACHED */ + } + if (!strcmp(argv[0], "-notype")) { + notype = 1; + continue; + } + if (!strcmp(argv[0], "-spy")) { + spy = 1; + continue; + } + if (!strcmp(argv[0], "-len")) { + if (++argv, --argc == 0) usage(); max_len = atoi(argv[0]); continue; - } - if (!strcmp(argv[0], "-formats") || !strcmp(argv[0], "-fs")) { - if (++argv, --argc==0) usage(); - if (!(stream=fopen(argv[0], "r"))) - Fatal_Error("unable to open file %s for reading.", argv[0]); + } + if (!strcmp(argv[0], "-formats") || !strcmp(argv[0], "-fs")) { + if (++argv, --argc == 0) usage(); + if (!(stream = fopen(argv[0], "r"))) + Fatal_Error("unable to open file %s for reading.", argv[0]); Read_Mappings(stream); fclose(stream); continue; - } - if (!strcmp(argv[0], "-font")) { - if (++argv, --argc==0) usage(); + } + if (!strcmp(argv[0], "-font")) { + if (++argv, --argc == 0) usage(); font = Open_Font(argv[0]); target_win = -1; continue; - } - if (!strcmp(argv[0], "-remove")) { - if (++argv, --argc==0) usage(); - remove_propname = argv[0]; + } + if (!strcmp(argv[0], "-remove")) { + thunk t; + if (++argv, --argc == 0) usage(); + t.propname = argv[0]; + if (remove_props == NULL) remove_props = Create_Thunk_List(); + remove_props = Add_Thunk(remove_props, t); continue; - } - if (!strcmp(argv[0], "-frame")) { + } + if (!strcmp(argv[0], "-set")) { + thunk t; + if (argc < 3) usage(); + t.propname = argv[1]; + t.extra_value = argv[2]; + argv += 3; argc -= 3; + if (set_props == NULL) set_props = Create_Thunk_List(); + set_props = Add_Thunk(set_props, t); + continue; + } + if (!strcmp(argv[0], "-frame")) { frame_only = True; continue; + } + if (!strcmp(argv[0], "-f") || !strcmp(argv[0], "-format")) { + Parse_Format_Mapping(&argc, &argv); + continue; + } + usage(); } - if (!strcmp(argv[0], "-f") || !strcmp(argv[0], "-format")) { - Parse_Format_Mapping(&argc, &argv); - continue; - } - usage(); - } - - if (target_win == None) { - target_win = Select_Window(dpy); - if (target_win != None && !frame_only) { - Window root; - int dummyi; - unsigned int dummy; - - if (XGetGeometry (dpy, target_win, &root, &dummyi, &dummyi, - &dummy, &dummy, &dummy, &dummy) && - target_win != root) - target_win = XmuClientWindow (dpy, target_win); - } - } - - if (remove_propname) { - remove_property (dpy, target_win, remove_propname); - XCloseDisplay (dpy); - exit (0); - } - - props=Handle_Prop_Requests(argc, argv); - - if (spy && target_win != -1) { - XEvent event; - char *format, *dformat; - - XSelectInput(dpy, target_win, PropertyChangeMask); - for (;;) { - XNextEvent(dpy, &event); - format = dformat = NULL; - if (props) { - int i; - for (i=0; i<props->thunk_count; i++) - if (props[i].value == event.xproperty.atom) - break; - if (i>=props->thunk_count) - continue; - format = props[i].format; - dformat = props[i].dformat; - } - Show_Prop(format, dformat, Format_Atom(event.xproperty.atom)); - } - } - exit (0); -} - -/* - * - * Other Stuff (temp.): - * - */ -void -remove_property (dpy, w, propname) - Display *dpy; - Window w; - char *propname; -{ - Atom id = XInternAtom (dpy, propname, True); + if ((remove_props != NULL || set_props != NULL) && argc > 0) + usage(); - if (id == None) { - fprintf (stderr, "%s: no such property \"%s\"\n", - program_name, propname); - return; + if (target_win == None) { + target_win = Select_Window(dpy); + if (target_win != None && !frame_only) { + Window root; + int dummyi; + unsigned int dummy; + + if (XGetGeometry (dpy, target_win, &root, &dummyi, &dummyi, + &dummy, &dummy, &dummy, &dummy) + && target_win != root) + target_win = XmuClientWindow (dpy, target_win); + } } - XDeleteProperty (dpy, w, id); - return; -} - -thunk *Handle_Prop_Requests(argc, argv) - int argc; - char **argv; -{ - char *format, *dformat, *prop; - thunk *thunks, t; - - thunks = Create_Thunk_List(); - /* if no prop referenced, by default list all properties for given window */ - if (!argc) { - Show_All_Props(); - return(NULL); - } + if (remove_props != NULL) { + int count; - while (argc>0) { - format = 0; - dformat = 0; + if (target_win == -1) + Fatal_Error("-remove works only on windows, not fonts"); - /* Get overriding formats, if any */ - if (Is_A_Format(argv[0])) { - format = argv++[0]; argc--; - if (!argc) usage(); + count = remove_props->thunk_count; + for (; count > 0; remove_props++, count--) + Remove_Property (dpy, target_win, remove_props->propname); } - if (Is_A_DFormat(argv[0])) { - dformat = argv++[0]; argc--; - if (!argc) usage(); - } - /* Get property name */ - prop = argv++[0]; argc--; + if (set_props != NULL) { + int count; - t.value = Parse_Atom(prop, True); - t.format = format; - t.dformat = dformat; - if (t.value) - thunks = Add_Thunk(thunks, t); - Show_Prop(format, dformat, prop); - } - return(thunks); -} + if (target_win == -1) + Fatal_Error("-set works only on windows, not fonts"); -void -Show_All_Props() -{ - Atom *atoms, atom; - char *name; - int count, i; - - if (target_win!=-1) { - atoms = XListProperties(dpy, target_win, &count); - for (i=0; i<count; i++) { - name = Format_Atom(atoms[i]); - Show_Prop(0, 0, name); - } - } else - for (i=0; i<font->n_properties; i++) { - atom = font->properties[i].name; - name = Format_Atom(atom); - Show_Prop(0, 0, name); + count = set_props->thunk_count; + for (; count > 0; set_props++, count--) + Set_Property (dpy, target_win, set_props->propname, + set_props->extra_value); } -} -#if NeedFunctionPrototypes -void -Set_Prop(char *format, char *dformat, char *prop, char mode, char *value) -#else -void -Set_Prop(format, dformat, prop, mode, value) - char *format, *dformat, *prop, *value; - char mode; -#endif -{ - outl("Seting prop %s(%s) using %s mode %c to %s", - prop, format, dformat, mode, value); -} + if (remove_props != NULL || set_props != NULL) { + XCloseDisplay (dpy); + exit (0); + } -static unsigned long _font_prop; + props = Handle_Prop_Requests(argc, argv); -char *Get_Font_Property_Data_And_Type(atom, length, type, size) - Atom atom; - long *length; - Atom *type; - int *size; -{ - int i; - - *type = 0; - - for (i=0; i<font->n_properties; i++) - if (atom==font->properties[i].name) { - _font_prop=font->properties[i].card32; - *length=sizeof(long); - *size=32; - return((char *) &_font_prop); - } - return(0); -} - -char *Get_Window_Property_Data_And_Type(atom, length, type, size) - Atom atom; - long *length; - Atom *type; - int *size; -{ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long nbytes; - unsigned long bytes_after; - unsigned char *prop; - int status; - - status = XGetWindowProperty(dpy, target_win, atom, 0, (max_len+3)/4, - False, AnyPropertyType, &actual_type, - &actual_format, &nitems, &bytes_after, - &prop); - if (status==BadWindow) - Fatal_Error("window id # 0x%lx does not exists!", target_win); - if (status!=Success) - Fatal_Error("XGetWindowProperty failed!"); + if (spy && target_win != -1) { + XEvent event; + const char *format, *dformat; - if (actual_format == 32) - nbytes = sizeof(long); - else if (actual_format == 16) - nbytes = sizeof(short); - else - nbytes = 1; - *length = min(nitems * nbytes, max_len); - *type = actual_type; - *size = actual_format; - return((char *)prop); -} - -char *Get_Property_Data_And_Type(atom, length, type, size) - Atom atom; - long *length; - Atom *type; - int *size; -{ - if (target_win == -1) - return(Get_Font_Property_Data_And_Type(atom, length, type, size)); - else - return(Get_Window_Property_Data_And_Type(atom, length, type, size)); -} - -void -Show_Prop(format, dformat, prop) - char *format, *dformat, *prop; -{ - char *data; - long length; - Atom atom, type; - thunk *thunks; - int size, fsize; - - printf("%s", prop); - if (!(atom = Parse_Atom(prop, True))) { - printf(": no such atom on any window.\n"); - return; - } - - data = Get_Property_Data_And_Type(atom, &length, &type, &size); - if (!size) { - puts(": not found."); - return; - } - - if (!notype && type) - printf("(%s)", Format_Atom(type)); - - Lookup_Formats(atom, &format, &dformat); - if (type) - Lookup_Formats(type, &format, &dformat); - Apply_Default_Formats(&format, &dformat); - - fsize=Get_Format_Size(format); - if (fsize!=size && fsize!=0) { - printf(": Type mismatch: assumed size %d bits, actual size %d bits.\n", - fsize, size); - return; - } - - thunks = Break_Down_Property(data, (int)length, format, size); - - Display_Property(thunks, dformat, format); + XSelectInput(dpy, target_win, PropertyChangeMask); + for (;;) { + XNextEvent(dpy, &event); + format = dformat = NULL; + if (props) { + int i; + for (i = 0; i < props->thunk_count; i++) + if (props[i].value == event.xproperty.atom) + break; + if (i >= props->thunk_count) + continue; + format = props[i].format; + dformat = props[i].dformat; + } + Show_Prop(format, dformat, Format_Atom(event.xproperty.atom)); + } + } + exit (0); } Index: xc/programs/xprop/xprop.man diff -u xc/programs/xprop/xprop.man:1.4 xc/programs/xprop/xprop.man:1.8 --- xc/programs/xprop/xprop.man:1.4 Sun Oct 4 05:41:44 1998 +++ xc/programs/xprop/xprop.man Sat Jan 27 13:21:21 2001 @@ -1,5 +1,6 @@ -.\" $TOG: xprop.man /main/22 1998/02/09 14:12:06 kaleb $ +.\" $Xorg: xprop.man,v 1.3 2000/08/17 19:54:55 cpqbld Exp $ .\" Copyright 1988, 1998 The Open Group +.\" Copyright \(co 2000 The XFree86 Project, Inc. .\" .\" All Rights Reserved. .\" @@ -18,7 +19,10 @@ .\" 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. -.TH XPROP 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xprop/xprop.man,v 1.8 2001/01/27 18:21:21 dawes Exp $ +.\" +.TH XPROP 1 __vendorversion__ .SH NAME xprop - property displayer for X .SH SYNOPSIS @@ -29,6 +33,7 @@ [-display \fIdisplay\fP] [-len \fIn\fP] [-notype] [-fs \fIfile\fP] [-remove \fIproperty-name\fP] +[-set \fIproperty-name\fP \fIvalue\fP] [-spy] [-f \fIatom\fP \fIformat\fP [\fIdformat\fP]]* [\fIformat\fP [\fIdformat\fP] \fIatom\fP]* @@ -79,7 +84,7 @@ .TP 8 .B "-display \fIdisplay\fP" This argument allows you to specify the server to connect to; -see \fIX(1)\fP. +see \fIX(__miscmansuffix__)\fP. .PP .TP 8 .B "-len \fIn\fP" @@ -106,6 +111,11 @@ Specifies the name of a property to be removed from the indicated window. .PP .TP 8 +.B "-set \fIproperty-name\fP \fIvalue\fP" +Specifies the name of a property and a property value, to be set on the +indicated window. +.PP +.TP 8 .B "-spy" Examine window properties forever, looking for property change events. .PP @@ -170,7 +180,7 @@ field there are in the property. Zero is a special case meaning use the field size information associated with the property itself. (This is only needed for special cases like type INTEGER which is actually three different -types depending on the size of the fields of the property) +types depending on the size of the fields of the property.) .PP A value of 8 means that the property is a sequence of bytes while a value of 16 would mean that @@ -207,6 +217,13 @@ represent a sequence of bytes. This format character is only usable with a field size of 8 and is most often used to represent a string. .TP +t +This field and the next ones until either a 0 or the end of the property +represent an internationalized text string. This format character is only +usable with a field size of 8. The string is assumed to be in an ICCCM +compliant encoding and is converted to the current locale encoding before +being output. +.TP x The field is a hex number (like 'c' but displayed in hex - most useful for displaying window ids and the like) @@ -318,6 +335,6 @@ Specifies the name of a file from which additional formats are to be obtained. .PP .SH SEE ALSO -X(1), xwininfo(1) +X(__miscmansuffix__), xwininfo(1) .SH AUTHOR Mark Lillibridge, MIT Project Athena Index: xc/programs/xrdb/Imakefile diff -u xc/programs/xrdb/Imakefile:3.2 xc/programs/xrdb/Imakefile:3.4 --- xc/programs/xrdb/Imakefile:3.2 Tue Sep 30 00:51:05 1997 +++ xc/programs/xrdb/Imakefile Thu Mar 29 21:15:26 2001 @@ -1,5 +1,10 @@ -XCOMM $XConsortium: Imakefile,v 1.8 92/09/14 18:53:12 rws Exp $ -XCOMM $XFree86: xc/programs/xrdb/Imakefile,v 3.2 1997/09/30 04:51:05 hohndel Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:56 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xrdb/Imakefile,v 3.4 2001/03/30 02:15:26 keithp Exp $ + #if PatheticCpp CPPDEFS = -DPATHETICCPP #endif @@ -12,7 +17,7 @@ #else DEFINES = -DCPP="\"$(CPP)\"" $(CPPDEFS) #endif - DEPLIBS = $(DEPXMULIB) $(DEPXLIB) -LOCAL_LIBRARIES = $(XMULIB) $(XLIB) + DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XMUULIB) $(XLIB) SimpleProgramTarget(xrdb) Index: xc/programs/xrdb/xrdb.c diff -u xc/programs/xrdb/xrdb.c:3.12 xc/programs/xrdb/xrdb.c:3.13 --- xc/programs/xrdb/xrdb.c:3.12 Thu Mar 11 21:36:27 1999 +++ xc/programs/xrdb/xrdb.c Wed Jan 17 18:46:22 2001 @@ -1,8 +1,7 @@ /* * xrdb - X resource manager database utility * - * $XConsortium: xrdb.c,v 11.76 95/05/12 18:36:46 mor Exp $ - * $XFree86: xc/programs/xrdb/xrdb.c,v 3.12 1999/03/12 02:36:27 dawes Exp $ + * $Xorg: xrdb.c,v 1.6 2000/08/17 19:54:56 cpqbld Exp $ */ /* @@ -31,6 +30,7 @@ * used in advertising or publicity pertaining to distribution of the software * without specific, written prior permission. */ +/* $XFree86: xc/programs/xrdb/xrdb.c,v 3.13 2001/01/17 23:46:22 dawes Exp $ */ /* * this program is used to load, or dump the resource manager database @@ -57,7 +57,7 @@ char *realloc(); #endif -#if defined(X_NOT_STDC_ENV) +#if defined(X_NOT_STDC_ENV) && !defined(__EMX__) extern int errno; #endif Index: xc/programs/xrdb/xrdb.man diff -u xc/programs/xrdb/xrdb.man:1.4 xc/programs/xrdb/xrdb.man:1.7 --- xc/programs/xrdb/xrdb.man:1.4 Sun Oct 4 05:41:45 1998 +++ xc/programs/xrdb/xrdb.man Sat Jan 27 13:21:22 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xrdb.man /main/42 1998/02/09 14:12:17 kaleb $ +.\" $Xorg: xrdb.man,v 1.3 2000/08/17 19:54:56 cpqbld Exp $ .\" Copyright 1991, Digital Equipment Corporation. .\" Copyright 1991, 1994, 1998 The Open Group .\" @@ -19,7 +19,10 @@ .\" 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. -.TH XRDB 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xrdb/xrdb.man,v 1.7 2001/01/27 18:21:22 dawes Exp $ +.\" +.TH XRDB 1 __xorgversion__ .SH NAME xrdb - X server resource database utility .SH SYNOPSIS @@ -165,7 +168,7 @@ the allowable options and parameters to be printed. .TP 8 .B \-display \fIdisplay\fP -This option specifies the X server to be used; see \fIX(1)\fP. +This option specifies the X server to be used; see \fIX(__miscmansuffix__)\fP. It also specifies the screen to use for the \fI-screen\fP option, and it specifies the screen from which preprocessor symbols are derived for the \fI-global\fP option. @@ -284,7 +287,7 @@ .SH FILES Generalizes \fI~/.Xdefaults\fP files. .SH "SEE ALSO" -X(1), Xlib Resource Manager documentation, Xt resource documentation +X(__miscmansuffix__), Xlib Resource Manager documentation, Xt resource documentation .SH ENVIRONMENT .TP 8 .B DISPLAY Index: xc/programs/xrefresh/Imakefile diff -u xc/programs/xrefresh/Imakefile:1.1.1.1 xc/programs/xrefresh/Imakefile:1.1.1.2 --- xc/programs/xrefresh/Imakefile:1.1.1.1 Wed Apr 27 03:13:16 1994 +++ xc/programs/xrefresh/Imakefile Tue Jan 16 18:02:11 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile,v 1.6 91/07/17 16:07:01 gildea Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:56 cpqbld Exp $ DEPLIBS = $(DEPXLIB) LOCAL_LIBRARIES = $(XLIB) Index: xc/programs/xrefresh/xrefresh.c diff -u xc/programs/xrefresh/xrefresh.c:3.3 xc/programs/xrefresh/xrefresh.c:3.4 --- xc/programs/xrefresh/xrefresh.c:3.3 Sun Mar 7 06:41:18 1999 +++ xc/programs/xrefresh/xrefresh.c Wed Jan 17 18:46:22 2001 @@ -42,12 +42,12 @@ ******************************************************************/ /* - * $TOG: xrefresh.c /main/15 1998/02/09 14:12:23 kaleb $ + * $Xorg: xrefresh.c,v 1.3 2000/08/17 19:54:56 cpqbld Exp $ * * Kitchen sink version, useful for clearing small areas and flashing the * screen. */ -/* $XFree86: xc/programs/xrefresh/xrefresh.c,v 3.3 1999/03/07 11:41:18 dawes Exp $ */ +/* $XFree86: xc/programs/xrefresh/xrefresh.c,v 3.4 2001/01/17 23:46:22 dawes Exp $ */ #include <stdio.h> #include <errno.h> Index: xc/programs/xrefresh/xrefresh.man diff -u xc/programs/xrefresh/xrefresh.man:1.4 xc/programs/xrefresh/xrefresh.man:1.7 --- xc/programs/xrefresh/xrefresh.man:1.4 Sun Oct 4 05:41:45 1998 +++ xc/programs/xrefresh/xrefresh.man Sat Jan 27 13:21:22 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xrefresh.man /main/19 1998/02/09 14:12:27 kaleb $ +.\" $Xorg: xrefresh.man,v 1.3 2000/08/17 19:54:56 cpqbld Exp $ .\" Copyright 1988, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XREFRESH 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xrefresh/xrefresh.man,v 1.7 2001/01/27 18:21:22 dawes Exp $ +.\" +.TH XREFRESH 1 __xorgversion__ .SH NAME xrefresh - refresh all or part of an X screen .SH SYNOPSIS @@ -64,12 +67,12 @@ .PP .TP 10 .B \-geometry \fIWxH+X+Y\fP -Specifies the portion of the screen to be repainted; see \fIX(1)\fP. +Specifies the portion of the screen to be repainted; see \fIX(__miscmansuffix__)\fP. .PP .TP 10 .B \-display \fIdisplay\fP This argument allows you to specify the server and screen to -refresh; see \fIX(1)\fP. +refresh; see \fIX(__miscmansuffix__)\fP. .SH X DEFAULTS The .I xrefresh @@ -89,7 +92,7 @@ .TP 8 DISPLAY - To get default host and display number. .SH SEE ALSO -X(1) +X(__miscmansuffix__) .SH BUGS .PP It should have just one default type for the background. Index: xc/programs/xrx/Imakefile diff -u xc/programs/xrx/Imakefile:1.4 xc/programs/xrx/Imakefile:1.5 --- xc/programs/xrx/Imakefile:1.4 Sun Oct 4 05:41:46 1998 +++ xc/programs/xrx/Imakefile Wed Jan 17 18:46:23 2001 @@ -1,4 +1,4 @@ -XCOMM $TOG: Imakefile /main/10 1998/02/26 17:08:56 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:56 cpqbld Exp $ #define IHaveSubdirs #define PassCDebugFlags CDEBUGFLAGS="$(CDEBUGFLAGS)" Index: xc/programs/xrx/cgi-bin/Imakefile diff -u xc/programs/xrx/cgi-bin/Imakefile:1.3 xc/programs/xrx/cgi-bin/Imakefile:1.4 --- xc/programs/xrx/cgi-bin/Imakefile:1.3 Sun Nov 16 01:43:05 1997 +++ xc/programs/xrx/cgi-bin/Imakefile Wed Jan 17 18:46:23 2001 @@ -1,4 +1,4 @@ -XCOMM $TOG: Imakefile /main/12 1997/07/15 15:31:02 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:56 cpqbld Exp $ #ifndef CgiBinDir #define CgiBinDir /files/web/cgi-bin Index: xc/programs/xrx/cgi-bin/bitmap diff -u xc/programs/xrx/cgi-bin/bitmap:1.1.1.2 xc/programs/xrx/cgi-bin/bitmap:1.1.1.3 --- xc/programs/xrx/cgi-bin/bitmap:1.1.1.2 Sat Jul 5 08:50:01 1997 +++ xc/programs/xrx/cgi-bin/bitmap Tue Jan 16 18:02:18 2001 @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -# $TOG: bitmap /main/7 1997/06/13 14:31:42 kaleb $ +# $Xorg: bitmap,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ # CGI script to launch xclock # Index: xc/programs/xrx/cgi-bin/dtcm diff -u xc/programs/xrx/cgi-bin/dtcm:1.1.1.2 xc/programs/xrx/cgi-bin/dtcm:1.1.1.3 --- xc/programs/xrx/cgi-bin/dtcm:1.1.1.2 Sat Jul 5 08:50:01 1997 +++ xc/programs/xrx/cgi-bin/dtcm Tue Jan 16 18:02:19 2001 @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -# $TOG: dtcm /main/15 1997/06/13 14:31:52 kaleb $ +# $Xorg: dtcm,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ # CGI script to launch dtcm # Index: xc/programs/xrx/cgi-bin/dtcm.sh diff -u xc/programs/xrx/cgi-bin/dtcm.sh:1.1.1.1 xc/programs/xrx/cgi-bin/dtcm.sh:1.1.1.2 --- xc/programs/xrx/cgi-bin/dtcm.sh:1.1.1.1 Sat Dec 21 23:16:39 1996 +++ xc/programs/xrx/cgi-bin/dtcm.sh Tue Jan 16 18:02:20 2001 @@ -1,5 +1,5 @@ #! /bin/csh -f -#$XConsortium: dtcm.sh /main/2 1996/10/08 09:25:12 kaleb $ +#$Xorg: dtcm.sh,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ setenv SHELL /bin/csh setenv _RLD_ROOT /dev/null setenv LD_LIBRARY_PATH /tools/packages/cde/alpha/osf1/cde_cst8/dt/lib:/tools/packages/cde/alpha/osf1/cde_cst8/x11/lib:/usr/shlib:/usr/ccs/lib:/usr/lib/cmplrs/cxx:/usr/lib/cmplrs/cc:/usr/lib:/usr/local/lib:/var/shlib Index: xc/programs/xrx/cgi-bin/excel diff -u xc/programs/xrx/cgi-bin/excel:1.1.1.2 xc/programs/xrx/cgi-bin/excel:1.1.1.3 --- xc/programs/xrx/cgi-bin/excel:1.1.1.2 Sat Jul 5 08:50:03 1997 +++ xc/programs/xrx/cgi-bin/excel Tue Jan 16 18:02:22 2001 @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -# $TOG: excel /main/4 1997/06/13 14:31:58 kaleb $ +# $Xorg: excel,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ # CGI script to launch excel # Index: xc/programs/xrx/cgi-bin/xclock diff -u xc/programs/xrx/cgi-bin/xclock:1.1.1.2 xc/programs/xrx/cgi-bin/xclock:1.1.1.3 --- xc/programs/xrx/cgi-bin/xclock:1.1.1.2 Sat Jul 5 08:50:02 1997 +++ xc/programs/xrx/cgi-bin/xclock Tue Jan 16 18:02:24 2001 @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -# $TOG: xclock /main/7 1997/06/13 14:32:02 kaleb $ +# $Xorg: xclock,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ # CGI script to launch xclock # Index: xc/programs/xrx/cgi-bin/xload diff -u xc/programs/xrx/cgi-bin/xload:1.1.1.2 xc/programs/xrx/cgi-bin/xload:1.1.1.3 --- xc/programs/xrx/cgi-bin/xload:1.1.1.2 Sat Jul 5 08:50:02 1997 +++ xc/programs/xrx/cgi-bin/xload Tue Jan 16 18:02:26 2001 @@ -1,5 +1,5 @@ #!/usr/local/bin/perl -# $TOG: xload /main/13 1997/06/13 14:32:05 kaleb $ +# $Xorg: xload,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ # CGI script to launch xload # Index: xc/programs/xrx/helper/GetUrl.c diff -u xc/programs/xrx/helper/GetUrl.c:1.1.1.2 xc/programs/xrx/helper/GetUrl.c:1.1.1.3 --- xc/programs/xrx/helper/GetUrl.c:1.1.1.2 Sun Sep 27 04:59:41 1998 +++ xc/programs/xrx/helper/GetUrl.c Tue Jan 16 18:02:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: GetUrl.c /main/4 1998/02/10 18:29:29 kaleb $ */ +/* $Xorg: GetUrl.c,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/helper/GetUrl.h diff -u xc/programs/xrx/helper/GetUrl.h:1.1.1.2 xc/programs/xrx/helper/GetUrl.h:1.1.1.3 --- xc/programs/xrx/helper/GetUrl.h:1.1.1.2 Sun Sep 27 04:59:42 1998 +++ xc/programs/xrx/helper/GetUrl.h Tue Jan 16 18:02:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: GetUrl.h /main/2 1998/02/10 18:29:37 kaleb $ */ +/* $Xorg: GetUrl.h,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/helper/Imakefile diff -u xc/programs/xrx/helper/Imakefile:1.1.1.1 xc/programs/xrx/helper/Imakefile:1.2 --- xc/programs/xrx/helper/Imakefile:1.1.1.1 Sat Dec 21 23:16:40 1996 +++ xc/programs/xrx/helper/Imakefile Mon Apr 23 12:17:13 2001 @@ -1,4 +1,10 @@ -XCOMM $XConsortium: Imakefile /main/6 1996/12/12 15:55:57 lehors $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xrx/helper/Imakefile,v 1.2 2001/04/23 16:17:13 tsi Exp $ + XCOMM Define UseWWW in order to use the www program to perform the GET request XCOMM #define UseWWW YES @@ -19,7 +25,7 @@ # if HasBSD44Sockets SOCK_DEFINES = -DBSD44SOCKETS # endif - DEPEND_DEFINES = $(TRANS_DEFINES) $(CONN_DEFINES) + DEPEND_DEFINES = $(TRANS_DEFINES) $(CONN_DEFINES) DependDefines DEFINES = StrcasecmpDefines \ $(CONN_DEFINES) $(SOCK_DEFINES) $(TRANS_DEFINES) $(POLL_DEFINES) Index: xc/programs/xrx/helper/helper.c diff -u xc/programs/xrx/helper/helper.c:1.3 xc/programs/xrx/helper/helper.c:1.4 --- xc/programs/xrx/helper/helper.c:1.3 Sun Oct 4 05:41:46 1998 +++ xc/programs/xrx/helper/helper.c Wed Jan 17 18:46:23 2001 @@ -1,4 +1,4 @@ -/* $TOG: helper.c /main/19 1998/02/25 13:59:56 barstow $ */ +/* $Xorg: helper.c,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/helper/httptran.c diff -u xc/programs/xrx/helper/httptran.c:1.3 xc/programs/xrx/helper/httptran.c:1.4 --- xc/programs/xrx/helper/httptran.c:1.3 Sun Oct 4 05:41:47 1998 +++ xc/programs/xrx/helper/httptran.c Wed Jan 17 18:46:23 2001 @@ -1,4 +1,4 @@ -/* $TOG: httptran.c /main/2 1998/02/10 18:29:50 kaleb $ */ +/* $Xorg: httptran.c,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -23,7 +23,7 @@ */ -/* $XFree86: xc/programs/xrx/helper/httptran.c,v 1.3 1998/10/04 09:41:47 dawes Exp $ */ +/* $XFree86: xc/programs/xrx/helper/httptran.c,v 1.4 2001/01/17 23:46:23 dawes Exp $ */ #if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) #define TRANS(func) _HttpTrans##func Index: xc/programs/xrx/helper/xrx.man diff -u xc/programs/xrx/helper/xrx.man:1.4 xc/programs/xrx/helper/xrx.man:1.6 --- xc/programs/xrx/helper/xrx.man:1.4 Sun Oct 4 05:41:47 1998 +++ xc/programs/xrx/helper/xrx.man Sat Jan 27 13:21:22 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xrx.man /main/6 1998/02/10 18:30:01 kaleb $ +.\" $Xorg: xrx.man,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ .\" Copyright 1996, 1998 The Open Group .\" .\" All Rights Reserved. @@ -19,7 +19,10 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.TH XRX 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xrx/helper/xrx.man,v 1.6 2001/01/27 18:21:22 dawes Exp $ +.\" +.TH XRX 1 __xorgversion__ .SH NAME xrx - RX helper program .SH SYNOPSIS Index: xc/programs/xrx/htdocs/Imakefile diff -u xc/programs/xrx/htdocs/Imakefile:1.2 xc/programs/xrx/htdocs/Imakefile:1.3 --- xc/programs/xrx/htdocs/Imakefile:1.2 Wed Jun 11 08:24:56 1997 +++ xc/programs/xrx/htdocs/Imakefile Wed Jan 17 18:46:24 2001 @@ -1,4 +1,4 @@ -XCOMM $TOG: Imakefile /main/7 1997/06/06 10:35:09 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:57 cpqbld Exp $ #ifndef HtmlDir #define HtmlDir /files/web/xfiles/consortium/plug-in Index: xc/programs/xrx/htdocs/bitmap diff -u xc/programs/xrx/htdocs/bitmap:1.1.1.1 xc/programs/xrx/htdocs/bitmap:1.1.1.2 --- xc/programs/xrx/htdocs/bitmap:1.1.1.1 Sat Dec 21 23:16:41 1996 +++ xc/programs/xrx/htdocs/bitmap Tue Jan 16 18:02:44 2001 @@ -1,4 +1,4 @@ -<!-- $XConsortium: bitmap /main/2 1996/10/22 14:45:05 lehors $ --> +<!-- $Xorg: bitmap,v 1.3 2000/08/17 19:54:58 cpqbld Exp $ --> <PARAM Name=VERSION Value=1.0> <PARAM Name=REQUIRED-SERVICES Value=UI> <PARAM Name=UI Value=X> Index: xc/programs/xrx/htdocs/bitmap.html diff -u xc/programs/xrx/htdocs/bitmap.html:1.1.1.1 xc/programs/xrx/htdocs/bitmap.html:1.1.1.2 --- xc/programs/xrx/htdocs/bitmap.html:1.1.1.1 Sat Dec 21 23:16:40 1996 +++ xc/programs/xrx/htdocs/bitmap.html Tue Jan 16 18:02:46 2001 @@ -1,4 +1,4 @@ -<!--$XConsortium: bitmap.html /main/2 1996/10/08 15:07:22 kaleb $--> +<!--$Xorg: bitmap.html,v 1.3 2000/08/17 19:54:58 cpqbld Exp $--> <html> <head> <title>X Applications on the Web - bitmap demo page. Index: xc/programs/xrx/htdocs/dtcm diff -u xc/programs/xrx/htdocs/dtcm:1.1.1.1 xc/programs/xrx/htdocs/dtcm:1.1.1.2 --- xc/programs/xrx/htdocs/dtcm:1.1.1.1 Sat Dec 21 23:16:41 1996 +++ xc/programs/xrx/htdocs/dtcm Tue Jan 16 18:02:47 2001 @@ -1,4 +1,4 @@ - + Index: xc/programs/xrx/htdocs/dtcm.html diff -u xc/programs/xrx/htdocs/dtcm.html:1.1.1.1 xc/programs/xrx/htdocs/dtcm.html:1.1.1.2 --- xc/programs/xrx/htdocs/dtcm.html:1.1.1.1 Sat Dec 21 23:16:40 1996 +++ xc/programs/xrx/htdocs/dtcm.html Tue Jan 16 18:02:48 2001 @@ -1,4 +1,4 @@ - + X Applications on the Web - Demo page. Index: xc/programs/xrx/htdocs/excel diff -u xc/programs/xrx/htdocs/excel:1.1.1.1 xc/programs/xrx/htdocs/excel:1.1.1.2 --- xc/programs/xrx/htdocs/excel:1.1.1.1 Sat Dec 21 23:16:41 1996 +++ xc/programs/xrx/htdocs/excel Tue Jan 16 18:02:50 2001 @@ -1,4 +1,4 @@ - + Index: xc/programs/xrx/htdocs/excel.html diff -u xc/programs/xrx/htdocs/excel.html:1.1.1.1 xc/programs/xrx/htdocs/excel.html:1.1.1.2 --- xc/programs/xrx/htdocs/excel.html:1.1.1.1 Sat Dec 21 23:16:41 1996 +++ xc/programs/xrx/htdocs/excel.html Tue Jan 16 18:02:51 2001 @@ -1,4 +1,4 @@ - + X Applications on the Web - Excel demo page. Index: xc/programs/xrx/htdocs/xclock diff -u xc/programs/xrx/htdocs/xclock:1.1.1.1 xc/programs/xrx/htdocs/xclock:1.1.1.2 --- xc/programs/xrx/htdocs/xclock:1.1.1.1 Sat Dec 21 23:16:41 1996 +++ xc/programs/xrx/htdocs/xclock Tue Jan 16 18:02:52 2001 @@ -1,4 +1,4 @@ - + Index: xc/programs/xrx/htdocs/xclock.html diff -u xc/programs/xrx/htdocs/xclock.html:1.1.1.1 xc/programs/xrx/htdocs/xclock.html:1.1.1.2 --- xc/programs/xrx/htdocs/xclock.html:1.1.1.1 Sat Dec 21 23:16:40 1996 +++ xc/programs/xrx/htdocs/xclock.html Tue Jan 16 18:02:52 2001 @@ -1,4 +1,4 @@ - + X Applications on the Web - xclock demo page. Index: xc/programs/xrx/htdocs/xload diff -u xc/programs/xrx/htdocs/xload:1.1.1.1 xc/programs/xrx/htdocs/xload:1.1.1.2 --- xc/programs/xrx/htdocs/xload:1.1.1.1 Sat Dec 21 23:16:41 1996 +++ xc/programs/xrx/htdocs/xload Tue Jan 16 18:02:54 2001 @@ -1,4 +1,4 @@ - + Index: xc/programs/xrx/htdocs/xload.html diff -u xc/programs/xrx/htdocs/xload.html:1.1.1.1 xc/programs/xrx/htdocs/xload.html:1.1.1.2 --- xc/programs/xrx/htdocs/xload.html:1.1.1.1 Sat Dec 21 23:16:40 1996 +++ xc/programs/xrx/htdocs/xload.html Tue Jan 16 18:02:56 2001 @@ -1,4 +1,4 @@ - + X Applications on the Web - Demo page. Index: xc/programs/xrx/libxplugin/Imakefile diff -u xc/programs/xrx/libxplugin/Imakefile:1.1.1.2 xc/programs/xrx/libxplugin/Imakefile:1.1.1.3 --- xc/programs/xrx/libxplugin/Imakefile:1.1.1.2 Sun Sep 27 07:06:47 1998 +++ xc/programs/xrx/libxplugin/Imakefile Tue Jan 16 18:02:57 2001 @@ -1,4 +1,4 @@ -XCOMM $TOG: Imakefile /main/12 1998/03/05 16:51:56 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ #if defined(SGIArchitecture) && (OSMajorVersion > 5) Index: xc/programs/xrx/libxplugin/README diff -u xc/programs/xrx/libxplugin/README:1.1.1.1 xc/programs/xrx/libxplugin/README:1.1.1.2 --- xc/programs/xrx/libxplugin/README:1.1.1.1 Sat Dec 21 23:16:46 1996 +++ xc/programs/xrx/libxplugin/README Tue Jan 16 18:02:58 2001 @@ -1,4 +1,4 @@ -$XConsortium: README /main/1 1996/08/12 11:55:43 kaleb $ +$Xorg: README,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ This library exists solely to get the new extensions linked into the Netscape Plug-in. Once vendors start shipping R7 versions of libXext.so Index: xc/programs/xrx/plugin/Global.c diff -u xc/programs/xrx/plugin/Global.c:1.1.1.2 xc/programs/xrx/plugin/Global.c:1.1.1.3 --- xc/programs/xrx/plugin/Global.c:1.1.1.2 Sun Sep 27 04:59:54 1998 +++ xc/programs/xrx/plugin/Global.c Tue Jan 16 18:03:00 2001 @@ -1,4 +1,4 @@ -/* $TOG: Global.c /main/8 1998/02/10 18:32:39 kaleb $ */ +/* $Xorg: Global.c,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/plugin/Imakefile diff -u xc/programs/xrx/plugin/Imakefile:1.6 xc/programs/xrx/plugin/Imakefile:1.8 --- xc/programs/xrx/plugin/Imakefile:1.6 Sun Oct 4 05:41:48 1998 +++ xc/programs/xrx/plugin/Imakefile Sat Mar 3 18:07:50 2001 @@ -1,5 +1,10 @@ -XCOMM $TOG: Imakefile /main/44 1998/03/10 10:44:27 barstow $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ + + + +XCOMM $XFree86: xc/programs/xrx/plugin/Imakefile,v 1.8 2001/03/03 23:07:50 tsi Exp $ + XCOMM This isn't an option we must build a shared lib #define DoSharedLib YES @@ -41,12 +46,14 @@ #if OSMajorVersion < 5 || OSMajorVersion == 5 && OSMinorVersion < 6 XT_DEFINES = -DXUSE_XTREGISTERWINDOW #endif +#if !HasGcc /* * Based on Xmd.h 2.6 appears to be no more than R6pl11, so we need this. * Hopefully Sun will fix this in 2.7. */ #undef DefaultCCOptions #define DefaultCCOptions -Xc +#endif #if OSMajorVersion == 4 FUNCPROTO_DEFINES = -DXFUNCPROTO_NOT_AVAILABLE #endif Index: xc/programs/xrx/plugin/Main.c diff -u xc/programs/xrx/plugin/Main.c:1.5 xc/programs/xrx/plugin/Main.c:1.6 --- xc/programs/xrx/plugin/Main.c:1.5 Sun Oct 4 05:41:48 1998 +++ xc/programs/xrx/plugin/Main.c Wed Jan 17 18:46:24 2001 @@ -1,4 +1,4 @@ -/* $TOG: Main.c /main/20 1998/03/05 16:17:28 kaleb $ */ +/* $Xorg: Main.c,v 1.4 2000/08/17 19:54:59 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -479,7 +479,7 @@ int rx_argc; RxParams params; RxReturnParams return_params; - NPError err, status = NPERR_NO_ERROR; + NPError status = NPERR_NO_ERROR; if (instance == NULL) return NPERR_INVALID_INSTANCE_ERROR; Index: xc/programs/xrx/plugin/NewNDest.c diff -u xc/programs/xrx/plugin/NewNDest.c:1.3 xc/programs/xrx/plugin/NewNDest.c:1.4 --- xc/programs/xrx/plugin/NewNDest.c:1.3 Sun Oct 4 05:41:48 1998 +++ xc/programs/xrx/plugin/NewNDest.c Wed Jan 17 18:46:24 2001 @@ -1,4 +1,4 @@ -/* $TOG: NewNDest.c /main/16 1998/02/10 18:32:58 kaleb $ */ +/* $Xorg: NewNDest.c,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/plugin/PProcess.c diff -u xc/programs/xrx/plugin/PProcess.c:1.3 xc/programs/xrx/plugin/PProcess.c:1.4 --- xc/programs/xrx/plugin/PProcess.c:1.3 Sun Oct 4 05:41:48 1998 +++ xc/programs/xrx/plugin/PProcess.c Wed Jan 17 18:46:24 2001 @@ -1,4 +1,4 @@ -/* $TOG: PProcess.c /main/34 1998/02/25 14:00:05 barstow $ */ +/* $Xorg: PProcess.c,v 1.5 2000/08/17 19:54:59 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -227,7 +227,7 @@ /* get window's record */ for (i = 0; i < This->nclient_windows; i++) - if (This->client_windows[i].win = win) + if ((This->client_windows[i].win = win)) break; if (i == This->nclient_windows) @@ -501,7 +501,6 @@ int i; Position x, y; XConfigureEvent sendev; - XConfigureEvent* ev = (XConfigureEvent*) event; XtTranslateCoords (This->plugin_widget, 0, 0, &x, &y); for (i = 0; i < This->nclient_windows; i++) { Index: xc/programs/xrx/plugin/RxPlugin.h diff -u xc/programs/xrx/plugin/RxPlugin.h:1.3 xc/programs/xrx/plugin/RxPlugin.h:1.4 --- xc/programs/xrx/plugin/RxPlugin.h:1.3 Sun Oct 4 05:41:49 1998 +++ xc/programs/xrx/plugin/RxPlugin.h Wed Jan 17 18:46:24 2001 @@ -1,4 +1,4 @@ -/* $TOG: RxPlugin.h /main/23 1998/02/10 18:33:10 kaleb $ */ +/* $Xorg: RxPlugin.h,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/plugin/SetWin.c diff -u xc/programs/xrx/plugin/SetWin.c:1.3 xc/programs/xrx/plugin/SetWin.c:1.4 --- xc/programs/xrx/plugin/SetWin.c:1.3 Sun Oct 4 05:41:49 1998 +++ xc/programs/xrx/plugin/SetWin.c Wed Jan 17 18:46:24 2001 @@ -1,4 +1,4 @@ -/* $TOG: SetWin.c /main/17 1998/02/10 18:33:15 kaleb $ */ +/* $Xorg: SetWin.c,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/plugin/libxrx.man diff -u xc/programs/xrx/plugin/libxrx.man:1.5 xc/programs/xrx/plugin/libxrx.man:1.7 --- xc/programs/xrx/plugin/libxrx.man:1.5 Sun Oct 4 05:41:52 1998 +++ xc/programs/xrx/plugin/libxrx.man Sat Jan 27 13:21:22 2001 @@ -1,4 +1,4 @@ -.\" $TOG: libxrx.man /main/7 1998/02/10 18:32:45 kaleb $ +.\" $Xorg: libxrx.man,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ .\" Copyright 1996, 1998 The Open Group .\" .\" All Rights Reserved. @@ -19,7 +19,10 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.TH LIBXRX 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xrx/plugin/libxrx.man,v 1.7 2001/01/27 18:21:22 dawes Exp $ +.\" +.TH LIBXRX 1 __xorgversion__ .SH NAME libxrx - RX Netscape Navigator Plug-in .SH DESCRIPTION Index: xc/programs/xrx/plugin/stubs.c diff -u xc/programs/xrx/plugin/stubs.c:1.1.1.1 xc/programs/xrx/plugin/stubs.c:1.1.1.2 --- xc/programs/xrx/plugin/stubs.c:1.1.1.1 Sat Dec 21 23:16:42 1996 +++ xc/programs/xrx/plugin/stubs.c Tue Jan 16 18:03:13 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: stubs.c /main/1 1996/08/14 11:46:09 lehors $ */ +/* $Xorg: stubs.c,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ */ /* -*- Mode: C; tab-width: 4; -*- */ /******************************************************************************* * Simple LiveConnect Sample Plugin Index: xc/programs/xrx/plugin/common/npunix.c diff -u xc/programs/xrx/plugin/common/npunix.c:1.1.1.1 xc/programs/xrx/plugin/common/npunix.c:1.1.1.2 --- xc/programs/xrx/plugin/common/npunix.c:1.1.1.1 Sat Dec 21 23:16:42 1996 +++ xc/programs/xrx/plugin/common/npunix.c Tue Jan 16 18:03:14 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: npunix.c /main/2 1996/11/13 09:28:37 kaleb $ */ +/* $Xorg: npunix.c,v 1.3 2000/08/17 19:54:59 cpqbld Exp $ */ /* * npunix.c * Index: xc/programs/xrx/plugin/include/jri.h diff -u xc/programs/xrx/plugin/include/jri.h:1.1.1.1 xc/programs/xrx/plugin/include/jri.h:1.1.1.2 --- xc/programs/xrx/plugin/include/jri.h:1.1.1.1 Sat Dec 21 23:16:43 1996 +++ xc/programs/xrx/plugin/include/jri.h Tue Jan 16 18:03:18 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: jri.h /main/2 1996/11/13 09:27:07 kaleb $ */ +/* $Xorg: jri.h,v 1.3 2000/08/17 19:55:00 cpqbld Exp $ */ /* -*- Mode: C; tab-width: 4; -*- */ /******************************************************************************* * Java Runtime Interface Index: xc/programs/xrx/plugin/include/jri_md.h diff -u xc/programs/xrx/plugin/include/jri_md.h:1.2 xc/programs/xrx/plugin/include/jri_md.h:1.3 --- xc/programs/xrx/plugin/include/jri_md.h:1.2 Sat Mar 13 22:22:31 1999 +++ xc/programs/xrx/plugin/include/jri_md.h Wed Jan 17 18:46:25 2001 @@ -1,10 +1,10 @@ -/* $XConsortium: jri_md.h /main/2 1996/11/13 09:27:11 kaleb $ */ +/* $Xorg: jri_md.h,v 1.3 2000/08/17 19:55:01 cpqbld Exp $ */ /* -*- Mode: C; tab-width: 4; -*- */ /******************************************************************************* * Java Runtime Interface - Machine Dependent Types * Copyright (c) 1996 Netscape Communications Corporation. All rights reserved. ******************************************************************************/ -/* $XFree86: xc/programs/xrx/plugin/include/jri_md.h,v 1.2 1999/03/14 03:22:31 dawes Exp $ */ +/* $XFree86: xc/programs/xrx/plugin/include/jri_md.h,v 1.3 2001/01/17 23:46:25 dawes Exp $ */ #ifndef JRI_MD_H #define JRI_MD_H Index: xc/programs/xrx/plugin/include/jritypes.h diff -u xc/programs/xrx/plugin/include/jritypes.h:1.1.1.1 xc/programs/xrx/plugin/include/jritypes.h:1.1.1.2 --- xc/programs/xrx/plugin/include/jritypes.h:1.1.1.1 Sat Dec 21 23:16:43 1996 +++ xc/programs/xrx/plugin/include/jritypes.h Tue Jan 16 18:03:19 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: jritypes.h /main/2 1996/11/13 09:27:14 kaleb $ */ +/* $Xorg: jritypes.h,v 1.3 2000/08/17 19:55:01 cpqbld Exp $ */ /* -*- Mode: C; tab-width: 4; -*- */ /******************************************************************************* * Java Runtime Interface Index: xc/programs/xrx/plugin/include/npapi.h diff -u xc/programs/xrx/plugin/include/npapi.h:1.3 xc/programs/xrx/plugin/include/npapi.h:1.4 --- xc/programs/xrx/plugin/include/npapi.h:1.3 Thu Aug 31 15:04:00 2000 +++ xc/programs/xrx/plugin/include/npapi.h Wed Jan 17 18:46:25 2001 @@ -1,10 +1,10 @@ -/* $XConsortium: npapi.h /main/2 1996/11/13 09:25:10 kaleb $ */ +/* $Xorg: npapi.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* -*- Mode: C; tab-width: 4; -*- */ /* * npapi.h Revision: 1.76 * Netscape client plug-in API spec */ -/* $XFree86: xc/programs/xrx/plugin/include/npapi.h,v 1.3 2000/08/31 19:04:00 tsi Exp $ */ +/* $XFree86: xc/programs/xrx/plugin/include/npapi.h,v 1.4 2001/01/17 23:46:25 dawes Exp $ */ #ifndef _NPAPI_H_ #define _NPAPI_H_ Index: xc/programs/xrx/plugin/include/npupp.h diff -u xc/programs/xrx/plugin/include/npupp.h:1.1.1.1 xc/programs/xrx/plugin/include/npupp.h:1.1.1.2 --- xc/programs/xrx/plugin/include/npupp.h:1.1.1.1 Sat Dec 21 23:16:43 1996 +++ xc/programs/xrx/plugin/include/npupp.h Tue Jan 16 18:03:21 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: npupp.h /main/2 1996/11/13 09:25:15 kaleb $ */ +/* $Xorg: npupp.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* -*- Mode: C; tab-width: 4; -*- */ /* * npupp.h Revision: 1.37 Index: xc/programs/xrx/rx/BuildReq.c diff -u xc/programs/xrx/rx/BuildReq.c:1.1.1.2 xc/programs/xrx/rx/BuildReq.c:1.1.1.3 --- xc/programs/xrx/rx/BuildReq.c:1.1.1.2 Sun Sep 27 05:00:06 1998 +++ xc/programs/xrx/rx/BuildReq.c Tue Jan 16 18:03:22 2001 @@ -1,4 +1,4 @@ -/* $TOG: BuildReq.c /main/5 1998/02/10 18:36:05 kaleb $ */ +/* $Xorg: BuildReq.c,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/rx/PParse.c diff -u xc/programs/xrx/rx/PParse.c:1.1.1.2 xc/programs/xrx/rx/PParse.c:1.1.1.3 --- xc/programs/xrx/rx/PParse.c:1.1.1.2 Sun Sep 27 05:00:06 1998 +++ xc/programs/xrx/rx/PParse.c Tue Jan 16 18:03:23 2001 @@ -1,4 +1,4 @@ -/* $TOG: PParse.c /main/6 1998/02/10 18:36:12 kaleb $ */ +/* $Xorg: PParse.c,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/rx/PRead.c diff -u xc/programs/xrx/rx/PRead.c:1.1.1.2 xc/programs/xrx/rx/PRead.c:1.1.1.3 --- xc/programs/xrx/rx/PRead.c:1.1.1.2 Sun Sep 27 05:00:07 1998 +++ xc/programs/xrx/rx/PRead.c Tue Jan 16 18:03:25 2001 @@ -1,4 +1,4 @@ -/* $TOG: PRead.c /main/5 1998/02/10 18:36:21 kaleb $ */ +/* $Xorg: PRead.c,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/rx/Prefs.c diff -u xc/programs/xrx/rx/Prefs.c:1.4 xc/programs/xrx/rx/Prefs.c:1.5 --- xc/programs/xrx/rx/Prefs.c:1.4 Sun Oct 4 05:41:53 1998 +++ xc/programs/xrx/rx/Prefs.c Wed Jan 17 18:46:25 2001 @@ -1,4 +1,4 @@ -/* $TOG: Prefs.c /main/5 1998/02/10 18:36:29 kaleb $ */ +/* $Xorg: Prefs.c,v 1.4 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -22,7 +22,7 @@ The Open Group. */ -/* $XFree86: xc/programs/xrx/rx/Prefs.c,v 1.4 1998/10/04 09:41:53 dawes Exp $ */ +/* $XFree86: xc/programs/xrx/rx/Prefs.c,v 1.5 2001/01/17 23:46:25 dawes Exp $ */ #include "Prefs.h" #include @@ -71,8 +71,8 @@ static AddressFilter * NextAFListElem(AddressFilter **list, int *count) { - AddressFilter *l, *elem; - int n, nn; + AddressFilter *l; + int n; l = *list; n = *count; Index: xc/programs/xrx/rx/Prefs.h diff -u xc/programs/xrx/rx/Prefs.h:1.1.1.2 xc/programs/xrx/rx/Prefs.h:1.1.1.3 --- xc/programs/xrx/rx/Prefs.h:1.1.1.2 Sun Sep 27 05:00:11 1998 +++ xc/programs/xrx/rx/Prefs.h Tue Jan 16 18:03:26 2001 @@ -1,4 +1,4 @@ -/* $TOG: Prefs.h /main/3 1998/02/10 18:36:36 kaleb $ */ +/* $Xorg: Prefs.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/rx/Rx.h diff -u xc/programs/xrx/rx/Rx.h:1.1.1.2 xc/programs/xrx/rx/Rx.h:1.1.1.3 --- xc/programs/xrx/rx/Rx.h:1.1.1.2 Sun Sep 27 05:00:01 1998 +++ xc/programs/xrx/rx/Rx.h Tue Jan 16 18:03:27 2001 @@ -1,4 +1,4 @@ -/* $TOG: Rx.h /main/5 1998/02/10 18:36:48 kaleb $ */ +/* $Xorg: Rx.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/rx/RxI.h diff -u xc/programs/xrx/rx/RxI.h:1.1.1.2 xc/programs/xrx/rx/RxI.h:1.1.1.3 --- xc/programs/xrx/rx/RxI.h:1.1.1.2 Sun Sep 27 05:00:02 1998 +++ xc/programs/xrx/rx/RxI.h Tue Jan 16 18:03:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: RxI.h /main/8 1998/02/10 18:36:42 kaleb $ */ +/* $Xorg: RxI.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/rx/XAuth.c diff -u xc/programs/xrx/rx/XAuth.c:1.1.1.3 xc/programs/xrx/rx/XAuth.c:1.1.1.4 --- xc/programs/xrx/rx/XAuth.c:1.1.1.3 Sun Sep 27 07:06:48 1998 +++ xc/programs/xrx/rx/XAuth.c Tue Jan 16 18:03:30 2001 @@ -1,4 +1,4 @@ -/* $TOG: XAuth.c /main/12 1998/03/10 10:44:20 barstow $ */ +/* $Xorg: XAuth.c,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/rx/XAuth.h diff -u xc/programs/xrx/rx/XAuth.h:1.1.1.2 xc/programs/xrx/rx/XAuth.h:1.1.1.3 --- xc/programs/xrx/rx/XAuth.h:1.1.1.2 Sun Sep 27 05:00:03 1998 +++ xc/programs/xrx/rx/XAuth.h Tue Jan 16 18:03:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: XAuth.h /main/5 1998/02/10 18:36:58 kaleb $ */ +/* $Xorg: XAuth.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/rx/XDpyName.c diff -u xc/programs/xrx/rx/XDpyName.c:1.3 xc/programs/xrx/rx/XDpyName.c:1.4 --- xc/programs/xrx/rx/XDpyName.c:1.3 Sun Oct 4 05:41:53 1998 +++ xc/programs/xrx/rx/XDpyName.c Wed Jan 17 18:46:25 2001 @@ -1,4 +1,4 @@ -/* $TOG: XDpyName.c /main/14 1998/02/25 14:00:14 barstow $ */ +/* $Xorg: XDpyName.c,v 1.4 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -192,7 +192,7 @@ char *release = NULL; pmGetProxyAddrMsg *pMsg; char *pData; - int len, i; + int len; IceReplyWaitInfo replyWait; GetProxyAddrReply reply; int majorVersion, minorVersion; @@ -449,10 +449,14 @@ char * GetXFwpDisplayName(char *dpy_name) { +#if 0 char *fwp_dpy_name, *ptr, *limit; - char buf[MAXLEN]; FILE *in; int c, status; +#else + char *fwp_dpy_name; +#endif + char buf[MAXLEN]; char *proxy_mngr; /* first, let's figure out where the proxy manager should be */ Index: xc/programs/xrx/rx/XDpyName.h diff -u xc/programs/xrx/rx/XDpyName.h:1.1.1.2 xc/programs/xrx/rx/XDpyName.h:1.1.1.3 --- xc/programs/xrx/rx/XDpyName.h:1.1.1.2 Sun Sep 27 05:00:08 1998 +++ xc/programs/xrx/rx/XDpyName.h Tue Jan 16 18:03:35 2001 @@ -1,4 +1,4 @@ -/* $TOG: XDpyName.h /main/4 1998/02/10 18:37:11 kaleb $ */ +/* $Xorg: XDpyName.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/rx/XUrls.c diff -u xc/programs/xrx/rx/XUrls.c:1.6 xc/programs/xrx/rx/XUrls.c:1.7 --- xc/programs/xrx/rx/XUrls.c:1.6 Thu May 11 14:14:45 2000 +++ xc/programs/xrx/rx/XUrls.c Wed Jan 17 18:46:25 2001 @@ -1,4 +1,4 @@ -/* $TOG: XUrls.c /main/15 1998/02/10 18:37:16 kaleb $ */ +/* $Xorg: XUrls.c,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group @@ -22,7 +22,7 @@ The Open Group. */ -/* $XFree86: xc/programs/xrx/rx/XUrls.c,v 1.6 2000/05/11 18:14:45 tsi Exp $ */ +/* $XFree86: xc/programs/xrx/rx/XUrls.c,v 1.7 2001/01/17 23:46:25 dawes Exp $ */ #include "RxI.h" #include Index: xc/programs/xrx/rx/XUrls.h diff -u xc/programs/xrx/rx/XUrls.h:1.3 xc/programs/xrx/rx/XUrls.h:1.4 --- xc/programs/xrx/rx/XUrls.h:1.3 Sun Oct 4 05:41:54 1998 +++ xc/programs/xrx/rx/XUrls.h Wed Jan 17 18:46:25 2001 @@ -1,4 +1,4 @@ -/* $TOG: XUrls.h /main/6 1998/02/10 18:37:23 kaleb $ */ +/* $Xorg: XUrls.h,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/testplugin/Imakefile diff -u xc/programs/xrx/testplugin/Imakefile:1.1.1.1 xc/programs/xrx/testplugin/Imakefile:1.1.1.2 --- xc/programs/xrx/testplugin/Imakefile:1.1.1.1 Sat Dec 21 23:16:45 1996 +++ xc/programs/xrx/testplugin/Imakefile Tue Jan 16 18:03:40 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile /main/9 1996/12/06 10:28:04 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:02 cpqbld Exp $ XCOMM where and which is the plugin to test PLUGINDIR = ../plugin Index: xc/programs/xrx/testplugin/testplugin.c diff -u xc/programs/xrx/testplugin/testplugin.c:1.1.1.2 xc/programs/xrx/testplugin/testplugin.c:1.1.1.3 --- xc/programs/xrx/testplugin/testplugin.c:1.1.1.2 Sun Sep 27 05:00:12 1998 +++ xc/programs/xrx/testplugin/testplugin.c Tue Jan 16 18:03:41 2001 @@ -1,4 +1,4 @@ -/* $TOG: testplugin.c /main/7 1998/02/10 18:38:21 kaleb $ */ +/* $Xorg: testplugin.c,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/testplugin/testplugin.man diff -u xc/programs/xrx/testplugin/testplugin.man:1.4 xc/programs/xrx/testplugin/testplugin.man:1.6 --- xc/programs/xrx/testplugin/testplugin.man:1.4 Sun Oct 4 05:41:54 1998 +++ xc/programs/xrx/testplugin/testplugin.man Sat Jan 27 13:21:22 2001 @@ -1,4 +1,4 @@ -.\" $TOG: testplugin.man /main/6 1998/02/10 18:38:28 kaleb $ +.\" $Xorg: testplugin.man,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ .\" Copyright 1996, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH TESTPLUGIN 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xrx/testplugin/testplugin.man,v 1.6 2001/01/27 18:21:22 dawes Exp $ +.\" +.TH TESTPLUGIN 1 __xorgversion__ .SH NAME testplugin - a Netscape Plug-in test bed utility .SH SYNOPSIS Index: xc/programs/xrx/xnest-plugin/Imakefile diff -u xc/programs/xrx/xnest-plugin/Imakefile:1.4 xc/programs/xrx/xnest-plugin/Imakefile:1.5 --- xc/programs/xrx/xnest-plugin/Imakefile:1.4 Sat Dec 13 21:55:47 1997 +++ xc/programs/xrx/xnest-plugin/Imakefile Wed Jan 17 18:46:26 2001 @@ -1,4 +1,4 @@ -XCOMM $TOG: Imakefile /main/11 1997/11/24 09:55:38 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ XCOMM This isn't an option we must build a shared lib #define DoSharedLib YES Index: xc/programs/xrx/xnest-plugin/NewNDest.c diff -u xc/programs/xrx/xnest-plugin/NewNDest.c:1.3 xc/programs/xrx/xnest-plugin/NewNDest.c:1.4 --- xc/programs/xrx/xnest-plugin/NewNDest.c:1.3 Sun Oct 4 05:41:55 1998 +++ xc/programs/xrx/xnest-plugin/NewNDest.c Wed Jan 17 18:46:26 2001 @@ -1,4 +1,4 @@ -/* $TOG: NewNDest.c /main/4 1998/02/10 18:39:57 kaleb $ */ +/* $Xorg: NewNDest.c,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/xnest-plugin/PProcess.c diff -u xc/programs/xrx/xnest-plugin/PProcess.c:1.3 xc/programs/xrx/xnest-plugin/PProcess.c:1.4 --- xc/programs/xrx/xnest-plugin/PProcess.c:1.3 Sun Oct 4 05:41:55 1998 +++ xc/programs/xrx/xnest-plugin/PProcess.c Wed Jan 17 18:46:26 2001 @@ -1,4 +1,4 @@ -/* $TOG: PProcess.c /main/6 1998/02/10 18:40:03 kaleb $ */ +/* $Xorg: PProcess.c,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/xnest-plugin/RxPlugin.h diff -u xc/programs/xrx/xnest-plugin/RxPlugin.h:1.3 xc/programs/xrx/xnest-plugin/RxPlugin.h:1.4 --- xc/programs/xrx/xnest-plugin/RxPlugin.h:1.3 Sun Oct 4 05:41:55 1998 +++ xc/programs/xrx/xnest-plugin/RxPlugin.h Wed Jan 17 18:46:26 2001 @@ -1,4 +1,4 @@ -/* $TOG: RxPlugin.h /main/6 1998/02/10 18:40:07 kaleb $ */ +/* $Xorg: RxPlugin.h,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/xnest-plugin/SetWin.c diff -u xc/programs/xrx/xnest-plugin/SetWin.c:1.4 xc/programs/xrx/xnest-plugin/SetWin.c:1.5 --- xc/programs/xrx/xnest-plugin/SetWin.c:1.4 Sun Oct 4 05:41:55 1998 +++ xc/programs/xrx/xnest-plugin/SetWin.c Wed Jan 17 18:46:26 2001 @@ -1,4 +1,4 @@ -/* $TOG: SetWin.c /main/6 1998/02/10 18:40:11 kaleb $ */ +/* $Xorg: SetWin.c,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xrx/xnest-plugin/XnestDis.c diff -u xc/programs/xrx/xnest-plugin/XnestDis.c:1.1.1.2 xc/programs/xrx/xnest-plugin/XnestDis.c:1.1.1.3 --- xc/programs/xrx/xnest-plugin/XnestDis.c:1.1.1.2 Sun Sep 27 05:00:17 1998 +++ xc/programs/xrx/xnest-plugin/XnestDis.c Tue Jan 16 18:03:52 2001 @@ -1,4 +1,4 @@ -/* $TOG: XnestDis.c /main/2 1998/02/10 18:40:16 kaleb $ */ +/* $Xorg: XnestDis.c,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ */ /* Copyright 1996, 1998 The Open Group Index: xc/programs/xset/Imakefile diff -u xc/programs/xset/Imakefile:3.9 xc/programs/xset/Imakefile:3.11 --- xc/programs/xset/Imakefile:3.9 Mon Aug 28 12:35:04 2000 +++ xc/programs/xset/Imakefile Thu Mar 29 21:15:26 2001 @@ -1,11 +1,15 @@ -XCOMM $XConsortium: Imakefile,v 1.7 91/12/20 11:29:16 rws Exp $ -XCOMM $XFree86: xc/programs/xset/Imakefile,v 3.9 2000/08/28 16:35:04 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ + + + +XCOMM $XFree86: xc/programs/xset/Imakefile,v 3.11 2001/03/30 02:15:26 keithp Exp $ + DEFINES = ExtensionDefines DPMSDefines \ FontCacheExtensionDefines \ XkbDefines - DEPLIBS = $(DEPXMULIB) $(DEPXLIB) $(DEPXF86LIBS) $(DEPFONTLIBS) -LOCAL_LIBRARIES = $(XMULIB) $(XF86LIBS) $(FONTLIBS) $(XLIB) + DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) $(DEPXF86LIBS) $(DEPFONTLIBS) +LOCAL_LIBRARIES = $(XMUULIB) $(XF86LIBS) $(FONTLIBS) $(XLIB) #if BuildXF86MiscLibrary DEPXF86LIBS = $(DEPXXF86MISCLIB) Index: xc/programs/xset/xset.c diff -u xc/programs/xset/xset.c:3.20 xc/programs/xset/xset.c:3.21 --- xc/programs/xset/xset.c:3.20 Mon Aug 28 12:35:04 2000 +++ xc/programs/xset/xset.c Wed Jan 17 18:46:27 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xset.c /main/76 1998/02/09 14:12:50 kaleb $ + * $Xorg: xset.c,v 1.5 2000/08/17 19:55:03 cpqbld Exp $ */ /* @@ -23,7 +23,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xset/xset.c,v 3.20 2000/08/28 16:35:04 dawes Exp $ */ +/* $XFree86: xc/programs/xset/xset.c,v 3.21 2001/01/17 23:46:27 dawes Exp $ */ /* Modified by Stephen so keyboard rate is set using XKB extensions */ #include Index: xc/programs/xset/xset.man diff -u xc/programs/xset/xset.man:3.10 xc/programs/xset/xset.man:3.13 --- xc/programs/xset/xset.man:3.10 Tue Nov 14 16:59:26 2000 +++ xc/programs/xset/xset.man Sat Jan 27 13:21:23 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xset.man /main/31 1998/02/09 14:12:56 kaleb $ +.\" $Xorg: xset.man,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ .\" Copyright 1988, 1998 The Open Group .\" .\" All Rights Reserved. @@ -19,9 +19,9 @@ .\" other dealings in this Software without prior written authorization .\" from The Open Group. .\" -.\" $XFree86: xc/programs/xset/xset.man,v 3.10 2000/11/14 21:59:26 dawes Exp $ +.\" $XFree86: xc/programs/xset/xset.man,v 3.13 2001/01/27 18:21:23 dawes Exp $ .\" -.TH XSET 1 "Release 6.4" "X Version 11" +.TH XSET 1 __xorgversion__ .SH NAME xset - user preference utility for X .SH SYNOPSIS @@ -45,7 +45,7 @@ .PP .TP 8 .B \-display \fIdisplay\fP -This option specifies the server to use; see \fIX(1)\fP. +This option specifies the server to use; see \fIX(__miscmansuffix__)\fP. .PP .TP 8 .B b @@ -236,7 +236,7 @@ Note that not all X implementations are guaranteed to honor all of these options. .SH "SEE ALSO" -X(1), Xserver(1), xmodmap(1), xrdb(1), xsetroot(1) +X(__miscmansuffix__), Xserver(1), xmodmap(1), xrdb(1), xsetroot(1) .SH AUTHOR Bob Scheifler, MIT Laboratory for Computer Science .br Index: xc/programs/xsetmode/xsetmode.c diff -u xc/programs/xsetmode/xsetmode.c:3.4 xc/programs/xsetmode/xsetmode.c:3.5 --- xc/programs/xsetmode/xsetmode.c:3.4 Sun Mar 7 06:41:20 1999 +++ xc/programs/xsetmode/xsetmode.c Sun Apr 1 10:00:23 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xsetmode/xsetmode.c,v 3.4 1999/03/07 11:41:20 dawes Exp $ */ +/* $XFree86: xc/programs/xsetmode/xsetmode.c,v 3.5 2001/04/01 14:00:23 tsi Exp $ */ /* * Copyright 1995 by Frederic Lepied, France. @@ -24,6 +24,8 @@ */ #include +#include +#include #include #include #include Index: xc/programs/xsetmode/xsetmode.man diff -u xc/programs/xsetmode/xsetmode.man:3.1 xc/programs/xsetmode/xsetmode.man:3.2 --- xc/programs/xsetmode/xsetmode.man:3.1 Tue Dec 26 05:43:02 1995 +++ xc/programs/xsetmode/xsetmode.man Sat Jan 27 13:21:23 2001 @@ -1,6 +1,6 @@ -.\" $XFree86: xc/programs/xsetmode/xsetmode.man,v 3.1 1995/12/26 10:43:02 dawes Exp $ +.\" $XFree86: xc/programs/xsetmode/xsetmode.man,v 3.2 2001/01/27 18:21:23 dawes Exp $ .\" -.TH xsetmode 1 "Release 6" "X Version 11" +.TH xsetmode 1 __vendorversion__ .SH NAME xsetmode \- set the mode for an X Input device .SH SYNOPSIS Index: xc/programs/xsetpointer/xsetpnt.man diff -u xc/programs/xsetpointer/xsetpnt.man:3.0 xc/programs/xsetpointer/xsetpnt.man:3.1 --- xc/programs/xsetpointer/xsetpnt.man:3.0 Tue Dec 26 01:10:25 1995 +++ xc/programs/xsetpointer/xsetpnt.man Sat Jan 27 13:21:23 2001 @@ -1,6 +1,6 @@ -.\" $XFree86: xc/programs/xsetpointer/xsetpnt.man,v 3.0 1995/12/26 06:10:25 dawes Exp $ +.\" $XFree86: xc/programs/xsetpointer/xsetpnt.man,v 3.1 2001/01/27 18:21:23 dawes Exp $ .\" -.TH xsetpointer 1 "Release 6" "X Version 11" +.TH xsetpointer 1 __vendorversion__ .SH NAME xsetpointer \- set an X Input device as the main pointer .SH SYNOPSIS Index: xc/programs/xsetpointer/xsetpointer.c diff -u xc/programs/xsetpointer/xsetpointer.c:3.5 xc/programs/xsetpointer/xsetpointer.c:3.6 --- xc/programs/xsetpointer/xsetpointer.c:3.5 Sun Mar 7 06:41:20 1999 +++ xc/programs/xsetpointer/xsetpointer.c Sun Apr 1 10:00:23 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xsetpointer/xsetpointer.c,v 3.5 1999/03/07 11:41:20 dawes Exp $ */ +/* $XFree86: xc/programs/xsetpointer/xsetpointer.c,v 3.6 2001/04/01 14:00:23 tsi Exp $ */ /* * Copyright 1995 by Frederic Lepied, France. @@ -24,6 +24,8 @@ */ #include +#include +#include #include #include #include Index: xc/programs/xsetroot/Imakefile diff -u xc/programs/xsetroot/Imakefile:1.1.1.1 xc/programs/xsetroot/Imakefile:1.3 --- xc/programs/xsetroot/Imakefile:1.1.1.1 Wed Apr 27 03:13:09 1994 +++ xc/programs/xsetroot/Imakefile Sun Apr 1 10:00:24 2001 @@ -1,6 +1,12 @@ -XCOMM $XConsortium: Imakefile,v 1.8 91/07/16 23:05:43 gildea Exp $ - DEPLIBS = $(DEPXLIB) -LOCAL_LIBRARIES = $(XMULIB) $(XLIB) +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xsetroot/Imakefile,v 1.3 2001/04/01 14:00:24 tsi Exp $ + + DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XMUULIB) $(XLIB) SRCS = xsetroot.c OBJS = xsetroot.o Index: xc/programs/xsetroot/xsetroot.c diff -u xc/programs/xsetroot/xsetroot.c:1.5 xc/programs/xsetroot/xsetroot.c:1.7 --- xc/programs/xsetroot/xsetroot.c:1.5 Sun Mar 7 06:41:20 1999 +++ xc/programs/xsetroot/xsetroot.c Sun Apr 1 10:00:24 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xsetroot.c /main/24 1998/02/09 14:12:40 kaleb $ + * $Xorg: xsetroot.c,v 1.3 2000/08/17 19:55:03 cpqbld Exp $ * Copyright 1987, 1998 The Open Group @@ -28,20 +28,16 @@ * Author: Mark Lillibridge, MIT Project Athena * 11-Jun-87 */ -/* $XFree86: xc/programs/xsetroot/xsetroot.c,v 1.5 1999/03/07 11:41:20 dawes Exp $ */ +/* $XFree86: xc/programs/xsetroot/xsetroot.c,v 1.7 2001/04/01 14:00:24 tsi Exp $ */ #include #include #include #include #include -#include "X11/bitmaps/gray" - -#ifndef X_NOT_STDC_ENV #include -#else -extern int atoi(char *); -#endif +#include +#include "X11/bitmaps/gray" #define Dynamic 1 Index: xc/programs/xsetroot/xsetroot.man diff -u xc/programs/xsetroot/xsetroot.man:1.4 xc/programs/xsetroot/xsetroot.man:1.7 --- xc/programs/xsetroot/xsetroot.man:1.4 Sun Oct 4 05:41:58 1998 +++ xc/programs/xsetroot/xsetroot.man Sat Jan 27 13:21:23 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xsetroot.man /main/20 1998/02/09 14:12:46 kaleb $ +.\" $Xorg: xsetroot.man,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ .\" Copyright 1988, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XSETROOT 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xsetroot/xsetroot.man,v 1.7 2001/01/27 18:21:23 dawes Exp $ +.\" +.TH XSETROOT 1 __xorgversion__ .SH NAME xsetroot \- root window parameter setting utility for X .SH SYNOPSIS @@ -98,8 +101,8 @@ window manager can use a text representation when the window is iconified. This option is unused since you can't iconify the background. .IP "\fB-display\fP \fIdisplay\fP" -Specifies the server to connect to; see \fIX(1)\fP. +Specifies the server to connect to; see \fIX(__miscmansuffix__)\fP. .SH "SEE ALSO" -X(1), xset(1), xrdb(1) +X(__miscmansuffix__), xset(1), xrdb(1) .SH AUTHOR Mark Lillibridge, MIT Project Athena Index: xc/programs/xsm/Imakefile diff -u xc/programs/xsm/Imakefile:1.5 xc/programs/xsm/Imakefile:1.6 --- xc/programs/xsm/Imakefile:1.5 Wed Feb 9 12:10:26 2000 +++ xc/programs/xsm/Imakefile Wed Jan 17 18:46:28 2001 @@ -1,5 +1,9 @@ -XCOMM $XConsortium: Imakefile /main/18 1996/01/31 23:50:38 gildea $ -XCOMM $XFree86: xc/programs/xsm/Imakefile,v 1.5 2000/02/09 17:10:26 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xsm/Imakefile,v 1.6 2001/01/17 23:46:28 dawes Exp $ #if !defined(RshCmd) #if SystemV Index: xc/programs/xsm/README diff -u xc/programs/xsm/README:1.1.1.1 xc/programs/xsm/README:1.1.1.2 --- xc/programs/xsm/README:1.1.1.1 Wed Jan 3 02:41:17 1996 +++ xc/programs/xsm/README Tue Jan 16 18:04:12 2001 @@ -1,4 +1,4 @@ -$XConsortium: README,v 1.5 95/01/04 18:26:53 mor Exp $ +$Xorg: README,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ README file for the X Session Manager (xsm) ------------------------------------------- Index: xc/programs/xsm/XSm.ad diff -u xc/programs/xsm/XSm.ad:1.1.1.1 xc/programs/xsm/XSm.ad:1.1.1.2 --- xc/programs/xsm/XSm.ad:1.1.1.1 Wed Jan 3 02:41:17 1996 +++ xc/programs/xsm/XSm.ad Tue Jan 16 18:04:16 2001 @@ -1,4 +1,4 @@ -! $XConsortium: XSm.ad,v 1.28 95/05/24 20:43:29 mor Exp $ +! $Xorg: XSm.ad,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ *chooseSessionPopup*font: 12x24 *chooseSessionLabel.label: Session Menu *chooseSessionMessageLabel.label: Press button again to confirm, or hit Cancel... Index: xc/programs/xsm/auth.c diff -u xc/programs/xsm/auth.c:1.5 xc/programs/xsm/auth.c:1.6 --- xc/programs/xsm/auth.c:1.5 Sun Mar 7 09:23:38 1999 +++ xc/programs/xsm/auth.c Wed Jan 17 18:46:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: auth.c /main/13 1998/02/09 14:13:00 kaleb $ */ +/* $Xorg: auth.c,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/auth.c,v 1.5 1999/03/07 14:23:38 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/auth.c,v 1.6 2001/01/17 23:46:28 dawes Exp $ */ #include "xsm.h" Index: xc/programs/xsm/auth.h diff -u xc/programs/xsm/auth.h:1.3 xc/programs/xsm/auth.h:1.4 --- xc/programs/xsm/auth.h:1.3 Sun Mar 7 09:23:39 1999 +++ xc/programs/xsm/auth.h Wed Jan 17 18:46:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: auth.h /main/2 1998/02/09 14:13:05 kaleb $ */ +/* $Xorg: auth.h,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/auth.h,v 1.3 1999/03/07 14:23:39 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/auth.h,v 1.4 2001/01/17 23:46:28 dawes Exp $ */ extern Bool HostBasedAuthProc(char *hostname); extern Status SetAuthentication(int count, IceListenObj *listenObjs, Index: xc/programs/xsm/choose.c diff -u xc/programs/xsm/choose.c:1.3 xc/programs/xsm/choose.c:1.4 --- xc/programs/xsm/choose.c:1.3 Sun Mar 7 09:23:39 1999 +++ xc/programs/xsm/choose.c Wed Jan 17 18:46:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: choose.c /main/26 1998/02/09 14:13:08 kaleb $ */ +/* $Xorg: choose.c,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/choose.c,v 1.3 1999/03/07 14:23:39 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/choose.c,v 1.4 2001/01/17 23:46:28 dawes Exp $ */ #include "xsm.h" #include "saveutil.h" Index: xc/programs/xsm/choose.h diff -u xc/programs/xsm/choose.h:1.3 xc/programs/xsm/choose.h:1.4 --- xc/programs/xsm/choose.h:1.3 Sun Mar 7 09:23:39 1999 +++ xc/programs/xsm/choose.h Wed Jan 17 18:46:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: choose.h /main/5 1998/02/09 14:13:16 kaleb $ */ +/* $Xorg: choose.h,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/choose.h,v 1.3 1999/03/07 14:23:39 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/choose.h,v 1.4 2001/01/17 23:46:28 dawes Exp $ */ extern int GetSessionNames(int *count_ret, String **short_names_ret, String **long_names_ret, Bool **locked_ret); Index: xc/programs/xsm/globals.c diff -u xc/programs/xsm/globals.c:1.3 xc/programs/xsm/globals.c:1.4 --- xc/programs/xsm/globals.c:1.3 Mon Feb 1 07:52:29 1999 +++ xc/programs/xsm/globals.c Wed Jan 17 18:46:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: globals.c /main/23 1998/02/09 14:13:21 kaleb $ */ +/* $Xorg: globals.c,v 1.3 2000/08/17 19:55:04 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/globals.c,v 1.3 1999/02/01 12:52:29 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/globals.c,v 1.4 2001/01/17 23:46:28 dawes Exp $ */ #include Index: xc/programs/xsm/info.c diff -u xc/programs/xsm/info.c:1.4 xc/programs/xsm/info.c:1.5 --- xc/programs/xsm/info.c:1.4 Sun Mar 7 06:41:22 1999 +++ xc/programs/xsm/info.c Wed Jan 17 18:46:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: info.c /main/27 1998/02/09 14:13:26 kaleb $ */ +/* $Xorg: info.c,v 1.4 2000/08/17 19:55:04 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/info.c,v 1.4 1999/03/07 11:41:22 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/info.c,v 1.5 2001/01/17 23:46:28 dawes Exp $ */ #include "xsm.h" #include "restart.h" @@ -221,6 +221,7 @@ sprintf (buffer.bufStart, "SM Properties : %s", clientListNames[index]); + ptr = Strstr (buffer.bufStart, ") Restart"); if (ptr) *(ptr + 1) = '\0'; @@ -423,19 +424,19 @@ List *vl = ListFirst (pprop->values); if (vl != NULL) { - PropValue *pval = (PropValue *) vl->thing; - - if (strcmp (pprop->name, SmProgram) == 0) - { - progName = GetProgramName ((char *) pval->value); + PropValue *pval = (PropValue *) vl->thing; - if ((int) strlen (progName) > maxlen1) - maxlen1 = strlen (progName); - } - else if (strcmp (pprop->name, "_XC_RestartService") == 0) - { - restart_service_prop = (char *) pval->value; - } + if (strcmp (pprop->name, SmProgram) == 0) + { + progName = GetProgramName ((char *) pval->value); + + if ((int) strlen (progName) > maxlen1) + maxlen1 = strlen (progName); + } + else if (strcmp (pprop->name, "_XC_RestartService") == 0) + { + restart_service_prop = (char *) pval->value; + } } } @@ -510,16 +511,15 @@ if (vl != NULL) { - PropValue *pval = (PropValue *) vl->thing; - - if (strcmp (pprop->name, SmProgram) == 0) - { - progName = GetProgramName ((char *) pval->value); - } - else if (strcmp (pprop->name, "_XC_RestartService") == 0) - { - restart_service_prop = (char *) pval->value; - } + PropValue *pval = (PropValue *) vl->thing; + if (strcmp (pprop->name, SmProgram) == 0) + { + progName = GetProgramName ((char *) pval->value); + } + else if (strcmp (pprop->name, "_XC_RestartService") == 0) + { + restart_service_prop = (char *) pval->value; + } } } Index: xc/programs/xsm/info.h diff -u xc/programs/xsm/info.h:3.2 xc/programs/xsm/info.h:3.3 --- xc/programs/xsm/info.h:3.2 Sun Mar 7 06:41:23 1999 +++ xc/programs/xsm/info.h Wed Jan 17 18:46:28 2001 @@ -1,4 +1,4 @@ -/* $TOG: info.h /main/2 1998/02/09 14:13:31 kaleb $ */ +/* $Xorg: info.h,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/info.h,v 3.2 1999/03/07 11:41:23 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/info.h,v 3.3 2001/01/17 23:46:28 dawes Exp $ */ extern void ShowHint(ClientRec *client); extern void DisplayProps(ClientRec *client); Index: xc/programs/xsm/list.c diff -u xc/programs/xsm/list.c:1.1.1.2 xc/programs/xsm/list.c:1.1.1.3 --- xc/programs/xsm/list.c:1.1.1.2 Sun Sep 27 04:57:43 1998 +++ xc/programs/xsm/list.c Tue Jan 16 18:04:36 2001 @@ -1,4 +1,4 @@ -/* $TOG: list.c /main/8 1998/02/09 14:13:35 kaleb $ */ +/* $Xorg: list.c,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group Index: xc/programs/xsm/list.h diff -u xc/programs/xsm/list.h:1.3 xc/programs/xsm/list.h:1.4 --- xc/programs/xsm/list.h:1.3 Sun Mar 7 09:23:40 1999 +++ xc/programs/xsm/list.h Wed Jan 17 18:46:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: list.h /main/7 1998/02/09 14:13:40 kaleb $ */ +/* $Xorg: list.h,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/list.h,v 1.3 1999/03/07 14:23:40 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/list.h,v 1.4 2001/01/17 23:46:29 dawes Exp $ */ typedef struct _List { struct _List *prev; Index: xc/programs/xsm/lock.c diff -u xc/programs/xsm/lock.c:3.2 xc/programs/xsm/lock.c:3.3 --- xc/programs/xsm/lock.c:3.2 Sun Mar 7 06:41:23 1999 +++ xc/programs/xsm/lock.c Wed Jan 17 18:46:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: lock.c /main/7 1998/02/09 14:13:55 kaleb $ */ +/* $Xorg: lock.c,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/lock.c,v 3.2 1999/03/07 11:41:23 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/lock.c,v 3.3 2001/01/17 23:46:29 dawes Exp $ */ #include "xsm.h" #include "lock.h" Index: xc/programs/xsm/lock.h diff -u xc/programs/xsm/lock.h:1.3 xc/programs/xsm/lock.h:1.4 --- xc/programs/xsm/lock.h:1.3 Sun Mar 7 09:23:40 1999 +++ xc/programs/xsm/lock.h Wed Jan 17 18:46:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: lock.h /main/3 1998/02/09 14:14:01 kaleb $ */ +/* $Xorg: lock.h,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/lock.h,v 1.3 1999/03/07 14:23:40 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/lock.h,v 1.4 2001/01/17 23:46:29 dawes Exp $ */ extern Status LockSession(char *session_name, Bool write_id); extern void UnlockSession(char* session_name); Index: xc/programs/xsm/log.c diff -u xc/programs/xsm/log.c:1.3 xc/programs/xsm/log.c:1.4 --- xc/programs/xsm/log.c:1.3 Sun Mar 7 09:23:40 1999 +++ xc/programs/xsm/log.c Wed Jan 17 18:46:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: log.c /main/5 1998/02/09 14:14:07 kaleb $ */ +/* $Xorg: log.c,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/log.c,v 1.3 1999/03/07 14:23:40 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/log.c,v 1.4 2001/01/17 23:46:29 dawes Exp $ */ #include "xsm.h" #include "save.h" Index: xc/programs/xsm/log.h diff -u xc/programs/xsm/log.h:1.3 xc/programs/xsm/log.h:1.4 --- xc/programs/xsm/log.h:1.3 Sun Mar 7 09:23:40 1999 +++ xc/programs/xsm/log.h Wed Jan 17 18:46:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: log.h /main/2 1998/02/09 14:14:11 kaleb $ */ +/* $Xorg: log.h,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/log.h,v 1.3 1999/03/07 14:23:40 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/log.h,v 1.4 2001/01/17 23:46:29 dawes Exp $ */ extern void DisplayLogXtProc(Widget w, XtPointer client_data, XtPointer callData); Index: xc/programs/xsm/mainwin.c diff -u xc/programs/xsm/mainwin.c:1.3 xc/programs/xsm/mainwin.c:1.4 --- xc/programs/xsm/mainwin.c:1.3 Sun Mar 7 09:23:41 1999 +++ xc/programs/xsm/mainwin.c Wed Jan 17 18:46:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: mainwin.c /main/9 1998/02/09 14:14:16 kaleb $ */ +/* $Xorg: mainwin.c,v 1.3 2000/08/17 19:55:05 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/mainwin.c,v 1.3 1999/03/07 14:23:41 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/mainwin.c,v 1.4 2001/01/17 23:46:29 dawes Exp $ */ #include "xsm.h" #include "info.h" Index: xc/programs/xsm/mainwin.h diff -u xc/programs/xsm/mainwin.h:1.3 xc/programs/xsm/mainwin.h:1.4 --- xc/programs/xsm/mainwin.h:1.3 Sun Mar 7 09:23:41 1999 +++ xc/programs/xsm/mainwin.h Wed Jan 17 18:46:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: mainwin.h /main/2 1998/02/09 14:14:20 kaleb $ */ +/* $Xorg: mainwin.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,6 +19,6 @@ 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/xsm/mainwin.h,v 1.3 1999/03/07 14:23:41 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/mainwin.h,v 1.4 2001/01/17 23:46:29 dawes Exp $ */ extern void create_main_window(void); Index: xc/programs/xsm/misc.c diff -u xc/programs/xsm/misc.c:1.3 xc/programs/xsm/misc.c:1.4 --- xc/programs/xsm/misc.c:1.3 Sun Mar 7 09:23:41 1999 +++ xc/programs/xsm/misc.c Wed Jan 17 18:46:29 2001 @@ -1,4 +1,4 @@ -/* $TOG: misc.c /main/6 1998/02/09 14:14:24 kaleb $ */ +/* $Xorg: misc.c,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/misc.c,v 1.3 1999/03/07 14:23:41 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/misc.c,v 1.4 2001/01/17 23:46:29 dawes Exp $ */ #include "xsm.h" Index: xc/programs/xsm/popup.c diff -u xc/programs/xsm/popup.c:1.3 xc/programs/xsm/popup.c:1.4 --- xc/programs/xsm/popup.c:1.3 Sun Mar 7 09:23:41 1999 +++ xc/programs/xsm/popup.c Wed Jan 17 18:46:30 2001 @@ -1,4 +1,4 @@ -/* $TOG: popup.c /main/3 1998/02/09 14:14:29 kaleb $ */ +/* $Xorg: popup.c,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /* @@ -23,7 +23,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xsm/popup.c,v 1.3 1999/03/07 14:23:41 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/popup.c,v 1.4 2001/01/17 23:46:30 dawes Exp $ */ #include "xsm.h" #include Index: xc/programs/xsm/popup.h diff -u xc/programs/xsm/popup.h:1.3 xc/programs/xsm/popup.h:1.4 --- xc/programs/xsm/popup.h:1.3 Sun Mar 7 09:23:42 1999 +++ xc/programs/xsm/popup.h Wed Jan 17 18:46:30 2001 @@ -1,4 +1,4 @@ -/* $TOG: popup.h /main/2 1998/02/09 14:14:33 kaleb $ */ +/* $Xorg: popup.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /* @@ -23,7 +23,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xsm/popup.h,v 1.3 1999/03/07 14:23:42 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/popup.h,v 1.4 2001/01/17 23:46:30 dawes Exp $ */ extern void PopupPopup(Widget parent, Widget popup, Bool transient, Bool first_time, int offset_x, int offset_y, Index: xc/programs/xsm/printhex.c diff -u xc/programs/xsm/printhex.c:1.1.1.2 xc/programs/xsm/printhex.c:1.1.1.3 --- xc/programs/xsm/printhex.c:1.1.1.2 Sun Sep 27 04:57:59 1998 +++ xc/programs/xsm/printhex.c Tue Jan 16 18:04:54 2001 @@ -1,4 +1,4 @@ -/* $TOG: printhex.c /main/3 1998/02/09 14:14:37 kaleb $ */ +/* $Xorg: printhex.c,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group Index: xc/programs/xsm/prop.c diff -u xc/programs/xsm/prop.c:1.3 xc/programs/xsm/prop.c:1.4 --- xc/programs/xsm/prop.c:1.3 Sun Mar 7 09:23:42 1999 +++ xc/programs/xsm/prop.c Wed Jan 17 18:46:30 2001 @@ -1,4 +1,4 @@ -/* $TOG: prop.c /main/7 1998/02/09 14:14:41 kaleb $ */ +/* $Xorg: prop.c,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/prop.c,v 1.3 1999/03/07 14:23:42 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/prop.c,v 1.4 2001/01/17 23:46:30 dawes Exp $ */ #include "xsm.h" #include "info.h" Index: xc/programs/xsm/prop.h diff -u xc/programs/xsm/prop.h:1.3 xc/programs/xsm/prop.h:1.4 --- xc/programs/xsm/prop.h:1.3 Sun Mar 7 09:23:42 1999 +++ xc/programs/xsm/prop.h Wed Jan 17 18:46:30 2001 @@ -1,4 +1,4 @@ -/* $TOG: prop.h /main/2 1998/02/09 14:14:46 kaleb $ */ +/* $Xorg: prop.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/prop.h,v 1.3 1999/03/07 14:23:42 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/prop.h,v 1.4 2001/01/17 23:46:30 dawes Exp $ */ extern void FreePropValues(List *propValues); extern void FreeProp(Prop *prop); Index: xc/programs/xsm/remote.c diff -u xc/programs/xsm/remote.c:1.3 xc/programs/xsm/remote.c:1.4 --- xc/programs/xsm/remote.c:1.3 Sun Mar 7 09:23:42 1999 +++ xc/programs/xsm/remote.c Wed Jan 17 18:46:30 2001 @@ -1,4 +1,4 @@ -/* $TOG: remote.c /main/16 1998/02/09 14:14:54 kaleb $ */ +/* $Xorg: remote.c,v 1.4 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/remote.c,v 1.3 1999/03/07 14:23:42 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/remote.c,v 1.4 2001/01/17 23:46:30 dawes Exp $ */ /* * We use the rstart protocol to restart clients on remote machines. Index: xc/programs/xsm/restart.c diff -u xc/programs/xsm/restart.c:1.4 xc/programs/xsm/restart.c:1.5 --- xc/programs/xsm/restart.c:1.4 Sun Mar 28 11:27:18 1999 +++ xc/programs/xsm/restart.c Wed Jan 17 18:46:30 2001 @@ -1,4 +1,4 @@ -/* $TOG: restart.c /main/27 1998/02/09 14:14:58 kaleb $ */ +/* $Xorg: restart.c,v 1.4 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/restart.c,v 1.4 1999/03/28 16:27:18 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/restart.c,v 1.5 2001/01/17 23:46:30 dawes Exp $ */ #include "xsm.h" #include "log.h" Index: xc/programs/xsm/restart.h diff -u xc/programs/xsm/restart.h:1.3 xc/programs/xsm/restart.h:1.4 --- xc/programs/xsm/restart.h:1.3 Sun Mar 7 09:23:43 1999 +++ xc/programs/xsm/restart.h Wed Jan 17 18:46:30 2001 @@ -1,4 +1,4 @@ -/* $TOG: restart.h /main/5 1998/02/09 14:15:07 kaleb $ */ +/* $Xorg: restart.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/restart.h,v 1.3 1999/03/07 14:23:43 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/restart.h,v 1.4 2001/01/17 23:46:30 dawes Exp $ */ extern Bool CheckIsManager(char *program); extern void GetRestartInfo(char *restart_service_prop, char *client_host_name, Index: xc/programs/xsm/save.c diff -u xc/programs/xsm/save.c:3.2 xc/programs/xsm/save.c:3.3 --- xc/programs/xsm/save.c:3.2 Sun Mar 7 06:41:29 1999 +++ xc/programs/xsm/save.c Wed Jan 17 18:46:30 2001 @@ -1,4 +1,4 @@ -/* $TOG: save.c /main/20 1998/02/09 14:15:24 kaleb $ */ +/* $Xorg: save.c,v 1.4 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/save.c,v 3.2 1999/03/07 11:41:29 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/save.c,v 3.3 2001/01/17 23:46:30 dawes Exp $ */ #include "xsm.h" #include "save.h" Index: xc/programs/xsm/save.h diff -u xc/programs/xsm/save.h:1.3 xc/programs/xsm/save.h:1.4 --- xc/programs/xsm/save.h:1.3 Sun Mar 7 09:23:43 1999 +++ xc/programs/xsm/save.h Wed Jan 17 18:46:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: save.h /main/5 1998/02/09 14:15:33 kaleb $ */ +/* $Xorg: save.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/save.h,v 1.3 1999/03/07 14:23:43 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/save.h,v 1.4 2001/01/17 23:46:31 dawes Exp $ */ extern void DoSave(int saveType, int interactStyle, Bool fast); extern void LetClientInteract(List *cl); Index: xc/programs/xsm/saveutil.c diff -u xc/programs/xsm/saveutil.c:1.4 xc/programs/xsm/saveutil.c:1.5 --- xc/programs/xsm/saveutil.c:1.4 Sun Mar 28 10:33:12 1999 +++ xc/programs/xsm/saveutil.c Wed Jan 17 18:46:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: saveutil.c /main/32 1998/02/09 14:15:13 kaleb $ */ +/* $Xorg: saveutil.c,v 1.4 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/saveutil.c,v 1.4 1999/03/28 15:33:12 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/saveutil.c,v 1.5 2001/01/17 23:46:31 dawes Exp $ */ #include "xsm.h" #include "log.h" Index: xc/programs/xsm/saveutil.h diff -u xc/programs/xsm/saveutil.h:1.4 xc/programs/xsm/saveutil.h:1.5 --- xc/programs/xsm/saveutil.h:1.4 Sun Mar 28 10:33:12 1999 +++ xc/programs/xsm/saveutil.h Wed Jan 17 18:46:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: saveutil.h /main/4 1998/02/09 14:15:19 kaleb $ */ +/* $Xorg: saveutil.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/saveutil.h,v 1.4 1999/03/28 15:33:12 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/saveutil.h,v 1.5 2001/01/17 23:46:31 dawes Exp $ */ extern void set_session_save_file_name(char *session_name); extern int ReadSave(char *session_name, char **sm_id); Index: xc/programs/xsm/signals.c diff -u xc/programs/xsm/signals.c:3.1 xc/programs/xsm/signals.c:3.2 --- xc/programs/xsm/signals.c:3.1 Sun Oct 4 05:41:59 1998 +++ xc/programs/xsm/signals.c Wed Jan 17 18:46:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: signals.c /main/5 1998/02/09 14:15:39 kaleb $ */ +/* $Xorg: signals.c,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1994, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/signals.c,v 3.1 1998/10/04 09:41:59 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/signals.c,v 3.2 2001/01/17 23:46:31 dawes Exp $ */ #include #include Index: xc/programs/xsm/system.xsm diff -u xc/programs/xsm/system.xsm:1.1.1.1 xc/programs/xsm/system.xsm:1.1.1.2 --- xc/programs/xsm/system.xsm:1.1.1.1 Wed Jan 3 02:41:22 1996 +++ xc/programs/xsm/system.xsm Tue Jan 16 18:05:12 2001 @@ -1,4 +1,4 @@ -! $XConsortium: system.xsm,v 1.5 94/12/27 17:57:25 mor Exp $ +! $Xorg: system.xsm,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ twm smproxy xterm Index: xc/programs/xsm/xsm.c diff -u xc/programs/xsm/xsm.c:1.6 xc/programs/xsm/xsm.c:1.7 --- xc/programs/xsm/xsm.c:1.6 Sun Aug 1 03:57:34 1999 +++ xc/programs/xsm/xsm.c Wed Jan 17 18:46:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: xsm.c /main/79 1998/02/09 14:15:54 kaleb $ */ +/* $Xorg: xsm.c,v 1.6 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/xsm.c,v 1.6 1999/08/01 07:57:34 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/xsm.c,v 1.7 2001/01/17 23:46:31 dawes Exp $ */ /* * X Session Manager. Index: xc/programs/xsm/xsm.h diff -u xc/programs/xsm/xsm.h:1.3 xc/programs/xsm/xsm.h:1.4 --- xc/programs/xsm/xsm.h:1.3 Sun Mar 7 09:23:44 1999 +++ xc/programs/xsm/xsm.h Wed Jan 17 18:46:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: xsm.h /main/38 1998/02/09 14:16:04 kaleb $ */ +/* $Xorg: xsm.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/xsm.h,v 1.3 1999/03/07 14:23:44 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/xsm.h,v 1.4 2001/01/17 23:46:31 dawes Exp $ */ #include #include Index: xc/programs/xsm/xsm.man diff -u xc/programs/xsm/xsm.man:1.4 xc/programs/xsm/xsm.man:1.6 --- xc/programs/xsm/xsm.man:1.4 Sun Oct 4 05:42:00 1998 +++ xc/programs/xsm/xsm.man Sat Jan 27 13:21:24 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xsm.man /main/16 1998/02/09 14:16:09 kaleb $ +.\" $Xorg: xsm.man,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ .\" Copyright 1994,1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XSM 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xsm/xsm.man,v 1.6 2001/01/27 18:21:24 dawes Exp $ +.\" +.TH XSM 1 __xorgversion__ .SH NAME xsm \- X Session Manager .SH SYNOPSIS Index: xc/programs/xsm/xtwatch.c diff -u xc/programs/xsm/xtwatch.c:1.3 xc/programs/xsm/xtwatch.c:1.4 --- xc/programs/xsm/xtwatch.c:1.3 Sun Mar 7 09:23:44 1999 +++ xc/programs/xsm/xtwatch.c Wed Jan 17 18:46:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: xtwatch.c /main/9 1998/02/09 14:16:15 kaleb $ */ +/* $Xorg: xtwatch.c,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,7 +19,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. ******************************************************************************/ -/* $XFree86: xc/programs/xsm/xtwatch.c,v 1.3 1999/03/07 14:23:44 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/xtwatch.c,v 1.4 2001/01/17 23:46:31 dawes Exp $ */ #include #include Index: xc/programs/xsm/xtwatch.h diff -u xc/programs/xsm/xtwatch.h:1.3 xc/programs/xsm/xtwatch.h:1.4 --- xc/programs/xsm/xtwatch.h:1.3 Sun Mar 7 09:23:45 1999 +++ xc/programs/xsm/xtwatch.h Wed Jan 17 18:46:31 2001 @@ -1,4 +1,4 @@ -/* $TOG: xtwatch.h /main/2 1998/02/09 14:16:20 kaleb $ */ +/* $Xorg: xtwatch.h,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ */ /****************************************************************************** Copyright 1993, 1998 The Open Group @@ -19,6 +19,6 @@ 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/xsm/xtwatch.h,v 1.3 1999/03/07 14:23:45 dawes Exp $ */ +/* $XFree86: xc/programs/xsm/xtwatch.h,v 1.4 2001/01/17 23:46:31 dawes Exp $ */ extern Status InitWatchProcs(XtAppContext appContext); Index: xc/programs/xstdcmap/Imakefile diff -u xc/programs/xstdcmap/Imakefile:1.1.1.1 xc/programs/xstdcmap/Imakefile:1.1.1.2 --- xc/programs/xstdcmap/Imakefile:1.1.1.1 Wed Apr 27 03:20:27 1994 +++ xc/programs/xstdcmap/Imakefile Tue Jan 16 18:05:20 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile,v 1.5 91/07/19 14:59:10 rws Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ DEPLIBS = $(DEPXMULIB) $(DEPXLIB) LOCAL_LIBRARIES = $(XMULIB) $(XLIB) SRCS = xstdcmap.c Index: xc/programs/xstdcmap/xstdcmap.c diff -u xc/programs/xstdcmap/xstdcmap.c:1.4 xc/programs/xstdcmap/xstdcmap.c:1.6 --- xc/programs/xstdcmap/xstdcmap.c:1.4 Sun Jun 27 10:08:34 1999 +++ xc/programs/xstdcmap/xstdcmap.c Sun Apr 1 10:00:24 2001 @@ -1,5 +1,5 @@ /* - * $TOG: xstdcmap.c /main/11 1998/02/09 14:16:26 kaleb $ + * $Xorg: xstdcmap.c,v 1.4 2000/08/17 19:55:06 cpqbld Exp $ * * Copyright 1989, 1998 The Open Group @@ -22,9 +22,10 @@ * * * Author: Donna Converse, MIT X Consortium */ -/* $XFree86: xc/programs/xstdcmap/xstdcmap.c,v 1.4 1999/06/27 14:08:34 dawes Exp $ */ +/* $XFree86: xc/programs/xstdcmap/xstdcmap.c,v 1.6 2001/04/01 14:00:24 tsi Exp $ */ #include +#include #include #include #include Index: xc/programs/xstdcmap/xstdcmap.man diff -u xc/programs/xstdcmap/xstdcmap.man:1.4 xc/programs/xstdcmap/xstdcmap.man:1.7 --- xc/programs/xstdcmap/xstdcmap.man:1.4 Sun Oct 4 05:42:01 1998 +++ xc/programs/xstdcmap/xstdcmap.man Sat Jan 27 13:21:24 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xstdcmap.man /main/16 1998/02/09 14:16:31 kaleb $ +.\" $Xorg: xstdcmap.man,v 1.3 2000/08/17 19:55:06 cpqbld Exp $ .\" Copyright 1989, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,6 +18,9 @@ .\" 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/xstdcmap/xstdcmap.man,v 1.7 2001/01/27 18:21:24 dawes Exp $ +.\" .de EX \"Begin example .ne 5 .if n .sp 1 @@ -31,7 +34,7 @@ .if n .sp 1 .if t .sp .5 .. -.TH XSTDCMAP 1 "Release 6.4" "X Version 11" +.TH XSTDCMAP 1 __xorgversion__ .SH NAME xstdcmap - X standard colormap utility .SH SYNOPSIS @@ -72,7 +75,7 @@ \fImap\fP may be one of: default, best, red, green, blue, gray, or all. .TP 8 .B \-display \fIdisplay\fP -This option specifies the host and display to use; see \fIX(1)\fP. +This option specifies the host and display to use; see \fIX(__miscmansuffix__)\fP. .TP 8 .B \-gray This option indicates that the RGB_GRAY_MAP should be defined. @@ -99,7 +102,7 @@ .B DISPLAY to get default host and display number. .SH SEE ALSO -X(1) +X(__miscmansuffix__) .SH AUTHOR Donna Converse, MIT X Consortium Index: xc/programs/xterm/INSTALL diff -u xc/programs/xterm/INSTALL:3.22 xc/programs/xterm/INSTALL:3.23 --- xc/programs/xterm/INSTALL:3.22 Tue Oct 31 20:12:36 2000 +++ xc/programs/xterm/INSTALL Sun Mar 11 19:54:16 2001 @@ -1,4 +1,4 @@ --- $XFree86: xc/programs/xterm/INSTALL,v 3.22 2000/11/01 01:12:36 dawes Exp $ +-- $XFree86: xc/programs/xterm/INSTALL,v 3.23 2001/03/12 00:54:16 dickey Exp $ -- Thomas E. Dickey Xterm is normally built as part of the X Windows source tree, using @@ -92,6 +92,11 @@ Modify the generated Makefile so that most compiler options are not shown. This makes it simpler to read a build log and see the actual warning messages. + + --disable-freetype disable freetype library-support + + Do not use freetype libraries if they are found. Normally they will + be used automatically. --disable-highlighting disable support for color highlighting Index: xc/programs/xterm/Imakefile diff -u xc/programs/xterm/Imakefile:3.34 xc/programs/xterm/Imakefile:3.35.2.1 --- xc/programs/xterm/Imakefile:3.34 Thu Nov 30 11:08:22 2000 +++ xc/programs/xterm/Imakefile Mon May 28 02:53:37 2001 @@ -1,4 +1,4 @@ -XCOMM $TOG: Imakefile /main/68 1997/08/28 08:08:34 kaleb $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:07 cpqbld Exp $ XCOMM XCOMM Attention xterm porters XCOMM @@ -7,7 +7,7 @@ XCOMM bcopy (or memcpy) cannot, write a routine called bcopy and link it in XCOMM or add -Dbcopy=mybcopy to the DEFINES list below. XCOMM -XCOMM $XFree86: xc/programs/xterm/Imakefile,v 3.34 2000/11/30 16:08:22 dawes Exp $ +XCOMM $XFree86: xc/programs/xterm/Imakefile,v 3.35.2.1 2001/05/28 06:53:37 torrey Exp $ XCOMM /* Uncomment SCROLLBAR_RIGHT if you want the scroll bar to be on the right */ @@ -198,6 +198,16 @@ NormalProgramTarget(resize,$(OBJS2),$(DEPLIBS2),NullParameter,$(TERMCAPLIB)) InstallProgramWithFlags(resize,$(BINDIR),NullParameter) + +/* + * termcap is a special name that does not install correctly with + * InstallNamedNonExec() + */ +install:: + MakeDir($(DESTDIR)$(LIBDIR)/etc) + $(INSTALL) $(INSTALLFLAGS) $(INSTDATFLAGS) termcap \ + $(DESTDIR)$(LIBDIR)/etc/xterm.termcap +InstallNamedNonExec(terminfo,xterm.terminfo,$(LIBDIR)/etc) InstallAppDefaults(XTerm) InstallAppDefaultsLong(XTerm-col,XTerm-color) Index: xc/programs/xterm/MANIFEST diff -u xc/programs/xterm/MANIFEST:1.7 xc/programs/xterm/MANIFEST:1.10 --- xc/programs/xterm/MANIFEST:1.7 Fri Aug 25 17:51:07 2000 +++ xc/programs/xterm/MANIFEST Tue Mar 13 04:48:43 2001 @@ -1,4 +1,4 @@ -MANIFEST for xterm-141, version xterm-141 +MANIFEST for xterm-152, version xterm-152 -------------------------------------------------------------------------------- MANIFEST this file 256colres.h resource-definitions for 256-color mode @@ -50,9 +50,11 @@ make.com build-script for VMS port of 'xterm' menu.c popup/pulldown menus for 'xterm' menu.h interface of menu.c +minstall.sh script for installing manpages misc.c miscellaneous utility functions for 'xterm' mkdirs.sh configure script: make directories for install process os2main.c main program for OS/2 EMX port of 'xterm' +plink.sh script to prune unneeded libraries from link precompose.c table of precompose sequences precompose.h interface of precompose.c print.c VT100+ print support functions @@ -78,10 +80,13 @@ wcwidth.c wide-character utility functions wcwidth.h interface of wcwidth.c xcharmouse.h Jason Bacon's mouse-defs, cleaned up a little +xstrings.c a few common string functions +xstrings.h interface of xstrings.c xterm.dat application defaults for VMS port of 'xterm' xterm.h common includes, definitions and prototypes for 'xterm' xterm.man manual page for 'xterm' xterm_axp.opt linker options file for VMS port of 'xterm' +xterm_io.h split-out definitions of termio/termios/sgtty and winsize from main.c, os2main.c, screen.c and resize.c xtermcfg.hin configure script: template for xtermcfg.h tektests subdirectory tektests/aitest.tek tek4014 demo: draw a globe Index: xc/programs/xterm/Makefile.in diff -u xc/programs/xterm/Makefile.in:3.34 xc/programs/xterm/Makefile.in:3.37 --- xc/programs/xterm/Makefile.in:3.34 Wed Dec 6 05:19:43 2000 +++ xc/programs/xterm/Makefile.in Tue Mar 13 04:48:43 2001 @@ -1,4 +1,4 @@ -## $XFree86: xc/programs/xterm/Makefile.in,v 3.34 2000/12/06 10:19:43 dickey Exp $ ## +## $XFree86: xc/programs/xterm/Makefile.in,v 3.37 2001/03/13 09:48:43 dickey Exp $ ## SHELL = /bin/sh @@ -6,24 +6,25 @@ srcdir = @srcdir@ VPATH = @srcdir@ +x = #@PROG_EXT@ CC = @CC@ CPP = @CPP@ AWK = @AWK@ LINK = $(CC) $(CFLAGS) + INSTALL = @INSTALL@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ +transform = @program_transform_name@ -X_CFLAGS = @X_CFLAGS@ X_LIBS = @X_LIBS@ X_EXTRA_LIBS = @X_EXTRA_LIBS@ -IMAKE_CFLAGS = @IMAKE_CFLAGS@ EXTRA_CFLAGS = @EXTRA_CFLAGS@ EXTRA_LOADFLAGS = @IMAKE_LOADFLAGS@ -CPPFLAGS = -I. -I$(srcdir) -DHAVE_CONFIG_H $(X_CFLAGS) $(IMAKE_CFLAGS) @CPPFLAGS@ +CPPFLAGS = -I. -I$(srcdir) -DHAVE_CONFIG_H @CPPFLAGS@ CFLAGS = @CFLAGS@ $(EXTRA_CFLAGS) LDFLAGS = @LDFLAGS@ LIBS = @LIBS@ @@ -71,7 +72,7 @@ OBJS = $(OBJS1) $(OBJS2) HDRS = VTparse.h data.h error.h main.h menu.h proto.h \ ptyx.h version.h xstrings.h xterm.h $(EXTRAHDR) - PROGRAMS = xterm resize + PROGRAMS = xterm$x resize$x all: $(PROGRAMS) @@ -93,11 +94,11 @@ $(OBJS1) : ptyx.h xtermcfg.h main.o resize.o screen.o : xterm_io.h -xterm : $(OBJS1) +xterm$x : $(OBJS1) @ECHO_LD@$(LINK) $(LDFLAGS) -o $@ $(OBJS1) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS) $(EXTRA_LOADFLAGS) -resize : $(OBJS2) - @ECHO_LD@$(LINK) $(LDFLAGS) -o $@ $(OBJS2) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS) +resize$x : $(OBJS2) + @ECHO_LD@$(SHELL) $(srcdir)/plink.sh $(LINK) $(LDFLAGS) -o $@ $(OBJS2) $(X_LIBS) $(X_EXTRA_LIBS) $(LIBS) 256colres.h : $(srcdir)/256colres.pl -rm -f $@ @@ -109,6 +110,12 @@ charproc.o : main.h @CHARPROC_DEPS@ +TRANSFORM = sed 's/$x$$//'|sed '$(transform)'|sed 's/$$/$x/' +actual_xterm = `echo xterm| sed '$(transform)'` +actual_resize = `echo resize| sed '$(transform)'` +binary_xterm = `echo xterm$x| $(TRANSFORM)` +binary_resize = `echo resize$x| $(TRANSFORM)` + install \ install-bin \ install-man \ @@ -118,15 +125,15 @@ install \ install-bin \ -install-full :: xterm resize - $(srcdir)/sinstall.sh "$(INSTALL_PROGRAM)" xterm @XTERM_PATH@ $(BINDIR)/xterm - $(INSTALL_PROGRAM) -s -m 755 resize $(BINDIR)/resize +install-full :: xterm$x resize$x + $(SHELL) $(srcdir)/sinstall.sh "$(INSTALL_PROGRAM)" xterm$x @XTERM_PATH@ $(BINDIR)/$(binary_xterm) + $(INSTALL_PROGRAM) -s -m 755 resize$x $(BINDIR)/$(binary_resize) install \ install-man \ install-full :: - $(INSTALL_DATA) $(srcdir)/xterm.man $(MANDIR)/xterm.$(manext) - $(INSTALL_DATA) $(srcdir)/resize.man $(MANDIR)/resize.$(manext) + $(SHELL) $(srcdir)/minstall.sh "$(INSTALL_DATA)" $(srcdir)/xterm.man $(MANDIR)/$(actual_xterm).$(manext) + $(SHELL) $(srcdir)/minstall.sh "$(INSTALL_DATA)" $(srcdir)/resize.man $(MANDIR)/$(actual_resize).$(manext) install \ install-app \ @@ -158,10 +165,10 @@ installdirs: $(INSTALL_DIRS) uninstall: - -$(RM) $(BINDIR)/xterm - -$(RM) $(BINDIR)/resize - -$(RM) $(MANDIR)/xterm.$(manext) - -$(RM) $(MANDIR)/resize.$(manext) + -$(RM) $(BINDIR)/$(binary_xterm) + -$(RM) $(BINDIR)/$(binary_resize) + -$(RM) $(MANDIR)/$(actual_xterm).$(manext) + -$(RM) $(MANDIR)/$(actual_resize).$(manext) -$(RM) $(APPSDIR)/$(CLASS) -$(RM) $(APPSDIR)/$(CLASS)-color Index: xc/programs/xterm/TekPrsTbl.c diff -u xc/programs/xterm/TekPrsTbl.c:3.2 xc/programs/xterm/TekPrsTbl.c:3.3 --- xc/programs/xterm/TekPrsTbl.c:3.2 Sun Oct 25 07:48:07 1998 +++ xc/programs/xterm/TekPrsTbl.c Wed Jan 17 18:46:33 2001 @@ -1,5 +1,5 @@ /* - * $XConsortium: TekPrsTbl.c,v 1.8 95/06/08 23:20:39 gildea Exp $ + * $Xorg: TekPrsTbl.c,v 1.3 2000/08/17 19:55:07 cpqbld Exp $ */ @@ -25,7 +25,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/programs/xterm/TekPrsTbl.c,v 3.2 1998/10/25 12:48:07 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/TekPrsTbl.c,v 3.3 2001/01/17 23:46:33 dawes Exp $ */ #include Index: xc/programs/xterm/Tekparse.def diff -u xc/programs/xterm/Tekparse.def:1.1.1.1 xc/programs/xterm/Tekparse.def:1.1.1.2 --- xc/programs/xterm/Tekparse.def:1.1.1.1 Wed Apr 27 03:12:33 1994 +++ xc/programs/xterm/Tekparse.def Tue Jan 16 18:05:26 2001 @@ -1,5 +1,5 @@ # -# $XConsortium: Tekparse.def,v 1.2 88/09/06 14:35:12 jim Exp $ +# $Xorg: Tekparse.def,v 1.3 2000/08/17 19:55:07 cpqbld Exp $ # # List of symbols that need to be defined for Tekparse.h. If you need to # change any of the CASE_ macros, make the change here and rerun the command Index: xc/programs/xterm/Tekparse.h diff -u xc/programs/xterm/Tekparse.h:1.3 xc/programs/xterm/Tekparse.h:1.4 --- xc/programs/xterm/Tekparse.h:1.3 Sun Oct 25 07:48:08 1998 +++ xc/programs/xterm/Tekparse.h Wed Jan 17 18:46:34 2001 @@ -1,5 +1,5 @@ /* - * $XConsortium: Tekparse.h,v 1.4 91/01/06 12:46:47 rws Exp $ + * $Xorg: Tekparse.h,v 1.3 2000/08/17 19:55:07 cpqbld Exp $ */ /* @@ -24,7 +24,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/programs/xterm/Tekparse.h,v 1.3 1998/10/25 12:48:08 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/Tekparse.h,v 1.4 2001/01/17 23:46:34 dawes Exp $ */ /* @(#)Tekparse.h X10/6.6 11/7/86 */ Index: xc/programs/xterm/Tekproc.c diff -u xc/programs/xterm/Tekproc.c:3.30 xc/programs/xterm/Tekproc.c:3.33 --- xc/programs/xterm/Tekproc.c:3.30 Fri Mar 31 15:13:41 2000 +++ xc/programs/xterm/Tekproc.c Wed Apr 11 21:02:49 2001 @@ -1,9 +1,9 @@ /* - * $XConsortium: Tekproc.c /main/120 1996/11/29 10:33:20 swick $ - * $XFree86: xc/programs/xterm/Tekproc.c,v 3.30 2000/03/31 20:13:41 dawes Exp $ + * $Xorg: Tekproc.c,v 1.4 2000/08/17 19:55:07 cpqbld Exp $ * * Warning, there be crufty dragons here. */ +/* $XFree86: xc/programs/xterm/Tekproc.c,v 3.33 2001/04/12 01:02:49 dickey Exp $ */ /* @@ -58,7 +58,6 @@ #include -#include #include #include #include @@ -78,10 +77,6 @@ #include #include #include - -#ifndef X_NOT_STDC_ENV -#include -#endif #ifdef MINIX #include Index: xc/programs/xterm/VTPrsTbl.c diff -u xc/programs/xterm/VTPrsTbl.c:3.22 xc/programs/xterm/VTPrsTbl.c:3.23 --- xc/programs/xterm/VTPrsTbl.c:3.22 Mon Jun 12 22:28:37 2000 +++ xc/programs/xterm/VTPrsTbl.c Wed Jan 17 18:46:34 2001 @@ -1,8 +1,8 @@ /* - * $XConsortium: VTPrsTbl.c,v 1.10 95/06/09 22:17:06 gildea Exp $ - * $XFree86: xc/programs/xterm/VTPrsTbl.c,v 3.22 2000/06/13 02:28:37 dawes Exp $ + * $Xorg: VTPrsTbl.c,v 1.3 2000/08/17 19:55:07 cpqbld Exp $ */ +/* $XFree86: xc/programs/xterm/VTPrsTbl.c,v 3.23 2001/01/17 23:46:34 dawes Exp $ */ /* * * Copyright 1999-2000 by Thomas E. Dickey Index: xc/programs/xterm/VTparse.def diff -u xc/programs/xterm/VTparse.def:3.11 xc/programs/xterm/VTparse.def:3.12 --- xc/programs/xterm/VTparse.def:3.11 Mon Sep 27 02:30:11 1999 +++ xc/programs/xterm/VTparse.def Wed Jan 17 18:46:34 2001 @@ -1,10 +1,11 @@ # -# $XConsortium: VTparse.def,v 1.4 92/09/15 15:28:31 gildea Exp $ -# $XFree86: xc/programs/xterm/VTparse.def,v 3.11 1999/09/27 06:30:11 dawes Exp $ +# $Xorg: VTparse.def,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ # # List of symbols that need to be defined for VTparse.h. If you need to # change any of the CASE_ macros, make the change here and rerun the command # shown in VTparse.h. +# +# $XFree86: xc/programs/xterm/VTparse.def,v 3.12 2001/01/17 23:46:34 dawes Exp $ # CASE_GROUND_STATE Index: xc/programs/xterm/VTparse.h diff -u xc/programs/xterm/VTparse.h:3.14 xc/programs/xterm/VTparse.h:3.15 --- xc/programs/xterm/VTparse.h:3.14 Mon Jan 24 17:21:52 2000 +++ xc/programs/xterm/VTparse.h Wed Jan 17 18:46:34 2001 @@ -1,8 +1,8 @@ /* - * $XConsortium: VTparse.h,v 1.6 92/09/15 15:28:31 gildea Exp $ - * $XFree86: xc/programs/xterm/VTparse.h,v 3.14 2000/01/24 22:21:52 dawes Exp $ + * $Xorg: VTparse.h,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ +/* $XFree86: xc/programs/xterm/VTparse.h,v 3.15 2001/01/17 23:46:34 dawes Exp $ */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * Index: xc/programs/xterm/XTerm.ad diff -u xc/programs/xterm/XTerm.ad:3.17 xc/programs/xterm/XTerm.ad:3.19 --- xc/programs/xterm/XTerm.ad:3.17 Tue Jun 13 20:16:17 2000 +++ xc/programs/xterm/XTerm.ad Wed Jan 17 18:46:34 2001 @@ -1,9 +1,9 @@ -! $XConsortium: XTerm.ad /main/35 1996/12/03 16:44:38 swick $ +! $Xorg: XTerm.ad,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ ! ! ! ! -! $XFree86: xc/programs/xterm/XTerm.ad,v 3.17 2000/06/14 00:16:17 dawes Exp $ +! $XFree86: xc/programs/xterm/XTerm.ad,v 3.19 2001/01/17 23:46:34 dawes Exp $ XTerm.JoinSession:False @@ -53,6 +53,7 @@ *vtMenu*allow132*Label: Allow 80/132 Column Switching *vtMenu*cursesemul*Label: Enable Curses Emulation *vtMenu*visualbell*Label: Enable Visual Bell +*vtMenu*poponbell*Label: Enable Pop on Bell *vtMenu*marginbell*Label: Enable Margin Bell *vtMenu*cursorblink*Label: Enable Blinking Cursor *vtMenu*titeInhibit*Label: Enable Alternate Screen Switching Index: xc/programs/xterm/aclocal.m4 diff -u xc/programs/xterm/aclocal.m4:3.37 xc/programs/xterm/aclocal.m4:3.40 --- xc/programs/xterm/aclocal.m4:3.37 Wed Dec 6 21:22:12 2000 +++ xc/programs/xterm/aclocal.m4 Sat Apr 28 09:51:55 2001 @@ -1,9 +1,9 @@ dnl -dnl $XFree86: xc/programs/xterm/aclocal.m4,v 3.37 2000/12/07 02:22:12 dickey Exp $ +dnl $XFree86: xc/programs/xterm/aclocal.m4,v 3.40 2001/04/28 13:51:55 dickey Exp $ dnl dnl --------------------------------------------------------------------------- dnl -dnl Copyright 1997-2000 by Thomas E. Dickey +dnl Copyright 1997-2001 by Thomas E. Dickey dnl dnl All Rights Reserved dnl @@ -32,8 +32,14 @@ for cf_add_cflags in $1 do case $cf_add_cflags in #(vi - -I*|-D*|-U*|-E|-P|-C) #(vi - CPPFLAGS="$CPPFLAGS $cf_add_cflags" + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case "$CPPFLAGS" in + *$cf_add_cflags) + ;; + *) + CPPFLAGS="$CPPFLAGS $cf_add_cflags" + ;; + esac ;; *) CFLAGS="$CFLAGS $cf_add_cflags" @@ -87,7 +93,7 @@ if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then - CFLAGS="$CFLAGS $cf_cv_ansi_cc" + CF_ADD_CFLAGS($cf_cv_ansi_cc) else AC_DEFINE(CC_HAS_PROTOS) fi @@ -385,7 +391,6 @@ if test "$GCC" = yes then AC_CHECKING([for $CC __attribute__ directives]) - changequote(,)dnl cat > conftest.$ac_ext < conftest.$ac_ext <./Imakefile test -f $cf_makefile && cat $cf_makefile >>./Imakefile @@ -931,9 +934,7 @@ dnl $1=uppercase($2) AC_DEFUN([CF_UPPER], [ -changequote(,)dnl $1=`echo "$2" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -changequote([,])dnl ])dnl dnl --------------------------------------------------------------------------- dnl Try to link with utempter library @@ -1206,6 +1207,31 @@ AC_DEFINE_UNQUOTED($CF_X_ATHENA_LIBS) ])dnl dnl --------------------------------------------------------------------------- +dnl Check for X freetype libraries (XFree86 4.x) +AC_DEFUN([CF_X_FREETYPE], +[ +cf_freetype_libs="-lXft -lfreetype -lXrender -lXrender" +AC_CACHE_CHECK(for X FreeType libraries,cf_cv_x_freetype,[ + +cf_save_LIBS="$LIBS" +LIBS="$cf_freetype_libs $LIBS" + +AC_TRY_LINK([ +#include +#include +#include ],[ + XftPattern *pat = XftNameParse ("name"); + ],[cf_cv_x_freetype=yes],[cf_cv_x_freetype=no]) + LIBS="$cf_save_LIBS" +]) +if test "$cf_cv_x_freetype" = yes ; then + LIBS="$cf_freetype_libs $LIBS" + AC_DEFINE(XRENDERFONT) +else + CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` +fi +]) +dnl --------------------------------------------------------------------------- dnl Check for X Toolkit libraries dnl AC_DEFUN([CF_X_TOOLKIT], @@ -1218,9 +1244,7 @@ SYSTEM_NAME=`echo "$cf_cv_system_name"|tr ' ' -` cf_have_X_LIBS=no case $SYSTEM_NAME in -changequote(,)dnl -irix[56]*) ;; -changequote([,])dnl +irix[[56]]*) ;; clix*) # FIXME: modify the library lookup in autoconf to # allow _s.a suffix ahead of .a @@ -1246,7 +1270,7 @@ if test $cf_have_X_LIBS = no ; then AC_PATH_XTRA LDFLAGS="$LDFLAGS $X_LIBS" - CFLAGS="$CFLAGS $X_CFLAGS" + CF_ADD_CFLAGS($X_CFLAGS) AC_CHECK_LIB(X11,XOpenDisplay, [LIBS="-lX11 $LIBS"],, [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS]) @@ -1257,7 +1281,7 @@ [$X_PRE_LIBS $LIBS $X_EXTRA_LIBS]) else LDFLAGS="$LDFLAGS $X_LIBS" - CFLAGS="$CFLAGS $X_CFLAGS" + CF_ADD_CFLAGS($X_CFLAGS) fi if test $cf_have_X_LIBS = no ; then Index: xc/programs/xterm/button.c diff -u xc/programs/xterm/button.c:3.52 xc/programs/xterm/button.c:3.61 --- xc/programs/xterm/button.c:3.52 Tue Nov 28 18:07:33 2000 +++ xc/programs/xterm/button.c Sat Apr 28 09:51:55 2001 @@ -1,4 +1,4 @@ -/* $TOG: button.c /main/76 1997/07/30 16:56:19 kaleb $ */ +/* $Xorg: button.c,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ /* * Copyright 1999-2000 by Thomas E. Dickey * @@ -50,7 +50,7 @@ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS * SOFTWARE. */ -/* $XFree86: xc/programs/xterm/button.c,v 3.52 2000/11/28 23:07:33 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/button.c,v 3.61 2001/04/28 13:51:55 dickey Exp $ */ /* button.c Handles button events in the terminal emulator. @@ -61,14 +61,9 @@ #include -#include - #include - -#ifdef MINIX -#include -#endif +#include #include #include @@ -103,9 +98,9 @@ #define KeyState(x) (((x) & (ShiftMask|ControlMask)) + (((x) & Mod1Mask) ? 2 : 0)) /* adds together the bits: - shift key -> 1 - meta key -> 2 - control key -> 4 */ + shift key -> 1 + meta key -> 2 + control key -> 4 */ #define Coordinate(r,c) ((r) * (term->screen.max_col+1) + (c)) @@ -468,8 +463,8 @@ Window root, child; int rx, ry, x, y; unsigned int mask; - int row, col; - Boolean oor; + int row = 0, col = 0; + Boolean oor = 0; Bool ret; int state; @@ -769,7 +764,6 @@ do_select_end (w, event, params, num_params, True); } -#if OPT_WIDE_CHARS #ifndef X_HAVE_UTF8_STRING static Atom XA_UTF8_STRING(Display *dpy) { @@ -780,12 +774,11 @@ return XmuInternAtom(dpy, p); } #endif -#endif struct _SelectionList { String *params; Cardinal count; - Bool utf8_failed; /* only used for UTF-8, but a nuisance to ifdef */ + Atom *targets; Time time; }; @@ -793,7 +786,7 @@ * by `#'. */ #if OPT_WIDE_CHARS -static XtPointer +static Char * UTF8toLatin1(Char *s, int len, unsigned long *result) { static Char *buffer; @@ -830,16 +823,25 @@ } } *result = q - buffer; - return (XtPointer)buffer; + return buffer; } /* Convert a Latin-1 string to UTF-8 */ -static int -Latin1toUTF8(Char *t, Char *s, int len) +static Char * +Latin1toUTF8(Char *s, int len, int *len_return) { Char *p = s; - Char *q = t; + Char *t; + Char *q; + + t = (Char *)XtMalloc(2 * len); + if (t == 0) { + TRACE(("Couldn't allocate target string\n")); + return 0; + } + q = t; + while (p < s + len) { if ((*p & 0x80) == 0) { *q++ = *p++; @@ -849,20 +851,30 @@ p++; } } - return q - t; + + *len_return = q - t; + return t; } /* Eliminate all control characters from a UTF-8 string, doing something reasonable with PS and LS */ -static int -filterUTF8(Char *t, Char *s, int len) +static Char* +filterUTF8(Char *s, int len, int *len_return) { Char *p=s; - Char *q=t; + Char *t; + Char *q; unsigned codepoint; int size; + t = (Char *)XtMalloc(len); + if (t == 0) { + TRACE(("Couldn't allocate target string\n")); + return 0; + } + q = t; + while (p < (s + len) && q < (t + len)) { if ((*p & 0x80) == 0) { codepoint = *p & 0x7F; @@ -909,19 +921,144 @@ *q++ = *p++; } } - return q - t; + *len_return = q - t; + return t; } #endif /* OPT_WIDE_CHARS */ +#if OPT_WIDE_CHARS +static Status +XTextPropertyToStringListUnchecked(XTextProperty *tp, + char ***list_return, + int *count_return) +{ + char **list; /* return value */ + int nelements; /* return value */ + register char *cp; /* temp variable */ + char *start; /* start of thing to copy */ + int i, j; /* iterator variables */ + int datalen = (int) tp->nitems; /* for convenience */ + + if (datalen == 0) { + *list_return = NULL; + *count_return = 0; + return True; + } + + /* + * walk the list to figure out how many elements there are + */ + nelements = 1; /* since null-separated */ + for (cp = (char *) tp->value, i = datalen; i > 0; cp++, i--) { + if (*cp == '\0') nelements++; + } + + /* + * allocate list and duplicate + */ + list = (char **) XtMalloc (nelements * sizeof (char *)); + if (!list) return False; + + start = (char *) XtMalloc ((datalen + 1) * sizeof (char)); /* for */ + if (!start) { + XtFree ((char *) list); + return False; + } + + /* + * copy data + */ + memcpy (start, (char *) tp->value, tp->nitems); + start[datalen] = '\0'; + + /* + * walk down list setting value + */ + for (cp = start, i = datalen + 1, j = 0; i > 0; cp++, i--) { + if (*cp == '\0') { + list[j] = start; + start = (cp + 1); + j++; + } + } + + /* + * append final null pointer and then return data + */ + *list_return = list; + *count_return = nelements; + return True; +} +#endif + +static Atom * +_SelectionTargets(Widget w) +{ + static Atom *eightBitSelectionTargets = NULL; + TScreen *screen; + int n; + + if(!IsXtermWidget(w)) + return NULL; + + screen = &((XtermWidget)w)->screen; + +#if OPT_WIDE_CHARS + if (screen->wide_chars) { + static Atom *utf8SelectionTargets = NULL; + + if (utf8SelectionTargets == NULL) { + utf8SelectionTargets = (Atom*)XtMalloc(5 * sizeof(Atom)); + if (utf8SelectionTargets == NULL) { + TRACE(("Couldn't allocate utf8SelectionTargets\n")); + return NULL; + } + n = 0; + utf8SelectionTargets[n] = XA_UTF8_STRING(XtDisplay(w)); n++; +#if OPT_USE_UTF8_API + if (screen->i18nSelections) { + utf8SelectionTargets[n] = XA_TEXT(XtDisplay(w)); n++; + utf8SelectionTargets[n] = XA_COMPOUND_TEXT(XtDisplay(w)); n++; + } +#endif + utf8SelectionTargets[n] = XA_STRING; n++; + utf8SelectionTargets[n] = None; + } + return utf8SelectionTargets; + } +#endif + + /* not screen->wide_chars */ + if (eightBitSelectionTargets == NULL) { + eightBitSelectionTargets = (Atom*)XtMalloc(5 * sizeof(Atom)); + if (eightBitSelectionTargets == NULL) { + TRACE(("Couldn't allocate eightBitSelectionTargets\n")); + return NULL; + } + n = 0; +#if OPT_USE_UTF8_API + eightBitSelectionTargets[n] = XA_UTF8_STRING(XtDisplay(w)); n++; +#endif + if (screen->i18nSelections) { + eightBitSelectionTargets[n] = XA_TEXT(XtDisplay(w)); n++; + eightBitSelectionTargets[n] = XA_COMPOUND_TEXT(XtDisplay(w)); n++; + } + eightBitSelectionTargets[n] = XA_STRING; n++; + eightBitSelectionTargets[n] = None; + } + return eightBitSelectionTargets; +} + static void _GetSelection( Widget w, Time ev_time, String *params, /* selections in precedence order */ Cardinal num_params, - Bool utf8_failed GCC_UNUSED) /* already tried UTF-8 */ + Atom *targets) { Atom selection; int cutbuffer; + Atom target; if (!IsXtermWidget(w)) return; @@ -939,7 +1076,8 @@ case XA_CUT_BUFFER7: cutbuffer = 7; break; default: cutbuffer = -1; } - TRACE(("Cutbuffer: %d, utf8_failed: %d\n", cutbuffer, utf8_failed)); + TRACE(("Cutbuffer: %d, target: %lu\n", cutbuffer, + (unsigned long)targets[0])); if (cutbuffer >= 0) { int inbytes; unsigned long nbytes; @@ -951,47 +1089,44 @@ SelectionReceived(w, NULL, &selection, &type, (XtPointer)line, &nbytes, &fmt8); else if (num_params > 1) - _GetSelection(w, ev_time, params+1, num_params-1, False); + _GetSelection(w, ev_time, params+1, num_params-1, NULL); + return; } else { struct _SelectionList* list; -#if OPT_WIDE_CHARS - TScreen *screen = &((XtermWidget)w)->screen; - if (!screen->wide_chars || utf8_failed) { + + if (targets == NULL || targets[0] == None) { + targets = _SelectionTargets(w); + } + + target = targets[0]; + + if (targets[1] == None) { /* last target in list */ params++; num_params--; - utf8_failed = False; + targets = _SelectionTargets(w); } else { - utf8_failed = True; + targets = &(targets[1]); } -#else - params++; - num_params--; -#endif if (num_params) { list = XtNew(struct _SelectionList); list->params = params; list->count = num_params; -#if OPT_WIDE_CHARS - list->utf8_failed = utf8_failed; -#endif + list->targets = targets; list->time = ev_time; } else list = NULL; - XtGetSelectionValue(w, selection, -#if OPT_WIDE_CHARS - (screen->wide_chars && utf8_failed) ? - XA_UTF8_STRING(XtDisplay(w)) : -#endif - XA_STRING, - SelectionReceived, - (XtPointer)list, ev_time); + + XtGetSelectionValue(w, selection, + target, + SelectionReceived, + (XtPointer)list, ev_time); } } #if OPT_TRACE && OPT_WIDE_CHARS -static void GettingSelection(char *tag, char *line, int len) +static void GettingSelection(char *tag, Char *line, int len) { - char *cp; + Char *cp; Trace("Getting %s\n", tag); for (cp = line; cp < line + len; cp++) @@ -1001,6 +1136,62 @@ #define GettingSelection(tag,line,len) /* nothing */ #endif +#ifndef VMS +static void +_WriteSelectionData(int pty, Char *line, int length) +{ + /* Write data to pty a line at a time. */ + /* Doing this one line at a time may no longer be necessary + because v_write has been re-written. */ + + register Char *lag, *cp, *end; + + end = &line[length]; + lag = line; + for (cp = line; cp != end; cp++) { + if (*cp == '\n') { + *cp = '\r'; + v_write(pty, lag, cp - lag + 1); + lag = cp + 1; + } + } + if (lag != end) { + v_write(pty, lag, end - lag); + } +} + +#else /* VMS */ + +static void +_WriteSelectionData(int pty, Char *line, int length) +{ + /* in the VMS version, if tt_pasting isn't set to TRUE then qio + reads aren't blocked and an infinite loop is entered, where the + pasted text shows up as new input, goes in again, shows up + again, ad nauseum. */ + + register Char *lag, *cp, *end; + + tt_pasting = TRUE; + + end = &line[length]; + lag = line; + for (cp = line; cp != end; cp++) { + if (*cp == '\n') { + *cp = '\r'; + tt_write(lag, cp - lag + 1); + lag = cp + 1; + } + } + if (lag != end) { + tt_write(lag, end - lag); + } + + tt_pasting = FALSE; + tt_start_read(); /* reenable reads or a character may be lost */ +} +#endif /* VMS */ + /* SelectionReceived: stuff received selection text into pty */ /* ARGSUSED */ @@ -1013,87 +1204,132 @@ unsigned long *length, int *format GCC_UNUSED) { - int pty; - register Char *lag, *cp, *end; + char **text_list = NULL; + Char *(*conversion_function)(Char*, int, int*) = NULL; Char *line = (Char*)value; - Char *buf; - int len; + int text_list_count; + XTextProperty text_prop; TScreen *screen; + Display *dpy; if (!IsXtermWidget(w)) return; screen = &((XtermWidget)w)->screen; + dpy = XtDisplay(w); - pty = ((XtermWidget)w)->screen.respond; /* file descriptor of pty */ - if (*type == 0 /*XT_CONVERT_FAIL*/ || *length == 0 || value == NULL) { - /* could not get this selection, so see if there are more to try */ - struct _SelectionList* list = (struct _SelectionList*)client_data; - if (list != NULL) { - _GetSelection(w, list->time, - list->params, list->count, list->utf8_failed); - XtFree((char *)client_data); - } - return; - } + if (*type == 0 /*XT_CONVERT_FAIL*/ || *length == 0 || value == NULL) + goto fail; - buf = line; - len = *length; + text_prop.value = value; + text_prop.encoding = *type; + text_prop.format = *format; + text_prop.nitems = *length; - if_OPT_WIDE_CHARS(screen,{ +#if OPT_WIDE_CHARS + if(screen->wide_chars) { + /* Convert the selection to UTF-8. */ if (*type == XA_UTF8_STRING(XtDisplay(w))) { - buf = (Char*)XtMalloc(*length); GettingSelection("UTF8_STRING", line, *length); - len = filterUTF8(buf, line, *length); - } else { - buf = (Char *)XtMalloc(2* *length); - GettingSelection("Latin-1", line, *length); - len = Latin1toUTF8(buf, line, *length); + if(XTextPropertyToStringListUnchecked(&text_prop, &text_list, + &text_list_count) < 0) { + TRACE(("Conversion failed\n")); + text_list = NULL; + } + conversion_function = filterUTF8; } - }) - - /* Write data to pty a line at a time. */ - /* Doing this one line at a time may no longer be necessary - because v_write has been re-written. */ - - /* on VMS version if tt_pasting isn't set to TRUE then qio - reads aren't blocked and an infinite loop is entered, where - the pasted text shows up as new input, goes in again, shows - up again, ad nauseum. */ - -#ifdef VMS - tt_pasting = TRUE; +#if OPT_USE_UTF8_API + if (*type == XA_COMPOUND_TEXT(XtDisplay(w))) { + GettingSelection("COMPOUND_TEXT", line, *length); + if(Xutf8TextPropertyToTextList(dpy, &text_prop, + &text_list, + &text_list_count) < 0) { + TRACE(("Conversion failed\n")); + text_list = NULL; + } + } #endif - end = &buf[len]; - lag = buf; - for (cp = buf; cp != end; cp++) + if (*type == XA_STRING) { + GettingSelection("STRING", line, *length); + if(XTextPropertyToStringList(&text_prop, &text_list, + &text_list_count) < 0) { + TRACE(("Conversion failed\n")); + text_list = NULL; + } + conversion_function = Latin1toUTF8; + } + } else +#endif /* OPT_WIDE_CHARS */ { - if (*cp == '\n') { - *cp = '\r'; -#ifdef VMS - tt_write(lag, cp - lag + 1); -#else /* VMS */ - v_write(pty, lag, cp - lag + 1); -#endif /* VMS */ - lag = cp + 1; + /* Convert the selection to locale's multibyte encoding. */ + if(*type == XA_COMPOUND_TEXT(XtDisplay(w))) { + GettingSelection("COMPOUND_TEXT", line, *length); + if(XmbTextPropertyToTextList(dpy, &text_prop, + &text_list, + &text_list_count) < 0) { + TRACE(("Conversion failed\n")); + text_list = NULL; + } } +#if OPT_USE_UTF8_API + if(*type == XA_UTF8_STRING(XtDisplay(w))) { + GettingSelection("UTF8_STRING", line, *length); + if(XmbTextPropertyToTextList(dpy, &text_prop, + &text_list, + &text_list_count) < 0) { + TRACE(("Conversion failed\n")); + text_list = NULL; + } + } +#endif + if(*type == XA_STRING) { + Status rc; + GettingSelection("STRING", line, *length); + if(!screen->brokenSelections) { + rc = XmbTextPropertyToTextList(dpy, + &text_prop, + &text_list, &text_list_count); + } else { + rc = XTextPropertyToStringList(&text_prop, + &text_list, &text_list_count); + } + if(rc < 0) { + TRACE(("Conversion failed\n")); + text_list = NULL; + } + } } - if (lag != end) -#ifdef VMS - tt_write(lag, end - lag); -#else /* VMS */ - v_write(pty, lag, end - lag); -#endif /* VMS */ -#ifdef VMS - tt_pasting = FALSE; - tt_start_read(); /* reenable reads or a character may be lost */ -#endif + if(text_list != NULL && text_list_count != 0) { + int i; + for(i = 0; i < text_list_count; i++) { + Char *t = (Char *)text_list[i]; + int len = strlen(text_list[i]); + if(conversion_function) { + if ((t = conversion_function(t, len, &len)) != 0) { + _WriteSelectionData(((XtermWidget)w)->screen.respond, t, len); + XtFree((char *)t); + } + } else { + _WriteSelectionData(((XtermWidget)w)->screen.respond, t, len); + } + } + XFreeStringList(text_list); + } else + goto fail; - if_OPT_WIDE_CHARS(screen,{ - XtFree((char*)buf); - }) XtFree((char *)client_data); XtFree((char *)value); + + return; + + fail: + if (client_data != 0) { + struct _SelectionList* list = (struct _SelectionList*)client_data; + _GetSelection(w, list->time, + list->params, list->count, list->targets); + XtFree((char *)client_data); + } + return; } @@ -1105,10 +1341,9 @@ Cardinal *num_params) { if (SendMousePosition(w, event)) return; - _GetSelection(w, event->xbutton.time, params, *num_params, False); + _GetSelection(w, event->xbutton.time, params, *num_params, NULL); } - static SelectUnit EvalSelectUnit(Time buttonDownTime, SelectUnit defaultUnit) { @@ -1746,7 +1981,7 @@ cclass = class_of(screen,startSRow,startSCol); do { --startSCol; - if (startSCol <= 0 + if (startSCol < 0 && ScrnTstWrapped(screen, startSRow - 1)) { --startSRow; startSCol = LastTextCol(startSRow); @@ -1905,13 +2140,13 @@ return; if(frow != trow) { /* do multiple rows */ - if((i = screen->max_col - fcol + 1) > 0) { /* first row */ + if((i = screen->max_col - fcol + 1) > 0) { /* first row */ ScrnRefresh(screen, frow, fcol, 1, i, True); } - if((i = trow - frow - 1) > 0) { /* middle rows*/ + if((i = trow - frow - 1) > 0) { /* middle rows*/ ScrnRefresh(screen, frow+1, 0,i, screen->max_col+1, True); } - if(tcol > 0 && trow <= screen->max_row) { /* last row */ + if(tcol > 0 && trow <= screen->max_row) { /* last row */ ScrnRefresh(screen, trow, 0, 1, tcol, True); } } else { /* do single row */ @@ -1995,6 +2230,39 @@ } static Boolean +_ConvertSelectionHelper(Widget w, + Atom *type, XtPointer *value, + unsigned long *length, int *format, + int (*conversion_function)(Display*, + char**, int, + XICCEncodingStyle, + XTextProperty*), + XICCEncodingStyle conversion_style) +{ + Display* d = XtDisplay(w); + TScreen *screen; + XTextProperty textprop; + + if (!IsXtermWidget(w)) + return False; + + screen = &((XtermWidget)w)->screen; + + + *value = (XtPointer) screen->selection_data; + if (conversion_function(d, (char**)value, 1, + conversion_style, + &textprop) < Success) + return False; + *value = (XtPointer) textprop.value; + *length = textprop.nitems; + *type = textprop.encoding; + *format = 8; + return True; +} + + +static Boolean ConvertSelection( Widget w, Atom *selection, @@ -2022,16 +2290,21 @@ XmuConvertStandardSelection(w, screen->selection_time, selection, target, type, (XPointer *)&std_targets, &std_length, format); - *length = std_length + 5; + *length = std_length + 6; targetP = (Atom*)XtMalloc(sizeof(Atom)*(*length)); *value = (XtPointer) targetP; *targetP++ = XA_STRING; *targetP++ = XA_TEXT(d); +#if OPT_USE_UTF8_API + *targetP++ = XA_COMPOUND_TEXT(d); + *targetP++ = XA_UTF8_STRING(d); +#else /* OPT_USE_UTF8_API */ *targetP = XA_COMPOUND_TEXT(d); if_OPT_WIDE_CHARS(screen, { - *targetP = XA_UTF8_STRING(d); + *targetP = XA_UTF8_STRING(d); }) targetP++; +#endif /* OPT_USE_UTF8_API */ *targetP++ = XA_LENGTH(d); *targetP++ = XA_LIST_LENGTH(d); memcpy ( (char*)targetP, (char*)std_targets, sizeof(Atom)*std_length); @@ -2041,76 +2314,104 @@ return True; } - if_OPT_WIDE_CHARS(screen,{ - if (*target == XA_STRING) { - *value = UTF8toLatin1((Char*)screen->selection_data, - screen->selection_length, length); - *type = XA_STRING; - *format = 8; - return True; - } - if (*target == XA_TEXT(d)) { - char *p; - /* walk the string, searching for non ISO 8859-1 characters */ - for (p = screen->selection_data; - p < screen->selection_data+screen->selection_length; - p++) { - if ((*p & 0xC0) == 0xC0 - && ((*p & 0x20) || (!(*p & 0x20) && (*p & 0x1C)))) - break; - } - if (p < screen->selection_data + screen->selection_length) { - /* non ISO 8859-1 character found -- return UTF-8 */ - *type = XA_UTF8_STRING(d); - *value = screen->selection_data; - *length = screen->selection_length; - *format = 8; - } else { - /* none found -- return STRING */ - *value = UTF8toLatin1((Char*)screen->selection_data, - screen->selection_length, length); - *type = XA_STRING; - *format = 8; - } - return True; - } - if (*target == XA_UTF8_STRING(d)) { - *type = XA_UTF8_STRING(d); - *value = screen->selection_data; - *length = screen->selection_length; - *format = 8; - return True; + +#if OPT_WIDE_CHARS + /* Deal with XA_TEXT in the Unicode case */ + if (*target == XA_TEXT(d) && screen->wide_chars) { +#if OPT_USE_UTF8_API + char *p; + /* walk the string, searching for non ISO 8859-1 characters */ + for (p = screen->selection_data; + p < screen->selection_data+screen->selection_length; + p++) { + if ((*p & 0xC0) == 0xC0 + && ((*p & 0x20) || (!(*p & 0x20) && (*p & 0x1C)))) + break; + } + if (p < screen->selection_data + screen->selection_length) { + /* non ISO 8859-1 character found -- return CTEXT */ + *target = XA_COMPOUND_TEXT(d); + } else { + /* none found -- return STRING */ + *target = XA_STRING; } - }) +#else /* OPT_USE_UTF8_API */ + *target = XA_STRING; +#endif /* OPT_USE_UTF8_API */ + } +#endif /* OPT_WIDE_CHARS */ - /* We covered the XA_TEXT and XA_STRING cases for wide_chars above */ - if ((*target == XA_TEXT(d) || *target == XA_STRING)) { + +#if OPT_WIDE_CHARS + if (screen->wide_chars && *target == XA_STRING) { + *value = UTF8toLatin1((Char*)screen->selection_data, + screen->selection_length, length); *type = XA_STRING; + *format = 8; + return True; + } + if (screen->wide_chars && *target == XA_UTF8_STRING(d)) { + *type = XA_UTF8_STRING(d); *value = screen->selection_data; *length = screen->selection_length; *format = 8; return True; } - - if (*target == XA_COMPOUND_TEXT(d) -#if OPT_WIDE_CHARS - && !screen->wide_chars + if (screen->wide_chars && *target == XA_COMPOUND_TEXT(d)) { +#if OPT_USE_UTF8_API + return + _ConvertSelectionHelper(w, + type, value, length, format, + Xutf8TextListToTextProperty, + XCompoundTextStyle); +#else + return False; +#endif + } #endif - ) { - XTextProperty textprop; - *value = (XtPointer) screen->selection_data; - if (XmbTextListToTextProperty (d, (char**)value, 1, - XCompoundTextStyle, - &textprop) < Success) - return False; - *value = (XtPointer) textprop.value; - *length = textprop.nitems; - *type = XA_COMPOUND_TEXT(d); + if (*target == XA_STRING) { /* not wide_chars */ + /* We can only reach this point if the selection requestor + requested STRING before any of TEXT, COMPOUND_TEXT or + UTF8_STRING. We therefore assume that the requestor is not + properly internationalised, and dump raw eight-bit data + with no conversion into the selection. Yes, this breaks + the ICCCM in non-Latin-1 locales. */ + *type = XA_STRING; + *value = screen->selection_data; + *length = screen->selection_length; *format = 8; return True; } + if (*target == XA_TEXT(d)) { /* not wide_chars */ + return + _ConvertSelectionHelper(w, + type, value, length, format, + XmbTextListToTextProperty, + XStdICCTextStyle); + } + + if (*target == XA_COMPOUND_TEXT(d)) { /* not wide_chars */ + return + _ConvertSelectionHelper(w, + type, value, length, format, + XmbTextListToTextProperty, + XCompoundTextStyle); + } + + if (*target == XA_UTF8_STRING(d)) { /* not wide_chars */ +#if OPT_USE_UTF8_API + return + _ConvertSelectionHelper(w, + type, value, length, format, + XmbTextListToTextProperty, + XUTF8StringStyle); +#else + return False; +#endif + } + if (*target == XA_LIST_LENGTH(d)) { *value = XtMalloc(4); if (sizeof(long) == 4) @@ -2356,6 +2657,13 @@ */ if (c == HIDDEN_CHAR && iswide(previous)) { previous = c; + /* Combining characters attached to double-width characters + are in memory attached to the HIDDEN_CHAR */ + if (c_1) { + lp = convertToUTF8(lp, c_1); + if (c_2) + lp = convertToUTF8(lp, c_2); + } continue; } previous = c; Index: xc/programs/xterm/charclass.c diff -u xc/programs/xterm/charclass.c:1.1 xc/programs/xterm/charclass.c:1.2 --- xc/programs/xterm/charclass.c:1.1 Sat Aug 26 00:33:53 2000 +++ xc/programs/xterm/charclass.c Wed Dec 27 19:51:50 2000 @@ -20,14 +20,12 @@ * but merging in new intervals is significantly more hassle and * not worth the effort here. */ -/* $XFree86: xc/programs/xterm/charclass.c,v 1.1 2000/08/26 04:33:53 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/charclass.c,v 1.2 2000/12/28 00:51:50 dickey Exp $ */ #include #include #if OPT_WIDE_CHARS - -#include struct classentry { int class; Index: xc/programs/xterm/charproc.c diff -u xc/programs/xterm/charproc.c:3.112 xc/programs/xterm/charproc.c:3.120 --- xc/programs/xterm/charproc.c:3.112 Wed Nov 29 03:39:24 2000 +++ xc/programs/xterm/charproc.c Fri Apr 20 05:30:38 2001 @@ -1,11 +1,12 @@ /* - * $XConsortium: charproc.c /main/196 1996/12/03 16:52:46 swick $ - * $XFree86: xc/programs/xterm/charproc.c,v 3.112 2000/11/29 08:39:24 keithp Exp $ + * $Xorg: charproc.c,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ +/* $XFree86: xc/programs/xterm/charproc.c,v 3.120 2001/04/20 09:30:38 dickey Exp $ */ + /* -Copyright 1999-2000 by Thomas E. Dickey +Copyright 1999-2001 by Thomas E. Dickey All Rights Reserved @@ -86,11 +87,11 @@ #include #include -#include #include #include #include #include +#include #include #include #include @@ -127,13 +128,9 @@ #define HANDLE_STRUCT_NOTIFY 1 #endif -#if !defined(NO_ACTIVE_ICON) || defined(HANDLE_STRUCT_NOTIFY) -#include -#endif /* NO_ACTIVE_ICON */ - extern char *ProgramName; -static int in_put (void); +static IChar in_put (void); static int set_character_class (char *s); static void FromAlternate (TScreen *screen); static void RequestResize (XtermWidget termw, int rows, int cols, int text); @@ -212,6 +209,14 @@ Shift Next:scroll-forw(1,halfpage) \n\ Shift Select:select-cursor-start() select-cursor-end(PRIMARY, CUT_BUFFER0) \n\ Shift Insert:insert-selection(PRIMARY, CUT_BUFFER0) \n\ +" +#if OPT_SHIFT_FONTS +"\ + Shift KP_Add:larger-vt-font() \n\ + Shift KP_Subtract:smaller-vt-font() \n\ +" +#endif +"\ ~Meta :insert-seven-bit() \n\ Meta :insert-eight-bit() \n\ !Ctrl :popup-menu(mainMenu) \n\ @@ -297,6 +302,7 @@ { "set-sun-keyboard", HandleSunKeyboard }, { "set-titeInhibit", HandleTiteInhibit }, { "set-visual-bell", HandleSetVisualBell }, + { "set-pop-on-bell", HandleSetPopOnBell }, { "set-vt-font", HandleSetFont }, { "soft-reset", HandleSoftReset }, { "start-cursor-extend", HandleKeyboardStartExtend }, @@ -335,7 +341,7 @@ #if OPT_SCO_FUNC_KEYS { "set-sco-function-keys", HandleScoFunctionKeys }, #endif -#if OPT_SHIFT_KEYS +#if OPT_SHIFT_FONTS { "larger-vt-font", HandleLargerFont }, { "smaller-vt-font", HandleSmallerFont }, #endif @@ -364,6 +370,7 @@ Bres(XtNawaitInput, XtCAwaitInput, screen.awaitInput, FALSE), Bres(XtNbackarrowKey, XtCBackarrowKey, screen.backarrow_key, TRUE), Bres(XtNboldMode, XtCBoldMode, screen.bold_mode, TRUE), +Bres(XtNbrokenSelections, XtCBrokenSelections, screen.brokenSelections, FALSE), Bres(XtNc132, XtCC132, screen.c132, FALSE), Bres(XtNcurses, XtCCurses, screen.curses, FALSE), Bres(XtNcutNewline, XtCCutNewline, screen.cutNewline, TRUE), @@ -375,12 +382,14 @@ Bres(XtNeightBitOutput, XtCEightBitOutput, screen.output_eight_bits, TRUE), Bres(XtNhighlightSelection, XtCHighlightSelection, screen.highlight_selection, FALSE), Bres(XtNhpLowerleftBugCompat, XtCHpLowerleftBugCompat, screen.hp_ll_bc, FALSE), +Bres(XtNi18nSelections, XtCI18nSelections, screen.i18nSelections, TRUE), Bres(XtNjumpScroll, XtCJumpScroll, screen.jumpscroll, TRUE), Bres(XtNloginShell, XtCLoginShell, misc.login_shell, FALSE), Bres(XtNmarginBell, XtCMarginBell, screen.marginbell, FALSE), Bres(XtNmetaSendsEscape, XtCMetaSendsEscape, screen.meta_sends_esc, FALSE), Bres(XtNmultiScroll, XtCMultiScroll, screen.multiscroll, FALSE), Bres(XtNoldXtermFKeys, XtCOldXtermFKeys, screen.old_fkeys, FALSE), +Bres(XtNpopOnBell, XtCPopOnBell, screen.poponbell, FALSE), Bres(XtNprinterAutoClose, XtCPrinterAutoClose, screen.printer_autoclose, FALSE), Bres(XtNprinterExtent, XtCPrinterExtent, screen.printer_extent, FALSE), Bres(XtNprinterFormFeed, XtCPrinterFormFeed, screen.printer_formfeed, FALSE), @@ -519,8 +528,8 @@ Ires(XtNprintAttributes, XtCPrintAttributes, screen.print_attributes, 1), #endif -#if OPT_SHIFT_KEYS -Bres(XtNshiftKeys, XtCShiftKeys, misc.shift_keys, TRUE), +#if OPT_SHIFT_FONTS +Bres(XtNshiftFonts, XtCShiftFonts, misc.shift_fonts, TRUE), #endif #if OPT_SUNPC_KBD @@ -823,7 +832,9 @@ int lastchar; /* positive iff we had a graphic character */ int nextstate; int laststate; +#if OPT_WIDE_CHARS int last_was_wide; +#endif /* We longjmp back to this point in VTReset() */ (void)setjmp(vtjmpbuf); @@ -838,7 +849,9 @@ string_mode = 0; lastchar = -1; /* not a legal IChar */ nextstate = -1; /* not a legal state */ +#if OPT_WIDE_CHARS last_was_wide = 0; +#endif for( ; ; ) { int thischar = -1; @@ -869,15 +882,12 @@ if (precomposed != -1) { putXtermCell(screen, last_written_row, last_written_col, precomposed); - ScrnRefresh(screen, last_written_row, last_written_col, 1, 1, 1); - continue; } else { addXtermCombining(screen, last_written_row, last_written_col, c); - if (!screen->scroll_amt) - ScrnRefresh(screen, last_written_row, last_written_col, 1, 1, 1); - /* does this suffice? */ - continue; } + if (!screen->scroll_amt) + ScrnRefresh(screen, last_written_row, last_written_col, 1, 1, 1); + continue; } #endif @@ -2444,7 +2454,7 @@ #define ptymask() (v_bufptr > v_bufstr ? pty_mask : 0) -static int +static IChar in_put(void) { int status; @@ -2559,7 +2569,7 @@ static fd_set write_mask; static int pty_read_bytes; -static int +static IChar in_put(void) { register TScreen *screen = &term->screen; @@ -3143,9 +3153,9 @@ if (screen->fullVwin.scrollbar != ((func == bitset) ? ON : OFF)) ToggleScrollBar(termw); break; -#if OPT_SHIFT_KEYS +#if OPT_SHIFT_FONTS case 35: /* rxvt */ - term->misc.shift_keys = (func == bitset) ? ON : OFF; + term->misc.shift_fonts = (func == bitset) ? ON : OFF; break; #endif case 38: /* DECTEK */ @@ -4022,6 +4032,10 @@ int cols, int text) { +#ifndef nothack + XSizeHints sizehints; + long supp; +#endif TScreen *screen = &termw->screen; unsigned long value; Dimension replyWidth, replyHeight; @@ -4086,6 +4100,12 @@ askedWidth = wide; } +#ifndef nothack + if (! XGetWMNormalHints(screen->display, VShellWindow, + &sizehints, &supp)) + bzero(&sizehints, sizeof(sizehints)); +#endif + status = XtMakeResizeRequest ( (Widget) termw, askedWidth, askedHeight, @@ -4101,10 +4121,26 @@ replyWidth, replyHeight, &termw->flags); - XSync(screen->display, FALSE); /* synchronize */ - if(XtAppPending(app_con)) - xevents(); } + +#ifndef nothack + /* + * XtMakeResizeRequest() has the undesirable side-effect of clearing + * the window manager's hints, even on a failed request. This would + * presumably be fixed if the shell did its own work. + */ + if (sizehints.flags + && replyHeight + && replyWidth) { + sizehints.height = replyHeight; + sizehints.width = replyWidth; + XSetWMNormalHints(screen->display, VShellWindow, &sizehints); + } +#endif + + XSync(screen->display, FALSE); /* synchronize */ + if(XtAppPending(app_con)) + xevents(); } extern Atom wm_delete_window; /* for ICCCM delete window */ @@ -4263,6 +4299,7 @@ wnew->screen.ansi_level = (wnew->screen.terminal_id / 100); wnew->screen.visualbell = request->screen.visualbell; + wnew->screen.poponbell = request->screen.poponbell; wnew->misc.limit_resize = request->misc.limit_resize; #if OPT_NUM_LOCK wnew->misc.real_NumLock = request->misc.real_NumLock; @@ -4274,8 +4311,8 @@ wnew->misc.meta_left = 0; wnew->misc.meta_right = 0; #endif -#if OPT_SHIFT_KEYS - wnew->misc.shift_keys = request->misc.shift_keys; +#if OPT_SHIFT_FONTS + wnew->misc.shift_fonts = request->misc.shift_fonts; #endif #if OPT_SUNPC_KBD wnew->misc.ctrl_fkeys = request->misc.ctrl_fkeys; @@ -4297,6 +4334,8 @@ wnew->screen.cutToBeginningOfLine = request->screen.cutToBeginningOfLine; wnew->screen.highlight_selection = request->screen.highlight_selection; wnew->screen.trim_selection = request->screen.trim_selection; + wnew->screen.i18nSelections = request->screen.i18nSelections; + wnew->screen.brokenSelections = request->screen.brokenSelections; wnew->screen.always_highlight = request->screen.always_highlight; wnew->screen.pointer_cursor = request->screen.pointer_cursor; @@ -4586,6 +4625,7 @@ - height - (XtParent(term)->core.border_width * 2); /* set up size hints for window manager; min 1 char by 1 char */ + bzero(&sizehints, sizeof(sizehints)); sizehints.base_width = 2 * screen->border + scrollbar_width; sizehints.base_height = 2 * screen->border; sizehints.width_inc = FontWidth(screen); @@ -4757,7 +4797,7 @@ #if OPT_I18N_SUPPORT && OPT_INPUT_METHOD static void VTInitI18N(void) { - unsigned i; + unsigned i, j; char *p, *s, *t, @@ -4768,6 +4808,14 @@ XIMStyles *xim_styles; XIMStyle input_style = 0; Boolean found; + static struct { + char *name; + unsigned long code; + } known_style[] = { + { "OverTheSpot", (XIMPreeditPosition | XIMStatusArea) }, + { "OffTheSpot", (XIMPreeditArea | XIMStatusArea) }, + { "Root", (XIMPreeditNothing | XIMStatusNothing) }, + }; term->screen.xic = NULL; @@ -4811,9 +4859,11 @@ fprintf(stderr, "Failed to open input method\n"); return; } + TRACE(("VTInitI18N opened input method\n")); if (XGetIMValues(xim, XNQueryInputStyle, &xim_styles, NULL) - || !xim_styles) { + || !xim_styles + || !xim_styles->count_styles) { fprintf(stderr, "input method doesn't support any style\n"); XCloseIM(xim); return; @@ -4830,17 +4880,19 @@ while ((end != s) && isspace(CharOf(end[-1]))) end--; if (end != s) { /* just in case we have a spurious comma */ - if (!strncmp(s, "OverTheSpot", end - s)) { - input_style = (XIMPreeditPosition | XIMStatusArea); - } else if (!strncmp(s, "OffTheSpot", end - s)) { - input_style = (XIMPreeditArea | XIMStatusArea); - } else if (!strncmp(s, "Root", end - s)) { - input_style = (XIMPreeditNothing | XIMStatusNothing); - } - for (i = 0; (unsigned short)i < xim_styles->count_styles; i++) { - if (input_style == xim_styles->supported_styles[i]) { - found = True; - break; + TRACE(("looking for style '%.*s'\n", end - s, s)); + for (i = 0; i < sizeof(known_style)/sizeof(known_style[0]); i++) { + if ((int)strlen(known_style[i].name) == (end - s) + && !strncmp(s, known_style[i].name, end - s)) { + input_style = known_style[i].code; + for (j = 0; j < xim_styles->count_styles; j++) { + if (input_style == xim_styles->supported_styles[j]) { + found = True; + break; + } + } + if (found) + break; } } } @@ -4850,7 +4902,8 @@ XFree(xim_styles); if (!found) { - fprintf(stderr, "input method doesn't support my preedit type\n"); + fprintf(stderr, "input method doesn't support my preedit type (%s)\n", + term->misc.preedit_type); XCloseIM(xim); return; } @@ -5569,7 +5622,6 @@ { VisualBell(); } - /* ARGSUSED */ static void HandleIgnore( Index: xc/programs/xterm/config.guess diff -u xc/programs/xterm/config.guess:1.11 xc/programs/xterm/config.guess:1.12 --- xc/programs/xterm/config.guess:1.11 Fri Oct 27 14:31:11 2000 +++ xc/programs/xterm/config.guess Sun Mar 11 19:54:17 2001 @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -version='2000-10-23' +timestamp='2001-02-13' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -32,30 +32,41 @@ # exits with 0. Otherwise, it exits with 1. # # The plan is that this can be called by configure scripts if you -# don't specify an explicit system type (host/target name). -# -# Only a few systems have been added to this list; please add others -# (but try to keep the structure clean). -# +# don't specify an explicit build system type. me=`echo "$0" | sed -e 's,.*/,,'` usage="\ Usage: $0 [OPTION] -Output the configuration name of this system. +Output the configuration name of the system \`$me' is run on. Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit" + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) +Originally written by Per Bothner. +Copyright (C) 1992, 93, 94, 95, 96, 97, 98, 99, 2000 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do - case "$1" in - --version | --vers* | -V ) + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; @@ -64,9 +75,7 @@ - ) # Use stdin as input. break ;; -* ) - exec >&2 - echo "$me: invalid option $1" - echo "$help" + echo "$me: invalid option $1$help" >&2 exit 1 ;; * ) break ;; @@ -78,19 +87,30 @@ exit 1 fi -# Use $HOST_CC if defined. $CC may point to a cross-compiler -if test x"$CC_FOR_BUILD" = x; then - if test x"$HOST_CC" != x; then - CC_FOR_BUILD="$HOST_CC" - else - if test x"$CC" != x; then - CC_FOR_BUILD="$CC" - else - CC_FOR_BUILD=cc - fi - fi -fi +dummy=dummy-$$ +trap 'rm -f $dummy.c $dummy.o $dummy.rel $dummy; exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int dummy(){}" > $dummy.c + for c in cc gcc c89 ; do + ($c $dummy.c -c -o $dummy.o) >/dev/null 2>&1 + if test $? = 0 ; then + CC_FOR_BUILD="$c"; break + fi + done + rm -f $dummy.c $dummy.o $dummy.rel + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 8/24/94.) @@ -100,18 +120,12 @@ UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown -UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown -dummy=dummy-$$ -trap 'rm -f $dummy.c $dummy.o $dummy; exit 1' 1 2 15 - # Note: order is significant - the case branches are not exclusive. case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in - i?86:OS/2:*:*) - echo "i386-unknown-os2" - exit 0;; *:NetBSD:*:*) # Netbsd (nbsd) targets should (where applicable) match one or # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, @@ -132,16 +146,24 @@ ibmrt|romp-ibm) machine=romp-ibm ;; *) machine=${UNAME_MACHINE}-unknown ;; esac - # The Operating System including object format. - if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ - | grep __ELF__ >/dev/null - then - # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). - # Return netbsd for either. FIX? - os=netbsd - else - os=netbsdelf - fi + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE}" in + i386|sparc|amiga|arm*|hp300|mvme68k|vax|atari|luna68k|mac68k|news68k|next68k|pc532|sun3*|x68k) + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep __ELF__ >/dev/null + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac # The OS release release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: @@ -250,7 +272,7 @@ arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} exit 0;; - SR2?01:HI-UX/MPP:*:*) + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp exit 0;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) @@ -440,6 +462,14 @@ i?86:AIX:*:*) echo i386-ibm-aix exit 0 ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit 0 ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then sed 's/^ //' << EOF >$dummy.c @@ -462,9 +492,9 @@ echo rs6000-ibm-aix3.2 fi exit 0 ;; - *:AIX:*:4) + *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | head -1 | awk '{ print $1 }'` - if /usr/sbin/lsattr -EHl ${IBM_CPU_ID} | grep POWER >/dev/null 2>&1; then + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then IBM_ARCH=rs6000 else IBM_ARCH=powerpc @@ -472,7 +502,7 @@ if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` else - IBM_REV=4.${UNAME_RELEASE} + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} exit 0 ;; @@ -498,10 +528,28 @@ echo m68k-hp-bsd4.4 exit 0 ;; 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in 9000/31? ) HP_ARCH=m68000 ;; 9000/[34]?? ) HP_ARCH=m68k ;; 9000/[678][0-9][0-9]) + case "${HPUX_REV}" in + 11.[0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + esac ;; + esac + fi ;; + esac + if [ "${HP_ARCH}" = "" ]; then sed 's/^ //' << EOF >$dummy.c #define _HPUX_SOURCE @@ -536,11 +584,16 @@ } EOF (CCOPTS= $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null ) && HP_ARCH=`./$dummy` + if test -z "$HP_ARCH"; then HP_ARCH=hppa; fi rm -f $dummy.c $dummy + fi ;; esac - HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ${HP_ARCH}-hp-hpux${HPUX_REV} exit 0 ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit 0 ;; 3050*:HI-UX:*:*) sed 's/^ //' << EOF >$dummy.c #include @@ -631,23 +684,24 @@ CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; - CRAY*T3E:*:*:*) + CRAY*T3D:*:*:*) echo alpha-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit 0 ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' exit 0 ;; CRAY-2:*:*:*) echo cray2-cray-unicos exit 0 ;; - F300:UNIX_System_V:*:*) + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "f300-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" exit 0 ;; - F301:UNIX_System_V:*:*) - echo f301-fujitsu-uxpv`echo $UNAME_RELEASE | sed 's/ .*//'` - exit 0 ;; hp300:OpenBSD:*:*) echo m68k-unknown-openbsd${UNAME_RELEASE} exit 0 ;; @@ -696,8 +750,50 @@ i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix exit 0 ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux + exit 0 ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit 0 ;; + mips:Linux:*:*) + cat >$dummy.c < /* for printf() prototype */ +int main (int argc, char *argv[]) { +#else +int main (argc, argv) int argc; char *argv[]; { +#endif +#ifdef __MIPSEB__ + printf ("%s-unknown-linux-gnu\n", argv[1]); +#endif +#ifdef __MIPSEL__ + printf ("%sel-unknown-linux-gnu\n", argv[1]); +#endif + return 0; +} +EOF + $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 + rm -f $dummy.c $dummy + ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit 0 ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit 0 ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit 0 ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit 0 ;; *:Linux:*:*) - # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent # problems with other programs or directories called `ld' in the path. @@ -708,10 +804,6 @@ s/ .*// p'` case "$ld_supported_emulations" in - *ia64) - echo "${UNAME_MACHINE}-unknown-linux" - exit 0 - ;; i?86linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" exit 0 @@ -727,6 +819,10 @@ echo "${UNAME_MACHINE}-unknown-linux-gnuaout" exit 0 ;; + elf32_sparc) + echo "${UNAME_MACHINE}-unknown-linux-gnu" + exit 0 + ;; armlinux) echo "${UNAME_MACHINE}-unknown-linux-gnuaout" exit 0 @@ -775,10 +871,6 @@ echo powerpc-unknown-linux-gnu${LIBC} exit 0 ;; - shelf_linux) - echo "${UNAME_MACHINE}-unknown-linux-gnu" - exit 0 - ;; esac if test "${UNAME_MACHINE}" = "alpha" ; then @@ -811,24 +903,12 @@ $CC_FOR_BUILD $dummy.s -o $dummy 2>/dev/null if test "$?" = 0 ; then case `./$dummy` in - 0-0) - UNAME_MACHINE="alpha" - ;; - 1-0) - UNAME_MACHINE="alphaev5" - ;; - 1-1) - UNAME_MACHINE="alphaev56" - ;; - 1-101) - UNAME_MACHINE="alphapca56" - ;; - 2-303) - UNAME_MACHINE="alphaev6" - ;; - 2-307) - UNAME_MACHINE="alphaev67" - ;; + 0-0) UNAME_MACHINE="alpha" ;; + 1-0) UNAME_MACHINE="alphaev5" ;; + 1-1) UNAME_MACHINE="alphaev56" ;; + 1-101) UNAME_MACHINE="alphapca56" ;; + 2-303) UNAME_MACHINE="alphaev6" ;; + 2-307) UNAME_MACHINE="alphaev67" ;; esac objdump --private-headers $dummy | \ @@ -839,43 +919,6 @@ fi rm -f $dummy.s $dummy echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} ; exit 0 - elif test "${UNAME_MACHINE}" = "mips" ; then - cat >$dummy.c < /* for printf() prototype */ - int main (int argc, char *argv[]) { -#else - int main (argc, argv) int argc; char *argv[]; { -#endif -#ifdef __MIPSEB__ - printf ("%s-unknown-linux-gnu\n", argv[1]); -#endif -#ifdef __MIPSEL__ - printf ("%sel-unknown-linux-gnu\n", argv[1]); -#endif - return 0; -} -EOF - $CC_FOR_BUILD $dummy.c -o $dummy 2>/dev/null && ./$dummy "${UNAME_MACHINE}" && rm $dummy.c $dummy && exit 0 - rm -f $dummy.c $dummy - elif test "${UNAME_MACHINE}" = "s390"; then - echo s390-ibm-linux && exit 0 - elif test "${UNAME_MACHINE}" = "x86_64"; then - echo x86_64-unknown-linux-gnu && exit 0 - elif test "${UNAME_MACHINE}" = "parisc" -o "${UNAME_MACHINE}" = "hppa"; then - # Look for CPU level - case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in - PA7*) - echo hppa1.1-unknown-linux-gnu - ;; - PA8*) - echo hppa2.0-unknown-linux-gnu - ;; - *) - echo hppa-unknown-linux-gnu - ;; - esac - exit 0 else # Either a pre-BFD a.out linker (linux-gnuoldld) # or one that does not give us useful --help. @@ -1021,9 +1064,12 @@ TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} exit 0 ;; - rs6000:LynxOS:2.*:* | PowerPC:LynxOS:2.*:*) + rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} exit 0 ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit 0 ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} exit 0 ;; @@ -1123,6 +1169,29 @@ fi echo ${UNAME_MACHINE}-unknown-plan9 exit 0 ;; + i?86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit 0 ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit 0 ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit 0 ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit 0 ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit 0 ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit 0 ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit 0 ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1214,11 +1283,24 @@ #endif #if defined (vax) -#if !defined (ultrix) - printf ("vax-dec-bsd\n"); exit (0); -#else - printf ("vax-dec-ultrix\n"); exit (0); -#endif +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif #endif #if defined (alliant) && defined (i860) @@ -1265,8 +1347,9 @@ cat >&2 < in order to provide the needed information to handle your system. -config.guess version = $version +config.guess timestamp = $timestamp uname -m = `(uname -m) 2>/dev/null || echo unknown` uname -r = `(uname -r) 2>/dev/null || echo unknown` @@ -1302,7 +1385,7 @@ # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "version='" +# time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: Index: xc/programs/xterm/config.sub diff -u xc/programs/xterm/config.sub:1.11 xc/programs/xterm/config.sub:1.12 --- xc/programs/xterm/config.sub:1.11 Fri Oct 27 14:31:11 2000 +++ xc/programs/xterm/config.sub Sun Mar 11 19:54:17 2001 @@ -1,9 +1,9 @@ #! /bin/sh -# Configuration validation subroutine script, version 1.1. -# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000 +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 # Free Software Foundation, Inc. -version='2000-10-25' +timestamp='2001-02-13' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -60,16 +60,30 @@ Canonicalize a configuration name. Operation modes: - -h, --help print this help, then exit - -V, --version print version number, then exit" + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + help=" Try \`$me --help' for more information." # Parse command line while test $# -gt 0 ; do - case "$1" in - --version | --vers* | -V ) + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit 0 ;; + --version | -v ) echo "$version" ; exit 0 ;; --help | --h* | -h ) echo "$usage"; exit 0 ;; @@ -78,9 +92,7 @@ - ) # Use stdin as input. break ;; -* ) - exec >&2 - echo "$me: invalid option $1" - echo "$help" + echo "$me: invalid option $1$help" exit 1 ;; *local*) @@ -105,7 +117,7 @@ # Here we must recognize all the valid KERNEL-OS combinations. maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` case $maybe_os in - nto-qnx* | linux-gnu*) + nto-qnx* | linux-gnu* | storm-chaos* | os2-emx*) os=-$maybe_os basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` ;; @@ -122,9 +134,6 @@ ### recognize some manufacturers as not being operating systems, so we ### can provide default operating systems below. case $os in - -os2) - basic_machine=`echo $1 | sed -e 's/86-.*/86/'` - ;; -sun*os*) # Prevent following clause from handling this invalid input. ;; @@ -206,22 +215,24 @@ case $basic_machine in # Recognize the basic CPU types without company name. # Some are omitted here because they have special meanings below. - tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc | arm \ - | arme[lb] | armv[2345] | armv[345][lb] | pyramid | mn10200 | mn10300 | tron | a29k \ + tahoe | i860 | ia64 | m32r | m68k | m68000 | m88k | ns32k | arc \ + | arm | arme[lb] | arm[bl]e | armv[2345] | armv[345][lb] | strongarm | xscale \ + | pyramid | mn10200 | mn10300 | tron | a29k \ | 580 | i960 | h8300 \ - | x86 | ppcbe | mipsbe | mipsle | shbe | shle | armbe | armle \ + | x86 | ppcbe | mipsbe | mipsle | shbe | shle \ | hppa | hppa1.0 | hppa1.1 | hppa2.0 | hppa2.0w | hppa2.0n \ | hppa64 \ | alpha | alphaev[4-8] | alphaev56 | alphapca5[67] \ | alphaev6[78] \ | we32k | ns16k | clipper | i370 | sh | sh[34] \ | powerpc | powerpcle \ - | 1750a | dsp16xx | pdp11 | mips16 | mips64 | mipsel | mips64el \ + | 1750a | dsp16xx | pdp10 | pdp11 \ + | mips16 | mips64 | mipsel | mips64el \ | mips64orion | mips64orionel | mipstx39 | mipstx39el \ | mips64vr4300 | mips64vr4300el | mips64vr4100 | mips64vr4100el \ | mips64vr5000 | miprs64vr5000el | mcore \ | sparc | sparclet | sparclite | sparc64 | sparcv9 | v850 | c4x \ - | thumb | d10v | d30v | fr30 | avr) + | thumb | d10v | d30v | fr30 | avr | openrisc) basic_machine=$basic_machine-unknown ;; m6811 | m68hc11 | m6812 | m68hc12) @@ -246,23 +257,24 @@ # Recognize the basic CPU types with company name. # FIXME: clean up the formatting here. vax-* | tahoe-* | i[234567]86-* | i860-* | ia64-* | m32r-* | m68k-* | m68000-* \ - | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | arm-* | c[123]* \ + | m88k-* | sparc-* | ns32k-* | fx80-* | arc-* | c[123]* \ + | arm-* | armbe-* | armle-* | armv*-* | strongarm-* | xscale-* \ | mips-* | pyramid-* | tron-* | a29k-* | romp-* | rs6000-* \ | power-* | none-* | 580-* | cray2-* | h8300-* | h8500-* | i960-* \ | xmp-* | ymp-* \ - | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* | armbe-* | armle-* \ + | x86-* | ppcbe-* | mipsbe-* | mipsle-* | shbe-* | shle-* \ | hppa-* | hppa1.0-* | hppa1.1-* | hppa2.0-* | hppa2.0w-* \ | hppa2.0n-* | hppa64-* \ | alpha-* | alphaev[4-8]-* | alphaev56-* | alphapca5[67]-* \ | alphaev6[78]-* \ | we32k-* | cydra-* | ns16k-* | pn-* | np1-* | xps100-* \ | clipper-* | orion-* \ - | sparclite-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ + | sparclite-* | pdp10-* | pdp11-* | sh-* | powerpc-* | powerpcle-* \ | sparc64-* | sparcv9-* | sparc86x-* | mips16-* | mips64-* | mipsel-* \ | mips64el-* | mips64orion-* | mips64orionel-* \ | mips64vr4100-* | mips64vr4100el-* | mips64vr4300-* | mips64vr4300el-* \ | mipstx39-* | mipstx39el-* | mcore-* \ - | f301-* | armv*-* | s390-* | sv1-* | t3e-* \ + | f30[01]-* | f700-* | s390-* | s390x-* | sv1-* | t3e-* \ | m88110-* | m680[01234]0-* | m683?2-* | m68360-* | z8k-* | d10v-* \ | thumb-* | v850-* | d30v-* | tic30-* | c30-* | fr30-* \ | bs2000-* | tic54x-* | c54x-* | x86_64-*) @@ -356,8 +368,8 @@ basic_machine=cray2-cray os=-unicos ;; - [ctj]90-cray) - basic_machine=c90-cray + [cjt]90) + basic_machine=${basic_machine}-cray os=-unicos ;; crds | unos) @@ -413,6 +425,10 @@ basic_machine=tron-gmicro os=-sysv ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; h3050r* | hiux*) basic_machine=hppa1.1-hitachi os=-hiuxwe2 @@ -512,18 +528,6 @@ basic_machine=i386-unknown os=-vsta ;; - i386-go32 | go32) - basic_machine=i386-unknown - os=-go32 - ;; - i386-mingw32 | mingw32) - basic_machine=i386-unknown - os=-mingw32 - ;; - i[34567]86-pw32 | pw32) - basic_machine=i586-unknown - os=-pw32 - ;; iris | iris4d) basic_machine=mips-sgi case $os in @@ -549,6 +553,10 @@ basic_machine=ns32k-utek os=-sysv ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; miniframe) basic_machine=m68000-convergent ;; @@ -579,7 +587,7 @@ os=-coff ;; msdos) - basic_machine=i386-unknown + basic_machine=i386-pc os=-msdos ;; mvs) @@ -689,7 +697,7 @@ basic_machine=i686-pc ;; pentiumii | pentium2) - basic_machine=i786-pc + basic_machine=i686-pc ;; pentium-* | p5-* | k5-* | k6-* | nexgen-*) basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` @@ -698,12 +706,12 @@ basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pentiumii-* | pentium2-*) - basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` ;; pn) basic_machine=pn-gould ;; - power) basic_machine=rs6000-ibm + power) basic_machine=power-ibm ;; ppc) basic_machine=powerpc-unknown ;; @@ -718,6 +726,10 @@ ps2) basic_machine=i386-ibm ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; rom68k) basic_machine=m68k-rom68k os=-coff @@ -908,6 +920,10 @@ vax) basic_machine=vax-dec ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; pdp11) basic_machine=pdp11-dec ;; @@ -998,7 +1014,8 @@ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ | -mingw32* | -linux-gnu* | -uxpv* | -beos* | -mpeix* | -udk* \ | -interix* | -uwin* | -rhapsody* | -darwin* | -opened* \ - | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux*) + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* | -os2*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1014,7 +1031,6 @@ os=-nto-qnx ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -os2 \ | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; @@ -1097,7 +1113,7 @@ -xenix) os=-xenix ;; - -*mint | -*MiNT) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) os=-mint ;; -none) @@ -1131,6 +1147,9 @@ arm*-semi) os=-aout ;; + pdp10-*) + os=-tops20 + ;; pdp11-*) os=-none ;; @@ -1239,7 +1258,7 @@ *-masscomp) os=-rtu ;; - f301-fujitsu) + f30[01]-fujitsu | f700-fujitsu) os=-uxpv ;; *-rom68k) @@ -1317,7 +1336,7 @@ -mpw* | -macos*) vendor=apple ;; - -*mint | -*MiNT) + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) vendor=atari ;; esac @@ -1330,7 +1349,7 @@ # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) -# time-stamp-start: "version='" +# time-stamp-start: "timestamp='" # time-stamp-format: "%:y-%02m-%02d" # time-stamp-end: "'" # End: Index: xc/programs/xterm/configure diff -u xc/programs/xterm/configure:3.54 xc/programs/xterm/configure:3.58 --- xc/programs/xterm/configure:3.54 Wed Dec 6 21:22:12 2000 +++ xc/programs/xterm/configure Sat Apr 28 09:51:55 2001 @@ -205,13 +205,14 @@ --disable-highlighting disable support for color highlighting --disable-doublechars disable support for double-size chars --disable-boxchars disable fallback-support for box chars + --disable-freetype disable freetype library-support --enable-hp-fkeys enable support for HP-style function keys --enable-sco-fkeys enable support for SCO-style function keys --disable-i18n disable internationalization --disable-initial-erase disable setup for stty erase - --disable-input-method disable input-method EOF cat <&6 -echo "configure:603: checking host system type" >&5 +echo "configure:604: checking host system type" >&5 host_alias=$host case "$host_alias" in @@ -649,7 +650,8 @@ ### checks for alternative programs case "$host_os" in -openedition) : ${CFLAGS="-O2 -Wc,dll -D_ALL_SOURCE -Wl,EDIT=NO"} +openedition) : ${CFLAGS="-O2 -Wc,dll -Wl,EDIT=NO"} + : ${CPPFLAGS="-D_ALL_SOURCE"} : ${LIBS="/usr/lib/Xaw.x /usr/lib/SM.x /usr/lib/ICE.x /usr/lib/X11.x"} : ${CC=c89};; esac @@ -657,7 +659,7 @@ # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:661: checking for $ac_word" >&5 +echo "configure:663: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -687,7 +689,7 @@ # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:691: checking for $ac_word" >&5 +echo "configure:693: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -738,7 +740,7 @@ # Extract the first word of "cl", so it can be a program name with args. set dummy cl; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:742: checking for $ac_word" >&5 +echo "configure:744: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -770,7 +772,7 @@ fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 -echo "configure:774: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 +echo "configure:776: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 ac_ext=c # CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. @@ -781,12 +783,12 @@ cat > conftest.$ac_ext << EOF -#line 785 "configure" +#line 787 "configure" #include "confdefs.h" main(){return(0);} EOF -if { (eval echo configure:790: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:792: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then ac_cv_prog_cc_works=yes # If we can't run a trivial program, we are probably using a cross compiler. if (./conftest; exit) 2>/dev/null; then @@ -812,12 +814,12 @@ { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } fi echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 -echo "configure:816: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "configure:818: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 cross_compiling=$ac_cv_prog_cc_cross echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 -echo "configure:821: checking whether we are using GNU C" >&5 +echo "configure:823: checking whether we are using GNU C" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -826,7 +828,7 @@ yes; #endif EOF -if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:830: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:832: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then ac_cv_prog_gcc=yes else ac_cv_prog_gcc=no @@ -845,7 +847,7 @@ ac_save_CFLAGS="$CFLAGS" CFLAGS= echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 -echo "configure:849: checking whether ${CC-cc} accepts -g" >&5 +echo "configure:851: checking whether ${CC-cc} accepts -g" >&5 if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -877,7 +879,7 @@ fi echo $ac_n "checking how to run the C preprocessor""... $ac_c" 1>&6 -echo "configure:881: checking how to run the C preprocessor" >&5 +echo "configure:883: checking how to run the C preprocessor" >&5 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then CPP= @@ -892,13 +894,13 @@ # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:902: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:904: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -909,13 +911,13 @@ rm -rf conftest* CPP="${CC-cc} -E -traditional-cpp" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:919: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:921: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -926,13 +928,13 @@ rm -rf conftest* CPP="${CC-cc} -nologo -E" cat > conftest.$ac_ext < Syntax Error EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:936: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:938: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then : @@ -958,13 +960,13 @@ if test $ac_cv_prog_gcc = yes; then echo $ac_n "checking whether ${CC-cc} needs -traditional""... $ac_c" 1>&6 -echo "configure:962: checking whether ${CC-cc} needs -traditional" >&5 +echo "configure:964: checking whether ${CC-cc} needs -traditional" >&5 if eval "test \"`echo '$''{'ac_cv_prog_gcc_traditional'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_pattern="Autoconf.*'x'" cat > conftest.$ac_ext < Autoconf TIOCGETP @@ -982,7 +984,7 @@ if test $ac_cv_prog_gcc_traditional = no; then cat > conftest.$ac_ext < Autoconf TCGETA @@ -1008,7 +1010,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:1012: checking for $ac_word" >&5 +echo "configure:1014: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_prog_AWK'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1049,7 +1051,7 @@ # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 -echo "configure:1053: checking for a BSD compatible install" >&5 +echo "configure:1055: checking for a BSD compatible install" >&5 if test -z "$INSTALL"; then if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1101,12 +1103,31 @@ test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' +if test "$program_transform_name" = s,x,x,; then + program_transform_name= +else + # Double any \ or $. echo might interpret backslashes. + cat <<\EOF_SED > conftestsed +s,\\,\\\\,g; s,\$,$$,g +EOF_SED + program_transform_name="`echo $program_transform_name|sed -f conftestsed`" + rm -f conftestsed +fi +test "$program_prefix" != NONE && + program_transform_name="s,^,${program_prefix},; $program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s,\$\$,${program_suffix},; $program_transform_name" + +# sed with no file args requires a program. +test "$program_transform_name" = "" && program_transform_name="s,x,x," + ### checks for UNIX variants that set C preprocessor variables echo $ac_n "checking for AIX""... $ac_c" 1>&6 -echo "configure:1108: checking for AIX" >&5 +echo "configure:1129: checking for AIX" >&5 cat > conftest.$ac_ext <&6 -echo "configure:1132: checking for POSIXized ISC" >&5 +echo "configure:1153: checking for POSIXized ISC" >&5 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then @@ -1150,17 +1171,17 @@ ac_safe=`echo "minix/config.h" | sed 'y%./+-%__p_%'` echo $ac_n "checking for minix/config.h""... $ac_c" 1>&6 -echo "configure:1154: checking for minix/config.h" >&5 +echo "configure:1175: checking for minix/config.h" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1164: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1185: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1207,17 +1228,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1211: checking for $ac_hdr" >&5 +echo "configure:1232: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1221: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1242: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1243,17 +1264,52 @@ fi done +echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 +echo "configure:1269: checking whether time.h and sys/time.h may both be included" >&5 +if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.$ac_ext < +#include +#include +int main() { +struct tm *tp; +; return 0; } +EOF +if { (eval echo configure:1283: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + ac_cv_header_time=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + ac_cv_header_time=no +fi +rm -f conftest* +fi + +echo "$ac_t""$ac_cv_header_time" 1>&6 +if test $ac_cv_header_time = yes; then + cat >> confdefs.h <<\EOF +#define TIME_WITH_SYS_TIME 1 +EOF + +fi + ### checks for typedefs echo $ac_n "checking for size_t in or ""... $ac_c" 1>&6 -echo "configure:1251: checking for size_t in or " >&5 +echo "configure:1307: checking for size_t in or " >&5 if eval "test \"`echo '$''{'cf_cv_type_size_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1266,7 +1322,7 @@ size_t x ; return 0; } EOF -if { (eval echo configure:1270: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1326: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_size_t=yes else @@ -1286,12 +1342,12 @@ echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:1290: checking for ANSI C header files" >&5 +echo "configure:1346: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -1299,7 +1355,7 @@ #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1303: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1359: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1316,7 +1372,7 @@ if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1334,7 +1390,7 @@ if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -1355,7 +1411,7 @@ : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -1366,7 +1422,7 @@ exit (0); } EOF -if { (eval echo configure:1370: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1426: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -1390,12 +1446,12 @@ fi echo $ac_n "checking for time_t""... $ac_c" 1>&6 -echo "configure:1394: checking for time_t" >&5 +echo "configure:1450: checking for time_t" >&5 if eval "test \"`echo '$''{'ac_cv_type_time_t'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #if STDC_HEADERS @@ -1426,6 +1482,7 @@ ### checks for library functions for ac_func in \ bcopy \ + getlogin \ memmove \ strerror \ tcgetattr \ @@ -1433,12 +1490,12 @@ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:1437: checking for $ac_func" >&5 +echo "configure:1494: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1522: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -1487,12 +1544,12 @@ echo $ac_n "checking for memmove""... $ac_c" 1>&6 -echo "configure:1491: checking for memmove" >&5 +echo "configure:1548: checking for memmove" >&5 if eval "test \"`echo '$''{'ac_cv_func_memmove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1576: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_memmove=yes" else @@ -1534,12 +1591,12 @@ echo "$ac_t""no" 1>&6 echo $ac_n "checking for bcopy""... $ac_c" 1>&6 -echo "configure:1538: checking for bcopy" >&5 +echo "configure:1595: checking for bcopy" >&5 if eval "test \"`echo '$''{'ac_cv_func_bcopy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1623: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_bcopy=yes" else @@ -1578,7 +1635,7 @@ echo "$ac_t""yes" 1>&6 echo $ac_n "checking if bcopy does overlapping moves""... $ac_c" 1>&6 -echo "configure:1582: checking if bcopy does overlapping moves" >&5 +echo "configure:1639: checking if bcopy does overlapping moves" >&5 if eval "test \"`echo '$''{'cf_cv_good_bcopy'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1587,7 +1644,7 @@ cf_cv_good_bcopy=unknown else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1661: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_good_bcopy=yes else @@ -1638,7 +1695,7 @@ echo $ac_n "checking for full tgetent function""... $ac_c" 1>&6 -echo "configure:1642: checking for full tgetent function" >&5 +echo "configure:1699: checking for full tgetent function" >&5 if eval "test \"`echo '$''{'cf_cv_lib_tgetent'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1653,7 +1710,7 @@ echo "cross-compiling, cannot verify if a termcap/tgetent is present in $cf_termlib" 1>&5 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1728: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then echo "yes, there is a termcap/tgetent in $cf_termlib" 1>&5 if test -n "$cf_termlib" ; then @@ -1703,7 +1760,7 @@ EOF cat > conftest.$ac_ext < @@ -1714,7 +1771,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:1718: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1775: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cat >> confdefs.h <<\EOF #define HAVE_TERMCAP_H 1 @@ -1732,7 +1789,7 @@ # validate values for the TERM environment variable given to # child processes. echo $ac_n "checking for partial tgetent function""... $ac_c" 1>&6 -echo "configure:1736: checking for partial tgetent function" >&5 +echo "configure:1793: checking for partial tgetent function" >&5 if eval "test \"`echo '$''{'cf_cv_lib_part_tgetent'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1741,14 +1798,14 @@ for cf_termlib in $cf_TERMLIB ; do LIBS="$cf_save_LIBS -l$cf_termlib" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "there is a terminfo/tgetent in $cf_termlib" 1>&5 cf_cv_lib_part_tgetent="-l$cf_termlib" @@ -1771,17 +1828,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1775: checking for $ac_hdr" >&5 +echo "configure:1832: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1785: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1842: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1822,17 +1879,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1826: checking for $ac_hdr" >&5 +echo "configure:1883: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1836: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1893: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1859,13 +1916,13 @@ done echo $ac_n "checking for lastlog path""... $ac_c" 1>&6 -echo "configure:1863: checking for lastlog path" >&5 +echo "configure:1920: checking for lastlog path" >&5 if eval "test \"`echo '$''{'cf_cv_path_lastlog'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -1880,7 +1937,7 @@ char *path = _PATH_LASTLOG ; return 0; } EOF -if { (eval echo configure:1884: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1941: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_path_lastlog="_PATH_LASTLOG" else @@ -1907,7 +1964,7 @@ echo $ac_n "checking for utmp implementation""... $ac_c" 1>&6 -echo "configure:1911: checking for utmp implementation" >&5 +echo "configure:1968: checking for utmp implementation" >&5 if eval "test \"`echo '$''{'cf_cv_have_utmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1915,7 +1972,7 @@ cf_cv_have_utmp=no for cf_header in utmpx utmp ; do cat > conftest.$ac_ext < @@ -1931,7 +1988,7 @@ ; return 0; } EOF -if { (eval echo configure:1935: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1992: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp=$cf_header break @@ -1941,7 +1998,7 @@ rm -rf conftest* cat > conftest.$ac_ext < @@ -1957,7 +2014,7 @@ ; return 0; } EOF -if { (eval echo configure:1961: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2018: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp=$cf_header cat >> confdefs.h <<\EOF @@ -1992,13 +2049,13 @@ if test $cf_cv_have_utmp != no ; then echo $ac_n "checking if utmp.ut_host is declared""... $ac_c" 1>&6 -echo "configure:1996: checking if utmp.ut_host is declared" >&5 +echo "configure:2053: checking if utmp.ut_host is declared" >&5 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_host'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2007,7 +2064,7 @@ struct $cf_cv_have_utmp x; char *y = &x.ut_host[0] ; return 0; } EOF -if { (eval echo configure:2011: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2068: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_host=yes else @@ -2031,7 +2088,7 @@ if test $cf_cv_have_utmp != no ; then echo $ac_n "checking for exit-status in $cf_cv_have_utmp""... $ac_c" 1>&6 -echo "configure:2035: checking for exit-status in $cf_cv_have_utmp" >&5 +echo "configure:2092: checking for exit-status in $cf_cv_have_utmp" >&5 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_xstatus'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2043,7 +2100,7 @@ ut_exit.ut_exit do cat > conftest.$ac_ext < @@ -2052,7 +2109,7 @@ struct $cf_cv_have_utmp x; long y = x.$cf_result = 0 ; return 0; } EOF -if { (eval echo configure:2056: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2113: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_xstatus=$cf_result break @@ -2084,13 +2141,13 @@ if test $cf_cv_have_utmp != no ; then echo $ac_n "checking if utmp.ut_xtime is declared""... $ac_c" 1>&6 -echo "configure:2088: checking if utmp.ut_xtime is declared" >&5 +echo "configure:2145: checking if utmp.ut_xtime is declared" >&5 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_xtime'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2099,7 +2156,7 @@ struct $cf_cv_have_utmp x; long y = x.ut_xtime = 0 ; return 0; } EOF -if { (eval echo configure:2103: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2160: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_xtime=yes else @@ -2107,7 +2164,7 @@ cat conftest.$ac_ext >&5 rm -rf conftest* cat > conftest.$ac_ext < @@ -2116,7 +2173,7 @@ struct $cf_cv_have_utmp x; long y = x.ut_tv.tv_sec ; return 0; } EOF -if { (eval echo configure:2120: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2177: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_xtime=define else @@ -2151,13 +2208,13 @@ if test $cf_cv_have_utmp != no ; then echo $ac_n "checking if utmp.ut_session is declared""... $ac_c" 1>&6 -echo "configure:2155: checking if utmp.ut_session is declared" >&5 +echo "configure:2212: checking if utmp.ut_session is declared" >&5 if eval "test \"`echo '$''{'cf_cv_have_utmp_ut_session'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2166,7 +2223,7 @@ struct $cf_cv_have_utmp x; long y = x.ut_session ; return 0; } EOF -if { (eval echo configure:2170: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2227: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_have_utmp_ut_session=yes else @@ -2191,14 +2248,14 @@ echo $ac_n "checking if $cf_cv_have_utmp is SYSV flavor""... $ac_c" 1>&6 -echo "configure:2195: checking if $cf_cv_have_utmp is SYSV flavor" >&5 +echo "configure:2252: checking if $cf_cv_have_utmp is SYSV flavor" >&5 if eval "test \"`echo '$''{'cf_cv_sysv_utmp'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else test "$cf_cv_have_utmp" = "utmp" && cf_prefix="ut" || cf_prefix="utx" cat > conftest.$ac_ext < @@ -2212,7 +2269,7 @@ end${cf_prefix}ent(); ; return 0; } EOF -if { (eval echo configure:2216: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2273: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_sysv_utmp=yes else @@ -2235,7 +2292,7 @@ echo $ac_n "checking if you want to link with utempter""... $ac_c" 1>&6 -echo "configure:2239: checking if you want to link with utempter" >&5 +echo "configure:2296: checking if you want to link with utempter" >&5 # Check whether --with-utempter or --without-utempter was given. if test "${with_utempter+set}" = set; then @@ -2250,7 +2307,7 @@ if test $use_utempter = yes ; then echo $ac_n "checking if we can link with utempter library""... $ac_c" 1>&6 -echo "configure:2254: checking if we can link with utempter library" >&5 +echo "configure:2311: checking if we can link with utempter library" >&5 if eval "test \"`echo '$''{'cf_cv_have_utempter'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2258,7 +2315,7 @@ cf_save_LIBS="$LIBS" LIBS="-lutempter $LIBS" cat > conftest.$ac_ext < @@ -2270,7 +2327,7 @@ ; return 0; } EOF -if { (eval echo configure:2274: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2331: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_have_utempter=yes @@ -2301,13 +2358,13 @@ echo $ac_n "checking if external errno is declared""... $ac_c" 1>&6 -echo "configure:2305: checking if external errno is declared" >&5 +echo "configure:2362: checking if external errno is declared" >&5 if eval "test \"`echo '$''{'cf_cv_dcl_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2381: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* eval 'cf_cv_dcl_'errno'=yes' else @@ -2351,13 +2408,13 @@ # It's possible (for near-UNIX clones) that the data doesn't exist echo $ac_n "checking if external errno exists""... $ac_c" 1>&6 -echo "configure:2355: checking if external errno exists" >&5 +echo "configure:2412: checking if external errno exists" >&5 if eval "test \"`echo '$''{'cf_cv_have_errno'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2428: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval 'cf_cv_have_'errno'=yes' else @@ -2399,7 +2456,7 @@ echo $ac_n "checking for tty group name""... $ac_c" 1>&6 -echo "configure:2403: checking for tty group name" >&5 +echo "configure:2460: checking for tty group name" >&5 if eval "test \"`echo '$''{'cf_cv_tty_group_name'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2457,7 +2514,7 @@ echo $ac_n "checking if we may use tty group""... $ac_c" 1>&6 -echo "configure:2461: checking if we may use tty group" >&5 +echo "configure:2518: checking if we may use tty group" >&5 if eval "test \"`echo '$''{'cf_cv_tty_group'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2466,7 +2523,7 @@ cf_cv_tty_group=unknown else cat > conftest.$ac_ext < @@ -2491,7 +2548,7 @@ } EOF -if { (eval echo configure:2495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_tty_group=yes else @@ -2516,7 +2573,7 @@ ### checks for compiler characteristics echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 -echo "configure:2520: checking for ${CC-cc} option to accept ANSI C" >&5 +echo "configure:2577: checking for ${CC-cc} option to accept ANSI C" >&5 if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2543,8 +2600,14 @@ for cf_add_cflags in $cf_arg do case $cf_add_cflags in #(vi - -I*|-D*|-U*|-E|-P|-C) #(vi - CPPFLAGS="$CPPFLAGS $cf_add_cflags" + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case "$CPPFLAGS" in + *$cf_add_cflags) + ;; + *) + CPPFLAGS="$CPPFLAGS $cf_add_cflags" + ;; + esac ;; *) CFLAGS="$CFLAGS $cf_add_cflags" @@ -2553,7 +2616,7 @@ done cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2636: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ansi_cc="$cf_arg"; break else @@ -2587,7 +2650,25 @@ if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then - CFLAGS="$CFLAGS $cf_cv_ansi_cc" + +for cf_add_cflags in $cf_cv_ansi_cc +do + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case "$CPPFLAGS" in + *$cf_add_cflags) + ;; + *) + CPPFLAGS="$CPPFLAGS $cf_add_cflags" + ;; + esac + ;; + *) + CFLAGS="$CFLAGS $cf_add_cflags" + ;; + esac +done + else cat >> confdefs.h <<\EOF #define CC_HAS_PROTOS 1 @@ -2597,12 +2678,12 @@ fi echo $ac_n "checking for working const""... $ac_c" 1>&6 -echo "configure:2601: checking for working const" >&5 +echo "configure:2682: checking for working const" >&5 if eval "test \"`echo '$''{'ac_cv_c_const'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2736: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_c_const=yes else @@ -2675,12 +2756,12 @@ ### checks for system services and user specified options echo $ac_n "checking for sys/wait.h that is POSIX.1 compatible""... $ac_c" 1>&6 -echo "configure:2679: checking for sys/wait.h that is POSIX.1 compatible" >&5 +echo "configure:2760: checking for sys/wait.h that is POSIX.1 compatible" >&5 if eval "test \"`echo '$''{'ac_cv_header_sys_wait_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -2696,7 +2777,7 @@ s = WIFEXITED (s) ? WEXITSTATUS (s) : 1; ; return 0; } EOF -if { (eval echo configure:2700: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2781: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_sys_wait_h=yes else @@ -2719,13 +2800,13 @@ echo $ac_n "checking for POSIX wait functions""... $ac_c" 1>&6 -echo "configure:2723: checking for POSIX wait functions" >&5 +echo "configure:2804: checking for POSIX wait functions" >&5 if eval "test \"`echo '$''{'cf_cv_posix_wait'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2743,7 +2824,7 @@ ; return 0; } EOF -if { (eval echo configure:2747: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2828: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_posix_wait=yes else @@ -2764,13 +2845,13 @@ echo $ac_n "checking if this platform has SYSV flavor""... $ac_c" 1>&6 -echo "configure:2768: checking if this platform has SYSV flavor" >&5 +echo "configure:2849: checking if this platform has SYSV flavor" >&5 if eval "test \"`echo '$''{'cf_cv_sysv'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2795,7 +2876,7 @@ ; return 0; } EOF -if { (eval echo configure:2799: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2880: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_sysv=yes else @@ -2816,7 +2897,7 @@ echo $ac_n "checking for elf_begin in -lelf""... $ac_c" 1>&6 -echo "configure:2820: checking for elf_begin in -lelf" >&5 +echo "configure:2901: checking for elf_begin in -lelf" >&5 ac_lib_var=`echo elf'_'elf_begin | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2824,7 +2905,7 @@ ac_save_LIBS="$LIBS" LIBS="-lelf $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2920: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2852,13 +2933,13 @@ echo "$ac_t""yes" 1>&6 echo $ac_n "checking if this is an SVR4 system""... $ac_c" 1>&6 -echo "configure:2856: checking if this is an SVR4 system" >&5 +echo "configure:2937: checking if this is an SVR4 system" >&5 if eval "test \"`echo '$''{'cf_cv_svr4'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -2879,7 +2960,7 @@ ; return 0; } EOF -if { (eval echo configure:2883: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2964: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_svr4=yes else @@ -2905,13 +2986,13 @@ echo $ac_n "checking if we must define _GNU_SOURCE""... $ac_c" 1>&6 -echo "configure:2909: checking if we must define _GNU_SOURCE" >&5 +echo "configure:2990: checking if we must define _GNU_SOURCE" >&5 if eval "test \"`echo '$''{'cf_cv_gnu_source'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -2921,7 +3002,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:2925: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3006: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_gnu_source=no else @@ -2931,7 +3012,7 @@ cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" cat > conftest.$ac_ext < int main() { @@ -2941,7 +3022,7 @@ #endif ; return 0; } EOF -if { (eval echo configure:2945: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3026: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_gnu_source=no else @@ -2966,7 +3047,7 @@ # Uses ac_ vars as temps to allow command line to override cache and checks. # --without-x overrides everything else, but does not touch the cache. echo $ac_n "checking for X""... $ac_c" 1>&6 -echo "configure:2970: checking for X" >&5 +echo "configure:3051: checking for X" >&5 # Check whether --with-x or --without-x was given. @@ -3029,12 +3110,12 @@ # First, try using that file with no special directory specified. cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3038: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:3119: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3103,14 +3184,14 @@ ac_save_LIBS="$LIBS" LIBS="-l$x_direct_test_library $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3195: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* LIBS="$ac_save_LIBS" # We can link X programs with no special library path. @@ -3210,7 +3291,7 @@ # FIXME: modify the library lookup in autoconf to # allow _s.a suffix ahead of .a echo $ac_n "checking for open in -lc_s""... $ac_c" 1>&6 -echo "configure:3214: checking for open in -lc_s" >&5 +echo "configure:3295: checking for open in -lc_s" >&5 ac_lib_var=`echo c_s'_'open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3218,7 +3299,7 @@ ac_save_LIBS="$LIBS" LIBS="-lc_s $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3314: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3246,7 +3327,7 @@ echo "$ac_t""yes" 1>&6 LIBS="-lc_s $LIBS" echo $ac_n "checking for gethostname in -lbsd""... $ac_c" 1>&6 -echo "configure:3250: checking for gethostname in -lbsd" >&5 +echo "configure:3331: checking for gethostname in -lbsd" >&5 ac_lib_var=`echo bsd'_'gethostname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3254,7 +3335,7 @@ ac_save_LIBS="$LIBS" LIBS="-lbsd $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3350: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3282,7 +3363,7 @@ echo "$ac_t""yes" 1>&6 LIBS="-lbsd $LIBS" echo $ac_n "checking for gethostname in -lnsl_s""... $ac_c" 1>&6 -echo "configure:3286: checking for gethostname in -lnsl_s" >&5 +echo "configure:3367: checking for gethostname in -lnsl_s" >&5 ac_lib_var=`echo nsl_s'_'gethostname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3290,7 +3371,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl_s $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3386: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3318,7 +3399,7 @@ echo "$ac_t""yes" 1>&6 LIBS="-lnsl_s $LIBS" echo $ac_n "checking for XOpenDisplay in -lX11_s""... $ac_c" 1>&6 -echo "configure:3322: checking for XOpenDisplay in -lX11_s" >&5 +echo "configure:3403: checking for XOpenDisplay in -lX11_s" >&5 ac_lib_var=`echo X11_s'_'XOpenDisplay | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3326,7 +3407,7 @@ ac_save_LIBS="$LIBS" LIBS="-lX11_s $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3354,7 +3435,7 @@ echo "$ac_t""yes" 1>&6 LIBS="-lX11_s $LIBS" echo $ac_n "checking for XtAppInitialize in -lXt_s""... $ac_c" 1>&6 -echo "configure:3358: checking for XtAppInitialize in -lXt_s" >&5 +echo "configure:3439: checking for XtAppInitialize in -lXt_s" >&5 ac_lib_var=`echo Xt_s'_'XtAppInitialize | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3362,7 +3443,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXt_s $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3458: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3414,7 +3495,7 @@ ;; *) echo $ac_n "checking for socket in -lsocket""... $ac_c" 1>&6 -echo "configure:3418: checking for socket in -lsocket" >&5 +echo "configure:3499: checking for socket in -lsocket" >&5 ac_lib_var=`echo socket'_'socket | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3422,7 +3503,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3518: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3461,7 +3542,7 @@ fi echo $ac_n "checking for gethostname in -lnsl""... $ac_c" 1>&6 -echo "configure:3465: checking for gethostname in -lnsl" >&5 +echo "configure:3546: checking for gethostname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3469,7 +3550,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3565: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3531,17 +3612,17 @@ case "`(uname -sr) 2>/dev/null`" in "SunOS 5"*) echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6 -echo "configure:3535: checking whether -R must be followed by a space" >&5 +echo "configure:3616: checking whether -R must be followed by a space" >&5 ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3626: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_nospace=yes else @@ -3557,14 +3638,14 @@ else LIBS="$ac_xsave_LIBS -R $x_libraries" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3649: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* ac_R_space=yes else @@ -3596,7 +3677,7 @@ # libraries were built with DECnet support. And karl@cs.umb.edu says # the Alpha needs dnet_stub (dnet does not exist). echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6 -echo "configure:3600: checking for dnet_ntoa in -ldnet" >&5 +echo "configure:3681: checking for dnet_ntoa in -ldnet" >&5 ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3604,7 +3685,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3700: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3637,7 +3718,7 @@ if test $ac_cv_lib_dnet_dnet_ntoa = no; then echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6 -echo "configure:3641: checking for dnet_ntoa in -ldnet_stub" >&5 +echo "configure:3722: checking for dnet_ntoa in -ldnet_stub" >&5 ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3645,7 +3726,7 @@ ac_save_LIBS="$LIBS" LIBS="-ldnet_stub $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3741: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3685,12 +3766,12 @@ # The nsl library prevents programs from opening the X display # on Irix 5.2, according to dickey@clark.net. echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6 -echo "configure:3689: checking for gethostbyname" >&5 +echo "configure:3770: checking for gethostbyname" >&5 if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3798: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_gethostbyname=yes" else @@ -3734,7 +3815,7 @@ if test $ac_cv_func_gethostbyname = no; then echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6 -echo "configure:3738: checking for gethostbyname in -lnsl" >&5 +echo "configure:3819: checking for gethostbyname in -lnsl" >&5 ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3742,7 +3823,7 @@ ac_save_LIBS="$LIBS" LIBS="-lnsl $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3838: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3783,12 +3864,12 @@ # -lsocket must be given before -lnsl if both are needed. # We assume that if connect needs -lnsl, so does gethostbyname. echo $ac_n "checking for connect""... $ac_c" 1>&6 -echo "configure:3787: checking for connect" >&5 +echo "configure:3868: checking for connect" >&5 if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3896: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_connect=yes" else @@ -3832,7 +3913,7 @@ if test $ac_cv_func_connect = no; then echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6 -echo "configure:3836: checking for connect in -lsocket" >&5 +echo "configure:3917: checking for connect in -lsocket" >&5 ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3840,7 +3921,7 @@ ac_save_LIBS="$LIBS" LIBS="-lsocket $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3936: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3875,12 +3956,12 @@ # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX. echo $ac_n "checking for remove""... $ac_c" 1>&6 -echo "configure:3879: checking for remove" >&5 +echo "configure:3960: checking for remove" >&5 if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3988: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_remove=yes" else @@ -3924,7 +4005,7 @@ if test $ac_cv_func_remove = no; then echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6 -echo "configure:3928: checking for remove in -lposix" >&5 +echo "configure:4009: checking for remove in -lposix" >&5 ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3932,7 +4013,7 @@ ac_save_LIBS="$LIBS" LIBS="-lposix $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4028: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3967,12 +4048,12 @@ # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay. echo $ac_n "checking for shmat""... $ac_c" 1>&6 -echo "configure:3971: checking for shmat" >&5 +echo "configure:4052: checking for shmat" >&5 if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4080: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_shmat=yes" else @@ -4016,7 +4097,7 @@ if test $ac_cv_func_shmat = no; then echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6 -echo "configure:4020: checking for shmat in -lipc" >&5 +echo "configure:4101: checking for shmat in -lipc" >&5 ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4024,7 +4105,7 @@ ac_save_LIBS="$LIBS" LIBS="-lipc $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4120: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4068,7 +4149,7 @@ # libraries we check for below, so use a different variable. # --interran@uluru.Stanford.EDU, kb@cs.umb.edu. echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6 -echo "configure:4072: checking for IceConnectionNumber in -lICE" >&5 +echo "configure:4153: checking for IceConnectionNumber in -lICE" >&5 ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4076,7 +4157,7 @@ ac_save_LIBS="$LIBS" LIBS="-lICE $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4172: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4112,9 +4193,27 @@ fi LDFLAGS="$LDFLAGS $X_LIBS" - CFLAGS="$CFLAGS $X_CFLAGS" + +for cf_add_cflags in $X_CFLAGS +do + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case "$CPPFLAGS" in + *$cf_add_cflags) + ;; + *) + CPPFLAGS="$CPPFLAGS $cf_add_cflags" + ;; + esac + ;; + *) + CFLAGS="$CFLAGS $cf_add_cflags" + ;; + esac +done + echo $ac_n "checking for XOpenDisplay in -lX11""... $ac_c" 1>&6 -echo "configure:4118: checking for XOpenDisplay in -lX11" >&5 +echo "configure:4217: checking for XOpenDisplay in -lX11" >&5 ac_lib_var=`echo X11'_'XOpenDisplay | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4122,7 +4221,7 @@ ac_save_LIBS="$LIBS" LIBS="-lX11 $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4236: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4154,7 +4253,7 @@ fi echo $ac_n "checking for XtAppInitialize in -lXt""... $ac_c" 1>&6 -echo "configure:4158: checking for XtAppInitialize in -lXt" >&5 +echo "configure:4257: checking for XtAppInitialize in -lXt" >&5 ac_lib_var=`echo Xt'_'XtAppInitialize | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4162,7 +4261,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXt $X_PRE_LIBS $LIBS $X_EXTRA_LIBS $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4276: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4200,7 +4299,25 @@ else LDFLAGS="$LDFLAGS $X_LIBS" - CFLAGS="$CFLAGS $X_CFLAGS" + +for cf_add_cflags in $X_CFLAGS +do + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case "$CPPFLAGS" in + *$cf_add_cflags) + ;; + *) + CPPFLAGS="$CPPFLAGS $cf_add_cflags" + ;; + esac + ;; + *) + CFLAGS="$CFLAGS $cf_add_cflags" + ;; + esac +done + fi if test $cf_have_X_LIBS = no ; then @@ -4210,18 +4327,6 @@ fi -# Change CPPFLAGS temporarily so that checks for X include files will -# look in any directories specified with `--x-includes=DIR', obtained -# via xmkmf, or located by AC_PATH_XTRA. These flags are already in -# CFLAGS (put there by CF_X_TOOLKIT), but that doesn't help here because -# AC_CHECK_HEADERS uses cpp, not cc. - -if test "${x_includes}" != NONE && test -n "${x_includes}"; then - C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"` -fi -cf_save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS" - for ac_hdr in \ X11/DECkeysym.h \ X11/Sunkeysym.h \ @@ -4230,17 +4335,17 @@ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:4234: checking for $ac_hdr" >&5 +echo "configure:4339: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:4244: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4349: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -4288,7 +4393,7 @@ echo $ac_n "checking for XextCreateExtension in -lXext""... $ac_c" 1>&6 -echo "configure:4292: checking for XextCreateExtension in -lXext" >&5 +echo "configure:4397: checking for XextCreateExtension in -lXext" >&5 ac_lib_var=`echo Xext'_'XextCreateExtension | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4296,7 +4401,7 @@ ac_save_LIBS="$LIBS" LIBS="-lXext $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4416: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4344,13 +4449,13 @@ if test $cf_path != default ; then CPPFLAGS="-I$cf_path/include $cf_save" echo $ac_n "checking for $cf_test in $cf_path""... $ac_c" 1>&6 -echo "configure:4348: checking for $cf_test in $cf_path" >&5 +echo "configure:4453: checking for $cf_test in $cf_path" >&5 else echo $ac_n "checking for $cf_test""... $ac_c" 1>&6 -echo "configure:4351: checking for $cf_test" >&5 +echo "configure:4456: checking for $cf_test" >&5 fi cat > conftest.$ac_ext < @@ -4359,7 +4464,7 @@ ; return 0; } EOF -if { (eval echo configure:4363: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4468: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_result=yes else @@ -4385,21 +4490,21 @@ if test $cf_path != default ; then LIBS="-L$cf_path/lib $cf_lib $LIBS" echo $ac_n "checking for $cf_lib in $cf_path""... $ac_c" 1>&6 -echo "configure:4389: checking for $cf_lib in $cf_path" >&5 +echo "configure:4494: checking for $cf_lib in $cf_path" >&5 else LIBS="$cf_lib $LIBS" echo $ac_n "checking for $cf_test in $cf_lib""... $ac_c" 1>&6 -echo "configure:4393: checking for $cf_test in $cf_lib" >&5 +echo "configure:4498: checking for $cf_test in $cf_lib" >&5 fi cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else @@ -4437,13 +4542,13 @@ echo $ac_n "checking for declaration of fd_set""... $ac_c" 1>&6 -echo "configure:4441: checking for declaration of fd_set" >&5 +echo "configure:4546: checking for declaration of fd_set" >&5 if eval "test \"`echo '$''{'cf_cv_type_fd_set'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else echo "trying sys/types alone" 1>&5 cat > conftest.$ac_ext < @@ -4451,7 +4556,7 @@ fd_set x ; return 0; } EOF -if { (eval echo configure:4455: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4560: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_fd_set=sys/types.h else @@ -4460,7 +4565,7 @@ rm -rf conftest* echo "trying X11/Xpoll.h" 1>&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4579: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_fd_set=X11/Xpoll.h else @@ -4479,7 +4584,7 @@ rm -rf conftest* echo "trying sys/select.h" 1>&5 cat > conftest.$ac_ext < @@ -4488,7 +4593,7 @@ fd_set x ; return 0; } EOF -if { (eval echo configure:4492: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4597: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_type_fd_set=sys/select.h else @@ -4514,13 +4619,13 @@ echo $ac_n "checking for IRIX 6.5 baud-rate redefinitions""... $ac_c" 1>&6 -echo "configure:4518: checking for IRIX 6.5 baud-rate redefinitions" >&5 +echo "configure:4623: checking for IRIX 6.5 baud-rate redefinitions" >&5 if eval "test \"`echo '$''{'cf_cv_termio_c_ispeed'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4533,7 +4638,7 @@ ; return 0; } EOF -if { (eval echo configure:4537: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4642: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_termio_c_ispeed=yes @@ -4554,8 +4659,6 @@ -CPPFLAGS="$cf_save_CPPFLAGS" - LIBS="$LIBS $X_EXTRA_LIBS" # Check for openpty() in -lutil if the UNIX98-style pty functions are not @@ -4563,12 +4666,12 @@ for ac_func in grantpt do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4567: checking for $ac_func" >&5 +echo "configure:4670: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4698: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4613,7 +4716,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for openpty in -lutil""... $ac_c" 1>&6 -echo "configure:4617: checking for openpty in -lutil" >&5 +echo "configure:4720: checking for openpty in -lutil" >&5 ac_lib_var=`echo util'_'openpty | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -4621,7 +4724,7 @@ ac_save_LIBS="$LIBS" LIBS="-lutil $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -4666,7 +4769,7 @@ # Extract the first word of "xterm", so it can be a program name with args. set dummy xterm; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4670: checking for $ac_word" >&5 +echo "configure:4773: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_XTERM_PATH'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4704,12 +4807,12 @@ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:4708: checking for $ac_func" >&5 +echo "configure:4811: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4839: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -4758,7 +4861,7 @@ echo $ac_n "checking if we should use imake to help""... $ac_c" 1>&6 -echo "configure:4762: checking if we should use imake to help" >&5 +echo "configure:4865: checking if we should use imake to help" >&5 # Check whether --enable-imake or --disable-imake was given. if test "${enable_imake+set}" = set; then @@ -4783,7 +4886,7 @@ # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 -echo "configure:4787: checking for $ac_word" >&5 +echo "configure:4890: checking for $ac_word" >&5 if eval "test \"`echo '$''{'ac_cv_path_IMAKE'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4831,6 +4934,7 @@ # config directory. if mkdir conftestdir; then cf_makefile=`cd $srcdir;pwd`/Imakefile + CDPATH=; export CDPATH cd conftestdir echo >./Imakefile test -f $cf_makefile && cat $cf_makefile >>./Imakefile @@ -4918,11 +5022,29 @@ -fi + +for cf_add_cflags in $IMAKE_CFLAGS +do + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case "$CPPFLAGS" in + *$cf_add_cflags) + ;; + *) + CPPFLAGS="$CPPFLAGS $cf_add_cflags" + ;; + esac + ;; + *) + CFLAGS="$CFLAGS $cf_add_cflags" + ;; + esac +done +fi echo $ac_n "checking for default terminal-id""... $ac_c" 1>&6 -echo "configure:4926: checking for default terminal-id" >&5 +echo "configure:5048: checking for default terminal-id" >&5 # Check whether --with-terminal-id or --without-terminal-id was given. if test "${with_terminal_id+set}" = set; then @@ -4943,7 +5065,7 @@ echo $ac_n "checking for default terminal-type""... $ac_c" 1>&6 -echo "configure:4947: checking for default terminal-type" >&5 +echo "configure:5069: checking for default terminal-type" >&5 # Check whether --with-terminal-type or --without-terminal-type was given. if test "${with_terminal_type+set}" = set; then @@ -4960,7 +5082,7 @@ echo $ac_n "checking for private terminfo-directory""... $ac_c" 1>&6 -echo "configure:4964: checking for private terminfo-directory" >&5 +echo "configure:5086: checking for private terminfo-directory" >&5 # Check whether --with-own-terminfo or --without-own-terminfo was given. if test "${with_own_terminfo+set}" = set; then @@ -5001,7 +5123,7 @@ echo $ac_n "checking if you want active-icons""... $ac_c" 1>&6 -echo "configure:5005: checking if you want active-icons" >&5 +echo "configure:5127: checking if you want active-icons" >&5 # Check whether --enable-active-icon or --disable-active-icon was given. if test "${enable_active_icon+set}" = set; then @@ -5027,7 +5149,7 @@ fi echo $ac_n "checking if you want ANSI color""... $ac_c" 1>&6 -echo "configure:5031: checking if you want ANSI color" >&5 +echo "configure:5153: checking if you want ANSI color" >&5 # Check whether --enable-ansi-color or --disable-ansi-color was given. if test "${enable_ansi_color+set}" = set; then @@ -5053,7 +5175,7 @@ if test $enable_ansi_color = yes ; then echo $ac_n "checking if you want 16 colors like aixterm""... $ac_c" 1>&6 -echo "configure:5057: checking if you want 16 colors like aixterm" >&5 +echo "configure:5179: checking if you want 16 colors like aixterm" >&5 # Check whether --enable-16-color or --disable-16-color was given. if test "${enable_16_color+set}" = set; then @@ -5077,7 +5199,7 @@ echo $ac_n "checking if you want 256 colors""... $ac_c" 1>&6 -echo "configure:5081: checking if you want 256 colors" >&5 +echo "configure:5203: checking if you want 256 colors" >&5 # Check whether --enable-256-color or --disable-256-color was given. if test "${enable_256_color+set}" = set; then @@ -5104,7 +5226,7 @@ else echo $ac_n "checking if you want 88 colors""... $ac_c" 1>&6 -echo "configure:5108: checking if you want 88 colors" >&5 +echo "configure:5230: checking if you want 88 colors" >&5 # Check whether --enable-88-color or --disable-88-color was given. if test "${enable_88_color+set}" = set; then @@ -5135,7 +5257,7 @@ fi echo $ac_n "checking if you want blinking cursor""... $ac_c" 1>&6 -echo "configure:5139: checking if you want blinking cursor" >&5 +echo "configure:5261: checking if you want blinking cursor" >&5 # Check whether --enable-blink-cursor or --disable-blink-cursor was given. if test "${enable_blink_cursor+set}" = set; then @@ -5161,7 +5283,7 @@ if test $enable_ansi_color = yes ; then echo $ac_n "checking if you want bold colors mapped like IBM PC""... $ac_c" 1>&6 -echo "configure:5165: checking if you want bold colors mapped like IBM PC" >&5 +echo "configure:5287: checking if you want bold colors mapped like IBM PC" >&5 # Check whether --enable-bold-color or --disable-bold-color was given. if test "${enable_bold_color+set}" = set; then @@ -5185,7 +5307,7 @@ echo $ac_n "checking if you want color-mode enabled by default""... $ac_c" 1>&6 -echo "configure:5189: checking if you want color-mode enabled by default" >&5 +echo "configure:5311: checking if you want color-mode enabled by default" >&5 # Check whether --enable-color-mode or --disable-color-mode was given. if test "${enable_color_mode+set}" = set; then @@ -5211,7 +5333,7 @@ fi echo $ac_n "checking if you want support for color highlighting""... $ac_c" 1>&6 -echo "configure:5215: checking if you want support for color highlighting" >&5 +echo "configure:5337: checking if you want support for color highlighting" >&5 # Check whether --enable-highlighting or --disable-highlighting was given. if test "${enable_highlighting+set}" = set; then @@ -5235,7 +5357,7 @@ echo $ac_n "checking if you want support for doublesize characters""... $ac_c" 1>&6 -echo "configure:5239: checking if you want support for doublesize characters" >&5 +echo "configure:5361: checking if you want support for doublesize characters" >&5 # Check whether --enable-doublechars or --disable-doublechars was given. if test "${enable_doublechars+set}" = set; then @@ -5259,7 +5381,7 @@ echo $ac_n "checking if you want fallback-support for box characters""... $ac_c" 1>&6 -echo "configure:5263: checking if you want fallback-support for box characters" >&5 +echo "configure:5385: checking if you want fallback-support for box characters" >&5 # Check whether --enable-boxchars or --disable-boxchars was given. if test "${enable_boxchars+set}" = set; then @@ -5282,8 +5404,82 @@ EOF +echo $ac_n "checking if you want to use FreeType library""... $ac_c" 1>&6 +echo "configure:5409: checking if you want to use FreeType library" >&5 + +# Check whether --enable-freetype or --disable-freetype was given. +if test "${enable_freetype+set}" = set; then + enableval="$enable_freetype" + test "$enableval" != no && enableval=yes + if test "$enableval" != "yes" ; then + enable_freetype=no + else + enable_freetype=yes + fi +else + enableval=yes + enable_freetype=yes + +fi + +echo "$ac_t""$enable_freetype" 1>&6 +if test $enable_freetype = yes ; then + +cf_freetype_libs="-lXft -lfreetype -lXrender -lXrender" +echo $ac_n "checking for X FreeType libraries""... $ac_c" 1>&6 +echo "configure:5431: checking for X FreeType libraries" >&5 +if eval "test \"`echo '$''{'cf_cv_x_freetype'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + +cf_save_LIBS="$LIBS" +LIBS="$cf_freetype_libs $LIBS" + +cat > conftest.$ac_ext < +#include +#include +int main() { + + XftPattern *pat = XftNameParse ("name"); + +; return 0; } +EOF +if { (eval echo configure:5453: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + rm -rf conftest* + cf_cv_x_freetype=yes +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_x_freetype=no +fi +rm -f conftest* + LIBS="$cf_save_LIBS" + +fi + +echo "$ac_t""$cf_cv_x_freetype" 1>&6 +if test "$cf_cv_x_freetype" = yes ; then + LIBS="$cf_freetype_libs $LIBS" + cat >> confdefs.h <<\EOF +#define XRENDERFONT 1 +EOF + +else + CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` +fi + +else + CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` +fi + echo $ac_n "checking if you want support for HP-style function keys""... $ac_c" 1>&6 -echo "configure:5287: checking if you want support for HP-style function keys" >&5 +echo "configure:5483: checking if you want support for HP-style function keys" >&5 # Check whether --enable-hp-fkeys or --disable-hp-fkeys was given. if test "${enable_hp_fkeys+set}" = set; then @@ -5309,7 +5505,7 @@ fi echo $ac_n "checking if you want support for SCO-style function keys""... $ac_c" 1>&6 -echo "configure:5313: checking if you want support for SCO-style function keys" >&5 +echo "configure:5509: checking if you want support for SCO-style function keys" >&5 # Check whether --enable-sco-fkeys or --disable-sco-fkeys was given. if test "${enable_sco_fkeys+set}" = set; then @@ -5335,7 +5531,7 @@ fi echo $ac_n "checking if you want support for internationalization""... $ac_c" 1>&6 -echo "configure:5339: checking if you want support for internationalization" >&5 +echo "configure:5535: checking if you want support for internationalization" >&5 # Check whether --enable-i18n or --disable-i18n was given. if test "${enable_i18n+set}" = set; then @@ -5361,7 +5557,7 @@ fi echo $ac_n "checking if you want support for initial-erase setup""... $ac_c" 1>&6 -echo "configure:5365: checking if you want support for initial-erase setup" >&5 +echo "configure:5561: checking if you want support for initial-erase setup" >&5 # Check whether --enable-initial-erase or --disable-initial-erase was given. if test "${enable_initial_erase+set}" = set; then @@ -5387,7 +5583,7 @@ fi echo $ac_n "checking if you want support for input-method""... $ac_c" 1>&6 -echo "configure:5391: checking if you want support for input-method" >&5 +echo "configure:5587: checking if you want support for input-method" >&5 # Check whether --enable-input-method or --disable-input-method was given. if test "${enable_input_method+set}" = set; then @@ -5407,13 +5603,13 @@ echo "$ac_t""$enable_ximp" 1>&6 echo $ac_n "checking if X libraries support input-method""... $ac_c" 1>&6 -echo "configure:5411: checking if X libraries support input-method" >&5 +echo "configure:5607: checking if X libraries support input-method" >&5 if eval "test \"`echo '$''{'cf_cv_input_method'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -5440,7 +5636,7 @@ ; return 0; } EOF -if { (eval echo configure:5444: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:5640: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_input_method=yes else @@ -5463,7 +5659,7 @@ fi echo $ac_n "checking if you want support for logging""... $ac_c" 1>&6 -echo "configure:5467: checking if you want support for logging" >&5 +echo "configure:5663: checking if you want support for logging" >&5 # Check whether --enable-logging or --disable-logging was given. if test "${enable_logging+set}" = set; then @@ -5487,7 +5683,7 @@ EOF echo $ac_n "checking if you want to allow logging via a pipe""... $ac_c" 1>&6 -echo "configure:5491: checking if you want to allow logging via a pipe" >&5 +echo "configure:5687: checking if you want to allow logging via a pipe" >&5 # Check whether --enable-logfile-exec or --disable-logfile-exec was given. if test "${enable_logfile_exec+set}" = set; then @@ -5514,7 +5710,7 @@ fi echo $ac_n "checking if you want support for iconify/maximize translations""... $ac_c" 1>&6 -echo "configure:5518: checking if you want support for iconify/maximize translations" >&5 +echo "configure:5714: checking if you want support for iconify/maximize translations" >&5 # Check whether --enable-maximize or --disable-maximize was given. if test "${enable_maximize+set}" = set; then @@ -5538,7 +5734,7 @@ echo $ac_n "checking if you want NumLock to override keyboard tables""... $ac_c" 1>&6 -echo "configure:5542: checking if you want NumLock to override keyboard tables" >&5 +echo "configure:5738: checking if you want NumLock to override keyboard tables" >&5 # Check whether --enable-num-lock or --disable-num-lock was given. if test "${enable_num_lock+set}" = set; then @@ -5562,7 +5758,7 @@ echo $ac_n "checking if you want support for right-scrollbar""... $ac_c" 1>&6 -echo "configure:5566: checking if you want support for right-scrollbar" >&5 +echo "configure:5762: checking if you want support for right-scrollbar" >&5 # Check whether --enable-rightbar or --disable-rightbar was given. if test "${enable_rightbar+set}" = set; then @@ -5588,7 +5784,7 @@ fi echo $ac_n "checking if you want check for redundant name-change""... $ac_c" 1>&6 -echo "configure:5592: checking if you want check for redundant name-change" >&5 +echo "configure:5788: checking if you want check for redundant name-change" >&5 # Check whether --enable-samename or --disable-samename was given. if test "${enable_samename+set}" = set; then @@ -5612,7 +5808,7 @@ echo $ac_n "checking if you want to use termcap-query/report""... $ac_c" 1>&6 -echo "configure:5616: checking if you want to use termcap-query/report" >&5 +echo "configure:5812: checking if you want to use termcap-query/report" >&5 # Check whether --enable-tcap-query or --disable-tcap-query was given. if test "${enable_tcap_query+set}" = set; then @@ -5636,7 +5832,7 @@ echo $ac_n "checking if you want support for tek4014""... $ac_c" 1>&6 -echo "configure:5640: checking if you want support for tek4014" >&5 +echo "configure:5836: checking if you want support for tek4014" >&5 # Check whether --enable-tek4014 or --disable-tek4014 was given. if test "${enable_tek4014+set}" = set; then @@ -5666,7 +5862,7 @@ fi echo $ac_n "checking if you want pulldown menus with a toolbar""... $ac_c" 1>&6 -echo "configure:5670: checking if you want pulldown menus with a toolbar" >&5 +echo "configure:5866: checking if you want pulldown menus with a toolbar" >&5 # Check whether --enable-toolbar or --disable-toolbar was given. if test "${enable_toolbar+set}" = set; then @@ -5690,7 +5886,7 @@ echo $ac_n "checking if you want VT52 emulation""... $ac_c" 1>&6 -echo "configure:5694: checking if you want VT52 emulation" >&5 +echo "configure:5890: checking if you want VT52 emulation" >&5 # Check whether --enable-vt52 or --disable-vt52 was given. if test "${enable_vt52+set}" = set; then @@ -5714,7 +5910,7 @@ echo $ac_n "checking if you want wide-character support""... $ac_c" 1>&6 -echo "configure:5718: checking if you want wide-character support" >&5 +echo "configure:5914: checking if you want wide-character support" >&5 # Check whether --enable-wide-chars or --disable-wide-chars was given. if test "${enable_wide_chars+set}" = set; then @@ -5743,7 +5939,7 @@ fi echo $ac_n "checking if you want DECterm Locator support""... $ac_c" 1>&6 -echo "configure:5747: checking if you want DECterm Locator support" >&5 +echo "configure:5943: checking if you want DECterm Locator support" >&5 # Check whether --enable-dec-locator or --disable-dec-locator was given. if test "${enable_dec_locator+set}" = set; then @@ -5769,7 +5965,7 @@ fi echo $ac_n "checking if you want -ziconbeep option""... $ac_c" 1>&6 -echo "configure:5773: checking if you want -ziconbeep option" >&5 +echo "configure:5969: checking if you want -ziconbeep option" >&5 # Check whether --enable-ziconbeep or --disable-ziconbeep was given. if test "${enable_ziconbeep+set}" = set; then @@ -5796,7 +5992,7 @@ echo $ac_n "checking if you want debugging traces""... $ac_c" 1>&6 -echo "configure:5800: checking if you want debugging traces" >&5 +echo "configure:5996: checking if you want debugging traces" >&5 # Check whether --enable-trace or --disable-trace was given. if test "${enable_trace+set}" = set; then @@ -5825,7 +6021,7 @@ echo $ac_n "checking if you want to see long compiling messages""... $ac_c" 1>&6 -echo "configure:5829: checking if you want to see long compiling messages" >&5 +echo "configure:6025: checking if you want to see long compiling messages" >&5 # Check whether --enable-echo or --disable-echo was given. if test "${enable_echo+set}" = set; then @@ -5865,7 +6061,7 @@ echo $ac_n "checking if you want magic cookie emulation""... $ac_c" 1>&6 -echo "configure:5869: checking if you want magic cookie emulation" >&5 +echo "configure:6065: checking if you want magic cookie emulation" >&5 # Check whether --enable-xmc-glitch or --disable-xmc-glitch was given. if test "${enable_xmc_glitch+set}" = set; then @@ -5894,7 +6090,7 @@ if test -n "$GCC" ; then echo $ac_n "checking if you want to turn on gcc warnings""... $ac_c" 1>&6 -echo "configure:5898: checking if you want to turn on gcc warnings" >&5 +echo "configure:6094: checking if you want to turn on gcc warnings" >&5 # Check whether --enable-warnings or --disable-warnings was given. if test "${enable_warnings+set}" = set; then @@ -5934,9 +6130,9 @@ if test "$GCC" = yes then echo "checking for $CC __attribute__ directives" 1>&6 -echo "configure:5938: checking for $CC __attribute__ directives" >&5 - cat > conftest.$ac_ext <&5 +cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:6174: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then test -n "$verbose" && echo "$ac_t""... $cf_attribute" 1>&6 cat conftest.h >>confdefs.h # else @@ -5990,12 +6186,12 @@ if test "$GCC" = yes then - cat > conftest.$ac_ext < conftest.$ac_ext <&6 -echo "configure:5999: checking for $CC warning options" >&5 + echo "checking for $CC warning options" 1>&6 +echo "configure:6195: checking for $CC warning options" >&5 cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-W -Wall" cf_warn_CONST="" @@ -6013,7 +6209,7 @@ Wstrict-prototypes $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo configure:6017: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + if { (eval echo configure:6213: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then test -n "$verbose" && echo "$ac_t""... -$cf_opt" 1>&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" test "$cf_opt" = Wcast-qual && EXTRA_CFLAGS="$EXTRA_CFLAGS -DXTSTRINGDEFINES" @@ -6033,12 +6229,12 @@ -### remove from IMAKE_CFLAGS the optional features we define in xtermcfg.h +### remove from CPPFLAGS the optional features we define in xtermcfg.h for cf_def in \ SCROLLBAR_RIGHT \ OPT_WIDE_CHARS do - IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" | sed -e s/-D$cf_def//` + CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-D$cf_def//` done ### output Makefile and xtermcfg.h Index: xc/programs/xterm/configure.in diff -u xc/programs/xterm/configure.in:3.44 xc/programs/xterm/configure.in:3.47 --- xc/programs/xterm/configure.in:3.44 Tue Oct 31 20:12:38 2000 +++ xc/programs/xterm/configure.in Wed Apr 11 21:02:50 2001 @@ -1,5 +1,5 @@ dnl -dnl $XFree86: xc/programs/xterm/configure.in,v 3.44 2000/11/01 01:12:38 dawes Exp $ +dnl $XFree86: xc/programs/xterm/configure.in,v 3.47 2001/04/12 01:02:50 dickey Exp $ dnl dnl --------------------------------------------------------------------------- dnl @@ -37,7 +37,8 @@ dnl Only add to this case statement when a system has a compiler that is not dnl detected by AC_PROG_CC. case "$host_os" in -openedition) : ${CFLAGS="-O2 -Wc,dll -D_ALL_SOURCE -Wl,EDIT=NO"} +openedition) : ${CFLAGS="-O2 -Wc,dll -Wl,EDIT=NO"} + : ${CPPFLAGS="-D_ALL_SOURCE"} : ${LIBS="/usr/lib/Xaw.x /usr/lib/SM.x /usr/lib/ICE.x /usr/lib/X11.x"} : ${CC=c89};; esac @@ -47,6 +48,7 @@ AC_GCC_TRADITIONAL AC_PROG_AWK AC_PROG_INSTALL +AC_ARG_PROGRAM ### checks for UNIX variants that set C preprocessor variables AC_AIX @@ -59,6 +61,7 @@ termios.h \ unistd.h \ ) +AC_HEADER_TIME ### checks for typedefs CF_SIZE_T @@ -67,6 +70,7 @@ ### checks for library functions AC_CHECK_FUNCS( \ bcopy \ + getlogin \ memmove \ strerror \ tcgetattr \ @@ -103,18 +107,6 @@ CF_GNU_SOURCE CF_X_TOOLKIT -# Change CPPFLAGS temporarily so that checks for X include files will -# look in any directories specified with `--x-includes=DIR', obtained -# via xmkmf, or located by AC_PATH_XTRA. These flags are already in -# CFLAGS (put there by CF_X_TOOLKIT), but that doesn't help here because -# AC_CHECK_HEADERS uses cpp, not cc. - -if test "${x_includes}" != NONE && test -n "${x_includes}"; then - C_SWITCH_X_SITE=-I`echo ${x_includes} | sed -e "s/:/ -I/g"` -fi -cf_save_CPPFLAGS="$CPPFLAGS" -CPPFLAGS="$C_SWITCH_X_SITE $CPPFLAGS" - AC_CHECK_HEADERS( \ X11/DECkeysym.h \ X11/Sunkeysym.h \ @@ -125,8 +117,6 @@ CF_TYPE_FD_SET CF_TERMIO_C_ISPEED -CPPFLAGS="$cf_save_CPPFLAGS" - LIBS="$LIBS $X_EXTRA_LIBS" # Check for openpty() in -lutil if the UNIX98-style pty functions are not @@ -147,8 +137,8 @@ AC_MSG_RESULT($enable_imake) if test $enable_imake = yes ; then CF_IMAKE_CFLAGS($(MAIN_DEFINES)) + CF_ADD_CFLAGS($IMAKE_CFLAGS) fi -AC_SUBST(IMAKE_CFLAGS) AC_MSG_CHECKING(for default terminal-id) AC_ARG_WITH(terminal-id, @@ -308,6 +298,18 @@ AC_MSG_RESULT($enable_boxchars) test $enable_boxchars = no && AC_DEFINE(OPT_BOX_CHARS,0) +AC_MSG_CHECKING(if you want to use FreeType library) +CF_ARG_DISABLE(freetype, + [ --disable-freetype disable freetype library-support], + [enable_freetype=no], + [enable_freetype=yes]) +AC_MSG_RESULT($enable_freetype) +if test $enable_freetype = yes ; then + CF_X_FREETYPE +else + CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-DXRENDERFONT//` +fi + AC_MSG_CHECKING(if you want support for HP-style function keys) CF_ARG_ENABLE(hp-fkeys, [ --enable-hp-fkeys enable support for HP-style function keys], @@ -531,12 +533,12 @@ AC_SUBST(EXTRASRCS) AC_SUBST(EXTRAOBJS) -### remove from IMAKE_CFLAGS the optional features we define in xtermcfg.h +### remove from CPPFLAGS the optional features we define in xtermcfg.h for cf_def in \ SCROLLBAR_RIGHT \ OPT_WIDE_CHARS do - IMAKE_CFLAGS=`echo "$IMAKE_CFLAGS" | sed -e s/-D$cf_def//` + CPPFLAGS=`echo "$CPPFLAGS" | sed -e s/-D$cf_def//` done ### output Makefile and xtermcfg.h Index: xc/programs/xterm/cursor.c diff -u xc/programs/xterm/cursor.c:3.13 xc/programs/xterm/cursor.c:3.14 --- xc/programs/xterm/cursor.c:3.13 Tue Feb 8 12:19:33 2000 +++ xc/programs/xterm/cursor.c Wed Jan 17 18:46:36 2001 @@ -1,7 +1,8 @@ /* - * $XConsortium: cursor.c,v 1.14 93/09/20 17:42:23 hersh Exp $ - * $XFree86: xc/programs/xterm/cursor.c,v 3.13 2000/02/08 17:19:33 dawes Exp $ + * $Xorg: cursor.c,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ + +/* $XFree86: xc/programs/xterm/cursor.c,v 3.14 2001/01/17 23:46:36 dawes Exp $ */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. Index: xc/programs/xterm/data.c diff -u xc/programs/xterm/data.c:3.20 xc/programs/xterm/data.c:3.21 --- xc/programs/xterm/data.c:3.20 Fri Sep 22 06:42:07 2000 +++ xc/programs/xterm/data.c Wed Jan 17 18:46:36 2001 @@ -1,7 +1,8 @@ /* - * $XConsortium: data.c,v 1.12 95/04/05 19:58:47 kaleb Exp $ - * $XFree86: xc/programs/xterm/data.c,v 3.20 2000/09/22 10:42:07 alanh Exp $ + * $Xorg: data.c,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ + +/* $XFree86: xc/programs/xterm/data.c,v 3.21 2001/01/17 23:46:36 dawes Exp $ */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. Index: xc/programs/xterm/data.h diff -u xc/programs/xterm/data.h:3.24 xc/programs/xterm/data.h:3.25 --- xc/programs/xterm/data.h:3.24 Thu Feb 10 13:57:38 2000 +++ xc/programs/xterm/data.h Wed Jan 17 18:46:36 2001 @@ -1,7 +1,9 @@ /* - * $XConsortium: data.h /main/13 1996/11/24 17:35:40 rws $ - * $XFree86: xc/programs/xterm/data.h,v 3.24 2000/02/10 18:57:38 dawes Exp $ + * $Xorg: data.h,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ + +/* $XFree86: xc/programs/xterm/data.h,v 3.25 2001/01/17 23:46:36 dawes Exp $ */ + /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * Index: xc/programs/xterm/error.h diff -u xc/programs/xterm/error.h:1.5 xc/programs/xterm/error.h:1.6 --- xc/programs/xterm/error.h:1.5 Sat Oct 10 11:25:48 1998 +++ xc/programs/xterm/error.h Wed Jan 17 18:46:36 2001 @@ -1,9 +1,9 @@ /* - * $XConsortium: error.h,v 1.9 93/02/25 17:21:29 gildea Exp $ + * $Xorg: error.h,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ -/* $XFree86: xc/programs/xterm/error.h,v 1.5 1998/10/10 15:25:48 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/error.h,v 1.6 2001/01/17 23:46:36 dawes Exp $ */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * Index: xc/programs/xterm/fontutils.c diff -u xc/programs/xterm/fontutils.c:1.27 xc/programs/xterm/fontutils.c:1.31 --- xc/programs/xterm/fontutils.c:1.27 Sun Dec 3 14:09:26 2000 +++ xc/programs/xterm/fontutils.c Thu Jan 4 13:26:12 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xterm/fontutils.c,v 1.27 2000/12/03 19:09:26 keithp Exp $ + * $XFree86: xc/programs/xterm/fontutils.c,v 1.31 2001/01/04 18:26:12 keithp Exp $ */ /************************************************************ @@ -454,13 +454,17 @@ static int same_font_size(XFontStruct *nfs, XFontStruct *bfs) { + TRACE(("same_font_size height %d/%d, min %d/%d max %d/%d\n", + nfs->ascent + nfs->descent, + bfs->ascent + bfs->descent, + nfs->min_bounds.width, bfs->min_bounds.width, + nfs->max_bounds.width, bfs->max_bounds.width)); return ( - nfs->ascent == bfs->ascent - && nfs->descent == bfs->descent - && nfs->min_bounds.width == bfs->min_bounds.width - && nfs->min_bounds.width == bfs->min_bounds.width - && nfs->max_bounds.width == bfs->max_bounds.width - && nfs->max_bounds.width == bfs->max_bounds.width); + (nfs->ascent + nfs->descent) == (bfs->ascent + bfs->descent) + && ( nfs->min_bounds.width == bfs->min_bounds.width + || nfs->min_bounds.width == bfs->min_bounds.width + 1) + && ( nfs->max_bounds.width == bfs->max_bounds.width + || nfs->max_bounds.width == bfs->max_bounds.width + 1)); } /* @@ -469,9 +473,24 @@ static int is_fixed_font(XFontStruct *fs) { - return (fs->min_bounds.width == fs->max_bounds.width - && fs->min_bounds.width == fs->min_bounds.width); + if (fs) + return (fs->min_bounds.width == fs->max_bounds.width); + return 1; +} + +/* + * Check if the font looks like a double width font (i.e. contains + * characters of width X and 2X + */ +#if OPT_WIDE_CHARS +static int +is_double_width_font(XFontStruct *fs) +{ + return (2 * fs->min_bounds.width == fs->max_bounds.width); } +#else +#define is_double_width_font(fs) 0 +#endif #define EmptyFont(fs) (fs != 0 \ && ((fs)->ascent + (fs)->descent == 0 \ @@ -555,22 +574,29 @@ * and 12x13ja as the corresponding fonts for 9x18 and 6x13. */ if_OPT_WIDE_CHARS(screen, { - if (wfontname == 0) { + if (wfontname == 0 && !is_double_width_font(nfs)) { fp = get_font_name_props(screen->display, nfs, normal); if (fp != 0) { wfontname = wide_font_name(fp); TRACE(("...derived wide %s\n", wfontname)); } } - if (wfontname - && (wfs = XLoadQueryFont(screen->display, wfontname)) == 0) { + + if (wfontname) { + wfs = XLoadQueryFont(screen->display, wfontname); + } else { + wfs = nfs; } + if (wbfontname) { wbfs = XLoadQueryFont(screen->display, wbfontname); + } else if (is_double_width_font(bfs)) { + wbfs = bfs; } else { wbfs = wfs; TRACE(("...cannot load wide bold font %s\n", wbfontname)); } + if (EmptyFont(wbfs)) goto bad; /* can't use a 0-sized font */ }) @@ -600,30 +626,32 @@ if (bfontname != 0) { return xtermLoadFont (screen, VT_FONTSET(nfontname, - NULL, /* throw it away! */ - wfontname, - wbfontname), - doresize, + NULL, /* throw it away! */ + wfontname, + wbfontname), + doresize, fontnum); } } if_OPT_WIDE_CHARS(screen, { - if (!same_font_size(wfs, wbfs) - && (is_fixed_font(wfs) && is_fixed_font(wbfs))) { - XFreeFont(screen->display, wbfs); - wbfs = wfs; - TRACE(("...fixing mismatched normal/bold wide fonts\n")); - if (bfontname != 0) { - return xtermLoadFont (screen, - VT_FONTSET(nfontname, - bfontname, - wfontname, - NULL), - doresize, - fontnum); - } - } + if (wfs != 0 + && wbfs != 0 + && !same_font_size(wfs, wbfs) + && (is_fixed_font(wfs) && is_fixed_font(wbfs))) { + XFreeFont(screen->display, wbfs); + wbfs = wfs; + TRACE(("...fixing mismatched normal/bold wide fonts\n")); + if (bfontname != 0) { + return xtermLoadFont (screen, + VT_FONTSET(nfontname, + bfontname, + wfontname, + NULL), + doresize, + fontnum); + } + } }) /* @@ -642,9 +670,11 @@ } if_OPT_WIDE_CHARS(screen, { - if (!is_fixed_font(wfs) + if (wfs != 0 + && wbfs != 0 + && (!is_fixed_font(wfs) || !is_fixed_font(wbfs) - || wfs->max_bounds.width != wbfs->max_bounds.width) { + || wfs->max_bounds.width != wbfs->max_bounds.width)) { TRACE(("Proportional font! wide %d/%d, wide bold %d/%d\n", wfs->min_bounds.width, wfs->max_bounds.width, @@ -768,7 +798,7 @@ fontMenuEntries[fontMenu_fontescape].widget, TRUE); } -#if OPT_SHIFT_KEYS +#if OPT_SHIFT_FONTS screen->menu_font_sizes[fontnum] = FontSize(nfs); #endif } @@ -830,24 +860,32 @@ if (!screen->renderFont && term->misc.face_name && XRenderFindVisualFormat (dpy, DefaultVisual (dpy, DefaultScreen (dpy)))) { - screen->renderFont = XftFontOpen (dpy, DefaultScreen (dpy), - XFT_FAMILY, XftTypeString, term->misc.face_name, - XFT_FAMILY, XftTypeString, "mono", - XFT_SIZE, XftTypeInteger, term->misc.face_size, - XFT_SPACING, XftTypeInteger, XFT_MONO, - 0); + XftPattern *pat, *match; + XftResult result; + + pat = XftNameParse (term->misc.face_name); + XftPatternBuild (pat, + XFT_FAMILY, XftTypeString, "mono", + XFT_SIZE, XftTypeInteger, term->misc.face_size, + XFT_SPACING, XftTypeInteger, XFT_MONO, + 0); + match = XftFontMatch (dpy, DefaultScreen (dpy), pat, &result); + screen->renderFont = XftFontOpenPattern (dpy, match); + if (!screen->renderFont && match) + XftPatternDestroy (match); if (screen->renderFont) { - screen->renderFontBold = XftFontOpen (dpy, DefaultScreen (dpy), - XFT_FAMILY, XftTypeString, term->misc.face_name, - XFT_FAMILY, XftTypeString, "mono", - XFT_SIZE, XftTypeInteger, term->misc.face_size, - XFT_WEIGHT, XftTypeInteger, XFT_WEIGHT_BOLD, - XFT_SPACING, XftTypeInteger, XFT_MONO, - XFT_CHAR_WIDTH, XftTypeInteger, - screen->renderFont->max_advance_width, - 0); + XftPatternBuild (pat, + XFT_WEIGHT, XftTypeInteger, XFT_WEIGHT_BOLD, + XFT_CHAR_WIDTH, XftTypeInteger, screen->renderFont->max_advance_width, + 0); + match = XftFontMatch (dpy, DefaultScreen (dpy), pat, &result); + screen->renderFontBold = XftFontOpenPattern (dpy, match); + if (!screen->renderFontBold && match) + XftPatternDestroy (match); } + if (pat) + XftPatternDestroy (pat); } if (screen->renderFont) { @@ -859,7 +897,11 @@ else #endif { - win->f_width = (font->max_bounds.width); + if (is_double_width_font(font)) { + win->f_width = (font->min_bounds.width); + } else { + win->f_width = (font->max_bounds.width); + } win->f_height = (font->ascent + font->descent); win->f_ascent = font->ascent; win->f_descent = font->descent; @@ -1201,7 +1243,7 @@ } #endif -#if OPT_SHIFT_KEYS +#if OPT_SHIFT_FONTS static XFontStruct * xtermFindFont ( TScreen *screen, @@ -1227,6 +1269,7 @@ lookupFontSizes(TScreen *screen) { int n; + for (n = 0; n < NMENUFONTS; n++) { if (screen->menu_font_sizes[n] == 0) { XFontStruct *fs = xtermFindFont(screen, n); @@ -1252,6 +1295,8 @@ TScreen *screen = &term->screen; int n, m; + if (!term->misc.shift_fonts) + return; lookupFontSizes(screen); for (n = 0, m = -1; n < NMENUFONTS; n++) { if ((screen->menu_font_sizes[n] > screen->menu_font_sizes[screen->menu_font_number]) @@ -1277,6 +1322,8 @@ TScreen *screen = &term->screen; int n, m; + if (!term->misc.shift_fonts) + return; lookupFontSizes(screen); for (n = 0, m = -1; n < NMENUFONTS; n++) { if ((screen->menu_font_sizes[n] < screen->menu_font_sizes[screen->menu_font_number]) Index: xc/programs/xterm/fontutils.h diff -u xc/programs/xterm/fontutils.h:1.9 xc/programs/xterm/fontutils.h:1.10 --- xc/programs/xterm/fontutils.h:1.9 Tue Oct 31 20:12:39 2000 +++ xc/programs/xterm/fontutils.h Sat Dec 30 14:15:46 2000 @@ -1,10 +1,10 @@ /* - * $XFree86: xc/programs/xterm/fontutils.h,v 1.9 2000/11/01 01:12:39 dawes Exp $ + * $XFree86: xc/programs/xterm/fontutils.h,v 1.10 2000/12/30 19:15:46 dickey Exp $ */ /************************************************************ -Copyright 1998,1999 by Thomas E. Dickey +Copyright 1998,1999,2000 by Thomas E. Dickey All Rights Reserved @@ -65,7 +65,7 @@ extern void xtermDrawBoxChar(TScreen *screen, int ch, unsigned flags, GC gc, int x, int y); #endif -#if OPT_SHIFT_KEYS +#if OPT_SHIFT_FONTS extern void HandleSmallerFont PROTO_XT_ACTIONS_ARGS; extern void HandleLargerFont PROTO_XT_ACTIONS_ARGS; #endif Index: xc/programs/xterm/input.c diff -u xc/programs/xterm/input.c:3.50 xc/programs/xterm/input.c:3.52 --- xc/programs/xterm/input.c:3.50 Wed Dec 6 21:40:00 2000 +++ xc/programs/xterm/input.c Wed Jan 17 18:46:36 2001 @@ -1,8 +1,9 @@ /* - * $XConsortium: input.c /main/21 1996/04/17 15:54:23 kaleb $ - * $XFree86: xc/programs/xterm/input.c,v 3.50 2000/12/07 02:40:00 dickey Exp $ + * $Xorg: input.c,v 1.3 2000/08/17 19:55:08 cpqbld Exp $ */ +/* $XFree86: xc/programs/xterm/input.c,v 3.52 2001/01/17 23:46:36 dawes Exp $ */ + /* * Copyright 1999-2000 by Thomas E. Dickey * @@ -377,15 +378,18 @@ */ if (screen->utf8_mode) { ucs = -1; - if (nbytes == 1) { + if (nbytes == 1 && strbuf[0]) { /* Take ISO 8859-1 character delivered by XLookupString() */ ucs = (unsigned char) strbuf[0]; - } else if (!nbytes && + } else if ((!nbytes || !strbuf[0]) && ((keysym >= 0x100 && keysym <= 0xf000) || (keysym & 0xff000000U) == 0x01000000)) ucs = keysym2ucs(keysym); else ucs = -2; + if (nbytes == 1 && !strbuf[0]) { + nbytes = 0; + } if (ucs == -1) nbytes = 0; if (ucs >= 0) @@ -506,22 +510,6 @@ #endif TRACE(("...ModifierParm %d\n", modify_parm)); } - -#if OPT_SHIFT_KEYS - if (term->misc.shift_keys - && (event->state & ShiftMask) != 0) { - switch (keysym) { - case XK_KP_Add: - HandleLargerFont((Widget)0, (XEvent *)0, (String *)0, (Cardinal *)0); - return; - case XK_KP_Subtract: - HandleSmallerFont((Widget)0, (XEvent *)0, (String *)0, (Cardinal *)0); - return; - default: - break; - } - } -#endif /* VT300 & up: backarrow toggle */ if ((nbytes == 1) Index: xc/programs/xterm/main.c diff -u xc/programs/xterm/main.c:3.122 xc/programs/xterm/main.c:3.130 --- xc/programs/xterm/main.c:3.122 Tue Oct 31 20:12:39 2000 +++ xc/programs/xterm/main.c Fri May 11 04:16:54 2001 @@ -1,5 +1,5 @@ #ifndef lint -static char *rid="$TOG: main.c /main/249 1997/08/26 14:13:43 kaleb $"; +static char *rid="$Xorg: main.c,v 1.6 2000/08/18 11:04:49 xorgcvs Exp $"; #endif /* lint */ /* @@ -64,7 +64,7 @@ ******************************************************************/ -/* $XFree86: xc/programs/xterm/main.c,v 3.122 2000/11/01 01:12:39 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/main.c,v 3.130 2001/05/11 08:16:54 alanh Exp $ */ /* main.c */ @@ -74,8 +74,6 @@ #include #include - -#include #include #include @@ -91,6 +89,7 @@ #include #include #include +#include #if OPT_WIDE_CHARS #include @@ -101,12 +100,10 @@ #include #include #include -#define _POSIX_SOURCE #include #include #include -#define USE_TERMIOS #define NILCAP ((capability *)NULL) #endif @@ -114,7 +111,6 @@ #include #define setpgrp(pid, pgid) setpgid(pid, pgid) -#define USE_TERMIOS #define MNX_LASTLOG #define WTMP /* Remap or define non-existing termios flags */ @@ -126,10 +122,6 @@ #define BSDLY 0 #define VTDLY 0 #define FFDLY 0 -#else /* MINIX */ -#ifdef DEBUG -#include -#endif #endif /* MINIX */ #ifdef __osf__ @@ -137,10 +129,6 @@ #define WTMP #endif -#if defined(SVR4) && !defined(__sgi) -#define USE_TERMIOS -#endif - #ifdef USE_ISPTS_FLAG static Bool IsPts = False; #endif @@ -155,51 +143,27 @@ #define KANJI #endif -#ifdef TIOCSLTC -#define HAS_LTCHARS -#endif - #ifdef linux -#define USE_TERMIOS #define USE_SYSV_PGRP #define USE_SYSV_SIGNALS #define WTMP -#undef HAS_LTCHARS #ifdef __GLIBC__ #if (__GLIBC__ > 2) || ((__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)) #include -#include /* getpt() */ #endif #endif #endif #ifdef __MVS__ -#define SVR4 -#define USE_POSIX_TERMIOS #define USE_SYSV_PGRP #define USE_SYSV_SIGNALS -#undef HAS_LTCHARS #endif #ifdef __CYGWIN__ -#define SYSV -#define SVR4 #define LASTLOG #define WTMP -#define ATT #endif -#ifdef __QNX__ -#define USE_POSIX_TERMIOS -#include -#endif - -#ifdef Lynx -#define USE_SYSV_TERMIO -#undef HAS_LTCHARS -#include -#endif - #ifdef SCO325 #define _SVID3 #endif @@ -218,10 +182,6 @@ #define TTY_GROUP_NAME "tty" #endif -#ifndef __CYGWIN__ -#include -#endif - #include #ifdef Lynx @@ -236,56 +196,20 @@ #endif #endif -#if defined(USE_POSIX_TERMIOS) -#include -#elif defined(USE_TERMIOS) -#include -/* this hacked termios support only works on SYSV */ -#define USE_SYSV_TERMIO -#define termio termios -#undef TCGETA -#define TCGETA TCGETS -#undef TCSETA -#define TCSETA TCSETS -#elif defined(SYSV) -#include -#elif defined(sun) && !defined(SVR4) -#include -#ifdef TIOCSWINSZ -#undef TIOCSSIZE -#endif -#endif /* USE_POSIX_TERMIOS */ - -#ifdef SVR4 -#undef HAS_LTCHARS /* defined, but not useable */ -#endif -#define USE_TERMCAP_ENVVARS /* every one uses this except SYSV maybe */ - -#if defined(__sgi) && (OSMAJORVERSION >= 5) -#undef TIOCLSET /* defined, but not useable */ -#endif - -#if defined(__GNU__) || defined(__MVS__) -#undef TIOCLSET -#undef TIOCSLTC -#endif - #ifdef SYSV /* { */ #ifdef USE_USG_PTYS /* AT&T SYSV has no ptyio.h */ -#include /* get typedef used in ptem.h */ #include /* for I_PUSH */ -#if !defined(SVR4) || defined(SCO325) -#include /* get struct winsize */ -#endif #include /* for POLLIN */ #endif /* USE_USG_PTYS */ -#define USE_SYSV_TERMIO + #define USE_SYSV_SIGNALS #define USE_SYSV_PGRP + #if !defined(TIOCSWINSZ) #define USE_SYSV_ENVVARS /* COLUMNS/LINES vs. TERMCAP */ #endif + /* * now get system-specific includes */ @@ -330,8 +254,6 @@ #ifdef __QNX__ -#undef TIOCSLTC /* conflicts with */ -#undef TIOCLSET #ifndef __QNXNTO__ #define ttyslot() 1 #else @@ -344,14 +266,14 @@ #ifndef linux #ifndef VMS #ifndef USE_POSIX_TERMIOS -#ifndef USE_SYSV_TERMIO +#ifndef USE_ANY_SYSV_TERMIO #include #endif #endif /* USE_POSIX_TERMIOS */ -#ifndef Lynx -#include -#else +#ifdef Lynx #include +#else +#include #endif #define HAS_BSD_GROUPS #endif /* !VMS */ @@ -376,10 +298,8 @@ #ifndef NOFILE #define NOFILE OPEN_MAX #endif -#elif !defined(MINIX) && !defined(WIN32) && !defined(Lynx) && !defined(__GNU__) && !defined(__MVS__) -#ifndef VMS +#elif !(defined(VMS) || defined(MINIX) || defined(WIN32) || defined(Lynx) || defined(__GNU__) || defined(__MVS__)) #include /* for NOFILE */ -#endif /* !VMS */ #endif #if defined(BSD) && (BSD >= 199103) @@ -389,12 +309,6 @@ #include -#ifdef X_NOT_STDC_ENV -extern time_t time (); -#else -#include -#endif - #ifdef __hpux #include #endif /* __hpux */ @@ -403,12 +317,6 @@ #define ttyslot() 1 #endif /* apollo */ -#ifdef sun -#include -#endif - -#include - #if defined(USE_UTEMPTER) #include @@ -439,17 +347,15 @@ #include #endif /* PUCC_PTYD */ -#ifndef UTMP_FILENAME -#ifdef UTMP_FILE +#if !defined(UTMP_FILENAME) +#if defined(UTMP_FILE) #define UTMP_FILENAME UTMP_FILE -#else -#ifdef _PATH_UTMP +#elif defined(_PATH_UTMP) #define UTMP_FILENAME _PATH_UTMP #else #define UTMP_FILENAME "/etc/utmp" #endif #endif -#endif #ifndef LASTLOG_FILENAME #ifdef _PATH_LASTLOG @@ -459,21 +365,17 @@ #endif #endif -#ifndef WTMP_FILENAME -#ifdef WTMP_FILE +#if !defined(WTMP_FILENAME) +#if defined(WTMP_FILE) #define WTMP_FILENAME WTMP_FILE -#else -#ifdef _PATH_WTMP +#elif defined(_PATH_WTMP) #define WTMP_FILENAME _PATH_WTMP -#else -#ifdef SYSV +#elif defined(SYSV) #define WTMP_FILENAME "/etc/wtmp" #else #define WTMP_FILENAME "/usr/adm/wtmp" #endif #endif -#endif -#endif #include @@ -483,14 +385,11 @@ #ifdef SIGTSTP #include -#ifdef __hpux -#include -#endif #endif #ifdef X_NOT_POSIX extern long lseek(); -#if defined(USG) +#if defined(USG) || defined(SVR4) extern unsigned sleep(); #else extern void sleep(); @@ -540,17 +439,8 @@ */ static char **command_to_exec = NULL; -#ifdef USE_SYSV_TERMIO -#ifndef ICRNL -#include -#endif -#if defined (__sgi) || (defined(__linux__) && defined(__sparc__)) -#undef TIOCLSET /* XXX why is this undef-ed again? */ -#endif -#endif /* USE_SYSV_TERMIO */ - #define TERMCAP_ERASE "kb" -#define VAL_INITIAL_ERASE A2E(127) +#define VAL_INITIAL_ERASE A2E(8) /* choose a nice default value for speed - if we make it too low, users who * mistakenly use $TERM set to vt100 will get padding delays @@ -612,7 +502,7 @@ #endif #ifndef VMS -#ifdef USE_SYSV_TERMIO +#ifdef USE_ANY_SYSV_TERMIO /* The following structures are initialized in main() in order ** to eliminate any assumptions about the internal order of their ** contents. @@ -628,7 +518,7 @@ #elif defined(USE_POSIX_TERMIOS) static struct termios d_tio; -#else /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */ +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ static struct sgttyb d_sg = { 0, 0, 0177, CKILL, EVENP|ODDP|ECHO|XTABS|CRMOD }; @@ -648,7 +538,7 @@ 'J', 'B' }; #endif /* sony */ -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO */ #endif /* ! VMS */ /* @@ -705,7 +595,7 @@ static int parse_tty_modes (char *s, struct _xttymodes *modelist); #ifdef USE_SYSV_UTMP -#if defined(X_NOT_STDC_ENV) || (defined(AIXV3) && (OSMAJORVERSION < 4)) +#if (defined(X_NOT_STDC_ENV) || (defined(AIXV3) && (OSMAJORVERSION < 4))) && !(defined(getutent) || defined(getutid) || defined(getutline)) extern struct utmp *getutent(); extern struct utmp *getutid(); extern struct utmp *getutline(); @@ -985,6 +875,8 @@ {"+im", "*useInsertMode", XrmoptionNoArg, (caddr_t) "off"}, {"-vb", "*visualBell", XrmoptionNoArg, (caddr_t) "on"}, {"+vb", "*visualBell", XrmoptionNoArg, (caddr_t) "off"}, +{"-pob", "*popOnBell", XrmoptionNoArg, (caddr_t) "on"}, +{"+pob", "*popOnBell", XrmoptionNoArg, (caddr_t) "off"}, #if OPT_WIDE_CHARS {"-wc", "*wideChars", XrmoptionNoArg, (caddr_t) "on"}, {"+wc", "*wideChars", XrmoptionNoArg, (caddr_t) "off"}, @@ -1002,7 +894,7 @@ standard XtAppInitialize options now */ {"%", "*tekGeometry", XrmoptionStickyArg, (caddr_t) NULL}, {"#", ".iconGeometry",XrmoptionStickyArg, (caddr_t) NULL}, -{"-T", "*title", XrmoptionSepArg, (caddr_t) NULL}, +{"-T", ".title", XrmoptionSepArg, (caddr_t) NULL}, {"-n", "*iconName", XrmoptionSepArg, (caddr_t) NULL}, {"-r", "*reverseVideo",XrmoptionNoArg, (caddr_t) "on"}, {"+r", "*reverseVideo",XrmoptionNoArg, (caddr_t) "off"}, @@ -1026,6 +918,10 @@ { "-bw number", "border width in pixels" }, { "-fn fontname", "normal text font" }, { "-fb fontname", "bold text font" }, +#ifdef XRENDERFONT +{ "-fa pattern", "FreeType font-selection pattern" }, +{ "-fs size", "FreeType font-size" }, +#endif #if OPT_WIDE_CHARS { "-fw fontname", "doublewidth text font" }, { "-fwb fontname", "doublewidth bold text font" }, @@ -1038,13 +934,13 @@ { "-/+132", "turn on/off column switch inhibiting" }, { "-/+ah", "turn on/off always highlight" }, #ifndef NO_ACTIVE_ICON -{ "-/+ai", "turn on/off active icon" }, -{ "-fi fontname", "icon font for active icon" }, +{ "-/+ai", "turn on/off active icon" }, +{ "-fi fontname", "icon font for active icon" }, #endif /* NO_ACTIVE_ICON */ { "-b number", "internal border in pixels" }, { "-/+bc", "turn on/off text cursor blinking" }, -{ "-bcf milliseconds", "time text cursor is off when blinking"}, -{ "-bcn milliseconds", "time text cursor is on when blinking"}, +{ "-bcf milliseconds", "time text cursor is off when blinking"}, +{ "-bcn milliseconds", "time text cursor is on when blinking"}, { "-/+bdc", "turn off/on display of bold as color"}, { "-/+cb", "turn on/off cut-to-beginning-of-line inhibit" }, { "-cc classrange", "specify additional character classes" }, @@ -1054,7 +950,7 @@ { "-/+cu", "turn on/off curses emulation" }, { "-/+dc", "turn off/on dynamic color selection" }, #if OPT_HIGHLIGHT_COLOR -{ "-hc", "selection background color" }, +{ "-hc", "selection background color" }, #endif #if OPT_HP_FUNC_KEYS { "-/+hf", "turn on/off HP Function Key escape codes" }, @@ -1112,6 +1008,7 @@ { "-/+ut", "turn on/off utmp inhibit (not supported)" }, #endif { "-/+vb", "turn on/off visual bell" }, +{ "-/+pob", "turn on/off pop on bell" }, #if OPT_WIDE_CHARS { "-/+wc", "turn on/off wide-character mode" }, #endif @@ -1471,7 +1368,7 @@ d_tio.c_cc[VREPRINT]= TREPRINT_DEF; d_tio.c_cc[VLNEXT]= TLNEXT_DEF; d_tio.c_cc[VDISCARD]= TDISCARD_DEF; -#elif defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) /* { */ +#elif defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) /* { */ /* Initialization is done here rather than above in order ** to prevent any assumptions about the order of the contents ** of the various terminal structures (which may change from @@ -1961,7 +1858,7 @@ } } if(i >= 0) { -#if defined(USE_SYSV_TERMIO) && !defined(SVR4) && !defined(linux) +#if defined(USE_ANY_SYSV_TERMIO) && !defined(SVR4) && !defined(linux) /* SYSV has another pointer which should be part of the ** FILE structure but is actually a separate array. */ @@ -1975,9 +1872,9 @@ stderr->_file = i; #endif _bufend(stderr) = old_bufend; -#else /* USE_SYSV_TERMIO */ +#else /* USE_ANY_SYSV_TERMIO */ freopen(dbglogfile, "w", stderr); -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO */ /* mark this file as close on exec */ (void) fcntl(i, F_SETFD, 1); @@ -2037,7 +1934,7 @@ if (fcntl(screen->respond, F_SETFD, mode) == -1) Error(1); nbio_register(screen->respond); -#elif defined(USE_SYSV_TERMIO) || defined(__MVS__) +#elif defined(USE_ANY_SYSV_TERMIO) || defined(__MVS__) if (0 > (mode = fcntl(screen->respond, F_GETFL, 0))) Error(1); #ifdef O_NDELAY @@ -2047,7 +1944,7 @@ #endif /* O_NDELAY */ if (fcntl(screen->respond, F_SETFL, mode)) Error(1); -#else /* !MINIX && !USE_SYSV_TERMIO */ +#else /* !MINIX && !USE_ANY_SYSV_TERMIO */ mode = 1; if (ioctl (screen->respond, FIONBIO, (char *)&mode) == -1) SysError (ERROR_FIONBIO); #endif /* MINIX, etc */ @@ -2479,7 +2376,7 @@ int initial_erase = VAL_INITIAL_ERASE; #endif int tty = -1; -#ifdef USE_SYSV_TERMIO +#ifdef USE_ANY_SYSV_TERMIO struct termio tio; #ifdef TIOCLSET unsigned lmode; @@ -2489,7 +2386,7 @@ #endif /* HAS_LTCHARS */ #elif defined(USE_POSIX_TERMIOS) struct termios tio; -#else /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */ +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ int ldisc = 0; int discipline; unsigned lmode; @@ -2500,7 +2397,7 @@ int jmode; struct jtchars jtc; #endif /* sony */ -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO */ char termcap [TERMCAP_SIZE]; char newtc [TERMCAP_SIZE]; @@ -2514,13 +2411,15 @@ struct ttysize ts; #elif defined(TIOCSWINSZ) struct winsize ws; -#endif +#endif /* sun vs TIOCSWINSZ */ struct passwd *pw = NULL; #ifdef HAVE_UTMP #if defined(UTMPX_FOR_UTMP) - struct utmpx utmp; + struct utmpx utmp, + *utret; #else - struct utmp utmp; + struct utmp utmp, + *utret; #endif #ifdef USE_LASTLOG struct lastlog lastlog; @@ -2591,9 +2490,9 @@ #ifdef TIOCLSET lmode = d_lmode; #endif /* TIOCLSET */ -#if defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) +#if defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) tio = d_tio; -#else /* not USE_SYSV_TERMIO and not USE_POSIX_TERMIOS */ +#else /* not USE_ANY_SYSV_TERMIO and not USE_POSIX_TERMIOS */ sg = d_sg; tc = d_tc; discipline = d_disipline; @@ -2601,7 +2500,7 @@ jmode = d_jmode; jtc = d_jtc; #endif /* sony */ -#endif /* USE_SYSV_TERMIO or USE_POSIX_TERMIOS */ +#endif /* USE_ANY_SYSV_TERMIO or USE_POSIX_TERMIOS */ } else { SysError(ERROR_OPDEVTTY); } @@ -2621,13 +2520,13 @@ if(ioctl(tty, TIOCLGET, &lmode) == -1) lmode = d_lmode; #endif /* TIOCLSET */ -#ifdef USE_SYSV_TERMIO +#ifdef USE_ANY_SYSV_TERMIO if(ioctl(tty, TCGETA, &tio) == -1) tio = d_tio; #elif defined(USE_POSIX_TERMIOS) if (tcgetattr(tty, &tio) == -1) tio = d_tio; -#else /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */ +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ if(ioctl(tty, TIOCGETP, (char *)&sg) == -1) sg = d_sg; if(ioctl(tty, TIOCGETC, (char *)&tc) == -1) @@ -2640,17 +2539,17 @@ if(ioctl(tty, TIOCKGETC, (char *)&jtc) == -1) jtc = d_jtc; #endif /* sony */ -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO */ #if OPT_INITIAL_ERASE if (resource.ptyInitialErase) { -#ifdef USE_SYSV_TERMIO +#ifdef USE_ANY_SYSV_TERMIO initial_erase = tio.c_cc[VERASE]; #elif defined(USE_POSIX_TERMIOS) initial_erase = tio.c_cc[VERASE]; -#else /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */ +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ initial_erase = sg.sg_erase; -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO */ } TRACE(("%s @%d, ptyInitialErase:%d, backarrow_is_erase:%d, initial_erase:%d (from /dev/tty)\n", __FILE__, __LINE__, @@ -2681,7 +2580,7 @@ #if OPT_INITIAL_ERASE if (resource.ptyInitialErase) { -#ifdef USE_SYSV_TERMIO +#ifdef USE_ANY_SYSV_TERMIO struct termio my_tio; if(ioctl(screen->respond, TCGETA, &my_tio) == 0) initial_erase = my_tio.c_cc[VERASE]; @@ -2689,11 +2588,11 @@ struct termios my_tio; if (tcgetattr(screen->respond, &my_tio) == 0) initial_erase = my_tio.c_cc[VERASE]; -#else /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */ +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ struct sgttyb my_sg; if(ioctl(screen->respond, TIOCGETP, (char *)&my_sg) == 0) initial_erase = my_sg.sg_erase; -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO */ } if (resource.backarrow_is_erase) if (initial_erase == 127) { /* see input.c */ @@ -3054,7 +2953,7 @@ * set up the tty modes */ { -#if defined(USE_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) +#if defined(USE_ANY_SYSV_TERMIO) || defined(USE_POSIX_TERMIOS) #if defined(umips) || defined(CRAY) || defined(linux) /* If the control tty had its modes screwed around with, eg. by lineedit in the shell, or emacs, etc. then tio @@ -3086,6 +2985,9 @@ cfsetospeed(&tio, VAL_LINE_SPEED); #else /* !MINIX */ #ifndef USE_POSIX_TERMIOS +# if defined(Lynx) && !defined(CBAUD) +# define CBAUD V_CBAUD +# endif tio.c_cflag &= ~(CBAUD); #ifdef BAUD_0 /* baud rate is 0 (don't care) */ @@ -3236,7 +3138,7 @@ if (tcsetattr (tty, TCSANOW, &tio) == -1) HsSysError(cp_pipe[1], ERROR_TIOCSETP); #endif /* USE_POSIX_TERMIOS */ -#else /* USE_SYSV_TERMIO or USE_POSIX_TERMIOS */ +#else /* USE_ANY_SYSV_TERMIO or USE_POSIX_TERMIOS */ sg.sg_flags &= ~(ALLDELAY | XTABS | CBREAK | RAW); sg.sg_flags |= ECHO | CRMOD; /* make sure speed is set on pty so that editors work right*/ @@ -3290,7 +3192,7 @@ if (ioctl (tty, TIOCKSETC, (char *)&jtc) == -1) HsSysError (cp_pipe[1], ERROR_TIOCKSETC); #endif /* sony */ -#endif /* !USE_SYSV_TERMIO */ +#endif /* !USE_ANY_SYSV_TERMIO */ #if defined(TIOCCONS) || defined(SRIOCSREDIR) if (Console) { #ifdef TIOCCONS @@ -3331,7 +3233,7 @@ if (! resource.ptyInitialErase && !override_tty_modes && !ttymodelist[XTTYMODE_erase].set) { -#ifdef USE_SYSV_TERMIO +#ifdef USE_ANY_SYSV_TERMIO if(ioctl(tty, TCGETA, &tio) == -1) tio = d_tio; tio.c_cc[VERASE] = initial_erase; @@ -3341,12 +3243,12 @@ tio = d_tio; tio.c_cc[VERASE] = initial_erase; tcsetattr(tty, TCSANOW, &tio); -#else /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */ +#else /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ if(ioctl(tty, TIOCGETP, (char *)&sg) == -1) sg = d_sg; sg.sg_erase = initial_erase; ioctl(tty, TIOCSETP, (char *)&sg); -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO */ } #endif @@ -3468,12 +3370,20 @@ /* position to entry in utmp file */ /* Test return value: beware of entries left behind: PSz 9 Mar 00 */ - if (! getutid(&utmp)) { + if (! ( utret = getutid(&utmp) ) ) { utmp.ut_type = USER_PROCESS; - if (! getutid(&utmp)) { + if (! ( utret = getutid(&utmp) ) ) { (void) setutent(); } } +#if OPT_TRACE + if ( ! utret ) + TRACE(("getutid: NULL\n.")); + else + TRACE(("getutid: pid=%d type=%d user=%s line=%s id=%s\n", + utret->ut_pid, utret->ut_type, utret->ut_user, + utret->ut_line, utret->ut_id )); +#endif /* set up the new entry */ utmp.ut_type = USER_PROCESS; @@ -3516,8 +3426,13 @@ #endif /* write out the entry */ - if (!resource.utmpInhibit) - (void) pututline(&utmp); + if (!resource.utmpInhibit) { + errno = 0; + pututline(&utmp); + TRACE(("pututline: %d %d %s\n", + resource.utmpInhibit, + errno, strerror(errno))); + } #ifdef WTMP #if defined(SVR4) || defined(SCO325) if (term->misc.login_shell) @@ -3769,11 +3684,11 @@ shname_minus = (char *)malloc(strlen(shname) + 2); (void) strcpy(shname_minus, "-"); (void) strcat(shname_minus, shname); -#if !defined(USE_SYSV_TERMIO) && !defined(USE_POSIX_TERMIOS) +#if !defined(USE_ANY_SYSV_TERMIO) && !defined(USE_POSIX_TERMIOS) ldisc = XStrCmp("csh", shname + strlen(shname) - 3) == 0 ? NTTYDISC : 0; ioctl(0, TIOCSETD, (char *)&ldisc); -#endif /* !USE_SYSV_TERMIO && !USE_POSIX_TERMIOS */ +#endif /* !USE_ANY_SYSV_TERMIO && !USE_POSIX_TERMIOS */ #ifdef USE_LOGIN_DASH_P if (term->misc.login_shell && pw && added_utmp_entry) @@ -4343,7 +4258,7 @@ if (term->misc.login_shell && (wfd = open(etc_wtmp, O_WRONLY | O_APPEND)) >= 0) { (void) strncpy(utmp.ut_line, - my_pty_name(ttydev), + my_pty_name(ttydev), sizeof (utmp.ut_line)); time(&utmp.ut_time); write(wfd, (char *)&utmp, sizeof(utmp)); @@ -4609,8 +4524,8 @@ else return 0; #elif defined(MINIX) - /* The answer doesn't have to correct. Calling nbio_isinprogress is - * much cheaper than called nbio_select. + /* The answer doesn't have to be correct. Calling nbio_isinprogress() is + * much cheaper than nbio_select(). */ if (nbio_isinprogress(fd, ASIO_READ)) return 0; Index: xc/programs/xterm/main.h diff -u xc/programs/xterm/main.h:3.4 xc/programs/xterm/main.h:3.5 --- xc/programs/xterm/main.h:3.4 Tue Oct 31 20:12:40 2000 +++ xc/programs/xterm/main.h Wed Jan 17 18:46:37 2001 @@ -1,7 +1,8 @@ /* - * $XConsortium: main.h,v 1.5 91/02/06 16:00:15 gildea Exp $ - * $XFree86: xc/programs/xterm/main.h,v 3.4 2000/11/01 01:12:40 dawes Exp $ + * $Xorg: main.h,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ + +/* $XFree86: xc/programs/xterm/main.h,v 3.5 2001/01/17 23:46:37 dawes Exp $ */ /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. Index: xc/programs/xterm/menu.c diff -u xc/programs/xterm/menu.c:3.38 xc/programs/xterm/menu.c:3.41 --- xc/programs/xterm/menu.c:3.38 Tue Oct 31 20:12:40 2000 +++ xc/programs/xterm/menu.c Wed Jan 17 18:46:37 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: menu.c /main/66 1996/12/01 23:46:59 swick $ */ -/* $XFree86: xc/programs/xterm/menu.c,v 3.38 2000/11/01 01:12:40 dawes Exp $ */ +/* $Xorg: menu.c,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ /* Copyright 1999-2000 by Thomas E. Dickey @@ -48,8 +47,9 @@ in this Software without prior written authorization from the X Consortium. */ +/* $XFree86: xc/programs/xterm/menu.c,v 3.41 2001/01/17 23:46:37 dawes Exp $ */ -#include +#include #include #include #include @@ -71,12 +71,6 @@ #include #include -#ifdef MINIX -#include -#endif - -#include - static void do_8bit_control PROTO_XT_CALLBACK_ARGS; static void do_allow132 PROTO_XT_CALLBACK_ARGS; static void do_allowsends PROTO_XT_CALLBACK_ARGS; @@ -111,6 +105,7 @@ static void do_terminate PROTO_XT_CALLBACK_ARGS; static void do_titeInhibit PROTO_XT_CALLBACK_ARGS; static void do_visualbell PROTO_XT_CALLBACK_ARGS; +static void do_poponbell PROTO_XT_CALLBACK_ARGS; static void do_vtfont PROTO_XT_CALLBACK_ARGS; #ifdef ALLOWLOGGING @@ -228,6 +223,7 @@ { "allow132", do_allow132, NULL }, { "cursesemul", do_cursesemul, NULL }, { "visualbell", do_visualbell, NULL }, + { "poponbell", do_poponbell, NULL }, { "marginbell", do_marginbell, NULL }, #if OPT_BLINK_CURS { "cursorblink", do_cursorblink, NULL }, @@ -467,7 +463,7 @@ return False; } - if ((mw = obtain_menu(w, me)) == 0 + if ((mw = obtain_menu(w, (MenuIndex) me)) == 0 || sizeof_menu(w, me) == 0) { mw = create_menu (w, term, (MenuIndex) me); created = (mw != 0); @@ -518,6 +514,7 @@ update_allow132(); update_cursesemul(); update_visualbell(); + update_poponbell(); update_marginbell(); update_cursorblink(); update_altscreen(); @@ -680,6 +677,17 @@ update_visualbell(); } +static void do_poponbell ( + Widget gw GCC_UNUSED, + XtPointer closure GCC_UNUSED, + XtPointer data GCC_UNUSED) +{ + register TScreen *screen = &term->screen; + + screen->poponbell = !screen->poponbell; + update_poponbell(); +} + #ifdef ALLOWLOGGING static void do_logging ( Widget gw GCC_UNUSED, @@ -1424,6 +1432,16 @@ Cardinal *param_count) { handle_toggle (do_visualbell, (int) term->screen.visualbell, + params, *param_count, w, (XtPointer)0, (XtPointer)0); +} + +void HandleSetPopOnBell( + Widget w, + XEvent *event GCC_UNUSED, + String *params, + Cardinal *param_count) +{ + handle_toggle (do_poponbell, (int) term->screen.poponbell, params, *param_count, w, (XtPointer)0, (XtPointer)0); } Index: xc/programs/xterm/menu.h diff -u xc/programs/xterm/menu.h:3.23 xc/programs/xterm/menu.h:3.25 --- xc/programs/xterm/menu.h:3.23 Mon Jun 12 22:28:40 2000 +++ xc/programs/xterm/menu.h Wed Jan 17 18:46:37 2001 @@ -1,5 +1,4 @@ -/* $XConsortium: menu.h /main/27 1996/12/01 23:47:03 swick $ */ -/* $XFree86: xc/programs/xterm/menu.h,v 3.23 2000/06/13 02:28:40 dawes Exp $ */ +/* $Xorg: menu.h,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ /* Copyright 1999-2000 by Thomas E. Dickey @@ -51,6 +50,7 @@ from the X Consortium. */ +/* $XFree86: xc/programs/xterm/menu.h,v 3.25 2001/01/17 23:46:37 dawes Exp $ */ #ifndef included_menu_h #define included_menu_h @@ -113,6 +113,7 @@ extern void HandleSetTekText PROTO_XT_ACTIONS_ARGS; extern void HandleSetTerminalType PROTO_XT_ACTIONS_ARGS; extern void HandleSetVisualBell PROTO_XT_ACTIONS_ARGS; +extern void HandleSetPopOnBell PROTO_XT_ACTIONS_ARGS; extern void HandleSoftReset PROTO_XT_ACTIONS_ARGS; extern void HandleSunFunctionKeys PROTO_XT_ACTIONS_ARGS; extern void HandleSunKeyboard PROTO_XT_ACTIONS_ARGS; @@ -190,6 +191,7 @@ vtMenu_allow132, vtMenu_cursesemul, vtMenu_visualbell, + vtMenu_poponbell, vtMenu_marginbell, #if OPT_BLINK_CURS vtMenu_cursorblink, @@ -428,6 +430,11 @@ update_menu_item (term->screen.vtMenu, \ vtMenuEntries[vtMenu_visualbell].widget, \ term->screen.visualbell) + +#define update_poponbell() \ + update_menu_item (term->screen.vtMenu, \ + vtMenuEntries[vtMenu_poponbell].widget, \ + term->screen.poponbell) #define update_marginbell() \ update_menu_item (term->screen.vtMenu, \ Index: xc/programs/xterm/minstall.sh diff -u /dev/null xc/programs/xterm/minstall.sh:1.1 --- /dev/null Mon Jun 4 12:43:06 2001 +++ xc/programs/xterm/minstall.sh Sun Mar 11 20:00:08 2001 @@ -0,0 +1,27 @@ +#!/bin/sh +# $XFree86: xc/programs/xterm/minstall.sh,v 1.1 2001/03/12 01:00:08 dickey Exp $ +# +# Install manpages, substituting a reasonable section value since XFree86 4.x +# doesn't use constants... +# +# Parameters: +# $1 = program to invoke as "install" +# $2 = manpage to install +# $3 = final installed-path +# + +MINSTALL="$1" +OLD_FILE="$2" +END_FILE="$3" + +suffix=`echo "$END_FILE" | sed -e 's/^[^.]*.//'` +NEW_FILE=temp$$ + +sed -e 's/__vendorversion__/"X Window System"/' \ + -e s/__miscmansuffix__/$suffix/ \ + $OLD_FILE >$NEW_FILE + +echo "$MINSTALL $OLD_FILE $END_FILE" +eval "$MINSTALL $NEW_FILE $END_FILE" + +rm -f $NEW_FILE Index: xc/programs/xterm/misc.c diff -u xc/programs/xterm/misc.c:3.59 xc/programs/xterm/misc.c:3.62 --- xc/programs/xterm/misc.c:3.59 Thu Dec 7 05:12:33 2000 +++ xc/programs/xterm/misc.c Wed Apr 11 21:02:50 2001 @@ -1,8 +1,9 @@ /* - * $XConsortium: misc.c /main/112 1996/11/29 10:34:07 swick $ - * $XFree86: xc/programs/xterm/misc.c,v 3.59 2000/12/07 10:12:33 dickey Exp $ + * $Xorg: misc.c,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ +/* $XFree86: xc/programs/xterm/misc.c,v 3.62 2001/04/12 01:02:50 dickey Exp $ */ + /* * * Copyright 1999-2000 by Thomas E. Dickey @@ -76,12 +77,6 @@ #include #endif -#ifdef X_NOT_STDC_ENV -extern time_t time (); -#else -#include -#endif - #include #include #include @@ -504,6 +499,9 @@ #else XBell(screen->display, percent); #endif + + if (screen->poponbell) + XRaiseWindow(screen->display, VShellWindow); if(screen->bellSuppressTime) { /* now we change a property and wait for the notify event to come Index: xc/programs/xterm/os2main.c diff -u xc/programs/xterm/os2main.c:3.41 xc/programs/xterm/os2main.c:3.45 --- xc/programs/xterm/os2main.c:3.41 Tue Oct 31 20:12:41 2000 +++ xc/programs/xterm/os2main.c Wed Apr 11 21:02:50 2001 @@ -5,7 +5,7 @@ #ifndef lint static char *rid="$XConsortium: main.c,v 1.227.1.2 95/06/29 18:13:15 kaleb Exp $"; #endif /* lint */ -/* $XFree86: xc/programs/xterm/os2main.c,v 3.41 2000/11/01 01:12:41 dawes Exp $ */ +/* $XFree86: xc/programs/xterm/os2main.c,v 3.45 2001/04/12 01:02:50 dickey Exp $ */ /*********************************************************** @@ -71,8 +71,6 @@ #include #include - -#include #include #ifdef I18N #include @@ -90,21 +88,15 @@ #include #include #include - -#include +#include int setpgrp(pid_t pid ,gid_t pgid) {} int chown(const char* fn, pid_t pid, gid_t gid) {} char *ttyname(int fd) { return "/dev/tty"; } -#include #include - #include /* for NOFILE */ - #include -#include - #include static SIGNAL_T reapchild (int n); @@ -424,6 +416,8 @@ {"+im", "*useInsertMode", XrmoptionNoArg, (caddr_t) "off"}, {"-vb", "*visualBell", XrmoptionNoArg, (caddr_t) "on"}, {"+vb", "*visualBell", XrmoptionNoArg, (caddr_t) "off"}, +{"-pob", "*popOnBell", XrmoptionNoArg, (caddr_t) "on"}, +{"+pob", "*popOnBell", XrmoptionNoArg, (caddr_t) "off"}, #if OPT_WIDE_CHARS {"-wc", "*wideChars", XrmoptionNoArg, (caddr_t) "on"}, {"+wc", "*wideChars", XrmoptionNoArg, (caddr_t) "off"}, @@ -441,7 +435,7 @@ standard XtAppInitialize options now */ {"%", "*tekGeometry", XrmoptionStickyArg, (caddr_t) NULL}, {"#", ".iconGeometry",XrmoptionStickyArg, (caddr_t) NULL}, -{"-T", "*title", XrmoptionSepArg, (caddr_t) NULL}, +{"-T", ".title", XrmoptionSepArg, (caddr_t) NULL}, {"-n", "*iconName", XrmoptionSepArg, (caddr_t) NULL}, {"-r", "*reverseVideo",XrmoptionNoArg, (caddr_t) "on"}, {"+r", "*reverseVideo",XrmoptionNoArg, (caddr_t) "off"}, @@ -539,6 +533,7 @@ { "-/+ulc", "turn off/on display of underline as color" }, { "-/+ut", "turn on/off utmp inhibit (not supported)" }, { "-/+vb", "turn on/off visual bell" }, +{ "-/+pob", "turn on/off pop on bell" }, #if OPT_WIDE_CHARS { "-/+wc", "turn on/off wide-character mode" }, #endif @@ -713,43 +708,6 @@ Atom wm_delete_window; #ifdef __EMX__ - -#define XFREE86_PTY 0x76 - -#define XTY_TIOCSETA 0x48 -#define XTY_TIOCSETAW 0x49 -#define XTY_TIOCSETAF 0x4a -#define XTY_TIOCCONS 0x4d -#define XTY_TIOCSWINSZ 0x53 -#define XTY_ENADUP 0x5a -#define XTY_TRACE 0x5b -#define XTY_TIOCGETA 0x65 -#define XTY_TIOCGWINSZ 0x66 -#define PTMS_GETPTY 0x64 -#define PTMS_BUFSZ 14 -#ifndef NCCS -#define NCCS 11 -#endif - -#define TIOCSWINSZ 113 -#define TIOCGWINSZ 117 - -struct pt_termios -{ - unsigned short c_iflag; - unsigned short c_oflag; - unsigned short c_cflag; - unsigned short c_lflag; - unsigned char c_cc[NCCS]; - long _reserved_[4]; -}; - -struct winsize { - unsigned short ws_row; /* rows, in characters */ - unsigned short ws_col; /* columns, in characters */ - unsigned short ws_xpixel; /* horizontal size, pixels */ - unsigned short ws_ypixel; /* vertical size, pixels */ -}; int ptioctl(int fd, int func, void* data) { Index: xc/programs/xterm/plink.sh diff -u /dev/null xc/programs/xterm/plink.sh:3.1 --- /dev/null Mon Jun 4 12:43:06 2001 +++ xc/programs/xterm/plink.sh Tue Mar 13 04:48:43 2001 @@ -0,0 +1,26 @@ +#!/bin/sh +# $XFree86: xc/programs/xterm/plink.sh,v 3.1 2001/03/13 09:48:43 dickey Exp $ +# +# Reduce the number of dynamic libraries used to link an executable. +CMD= +while test $# != 0 +do + OPT="$1" + shift + case $OPT in + -l*) + echo "testing if $OPT is needed" + if ( eval $CMD $* >/dev/null 2>/dev/null ) + then + : echo ...no + else + echo ...yes + CMD="$CMD $OPT" + fi + ;; + *) + CMD="$CMD $OPT" + ;; + esac +done +eval $CMD Index: xc/programs/xterm/ptyx.h diff -u xc/programs/xterm/ptyx.h:3.81 xc/programs/xterm/ptyx.h:3.86 --- xc/programs/xterm/ptyx.h:3.81 Wed Nov 29 03:39:26 2000 +++ xc/programs/xterm/ptyx.h Wed Apr 11 21:02:50 2001 @@ -1,8 +1,9 @@ /* - * $XConsortium: ptyx.h /main/67 1996/11/29 10:34:19 swick $ - * $XFree86: xc/programs/xterm/ptyx.h,v 3.81 2000/11/29 08:39:26 keithp Exp $ + * $Xorg: ptyx.h,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ +/* $XFree86: xc/programs/xterm/ptyx.h,v 3.86 2001/04/12 01:02:50 dickey Exp $ */ + /* * Copyright 1999-2000 by Thomas E. Dickey * @@ -111,7 +112,7 @@ #ifdef SYSV #ifdef X_NOT_POSIX -#ifndef CRAY +#if !defined(CRAY) && !defined(SVR4) #define dup2(fd1,fd2) ((fd1 == fd2) ? fd1 : \ (close(fd2), fcntl(fd1, F_DUPFD, fd2))) #endif @@ -220,7 +221,7 @@ #ifdef CRAY #define PTYCHARLEN 3 #elif defined(__MVS__) -#define PTYCHARLEN 4 +#define PTYCHARLEN 8 /* OS/390 stores, e.g. ut_id="ttyp1234" */ #else #define PTYCHARLEN 2 #endif @@ -510,8 +511,8 @@ #define OPT_SCO_FUNC_KEYS 0 /* true if xterm supports SCO-style function keys */ #endif -#ifndef OPT_SHIFT_KEYS -#define OPT_SHIFT_KEYS 1 /* true if xterm interprets shifted special-keys */ +#ifndef OPT_SHIFT_FONTS +#define OPT_SHIFT_FONTS 1 /* true if xterm interprets fontsize-shifting */ #endif #ifndef OPT_SUNPC_KBD @@ -550,6 +551,14 @@ #define OPT_ZICONBEEP 1 /* true if xterm supports "-ziconbeep" option */ #endif +#ifndef OPT_USE_UTF8_API +#define OPT_USE_UTF8_API 1 +#endif +#ifndef X_HAVE_UTF8_STRING +#undef OPT_USE_UTF8_API +#define OPT_USE_UTF8_API 0 +#endif + /***====================================================================***/ #if OPT_AIX_COLORS && !OPT_ISO_COLORS @@ -797,9 +806,13 @@ #if OPT_TRACE #include #else +#ifndef TRACE #define TRACE(p) /*nothing*/ +#endif +#ifndef TRACE_CHILD #define TRACE_CHILD /*nothing*/ #endif +#endif /***====================================================================***/ @@ -1038,6 +1051,7 @@ int mouse_col; /* ...and its column */ int select; /* xterm selected */ Boolean visualbell; /* visual bell mode */ + Boolean poponbell; /* pop on bell mode */ Boolean allowSendEvents;/* SendEvent mode */ Boolean awaitInput; /* select-timeout mode */ Boolean grabbedKbd; /* keyboard is grabbed */ @@ -1214,6 +1228,8 @@ Boolean cutToBeginningOfLine; /* line cuts to BOL? */ Boolean highlight_selection; /* controls appearance of selection */ Boolean trim_selection; /* controls trimming of selection */ + Boolean i18nSelections; + Boolean brokenSelections; char *selection_data; /* the current selection */ int selection_size; /* size of allocated buffer */ int selection_length; /* number of significant bytes */ @@ -1322,8 +1338,8 @@ #if OPT_DEC_SOFTFONT Boolean font_loadable; #endif -#if OPT_SHIFT_KEYS - Boolean shift_keys; /* true if we interpret shifted special-keys */ +#if OPT_SHIFT_FONTS + Boolean shift_fonts; /* true if we interpret fontsize-shifting */ #endif #if OPT_SUNPC_KBD int ctrl_fkeys; /* amount to add to XK_F1 for ctrl modifier */ Index: xc/programs/xterm/resize.c diff -u xc/programs/xterm/resize.c:3.43 xc/programs/xterm/resize.c:3.48 --- xc/programs/xterm/resize.c:3.43 Tue Oct 31 20:12:42 2000 +++ xc/programs/xterm/resize.c Thu Apr 5 15:29:44 2001 @@ -1,8 +1,9 @@ /* - * $XConsortium: resize.c,v 1.34 95/05/24 22:12:04 gildea Exp $ - * $XFree86: xc/programs/xterm/resize.c,v 3.43 2000/11/01 01:12:42 dawes Exp $ + * $Xorg: resize.c,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ +/* $XFree86: xc/programs/xterm/resize.c,v 3.48 2001/04/05 19:29:44 dawes Exp $ */ + /* * Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts. * @@ -28,87 +29,26 @@ /* resize.c */ - -#ifdef HAVE_CONFIG_H -#include - -#else - -#if defined(__EMX__) || defined(__CYGWIN__) || defined(SCO) || defined(sco) -#define USE_TERMCAP 1 -#endif - -#endif -#include +#include #include #include #include +#include -#if defined(att) -#define ATT -#endif - -#if defined(sgi) && defined(SVR4) -#undef SYSV -#undef SVR4 -#define SYSV -#endif - -#ifdef SVR4 -#undef SYSV /* predefined on Solaris 2.4 */ -#define SYSV -#define ATT -#endif - -#if (defined(ATT) && !defined(__sgi)) || (defined(SYSV) && defined(i386)) || (defined (__GLIBC__) && (__GLIBC__ == 2) && (__GLIBC_MINOR__ >= 1)) -#define USE_USG_PTYS -#endif - #ifdef APOLLO_SR9 #define CANT_OPEN_DEV_TTY #endif -#if defined(__EMX__) || defined(__CYGWIN__) -#define USE_SYSV_TERMIO -#endif - -#ifdef macII -#define USE_SYSV_TERMIO -#undef SYSV /* pretend to be bsd */ -#endif /* macII */ - -#ifdef linux -#define USE_TERMIOS -#endif - -#ifdef __MVS__ -#define USE_TERMIOS -#endif - -#ifdef Lynx -#define USE_SYSV_TERMIO -#endif - -#ifdef __OpenBSD__ -#define USE_TERMINFO -#include -#endif - #ifndef USE_TERMINFO /* avoid conflict with configure script */ -#if defined(SCO) || defined(sco) || defined(linux) +#if defined(__QNX__) || defined(SCO) || defined(sco) || defined(linux) || defined(__OpenBSD__) #define USE_TERMINFO #endif #endif -#if defined(SYSV) || defined(__CYGWIN__) -#define USE_SYSV_TERMIO -#elif defined(__QNX__) -#define USE_TERMINFO +#if defined(__QNX__) #include -#elif !defined(USE_TERMCAP) -#define USE_TERMCAP -#endif /* SYSV */ +#endif /* * Some OS's may want to use both, like SCO for example. We catch here anyone @@ -118,82 +58,31 @@ #define USE_TERMINFO #endif -#if defined(CSRG_BASED) -#define USE_TERMIOS -#endif - -#ifndef __CYGWIN__ -#include -#endif - -#ifdef USE_SYSV_TERMIO -# ifndef Lynx -# include -# else -# include -# endif -#else /* else not USE_SYSV_TERMIO */ -# ifdef USE_TERMIOS -# include -# else /* not USE_TERMIOS */ -# include -# endif /* USE_TERMIOS */ -#endif /* USE_SYSV_TERMIO */ - -#ifdef SYSV -#ifdef USE_USG_PTYS -#include -#ifndef SVR4 -#include -#endif -#endif -#endif - #include #include -#ifndef X_NOT_STDC_ENV -#include -#else -char *getenv(); -#endif - -#ifdef USE_SYSV_TERMIO #ifdef X_NOT_POSIX #if !defined(SYSV) && !defined(i386) extern struct passwd *getpwuid(); /* does ANYBODY need this? */ #endif /* SYSV && i386 */ #endif /* X_NOT_POSIX */ + +#ifndef bzero #define bzero(s, n) memset(s, 0, n) -#endif /* USE_SYSV_TERMIO */ +#endif #ifdef MINIX -#define USE_SYSV_TERMIO -#include -#define termio termios -#define TCGETA TCGETS -#define TCSETAW TCSETSW #ifndef IUCLC #define IUCLC 0 #endif #endif -#ifndef DFT_TERMTYPE -#define DFT_TERMTYPE "xterm" -#endif - -#ifndef GCC_UNUSED -#define GCC_UNUSED /* nothing */ -#endif - #ifdef __MVS__ -#define ESC(string) "\047" string +#define ESCAPE(string) "\047" string #else -#define ESC(string) "\033" string +#define ESCAPE(string) "\033" string #endif -#define CharOf(ch) ((unsigned char)(ch)) - #define EMULATIONS 2 #define SUN 1 #define VT100 0 @@ -225,52 +114,49 @@ char *myname; int shell_type = SHELL_UNKNOWN; char *getsize[EMULATIONS] = { - ESC("7") ESC("[r") ESC("[999;999H") ESC("[6n"), - ESC("[18t"), + ESCAPE("7") ESCAPE("[r") ESCAPE("[999;999H") ESCAPE("[6n"), + ESCAPE("[18t"), }; -#if !defined(sun) || defined(SVR4) -#ifdef TIOCSWINSZ +#if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) +#elif defined(TIOCSWINSZ) char *getwsize[EMULATIONS] = { /* size in pixels */ 0, - ESC("[14t"), + ESCAPE("[14t"), }; -#endif /* TIOCSWINSZ */ -#endif /* sun */ +#endif /* sun vs TIOCSWINSZ */ char *restore[EMULATIONS] = { - ESC("8"), + ESCAPE("8"), 0, }; char *setname = ""; char *setsize[EMULATIONS] = { 0, - ESC("[8;%s;%st"), + ESCAPE("[8;%s;%st"), }; -#ifdef USE_SYSV_TERMIO + +#ifdef USE_ANY_SYSV_TERMIO struct termio tioorig; -#else /* not USE_SYSV_TERMIO */ -# ifdef USE_TERMIOS +#elif defined(USE_TERMIOS) struct termios tioorig; -# else /* not USE_TERMIOS */ +#else struct sgttyb sgorig; -# endif /* USE_TERMIOS */ -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ + char *size[EMULATIONS] = { - ESC("[%d;%dR"), - ESC("[8;%d;%dt"), + ESCAPE("[%d;%dR"), + ESCAPE("[8;%d;%dt"), }; char sunname[] = "sunsize"; int tty; FILE *ttyfp; -#if !defined(sun) || defined(SVR4) -#ifdef TIOCSWINSZ + +#if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) +#elif defined(TIOCSWINSZ) char *wsize[EMULATIONS] = { 0, - ESC("[4;%hd;%hdt"), + ESCAPE("[4;%hd;%hdt"), }; -#endif /* TIOCSWINSZ */ -#endif /* sun */ - -#include +#endif /* sun vs TIOCSWINSZ */ static SIGNAL_T onintr (int sig); static SIGNAL_T resize_timeout (int sig); @@ -278,6 +164,8 @@ static void Usage (void); static void readstring (FILE *fp, char *buf, char *str); +#undef US /* may conflict with curses.h */ + #ifdef USE_TERMCAP #ifdef HAVE_TERMCAP_H #include @@ -292,7 +180,11 @@ #else #include #ifdef NCURSES_VERSION +#ifdef __CYGWIN__ +#include +#else #include /* tgetent() */ +#endif /*CYGWIN*/ #endif #endif /* HAVE_TERMCAP_H */ #endif @@ -311,30 +203,24 @@ struct passwd *pw; int i; int rows, cols; -#ifdef USE_SYSV_TERMIO +#ifdef USE_ANY_SYSV_TERMIO struct termio tio; -#else /* not USE_SYSV_TERMIO */ -#ifdef USE_TERMIOS +#elif defined(USE_TERMIOS) struct termios tio; -#else /* not USE_TERMIOS */ +#else struct sgttyb sg; -#endif /* USE_TERMIOS */ -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ #ifdef USE_TERMCAP int ok_tcap = 1; char termcap [TERMCAP_SIZE]; char newtc [TERMCAP_SIZE]; #endif /* USE_TERMCAP */ char buf[BUFSIZ]; -#if defined(sun) && !defined(SVR4) -#ifdef TIOCSSIZE +#if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) struct ttysize ts; -#endif /* TIOCSSIZE */ -#else /* sun */ -#ifdef TIOCSWINSZ +#elif defined(TIOCSWINSZ) struct winsize ws; -#endif /* TIOCSWINSZ */ -#endif /* sun */ +#endif /* sun vs TIOCSWINSZ */ char *name_of_tty; #ifdef CANT_OPEN_DEV_TTY extern char *ttyname(); @@ -424,7 +310,7 @@ } #endif /* USE_TERMINFO */ -#ifdef USE_SYSV_TERMIO +#ifdef USE_ANY_SYSV_TERMIO ioctl (tty, TCGETA, &tioorig); tio = tioorig; tio.c_iflag &= ~(ICRNL | IUCLC); @@ -432,8 +318,7 @@ tio.c_cflag |= CS8; tio.c_cc[VMIN] = 6; tio.c_cc[VTIME] = 1; -#else /* else not USE_SYSV_TERMIO */ -#if defined(USE_TERMIOS) +#elif defined(USE_TERMIOS) tcgetattr(tty, &tioorig); tio = tioorig; tio.c_iflag &= ~ICRNL; @@ -446,20 +331,17 @@ sg = sgorig; sg.sg_flags |= RAW; sg.sg_flags &= ~ECHO; -#endif /* USE_TERMIOS */ -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ signal(SIGINT, onintr); signal(SIGQUIT, onintr); signal(SIGTERM, onintr); -#ifdef USE_SYSV_TERMIO +#ifdef USE_ANY_SYSV_TERMIO ioctl (tty, TCSETAW, &tio); -#else /* not USE_SYSV_TERMIO */ -#ifdef USE_TERMIOS +#elif defined(USE_TERMIOS) tcsetattr(tty, TCSADRAIN, &tio); #else /* not USE_TERMIOS */ ioctl (tty, TIOCSETP, &sg); -#endif /* USE_TERMIOS */ -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ if (argc == 2) { sprintf (buf, setsize[emu], argv[0], argv[1]); @@ -473,17 +355,14 @@ } if(restore[emu]) write(tty, restore[emu], strlen(restore[emu])); -#if defined(sun) && !defined(SVR4) -#ifdef TIOCGSIZE +#if defined(TIOCSSIZE) && (defined(sun) && !defined(SVR4)) /* finally, set the tty's window size */ if (ioctl (tty, TIOCGSIZE, &ts) != -1) { ts.ts_lines = rows; ts.ts_cols = cols; ioctl (tty, TIOCSSIZE, &ts); } -#endif /* TIOCGSIZE */ -#else /* sun */ -#ifdef TIOCGWINSZ +#elif defined(TIOCSWINSZ) /* finally, set the tty's window size */ if(getwsize[emu]) { /* get the window size in pixels */ @@ -509,18 +388,15 @@ ws.ws_col = cols; ioctl (tty, TIOCSWINSZ, &ws); } -#endif /* TIOCGWINSZ */ -#endif /* sun */ +#endif /* sun vs TIOCSWINSZ */ -#ifdef USE_SYSV_TERMIO +#ifdef USE_ANY_SYSV_TERMIO ioctl (tty, TCSETAW, &tioorig); -#else /* not USE_SYSV_TERMIO */ -#ifdef USE_TERMIOS +#elif defined(USE_TERMIOS) tcsetattr(tty, TCSADRAIN, &tioorig); #else /* not USE_TERMIOS */ ioctl (tty, TIOCSETP, &sgorig); -#endif /* USE_TERMIOS */ -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ signal(SIGINT, SIG_DFL); signal(SIGQUIT, SIG_DFL); signal(SIGTERM, SIG_DFL); @@ -610,7 +486,7 @@ setitimer(ITIMER_REAL, &it, (struct itimerval *)NULL); #endif if ((c = getc(fp)) == 0233) { /* meta-escape, CSI */ - *buf++ = c = ESC("")[0]; + *buf++ = c = ESCAPE("")[0]; *buf++ = '['; } else { *buf++ = c; @@ -651,14 +527,12 @@ static SIGNAL_T onintr(int sig GCC_UNUSED) { -#ifdef USE_SYSV_TERMIO +#ifdef USE_ANY_SYSV_TERMIO ioctl (tty, TCSETAW, &tioorig); -#else /* not USE_SYSV_TERMIO */ -#ifdef USE_TERMIOS +#elif defined(USE_TERMIOS) tcsetattr (tty, TCSADRAIN, &tioorig); #else /* not USE_TERMIOS */ ioctl (tty, TIOCSETP, &sgorig); -#endif /* use TERMIOS */ -#endif /* USE_SYSV_TERMIO */ +#endif /* USE_ANY_SYSV_TERMIO/USE_TERMIOS */ exit(1); } Index: xc/programs/xterm/resize.man diff -u xc/programs/xterm/resize.man:1.5 xc/programs/xterm/resize.man:1.9 --- xc/programs/xterm/resize.man:1.5 Mon Jun 12 22:28:40 2000 +++ xc/programs/xterm/resize.man Sun Mar 11 19:54:17 2001 @@ -1,7 +1,9 @@ -.\" $XConsortium: resize.man /main/12 1996/12/09 17:10:48 kaleb $ -.\" $XFree86: xc/programs/xterm/resize.man,v 1.5 2000/06/13 02:28:40 dawes Exp $ +.\" $Xorg: resize.man,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ +.\" .\" updated by Thomas E. Dickey for XFree86, Februrary 1998. -.TH RESIZE 1 "Release 6.3" "X Version 11" +.\" +.\" $XFree86: xc/programs/xterm/resize.man,v 1.9 2001/03/12 00:54:17 dickey Exp $ +.TH RESIZE 1 __vendorversion__ .SH NAME resize \- set TERMCAP and terminal settings to current xterm window size .SH SYNOPSIS @@ -78,5 +80,5 @@ Copyright (c) 1984, 1985 by X Consortium .br See -.IR X (1) +.IR X (__miscmansuffix__) for a complete copyright notice. Index: xc/programs/xterm/screen.c diff -u xc/programs/xterm/screen.c:3.52 xc/programs/xterm/screen.c:3.56 --- xc/programs/xterm/screen.c:3.52 Fri Sep 22 06:42:08 2000 +++ xc/programs/xterm/screen.c Wed Apr 11 21:02:50 2001 @@ -1,5 +1,5 @@ /* - * $TOG: screen.c /main/37 1997/08/26 14:13:55 kaleb $ + * $Xorg: screen.c,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ /* @@ -54,7 +54,7 @@ * SOFTWARE. */ -/* $XFree86: xc/programs/xterm/screen.c,v 3.52 2000/09/22 10:42:08 alanh Exp $ */ +/* $XFree86: xc/programs/xterm/screen.c,v 3.56 2001/04/12 01:02:50 dickey Exp $ */ /* screen.c */ @@ -63,64 +63,10 @@ #include #include #include +#include #include -#ifdef SVR4 -#include -#elif !defined(__CYGWIN__) -#include -#endif - -#if defined(__CYGWIN__) && !defined(TIOCSPGRP) -#include -#define TIOCSPGRP (_IOW('t', 118, pid_t)) -#endif - -#ifdef __hpux -#include -#endif - -#ifdef SYSV -#if !defined(DGUX) /* Intel DG/ux uses termios.h */ -#include -#endif /* DGUX */ -#ifdef USE_USG_PTYS -#include /* get typedef used in ptem.h */ -#include -#endif -#elif defined(sun) && !defined(SVR4) -#include -#ifdef TIOCSWINSZ -#undef TIOCSSIZE -#endif -#endif - -#ifdef MINIX -#include -#endif - -#ifdef ISC -#ifndef SYSV -#include -#endif -#define TIOCGPGRP TCGETPGRP -#define TIOCSPGRP TCSETPGRP -#endif - -#ifdef __EMX__ -extern int ptioctl(int fd, int func, void* data); -#define ioctl ptioctl -#define TIOCSWINSZ 113 -#define TIOCGWINSZ 117 -struct winsize { - unsigned short ws_row; /* rows, in characters */ - unsigned short ws_col; /* columns, in characters */ - unsigned short ws_xpixel; /* horizontal size, pixels */ - unsigned short ws_ypixel; /* vertical size, pixels */ -}; -#endif - /* * Allocates memory for a 2-dimensional array of chars and returns a pointer * thereto. Each line is formed from a set of char arrays, with an index @@ -294,8 +240,8 @@ int avail = screen->max_col - screen->cur_col + 1; Char *col; int wrappedbit; - Char starcol, starcol2; #if OPT_WIDE_CHARS + Char starcol, starcol2; Char *comb1l = 0, *comb1h = 0, *comb2l = 0, *comb2h = 0; #endif @@ -333,16 +279,14 @@ wrappedbit = ScrnTstWrapped(screen, screen->cur_row); +#if OPT_WIDE_CHARS starcol = *col; starcol2 = col[length-1]; +#endif /* write blanks if we're writing invisible text */ if (flags & INVISIBLE) { -#if OPT_WIDE_CHARS - memset(col, ' ', real_width); -#else memset(col, ' ', length); -#endif } else { memcpy(col, str, length); /* This can stand for the present. If it is wrong, we will scribble over it */ Index: xc/programs/xterm/scrollbar.c diff -u xc/programs/xterm/scrollbar.c:3.28 xc/programs/xterm/scrollbar.c:3.30 --- xc/programs/xterm/scrollbar.c:3.28 Mon Jun 12 22:28:41 2000 +++ xc/programs/xterm/scrollbar.c Sun Mar 11 19:54:18 2001 @@ -1,10 +1,11 @@ /* - * $XConsortium: scrollbar.c /main/47 1996/12/01 23:47:08 swick $ - * $XFree86: xc/programs/xterm/scrollbar.c,v 3.28 2000/06/13 02:28:41 dawes Exp $ + * $Xorg: scrollbar.c,v 1.4 2000/08/17 19:55:09 cpqbld Exp $ */ +/* $XFree86: xc/programs/xterm/scrollbar.c,v 3.30 2001/03/12 00:54:18 dickey Exp $ */ + /* - * Copyright 2000 by Thomas E. Dickey + * Copyright 2000,2001 by Thomas E. Dickey * * All Rights Reserved * @@ -151,7 +152,7 @@ if (! XGetWMNormalHints(screen->display, XtWindow(XtParent(xw)), &sizehints, &supp)) - sizehints.flags = 0; + bzero(&sizehints, sizeof(sizehints)); sizehints.base_width = min_width; sizehints.base_height = min_height; sizehints.width_inc = FontWidth(screen); Index: xc/programs/xterm/tabs.c diff -u xc/programs/xterm/tabs.c:3.8 xc/programs/xterm/tabs.c:3.9 --- xc/programs/xterm/tabs.c:3.8 Mon Jun 12 22:28:41 2000 +++ xc/programs/xterm/tabs.c Wed Jan 17 18:46:39 2001 @@ -1,7 +1,8 @@ /* - * $XConsortium: tabs.c,v 1.4 91/05/06 17:12:18 gildea Exp $ - * $XFree86: xc/programs/xterm/tabs.c,v 3.8 2000/06/13 02:28:41 dawes Exp $ + * $XFree86: xc/programs/xterm/tabs.c,v 3.9 2001/01/17 23:46:39 dawes Exp $ */ + +/* $Xorg: tabs.c,v 1.3 2000/08/17 19:55:09 cpqbld Exp $ */ /* * Copyright 2000 by Thomas E. Dickey Index: xc/programs/xterm/termcap diff -u xc/programs/xterm/termcap:3.27 xc/programs/xterm/termcap:3.28 --- xc/programs/xterm/termcap:3.27 Tue Oct 31 20:12:42 2000 +++ xc/programs/xterm/termcap Wed Jan 17 18:46:39 2001 @@ -1,5 +1,4 @@ -# $XConsortium: termcap,v 1.13 94/10/13 21:24:32 gildea Exp $ -# $XFree86: xc/programs/xterm/termcap,v 3.27 2000/11/01 01:12:42 dawes Exp $ +# $Xorg: termcap,v 1.3 2000/08/17 19:55:10 cpqbld Exp $ # # Note: # termcap format is limited to 1023 characters. This set of descriptions @@ -15,6 +14,8 @@ # # I checked the limits using ncurses "captoinfo -CrTv", which prints # the resolved length of each entry in a comment at the end - T.Dickey +# +# $XFree86: xc/programs/xterm/termcap,v 3.28 2001/01/17 23:46:39 dawes Exp $ # xf|xterm-xfree86|XFree86 xterm:\ :k1=\EOP:k2=\EOQ:k3=\EOR:k4=\EOS:\ Index: xc/programs/xterm/terminfo diff -u xc/programs/xterm/terminfo:3.42 xc/programs/xterm/terminfo:3.45 --- xc/programs/xterm/terminfo:3.42 Tue Oct 31 20:12:42 2000 +++ xc/programs/xterm/terminfo Wed Apr 11 21:02:51 2001 @@ -1,9 +1,12 @@ -# $XConsortium: terminfo,v 1.11 94/10/13 21:24:31 gildea Exp $ -# $XFree86: xc/programs/xterm/terminfo,v 3.42 2000/11/01 01:12:42 dawes Exp $ +# $Xorg: terminfo,v 1.3 2000/08/17 19:55:10 cpqbld Exp $ # +# meml locks memory above the cursor; memu unlocks (ala HP terminals) +# # XFree86 updates/notes/new entries (including xterm-8bit, xterm-16color) # - Thomas E. Dickey # +# $XFree86: xc/programs/xterm/terminfo,v 3.45 2001/04/12 01:02:51 dickey Exp $ +# # Special Capabilities: # -------------------- # ich has a corresponding capability that inserts a single blank. We could @@ -95,14 +98,14 @@ # xterm-xfree86|xterm-new|xterm terminal emulator (XFree86), npc, - kDC=\E[3;5~, - kEND=\EO5F, - kHOM=\EO5H, - kIC=\E[2;5~, - kLFT=\EO5D, - kNXT=\E[6;5~, - kPRV=\E[5;5~, - kRIT=\EO5C, + kDC=\E[3;2~, + kEND=\EO2F, + kHOM=\EO2H, + kIC=\E[2;2~, + kLFT=\EO2D, + kNXT=\E[6;2~, + kPRV=\E[5;2~, + kRIT=\EO2C, kb2=\EOE, kcbt=\E[Z, kcub1=\EOD, @@ -244,7 +247,7 @@ setaf=\E[3%p1%dm, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, - sgr=\E[0%?%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, @@ -734,7 +737,7 @@ setaf=\2333%p1%dm, setb=\2334%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\2333%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, - sgr=\2330%?%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, sgr0=\233m^O, smacs=^N, smam=\233?7h, Index: xc/programs/xterm/util.c diff -u xc/programs/xterm/util.c:3.61.2.1 xc/programs/xterm/util.c:3.67 --- xc/programs/xterm/util.c:3.61.2.1 Wed Feb 28 17:24:54 2001 +++ xc/programs/xterm/util.c Wed May 16 14:06:38 2001 @@ -1,10 +1,11 @@ /* - * $XConsortium: util.c /main/33 1996/12/01 23:47:10 swick $ - * $XFree86: xc/programs/xterm/util.c,v 3.61.2.1 2001/02/28 22:24:54 dawes Exp $ + * $Xorg: util.c,v 1.3 2000/08/17 19:55:10 cpqbld Exp $ */ +/* $XFree86: xc/programs/xterm/util.c,v 3.67 2001/05/16 18:06:38 keithp Exp $ */ + /* - * Copyright 1999-2000 by Thomas E. Dickey + * Copyright 1999,2000,2001 by Thomas E. Dickey * * All Rights Reserved * @@ -663,7 +664,7 @@ * so this has the effect of suppressing trailing blanks from a * selection. */ - if (col + len + 1 < screen->max_col) { + if (col + len < screen->max_col + 1) { flags |= CHARDRAWN; } else { len = screen->max_col + 1 - col; @@ -1466,10 +1467,31 @@ len * FontWidth(screen), FontHeight(screen)); y += font->ascent; - XftDrawString8 (screen->renderDraw, - getColor (values.foreground), - font, - x, y, (unsigned char *) text, len); + if (text2) + { + static XftChar16 *sbuf; + static int slen; + int n; + + if (slen < len) + { + slen = (len + 1) * 2; + sbuf = (XftChar16 *) XtRealloc ((char *) sbuf, slen * sizeof (XftChar16)); + } + for (n = 0; n < len; n++) + sbuf[n] = *text++| (*text2++ << 8); + XftDrawString16 (screen->renderDraw, + getColor (values.foreground), + font, + x, y, sbuf, len); + } + else + { + XftDrawString8 (screen->renderDraw, + getColor (values.foreground), + font, + x, y, (unsigned char *) text, len); + } return x + len * FontWidth(screen); } @@ -1774,10 +1796,11 @@ #if OPT_WIDE_CHARS if (text2 != 0) ch |= (text2[last] << 8); - isMissing = xtermMissingChar(ch, + isMissing = (ch != HIDDEN_CHAR) + && (xtermMissingChar(ch, ((on_wide || iswide(ch)) && screen->fnt_dwd) ? screen->fnt_dwd - : font); + : font)); #else isMissing = xtermMissingChar(ch, font); #endif @@ -1941,8 +1964,8 @@ unsigned makeColorPair (int fg, int bg) { - unsigned my_bg = (bg >= 0) && (bg < NUM_ANSI_COLORS) ? bg : 0; - unsigned my_fg = (fg >= 0) && (fg < NUM_ANSI_COLORS) ? fg : my_bg; + unsigned my_bg = (bg >= 0) && (bg < NUM_ANSI_COLORS) ? (unsigned) bg : 0; + unsigned my_fg = (fg >= 0) && (fg < NUM_ANSI_COLORS) ? (unsigned) fg : my_bg; #if OPT_EXT_COLORS return (my_fg << 8) | my_bg; #else Index: xc/programs/xterm/version.h diff -u xc/programs/xterm/version.h:3.62 xc/programs/xterm/version.h:3.68 --- xc/programs/xterm/version.h:3.62 Wed Dec 6 21:50:05 2000 +++ xc/programs/xterm/version.h Sat Apr 28 09:51:56 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xterm/version.h,v 3.62 2000/12/07 02:50:05 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/version.h,v 3.68 2001/04/28 13:51:56 dickey Exp $ */ /* * These definitions are used to build the string that's printed in response to @@ -6,5 +6,5 @@ * XFree86 to which this version of xterm has been built. The number in * parentheses is my patch number (T.Dickey). */ -#define XTERM_PATCH 149 -#define XFREE86_VERSION "XFree86 4.0.1h" +#define XTERM_PATCH 156 +#define XFREE86_VERSION "XFree86 4.0.3" Index: xc/programs/xterm/xterm.dat diff -u xc/programs/xterm/xterm.dat:1.2 xc/programs/xterm/xterm.dat:1.3 --- xc/programs/xterm/xterm.dat:1.2 Tue Jun 13 20:16:21 2000 +++ xc/programs/xterm/xterm.dat Sat Dec 30 14:15:47 2000 @@ -1,4 +1,4 @@ -! $XFree86: xc/programs/xterm/xterm.dat,v 1.2 2000/06/14 00:16:21 dawes Exp $ +! $XFree86: xc/programs/xterm/xterm.dat,v 1.3 2000/12/30 19:15:47 dickey Exp $ ! *title: Xterm *iconName: Xterm @@ -58,6 +58,7 @@ *vtMenu*allow132*Label: Allow 80/132 Column Switching *vtMenu*cursesemul*Label: Enable Curses Emulation *vtMenu*visualbell*Label: Enable Visual Bell +*vtMenu*poponbell*Label: Enable Pop on Bell *vtMenu*marginbell*Label: Enable Margin Bell *vtMenu*cursorblink*Label: Enable Blinking Cursor *vtMenu*titeInhibit*Label: Enable Alternate Screen Switching Index: xc/programs/xterm/xterm.h diff -u xc/programs/xterm/xterm.h:3.65 xc/programs/xterm/xterm.h:3.70 --- xc/programs/xterm/xterm.h:3.65 Thu Dec 7 05:12:34 2000 +++ xc/programs/xterm/xterm.h Wed Apr 11 21:02:51 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xterm/xterm.h,v 3.65 2000/12/07 10:12:34 dickey Exp $ */ +/* $XFree86: xc/programs/xterm/xterm.h,v 3.70 2001/04/12 01:02:51 dickey Exp $ */ /************************************************************ @@ -38,8 +38,8 @@ * This is also where we put the fallback definitions if we do not build using * the configure script. */ -#ifndef included_xterm_h -#define included_xterm_h +#ifndef included_xterm_h +#define included_xterm_h #ifdef HAVE_CONFIG_H #include @@ -83,11 +83,19 @@ #define USE_POSIX_TERMIOS 1 #endif +#if defined(hpux) && !defined(__hpux) +#define __hpux 1 /* HPUX 11.0 does not define this */ +#endif + #ifdef USE_POSIX_TERMIOS #define HAVE_TERMIOS_H 1 #define HAVE_TCGETATTR 1 #endif +#if defined(__EMX__) || defined(__CYGWIN__) || defined(SCO) || defined(sco) +#define USE_TERMCAP 1 +#endif + #if defined(UTMP) #define HAVE_UTMP 1 #endif @@ -150,6 +158,18 @@ /***====================================================================***/ +/* if compiling with gcc -ansi -pedantic, we must fix POSIX definitions */ +#if defined(__GNUC__) && defined(SVR4) && defined(sun) +#ifndef __EXTENSIONS__ +#define __EXTENSIONS__ 1 +#endif +#ifndef _POSIX_C_SOURCE +#define _POSIX_C_SOURCE 1 +#endif +#endif + +/***====================================================================***/ + #ifdef HAVE_STDLIB_H #include #else @@ -199,11 +219,22 @@ #else #define Select(n,r,w,e,t) select(n,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval *)t) #define XFD_COPYSET(src,dst) memcpy((dst)->fds_bits, (src)->fds_bits, sizeof(fd_set)) -#ifdef __MVS__ -#include +#if defined(__MVS__) && !defined(TIME_WITH_SYS_TIME) +#define TIME_WITH_SYS_TIME #endif #endif +#ifdef TIME_WITH_SYS_TIME +# include +# include +#else +# ifdef HAVE_SYS_TIME_H +# include +# else +# include +# endif +#endif + #ifdef USE_SYS_SELECT_H #include @@ -233,6 +264,7 @@ #define XtNboldColors "boldColors" #define XtNboldFont "boldFont" #define XtNboldMode "boldMode" +#define XtNbrokenSelections "brokenSelections" #define XtNc132 "c132" #define XtNcacheDoublesize "cacheDoublesize" #define XtNcharClass "charClass" @@ -276,13 +308,14 @@ #define XtNeightBitControl "eightBitControl" #define XtNeightBitInput "eightBitInput" #define XtNeightBitOutput "eightBitOutput" -#define XtNfontDoublesize "fontDoublesize" -#define XtNfontStyle "fontStyle" #define XtNfaceName "faceName" #define XtNfaceSize "faceSize" +#define XtNfontDoublesize "fontDoublesize" +#define XtNfontStyle "fontStyle" #define XtNhighlightColor "highlightColor" #define XtNhighlightSelection "highlightSelection" #define XtNhpLowerleftBugCompat "hpLowerleftBugCompat" +#define XtNi18nSelections "i18nSelections" #define XtNinternalBorder "internalBorder" #define XtNjumpScroll "jumpScroll" #define XtNkeyboardDialect "keyboardDialect" @@ -303,6 +336,7 @@ #define XtNpointerColor "pointerColor" #define XtNpointerColorBackground "pointerColorBackground" #define XtNpointerShape "pointerShape" +#define XtNpopOnBell "popOnBell" #define XtNprintAttributes "printAttributes" #define XtNprinterAutoClose "printerAutoClose" #define XtNprinterCommand "printerCommand" @@ -318,7 +352,7 @@ #define XtNscrollLines "scrollLines" #define XtNscrollPos "scrollPos" #define XtNscrollTtyOutput "scrollTtyOutput" -#define XtNshiftKeys "shiftKeys" +#define XtNshiftFonts "shiftFonts" #define XtNsignalInhibit "signalInhibit" #define XtNtekGeometry "tekGeometry" #define XtNtekInhibit "tekInhibit" @@ -329,9 +363,9 @@ #define XtNunderLine "underLine" #define XtNutf8 "utf8" #define XtNvisualBell "visualBell" +#define XtNwideBoldFont "wideBoldFont" #define XtNwideChars "wideChars" #define XtNwideFont "wideFont" -#define XtNwideBoldFont "wideBoldFont" #define XtNxmcAttributes "xmcAttributes" #define XtNxmcGlitch "xmcGlitch" #define XtNxmcInline "xmcInline" @@ -349,6 +383,7 @@ #define XtCBellSuppressTime "BellSuppressTime" #define XtCBoldFont "BoldFont" #define XtCBoldMode "BoldMode" +#define XtCBrokenSelections "BrokenSelections" #define XtCC132 "C132" #define XtCCacheDoublesize "CacheDoublesize" #define XtCCharClass "CharClass" @@ -373,6 +408,7 @@ #define XtCFontStyle "FontStyle" #define XtCHighlightSelection "HighlightSelection" #define XtCHpLowerleftBugCompat "HpLowerleftBugCompat" +#define XtCI18nSelections "I18nSelections" #define XtCJumpScroll "JumpScroll" #define XtCKeyboardDialect "KeyboardDialect" #define XtCLimitResize "LimitResize" @@ -388,6 +424,7 @@ #define XtCMultiScroll "MultiScroll" #define XtCNumLock "NumLock" #define XtCOldXtermFKeys "OldXtermFKeys" +#define XtCPopOnBell "PopOnBell" #define XtCPrintAttributes "PrintAttributes" #define XtCPrinterAutoClose "PrinterAutoClose" #define XtCPrinterCommand "PrinterCommand" @@ -402,7 +439,7 @@ #define XtCScrollCond "ScrollCond" #define XtCScrollLines "ScrollLines" #define XtCScrollPos "ScrollPos" -#define XtCShiftKeys "ShiftKeys" +#define XtCShiftFonts "ShiftFonts" #define XtCSignalInhibit "SignalInhibit" #define XtCTekInhibit "TekInhibit" #define XtCTekSmall "TekSmall" @@ -412,9 +449,9 @@ #define XtCUnderLine "UnderLine" #define XtCUtf8 "Utf8" #define XtCVisualBell "VisualBell" +#define XtCWideBoldFont "WideBoldFont" #define XtCWideChars "WideChars" #define XtCWideFont "WideFont" -#define XtCWideBoldFont "WideBoldFont" #define XtCXmcAttributes "XmcAttributes" #define XtCXmcGlitch "XmcGlitch" #define XtCXmcInline "XmcInline" @@ -426,12 +463,12 @@ #endif #ifdef VMS -#define XtCbackground "background" -#define XtCbordercolor "borderColor" -#define XtCborderwidth "borderWidth" -#define XtCforeground "foreground" -#define XtCfont "font" -#define XtCiconic "iconic" +#define XtCbackground "background" +#define XtCbordercolor "borderColor" +#define XtCborderwidth "borderWidth" +#define XtCforeground "foreground" +#define XtCfont "font" +#define XtCiconic "iconic" #endif /***====================================================================***/ Index: xc/programs/xterm/xterm.log.html diff -u xc/programs/xterm/xterm.log.html:1.61 xc/programs/xterm/xterm.log.html:1.69 --- xc/programs/xterm/xterm.log.html:1.61 Wed Dec 6 21:50:06 2000 +++ xc/programs/xterm/xterm.log.html Sat Apr 28 09:51:56 2001 @@ -20,7 +20,7 @@ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. * ***************************************************************************** - $XFree86: xc/programs/xterm/xterm.log.html,v 1.61 2000/12/07 02:50:06 dickey Exp $ + $XFree86: xc/programs/xterm/xterm.log.html,v 1.69 2001/04/28 13:51:56 dickey Exp $ --> @@ -42,6 +42,13 @@ xc/programs/Xserver/hw/xfree86). +

Patch #156 - 2001/4/28 - XFree86 4.0.3

+
    +
  • change order of selection-target types to make 8-bit xterm prefer + UTF8_STRING to COMPOUND_TEXT (patch by Juliusz Chroboczek). + +
  • document -fa, -fs command-line options + and faceName, faceSize + resources which are used by the freetype library support. + +
  • if configure script finds freetype libraries, but imake definitions + do not have the XRENDERFONT definition, define it anyway. + +
  • modify configure script check for freetype libraries to include + <Xlib.h>, since an older version of the related + headers relies on this (patch by Adam <adam@cfar.umd.edu>). +
+ +

Patch #155 - 2001/4/20 - XFree86 4.0.3

+
    +
  • correct return type of in_put() from patch #153 changes, which + left it not wide enough for UTF-8 (patch by Bruno Haible). +
+ +

Patch #154 - 2001/4/11 - XFree86 4.0.3

+
    +
  • undo check for return value from pututline (used for + debugging) since that function does not return a value on Slackware + 3.6. + +
  • correct length in ScreenWrite, when rendering invisible text + (patch by Sven Verdoolaege <skimo@kotnet.org>). + +
  • fixes/improvements for the i18nSelection resource + from patch #153, by Bruno Haible: + +
      +
    • add missing initialization for i18nSelection + resource. + +
    • split-out the non-ICCM aspect of the + i18nSelection resource as a new resource, + brokenSelections. +
    + +
  • add configure check for <time.h> and + <sys/time.h>, to allow for Unixware 7, + which requires both. If the configure script is not used, only + <time.h> will be included as before (report + by Thanh Ma). + +
  • fix redefinition of dup2, getutent, + getutid, getutline and sleep + functions on Unixware 7 (report by Thanh Ma + <Thanh.Ma@casi-rusco.com>) + +
  • add a fall-back definition for __hpux, which is + apparently not defined in some compilers on HPUX 11.0 (reported + by Clint Olsen). + +
  • change VAL_INITIAL_ERASE, which is used as a fallback for the + "kb" termcap string to 8, since that matches the + xterm terminal description (request by Alexander V Lukyanov). + +
  • correct an off-by-one in ClearInLine, which caused + the erase-characters (ECH) control to display incorrectly + (patch by Alexander V Lukyanov). + +
  • correct escape sequences shown in terminfo for shifted editing + keys. The modifier code was for the control key rather than + the shift key. +
+ +

Patch #153 - 2001/3/29 - XFree86 4.0.3

+
    +
  • increase PTYCHARLEN to 8 for os390, add some debugging traces + for UTMP functions (patch by Paul Gilmartin). + +
  • correct an misplaced brace in SelectionReceived() + (patch by Bruno Haible). + +
  • correct an assignment dropped in SelectionReceived() + which made it not compile for wide-characters combined with debug + traces. + +
  • correct typo, clarify description of 88- and 256-color controls + (report by Bram Moolenaar). + +
  • correct a typo in ctlseqs.ms which caused DEC Locator control + sequences using single quote "'" display grave "`" instead (reported + by Paul Williams, apparently in patch #114). +
+ +

Patch #152 - 2001/3/13 - XFree86 4.0.2

+
    +
  • correct index in inner loop in VTInitI18N() from + patch #151 changes, which resulted in infinite loop under some + conditions (report/analysis by Paul Gilmartin). + +
  • remove spurious "%|" from terminfo sgr capabilities + (report/analysis by Adam M Costello, Debian bug #89222). + +
  • add shell script to adjust list of dynamic libraries linked by + resize when building with the standalone configure + script. Otherwise it uses the same list as for xterm, which is + excessive. + +
  • fix a few compiler warnings reported by the 20010305 gcc snapshot. +
+ +

Patch #151 - 2001/3/10 - XFree86 4.0.2

+
    +
  • patch from Juliusz Chroboczek <jch@pps.jussieu.fr> which + alters the behaviour of selections in XTerm. + It is believed to follow the ICCCM + UTF8_STRING to the letter, both + in UTF-8 and in eight-bit mode. From his description: +
      +
    • When compiled against XFree86 4.0.2, the patched XTerm will make + the selection available as COMPOUND_TEXT, STRING or UTF8_STRING in + both modes. It will request selections in the following order: +

      + UTF-8 mode: UTF8_STRING, TEXT, COMPOUND_TEXT, STRING.
      + eight-bit mode: TEXT, COMPOUND_TEXT, UTF8_STRING, STRING. + +

    • When compiled against an earlier version of XFree86 (or compiled with + OPT_UTF8_API=0), it will still obey the ICCCM, but will neither + request nor provide UTF8_STRING in eight-bit mode, and neither TEXT + nor COMPOUND_TEXT in UTF-8 mode. +
    • For compatibility with previous versions of XTerm, a resource + i18nSelections is provided, please see the manpage for + details. However, due to an unexpected combination of ICCCM + extensions by various bits and pieces of the libraries, interacting + with previous versions of XTerm will work in many locales even + without this flag. (Please do not set this resource to true by + default, as this would violate the ICCCM.) +
    + +
  • improved error checking/reporting in VTInitI18N(), ensuring that + lack of input method styles is treated distinctly from a mismatch. + +
  • remove an incorrect ifdef from patch #141 which suppressed + overstriking to simulate bold font when xterm was compiled to support + wide characters (report/analysis by Adam M Costello + <amc@cs.berkeley.edu>, fixes Debian bugs #76404, #77575). + +
  • modify RequestResize() function to save/restore window + manager hints. Its call to XtMakeResizeRequest() had + the undesirable side-effect of clearing window manager hints, e.g., + when switching to 132-columns via DECCOLM escape sequence. Window + manager hints make it simple to resize xterm in terms of character + cells rather than pixels (reported by Christian Weisgerber as well + as Debian bug #79939). +

    + This applies to the normal configuration. When built with toolbar + support, the hints are applied to a different widget level (more + work will be needed to make hints work with the toolbar). + +

  • fix a redefinition warning for resize.c on OpenBSD (patch by + Christian Weisgerber). + +
  • 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). + +
  • add script used from autoconf'd makefile for installing manpages, + since recent XFree86 changing the way section numbers are represented + makes the install dependent on extra scripts. + +
  • add configure check for freetype libraries and configure option + --disable-freetype to override this feature. + +
  • modify some configure script macros to avoid using changequote(), + which has been rendered useless in the latest autoconf alpha 2.49c + +
  • update config.guess, config.sub to 2001-2-13 + +
  • remove redundant/contradictory __CYGWIN__ definitions from resize.c + +
  • correct manpage typo introduced by X11R6.5 resync. +
+ Changes from XFree86 4.0.2: +
    +
  • add definition of _POSIX_C_SOURCE for Solaris to + make this compile with gcc -ansi -pedantic (report + by <mark@zang.com>. +
+ +

Patch #150 - 2000/12/29 - XFree86 4.0.2

+
    +
  • move the binding for shifted keypad plus/minus, which invokes the + larger-vt-font() and smaller-vt-font() + actions, respectively, into the translations resource (suggested by + Marius Gedminas <mgedmin@puni.osf.lt>). + +
  • modify configure script to support the + --program-prefix, --program-suffix and + --program-transform-name options (request by Alison + Winters <alison@mirrabooka.com>). + +
  • patch from Robert Brady +
      +
    • fix a scrolling / combining characters display anomaly + +
    • fix a problem with double-width characters where if the primary + font had no box-drawing characters, the right hand half of + double-width characters was erased (reported by Yao Zhang + <yzhang@sharemedia.com>). + +
    • fix special case of null byte for key handling in UTF-8 locales. +
    + +
  • modify logic that compares sizes of normal and bold fonts to be + more forgiving of the font server's choice of bold font which must + match the normal font's size. Now same_font_size() + compares the height of the fonts rather than individually ascent and + descent, and allows the bold font to be one pixel smaller than the + normal font (addresses a report by Alan Citterman + <alan@mticket.com>, who says that something in patches #146 to + #148 made xterm more likely to overstrike bold fonts, and indirectly + Debian bug report #76404, which reports the opposite). + +
  • make configure script use $CFLAGS and $CPPFLAGS consistently, + including removing a chunk from configure.in which attempted to + save/restore $CPPFLAGS while processing value set by the --x-includes + option, but lost values set in an intervening AC_CHECK_HEADERS. This + change modifies macros CF_ADD_CFLAGS, CF_ANSI_CC_CHECK and + CF_X_TOOLKIT, as well as removing variables IMAKE_CFLAGS and X_CFLAGS + from the generated makefile (the AC_CHECK_HEADERS problem was + reported by Albert Chin-A-Young <china@thewrittenword.com<). + +
  • correct a comparison in SELECTWORD case of ComputeSelect(), which + resulted in a word-selection wrapping past the first column without + checking the first column's character class (reported by Christian + Lacunza <celacunza@netscape.net> + +
  • correct a logic in UTF-8 mode for selecting double-width characters; + a combining character was omitted (patch by Markus Kuhn). + +
  • add feature to pop (raise) window when a bell is received + (patch by Gael Roualland <gael.roualland@dial.oleane.com>). + +
  • add __NetBSD__ and __OpenBSD__ to special-case in xterm_io.h + for USE_POSIX_TERMIOS definition (patch by Christian Weisgerber). + +
  • move special-case HPUX include for <sys/bsdtty.h> to + xterm_io.h to define TIOCSLTC, making HAS_LTCHARS defined for HPUX + 10.20 (report by Bruno Betro). +
+

Patch #149 - 2000/12/6 - XFree86 4.0.1h

    +
  • restructured includes for termios.h, + termio.h and related definitions for main.c, os2main.c, + screen.c and resize.c so they will share equivalent definitions in a + new header xterm_io.h. This is intended to solve some + problems mainly for HPUX which appear to arise from inconsistent + definitions for SIGWINCH- and HAS_LTCHARS-related symbols (reports + by Bruno Betro, Jeremie Petit and Clint Olsen). + +
  • improve usability of double-width fonts by allowing normal fonts + to be given as double-width (from a patch by Fabrice Bellard + <bellard@email.enst.fr>). + +
  • correct a few compiler warnings in TRACE() macros for + signed/unsigned variable differences (reported by Clint Olsen). + +
  • make configure script use $CFLAGS and $CPPFLAGS more consistently, + i.e., by using CF_ADD_CFLAGS in CF_ANSI_CC macro. +
  • expanded description of environment variables in manual-page.
  • modify OPT_TCAP_QUERY feature to always return the termcap or @@ -369,7 +643,7 @@

    Patch #144 - 2000/8/23 - XFree86 4.0.1b

    • remove a spurious assignment in ScreenWrite() from Robert Brady's - patch which set a null at the "end" of the buffer to be written. + patch which set a null at the "end" of the buffer to be written. That made the autowrap feature write a blank in the first column for the non-UTF-8 configuration, rather than the actual character (reported by Alan Citterman <alan@mticket.com>). @@ -451,7 +725,7 @@

      Patch #138 - 2000/6/15 - XFree86 4.0c

        -
      • workaround for fixed fonts which are generated from Unicode fonts: +
      • workaround for fixed fonts which are generated from Unicode fonts: they omit glyphs for some xterm's less-used line-drawing characters, which caused xterm to set a flag telling it to use only its internal line-drawing characters. Do not set the flag (it can be set from the @@ -670,7 +944,7 @@
      • include <term.h> in resize.c, to fix a missing-prototype warning.
      - +
    • modified creat_as() a little more, retaining the ability to append to a logfile If the user specifies the name. Also, check if the opened file (which patch #130 ensures is @@ -679,7 +953,7 @@
    • use creat_as() logic to make tek4014 screen-copy more secure (noted by Branden Robinson). -
    • ifdef'd some of Branden's changes to build/work on older machines. +
    • ifdef'd some of Branden's changes to build/work on older machines.
    • correct missing initialization of the .mode flag in ColorRes struct, from patch #129. This worked on Linux @@ -697,7 +971,7 @@

      Patch #130 - 2000/3/1 - XFree86 3.9.18a

        -
      • modify scroll-forw() and scroll-back() +
      • modify scroll-forw() and scroll-back() actions, adding a third parameter which will direct xterm to ignore the action when mouse reporting is enabled. This is needed for the wheel mouse to be used to report to the application rather than @@ -831,7 +1105,7 @@ even if it happens to be the stty erase character.
      • add encoding for control/?, to work around xmodmap or key - translations which may confuse backspace and delete. A control/? + translations which may confuse backspace and delete. A control/? will send DEL (127), and a control/H will of course send backspace (8). @@ -900,7 +1174,7 @@
        • use clipping to avoid leaving trash at end of the text, and
        • add brackets so wide-character logic does not fall-through - into the overstriking logic (reported by + into the overstriking logic (reported by Marc Feeley <feeley@IRO.UMontreal.CA>)
        Index: xc/programs/xterm/xterm.man diff -u xc/programs/xterm/xterm.man:3.66 xc/programs/xterm/xterm.man:3.73 --- xc/programs/xterm/xterm.man:3.66 Wed Dec 6 21:43:00 2000 +++ xc/programs/xterm/xterm.man Sat Apr 28 09:51:56 2001 @@ -1,8 +1,7 @@ -.\" $XConsortium: xterm.man /main/85 1996/12/09 17:10:53 kaleb $ -.\" $XFree86: xc/programs/xterm/xterm.man,v 3.66 2000/12/07 02:43:00 dickey Exp $ +.\" $Xorg: xterm.man,v 1.3 2000/08/17 19:55:10 cpqbld Exp $ .\" .\" -.\" Copyright 1996,1997,1998,1999,2000 by Thomas E. Dickey +.\" Copyright 1996,1997,1998,1999,2000,2001 by Thomas E. Dickey .\" .\" All Rights Reserved .\" @@ -57,8 +56,10 @@ .\" other dealings in this Software without prior written authorization .\" from the X Consortium. .\" +.\" $XFree86: xc/programs/xterm/xterm.man,v 3.73 2001/04/28 13:51:56 dickey Exp $ +.\" .\" updated by Thomas E. Dickey for XFree86, July 1996. -.TH XTERM 1 "Release 6.3" "X Version 11" +.TH XTERM 1 __vendorversion__ .SH NAME xterm \- terminal emulator for X .SH SYNOPSIS @@ -343,6 +344,22 @@ If only one of the normal or bold fonts is specified, it will be used as the normal font and the bold font will be produced by overstriking this font. The default is to do overstriking of the normal font. +See also the discussion of \fBboldFont\fP and \fBboldMode\fP resources. +.TP 8 +.BI \-fa " pattern" +This option sets the pattern for fonts selected from the FreeType +library if support for that library was compiled into xterm. +This corresponds to the \fBfaceName\fP resource. +.TP 8 +.BI \-fi " font" +This option sets the font for active icons if that feature was compiled +into xterm. +See also the discussion of the \fBiconFont\fP resource. +.TP 8 +.BI \-fs " size" +This option sets the pointsize for fonts selected from the FreeType +library if support for that library was compiled into xterm. +This corresponds to the \fBfaceSize\fP resource. .TP 8 .B \-fw \fIfont\fP This option specifies the font to be used for displaying wide text. @@ -360,10 +377,6 @@ If no doublewidth font is found, it will improvise, by stretching the normal font. .TP 8 -.B \-fi -This option sets the font for active icons if that feature was compiled -into xterm. -.TP 8 .BI \-hc " color" This option specifies the color to use for the background of selected or otherwise highlighted text. If not specified, @@ -484,6 +497,14 @@ .B \+pc This option disables the PC-style use of bold colors. .TP 8 +.B \-pob +This option indicates that the window should be raised whenever a +Control-G is received. +.TP 8 +.B \+pob +This option indicates that the window should not be raised whenever a +Control-G is received. +.TP 8 .B \-rightbar Force scrollbar to the right side of VT100 screen. .TP 8 @@ -734,7 +755,7 @@ This option specifies the width in pixels of the border surrounding the window. .TP 8 .B \-display \fIdisplay\fP -This option specifies the X server to contact; see \fIX(1)\fP. +This option specifies the X server to contact; see \fIX(__miscmansuffix__)\fP. .TP 8 .B \-fg \fIcolor\fP This option specifies the color to use for displaying text. The default is @@ -746,7 +767,7 @@ .TP 8 .B \-geometry \fIgeometry\fP This option specifies the preferred size and position of the VT102 window; -see \fIX(1)\fP. +see \fIX(__miscmansuffix__)\fP. .TP 8 .B \-iconic This option indicates that \fIxterm\fP should ask the window manager to @@ -991,6 +1012,19 @@ same as the normal font. It may be desirable to disable bold fonts when color is being used for the bold attribute. +Note that \fIxterm\fP has one bold font which you may set explicitly. +It attempts to match a bold font for the other font selections +(\fBfont1\fP through \fBfont6\fP). +If the normal and bold fonts are distinct, this resource has no effect. +.TP 8 +.B "brokenSelections (\fPclass\fB BrokenSelections)" +If true, \fIxterm\fP in 8-bit mode will interpret +.B STRING +selections as carrying text in the current locale's encoding. Normally +.B STRING +selections carry ISO-8859-1 encoded text. Setting this resource to +``true'' violates the ICCCM; it may, however, be useful for interacting +with some broken X clients. .TP 8 .B "c132 (\fPclass\fB C132)" Specifies whether or not the VT102 DECCOLM escape sequence should be honored. @@ -1182,6 +1216,19 @@ accepted as is or stripped when printed. The default is ``true,'' which means that they are accepted as is. .TP 8 +.B "faceName" (\fPclass\fB FaceName)" +Specify the pattern for fonts selected from the FreeType +library if support for that library was compiled into xterm. +There is no default. +If not specified, +or if there is no match for both normal and bold fonts, +xterm uses the \fBfont\fP and related resources. +.TP 8 +.B "faceSize" (\fPclass\fB FaceSize)" +Specify the pointsize for fonts selected from the FreeType +library if support for that library was compiled into xterm. +The default is ``14.'' +.TP 8 .B "font (\fPclass\fB Font)" Specifies the name of the normal font. The default is ``fixed.'' .TP 8 @@ -1244,6 +1291,14 @@ ``true'' causes \fIxterm\fP to interpret ESC F as a request to move to the lower left corner of the screen. The default is ``false.'' .TP 8 +.B "i18nSelections (\fPclass\fB I18nSelections)" +If false, \fIxterm\fP will never request the targets +.B COMPOUND_TEXT +or +.BR TEXT . +The default is ``true.'' It may be set to false in order to work around +ICCCM violations by other X clients. +.TP 8 .B "iconBorderColor (\fPclass\fB BorderColor)" Specifies the border color for the active icon window if this feature is compiled into xterm. Not all window managers will make the icon @@ -1418,8 +1473,15 @@ .TP 8 .B "scrollTtyOutput (\fPclass\fB ScrollCond)" Specifies whether or not output to the terminal should automatically cause -the scrollbar to go to the bottom of the scrolling region. The default is -``true.'' +the scrollbar to go to the bottom of the scrolling region. +The default is ``true.'' +.TP 8 +.B "shiftFonts (\fPclass\fB ShiftFonts)" +Specifies whether to enable the actions +\fBlarger-vt-font()\fP and +\fBsmaller-vt-font()\fP, which are normally bound to +the shifted KP_Add and KP_Subtract. +The default is ``true.'' .TP 8 .B "signalInhibit (\fPclass\fB SignalInhibit)" Specifies whether or not the entries in the ``Main Options'' menu for sending @@ -1486,6 +1548,10 @@ Specifies whether or not a visible bell (i.e. flashing) should be used instead of an audible bell when Control-G is received. The default is ``false.'' .TP 8 +.B "popOnBell (\fPclass\fB PopOnBell)" +Specifies whether the window whould be raised when Control-G is +received. The default is ``false.'' +.TP 8 .B "wideChars (\fPclass\fB WideChars)" Specifies if \fIxterm\fP should respond to control sequences that process 16-bit characters. @@ -1649,6 +1715,9 @@ .B "visualbell (\fPclass\fB SmeBSB)" This entry invokes the \fBset-visualbell(toggle)\fP action. .TP 8 +.B "poponbell (\fPclass\fB SmeBSB)" +This entry invokes the \fBset-poponbell(toggle)\fP action. +.TP 8 .B "marginbell (\fPclass\fB SmeBSB)" This entry invokes the \fBset-marginbell(toggle)\fP action. .TP 8 @@ -1658,7 +1727,7 @@ .B "titeInhibit (\fPclass\fB SmeBSB)" This entry invokes the \fBset-titeInhibit(toggle)\fP action. .TP 8 -.B "activeicon (\fPclass\fB SMeBSB)" +.B "activeicon (\fPclass\fB SmeBSB)" This entry toggles active icons on and off if this feature was compiled into \fIxterm\fP. It is enabled only if \fIxterm\fP was started with the command line option +ai or the \fBactiveIcon\fP @@ -2168,6 +2237,10 @@ name is \fIname\fP with the suffix \fIKeymap\fP (case is significant). The name \fINone\fP restores the original translation table. .TP 8 +.B "larger-vt-font()" +Set the font to the next larger one, based on the font dimensions. +See also \fBset-vt-font()\fP. +.TP 8 .B "maximize()" Resizes the window to fill the screen. .TP 8 @@ -2324,6 +2397,10 @@ .B "set-num-lock()" This action toggles the state of the \fBnumLock\fP resource. .TP 8 +.B "set-pop-on-bell(\fIon/off/toggle\fP)" +This action toggles the \fBpopOnBell\fP resource and is also invoked +by the \fBpoponbell\fP entry in \fIvtMenu\fP. +.TP 8 .B "set-reverse-video(\fIon/off/toggle\fP)" This action toggles the \fIreverseVideo\fP resource and is also invoked by the \fBreversevideo\fP entry in \fIvtMenu\fP. @@ -2394,6 +2471,10 @@ \fIs\fP or \fIS\fP indicate the font selection (as made by programs such as \fIxfontsel(1)\fP) indicated by the second action argument. .TP 8 +.B "smaller-vt-font()" +Set the font to the next smaller one, based on the font dimensions. +See also \fBset-vt-font()\fP. +.TP 8 .B "soft-reset()" This action resets the scrolling region and is also invoked from the \fBsoftreset\fP entry in \fIvtMenu\fP. @@ -2467,6 +2548,8 @@ Shift Select:select-cursor-start() \\ select-cursor-end(PRIMARY, CUT_BUFFER0) \\n\\ Shift Insert:insert-selection(PRIMARY, CUT_BUFFER0) \\n\\ + Shift KP_Add:larger-vt-font() \\n\\ + Shift KP_Subtract:smaller-vt-font() \\n\\ ~Meta :insert-seven-bit() \\n\\ Meta :insert-eight-bit() \\n\\ !Ctrl :popup-menu(mainMenu) \\n\\ @@ -2615,7 +2698,7 @@ in your .Xdefaults file to automatically turn on color in \fIxterm\fP and similar applications. .SH "SEE ALSO" -resize(1), X(1), pty(4), tty(4) +resize(1), X(__miscmansuffix__), pty(4), tty(4) .br \fIXterm Control Sequences\fP (this is the file ctlseqs.ms). Index: xc/programs/xterm/xterm_io.h diff -u xc/programs/xterm/xterm_io.h:1.1 xc/programs/xterm/xterm_io.h:1.3 --- xc/programs/xterm/xterm_io.h:1.1 Wed Dec 6 05:19:43 2000 +++ xc/programs/xterm/xterm_io.h Tue Feb 13 14:19:19 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xterm/xterm_io.h,v 1.1 2000/12/06 10:19:43 dickey Exp $ + * $XFree86: xc/programs/xterm/xterm_io.h,v 1.3 2001/02/13 19:19:19 dawes Exp $ */ /* @@ -63,7 +63,7 @@ #define USE_SYSV_TERMIO #endif -#ifdef __FreeBSD__ +#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) #define USE_POSIX_TERMIOS #endif @@ -132,12 +132,14 @@ /* this hacked termios support only works on SYSV */ #define USE_ANY_SYSV_TERMIO #define termio termios +#ifndef __CYGWIN__ #undef TCGETA #define TCGETA TCGETS #undef TCSETA #define TCSETA TCSETS #undef TCSETAW #define TCSETAW TCSETSW +#endif #elif defined(USE_SYSV_TERMIO) # define USE_ANY_SYSV_TERMIO # ifdef Lynx @@ -219,6 +221,10 @@ #define ioctl ptioctl #endif /* __EMX__ */ + +#ifdef __hpux +#include /* defines TIOCSLTC */ +#endif #ifdef ISC #define TIOCGPGRP TCGETPGRP Index: xc/programs/xterm/xtermcfg.hin diff -u xc/programs/xterm/xtermcfg.hin:3.35 xc/programs/xterm/xtermcfg.hin:3.37 --- xc/programs/xterm/xtermcfg.hin:3.35 Wed Dec 6 21:22:12 2000 +++ xc/programs/xterm/xtermcfg.hin Sat Apr 28 09:51:56 2001 @@ -1,5 +1,5 @@ /* - * $XFree86: xc/programs/xterm/xtermcfg.hin,v 3.35 2000/12/07 02:22:12 dickey Exp $ + * $XFree86: xc/programs/xterm/xtermcfg.hin,v 3.37 2001/04/28 13:51:56 dickey Exp $ */ /************************************************************ @@ -39,10 +39,12 @@ #undef DFT_COLORMODE /* AC_ARG_WITH(default-color-mode) */ #undef DFT_DECID /* AC_ARG_WITH(default-terminal-id) */ #undef DFT_TERMTYPE /* AC_ARG_WITH(default-term-type) */ +#undef HAVE_GETLOGIN /* AC_CHECK_FUNCS(getlogin) */ #undef HAVE_LASTLOG_H /* CF_LASTLOG */ #undef HAVE_PATHS_H /* CF_LASTLOG */ #undef HAVE_STDLIB_H /* AC_CHECK_HEADERS(stdlib.h) */ #undef HAVE_STRERROR /* AC_CHECK_FUNCS(strerror) */ +#undef HAVE_SYS_TIME_H /* AC_HEADER_TIME */ #undef HAVE_SYS_WAIT_H /* AC_HEADER_SYS_WAIT */ #undef HAVE_TCGETATTR /* AC_CHECK_FUNCS(tcgetattr) */ #undef HAVE_TERMCAP_H /* AC_CHECK_HEADERS(termcap.h) */ @@ -76,7 +78,9 @@ #undef OPT_MAXIMIZE /* CF_ARG_DISABLE(maximize) */ #undef OPT_NUM_LOCK /* CF_ARG_DISABLE(num-lock) */ #undef OPT_PC_COLORS /* CF_ARG_DISABLE(pc-color) */ +#undef OPT_SAME_NAME #undef OPT_SCO_FUNC_KEYS /* CF_ARG_ENABLE(sco-fkeys) */ +#undef OPT_TCAP_QUERY #undef OPT_TEK4014 /* CF_ARG_DISABLE(tek4014) */ #undef OPT_TOOLBAR /* CF_ARG_ENABLE(toolbar) */ #undef OPT_TRACE /* CF_ARG_ENABLE(trace) */ @@ -84,12 +88,11 @@ #undef OPT_WIDE_CHARS /* CF_ARG_ENABLE(wide-chars) */ #undef OPT_XMC_GLITCH /* CF_ARG_ENABLE(xmc-glitch) */ #undef OPT_ZICONBEEP /* CF_ARG_DISABLE(ziconbeep) */ -#undef OPT_SAME_NAME -#undef OPT_TCAP_QUERY #undef OWN_TERMINFO_DIR /* AC_ARG_WITH(own-terminfo) */ #undef SCROLLBAR_RIGHT /* CF_ARG_ENABLE(rightbar) */ #undef SVR4 /* CF_SVR4, imake */ #undef SYSV /* CF_SYSV, imake */ +#undef TIME_WITH_SYS_TIME /* AC_HEADER_TIME */ #undef TTY_GROUP_NAME /* CF_TTY_GROUP */ #undef USE_LASTLOG /* CF_LASTLOG */ #undef USE_MY_MEMMOVE /* CF_FUNC_MEMMOVE */ @@ -102,6 +105,7 @@ #undef USE_TTY_GROUP /* CF_TTY_GROUP */ #undef USE_UTEMPTER /* CF_UTEMPTER */ #undef UTMPX_FOR_UTMP /* CF_UTMP */ +#undef XRENDERFONT /* CF_X_FREETYPE */ #undef const /* AC_CONST */ #undef size_t /* AC_TYPE_SIZE_T */ #undef time_t /* AC_CHECK_TYPE(time_t, long) */ Index: xc/programs/xvidtune/xvidtune.c diff -u xc/programs/xvidtune/xvidtune.c:3.26 xc/programs/xvidtune/xvidtune.c:3.27 --- xc/programs/xvidtune/xvidtune.c:3.26 Tue Sep 26 11:57:27 2000 +++ xc/programs/xvidtune/xvidtune.c Thu Apr 5 22:16:26 2001 @@ -1,4 +1,4 @@ -/* $XFree86: xc/programs/xvidtune/xvidtune.c,v 3.26 2000/09/26 15:57:27 tsi Exp $ */ +/* $XFree86: xc/programs/xvidtune/xvidtune.c,v 3.27 2001/04/06 02:16:26 dawes Exp $ */ /* @@ -534,7 +534,7 @@ if (mode_flags & V_INTERLACE) strcat(modebuf, " interlace"); if (mode_flags & V_CSYNC) strcat(modebuf, " composite"); if (mode_flags & V_PCSYNC) strcat(modebuf, " +csync"); - if (mode_flags & V_PCSYNC) strcat(modebuf, " -csync"); + if (mode_flags & V_NCSYNC) strcat(modebuf, " -csync"); if (mode_flags & V_DBLSCAN) strcat(modebuf, " doublescan"); printf("%s\n", modebuf); time = XtLastTimestampProcessed(XtDisplay(w)); Index: xc/programs/xvidtune/xvidtune.man diff -u xc/programs/xvidtune/xvidtune.man:3.12 xc/programs/xvidtune/xvidtune.man:3.13 --- xc/programs/xvidtune/xvidtune.man:3.12 Sun Jan 28 02:34:34 1996 +++ xc/programs/xvidtune/xvidtune.man Sat Jan 27 13:21:25 2001 @@ -1,4 +1,4 @@ -.\" $XFree86: xc/programs/xvidtune/xvidtune.man,v 3.12 1996/01/28 07:34:34 dawes Exp $ +.\" $XFree86: xc/programs/xvidtune/xvidtune.man,v 3.13 2001/01/27 18:21:25 dawes Exp $ .\" .\" Copyright (c) 1995 Kaleb S. KEITHLEY .\" @@ -26,7 +26,7 @@ .\" other dealings in this Software without prior written authorization .\" from Kaleb S. KEITHLEY. .\" -.TH xvidtune 1 "Release 6.1" "X Version 11" +.TH xvidtune 1 __vendorversion__ .SH NAME xvidtune \- video mode tuner for XFree86 .SH SYNOPSIS Index: xc/programs/xvinfo/xvinfo.c diff -u xc/programs/xvinfo/xvinfo.c:1.4 xc/programs/xvinfo/xvinfo.c:1.6 --- xc/programs/xvinfo/xvinfo.c:1.4 Tue Oct 24 18:45:17 2000 +++ xc/programs/xvinfo/xvinfo.c Sun Apr 1 10:00:24 2001 @@ -1,9 +1,10 @@ -/* $XFree86: xc/programs/xvinfo/xvinfo.c,v 1.4 2000/10/24 22:45:17 dawes Exp $ */ +/* $XFree86: xc/programs/xvinfo/xvinfo.c,v 1.6 2001/04/01 14:00:24 tsi Exp $ */ #include #include #include #include +#include #include #include @@ -179,7 +180,7 @@ } formats = XvListImageFormats( - dpy, ainfo[i].base_id, &numImages); + dpy, ainfo[j].base_id, &numImages); fprintf(stdout, " Number of image formats: %i\n", numImages); Index: xc/programs/xvinfo/xvinfo.man diff -u xc/programs/xvinfo/xvinfo.man:1.1 xc/programs/xvinfo/xvinfo.man:1.3 --- xc/programs/xvinfo/xvinfo.man:1.1 Tue Sep 19 02:08:11 2000 +++ xc/programs/xvinfo/xvinfo.man Sat Jan 27 13:21:25 2001 @@ -1,7 +1,7 @@ -.\" $XFree86: xc/programs/xvinfo/xvinfo.man,v 1.1 2000/09/19 06:08:11 mvojkovi Exp $ +.\" $XFree86: xc/programs/xvinfo/xvinfo.man,v 1.3 2001/01/27 18:21:25 dawes Exp $ .\" -.TH xvinfo 1 "Release 6.4" "X Version 11" +.TH xvinfo 1 __vendorversion__ .SH NAME xvinfo - Print out X-Video extension adaptor information .SH SYNOPSIS @@ -16,7 +16,7 @@ .PP .TP 8 .B "-display \fIdisplay\fP" -This argument allows you to specify the server to query; see \fIX(1)\fP. +This argument allows you to specify the server to query; see \fIX(__miscmansuffix__)\fP. .SH ENVIRONMENT .PP .TP 8 Index: xc/programs/xwd/Imakefile diff -u xc/programs/xwd/Imakefile:1.2 xc/programs/xwd/Imakefile:1.5 --- xc/programs/xwd/Imakefile:1.2 Fri Mar 20 16:08:43 1998 +++ xc/programs/xwd/Imakefile Sun Apr 1 10:00:24 2001 @@ -1,6 +1,12 @@ -XCOMM $XConsortium: Imakefile /main/9 1996/01/14 16:53:10 kaleb $ - DEPLIBS = XkbClientDepLibs $(DEPXMULIB) $(DEPXLIB) -LOCAL_LIBRARIES = XkbClientLibs $(XMULIB) $(XLIB) +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:11 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xwd/Imakefile,v 1.5 2001/04/01 14:00:24 tsi Exp $ + + DEPLIBS = XkbClientDepLibs $(DEPXMUULIB) $(DEPXLIB) +LOCAL_LIBRARIES = XkbClientLibs $(XMUULIB) $(XLIB) SRCS = xwd.c dsimple.c list.c multiVis.c OBJS = xwd.o dsimple.o list.o multiVis.o DEFINES = XkbClientDefines Index: xc/programs/xwd/list.c diff -u xc/programs/xwd/list.c:3.3 xc/programs/xwd/list.c:3.4 --- xc/programs/xwd/list.c:3.3 Sun Mar 7 06:41:36 1999 +++ xc/programs/xwd/list.c Wed Jan 17 18:46:41 2001 @@ -1,4 +1,4 @@ -/* $TOG: list.c /main/5 1998/02/09 14:20:02 kaleb $ */ +/* $Xorg: list.c,v 1.4 2000/08/17 19:55:12 cpqbld Exp $ */ /** ------------------------------------------------------------------------ This file contains routines for manipulating generic lists. Lists are implemented with a "harness". In other words, each @@ -30,7 +30,7 @@ from The Open Group. ----------------------------------------------------------------------- **/ -/* $XFree86: xc/programs/xwd/list.c,v 3.3 1999/03/07 11:41:36 dawes Exp $ */ +/* $XFree86: xc/programs/xwd/list.c,v 3.4 2001/01/17 23:46:41 dawes Exp $ */ #include Index: xc/programs/xwd/list.h diff -u xc/programs/xwd/list.h:1.3 xc/programs/xwd/list.h:1.4 --- xc/programs/xwd/list.h:1.3 Sun Oct 4 05:42:02 1998 +++ xc/programs/xwd/list.h Wed Jan 17 18:46:42 2001 @@ -1,4 +1,4 @@ -/* $TOG: list.h /main/5 1998/02/09 14:20:09 kaleb $ */ +/* $Xorg: list.h,v 1.3 2000/08/17 19:55:12 cpqbld Exp $ */ /** ------------------------------------------------------------------------ This file contains routines for manipulating generic lists. Lists are implemented with a "harness". In other words, each Index: xc/programs/xwd/multiVis.c diff -u xc/programs/xwd/multiVis.c:1.5 xc/programs/xwd/multiVis.c:1.6 --- xc/programs/xwd/multiVis.c:1.5 Sun Mar 7 09:23:48 1999 +++ xc/programs/xwd/multiVis.c Wed Jan 17 18:46:42 2001 @@ -1,4 +1,4 @@ -/* $TOG: multiVis.c /main/5 1998/02/09 14:20:15 kaleb $ */ +/* $Xorg: multiVis.c,v 1.4 2000/08/17 19:55:12 cpqbld Exp $ */ /** ------------------------------------------------------------------------ This file contains functions to create a list of regions which tile a specified window. Each region contains all visible @@ -30,7 +30,7 @@ from The Open Group. ------------------------------------------------------------------------ **/ -/* $XFree86: xc/programs/xwd/multiVis.c,v 1.5 1999/03/07 14:23:48 dawes Exp $ */ +/* $XFree86: xc/programs/xwd/multiVis.c,v 1.6 2001/01/17 23:46:42 dawes Exp $ */ #include #include Index: xc/programs/xwd/multiVis.h diff -u xc/programs/xwd/multiVis.h:1.1.1.3 xc/programs/xwd/multiVis.h:1.1.1.4 --- xc/programs/xwd/multiVis.h:1.1.1.3 Sun Sep 27 04:01:48 1998 +++ xc/programs/xwd/multiVis.h Tue Jan 16 18:07:05 2001 @@ -1,4 +1,4 @@ -/* $TOG: multiVis.h /main/5 1998/02/09 14:20:24 kaleb $ */ +/* $Xorg: multiVis.h,v 1.3 2000/08/17 19:55:13 cpqbld Exp $ */ /** ------------------------------------------------------------------------ This file contains routines for manipulating generic lists. Lists are implemented with a "harness". In other words, each Index: xc/programs/xwd/wsutils.h diff -u xc/programs/xwd/wsutils.h:1.1.1.3 xc/programs/xwd/wsutils.h:1.1.1.4 --- xc/programs/xwd/wsutils.h:1.1.1.3 Sun Sep 27 04:01:49 1998 +++ xc/programs/xwd/wsutils.h Tue Jan 16 18:07:08 2001 @@ -1,4 +1,4 @@ -/* $TOG: wsutils.h /main/4 1998/02/09 14:20:30 kaleb $ */ +/* $Xorg: wsutils.h,v 1.3 2000/08/17 19:55:13 cpqbld Exp $ */ /** ------------------------------------------------------------------------ This file contains routines for manipulating generic lists. Lists are implemented with a "harness". In other words, each Index: xc/programs/xwd/xwd.c diff -u xc/programs/xwd/xwd.c:3.6 xc/programs/xwd/xwd.c:3.7 --- xc/programs/xwd/xwd.c:3.6 Thu Nov 30 19:24:36 2000 +++ xc/programs/xwd/xwd.c Wed Jan 17 18:46:42 2001 @@ -1,4 +1,4 @@ -/* $TOG: xwd.c /main/65 1998/02/09 14:20:36 kaleb $ */ +/* $Xorg: xwd.c,v 1.4 2000/08/17 19:55:13 cpqbld Exp $ */ /* @@ -21,7 +21,7 @@ in this Software without prior written authorization from The Open Group. */ -/* $XFree86: xc/programs/xwd/xwd.c,v 3.6 2000/12/01 00:24:36 dawes Exp $ */ +/* $XFree86: xc/programs/xwd/xwd.c,v 3.7 2001/01/17 23:46:42 dawes Exp $ */ /* * xwd.c MIT Project Athena, X Window system window raster image dumper. Index: xc/programs/xwd/xwd.man diff -u xc/programs/xwd/xwd.man:1.4 xc/programs/xwd/xwd.man:1.7 --- xc/programs/xwd/xwd.man:1.4 Sun Oct 4 05:42:03 1998 +++ xc/programs/xwd/xwd.man Sat Jan 27 13:21:25 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xwd.man /main/23 1998/02/09 14:20:45 kaleb $ +.\" $Xorg: xwd.man,v 1.3 2000/08/17 19:55:14 cpqbld Exp $ .\" Copyright 1988, 1994, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XWD 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xwd/xwd.man,v 1.7 2001/01/27 18:21:25 dawes Exp $ +.\" +.TH XWD 1 __xorgversion__ .SH NAME xwd - dump an image of an X window .SH SYNOPSIS @@ -41,7 +44,7 @@ .PP .TP 8 .B "-display \fIdisplay\fP" -This argument allows you to specify the server to connect to; see \fIX(1)\fP. +This argument allows you to specify the server to connect to; see \fIX(__miscmansuffix__)\fP. .PP .TP 8 .B "-help" @@ -119,7 +122,7 @@ .B XWDFile.h X Window Dump File format definition file. .SH SEE ALSO -xwud(1), xpr(1), X(1) +xwud(1), xpr(1), X(__miscmansuffix__) .SH AUTHORS Tony Della Fera, Digital Equipment Corp., MIT Project Athena .br Index: xc/programs/xwininfo/Imakefile diff -u xc/programs/xwininfo/Imakefile:1.2 xc/programs/xwininfo/Imakefile:1.5 --- xc/programs/xwininfo/Imakefile:1.2 Fri Mar 20 16:08:46 1998 +++ xc/programs/xwininfo/Imakefile Sun Apr 1 10:00:25 2001 @@ -1,6 +1,12 @@ -XCOMM $XConsortium: Imakefile,v 1.9 92/11/20 13:24:14 rws Exp $ - DEPLIBS = $(DEPXMULIB) $(DEPXLIB) -LOCAL_LIBRARIES = $(XMULIB) $(XLIB) +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:15 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/programs/xwininfo/Imakefile,v 1.5 2001/04/01 14:00:25 tsi Exp $ + + DEPLIBS = $(DEPXMUULIB) $(DEPXLIB) +LOCAL_LIBRARIES = $(XMUULIB) $(XLIB) SRCS = xwininfo.c dsimple.c OBJS = xwininfo.o dsimple.o Index: xc/programs/xwininfo/xwininfo.c diff -u xc/programs/xwininfo/xwininfo.c:1.5 xc/programs/xwininfo/xwininfo.c:1.7 --- xc/programs/xwininfo/xwininfo.c:1.5 Tue Mar 2 06:50:04 1999 +++ xc/programs/xwininfo/xwininfo.c Sun Apr 1 10:00:25 2001 @@ -1,4 +1,4 @@ -/* $TOG: xwininfo.c /main/56 1998/02/09 14:21:06 kaleb $ */ +/* $Xorg: xwininfo.c,v 1.3 2000/08/17 19:55:16 cpqbld Exp $ */ /* Copyright 1987, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xwininfo/xwininfo.c,v 1.5 1999/03/02 11:50:04 dawes Exp $ */ +/* $XFree86: xc/programs/xwininfo/xwininfo.c,v 1.7 2001/04/01 14:00:25 tsi Exp $ */ /* @@ -44,6 +44,7 @@ #include #include #include +#include /* Include routines to handle parsing defaults */ #include "dsimple.h" Index: xc/programs/xwininfo/xwininfo.man diff -u xc/programs/xwininfo/xwininfo.man:1.4 xc/programs/xwininfo/xwininfo.man:1.7 --- xc/programs/xwininfo/xwininfo.man:1.4 Sun Oct 4 05:42:04 1998 +++ xc/programs/xwininfo/xwininfo.man Sat Jan 27 13:21:25 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xwininfo.man /main/26 1998/02/09 14:21:13 kaleb $ +.\" $Xorg: xwininfo.man,v 1.3 2000/08/17 19:55:16 cpqbld Exp $ .\" Copyright 1988, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XWININFO 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xwininfo/xwininfo.man,v 1.7 2001/01/27 18:21:25 dawes Exp $ +.\" +.TH XWININFO 1 __xorgversion__ .SH NAME xwininfo \- window information utility for X .SH SYNOPSIS @@ -148,7 +151,7 @@ .PP .TP 8 .B \-display \fIdisplay\fP -This option allows you to specify the server to connect to; see \fIX(1)\fP. +This option allows you to specify the server to connect to; see \fIX(__miscmansuffix__)\fP. .SH EXAMPLE .PP The following is a sample summary taken with no options specified: @@ -181,7 +184,7 @@ .B DISPLAY To get the default host and display number. .SH SEE ALSO -X(1), xprop(1) +X(__miscmansuffix__), xprop(1) .SH BUGS Using \fB\-stats \-bits\fP shows some redundant information. .PP Index: xc/programs/xwud/Imakefile diff -u xc/programs/xwud/Imakefile:1.1.1.1 xc/programs/xwud/Imakefile:1.1.1.2 --- xc/programs/xwud/Imakefile:1.1.1.1 Wed Apr 27 03:13:08 1994 +++ xc/programs/xwud/Imakefile Tue Jan 16 18:07:17 2001 @@ -1,4 +1,4 @@ -XCOMM $XConsortium: Imakefile,v 1.8 93/08/19 09:35:34 rws Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:17 cpqbld Exp $ DEPLIBS = $(DEPXONLYLIB) LOCAL_LIBRARIES = $(XONLYLIB) Index: xc/programs/xwud/xwud.c diff -u xc/programs/xwud/xwud.c:3.4 xc/programs/xwud/xwud.c:3.5 --- xc/programs/xwud/xwud.c:3.4 Sun Mar 7 06:41:38 1999 +++ xc/programs/xwud/xwud.c Wed Jan 17 18:46:43 2001 @@ -1,4 +1,4 @@ -/* $TOG: xwud.c /main/61 1998/02/09 14:21:20 kaleb $ */ +/* $Xorg: xwud.c,v 1.4 2000/08/17 19:55:17 cpqbld Exp $ */ /* Copyright 1985, 1986, 1988, 1998 The Open Group @@ -22,7 +22,7 @@ from The Open Group. */ -/* $XFree86: xc/programs/xwud/xwud.c,v 3.4 1999/03/07 11:41:38 dawes Exp $ */ +/* $XFree86: xc/programs/xwud/xwud.c,v 3.5 2001/01/17 23:46:43 dawes Exp $ */ /* xwud - marginally useful raster image undumper */ Index: xc/programs/xwud/xwud.man diff -u xc/programs/xwud/xwud.man:1.4 xc/programs/xwud/xwud.man:1.7 --- xc/programs/xwud/xwud.man:1.4 Sun Oct 4 05:42:05 1998 +++ xc/programs/xwud/xwud.man Sat Jan 27 13:21:26 2001 @@ -1,4 +1,4 @@ -.\" $TOG: xwud.man /main/22 1998/02/09 14:21:26 kaleb $ +.\" $Xorg: xwud.man,v 1.3 2000/08/17 19:55:18 cpqbld Exp $ .\" Copyright 1988, 1998 The Open Group .\" .\" All Rights Reserved. @@ -18,7 +18,10 @@ .\" 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. -.TH XWUD 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xwud/xwud.man,v 1.7 2001/01/27 18:21:26 dawes Exp $ +.\" +.TH XWUD 1 __xorgversion__ .SH NAME xwud - image displayer for X .SH SYNOPSIS @@ -42,7 +45,7 @@ .PP .TP 8 .B "-display \fIdisplay\fP" -This option allows you to specify the server to connect to; see \fIX(1)\fP. +This option allows you to specify the server to connect to; see \fIX(__miscmansuffix__)\fP. .PP .TP 8 .B "-fg \fIcolor\fP" @@ -139,7 +142,7 @@ xwud doesn't handle big/deep images very well on servers that don't have the BIG-REQUESTS extension. .SH SEE ALSO -xwd(1), xpr(1), xstdcmap(1), X(1) +xwd(1), xpr(1), xstdcmap(1), X(__miscmansuffix__) .SH AUTHOR Bob Scheifler, MIT X Consortium Index: xc/util/memleak/Imakefile diff -u xc/util/memleak/Imakefile:3.4 xc/util/memleak/Imakefile:3.5 --- xc/util/memleak/Imakefile:3.4 Fri Feb 11 22:40:07 2000 +++ xc/util/memleak/Imakefile Wed Jan 17 18:20:07 2001 @@ -1,5 +1,10 @@ -XCOMM $XConsortium: Imakefile /main/9 1996/09/28 17:19:05 rws $ -XCOMM $XFree86: xc/util/memleak/Imakefile,v 3.4 2000/02/12 03:40:07 dawes Exp $ +XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:55:19 cpqbld Exp $ + + + + +XCOMM $XFree86: xc/util/memleak/Imakefile,v 3.5 2001/01/17 23:20:07 dawes Exp $ + #define DoNormalLib YES #define DoSharedLib NO #define DoDebugLib NO Index: xc/util/memleak/README diff -u xc/util/memleak/README:1.1.1.1 xc/util/memleak/README:1.1.1.2 --- xc/util/memleak/README:1.1.1.1 Wed Apr 27 03:36:31 1994 +++ xc/util/memleak/README Tue Jan 16 18:41:15 2001 @@ -1,4 +1,4 @@ -.\" $XConsortium: README,v 1.3 92/05/15 14:04:04 keith Exp $ +.\" $Xorg: README,v 1.3 2000/08/17 19:55:19 cpqbld Exp $ This library replaces the C library allocator; providing malloc, free, realloc and calloc (sorry, no valloc) Index: xc/util/memleak/find-rtns.sh diff -u xc/util/memleak/find-rtns.sh:1.1.1.2 xc/util/memleak/find-rtns.sh:1.2 --- xc/util/memleak/find-rtns.sh:1.1.1.2 Sun Sep 27 05:12:16 1998 +++ xc/util/memleak/find-rtns.sh Fri Feb 16 08:24:10 2001 @@ -1,28 +1,45 @@ #!/bin/sh # -# $TOG: find-rtns.sh /main/2 1998/02/09 11:39:44 kaleb $ +# $Xorg: find-rtns.sh,v 1.3 2000/08/17 19:55:19 cpqbld Exp $ # # find-routines - convert leak tracer stack traces into file/lineno traces -# using a modified version of gdb-4.4 +# modified to work with the an unmodified version of +# gdb-4.18 # # Usage: find-routines {leak-tracing-output-files} # + TMP1=find-routine.tmp1 TMP=find-routine.tmp trap "rm -f $TMP $TMP1" 0 OBJ=$1 shift -grep 'return stack:' $* | +echo 'set width 500' > $TMP1 +for i in `grep '\(return stack:\)\|\(allocated at\)' $* | tr ' ' '\012' | - grep 0x | sort -u | sed 's;^;x/i ;' | - gdb $OBJ | grep '>:' | - sed 's/>.*$/>/' | sed 's/(gdb) //' > $TMP1 + grep 0x | sort -u`; + do + echo 'x/i '$i >> $TMP1 + echo 'i line * '$i >> $TMP1 +done -awk '/^"/ { printf("s;%s;%s line %s %s;\n", $4, $1, $3, $5) } -/^0/ { printf("s;%s;%s %s;\n", $1, $2, $1);}' $TMP1 > $TMP +cat $TMP1 | gdb $OBJ \ + | awk '\ + /^\(gdb\) \(?g?d?b?\)? ?0x[[:xdigit:]]*.*:.*/ \ + {a = gensub(/^\(gdb\) \(?g?d?b?\)? ?(0x[[:xdigit:]]*).*:.*/,"\\1","G");\ + b = gensub(/^\(gdb\) \(?g?d?b?\)? ?(0x[[:xdigit:]]*.*):.*/,"\\1","G");\ + printf("s;%s;%s",a,b); next; } \ + /.*No line.*/ \ + {printf(";\n",a);next} \ + /.*Line [[:digit:]]+.*/ \ + {a = gensub(/.*(Line [[:digit:]]+ of .*) starts.*/,"\\1","G"); \ + printf(" at %s;\n", a); next}'>> $TMP awk '/return stack/ { printf ("return stack\n"); for (i = 3; i <= NF; i++) printf ("\troutine %s\n", $i); } + /allocated at/ { printf ("allocated at\n"); + for (i = 3; i <= NF; i++) + printf ("\t\troutine %s\n", $i); } /^[A-Z]/ { print }' $* | sed -f $TMP Index: xc/util/memleak/fmalloc.c diff -u xc/util/memleak/fmalloc.c:3.10 xc/util/memleak/fmalloc.c:3.12 --- xc/util/memleak/fmalloc.c:3.10 Fri Dec 8 16:43:22 2000 +++ xc/util/memleak/fmalloc.c Fri Feb 16 08:24:10 2001 @@ -1,5 +1,5 @@ /* - * $TOG: fmalloc.c /main/8 1998/02/09 11:39:50 kaleb $ + * $Xorg: fmalloc.c,v 1.4 2000/08/17 19:55:20 cpqbld Exp $ * Copyright 1992, 1998 The Open Group @@ -22,7 +22,7 @@ * Author: Keith Packard, MIT X Consortium */ -/* $XFree86: xc/util/memleak/fmalloc.c,v 3.10 2000/12/08 21:43:22 keithp Exp $ */ +/* $XFree86: xc/util/memleak/fmalloc.c,v 3.12 2001/02/16 13:24:10 eich Exp $ */ /* @@ -91,6 +91,7 @@ mem returnStack[MAX_RETURN_STACK]; #endif mem *from; + mem *fromReturnStack; unsigned long allocTime; unsigned long freeTime; int size; @@ -190,10 +191,16 @@ if (h) { - fprintf (stderr, "%s 0x%08lx (size %d) (from 0x%lx)\n", + fprintf (stderr, "%s 0x%08lx (size %d) (from 0x%lx) ", s, DataForHead(h), h->desiredsize, h->from); #ifdef HAS_GET_RETURN_ADDRESS + if (h->fromReturnStack) + PrintReturnStack ("\nallocated at", h->fromReturnStack); + else + fprintf(stderr,"\n"); PrintReturnStack ("Saved return stack", h->returnStack); +#else + fprintf(stderr,"\n"); #endif } else @@ -228,7 +235,7 @@ MarkActiveBlock (p, from) mem *p, *from; { - HeadPtr h; + HeadPtr h, hh; int marked; int oldMarked; @@ -242,6 +249,11 @@ { h->marked |= marked; h->from = from; +#ifdef HAS_GET_RETURN_ADDRESS + SEARCH(activeMemory, hh, h->from) + if (hh) + h->fromReturnStack = hh->returnStack; +#endif if (!oldMarked) MarkMemoryRegion (DataForHead(h), (mem *) TailForHead(h)); } @@ -257,6 +269,11 @@ { h->marked |= marked; h->from = from; +#ifdef HAS_GET_RETURN_ADDRESS + SEARCH(activeMemory, hh, h->from) + if (hh) + h->fromReturnStack = hh->returnStack; +#endif } return; } @@ -468,7 +485,49 @@ if (freedMemoryTotal - deadMemoryTotal >= MAX_FREED_MEMORY) CheckMemory (); } +#if 0 +static void +WarnReferencedRange(rangeStart,rangeEnd,from,to) + mem *rangeStart; + mem *rangeEnd; + mem *from; + mem *to; +{ + mem *range = rangeStart; + while ( range < rangeEnd) { + if ((mem *)*range >= from && (mem *)*range <= to) + fprintf(stderr, "0x%lx still points into newly allocated range\n", + (unsigned long) range); + range++; + } +} + +static void +WarnReferencedTree(head, from, to) + tree *head; + char *from; + char *to; +{ + if (!head) return; + WarnReferencedTree(head->right,from,to); + WarnReferencedRange(DataForHead(head),TailForHead(head),from,to); + WarnReferencedTree(head->left,from,to); +} + +static void +WarnReferenced(from, to) + char *from; + char *to; +{ + mem foo; + + foo = 1; + WarnReferencedTree(activeMemory,from,to); + WarnReferencedRange(BOTTOM_OF_DATA, endOfStaticMemory,from,to); + WarnReferencedRange(&foo, TOP_OF_STACK,from,to); +} +#endif /* * Entry points: * @@ -486,6 +545,8 @@ foo = 1; fprintf (stderr, "\nCheckMemory\n"); + fprintf (stderr, "Static Memory Area: 0x%lx to 0x%lx\n", + BOTTOM_OF_DATA, endOfStaticMemory); fprintf (stderr, "%d bytes active memory in %d allocations\n", activeMemoryTotal, activeMemoryCount); fprintf (stderr, "%d bytes freed memory held from %d allocations\n", Index: xc/util/memleak/ftest.c diff -u xc/util/memleak/ftest.c:1.1.1.2 xc/util/memleak/ftest.c:1.2 --- xc/util/memleak/ftest.c:1.1.1.2 Sun Sep 27 05:12:17 1998 +++ xc/util/memleak/ftest.c Fri Feb 16 08:24:10 2001 @@ -1,5 +1,5 @@ /* - * $TOG: ftest.c /main/5 1998/02/09 11:39:56 kaleb $ + * $Xorg: ftest.c,v 1.3 2000/08/17 19:55:20 cpqbld Exp $ * Copyright 1992, 1998 The Open Group @@ -22,7 +22,7 @@ * Author: Keith Packard, MIT X Consortium */ -static char *foo, *bar, *bletch; +static char *foo, *bar, *bletch, *snarf; static char *glorf[100]; extern char *malloc (); @@ -34,12 +34,14 @@ foo = malloc (1000); bar = malloc (2000); bletch = malloc (3000); + snarf = malloc(1000); for (i = 0; i < 100; i++) glorf[i] = malloc (i * 200); for (i = 0; i < 100; i++) { free (glorf[i]); glorf[i] = 0; } + *(char **)snarf = bletch; free (foo); free (bletch); bletch = 0; Index: xc/util/memleak/getreti386.c diff -u xc/util/memleak/getreti386.c:3.4 xc/util/memleak/getreti386.c:3.5 --- xc/util/memleak/getreti386.c:3.4 Fri Dec 8 16:44:05 2000 +++ xc/util/memleak/getreti386.c Fri Feb 16 08:24:10 2001 @@ -4,7 +4,7 @@ * Copyright (c) 1995 Jeffrey Hsu */ -/* $XFree86: xc/util/memleak/getreti386.c,v 3.4 2000/12/08 21:44:05 keithp Exp $ */ +/* $XFree86: xc/util/memleak/getreti386.c,v 3.5 2001/02/16 13:24:10 eich Exp $ */ #define get_current_fp(first_local) ((unsigned)&(first_local) + 4) #define prev_fp_from_fp(fp) *((unsigned *) fp) @@ -17,7 +17,7 @@ #define CRT0_ADDRESS 0x109a #endif #ifdef linux -#define CRT0_ADDRESS 0x804a3d0 +#define CRT0_ADDRESS 0x80482fc #endif static unsigned long Index: xc/util/memleak/getretmips.c diff -u xc/util/memleak/getretmips.c:1.1.1.2 xc/util/memleak/getretmips.c:1.1.1.3 --- xc/util/memleak/getretmips.c:1.1.1.2 Sun Sep 27 05:12:17 1998 +++ xc/util/memleak/getretmips.c Tue Jan 16 18:41:20 2001 @@ -1,5 +1,5 @@ /* - * $TOG: getretmips.c /main/5 1998/02/09 11:40:00 kaleb $ + * $Xorg: getretmips.c,v 1.3 2000/08/17 19:55:20 cpqbld Exp $ * Copyright 1992, 1998 The Open Group Index: xc/util/memleak/getretspar.c diff -u xc/util/memleak/getretspar.c:1.1.1.2 xc/util/memleak/getretspar.c:1.1.1.3 --- xc/util/memleak/getretspar.c:1.1.1.2 Sun Sep 27 05:12:18 1998 +++ xc/util/memleak/getretspar.c Tue Jan 16 18:41:21 2001 @@ -1,5 +1,5 @@ /* - * $TOG: getretspar.c /main/3 1998/02/09 11:40:04 kaleb $ + * $Xorg: getretspar.c,v 1.3 2000/08/17 19:55:20 cpqbld Exp $ * Copyright 1992, 1998 The Open Group Index: xc/util/memleak/getrettest.c diff -u xc/util/memleak/getrettest.c:1.1.1.3 xc/util/memleak/getrettest.c:1.1.1.4 --- xc/util/memleak/getrettest.c:1.1.1.3 Sun Sep 27 05:12:19 1998 +++ xc/util/memleak/getrettest.c Tue Jan 16 18:41:22 2001 @@ -1,5 +1,5 @@ /* - * $TOG: getrettest.c /main/5 1998/02/09 11:40:08 kaleb $ + * $Xorg: getrettest.c,v 1.3 2000/08/17 19:55:20 cpqbld Exp $ * Copyright 1992, 1998 The Open Group Index: xc/util/memleak/mipsstack.s diff -u xc/util/memleak/mipsstack.s:1.1.1.2 xc/util/memleak/mipsstack.s:1.1.1.3 --- xc/util/memleak/mipsstack.s:1.1.1.2 Sun Sep 27 05:12:19 1998 +++ xc/util/memleak/mipsstack.s Tue Jan 16 18:41:23 2001 @@ -1,5 +1,5 @@ /* - * $TOG: mipsstack.s /main/4 1998/02/09 11:40:17 kaleb $ + * $Xorg: mipsstack.s,v 1.3 2000/08/17 19:55:20 cpqbld Exp $ * Copyright 1992, 1998 The Open Group Index: xc/util/memleak/sparcsolstack.s diff -u xc/util/memleak/sparcsolstack.s:1.1.1.1 xc/util/memleak/sparcsolstack.s:1.1.1.2 --- xc/util/memleak/sparcsolstack.s:1.1.1.1 Wed Apr 27 03:36:31 1994 +++ xc/util/memleak/sparcsolstack.s Tue Jan 16 18:41:24 2001 @@ -1,4 +1,4 @@ -! $XConsortium: sparcsolstack.s,v 1.1 93/12/03 09:26:24 kaleb Exp $ +! $Xorg: sparcsolstack.s,v 1.3 2000/08/17 19:55:20 cpqbld Exp $ .seg "text" .proc 16 .globl getStackPointer Index: xc/util/memleak/sparcstack.s diff -u xc/util/memleak/sparcstack.s:1.1.1.1 xc/util/memleak/sparcstack.s:1.1.1.2 --- xc/util/memleak/sparcstack.s:1.1.1.1 Wed Apr 27 03:36:31 1994 +++ xc/util/memleak/sparcstack.s Tue Jan 16 18:41:25 2001 @@ -1,4 +1,4 @@ -# $XConsortium: sparcstack.s,v 1.2 92/04/08 17:19:18 keith Exp $ +# $Xorg: sparcstack.s,v 1.3 2000/08/17 19:55:20 cpqbld Exp $ .seg "text" .proc 16 .globl _getStackPointer Index: xc/util/misc/dlsym.c diff -u xc/util/misc/dlsym.c:1.1.1.1 xc/util/misc/dlsym.c:1.1.1.2 --- xc/util/misc/dlsym.c:1.1.1.1 Wed Apr 27 03:36:29 1994 +++ xc/util/misc/dlsym.c Tue Jan 16 18:41:27 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: dlsym.c,v 1.1 93/12/06 16:24:15 kaleb Exp $ */ +/* $Xorg: dlsym.c,v 1.3 2000/08/17 19:55:21 cpqbld Exp $ */ /* * Stub interface to dynamic linker routines * that SunOS uses but didn't ship with 4.1. Index: xc/util/misc/rt.stdarg.h diff -u xc/util/misc/rt.stdarg.h:1.1.1.1 xc/util/misc/rt.stdarg.h:1.1.1.2 --- xc/util/misc/rt.stdarg.h:1.1.1.1 Wed Apr 27 03:36:29 1994 +++ xc/util/misc/rt.stdarg.h Tue Jan 16 18:41:27 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: rt.stdarg.h,v 1.1 93/12/06 16:24:27 kaleb Exp $ */ +/* $Xorg: rt.stdarg.h,v 1.3 2000/08/17 19:55:21 cpqbld Exp $ */ #ifndef _STDARG_H #define _STDARG_H typedef int *va_list; Index: xc/util/misc/thr_stubs.c diff -u xc/util/misc/thr_stubs.c:1.1.1.1 xc/util/misc/thr_stubs.c:1.1.1.2 --- xc/util/misc/thr_stubs.c:1.1.1.1 Wed Apr 27 03:36:29 1994 +++ xc/util/misc/thr_stubs.c Tue Jan 16 18:41:28 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: thr_stubs.c,v 1.3 94/01/13 13:59:50 kaleb Exp $ */ +/* $Xorg: thr_stubs.c,v 1.3 2000/08/17 19:55:21 cpqbld Exp $ */ /* * Stub interface to thread routines that Solaris needs but shipped * broken/buggy versions in 5.2 and 5.3 Index: xc/util/patch/Configure diff -u xc/util/patch/Configure:1.1.1.2 xc/util/patch/Configure:1.1.1.3 --- xc/util/patch/Configure:1.1.1.2 Wed Jan 3 03:18:34 1996 +++ xc/util/patch/Configure Tue Jan 16 18:41:29 2001 @@ -9,7 +9,7 @@ # of config.h for certain machines, so you might look for one of those.) # # oldHeader: Head.U,v 1.0 87/05/22 12:28:10 lwall Exp $ -# $XConsortium: Configure,v 1.1 94/09/09 20:04:01 gildea Exp $ +# $Xorg: Configure,v 1.3 2000/08/17 19:55:21 cpqbld Exp $ # # Yes, you may rip this off to use in other distribution packages. # (Note: this Configure script was generated automatically. Rather than Index: xc/util/patch/EXTERN.h diff -u xc/util/patch/EXTERN.h:1.1.1.2 xc/util/patch/EXTERN.h:1.1.1.3 --- xc/util/patch/EXTERN.h:1.1.1.2 Wed Jan 3 03:18:35 1996 +++ xc/util/patch/EXTERN.h Tue Jan 16 18:41:30 2001 @@ -1,5 +1,5 @@ /* oldHeader: EXTERN.h,v 2.0 86/09/17 15:35:37 lwall Exp $ - * $XConsortium: EXTERN.h,v 2.1 94/09/09 20:04:44 gildea Exp $ + * $Xorg: EXTERN.h,v 1.3 2000/08/17 19:55:21 cpqbld Exp $ * * Revision 2.0 86/09/17 15:35:37 lwall * Baseline for netwide release. Index: xc/util/patch/INTERN.h diff -u xc/util/patch/INTERN.h:1.1.1.2 xc/util/patch/INTERN.h:1.1.1.3 --- xc/util/patch/INTERN.h:1.1.1.2 Wed Jan 3 03:18:37 1996 +++ xc/util/patch/INTERN.h Tue Jan 16 18:41:31 2001 @@ -1,5 +1,5 @@ /* oldHeader: INTERN.h,v 2.0 86/09/17 15:35:58 lwall Exp $ - * $XConsortium: INTERN.h,v 2.1 94/09/09 20:08:54 gildea Exp $ + * $Xorg: INTERN.h,v 1.3 2000/08/17 19:55:21 cpqbld Exp $ * * Revision 2.0 86/09/17 15:35:58 lwall * Baseline for netwide release. Index: xc/util/patch/Makefile.SH diff -u xc/util/patch/Makefile.SH:1.1.1.2 xc/util/patch/Makefile.SH:1.1.1.3 --- xc/util/patch/Makefile.SH:1.1.1.2 Wed Jan 3 03:18:38 1996 +++ xc/util/patch/Makefile.SH Tue Jan 16 18:41:32 2001 @@ -4,7 +4,7 @@ echo "Extracting Makefile (with variable substitutions)" cat >Makefile <. Some algorithms adapted from GNU Emacs. */ Index: xc/util/patch/common.h diff -u xc/util/patch/common.h:3.0 xc/util/patch/common.h:3.1 --- xc/util/patch/common.h:3.0 Sun Sep 29 09:49:49 1996 +++ xc/util/patch/common.h Wed Jan 17 18:20:07 2001 @@ -1,5 +1,5 @@ /* oldHeader: common.h,v 2.0.1.2 88/06/22 20:44:53 lwall Locked $ - * $XConsortium: common.h,v 3.3 94/09/14 21:13:08 gildea Exp $ + * $Xorg: common.h,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ * * Revision 2.0.1.2 88/06/22 20:44:53 lwall * patch12: sprintf was declared wrong Index: xc/util/patch/config.h.nt diff -u xc/util/patch/config.h.nt:3.0 xc/util/patch/config.h.nt:3.1 --- xc/util/patch/config.h.nt:3.0 Fri Jan 5 08:24:31 1996 +++ xc/util/patch/config.h.nt Wed Jan 17 18:20:07 2001 @@ -1,5 +1,5 @@ -/* $XConsortium: config.h.nt,v 1.1 94/09/09 20:26:16 kaleb Exp $ */ +/* $Xorg: config.h.nt,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ */ /* Portability variables. -*- C -*- */ Index: xc/util/patch/inp.c diff -u xc/util/patch/inp.c:1.1.1.2 xc/util/patch/inp.c:1.1.1.3 --- xc/util/patch/inp.c:1.1.1.2 Wed Jan 3 03:18:44 1996 +++ xc/util/patch/inp.c Tue Jan 16 18:41:40 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: inp.c,v 3.4 94/09/14 21:18:35 gildea Exp $ +/* $Xorg: inp.c,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ * * Revision 3.1 94/03/29 13:39:15 gildea * check that a patch that creates a file has not already been applied. Index: xc/util/patch/inp.h diff -u xc/util/patch/inp.h:1.1.1.2 xc/util/patch/inp.h:1.1.1.3 --- xc/util/patch/inp.h:1.1.1.2 Wed Jan 3 03:18:45 1996 +++ xc/util/patch/inp.h Tue Jan 16 18:41:41 2001 @@ -1,5 +1,5 @@ /* oldHeader: inp.h,v 2.0 86/09/17 15:37:25 lwall Exp $ - * $XConsortium: inp.h,v 2.1 94/09/09 20:04:28 gildea Exp $ + * $Xorg: inp.h,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ * * Revision 2.0 86/09/17 15:37:25 lwall * Baseline for netwide release. Index: xc/util/patch/patch.c diff -u xc/util/patch/patch.c:1.1.1.2 xc/util/patch/patch.c:1.1.1.3 --- xc/util/patch/patch.c:1.1.1.2 Wed Jan 3 03:18:47 1996 +++ xc/util/patch/patch.c Tue Jan 16 18:41:42 2001 @@ -1,5 +1,5 @@ char rcsid[] = - "$XConsortium: patch.c,v 3.3 94/09/14 21:21:33 gildea Exp $"; + "$Xorg: patch.c,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ /* "oldHeader: patch.c,v 2.0.2.0 90/05/01 22:17:50 davison Locked $"; */ /* patch - a program to apply diffs to original files Index: xc/util/patch/patch.man diff -u xc/util/patch/patch.man:1.1.1.2 xc/util/patch/patch.man:1.2 --- xc/util/patch/patch.man:1.1.1.2 Wed Jan 3 03:18:48 1996 +++ xc/util/patch/patch.man Wed Feb 7 17:35:23 2001 @@ -1,6 +1,6 @@ .\" -*- nroff -*- .rn '' }` -'\" $XConsortium: patch.man,v 1.2 94/09/09 20:04:28 gildea Exp $ +'\" $Xorg: patch.man,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ '\" '\" Revision 2.0.1.2 88/06/22 20:47:18 lwall '\" patch12: now avoids Bell System Logo @@ -33,6 +33,7 @@ '\" Revision 1.2 84/12/04 17:22:02 lwall '\" Baseline version. '\" +'\" $XFree86: xc/util/patch/patch.man,v 1.2 2001/02/07 22:35:23 tsi Exp $ .de Sh .br .ne 5 @@ -539,7 +540,7 @@ swapped code, but that would take an extra pass. .PP If code has been duplicated (for instance with #ifdef OLDCODE ... #else ... -#endif), +\&#endif), .I patch is incapable of patching both versions, and, if it works at all, will likely patch the wrong one, and tell you that it succeeded to boot. Index: xc/util/patch/patchlevel.h diff -u xc/util/patch/patchlevel.h:1.1.1.2 xc/util/patch/patchlevel.h:1.1.1.3 --- xc/util/patch/patchlevel.h:1.1.1.2 Wed Jan 3 03:18:50 1996 +++ xc/util/patch/patchlevel.h Tue Jan 16 18:41:44 2001 @@ -1,2 +1,2 @@ -/* $XConsortium: patchlevel.h,v 3.2 94/09/14 21:31:55 gildea Exp $ */ +/* $Xorg: patchlevel.h,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ */ #define PATCHLEVEL "12u9.XC2" Index: xc/util/patch/pch.c diff -u xc/util/patch/pch.c:3.1 xc/util/patch/pch.c:3.2 --- xc/util/patch/pch.c:3.1 Sun Sep 29 09:49:51 1996 +++ xc/util/patch/pch.c Wed Jan 17 18:20:07 2001 @@ -1,5 +1,5 @@ /* oldHeader: pch.c,v 2.0.1.7 88/06/03 15:13:28 lwall Locked $ - * $XConsortium: pch.c,v 3.3 94/09/14 21:22:55 gildea Exp $ +/* $Xorg: pch.c,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ * * Revision 2.0.2.0 90/05/01 22:17:51 davison * patch12u: unidiff support added Index: xc/util/patch/pch.h diff -u xc/util/patch/pch.h:1.1.1.2 xc/util/patch/pch.h:1.1.1.3 --- xc/util/patch/pch.h:1.1.1.2 Wed Jan 3 03:18:52 1996 +++ xc/util/patch/pch.h Tue Jan 16 18:41:46 2001 @@ -1,5 +1,5 @@ /* oldHeader: pch.h,v 2.0.1.1 87/01/30 22:47:16 lwall Exp $ - * $XConsortium: pch.h,v 3.3 94/09/14 21:24:15 gildea Exp $ + * $Xorg: pch.h,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ * * Revision 2.0.1.1 87/01/30 22:47:16 lwall * Added do_ed_script(). Index: xc/util/patch/util.c diff -u xc/util/patch/util.c:3.0 xc/util/patch/util.c:3.1 --- xc/util/patch/util.c:3.0 Sun Sep 29 09:49:52 1996 +++ xc/util/patch/util.c Wed Jan 17 18:20:07 2001 @@ -1,4 +1,4 @@ -/* $XConsortium: util.c,v 3.3 94/09/14 21:26:09 gildea Exp $ */ +/* $Xorg: util.c,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ */ #define const /*nothing*/ Index: xc/util/patch/util.h diff -u xc/util/patch/util.h:1.1.1.2 xc/util/patch/util.h:1.1.1.3 --- xc/util/patch/util.h:1.1.1.2 Wed Jan 3 03:18:55 1996 +++ xc/util/patch/util.h Tue Jan 16 18:41:49 2001 @@ -1,5 +1,5 @@ /* oldHeader: util.h,v 2.0 86/09/17 15:40:06 lwall Exp $ - * $XConsortium: util.h,v 2.1 94/09/09 20:04:28 gildea Exp $ + * $Xorg: util.h,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ * * Revision 2.0 86/09/17 15:40:06 lwall * Baseline for netwide release. Index: xc/util/patch/version.c diff -u xc/util/patch/version.c:1.1.1.2 xc/util/patch/version.c:1.1.1.3 --- xc/util/patch/version.c:1.1.1.2 Wed Jan 3 03:18:56 1996 +++ xc/util/patch/version.c Tue Jan 16 18:41:50 2001 @@ -1,5 +1,5 @@ /* oldHeader: version.c,v 2.0 86/09/17 15:40:11 lwall Exp $ - * $XConsortium: version.c,v 2.1 94/09/09 20:04:28 gildea Exp $ + * $Xorg: version.c,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ * * Revision 2.0 86/09/17 15:40:11 lwall * Baseline for netwide release. Index: xc/util/patch/version.h diff -u xc/util/patch/version.h:1.1.1.2 xc/util/patch/version.h:1.1.1.3 --- xc/util/patch/version.h:1.1.1.2 Wed Jan 3 03:18:57 1996 +++ xc/util/patch/version.h Tue Jan 16 18:41:52 2001 @@ -1,5 +1,5 @@ /* oldHeader: version.h,v 2.0 86/09/17 15:40:14 lwall Exp $ - * $XConsortium: version.h,v 2.1 94/09/09 20:04:28 gildea Exp $ + * $Xorg: version.h,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ * * Revision 2.0 86/09/17 15:40:14 lwall * Baseline for netwide release. Index: xc/util/patch/winnt.h diff -u xc/util/patch/winnt.h:3.0 xc/util/patch/winnt.h:3.1 --- xc/util/patch/winnt.h:3.0 Fri Jan 5 08:24:33 1996 +++ xc/util/patch/winnt.h Wed Jan 17 18:20:07 2001 @@ -1,5 +1,5 @@ -/* $XConsortium: winnt.h,v 1.1 94/09/09 20:27:49 kaleb Exp $ */ +/* $Xorg: winnt.h,v 1.3 2000/08/17 19:55:22 cpqbld Exp $ */ #define stat _stat